blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
d5fb5953da24e2d0577d51fd0edee02e6d6886e5
4f55aaeaf9e9b6bbedaa6d6ef8e39f0c60a65af0
/src/java/controllers/EditHallController.java
ffaf6fb80428dd51cf76663f7b20c9c97142f05a
[]
no_license
tanbinh123/Sound-and-Stage-Entertainment-Project
b45e81795a82b8d3cf88c0b8f13b78ad7db97f79
69bba3522a49fb9577c3be24c93ea1c98a570065
refs/heads/master
2022-02-17T03:55:11.652678
2018-07-09T17:19:13
2018-07-09T17:19:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,976
java
package controllers; import java.io.IOException; import java.io.PrintWriter; 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 models.HallModel; @WebServlet(name = "EditHallController", urlPatterns = {"/EditHallController"}) public class EditHallController extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet EditHallController</title>"); out.println("</head>"); out.println("<body>"); //out.println("<h1>Servlet EditHallController at " + request.getContextPath() + "</h1>"); int hcode = Integer.parseInt(request.getParameter("txthcode")); String hname = request.getParameter("txthallname"); HallModel obh= new HallModel(); obh.setHallname(hname); obh.modifyHallNameByHallCode(hcode); response.sendRedirect("admin/NewHall1.jsp"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "vikytripathi@outlook.com" ]
vikytripathi@outlook.com
a41c35beed1aedbdf7105fc48ded9b37c7206032
4fbc6259543cf8d03dc12e002b2b7535e4f2e3cb
/AndroidJogQuest/app/src/main/java/org/zeromq/SocketType.java
ac533f4bcb9eee3f6070bc9b93e8a6381c633dc2
[]
no_license
Heappl/sii-hct
d49954dd55c05317a7a8bb1f55f25839778efa4c
1a969ca35858fe81bd9887f795a62eb02dfa5eee
refs/heads/master
2020-04-07T02:29:34.439391
2018-11-18T06:59:14
2018-11-18T06:59:14
157,978,746
0
1
null
null
null
null
UTF-8
Java
false
false
17,768
java
package org.zeromq; import zmq.ZMQ; /** * Socket Type enumeration * * @author Isa Hekmatizadeh */ public enum SocketType { /** * Flag to specify a exclusive pair of sockets. * <p> * A socket of type PAIR can only be connected to a single peer at any one time. * <br> * No message routing or filtering is performed on messages sent over a PAIR socket. * <br> * When a PAIR socket enters the mute state due to having reached the high water mark for the connected peer, * or if no peer is connected, then any send() operations on the socket shall block until the peer becomes available for sending; * messages are not discarded. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>PAIR</td></tr> * <tr><td>Direction</td><td>Bidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Unrestricted</td></tr> * <tr><td>Incoming routing strategy</td><td>N/A</td></tr> * <tr><td>Outgoing routing strategy</td><td>N/A</td></tr> * <tr><td>Action in mute state</td><td>Block</td></tr> * </table> * <p> * <strong>PAIR sockets are designed for inter-thread communication across the inproc transport * and do not implement functionality such as auto-reconnection. * PAIR sockets are considered experimental and may have other missing or broken aspects.</strong> */ PAIR(ZMQ.ZMQ_PAIR), /** * Flag to specify a PUB socket, receiving side must be a SUB or XSUB. * <p> * A socket of type PUB is used by a publisher to distribute data. * <br> * Messages sent are distributed in a fan out fashion to all connected peers. * <br> * The {@link org.zeromq.ZMQ.Socket#recv()} function is not implemented for this socket type. * <br> * When a PUB socket enters the mute state due to having reached the high water mark for a subscriber, * then any messages that would be sent to the subscriber in question shall instead be dropped until the mute state ends. * <br> * The send methods shall never block for this socket type. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#SUB}, {@link org.zeromq.ZMQ#XSUB}</td></tr> * <tr><td>Direction</td><td>Unidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Send only</td></tr> * <tr><td>Incoming routing strategy</td><td>N/A</td></tr> * <tr><td>Outgoing routing strategy</td><td>Fan out</td></tr> * <tr><td>Action in mute state</td><td>Drop</td></tr> * </table> */ PUB(ZMQ.ZMQ_PUB), /** * Flag to specify the receiving part of the PUB or XPUB socket. * <p> * A socket of type SUB is used by a subscriber to subscribe to data distributed by a publisher. * <br> * Initially a SUB socket is not subscribed to any messages, * use the {@link org.zeromq.ZMQ.Socket#subscribe(byte[])} option to specify which messages to subscribe to. * <br> * The send methods are not implemented for this socket type. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#PUB}, {@link org.zeromq.ZMQ#XPUB}</td></tr> * <tr><td>Direction</td><td>Unidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Receive only</td></tr> * <tr><td>Incoming routing strategy</td><td>Fair-queued</td></tr> * <tr><td>Outgoing routing strategy</td><td>N/A</td></tr> * </table> */ SUB(ZMQ.ZMQ_SUB), /** * Flag to specify a REQ socket, receiving side must be a REP or ROUTER. * <p> * A socket of type REQ is used by a client to send requests to and receive replies from a service. * <br> * This socket type allows only an alternating sequence of send(request) and subsequent recv(reply) calls. * <br> * Each request sent is round-robined among all services, and each reply received is matched with the last issued request. * <br> * If no services are available, then any send operation on the socket shall block until at least one service becomes available. * <br> * The REQ socket shall not discard messages. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#REP}, {@link org.zeromq.ZMQ#ROUTER}</td></tr> * <tr><td>Direction</td><td>Bidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Send, Receive, Send, Receive, ...</td></tr> * <tr><td>Incoming routing strategy</td><td>Last peer</td></tr> * <tr><td>Outgoing routing strategy</td><td>Round-robin</td></tr> * <tr><td>Action in mute state</td><td>Block</td></tr> * </table> */ REQ(ZMQ.ZMQ_REQ), /** * Flag to specify the receiving part of a REQ or DEALER socket. * <p> * A socket of type REP is used by a service to receive requests from and send replies to a client. * <br> * This socket type allows only an alternating sequence of recv(request) and subsequent send(reply) calls. * <br> * Each request received is fair-queued from among all clients, and each reply sent is routed to the client that issued the last request. * <br> * If the original requester does not exist any more the reply is silently discarded. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#REQ}, {@link org.zeromq.ZMQ#DEALER}</td></tr> * <tr><td>Direction</td><td>Bidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Receive, Send, Receive, Send, ...</td></tr> * <tr><td>Incoming routing strategy</td><td>Fair-queued</td></tr> * <tr><td>Outgoing routing strategy</td><td>Last peer</td></tr> * </table> */ REP(ZMQ.ZMQ_REP), /** * Flag to specify a DEALER socket (aka XREQ). * <p> * DEALER is really a combined ventilator / sink * that does load-balancing on output and fair-queuing on input * with no other semantics. It is the only socket type that lets * you shuffle messages out to N nodes and shuffle the replies * back, in a raw bidirectional asynch pattern. * <p> * A socket of type DEALER is an advanced pattern used for extending request/reply sockets. * <br> * Each message sent is round-robined among all connected peers, and each message received is fair-queued from all connected peers. * <br> * When a DEALER socket enters the mute state due to having reached the high water mark for all peers, * or if there are no peers at all, then any send() operations on the socket shall block * until the mute state ends or at least one peer becomes available for sending; messages are not discarded. * <br> * When a DEALER socket is connected to a {@link org.zeromq.ZMQ#REP} socket each message sent must consist of an empty message part, the delimiter, followed by one or more body parts. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#ROUTER}, {@link org.zeromq.ZMQ#REP}, {@link org.zeromq.ZMQ#DEALER}</td></tr> * <tr><td>Direction</td><td>Bidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Unrestricted</td></tr> * <tr><td>Incoming routing strategy</td><td>Fair-queued</td></tr> * <tr><td>Outgoing routing strategy</td><td>Round-robin</td></tr> * <tr><td>Action in mute state</td><td>Block</td></tr> * </table> */ DEALER(ZMQ.ZMQ_DEALER), /** * Flag to specify ROUTER socket (aka XREP). * <p> * ROUTER is the socket that creates and consumes request-reply * routing envelopes. It is the only socket type that lets you route * messages to specific connections if you know their identities. * <p> * A socket of type ROUTER is an advanced socket type used for extending request/reply sockets. * <p> * When receiving messages a ROUTER socket shall prepend a message part containing the identity * of the originating peer to the message before passing it to the application. * <br> * Messages received are fair-queued from among all connected peers. * <p> * When sending messages a ROUTER socket shall remove the first part of the message * and use it to determine the identity of the peer the message shall be routed to. * If the peer does not exist anymore the message shall be silently discarded by default, * unless {@link org.zeromq.ZMQ.Socket#setRouterMandatory(boolean)} socket option is set to true. * <p> * When a ROUTER socket enters the mute state due to having reached the high water mark for all peers, * then any messages sent to the socket shall be dropped until the mute state ends. * <br> * Likewise, any messages routed to a peer for which the individual high water mark has been reached shall also be dropped, * , unless {@link org.zeromq.ZMQ.Socket#setRouterMandatory(boolean)} socket option is set to true. * <p> * When a {@link org.zeromq.ZMQ#REQ} socket is connected to a ROUTER socket, in addition to the identity of the originating peer * each message received shall contain an empty delimiter message part. * <br> * Hence, the entire structure of each received message as seen by the application becomes: * one or more identity parts, * delimiter part, * one or more body parts. * <p> * When sending replies to a REQ socket the application must include the delimiter part. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#DEALER}, {@link org.zeromq.ZMQ#REQ}, {@link org.zeromq.ZMQ#ROUTER}</td></tr> * <tr><td>Direction</td><td>Bidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Unrestricted</td></tr> * <tr><td>Incoming routing strategy</td><td>Fair-queued</td></tr> * <tr><td>Outgoing routing strategy</td><td>See text</td></tr> * <tr><td>Action in mute state</td><td>Drop (See text)</td></tr> * </table> */ ROUTER(ZMQ.ZMQ_ROUTER), /** * Flag to specify the receiving part of a PUSH socket. * <p> * A socket of type ZMQ_PULL is used by a pipeline node to receive messages from upstream pipeline nodes. * <br> * Messages are fair-queued from among all connected upstream nodes. * <br> * The send() function is not implemented for this socket type. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#PUSH}</td></tr> * <tr><td>Direction</td><td>Unidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Receive only</td></tr> * <tr><td>Incoming routing strategy</td><td>Fair-queued</td></tr> * <tr><td>Outgoing routing strategy</td><td>N/A</td></tr> * <tr><td>Action in mute state</td><td>Block</td></tr> * </table> */ PULL(ZMQ.ZMQ_PULL), /** * Flag to specify a PUSH socket, receiving side must be a PULL. * <p> * A socket of type PUSH is used by a pipeline node to send messages to downstream pipeline nodes. * <br> * Messages are round-robined to all connected downstream nodes. * <br> * The recv() function is not implemented for this socket type. * <br> * When a PUSH socket enters the mute state due to having reached the high water mark for all downstream nodes, * or if there are no downstream nodes at all, then any send() operations on the socket shall block until the mute state ends * or at least one downstream node becomes available for sending; messages are not discarded. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#PULL}</td></tr> * <tr><td>Direction</td><td>Unidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Send only</td></tr> * <tr><td>Incoming routing strategy</td><td>N/A</td></tr> * <tr><td>Outgoing routing strategy</td><td>Round-robin</td></tr> * <tr><td>Action in mute state</td><td>Block</td></tr> * </table> */ PUSH(ZMQ.ZMQ_PUSH), /** * Flag to specify a XPUB socket, receiving side must be a SUB or XSUB. * <p> * Subscriptions can be received as a message. Subscriptions start with * a '1' byte. Unsubscriptions start with a '0' byte. * <p> * Same as {@link org.zeromq.ZMQ#PUB} except that you can receive subscriptions from the peers in form of incoming messages. * <br> * Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body. * <br> * Messages without a sub/unsub prefix are also received, but have no effect on subscription status. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#SUB}, {@link org.zeromq.ZMQ#XSUB}</td></tr> * <tr><td>Direction</td><td>Unidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Send messages, receive subscriptions</td></tr> * <tr><td>Incoming routing strategy</td><td>N/A</td></tr> * <tr><td>Outgoing routing strategy</td><td>Fan out</td></tr> * <tr><td>Action in mute state</td><td>Drop</td></tr> * </table> */ XPUB(ZMQ.ZMQ_XPUB), /** * Flag to specify the receiving part of the PUB or XPUB socket. * <p> * Same as {@link org.zeromq.ZMQ#SUB} except that you subscribe by sending subscription messages to the socket. * <br> * Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body. * <br> * Messages without a sub/unsub prefix may also be sent, but have no effect on subscription status. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>{@link org.zeromq.ZMQ#PUB}, {@link org.zeromq.ZMQ#XPUB}</td></tr> * <tr><td>Direction</td><td>Unidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Receive messages, send subscriptions</td></tr> * <tr><td>Incoming routing strategy</td><td>Fair-queued</td></tr> * <tr><td>Outgoing routing strategy</td><td>N/A</td></tr> * <tr><td>Action in mute state</td><td>Drop</td></tr> * </table> */ XSUB(ZMQ.ZMQ_XSUB), /** * Flag to specify a STREAM socket. * <p> * A socket of type STREAM is used to send and receive TCP data from a non-ØMQ peer, when using the tcp:// transport. * A STREAM socket can act as client and/or server, sending and/or receiving TCP data asynchronously. * <br> * When receiving TCP data, a STREAM socket shall prepend a message part containing the identity * of the originating peer to the message before passing it to the application. * <br> * Messages received are fair-queued from among all connected peers. * When sending TCP data, a STREAM socket shall remove the first part of the message * and use it to determine the identity of the peer the message shall be routed to, * and unroutable messages shall cause an EHOSTUNREACH or EAGAIN error. * <br> * To open a connection to a server, use the {@link org.zeromq.ZMQ.Socket#connect(String)} call, and then fetch the socket identity using the {@link org.zeromq.ZMQ.Socket#getIdentity()} call. * To close a specific connection, send the identity frame followed by a zero-length message. * When a connection is made, a zero-length message will be received by the application. * Similarly, when the peer disconnects (or the connection is lost), a zero-length message will be received by the application. * The {@link org.zeromq.ZMQ#SNDMORE} flag is ignored on data frames. You must send one identity frame followed by one data frame. * <br> * Also, please note that omitting the SNDMORE flag will prevent sending further data (from any client) on the same socket. * <p> * <table summary="" border="1"> * <th colspan="2">Summary of socket characteristics</th> * <tr><td>Compatible peer sockets</td><td>none</td></tr> * <tr><td>Direction</td><td>Bidirectional</td></tr> * <tr><td>Send/receive pattern</td><td>Unrestricted</td></tr> * <tr><td>Incoming routing strategy</td><td>Fair-queued</td></tr> * <tr><td>Outgoing routing strategy</td><td>See text</td></tr> * <tr><td>Action in mute state</td><td>EAGAIN</td></tr> * </table> */ STREAM(ZMQ.ZMQ_STREAM); private final int socketType; SocketType(int socketType) { this.socketType = socketType; } public static SocketType type(int baseType) { for (SocketType type : values()) { if (type.type() == baseType) { return type; } } throw new IllegalArgumentException("no socket type found with value " + baseType); } public int type() { return socketType; } }
[ "bartosz.kalinczuk@tooploox.com" ]
bartosz.kalinczuk@tooploox.com
bca7691b9c5d8cbcbd7bdeef6e6cfea2bb8a9b60
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_3ba8edb574396c7fdb3ca39beff6ac24cb16a69d/IndexTermReader/5_3ba8edb574396c7fdb3ca39beff6ac24cb16a69d_IndexTermReader_t.java
a5a1b5769f7a304b93b8573b0bd0745a4d49476b
[]
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
21,457
java
/* * This file is part of the DITA Open Toolkit project hosted on * Sourceforge.net. See the accompanying license.txt file for * applicable licenses. */ /* * (c) Copyright IBM Corp. 2005, 2006 All Rights Reserved. */ package org.dita.dost.reader; import static org.dita.dost.util.Constants.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; import org.dita.dost.index.IndexTerm; import org.dita.dost.index.IndexTermCollection; import org.dita.dost.index.IndexTermTarget; import org.dita.dost.log.MessageUtils; import org.dita.dost.util.StringUtils; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * This class extends SAX's DefaultHandler, used for parse index term from dita * files. * * @version 1.0 2005-04-30 * * @author Wu, Zhi Qiang */ public final class IndexTermReader extends AbstractXMLReader { /** The target file under parsing */ private String targetFile = null; /** The title of the topic under parsing */ private String title = null; /** The title of the main topic */ private String defaultTitle = null; /** Whether or not current element under parsing is a title element */ private boolean inTitleElement = false; /** Whether or not current element under parsing is <index-sort-as> */ private boolean insideSortingAs = false; /** Stack used to store index term */ private final Stack<IndexTerm> termStack; /** Stack used to store topic id */ private final Stack<String> topicIdStack; /** List used to store all the specialized index terms */ private final List<String> indexTermSpecList; /** List used to store all the specialized index-see */ private final List<String> indexSeeSpecList; /** List used to store all the specialized index-see-also */ private final List<String> indexSeeAlsoSpecList; /** List used to store all the specialized index-sort-as */ private final List<String> indexSortAsSpecList; /** List used to store all the specialized topics */ private final List<String> topicSpecList; /** List used to store all specialized titles */ private final List<String> titleSpecList; /** List used to store all the indexterm found in this topic file */ private final List<IndexTerm> indexTermList; /** Map used to store the title info accessed by its topic id*/ private final Map<String, String> titleMap; /** Stack for "@processing-role" value */ private final Stack<String> processRoleStack; /** Depth inside a "@processing-role" parent */ private int processRoleLevel = 0; //Added by William on 2010-04-26 for ref:2990783 start private IndexTermCollection result; //Added by William on 2010-04-26 for ref:2990783 end //Added by William on 2010-04-26 for ref:2990783 start public IndexTermReader(final IndexTermCollection result) { this(); this.result = result; } //Added by William on 2010-04-26 for ref:2990783 end /** * Constructor. * * @deprecated use {@link #IndexTermReader(IndexTermCollection)} instead */ @Deprecated public IndexTermReader() { termStack = new Stack<IndexTerm>(); topicIdStack = new Stack<String>(); indexTermSpecList = new ArrayList<String>(INT_16); indexSeeSpecList = new ArrayList<String>(INT_16); indexSeeAlsoSpecList = new ArrayList<String>(INT_16); indexSortAsSpecList = new ArrayList<String>(INT_16); topicSpecList = new ArrayList<String>(INT_16); titleSpecList = new ArrayList<String>(INT_16); indexTermList = new ArrayList<IndexTerm>(INT_256); titleMap = new HashMap<String, String>(INT_256); processRoleStack = new Stack<String>(); processRoleLevel = 0; if (result == null) { result = IndexTermCollection.getInstantce(); } } /** * Reset the reader. */ public void reset() { targetFile = null; title = null; defaultTitle = null; inTitleElement = false; termStack.clear(); topicIdStack.clear(); indexTermSpecList.clear(); indexSeeSpecList.clear(); indexSeeAlsoSpecList.clear(); indexSortAsSpecList.clear(); topicSpecList.clear(); indexTermList.clear(); processRoleStack.clear(); processRoleLevel = 0; titleMap.clear(); } @Override public void characters(final char[] ch, final int start, final int length) throws SAXException { final StringBuilder tempBuf = new StringBuilder(length); tempBuf.append(ch, start, length); normalizeAndCollapseWhitespace(tempBuf); String temp = tempBuf.toString(); /* * For title info */ if (processRoleStack.isEmpty() || !ATTR_PROCESSING_ROLE_VALUE_RESOURCE_ONLY.equalsIgnoreCase(processRoleStack.peek())) { if (!insideSortingAs && !termStack.empty()) { final IndexTerm indexTerm = termStack.peek(); temp = trimSpaceAtStart(temp, indexTerm.getTermName()); indexTerm.setTermName(StringUtils.setOrAppend(indexTerm.getTermName(), temp, false)); } else if (insideSortingAs && temp.length() > 0) { final IndexTerm indexTerm = termStack.peek(); temp = trimSpaceAtStart(temp, indexTerm.getTermKey()); indexTerm.setTermKey(StringUtils.setOrAppend(indexTerm.getTermKey(), temp, false)); } else if (inTitleElement) { temp = trimSpaceAtStart(temp, title); //Always append space if: <title>abc<ph/>df</title> //Updated with SF 2010062 - should only add space if one is in source title = StringUtils.setOrAppend(title, temp, false); } } } @Override public void endDocument() throws SAXException { final int size = indexTermList.size(); updateIndexTermTargetName(); for(int i=0; i<size; i++){ final IndexTerm indexterm = indexTermList.get(i); //IndexTermCollection.getInstantce().addTerm(indexterm); //Added by William on 2010-04-26 for ref:2990783 start result.addTerm(indexterm); //Added by William on 2010-04-26 for ref:2990783 end } } @Override public void endElement(final String uri, final String localName, final String qName) throws SAXException { //Skip the topic if @processing-role="resource-only" if (processRoleLevel > 0) { String role = processRoleStack.peek(); if (processRoleLevel == processRoleStack.size()) { role = processRoleStack.pop(); } processRoleLevel--; if (ATTR_PROCESSING_ROLE_VALUE_RESOURCE_ONLY .equalsIgnoreCase(role)) { return; } } // Check to see if the indexterm element or a specialized version is // in the list. if (indexTermSpecList.contains(localName)) { final IndexTerm term = termStack.pop(); //SF Bug 2010062: Also set to *** when the term is only white-space. if (term.getTermName() == null || term.getTermName().trim().equals("")){ if(term.getEndAttribute() != null && !term.hasSubTerms()){ return; } else{ term.setTermName("***"); logger.logWarn(MessageUtils.getMessage("DOTJ014W").toString()); } } if (term.getTermKey() == null) { term.setTermKey(term.getTermName()); } //if this term is the leaf term //leaf means the current indexterm element doesn't contains any subterms //or only has "index-see" or "index-see-also" subterms. if (term.isLeaf()){ //generate a target which points to current topic and //assign it to current term. final IndexTermTarget target = genTarget(); term.addTarget(target); } if (termStack.empty()) { //most parent indexterm indexTermList.add(term); } else { //Assign parent indexterm to final IndexTerm parentTerm = termStack.peek(); parentTerm.addSubTerm(term); } } // Check to see if the index-see or index-see-also or a specialized // version is in the list. if (indexSeeSpecList.contains(localName) || indexSeeAlsoSpecList.contains(localName)) { final IndexTerm term = termStack.pop(); final IndexTerm parentTerm = termStack.peek(); if (term.getTermKey() == null) { term.setTermKey(term.getTermFullName()); } //term.addTargets(parentTerm.getTargetList()); term.addTarget(genTarget()); //assign current topic as the target of index-see or index-see-also term parentTerm.addSubTerm(term); } /* * For title info */ if (titleSpecList.contains(localName)) { inTitleElement = false; if(!titleMap.containsKey(topicIdStack.peek())){ //If this is the first topic title if(titleMap.size() == 0) { defaultTitle = title; } titleMap.put(topicIdStack.peek(), title); } } // For <index-sort-as> if (indexSortAsSpecList.contains(localName)) { insideSortingAs = false; } // For <topic> if (topicSpecList.contains(localName)){ topicIdStack.pop(); } } /** * This method is used to create a target which refers to current topic. * @return instance of IndexTermTarget created */ private IndexTermTarget genTarget() { final IndexTermTarget target = new IndexTermTarget(); String fragment = null; if(topicIdStack.peek() == null){ fragment = null; }else{ fragment = topicIdStack.peek(); } if (title != null) { target.setTargetName(title); } else { target.setTargetName(targetFile); } if(fragment != null) { target.setTargetURI(targetFile + SHARP + fragment); } else { target.setTargetURI(targetFile); } return target; } @Override public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException { //Skip the topic if @processing-role="resource-only" final String attrValue = attributes .getValue(ATTRIBUTE_NAME_PROCESSING_ROLE); if (attrValue != null) { processRoleStack.push(attrValue); processRoleLevel++; if (ATTR_PROCESSING_ROLE_VALUE_RESOURCE_ONLY .equals(attrValue)) { return; } } else if (processRoleLevel > 0) { processRoleLevel++; if (ATTR_PROCESSING_ROLE_VALUE_RESOURCE_ONLY .equals(processRoleStack.peek())) { return; } } final String classAttr = attributes.getValue(ATTRIBUTE_NAME_CLASS); handleSpecialization(localName, classAttr); parseTopic(localName, attributes.getValue(ATTRIBUTE_NAME_ID)); //change parseIndexTerm(localName) to parseIndexTerm(localName,attributes) parseIndexTerm(localName,attributes); parseIndexSee(localName); parseIndexSeeAlso(localName); if (IndexTerm.getTermLocale() == null) { final String xmlLang = attributes .getValue(ATTRIBUTE_NAME_XML_LANG); if (xmlLang != null) { IndexTerm.setTermLocale(StringUtils.getLocale(xmlLang)); } } /* * For title info */ if (titleSpecList.contains(localName) && !titleMap.containsKey(topicIdStack.peek())) { inTitleElement = true; title = null; } // For <index-sort-as> if (indexSortAsSpecList.contains(localName)) { insideSortingAs = true; } } private void parseTopic(final String localName, final String id){ if (topicSpecList.contains(localName)){ topicIdStack.push(id); } } private void parseIndexSeeAlso(final String localName) { // check to see it the index-see-also element or a specialized version // is in the list. if (indexSeeAlsoSpecList.contains(localName)) { final IndexTerm indexTerm = new IndexTerm(); IndexTerm parentTerm = null; if(!termStack.isEmpty()){ parentTerm = termStack.peek(); if(parentTerm.hasSubTerms()){ parentTerm.updateSubTerm(); } } indexTerm.setTermPrefix(IndexTerm_Prefix_See_Also); termStack.push(indexTerm); } } private void parseIndexSee(final String localName) { // check to see it the index-see element or a specialized version is // in the list. if (indexSeeSpecList.contains(localName)) { final IndexTerm indexTerm = new IndexTerm(); IndexTerm parentTerm = null; indexTerm.setTermPrefix(IndexTerm_Prefix_See); if(!termStack.isEmpty()){ parentTerm = termStack.peek(); if(parentTerm.hasSubTerms()){ parentTerm.updateSubTerm(); indexTerm.setTermPrefix(IndexTerm_Prefix_See_Also); } } termStack.push(indexTerm); } } private void parseIndexTerm(final String localName, final Attributes attributes) { // check to see it the indexterm element or a specialized version is // in the list. if (indexTermSpecList.contains(localName)) { final IndexTerm indexTerm = new IndexTerm(); indexTerm.setStartAttribute(attributes.getValue(ATTRIBUTE_NAME_END)); indexTerm.setEndAttribute(attributes.getValue(ATTRIBUTE_NAME_END)); IndexTerm parentTerm = null; if(!termStack.isEmpty()){ parentTerm = termStack.peek(); if(parentTerm.hasSubTerms()){ parentTerm.updateSubTerm(); } } termStack.push(indexTerm); } } /** * Note: <index-see-also> should be handled before <index-see>. * * @param localName * @param classAttr */ private void handleSpecialization(final String localName, final String classAttr) { if (classAttr == null) { return; } else if (TOPIC_INDEXTERM.matches(classAttr)) { // add the element name to the indexterm specialization element // list if it does not already exist in that list. if (!indexTermSpecList.contains(localName)) { indexTermSpecList.add(localName); } } else if (INDEXING_D_INDEX_SEE_ALSO.matches(classAttr)) { // add the element name to the index-see-also specialization element // list if it does not already exist in that list. if (!indexSeeAlsoSpecList.contains(localName)) { indexSeeAlsoSpecList.add(localName); } } else if (INDEXING_D_INDEX_SEE.matches(classAttr)) { // add the element name to the index-see specialization element // list if it does not already exist in that list. if (!indexSeeSpecList.contains(localName)) { indexSeeSpecList.add(localName); } } else if (INDEXING_D_INDEX_SORT_AS.matches(classAttr)) { // add the element name to the index-sort-as specialization element // list if it does not already exist in that list. if (!indexSortAsSpecList.contains(localName)) { indexSortAsSpecList.add(localName); } } else if (TOPIC_TOPIC.matches(classAttr)) { //add the element name to the topic specialization element // list if it does not already exist in that list. if (!topicSpecList.contains(localName)) { topicSpecList.add(localName); } } else if (TOPIC_TITLE.matches(classAttr)) { //add the element name to the title specailization element list // if it does not exist in that list. if (!titleSpecList.contains(localName)){ titleSpecList.add(localName); } } } /** * Set the current parsing file. * @param target The parsingFile to set. */ public void setTargetFile(final String target) { this.targetFile = target; } /** * Update the target name of constructed IndexTerm recursively * */ private void updateIndexTermTargetName(){ final int size = indexTermList.size(); if(defaultTitle == null){ defaultTitle = targetFile; } for(int i=0; i<size; i++){ final IndexTerm indexterm = indexTermList.get(i); updateIndexTermTargetName(indexterm); } } /** * Update the target name of each IndexTerm, recursively. * @param indexterm */ private void updateIndexTermTargetName(final IndexTerm indexterm){ final int targetSize = indexterm.getTargetList().size(); final int subtermSize = indexterm.getSubTerms().size(); for(int i=0; i<targetSize; i++){ final IndexTermTarget target = indexterm.getTargetList().get(i); final String uri = target.getTargetURI(); final int indexOfSharp = uri.lastIndexOf(SHARP); final String fragment = (indexOfSharp == -1 || uri.endsWith(SHARP))? null: uri.substring(indexOfSharp+1); if(fragment != null && titleMap.containsKey(fragment)){ target.setTargetName(titleMap.get(fragment)); }else{ target.setTargetName(defaultTitle); } } for(int i=0; i<subtermSize; i++){ final IndexTerm subterm = indexterm.getSubTerms().get(i); updateIndexTermTargetName(subterm); } } /** Whitespace normalization state. */ private enum WhiteSpaceState { WORD, SPACE }; /** * Normalize and collapse whitespaces from string buffer. * * @param strBuffer The string buffer. */ private void normalizeAndCollapseWhitespace(final StringBuilder strBuffer){ WhiteSpaceState currentState = WhiteSpaceState.WORD; for (int i = strBuffer.length() - 1; i >= 0; i--) { final char currentChar = strBuffer.charAt(i); if (Character.isWhitespace(currentChar)) { if (currentState == WhiteSpaceState.SPACE) { strBuffer.delete(i, i + 1); } else if(currentChar != ' ') { strBuffer.replace(i, i + 1, " "); } currentState = WhiteSpaceState.SPACE; } else { currentState = WhiteSpaceState.WORD; } } } /** * Trim whitespace from start of the string. If last character of termName and * first character of temp is a space character, remove leading string from temp * * @param temp * @param termName * @return trimmed temp value */ private String trimSpaceAtStart(final String temp, final String termName) { if(termName != null && termName.charAt(termName.length() - 1) == ' ') { if(temp.charAt(0) == ' ') { return temp.substring(1); } } return temp; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8ae039f9d5791569011ba8c4a8217904a2cd290d
a0f3011247519c22b460621ac10c1cb8d6be5198
/src/main/java/book/ctci/chapter14/intro/IntroductionOverriding.java
aa372c9efb8f27e522e36c0e9ca2e99b1c4e68b1
[]
no_license
danielbgg/datastructure
7afed2f0cf43ca5ded050ca7c09acb6917cbe1b1
06c36f5c4d3309620dd1c704534b51a420df1143
refs/heads/master
2021-05-29T02:02:34.655034
2015-05-20T21:41:39
2015-05-20T21:41:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
package book.ctci.chapter14.intro; public class IntroductionOverriding { public static void printArea(Circle c) { System.out.println("The circle is " + c.computeArea()); } public static void printArea(Square s) { System.out.println("The square is " + s.computeArea()); } public static void printArea(Ambiguous s) { System.out.println("The ambiguous is undefined"); } public static void main(String[] args) { Shape[] shapes = new Shape[2]; Circle circle = new Circle(); Ambiguous ambiguous = new Ambiguous(); shapes[0] = circle; shapes[1] = ambiguous; for (Shape s : shapes) { s.printMe(); System.out.println(s.computeArea()); } } }
[ "danielbgg@gmail.com" ]
danielbgg@gmail.com
5090b1f677a119718e9d90b9b42bb9501d1fb6ca
14a5cb80d36affd15f003b53947a2898de7eb722
/sawtooth-java-wrapper-service/src/main/java/com/mycompany/blockchain/sawtooth/core/service/asset/AssetProcessor.java
f3bc54de3c928ace112c9e56d7fd6d4099a659fa
[ "Apache-2.0" ]
permissive
nissshh/sawtooth-java-wrapper
138b928fbf1bcb06c47c5766220dfe9859b8de98
ec1a41a714b8136d37a9ebb24e2c82514376ce39
refs/heads/master
2021-04-15T08:18:41.187819
2018-05-02T07:42:02
2018-05-02T07:42:02
126,175,969
0
0
Apache-2.0
2018-05-02T07:42:03
2018-03-21T12:35:18
Java
UTF-8
Java
false
false
489
java
package com.mycompany.blockchain.sawtooth.core.service.asset; import sawtooth.sdk.processor.TransactionProcessor; public class AssetProcessor { /** * the method that runs a Thread with a TransactionProcessor in it. */ public static void main(String[] args) { TransactionProcessor transactionProcessor = new TransactionProcessor(args[0]); transactionProcessor.addHandler(new AssetPayloadHandler()); Thread thread = new Thread(transactionProcessor); thread.start(); } }
[ "nishant_sonar@yahoo.com" ]
nishant_sonar@yahoo.com
21ce3e709838deff7a11ded5f3066af0333723ae
b3edc42caecec7f41d5f6d5d22a43073efe7a0b0
/src/main/java/com/mrs/entity/Order.java
7c02ed8af3fcc45299dbe5af5746110d4595083c
[]
no_license
twister229/MRSProject
07187cdda0f3a8324f64c53267e8f0840a329f49
d17d0b1a8e46fc761c80567405cbb44cda203689
refs/heads/master
2021-01-10T02:26:26.682489
2016-02-25T09:04:11
2016-02-25T09:04:11
52,327,354
0
0
null
null
null
null
UTF-8
Java
false
false
2,752
java
package com.mrs.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @Table(name = "`order`") public class Order implements Serializable { private static final long serialVersionUID = -7988799579036225137L; private Integer orderID; private Date createTime; private Integer productID; private String symptom; private String productName; private Integer invoiceID; private Integer status; private String customerUsername; public Order() { // TODO Auto-generated constructor stub } public Order(Date createTime, Integer productID, String symptom, String productName, Integer invoiceID, Integer status, String customerUsername) { super(); this.createTime = createTime; this.productID = productID; this.symptom = symptom; this.productName = productName; this.invoiceID = invoiceID; this.status = status; this.customerUsername = customerUsername; } @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "OrderID") public Integer getOrderID() { return orderID; } public void setOrderID(Integer orderID) { this.orderID = orderID; } @Column(name = "CreateTime") @Temporal(TemporalType.TIMESTAMP) public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } @Column(name = "ProductID") public Integer getProductID() { return productID; } public void setProductID(Integer productID) { this.productID = productID; } @Column(name = "Symptom") public String getSymptom() { return symptom; } public void setSymptom(String symptom) { this.symptom = symptom; } @Column(name = "ProductName") public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } @Column(name = "InvoiceID") public Integer getInvoiceID() { return invoiceID; } public void setInvoiceID(Integer invoiceID) { this.invoiceID = invoiceID; } @Column(name = "Status") public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } @Column(name = "CustomerUsername") public String getCustomerUsername() { return customerUsername; } public void setCustomerUsername(String customerUsername) { this.customerUsername = customerUsername; } }
[ "vohonglinh229@gmail.com" ]
vohonglinh229@gmail.com
f74e5570bbef82ac8d9937c78ab681d12392009b
b581709d7cb50ba1e9a8246433fc1a7ff2092a47
/src/test/java/ar/edu/unlam/tallerweb1/modelo/CorralTest.java
e5a740dc9ae41537c8c5db6a750ae0ea6f62cf17
[]
no_license
RoMaIsau/SmartFarm
652fe8465884bfab857f75a06ff53a5c8c637db0
fbed0b58a3be25d43ff6ec8d580f6993a05163b1
refs/heads/master
2022-12-04T20:47:54.835594
2020-08-09T23:33:12
2020-08-09T23:33:12
259,749,161
0
1
null
2020-07-15T22:17:09
2020-04-28T20:54:20
CSS
UTF-8
Java
false
false
2,072
java
package ar.edu.unlam.tallerweb1.modelo; import static org.assertj.core.api.Assertions.*; import java.math.BigDecimal; import java.util.LinkedList; import java.util.List; import org.junit.Test; public class CorralTest { @Test public void losPuntosDeberianEstarDentroDelCorral() { Corral corral = ConstructorDeCorral.crear() .conPunto(-35.27943238, -59.25639695) .conPunto(-35.27050061, -59.24681765) .conPunto(-35.27482256, -59.23890212) .conPunto(-35.28256033, -59.25004436) .conPunto(-35.27943238, -59.25639695) .corral(); assertThat(corral.contiene(-35.27699061134853, -59.24939917767695)).isTrue(); assertThat(corral.contiene(-35.27189641088621, -59.246782457908026)).isTrue(); assertThat(corral.contiene(-35.28016747737641, -59.25275394661165)).isTrue(); } @Test public void losPuntosDeberianEstarFueraDelCorral() { Corral corral = ConstructorDeCorral.crear() .conPunto(-35.27943238, -59.25639695) .conPunto(-35.27050061, -59.24681765) .conPunto(-35.27482256, -59.23890212) .conPunto(-35.28256033, -59.25004436) .conPunto(-35.27943238, -59.25639695) .corral(); assertThat(corral.contiene(-35.27780814141548, -59.23786377665017)).isFalse(); assertThat(corral.contiene(-35.271125428754274, -59.25356409526432)).isFalse(); assertThat(corral.contiene(-35.27123498586599, -59.24088306869129)).isFalse(); assertThat(corral.contiene(-35.282467888773674, -59.256041620167636)).isFalse(); } } class ConstructorDeCorral { private List<Vertice> vertices; private ConstructorDeCorral() { this.vertices = new LinkedList<>(); } public static ConstructorDeCorral crear() { return new ConstructorDeCorral(); } public ConstructorDeCorral conPunto(double latitud, double longitud) { Vertice vertice = new Vertice(); vertice.setLatitud(BigDecimal.valueOf(latitud)); vertice.setLongitud(BigDecimal.valueOf(longitud)); this.vertices.add(vertice); return this; } public Corral corral() { Corral corral = new Corral(); corral.setVertices(this.vertices); return corral; } }
[ "rocio.isau@gmail.com" ]
rocio.isau@gmail.com
1271f90d52e95a613df818e249fb38dddfe1bc1b
f766baf255197dd4c1561ae6858a67ad23dcda68
/app/src/main/java/com/tencent/tmassistantsdk/common/TMAssistantDownloadSDKContentType.java
f78a7104891a3748d7ba45d1073f6f102e637658
[]
no_license
jianghan200/wxsrc6.6.7
d83f3fbbb77235c7f2c8bc945fa3f09d9bac3849
eb6c56587cfca596f8c7095b0854cbbc78254178
refs/heads/master
2020-03-19T23:40:49.532494
2018-06-12T06:00:50
2018-06-12T06:00:50
137,015,278
4
2
null
null
null
null
UTF-8
Java
false
false
617
java
package com.tencent.tmassistantsdk.common; public class TMAssistantDownloadSDKContentType { public static final String CONTENT_TYPE_APK = "application/vnd.android.package-archive"; public static final String CONTENT_TYPE_APKDIFF = "application/tm.android.apkdiff"; public static final String CONTENT_TYPE_OTHERS = "resource/tm.android.unknown"; } /* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes3-dex2jar.jar!/com/tencent/tmassistantsdk/common/TMAssistantDownloadSDKContentType.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "526687570@qq.com" ]
526687570@qq.com
16959750193c2ee756d3296147d51a75bfd9f6bb
6f324a492f9389c2a856bb7887494bbc35ff795a
/src/com/alijian/front/model/CommentsModel.java
324cdc51010f35f27c07e1f6deadc2ff7d38ce44
[]
no_license
huyanqi/alijian
7a1d36ab10885f08e6f1071dcf071c3fc5af644f
aa182d02531c345016326e73d8b30474cffd1918
refs/heads/master
2021-01-22T16:53:05.524884
2015-12-01T09:49:51
2015-12-01T09:49:51
40,084,493
0
0
null
null
null
null
GB18030
Java
false
false
1,483
java
package com.alijian.front.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; /** * 留言板 * @author Frankie * */ @Entity @Table(name = "comments") public class CommentsModel { @Id @GeneratedValue(strategy = GenerationType.AUTO) public int id; @Column public String content;//留言内容 @Column public int touser;//接收留言的用户/商户ID @Column public int fromuser;//发送留言的用户ID @Column public Date update_time = new Date(); @Transient public UserModel userModel; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getTouser() { return touser; } public void setTouser(int touser) { this.touser = touser; } public int getFromuser() { return fromuser; } public void setFromuser(int fromuser) { this.fromuser = fromuser; } public Date getUpdate_time() { return update_time; } public void setUpdate_time(Date update_time) { this.update_time = update_time; } public UserModel getUserModel() { return userModel; } public void setUserModel(UserModel userModel) { this.userModel = userModel; } }
[ "287569090@qq.com" ]
287569090@qq.com
657695046d50900b82ba310b77b08a7d086b3d5e
d0a370e01e0d0b8e2240ecb545e03f1dc6a9be5e
/vertx-pin/zero-atom/src/main/java/io/vertx/tp/modular/file/ExcelReader.java
9f7076cf76957dd049b48c6e4af2eef051f1e459
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
zwkjhx/vertx-zero
8a53b57198be123922c5f89a5dc68179ea9d585c
0349d7b4e2055a8e2fb2553081b0ab7259f3cb21
refs/heads/master
2023-05-13T05:32:00.587660
2023-02-08T14:12:28
2023-02-08T14:12:28
205,322,934
0
0
Apache-2.0
2019-08-30T06:53:04
2019-08-30T06:53:03
null
UTF-8
Java
false
false
2,603
java
package io.vertx.tp.modular.file; import io.vertx.tp.atom.modeling.Model; import io.vertx.tp.atom.modeling.Schema; import io.vertx.tp.atom.refine.Ao; import io.vertx.tp.modular.file.excel.ExAnalyzer; import io.vertx.tp.modular.file.excel.ExModello; import io.vertx.up.util.Ut; import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; /* * Excel类型的 Marshal,用于读取数据 */ public class ExcelReader implements AoFile { private final transient String rootPath; public ExcelReader() { this(Ao.Path.PATH_EXCEL); } public ExcelReader(final String rootPath) { final String normalized; if (Objects.isNull(rootPath)) { /* runtime/excel */ normalized = Ao.Path.PATH_EXCEL; } else { /* End with '/' */ if (!rootPath.endsWith("/")) { normalized = rootPath + "/"; } else { normalized = rootPath; } } this.rootPath = normalized; } @Override public Set<Model> readModels(final String appName) { final Set<String> files = this.readFiles("schema"); Ao.infoUca(this.getClass(), "找到符合条件的文件:{0}", String.valueOf(files.size())); /* * 先构造 Schema 处理实体 */ final Set<Schema> schemas = ExModello.create(files) .on(appName).build(); Ao.infoUca(this.getClass(), "合计构造了模型:{0}", schemas.size()); /* * 将 Model 和 Schema 连接 */ final Set<Model> models = new HashSet<>(); files.stream().map(ExAnalyzer::create) // 和应用绑定 .map(analyzer -> analyzer.on(appName)) // 构造最终的Model .map(analyzer -> analyzer.build(schemas)) .forEach(models::addAll); return models; } @Override public Set<String> readServices() { return null; } @Override public Set<String> readDataFiles() { return this.readFiles("data"); } private Set<String> readFiles(final String folder) { final String root = this.rootPath + folder; final List<String> files = Ut.ioFiles(root); return files.stream() .filter(file -> file.endsWith(".xlsx") || file.equals("xls")) // Only Excel Valid .filter(file -> !file.startsWith("~")) // 过滤Office的临时文件 .map(item -> root + "/" + item).collect(Collectors.toSet()); } }
[ "silentbalanceyh@126.com" ]
silentbalanceyh@126.com
30fb31ebc2d54dbaf7813662a4d6448746a481b7
823fe39d137a2b72159499e5b3ff9c700fc51180
/Inteligentes_Extra/Inteligentes_Extra/src/control/SearchAlg.java
30be09b6eeebc3d74adafbe35fed62b78193b9df
[]
no_license
Kirkuss/Inteligentes
2211f045f9b08e8a0fc4fb2743a90648908bf192
02b180e0bd6716409920f395b0d3786ca271d454
refs/heads/master
2020-04-24T08:51:06.170776
2019-06-05T18:04:34
2019-06-05T18:04:34
171,843,888
0
1
null
null
null
null
UTF-8
Java
false
false
6,769
java
package control; import java.security.NoSuchAlgorithmException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Hashtable; public class SearchAlg { private int nodeCount; private TreeNode endNode; private Frontier fringe; private Problem prob; private boolean prune; private int heuristic; private Hashtable<String, TreeNode> visited; public SearchAlg(boolean prune) { this.prune = prune; } public void setHeu(int heu) { this.heuristic = heu; } public String Busqueda_Acotada(Problem prob, String estrategia, int Prof_Max) throws NoSuchAlgorithmException { this.prob = prob; this.nodeCount = 0; this.prob.getInSt().calculateMD5(); fringe = new Frontier(); visited = new Hashtable<String, TreeNode>(); TreeNode n_inicial = new TreeNode(null, this.prob.getInSt(), 0, 0, 0); TreeNode n_actual = new TreeNode(); fringe.Insert(n_inicial); nodeCount++; boolean solucion = false; while (!solucion && !fringe.isEmpty()) { n_actual = fringe.Remove(); if (prune) { updateVisited(n_actual);} if (prob.isGoal(n_actual.getCurrentState())) { solucion = true; }else { ArrayList<control.Node> LS = prob.Sucesores(n_actual.getCurrentState()); ArrayList<TreeNode> LN = CreaListaNodosArbol(LS, n_actual, Prof_Max, estrategia); insertTreeNodes(LN, n_actual); } } if (solucion) { DecimalFormat df = new DecimalFormat("###.##"); endNode = n_actual; return "\nSOLUTION DEPTH: " + (n_actual.getDepth() + 1) + "\nINSERTED NODES: " + nodeCount + "\nESTRATEGY: " + estrategia + "\nTOTAL COST: " + df.format(n_actual.getCost()/1000) + " km\n" + CreaSolucion(n_actual); }else { return ""; } } private void updateVisited(TreeNode n_actual) { if(!visited.contains(n_actual.getCurrentState().getId())) { visited.put(n_actual.getCurrentState().getId(), n_actual); }else if(isBetter(n_actual)){ visited.replace(n_actual.getCurrentState().getId(), n_actual); }; } private void insertTreeNodes(ArrayList<TreeNode> LN, TreeNode n_actual) { for(int i = 0; i<LN.size(); i++) { if(prune) { if(!visited.containsKey(LN.get(i).getCurrentState().getId())) { fringe.Insert(LN.get(i)); nodeCount++; }else if(isBetter(LN.get(i))) { fringe.Insert(LN.get(i)); nodeCount++; } }else { fringe.Insert(LN.get(i)); nodeCount++; } } } public TreeNode getEndNode() { return endNode; } public String Busqueda(Problem prob, String estrategia, int Prof_Max, int Inc_Prof) throws NoSuchAlgorithmException { int Prof_Actual = Inc_Prof; String solucion = ""; while (solucion.equals("") && Prof_Actual <= Prof_Max) { solucion = Busqueda_Acotada(prob, estrategia, Prof_Actual); Prof_Actual += Inc_Prof; } return solucion; } public ArrayList<TreeNode> CreaListaNodosArbol(ArrayList<control.Node> LS, TreeNode n_actual, int Prof_Max, String estrategia) throws NoSuchAlgorithmException{ ArrayList<TreeNode> LN = new ArrayList<TreeNode>(); double f = 0; int prof_Act = n_actual.getDepth(); int prof_Sig = prof_Act + 1; for(int i = 0; i<LS.size(); i++) { control.Node listNode = LS.get(i); State st = new State(listNode.getID()); st.setListNodes(n_actual.getCurrentState().getListNodes()); switch(estrategia) { case "UCS": f = listNode.getF() + n_actual.getF(); break; case "DFS": f = - prof_Sig; break; case "BFS": f = prof_Sig; break; case "GRE": if(!st.getListNodes().isEmpty()) { f = setHeu(st); }else { f = 0;} break; case "A*": if(!st.getListNodes().isEmpty()) { f = setHeu(st) + (listNode.getF() + n_actual.getCost()); }else { f = 0;} break; } if(!(prof_Sig > Prof_Max)) { TreeNode listTree = new TreeNode(n_actual, st, prof_Sig, listNode.getF() + n_actual.getCost(), f); LN.add(listTree); } } return LN; } private boolean isBetter(TreeNode tn) { TreeNode tn1 = visited.get(tn.getCurrentState().getId()); if(Math.abs(tn.getF()) < Math.abs(tn1.getF())) { return true; } return false; } private double setHeu(State tn1) { double min = 999999; double heu = 0; double heu0 = 0; double actual_Dist = 0; control.Node nActual = prob.getStateSpace().getG().getNode(tn1.getNode()); ArrayList<String> subgoals = tn1.getListNodes(); for(int i = 0; i<subgoals.size(); i++) { control.Node tn2 = prob.getStateSpace().getG().getNode(subgoals.get(i)); actual_Dist = calculateDistance(nActual,tn2); if(actual_Dist < min) { min = actual_Dist; actual_Dist = 0; } } heu = min; min = 999999; if(heuristic == 1) { for(int i = 0; i<subgoals.size() - 1; i++) { for(int j = i+1; j<subgoals.size(); j++) { control.Node tn3 = prob.getStateSpace().getG().getNode(subgoals.get(i)); control.Node tn4 = prob.getStateSpace().getG().getNode(subgoals.get(j)); actual_Dist = calculateDistance(tn3,tn4); if(actual_Dist < min) { min = actual_Dist; heu0 = actual_Dist; } } } heu += heu0; } return heu; } private double calculateDistance(control.Node tn1, control.Node tn2) { double[] lnglat1 = {Double.valueOf(tn1.getX()), Double.valueOf(tn1.getY())}; double[] lnglat2 = {Double.valueOf(tn2.getX()), Double.valueOf(tn2.getY())}; double earthR = 6371009; double phi1 = Math.toRadians(lnglat1[1]); double phi2 = Math.toRadians(lnglat2[1]); double diffPhi = phi2 - phi1; double theta1 = Math.toRadians(lnglat1[0]); double theta2 = Math.toRadians(lnglat2[0]); double diffTheta = theta2 - theta1; double h = Math.pow(Math.sin(diffPhi/2), 2) + Math.pow(Math.sin(Math.cos(phi1) * Math.cos(phi2) * diffTheta/2), 2); double arc = 2 * Math.asin(Math.sqrt(h)); return arc * earthR; } public String CreaSolucion(TreeNode tn) { DecimalFormat df = new DecimalFormat("###.##"); String solucion = ""; if(tn.getParent() == null) { solucion += "\nStarting from: " + tn.getCurrentState().getNode() + "\n"; return solucion; }else { solucion += CreaSolucion(tn.getParent()) + tn.getParent().getCurrentState().getNode() + " -> " + tn.getCurrentState().getNode() + " (F: " + df.format(tn.getF()) + ", D: " + tn.getDepth() + ", Cost: " + df.format(tn.getCost()) + ")\nStreet name: " + prob.getStateSpace().getG().getEdge(tn.getParent().getCurrentState().getNode() + tn.getCurrentState().getNode()).getName() + "\nIN: " + tn.getCurrentState().getNode() + "\nREMAINING: " + tn.getCurrentState().getListNodes() + "\n"; } return solucion; } }
[ "noreply@github.com" ]
noreply@github.com
125599858413190e7fd9b15355d6eb405705bae0
1d6aa9b4e4e58540a11cef3e603631c3cfbd4244
/projetCdb/core/src/main/java/cdb/core/models/User.java
b54011949287459fb49e9a9ddf5497597e7ea647
[]
no_license
chrwizi/cdb
70e4d67bfa4ecfb46d84ef2c94247ed4ea5e5e40
f3fe283370cd7450eb74238514ca8268067239ad
refs/heads/master
2020-04-22T03:46:16.788010
2019-04-08T15:35:07
2019-04-08T15:35:07
170,099,970
0
0
null
null
null
null
UTF-8
Java
false
false
1,406
java
package cdb.core.models; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) long userID; private String username; private String password; @ManyToOne @JoinColumn(name = "role_id") private Role role; public User() { super(); } public User(String username, String password, Role role) { this.username = username; this.password = password; this.role = role; } public User(User anotherUser) { if (anotherUser != null) { this.userID = anotherUser.userID; this.username = anotherUser.getPassword(); this.password = anotherUser.getPassword(); this.role = anotherUser.getRole(); } } public long getUserID() { return userID; } public void setUserID(long userID) { this.userID = userID; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Role getRole() { return role; } public void setRole(Role role) { this.role = role; } public String getStringRole() { return role.getRole(); } }
[ "superferi93@gmail.com" ]
superferi93@gmail.com
f9a0cec8cf0fa9fdc1037268ab873acb4970a2e9
2b958f1ac9dd107afb2339a4ccae5f2709f919af
/app/src/main/java/com/sunshine/rxjavademo/inter/OnItemClickListener.java
68a840d3466ba2483e3737e90566dcc44557fbf5
[]
no_license
sunshine-sz/SunshineUtilsDemo
36264c345722dde1759ba7b4a4477e9817deecf9
a9f829c4527764bca7ecec1a31b8a1c24ba793cc
refs/heads/master
2020-07-01T12:46:06.508686
2017-02-07T04:02:03
2017-02-07T04:02:03
74,342,077
1
0
null
null
null
null
UTF-8
Java
false
false
182
java
package com.sunshine.rxjavademo.inter; import android.view.View; /** * 选择回调接口 */ public interface OnItemClickListener { void onItemClick(int item, View view); }
[ "SunshineLee@fitsleep.net" ]
SunshineLee@fitsleep.net
dec49c0a25f4bf55623125c44e2ff50966734bb0
1e4b52a9a1d4af16b8401d3b3b62baa0a02ef75f
/aula1/src/Exer26.java
16f00c467f69a3cacf812edc83990aaf733fde79
[]
no_license
Dionisiohenriq/Java-b-sico
ce3e60e00c192d9eeacd87cdb03b445c3a610543
939a1384a26df53af176823f5b7d93dd25ce1f08
refs/heads/master
2022-04-21T13:52:08.001221
2020-04-20T04:06:08
2020-04-20T04:06:08
256,626,721
0
0
null
null
null
null
UTF-8
Java
false
false
247
java
public class Exer26 { public static void main(String[] args) { for (int i = 0; i <= 10; i++) { if (i == 5) { continue; } System.out.println("->processando" + i); } System.out.println("terminando o programa..."); } }
[ "henriquedionisio.dionisioferre@gmail.com" ]
henriquedionisio.dionisioferre@gmail.com
ab0ee76ff35aac8429c04a9ae2b3e670920d400c
458262660a979fb41d4aa08a86ccf685e458cf80
/src/main/java/com/cnpc/excel/controller/ExcelImportController.java
d63cb5a0d6d97b7ab7e7eb63fd29abc06558441e
[]
no_license
lzhcccccch/ImportAndExportExcel
096da8c07fa6237c018bf87b3b16af239e8c98e2
0623e85d62ee2c20ca1f7bde10ba3cf44879e6a3
refs/heads/master
2023-05-02T14:12:17.067609
2021-05-31T09:19:29
2021-05-31T09:19:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,632
java
package com.cnpc.excel.controller; import com.cnpc.excel.service.impl.ExcelImportImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; /** * @packageName: com.cnpc.excel.controller * @className: ExcelImportController * @description: TODO * @version: v1.0 * @author: liuzhichao * @date: 2020-12-08 16:10 */ @RestController @RequestMapping("/excel") public class ExcelImportController { @Autowired private ExcelImportImpl service; @PostMapping("/import") public Map importExcel(@RequestParam("file") MultipartFile file) { Map<Integer, String> map = new HashMap<>(); if (file!=null) { if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith("xls")) { map = service.importExcel(file); } else { map.put(502, "不支持该文件格式."); } } else { map.put(502, "文件为空,请正确上传文件."); } return map; } @GetMapping("/export") public Map exportExcel(String date, HttpServletResponse response) { return service.exportExcel(date, response); } }
[ "liuzhichao000@163.com.cn" ]
liuzhichao000@163.com.cn
218f0ce723de84a616f04a8cc2ee8901b8bb1852
1c800afdf704affd9f789c3370174434d9e644dc
/app/src/main/java/com/example/indraaguslesmana/mvpezy/model/DetailProductResponse.java
ee58c65d07e6a11887c675cbfc9547951d041384
[]
no_license
indraAsLesmana/Mvp_ezy
a67815f1bca8807b800244beef01663c2149a9d0
b103449c4092b4ef326deae1dc7f964f55465690
refs/heads/master
2021-01-22T07:48:34.246986
2017-05-27T07:20:03
2017-05-27T07:20:03
92,579,238
0
0
null
null
null
null
UTF-8
Java
false
false
2,127
java
package com.example.indraaguslesmana.mvpezy.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; /** * Created by indraaguslesmana on 4/7/17. */ public class DetailProductResponse { @SerializedName("result") @Expose public ArrayList<Result> result = null; @SerializedName("status") @Expose public Status status; public static class Result { @SerializedName("product_name") @Expose public String productName; @SerializedName("review_url") @Expose public String reviewUrl; @SerializedName("share_url") @Expose public String shareUrl; @SerializedName("harga_toko") @Expose public String hargaToko; @SerializedName("info1") @Expose public String info1; @SerializedName("info2") @Expose public String info2; @SerializedName("info3") @Expose public String info3; @SerializedName("description") @Expose public String description; public String getProductName() { return productName; } public String getReviewUrl() { return reviewUrl; } public String getShareUrl() { return shareUrl; } public String getHargaToko() { return hargaToko; } public String getInfo1() { return info1; } public String getInfo2() { return info2; } public String getInfo3() { return info3; } public String getDescription() { return description; } } public static class Status { @SerializedName("code") @Expose public String code; @SerializedName("message") @Expose public String message; public String getCode() { return code; } public String getMessage() { return message; } } }
[ "indra.agus@kiranatama.com" ]
indra.agus@kiranatama.com
aef6f3194174372f933925b92d652b3717321ec8
619a57bd2550431562b8083387307673edeabb18
/Task_06.java
1dc09af076dfeba553bc53968c5bd013cbcfbf62
[]
no_license
gaborSomogyvari/Java
46d3090fb9f31d241f5e7d7e707bc52f68930a56
9a6ed235a546074050819defd949003765d8c857
refs/heads/master
2020-12-01T18:11:29.292809
2020-05-23T12:43:55
2020-05-23T12:43:55
230,722,967
0
0
null
null
null
null
UTF-8
Java
false
false
965
java
class Task_06{ public static void main(String[] args) { int[][][] opers = { { {100, -50, 25}, {150,-300}, {300,-90,100} }, { {90, -60, 250}, {300,20,-100} }, { {20, 50}, {300}, {20,-20,40}, {100,-200} } }; print2d(accountBalance(opers)); } static int[] accountBalance(int[][][] operations){ int[] balance=new int[operations.length]; for(int i=0;i<operations.length;i++){ for(int j=0;j<operations[i].length;j++){ for(int k=0;k<operations[i][j].length;k++){ balance[i]+=operations[i][j][k]; } } } return balance; } static void print(String msg){ System.out.println(msg); } static void print2d(int[] in){ for(int i=0;i<in.length;i++){ print(String.valueOf(in[i])); } } }
[ "noreply@github.com" ]
noreply@github.com
268559c05ca52f3be6684bdfb3863bdb917f33e7
bb0f8270f9472bf923f38e5be7c13223071a0aff
/app/src/main/java/com/example/bomberman/MainActivity.java
8095c1a4cf93543cfd86170dde16b1b2df167af4
[]
no_license
murovv/Bomberman
466f55f69070f39dbdd3197e0e6d87ee9a9452c7
911a2960c290947580079b0ad2cab36bfe688488
refs/heads/master
2021-03-18T19:50:19.298448
2020-03-13T19:05:17
2020-03-13T19:05:17
247,096,075
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.example.bomberman; 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.start_screen); } }
[ "murovgleb@gmail.com" ]
murovgleb@gmail.com
a616a1f6999f014bdd714585237b5d62dba5d147
cf6b8c11c20a806433c82a1b4a9fad1ee9045c43
/src/com/spring/aop/helloworld/ArithmaticCalculatorLoggingProxy.java
4d4fab06fc89ff552d20bd335b000f753fb12000
[]
no_license
gravenguan/spring-2-shangxuetang
cfe667a91b24ccf48e52fb7e891e737332c1099e
7544dc4584c71b5c8ca2b6fd6582d5d5bfe0b0b5
refs/heads/master
2020-03-30T18:10:15.465687
2018-10-03T22:11:52
2018-10-03T22:11:52
151,486,970
0
0
null
null
null
null
UTF-8
Java
false
false
1,767
java
package com.spring.aop.helloworld; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Arrays; public class ArithmaticCalculatorLoggingProxy { // 要代理对象 private ArithmaticCalculator target; public ArithmaticCalculatorLoggingProxy(ArithmaticCalculator target) { this.target = target; } public ArithmaticCalculator getLoggingProxy(){ ArithmaticCalculator proxy = null; // 代理对象由哪一个类加载器负责加载 ClassLoader loader=target.getClass().getClassLoader(); // 代理对象类型,即其中有哪些方法 Class [] interfaces = new Class[]{ArithmaticCalculator.class}; // 当调用代理对象其中方法时,该执行的代码 InvocationHandler h = new InvocationHandler() { /* proxy: 正在返回到那个代理对象,一般情况在invoke放大都不使用该对象 method:正在被调用的方法 args:调用方法时,传入的参数 */ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); //日志 System.out.println("The method"+methodName+" begins with "+ Arrays.asList(args)); //执行方法 Object result = method.invoke(target,args); //日志 System.out.println("The method "+methodName + "ends with" + result); return result; } }; proxy= (ArithmaticCalculator) Proxy.newProxyInstance(loader,interfaces,h); return proxy; } }
[ "heran.guan@toyota.com" ]
heran.guan@toyota.com
a3e04368a0ec02962d402b43551a55796df3ee04
9b7b8df0c0b05f5727461b3cf65a0dca9ebb5cb4
/solution.java
d65411346b865befb24f6f912ae30867c98cee83
[]
no_license
vigneshbalusami/contest
bc4d12006684838bbc05fdec3ee1e8a101f5b2c0
3e885e587fe2917e701c4b6cc6ad0a44faf6fe38
refs/heads/master
2020-03-25T06:29:16.637700
2019-10-24T05:46:18
2019-10-24T05:46:18
143,504,980
0
0
null
null
null
null
UTF-8
Java
false
false
1,717
java
package com.subarray; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class solution { public static char[] doubleValue = new char[64]; public static Map<Character,Integer> mapValue = new HashMap<>(); public static void main(String args[]){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); setDoubleValue(); while(t>0){ int n = sc.nextInt(),value=0,temp=0,value2=0,i=0,j=0,count=0; String str = sc.next(); char arr[] = str.toCharArray(); int sum[] = new int[n]; int doubleSum[] = new int[n]; for(i=n-1,j=0;i>=0;i--,j++){ value = mapValue.get(arr[i]); // System.out.print(doubleValue[value]); if(j%2==0) value = value*2; value2 = value/64 + value%64; // System.out.print(doubleValue[value2]); count = count + value2; // System.out.print(" "+count); } value = count/64; System.out.println(doubleValue[(64-(count-64*value))%64]); /*for(i=0;i<n;i++){ System.out.print(doubleSum[i]+" "); }*/ t--; } } public static void setDoubleValue(){ int i,j=0; for(i = 0;i <= 25;i++){ doubleValue[i] = (char)('A' + i); mapValue.put(doubleValue[i],i); } for(j=0,i=26;i <= 51;i++,j++){ doubleValue[i] = (char)('a'+j); mapValue.put(doubleValue[i],i); } for(j=0,i=52;i <= 61;i++,j++){ doubleValue[i] = (char)('0'+j); mapValue.put(doubleValue[i],i); } doubleValue[i++] = '+'; mapValue.put('+',62); doubleValue[i++] = '/'; mapValue.put('/',63); } } /*8 1 1 1 0 4 0000 10 1234567890 29 41201953788963824033556555672 7 3000158 11 90540677470 36 188648824429847292479287385561746664*/
[ "noreply@github.com" ]
noreply@github.com
330aefc87c33dbfebdef7359731b00617f70cd96
50fe4f21b9ae2379903d44da8c3d9bfd81ec6514
/tg/META-INF/classes/nc/bs/tg/outside/ctar/WYSFCtArBillToNC.java
31153177b71f263ca6dc2f1d1ec4da57d6f283dd
[]
no_license
tanzijian1/mytest
cda37bf2d54abfd2da45b13bfe79c7e5e02676c6
4465ba67a6f62a4eac3b8bc18e19645f04a56145
refs/heads/master
2023-02-15T05:34:52.101432
2021-01-15T06:37:55
2021-01-15T06:38:56
329,802,651
0
0
null
null
null
null
GB18030
Java
false
false
14,017
java
package nc.bs.tg.outside.ctar; import java.util.HashMap; import java.util.List; import nc.vo.fct.ar.entity.AggCtArVO; import nc.vo.fct.ar.entity.ArAddedServicesBVO; import nc.vo.fct.ar.entity.ArOrganizationBVO; import nc.vo.fct.ar.entity.ArPerformanceBVO; import nc.vo.fct.ar.entity.CtArBVO; import nc.vo.fct.ar.entity.CtArPlanVO; import nc.vo.fct.ar.entity.CtArVO; import nc.vo.fct.entity.CtArExecDetailVO; import nc.vo.org.OrgVO; import nc.vo.pub.BusinessException; import nc.vo.pub.VOStatus; import nc.vo.pub.lang.UFDate; import nc.vo.pub.lang.UFDateTime; import nc.vo.pub.lang.UFDouble; import nc.vo.tg.outside.LLArAddedServicesJsonBVO; import nc.vo.tg.outside.LLArPerformanceJsonBVO; import nc.vo.tg.outside.LLCtArExecJsonVO; import nc.vo.tg.outside.LLCtArJsonBVO; import nc.vo.tg.outside.LLCtArJsonVO; import nc.vo.tg.outside.LLCtArPlanJsonVO; import nc.vo.tg.outside.LLOrganizationJsonVO; import com.alibaba.fastjson.JSONObject; public class WYSFCtArBillToNC extends CtArBillUtil { protected AggCtArVO onTranBill(HashMap<String, Object> info, String hpk) throws BusinessException { AggCtArVO ctaraggvo = new AggCtArVO(); JSONObject jsonData = (JSONObject) info.get("data"); // 表头信息 LLCtArJsonVO headvo = JSONObject.parseObject( jsonData.getString("headInfo"), LLCtArJsonVO.class); // 合同基本 List<LLCtArJsonBVO> ctArBvos = JSONObject.parseArray( jsonData.getString("ctarbvos"), LLCtArJsonBVO.class); // 执行情况 List<LLCtArExecJsonVO> ctArExecBvos = JSONObject.parseArray( jsonData.getString("ctarexecdetail"), LLCtArExecJsonVO.class); // 收款计划 List<LLCtArPlanJsonVO> ctArPlanBvos = JSONObject.parseArray( jsonData.getString("ctarplans"), LLCtArPlanJsonVO.class); // 编制情况 List<LLOrganizationJsonVO> organizationBVOs = JSONObject.parseArray( jsonData.getString("organization"), LLOrganizationJsonVO.class); // 绩效计提口径 List<LLArPerformanceJsonBVO> performanceBVOs = JSONObject .parseArray(jsonData.getString("performance"), LLArPerformanceJsonBVO.class); // 增值服务 List<LLArAddedServicesJsonBVO> addedservicesBVOs = JSONObject .parseArray(jsonData.getString("addedservices"), LLArAddedServicesJsonBVO.class); OrgVO orgvo = getOrgVO(headvo.getPk_org()); String srcid = headvo.getSrcid();// 外系统业务单据ID Object[] defpks = super.getDeptpksByCode(headvo.getDepid(), orgvo.getPk_org()); CtArVO ctarvo = buildHeadVo(orgvo, defpks, headvo); // 合同基本信息 CtArBVO[] ctarbvos = null; ctarbvos = new CtArBVO[ctArBvos.size()]; if (ctArBvos != null && ctArBvos.size() > 0) { for (int i = 0; i < ctArBvos.size(); i++) { // 合同基本信息 CtArBVO ctarbvo = new CtArBVO(); ctarbvo.setCrowno(i + 1 + "0"); ctarbvo.setPk_group(orgvo.getPk_group()); ctarbvo.setPk_org(orgvo.getPk_org()); ctarbvo.setPk_org_v(orgvo.getPk_vid()); ; ctarbvo.setPk_financeorg(orgvo.getPk_org()); ctarbvo.setPk_financeorg_v(orgvo.getPk_vid()); ctarbvo.setFtaxtypeflag(1); ctarbvo.setNnosubtaxrate(new UFDouble(ctArBvos.get(i) .getNnosubtaxrate())); ctarbvo.setNtaxrate(new UFDouble(ctArBvos.get(i).getNtaxrate())); ctarbvo.setVbdef1(ctArBvos.get(i).getVbdef1());// 科目名称 ctarbvo.setVbdef2(ctArBvos.get(i).getVbdef2());// 拆分比例 ctarbvo.setVmemo(ctArBvos.get(i).getVmemo());// 说明 ctarbvo.setProject(ctArBvos.get(i).getProject());// 项目 ctarbvo.setInoutcome(ctArBvos.get(i).getInoutcome());// 收支项目 ctarbvo.setVbdef3(ctArBvos.get(i).getVbdef3());// 自定义项3 ctarbvo.setVbdef4(ctArBvos.get(i).getVbdef4());// 自定义项4 ctarbvo.setVbdef5(ctArBvos.get(i).getVbdef5());// 自定义项5 ctarbvo.setVbdef6(ctArBvos.get(i).getVbdef6());// 自定义项6 ctarbvo.setVbdef7(ctArBvos.get(i).getVbdef7());// 自定义项7 ctarbvo.setVbdef8(ctArBvos.get(i).getVbdef8());// 自定义项8 ctarbvo.setVbdef9(ctArBvos.get(i).getVbdef9());// 自定义项9 ctarbvo.setVbdef10(ctArBvos.get(i).getVbdef10());// 自定义项10 ctarbvo.setVbdef11(ctArBvos.get(i).getVbdef11());// 自定义项11 ctarbvo.setVbdef12(ctArBvos.get(i).getVbdef12());// 自定义项12 ctarbvo.setVbdef13(ctArBvos.get(i).getVbdef13());// 自定义项13 ctarbvo.setVbdef14(ctArBvos.get(i).getVbdef14());// 自定义项14 ctarbvo.setVbdef15(ctArBvos.get(i).getVbdef15());// 自定义项15 ctarbvo.setVbdef16(ctArBvos.get(i).getVbdef16());// 自定义项16 ctarbvo.setVbdef17(ctArBvos.get(i).getVbdef17());// 自定义项17 ctarbvo.setVbdef18(ctArBvos.get(i).getVbdef18());// 自定义项18 ctarbvo.setVbdef19(ctArBvos.get(i).getVbdef19());// 自定义项19 ctarbvo.setVbdef20(ctArBvos.get(i).getVbdef20());// 自定义项20 ctarbvo.setVchangerate("1.00/1.00"); ctarbvo.setVqtunitrate("1.00/1.00"); ctarbvo.setNtaxmny(new UFDouble(ctArBvos.get(i) .getNorigtaxmny())); ctarbvo.setNorigtaxmny(new UFDouble(ctArBvos.get(i) .getNorigtaxmny())); // 2020-09-28-谈子健-添加字段-start ctarbvo.setVbdef29(getdefdocBycode(ctArBvos.get(i) .getCollectionitemstype(), "SDLL008"));// 收费项目类型 ctarbvo.setVbdef30(getItemnameByPk(ctArBvos.get(i) .getCollectionitemsname(), "SDLL008"));// 收费项目名称 ctarbvo.setNtax(new UFDouble(ctArBvos.get(i).getNorigtax())); // 2020-09-28-谈子健-添加字段-end ctarbvos[i] = ctarbvo; } } // 执行情况 CtArExecDetailVO[] execvos = null; if (ctArExecBvos != null && ctArExecBvos.size() > 0) { execvos = new CtArExecDetailVO[ctArExecBvos.size()]; for (int i = 0; i < ctArExecBvos.size(); i++) { CtArExecDetailVO execvo = new CtArExecDetailVO(); execvo.setVbillcode(ctArExecBvos.get(i).getVbillcode()); execvo.setVbilldate(new UFDate(ctArExecBvos.get(i) .getVbilldate())); execvo.setNorigpshamount(new UFDouble(ctArExecBvos.get(i) .getNorigpshamount())); execvo.setCtrunarmny(new UFDouble(ctArExecBvos.get(i) .getCtrunarmny())); execvo.setNorigcopamount(new UFDouble(ctArExecBvos.get(i) .getNorigcopamount())); execvo.setVbdef1(ctArExecBvos.get(i).getVbdef1()); execvo.setVbdef2(ctArExecBvos.get(i).getVbdef2());// 所有表体vdef2定为:EBS主键 execvo.setVbdef3(ctArExecBvos.get(i).getVbdef3()); execvo.setVbdef4(ctArExecBvos.get(i).getVbdef4()); execvo.setVbdef5(ctArExecBvos.get(i).getVbdef5()); execvo.setVbdef6(ctArExecBvos.get(i).getVbdef6()); execvo.setVbdef7(ctArExecBvos.get(i).getVbdef7()); execvo.setVbdef8(ctArExecBvos.get(i).getVbdef8()); execvo.setVbdef9(ctArExecBvos.get(i).getVbdef9()); execvo.setVbdef10(ctArExecBvos.get(i).getVbdef10()); execvo.setTs(new UFDateTime()); execvo.setDr(0); // 2020-09-28-谈子健-添加字段-start execvo.setAdvancemoney(ctArExecBvos.get(i).getAdvancemoney());// 预收金额 execvo.setInvoiceamountincludingtax(ctArExecBvos.get(i) .getInvoiceamountincludingtax());// 累计已开发票含税金额 execvo.setInvoiceamountexcludingtax(ctArExecBvos.get(i) .getInvoiceamountexcludingtax());// 累计已开发票不含税金额 // 2020-09-28-谈子健-添加字段-end execvos[i] = execvo; } } // 收款计划 CtArPlanVO[] ctarplavvos = null; if (ctArPlanBvos != null && ctArPlanBvos.size() > 0) { ctarplavvos = new CtArPlanVO[ctArPlanBvos.size()]; for (int i = 0; i < ctArPlanBvos.size(); i++) { CtArPlanVO ctarplanvo = new CtArPlanVO(); ctarplanvo.setAccountdate(0); ctarplanvo.setEnddate(new UFDate(ctArPlanBvos.get(i) .getEnddate()));// 收款日期 ctarplanvo.setPk_org(orgvo.getPk_corp()); ctarplanvo.setPk_org_v(orgvo.getPk_vid()); ctarplanvo.setPlanmoney(new UFDouble(ctArPlanBvos.get(i) .getPlanmoney()));// 合同金额 // 2020-09-28-谈子健-添加字段-start ctarplanvo.setPerformancedate(ctArPlanBvos.get(i) .getPerformancedate());// 所属年月 ctarplanvo.setMoney(ctArPlanBvos.get(i).getMoney());// 含税金额 ctarplanvo.setNotaxmny(ctArPlanBvos.get(i).getNotaxmny());// 不含税金额 ctarplanvo.setApprovetime(ctArPlanBvos.get(i).getApprovetime());// 应收单审批时间 ctarplanvo.setAmountreceivable(ctArPlanBvos.get(i) .getAmountreceivable());// 已转应收金额 ctarplanvo.setPayer(ctArPlanBvos.get(i).getPayer());// 付款人 ctarplanvo.setProjectprogress(ctArPlanBvos.get(i) .getProjectprogress());// 工程进度 ctarplanvo.setIsdeposit(ctArPlanBvos.get(i).getIsdeposit());// 是否质保金 ctarplanvo.setDepositterm(ctArPlanBvos.get(i).getDepositterm());// 质保金期限 ctarplanvo.setChargingname(ctArPlanBvos.get(i) .getChargingname());// 收费标准名称 // 2020-09-28-谈子健-添加字段-end ctarplavvos[i] = ctarplanvo; } } // 编制情况 organizationBVOs ArOrganizationBVO[] organizationvos = null; if (organizationBVOs != null && organizationBVOs.size() > 0) { organizationvos = new ArOrganizationBVO[organizationBVOs.size()]; for (int i = 0; i < organizationBVOs.size(); i++) { ArOrganizationBVO arOrganizationBVO = new ArOrganizationBVO(); arOrganizationBVO.setPostname(organizationBVOs.get(i) .getPostname());// 岗位名称 arOrganizationBVO .setPeople(organizationBVOs.get(i).getPeople());// 人数 arOrganizationBVO.setUnivalence(new UFDouble(organizationBVOs .get(i).getUnivalence()));// 单价 arOrganizationBVO.setBillingperiod(organizationBVOs.get(i) .getBillingperiod());// 计费期限 arOrganizationBVO.setBillingamount(new UFDouble( organizationBVOs.get(i).getBillingamount()));// 计费金额 organizationvos[i] = arOrganizationBVO; } } // 绩效计提口径 performanceBVOs ArPerformanceBVO[] performancevos = null; if (performanceBVOs != null && performanceBVOs.size() > 0) { performancevos = new ArPerformanceBVO[performanceBVOs.size()]; for (int i = 0; i < performanceBVOs.size(); i++) { ArPerformanceBVO arPerformanceBVO = new ArPerformanceBVO(); arPerformanceBVO.setPerformancedate(performanceBVOs.get(i) .getPerformancedate());// 日期xx年xx月 arPerformanceBVO.setMoney(new UFDouble(performanceBVOs.get(i) .getMoney()));// 含税金额 arPerformanceBVO.setNotaxmny(new UFDouble(performanceBVOs .get(i).getNotaxmny()));// 不含税金额 arPerformanceBVO.setApprovestatus(Integer .valueOf(performanceBVOs.get(i).getApprovestatus()));// 共享审核应收单状态 performancevos[i] = arPerformanceBVO; } } // 增值服务 ArAddedServicesBVO[] addedservicesvos = null; if (addedservicesBVOs != null && addedservicesBVOs.size() > 0) { addedservicesvos = new ArAddedServicesBVO[addedservicesBVOs.size()]; for (int i = 0; i < addedservicesBVOs.size(); i++) { ArAddedServicesBVO arAddedServicesBVO = new ArAddedServicesBVO(); arAddedServicesBVO.setServicecontent(addedservicesBVOs.get(i) .getServicecontent());// 开展增值服务内容 arAddedServicesBVO.setChargingname(addedservicesBVOs.get(i) .getChargingname());// 收费标准名称 arAddedServicesBVO.setServiceperiod(addedservicesBVOs.get(i) .getServiceperiod());// 服务期限 arAddedServicesBVO.setMoney(new UFDouble(addedservicesBVOs.get( i).getMoney()));// 含税金额 arAddedServicesBVO.setPaytype(addedservicesBVOs.get(i) .getPaytype());// 付款方式 addedservicesvos[i] = arAddedServicesBVO; } } ctaraggvo.setParentVO(ctarvo); ctaraggvo.setCtArBVO(ctarbvos); ctaraggvo.setCtArPlanVO(ctarplavvos); ctaraggvo.setCtArExecDetailVO(execvos);// 执行情况 ctaraggvo.setArOrganizationBVO(organizationvos); ctaraggvo.setArPerformanceBVO(performancevos); ctaraggvo.setArAddedServicesBVO(addedservicesvos); // 更新的合同 if (hpk != null) { // 变更逻辑 AggCtArVO oldaggvos = (AggCtArVO) getBillVO(AggCtArVO.class, "isnull(dr,0)=0 and blatest ='Y' and vdef18 = '" + srcid + "'"); if (oldaggvos == null) { throw new BusinessException("变更失败!nc系统中查不到该单据!"); } // 将原始VO表头的部分数据填充到新VO String primaryKey = oldaggvos.getPrimaryKey(); ctaraggvo.getParentVO().setPrimaryKey(primaryKey); ctaraggvo.getParentVO().setTs(oldaggvos.getParentVO().getTs()); // 同步表头ts ctaraggvo.getParentVO().setStatus(VOStatus.UPDATED); ctaraggvo.getParentVO().setBillmaker( oldaggvos.getParentVO().getBillmaker()); ctaraggvo.getParentVO().setActualinvalidate( oldaggvos.getParentVO().getActualinvalidate()); ctaraggvo.getParentVO().setApprover( oldaggvos.getParentVO().getApprover()); ctaraggvo.getParentVO().setCreator( oldaggvos.getParentVO().getCreator()); ctaraggvo.getParentVO().setCreationtime( oldaggvos.getParentVO().getCreationtime()); ctaraggvo.getParentVO().setDmakedate( oldaggvos.getParentVO().getDmakedate()); ctaraggvo.getParentVO().setTaudittime( oldaggvos.getParentVO().getTaudittime()); syncBvoPkByEbsPk(CtArBVO.class, primaryKey, ctaraggvo, CtArBVO.PK_FCT_AR_B, CtArBVO.getDefaultTableName()); syncBvoPkByEbsPk(CtArExecDetailVO.class, primaryKey, ctaraggvo, CtArExecDetailVO.PK_EXEC, CtArExecDetailVO.getDefaultTableName()); syncBvoPkByEbsPk(CtArPlanVO.class, primaryKey, ctaraggvo, CtArPlanVO.PK_FCT_AR_PLAN, "fct_ar_plan"); syncBvoPkByEbsPk(ArOrganizationBVO.class, primaryKey, ctaraggvo, ArOrganizationBVO.PK_ORGANIZATION, ArOrganizationBVO.getDefaultTableName()); syncBvoPkByEbsPk(ArPerformanceBVO.class, primaryKey, ctaraggvo, ArPerformanceBVO.PK_PERFORMANCE, ArPerformanceBVO.getDefaultTableName()); syncBvoPkByEbsPk(ArAddedServicesBVO.class, primaryKey, ctaraggvo, ArAddedServicesBVO.PK_ADDEDSERVICES, ArAddedServicesBVO.getDefaultTableName()); } return ctaraggvo; } }
[ "tzj@hanzhisoft.com" ]
tzj@hanzhisoft.com
5944b94159fa080be5167f0c27f98aa955ce55aa
ab97dfb6252b8a72235e882a8df0ac2cb70cc2b1
/design-patterns-2/src/cap_5/Visitor.java
5c0496aafe7bb481abcc66e94a5505a6644ff2e8
[]
no_license
jjduarte/treinamento
01cdba74d3df138d366f80b43228a3561b0ec135
74aba9a32086269deb57ce59d4e6701beeb883bc
refs/heads/master
2020-12-24T16:23:51.967816
2016-03-18T05:07:53
2016-03-18T05:07:53
30,542,299
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package cap_5; public interface Visitor { public abstract void visitaSoma(Soma soma); public abstract void visitaSubtracao(Subtracao subtracao); public abstract void visitaDivisao(Divisao divisao); public abstract void visitaMultiplicacao(Multiplicacao multiplicacao); public abstract void visitaRaiz(RaizQuadrada raiz); public abstract void visitaNumero(Numero numero); }
[ "duarte.jpdl@gmail.com" ]
duarte.jpdl@gmail.com
b5173384aa2eb693cf8168b5439d10fffc163754
111f8fb2bdeec2f1ead49612edbc2926ecd4d090
/TAREAS/T156 MATRIZ TRANSPUESTA(CASOS)/src/com/company/Main.java
c66dcf911344a761222bca44797fe7bd38cd79f8
[]
no_license
arturobarbaro/Java
9deabc695cc111c590e6c95551bd377a25979249
df128a789930863e26d43c54b39394a09683effa
refs/heads/master
2020-03-30T01:12:16.584881
2019-01-12T17:21:01
2019-01-12T17:21:01
150,564,704
1
0
null
null
null
null
UTF-8
Java
false
false
1,819
java
package com.company; import java.util.Arrays; public class Main { public static void main(String[] args) { // write your code here int[][] matriz = {{1,2,3},{4,5,6},{7,8,9},{0,1,2}}; mostrar(matriz); transpuesta(matriz); // NO seria posible si las filas tienen distinta longitud // dado que esto no es una matriz, seria posible si el resto de sus elementos fuera 0 // No es posible pq no se puede operar con matrices con desigualdad de filas y/o columnas int[][] a ={{1,2},{3,4,5},{7,8}}; mostrar(a); transpuesta(a); } public static void transpuesta(int[][] matriz){ comprobacionDeParametros(matriz); int contador=0; do { for (int j = 0; j < matriz[j].length; j++) { for (int i = 0; i < matriz.length; i++) { System.out.print(matriz[i][j]+ " "); } System.out.println(); contador++; } System.out.println(); } while (contador < matriz.length-1); } public static void mostrar(int matriz[][]) { for (int i = 0; i < matriz.length; i++) { for (int j = 0; j < matriz[i].length; j++) { System.out.print(matriz[i][j] + " "); } System.out.println(); } System.out.println(); } private static void comprobacionDeParametros(int[][] matriz){ assert matriz!=null : "Error: la matriz no puede ser nula"; assert matriz.length>0 : "Error: la matriz no puede ser vacia"; for (int i = 0; i < matriz.length; i++) { assert matriz[i].length>0 : "Error: la matriz no puede ser vacia"; } } }
[ "arturo.barba@iesdonana.org" ]
arturo.barba@iesdonana.org
feb4992164d2b1d7fde544ddd1cefc779684fddf
d00f3bb675c3f61423368ca681f86c332cb6811a
/src/main/java/com/example/javabasic/thread/share_resource/EventChecker.java
d8798b38388d303bef6c2ddd094bc3c169ce63eb
[]
no_license
Garcia111/javabasic
6a4a641089930dd3e2bafa0f734b9c09b12201a8
9a257cf1d22913aab0a2e245f0ee25914c652454
refs/heads/master
2022-06-25T12:44:46.307459
2020-09-14T15:00:25
2020-09-14T15:00:25
206,282,875
0
0
null
2022-06-21T02:15:30
2019-09-04T09:30:53
Java
UTF-8
Java
false
false
1,309
java
package com.example.javabasic.thread.share_resource; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class EventChecker implements Runnable { private IntGenerator generator; private final int id; public EventChecker(IntGenerator g, int ident){ generator = g; id = ident; } @Override public void run() { while(!generator.isCanceled()){ int val = generator.next(); System.out.println("val:"+val); //校验下一个数是否是偶数 if(val % 2 != 0){ System.out.println(val+ "not even"); generator.cancel(); //取消所有EventCheckers,所有线程都可以访问cancel变量, // 如果cancel被设置为true,所有的线程进入run()的时候都会停止 } } } public static void test(IntGenerator gp,int count){ System.out.println("Press Control-C to exit"); ExecutorService exec = Executors.newCachedThreadPool(); for(int i=0;i<count;i++){ exec.execute(new EventChecker(gp,i)); } exec.shutdown(); } public static void test(IntGenerator gp){ //创建10个线程 test(gp,10); } }
[ "erya0923!" ]
erya0923!
483a033640b77bcc51cfaf43c80b54bacf8d969a
76ded0774bb7efeff9d2474cb7944e1917e25e78
/src/main/java/ListDistinctTest.java
d8a622ce37705991fdb97e6e2df57bf7fc912378
[]
no_license
matinaNone/aa
3c24e158fd05e18e228db968d5ff2a6ea313b232
56c7208633f860f151b0eae750735b3353206aea
refs/heads/master
2020-07-13T10:27:36.307767
2019-09-03T10:00:45
2019-09-03T10:00:45
204,415,377
0
0
null
null
null
null
UTF-8
Java
false
false
589
java
import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * Created by wangnan01 on 2018/1/12. */ public class ListDistinctTest { public static void main(String[] args) { List<String> a = new ArrayList<>(); a.add("1"); a.add("1"); a.add("1"); System.out.println(a); // a.stream().distinct().collect(Collectors.toList()); a.stream().map(i -> {i = "2"; return i;}).collect(Collectors.toList()); // System.out.println(a.stream().distinct().count()); System.out.println(a); } }
[ "382413415@qq.com" ]
382413415@qq.com
ce15f59bddce755a58141f0a17d3ff888de0f045
2a8b80d0418f81adfa4e6c4684a782f518769cc2
/src/main/java/com/sbm/proposal/dto/ProposalStatus.java
68b67810839bf545116d504f5dbccd85a8a23f6d
[]
no_license
C-HS/proposal-tracking
78916c0e801908e5c47e3c1cbae79f2bdfe00a74
3cda3c4235c831f1788a506d9ef7521a06e54e46
refs/heads/main
2022-12-29T15:27:09.847645
2020-10-17T12:44:05
2020-10-17T12:44:05
301,934,727
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.sbm.proposal.dto; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; @Getter @Setter @NoArgsConstructor @AllArgsConstructor @ToString public class ProposalStatus { private long proposalId; private String proposalStatus; }
[ "zafar.parvez@gmail.com" ]
zafar.parvez@gmail.com
94e6d8cf27c588bf908cc276b6d9019966a47d45
f1fa0c59c88d2f90855d216814c3bc8f9e94ec90
/Caracol/src/caracol/Archivo.java
1eb43533ddafa207a706ba0605a273984347bf16
[]
no_license
JulianFOT/Caracol
fe44f7a26786e6571a020a0babbefca6696b0acd
8110821ff8923a138b6765ca32cc2d0d7cd639a4
refs/heads/master
2020-04-21T12:40:43.548140
2019-02-14T02:17:12
2019-02-14T02:17:12
169,570,935
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
package caracol; import java.io.*; public class Archivo { public void leer(String Archivo){ try { FileReader r=new FileReader(Archivo); BufferedReader buffer=new BufferedReader(r); String temp=" "; while(temp!=null){ temp=buffer.readLine(); String x; x = temp; String []vector; vector = x.split(" "); for(int i=0;i<vector.length;i++){ System.out.println(""+vector[i]); } if(temp==null); } } catch (Exception e) { System.out.println(e.getMessage()); } } }
[ "noreply@github.com" ]
noreply@github.com
6e85a0563ccb20fc253f1033ebffa9b2329a2f1f
23af6c00ff9ed687f51453df08a3f5927d5a2b6d
/miniLoan/src/main/java/com/wealth/miniloan/dao/MlCorpCreditMapper.java
2541f3c269491c60d8e68f0c0a2281410e9419eb
[]
no_license
asheme/miniLoan
a4d6061aa94195ec38909ddc54782788a98b2bd1
e2e65d9204b71acde30877c90961b1b87c1f3e8a
refs/heads/master
2021-01-10T20:40:51.098078
2014-11-12T13:16:16
2014-11-12T13:16:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,248
java
package com.wealth.miniloan.dao; import com.wealth.miniloan.entity.MlCorpCredit; import com.wealth.miniloan.entity.MlCorpCreditExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface MlCorpCreditMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int countByExample(MlCorpCreditExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int deleteByExample(MlCorpCreditExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int deleteByPrimaryKey(String appNo); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int insert(MlCorpCredit record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int insertSelective(MlCorpCredit record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ List<MlCorpCredit> selectByExample(MlCorpCreditExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ MlCorpCredit selectByPrimaryKey(String appNo); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int updateByExampleSelective(@Param("record") MlCorpCredit record, @Param("example") MlCorpCreditExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int updateByExample(@Param("record") MlCorpCredit record, @Param("example") MlCorpCreditExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int updateByPrimaryKeySelective(MlCorpCredit record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table ml_corp_credit_info * * @mbggenerated Sat Sep 27 17:34:51 CST 2014 */ int updateByPrimaryKey(MlCorpCredit record); }
[ "asheme@163.com" ]
asheme@163.com
d121b40a72829f8d868b709627081a0acfac1ec8
c172277968872fed622af288f299b2312cc8797c
/library/src/main/java/com/designer/library/utils/GsonUtils.java
3edfd5abcf0df94d9703b68587c4afaa59599f4d
[]
no_license
meihuali/TuiTuiZhu
3b1a824713b807cca5c88202b03ca295113b4327
dc1867374f747ea63904dfdfafe599f3e10483cd
refs/heads/master
2020-05-02T03:36:52.444123
2019-03-26T07:03:57
2019-03-26T07:03:57
177,732,689
1
0
null
null
null
null
UTF-8
Java
false
false
3,429
java
/* * Copyright (C) 2018,米珈科技有限公司 All rights reserved. * Project:TongHeChuanMei * Author:姜涛 * Date:11/12/18 4:49 PM */ package com.designer.library.utils; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.Reader; import java.lang.reflect.Type; public final class GsonUtils { private static final Gson GSON = createGson(true); private static final Gson GSON_NO_NULLS = createGson(false); private GsonUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /** * Gets pre-configured {@link Gson} instance. * * @return {@link Gson} instance. */ public static Gson getGson() { return getGson(true); } /** * Gets pre-configured {@link Gson} instance. * * @param serializeNulls determines if nulls will be serialized. * @return {@link Gson} instance. */ public static Gson getGson(final boolean serializeNulls) { return serializeNulls ? GSON_NO_NULLS : GSON; } /** * Serializes an object into json. * * @param object the object to serialize. * @return object serialized into json. */ public static String toJson(final Object object) { return toJson(object, true); } /** * Serializes an object into json. * * @param object the object to serialize. * @param includeNulls determines if nulls will be included. * @return object serialized into json. */ public static String toJson(final Object object, final boolean includeNulls) { return includeNulls ? GSON.toJson(object) : GSON_NO_NULLS.toJson(object); } /** * Converts {@link String} to given type. * * @param json the json to convert. * @param type type type json will be converted to. * @return instance of type */ public static <T> T fromJson(final String json, final Class<T> type) { return GSON.fromJson(json, type); } /** * Converts {@link String} to given type. * * @param json the json to convert. * @param type type type json will be converted to. * @return instance of type */ public static <T> T fromJson(final String json, final Type type) { return GSON.fromJson(json, type); } /** * Converts {@link Reader} to given type. * * @param reader the reader to convert. * @param type type type json will be converted to. * @return instance of type */ public static <T> T fromJson(final Reader reader, final Class<T> type) { return GSON.fromJson(reader, type); } /** * Converts {@link Reader} to given type. * * @param reader the reader to convert. * @param type type type json will be converted to. * @return instance of type */ public static <T> T fromJson(final Reader reader, final Type type) { return GSON.fromJson(reader, type); } /** * Create a pre-configured {@link Gson} instance. * * @param serializeNulls determines if nulls will be serialized. * @return {@link Gson} instance. */ private static Gson createGson(final boolean serializeNulls) { final GsonBuilder builder = new GsonBuilder(); if (serializeNulls) { builder.serializeNulls(); } return builder.create(); } }
[ "77299007@qq.com" ]
77299007@qq.com
36af79e796e5834cccd7162456aae7efdb0a18fd
9bc2b03b7a2939a647e218945a674cf551016059
/src/main/java/com/creditcard/demo/CreditCardApplication.java
23f6cc26e505802d32ded5d059f252c221e64464
[]
no_license
ApurvaJhunjhunwala/CreditCardApp
a66149df06b402440fee995dd7ea27e828932f31
78f5db36a88fd76debad35b43026b3746fc60782
refs/heads/master
2023-06-04T02:49:26.754540
2021-06-20T18:25:52
2021-06-20T18:25:52
377,951,659
0
0
null
null
null
null
UTF-8
Java
false
false
1,137
java
package com.creditcard.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication(scanBasePackages = { "com.creditcard.repo" ,"com.creditcard.model", "com.creditcard.service", "com.creditcard.controller", "com.creditcard.security", "com.creditcard.validator", "com.creditcard.exception","com.creditcard.demotest" , }) @EnableAutoConfiguration @EnableJpaRepositories(basePackages="com.creditcard.repo") @EnableTransactionManagement @EntityScan(basePackages="com.creditcard.model") public class CreditCardApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(CreditCardApplication.class, args); } }
[ "apurva.jhunjhunwala@ai-london.com" ]
apurva.jhunjhunwala@ai-london.com
4e5df87c018acc8f9a4ab74b264cd27ca3855183
881284c4aee3c5a1fb6178f670c4d0f186081b11
/DP/1696. Jump Game VI/maxResult.java
1d35109ddeac75fb8f9db1ece974c3b8261b4045
[]
no_license
xxpp1314/Leetcode
92e544bfb737f5b0a7fa584ed5961a9e067d206c
692afa3be007cb2bedd5a1e765a8d1a291ca4279
refs/heads/main
2023-07-24T15:14:19.548553
2021-08-31T00:01:51
2021-08-31T00:01:51
347,841,232
0
0
null
null
null
null
UTF-8
Java
false
false
802
java
class Solution { public int maxResult(int[] nums, int k) { // maintain max elements in queue length of K (window) Deque<Integer> queue = new LinkedList<Integer>(); for (int i = 0; i < nums.length; i++) { // pick the max number in the window size of K int max = queue.isEmpty() ? 0 : nums[queue.peekFirst()]; // update the max value at the position nums[i] = nums[i] + max; // If nums[i] is max then remove the min values from queue while (!queue.isEmpty() && nums[queue.peekLast()] < nums[i]) { queue.pollLast(); } queue.add(i); // keep the window valid, if window size is increased while (!queue.isEmpty() && i - queue.peekFirst() + 1 > k) { queue.pollFirst(); } } return nums[nums.length - 1]; } } //idea:dp+mono-deque //time:O(N) //sapce:O(N)
[ "noreply@github.com" ]
noreply@github.com
e8577a6dda52a7b95c635de0de2bab996eca1784
219e8ca082fc7acfc40baa691faf6162ade34b62
/src/javaCollectionsFramework/queue/TestQueue.java
32c994a714892b70ec63612fdc3a9e868e81838e
[]
no_license
Vadim-BG/Advanced_JAVA
8aaf2deeac488e5e21cbb22a5ecf7e0f7556056e
3b0dc6c11baf801d7afa0f50d81c640d10637996
refs/heads/master
2021-03-04T08:32:25.139547
2020-04-05T10:58:36
2020-04-05T10:58:36
246,020,078
0
0
null
null
null
null
UTF-8
Java
false
false
1,063
java
package javaCollectionsFramework.queue; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; public class TestQueue { public static void main(String[] args) { Person person1 = new Person(1); Person person2 = new Person(2); Person person3 = new Person(3); Person person4 = new Person(4); Queue<Person> people = new ArrayBlockingQueue<Person>(3); System.out.println(people.offer(person3)); System.out.println(people.offer(person2)); System.out.println(people.offer(person4)); System.out.println(people.offer(person1)); // System.out.println(people.remove()); // System.out.println(people.peek()); // System.out.println(people); // for (Person person : people) // System.out.println(person); } } class Person{ private int id; public Person(int id) { this.id = id; } @Override public String toString() { return "Person{" + "id=" + id + '}'; } }
[ "infotourbg.vadim@gmail.com" ]
infotourbg.vadim@gmail.com
e09935ad7fad8e5f3c36a132c453d635ce5cfdb6
c02e73d8a6a80194a9f43eb30a35fc9db5c26886
/ZJboot-master2/src/main/java/cn/xuezhijian2/core/dao/impl/MyBatisPrimaryBaseDaoImpl.java
4c7ceb7abbcfdab583e8b0c5ed7bc1aa01f31d4b
[]
no_license
lihuahuagit/Spring-Demo-Repository
2ca625f86a749c7044e2b6e751b3de4070e838af
718f8661563525fb40362e5264d63e46a59f7676
refs/heads/master
2020-09-10T20:11:56.222947
2017-05-06T07:32:30
2017-05-06T07:32:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,296
java
package cn.xuezhijian2.core.dao.impl; import cn.xuezhijian2.core.annotation.MapperClass; import cn.xuezhijian2.core.dao.BaseDao; import cn.xuezhijian2.core.dto.FlexiPageDto; import cn.xuezhijian2.core.entity.Entity; import com.github.pagehelper.PageHelper; import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.entity.Example; import javax.annotation.Resource; import java.util.List; /** * Created with IntelliJ IDEA. * packageName : cn.xuezhijian2.core.dao.impl * User : zj * Date : 17/4/15 * Time : 下午3:04 * Description : */ @Repository("myBatisPrimaryBaseDao") @SuppressWarnings("unchecked") public class MyBatisPrimaryBaseDaoImpl<T> implements BaseDao<T> { @Resource @Qualifier("primarySqlSessionFactory") private SqlSessionFactory sqlSessionFactory; private SqlSession sqlSession; @SuppressWarnings("rawtypes") public <M extends Mapper<T>> M getMapper(Class cls){ MapperClass mapperClass = (MapperClass) cls.getAnnotation(MapperClass.class); if(null == mapperClass){ throw new RuntimeException("没有注解MapperClass"); } return (M) getSqlSession().getMapper(mapperClass.value()); } @Override public T getEntityById(Class<T> cls, Integer id) { return this.getMapper(cls).selectByPrimaryKey(id); } @Override public void addEntity(T entity) { this.getMapper(entity.getClass()).insert(entity); } @Override public void updateEntity(T entity) { this.getMapper(entity.getClass()).updateByPrimaryKey(entity); } @Override public void deleteEntityById(Class<T> cls, Integer id) { this.getMapper(cls).deleteByPrimaryKey(id); } @Override public List<T> selectAll(Class<T> cls) { return this.getMapper(cls).selectAll(); } @Override public List<T> selectAllByPage(Class<T> cls, Integer pageNum, Integer pageSize) { if (pageNum != null && pageSize != null) { PageHelper.startPage(pageNum, pageSize); } return this.getMapper(cls).selectAll(); } @Override public List<T> findByLike(Example example) { return this.getMapper(example.getEntityClass()).selectByExample(example); } @Override public List<T> findByPage(Example example, FlexiPageDto flexiPageDto) { RowBounds rowBounds = new RowBounds(flexiPageDto.getOffset(), flexiPageDto.getRp()); return this.getMapper(example.getEntityClass()).selectByExampleAndRowBounds(example, rowBounds); } @Override public int findRowCount(Example example) { return this.getMapper(example.getEntityClass()).selectCountByExample(example); } public SqlSession getSqlSession(){ if (null == sqlSession){ synchronized (MyBatisPrimaryBaseDaoImpl.class) { this.sqlSession = new SqlSessionTemplate(sqlSessionFactory); } } return this.sqlSession; } }
[ "746753491@qq.com" ]
746753491@qq.com
0ed98cb48b3265be5ea32e2672ca0a6d11be9677
7b369253375cb2e282753ded5a6a44d8d8573a89
/server+frontend/src/main/java/dao/impl/RecordDaoImpl.java
04ff547228bb41f72329bdf8e23b474e32938978
[]
no_license
myuaggie/wrong_set
b87a8fa7d430293c711ad3371dafdcf92821f53f
8ba3eec74efd237433cca66e977667d379822a0e
refs/heads/master
2020-04-25T15:02:45.855576
2019-04-10T06:07:12
2019-04-10T06:07:12
172,864,360
0
0
null
null
null
null
UTF-8
Java
false
false
2,772
java
package dao.impl; import dao.RecordDao; import model.Record; import model.URKey; import org.hibernate.SessionFactory; import org.hibernate.query.Query; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.io.UnsupportedEncodingException; import java.sql.Blob; import java.util.List; public class RecordDaoImpl implements RecordDao { private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory){this.sessionFactory=sessionFactory;} @Transactional(value = "wrongSetTransactionManager",propagation = Propagation.REQUIRES_NEW) public void save(Record record){ sessionFactory.getCurrentSession().save(record); } @Transactional(value = "wrongSetTransactionManager",propagation = Propagation.REQUIRES_NEW) public void delete(Record record){ sessionFactory.getCurrentSession().delete(record); } @Transactional(value = "wrongSetTransactionManager",propagation = Propagation.REQUIRES_NEW) public void update(Record record){ sessionFactory.getCurrentSession().merge(record); } @Transactional(value = "wrongSetTransactionManager", propagation = Propagation.SUPPORTS, isolation = Isolation.READ_COMMITTED) public Record getRecordByKey(URKey key){ @SuppressWarnings("unchecked") Query<Record> query=sessionFactory.getCurrentSession().createQuery( "from Record as r where r.urKey.userId=? " + "and r.urKey.libraryId=?" + "and r.urKey.recordId=?",Record.class); query.setParameter(0,key.getUserId()) .setParameter(1,key.getLibraryId()) .setParameter(2,key.getRecordId()); List<Record> rs = query.getResultList(); Record r = rs.size() > 0 ? rs.get(0) : null; return r; } @Transactional(value = "wrongSetTransactionManager", propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED) public List<Record> getAllRecords(int userId, int libraryId){ @SuppressWarnings("unchecked") Query<Record> query=sessionFactory.getCurrentSession().createQuery("from Record as r where r.urKey.userId=? " + "and r.urKey.libraryId=? ",Record.class); query.setParameter(0,userId).setParameter(1,libraryId); List<Record> rs = query.getResultList(); return rs; } public Blob convertBlob(String ans) throws UnsupportedEncodingException { byte[] bytes=ans.getBytes("utf-8"); Blob blobContent= sessionFactory.getCurrentSession().getLobHelper().createBlob(bytes); return blobContent; } }
[ "920369216@qq.com" ]
920369216@qq.com
4fc0fa61d994e00d68e11ad44dd522367793d0c4
b9de299c93a3bfe37acbba74343ec838a0e2fd36
/ButtonClickCounter/app/src/androidTest/java/com/ashatechsoln/buttonclickcounter/ApplicationTest.java
65b772487bba3108f4d0d8fdb5de9cc93a8b91d3
[]
no_license
TiwariAnil/Android
0e1e01c15141757c7982a29f22ab0d906efcc579
ae483dc036cd15bee64d660fc27bebea7ac948e3
refs/heads/master
2021-01-17T23:16:49.025696
2016-07-12T10:06:36
2016-07-12T10:06:36
59,872,635
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package com.ashatechsoln.buttonclickcounter; 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); } }
[ "aniltiwari619@gmail.com" ]
aniltiwari619@gmail.com
83dc4f84c5a6611cef0700502c8229a1cbf4258c
532960b369d1364e7ed58e6a3650f3f43c6d7dac
/src/main/java/com/openkm/automation/action/AddCategoryToWizard.java
4bdbb4acc125a3be596446cbe11a42d1ddb02d23
[]
no_license
okelah/openkm-code
f0c02062d909b2d5e185b9784b33a9b8753be948
d9e0687e0c6dab385cac0ce8b975cb92c8867743
refs/heads/master
2021-01-13T15:53:59.286016
2016-08-18T22:06:25
2016-08-18T22:06:25
76,772,981
1
1
null
null
null
null
UTF-8
Java
false
false
2,045
java
/** * OpenKM, Open Document Management System (http://www.openkm.com) * Copyright (c) 2006-2015 Paco Avila & Josep Llort * * No bytes were intentionally harmed during the development of this application. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.openkm.automation.action; import java.util.HashMap; import com.openkm.automation.Action; import com.openkm.automation.AutomationUtils; import com.openkm.bean.FileUploadResponse; /** * AddCategoryToWizard * * @author jllort * */ public class AddCategoryToWizard implements Action { @Override public void executePre(HashMap<String, Object> env, Object... params) { } @Override public void executePost(HashMap<String, Object> env, Object... params) { execute(env, params); } /** * execute * * @param env OpenKM API internal environment data. * @param params Action configured parameters. */ private void execute(HashMap<String, Object> env, Object... params) { if (env.keySet().contains(AutomationUtils.UPLOAD_RESPONSE)) { FileUploadResponse fuResponse = (FileUploadResponse) env.get(AutomationUtils.UPLOAD_RESPONSE); fuResponse.setShowWizardCategories(true); } else { FileUploadResponse fuResponse = new FileUploadResponse(); fuResponse.setShowWizardCategories(true); env.put(AutomationUtils.UPLOAD_RESPONSE, fuResponse); } } }
[ "github@sven-joerns.de" ]
github@sven-joerns.de
964fe3f2865f5f371e2afb31a8139f0b99a50b93
156fe8ada54637bef33366346b043d2a0d139f81
/app/src/main/java/com/example/taskmaster/ViewAdapter.java
b852157e67915afa6e4594348f5d1093016048bf
[]
no_license
AliShiyyab/taskmaster
0bd30f5191702b9521125e64527ba910c322a66a
35c415e344c31ff751bdbed56e37a2a610628f44
refs/heads/main
2023-08-21T15:28:06.979050
2021-09-15T12:17:47
2021-09-15T12:17:47
401,048,942
0
0
null
2021-09-15T12:17:48
2021-08-29T13:29:45
Java
UTF-8
Java
false
false
2,332
java
package com.example.taskmaster; import android.content.Intent; import android.view.ViewGroup; import android.view.View; import android.widget.TextView; import android.view.LayoutInflater; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import androidx.room.Delete; import com.amplifyframework.datastore.generated.model.taskmaster; import com.amplifyframework.datastore.generated.model.team; import com.example.taskmaster.R; import java.util.ArrayList; import java.util.List; public class ViewAdapter extends RecyclerView.Adapter<ViewAdapter.TaskViewHolder> { private ArrayList<taskmaster> taskList = new ArrayList<>(); public ViewAdapter(ArrayList<taskmaster> allTasks){ this.taskList = allTasks; } public static class TaskViewHolder extends RecyclerView.ViewHolder{ public taskmaster task; View itemView; public TaskViewHolder(@NonNull View itemView){ super(itemView); this.itemView = itemView; itemView.setOnClickListener(View->{ Intent intent = new Intent(View.getContext(), Details.class); intent.putExtra("TaskName" , task.getTitle()); intent.putExtra("TaskBody" , task.getBody()); intent.putExtra("TaskState" , task.getState()); View.getContext().startActivity(intent); }); } } @NonNull @Override public ViewAdapter.TaskViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_fragment_task,parent,false); return new TaskViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewAdapter.TaskViewHolder holder, int position) { holder.task = taskList.get(position); TextView taskTitle = holder.itemView.findViewById(R.id.taskTitle); TextView taskBody = holder.itemView.findViewById(R.id.taskBody); TextView taskState = holder.itemView.findViewById(R.id.taskState); taskTitle.setText(holder.task.getTitle()); taskBody.setText(holder.task.getBody()); taskState.setText(holder.task.getState()); } @Override public int getItemCount() { return taskList.size(); } }
[ "alishiyyab1998@gmail.com" ]
alishiyyab1998@gmail.com
4b6f0a8323eb897961a7664c7f0b848d9649a236
f4f90aa4726957c02aa8a27262979a75bfd6aab6
/src/com/oci/dao/MaterialTypeDAOImpl.java
3a393efea74a2fd543c2bf3571288f58a6e78dd2
[]
no_license
RicardoShaw/OCI
3e4dc39ac13f7c843576590d02e97dcbdbff1cca
e2129f9f6a88748da9c1bd178d0299a7b4f28dff
refs/heads/master
2021-01-23T06:14:32.480085
2017-06-07T15:53:53
2017-06-07T15:53:53
93,015,305
0
1
null
null
null
null
UTF-8
Java
false
false
4,102
java
/** * @Title: MaterialTypeDAOImpl.java * @Package com.oci.dao * @Description: TODO(用一句话描述该文件做什么) * @author RicardoShaw * @Email Ricardo_Shaw@outlook.com * @date 2017年5月28日 下午9:25:49 * @version V1.0 */ package com.oci.dao; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.oci.domain.MaterialType; import com.oci.domain.searcher.MaterialTypeSearcher; import com.oci.domain.vo.MaterialTypeVo; import com.oci.mapper.MaterialTypeMapper; /** * @ClassName: MaterialTypeDAOImpl * @Description: TODO(这里用一句话描述这个类的作用) * @author RicardoShaw * @Email Ricardo_Shaw@outlook.com * @date 2017年5月28日 下午9:25:49 * */ @Repository public class MaterialTypeDAOImpl implements MaterialTypeDAO{ @Autowired private MaterialTypeMapper materialTypeMapper; public void setMaterialTypeMapper(MaterialTypeMapper materialTypeMapper) { this.materialTypeMapper = materialTypeMapper; } /* (非 Javadoc) * <p>Title: findAllMaterialTypeVo</p> * <p>Description: </p> * @return * @see com.oci.dao.MaterialTypeDAO#findAllMaterialTypeVo() */ @Override public List<MaterialTypeVo> findAllMaterialTypeVo() { // TODO Auto-generated method stub return materialTypeMapper.findAllMaterialTypeVo(); } /* (非 Javadoc) * <p>Title: findMaterialType</p> * <p>Description: </p> * @param typeId * @return * @see com.oci.dao.MaterialTypeDAO#findMaterialType(java.lang.Integer) */ @Override public MaterialType findMaterialType(Integer typeId) { // TODO Auto-generated method stub return materialTypeMapper.findMaterialType(typeId); } /* (非 Javadoc) * <p>Title: findMaterialTypeVo</p> * <p>Description: </p> * @param typeId * @return * @see com.oci.dao.MaterialTypeDAO#findMaterialTypeVo(java.lang.Integer) */ @Override public MaterialTypeVo findMaterialTypeVo(Integer typeId) { // TODO Auto-generated method stub return materialTypeMapper.findMaterialTypeVo(typeId); } /* (非 Javadoc) * <p>Title: updateMaterialType</p> * <p>Description: </p> * @param materialType * @see com.oci.dao.MaterialTypeDAO#updateMaterialType(com.oci.domain.MaterialType) */ @Override public void updateMaterialType(MaterialType materialType) { // TODO Auto-generated method stub materialTypeMapper.updateMaterialType(materialType); } /* (非 Javadoc) * <p>Title: insertMaterialType</p> * <p>Description: </p> * @param materialType * @see com.oci.dao.MaterialTypeDAO#insertMaterialType(com.oci.domain.MaterialType) */ @Override public void insertMaterialType(MaterialType materialType) { // TODO Auto-generated method stub materialTypeMapper.insertMaterialType(materialType); } /* (非 Javadoc) * <p>Title: deleteMaterialTypes</p> * <p>Description: </p> * @param typeIds * @see com.oci.dao.MaterialTypeDAO#deleteMaterialTypes(java.util.List) */ @Override public void deleteMaterialTypes(List<Integer> typeIds) { // TODO Auto-generated method stub materialTypeMapper.deleteMaterialTypes(typeIds); } /* (非 Javadoc) * <p>Title: deleteMaterialType</p> * <p>Description: </p> * @param typeId * @see com.oci.dao.MaterialTypeDAO#deleteMaterialType(java.lang.Integer) */ @Override public void deleteMaterialType(Integer typeId) { // TODO Auto-generated method stub materialTypeMapper.deleteMaterialType(typeId); } /* (非 Javadoc) * <p>Title: findMaterialTypeVos</p> * <p>Description: </p> * @param materialType * @return * @see com.oci.dao.MaterialTypeDAO#findMaterialTypeVos(com.oci.domain.searcher.MaterialTypeSearcher) */ @Override public List<MaterialTypeVo> findMaterialTypeVos( MaterialTypeSearcher materialType) { // TODO Auto-generated method stub return materialTypeMapper.findMaterialTypeVos(materialType); } }
[ "RicardoShaw@qq.com" ]
RicardoShaw@qq.com
3029b3241fd6bb6fa81e8c2b26e3aca8da66377b
6045518db77c6104b4f081381f61c26e0d19d5db
/datasets/file_version_per_commit_backup/jruby/5d9280cf90ab1ee2923ed794a55992637fd5d596.java
942db4bcc9bf1568f994bec48ad7f1a646005d40
[]
no_license
edisutoyo/msr16_td_removal
6e039da7fed166b81ede9b33dcc26ca49ba9259c
41b07293c134496ba1072837e1411e05ed43eb75
refs/heads/master
2023-03-22T21:40:42.993910
2017-09-22T09:19:51
2017-09-22T09:19:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
121,610
java
/* ***** BEGIN LICENSE BLOCK ***** * Version: CPL 1.0/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Common Public * License Version 1.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.eclipse.org/legal/cpl-v10.html * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * Copyright (C) 2006 Charles O Nutter <headius@headius.com> * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the CPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the CPL, the GPL or the LGPL. ***** END LICENSE BLOCK *****/ package org.jruby.compiler.impl; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import org.jruby.MetaClass; import org.jruby.Ruby; import org.jruby.RubyArray; import org.jruby.RubyBignum; import org.jruby.RubyBoolean; import org.jruby.RubyClass; import org.jruby.RubyException; import org.jruby.RubyFloat; import org.jruby.RubyHash; import org.jruby.RubyInstanceConfig; import org.jruby.RubyMatchData; import org.jruby.RubyModule; import org.jruby.RubyRange; import org.jruby.RubyRegexp; import org.jruby.RubyString; import org.jruby.RubySymbol; import org.jruby.ast.NodeType; import org.jruby.ast.executable.AbstractScript; import org.jruby.ast.util.ArgsUtil; import org.jruby.compiler.ASTInspector; import org.jruby.compiler.ArrayCallback; import org.jruby.compiler.BranchCallback; import org.jruby.compiler.CacheCompiler; import org.jruby.compiler.CompilerCallback; import org.jruby.compiler.InvocationCompiler; import org.jruby.compiler.MethodCompiler; import org.jruby.compiler.NotCompilableException; import org.jruby.compiler.ScriptCompiler; import org.jruby.compiler.VariableCompiler; import org.jruby.exceptions.JumpException; import org.jruby.exceptions.RaiseException; import org.jruby.internal.runtime.GlobalVariables; import org.jruby.internal.runtime.methods.CallConfiguration; import org.jruby.internal.runtime.methods.DynamicMethod; import org.jruby.javasupport.util.RuntimeHelpers; import org.jruby.lexer.yacc.ISourcePosition; import org.jruby.parser.ReOptions; import org.jruby.parser.StaticScope; import org.jruby.runtime.Arity; import org.jruby.runtime.Block; import org.jruby.runtime.BlockBody; import org.jruby.runtime.CompiledBlockCallback; import org.jruby.runtime.DynamicScope; import org.jruby.runtime.Frame; import org.jruby.runtime.ThreadContext; import org.jruby.runtime.Visibility; import org.jruby.runtime.builtin.IRubyObject; import org.jruby.runtime.builtin.InstanceVariables; import org.jruby.util.ByteList; import static org.jruby.util.CodegenUtils.*; import org.jruby.util.JRubyClassLoader; import org.jruby.util.JavaNameMangler; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Label; import org.objectweb.asm.Opcodes; import org.objectweb.asm.util.CheckClassAdapter; /** * * @author headius */ public class StandardASMCompiler implements ScriptCompiler, Opcodes { private static final String THREADCONTEXT = p(ThreadContext.class); private static final String RUBY = p(Ruby.class); private static final String IRUBYOBJECT = p(IRubyObject.class); public static final String[] METHOD_SIGNATURES = { sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, Block.class}), sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, IRubyObject.class, Block.class}), sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, IRubyObject.class, IRubyObject.class, Block.class}), sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, IRubyObject.class, IRubyObject.class, IRubyObject.class, Block.class}), sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, IRubyObject[].class, Block.class}), }; private static final String CLOSURE_SIGNATURE = sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, IRubyObject.class}); public static final int THIS = 0; public static final int THREADCONTEXT_INDEX = 1; public static final int SELF_INDEX = 2; public static final int ARGS_INDEX = 3; public static final int CLOSURE_OFFSET = 0; public static final int DYNAMIC_SCOPE_OFFSET = 1; public static final int RUNTIME_OFFSET = 2; public static final int VARS_ARRAY_OFFSET = 3; public static final int NIL_OFFSET = 4; public static final int EXCEPTION_OFFSET = 5; public static final int PREVIOUS_EXCEPTION_OFFSET = 6; public static final int FIRST_TEMP_OFFSET = 7; private String classname; private String sourcename; private ClassWriter classWriter; private SkinnyMethodAdapter initMethod; private SkinnyMethodAdapter clinitMethod; int methodIndex = -1; int innerIndex = -1; int fieldIndex = 0; int rescueNumber = 1; int ensureNumber = 1; StaticScope topLevelScope; CacheCompiler cacheCompiler; /** Creates a new instance of StandardCompilerContext */ public StandardASMCompiler(String classname, String sourcename) { this.classname = classname; this.sourcename = sourcename; } public byte[] getClassByteArray() { return classWriter.toByteArray(); } public Class<?> loadClass(JRubyClassLoader classLoader) throws ClassNotFoundException { classLoader.defineClass(c(classname), classWriter.toByteArray()); return classLoader.loadClass(c(classname)); } public void writeClass(File destination) throws IOException { writeClass(classname, destination, classWriter); } private void writeClass(String classname, File destination, ClassWriter writer) throws IOException { String fullname = classname + ".class"; String filename = null; String path = null; // verify the class byte[] bytecode = writer.toByteArray(); CheckClassAdapter.verify(new ClassReader(bytecode), false, new PrintWriter(System.err)); if (fullname.lastIndexOf("/") == -1) { filename = fullname; path = ""; } else { filename = fullname.substring(fullname.lastIndexOf("/") + 1); path = fullname.substring(0, fullname.lastIndexOf("/")); } // create dir if necessary File pathfile = new File(destination, path); pathfile.mkdirs(); FileOutputStream out = new FileOutputStream(new File(pathfile, filename)); out.write(bytecode); out.close(); } public String getClassname() { return classname; } public String getSourcename() { return sourcename; } public ClassVisitor getClassVisitor() { return classWriter; } static boolean USE_INHERITED_CACHE_FIELDS = true; public void startScript(StaticScope scope) { classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); // Create the class with the appropriate class name and source file classWriter.visit(RubyInstanceConfig.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER, classname, null, p(AbstractScript.class), null); classWriter.visitSource(sourcename, null); topLevelScope = scope; beginInit(); beginClassInit(); cacheCompiler = new InheritedCacheCompiler(this); } public void endScript(boolean generateRun, boolean generateLoad, boolean generateMain) { // add Script#run impl, used for running this script with a specified threadcontext and self // root method of a script is always in __file__ method String methodName = "__file__"; if (generateLoad || generateMain) { // the load method is used for loading as a top-level script, and prepares appropriate scoping around the code SkinnyMethodAdapter method = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC, "load", METHOD_SIGNATURES[4], null, null)); method.start(); // invoke __file__ with threadcontext, self, args (null), and block (null) Label tryBegin = new Label(); Label tryFinally = new Label(); method.label(tryBegin); method.aload(THREADCONTEXT_INDEX); buildStaticScopeNames(method, topLevelScope); method.invokestatic(p(RuntimeHelpers.class), "preLoad", sig(void.class, ThreadContext.class, String[].class)); method.aload(THIS); method.aload(THREADCONTEXT_INDEX); method.aload(SELF_INDEX); method.aload(ARGS_INDEX); // load always uses IRubyObject[], so simple closure offset calculation here method.aload(ARGS_INDEX + 1 + CLOSURE_OFFSET); method.invokevirtual(classname, methodName, METHOD_SIGNATURES[4]); method.aload(THREADCONTEXT_INDEX); method.invokestatic(p(RuntimeHelpers.class), "postLoad", sig(void.class, ThreadContext.class)); method.areturn(); method.label(tryFinally); method.aload(THREADCONTEXT_INDEX); method.invokestatic(p(RuntimeHelpers.class), "postLoad", sig(void.class, ThreadContext.class)); method.athrow(); method.trycatch(tryBegin, tryFinally, tryFinally, null); method.end(); } if (generateMain) { // add main impl, used for detached or command-line execution of this script with a new runtime // root method of a script is always in stub0, method0 SkinnyMethodAdapter method = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC | ACC_STATIC, "main", sig(Void.TYPE, params(String[].class)), null, null)); method.start(); // new instance to invoke run against method.newobj(classname); method.dup(); method.invokespecial(classname, "<init>", sig(Void.TYPE)); // instance config for the script run method.newobj(p(RubyInstanceConfig.class)); method.dup(); method.invokespecial(p(RubyInstanceConfig.class), "<init>", "()V"); // set argv from main's args method.dup(); method.aload(0); method.invokevirtual(p(RubyInstanceConfig.class), "setArgv", sig(void.class, String[].class)); // invoke run with threadcontext and topself method.invokestatic(p(Ruby.class), "newInstance", sig(Ruby.class, RubyInstanceConfig.class)); method.dup(); method.invokevirtual(RUBY, "getCurrentContext", sig(ThreadContext.class)); method.swap(); method.invokevirtual(RUBY, "getTopSelf", sig(IRubyObject.class)); method.getstatic(p(IRubyObject.class), "NULL_ARRAY", ci(IRubyObject[].class)); method.getstatic(p(Block.class), "NULL_BLOCK", ci(Block.class)); method.invokevirtual(classname, "load", METHOD_SIGNATURES[4]); method.voidreturn(); method.end(); } // add setPosition impl, which stores filename as constant to speed updates SkinnyMethodAdapter method = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PRIVATE | ACC_STATIC | ACC_SYNTHETIC, "setPosition", sig(Void.TYPE, params(ThreadContext.class, int.class)), null, null)); method.start(); method.aload(0); // thread context method.ldc(sourcename); method.iload(1); // line number method.invokevirtual(p(ThreadContext.class), "setFileAndLine", sig(void.class, String.class, int.class)); method.voidreturn(); method.end(); endInit(); endClassInit(); } public void buildStaticScopeNames(SkinnyMethodAdapter method, StaticScope scope) { // construct static scope list of names method.pushInt(scope.getNumberOfVariables()); method.anewarray(p(String.class)); for (int i = 0; i < scope.getNumberOfVariables(); i++) { method.dup(); method.pushInt(i); method.ldc(scope.getVariables()[i]); method.arraystore(); } } private void beginInit() { ClassVisitor cv = getClassVisitor(); initMethod = new SkinnyMethodAdapter(cv.visitMethod(ACC_PUBLIC, "<init>", sig(Void.TYPE), null, null)); initMethod.start(); initMethod.aload(THIS); if (USE_INHERITED_CACHE_FIELDS) { initMethod.invokespecial(p(AbstractScript.class), "<init>", sig(Void.TYPE)); } else { initMethod.invokespecial(p(Object.class), "<init>", sig(Void.TYPE)); } cv.visitField(ACC_PRIVATE | ACC_FINAL, "$class", ci(Class.class), null, null); // FIXME: this really ought to be in clinit, but it doesn't matter much initMethod.aload(THIS); initMethod.ldc(c(classname)); initMethod.invokestatic(p(Class.class), "forName", sig(Class.class, params(String.class))); initMethod.putfield(classname, "$class", ci(Class.class)); } private void endInit() { initMethod.voidreturn(); initMethod.end(); } private void beginClassInit() { ClassVisitor cv = getClassVisitor(); clinitMethod = new SkinnyMethodAdapter(cv.visitMethod(ACC_PUBLIC | ACC_STATIC, "<clinit>", sig(Void.TYPE), null, null)); clinitMethod.start(); } private void endClassInit() { clinitMethod.voidreturn(); clinitMethod.end(); } public SkinnyMethodAdapter getInitMethod() { return initMethod; } public SkinnyMethodAdapter getClassInitMethod() { return clinitMethod; } public CacheCompiler getCacheCompiler() { return cacheCompiler; } public MethodCompiler startMethod(String friendlyName, CompilerCallback args, StaticScope scope, ASTInspector inspector) { ASMMethodCompiler methodCompiler = new ASMMethodCompiler(friendlyName, inspector, scope); methodCompiler.beginMethod(args, scope); // Emite a nop, to mark the end of the method preamble methodCompiler.method.nop(); return methodCompiler; } public abstract class AbstractMethodCompiler implements MethodCompiler { protected SkinnyMethodAdapter method; protected VariableCompiler variableCompiler; protected InvocationCompiler invocationCompiler; protected int argParamCount; protected Label[] currentLoopLabels; protected Label scopeStart; protected Label scopeEnd; protected Label redoJump; protected boolean withinProtection = false; private int lastLine = -1; private int lastPositionLine = -1; protected StaticScope scope; public AbstractMethodCompiler(StaticScope scope) { this.scope = scope; if (scope.getRestArg() >= 0 || scope.getOptionalArgs() > 0 || scope.getRequiredArgs() > 3) { argParamCount = 1; // use IRubyObject[] } else { argParamCount = scope.getRequiredArgs(); // specific arity } } public abstract void beginMethod(CompilerCallback args, StaticScope scope); public abstract void endMethod(); public MethodCompiler chainToMethod(String methodName, ASTInspector inspector) { // chain to the next segment of this giant method method.aload(THIS); loadThreadContext(); loadSelf(); if(this instanceof ASMClosureCompiler) { pushNull(); } else { loadBlock(); } method.invokevirtual(classname, methodName, sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, Block.class})); endMethod(); ASMMethodCompiler methodCompiler = new ASMMethodCompiler(methodName, inspector, scope); methodCompiler.beginChainedMethod(); return methodCompiler; } public StandardASMCompiler getScriptCompiler() { return StandardASMCompiler.this; } public void lineNumber(ISourcePosition position) { int thisLine = position.getStartLine(); // No point in updating number if last number was same value. if (thisLine != lastLine) { lastLine = thisLine; } else { return; } Label line = new Label(); method.label(line); method.visitLineNumber(thisLine + 1, line); } public void loadThreadContext() { method.aload(THREADCONTEXT_INDEX); } public void loadSelf() { method.aload(SELF_INDEX); } protected int getClosureIndex() { return ARGS_INDEX + argParamCount + CLOSURE_OFFSET; } protected int getRuntimeIndex() { return ARGS_INDEX + argParamCount + RUNTIME_OFFSET; } protected int getNilIndex() { return ARGS_INDEX + argParamCount + NIL_OFFSET; } protected int getPreviousExceptionIndex() { return ARGS_INDEX + argParamCount + PREVIOUS_EXCEPTION_OFFSET; } protected int getDynamicScopeIndex() { return ARGS_INDEX + argParamCount + DYNAMIC_SCOPE_OFFSET; } protected int getVarsArrayIndex() { return ARGS_INDEX + argParamCount + VARS_ARRAY_OFFSET; } protected int getFirstTempIndex() { return ARGS_INDEX + argParamCount + FIRST_TEMP_OFFSET; } protected int getExceptionIndex() { return ARGS_INDEX + argParamCount + EXCEPTION_OFFSET; } public void loadThis() { method.aload(THIS); } public void loadRuntime() { method.aload(getRuntimeIndex()); } public void loadBlock() { method.aload(getClosureIndex()); } public void loadNil() { method.aload(getNilIndex()); } public void loadNull() { method.aconst_null(); } public void loadSymbol(String symbol) { loadRuntime(); method.ldc(symbol); invokeIRuby("newSymbol", sig(RubySymbol.class, params(String.class))); } public void loadObject() { loadRuntime(); invokeIRuby("getObject", sig(RubyClass.class, params())); } /** * This is for utility methods used by the compiler, to reduce the amount of code generation * necessary. All of these live in CompilerHelpers. */ public void invokeUtilityMethod(String methodName, String signature) { method.invokestatic(p(RuntimeHelpers.class), methodName, signature); } public void invokeThreadContext(String methodName, String signature) { method.invokevirtual(THREADCONTEXT, methodName, signature); } public void invokeIRuby(String methodName, String signature) { method.invokevirtual(RUBY, methodName, signature); } public void invokeIRubyObject(String methodName, String signature) { method.invokeinterface(IRUBYOBJECT, methodName, signature); } public void consumeCurrentValue() { method.pop(); } public void duplicateCurrentValue() { method.dup(); } public void swapValues() { method.swap(); } public void retrieveSelf() { loadSelf(); } public void retrieveSelfClass() { loadSelf(); metaclass(); } public VariableCompiler getVariableCompiler() { return variableCompiler; } public InvocationCompiler getInvocationCompiler() { return invocationCompiler; } public void assignConstantInCurrent(String name) { loadThreadContext(); method.ldc(name); method.dup2_x1(); method.pop2(); invokeThreadContext("setConstantInCurrent", sig(IRubyObject.class, params(String.class, IRubyObject.class))); } public void assignConstantInModule(String name) { method.ldc(name); loadThreadContext(); invokeUtilityMethod("setConstantInModule", sig(IRubyObject.class, IRubyObject.class, IRubyObject.class, String.class, ThreadContext.class)); } public void assignConstantInObject(String name) { // load Object under value loadRuntime(); invokeIRuby("getObject", sig(RubyClass.class, params())); method.swap(); assignConstantInModule(name); } public void retrieveConstant(String name) { loadThreadContext(); method.ldc(name); invokeThreadContext("getConstant", sig(IRubyObject.class, params(String.class))); } public void retrieveConstantFromModule(String name) { method.visitTypeInsn(CHECKCAST, p(RubyModule.class)); method.ldc(name); method.invokevirtual(p(RubyModule.class), "fastGetConstantFrom", sig(IRubyObject.class, params(String.class))); } public void retrieveClassVariable(String name) { loadThreadContext(); loadRuntime(); loadSelf(); method.ldc(name); invokeUtilityMethod("fastFetchClassVariable", sig(IRubyObject.class, params(ThreadContext.class, Ruby.class, IRubyObject.class, String.class))); } public void assignClassVariable(String name) { loadThreadContext(); method.swap(); loadRuntime(); method.swap(); loadSelf(); method.swap(); method.ldc(name); method.swap(); invokeUtilityMethod("fastSetClassVariable", sig(IRubyObject.class, params(ThreadContext.class, Ruby.class, IRubyObject.class, String.class, IRubyObject.class))); } public void assignClassVariable(String name, CompilerCallback value) { loadThreadContext(); loadRuntime(); loadSelf(); method.ldc(name); value.call(this); invokeUtilityMethod("fastSetClassVariable", sig(IRubyObject.class, params(ThreadContext.class, Ruby.class, IRubyObject.class, String.class, IRubyObject.class))); } public void declareClassVariable(String name) { loadThreadContext(); method.swap(); loadRuntime(); method.swap(); loadSelf(); method.swap(); method.ldc(name); method.swap(); invokeUtilityMethod("fastDeclareClassVariable", sig(IRubyObject.class, params(ThreadContext.class, Ruby.class, IRubyObject.class, String.class, IRubyObject.class))); } public void declareClassVariable(String name, CompilerCallback value) { loadThreadContext(); loadRuntime(); loadSelf(); method.ldc(name); value.call(this); invokeUtilityMethod("fastDeclareClassVariable", sig(IRubyObject.class, params(ThreadContext.class, Ruby.class, IRubyObject.class, String.class, IRubyObject.class))); } public void createNewFloat(double value) { loadRuntime(); method.ldc(new Double(value)); invokeIRuby("newFloat", sig(RubyFloat.class, params(Double.TYPE))); } public void createNewFixnum(long value) { cacheCompiler.cacheFixnum(this, value); // // if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) { // switch ((int)value) { // case -1: // method.invokestatic(p(RubyFixnum.class), "minus_one", sig(RubyFixnum.class, Ruby.class)); // break; // case 0: // method.invokestatic(p(RubyFixnum.class), "zero", sig(RubyFixnum.class, Ruby.class)); // break; // case 1: // method.invokestatic(p(RubyFixnum.class), "one", sig(RubyFixnum.class, Ruby.class)); // break; // case 2: // method.invokestatic(p(RubyFixnum.class), "two", sig(RubyFixnum.class, Ruby.class)); // break; // case 3: // method.invokestatic(p(RubyFixnum.class), "three", sig(RubyFixnum.class, Ruby.class)); // break; // case 4: // method.invokestatic(p(RubyFixnum.class), "four", sig(RubyFixnum.class, Ruby.class)); // break; // case 5: // method.invokestatic(p(RubyFixnum.class), "five", sig(RubyFixnum.class, Ruby.class)); // break; // default: // method.pushInt((int)value); // invokeIRuby("newFixnum", sig(RubyFixnum.class, params(int.class))); // } // } else { // method.ldc(new Long(value)); // // invokeIRuby("newFixnum", sig(RubyFixnum.class, params(long.class))); // } } public void createNewBignum(BigInteger value) { loadRuntime(); getCacheCompiler().cacheBigInteger(this, value); method.invokestatic(p(RubyBignum.class), "newBignum", sig(RubyBignum.class, params(Ruby.class, BigInteger.class))); } public void createNewString(ArrayCallback callback, int count) { loadRuntime(); invokeIRuby("newString", sig(RubyString.class, params())); for (int i = 0; i < count; i++) { callback.nextValue(this, null, i); method.invokevirtual(p(RubyString.class), "append", sig(RubyString.class, params(IRubyObject.class))); } } public void createNewSymbol(ArrayCallback callback, int count) { loadRuntime(); createNewString(callback, count); toJavaString(); invokeIRuby("newSymbol", sig(RubySymbol.class, params(String.class))); } public void createNewString(ByteList value) { // FIXME: this is sub-optimal, storing string value in a java.lang.String again loadRuntime(); getCacheCompiler().cacheByteList(this, value.toString()); invokeIRuby("newStringShared", sig(RubyString.class, params(ByteList.class))); } public void createNewSymbol(String name) { getCacheCompiler().cacheSymbol(this, name); } public void createNewArray(boolean lightweight) { loadRuntime(); // put under object array already present method.swap(); if (lightweight) { method.invokestatic(p(RubyArray.class), "newArrayNoCopyLight", sig(RubyArray.class, params(Ruby.class, IRubyObject[].class))); } else { method.invokestatic(p(RubyArray.class), "newArrayNoCopy", sig(RubyArray.class, params(Ruby.class, IRubyObject[].class))); } } public void createNewArray(Object[] sourceArray, ArrayCallback callback, boolean lightweight) { loadRuntime(); createObjectArray(sourceArray, callback); if (lightweight) { method.invokestatic(p(RubyArray.class), "newArrayNoCopyLight", sig(RubyArray.class, params(Ruby.class, IRubyObject[].class))); } else { method.invokestatic(p(RubyArray.class), "newArrayNoCopy", sig(RubyArray.class, params(Ruby.class, IRubyObject[].class))); } } public void createEmptyArray() { loadRuntime(); invokeIRuby("newArray", sig(RubyArray.class, params())); } public void createObjectArray(Object[] sourceArray, ArrayCallback callback) { buildObjectArray(IRUBYOBJECT, sourceArray, callback); } public void createObjectArray(int elementCount) { // if element count is less than 6, use helper methods if (elementCount < 6) { Class[] params = new Class[elementCount]; Arrays.fill(params, IRubyObject.class); invokeUtilityMethod("constructObjectArray", sig(IRubyObject[].class, params)); } else { // This is pretty inefficient for building an array, so just raise an error if someone's using it for a lot of elements throw new NotCompilableException("Don't use createObjectArray(int) for more than 5 elements"); } } private void buildObjectArray(String type, Object[] sourceArray, ArrayCallback callback) { if (sourceArray.length == 0) { method.getstatic(p(IRubyObject.class), "NULL_ARRAY", ci(IRubyObject[].class)); } else if (sourceArray.length <= RuntimeHelpers.MAX_SPECIFIC_ARITY_OBJECT_ARRAY) { // if we have a specific-arity helper to construct an array for us, use that for (int i = 0; i < sourceArray.length; i++) { callback.nextValue(this, sourceArray, i); } invokeUtilityMethod("constructObjectArray", sig(IRubyObject[].class, params(IRubyObject.class, sourceArray.length))); } else { // brute force construction inline method.pushInt(sourceArray.length); method.anewarray(type); for (int i = 0; i < sourceArray.length; i++) { method.dup(); method.pushInt(i); callback.nextValue(this, sourceArray, i); method.arraystore(); } } } public void createEmptyHash() { loadRuntime(); method.invokestatic(p(RubyHash.class), "newHash", sig(RubyHash.class, params(Ruby.class))); } public void createNewHash(Object elements, ArrayCallback callback, int keyCount) { loadRuntime(); if (keyCount <= RuntimeHelpers.MAX_SPECIFIC_ARITY_HASH) { // we have a specific-arity method we can use to construct, so use that for (int i = 0; i < keyCount; i++) { callback.nextValue(this, elements, i); } invokeUtilityMethod("constructHash", sig(RubyHash.class, params(Ruby.class, IRubyObject.class, keyCount * 2))); } else { method.invokestatic(p(RubyHash.class), "newHash", sig(RubyHash.class, params(Ruby.class))); for (int i = 0; i < keyCount; i++) { method.dup(); callback.nextValue(this, elements, i); method.invokevirtual(p(RubyHash.class), "fastASet", sig(void.class, params(IRubyObject.class, IRubyObject.class))); } } } public void createNewRange(boolean isExclusive) { loadRuntime(); loadThreadContext(); // could be more efficient with a callback method.dup2_x2(); method.pop2(); if (isExclusive) { method.invokestatic(p(RubyRange.class), "newExclusiveRange", sig(RubyRange.class, params(Ruby.class, ThreadContext.class, IRubyObject.class, IRubyObject.class))); } else { method.invokestatic(p(RubyRange.class), "newInclusiveRange", sig(RubyRange.class, params(Ruby.class, ThreadContext.class, IRubyObject.class, IRubyObject.class))); } } /** * Invoke IRubyObject.isTrue */ private void isTrue() { invokeIRubyObject("isTrue", sig(Boolean.TYPE)); } public void performBooleanBranch(BranchCallback trueBranch, BranchCallback falseBranch) { Label afterJmp = new Label(); Label falseJmp = new Label(); // call isTrue on the result isTrue(); method.ifeq(falseJmp); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(afterJmp); // FIXME: optimize for cases where we have no false branch method.label(falseJmp); falseBranch.branch(this); method.label(afterJmp); } public void performLogicalAnd(BranchCallback longBranch) { Label falseJmp = new Label(); // dup it since we need to return appropriately if it's false method.dup(); // call isTrue on the result isTrue(); method.ifeq(falseJmp); // EQ == 0 (i.e. false) // pop the extra result and replace with the send part of the AND method.pop(); longBranch.branch(this); method.label(falseJmp); } public void performLogicalOr(BranchCallback longBranch) { // FIXME: after jump is not in here. Will if ever be? //Label afterJmp = new Label(); Label falseJmp = new Label(); // dup it since we need to return appropriately if it's false method.dup(); // call isTrue on the result isTrue(); method.ifne(falseJmp); // EQ == 0 (i.e. false) // pop the extra result and replace with the send part of the AND method.pop(); longBranch.branch(this); method.label(falseJmp); } public void performBooleanLoopSafe(BranchCallback condition, BranchCallback body, boolean checkFirst) { String mname = getNewRescueName(); String signature = sig(IRubyObject.class, new Class[]{ThreadContext.class, IRubyObject.class, Block.class}); SkinnyMethodAdapter mv = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC | ACC_SYNTHETIC, mname, signature, null, null)); SkinnyMethodAdapter old_method = null; SkinnyMethodAdapter var_old_method = null; SkinnyMethodAdapter inv_old_method = null; boolean oldWithinProtection = withinProtection; withinProtection = true; Label[] oldLoopLabels = currentLoopLabels; currentLoopLabels = null; int oldArgCount = argParamCount; argParamCount = 0; // synthetic methods always have zero arg parameters try { old_method = this.method; var_old_method = getVariableCompiler().getMethodAdapter(); inv_old_method = getInvocationCompiler().getMethodAdapter(); this.method = mv; getVariableCompiler().setMethodAdapter(mv); getInvocationCompiler().setMethodAdapter(mv); mv.visitCode(); // set up a local IRuby variable mv.aload(THREADCONTEXT_INDEX); mv.dup(); mv.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class)); mv.dup(); mv.astore(getRuntimeIndex()); // store previous exception for restoration if we rescue something loadRuntime(); invokeUtilityMethod("getErrorInfo", sig(IRubyObject.class, Ruby.class)); mv.astore(getPreviousExceptionIndex()); // grab nil for local variables mv.invokevirtual(p(Ruby.class), "getNil", sig(IRubyObject.class)); mv.astore(getNilIndex()); mv.invokevirtual(p(ThreadContext.class), "getCurrentScope", sig(DynamicScope.class)); mv.dup(); mv.astore(getDynamicScopeIndex()); mv.invokevirtual(p(DynamicScope.class), "getValues", sig(IRubyObject[].class)); mv.astore(getVarsArrayIndex()); performBooleanLoop(condition, body, checkFirst); mv.areturn(); mv.visitMaxs(1, 1); mv.visitEnd(); } finally { withinProtection = oldWithinProtection; this.method = old_method; getVariableCompiler().setMethodAdapter(var_old_method); getInvocationCompiler().setMethodAdapter(inv_old_method); currentLoopLabels = oldLoopLabels; argParamCount = oldArgCount; } method.aload(THIS); loadThreadContext(); loadSelf(); if(this instanceof ASMClosureCompiler) { pushNull(); } else { loadBlock(); } method.invokevirtual(classname, mname, signature); } public void performBooleanLoop(BranchCallback condition, BranchCallback body, boolean checkFirst) { // FIXME: handle next/continue, break, etc Label tryBegin = new Label(); Label tryEnd = new Label(); Label catchRedo = new Label(); Label catchNext = new Label(); Label catchBreak = new Label(); Label catchRaised = new Label(); Label endOfBody = new Label(); Label conditionCheck = new Label(); Label topOfBody = new Label(); Label done = new Label(); Label normalLoopEnd = new Label(); method.trycatch(tryBegin, tryEnd, catchRedo, p(JumpException.RedoJump.class)); method.trycatch(tryBegin, tryEnd, catchNext, p(JumpException.NextJump.class)); method.trycatch(tryBegin, tryEnd, catchBreak, p(JumpException.BreakJump.class)); if (checkFirst) { // only while loops seem to have this RaiseException magic method.trycatch(tryBegin, tryEnd, catchRaised, p(RaiseException.class)); } method.label(tryBegin); { Label[] oldLoopLabels = currentLoopLabels; currentLoopLabels = new Label[] {endOfBody, topOfBody, done}; // FIXME: if we terminate immediately, this appears to break while in method arguments // we need to push a nil for the cases where we will never enter the body if (checkFirst) { method.go_to(conditionCheck); } method.label(topOfBody); body.branch(this); method.label(endOfBody); // clear body or next result after each successful loop method.pop(); method.label(conditionCheck); // check the condition condition.branch(this); isTrue(); method.ifne(topOfBody); // NE == nonzero (i.e. true) currentLoopLabels = oldLoopLabels; } method.label(tryEnd); // skip catch block method.go_to(normalLoopEnd); // catch logic for flow-control exceptions { // redo jump { method.label(catchRedo); method.pop(); method.go_to(topOfBody); } // next jump { method.label(catchNext); method.pop(); // exceptionNext target is for a next that doesn't push a new value, like this one method.go_to(conditionCheck); } // break jump { method.label(catchBreak); loadBlock(); invokeUtilityMethod("breakJumpInWhile", sig(IRubyObject.class, JumpException.BreakJump.class, Block.class)); method.go_to(done); } // FIXME: This generates a crapload of extra code that is frequently *never* needed // raised exception if (checkFirst) { // only while loops seem to have this RaiseException magic method.label(catchRaised); Label raiseNext = new Label(); Label raiseRedo = new Label(); Label raiseRethrow = new Label(); method.dup(); invokeUtilityMethod("getLocalJumpTypeOrRethrow", sig(String.class, params(RaiseException.class))); // if we get here we have a RaiseException we know is a local jump error and an error type // is it break? method.dup(); // dup string method.ldc("break"); method.invokevirtual(p(String.class), "equals", sig(boolean.class, params(Object.class))); method.ifeq(raiseNext); // pop the extra string, get the break value, and end the loop method.pop(); invokeUtilityMethod("unwrapLocalJumpErrorValue", sig(IRubyObject.class, params(RaiseException.class))); method.go_to(done); // is it next? method.label(raiseNext); method.dup(); method.ldc("next"); method.invokevirtual(p(String.class), "equals", sig(boolean.class, params(Object.class))); method.ifeq(raiseRedo); // pop the extra string and the exception, jump to the condition method.pop2(); method.go_to(conditionCheck); // is it redo? method.label(raiseRedo); method.dup(); method.ldc("redo"); method.invokevirtual(p(String.class), "equals", sig(boolean.class, params(Object.class))); method.ifeq(raiseRethrow); // pop the extra string and the exception, jump to the condition method.pop2(); method.go_to(topOfBody); // just rethrow it method.label(raiseRethrow); method.pop(); // pop extra string method.athrow(); } } method.label(normalLoopEnd); loadNil(); method.label(done); } public void performBooleanLoopLight(BranchCallback condition, BranchCallback body, boolean checkFirst) { Label endOfBody = new Label(); Label conditionCheck = new Label(); Label topOfBody = new Label(); Label done = new Label(); Label[] oldLoopLabels = currentLoopLabels; currentLoopLabels = new Label[] {endOfBody, topOfBody, done}; // FIXME: if we terminate immediately, this appears to break while in method arguments // we need to push a nil for the cases where we will never enter the body if (checkFirst) { method.go_to(conditionCheck); } method.label(topOfBody); body.branch(this); method.label(endOfBody); // clear body or next result after each successful loop method.pop(); method.label(conditionCheck); // check the condition condition.branch(this); isTrue(); method.ifne(topOfBody); // NE == nonzero (i.e. true) currentLoopLabels = oldLoopLabels; loadNil(); method.label(done); } public void createNewClosure( int line, StaticScope scope, int arity, CompilerCallback body, CompilerCallback args, boolean hasMultipleArgsHead, NodeType argsNodeId, ASTInspector inspector) { String closureMethodName = "block_" + ++innerIndex + "$RUBY$" + "__block__"; ASMClosureCompiler closureCompiler = new ASMClosureCompiler(closureMethodName, inspector, scope); closureCompiler.beginMethod(args, scope); body.call(closureCompiler); closureCompiler.endMethod(); // Done with closure compilation loadThreadContext(); loadSelf(); method.pushInt(arity); buildStaticScopeNames(method, scope); cacheCompiler.cacheClosure(this, closureMethodName); method.ldc(Boolean.valueOf(hasMultipleArgsHead)); method.ldc(BlockBody.asArgumentType(argsNodeId)); // if there's a sub-closure or there's scope-aware methods, it can't be "light" method.ldc(!(inspector.hasClosure() || inspector.hasScopeAwareMethods())); invokeUtilityMethod("createBlock", sig(Block.class, params(ThreadContext.class, IRubyObject.class, Integer.TYPE, String[].class, CompiledBlockCallback.class, Boolean.TYPE, Integer.TYPE, boolean.class))); } public void runBeginBlock(StaticScope scope, CompilerCallback body) { String closureMethodName = "block_" + ++innerIndex + "$RUBY$__begin__"; ASMClosureCompiler closureCompiler = new ASMClosureCompiler(closureMethodName, null, scope); closureCompiler.beginMethod(null, scope); body.call(closureCompiler); closureCompiler.endMethod(); // Done with closure compilation loadThreadContext(); loadSelf(); buildStaticScopeNames(method, scope); cacheCompiler.cacheClosure(this, closureMethodName); invokeUtilityMethod("runBeginBlock", sig(IRubyObject.class, params(ThreadContext.class, IRubyObject.class, String[].class, CompiledBlockCallback.class))); } public void createNewForLoop(int arity, CompilerCallback body, CompilerCallback args, boolean hasMultipleArgsHead, NodeType argsNodeId) { String closureMethodName = "block_" + ++innerIndex + "$RUBY$__for__"; ASMClosureCompiler closureCompiler = new ASMClosureCompiler(closureMethodName, null, scope); closureCompiler.beginMethod(args, null); body.call(closureCompiler); closureCompiler.endMethod(); // Done with closure compilation loadThreadContext(); loadSelf(); method.pushInt(arity); cacheCompiler.cacheClosure(this, closureMethodName); method.ldc(Boolean.valueOf(hasMultipleArgsHead)); method.ldc(BlockBody.asArgumentType(argsNodeId)); invokeUtilityMethod("createSharedScopeBlock", sig(Block.class, params(ThreadContext.class, IRubyObject.class, Integer.TYPE, CompiledBlockCallback.class, Boolean.TYPE, Integer.TYPE))); } public void createNewEndBlock(CompilerCallback body) { String closureMethodName = "block_" + ++innerIndex + "$RUBY$__end__"; ASMClosureCompiler closureCompiler = new ASMClosureCompiler(closureMethodName, null, scope); closureCompiler.beginMethod(null, null); body.call(closureCompiler); closureCompiler.endMethod(); // Done with closure compilation loadThreadContext(); loadSelf(); method.iconst_0(); cacheCompiler.cacheClosure(this, closureMethodName); method.iconst_0(); // false method.iconst_0(); // zero invokeUtilityMethod("createSharedScopeBlock", sig(Block.class, params(ThreadContext.class, IRubyObject.class, Integer.TYPE, CompiledBlockCallback.class, Boolean.TYPE, Integer.TYPE))); loadRuntime(); invokeUtilityMethod("registerEndBlock", sig(void.class, Block.class, Ruby.class)); loadNil(); } public void getCompiledClass() { method.aload(THIS); method.getfield(classname, "$class", ci(Class.class)); } public void println() { method.dup(); method.getstatic(p(System.class), "out", ci(PrintStream.class)); method.swap(); method.invokevirtual(p(PrintStream.class), "println", sig(Void.TYPE, params(Object.class))); } public void defineAlias(String newName, String oldName) { loadThreadContext(); method.ldc(newName); method.ldc(oldName); invokeUtilityMethod("defineAlias", sig(IRubyObject.class, ThreadContext.class, String.class, String.class)); } public void loadFalse() { // TODO: cache? loadRuntime(); invokeIRuby("getFalse", sig(RubyBoolean.class)); } public void loadTrue() { // TODO: cache? loadRuntime(); invokeIRuby("getTrue", sig(RubyBoolean.class)); } public void loadCurrentModule() { loadThreadContext(); invokeThreadContext("getCurrentScope", sig(DynamicScope.class)); method.invokevirtual(p(DynamicScope.class), "getStaticScope", sig(StaticScope.class)); method.invokevirtual(p(StaticScope.class), "getModule", sig(RubyModule.class)); } public void retrieveInstanceVariable(String name) { loadRuntime(); loadSelf(); method.ldc(name); invokeUtilityMethod("fastGetInstanceVariable", sig(IRubyObject.class, Ruby.class, IRubyObject.class, String.class)); } public void assignInstanceVariable(String name) { // FIXME: more efficient with a callback loadSelf(); invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class)); method.swap(); method.ldc(name); method.swap(); method.invokeinterface(p(InstanceVariables.class), "fastSetInstanceVariable", sig(IRubyObject.class, params(String.class, IRubyObject.class))); } public void assignInstanceVariable(String name, CompilerCallback value) { // FIXME: more efficient with a callback loadSelf(); invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class)); method.ldc(name); value.call(this); method.invokeinterface(p(InstanceVariables.class), "fastSetInstanceVariable", sig(IRubyObject.class, params(String.class, IRubyObject.class))); } public void retrieveGlobalVariable(String name) { loadRuntime(); invokeIRuby("getGlobalVariables", sig(GlobalVariables.class)); method.ldc(name); method.invokevirtual(p(GlobalVariables.class), "get", sig(IRubyObject.class, params(String.class))); } public void assignGlobalVariable(String name) { // FIXME: more efficient with a callback loadRuntime(); invokeIRuby("getGlobalVariables", sig(GlobalVariables.class)); method.swap(); method.ldc(name); method.swap(); method.invokevirtual(p(GlobalVariables.class), "set", sig(IRubyObject.class, params(String.class, IRubyObject.class))); } public void assignGlobalVariable(String name, CompilerCallback value) { // FIXME: more efficient with a callback loadRuntime(); invokeIRuby("getGlobalVariables", sig(GlobalVariables.class)); method.ldc(name); value.call(this); method.invokevirtual(p(GlobalVariables.class), "set", sig(IRubyObject.class, params(String.class, IRubyObject.class))); } public void negateCurrentValue() { loadRuntime(); invokeUtilityMethod("negate", sig(IRubyObject.class, IRubyObject.class, Ruby.class)); } public void splatCurrentValue() { method.invokestatic(p(RuntimeHelpers.class), "splatValue", sig(RubyArray.class, params(IRubyObject.class))); } public void singlifySplattedValue() { method.invokestatic(p(RuntimeHelpers.class), "aValueSplat", sig(IRubyObject.class, params(IRubyObject.class))); } public void aryToAry() { method.invokestatic(p(RuntimeHelpers.class), "aryToAry", sig(IRubyObject.class, params(IRubyObject.class))); } public void ensureRubyArray() { invokeUtilityMethod("ensureRubyArray", sig(RubyArray.class, params(IRubyObject.class))); } public void ensureMultipleAssignableRubyArray(boolean masgnHasHead) { loadRuntime(); method.swap(); method.pushBoolean(masgnHasHead); invokeUtilityMethod("ensureMultipleAssignableRubyArray", sig(RubyArray.class, params(Ruby.class, IRubyObject.class, boolean.class))); } public void forEachInValueArray(int start, int count, Object source, ArrayCallback callback, ArrayCallback nilCallback, CompilerCallback argsCallback) { // FIXME: This could probably be made more efficient for (; start < count; start++) { Label noMoreArrayElements = new Label(); Label doneWithElement = new Label(); // confirm we're not past the end of the array method.dup(); // dup the original array object method.invokevirtual(p(RubyArray.class), "getLength", sig(Integer.TYPE)); method.pushInt(start); method.if_icmple(noMoreArrayElements); // if length <= start, end loop // extract item from array method.dup(); // dup the original array object method.pushInt(start); method.invokevirtual(p(RubyArray.class), "entry", sig(IRubyObject.class, params(Integer.TYPE))); // extract item callback.nextValue(this, source, start); method.go_to(doneWithElement); // otherwise no items left available, use the code from nilCallback method.label(noMoreArrayElements); nilCallback.nextValue(this, source, start); // end of this element method.label(doneWithElement); // normal assignment leaves the value; pop it. method.pop(); } if (argsCallback != null) { Label emptyArray = new Label(); Label readyForArgs = new Label(); // confirm we're not past the end of the array method.dup(); // dup the original array object method.invokevirtual(p(RubyArray.class), "getLength", sig(Integer.TYPE)); method.pushInt(start); method.if_icmple(emptyArray); // if length <= start, end loop // assign remaining elements as an array for rest args method.dup(); // dup the original array object method.pushInt(start); invokeUtilityMethod("createSubarray", sig(RubyArray.class, RubyArray.class, int.class)); method.go_to(readyForArgs); // create empty array method.label(emptyArray); createEmptyArray(); // assign rest args method.label(readyForArgs); argsCallback.call(this); //consume leftover assigned value method.pop(); } } public void asString() { method.invokeinterface(p(IRubyObject.class), "asString", sig(RubyString.class)); } public void toJavaString() { method.invokevirtual(p(Object.class), "toString", sig(String.class)); } public void nthRef(int match) { method.pushInt(match); backref(); method.invokestatic(p(RubyRegexp.class), "nth_match", sig(IRubyObject.class, params(Integer.TYPE, IRubyObject.class))); } public void match() { loadThreadContext(); method.invokevirtual(p(RubyRegexp.class), "op_match2", sig(IRubyObject.class, params(ThreadContext.class))); } public void match2() { loadThreadContext(); method.swap(); method.invokevirtual(p(RubyRegexp.class), "op_match", sig(IRubyObject.class, params(ThreadContext.class, IRubyObject.class))); } public void match3() { loadThreadContext(); invokeUtilityMethod("match3", sig(IRubyObject.class, RubyRegexp.class, IRubyObject.class, ThreadContext.class)); } public void createNewRegexp(final ByteList value, final int options) { String regexpField = getNewConstant(ci(RubyRegexp.class), "lit_reg_"); // in current method, load the field to see if we've created a Pattern yet method.aload(THIS); method.getfield(classname, regexpField, ci(RubyRegexp.class)); Label alreadyCreated = new Label(); method.ifnonnull(alreadyCreated); //[] // load string, for Regexp#source and Regexp#inspect String regexpString = value.toString(); loadRuntime(); //[R] method.ldc(regexpString); //[R, rS] method.pushInt(options); //[R, rS, opts] method.invokestatic(p(RubyRegexp.class), "newRegexp", sig(RubyRegexp.class, params(Ruby.class, String.class, Integer.TYPE))); //[reg] method.aload(THIS); //[reg, T] method.swap(); //[T, reg] method.putfield(classname, regexpField, ci(RubyRegexp.class)); //[] method.label(alreadyCreated); method.aload(THIS); //[T] method.getfield(classname, regexpField, ci(RubyRegexp.class)); } public void createNewRegexp(CompilerCallback createStringCallback, final int options) { boolean onceOnly = (options & ReOptions.RE_OPTION_ONCE) != 0; // for regular expressions with the /o flag Label alreadyCreated = null; String regexpField = null; // only alter the code if the /o flag was present if (onceOnly) { regexpField = getNewConstant(ci(RubyRegexp.class), "lit_reg_"); // in current method, load the field to see if we've created a Pattern yet method.aload(THIS); method.getfield(classname, regexpField, ci(RubyRegexp.class)); alreadyCreated = new Label(); method.ifnonnull(alreadyCreated); } loadRuntime(); createStringCallback.call(this); method.invokevirtual(p(RubyString.class), "getByteList", sig(ByteList.class)); method.pushInt(options); method.invokestatic(p(RubyRegexp.class), "newRegexp", sig(RubyRegexp.class, params(Ruby.class, ByteList.class, Integer.TYPE))); //[reg] // only alter the code if the /o flag was present if (onceOnly) { method.aload(THIS); method.swap(); method.putfield(classname, regexpField, ci(RubyRegexp.class)); method.label(alreadyCreated); method.aload(THIS); method.getfield(classname, regexpField, ci(RubyRegexp.class)); } } public void pollThreadEvents() { if (!RubyInstanceConfig.THREADLESS_COMPILE_ENABLED) { loadThreadContext(); invokeThreadContext("pollThreadEvents", sig(Void.TYPE)); } } public void nullToNil() { Label notNull = new Label(); method.dup(); method.ifnonnull(notNull); method.pop(); loadNil(); method.label(notNull); } public void isInstanceOf(Class clazz, BranchCallback trueBranch, BranchCallback falseBranch) { method.instance_of(p(clazz)); Label falseJmp = new Label(); Label afterJmp = new Label(); method.ifeq(falseJmp); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(afterJmp); method.label(falseJmp); falseBranch.branch(this); method.label(afterJmp); } public void isCaptured(final int number, final BranchCallback trueBranch, final BranchCallback falseBranch) { backref(); method.dup(); isInstanceOf(RubyMatchData.class, new BranchCallback() { public void branch(MethodCompiler context) { method.visitTypeInsn(CHECKCAST, p(RubyMatchData.class)); method.dup(); method.invokevirtual(p(RubyMatchData.class), "use", sig(void.class)); method.pushInt(number); method.invokevirtual(p(RubyMatchData.class), "group", sig(IRubyObject.class, params(int.class))); method.invokeinterface(p(IRubyObject.class), "isNil", sig(boolean.class)); Label isNil = new Label(); Label after = new Label(); method.ifne(isNil); trueBranch.branch(context); method.go_to(after); method.label(isNil); falseBranch.branch(context); method.label(after); } }, new BranchCallback() { public void branch(MethodCompiler context) { method.pop(); falseBranch.branch(context); } }); } public void branchIfModule(CompilerCallback receiverCallback, BranchCallback moduleCallback, BranchCallback notModuleCallback) { receiverCallback.call(this); isInstanceOf(RubyModule.class, moduleCallback, notModuleCallback); } public void backref() { loadThreadContext(); invokeThreadContext("getCurrentFrame", sig(Frame.class)); method.invokevirtual(p(Frame.class), "getBackRef", sig(IRubyObject.class)); } public void backrefMethod(String methodName) { backref(); method.invokestatic(p(RubyRegexp.class), methodName, sig(IRubyObject.class, params(IRubyObject.class))); } public void issueLoopBreak() { // inside a loop, break out of it // go to end of loop, leaving break value on stack method.go_to(currentLoopLabels[2]); } public void issueLoopNext() { // inside a loop, jump to conditional method.go_to(currentLoopLabels[0]); } public void issueLoopRedo() { // inside a loop, jump to body method.go_to(currentLoopLabels[1]); } protected String getNewEnsureName() { return "ensure_" + (ensureNumber++) + "$RUBY$__ensure__"; } public void protect(BranchCallback regularCode, BranchCallback protectedCode, Class ret) { String mname = getNewEnsureName(); SkinnyMethodAdapter mv = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC | ACC_SYNTHETIC, mname, sig(ret, new Class[]{ThreadContext.class, IRubyObject.class, Block.class}), null, null)); SkinnyMethodAdapter old_method = null; SkinnyMethodAdapter var_old_method = null; SkinnyMethodAdapter inv_old_method = null; boolean oldWithinProtection = withinProtection; withinProtection = true; Label[] oldLoopLabels = currentLoopLabels; currentLoopLabels = null; int oldArgCount = argParamCount; argParamCount = 0; // synthetic methods always have zero arg parameters try { old_method = this.method; var_old_method = getVariableCompiler().getMethodAdapter(); inv_old_method = getInvocationCompiler().getMethodAdapter(); this.method = mv; getVariableCompiler().setMethodAdapter(mv); getInvocationCompiler().setMethodAdapter(mv); mv.visitCode(); // set up a local IRuby variable mv.aload(THREADCONTEXT_INDEX); mv.dup(); mv.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class)); mv.dup(); mv.astore(getRuntimeIndex()); // grab nil for local variables mv.invokevirtual(p(Ruby.class), "getNil", sig(IRubyObject.class)); mv.astore(getNilIndex()); mv.invokevirtual(p(ThreadContext.class), "getCurrentScope", sig(DynamicScope.class)); mv.dup(); mv.astore(getDynamicScopeIndex()); mv.invokevirtual(p(DynamicScope.class), "getValues", sig(IRubyObject[].class)); mv.astore(getVarsArrayIndex()); Label codeBegin = new Label(); Label codeEnd = new Label(); Label ensureBegin = new Label(); Label ensureEnd = new Label(); method.label(codeBegin); regularCode.branch(this); method.label(codeEnd); protectedCode.branch(this); mv.areturn(); method.label(ensureBegin); method.astore(getExceptionIndex()); method.label(ensureEnd); protectedCode.branch(this); method.aload(getExceptionIndex()); method.athrow(); method.trycatch(codeBegin, codeEnd, ensureBegin, null); method.trycatch(ensureBegin, ensureEnd, ensureBegin, null); mv.visitMaxs(1, 1); mv.visitEnd(); } finally { this.method = old_method; getVariableCompiler().setMethodAdapter(var_old_method); getInvocationCompiler().setMethodAdapter(inv_old_method); withinProtection = oldWithinProtection; currentLoopLabels = oldLoopLabels; argParamCount = oldArgCount; } method.aload(THIS); loadThreadContext(); loadSelf(); if(this instanceof ASMClosureCompiler) { pushNull(); } else { loadBlock(); } method.invokevirtual(classname, mname, sig(ret, new Class[]{ThreadContext.class, IRubyObject.class, Block.class})); } protected String getNewRescueName() { return "rescue_" + (rescueNumber++) + "$RUBY$__rescue__"; } public void rescue(BranchCallback regularCode, Class exception, BranchCallback catchCode, Class ret) { String mname = getNewRescueName(); SkinnyMethodAdapter mv = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC | ACC_SYNTHETIC, mname, sig(ret, new Class[]{ThreadContext.class, IRubyObject.class, Block.class}), null, null)); SkinnyMethodAdapter old_method = null; SkinnyMethodAdapter var_old_method = null; SkinnyMethodAdapter inv_old_method = null; Label afterMethodBody = new Label(); Label catchRetry = new Label(); Label catchRaised = new Label(); Label catchJumps = new Label(); Label exitRescue = new Label(); boolean oldWithinProtection = withinProtection; withinProtection = true; Label[] oldLoopLabels = currentLoopLabels; currentLoopLabels = null; int oldArgCount = argParamCount; argParamCount = 0; // synthetic methods always have zero arg parameters try { old_method = this.method; var_old_method = getVariableCompiler().getMethodAdapter(); inv_old_method = getInvocationCompiler().getMethodAdapter(); this.method = mv; getVariableCompiler().setMethodAdapter(mv); getInvocationCompiler().setMethodAdapter(mv); mv.visitCode(); // set up a local IRuby variable mv.aload(THREADCONTEXT_INDEX); mv.dup(); mv.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class)); mv.dup(); mv.astore(getRuntimeIndex()); // store previous exception for restoration if we rescue something loadRuntime(); invokeUtilityMethod("getErrorInfo", sig(IRubyObject.class, Ruby.class)); mv.astore(getPreviousExceptionIndex()); // grab nil for local variables mv.invokevirtual(p(Ruby.class), "getNil", sig(IRubyObject.class)); mv.astore(getNilIndex()); mv.invokevirtual(p(ThreadContext.class), "getCurrentScope", sig(DynamicScope.class)); mv.dup(); mv.astore(getDynamicScopeIndex()); mv.invokevirtual(p(DynamicScope.class), "getValues", sig(IRubyObject[].class)); mv.astore(getVarsArrayIndex()); Label beforeBody = new Label(); Label afterBody = new Label(); Label catchBlock = new Label(); mv.visitTryCatchBlock(beforeBody, afterBody, catchBlock, p(exception)); mv.visitLabel(beforeBody); regularCode.branch(this); mv.label(afterBody); mv.go_to(exitRescue); mv.label(catchBlock); mv.astore(getExceptionIndex()); catchCode.branch(this); mv.label(afterMethodBody); mv.go_to(exitRescue); // retry handling in the rescue block mv.trycatch(catchBlock, afterMethodBody, catchRetry, p(JumpException.RetryJump.class)); mv.label(catchRetry); mv.pop(); mv.go_to(beforeBody); // any exceptions raised must continue to be raised, skipping $! restoration mv.trycatch(beforeBody, afterMethodBody, catchRaised, p(RaiseException.class)); mv.label(catchRaised); mv.athrow(); // and remaining jump exceptions should restore $! mv.trycatch(beforeBody, afterMethodBody, catchJumps, p(JumpException.class)); mv.label(catchJumps); loadRuntime(); mv.aload(getPreviousExceptionIndex()); invokeUtilityMethod("setErrorInfo", sig(void.class, Ruby.class, IRubyObject.class)); mv.athrow(); mv.label(exitRescue); // restore the original exception loadRuntime(); mv.aload(getPreviousExceptionIndex()); invokeUtilityMethod("setErrorInfo", sig(void.class, Ruby.class, IRubyObject.class)); mv.areturn(); mv.visitMaxs(1, 1); mv.visitEnd(); } finally { withinProtection = oldWithinProtection; this.method = old_method; getVariableCompiler().setMethodAdapter(var_old_method); getInvocationCompiler().setMethodAdapter(inv_old_method); currentLoopLabels = oldLoopLabels; argParamCount = oldArgCount; } method.aload(THIS); loadThreadContext(); loadSelf(); if(this instanceof ASMClosureCompiler) { pushNull(); } else { loadBlock(); } method.invokevirtual(classname, mname, sig(ret, new Class[]{ThreadContext.class, IRubyObject.class, Block.class})); } public void inDefined() { method.aload(THREADCONTEXT_INDEX); method.iconst_1(); invokeThreadContext("setWithinDefined", sig(void.class, params(boolean.class))); } public void outDefined() { method.aload(THREADCONTEXT_INDEX); method.iconst_0(); invokeThreadContext("setWithinDefined", sig(void.class, params(boolean.class))); } public void stringOrNil() { loadRuntime(); loadNil(); invokeUtilityMethod("stringOrNil", sig(IRubyObject.class, String.class, Ruby.class, IRubyObject.class)); } public void pushNull() { method.aconst_null(); } public void pushString(String str) { method.ldc(str); } public void isMethodBound(String name, BranchCallback trueBranch, BranchCallback falseBranch) { metaclass(); method.ldc(name); method.iconst_0(); // push false method.invokevirtual(p(RubyClass.class), "isMethodBound", sig(boolean.class, params(String.class, boolean.class))); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); } public void hasBlock(BranchCallback trueBranch, BranchCallback falseBranch) { loadBlock(); method.invokevirtual(p(Block.class), "isGiven", sig(boolean.class)); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); } public void isGlobalDefined(String name, BranchCallback trueBranch, BranchCallback falseBranch) { loadRuntime(); invokeIRuby("getGlobalVariables", sig(GlobalVariables.class)); method.ldc(name); method.invokevirtual(p(GlobalVariables.class), "isDefined", sig(boolean.class, params(String.class))); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); } public void isConstantDefined(String name, BranchCallback trueBranch, BranchCallback falseBranch) { loadThreadContext(); method.ldc(name); invokeThreadContext("getConstantDefined", sig(boolean.class, params(String.class))); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); } public void isInstanceVariableDefined(String name, BranchCallback trueBranch, BranchCallback falseBranch) { loadSelf(); invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class)); method.ldc(name); //method.invokeinterface(p(IRubyObject.class), "getInstanceVariable", sig(IRubyObject.class, params(String.class))); method.invokeinterface(p(InstanceVariables.class), "fastHasInstanceVariable", sig(boolean.class, params(String.class))); Label trueLabel = new Label(); Label exitLabel = new Label(); //method.ifnonnull(trueLabel); method.ifne(trueLabel); falseBranch.branch(this); method.go_to(exitLabel); method.label(trueLabel); trueBranch.branch(this); method.label(exitLabel); } public void isClassVarDefined(String name, BranchCallback trueBranch, BranchCallback falseBranch){ method.ldc(name); method.invokevirtual(p(RubyModule.class), "fastIsClassVarDefined", sig(boolean.class, params(String.class))); Label trueLabel = new Label(); Label exitLabel = new Label(); method.ifne(trueLabel); falseBranch.branch(this); method.go_to(exitLabel); method.label(trueLabel); trueBranch.branch(this); method.label(exitLabel); } public Object getNewEnding() { return new Label(); } public void isNil(BranchCallback trueBranch, BranchCallback falseBranch) { method.invokeinterface(p(IRubyObject.class), "isNil", sig(boolean.class)); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); } public void isNull(BranchCallback trueBranch, BranchCallback falseBranch) { Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifnonnull(falseLabel); trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); } public void ifNull(Object gotoToken) { method.ifnull((Label)gotoToken); } public void ifNotNull(Object gotoToken) { method.ifnonnull((Label)gotoToken); } public void setEnding(Object endingToken){ method.label((Label)endingToken); } public void go(Object gotoToken) { method.go_to((Label)gotoToken); } public void isConstantBranch(final BranchCallback setup, final BranchCallback isConstant, final BranchCallback isMethod, final BranchCallback none, final String name) { rescue(new BranchCallback() { public void branch(MethodCompiler context) { setup.branch(AbstractMethodCompiler.this); method.dup(); //[C,C] method.instance_of(p(RubyModule.class)); //[C, boolean] Label falseJmp = new Label(); Label afterJmp = new Label(); Label nextJmp = new Label(); Label nextJmpPop = new Label(); method.ifeq(nextJmp); // EQ == 0 (i.e. false) //[C] method.visitTypeInsn(CHECKCAST, p(RubyModule.class)); method.dup(); //[C, C] method.ldc(name); //[C, C, String] method.invokevirtual(p(RubyModule.class), "fastGetConstantAt", sig(IRubyObject.class, params(String.class))); //[C, null|C] method.dup(); method.ifnull(nextJmpPop); method.pop(); method.pop(); isConstant.branch(AbstractMethodCompiler.this); method.go_to(afterJmp); method.label(nextJmpPop); method.pop(); method.label(nextJmp); //[C] metaclass(); method.ldc(name); method.iconst_1(); // push true method.invokevirtual(p(RubyClass.class), "isMethodBound", sig(boolean.class, params(String.class, boolean.class))); method.ifeq(falseJmp); // EQ == 0 (i.e. false) isMethod.branch(AbstractMethodCompiler.this); method.go_to(afterJmp); method.label(falseJmp); none.branch(AbstractMethodCompiler.this); method.label(afterJmp); }}, JumpException.class, none, String.class); } public void metaclass() { invokeIRubyObject("getMetaClass", sig(RubyClass.class)); } public void getVisibilityFor(String name) { method.ldc(name); method.invokevirtual(p(RubyClass.class), "searchMethod", sig(DynamicMethod.class, params(String.class))); method.invokevirtual(p(DynamicMethod.class), "getVisibility", sig(Visibility.class)); } public void isPrivate(Object gotoToken, int toConsume) { method.invokevirtual(p(Visibility.class), "isPrivate", sig(boolean.class)); Label temp = new Label(); method.ifeq(temp); // EQ == 0 (i.e. false) while((toConsume--) > 0) { method.pop(); } method.go_to((Label)gotoToken); method.label(temp); } public void isNotProtected(Object gotoToken, int toConsume) { method.invokevirtual(p(Visibility.class), "isProtected", sig(boolean.class)); Label temp = new Label(); method.ifne(temp); while((toConsume--) > 0) { method.pop(); } method.go_to((Label)gotoToken); method.label(temp); } public void selfIsKindOf(Object gotoToken) { method.invokevirtual(p(RubyClass.class), "getRealClass", sig(RubyClass.class)); loadSelf(); method.invokevirtual(p(RubyModule.class), "isInstance", sig(boolean.class, params(IRubyObject.class))); method.ifne((Label)gotoToken); // EQ != 0 (i.e. true) } public void notIsModuleAndClassVarDefined(String name, Object gotoToken) { method.dup(); //[?, ?] method.instance_of(p(RubyModule.class)); //[?, boolean] Label falsePopJmp = new Label(); Label successJmp = new Label(); method.ifeq(falsePopJmp); method.visitTypeInsn(CHECKCAST, p(RubyModule.class)); //[RubyModule] method.ldc(name); //[RubyModule, String] method.invokevirtual(p(RubyModule.class), "fastIsClassVarDefined", sig(boolean.class, params(String.class))); //[boolean] method.ifeq((Label)gotoToken); method.go_to(successJmp); method.label(falsePopJmp); method.pop(); method.go_to((Label)gotoToken); method.label(successJmp); } public void ifSingleton(Object gotoToken) { method.invokevirtual(p(RubyModule.class), "isSingleton", sig(boolean.class)); method.ifne((Label)gotoToken); // EQ == 0 (i.e. false) } public void getInstanceVariable(String name) { method.ldc(name); invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class)); method.invokeinterface(p(InstanceVariables.class), "fastGetInstanceVariable", sig(IRubyObject.class, params(String.class))); } public void getFrameName() { loadThreadContext(); invokeThreadContext("getFrameName", sig(String.class)); } public void getFrameKlazz() { loadThreadContext(); invokeThreadContext("getFrameKlazz", sig(RubyModule.class)); } public void superClass() { method.invokevirtual(p(RubyModule.class), "getSuperClass", sig(RubyClass.class)); } public void attached() { method.visitTypeInsn(CHECKCAST, p(MetaClass.class)); method.invokevirtual(p(MetaClass.class), "getAttached", sig(IRubyObject.class)); } public void ifNotSuperMethodBound(Object token) { method.swap(); method.iconst_0(); method.invokevirtual(p(RubyModule.class), "isMethodBound", sig(boolean.class, params(String.class, boolean.class))); method.ifeq((Label)token); } public void concatArrays() { method.invokevirtual(p(RubyArray.class), "concat", sig(RubyArray.class, params(IRubyObject.class))); } public void concatObjectArrays() { invokeUtilityMethod("concatObjectArrays", sig(IRubyObject[].class, params(IRubyObject[].class, IRubyObject[].class))); } public void appendToArray() { method.invokevirtual(p(RubyArray.class), "append", sig(RubyArray.class, params(IRubyObject.class))); } public void appendToObjectArray() { invokeUtilityMethod("appendToObjectArray", sig(IRubyObject[].class, params(IRubyObject[].class, IRubyObject.class))); } public void convertToJavaArray() { method.invokestatic(p(ArgsUtil.class), "convertToJavaArray", sig(IRubyObject[].class, params(IRubyObject.class))); } public void aliasGlobal(String newName, String oldName) { loadRuntime(); invokeIRuby("getGlobalVariables", sig(GlobalVariables.class)); method.ldc(newName); method.ldc(oldName); method.invokevirtual(p(GlobalVariables.class), "alias", sig(Void.TYPE, params(String.class, String.class))); loadNil(); } public void undefMethod(String name) { loadThreadContext(); invokeThreadContext("getRubyClass", sig(RubyModule.class)); Label notNull = new Label(); method.dup(); method.ifnonnull(notNull); method.pop(); loadRuntime(); method.ldc("No class to undef method '" + name + "'."); invokeIRuby("newTypeError", sig(RaiseException.class, params(String.class))); method.athrow(); method.label(notNull); loadThreadContext(); method.ldc(name); method.invokevirtual(p(RubyModule.class), "undef", sig(Void.TYPE, params(ThreadContext.class, String.class))); loadNil(); } public void defineClass( final String name, final StaticScope staticScope, final CompilerCallback superCallback, final CompilerCallback pathCallback, final CompilerCallback bodyCallback, final CompilerCallback receiverCallback) { String methodName = null; if (receiverCallback == null) { String mangledName = JavaNameMangler.mangleStringForCleanJavaIdentifier(name); methodName = "class_" + ++methodIndex + "$RUBY$" + mangledName; } else { methodName = "sclass_" + ++methodIndex + "$RUBY$__singleton__"; } final ASMMethodCompiler methodCompiler = new ASMMethodCompiler(methodName, null, staticScope); CompilerCallback bodyPrep = new CompilerCallback() { public void call(MethodCompiler context) { if (receiverCallback == null) { if (superCallback != null) { methodCompiler.loadRuntime(); superCallback.call(methodCompiler); methodCompiler.invokeUtilityMethod("prepareSuperClass", sig(RubyClass.class, params(Ruby.class, IRubyObject.class))); } else { methodCompiler.method.aconst_null(); } methodCompiler.loadThreadContext(); pathCallback.call(methodCompiler); methodCompiler.invokeUtilityMethod("prepareClassNamespace", sig(RubyModule.class, params(ThreadContext.class, IRubyObject.class))); methodCompiler.method.swap(); methodCompiler.method.ldc(name); methodCompiler.method.swap(); methodCompiler.method.invokevirtual(p(RubyModule.class), "defineOrGetClassUnder", sig(RubyClass.class, params(String.class, RubyClass.class))); } else { methodCompiler.loadRuntime(); // we re-set self to the class, but store the old self in a temporary local variable // this is to prevent it GCing in case the singleton is short-lived methodCompiler.method.aload(SELF_INDEX); int selfTemp = methodCompiler.getVariableCompiler().grabTempLocal(); methodCompiler.getVariableCompiler().setTempLocal(selfTemp); methodCompiler.method.aload(SELF_INDEX); methodCompiler.invokeUtilityMethod("getSingletonClass", sig(RubyClass.class, params(Ruby.class, IRubyObject.class))); } // set self to the class methodCompiler.method.dup(); methodCompiler.method.astore(SELF_INDEX); // CLASS BODY methodCompiler.loadThreadContext(); methodCompiler.method.swap(); // static scope buildStaticScopeNames(methodCompiler.method, staticScope); methodCompiler.invokeThreadContext("preCompiledClass", sig(Void.TYPE, params(RubyModule.class, String[].class))); } }; // Here starts the logic for the class definition Label start = new Label(); Label end = new Label(); Label after = new Label(); Label noException = new Label(); methodCompiler.method.trycatch(start, end, after, null); methodCompiler.beginClass(bodyPrep, staticScope); methodCompiler.method.label(start); bodyCallback.call(methodCompiler); methodCompiler.method.label(end); // finally with no exception methodCompiler.loadThreadContext(); methodCompiler.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); methodCompiler.method.go_to(noException); methodCompiler.method.label(after); // finally with exception methodCompiler.loadThreadContext(); methodCompiler.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); methodCompiler.method.athrow(); methodCompiler.method.label(noException); methodCompiler.endMethod(); // prepare to call class definition method method.aload(THIS); loadThreadContext(); if (receiverCallback == null) { // if there's no receiver, there could potentially be a superclass like class Foo << self // so we pass in self here method.aload(SELF_INDEX); } else { // otherwise, there's a receiver, so we pass that in directly for the sclass logic receiverCallback.call(this); } method.getstatic(p(Block.class), "NULL_BLOCK", ci(Block.class)); method.invokevirtual(classname, methodName, METHOD_SIGNATURES[0]); } public void defineModule(final String name, final StaticScope staticScope, final CompilerCallback pathCallback, final CompilerCallback bodyCallback) { String mangledName = JavaNameMangler.mangleStringForCleanJavaIdentifier(name); String methodName = "module__" + ++methodIndex + "$RUBY$" + mangledName; final ASMMethodCompiler methodCompiler = new ASMMethodCompiler(methodName, null, staticScope); CompilerCallback bodyPrep = new CompilerCallback() { public void call(MethodCompiler context) { methodCompiler.loadThreadContext(); pathCallback.call(methodCompiler); methodCompiler.invokeUtilityMethod("prepareClassNamespace", sig(RubyModule.class, params(ThreadContext.class, IRubyObject.class))); methodCompiler.method.ldc(name); methodCompiler.method.invokevirtual(p(RubyModule.class), "defineOrGetModuleUnder", sig(RubyModule.class, params(String.class))); // set self to the class methodCompiler.method.dup(); methodCompiler.method.astore(SELF_INDEX); // CLASS BODY methodCompiler.loadThreadContext(); methodCompiler.method.swap(); // static scope buildStaticScopeNames(methodCompiler.method, staticScope); methodCompiler.invokeThreadContext("preCompiledClass", sig(Void.TYPE, params(RubyModule.class, String[].class))); } }; // Here starts the logic for the class definition Label start = new Label(); Label end = new Label(); Label after = new Label(); Label noException = new Label(); methodCompiler.method.trycatch(start, end, after, null); methodCompiler.beginClass(bodyPrep, staticScope); methodCompiler.method.label(start); bodyCallback.call(methodCompiler); methodCompiler.method.label(end); methodCompiler.method.go_to(noException); methodCompiler.method.label(after); methodCompiler.loadThreadContext(); methodCompiler.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); methodCompiler.method.athrow(); methodCompiler.method.label(noException); methodCompiler.loadThreadContext(); methodCompiler.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); methodCompiler.endMethod(); // prepare to call class definition method method.aload(THIS); loadThreadContext(); loadSelf(); method.getstatic(p(IRubyObject.class), "NULL_ARRAY", ci(IRubyObject[].class)); method.getstatic(p(Block.class), "NULL_BLOCK", ci(Block.class)); method.invokevirtual(classname, methodName, METHOD_SIGNATURES[4]); } public void unwrapPassedBlock() { loadBlock(); invokeUtilityMethod("getBlockFromBlockPassBody", sig(Block.class, params(IRubyObject.class, Block.class))); } public void performBackref(char type) { loadThreadContext(); switch (type) { case '~': invokeUtilityMethod("backref", sig(IRubyObject.class, params(ThreadContext.class))); break; case '&': invokeUtilityMethod("backrefLastMatch", sig(IRubyObject.class, params(ThreadContext.class))); break; case '`': invokeUtilityMethod("backrefMatchPre", sig(IRubyObject.class, params(ThreadContext.class))); break; case '\'': invokeUtilityMethod("backrefMatchPost", sig(IRubyObject.class, params(ThreadContext.class))); break; case '+': invokeUtilityMethod("backrefMatchLast", sig(IRubyObject.class, params(ThreadContext.class))); break; default: throw new NotCompilableException("ERROR: backref with invalid type"); } } public void callZSuper(CompilerCallback closure) { loadRuntime(); loadThreadContext(); if (closure != null) { closure.call(this); } else { method.getstatic(p(Block.class), "NULL_BLOCK", ci(Block.class)); } loadSelf(); invokeUtilityMethod("callZSuper", sig(IRubyObject.class, params(Ruby.class, ThreadContext.class, Block.class, IRubyObject.class))); } public void checkIsExceptionHandled() { // ruby exception and list of exception types is on the stack loadRuntime(); loadThreadContext(); loadSelf(); invokeUtilityMethod("isExceptionHandled", sig(IRubyObject.class, RubyException.class, IRubyObject[].class, Ruby.class, ThreadContext.class, IRubyObject.class)); } public void rethrowException() { loadException(); method.athrow(); } public void loadClass(String name) { loadRuntime(); method.ldc(name); invokeIRuby("getClass", sig(RubyClass.class, String.class)); } public void unwrapRaiseException() { // RaiseException is on stack, get RubyException out method.invokevirtual(p(RaiseException.class), "getException", sig(RubyException.class)); } public void loadException() { method.aload(getExceptionIndex()); } public void setFilePosition(ISourcePosition position) { if (!RubyInstanceConfig.POSITIONLESS_COMPILE_ENABLED) { loadThreadContext(); method.ldc(position.getFile()); invokeThreadContext("setFile", sig(void.class, params(String.class))); } } public void setLinePosition(ISourcePosition position) { if (!RubyInstanceConfig.POSITIONLESS_COMPILE_ENABLED) { if (lastPositionLine == position.getStartLine()) { // updating position for same line; skip return; } else { lastPositionLine = position.getStartLine(); loadThreadContext(); method.pushInt(position.getStartLine()); method.invokestatic(classname, "setPosition", sig(void.class, params(ThreadContext.class, int.class))); } } } public void checkWhenWithSplat() { loadThreadContext(); invokeUtilityMethod("isWhenTriggered", sig(RubyBoolean.class, IRubyObject.class, IRubyObject.class, ThreadContext.class)); } public void issueRetryEvent() { invokeUtilityMethod("retryJump", sig(IRubyObject.class)); } public void defineNewMethod(String name, int methodArity, StaticScope scope, CompilerCallback body, CompilerCallback args, CompilerCallback receiver, ASTInspector inspector, boolean root) { // TODO: build arg list based on number of args, optionals, etc ++methodIndex; String methodName; if (root && Boolean.getBoolean("jruby.compile.toplevel")) { methodName = name; } else { String mangledName = JavaNameMangler.mangleStringForCleanJavaIdentifier(name); methodName = "method__" + methodIndex + "$RUBY$" + mangledName; } MethodCompiler methodCompiler = startMethod(methodName, args, scope, inspector); // callbacks to fill in method body body.call(methodCompiler); methodCompiler.endMethod(); // prepare to call "def" utility method to handle def logic loadThreadContext(); loadSelf(); if (receiver != null) receiver.call(this); // script object method.aload(THIS); method.ldc(name); method.ldc(methodName); buildStaticScopeNames(method, scope); method.pushInt(methodArity); // arities method.pushInt(scope.getRequiredArgs()); method.pushInt(scope.getOptionalArgs()); method.pushInt(scope.getRestArg()); // if method has frame aware methods or frameless compilation is NOT enabled if (inspector.hasFrameAwareMethods() || !(inspector.noFrame() || RubyInstanceConfig.FRAMELESS_COMPILE_ENABLED)) { if (inspector.hasClosure() || inspector.hasScopeAwareMethods()) { method.getstatic(p(CallConfiguration.class), CallConfiguration.FRAME_AND_SCOPE.name(), ci(CallConfiguration.class)); } else { method.getstatic(p(CallConfiguration.class), CallConfiguration.FRAME_ONLY.name(), ci(CallConfiguration.class)); } } else { if (inspector.hasClosure() || inspector.hasScopeAwareMethods()) { // TODO: call config with scope but no frame if (RubyInstanceConfig.FASTEST_COMPILE_ENABLED) { method.getstatic(p(CallConfiguration.class), CallConfiguration.SCOPE_ONLY.name(), ci(CallConfiguration.class)); } else { method.getstatic(p(CallConfiguration.class), CallConfiguration.BACKTRACE_AND_SCOPE.name(), ci(CallConfiguration.class)); } } else { if (RubyInstanceConfig.FASTEST_COMPILE_ENABLED || inspector.noFrame()) { method.getstatic(p(CallConfiguration.class), CallConfiguration.NO_FRAME_NO_SCOPE.name(), ci(CallConfiguration.class)); } else { method.getstatic(p(CallConfiguration.class), CallConfiguration.BACKTRACE_ONLY.name(), ci(CallConfiguration.class)); } } } if (receiver != null) { invokeUtilityMethod("defs", sig(IRubyObject.class, params(ThreadContext.class, IRubyObject.class, IRubyObject.class, Object.class, String.class, String.class, String[].class, int.class, int.class, int.class, int.class, CallConfiguration.class))); } else { invokeUtilityMethod("def", sig(IRubyObject.class, params(ThreadContext.class, IRubyObject.class, Object.class, String.class, String.class, String[].class, int.class, int.class, int.class, int.class, CallConfiguration.class))); } } public void rethrowIfSystemExit() { loadRuntime(); method.ldc("SystemExit"); method.invokevirtual(p(Ruby.class), "fastGetClass", sig(RubyClass.class, String.class)); method.swap(); method.invokevirtual(p(RubyModule.class), "isInstance", sig(boolean.class, params(IRubyObject.class))); method.iconst_0(); Label ifEnd = new Label(); method.if_icmpeq(ifEnd); loadException(); method.athrow(); method.label(ifEnd); } } public class ASMClosureCompiler extends AbstractMethodCompiler { private String closureMethodName; public ASMClosureCompiler(String closureMethodName, ASTInspector inspector, StaticScope scope) { super(scope); this.closureMethodName = closureMethodName; method = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC | ACC_SYNTHETIC, closureMethodName, CLOSURE_SIGNATURE, null, null)); if (inspector == null) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, false, ARGS_INDEX, getFirstTempIndex()); } else if (inspector.hasClosure() || inspector.hasScopeAwareMethods()) { // enable "boxed" variable compilation when only a closure present // this breaks using a proc as a binding if (RubyInstanceConfig.BOXED_COMPILE_ENABLED && !inspector.hasScopeAwareMethods()) { variableCompiler = new BoxedVariableCompiler(this, method, scope, false, ARGS_INDEX, getFirstTempIndex()); } else { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, false, ARGS_INDEX, getFirstTempIndex()); } } else { variableCompiler = new StackBasedVariableCompiler(this, method, scope, false, ARGS_INDEX, getFirstTempIndex()); } invocationCompiler = new StandardInvocationCompiler(this, method); } public void beginMethod(CompilerCallback args, StaticScope scope) { method.start(); // set up a local IRuby variable method.aload(THREADCONTEXT_INDEX); invokeThreadContext("getRuntime", sig(Ruby.class)); method.dup(); method.astore(getRuntimeIndex()); // grab nil for local variables invokeIRuby("getNil", sig(IRubyObject.class)); method.astore(getNilIndex()); variableCompiler.beginClosure(args, scope); // start of scoping for closure's vars scopeStart = new Label(); scopeEnd = new Label(); redoJump = new Label(); method.label(scopeStart); } public void beginClass(CompilerCallback bodyPrep, StaticScope scope) { throw new NotCompilableException("ERROR: closure compiler should not be used for class bodies"); } public void endMethod() { // end of scoping for closure's vars scopeEnd = new Label(); method.areturn(); method.label(scopeEnd); // handle redos by restarting the block method.pop(); method.go_to(scopeStart); method.trycatch(scopeStart, scopeEnd, scopeEnd, p(JumpException.RedoJump.class)); method.end(); } @Override public void loadBlock() { loadThreadContext(); invokeThreadContext("getFrameBlock", sig(Block.class)); } public void performReturn() { loadThreadContext(); invokeUtilityMethod("returnJump", sig(JumpException.ReturnJump.class, IRubyObject.class, ThreadContext.class)); method.athrow(); } public void processRequiredArgs(Arity arity, int requiredArgs, int optArgs, int restArg) { throw new NotCompilableException("Shouldn't be calling this..."); } public void assignOptionalArgs(Object object, int expectedArgsCount, int size, ArrayCallback optEval) { throw new NotCompilableException("Shouldn't be calling this..."); } public void processRestArg(int startIndex, int restArg) { throw new NotCompilableException("Shouldn't be calling this..."); } public void processBlockArgument(int index) { loadRuntime(); loadThreadContext(); loadBlock(); method.pushInt(index); invokeUtilityMethod("processBlockArgument", sig(void.class, params(Ruby.class, ThreadContext.class, Block.class, int.class))); } public void issueBreakEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopBreak(); } else { value.call(this); invokeUtilityMethod("breakJump", sig(IRubyObject.class, IRubyObject.class)); } } public void issueNextEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopNext(); } else { value.call(this); invokeUtilityMethod("nextJump", sig(IRubyObject.class, IRubyObject.class)); } } public void issueRedoEvent() { // FIXME: This isn't right for within ensured/rescued code if (currentLoopLabels != null) { issueLoopRedo(); } else if (withinProtection) { invokeUtilityMethod("redoJump", sig(IRubyObject.class)); } else { // jump back to the top of the main body of this closure method.go_to(scopeStart); } } } public class ASMMethodCompiler extends AbstractMethodCompiler { private String friendlyName; private boolean specificArity; public ASMMethodCompiler(String friendlyName, ASTInspector inspector, StaticScope scope) { super(scope); this.friendlyName = friendlyName; String signature = null; if (scope.getRestArg() >= 0 || scope.getOptionalArgs() > 0 || scope.getRequiredArgs() > 3) { signature = METHOD_SIGNATURES[4]; method = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC, friendlyName, signature, null, null)); specificArity = false; } else { specificArity = true; signature = METHOD_SIGNATURES[scope.getRequiredArgs()]; // add a default [] version of the method that calls the specific version method = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC, friendlyName, METHOD_SIGNATURES[4], null, null)); method.start(); // check arity in the variable-arity version method.aload(1); method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class)); method.aload(3); method.pushInt(scope.getRequiredArgs()); method.pushInt(scope.getRequiredArgs()); method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class)); method.pop(); loadThis(); loadThreadContext(); loadSelf(); // FIXME: missing arity check for (int i = 0; i < scope.getRequiredArgs(); i++) { method.aload(ARGS_INDEX); method.ldc(i); method.arrayload(); } method.aload(ARGS_INDEX + 1); // load block from [] version of method method.invokevirtual(classname, friendlyName, signature); method.areturn(); method.end(); method = new SkinnyMethodAdapter(getClassVisitor().visitMethod(ACC_PUBLIC, friendlyName, signature, null, null)); } if (inspector == null) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, specificArity, ARGS_INDEX, getFirstTempIndex()); } else if (inspector.hasClosure() || inspector.hasScopeAwareMethods()) { // enable "boxed" variable compilation when only a closure present // this breaks using a proc as a binding if (RubyInstanceConfig.BOXED_COMPILE_ENABLED && !inspector.hasScopeAwareMethods()) { variableCompiler = new BoxedVariableCompiler(this, method, scope, specificArity, ARGS_INDEX, getFirstTempIndex()); } else { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, specificArity, ARGS_INDEX, getFirstTempIndex()); } } else { variableCompiler = new StackBasedVariableCompiler(this, method, scope, specificArity, ARGS_INDEX, getFirstTempIndex()); } invocationCompiler = new StandardInvocationCompiler(this, method); } public void beginChainedMethod() { method.start(); method.aload(THREADCONTEXT_INDEX); method.dup(); method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class)); method.dup(); method.astore(getRuntimeIndex()); // grab nil for local variables method.invokevirtual(p(Ruby.class), "getNil", sig(IRubyObject.class)); method.astore(getNilIndex()); method.invokevirtual(p(ThreadContext.class), "getCurrentScope", sig(DynamicScope.class)); method.dup(); method.astore(getDynamicScopeIndex()); method.invokevirtual(p(DynamicScope.class), "getValues", sig(IRubyObject[].class)); method.astore(getVarsArrayIndex()); } public void beginMethod(CompilerCallback args, StaticScope scope) { method.start(); // set up a local IRuby variable method.aload(THREADCONTEXT_INDEX); invokeThreadContext("getRuntime", sig(Ruby.class)); method.dup(); method.astore(getRuntimeIndex()); // grab nil for local variables invokeIRuby("getNil", sig(IRubyObject.class)); method.astore(getNilIndex()); variableCompiler.beginMethod(args, scope); // visit a label to start scoping for local vars in this method Label start = new Label(); method.label(start); scopeStart = start; } public void beginClass(CompilerCallback bodyPrep, StaticScope scope) { method.start(); // set up a local IRuby variable method.aload(THREADCONTEXT_INDEX); invokeThreadContext("getRuntime", sig(Ruby.class)); method.dup(); method.astore(getRuntimeIndex()); // grab nil for local variables invokeIRuby("getNil", sig(IRubyObject.class)); method.astore(getNilIndex()); variableCompiler.beginClass(bodyPrep, scope); // visit a label to start scoping for local vars in this method Label start = new Label(); method.label(start); scopeStart = start; } public void endMethod() { // return last value from execution method.areturn(); // end of variable scope Label end = new Label(); method.label(end); method.end(); } public void performReturn() { // normal return for method body. return jump for within a begin/rescue/ensure if (withinProtection) { loadThreadContext(); invokeUtilityMethod("returnJump", sig(JumpException.ReturnJump.class, IRubyObject.class, ThreadContext.class)); method.athrow(); } else { method.areturn(); } } public void issueBreakEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopBreak(); } else if (withinProtection) { value.call(this); invokeUtilityMethod("breakJump", sig(IRubyObject.class, IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); value.call(this); invokeUtilityMethod("breakLocalJumpError", sig(IRubyObject.class, Ruby.class, IRubyObject.class)); } } public void issueNextEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopNext(); } else if (withinProtection) { value.call(this); invokeUtilityMethod("nextJump", sig(IRubyObject.class, IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); value.call(this); invokeUtilityMethod("nextLocalJumpError", sig(IRubyObject.class, Ruby.class, IRubyObject.class)); } } public void issueRedoEvent() { if (currentLoopLabels != null) { issueLoopRedo(); } else if (withinProtection) { invokeUtilityMethod("redoJump", sig(IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); invokeUtilityMethod("redoLocalJumpError", sig(IRubyObject.class, Ruby.class)); } } } private int constants = 0; public String getNewConstant(String type, String name_prefix) { return getNewConstant(type, name_prefix, null); } public String getNewConstant(String type, String name_prefix, Object init) { ClassVisitor cv = getClassVisitor(); String realName; synchronized (this) { realName = "_" + constants++; } // declare the field cv.visitField(ACC_PRIVATE, realName, type, null, null).visitEnd(); if(init != null) { initMethod.aload(THIS); initMethod.ldc(init); initMethod.putfield(classname, realName, type); } return realName; } public String getNewField(String type, String name, Object init) { ClassVisitor cv = getClassVisitor(); // declare the field cv.visitField(ACC_PRIVATE, name, type, null, null).visitEnd(); if(init != null) { initMethod.aload(THIS); initMethod.ldc(init); initMethod.putfield(classname, name, type); } return name; } public String getNewStaticConstant(String type, String name_prefix) { ClassVisitor cv = getClassVisitor(); String realName; synchronized (this) { realName = "__" + constants++; } // declare the field cv.visitField(ACC_PRIVATE | ACC_STATIC | ACC_FINAL, realName, type, null, null).visitEnd(); return realName; } }
[ "everton.maldonado@gmail.com" ]
everton.maldonado@gmail.com
4e2f235a97d617beac055eb7bd31e00b1983ab7b
353f37697a4680353a5e52cea314a8e92d47e0d4
/1.JavaSyntax/src/com/javarush/task/task04/task0419/Solution.java
8b52d7558c9378d4801e3fbc02865509da6fb608
[]
no_license
CrowKiller/JavaRushTasks
a43bed81d7fe70427754ea979198bb37566bfa0c
9a92aa7c301b5ca82f41b421de9347311a6b581a
refs/heads/master
2022-01-15T00:19:27.762603
2022-01-02T05:07:55
2022-01-02T05:07:55
197,341,550
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package com.javarush.task.task04.task0419; /* Максимум четырех чисел */ import java.io.*; public class Solution { public static void main(String[] args) throws Exception { //напишите тут ваш код BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int a = Integer.parseInt(reader.readLine()); int b = Integer.parseInt(reader.readLine()); int c = Integer.parseInt(reader.readLine()); int d = Integer.parseInt(reader.readLine()); int max=a; if (b>max) max=b; if (c>max) max=c; if (d>max) max=d; System.out.println(max); } }
[ "nenajmi@gmail.com" ]
nenajmi@gmail.com
7fc598c8a820691a3e5cb502aa5d9e503a86e25f
033efd99e8718e93b45ee8ae0e35de5d2884287d
/src/main/java/com/ky2009666/service/service/ShResourceService.java
aafcae8e0a037c3589b10d754a1754b5a93e2ebe
[]
no_license
ky2009888/springboot-shiro-01
69de9ebf5c4d32036ca360a904383cbb8b5e51c4
027397dc207586933349eaccdc4bd6ae643c52ac
refs/heads/master
2023-04-13T18:20:27.806925
2021-04-29T03:28:34
2021-04-29T03:28:34
362,676,985
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.ky2009666.service.service; import com.ky2009666.service.domain.ShResource; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; /** * */ public interface ShResourceService extends IService<ShResource> { List<ShResource> findPermissionsByRoleId(String roleId); }
[ "ji_jinliang2012@163.com" ]
ji_jinliang2012@163.com
1200037e73375b729438b7cd97d4ccf2fb455a3b
fb05344c53beae014fcee77d37036c0198a91f99
/SuricatePodcast/app/src/main/java/leoisasmendi/android/com/suricatepodcast/data/PodcastContract.java
10621c352a108fb6d2ba5dcedff9ec407e25817f
[ "MIT" ]
permissive
LeoIsasmendi/SuricatePodcast
1487e4350edbeb074b8626300b9a1c13ddb9117a
ad455687c27ebf4c2141cd0025035ec1910a099b
refs/heads/master
2020-06-19T11:57:50.906485
2017-05-08T00:41:21
2017-05-08T00:41:21
74,906,611
1
0
null
null
null
null
UTF-8
Java
false
false
3,168
java
/* * The MIT License (MIT) * Copyright (c) 2017. Sergio Leonardo Isasmendi * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package leoisasmendi.android.com.suricatepodcast.data; import android.net.Uri; import android.provider.BaseColumns; public final class PodcastContract { // To prevent to someone from accidentally instantiating the contract class, // make the constructor private. private PodcastContract() { } public static final String CONTENT_AUTHORITY = "leoisasmendi.android.com.suricatepodcast.provider.DataProvider"; public static final Uri BASE_URI = Uri.parse("content://" + CONTENT_AUTHORITY); /* Inner class that defines the table contents */ public static final class PodcastEntry implements BaseColumns { public static final String TABLE_NAME = "Playlist"; public static final String COLUMN_ID = "podcast"; public static final String COLUMN_TITLE = "title"; public static final String COLUMN_SHOW_TITLE = "showtitle"; public static final String COLUMN_DURATION = "duration"; public static final String COLUMN_AUDIO = "audio"; public static final String COLUMN_POSTER = "poster"; public static final String COLUMN_DESCRIPTION = "description"; /** * Matches: /items/ */ public static Uri buildDirUri() { return BASE_URI.buildUpon().appendPath("items").build(); } /** * Matches: /items/[_id]/ */ public static Uri buildItemUri(long _id) { return BASE_URI.buildUpon().appendPath("items").appendPath(Long.toString(_id)).build(); } /** * Read item ID item detail URI. */ public static long getItemId(Uri itemUri) { return Long.parseLong(itemUri.getPathSegments().get(1)); } } /* Inner class that defines the table types */ public static final class PodcastType { public static final String STRING_TYPE = "text"; public static final String INT_TYPE = "integer"; public static final String LONG_TYPE = "long"; } }
[ "leo.isasmendi@gmail.com" ]
leo.isasmendi@gmail.com
6378fb60e4c18c49729549edbd2ec29b3183c900
ab2678c3d33411507d639ff0b8fefb8c9a6c9316
/jgralab/src/de/uni_koblenz/jgralab/greql2/schema/impl/std/DeclarationImpl.java
e1a295523da4d6d35952e504783226e867998595
[]
no_license
dmosen/wiki-analysis
b58c731fa2d66e78fe9b71699bcfb228f4ab889e
e9c8d1a1242acfcb683aa01bfacd8680e1331f4f
refs/heads/master
2021-01-13T01:15:10.625520
2013-10-28T13:27:16
2013-10-28T13:27:16
8,741,553
2
0
null
null
null
null
UTF-8
Java
false
false
15,081
java
/* * This code was generated automatically. * Do NOT edit this file, changes will be lost. * Instead, change and commit the underlying schema. */ package de.uni_koblenz.jgralab.greql2.schema.impl.std; import de.uni_koblenz.jgralab.impl.IncidenceIterable; import de.uni_koblenz.jgralab.impl.std.VertexImpl; import de.uni_koblenz.jgralab.EdgeDirection; import de.uni_koblenz.jgralab.GraphIO; import de.uni_koblenz.jgralab.GraphIOException; import de.uni_koblenz.jgralab.NoSuchAttributeException; import java.io.IOException; public class DeclarationImpl extends VertexImpl implements de.uni_koblenz.jgralab.greql2.schema.Declaration, de.uni_koblenz.jgralab.greql2.schema.Greql2Vertex { public DeclarationImpl(int id, de.uni_koblenz.jgralab.Graph g) { super(id, g); } @Override public final de.uni_koblenz.jgralab.schema.VertexClass getAttributedElementClass() { return de.uni_koblenz.jgralab.greql2.schema.Declaration.VC; } @Override public final java.lang.Class<? extends de.uni_koblenz.jgralab.Vertex> getSchemaClass() { return de.uni_koblenz.jgralab.greql2.schema.Declaration.class; } public <T> T getAttribute(String attributeName) { throw new NoSuchAttributeException("Declaration doesn't contain an attribute " + attributeName); } public <T> void setAttribute(String attributeName, T data) { throw new NoSuchAttributeException("Declaration doesn't contain an attribute " + attributeName); } public void readAttributeValues(GraphIO io) throws GraphIOException { } public void readAttributeValueFromString(String attributeName, String value) throws GraphIOException { throw new NoSuchAttributeException("Declaration doesn't contain an attribute " + attributeName); } public void writeAttributeValues(GraphIO io) throws GraphIOException, IOException { } public String writeAttributeValueToString(String attributeName) throws IOException, GraphIOException { throw new NoSuchAttributeException("Declaration doesn't contain an attribute " + attributeName); } @Override public de.uni_koblenz.jgralab.greql2.schema.Declaration getNextDeclaration() { return (de.uni_koblenz.jgralab.greql2.schema.Declaration)getNextVertex(de.uni_koblenz.jgralab.greql2.schema.Declaration.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.Greql2Vertex getNextGreql2Vertex() { return (de.uni_koblenz.jgralab.greql2.schema.Greql2Vertex)getNextVertex(de.uni_koblenz.jgralab.greql2.schema.Greql2Vertex.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf getFirstIsTypeExprOfIncidence() { return (de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf getFirstIsTypeExprOfIncidence(EdgeDirection orientation) { return (de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf.class, orientation); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf getFirstIsCompDeclOfIncidence() { return (de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf getFirstIsCompDeclOfIncidence(EdgeDirection orientation) { return (de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf.class, orientation); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf getFirstIsBoundExprOfIncidence() { return (de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf getFirstIsBoundExprOfIncidence(EdgeDirection orientation) { return (de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf.class, orientation); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf getFirstIsQuantifiedDeclOfIncidence() { return (de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf getFirstIsQuantifiedDeclOfIncidence(EdgeDirection orientation) { return (de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf.class, orientation); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf getFirstIsSimpleDeclOfIncidence() { return (de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf getFirstIsSimpleDeclOfIncidence(EdgeDirection orientation) { return (de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class, orientation); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf getFirstIsConstraintOfIncidence() { return (de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf getFirstIsConstraintOfIncidence(EdgeDirection orientation) { return (de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class, orientation); } @Override public de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation getFirstGreql2AggregationIncidence() { return (de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation.class); } @Override public de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation getFirstGreql2AggregationIncidence(EdgeDirection orientation) { return (de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation)getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation.class, orientation); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf add_constraint(de.uni_koblenz.jgralab.greql2.schema.Expression vertex) { return ((de.uni_koblenz.jgralab.greql2.schema.Greql2)getGraph()).createEdge(de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.EC, (de.uni_koblenz.jgralab.greql2.schema.Expression) vertex, (de.uni_koblenz.jgralab.greql2.schema.Declaration) this); } @Override public java.util.List<? extends de.uni_koblenz.jgralab.greql2.schema.Expression> remove_constraint() { java.util.List<de.uni_koblenz.jgralab.greql2.schema.Expression> adjacences = new java.util.ArrayList<de.uni_koblenz.jgralab.greql2.schema.Expression>(); de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf edge = (de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf) getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class, EdgeDirection.IN); while (edge != null) { de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf next = (de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf) edge.getNextIncidence(de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class, EdgeDirection.IN); adjacences.add((de.uni_koblenz.jgralab.greql2.schema.Expression) edge.getThat()); edge.delete(); edge = next; } return adjacences; } @Override public boolean remove_constraint(de.uni_koblenz.jgralab.greql2.schema.Expression vertex) { boolean elementRemoved = false; de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf edge = (de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf) getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class, EdgeDirection.IN); while (edge != null) { de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf next = (de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf) edge.getNextIncidence(de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class, EdgeDirection.IN); if (edge.getThat().equals(vertex)) { edge.delete(); elementRemoved = true; } edge = next; } return elementRemoved; } @Override public Iterable<? extends de.uni_koblenz.jgralab.greql2.schema.Expression> get_constraint() { return new de.uni_koblenz.jgralab.impl.NeighbourIterable<de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf, de.uni_koblenz.jgralab.greql2.schema.Expression>(this, de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class, EdgeDirection.IN); } @Override public de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf add_simpleDecl(de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration vertex) { return ((de.uni_koblenz.jgralab.greql2.schema.Greql2)getGraph()).createEdge(de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.EC, (de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration) vertex, (de.uni_koblenz.jgralab.greql2.schema.Declaration) this); } @Override public java.util.List<? extends de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration> remove_simpleDecl() { java.util.List<de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration> adjacences = new java.util.ArrayList<de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration>(); de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf edge = (de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf) getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class, EdgeDirection.IN); while (edge != null) { de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf next = (de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf) edge.getNextIncidence(de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class, EdgeDirection.IN); adjacences.add((de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration) edge.getThat()); edge.delete(); edge = next; } return adjacences; } @Override public boolean remove_simpleDecl(de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration vertex) { boolean elementRemoved = false; de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf edge = (de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf) getFirstIncidence(de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class, EdgeDirection.IN); while (edge != null) { de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf next = (de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf) edge.getNextIncidence(de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class, EdgeDirection.IN); if (edge.getThat().equals(vertex)) { edge.delete(); elementRemoved = true; } edge = next; } return elementRemoved; } @Override public Iterable<? extends de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration> get_simpleDecl() { return new de.uni_koblenz.jgralab.impl.NeighbourIterable<de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf, de.uni_koblenz.jgralab.greql2.schema.SimpleDeclaration>(this, de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class, EdgeDirection.IN); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf> getIsTypeExprOfIncidences() { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf.class); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf> getIsTypeExprOfIncidences(EdgeDirection direction) { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsTypeExprOf.class, direction); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf> getIsCompDeclOfIncidences() { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf.class); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf> getIsCompDeclOfIncidences(EdgeDirection direction) { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsCompDeclOf.class, direction); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf> getIsBoundExprOfIncidences() { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf.class); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf> getIsBoundExprOfIncidences(EdgeDirection direction) { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsBoundExprOf.class, direction); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf> getIsQuantifiedDeclOfIncidences() { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf.class); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf> getIsQuantifiedDeclOfIncidences(EdgeDirection direction) { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsQuantifiedDeclOf.class, direction); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf> getIsSimpleDeclOfIncidences() { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf> getIsSimpleDeclOfIncidences(EdgeDirection direction) { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsSimpleDeclOf.class, direction); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf> getIsConstraintOfIncidences() { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf> getIsConstraintOfIncidences(EdgeDirection direction) { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf>(this, de.uni_koblenz.jgralab.greql2.schema.IsConstraintOf.class, direction); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation> getGreql2AggregationIncidences() { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation>(this, de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation.class); } @Override public Iterable<de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation> getGreql2AggregationIncidences(EdgeDirection direction) { return new IncidenceIterable<de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation>(this, de.uni_koblenz.jgralab.greql2.schema.Greql2Aggregation.class, direction); } }
[ "dmosen@uni-koblenz.de" ]
dmosen@uni-koblenz.de
4fc47a728144c28fb341f9b66925cc3b35e08c7a
b745bce17192e6bdc6a866eb410e658aa6ee8dbc
/_finalProject/raise/src/main/java/com/ilyabuglakov/raise/dal/dao/interfaces/AnswerDao.java
9e87f8f19899aef831b4b39350d46c1485749118
[]
no_license
Sintexer/IlyaBuglakov
676981aebfb9a659cd31962d40c6ff73820b8705
daed7dd789ee2923f33432b3f264cd477a24f3da
refs/heads/master
2023-03-01T23:34:33.403755
2021-02-09T11:28:09
2021-02-09T11:28:09
296,237,346
0
1
null
null
null
null
UTF-8
Java
false
false
838
java
package com.ilyabuglakov.raise.dal.dao.interfaces; import com.ilyabuglakov.raise.dal.dao.Dao; import com.ilyabuglakov.raise.dal.dao.exception.DaoOperationException; import com.ilyabuglakov.raise.domain.Answer; import java.util.Collection; import java.util.Set; /** * The interface Answer dao. */ public interface AnswerDao extends Dao<Answer> { /** * Find by question id set. * * @param questionId the question id * @return the set * @throws DaoOperationException the dao operation exception */ Set<Answer> findByQuestionId(Integer questionId) throws DaoOperationException; /** * Create all. * * @param answers the answers * @throws DaoOperationException the dao operation exception */ void createAll(Collection<Answer> answers) throws DaoOperationException; }
[ "Neonlightnight@gmail.com" ]
Neonlightnight@gmail.com
7f8dcf08ba318cb8c3b76c26714138a2a9f6a3c6
2ed545611fac5f7032849be4b78e048bb409b72a
/app/src/main/java/com/toboehm/walktracker/network/requests/PhotoRequest.java
47518bfd3dceafe754216506f8b16229d527e562
[ "Apache-2.0" ]
permissive
TBoehm/K-Recruitement-Test
c415fbb16ef7e2a10f9d6e0a50dc5bf51a3f6b02
999139cd208106acd36f996cc38a78ce0db1fa25
refs/heads/master
2021-01-10T15:04:55.152138
2015-10-25T18:56:27
2015-10-25T18:56:27
44,914,936
0
0
null
null
null
null
UTF-8
Java
false
false
1,726
java
package com.toboehm.walktracker.network.requests; import android.location.Location; import android.util.Log; import com.toboehm.walktracker.network.responsmodel.PPhotoResponse; import rx.Observable; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by Tobias Boehm on 24.10.2015. */ public class PhotoRequest extends Request<PPhotoResponse> { private static final double AREA_DELTA = 0.00075; public static PhotoRequest createFor(final Location currentLocation) { return new PhotoRequest(currentLocation); } private final double minLongitude; private final double maxLongitude; private final double minLatitude; private final double maxLatitude; private PhotoRequest(final Location currentLocation) { // calculate an area around the current location from which pictures can be taken minLongitude = currentLocation.getLongitude() - AREA_DELTA; maxLongitude = currentLocation.getLongitude() + AREA_DELTA; minLatitude = currentLocation.getLatitude() - AREA_DELTA / 2; maxLatitude = currentLocation.getLatitude() + AREA_DELTA / 2; Log.v("PhotoRequest Vars", "minLongitude = " + minLongitude + ", maxLongitude = " + maxLongitude + ", minLatitude = " + minLatitude + ", maxLatitude = " + maxLatitude); } @Override public Observable<PPhotoResponse> getConfiguredObservable() { return panoramioEndpoint.getPanorama(minLongitude, minLatitude, maxLongitude, maxLatitude) .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .retry(3); } }
[ "contact@toboehm.de" ]
contact@toboehm.de
279489f4726aa7c88ed0b33703c32360b15df6ee
fb079e82c42cea89a3faea928d4caf0df4954b05
/Физкультура/ВДНХ/VelnessBMSTU_v1.2b_apkpure.com_source_from_JADX/com/google/android/gms/internal/zzegx.java
dc72e031d99f55f15db2c26580a99a2011c8f5da
[]
no_license
Belousov-EA/university
33c80c701871379b6ef9aa3da8f731ccf698d242
6ec7303ca964081c52f259051833a045f0c91a39
refs/heads/master
2022-01-21T17:46:30.732221
2022-01-10T20:27:15
2022-01-10T20:27:15
123,337,018
1
1
null
null
null
null
UTF-8
Java
false
false
2,539
java
package com.google.android.gms.internal; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.Callable; public final class zzegx implements zzegy { private boolean zzmls = false; private final void zzbtf() { zzelt.zzb(this.zzmls, "Transaction expected to already be in progress."); } public final void zza(zzedk com_google_android_gms_internal_zzedk, zzecy com_google_android_gms_internal_zzecy, long j) { zzbtf(); } public final void zza(zzedk com_google_android_gms_internal_zzedk, zzekd com_google_android_gms_internal_zzekd, long j) { zzbtf(); } public final void zza(zzeik com_google_android_gms_internal_zzeik, zzekd com_google_android_gms_internal_zzekd) { zzbtf(); } public final void zza(zzeik com_google_android_gms_internal_zzeik, Set<zzejg> set) { zzbtf(); } public final void zza(zzeik com_google_android_gms_internal_zzeik, Set<zzejg> set, Set<zzejg> set2) { zzbtf(); } public final void zzbl(long j) { zzbtf(); } public final List<zzegd> zzbtb() { return Collections.emptyList(); } public final void zzbte() { zzbtf(); } public final void zzc(zzedk com_google_android_gms_internal_zzedk, zzecy com_google_android_gms_internal_zzecy) { zzbtf(); } public final void zzd(zzedk com_google_android_gms_internal_zzedk, zzecy com_google_android_gms_internal_zzecy) { zzbtf(); } public final <T> T zze(Callable<T> callable) { zzelt.zzb(!this.zzmls, "runInTransaction called when an existing transaction is already in progress."); this.zzmls = true; try { T call = callable.call(); this.zzmls = false; return call; } catch (Throwable th) { this.zzmls = false; } } public final zzehx zzf(zzeik com_google_android_gms_internal_zzeik) { return new zzehx(zzejw.zza(zzeju.zzcaf(), com_google_android_gms_internal_zzeik.zzbyr()), false, false); } public final void zzg(zzeik com_google_android_gms_internal_zzeik) { zzbtf(); } public final void zzh(zzeik com_google_android_gms_internal_zzeik) { zzbtf(); } public final void zzi(zzeik com_google_android_gms_internal_zzeik) { zzbtf(); } public final void zzk(zzedk com_google_android_gms_internal_zzedk, zzekd com_google_android_gms_internal_zzekd) { zzbtf(); } }
[ "Belousov.EA98@gmail.com" ]
Belousov.EA98@gmail.com
7a588a1dca7c1c7b03a46ba755ff5d71b1c9bd97
90a7e4449670118d549f797b8a1bffbd57537215
/org.hpccsystems.ws.client/src/main/java/org/hpccsystems/ws/client/soap/filespray/OpenSaveResponse.java
457ccd72b4e60bbd02dcb8cea1f944358b93b3fd
[]
no_license
supriyan/HPCC-JAPIs
18b0cebe030c3855b9c578ed595f76d4ab5cc08a
e373e61daeda2d9ea07a8366a094602212831b06
refs/heads/master
2021-01-24T22:13:44.515634
2014-11-06T21:53:55
2014-11-06T21:53:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,782
java
/** * OpenSaveResponse.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package org.hpccsystems.ws.client.soap.filespray; public class OpenSaveResponse implements java.io.Serializable { private org.hpccsystems.ws.client.soap.filespray.ArrayOfEspException exceptions; private java.lang.String location; private java.lang.String path; private java.lang.String name; private java.lang.String type; private java.lang.String dateTime; private java.lang.Boolean viewable; public OpenSaveResponse() { } public OpenSaveResponse( org.hpccsystems.ws.client.soap.filespray.ArrayOfEspException exceptions, java.lang.String location, java.lang.String path, java.lang.String name, java.lang.String type, java.lang.String dateTime, java.lang.Boolean viewable) { this.exceptions = exceptions; this.location = location; this.path = path; this.name = name; this.type = type; this.dateTime = dateTime; this.viewable = viewable; } /** * Gets the exceptions value for this OpenSaveResponse. * * @return exceptions */ public org.hpccsystems.ws.client.soap.filespray.ArrayOfEspException getExceptions() { return exceptions; } /** * Sets the exceptions value for this OpenSaveResponse. * * @param exceptions */ public void setExceptions(org.hpccsystems.ws.client.soap.filespray.ArrayOfEspException exceptions) { this.exceptions = exceptions; } /** * Gets the location value for this OpenSaveResponse. * * @return location */ public java.lang.String getLocation() { return location; } /** * Sets the location value for this OpenSaveResponse. * * @param location */ public void setLocation(java.lang.String location) { this.location = location; } /** * Gets the path value for this OpenSaveResponse. * * @return path */ public java.lang.String getPath() { return path; } /** * Sets the path value for this OpenSaveResponse. * * @param path */ public void setPath(java.lang.String path) { this.path = path; } /** * Gets the name value for this OpenSaveResponse. * * @return name */ public java.lang.String getName() { return name; } /** * Sets the name value for this OpenSaveResponse. * * @param name */ public void setName(java.lang.String name) { this.name = name; } /** * Gets the type value for this OpenSaveResponse. * * @return type */ public java.lang.String getType() { return type; } /** * Sets the type value for this OpenSaveResponse. * * @param type */ public void setType(java.lang.String type) { this.type = type; } /** * Gets the dateTime value for this OpenSaveResponse. * * @return dateTime */ public java.lang.String getDateTime() { return dateTime; } /** * Sets the dateTime value for this OpenSaveResponse. * * @param dateTime */ public void setDateTime(java.lang.String dateTime) { this.dateTime = dateTime; } /** * Gets the viewable value for this OpenSaveResponse. * * @return viewable */ public java.lang.Boolean getViewable() { return viewable; } /** * Sets the viewable value for this OpenSaveResponse. * * @param viewable */ public void setViewable(java.lang.Boolean viewable) { this.viewable = viewable; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof OpenSaveResponse)) return false; OpenSaveResponse other = (OpenSaveResponse) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.exceptions==null && other.getExceptions()==null) || (this.exceptions!=null && this.exceptions.equals(other.getExceptions()))) && ((this.location==null && other.getLocation()==null) || (this.location!=null && this.location.equals(other.getLocation()))) && ((this.path==null && other.getPath()==null) || (this.path!=null && this.path.equals(other.getPath()))) && ((this.name==null && other.getName()==null) || (this.name!=null && this.name.equals(other.getName()))) && ((this.type==null && other.getType()==null) || (this.type!=null && this.type.equals(other.getType()))) && ((this.dateTime==null && other.getDateTime()==null) || (this.dateTime!=null && this.dateTime.equals(other.getDateTime()))) && ((this.viewable==null && other.getViewable()==null) || (this.viewable!=null && this.viewable.equals(other.getViewable()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getExceptions() != null) { _hashCode += getExceptions().hashCode(); } if (getLocation() != null) { _hashCode += getLocation().hashCode(); } if (getPath() != null) { _hashCode += getPath().hashCode(); } if (getName() != null) { _hashCode += getName().hashCode(); } if (getType() != null) { _hashCode += getType().hashCode(); } if (getDateTime() != null) { _hashCode += getDateTime().hashCode(); } if (getViewable() != null) { _hashCode += getViewable().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(OpenSaveResponse.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", ">OpenSaveResponse")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("exceptions"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "Exceptions")); elemField.setXmlType(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "ArrayOfEspException")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("location"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "Location")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("path"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "Path")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("name"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "Name")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("type"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "Type")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("dateTime"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "DateTime")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("viewable"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:filespray", "Viewable")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
[ "rodrigo.pastrana@lexisnexis.com" ]
rodrigo.pastrana@lexisnexis.com
21135c52cff0e39c5ff90505d246795f7251f7b7
6a516b3939751b7c4ee1859280569151124dd2c2
/src/com/javarush/test/level16/lesson03/task05/Solution.java
47c98e43ca752abf19d7861c7d06964f14117d41
[]
no_license
SirMatters/JavaRush-Solutions
690d34b0680ca2f2b220ce3fce666937cb59050d
fe3592308428baac735fb3c443356b54e38a4f8d
refs/heads/master
2020-12-24T11:45:45.233258
2018-04-14T18:50:25
2018-04-14T18:50:25
73,015,759
0
0
null
null
null
null
UTF-8
Java
false
false
2,059
java
package com.javarush.test.level16.lesson03.task05; import java.util.Date; /* Поговорим о музыке? 1. Измените класс Violin так, чтоб он стал таском для нити. Используйте интерфейс MusicalInstrument 2. Реализуй необходимый метод в нити Violin. Реализация должна быть следующей: 2.1. Считай время начала игры - метод startPlaying(). 2.2. Подожди 1 секунду - метод sleepNSeconds(int n), где n - количество секунд. 2.3. Считай время окончания игры - метод stopPlaying(). 2.4. Выведи на консоль продолжительность игры в миллисекундах. Пример "Playing 1002 ms". */ public class Solution { public static void main(String[] args) { Thread violin = new Thread(new Violin("Player")); violin.start(); } public static class Violin implements MusicalInstrument { public void run() { Date strt = startPlaying(); sleepNSeconds(1); Date stp = stopPlaying(); System.out.println("Playing " + (stp.getTime() - strt.getTime() + " ms")); } private String owner; public Violin(String owner) { this.owner = owner; } public Date startPlaying() { System.out.println(this.owner + " starts playing"); return new Date(); } public Date stopPlaying() { System.out.println(this.owner + " stops playing"); return new Date(); } } public static int delay = 1000; public static void sleepNSeconds(int n) { try { Thread.sleep(n * delay); } catch (InterruptedException e) { e.printStackTrace(); } } public static interface MusicalInstrument extends Runnable { Date startPlaying(); Date stopPlaying(); } }
[ "perov.krll@gmail.com" ]
perov.krll@gmail.com
df61a7fb23203398f97605a097c830f67ae5cca4
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Time/6/org/joda/time/chrono/GJChronology_getDateTimeMillis_349.java
6c703d29326309691d0d8afc26269502fe47d844
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
3,534
java
org joda time chrono implement gregorian julian calendar system calendar system world recommend link iso chronolog isochronolog gregorian calendar replac julian calendar point time chronolog switch control paramet instanc getinst method cutov set date gregorian calendar institut octob date chronolog prolept julian calendar prolept mean extend indefinit julian calendar leap year year gregorian special rule year meaning result obtain input valu julian leap year irregular bce julian calendar chronolog differ link java util gregorian calendar gregoriancalendar gregorian calendar gregoriancalendar year bce return correctli year bce return year era yearofera field produc result compat gregorian calendar gregoriancalendar julian calendar year year year gregorian cutov date year julian year defin word prolept gregorian chronolog year creat pure prolept julian chronolog link julian chronolog julianchronolog creat pure prolept gregorian chronolog link gregorian chronolog gregorianchronolog chronolog gjchronolog thread safe immut author brian neill o'neil author stephen colebourn chronolog gjchronolog assembl chronolog assembledchronolog date time milli getdatetimemilli year month year monthofyear dai month dayofmonth hour dai hourofdai minut hour minuteofhour minut secondofminut milli millisofsecond illeg argument except illegalargumentexcept chronolog base base base getbas base date time milli getdatetimemilli year month year monthofyear dai month dayofmonth hour dai hourofdai minut hour minuteofhour minut secondofminut milli millisofsecond assum date gregorian instant instant gregorian chronolog igregorianchronolog date time milli getdatetimemilli year month year monthofyear dai month dayofmonth hour dai hourofdai minut hour minuteofhour minut secondofminut milli millisofsecond illeg field except illegalfieldvalueexcept month year monthofyear dai month dayofmonth instant gregorian chronolog igregorianchronolog date time milli getdatetimemilli year month year monthofyear hour dai hourofdai minut hour minuteofhour minut secondofminut milli millisofsecond instant cutov milli icutovermilli instant cutov milli icutovermilli julian instant julian chronolog ijulianchronolog date time milli getdatetimemilli year month year monthofyear dai month dayofmonth hour dai hourofdai minut hour minuteofhour minut secondofminut milli millisofsecond instant cutov milli icutovermilli illeg cutov gap illeg argument except illegalargumentexcept date exist instant
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
7d1a1119ed7e21e0622b61cb18808e7063393d36
df2cc5237efd95c9893cddc1dc345bde80b2319e
/ly-gateway/src/main/java/com/leyou/registry/gateway/config/FilterProperties.java
4dd825fb7fca6a4ebfc9a8c8be71b9b66383c848
[]
no_license
risero/leyou
2a32b0d396fac69f74a8c05d4108aa089ec51dd0
60eceb32a156c071c175690673d6b6bc4ea925f7
refs/heads/master
2022-12-22T06:13:20.020488
2019-05-24T00:57:29
2019-05-24T00:57:29
165,045,801
1
0
null
null
null
null
UTF-8
Java
false
false
434
java
package com.leyou.registry.gateway.config; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import java.util.List; /** * author 暗氵愧 * HostName dell * Date 2019/1/2 19:12 */ @Data @Configuration @ConfigurationProperties(prefix = "ly.filter") public class FilterProperties { private List<String> allowPaths; }
[ "risero/2628668412@qq.com" ]
risero/2628668412@qq.com
4dd85ac08f5393eec6d078b5aa155b0718eb4525
3daded44038169d81d949ea22269a79690ac8983
/src/ex13interface/figure/IFigure.java
6383ae4bceb1f16f06d131eea67eb0befb60e7d4
[]
no_license
sungkihoon/K01JAVA
1ec3e46264dfe694d793170e635f29259d1f44b3
b047c47961fefe585fd3a5dbbd1b32a96025ceb9
refs/heads/master
2021-02-19T11:22:38.249150
2020-06-12T09:00:20
2020-06-12T09:00:20
245,307,853
0
0
null
null
null
null
UTF-8
Java
false
false
262
java
package ex13interface.figure; //※인터페이스 하나당 하나의 자바파일을 구성하는 것을 권고하고 있음 //인자로 전다로디는 도형의 넓이를 구하는 추상메소드 public interface IFigure { void area(String figureName); }
[ "Kosmo_25@DESKTOP-U46TV3B" ]
Kosmo_25@DESKTOP-U46TV3B
b1d5f047e02791dd6f74d34f784d67f50dad0200
88bb343687bc1b9171803022d1e847b60ab4cb41
/gmall-sms/src/main/java/com/atguigu/gmall/sms/controller/HomeSubjectController.java
d7eba29947f7a6689f515dc13e3d868181ca612d
[ "Apache-2.0" ]
permissive
57794246/gmall
1b9356245386289ffa942139655481b1160c972f
83d77dd953b7ab4a1ee9e7405b5da21196e8a116
refs/heads/master
2022-07-23T00:15:26.349171
2019-12-02T16:52:06
2019-12-02T16:52:06
225,326,765
0
0
Apache-2.0
2022-07-06T20:43:20
2019-12-02T08:45:01
JavaScript
UTF-8
Java
false
false
2,618
java
package com.atguigu.gmall.sms.controller; import java.util.Arrays; import java.util.Map; import com.atguigu.core.bean.PageVo; import com.atguigu.core.bean.QueryCondition; import com.atguigu.core.bean.Resp; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import com.atguigu.gmall.sms.entity.HomeSubjectEntity; import com.atguigu.gmall.sms.service.HomeSubjectService; /** * 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 * * @author ZhengFei * @email zf@atguigu.com * @date 2019-12-03 00:44:59 */ @Api(tags = "首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 管理") @RestController @RequestMapping("sms/homesubject") public class HomeSubjectController { @Autowired private HomeSubjectService homeSubjectService; /** * 列表 */ @ApiOperation("分页查询(排序)") @GetMapping("/list") @PreAuthorize("hasAuthority('sms:homesubject:list')") public Resp<PageVo> list(QueryCondition queryCondition) { PageVo page = homeSubjectService.queryPage(queryCondition); return Resp.ok(page); } /** * 信息 */ @ApiOperation("详情查询") @GetMapping("/info/{id}") @PreAuthorize("hasAuthority('sms:homesubject:info')") public Resp<HomeSubjectEntity> info(@PathVariable("id") Long id){ HomeSubjectEntity homeSubject = homeSubjectService.getById(id); return Resp.ok(homeSubject); } /** * 保存 */ @ApiOperation("保存") @PostMapping("/save") @PreAuthorize("hasAuthority('sms:homesubject:save')") public Resp<Object> save(@RequestBody HomeSubjectEntity homeSubject){ homeSubjectService.save(homeSubject); return Resp.ok(null); } /** * 修改 */ @ApiOperation("修改") @PostMapping("/update") @PreAuthorize("hasAuthority('sms:homesubject:update')") public Resp<Object> update(@RequestBody HomeSubjectEntity homeSubject){ homeSubjectService.updateById(homeSubject); return Resp.ok(null); } /** * 删除 */ @ApiOperation("删除") @PostMapping("/delete") @PreAuthorize("hasAuthority('sms:homesubject:delete')") public Resp<Object> delete(@RequestBody Long[] ids){ homeSubjectService.removeByIds(Arrays.asList(ids)); return Resp.ok(null); } }
[ "577974246@qq.com" ]
577974246@qq.com
f84f4373716bba67c33a7cc728c2baed54ddbd2f
c474b03758be154e43758220e47b3403eb7fc1fc
/apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/com/google/android/m4b/maps/ci/C5210i.java
8aa9d27aaf006de9bbfdac8dd25adf5544cd26d8
[]
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
5,287
java
package com.google.android.m4b.maps.ci; import android.graphics.Point; import com.google.android.m4b.maps.ac.C4591a; import com.google.android.m4b.maps.ao.C4651e; import com.google.android.m4b.maps.ar.C4662a; import com.google.android.m4b.maps.ar.C4665c; import com.google.android.m4b.maps.cg.C5162c; import com.google.android.m4b.maps.cl.C5217b; import com.google.android.m4b.maps.cl.C5222g; import com.google.android.m4b.maps.cl.C5224i; import com.google.android.m4b.maps.cl.C5225j; import com.google.android.m4b.maps.p125y.C5571j; /* renamed from: com.google.android.m4b.maps.ci.i */ final class C5210i { /* renamed from: a */ private static String m23257a(C4662a c4662a, String str) { try { c4662a = String.valueOf(C4591a.m20681b().m20685a(c4662a.m20837d())); StringBuilder stringBuilder = new StringBuilder((String.valueOf(str).length() + 4) + String.valueOf(c4662a).length()); stringBuilder.append(str); stringBuilder.append("bpb="); stringBuilder.append(c4662a); return stringBuilder.toString(); } catch (C4662a c4662a2) { throw new IllegalStateException(c4662a2); } } /* renamed from: a */ private static void m23259a(C4662a c4662a, C6647k c6647k) { int i = (int) c6647k.f24922e.zoom; C4662a c4662a2 = new C4662a(C5224i.f19453a); C4662a c4662a3 = new C4662a(C5224i.f19454b); c4662a3.m20841f(2, i); C4662a c4662a4 = new C4662a(C5224i.f19455c); c4662a4.m20841f(1, C5210i.m23254a(c6647k.f24923f, c6647k.f24925h)); c4662a4.m20841f(2, C5210i.m23254a(c6647k.f24924g, c6647k.f24925h)); c4662a3.m20827b(1, c4662a4); c4662a4 = new C4662a(C4651e.f17079a); if (c6647k.f24918a == c6647k.f24920c && c6647k.f24919b == c6647k.f24921d) { c6647k = c6647k.f24922e.target; } else { c6647k = c6647k.mo4987a(new Point(c6647k.f24923f / 2, c6647k.f24924g / 2)); } c4662a4.m20841f(1, C5210i.m23253a(c6647k.latitude)); c4662a4.m20841f(2, C5210i.m23253a(c6647k.longitude)); c4662a3.m20827b(3, c4662a4); c4662a2.m20827b(4, c4662a3); c4662a.m20821a(1, c4662a2); } /* renamed from: a */ private static void m23258a(C4662a c4662a, int i) { C5571j.m24298a(i != 0, (Object) "Shouldn't fetch for MAP_TYPE_NONE"); C4662a g = c4662a.m20842g(3); if (g == null) { g = new C4662a(C5222g.f19447a); } switch (i) { case 2: C5210i.m23260b(c4662a, 1); return; case 3: C5210i.m23260b(c4662a, 4); C5210i.m23260b(c4662a, 0); c4662a = new C4662a(C5225j.f19459a); c4662a.m20841f(1, 5); g.m20821a(12, c4662a); return; case 4: C5210i.m23260b(c4662a, 1); C5210i.m23260b(c4662a, 0); c4662a = new C4662a(C5225j.f19459a); c4662a.m20841f(1, 4); g.m20821a(12, c4662a); return; default: C5210i.m23260b(c4662a, 0); return; } } /* renamed from: a */ private static int m23254a(int i, double d) { return Math.min((int) Math.ceil(((double) i) / d), (int) Math.floor(2048.0d / d)); } /* renamed from: b */ private static void m23260b(C4662a c4662a, int i) { C4662a c4662a2 = new C4662a(C5217b.f19419a); c4662a2.m20841f(1, i); c4662a2.m20841f(3, 999999); c4662a.m20821a(2, c4662a2); } /* renamed from: a */ public static String m23255a(C4662a c4662a, C6647k c6647k, int i, C5162c c5162c, String str) { try { c4662a = C4665c.m20857a(c4662a); C5210i.m23259a(c4662a, c6647k); if (c5162c != null) { String b = c5162c.m23078b(); C5210i.m23260b(c4662a, 0); C4662a c4662a2 = new C4662a(C5225j.f19459a); c4662a2.m20841f(1, 68); C4662a c4662a3 = new C4662a(C5225j.f19460b); c4662a3.m20828b(1, "set"); c4662a3.m20828b(2, b); c4662a2.m20821a(2, c4662a3); C4662a c4662a4 = new C4662a(C5222g.f19447a); c4662a4.m20821a(12, c4662a2); c4662a.m20821a(3, c4662a4); } else { C5210i.m23258a(c4662a, i); } return C5210i.m23257a(c4662a, str); } catch (C4662a c4662a5) { throw new IllegalStateException(c4662a5); } } /* renamed from: a */ public static String m23256a(C4662a c4662a, C6647k c6647k, int i, String str) { try { c4662a = C4665c.m20857a(c4662a); c4662a.m20839e(5, 0); c4662a.m20841f(4, 5); C5210i.m23259a(c4662a, c6647k); C5210i.m23258a(c4662a, i); return C5210i.m23257a(c4662a, str); } catch (C4662a c4662a2) { throw new IllegalStateException(c4662a2); } } /* renamed from: a */ private static int m23253a(double d) { return (int) Math.round(d * 1.0E7d); } }
[ "jdguzmans@hotmail.com" ]
jdguzmans@hotmail.com
d32c624496547433066b370c4fa9f7b698a71a96
a298809628d4a7bc6f0f3947cc5096e2b0ccd026
/mybatisProject/src/com/kh/mybatis/board/controller/BoardDetailController.java
813a032c4a2dbbb7f731acd41fee7ba5cf4860c7
[]
no_license
BrianH29/BH_mybatis_workspace
6062f6620ae2976f2b7a309621722ff66cb2662d
461ee016dd1bfc6605b691ff92845d02ab41f028
refs/heads/main
2023-01-06T18:04:55.488798
2020-11-05T00:17:00
2020-11-05T00:17:00
304,542,839
0
0
null
null
null
null
UTF-8
Java
false
false
2,209
java
package com.kh.mybatis.board.controller; import java.io.IOException; import java.util.ArrayList; 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 com.kh.mybatis.board.model.service.BoardService; import com.kh.mybatis.board.model.service.BoardServiceImpl; import com.kh.mybatis.board.model.vo.Board; import com.kh.mybatis.board.model.vo.Reply; /** * Servlet implementation class BoardDetailController */ @WebServlet("/detail.bo") public class BoardDetailController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public BoardDetailController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int bno = Integer.parseInt(request.getParameter("bno")); BoardService bService = new BoardServiceImpl(); //상세보기 요청시 실행할 서비스 // 1. 해당 게시글 조회수 증가 시키는 서비스 int result = bService.updateCount(bno); if(result>0) { // 2. 해당 게시글 내용 상세 조회 서비스(글번호, 제목, 작성자, 조회수, 작성일, 내용) Board b = bService.selectBoard(bno); // 3. 해당 게시글에 딸려있는 댓글리스트 조회 서비스(작성자, 댓글내용, 작성일) ArrayList<Reply> list = bService.selectReplyList(bno); request.setAttribute("b",b); request.setAttribute("list", list); request.getRequestDispatcher("WEB-INF/views/board/boardDetailView.jsp").forward(request, response); } else { } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "brianhwang29@gmail.com" ]
brianhwang29@gmail.com
f4088b0f22214e939e14ea5c364f31870ad36a29
1dd6c249609b1806b04c4f6aeac1f8fe49526878
/src/java/org/chefx3d/util/DynamicGridLayout.java
39a92e7945f9e37181d5b7ef76e90291babe563f
[]
no_license
rmelton/ChefX3D
fd6c05d2fe5f5ffa3f33a61fecfa57859ce51ff0
d4580a8e885cdc8cd36ca384f309a16bb234f70e
refs/heads/master
2020-12-25T05:18:00.352831
2011-05-31T16:53:15
2011-05-31T16:53:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,916
java
/***************************************************************************** * Copyright Yumetech, Inc (c) 2005-2006 * Java Source * * This source is licensed under the GNU LGPL v2.1 * Please read http://www.gnu.org/copyleft/lgpl.html for more information * * This software comes with the standard NO WARRANTY disclaimer for any * purpose. Use it at your own risk. If there's a problem you get to fix it. * ****************************************************************************/ package org.chefx3d.util; // External imports import java.awt.*; // Local Imports // None /** * A layout manager that lays out a container's components in a rectangular * grid, with different sizes for each row/column. * <p> * As with GridLayout one component is placed in each rectangle, but the width * of columns and height of rows are not necessarily the same. By default each * row and column will be sized in proportion to the minimum size of the largest * component in that row or column. Alternatively, individual rows or columns * can be set to a fixed percentage of the container or their minimum size with * various options. Components can also be set to fill the assigned area or use * their minimum size and align themselves within that allocated space. If the * grid itself doesn't completely fill the area assigned by the container there * are methods to set this alignment too. * <p> * Here's a simple example of using a DynamicGridLayout. * <p> * <blockquote> * * <pre> * //create the layout and set it * setLayout(dgl = new DynamicGridLayout(2, 2, 5, 5)); * //set any styles, sizes or alignments * dgl.setRowSize(0, dgl.MINIMUM); * //add the components * add(new Button(&quot;Row One/Col One&quot;)); * add(new Button(&quot;Row One/Col Two&quot;)); * add(new Button(&quot;Row Two/Col One&quot;)); * add(new Button(&quot;Row Two/Col Two&quot;)); * </pre> * * </blockquote> * * @author Robert Nielsen * @version $Revision: 1.4 $ */ public class DynamicGridLayout implements LayoutManager, java.io.Serializable { /** version id */ private static final long serialVersionUID = 1L; // Constants for size public static final int DYNAMIC = 0; public static final int MINIMUM = -1; public static final int ABOVE_MINIMUM = -2; public static final int BELOW_MINIMUM = -3; private static final int ABOVE_MARKER = -5; private static final int BELOW_MARKER = -6; // Constants for alignment public static final int FILL = 0; public static final int CENTER = 1; public static final int LEFT = 2; public static final int RIGHT = 3; public static final int TOP = 4; public static final int BOTTOM = 5; // Constants for style public static final int LABEL_FILL = 6; public static final int LABEL_MIN = 7; private int hgap; private int vgap; private int rows; private int cols; private int[] row_align; private int[] col_align; private int[] row_size; private int[] col_size; private int[] row_height; private int[] col_width; private int vert_align = CENTER; private int horiz_align = CENTER; /** * Creates a grid layout with a default of one column per component, in a * single row. */ public DynamicGridLayout() { this(1, 0, 0, 0); } /** * Creates a grid layout with the specified number of rows and columns. All * components in the layout are given equal size. * <p> * One, but not both, of <code>rows</code> and <code>cols</code> can be * zero, which means that any number of objects can be placed in a row or in * a column. * * @param rows the rows, with the value zero meaning any number of rows. * @param cols the columns, with the value zero meaning any number of * columns. */ public DynamicGridLayout(int rows, int cols) { this(rows, cols, 0, 0); } /** * Creates a grid layout with the specified number of rows and columns. * <p> * In addition, the horizontal and vertical gaps are set to the specified * values. Horizontal gaps are placed at the left and right edges, and * between each of the columns. Vertical gaps are placed at the top and * bottom edges, and between each of the rows. * <p> * One, but not both, of <code>rows</code> and <code>cols</code> can be * zero, which means that any number of objects can be placed in a row or in * a column. * * @param rows the rows, with the value zero meaning any number of rows. * @param cols the columns, with the value zero meaning any number of * columns. * @param hgap the horizontal gap. * @param vgap the vertical gap. * @exception IllegalArgumentException if the of <code>rows</code> or * <code>cols</code> is invalid. */ public DynamicGridLayout(int rows, int cols, int hgap, int vgap) { if ((rows == 0) && (cols == 0)) throw new IllegalArgumentException( "rows and cols cannot both be zero"); this.rows = rows; this.cols = cols; this.hgap = hgap; this.vgap = vgap; resetGrid(); } /** * Gets the number of rows in this layout. * * @return the number of rows in this layout. */ public int getRows() { return rows; } /** * Sets the number of rows in this layout to the specified value. * * @param rows the number of rows in this layout. * @exception IllegalArgumentException if the value of both * <code>rows</code> and <code>cols</code> is set to zero. */ public void setRows(int rows) { if ((rows == 0) && (this.cols == 0)) throw new IllegalArgumentException( "rows and cols cannot both be zero"); this.rows = rows; resetGrid(); } /** * Gets the number of columns in this layout. * * @return the number of columns in this layout. * @since JDK1.1 */ public int getColumns() { return cols; } /** * Sets the number of columns in this layout to the specified value. * * @param cols the number of columns in this layout. * @exception IllegalArgumentException if the value of both * <code>rows</code> and <code>cols</code> is set to zero. */ public void setColumns(int cols) { if ((cols == 0) && (this.rows == 0)) throw new IllegalArgumentException( "rows and cols cannot both be zero"); this.cols = cols; resetGrid(); } /** * Gets the horizontal gap between components. * * @return the horizontal gap between components. */ public int getHgap() { return hgap; } /** * Sets the horizontal gap between components to the specified value. * * @param hgap the horizontal gap between components. */ public void setHgap(int hgap) { this.hgap = hgap; } /** * Gets the vertical gap between components. * * @return the vertical gap between components. */ public int getVgap() { return vgap; } /** * Sets the vertical gap between components to the specified value. * * @param vgap the vertical gap between components. */ public void setVgap(int vgap) { this.vgap = vgap; } /** * Resets the grid parameters. All styles, alignments and sizes are reset to * their default values. */ public void resetGrid() { row_align = new int[rows]; col_align = new int[cols]; row_size = new int[rows]; col_size = new int[cols]; } /** * Sets the style of this grid. This provides a shortcut to producing * several standard styles of grid layout by setting various row alignments * and sizes. The style can be tweaked by using the set(Row|Column)Alignment * and set(Row|Column)Size methods after a call to this one. * <p> * The style parameter has the following parameters: * <ul> * <li>FILL to use all available space, with component heights and widths * relative to their preferred size. * <li>CENTER to use the same spacing as FILL but with each component being * it's preferred size and centered in the space. * <li>LABEL_FILL is a simple layout where the 1st, 3rd, etc. columns are * considered to be labels and the intervening ones are the data components * (TextFields, ComboBoxes). The labels are minimum size and right aligned * and the others fill all available space. * <li>LABEL_MIN is the same as LABEL_FILL but the data components are * minimum too and aligned left. * </ul> * * @param style - the style to be set. */ public void setStyle(int style) { switch (style) { case FILL: setColumnAlignments(0, cols - 1, FILL); setRowAlignments(0, rows - 1, FILL); setColumnSizes(0, cols - 1, DYNAMIC); setRowSizes(0, rows - 1, DYNAMIC); break; case CENTER: setColumnAlignments(0, cols - 1, CENTER); setRowAlignments(0, rows - 1, CENTER); setColumnSizes(0, cols - 1, DYNAMIC); setRowSizes(0, rows - 1, DYNAMIC); break; case LABEL_FILL: case LABEL_MIN: for (int i = 0; i < cols; i += 2) { setColumnAlignment(i, RIGHT); setColumnSize(i, MINIMUM); if (style == LABEL_FILL) { setColumnAlignment(i + 1, DYNAMIC); setColumnSize(i + 1, FILL); } else { setColumnAlignment(i + 1, LEFT); setColumnSize(i + 1, BELOW_MINIMUM); } } break; } } /** * This method is only required if there are no columns with dynamic widths * which may cause the layout to be smaller than the allocated space. The * horizontal alignment of the grid in this space can then be specified * using this method. The default is centered. The available alignments are: * <ul> * <li>LEFT - align the grid to the left of the space available. * <li>CENTER - center the grid in the space. * <li>RIGHT - align the grid to the right of the space available. * </ul> * * @param value the alignment to set */ public void setHorizontalAlignment(int value) { horiz_align = value; } /** * This method is only required if there are no rows with dynamic heights * which may cause the layout to be smaller than the allocated space. The * vertical alignment of the grid in this space can then be specified using * this method. The default is centered. The available alignments are: * <ul> * <li>TOP - align the grid to the top of the space available. * <li>CENTER - center the grid in the space. * <li>BOTTOM - align the grid to the bottom of the space available. * </ul> * * @param value the alignment to set */ public void setVerticalAlignment(int value) { vert_align = value; } /** * Sets the alignment for a particular row. If the alignment is not FILL, * the preferred size of the component will be used unless it is greater * than the available space, in which case it will be truncated. The default * alignment is FILL for all rows. The available alignments are: * <ul> * <li>FILL - fill the entire vertical space available. * <li>TOP - align to the top of the space available. * <li>CENTER - center the component in the space. * <li>BOTTOM - align with the bottom of the space available. * </ul> * * @param row - the row to set the alignment for * @param value - the alignment to set. */ public void setRowAlignment(int row, int value) { row_align[row] = value; } /** * Sets the alignment of multiple rows. See setRowAlignment for details of * alignment values. * * @param start the inclusive start row to set * @param end the inclusive end row to set * @param value the alignment to set * @see #setRowAlignment */ public void setRowAlignments(int start, int end, int value) { for (int i = start; i <= end; i++) row_align[i] = value; } /** * Sets the alignment for a particular column. If the alignment is not FILL, * the preferred size of the component will be used unless it is greater * than the available space, in which case it will be truncated. The default * alignment is FILL for all columns. The available alignments are: * <ul> * <li>FILL - fill the entire vertical space available. * <li>LEFT - align to the left of the space available. * <li>CENTER - center the component in the space. * <li>RIGHT - align to the right of the space available. * </ul> * * @param col - the column to set the alignment for * @param value - the alignment to set. */ public void setColumnAlignment(int col, int value) { col_align[col] = value; } /** * Sets the alignment of multiple columns. See setColumnAlignment for * details of alignment values. * * @param start the inclusive start column to set * @param end the inclusive end column to set * @param value the alignment to set * @see #setColumnAlignment */ public void setColumnAlignments(int start, int end, int value) { for (int i = start; i <= end; i++) col_align[i] = value; } /** * Sets the size of a row. The available sizes are: * <ul> * <li>percentage - a value between 1 and 100 for the percentage of the * width of the grid that this row should take up. * <li>MINIMUM - make sure that the height of this row is always the * minimum height of of the largest component in the row no matter what it * does to the formatting. It can look ugly if you resize the window too * small but is good for labels which must always display all their text. * <li>DYNAMIC - After the percentages and minumum components are removed * from the grid width the rows with dynamic sizes are allocated a * proportion of the remaining space based on the minimum height of the * largest component in the row. This is the default size for all rows. * <li>BELOW_MINIMUM - the height is set to MINIMUM unless this minimum * size would be smaller than a dynamically allocated one, in which case * DYNAMIC allocation is used. This setting is useful if you want a * component to stick to it's minimum size in most situations but go even * smaller if the panel size gets really small. * <li>ABOVE_MINIMUM - the height is allocated using the DYNAMIC setting * unless it would make the component smaller than it's minimum size, where * MINIMUM is used. This option is useful if you want a component to take up * any available space but never go smaller than it's minumum size. * </ul> */ public void setRowSize(int row, int value) { row_size[row] = value; } /** * Sets the size of multiple rows. See setRowSize for details of alignment * values. * * @param start the inclusive start row to set * @param end the inclusive end row to set * @param value the size to set * @see #setRowSize */ public void setRowSizes(int start, int end, int value) { for (int i = start; i <= end; i++) row_size[i] = value; } /** * Sets the size of a column. The available sizes are: * <ul> * <li>percentage - a value between 1 and 100 for the percentage of the * width of the grid that this column should take up. * <li>MINIMUM - make sure that the width of this column is always the * minimum width of the largest component in the column no matter what it * does to the formatting. It can look ugly if you resize the window too * small but is good for labels which must always display all their text. * <li>DYNAMIC - After the percentages and minumum components are removed * from the grid width the columns with dynamic sizes are allocated a * proportion of the remaining space based on the minimum width of the * largest component in the row. This is the default size for all column. * <li>BELOW_MINIMUM - the height is set to MINIMUM unless this minimum * size would be smaller than a dynamically allocated one, in which case * DYNAMIC allocation is used. This setting is useful if you want a * component to stick to it's minimum size in most situations but go even * smaller if the panel size gets really small. * <li>ABOVE_MINIMUM - the width is allocated using the DYNAMIC setting * unless it would make the component smaller than it's minimum size, where * MINIMUM is used. This option is useful if you want a component to take up * any available space but never go smaller than it's minumum size. * </ul> * * @param col - the column to set the size for * @param value - the size to set. */ public void setColumnSize(int col, int value) { col_size[col] = value; } /** * Sets the size of multiple columns. See setColumnSize for details of * alignment values. * * @param start the inclusive start column to set * @param end the inclusive end column to set * @param value the size to set * @see #setColumnSize */ public void setColumnSizes(int start, int end, int value) { for (int i = start; i <= end; i++) col_size[i] = value; } /** * Adds the specified component with the specified name to the layout. * * @param name the name of the component. * @param comp the component to be added. */ public void addLayoutComponent(String name, Component comp) { } /** * Removes the specified component from the layout. * * @param comp the component to be removed. */ public void removeLayoutComponent(Component comp) { } /** * Calculate the largest either minimum or preferred size for the components * in each row and column. * * @param parent the container of all the components to be laid out. * @param prefered TRUE to use preferred size, FALSE to use minimum size */ private void getWidthsAndHeights(Container parent, boolean preferred) { int ncomponents = parent.getComponentCount(); col_width = new int[cols]; row_height = new int[rows]; for (int i = 0; i < ncomponents && i < rows * cols; i++) { Component comp = parent.getComponent(i); Dimension d; if (preferred) d = comp.getPreferredSize(); else d = comp.getMinimumSize(); if (d.width > col_width[i % cols]) col_width[i % cols] = d.width; if (d.height > row_height[i / cols]) row_height[i / cols] = d.height; } } private int getMaximumSize(int[] perc, int[] min) { int perc_sum = 0; int leftover_sum = 0; int temp; int max = 0; int size = perc.length; for (int i = 0; i < size; i++) { if (perc[i] > 0) { temp = min[i] * 100 / perc[i]; if (temp > max) max = temp; perc_sum += min[i]; } else leftover_sum += min[i]; } temp = leftover_sum * 100 / (100 - perc_sum); if (temp > max) max = temp; return max; } /** * Given an array of sizes, calculate the grid positions. This method is * called both with the row sizes and the column sizes. * * @param len the length of the space we need to allocate * @param perce the sizes of each row or column * @param value the array to place the calculated positions into. */ private int spaceOut(int len, int[] perc, int[] value) { int sum = 0; // sum of all dynamic values int dyn_cnt = 0; // a count of the number of dynamic entries int size = perc.length; // the number of grid squares int space_left = len; // the remaining space to allocate between the // dynamics boolean check_above_minimum = false; // efficiency flags boolean check_below_minimum = false; for (int i = 0; i < size; i++) { if (perc[i] > 0) // a percentage { value[i] = len * perc[i] / 100; space_left -= value[i]; } else if (perc[i] == DYNAMIC || perc[i] == ABOVE_MINIMUM || perc[i] == ABOVE_MARKER) { if (perc[i] == ABOVE_MARKER) perc[i] = ABOVE_MINIMUM; if (perc[i] != DYNAMIC) check_above_minimum = true; sum += value[i]; dyn_cnt++; } else // minimum, below_minumum, or below_marker { if (perc[i] == BELOW_MARKER) // reset the marker perc[i] = BELOW_MINIMUM; if (perc[i] != MINIMUM) check_below_minimum = true; space_left -= value[i]; // lower the available space } } if (check_below_minimum) for (int i = 0; i < size; i++) if ((perc[i] == BELOW_MINIMUM) && (space_left + value[i]) / (sum + value[i]) < 1) { perc[i] = BELOW_MARKER; sum += value[i]; space_left += value[i]; dyn_cnt++; } if (check_above_minimum) for (int i = 0; i < size; i++) { if ((perc[i] == ABOVE_MINIMUM) && (space_left - value[i]) / (sum - value[i]) < 1) { perc[i] = ABOVE_MARKER; sum -= value[i]; space_left -= value[i]; dyn_cnt--; } } if (dyn_cnt > 0) { int leftover = space_left; int lastdyn = -1; // this had better be changed or there is // something wrong with cnt for (int i = 0; i < size; i++) if (perc[i] == DYNAMIC || perc[i] == BELOW_MARKER || perc[i] == ABOVE_MINIMUM) { if (sum == 0) value[i] = 0; else value[i] = Math.round(value[i] * space_left / sum); leftover -= value[i]; lastdyn = i; } value[lastdyn] += leftover; // if there is any leftovers give it to // the last dynamic one return 0; } if (space_left < 0) return 0; else return space_left; } private void placeComponent(Component c, int x, int y, int w, int h, int ra, int ca) { Dimension pref = c.getPreferredSize(); if (ra != FILL && pref.height < h) { if (ra == CENTER) y += Math.round((h - pref.height) / 2.0); else if (ra == BOTTOM) y += (h - pref.height); h = pref.height; } if (ca != FILL && pref.width < w) { if (ca == CENTER) x += Math.round((w - pref.width) / 2.0); else if (ca == RIGHT) x += (w - pref.width); w = pref.width; } c.setBounds(x, y, w, h); } /** * Determines the preferred size of the container argument using this grid * layout. * <p> * The preferred width of a grid layout is the largest preferred width of * any of the widths in the container times the number of columns, plus the * horizontal padding times the number of columns plus one, plus the left * and right insets of the target container. * <p> * The preferred height of a grid layout is the largest preferred height of * any of the heights in the container times the number of rows, plus the * vertical padding times the number of rows plus one, plus the top and * bottom insets of the target container. * * @param parent the container in which to do the layout. * @return the preferred dimensions to lay out the subcomponents of the * specified container. * @see java.awt.GridLayout#minimumLayoutSize * @see java.awt.Container#getPreferredSize() */ public Dimension preferredLayoutSize(Container parent) { getWidthsAndHeights(parent, true); int w = getMaximumSize(col_size, col_width); int h = getMaximumSize(row_size, row_height); Insets insets = parent.getInsets(); return new Dimension( insets.left + insets.right + w + (cols - 1) * hgap, insets.top + insets.bottom + h + (rows - 1) * vgap); } /** * Determines the minimum size of the container argument using this grid * layout. * <p> * The minimum width of a grid layout is the largest minimum width of any of * the widths in the container times the number of columns, plus the * horizontal padding times the number of columns plus one, plus the left * and right insets of the target container. * <p> * The minimum height of a grid layout is the largest minimum height of any * of the heights in the container times the number of rows, plus the * vertical padding times the number of rows plus one, plus the top and * bottom insets of the target container. * * @param parent the container in which to do the layout. * @return the minimum dimensions needed to lay out the subcomponents of the * specified container. * @see java.awt.GridLayout#preferredLayoutSize * @see java.awt.Container#doLayout */ public Dimension minimumLayoutSize(Container parent) { getWidthsAndHeights(parent, false); int w = getMaximumSize(col_size, col_width); int h = getMaximumSize(row_size, row_height); Insets insets = parent.getInsets(); return new Dimension( insets.left + insets.right + w + (cols - 1) * hgap, insets.top + insets.bottom + h + (rows - 1) * vgap); } /** * Lays out the specified container using this layout. * <p> * This method reshapes the components in the specified target container in * order to satisfy the constraints of the <code>GridLayout</code> object. * <p> * The grid layout manager determines the size of individual components by * dividing the free space in the container into equal-sized portions * according to the number of rows and columns in the layout. The * container's free space equals the container's size minus any insets and * any specified horizontal or vertical gap. All components in a grid layout * are given the same size. * * @param parent the container in which to do the layout. * @see java.awt.Container * @see java.awt.Container#doLayout */ public void layoutContainer(Container parent) { Insets insets = parent.getInsets(); int ncomponents = parent.getComponentCount(); Dimension p = parent.getSize(); int w = p.width - (insets.left + insets.right); int h = p.height - (insets.top + insets.bottom); w = (w - (cols - 1) * hgap); h = (h - (rows - 1) * vgap); getWidthsAndHeights(parent, true); int row_leftover = spaceOut(h, row_size, row_height); int col_leftover = spaceOut(w, col_size, col_width); int col_indent = 0; switch (horiz_align) { case CENTER: col_indent = (int) Math.round(col_leftover / 2.0); break; case RIGHT: col_indent = col_leftover; break; } int row_indent = 0; switch (vert_align) { case CENTER: row_indent = (int) Math.round(row_leftover / 2.0); break; case BOTTOM: row_indent = row_leftover; break; } for (int c = 0, x = insets.left + col_indent; c < cols; x += col_width[c++] + hgap) { for (int r = 0, y = insets.top + row_indent; r < rows; y += row_height[r++] + vgap) { int i = r * cols + c; if (i < ncomponents) placeComponent(parent.getComponent(i), x, y, col_width[c], row_height[r], row_align[r], col_align[c]); } } } /* * public void dump() { System.out.print("Rows: "); for(int i=0;i<rows;i++) * System.out.print(row_height[i]+","); System.out.print("\nCols: "); * for(int i=0;i<cols;i++) System.out.print(col_width[i]+","); * System.out.println(); } */ /** * Returns the string representation of this grid layout's values. * * @return a string representation of this grid layout. */ public String toString() { return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + ",rows=" + rows + ",cols=" + cols + "]"; } }
[ "giles7777@gmail.com" ]
giles7777@gmail.com
99271a442c7e709091f5626453ab194328d17418
8bcad3bc8a53c55cb1c50dc60712d2591d58eef0
/MegajanWebService/src/main/java/util/ExceptionUtil.java
99bb2b35054748869b95556b3f2c1888f4e41d7c
[]
no_license
skorbas/Megajan
216eeb62df022c70419aa2c991a36defcf1e1523
f49409305e138609d19c9063928e2bf306bd785e
refs/heads/master
2021-01-22T09:04:36.636339
2013-02-14T14:29:45
2013-02-14T14:29:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package util; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; public class ExceptionUtil { public static String getStackTraceAsString( Exception ex ) { final Writer writer = new StringWriter(); final PrintWriter printWriter = new PrintWriter( writer ); ex.printStackTrace( printWriter ); return writer.toString(); } }
[ "skorbas@poczta.fm" ]
skorbas@poczta.fm
87799f337b416b361eb86109d37dfad5a2e32405
59d9434f83e53f7685655f600731e3f8cf5be161
/addressManagement/AddressBookManager.java
c6ba64e8261755eb746350f40d5fcdb13b4c7bba
[]
no_license
luckyNB/object-oriented-programs
d16bedb40619a2c4f6e46a61ea51e15b3b777df9
994c8ef009456219b5e1f48d5ec56a41697bbae2
refs/heads/master
2020-08-06T01:38:27.189534
2019-10-04T10:16:18
2019-10-04T10:16:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,798
java
package com.bridgelabz.oops.addressManagement; import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.LinkedList; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; import com.bridgelabz.util.Utility; class AddressBookManager implements Manager { static ObjectMapper mapper = new ObjectMapper(); //mapper to translate data static String firstName; static String lastName; static String bookName; // create new address book public static boolean createAddressBook(String name) throws IOException, Exception { // create file with user provided name File file = new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + name + ".json"); // check file created or not boolean result = file.createNewFile(); return result; } // add person in address book public static void addPersonInAddressBook(String addressBook, String firstName, String lastName) throws JsonMappingException, IOException { if (new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook) .exists() == false) { System.out.println("invalid address book"); return; } PersonDetails person = new PersonDetails(); Address address = new Address(); PhoneNumber phone = new PhoneNumber(); System.out.println("Enter street:"); String street = Utility.inputStringValue(); System.out.println("Enter city:"); String city = Utility.inputStringValue(); System.out.println("Enter State:"); String state = Utility.inputStringValue(); System.out.println("Enter zip"); int zip = Utility.getInt(); System.out.println("Enter mobile number:"); long phoneNumber = Utility.getLong(); phone.setMobileNumber(phoneNumber); address.setStreet(street); address.setCity(city); address.setState(state); address.setZip(zip); person.setFirstName(firstName); person.setLastName(lastName); person.setAddress(address); person.setPhoneNumber(phone); AddressBookManager manager = new AddressBookManager(); manager.save1(person, addressBook); } // to edit person details public static void editPerson(String name, String addressBook) throws JsonMappingException, IOException { int count = 0; int tempCount = 0; String temp = ""; int stop = 0; //read data from file and store it in linked list LinkedList<PersonDetails> details = mapper.readValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), new TypeReference<LinkedList<PersonDetails>>() { }); for (PersonDetails person : details) { if (person.getFirstName().equals(name)) { //check if entered name is present or not tempCount = count; } count++; } while (stop != 2) { System.out.println("1. for edit first name"); System.out.println("2. for edit last name"); System.out.println("3. for edit address and phone number"); count = Utility.getInt(); switch (count) { case 1: //change first name System.out.println("Enter new first name :"); firstName = Utility.inputStringValue(); details.get(tempCount).setFirstName(firstName); //set new name break; case 2: //change last name System.out.println("Enter new last name :"); lastName = Utility.inputStringValue(); details.get(tempCount).setLastName(lastName); //set new last name break; case 3: //edit address System.out.println("press \n 1. for edit street"); System.out.println("2. for edit city"); System.out.println("3. for edit state"); System.out.println("4 . for edit zip code"); System.out.println("5 . for edit phone number"); int choice = Utility.getInt(); if (choice == 1) { System.out.println("Enter street:"); temp = Utility.inputStringValue(); details.get(tempCount).getAddress().setStreet(temp); //change street name } if (choice == 2) { System.out.println("Enter city:"); temp = Utility.inputStringValue(); details.get(tempCount).getAddress().setCity(temp); //change city name } if (choice == 3) { System.out.println("Enter state:"); temp = Utility.inputStringValue(); details.get(tempCount).getAddress().setState(temp); //change city name } if (choice == 4) { System.out.println("Enter zip:"); int zip = Utility.getInt(); details.get(tempCount).getAddress().setZip(zip);//change zip ; } if (choice == 5) { System.out.println("Enter mobile number:"); Long phoneNumber = Utility.getLong(); details.get(tempCount).getPhoneNumber().setMobileNumber(phoneNumber); //change mobile number } } System.out.println("for stop press 2. or for continue press any number"); stop = Utility.getInt(); } if (stop == 2) { //write data to file mapper.writeValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), details); } } // save details after entering all data into file public void save1(PersonDetails person, String addressBook) throws JsonMappingException, IOException { if (new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook) .length() == 0) { LinkedList<PersonDetails> newPerson = new LinkedList<>(); newPerson.add(person); // System.out.println(newPerson); mapper.writeValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), newPerson); if (new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook) .length() != 0) { System.out.println("data added successfully"); } else { System.out.println("unsuccessful"); } } else { long preFileLength = new File( "/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook).length(); LinkedList<PersonDetails> multiple = mapper.readValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), new TypeReference<LinkedList<PersonDetails>>() { }); multiple.add(person); mapper.writeValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), multiple); long afterWriteLength = new File( "/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook).length(); if (preFileLength < afterWriteLength) { System.out.println("data added successfully"); } else { System.out.println("data not fill in file"); } } } //to add new data public void add() throws JsonMappingException, IOException { // TODO Auto-generated method stub System.out.println("Enter person first name:"); firstName = Utility.getString(); System.out.println("Enter last name"); lastName = Utility.getString(); System.out.println("Enter address book name"); bookName = Utility.getString(); addPersonInAddressBook(bookName, firstName, lastName); } // delete person from address book public void delete(String name, String addressBook) throws JsonMappingException, IOException { LinkedList<PersonDetails> details = mapper.readValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), new TypeReference<LinkedList<PersonDetails>>() { }); int count = 0; boolean result = true; // to remove the given person for (PersonDetails person : details) { if (person.getFirstName().equals(name)) { //if name is present then delete details.remove(count); System.out.println("person successfully removed"); mapper.writeValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), details); } count++; } // to check whether the person is removed or not for (PersonDetails person : details) { if (person.getFirstName().equals(name)) { result = false; } } if (result == true) { System.out.println("person successfully remove"); } } //sort data by name public void sortByName(String addressBook) throws JsonMappingException, IOException { LinkedList<PersonDetails> details = mapper.readValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), new TypeReference<LinkedList<PersonDetails>>() { }); LinkedList<String> name = new LinkedList<>(); int count = 0; for (PersonDetails person : details) { name.add(person.getFirstName()); } // string array to store named for sorting purpose String names[] = new String[name.size()]; // loop for store linked list object in an array for (String value : name) { names[count] = value; count++; } Arrays.sort(names); System.out.println("sort by first name"); // loop to print sorted data by name // count = 0; for (String s : names) { int count2 = 0; while (count2 < details.size()) { if (details.get(count2).getFirstName().equals(s)) { System.out.println(details.get(count2)); } count2++; } } } //sort data by zip public void sortByZip(String addressBook) throws JsonMappingException, IOException { LinkedList<PersonDetails> details = mapper.readValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), new TypeReference<LinkedList<PersonDetails>>() { }); LinkedList<Integer> zip = new LinkedList<>(); int count = 0; for (PersonDetails person : details) { zip.add(person.getAddress().getZip()); } int zipArray[] = new int[zip.size()]; for (int value : zip) { zipArray[count] = value; count++; } Arrays.sort(zipArray); System.out.println("sort by zip"); // count = 0; for (int s : zipArray) { int count2 = 0; while (count2 < details.size()) { if (details.get(count2).getAddress().getZip() == s) { System.out.println(details.get(count2)); } count2++; } } } // print person details public void print(String addressBook, String name) throws JsonMappingException, IOException { LinkedList<PersonDetails> details = mapper.readValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressBook), new TypeReference<LinkedList<PersonDetails>>() { }); for (PersonDetails person : details) { if (person.getFirstName().equals(name)) { System.out.println(person); } } } // to see list of address book in folder public static File[] openFile() { File folder = new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/"); return folder.listFiles(); } //print all file names public static void printFileNames() { File file[] = openFile(); // store file names from given location by calling openFile method System.out.println("\ngot following json files at mentioned location...\nplz select proper one:"); for (File file1 : file) { String name = file1.getName(); if (name.contains(".json")) //to print only json files System.out.println(name); // display files at that location } System.out.println(); } //print details public static void openAddressbook(String addressbook) throws JsonMappingException, IOException { LinkedList<PersonDetails> details = mapper.readValue( new File("/home/admin1/Desktop/BridgeLabzPrograms/src/com/bridgelabz/oops/addressManagement/" + addressbook), new TypeReference<LinkedList<PersonDetails>>() { }); System.out.println(details); } }
[ "laxmanbhosale360@gmail.com" ]
laxmanbhosale360@gmail.com
1c6f53faf4d07a33556379413ccaeba743566d9f
e89dc01c95b8b45404f971517c2789fd21657749
/src/main/java/com/alipay/api/domain/JointAccountDTO.java
6d3ac867eb3ab205129e3f1433fe5e68c8457e49
[ "Apache-2.0" ]
permissive
guoweiecust/alipay-sdk-java-all
3370466eec70c5422c8916c62a99b1e8f37a3f46
bb2b0dc8208a7a0ab8521a52f8a5e1fcef61aeb9
refs/heads/master
2023-05-05T07:06:47.823723
2021-05-25T15:26:21
2021-05-25T15:26:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,072
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 共同账户基本信息 * * @author auto create * @since 1.0, 2021-01-25 21:13:16 */ public class JointAccountDTO extends AlipayObject { private static final long serialVersionUID = 7791534246616675955L; /** * 共同账户ID */ @ApiField("account_id") private String accountId; /** * 共同账户账本名称 */ @ApiField("account_name") private String accountName; /** * 账本创建人会员号 */ @ApiField("user_id") private String userId; public String getAccountId() { return this.accountId; } public void setAccountId(String accountId) { this.accountId = accountId; } public String getAccountName() { return this.accountName; } public void setAccountName(String accountName) { this.accountName = accountName; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
dfc1045e7c90927efe86f2a813d83e848fcfe1f9
cc1fb6fad509f55c999c2751c4f9029e89248cd9
/Jersey/TFTPDemo/src/com/ikaz/demo/tftp/Server/package-info.java
629fec1273ccbeedd19b6c02cb76abf8073de57a
[]
no_license
icast7/java
afe8da56567b0f3002b66af739da25dd3c2cbdbb
1cf25a48574ebe4876771a905a732771e2102862
refs/heads/master
2023-05-11T00:06:45.828716
2015-03-01T20:38:29
2015-03-01T20:38:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
96
java
/** * */ /** * @author icastillejos * @version 0.0.1 */ package com.ikaz.demo.tftp.Server;
[ "icastillejos@gmail.com" ]
icastillejos@gmail.com
4f7095954b33a940884aa130d487186677c7e0bd
d291f1872a8275b7794f91827a5a4f615934cd73
/jOOQ-examples/jOOQ-academy/src/test/java/org/jooq/academy/section4/Example_4_2_SQLDialect.java
4ccb86bd1ca8428626c25eb179ebc96aa5cbf468
[ "Apache-2.0" ]
permissive
pecko/jOOQ
2c9930e55bbd3b139651c4cba01ee453e9ff5ea0
cab313f6730a48edb1ad6afa1f56327dd400eafc
refs/heads/master
2020-12-02T16:32:37.041672
2015-12-29T12:56:48
2015-12-29T12:56:48
15,281,817
1
0
null
null
null
null
UTF-8
Java
false
false
1,604
java
/** * Copyright (c) 2009-2015, Data Geekery GmbH (http://www.datageekery.com) * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Other licenses: * ----------------------------------------------------------------------------- * Commercial licenses for this work are available. These replace the above * ASL 2.0 and offer limited warranties, support, maintenance, and commercial * database integrations. * * For more information, please visit: http://www.jooq.org/licenses * * * * * * * * * * * * * * * * */ package org.jooq.academy.section4; import java.util.Arrays; import org.jooq.SQLDialect; import org.jooq.academy.tools.Tools; import org.jooq.impl.DSL; import org.junit.Test; public class Example_4_2_SQLDialect { @Test public void run() { Tools.title("Generate SELECT 1 FROM DUAL for all SQL dialect families"); Arrays.stream(SQLDialect.families()) .map(dialect -> String.format("%15s : ", dialect) + DSL.using(dialect).render(DSL.selectOne())) .forEach(System.out::println); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
47e892b780f3185adb22c4f72ab1e99d33c458a0
72dde80d63beff61df4d9638ce783f125354f14f
/app/src/main/java/chewin/app/com/DBHelper.java
fbaba8dd4c28ddc643fa0373982be345fe02c400
[]
no_license
Ajinkyashinde15/ChewIn-Restaurant-Recommendation-Android-Appliaction
a65d0d734457df2044070c6002646ef4bd8e403a
b9e3a7e8a7612de4e9c2a5a9e93fec624838ec48
refs/heads/master
2021-01-16T22:12:46.937080
2016-08-19T20:52:39
2016-08-19T20:52:39
68,373,176
2
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package chewin.app.com; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class DBHelper extends SQLiteOpenHelper { //Create local database public DBHelper(Context context, String name, CursorFactory factory, int version) { //Parameterized constructor super(context, name, factory, version); // TODO Auto-generated constructor stub } public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL("create table bookmark(id INTEGER PRIMARY KEY AUTOINCREMENT,username text,restaurant_name text,latitude text,longitude text)"); //Crate table name bookmark db.execSQL("create table checkin(id INTEGER PRIMARY KEY AUTOINCREMENT,username text,restaurant_name text,latitude text,longitude text)"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub } }
[ "ademola.kazeem@ucdconnect.ie" ]
ademola.kazeem@ucdconnect.ie
80a144a6f38c89db4b023ebd5036dc4b1ccd5b5a
c5545ef9be397aa73bf39d3475cf4994ecd80660
/src/main/java/test/Main.java
c2b6dc136e1a1f4f85a14282765c321ad2a48ef9
[]
no_license
leveretconey/webClient
5a3d18df4e7e783ae727dcb312982aa68b5f2c27
a9934bf888b9ffde313ee257f24ff687f0a966da
refs/heads/master
2020-04-13T01:08:01.725089
2018-12-23T05:34:52
2018-12-23T05:34:52
162,865,242
0
0
null
null
null
null
UTF-8
Java
false
false
5,989
java
package test; import org.bytedeco.javacv.CanvasFrame; import org.bytedeco.javacv.Frame; import org.bytedeco.javacv.GLCanvasFrame; import org.bytedeco.javacv.Java2DFrameConverter; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import leveretconey.FrameUpdateListener; import leveretconey.LiveRecorder; import leveretconey.RecorderException; class Main { JButton buttonStart; JButton buttonGraph; JButton buttonSound; JTextField textUrl; LiveRecorder recorder; Java2DFrameConverter converter; public static void main(String[] args) throws Exception { new Main().start(); } void start() throws Exception{ converter=new Java2DFrameConverter(); JFrame canvasFrame=new JFrame(); canvasFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); canvasFrame.setSize(800,600); canvasFrame.setResizable(false); canvasFrame.setVisible(true); canvasFrame.setLayout(null); JPanel control=new JPanel( ); canvasFrame.add(control); control.setBounds(0,500,800,80); PreviewPanel preview=new PreviewPanel(); canvasFrame.add(preview); preview.setBounds(0,12,800,480); control.setLayout(null); control.setBackground(Color.gray); buttonStart=new JButton("启动"); buttonGraph=new JButton("推送屏幕图像"); buttonSound=new JButton("推送麦克风声音"); textUrl=new JTextField("rtmp://me:1935/live/test"); control.add(buttonGraph); control.add(buttonSound); control.add(buttonStart); control.add(textUrl); buttonGraph.setBounds(50,20,140,30); buttonSound.setBounds(210,20,140,30); buttonStart.setBounds(690,20,80,30); textUrl.setBounds(370,20,300,30); buttonStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text=buttonStart.getText(); if("停止".equals(text)) { if(recorder!=null) recorder.destroy(); recorder=null; buttonStart.setText("启动"); }else { try { if (recorder == null) { recorder = new LiveRecorder(textUrl.getText()); recorder.setGraphicSource(getGraphicSource()); recorder.setSoundSource(getSoundSource()); recorder.start(); recorder.setUpdateListener(new FrameUpdateListener() { @Override public void onUpdateFrame(Frame frame) { preview.repaint(converter.convert(frame)); } }); buttonStart.setText("停止"); } } catch (RecorderException error) { error.printStackTrace(); if (recorder != null) { recorder.destroy(); recorder = null; } } } } }); buttonGraph.addActionListener((e)->{ String text=buttonGraph.getText(); String newtext; if("推送屏幕图像".equals(text)) { newtext="推送摄像头图像"; }else if("推送摄像头图像".equals(text)){ newtext="不推送图像"; }else { newtext="推送屏幕图像"; } buttonGraph.setText(newtext); if(recorder!=null) recorder.setGraphicSource(getGraphicSource()); }); buttonSound.addActionListener((e)->{ String text=buttonSound.getText(); String newtext; if("推送麦克风声音".equals(text)) { newtext="不推送声音"; }else { newtext="推送麦克风声音"; } buttonSound.setText(newtext); if(recorder!=null) recorder.setSoundSource(getSoundSource()); }); } private LiveRecorder.GraphicSource getGraphicSource(){ String text=buttonGraph.getText(); if("推送屏幕图像".equals(text)) { return LiveRecorder.GraphicSource.SCREEN; }else if("推送摄像头图像".equals(text)){ return LiveRecorder.GraphicSource.CAMERA; }else { return null; } } private LiveRecorder.SoundSource getSoundSource(){ String text=buttonSound.getText(); if("推送麦克风声音".equals(text)) { return LiveRecorder.SoundSource.MICROPHONE; }else { return null; } } } class PreviewPanel extends JPanel{ @Override public void paint(Graphics g) { super.paint(g); if(image==null) return; double scale=Math.max((double)image.getHeight(null)/this.getHeight() ,(double)image.getWidth(null)/this.getWidth()); scale=1/scale; AffineTransformOp op=new AffineTransformOp(AffineTransform .getScaleInstance(scale,scale),null); image=op.filter(image,null); g.drawImage(image,0,0,null); } private BufferedImage image; public void repaint(BufferedImage image){ this.image=image; repaint(); } }
[ "974443739@qq.com" ]
974443739@qq.com
86cf38c16e6cbacfdb3f23e9828558d3998d8d54
208ba847cec642cdf7b77cff26bdc4f30a97e795
/z/src/androidTest/java/org.wp.z/ui/notifications/NotificationsUtilsTest.java
db4a44bc20b23226e9bcba01c8a27b8df7d63ca4
[]
no_license
kageiit/perf-android-large
ec7c291de9cde2f813ed6573f706a8593be7ac88
2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8
refs/heads/master
2021-01-12T14:00:19.468063
2016-09-27T13:10:42
2016-09-27T13:10:42
69,685,305
0
0
null
2016-09-30T16:59:49
2016-09-30T16:59:48
null
UTF-8
Java
false
false
734
java
package org.wp.z.ui.notifications; import android.test.AndroidTestCase; import android.text.SpannableStringBuilder; import org.wp.z.ui.notifications.utils.NotificationsUtils; public class NotificationsUtilsTest extends AndroidTestCase { public void testSpannableHasCharacterAtIndex() { SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("This is only a test."); assertTrue(NotificationsUtils.spannableHasCharacterAtIndex(spannableStringBuilder, 's', 3)); assertFalse(NotificationsUtils.spannableHasCharacterAtIndex(spannableStringBuilder, 's', 4)); // Test with bogus params assertFalse(NotificationsUtils.spannableHasCharacterAtIndex(null, 'b', -1)); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
684ace20e8f88e14e720855defb226c3c955162f
cbda3cff363ada5627f3fb6d624cb1b64e858874
/src/pers/sharedFileSystem/exceptionManager/ErrorHandler.java
cb3abbe0a529ac0e5dd1e28a66a2a9e749bf2180
[]
no_license
buaashuai/SharedFileSystemServer
8fd46865ade658940e080f94759a8de810afc469
30feb99deece8644c23f0612926c5e6fa0a07d9d
refs/heads/master
2020-05-21T12:20:46.721711
2016-10-08T04:29:27
2016-10-08T04:29:27
47,255,686
2
1
null
null
null
null
UTF-8
Java
false
false
2,346
java
package pers.sharedFileSystem.exceptionManager; import java.io.InputStream; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; import pers.sharedFileSystem.configManager.Config; import pers.sharedFileSystem.convenientUtil.CommonUtil; import pers.sharedFileSystem.entity.RuntimeType; /** * 文件系统错误处理器 * * @author buaashuai */ public class ErrorHandler { private static Hashtable<String, String> errorCodeTable = new Hashtable<String, String>(); private static final ErrorHandler errorHandler = new ErrorHandler(); private ErrorHandler() { try { InputStream in = null; if (Config.runtimeType== RuntimeType.DEBUG) { in = this .getClass() .getResourceAsStream( "/pers/sharedFileSystem/exceptionManager/errorcode.properties"); // System.out // .println(this // .getClass() // .getResource( // "/pers/sharedFileSystem/exception/errorcode.properties")); } else if (Config.runtimeType==RuntimeType.CLIENT){ in = this .getClass() .getResourceAsStream( "/pers/sharedFileSystem/exceptionManager/errorcode.properties"); // System.out // .println(this // .getClass() // .getResource( // "/pers/sharedFileSystem/exception/errorcode.properties")); } else if (Config.runtimeType==RuntimeType.SERVER){ in = this .getClass() .getResourceAsStream( "/pers/sharedFileSystem/exceptionManager/errorcode.properties"); // System.out // .println(this // .getClass() // .getResource( // "/pers/sharedFileSystem/exception/errorcode.properties")); } Properties p = new Properties(); p.load(in); Enumeration e1 = p.keys(); while (e1.hasMoreElements()) { String key = (String) e1.nextElement(); errorCodeTable.put(key, p.getProperty(key)); } in.close(); } catch (Exception e) { e.printStackTrace(); } } /** * 获取某个错误码的返回值 * * @param errorcode * @param otherInfo * 其他需要返回的错误信息 * @return 错误码对应的返回值 */ public static String getErrorInfo(int errorcode, String otherInfo) { if (CommonUtil.validateString(otherInfo)) return errorCodeTable.get(errorcode + "") + "," + otherInfo; else return errorCodeTable.get(errorcode + ""); } }
[ "shuaiwang126@163.com" ]
shuaiwang126@163.com
45b476bdb395159feb72ca118c624078486b67bb
b4935fb717991f8418f48e2387ae5c7f47fae9cb
/src/retailservice/model/Sale.java
614b6fbf639708cbc259251c71d233c726e62501
[]
no_license
b-dorsal/CSC435HW3
4c1b23db8269b6c9f1dcc9886f400d39cb672f27
a26c529b9760c87e5597aa952866aceac693bc35
refs/heads/master
2021-04-03T05:06:13.903047
2018-03-08T22:29:13
2018-03-08T22:29:13
124,455,046
0
0
null
null
null
null
UTF-8
Java
false
false
2,428
java
package retailservice.model; import java.sql.*; import java.util.ArrayList; import java.util.List; public class Sale{ private int sku; private int id; private int count; private float price; public Sale(int saleID, int sku, int count, float price){ this.id = saleID; this.sku = sku; this.count = count; this.price = price; } public static List<Sale> getSale(final int saleID) { List<Sale> sales = new ArrayList<>(); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/retail_store","root","boo5285"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM sales WHERE sale_id = " + saleID); while(rs.next()) sales.add(new Sale(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getFloat(4))); con.close(); }catch(Exception e){ System.out.println(e);} return sales; } public static void postSales(final int saleID, ArrayList<Product> items) { System.out.println("SALE " + saleID); System.out.println(items); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/retail_store","root","boo5285"); Statement stmt = con.createStatement(); for(Product p : items){ String query = "INSERT INTO sales VALUES(" + saleID + ", " + p.getSku() + "," + 1 + "," + p.getPrice() + ")"; stmt.executeUpdate(query); } con.close(); }catch(Exception e){ System.out.println(e);} } // getters public int getSku() { return sku; } public int getId() { return id; } public int getCount() { return count; } public float getPrice() { return price; } // setters public void setSku(int sku){ this.sku = sku; } public void setId(int id){ this.id = id; } public void setPrice(float price){ this.price = price; } public void setCount(int count){ this.count = count; } @Override public String toString(){ return "Sale: " + this.sku + ", " + this.id; } }
[ "bdo528@gmail.com" ]
bdo528@gmail.com
73d54f673521db0817cdf4cbfb74f57d7f8f36cd
d3bf4dfd7b48597f13f656a1f28eca1e79c1cb2a
/smilife/smilife_web/src/main/java/com/iskyshop/foundation/service/impl/TransportServiceImpl.java
f69854f3c4bac58fecb24ff707b22e5545aa9820
[]
no_license
zengchi/project
6a5b0d71ec6e7bcc8d32380509b34d9eebbe1ed7
a72c4aabb260bca8d2e340f2262d2f6c53f98898
refs/heads/master
2021-04-08T14:37:56.661873
2017-12-23T02:42:31
2017-12-23T02:42:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,725
java
package com.iskyshop.foundation.service.impl; import java.io.Serializable; import java.util.List; import java.util.Map; import javax.annotation.Resource; import com.iskyshop.core.query.PageObject; import com.iskyshop.core.query.support.IPageList; import com.iskyshop.core.query.support.IQueryObject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.iskyshop.core.dao.IGenericDAO; import com.iskyshop.core.query.GenericPageList; import com.iskyshop.foundation.domain.Transport; import com.iskyshop.foundation.service.ITransportService; @Service @Transactional public class TransportServiceImpl implements ITransportService{ @Resource(name = "transportDAO") private IGenericDAO<Transport> transportDao; @Transactional(readOnly = false) public boolean save(Transport transport) { /** * init other field here */ try { this.transportDao.save(transport); return true; } catch (Exception e) { e.printStackTrace(); return false; } } @Transactional(readOnly = true) public Transport getObjById(Long id) { Transport transport = this.transportDao.get(id); if (transport != null) { return transport; } return null; } @Transactional(readOnly = false) public boolean delete(Long id) { try { this.transportDao.remove(id); return true; } catch (Exception e) { e.printStackTrace(); return false; } } @Transactional(readOnly = false) public boolean batchDelete(List<Serializable> transportIds) { // TODO Auto-generated method stub for (Serializable id : transportIds) { delete((Long) id); } return true; } @Transactional(readOnly = true) public IPageList list(IQueryObject properties) { if (properties == null) { return null; } String query = properties.getQuery(); String construct = properties.getConstruct(); Map params = properties.getParameters(); GenericPageList pList = new GenericPageList(Transport.class,construct, query, params, this.transportDao); if (properties != null) { PageObject pageObj = properties.getPageObj(); if (pageObj != null) pList.doList(pageObj.getCurrentPage() == null ? 0 : pageObj .getCurrentPage(), pageObj.getPageSize() == null ? 0 : pageObj.getPageSize()); } else pList.doList(0, -1); return pList; } @Transactional(readOnly = false) public boolean update(Transport transport) { try { this.transportDao.update( transport); return true; } catch (Exception e) { e.printStackTrace(); return false; } } @Transactional(readOnly = true) public List<Transport> query(String query, Map params, int begin, int max){ return this.transportDao.query(query, params, begin, max); } }
[ "32216688+henry90821@users.noreply.github.com" ]
32216688+henry90821@users.noreply.github.com
1bb8a548aafde88df88c802db3e5a64a136ef4e0
199e94c3b8b96befcd0dbbe17b9473d4c874cd5f
/Guidebar/app/src/main/java/com/google/zxing/client/android/book/SearchBookContentsActivity.java
c77250e8292edd29cd0b10db6cf7237a37d53170
[]
no_license
kahsaynishimura/guidebar-android-studio
c91206e0f28f60b0339e6d7d9d7cb5074368871e
58fb5a07e5b2cb0b3f743f1c3f529e56f86350be
refs/heads/master
2020-05-20T14:00:26.326980
2015-01-28T14:09:11
2015-01-28T14:09:11
29,818,840
1
0
null
null
null
null
UTF-8
Java
false
false
10,061
java
/* * Copyright (C) 2008 ZXing 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 com.google.zxing.client.android.book; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import br.com.guidebar.R; import com.google.zxing.client.android.HttpHelper; import com.google.zxing.client.android.Intents; import com.google.zxing.client.android.LocaleManager; import com.google.zxing.client.android.common.executor.AsyncTaskExecInterface; import com.google.zxing.client.android.common.executor.AsyncTaskExecManager; /** * Uses Google Book Search to find a word or phrase in the requested book. * * @author dswitkin@google.com (Daniel Switkin) */ public final class SearchBookContentsActivity extends Activity { private static final String TAG = SearchBookContentsActivity.class.getSimpleName(); private static final Pattern TAG_PATTERN = Pattern.compile("\\<.*?\\>"); private static final Pattern LT_ENTITY_PATTERN = Pattern.compile("&lt;"); private static final Pattern GT_ENTITY_PATTERN = Pattern.compile("&gt;"); private static final Pattern QUOTE_ENTITY_PATTERN = Pattern.compile("&#39;"); private static final Pattern QUOT_ENTITY_PATTERN = Pattern.compile("&quot;"); private String isbn; private EditText queryTextView; private Button queryButton; private ListView resultListView; private TextView headerView; private NetworkTask networkTask; private final AsyncTaskExecInterface taskExec; public SearchBookContentsActivity() { taskExec = new AsyncTaskExecManager().build(); } private final Button.OnClickListener buttonListener = new Button.OnClickListener() { @Override public void onClick(View view) { launchSearch(); } }; private final View.OnKeyListener keyListener = new View.OnKeyListener() { @Override public boolean onKey(View view, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) { launchSearch(); return true; } return false; } }; String getISBN() { return isbn; } @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); // Make sure that expired cookies are removed on launch. CookieSyncManager.createInstance(this); CookieManager.getInstance().removeExpiredCookie(); Intent intent = getIntent(); if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) { finish(); return; } isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN); if (LocaleManager.isBookSearchUrl(isbn)) { setTitle(getString(R.string.sbc_name)); } else { setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn); } setContentView(R.layout.search_book_contents); queryTextView = (EditText) findViewById(R.id.query_text_view); String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY); if (initialQuery != null && initialQuery.length() > 0) { // Populate the search box but don't trigger the search queryTextView.setText(initialQuery); } queryTextView.setOnKeyListener(keyListener); queryButton = (Button) findViewById(R.id.query_button); queryButton.setOnClickListener(buttonListener); resultListView = (ListView) findViewById(R.id.result_list_view); LayoutInflater factory = LayoutInflater.from(this); headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false); resultListView.addHeaderView(headerView); } @Override protected void onResume() { super.onResume(); queryTextView.selectAll(); } @Override protected void onPause() { NetworkTask oldTask = networkTask; if (oldTask != null) { oldTask.cancel(true); networkTask = null; } super.onPause(); } private void launchSearch() { String query = queryTextView.getText().toString(); if (query != null && query.length() > 0) { NetworkTask oldTask = networkTask; if (oldTask != null) { oldTask.cancel(true); } networkTask = new NetworkTask(); taskExec.execute(networkTask, query, isbn); headerView.setText(R.string.msg_sbc_searching_book); resultListView.setAdapter(null); queryTextView.setEnabled(false); queryButton.setEnabled(false); } } private final class NetworkTask extends AsyncTask<String,Object,JSONObject> { @Override protected JSONObject doInBackground(String... args) { try { // These return a JSON result which describes if and where the query was found. This API may // break or disappear at any time in the future. Since this is an API call rather than a // website, we don't use LocaleManager to change the TLD. String theQuery = args[0]; String theIsbn = args[1]; String uri; if (LocaleManager.isBookSearchUrl(theIsbn)) { int equals = theIsbn.indexOf('='); String volumeId = theIsbn.substring(equals + 1); uri = "http://www.google.com/books?id=" + volumeId + "&jscmd=SearchWithinVolume2&q=" + theQuery; } else { uri = "http://www.google.com/books?vid=isbn" + theIsbn + "&jscmd=SearchWithinVolume2&q=" + theQuery; } CharSequence content = HttpHelper.downloadViaHttp(uri, HttpHelper.ContentType.JSON); return new JSONObject(content.toString()); } catch (IOException ioe) { Log.w(TAG, "Error accessing book search", ioe); return null; } catch (JSONException je) { Log.w(TAG, "Error accessing book search", je); return null; } } @Override protected void onPostExecute(JSONObject result) { if (result == null) { headerView.setText(R.string.msg_sbc_failed); } else { handleSearchResults(result); } queryTextView.setEnabled(true); queryTextView.selectAll(); queryButton.setEnabled(true); } // Currently there is no way to distinguish between a query which had no results and a book // which is not searchable - both return zero results. private void handleSearchResults(JSONObject json) { try { int count = json.getInt("number_of_results"); headerView.setText(getString(R.string.msg_sbc_results) + " : " + count); if (count > 0) { JSONArray results = json.getJSONArray("search_results"); SearchBookContentsResult.setQuery(queryTextView.getText().toString()); List<SearchBookContentsResult> items = new ArrayList<SearchBookContentsResult>(count); for (int x = 0; x < count; x++) { items.add(parseResult(results.getJSONObject(x))); } resultListView.setOnItemClickListener(new BrowseBookListener(SearchBookContentsActivity.this, items)); resultListView.setAdapter(new SearchBookContentsAdapter(SearchBookContentsActivity.this, items)); } else { String searchable = json.optString("searchable"); if ("false".equals(searchable)) { headerView.setText(R.string.msg_sbc_book_not_searchable); } resultListView.setAdapter(null); } } catch (JSONException e) { Log.w(TAG, "Bad JSON from book search", e); resultListView.setAdapter(null); headerView.setText(R.string.msg_sbc_failed); } } // Available fields: page_id, page_number, page_url, snippet_text private SearchBookContentsResult parseResult(JSONObject json) { try { String pageId = json.getString("page_id"); String pageNumber = json.getString("page_number"); if (pageNumber.length() > 0) { pageNumber = getString(R.string.msg_sbc_page) + ' ' + pageNumber; } else { // This can happen for text on the jacket, and possibly other reasons. pageNumber = getString(R.string.msg_sbc_unknown_page); } // Remove all HTML tags and encoded characters. Ideally the server would do this. String snippet = json.optString("snippet_text"); boolean valid = true; if (snippet.length() > 0) { snippet = TAG_PATTERN.matcher(snippet).replaceAll(""); snippet = LT_ENTITY_PATTERN.matcher(snippet).replaceAll("<"); snippet = GT_ENTITY_PATTERN.matcher(snippet).replaceAll(">"); snippet = QUOTE_ENTITY_PATTERN.matcher(snippet).replaceAll("'"); snippet = QUOT_ENTITY_PATTERN.matcher(snippet).replaceAll("\""); } else { snippet = '(' + getString(R.string.msg_sbc_snippet_unavailable) + ')'; valid = false; } return new SearchBookContentsResult(pageId, pageNumber, snippet, valid); } catch (JSONException e) { // Never seen in the wild, just being complete. return new SearchBookContentsResult(getString(R.string.msg_sbc_no_page_returned), "", "", false); } } } }
[ "kahsaynishimura@gmail.com" ]
kahsaynishimura@gmail.com
7c6a43e783903ae6e4158dda609a91fe7e2b4a44
92577310d94a7a4789ad2e7ba1b3ab1b574c63ee
/core/src/main/java/com/travel/diary/service/PhotoService.java
526331eeace5220563c73de935d0f746825e3a3a
[]
no_license
xelloss8886/travelDiary
b3c9d2eb0fa889f2f4fef66562864776572d88d3
f0468eefca979068523ea2c0c5da7fbff49c86c1
refs/heads/master
2020-03-18T17:28:29.674744
2018-07-01T04:00:15
2018-07-01T04:00:15
135,031,292
0
0
null
null
null
null
UTF-8
Java
false
false
151
java
package com.travel.diary.service; import com.travel.diary.entity.PhotoEntity; public interface PhotoService extends GeneralService<PhotoEntity> { }
[ "xelloss8886@gmail.com" ]
xelloss8886@gmail.com
213ef7deb6ea5abe46d340f0dbbe9bfc01875838
d0939ba55591150ebe9f0f72706edd94719564e4
/app/src/androidTest/java/com/fd/alertplaces/ApplicationTest.java
21c01653cceda4d5082bf178ffd1888e71d71d59
[]
no_license
rodrigofrosch/NotifyTopPlaces
fc45c2d48a1f6dc450dd4e4aa668a0f80c2ff281
16c819b3612b582205c00f76148f08e1177198d2
refs/heads/master
2021-01-18T14:44:52.534749
2015-01-14T04:25:05
2015-01-14T04:25:05
29,226,932
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.fd.alertplaces; 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); } }
[ "rodrigo.frosch@yahoo.com.br" ]
rodrigo.frosch@yahoo.com.br
84ae4161f5c5a3b7f54f53d6aab3e3cf748115f3
a217e8e8ed07b4be5475a6901a595171f0dbe3d9
/core/src/main/java/ClibsTest/core/services/MindInfoStep.java
3e85a95acd1619ecd4adfaa8137e6448530d6fc9
[]
no_license
Manojas/ClibsTestProject
55012a6111c24ab4f6ad0254bc41a3fad4d174df
47ec75de81cf28c6adb41f24c10302e22dc61168
refs/heads/master
2023-04-24T05:54:48.468466
2021-05-18T14:15:30
2021-05-18T14:15:30
366,608,849
0
0
null
null
null
null
UTF-8
Java
false
false
1,279
java
package ClibsTest.core.services; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.adobe.granite.workflow.WorkflowException; import com.adobe.granite.workflow.WorkflowSession; import com.adobe.granite.workflow.exec.WorkItem; import com.adobe.granite.workflow.exec.WorkflowProcess; import com.adobe.granite.workflow.metadata.MetaDataMap; @Component(service=WorkflowProcess.class,immediate=true, property= {"process.label"+"=MindInfoStep", Constants.SERVICE_DESCRIPTION + "=This step takes Mind info", Constants.SERVICE_VENDOR + "=Mindtree" }) public class MindInfoStep implements WorkflowProcess { private static final Logger Log=LoggerFactory.getLogger(MindInfoStep.class); @Override public void execute(WorkItem workItem, WorkflowSession workFlowSession, MetaDataMap metaData) throws WorkflowException { // TODO Auto-generated method stub try { String mindName=metaData.get("MIND_NAME", "String"); String mindId=metaData.get("MIND_ID", "String"); Log.info("Mindtree mind name"); Log.info("Mind name "+mindName); Log.info("Mind Id "+mindId); }catch(Exception e) { System.out.println(e.getMessage()); } } }
[ "manojsurendra07@gmail.com" ]
manojsurendra07@gmail.com
24011e027552ed344756ff17c82995ade28f70e3
6828c9db69ff97a3259d92e828d1ff32a078aa33
/XMLSchema/src/com/sample/MD5Digest.java
0310323f47cc9f3c33e8b8d0c3c281a151077868
[]
no_license
PrathapKK/codehawk
e022a65fa74d533537ddefdbefaabf0bba6153f0
e8d7a18da6ff6fc34d103167f9bd142b59b76ed9
refs/heads/master
2020-12-25T19:03:51.929059
2013-12-09T12:47:23
2013-12-09T12:47:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package com.sample; import java.security.*; public class MD5Digest { public static void main(String args[]) throws Exception{ MessageDigest md = MessageDigest.getInstance("MD5"); byte toChapter1 [] = "Prathap".getBytes() ; byte[] toChapter2 = null; try { md.digest(toChapter1); System.out.println(md.); /* MessageDigest tc1 = (MessageDigest) md.clone(); byte[] toChapter1Digest = tc1.digest(); md.update(toChapter2);*/ } catch (Exception cnse) { throw new DigestException("couldn't make digest of partial content"); } } }
[ "prathap_kk@gmail.com" ]
prathap_kk@gmail.com
c2340e6068b372adb7118996c3f787ddc2c3751d
1415496f94592ba4412407b71dc18722598163dd
/doc/libjitisi/sources/net/sf/fmj/media/cdp/javasound/CaptureDevicePlugger.java
48ba0f9505e9ebac864e97d405990e01c7d6cb37
[ "Apache-2.0" ]
permissive
lhzheng880828/VOIPCall
ad534535869c47b5fc17405b154bdc651b52651b
a7ba25debd4bd2086bae2a48306d28c614ce0d4a
refs/heads/master
2021-07-04T17:25:21.953174
2020-09-29T07:29:42
2020-09-29T07:29:42
183,576,020
0
0
null
null
null
null
UTF-8
Java
false
false
1,556
java
package net.sf.fmj.media.cdp.javasound; import java.util.logging.Logger; import javax.media.CaptureDeviceInfo; import javax.media.CaptureDeviceManager; import javax.media.Format; import javax.media.MediaLocator; import net.sf.fmj.media.protocol.javasound.DataSource; import net.sf.fmj.utility.LoggerSingleton; import org.jitsi.android.util.javax.sound.sampled.AudioSystem; import org.jitsi.android.util.javax.sound.sampled.Mixer; import org.jitsi.android.util.javax.sound.sampled.Mixer.Info; public class CaptureDevicePlugger { private static final Logger logger = LoggerSingleton.logger; public void addCaptureDevices() { int index = 0; Info[] mixerInfo = AudioSystem.getMixerInfo(); for (int i = 0; i < mixerInfo.length; i++) { Mixer mixer = AudioSystem.getMixer(mixerInfo[i]); Format[] formats = DataSource.querySupportedFormats(i); if (formats != null && formats.length > 0) { CaptureDeviceInfo jmfInfo = new CaptureDeviceInfo("javasound:" + mixerInfo[i].getName() + ":" + index, new MediaLocator("javasound:#" + i), formats); index++; if (CaptureDeviceManager.getDevice(jmfInfo.getName()) == null) { CaptureDeviceManager.addDevice(jmfInfo); logger.fine("CaptureDevicePlugger: Added " + jmfInfo.getLocator()); } else { logger.fine("CaptureDevicePlugger: Already present, skipping " + jmfInfo.getLocator()); } } } } }
[ "lhzheng@grandstream.cn" ]
lhzheng@grandstream.cn
9b86f7d2458a3ad50600e58b38ce46ab65a4bd6a
c38c37b89489808077c7a5adefa764219170aea3
/evacuation-visualization/src/main/java/edu/utdallas/mavs/evacuation/visualization/vis3D/EvacuationVisualizer3DApplication.java
750c1e3ef7b848f57c7ccbc5e277256221ef4d87
[]
no_license
pragati99/DIVAS5
35a568af1a9c56a6c883cd076d3ad789dcf47107
714ba37c122e478e0494979ab7e08c16e50a5284
refs/heads/master
2021-08-11T19:32:27.038232
2017-11-14T03:32:03
2017-11-14T03:32:03
110,481,811
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package edu.utdallas.mavs.evacuation.visualization.vis3D; import com.google.inject.Inject; import edu.utdallas.mavs.divas.core.client.SimAdapter; import edu.utdallas.mavs.divas.visualization.vis3D.Visualizer3DApplication; import edu.utdallas.mavs.divas.visualization.vis3D.spectator.VisualSpectator; /** * This class describes the 3D visualizer singleton class. * <p> */ public class EvacuationVisualizer3DApplication extends Visualizer3DApplication<EvacuationApplication> { @Inject public EvacuationVisualizer3DApplication(SimAdapter simClientAdapter, EvacuationApplication app, VisualSpectator spectator) { super(simClientAdapter, app, spectator); } }
[ "prakashpragati@gmail.com" ]
prakashpragati@gmail.com
d4dadaa745d92a69222017d04ba07348a09e25ec
300c85f8db59231b9c841cdf1abaeaea92df0265
/src/main/java/cn/tomxin/jiandan_house/entity/Record.java
4b66409fb4c8d969f70ffaf665c239f33f4cc674
[]
no_license
guanbinbin/jiandan_house
bb86fe78b2c115edeec5fee5bee0ebb98515d80a
d46238e1daab4ae08d14b02e647d8b2f67c9c363
refs/heads/master
2020-04-25T19:42:31.097541
2019-02-01T03:25:32
2019-02-01T03:25:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,255
java
package cn.tomxin.jiandan_house.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.time.LocalDateTime; import java.util.Date; @Data @Table(name = "record") @Entity public class Record { @Id @GenericGenerator(name="idGenerator", strategy="uuid") //这个是hibernate的注解/生成32位UUID @GeneratedValue(generator="idGenerator") @Column(columnDefinition = "varchar(32) not null COMMENT '记录id'") private String id; @Column(columnDefinition = "varchar(50) COMMENT '用户openId'") @JsonIgnore private String openId; @Column(columnDefinition = "varchar(10) COMMENT '城市名称'") private String cityName; @Column(columnDefinition = "TIMESTAMP COMMENT '添加时间'") private Date createTime; @Column(columnDefinition = "varchar(100) COMMENT '关键字'") private String keyWord; @Column(columnDefinition = "varchar(10) COMMENT '提醒方式'") private String remindType; @Column(columnDefinition = "varchar(100) COMMENT '提醒地址'") private String remind; @Column(columnDefinition = "int COMMENT '状态'") private Integer status; }
[ "221360@nd.com" ]
221360@nd.com
64aea77173aaad7cab6c5a1f771637d62a334781
20aee8111d456d4c6c66d517729aa9b5f7d46da2
/projects/roops/src/roops/core/objects/SinglyLinkedList.java
b17cf2ba75c55eb253509a7fb6509e07de5233a7
[]
no_license
matteomiraz/testless
2da72e30398163f7212da559169517e3cfbc5cf0
e8dad0e78093314aa193982578f6d47f9a381241
refs/heads/master
2021-01-10T21:25:13.149043
2012-02-10T16:19:20
2012-02-10T16:19:20
3,390,574
0
0
null
null
null
null
UTF-8
Java
false
false
3,793
java
package roops.core.objects; //Authors: Marcelo Frias import roops.util.RoopsArray; @roops.util.BenchmarkClass /** * @Invariant all n: SinglyLinkedListNode | ( ( n in this.header.*next @- null ) => ( n !in n.next.*next @- null ) ) ; */ public class SinglyLinkedList { @roops.util.NrOfGoals(7) @roops.util.BenchmarkMethod static public void containsTest(roops.core.objects.SinglyLinkedList list, Object value_param) { boolean ret_val; if (list!=null) { ret_val = list.contains(value_param); } } @roops.util.NrOfGoals(4) @roops.util.BenchmarkMethod static public void insertBackTest(SinglyLinkedList list, Object arg) { if (list!=null) { list.insertBack(arg); } } @roops.util.NrOfGoals(7) @roops.util.BenchmarkMethod static public void removeTest(SinglyLinkedList list, int index) { if (list!=null) { list.remove(index); } } public /*@ nullable @*/SinglyLinkedListNode header; public boolean contains(Object value_param) { SinglyLinkedListNode current; boolean result; current = this.header; result = false; while (result == false && current != null) { {roops.util.Goals.reached(0, roops.util.Verdict.REACHABLE);} boolean equalVal; if (value_param == null && current.value == null){ {roops.util.Goals.reached(1, roops.util.Verdict.REACHABLE);} equalVal = true; } else if (value_param != null) { if (value_param == current.value) { {roops.util.Goals.reached(2, roops.util.Verdict.REACHABLE);} equalVal = true; } else { {roops.util.Goals.reached(3, roops.util.Verdict.REACHABLE);} equalVal = false; } } else { {roops.util.Goals.reached(4, roops.util.Verdict.REACHABLE);} equalVal = false; } if (equalVal == true) { {roops.util.Goals.reached(5, roops.util.Verdict.REACHABLE);} result = true; } current = current.next; } {roops.util.Goals.reached(6, roops.util.Verdict.REACHABLE);} return result; } public void remove(int index) { if (index<0) { {roops.util.Goals.reached(0, roops.util.Verdict.REACHABLE);} throw new RuntimeException(); } SinglyLinkedListNode current; current = this.header; SinglyLinkedListNode previous; previous = null; int current_index; current_index = 0; boolean found = false; while (found==false && current != null) { {roops.util.Goals.reached(1, roops.util.Verdict.REACHABLE);} if (index == current_index) { {roops.util.Goals.reached(2, roops.util.Verdict.REACHABLE);} found = true; } else { {roops.util.Goals.reached(3, roops.util.Verdict.REACHABLE);} current_index = current_index + 1; previous = current; current = current.next; } } if (found==false) { {roops.util.Goals.reached(4, roops.util.Verdict.REACHABLE);} throw new RuntimeException(); } if (previous == null){ {roops.util.Goals.reached(5, roops.util.Verdict.REACHABLE);} this.header = current.next; } else { {roops.util.Goals.reached(6, roops.util.Verdict.REACHABLE);} previous.next = current.next; } } public void insertBack(Object arg) { SinglyLinkedListNode freshNode = new SinglyLinkedListNode(); freshNode.value = arg; freshNode.next = null; if (this.header == null) { {roops.util.Goals.reached(0, roops.util.Verdict.REACHABLE);} this.header = freshNode; } else { {roops.util.Goals.reached(1, roops.util.Verdict.REACHABLE);} SinglyLinkedListNode current; current = this.header; while (current.next != null) { {roops.util.Goals.reached(2, roops.util.Verdict.REACHABLE);} current = current.next; } current.next = freshNode; } {roops.util.Goals.reached(3, roops.util.Verdict.REACHABLE);} } public SinglyLinkedList() {} } /* end roops.core.objects */
[ "matteo@miraz.it" ]
matteo@miraz.it
1c4b8a550177741d78be6d235f9b7661efc21d49
840905498d610c00168d45acad85f1e78f6dd271
/src/com/java/Java2DArray.java
2989d5a1bbbdf740a66bfe7d49d3978a287a8b4f
[]
no_license
TusharPandey98/hackerrank-solution-java
bb852f9db06f90b3ce9debd5a24f616963360fcb
35119e98b9740a9f47b2a03457c94eb4250edbc2
refs/heads/master
2023-07-23T22:33:35.502870
2021-08-26T15:52:46
2021-08-26T15:52:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,199
java
package com.java; import java.io.IOException; import java.util.Scanner; // 1 1 1 0 0 0 // 0 1 0 0 0 0 // 1 1 1 0 0 0 // 0 0 0 0 0 0 // 0 0 0 0 0 0 // 0 0 0 0 0 0 public class Java2DArray { static int hourGlassSum(int[][] arr) { int row = arr.length; int col = arr[0].length; int max_hourglass_sum = Integer.MIN_VALUE; for (int i = 0; i < row - 2; i++) { for (int j = 0; j < col - 2; j++) { int current_hourglass_sum = arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + arr[i + 1][j + 1] + arr[i + 2][j] + arr[i + 2][j + 1] + arr[i + 2][j + 2]; max_hourglass_sum = Math.max(max_hourglass_sum, current_hourglass_sum); } } return max_hourglass_sum; } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int arr[][] = new int[6][6]; for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { arr[i][j] = sc.nextInt(); } } int result = hourGlassSum(arr); System.out.println(result); } }
[ "tushar2898pandey@gmail.com" ]
tushar2898pandey@gmail.com
60aea96c8cd748e388d675965bd96649bdb19697
26956ae51840079dd4ae648fced40d7c0edc700f
/Lab3/src/Clothes/Hat.java
ba53ff3a803e4d1ac46c0cbad1357a9dcdad3a35
[]
no_license
bball30/Proga_1_sem
438c979d065bfdb0a164dea07a62c3a54fde8fd0
8272eacce5c8ea77dcc569329065166dc6ed2de8
refs/heads/main
2023-02-03T21:03:52.691735
2020-12-20T17:55:52
2020-12-20T17:55:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
917
java
package Clothes; import java.util.Objects; public class Hat { private final String color; private final int size; public Hat(String color, int size) { this.color = color; this.size = size; } public String getColor() { return color; } public int getSize() { return size; } @Override public String toString() { return "Hat{" + "color='" + color + '\'' + ", size=" + size + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Hat hat = (Hat) o; return size == hat.size && color.equals(hat.color); } @Override public int hashCode() { return Objects.hash(color, size); } }
[ "noreply@github.com" ]
noreply@github.com
3d882774a15fba302691773f8acdcbc5b9f092b0
9349cc54a51e54a5a45bd064e0c78a6037b65839
/src/main/java/com/nelioalves/cursomc/domain/enums/Perfil.java
adb15a4dcb90e5e18a6ca8ff154e2ed961842d15
[]
no_license
joselinsneto182/cursomc
b50fdf1a7076c9419a405044e93b21e4bef9cdd5
595f3724079fe344fb9ee480bdb81967131b3880
refs/heads/master
2021-06-15T12:31:58.662973
2019-12-05T06:09:03
2019-12-05T06:09:03
192,418,031
0
0
null
2021-04-26T19:43:45
2019-06-17T20:59:15
Java
UTF-8
Java
false
false
616
java
package com.nelioalves.cursomc.domain.enums; public enum Perfil { ADMIN (1, "ROLE_ADMIN"), CLIENTE (2, "ROLE_CLIENTE"); private int cod; private String descricao; private Perfil(int cod, String descricao) { this.cod = cod; this.descricao = descricao; } public int getCod() { return cod; } public String getDescricao() { return descricao; } public static Perfil toEnum(Integer cod) { if(cod == null) { return null; } for(Perfil x : Perfil.values()) { if(cod.equals(x.getCod())) { return x; } } throw new IllegalArgumentException("Id inválido: "+ cod); } }
[ "joselinsneto182@gmail.com" ]
joselinsneto182@gmail.com
f7760393ffab0b438233b54aab04c5ef0fb13d7b
f8d5ed331558664b6a986d7f3ebd74c679139e12
/metamer/ftest/src/test/java/org/richfaces/tests/metamer/ftest/richMessage/RF12030Page.java
0673082685ceabda278da4eff20b33f04f1a300a
[]
no_license
jhuska/richfaces-qa
a58792dea8ec35c3bd2df01734dc9becf60f70f1
be0610bf0ca5e7f8337e6a530610d206d235b31d
refs/heads/master
2021-01-12T22:48:38.372909
2014-09-30T11:21:49
2014-09-30T11:22:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,553
java
/** * JBoss, Home of Professional Open Source * Copyright 2010-2014, Red Hat, Inc. and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.richfaces.tests.metamer.ftest.richMessage; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.richfaces.tests.metamer.ftest.webdriver.MetamerPage; /** * @author <a href="mailto:jstefek@redhat.com">Jiri Stefek</a> */ public class RF12030Page extends MetamerPage { @FindBy(css = "tr.rf-dt-r.rf-dt-fst-r > td") WebElement firstTableRow; @FindBy(css = "table.rf-cp-gr") WebElement collapsePanel; @FindBy(css = "a.rf-ds-btn.rf-ds-btn-next") WebElement nextButton; }
[ "jstefek@redhat.com" ]
jstefek@redhat.com
efdc6edc2731f35014adf3c69cc4612943b71fdd
e6d750512f2e93e65819a270e744a233c680124b
/netty_lecture/src/main/java/com/jade/protobuf/PersonInfo.java
a09733d6c1dea62c442b15ae01f3c5927d1d759d
[]
no_license
Asurada520/gradle-test
544114f4576574e7033bdc9dc2a53966ecc2dfa1
ef4a54122a401faec3ac2394d538f491b982a188
refs/heads/master
2023-02-12T15:11:33.500253
2021-01-15T09:46:55
2021-01-15T09:46:55
321,303,746
0
0
null
null
null
null
UTF-8
Java
false
true
129,693
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: src/protobuf/Person.proto package com.jade.protobuf; public final class PersonInfo { private PersonInfo() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } public interface MyMessageOrBuilder extends // @@protoc_insertion_point(interface_extends:com.jade.protobuf.MyMessage) com.google.protobuf.MessageOrBuilder { /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @return Whether the dataType field is set. */ boolean hasDataType(); /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @return The dataType. */ com.jade.protobuf.PersonInfo.MyMessage.DataType getDataType(); /** * <code>.com.jade.protobuf.Person person = 2;</code> * @return Whether the person field is set. */ boolean hasPerson(); /** * <code>.com.jade.protobuf.Person person = 2;</code> * @return The person. */ com.jade.protobuf.PersonInfo.Person getPerson(); /** * <code>.com.jade.protobuf.Person person = 2;</code> */ com.jade.protobuf.PersonInfo.PersonOrBuilder getPersonOrBuilder(); /** * <code>.com.jade.protobuf.Dog dog = 3;</code> * @return Whether the dog field is set. */ boolean hasDog(); /** * <code>.com.jade.protobuf.Dog dog = 3;</code> * @return The dog. */ com.jade.protobuf.PersonInfo.Dog getDog(); /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ com.jade.protobuf.PersonInfo.DogOrBuilder getDogOrBuilder(); /** * <code>.com.jade.protobuf.Cat cat = 4;</code> * @return Whether the cat field is set. */ boolean hasCat(); /** * <code>.com.jade.protobuf.Cat cat = 4;</code> * @return The cat. */ com.jade.protobuf.PersonInfo.Cat getCat(); /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ com.jade.protobuf.PersonInfo.CatOrBuilder getCatOrBuilder(); public com.jade.protobuf.PersonInfo.MyMessage.DataBodyCase getDataBodyCase(); } /** * Protobuf type {@code com.jade.protobuf.MyMessage} */ public static final class MyMessage extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.jade.protobuf.MyMessage) MyMessageOrBuilder { private static final long serialVersionUID = 0L; // Use MyMessage.newBuilder() to construct. private MyMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private MyMessage() { dataType_ = 1; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new MyMessage(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private MyMessage( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 8: { int rawValue = input.readEnum(); @SuppressWarnings("deprecation") com.jade.protobuf.PersonInfo.MyMessage.DataType value = com.jade.protobuf.PersonInfo.MyMessage.DataType.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(1, rawValue); } else { bitField0_ |= 0x00000001; dataType_ = rawValue; } break; } case 18: { com.jade.protobuf.PersonInfo.Person.Builder subBuilder = null; if (dataBodyCase_ == 2) { subBuilder = ((com.jade.protobuf.PersonInfo.Person) dataBody_).toBuilder(); } dataBody_ = input.readMessage(com.jade.protobuf.PersonInfo.Person.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom((com.jade.protobuf.PersonInfo.Person) dataBody_); dataBody_ = subBuilder.buildPartial(); } dataBodyCase_ = 2; break; } case 26: { com.jade.protobuf.PersonInfo.Dog.Builder subBuilder = null; if (dataBodyCase_ == 3) { subBuilder = ((com.jade.protobuf.PersonInfo.Dog) dataBody_).toBuilder(); } dataBody_ = input.readMessage(com.jade.protobuf.PersonInfo.Dog.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom((com.jade.protobuf.PersonInfo.Dog) dataBody_); dataBody_ = subBuilder.buildPartial(); } dataBodyCase_ = 3; break; } case 34: { com.jade.protobuf.PersonInfo.Cat.Builder subBuilder = null; if (dataBodyCase_ == 4) { subBuilder = ((com.jade.protobuf.PersonInfo.Cat) dataBody_).toBuilder(); } dataBody_ = input.readMessage(com.jade.protobuf.PersonInfo.Cat.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom((com.jade.protobuf.PersonInfo.Cat) dataBody_); dataBody_ = subBuilder.buildPartial(); } dataBodyCase_ = 4; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_MyMessage_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_MyMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.MyMessage.class, com.jade.protobuf.PersonInfo.MyMessage.Builder.class); } /** * Protobuf enum {@code com.jade.protobuf.MyMessage.DataType} */ public enum DataType implements com.google.protobuf.ProtocolMessageEnum { /** * <code>PersonType = 1;</code> */ PersonType(1), /** * <code>DogType = 2;</code> */ DogType(2), /** * <code>CatType = 3;</code> */ CatType(3), ; /** * <code>PersonType = 1;</code> */ public static final int PersonType_VALUE = 1; /** * <code>DogType = 2;</code> */ public static final int DogType_VALUE = 2; /** * <code>CatType = 3;</code> */ public static final int CatType_VALUE = 3; public final int getNumber() { return value; } /** * @param value The numeric wire value of the corresponding enum entry. * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static DataType valueOf(int value) { return forNumber(value); } /** * @param value The numeric wire value of the corresponding enum entry. * @return The enum associated with the given numeric wire value. */ public static DataType forNumber(int value) { switch (value) { case 1: return PersonType; case 2: return DogType; case 3: return CatType; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<DataType> internalGetValueMap() { return internalValueMap; } private static final com.google.protobuf.Internal.EnumLiteMap< DataType> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<DataType>() { public DataType findValueByNumber(int number) { return DataType.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.jade.protobuf.PersonInfo.MyMessage.getDescriptor().getEnumTypes().get(0); } private static final DataType[] VALUES = values(); public static DataType valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; } private final int value; private DataType(int value) { this.value = value; } // @@protoc_insertion_point(enum_scope:com.jade.protobuf.MyMessage.DataType) } private int bitField0_; private int dataBodyCase_ = 0; private java.lang.Object dataBody_; public enum DataBodyCase implements com.google.protobuf.Internal.EnumLite, com.google.protobuf.AbstractMessage.InternalOneOfEnum { PERSON(2), DOG(3), CAT(4), DATABODY_NOT_SET(0); private final int value; private DataBodyCase(int value) { this.value = value; } /** * @param value The number of the enum to look for. * @return The enum associated with the given number. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static DataBodyCase valueOf(int value) { return forNumber(value); } public static DataBodyCase forNumber(int value) { switch (value) { case 2: return PERSON; case 3: return DOG; case 4: return CAT; case 0: return DATABODY_NOT_SET; default: return null; } } public int getNumber() { return this.value; } }; public DataBodyCase getDataBodyCase() { return DataBodyCase.forNumber( dataBodyCase_); } public static final int DATA_TYPE_FIELD_NUMBER = 1; private int dataType_; /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @return Whether the dataType field is set. */ @java.lang.Override public boolean hasDataType() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @return The dataType. */ @java.lang.Override public com.jade.protobuf.PersonInfo.MyMessage.DataType getDataType() { @SuppressWarnings("deprecation") com.jade.protobuf.PersonInfo.MyMessage.DataType result = com.jade.protobuf.PersonInfo.MyMessage.DataType.valueOf(dataType_); return result == null ? com.jade.protobuf.PersonInfo.MyMessage.DataType.PersonType : result; } public static final int PERSON_FIELD_NUMBER = 2; /** * <code>.com.jade.protobuf.Person person = 2;</code> * @return Whether the person field is set. */ @java.lang.Override public boolean hasPerson() { return dataBodyCase_ == 2; } /** * <code>.com.jade.protobuf.Person person = 2;</code> * @return The person. */ @java.lang.Override public com.jade.protobuf.PersonInfo.Person getPerson() { if (dataBodyCase_ == 2) { return (com.jade.protobuf.PersonInfo.Person) dataBody_; } return com.jade.protobuf.PersonInfo.Person.getDefaultInstance(); } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ @java.lang.Override public com.jade.protobuf.PersonInfo.PersonOrBuilder getPersonOrBuilder() { if (dataBodyCase_ == 2) { return (com.jade.protobuf.PersonInfo.Person) dataBody_; } return com.jade.protobuf.PersonInfo.Person.getDefaultInstance(); } public static final int DOG_FIELD_NUMBER = 3; /** * <code>.com.jade.protobuf.Dog dog = 3;</code> * @return Whether the dog field is set. */ @java.lang.Override public boolean hasDog() { return dataBodyCase_ == 3; } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> * @return The dog. */ @java.lang.Override public com.jade.protobuf.PersonInfo.Dog getDog() { if (dataBodyCase_ == 3) { return (com.jade.protobuf.PersonInfo.Dog) dataBody_; } return com.jade.protobuf.PersonInfo.Dog.getDefaultInstance(); } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ @java.lang.Override public com.jade.protobuf.PersonInfo.DogOrBuilder getDogOrBuilder() { if (dataBodyCase_ == 3) { return (com.jade.protobuf.PersonInfo.Dog) dataBody_; } return com.jade.protobuf.PersonInfo.Dog.getDefaultInstance(); } public static final int CAT_FIELD_NUMBER = 4; /** * <code>.com.jade.protobuf.Cat cat = 4;</code> * @return Whether the cat field is set. */ @java.lang.Override public boolean hasCat() { return dataBodyCase_ == 4; } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> * @return The cat. */ @java.lang.Override public com.jade.protobuf.PersonInfo.Cat getCat() { if (dataBodyCase_ == 4) { return (com.jade.protobuf.PersonInfo.Cat) dataBody_; } return com.jade.protobuf.PersonInfo.Cat.getDefaultInstance(); } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ @java.lang.Override public com.jade.protobuf.PersonInfo.CatOrBuilder getCatOrBuilder() { if (dataBodyCase_ == 4) { return (com.jade.protobuf.PersonInfo.Cat) dataBody_; } return com.jade.protobuf.PersonInfo.Cat.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; if (!hasDataType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { output.writeEnum(1, dataType_); } if (dataBodyCase_ == 2) { output.writeMessage(2, (com.jade.protobuf.PersonInfo.Person) dataBody_); } if (dataBodyCase_ == 3) { output.writeMessage(3, (com.jade.protobuf.PersonInfo.Dog) dataBody_); } if (dataBodyCase_ == 4) { output.writeMessage(4, (com.jade.protobuf.PersonInfo.Cat) dataBody_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(1, dataType_); } if (dataBodyCase_ == 2) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, (com.jade.protobuf.PersonInfo.Person) dataBody_); } if (dataBodyCase_ == 3) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, (com.jade.protobuf.PersonInfo.Dog) dataBody_); } if (dataBodyCase_ == 4) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, (com.jade.protobuf.PersonInfo.Cat) dataBody_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.jade.protobuf.PersonInfo.MyMessage)) { return super.equals(obj); } com.jade.protobuf.PersonInfo.MyMessage other = (com.jade.protobuf.PersonInfo.MyMessage) obj; if (hasDataType() != other.hasDataType()) return false; if (hasDataType()) { if (dataType_ != other.dataType_) return false; } if (!getDataBodyCase().equals(other.getDataBodyCase())) return false; switch (dataBodyCase_) { case 2: if (!getPerson() .equals(other.getPerson())) return false; break; case 3: if (!getDog() .equals(other.getDog())) return false; break; case 4: if (!getCat() .equals(other.getCat())) return false; break; case 0: default: } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasDataType()) { hash = (37 * hash) + DATA_TYPE_FIELD_NUMBER; hash = (53 * hash) + dataType_; } switch (dataBodyCase_) { case 2: hash = (37 * hash) + PERSON_FIELD_NUMBER; hash = (53 * hash) + getPerson().hashCode(); break; case 3: hash = (37 * hash) + DOG_FIELD_NUMBER; hash = (53 * hash) + getDog().hashCode(); break; case 4: hash = (37 * hash) + CAT_FIELD_NUMBER; hash = (53 * hash) + getCat().hashCode(); break; case 0: default: } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.MyMessage parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.MyMessage parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.MyMessage parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.jade.protobuf.PersonInfo.MyMessage prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.jade.protobuf.MyMessage} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.jade.protobuf.MyMessage) com.jade.protobuf.PersonInfo.MyMessageOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_MyMessage_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_MyMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.MyMessage.class, com.jade.protobuf.PersonInfo.MyMessage.Builder.class); } // Construct using com.jade.protobuf.PersonInfo.MyMessage.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); dataType_ = 1; bitField0_ = (bitField0_ & ~0x00000001); dataBodyCase_ = 0; dataBody_ = null; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_MyMessage_descriptor; } @java.lang.Override public com.jade.protobuf.PersonInfo.MyMessage getDefaultInstanceForType() { return com.jade.protobuf.PersonInfo.MyMessage.getDefaultInstance(); } @java.lang.Override public com.jade.protobuf.PersonInfo.MyMessage build() { com.jade.protobuf.PersonInfo.MyMessage result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.jade.protobuf.PersonInfo.MyMessage buildPartial() { com.jade.protobuf.PersonInfo.MyMessage result = new com.jade.protobuf.PersonInfo.MyMessage(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.dataType_ = dataType_; if (dataBodyCase_ == 2) { if (personBuilder_ == null) { result.dataBody_ = dataBody_; } else { result.dataBody_ = personBuilder_.build(); } } if (dataBodyCase_ == 3) { if (dogBuilder_ == null) { result.dataBody_ = dataBody_; } else { result.dataBody_ = dogBuilder_.build(); } } if (dataBodyCase_ == 4) { if (catBuilder_ == null) { result.dataBody_ = dataBody_; } else { result.dataBody_ = catBuilder_.build(); } } result.bitField0_ = to_bitField0_; result.dataBodyCase_ = dataBodyCase_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.jade.protobuf.PersonInfo.MyMessage) { return mergeFrom((com.jade.protobuf.PersonInfo.MyMessage)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.jade.protobuf.PersonInfo.MyMessage other) { if (other == com.jade.protobuf.PersonInfo.MyMessage.getDefaultInstance()) return this; if (other.hasDataType()) { setDataType(other.getDataType()); } switch (other.getDataBodyCase()) { case PERSON: { mergePerson(other.getPerson()); break; } case DOG: { mergeDog(other.getDog()); break; } case CAT: { mergeCat(other.getCat()); break; } case DATABODY_NOT_SET: { break; } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { if (!hasDataType()) { return false; } return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.jade.protobuf.PersonInfo.MyMessage parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.jade.protobuf.PersonInfo.MyMessage) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int dataBodyCase_ = 0; private java.lang.Object dataBody_; public DataBodyCase getDataBodyCase() { return DataBodyCase.forNumber( dataBodyCase_); } public Builder clearDataBody() { dataBodyCase_ = 0; dataBody_ = null; onChanged(); return this; } private int bitField0_; private int dataType_ = 1; /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @return Whether the dataType field is set. */ @java.lang.Override public boolean hasDataType() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @return The dataType. */ @java.lang.Override public com.jade.protobuf.PersonInfo.MyMessage.DataType getDataType() { @SuppressWarnings("deprecation") com.jade.protobuf.PersonInfo.MyMessage.DataType result = com.jade.protobuf.PersonInfo.MyMessage.DataType.valueOf(dataType_); return result == null ? com.jade.protobuf.PersonInfo.MyMessage.DataType.PersonType : result; } /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @param value The dataType to set. * @return This builder for chaining. */ public Builder setDataType(com.jade.protobuf.PersonInfo.MyMessage.DataType value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; dataType_ = value.getNumber(); onChanged(); return this; } /** * <code>required .com.jade.protobuf.MyMessage.DataType data_type = 1;</code> * @return This builder for chaining. */ public Builder clearDataType() { bitField0_ = (bitField0_ & ~0x00000001); dataType_ = 1; onChanged(); return this; } private com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Person, com.jade.protobuf.PersonInfo.Person.Builder, com.jade.protobuf.PersonInfo.PersonOrBuilder> personBuilder_; /** * <code>.com.jade.protobuf.Person person = 2;</code> * @return Whether the person field is set. */ @java.lang.Override public boolean hasPerson() { return dataBodyCase_ == 2; } /** * <code>.com.jade.protobuf.Person person = 2;</code> * @return The person. */ @java.lang.Override public com.jade.protobuf.PersonInfo.Person getPerson() { if (personBuilder_ == null) { if (dataBodyCase_ == 2) { return (com.jade.protobuf.PersonInfo.Person) dataBody_; } return com.jade.protobuf.PersonInfo.Person.getDefaultInstance(); } else { if (dataBodyCase_ == 2) { return personBuilder_.getMessage(); } return com.jade.protobuf.PersonInfo.Person.getDefaultInstance(); } } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ public Builder setPerson(com.jade.protobuf.PersonInfo.Person value) { if (personBuilder_ == null) { if (value == null) { throw new NullPointerException(); } dataBody_ = value; onChanged(); } else { personBuilder_.setMessage(value); } dataBodyCase_ = 2; return this; } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ public Builder setPerson( com.jade.protobuf.PersonInfo.Person.Builder builderForValue) { if (personBuilder_ == null) { dataBody_ = builderForValue.build(); onChanged(); } else { personBuilder_.setMessage(builderForValue.build()); } dataBodyCase_ = 2; return this; } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ public Builder mergePerson(com.jade.protobuf.PersonInfo.Person value) { if (personBuilder_ == null) { if (dataBodyCase_ == 2 && dataBody_ != com.jade.protobuf.PersonInfo.Person.getDefaultInstance()) { dataBody_ = com.jade.protobuf.PersonInfo.Person.newBuilder((com.jade.protobuf.PersonInfo.Person) dataBody_) .mergeFrom(value).buildPartial(); } else { dataBody_ = value; } onChanged(); } else { if (dataBodyCase_ == 2) { personBuilder_.mergeFrom(value); } personBuilder_.setMessage(value); } dataBodyCase_ = 2; return this; } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ public Builder clearPerson() { if (personBuilder_ == null) { if (dataBodyCase_ == 2) { dataBodyCase_ = 0; dataBody_ = null; onChanged(); } } else { if (dataBodyCase_ == 2) { dataBodyCase_ = 0; dataBody_ = null; } personBuilder_.clear(); } return this; } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ public com.jade.protobuf.PersonInfo.Person.Builder getPersonBuilder() { return getPersonFieldBuilder().getBuilder(); } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ @java.lang.Override public com.jade.protobuf.PersonInfo.PersonOrBuilder getPersonOrBuilder() { if ((dataBodyCase_ == 2) && (personBuilder_ != null)) { return personBuilder_.getMessageOrBuilder(); } else { if (dataBodyCase_ == 2) { return (com.jade.protobuf.PersonInfo.Person) dataBody_; } return com.jade.protobuf.PersonInfo.Person.getDefaultInstance(); } } /** * <code>.com.jade.protobuf.Person person = 2;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Person, com.jade.protobuf.PersonInfo.Person.Builder, com.jade.protobuf.PersonInfo.PersonOrBuilder> getPersonFieldBuilder() { if (personBuilder_ == null) { if (!(dataBodyCase_ == 2)) { dataBody_ = com.jade.protobuf.PersonInfo.Person.getDefaultInstance(); } personBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Person, com.jade.protobuf.PersonInfo.Person.Builder, com.jade.protobuf.PersonInfo.PersonOrBuilder>( (com.jade.protobuf.PersonInfo.Person) dataBody_, getParentForChildren(), isClean()); dataBody_ = null; } dataBodyCase_ = 2; onChanged();; return personBuilder_; } private com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Dog, com.jade.protobuf.PersonInfo.Dog.Builder, com.jade.protobuf.PersonInfo.DogOrBuilder> dogBuilder_; /** * <code>.com.jade.protobuf.Dog dog = 3;</code> * @return Whether the dog field is set. */ @java.lang.Override public boolean hasDog() { return dataBodyCase_ == 3; } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> * @return The dog. */ @java.lang.Override public com.jade.protobuf.PersonInfo.Dog getDog() { if (dogBuilder_ == null) { if (dataBodyCase_ == 3) { return (com.jade.protobuf.PersonInfo.Dog) dataBody_; } return com.jade.protobuf.PersonInfo.Dog.getDefaultInstance(); } else { if (dataBodyCase_ == 3) { return dogBuilder_.getMessage(); } return com.jade.protobuf.PersonInfo.Dog.getDefaultInstance(); } } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ public Builder setDog(com.jade.protobuf.PersonInfo.Dog value) { if (dogBuilder_ == null) { if (value == null) { throw new NullPointerException(); } dataBody_ = value; onChanged(); } else { dogBuilder_.setMessage(value); } dataBodyCase_ = 3; return this; } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ public Builder setDog( com.jade.protobuf.PersonInfo.Dog.Builder builderForValue) { if (dogBuilder_ == null) { dataBody_ = builderForValue.build(); onChanged(); } else { dogBuilder_.setMessage(builderForValue.build()); } dataBodyCase_ = 3; return this; } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ public Builder mergeDog(com.jade.protobuf.PersonInfo.Dog value) { if (dogBuilder_ == null) { if (dataBodyCase_ == 3 && dataBody_ != com.jade.protobuf.PersonInfo.Dog.getDefaultInstance()) { dataBody_ = com.jade.protobuf.PersonInfo.Dog.newBuilder((com.jade.protobuf.PersonInfo.Dog) dataBody_) .mergeFrom(value).buildPartial(); } else { dataBody_ = value; } onChanged(); } else { if (dataBodyCase_ == 3) { dogBuilder_.mergeFrom(value); } dogBuilder_.setMessage(value); } dataBodyCase_ = 3; return this; } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ public Builder clearDog() { if (dogBuilder_ == null) { if (dataBodyCase_ == 3) { dataBodyCase_ = 0; dataBody_ = null; onChanged(); } } else { if (dataBodyCase_ == 3) { dataBodyCase_ = 0; dataBody_ = null; } dogBuilder_.clear(); } return this; } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ public com.jade.protobuf.PersonInfo.Dog.Builder getDogBuilder() { return getDogFieldBuilder().getBuilder(); } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ @java.lang.Override public com.jade.protobuf.PersonInfo.DogOrBuilder getDogOrBuilder() { if ((dataBodyCase_ == 3) && (dogBuilder_ != null)) { return dogBuilder_.getMessageOrBuilder(); } else { if (dataBodyCase_ == 3) { return (com.jade.protobuf.PersonInfo.Dog) dataBody_; } return com.jade.protobuf.PersonInfo.Dog.getDefaultInstance(); } } /** * <code>.com.jade.protobuf.Dog dog = 3;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Dog, com.jade.protobuf.PersonInfo.Dog.Builder, com.jade.protobuf.PersonInfo.DogOrBuilder> getDogFieldBuilder() { if (dogBuilder_ == null) { if (!(dataBodyCase_ == 3)) { dataBody_ = com.jade.protobuf.PersonInfo.Dog.getDefaultInstance(); } dogBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Dog, com.jade.protobuf.PersonInfo.Dog.Builder, com.jade.protobuf.PersonInfo.DogOrBuilder>( (com.jade.protobuf.PersonInfo.Dog) dataBody_, getParentForChildren(), isClean()); dataBody_ = null; } dataBodyCase_ = 3; onChanged();; return dogBuilder_; } private com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Cat, com.jade.protobuf.PersonInfo.Cat.Builder, com.jade.protobuf.PersonInfo.CatOrBuilder> catBuilder_; /** * <code>.com.jade.protobuf.Cat cat = 4;</code> * @return Whether the cat field is set. */ @java.lang.Override public boolean hasCat() { return dataBodyCase_ == 4; } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> * @return The cat. */ @java.lang.Override public com.jade.protobuf.PersonInfo.Cat getCat() { if (catBuilder_ == null) { if (dataBodyCase_ == 4) { return (com.jade.protobuf.PersonInfo.Cat) dataBody_; } return com.jade.protobuf.PersonInfo.Cat.getDefaultInstance(); } else { if (dataBodyCase_ == 4) { return catBuilder_.getMessage(); } return com.jade.protobuf.PersonInfo.Cat.getDefaultInstance(); } } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ public Builder setCat(com.jade.protobuf.PersonInfo.Cat value) { if (catBuilder_ == null) { if (value == null) { throw new NullPointerException(); } dataBody_ = value; onChanged(); } else { catBuilder_.setMessage(value); } dataBodyCase_ = 4; return this; } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ public Builder setCat( com.jade.protobuf.PersonInfo.Cat.Builder builderForValue) { if (catBuilder_ == null) { dataBody_ = builderForValue.build(); onChanged(); } else { catBuilder_.setMessage(builderForValue.build()); } dataBodyCase_ = 4; return this; } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ public Builder mergeCat(com.jade.protobuf.PersonInfo.Cat value) { if (catBuilder_ == null) { if (dataBodyCase_ == 4 && dataBody_ != com.jade.protobuf.PersonInfo.Cat.getDefaultInstance()) { dataBody_ = com.jade.protobuf.PersonInfo.Cat.newBuilder((com.jade.protobuf.PersonInfo.Cat) dataBody_) .mergeFrom(value).buildPartial(); } else { dataBody_ = value; } onChanged(); } else { if (dataBodyCase_ == 4) { catBuilder_.mergeFrom(value); } catBuilder_.setMessage(value); } dataBodyCase_ = 4; return this; } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ public Builder clearCat() { if (catBuilder_ == null) { if (dataBodyCase_ == 4) { dataBodyCase_ = 0; dataBody_ = null; onChanged(); } } else { if (dataBodyCase_ == 4) { dataBodyCase_ = 0; dataBody_ = null; } catBuilder_.clear(); } return this; } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ public com.jade.protobuf.PersonInfo.Cat.Builder getCatBuilder() { return getCatFieldBuilder().getBuilder(); } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ @java.lang.Override public com.jade.protobuf.PersonInfo.CatOrBuilder getCatOrBuilder() { if ((dataBodyCase_ == 4) && (catBuilder_ != null)) { return catBuilder_.getMessageOrBuilder(); } else { if (dataBodyCase_ == 4) { return (com.jade.protobuf.PersonInfo.Cat) dataBody_; } return com.jade.protobuf.PersonInfo.Cat.getDefaultInstance(); } } /** * <code>.com.jade.protobuf.Cat cat = 4;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Cat, com.jade.protobuf.PersonInfo.Cat.Builder, com.jade.protobuf.PersonInfo.CatOrBuilder> getCatFieldBuilder() { if (catBuilder_ == null) { if (!(dataBodyCase_ == 4)) { dataBody_ = com.jade.protobuf.PersonInfo.Cat.getDefaultInstance(); } catBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.jade.protobuf.PersonInfo.Cat, com.jade.protobuf.PersonInfo.Cat.Builder, com.jade.protobuf.PersonInfo.CatOrBuilder>( (com.jade.protobuf.PersonInfo.Cat) dataBody_, getParentForChildren(), isClean()); dataBody_ = null; } dataBodyCase_ = 4; onChanged();; return catBuilder_; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.jade.protobuf.MyMessage) } // @@protoc_insertion_point(class_scope:com.jade.protobuf.MyMessage) private static final com.jade.protobuf.PersonInfo.MyMessage DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.jade.protobuf.PersonInfo.MyMessage(); } public static com.jade.protobuf.PersonInfo.MyMessage getDefaultInstance() { return DEFAULT_INSTANCE; } @java.lang.Deprecated public static final com.google.protobuf.Parser<MyMessage> PARSER = new com.google.protobuf.AbstractParser<MyMessage>() { @java.lang.Override public MyMessage parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new MyMessage(input, extensionRegistry); } }; public static com.google.protobuf.Parser<MyMessage> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<MyMessage> getParserForType() { return PARSER; } @java.lang.Override public com.jade.protobuf.PersonInfo.MyMessage getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface PersonOrBuilder extends // @@protoc_insertion_point(interface_extends:com.jade.protobuf.Person) com.google.protobuf.MessageOrBuilder { /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ boolean hasName(); /** * <code>optional string name = 1;</code> * @return The name. */ java.lang.String getName(); /** * <code>optional string name = 1;</code> * @return The bytes for name. */ com.google.protobuf.ByteString getNameBytes(); /** * <code>optional int32 age = 2;</code> * @return Whether the age field is set. */ boolean hasAge(); /** * <code>optional int32 age = 2;</code> * @return The age. */ int getAge(); /** * <code>optional string address = 3;</code> * @return Whether the address field is set. */ boolean hasAddress(); /** * <code>optional string address = 3;</code> * @return The address. */ java.lang.String getAddress(); /** * <code>optional string address = 3;</code> * @return The bytes for address. */ com.google.protobuf.ByteString getAddressBytes(); } /** * Protobuf type {@code com.jade.protobuf.Person} */ public static final class Person extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.jade.protobuf.Person) PersonOrBuilder { private static final long serialVersionUID = 0L; // Use Person.newBuilder() to construct. private Person(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Person() { name_ = ""; address_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new Person(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Person( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; name_ = bs; break; } case 16: { bitField0_ |= 0x00000002; age_ = input.readInt32(); break; } case 26: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000004; address_ = bs; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Person_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Person_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.Person.class, com.jade.protobuf.PersonInfo.Person.Builder.class); } private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; private volatile java.lang.Object name_; /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ @java.lang.Override public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> * @return The name. */ @java.lang.Override public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * <code>optional string name = 1;</code> * @return The bytes for name. */ @java.lang.Override public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int AGE_FIELD_NUMBER = 2; private int age_; /** * <code>optional int32 age = 2;</code> * @return Whether the age field is set. */ @java.lang.Override public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> * @return The age. */ @java.lang.Override public int getAge() { return age_; } public static final int ADDRESS_FIELD_NUMBER = 3; private volatile java.lang.Object address_; /** * <code>optional string address = 3;</code> * @return Whether the address field is set. */ @java.lang.Override public boolean hasAddress() { return ((bitField0_ & 0x00000004) != 0); } /** * <code>optional string address = 3;</code> * @return The address. */ @java.lang.Override public java.lang.String getAddress() { java.lang.Object ref = address_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { address_ = s; } return s; } } /** * <code>optional string address = 3;</code> * @return The bytes for address. */ @java.lang.Override public com.google.protobuf.ByteString getAddressBytes() { java.lang.Object ref = address_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeInt32(2, age_); } if (((bitField0_ & 0x00000004) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, address_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, age_); } if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, address_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.jade.protobuf.PersonInfo.Person)) { return super.equals(obj); } com.jade.protobuf.PersonInfo.Person other = (com.jade.protobuf.PersonInfo.Person) obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (!getName() .equals(other.getName())) return false; } if (hasAge() != other.hasAge()) return false; if (hasAge()) { if (getAge() != other.getAge()) return false; } if (hasAddress() != other.hasAddress()) return false; if (hasAddress()) { if (!getAddress() .equals(other.getAddress())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasAge()) { hash = (37 * hash) + AGE_FIELD_NUMBER; hash = (53 * hash) + getAge(); } if (hasAddress()) { hash = (37 * hash) + ADDRESS_FIELD_NUMBER; hash = (53 * hash) + getAddress().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.jade.protobuf.PersonInfo.Person parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Person parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Person parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Person parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Person parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Person parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Person parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Person parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Person parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Person parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Person parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Person parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.jade.protobuf.PersonInfo.Person prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.jade.protobuf.Person} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.jade.protobuf.Person) com.jade.protobuf.PersonInfo.PersonOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Person_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Person_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.Person.class, com.jade.protobuf.PersonInfo.Person.Builder.class); } // Construct using com.jade.protobuf.PersonInfo.Person.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); name_ = ""; bitField0_ = (bitField0_ & ~0x00000001); age_ = 0; bitField0_ = (bitField0_ & ~0x00000002); address_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Person_descriptor; } @java.lang.Override public com.jade.protobuf.PersonInfo.Person getDefaultInstanceForType() { return com.jade.protobuf.PersonInfo.Person.getDefaultInstance(); } @java.lang.Override public com.jade.protobuf.PersonInfo.Person build() { com.jade.protobuf.PersonInfo.Person result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.jade.protobuf.PersonInfo.Person buildPartial() { com.jade.protobuf.PersonInfo.Person result = new com.jade.protobuf.PersonInfo.Person(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000002) != 0)) { result.age_ = age_; to_bitField0_ |= 0x00000002; } if (((from_bitField0_ & 0x00000004) != 0)) { to_bitField0_ |= 0x00000004; } result.address_ = address_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.jade.protobuf.PersonInfo.Person) { return mergeFrom((com.jade.protobuf.PersonInfo.Person)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.jade.protobuf.PersonInfo.Person other) { if (other == com.jade.protobuf.PersonInfo.Person.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasAge()) { setAge(other.getAge()); } if (other.hasAddress()) { bitField0_ |= 0x00000004; address_ = other.address_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.jade.protobuf.PersonInfo.Person parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.jade.protobuf.PersonInfo.Person) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.lang.Object name_ = ""; /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <code>optional string name = 1;</code> * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string name = 1;</code> * @param value The name to set. * @return This builder for chaining. */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } /** * <code>optional string name = 1;</code> * @return This builder for chaining. */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <code>optional string name = 1;</code> * @param value The bytes for name to set. * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } private int age_ ; /** * <code>optional int32 age = 2;</code> * @return Whether the age field is set. */ @java.lang.Override public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> * @return The age. */ @java.lang.Override public int getAge() { return age_; } /** * <code>optional int32 age = 2;</code> * @param value The age to set. * @return This builder for chaining. */ public Builder setAge(int value) { bitField0_ |= 0x00000002; age_ = value; onChanged(); return this; } /** * <code>optional int32 age = 2;</code> * @return This builder for chaining. */ public Builder clearAge() { bitField0_ = (bitField0_ & ~0x00000002); age_ = 0; onChanged(); return this; } private java.lang.Object address_ = ""; /** * <code>optional string address = 3;</code> * @return Whether the address field is set. */ public boolean hasAddress() { return ((bitField0_ & 0x00000004) != 0); } /** * <code>optional string address = 3;</code> * @return The address. */ public java.lang.String getAddress() { java.lang.Object ref = address_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { address_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <code>optional string address = 3;</code> * @return The bytes for address. */ public com.google.protobuf.ByteString getAddressBytes() { java.lang.Object ref = address_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string address = 3;</code> * @param value The address to set. * @return This builder for chaining. */ public Builder setAddress( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; address_ = value; onChanged(); return this; } /** * <code>optional string address = 3;</code> * @return This builder for chaining. */ public Builder clearAddress() { bitField0_ = (bitField0_ & ~0x00000004); address_ = getDefaultInstance().getAddress(); onChanged(); return this; } /** * <code>optional string address = 3;</code> * @param value The bytes for address to set. * @return This builder for chaining. */ public Builder setAddressBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; address_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.jade.protobuf.Person) } // @@protoc_insertion_point(class_scope:com.jade.protobuf.Person) private static final com.jade.protobuf.PersonInfo.Person DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.jade.protobuf.PersonInfo.Person(); } public static com.jade.protobuf.PersonInfo.Person getDefaultInstance() { return DEFAULT_INSTANCE; } @java.lang.Deprecated public static final com.google.protobuf.Parser<Person> PARSER = new com.google.protobuf.AbstractParser<Person>() { @java.lang.Override public Person parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Person(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Person> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Person> getParserForType() { return PARSER; } @java.lang.Override public com.jade.protobuf.PersonInfo.Person getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface DogOrBuilder extends // @@protoc_insertion_point(interface_extends:com.jade.protobuf.Dog) com.google.protobuf.MessageOrBuilder { /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ boolean hasName(); /** * <code>optional string name = 1;</code> * @return The name. */ java.lang.String getName(); /** * <code>optional string name = 1;</code> * @return The bytes for name. */ com.google.protobuf.ByteString getNameBytes(); /** * <code>optional int32 age = 2;</code> * @return Whether the age field is set. */ boolean hasAge(); /** * <code>optional int32 age = 2;</code> * @return The age. */ int getAge(); } /** * Protobuf type {@code com.jade.protobuf.Dog} */ public static final class Dog extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.jade.protobuf.Dog) DogOrBuilder { private static final long serialVersionUID = 0L; // Use Dog.newBuilder() to construct. private Dog(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Dog() { name_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new Dog(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Dog( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; name_ = bs; break; } case 16: { bitField0_ |= 0x00000002; age_ = input.readInt32(); break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Dog_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Dog_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.Dog.class, com.jade.protobuf.PersonInfo.Dog.Builder.class); } private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; private volatile java.lang.Object name_; /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ @java.lang.Override public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> * @return The name. */ @java.lang.Override public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * <code>optional string name = 1;</code> * @return The bytes for name. */ @java.lang.Override public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int AGE_FIELD_NUMBER = 2; private int age_; /** * <code>optional int32 age = 2;</code> * @return Whether the age field is set. */ @java.lang.Override public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> * @return The age. */ @java.lang.Override public int getAge() { return age_; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeInt32(2, age_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, age_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.jade.protobuf.PersonInfo.Dog)) { return super.equals(obj); } com.jade.protobuf.PersonInfo.Dog other = (com.jade.protobuf.PersonInfo.Dog) obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (!getName() .equals(other.getName())) return false; } if (hasAge() != other.hasAge()) return false; if (hasAge()) { if (getAge() != other.getAge()) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasAge()) { hash = (37 * hash) + AGE_FIELD_NUMBER; hash = (53 * hash) + getAge(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.jade.protobuf.PersonInfo.Dog parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Dog parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Dog parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Dog parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Dog parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Dog parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Dog parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Dog parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Dog parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Dog parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Dog parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Dog parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.jade.protobuf.PersonInfo.Dog prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.jade.protobuf.Dog} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.jade.protobuf.Dog) com.jade.protobuf.PersonInfo.DogOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Dog_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Dog_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.Dog.class, com.jade.protobuf.PersonInfo.Dog.Builder.class); } // Construct using com.jade.protobuf.PersonInfo.Dog.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); name_ = ""; bitField0_ = (bitField0_ & ~0x00000001); age_ = 0; bitField0_ = (bitField0_ & ~0x00000002); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Dog_descriptor; } @java.lang.Override public com.jade.protobuf.PersonInfo.Dog getDefaultInstanceForType() { return com.jade.protobuf.PersonInfo.Dog.getDefaultInstance(); } @java.lang.Override public com.jade.protobuf.PersonInfo.Dog build() { com.jade.protobuf.PersonInfo.Dog result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.jade.protobuf.PersonInfo.Dog buildPartial() { com.jade.protobuf.PersonInfo.Dog result = new com.jade.protobuf.PersonInfo.Dog(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000002) != 0)) { result.age_ = age_; to_bitField0_ |= 0x00000002; } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.jade.protobuf.PersonInfo.Dog) { return mergeFrom((com.jade.protobuf.PersonInfo.Dog)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.jade.protobuf.PersonInfo.Dog other) { if (other == com.jade.protobuf.PersonInfo.Dog.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasAge()) { setAge(other.getAge()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.jade.protobuf.PersonInfo.Dog parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.jade.protobuf.PersonInfo.Dog) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.lang.Object name_ = ""; /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <code>optional string name = 1;</code> * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string name = 1;</code> * @param value The name to set. * @return This builder for chaining. */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } /** * <code>optional string name = 1;</code> * @return This builder for chaining. */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <code>optional string name = 1;</code> * @param value The bytes for name to set. * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } private int age_ ; /** * <code>optional int32 age = 2;</code> * @return Whether the age field is set. */ @java.lang.Override public boolean hasAge() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional int32 age = 2;</code> * @return The age. */ @java.lang.Override public int getAge() { return age_; } /** * <code>optional int32 age = 2;</code> * @param value The age to set. * @return This builder for chaining. */ public Builder setAge(int value) { bitField0_ |= 0x00000002; age_ = value; onChanged(); return this; } /** * <code>optional int32 age = 2;</code> * @return This builder for chaining. */ public Builder clearAge() { bitField0_ = (bitField0_ & ~0x00000002); age_ = 0; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.jade.protobuf.Dog) } // @@protoc_insertion_point(class_scope:com.jade.protobuf.Dog) private static final com.jade.protobuf.PersonInfo.Dog DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.jade.protobuf.PersonInfo.Dog(); } public static com.jade.protobuf.PersonInfo.Dog getDefaultInstance() { return DEFAULT_INSTANCE; } @java.lang.Deprecated public static final com.google.protobuf.Parser<Dog> PARSER = new com.google.protobuf.AbstractParser<Dog>() { @java.lang.Override public Dog parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Dog(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Dog> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Dog> getParserForType() { return PARSER; } @java.lang.Override public com.jade.protobuf.PersonInfo.Dog getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface CatOrBuilder extends // @@protoc_insertion_point(interface_extends:com.jade.protobuf.Cat) com.google.protobuf.MessageOrBuilder { /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ boolean hasName(); /** * <code>optional string name = 1;</code> * @return The name. */ java.lang.String getName(); /** * <code>optional string name = 1;</code> * @return The bytes for name. */ com.google.protobuf.ByteString getNameBytes(); /** * <code>optional string city = 2;</code> * @return Whether the city field is set. */ boolean hasCity(); /** * <code>optional string city = 2;</code> * @return The city. */ java.lang.String getCity(); /** * <code>optional string city = 2;</code> * @return The bytes for city. */ com.google.protobuf.ByteString getCityBytes(); } /** * Protobuf type {@code com.jade.protobuf.Cat} */ public static final class Cat extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.jade.protobuf.Cat) CatOrBuilder { private static final long serialVersionUID = 0L; // Use Cat.newBuilder() to construct. private Cat(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Cat() { name_ = ""; city_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new Cat(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Cat( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; name_ = bs; break; } case 18: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000002; city_ = bs; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Cat_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Cat_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.Cat.class, com.jade.protobuf.PersonInfo.Cat.Builder.class); } private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; private volatile java.lang.Object name_; /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ @java.lang.Override public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> * @return The name. */ @java.lang.Override public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * <code>optional string name = 1;</code> * @return The bytes for name. */ @java.lang.Override public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int CITY_FIELD_NUMBER = 2; private volatile java.lang.Object city_; /** * <code>optional string city = 2;</code> * @return Whether the city field is set. */ @java.lang.Override public boolean hasCity() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional string city = 2;</code> * @return The city. */ @java.lang.Override public java.lang.String getCity() { java.lang.Object ref = city_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { city_ = s; } return s; } } /** * <code>optional string city = 2;</code> * @return The bytes for city. */ @java.lang.Override public com.google.protobuf.ByteString getCityBytes() { java.lang.Object ref = city_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); city_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, city_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, city_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.jade.protobuf.PersonInfo.Cat)) { return super.equals(obj); } com.jade.protobuf.PersonInfo.Cat other = (com.jade.protobuf.PersonInfo.Cat) obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (!getName() .equals(other.getName())) return false; } if (hasCity() != other.hasCity()) return false; if (hasCity()) { if (!getCity() .equals(other.getCity())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasCity()) { hash = (37 * hash) + CITY_FIELD_NUMBER; hash = (53 * hash) + getCity().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.jade.protobuf.PersonInfo.Cat parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Cat parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Cat parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Cat parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Cat parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.jade.protobuf.PersonInfo.Cat parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Cat parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Cat parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Cat parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Cat parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.jade.protobuf.PersonInfo.Cat parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.jade.protobuf.PersonInfo.Cat parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.jade.protobuf.PersonInfo.Cat prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.jade.protobuf.Cat} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.jade.protobuf.Cat) com.jade.protobuf.PersonInfo.CatOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Cat_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Cat_fieldAccessorTable .ensureFieldAccessorsInitialized( com.jade.protobuf.PersonInfo.Cat.class, com.jade.protobuf.PersonInfo.Cat.Builder.class); } // Construct using com.jade.protobuf.PersonInfo.Cat.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); name_ = ""; bitField0_ = (bitField0_ & ~0x00000001); city_ = ""; bitField0_ = (bitField0_ & ~0x00000002); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.jade.protobuf.PersonInfo.internal_static_com_jade_protobuf_Cat_descriptor; } @java.lang.Override public com.jade.protobuf.PersonInfo.Cat getDefaultInstanceForType() { return com.jade.protobuf.PersonInfo.Cat.getDefaultInstance(); } @java.lang.Override public com.jade.protobuf.PersonInfo.Cat build() { com.jade.protobuf.PersonInfo.Cat result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.jade.protobuf.PersonInfo.Cat buildPartial() { com.jade.protobuf.PersonInfo.Cat result = new com.jade.protobuf.PersonInfo.Cat(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000002) != 0)) { to_bitField0_ |= 0x00000002; } result.city_ = city_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.jade.protobuf.PersonInfo.Cat) { return mergeFrom((com.jade.protobuf.PersonInfo.Cat)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.jade.protobuf.PersonInfo.Cat other) { if (other == com.jade.protobuf.PersonInfo.Cat.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasCity()) { bitField0_ |= 0x00000002; city_ = other.city_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.jade.protobuf.PersonInfo.Cat parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.jade.protobuf.PersonInfo.Cat) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.lang.Object name_ = ""; /** * <code>optional string name = 1;</code> * @return Whether the name field is set. */ public boolean hasName() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional string name = 1;</code> * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <code>optional string name = 1;</code> * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string name = 1;</code> * @param value The name to set. * @return This builder for chaining. */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } /** * <code>optional string name = 1;</code> * @return This builder for chaining. */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <code>optional string name = 1;</code> * @param value The bytes for name to set. * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; name_ = value; onChanged(); return this; } private java.lang.Object city_ = ""; /** * <code>optional string city = 2;</code> * @return Whether the city field is set. */ public boolean hasCity() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional string city = 2;</code> * @return The city. */ public java.lang.String getCity() { java.lang.Object ref = city_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { city_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <code>optional string city = 2;</code> * @return The bytes for city. */ public com.google.protobuf.ByteString getCityBytes() { java.lang.Object ref = city_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); city_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>optional string city = 2;</code> * @param value The city to set. * @return This builder for chaining. */ public Builder setCity( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; city_ = value; onChanged(); return this; } /** * <code>optional string city = 2;</code> * @return This builder for chaining. */ public Builder clearCity() { bitField0_ = (bitField0_ & ~0x00000002); city_ = getDefaultInstance().getCity(); onChanged(); return this; } /** * <code>optional string city = 2;</code> * @param value The bytes for city to set. * @return This builder for chaining. */ public Builder setCityBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; city_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.jade.protobuf.Cat) } // @@protoc_insertion_point(class_scope:com.jade.protobuf.Cat) private static final com.jade.protobuf.PersonInfo.Cat DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.jade.protobuf.PersonInfo.Cat(); } public static com.jade.protobuf.PersonInfo.Cat getDefaultInstance() { return DEFAULT_INSTANCE; } @java.lang.Deprecated public static final com.google.protobuf.Parser<Cat> PARSER = new com.google.protobuf.AbstractParser<Cat>() { @java.lang.Override public Cat parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Cat(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Cat> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Cat> getParserForType() { return PARSER; } @java.lang.Override public com.jade.protobuf.PersonInfo.Cat getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_jade_protobuf_MyMessage_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_jade_protobuf_MyMessage_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_jade_protobuf_Person_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_jade_protobuf_Person_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_jade_protobuf_Dog_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_jade_protobuf_Dog_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_jade_protobuf_Cat_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_jade_protobuf_Cat_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\031src/protobuf/Person.proto\022\021com.jade.pr" + "otobuf\"\202\002\n\tMyMessage\0228\n\tdata_type\030\001 \002(\0162" + "%.com.jade.protobuf.MyMessage.DataType\022+" + "\n\006person\030\002 \001(\0132\031.com.jade.protobuf.Perso" + "nH\000\022%\n\003dog\030\003 \001(\0132\026.com.jade.protobuf.Dog" + "H\000\022%\n\003cat\030\004 \001(\0132\026.com.jade.protobuf.CatH" + "\000\"4\n\010DataType\022\016\n\nPersonType\020\001\022\013\n\007DogType" + "\020\002\022\013\n\007CatType\020\003B\n\n\010dataBody\"4\n\006Person\022\014\n" + "\004name\030\001 \001(\t\022\013\n\003age\030\002 \001(\005\022\017\n\007address\030\003 \001(" + "\t\" \n\003Dog\022\014\n\004name\030\001 \001(\t\022\013\n\003age\030\002 \001(\005\"!\n\003C" + "at\022\014\n\004name\030\001 \001(\t\022\014\n\004city\030\002 \001(\tB!\n\021com.ja" + "de.protobufB\nPersonInfoH\001" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }); internal_static_com_jade_protobuf_MyMessage_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_com_jade_protobuf_MyMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_jade_protobuf_MyMessage_descriptor, new java.lang.String[] { "DataType", "Person", "Dog", "Cat", "DataBody", }); internal_static_com_jade_protobuf_Person_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_com_jade_protobuf_Person_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_jade_protobuf_Person_descriptor, new java.lang.String[] { "Name", "Age", "Address", }); internal_static_com_jade_protobuf_Dog_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_com_jade_protobuf_Dog_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_jade_protobuf_Dog_descriptor, new java.lang.String[] { "Name", "Age", }); internal_static_com_jade_protobuf_Cat_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_com_jade_protobuf_Cat_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_jade_protobuf_Cat_descriptor, new java.lang.String[] { "Name", "City", }); } // @@protoc_insertion_point(outer_class_scope) }
[ "602423940@qq.com" ]
602423940@qq.com
e551be587e486cc68937b57625976176ca7930f9
147885d7eb4527c20b561af7d1dc0b38312bc39f
/src/main/java/lense/compiler/LenseNumericBoundsSpecification.java
6dff2689f611fb1b3d0c537256786f704f5cd0bf
[]
no_license
sergiotaborda/lense-lang
931d5afd81df307f81e5770f5f8a3cbbab800f23
472c4fc038f3c1fb3514c56f7ec77bfaa279560e
refs/heads/master
2023-01-31T06:12:16.812809
2023-01-05T17:55:12
2023-01-05T17:55:12
44,053,128
2
0
null
2023-01-05T17:55:13
2015-10-11T13:29:13
Java
UTF-8
Java
false
false
2,312
java
package lense.compiler; import java.math.BigDecimal; import java.util.List; import java.util.Map; import compiler.lexer.ScanPositionHolder; import lense.compiler.type.TypeDefinition; import lense.compiler.type.variable.TypeVariable; import lense.compiler.typesystem.LenseTypeSystem; public class LenseNumericBoundsSpecification { record NumericBounds (TypeDefinition type, BigDecimal min, BigDecimal max){ public boolean contain(BigDecimal value) { if (min != null && value.compareTo(min) < 0) { return false; } else if (max != null && value.compareTo(max) > 0) { return false; } return true; } }; static List<NumericBounds> bounds = List.of( new NumericBounds(LenseTypeSystem.Int64(), BigDecimal.valueOf(Long.MIN_VALUE),BigDecimal.valueOf( Long.MAX_VALUE)), new NumericBounds(LenseTypeSystem.Int32(), BigDecimal.valueOf(Integer.MIN_VALUE),BigDecimal.valueOf( Integer.MAX_VALUE)), new NumericBounds(LenseTypeSystem.Natural(), BigDecimal.ZERO,null) ); static TypeDefinition typeFromValue(BigDecimal value) { if (!whole(value)) { return LenseTypeSystem.Rational(); } if (value.signum() < 0) { return LenseTypeSystem.Integer(); } return LenseTypeSystem.Natural(); } public static void checkInBounds(ScanPositionHolder holder, TypeVariable type, BigDecimal value) { if (type == null) { return; } for (var bound : bounds ) { if (bound.type.getName().equals(type.getTypeDefinition().getName())) { if (bound.min != null && value.compareTo(bound.min) < 0) { throw new CompilationError(holder, "Value " + value.toString() + " is too small to be hold by a " + type.toString() + "(Expected minimum : "+ bound.min + ")"); } else if (bound.max != null && value.compareTo(bound.max) > 0) { throw new CompilationError(holder, "Value " + value.toString() + " is too large to be hold by a " + type.toString() + "(Expected maximum : "+ bound.max + ")"); } } } } private static boolean whole(BigDecimal value) { return value.signum() == 0 || value.scale() <= 0 || value.stripTrailingZeros().scale() <= 0; } }
[ "sergiotaborda@yahoo.com.br" ]
sergiotaborda@yahoo.com.br
aa95887aeace457dfa0d5f87dcfd8fa9387f8258
9e7339c5ec4e6aa7d3a3a75c171d16a9243bbb88
/src/main/java/com/rabobank/customer/statementprocessor/service/ResponseBuilderService.java
5448424180a7f25a8604bb97fa2b91581c36aed1
[]
no_license
zaveethaslam/springboot-statement-processor
0794f1fa3d27cfb79bd46d8f771b9734981d3261
1c5cfc6eea64c63fb53b8750a5ca0b26c44e8786
refs/heads/master
2022-12-14T17:42:19.125966
2020-08-17T06:15:52
2020-08-17T06:15:52
287,693,110
0
0
null
null
null
null
UTF-8
Java
false
false
2,497
java
package com.rabobank.customer.statementprocessor.service; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.springframework.stereotype.Service; import com.rabobank.customer.statementprocessor.api.dto.CustomerRecord; import com.rabobank.customer.statementprocessor.api.dto.ErrorRecord; import com.rabobank.customer.statementprocessor.api.dto.ResponseMessage; @Service public class ResponseBuilderService { ValidatorService validator; public ResponseBuilderService(ValidatorService validator) { this.validator = validator; } public ResponseMessage processRecords(List<CustomerRecord> records) { return buildResponseCode(validator.validateRequest(records)); } public List<ErrorRecord> buildErrorRecords(List<CustomerRecord> list) { Set<Long> referenceSet = new HashSet<>(); return list.stream().filter(record -> referenceSet.add(record.getReference())) .map(record -> new ErrorRecord(record.getReference(), record.getAccountNumber())) .collect(Collectors.toList()); } public List<ErrorRecord> buildErrorRecordsForBothErrors(List<List<CustomerRecord>> validatedRecords) { Set<Long> referenceSet = new HashSet<>(); return validatedRecords.stream().flatMap(List::stream).filter(record -> referenceSet.add(record.getReference())) .map(record -> new ErrorRecord(record.getReference(), record.getAccountNumber())) .collect(Collectors.toList()); } public ResponseMessage buildResponseCode(List<List<CustomerRecord>> validatedRecords) { if (validatedRecords.get(0).size() == 0 && validatedRecords.get(1).size() == 0) { return ResponseMessage.builder().result("SUCCESSFUL").build(); } else if (validatedRecords.get(0).size() != 0 && validatedRecords.get(1).size() == 0) { return ResponseMessage.builder().result("DUPLICATE_REFERENCE") .errorRecords(buildErrorRecords(validatedRecords.get(0))).build(); } else if (validatedRecords.get(0).size() == 0 && validatedRecords.get(1).size() != 0) { return ResponseMessage.builder().result("INCORRECT_END_BALANCE") .errorRecords(buildErrorRecords(validatedRecords.get(1))).build(); } else if (validatedRecords.get(0).size() != 0 && validatedRecords.get(1).size() != 0) { return ResponseMessage.builder().result("DUPLICATE_REFERENCE_INCORRECT_END_BALANCE") .errorRecords(buildErrorRecordsForBothErrors(validatedRecords)).build(); } else { return ResponseMessage.builder().result("BAD_REQUEST").build(); } } }
[ "zaveethaslam@gmail.com" ]
zaveethaslam@gmail.com
d09db3d0ac44522eecb9358d22ead8968f907eeb
280ffa7e2a0ae50b33178becb69d0b7180627bf5
/src/main/java/pe/metrogo/service/IUsuarioService.java
020b1ca3a388088902863d5edeb0ac9401e3f8df
[]
no_license
carlosmatos655/Proyecto-MetroGo
c21d884003a3a82da2fc91bc13491829f156214a
6057c04ea335a26df3193ed894c213fd481fb0ac
refs/heads/master
2022-12-23T10:12:14.104443
2020-10-01T05:48:06
2020-10-01T05:48:06
296,189,230
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package pe.metrogo.service; import java.util.List; import pe.metrogo.entity.Usuario; public interface IUsuarioService { public void insertar(Usuario usuario); public List<Usuario> listar(); public List<Usuario> findByNameUsuario(Usuario usu); public void eliminar(int CUsuario); }
[ "40475823+carlosmatos655@users.noreply.github.com" ]
40475823+carlosmatos655@users.noreply.github.com
5408e756eb58c394306a23d8dbe41008143b3d5c
53e0c01c535ca4d9b1070e1bde31a440f3097404
/src/com/wjahatsyed/random/practice/new_3_package/MyClass.java
d60f31f48e315f0c71254caed0c0e965385e1000
[]
no_license
wjahatsyed/random-prac
c08d8ecb652b534d9f515ae6c4dc37a802e51153
0b4d0cc1d012fd1bd2c6d526068fda1eb9e8ce7c
refs/heads/master
2023-01-19T11:17:02.412210
2020-11-19T10:40:24
2020-11-19T10:40:24
290,463,216
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
package com.wjahatsyed.random.practice.new_3_package; /** * Created by Syed Wajahat on 8/26/2020. * A synchronized method can only be accessed by one thread at a time * Ths keyword can only be applied to methods and it works with all types of modifiers. * * Argument is defined within the method parentheses while Parameter is the value passed to the method * while invoking that specific method */ public class MyClass { public synchronized void myPublicSynchronizedMethod() { System.out.println("public synchronized method"); } }
[ "wajahat@binaryvibes.com" ]
wajahat@binaryvibes.com
847766f8286e370d624788b624eba4996227fb8d
417529a7941ca968ae4f1436b6b3f49b4193a189
/gui_react_native/android/app/src/main/java/com/gui_react_native/MainActivity.java
5959803bc1c37528f627e524cb81d0c2cce0f40d
[]
no_license
tayduivn/project_1phut_30giay
6bbcaedda5173e25a83236c7a9865e487f769d13
7a14bec8b023216815fb6eb9f0f36eb7f435d87e
refs/heads/master
2021-09-13T07:36:11.037428
2018-04-26T15:37:07
2018-04-26T15:37:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
377
java
package com.gui_react_native; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "gui_react_native"; } }
[ "38187082+phamphuchinh1606@users.noreply.github.com" ]
38187082+phamphuchinh1606@users.noreply.github.com
720fc409f321c472721bec6381b0c757c853ceb3
e2bae6535f0045788677668a8723e9e5867914c4
/Java2D/src/gui/GameWindowConfiguration.java
ce505112c054f4c5b52c800c81a15b8d4f68a95e
[]
no_license
AlexandreSanscartier/shiny-archer
7be98fdd2bdc19bbe4b0c6888d3f9a0ddc79326b
e866a45982a9267dd85c6368ef4275d39cbc8cf9
refs/heads/master
2016-09-05T13:16:10.042560
2015-05-11T20:15:33
2015-05-11T20:15:33
24,149,294
0
0
null
null
null
null
UTF-8
Java
false
false
254
java
package gui; public class GameWindowConfiguration { public GameWindowConfiguration() { title = "Default Title"; width = 800; height = 600; fullScreen = false; } public String title; public int width, height; public boolean fullScreen; }
[ "alex.sanscartier@gmail.com" ]
alex.sanscartier@gmail.com
488a3fe0784181e7797f34c9daecd7743e8341df
902e2e95243cf2864569ef72edf7e89c814c01e9
/src/main/java/com/example/demo/resource/GoldResource.java
32b20bf1063f57a909be87dd414aa87c801c0fb0
[]
no_license
Stigmag/Heroes_server
1de59769a168286c054b3b5f89de128ff23d6d95
2440ee145775343cdfe447a8b2fafdba63735926
refs/heads/master
2022-06-21T13:59:52.986711
2020-04-02T17:21:51
2020-04-02T17:21:51
247,277,455
0
0
null
2022-05-20T21:28:27
2020-03-14T13:01:13
Java
UTF-8
Java
false
false
88
java
package com.example.demo.resource; public class GoldResource extends UserResource { }
[ "katekarpenko75@gmail.com" ]
katekarpenko75@gmail.com
716501cc52d4d50a13a5fb6791ae7db58541af73
1cd773a5447548242b0715d02ef29eec2d6a5a62
/src/main/java/com/ge/healthcare/dose/services/ruleengine/NoMoreExecutorPoolSlotException.java
adbc923905c387a599a0d16501fbb6ea8cabe6c4
[ "MIT" ]
permissive
mcgivrer/RuleEngine
a852ab0452dbb71a4756fa944df0d861616fdbed
90ce7645e882572cfd2a23a815bde88402374116
refs/heads/develop
2022-06-24T02:03:00.471217
2019-09-27T21:35:13
2019-09-27T21:35:13
208,308,975
0
1
MIT
2022-05-20T21:10:51
2019-09-13T17:00:49
Java
UTF-8
Java
false
false
120
java
package com.ge.healthcare.dose.services.ruleengine; public class NoMoreExecutorPoolSlotException extends Exception { }
[ "frederic.delorme@ge.com" ]
frederic.delorme@ge.com
f72682bec6e6b854e559fbd626fdb11f5739f68f
252e198d9fb059908dc9e728ccc3605b70b8ecac
/HospitalInfectologia2018073/src/org/edwinaquino/sistema/Principal.java
917a9ed778707139490f3a5179bf20bbbe32998c
[]
no_license
EAquino073/HospitalInfectologia
14e88fa6c041611f4ef561a836c3798cf921a6d0
2dad3ee19824ea748efbf6feb2a0dd9723354c11
refs/heads/master
2022-11-16T08:43:41.837056
2020-07-10T22:05:40
2020-07-10T22:05:40
278,741,289
0
0
null
null
null
null
UTF-8
Java
false
false
4,546
java
package org.edwinaquino.sistema; import java.io.InputStream; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.fxml.JavaFXBuilderFactory; import javafx.scene.Scene; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import org.edwinaquino.controller.ContactoUrgenciasController; import org.edwinaquino.controller.MenuPrincipalController; import org.edwinaquino.controller.MedicoController; import org.edwinaquino.controller.PacientesController; import org.edwinaquino.controller.ProgramadorController; import org.edwinaquino.controller.TelefonoMedicoController; import org.edwinaquino.db.Conexion; /** * * @author programacion */ public class Principal extends Application { private final String PAQUETE_VISTA = "/org/edwinaquino/view/"; private Stage escenarioPrincipal; private Scene escena; @Override public void start(Stage escenarioPrincipal) throws Exception { try{ PreparedStatement procedimiento = Conexion.getInstancia().getConexion().prepareCall("{call sp_Buscar_Medicos(?)}"); procedimiento.setInt(1,1); ResultSet registro = procedimiento.executeQuery(); while(registro.next()){ System.out.println(registro.getInt("codigoMedico")); System.out.println(registro.getInt("licenciaMedica")); } }catch(SQLException e){ e.printStackTrace(); } this.escenarioPrincipal = escenarioPrincipal; escenarioPrincipal.setTitle("Hospital de Infectologia"); menuPrincipal(); escenarioPrincipal.show(); } public void menuPrincipal(){ try{ MenuPrincipalController menuPrincipal = (MenuPrincipalController)cambiarEscena("MenuPrincipalView.fxml",630,472); menuPrincipal.setEscenarioPrincipal(this); }catch(Exception e){ e.printStackTrace(); } } public void ventanaMedicos (){ try{ MedicoController medicoController = (MedicoController)cambiarEscena("MedicosView.fxml",734,558); medicoController.setEscenarioPrincipal(this); }catch(Exception e){ e.printStackTrace(); } } public void ventanaProgramador (){ try{ ProgramadorController programadorController = (ProgramadorController)cambiarEscena("Programador.fxml",691,459); programadorController.setEscenarioPrincipal(this); }catch(Exception e){ e.printStackTrace(); } } public void ventanaPacientes (){ try{ PacientesController pacientesController = (PacientesController)cambiarEscena("PacientesView.fxml",802,507); pacientesController.setEscenarioPrincipal(this); }catch(Exception e){ e.printStackTrace(); } } public void ventanaTelefonoMedico (){ try{ TelefonoMedicoController telefonoController = (TelefonoMedicoController)cambiarEscena("TelefonosMedicosView.fxml",600,400); telefonoController.setEscenarioPrincipal(this); }catch(Exception e){ e.printStackTrace(); } } public void ventanaContactoUrgencias (){ try{ ContactoUrgenciasController urgenciasController = (ContactoUrgenciasController)cambiarEscena("ContactoUrenciaView.fxml",656,500); urgenciasController.setEscenarioPrincipal(this); }catch(Exception e){ e.printStackTrace(); } } public Initializable cambiarEscena(String fxml, int ancho, int alto)throws Exception{ Initializable resultado = null; FXMLLoader cargadorFXML = new FXMLLoader(); InputStream archivo = Principal.class.getResourceAsStream(PAQUETE_VISTA+fxml); cargadorFXML.setBuilderFactory(new JavaFXBuilderFactory()); cargadorFXML.setLocation(Principal.class.getResource(PAQUETE_VISTA+fxml)); escena = new Scene((AnchorPane)cargadorFXML.load(archivo),ancho,alto); escenarioPrincipal.setScene(escena); escenarioPrincipal.sizeToScene(); resultado = (Initializable)cargadorFXML.getController(); return resultado; } public static void main(String[] args) { launch(args); } }
[ "gustavo073edwin@gmail.com" ]
gustavo073edwin@gmail.com
4219d996e81937aa8a66ea65fd39caa2c6cdd375
03c52791c151a837b05d4a111c3647db58c66b01
/src/main/java/com/codingtest/App.java
d07318eb95cf1c28c22d99955ccc465251cadcf7
[]
no_license
anonymousinterviewee1/ae-backend-coding-test
814d3edeed996fd87a795edafe881b57ad2e997b
f82e295afcf31bbb52f4d0b7364599998936f45e
refs/heads/main
2023-03-07T14:22:39.964865
2021-02-19T14:34:49
2021-02-19T15:03:31
340,390,189
0
0
null
null
null
null
UTF-8
Java
false
false
1,240
java
package com.codingtest; import java.io.File; import java.util.Optional; public class App { public static void main(String[] args) { final String originalFile = args[0]; final String targetFile = args[1]; final String originalElementId = args[2]; HtmlDocument originalHtmlDocument = HtmlDocument.fromFile(new File(originalFile)); Optional<HtmlElement> originalElement = originalHtmlDocument.findElementById(originalElementId); originalElement.ifPresent(original -> { System.out.println("Original element:"); System.out.println(original); System.out.println("With path: " + original.getPath()); HtmlDocument targetHtmlDocument = HtmlDocument.fromFile(new File(targetFile)); HtmlSearch htmlSearch = new HtmlSearch(); Optional<HtmlElement> mostSimilarElement = htmlSearch.findMostSimilarElement(targetHtmlDocument, original); mostSimilarElement.ifPresent(mostSimilar -> { System.out.println("The most similar found element:"); System.out.println(mostSimilar); System.out.println("With path: " + mostSimilar.getPath()); }); }); } }
[ "anonymousinterviewee@gmail.com" ]
anonymousinterviewee@gmail.com
f970ae9686b870df962c07abf70584abbe699b37
8008d9cb2e12798d31828edb939028520002cded
/testApp/gateway-test/discovery-service/src/test/java/com/mbg/otdev/discoveryservice/DiscoveryServiceApplicationTests.java
87b30d7ef37b75439f1dbf8cc9d58eefe6ac5fa2
[]
no_license
kkomhero/MDP_DEV
1e7bc9b2fa68ec1cddf702a3ed8480558253bfa4
a69ecef727a4112d4b81ead9bac47485078d5c16
refs/heads/master
2020-07-07T08:21:04.407322
2019-09-16T12:50:31
2019-09-16T12:50:31
203,301,386
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
package com.mbg.otdev.discoveryservice; // import org.junit.Test; // import org.junit.runner.RunWith; // import org.springframework.boot.test.context.SpringBootTest; // import org.springframework.test.context.junit4.SpringRunner; //@RunWith(SpringRunner.class) //@SpringBootTest public class DiscoveryServiceApplicationTests { //@Test public void contextLoads() { } }
[ "lamhirh@Lamhirh-MacBook15.local" ]
lamhirh@Lamhirh-MacBook15.local
fee85854bb0936a1cd8c8317db1029b426858826
62f8a128bc4af47176a07ab336c0717e6205b87d
/src/com/sistemasoperativos/ejercicio_nuestro/Avion.java
e468aa01783498380fc80a6e35e306a633ad5180
[]
no_license
SantiagoGianotti/ExposicionSO
ac27c5db5c540683266ee28e3405844d09ff6d15
23e606bb85a4c5416df0cc8489aac717c76e8789
refs/heads/main
2023-08-20T12:11:55.467495
2021-10-21T14:56:22
2021-10-21T14:56:22
418,274,240
0
0
null
null
null
null
UTF-8
Java
false
false
1,132
java
package com.sistemasoperativos.ejercicio_nuestro; import java.util.UUID; import java.util.concurrent.Semaphore; public class Avion extends Thread { Estado estado; Semaphore pistasDisponibles; int id; public Avion(int id, Estado estado) { this.id = id; this.estado = estado; } @Override public void run() { try { System.out.println( "La torre reservo la pista para el avion["+this.id + "] que desea " + (this.estado == Estado.ATERRIZANDO? "ATERRIZAR" : "DESPEGAR") ); System.out.println("Pistas disponibles:" + pistasDisponibles.availablePermits()); //Tiempo que permanece en pista un avion sleep(4500/2); System.out.println( "El avion["+this.id + "] salio de pista \n Pistas disponibles: " + (pistasDisponibles.availablePermits() +1)); //El avion ya uso la pista y la libera. pistasDisponibles.release(); } catch (InterruptedException e) { System.out.println("Excepcion en avion"); } } public void setAvionesEnPista(Semaphore pistasDisponibles) { this.pistasDisponibles = pistasDisponibles; } @Override public String toString() { return "Avion["+id+"]: " +estado; } }
[ "sjgianotti@hotmail.com" ]
sjgianotti@hotmail.com
a6cdb9e1267bef0371e0446852478d7ea46420c2
f615bb99378931d7c4b7ea4abb793a50764e0f73
/HORLER/DeQueue.java
9cf2af0ee0ab3489014ac7975294adaa29bf2159
[ "Apache-2.0" ]
permissive
PramodJana/java
8a17f6994fd00754fb045a555051b074ca5918fb
9880581d3eb7031d735ffc44ce1ef59faa8f484f
refs/heads/master
2021-07-20T09:37:12.022473
2020-05-21T14:51:44
2020-05-21T14:51:44
166,330,775
1
0
null
null
null
null
UTF-8
Java
false
false
1,462
java
import java.util.*; class DeQueue { int cap; int ele[] =new int [cap]; int front ,rear; DeQueue(int max) { cap=max; front =-1; rear=-1; } void pushfront(int v) { if(front ==0) { System.out.println("FULL FROM FRONT "); } else { front --; ele[front]=v; } } int popfront() { int result; if(front ==-1) { return -999; } else if(front ==rear) { result= ele[front]; front =-1; return result; } else { result=ele[front]; front ++; return result; } } void pushrear(int v) { if(rear ==-1) { rear=0; front =0; ele[rear]=v; } else if(rear ==(cap-1)) { System.out.println("FULL FROM REAR"); } else { rear =rear+1; ele[rear]=v; } } int poprear() { int result; if(rear== -1) { return -999; } else if(rear ==0) { result =ele[rear]; rear = -1; return result; } else { result=ele[rear]; rear =rear-1; return result; } } }
[ "pramodjana395@gmail.com" ]
pramodjana395@gmail.com
eb8e0db0a954167124c59190f1096d6a7b5e3332
e37dc07cad20bfd2da5506d2d1d4f7e55cc0118e
/app/src/main/java/br/edu/iff/cagadodefome/ListaInicialActivity.java
d4f31c93b0b7aae885455e21ef3c22df55db5c44
[]
no_license
tuliodutra27/CagadodeFome
15355d1563d64daa04322dc1713c103d8ee66067
36794f051676a6ecd2f203c263527c3995878dd0
refs/heads/master
2021-08-08T13:32:07.032207
2017-11-08T15:15:28
2017-11-08T15:15:28
107,936,457
0
0
null
null
null
null
UTF-8
Java
false
false
2,846
java
package br.edu.iff.cagadodefome; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by kamik on 22/10/2017. */ public class ListaInicialActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); setContentView(R.layout.content_main); //código para a lista ListView lista = (ListView) findViewById(R.id.listaInicial); List<Estabelecimento> estabelecimentos = todosOsEstabelecimentos(); AdapterListaInicial adapterListaInicial = new AdapterListaInicial(estabelecimentos, this); lista.setAdapter(adapterListaInicial); lista.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent; switch(position){ case 0: intent = new Intent(getBaseContext(), ListaPizzariasActivity.class); startActivity(intent); break; case 1: intent = new Intent(getBaseContext(), ListaPizzariasActivity.class); startActivity(intent); break; case 2: intent = new Intent(getBaseContext(), ListaPizzariasActivity.class); startActivity(intent); break; case 3: intent = new Intent(getBaseContext(), ListaPizzariasActivity.class); startActivity(intent); break; case 4: intent = new Intent(getBaseContext(), MainActivity.class); startActivity(intent); break; } } }); } private List<Estabelecimento> todosOsEstabelecimentos(){ return new ArrayList<>(Arrays.asList( new Estabelecimento("Pizzas", 0, R.drawable.pizza), new Estabelecimento("Lanches", 1, R.drawable.hamburger), new Estabelecimento("Bebidas", 2, R.drawable.bebida1), new Estabelecimento("Ajuda", 3, android.R.drawable.ic_menu_help), new Estabelecimento("Configurações", 4, android.R.drawable.ic_menu_manage))); } }
[ "tuliodutra27@gmail.com" ]
tuliodutra27@gmail.com
6916ca819f7123b5ff8a19f2151b8114f9b51b1d
33461c1771410f9ff381737115cec194d94924fb
/day06-Class/src/practice/methods/VarietyMethods.java
f8fe6ac80c084f9ddab8de439017409f9381a213
[]
no_license
LeeKwonWoo/02_java
85016ad978b57b935177989b605108cb21825fa0
fba06ffdd9750de542a050e01560a67e6e2a6567
refs/heads/master
2020-06-14T22:19:52.982542
2019-07-26T07:06:34
2019-07-26T07:06:34
195,142,847
0
0
null
null
null
null
UTF-8
Java
false
false
6,226
java
package practice.methods; /** * 메소드 작성 실습 클래스 * * @author HannaC * */ public class VarietyMethods { /** * 화면에 hello, world! 를 출력하는 메소드 */ public void sayHello() { System.out.println("hello, world!"); } /** * 매개변수로 * 유명인(명사) 의 이름을 입력(name) 받고 * 그 사람이 한 유명한 문구(maxim)를 입력 받아 * * OOO(이)가 말하길 "....." 라고 하였다. * 라는 문장을 출력하는 메소드 * maxims 를 정의하라 */ public void maxims(String name, String maxim) { System.out.printf("%s (이)가 말하길%n" + "\"%s\" 라고 하였다.%n" , name, maxim); } /** * 입력된 화씨온도를 섭씨온도로 변환하여 * 변환된 섭씨온도를 리턴하는 메소드 * fahToCel 을 디자인 * * 변환 공식 : 5 / 9 * (F - 32) * * @param fah : double : 변환할 화씨 온도 값 * @return 변환된 섭씨 온도 값 */ public double fahToCel(double fah) { return 5.0 / 9.0 * (fah - 32); } // ========================================================= /** * 어떤 사람의 이름, 생년, 출생월을 매개변수로 입력받아 * * OOO는 XXXX년 XX월 생입니다. * * 라는 문장으로 출력하는 * birthYearMonth 라는 메소드를 정의하시오. * @param name : String * @param year : int * @param month : int */ public void birthYearMonth(int year, int month,String name) { System.out.printf("%s 는 %d 년 %d 월 생입니다.%n",name,year,month); } /** * 출력할 단의 숫자를 입력받아 * 해당 단의 구구단을 출력하는 메소드 * * 출력의 첫 줄에 X 단 이라는 제목을 출력 * * printNineNineTable 을 디자인 * @param stage : int */ public void printNineNineTable(int stage) { for (int idx = 1; idx <= 9; idx++) { System.out.println(stage+"X"+idx+"="+(stage*idx)); } } /** * 출력할 단의 숫자를 가지고 있는 int 배열을 * 매개변수로 입력받아 * 입력된 배열의 원소인 각 숫자에 대해 * 구구단을 출력하는 메소드 * printNineNineTableArray 를 정의하시오. * @param stages : int[] 배열 */ public void printNineNineTableArray(int[] stages) { for (int idx = 0; idx < stages.length; idx++) { for (int idn = 1; idn <= 9; idn++) { System.out.println(stages[idx]+"X"+idn+"="+(stages[idx]*idn)); } } } /** * 키(cm), 몸무게(kg)을 매개변수로 입력받아 * BMI 지수를 계산하여 비만도 판정 결과를 리턴하는 메소드 * calcBmi 를 정의하시오 * * 몸무게(kg) / 키(m)의 제곱 * * 15.0미만 병적인 저체중 * 15.0이상 18.5미만 저체중 * 18.5이상 23.0미만 정상 * 23.0이상 27.5이하 과체중 * 27.5초과 40.0이하 비만 * 40.0초과 병적인 비만 * * @param height : double * @param weight : double * @return String 비만도 판정 결과 문자열 */ public String calcBmi(double height, double weight) { double bmi = weight / (height * height) * 10000; String result; // 3. 사용 if (bmi < 15.0) { return result = "병적인 저체중"; } else if (bmi >= 15.0 && bmi < 18.5) { return result = "저체중"; } else if (bmi >= 18.5 && bmi < 23.0) { return result = "정상"; } else if (bmi >= 23.0 && bmi <= 27.5) { return result = "과체중"; } else if (bmi > 27.5 && bmi <= 40.0) { return result = "비만"; } else { return result = "병적인 비만"; } } /** * 입력된 두 정수 중에서 작은 수를 찾아 리턴하는 메소드 * min 을 정의하시오 * @param input1 * @param input2 * @return int 둘 중 작은 정수 */ public int min(int input1, int input2) { if (input1 > input2) { return input2; } else { return input1; } } /** * 입력된 두 정수 중에서 큰 수를 찾아 리턴하는 메소드 * max 를 정의하시오 * @param input1 : int * @param input2 : int * @return int 둘 중 큰 정수 */ public int max(int input1, int input2) { if (input1 > input2) { return input1; } else { return input2; } } /** * 정수가 저장된 int 배열을 매개변수로 입력받아 * 그 배열의 각 원소의 합을 구하여 리턴하는 메소드 * sumOfArray 를 디자인 * @param numbers : int[] (int 배열) * @return int[] 배열의 각 원소의 합 */ public int sumOfArray(int[] numbers) { int sum = 0; for (int idx = 0; idx < numbers.length; idx++) { sum += numbers[idx]; } return sum; } /** * 정수가 저장된 int 배열을 매개변수로 입력받아 * 그 배열의 각 원소들의 평균을 구하여 리턴하는 메소드 * avgOfArray 를 디자인 * @param numbers : int[] (int 배열) * @return double 배열의 각 원소의 평균 */ public double avgOfArray(int[] numbers) { int sum = 0; double avg = 0.0; // 1. 배열 원소의 총합 for (int idx = 0; idx < numbers.length; idx++) { sum += numbers[idx]; } // 2. 총합/원소의 갯수 ==> 평균 avg = (double)sum / numbers.length; return avg; } /** * char 타입의 연산자와 두 개의 정수를 * 매개변수로 입력받아 * * 입력된 연산자가 '+' 일 때만 * 두 정수의 합을 구하여 덧셈의 결과를 * * 출력하는 메소드 adder 를 디자인 * 출력 형태 예) 10 + 20 = 30 * @param op : char * @param x : int * @param y : int */ public void adder (int x,int y,char op) { if (op == '+') { System.out.println(x+"+"+y+"="+(x+y)); } } public double arithmetic (double x, double y, char op) { if (op == '+') { return x+y; } else if (op == '-') { return x-y; } else if (op == '*') { return x*y; } else if (op == '/') { return x/y; } return 0; } }
[ "kenu12@Naver.com" ]
kenu12@Naver.com
90cd78d78ac616e6b4c961efdda2c04a489ec157
a633ae7333e6674c574836908b1a2cb9b35421b7
/QRcode_iteration2/qrcodelibrary/src/main/java/com/google/zxing/multi/GenericMultipleBarcodeReader.java
058be2d62c3f3bfb80f3cc798d0fe1ea9e47f40c
[]
no_license
buptssemx/Inspection_System
d639c872e26408ad217061ce88dcc3012043bc2b
647dcc7b6e316788130dadfdce5aef1dd14cdd6c
refs/heads/master
2020-04-11T21:46:14.054404
2018-08-31T08:39:34
2018-08-31T08:39:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,545
java
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package com.google.zxing.multi; import com.google.zxing.BinaryBitmap; import com.google.zxing.NotFoundException; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.Result; import com.google.zxing.ResultPoint; import com.google.zxing.multi.MultipleBarcodeReader; import java.util.Hashtable; import java.util.Vector; public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader { private static final int MIN_DIMENSION_TO_RECUR = 100; private final Reader delegate; public GenericMultipleBarcodeReader(Reader delegate) { this.delegate = delegate; } public Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException { return this.decodeMultiple(image, (Hashtable)null); } public Result[] decodeMultiple(BinaryBitmap image, Hashtable hints) throws NotFoundException { Vector results = new Vector(); this.doDecodeMultiple(image, hints, results, 0, 0); if(results.isEmpty()) { throw NotFoundException.getNotFoundInstance(); } else { int numResults = results.size(); Result[] resultArray = new Result[numResults]; for(int i = 0; i < numResults; ++i) { resultArray[i] = (Result)results.elementAt(i); } return resultArray; } } private void doDecodeMultiple(BinaryBitmap image, Hashtable hints, Vector results, int xOffset, int yOffset) { Result result; try { result = this.delegate.decode(image, hints); } catch (ReaderException var19) { return; } boolean alreadyFound = false; for(int resultPoints = 0; resultPoints < results.size(); ++resultPoints) { Result width = (Result)results.elementAt(resultPoints); if(width.getText().equals(result.getText())) { alreadyFound = true; break; } } if(!alreadyFound) { results.addElement(translateResultPoints(result, xOffset, yOffset)); ResultPoint[] var20 = result.getResultPoints(); if(var20 != null && var20.length != 0) { int var21 = image.getWidth(); int height = image.getHeight(); float minX = (float)var21; float minY = (float)height; float maxX = 0.0F; float maxY = 0.0F; for(int i = 0; i < var20.length; ++i) { ResultPoint point = var20[i]; float x = point.getX(); float y = point.getY(); if(x < minX) { minX = x; } if(y < minY) { minY = y; } if(x > maxX) { maxX = x; } if(y > maxY) { maxY = y; } } if(minX > 100.0F) { this.doDecodeMultiple(image.crop(0, 0, (int)minX, height), hints, results, xOffset, yOffset); } if(minY > 100.0F) { this.doDecodeMultiple(image.crop(0, 0, var21, (int)minY), hints, results, xOffset, yOffset); } if(maxX < (float)(var21 - 100)) { this.doDecodeMultiple(image.crop((int)maxX, 0, var21 - (int)maxX, height), hints, results, xOffset + (int)maxX, yOffset); } if(maxY < (float)(height - 100)) { this.doDecodeMultiple(image.crop(0, (int)maxY, var21, height - (int)maxY), hints, results, xOffset, yOffset + (int)maxY); } } } } private static Result translateResultPoints(Result result, int xOffset, int yOffset) { ResultPoint[] oldResultPoints = result.getResultPoints(); ResultPoint[] newResultPoints = new ResultPoint[oldResultPoints.length]; for(int i = 0; i < oldResultPoints.length; ++i) { ResultPoint oldPoint = oldResultPoints[i]; newResultPoints[i] = new ResultPoint(oldPoint.getX() + (float)xOffset, oldPoint.getY() + (float)yOffset); } return new Result(result.getText(), result.getRawBytes(), newResultPoints, result.getBarcodeFormat()); } }
[ "853740100@qq.com" ]
853740100@qq.com
2c3a934e94a8aeff4b0f0df1713ec901aae98ed2
035ce2c447eaaf6c0e45f1bc43ec6c083f10882d
/zeromeaner-core/src/main/java/org/zeromeaner/gui/common/JTextComponentOutputStream.java
71a224f08e80bb755d5dfa4f4a4ace7452be23ff
[ "BSD-3-Clause" ]
permissive
zeromeaner/zeromeaner
37ed00fc98f8df6ea889a427c00fdb1a8e81d9e6
882826aab6463333a90bc43f575fe3c14e6cb375
refs/heads/master
2021-01-20T08:19:15.638647
2015-09-30T08:15:24
2015-09-30T08:15:24
29,566,514
3
1
null
null
null
null
UTF-8
Java
false
false
1,577
java
package org.zeromeaner.gui.common; import java.awt.EventQueue; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; import javax.swing.text.JTextComponent; public class JTextComponentOutputStream extends OutputStream { private JTextComponent text; private boolean oneline; public JTextComponentOutputStream(JTextComponent text, boolean oneline) { this.text = text; this.oneline = oneline; } @Override public void write(final int b) { if(EventQueue.isDispatchThread()) { String t = text.getText() + (char) (0xff & b); if(oneline && t.indexOf('\n') != t.lastIndexOf('\n')) t = t.substring(t.indexOf('\n') + 1); text.setText(t); text.repaint(); } else try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { write(b); } }); } catch (InvocationTargetException e) { } catch (InterruptedException e) { } } @Override public void write(final byte[] b, final int off, final int len) { if(EventQueue.isDispatchThread()) { StringBuilder sb = new StringBuilder(); for(int i = 0; i < len; i++) sb.append((char) (0xff & b[off + i])); String t = text.getText() + sb; if(oneline && t.indexOf('\n') != t.lastIndexOf('\n')) t = t.substring(t.indexOf('\n') + 1); text.setText(t); text.repaint(); } else try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { write(b, off, len); } }); } catch (InvocationTargetException e) { } catch (InterruptedException e) { } } }
[ "robin@robinkirkman.com" ]
robin@robinkirkman.com
0b1d604c292610db83426c1f56c061c8f67892ec
8e03ab726dbf9e6f73d429ba21526fc79538d550
/Point.java
ec3b707aee2969ffc879d83662dd98f3f4a017cc
[]
no_license
sharique1006/Topological-Triangulation-Using-Graph-Theory
de05ffd8de76a9d6499245ccc409bbeff32b2d6e
7a2970d6c232fcba1b5ca7a6aad3a5b442547357
refs/heads/master
2022-09-17T19:17:27.445093
2020-05-29T05:14:37
2020-05-29T05:14:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
public class Point implements PointInterface { float X, Y, Z; float[] XYZ; public Point(float x, float y, float z) { this.X = x; this.Y = y; this.Z = z; } public float getX() { return X; } public float getY() { return Y; } public float getZ() { return Z; } public float[] getXYZcoordinate() { XYZ[0] = X; XYZ[1] = Y; XYZ[2] = Z; return XYZ; } public int compareTo (Point pt) { if(X == pt.X && Y == pt.Y && Z == pt.Z) { return 1; } else { return 0; } } }
[ "noreply@github.com" ]
noreply@github.com
0cf91990b2560f036efaecef6170bb3da5b79371
0bd196b80d4dec77165885af7324a2e5f32ed82c
/notificacion/src/main/java/com/tfg/notificacion/client/UserFeignClientInterceptor.java
34ee4e7bd46468d66f71c4a4db9976dab3f52d41
[]
no_license
FreddyGonzalez/TFG
afd22146e44ec88de8fb59a98f53d6a2af4a2c5e
b97c1e89ee992b4d3f8d33213490a0a1c809edf6
refs/heads/main
2023-07-14T21:24:40.354338
2021-09-09T21:54:56
2021-09-09T21:54:56
400,784,032
0
0
null
null
null
null
UTF-8
Java
false
false
626
java
package com.tfg.notificacion.client; import com.tfg.notificacion.security.SecurityUtils; import feign.RequestInterceptor; import feign.RequestTemplate; import org.springframework.stereotype.Component; @Component public class UserFeignClientInterceptor implements RequestInterceptor { private static final String AUTHORIZATION_HEADER = "Authorization"; private static final String BEARER = "Bearer"; @Override public void apply(RequestTemplate template) { SecurityUtils.getCurrentUserJWT() .ifPresent(s -> template.header(AUTHORIZATION_HEADER,String.format("%s %s", BEARER, s))); } }
[ "arielgonzalez344@gmail.com" ]
arielgonzalez344@gmail.com
44ddefd2c179a55fbe434f6e40239c00840777e3
3266d8455d9b127755b77d252fbb80f806e3354c
/src/com/example/neon_stingray_test/api/Parser.java
c98439f6165ea106df44c0c00f843c43919c0a68
[]
no_license
YourTradingSystems/neon_stingray_test
90d1bf91f5a26957a90157f2bbd4acd153d6f97e
7fe86b4e78caa963fd582ceb60fc348bb2eccad6
refs/heads/master
2021-01-10T21:05:23.585955
2014-06-29T19:11:26
2014-06-29T19:11:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,801
java
package com.example.neon_stingray_test.api; import com.example.neon_stingray_test.core.CaseModel; import com.example.neon_stingray_test.core.ScenarioModel; import com.example.neon_stingray_test.global.Constants; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.text.ParseException; import java.util.ArrayList; /** * User: ZOG * Date: 26.03.14 * Time: 15:54 */ abstract class Parser { protected static final ArrayList<ScenarioModel> parseScenarios(final String _response) throws JSONException, ParseException { final ArrayList<ScenarioModel> scenarios = new ArrayList<ScenarioModel>(); final JSONObject jsonObj = new JSONObject(_response); final JSONArray jaScenarios = jsonObj.getJSONArray(Constants.KEY_SCENARIOS); for (int i = 0; i < jaScenarios.length(); i++) { final JSONObject scenario = jaScenarios.getJSONObject(i); final ScenarioModel scenariosModel = parseScenarioModel(scenario); scenarios.add(scenariosModel); } return scenarios; } /** * Parse ScenarioModel. Helper method. * @param scenario json obj with scenario data. * @return new ScenarioModel. */ private static final ScenarioModel parseScenarioModel(final JSONObject scenario) throws JSONException { final String text = scenario.getString(Constants.KEY_TEXT); final String id = scenario.getString(Constants.KEY_ID); final String caseId = scenario.getString(Constants.KEY_CASE_ID); final ScenarioModel scenariosModel = new ScenarioModel(); scenariosModel.text = text; scenariosModel.id = id; scenariosModel.caseId = caseId; return scenariosModel; } /** * Parse response from cases request. Uses parseScenarioModel() for parsing answers. * @param _response string from response. * @return * @throws JSONException */ protected static final CaseModel parseCases(final String _response) throws JSONException { final JSONObject jsonObj = new JSONObject(_response); final JSONObject jCase = jsonObj.getJSONObject(Constants.KEY_CASE); //parsing main data final String text = jCase.getString(Constants.KEY_TEXT); final String imgUrl = jCase.getString(Constants.KEY_IMAGE); final String id = jCase.getString(Constants.KEY_ID); //parsing answers final ArrayList<ScenarioModel> answers = new ArrayList<ScenarioModel>(); final JSONArray jaAnswers = jCase.optJSONArray(Constants.KEY_ANSWERS); if (jaAnswers != null) { for (int i = 0; i < jaAnswers.length(); i++) { final ScenarioModel answer = parseScenarioModel(jaAnswers.getJSONObject(i)); answers.add(answer); } } //add parsed data to model final CaseModel caseModel = new CaseModel(); caseModel.text = text; caseModel.imgUrl = imgUrl; caseModel.id = id; caseModel.answers = answers; return caseModel; } }
[ "zdesbulbac9i@gmail.com" ]
zdesbulbac9i@gmail.com