blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ede2eb6e0ebb77eeaca74b8ed4fa670222af1130 | 26bdf376e640cb5e6abc94019645a99ace3efd96 | /src/com/Mani/java/ControllerServlet.java | 7e1605474ff6e0e6d1894d2b3f6df958a1564c20 | [] | no_license | manikantarss/Mani_MVC_Proj | 1116c7be0781aa8da39288b762b6db8d22965327 | ca24ae5fea10428a8d7fa599ff84c6c1650cfd8b | refs/heads/master | 2021-01-10T19:33:41.390353 | 2015-03-18T10:48:12 | 2015-03-18T10:48:12 | 32,454,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,480 | java | package com.rohit.java;
import java.io.IOException;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.rohit.java.RegBean;
import com.rohit.java.Constants;
import com.rohit.java.ContactBean;
/**
* Servlet implementation class ControllerServlet
*/
public class ControllerServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ControllerServlet() {
super();
// TODO Auto-generated constructor stub
}
@Override
public void init() throws ServletException {
// TODO Auto-generated method stub
super.init();
}
@Override
public void destroy() {
// TODO Auto-generated method stub
super.destroy();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("inside doGet() of CS");
process(request,response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("inside doPost() of CS");
process(request,response);
}
protected void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("inside process() of CS");
String uri = request.getRequestURI();
RequestDispatcher rd = null;
System.out.println(uri);
Model m = new Model() ;
HttpSession session = request.getSession();
if(uri.contains("/openRegView"))
{
rd = request.getRequestDispatcher("/Register.jsp");
rd.forward(request, response);
}
if(uri.contains("/openLoginView"))
{
rd = request.getRequestDispatcher("/Login.jsp");
rd.forward(request, response);
}
if(uri.contains("/register"))
{
System.out.println("inside if block of /register");
RegBean rb = (RegBean) request.getAttribute("reg");
String result = m.register(rb);
if(result.equals(Constants.SUCCESS))
{
request.setAttribute("message", "Registration has succeeded! You can now login!!");
rd = request.getRequestDispatcher("/LoginSuccess.jsp");
rd.forward(request, response);
}
else
{
request.setAttribute("errorMsg", result);
rd = request.getRequestDispatcher("/Register.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/login"))
{
System.out.println("inside if block of /login");
LogBean lb =(LogBean)request.getAttribute("log");
System.out.println(lb);
String result = m.login(lb);
System.out.println(result);
if(result.equals(Constants.SUCCESS))
{
session.setAttribute("email",lb.getEmail());
session.setAttribute("pass", lb.getPass());
request.setAttribute("message", "Login Sucessfull");
RegBean bean = m.getUserDetails(lb.getEmail());
session.setAttribute("uname", bean.getName());
String mail=(String)session.getAttribute("email");
System.out.println(mail);
System.out.println("compare "+mail.contains("admin"));
if(mail.contains("admin"))
{
rd = request.getRequestDispatcher("AdminMenu.jsp");
rd.forward(request, response);
}
else
{
rd = request.getRequestDispatcher("Menu.jsp");
rd.forward(request, response);
}
}
else
{
request.setAttribute("errorMsg", result);
rd = request.getRequestDispatcher("/Login.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/logout"))
{ System.out.println("inside /logout of CS");
System.out.println(session.getId());
rd = request.getRequestDispatcher("Logout.jsp");
rd.forward(request, response);
}
if(uri.contains("/editAcc"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /editacc");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{ System.out.println("inside else block of /editacc");
String email = (String) s.getAttribute("email");
RegBean bean = m.getUserDetails(email);
System.out.println(bean);
request.setAttribute("userDetails", bean);
rd = request.getRequestDispatcher("EditAccount.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/updateRegister"))
{
System.out.println("inside if block of updateReg" );
RegBean rb=(RegBean) request.getAttribute("update");
System.out.println(rb);
session.setAttribute("uname", rb.getName());
String result=m.updateRegister(rb);
if(result.equals(Constants.SUCCESS))
{
System.out.println("Update Successfull");
request.setAttribute("message", "Modification Successfull");
rd=request.getRequestDispatcher("Message.jsp");
rd.forward(request, response);
}else
{
System.out.println("Update failed");
request.setAttribute("errorMsg", result);
rd=request.getRequestDispatcher("Message.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/listUser"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /listuser");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside if block of /listUser");
List<RegBean> users = m.listUsers();
System.out.println(users);
request.setAttribute("list", users);
rd = request.getRequestDispatcher("ListUsers.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/deleteUser"))
{
System.out.println("inside /deleteUser of CS");
System.out.println(session.getAttribute("email"));
if(session==null||session.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside deluser uri if case");
String sl_no = (String) request.getParameter("Csl_no");
System.out.println(sl_no);
String result = m.delUsers(sl_no);
System.out.println(result);
if(result.equals(Constants.SUCCESS))
{
System.out.println("inside ifblock of /delUser");
request.setAttribute("message", "User Deleted successfully");
rd = request.getRequestDispatcher("/listUser.do");
rd.forward(request, response);
}
else
{
request.setAttribute("errorMsg", result);
rd = request.getRequestDispatcher("/AdminSuccessView.jsp");
rd.forward(request, response);
}
}
}
if(uri.contains("/searchUser"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /searchUser");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside /searchuser of CS");
rd = request.getRequestDispatcher("SearchUser.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/searchuser"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /searchUser");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside /Search of CS");
String value=request.getParameter("search");
String searchstr=request.getParameter("searchStr");
System.out.println(value);
System.out.println(searchstr);
List<RegBean> users = m.searchUser(value,searchstr);
System.out.println(users);
if(users.isEmpty())
{
request.setAttribute("errorMsg", "No match Found");
rd = request.getRequestDispatcher("/AdminSuccessView.jsp");
rd.forward(request, response);
}else{
request.setAttribute("Slist1", users);
System.out.println("forwarding");
rd = request.getRequestDispatcher("SearchUser.jsp");
rd.forward(request, response);
System.out.println("forwarded");
}
}
}
if(uri.contains("/openAddContactView"))
{
HttpSession s = request.getSession(false);
System.out.println("inside /addcontact of CS");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside /openAddContactView uri if case");
rd = request.getRequestDispatcher("/AddContact.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/addContact"))
{
HttpSession s = request.getSession(false);
System.out.println("inside /addcontact of CS");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
String email = (String) session.getAttribute("email");
System.out.println("inside /addContact uri if case");
ContactBean cb = (ContactBean) request.getAttribute("contact");
System.out.println(cb);
String result = m.addContact(cb,email);
if(result.equals(Constants.SUCCESS))
{
System.out.println("inside ifblock of /addcontact");
request.setAttribute("message", "Contact added successfully");
rd = request.getRequestDispatcher("/AddContact.jsp");
rd.forward(request, response);
}
else
{
request.setAttribute("errorMsg", result);
rd = request.getRequestDispatcher("/AddContact.jsp");
rd.forward(request, response);
}
}
}
if(uri.contains("/openListContact"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /listCont");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside else block of /listContact");
String email = (String)session.getAttribute("email");
List<ContactBean> users = m.listContacts(email);
System.out.println(users);
if(users.isEmpty())
{
System.out.println("list empty");
request.setAttribute("errorMsg", "List Empty");
rd = request.getRequestDispatcher("Message.jsp");
rd.forward(request, response);
}else{
request.setAttribute("list1", users);
rd = request.getRequestDispatcher("ListContacts.jsp");
rd.forward(request, response);
}}
}
if(uri.contains("/editContactView"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /editContact");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{ System.out.println("inside else block of /editContact");
String sl_no = (String) request.getParameter("Csl_no");
session.setAttribute("csl_no", sl_no);
System.out.println(sl_no);
ContactBean bean = m.getContactDetails(sl_no);
System.out.println(bean);
request.setAttribute("contactDetails", bean);
rd = request.getRequestDispatcher("EditContact.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/updateContacts"))
{
System.out.println("inside if block of updateContacts" );
ContactBean cb=(ContactBean) request.getAttribute("updateC");
System.out.println(cb);
String sl_no = (String) session.getAttribute("csl_no");
System.out.println(sl_no);
String result=m.updateContact(cb,sl_no);
if(result.equals(Constants.SUCCESS))
{
System.out.println("Update Successfull");
request.setAttribute("message", "Modification Successfull");
rd=request.getRequestDispatcher("Message.jsp");
rd.forward(request, response);
}else
{
System.out.println("Update failed");
request.setAttribute("errorMsg", result);
rd=request.getRequestDispatcher("Message.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/searchContact"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /searchContact");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside /searchContact of CS");
rd = request.getRequestDispatcher("SearchContact.jsp");
rd.forward(request, response);
}
}
if(uri.contains("/Search"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /search");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside /Search of CS");
String value=request.getParameter("search");
String searchstr=request.getParameter("searchStr");
String email =(String)session.getAttribute("email");
System.out.println(value);
System.out.println(searchstr);
List<ContactBean> users = m.searchContacts(value,searchstr,email);
System.out.println(users);
if(users.isEmpty())
{
request.setAttribute("errorMsg", "No match Found");
rd = request.getRequestDispatcher("/Message.jsp");
rd.forward(request, response);
}else{
request.setAttribute("Slist", users);
System.out.println("forwarding");
rd = request.getRequestDispatcher("SearchContact.jsp");
rd.forward(request, response);
System.out.println("forwarded");
}
}
}
if(uri.contains("/deleteContact"))
{
HttpSession s = request.getSession(false);
System.out.println("inside /deleteContact of CS");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside delContact uri if case");
String sl_no = (String) request.getParameter("Csl_no");
System.out.println(sl_no);
//ContactBean cb = (ContactBean) request.getAttribute("delcontact");
String result = m.delContact(sl_no);
System.out.println(result);
if(result.equals(Constants.SUCCESS))
{
System.out.println("inside ifblock of /delcontact");
request.setAttribute("message", "Contact Deleted successfully");
rd = request.getRequestDispatcher("/openListContact.do");
rd.forward(request, response);
}
else
{
request.setAttribute("errorMsg", result);
rd = request.getRequestDispatcher("/Message.jsp");
rd.forward(request, response);
}
}
}if(uri.contains("/bdayRmndr"))
{
HttpSession s = request.getSession(false);
System.out.println(s);
System.out.println("inside if block of /bdayrmndr");
System.out.println(s.getAttribute("email"));
if(s==null||s.getAttribute("email")==null)
{
request.setAttribute("errorMsg", "Your session does not exist. Please login again");
rd = request.getRequestDispatcher("Error.jsp");
rd.forward(request, response);
}
else
{
System.out.println("inside else block /bdayrmndr of CS");
String email = (String)session.getAttribute("email");
List<ContactBean> birthdayList = m.bdayRmndr(email);
System.out.println(birthdayList);
if(birthdayList.isEmpty()){
request.setAttribute("errorMsg","NO birthdays in next 7 Days");
rd = request.getRequestDispatcher("Message.jsp");
rd.forward(request, response);
}else{
request.setAttribute("blist", birthdayList);
System.out.println("forwarding");
rd = request.getRequestDispatcher("listOfBirthdays.jsp");
rd.forward(request, response);
System.out.println("forwarded");
}
}
}
}
}
| [
"manikanta.rss@gmail.com"
] | manikanta.rss@gmail.com |
933c618ab73ca05c68813aec564fdfee66d5b053 | 10697769ce2ed334a99ff0ccc47608a739aaf608 | /src/gov/usgs/earthquake/product/Content.java | e2d1f56185cbd9d6234b35bca865e972410b41c3 | [
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | shankarlaldhakar/pdl | 9db5a31b7534d2c8f7bad8ce83149e39c9016258 | b68797b894a834accaef630f8a7e6646c35c5c3f | refs/heads/master | 2021-01-13T16:15:58.876717 | 2017-01-11T22:42:08 | 2017-01-11T22:42:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,071 | java | /*
* Content
*
* $Id: Content.java 10673 2011-06-30 23:48:47Z jmfee $
* $URL: https://ghttrac.cr.usgs.gov/websvn/ProductDistribution/trunk/src/gov/usgs/earthquake/product/Content.java $
*/
package gov.usgs.earthquake.product;
import java.io.InputStream;
import java.io.IOException;
import java.util.Date;
/**
* Content describes a group of bytes with associated mime type information. *
*/
public interface Content {
/**
* The type of content.
*
* @return the mime content type for this content.
*/
public String getContentType();
/**
* The content bytes as a stream.
*
* @return an InputStream from which content can be read.
* @throws IOException
* if an error occurs while creating the stream.
*/
public InputStream getInputStream() throws IOException;
/**
* When the content was modified.
*
* @return Date when the content was modified.
*/
public Date getLastModified();
/**
* How much content there is.
*
* @return the actual content length, or -1 if unknown.
*/
public Long getLength();
}
| [
"jmfee@usgs.gov"
] | jmfee@usgs.gov |
364092f57ede4ad4513612dde164a10dda48b847 | 46e343726625bb60bf2824edabbf83275d94c5d0 | /rdfgears-ui/src/main/java/com/nl/tudelft/rdfgearsUI/client/Dia/RGFunctionParamDataEntity.java | abf62a351298a3485d732a6de8e855eca3ca2a88 | [] | no_license | hidders/rdfgears.btodorov | 20972bd1bb0755d886a84efd0b9e2d8a89230b20 | 196b269513241b1d8fe3ea1a1da6415dbe0a55fb | refs/heads/master | 2021-04-09T17:17:20.376497 | 2013-10-09T12:37:24 | 2013-10-09T12:37:24 | 32,384,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,395 | java | package com.nl.tudelft.rdfgearsUI.client.Dia;
import static com.google.gwt.query.client.GQuery.$;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.dom.client.Element;
import com.google.gwt.query.client.Function;
import com.google.gwt.user.client.DOM;
import com.google.gwt.xml.client.Document;
import com.nl.tudelft.rdfgearsUI.client.RGType;
import com.nl.tudelft.rdfgearsUI.client.RGTypeUtils;
public class RGFunctionParamDataEntity extends RGFunctionParam{
private String vals = null;
private ArrayList <String> fieldFormIds = new ArrayList <String>();
private Map <String, String> id2EntryId = new HashMap <String, String>();
private String inputFormId, groupId;
Node owner;
private int inputCounter = 0;
public RGFunctionParamDataEntity(String id, String value, String label, String gId, Node n) {
super(id, label);
groupId = gId;
owner = n;
pType = RGFunctionParamType.INPUT_FIELDS;
vals = value;
if(vals != null)
if(vals.contains(";")){
String[] vs = vals.split(";");
for(String v: vs){
addPort(v);
}
}
}
@Override
void display(Element container) {
if(elementCache == null){
initDisplayElement();
Element addFieldButton = DOM.createDiv();
//addFieldButton.setInnerText("+ add input");
addFieldButton.setInnerHTML("<img src=\"images/add.png\" /> add input");
String addFieldButtonId = owner.canvas.createUniqueId();
addFieldButton.setId(addFieldButtonId);
addFieldButton.setClassName("addFieldButton");
elementCache.appendChild(addFieldButton);
if(!desc.equals("")){
Element descContainer = DOM.createDiv();
descContainer.setClassName("paramFormHelpText");
descContainer.setInnerText(desc);
elementCache.appendChild(descContainer);
}
container.appendChild(elementCache);
assignAddButtonHandler(addFieldButtonId);
if(fieldFormIds.size() > 0){
for(String fId: fieldFormIds){
String holderId = owner.canvas.createUniqueId();
String dbuttonId = owner.canvas.createUniqueId();
String value = owner.getPortNameByEntryId(id2EntryId.get(fId));
Element holder = createForm(holderId, fId, dbuttonId, value);
formContainer.appendChild(holder);
assignHandler(fId);
assignDelButtonHandler(dbuttonId, holderId, fId);
}
}
}else{
container.appendChild(elementCache);
}
}
public void addPort(String value){
String formCandidateId = owner.canvas.createUniqueId();
String entryId = owner.canvas.createUniqueId();
fieldFormIds.add(formCandidateId);
owner.addInputEntry(entryId, value, new RGType(RGTypeUtils.getSimpleVarType(owner.canvas.getTypeChecker().createUniqueTypeName())), value, false, groupId);
id2EntryId.put(formCandidateId, entryId);
inputCounter += 1;
}
private Element createForm(String holderId, String formId, String delButtonId, String value){
Element holder = DOM.createDiv();
holder.setId(holderId);
Element deleteButton = DOM.createDiv();
//deleteButton.setInnerText("X");
deleteButton.setInnerHTML("<img src=\"images/del-white.png\"/>");
deleteButton.setId(delButtonId);
deleteButton.setAttribute("style", "display:inline;margin-left:5px;");
Element t = DOM.createInputText();
t.setAttribute("value",value);
t.setClassName("inputString");
t.setId(formId);
holder.appendChild(t);
holder.appendChild(deleteButton);
return holder;
}
String addInputField(String value){
String id = owner.canvas.createUniqueId();
String holderId = owner.canvas.createUniqueId();
String dbuttonId = owner.canvas.createUniqueId();
Element holder = createForm(holderId, id, dbuttonId, value);
fieldFormIds.add(id);
if(formContainer != null){
formContainer.appendChild(holder);
Element t = holder.getElementsByTagName("input").getItem(0);
t.focus();
String entryId = owner.canvas.createUniqueId();
owner.addInputEntry(entryId, value, new RGType(RGTypeUtils.getSimpleVarType(owner.canvas.getTypeChecker().createUniqueTypeName())), value, false, groupId);
// owner.redrawPaths();
id2EntryId.put(id, entryId);
assignHandler(id);
assignDelButtonHandler(dbuttonId, holderId, id);
}else{
Log.debug("formContainer NULL !!");
}
return id;
}
void removeField(String id){
}
void assignDelButtonHandler(String buttonId, final String holderId, final String formId){
$("#" + buttonId).click(new Function(){
@Override
public void f(){
removeField(holderId);
fieldFormIds.remove(formId);
$("#" + holderId).remove();
owner.removeEntry(id2EntryId.get(formId));
// owner.redrawPaths();
id2EntryId.remove(formId);
collectFieldVals();
}
});
// $("#" + buttonId).mouseover(new Function(){
// @Override
// public void f(){
// $("#" + buttonId).html("<img src=\"images/del-red.png\"/>");
// }
// });
// $("#" + buttonId).mouseout(new Function(){
// @Override
// public void f(){
// $("#" + buttonId).html("<img src=\"images/del-white.png\"/>");
// }
// });
}
void collectFieldVals(){
vals = "";
for(int i = 0; i < fieldFormIds.size(); i++){
String fId = fieldFormIds.get(i);
vals = vals + $("#" + fId).val() + ";";
}
}
void assignAddButtonHandler(String id){
$("#" + id).click(new Function(){
@Override
public void f(){
inputFormId = addInputField("input" + inputCounter);
inputCounter += 1;
}
});
}
@Override
void assignHandler(final String id) {
$("#" + id).blur(new Function(){
@Override
public void f(){
owner.updateEntryText(id2EntryId.get(id), $("#" + id).val());
owner.updatePortNameByEntryId(id2EntryId.get(id), $("#" + id).val());
collectFieldVals();
}
});
}
@Override
void setValueFromString(String s) {
}
@Override
com.google.gwt.xml.client.Element toXml(Document doc) {
com.google.gwt.xml.client.Element var = doc.createElement("config");
var.setAttribute("param", "bindVariables");
if(vals != null){
if(vals.length() > 0){
var.appendChild(doc.createTextNode(vals));
}
}
return var;
}
}
| [
"btodorov@btodorov-PC"
] | btodorov@btodorov-PC |
8fc3c69e562e5b996cde1b8fc81f211b53987ab6 | 5de9adb9e25bc031c3f9bd0d58e2002819e9980b | /module_base_player/src/main/java/com/player/ali/svideo/common/widget/SwitchButton.java | 2de30331b4edc3d17d67ab617147c466c556efbd | [] | no_license | xp304467543/Cpb_BASE | f5a4fe5fd08680d2cd2a95d0b9734b27856da26b | f93880928cb62c23bff260d1fad6731e0991e8e6 | refs/heads/master | 2023-08-13T18:56:01.985659 | 2021-10-11T05:02:17 | 2021-10-11T05:02:17 | 408,704,289 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 19,224 | java | package com.player.ali.svideo.common.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Shader;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import com.videoplayer.R;
/**
* hasShadow 是否显示按钮阴影
* primaryColor 开启状态背景色
* primaryColorDark 开启状态按钮描边色
* offColor 关闭状态描边色
* offColorDark 关闭状态按钮描边色
* shadowColor 按钮阴影色
* ratioAspect 按钮宽高形状比率(0,1]
* isOpened 初始化默认状态
*/
public class SwitchButton extends View {
private static final int STATE_SWITCH_ON = 4;
private static final int STATE_SWITCH_ON2 = 3;
private static final int STATE_SWITCH_OFF2 = 2;
private static final int STATE_SWITCH_OFF = 1;
private final AccelerateInterpolator interpolator = new AccelerateInterpolator(2);
private final Paint paint = new Paint();
private final Path sPath = new Path();
private final Path bPath = new Path();
private final RectF bRectF = new RectF();
private float sAnim, bAnim;
private RadialGradient shadowGradient;
protected float ratioAspect = 0.68f; // (0,1]
protected float animationSpeed = 0.1f; // (0,1]
private int state;
private int lastState;
private boolean isCanVisibleDrawing = false;
private OnClickListener mOnClickListener;
protected int colorPrimary;
protected int colorPrimaryDark;
protected int colorOff;
protected int colorOffDark;
protected int colorShadow;
protected boolean hasShadow;
protected boolean isOpened;
private float sRight;
private float sCenterX, sCenterY;
private float sScale;
private float bOffset;
private float bRadius, bStrokeWidth;
private float bWidth;
private float bLeft;
private float bRight;
private float bOnLeftX, bOn2LeftX, bOff2LeftX, bOffLeftX;
private float shadowReservedHeight;
public SwitchButton(Context context) {
this(context, null);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public SwitchButton(Context context, AttributeSet attrs) {
super(context, attrs);
setLayerType(LAYER_TYPE_SOFTWARE, null);
final int DEFAULT_COLOR_PRIMARY = 0xFF4BD763;
final int DEFAULT_COLOR_PRIMARY_DARK = 0xFF3AC652;
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwitchButton);
colorPrimary = a.getColor(R.styleable.SwitchButton_primaryColor, DEFAULT_COLOR_PRIMARY);
colorPrimaryDark = a.getColor(R.styleable.SwitchButton_primaryColorDark, DEFAULT_COLOR_PRIMARY_DARK);
colorOff = a.getColor(R.styleable.SwitchButton_offColor, 0xFFE3E3E3);
colorOffDark = a.getColor(R.styleable.SwitchButton_offColorDark, 0xFFBFBFBF);
colorShadow = a.getColor(R.styleable.SwitchButton_shadowColor, 0xFF333333);
ratioAspect = a.getFloat(R.styleable.SwitchButton_ratioAspect, 0.68f);
hasShadow = a.getBoolean(R.styleable.SwitchButton_hasShadow, true);
isOpened = a.getBoolean(R.styleable.SwitchButton_isOpened, false);
state = isOpened ? STATE_SWITCH_ON : STATE_SWITCH_OFF;
lastState = state;
a.recycle();
if (colorPrimary == DEFAULT_COLOR_PRIMARY && colorPrimaryDark == DEFAULT_COLOR_PRIMARY_DARK) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
TypedValue primaryColorTypedValue = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.colorPrimary, primaryColorTypedValue, true);
if (primaryColorTypedValue.data > 0) {
colorPrimary = primaryColorTypedValue.data;
}
TypedValue primaryColorDarkTypedValue = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.colorPrimaryDark, primaryColorDarkTypedValue, true);
if (primaryColorDarkTypedValue.data > 0) {
colorPrimaryDark = primaryColorDarkTypedValue.data;
}
}
} catch (Exception ignore) {
}
}
}
public void setColor(int newColorPrimary, int newColorPrimaryDark) {
setColor(newColorPrimary, newColorPrimaryDark, colorOff, colorOffDark);
}
public void setColor(int newColorPrimary, int newColorPrimaryDark, int newColorOff, int newColorOffDark) {
setColor(newColorPrimary, newColorPrimaryDark, newColorOff, newColorOffDark, colorShadow);
}
public void setColor(int newColorPrimary, int newColorPrimaryDark, int newColorOff, int newColorOffDark, int newColorShadow) {
colorPrimary = newColorPrimary;
colorPrimaryDark = newColorPrimaryDark;
colorOff = newColorOff;
colorOffDark = newColorOffDark;
colorShadow = newColorShadow;
invalidate();
}
public void setShadow(boolean shadow) {
hasShadow = shadow;
invalidate();
}
public boolean isOpened() {
return isOpened;
}
public void setOpened(boolean isOpened) {
int wishState = isOpened ? STATE_SWITCH_ON : STATE_SWITCH_OFF;
if (wishState == state) {
return;
}
refreshState(wishState);
}
public void toggleSwitch(boolean isOpened) {
int wishState = isOpened ? STATE_SWITCH_ON : STATE_SWITCH_OFF;
if (wishState == state) {
return;
}
if ((wishState == STATE_SWITCH_ON && (state == STATE_SWITCH_OFF || state == STATE_SWITCH_OFF2))
|| (wishState == STATE_SWITCH_OFF && (state == STATE_SWITCH_ON || state == STATE_SWITCH_ON2))) {
sAnim = 1;
}
bAnim = 1;
refreshState(wishState);
}
private void refreshState(int newState) {
if (!isOpened && newState == STATE_SWITCH_ON) {
isOpened = true;
} else if (isOpened && newState == STATE_SWITCH_OFF) {
isOpened = false;
}
lastState = state;
state = newState;
postInvalidate();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int resultWidth;
if (widthMode == MeasureSpec.EXACTLY) {
resultWidth = widthSize;
} else {
resultWidth = (int) (56 * getResources().getDisplayMetrics().density + 0.5f)
+ getPaddingLeft() + getPaddingRight();
if (widthMode == MeasureSpec.AT_MOST) {
resultWidth = Math.min(resultWidth, widthSize);
}
}
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int resultHeight;
if (heightMode == MeasureSpec.EXACTLY) {
resultHeight = heightSize;
} else {
resultHeight = (int) (resultWidth * ratioAspect) + getPaddingTop() + getPaddingBottom();
if (heightMode == MeasureSpec.AT_MOST) {
resultHeight = Math.min(resultHeight, heightSize);
}
}
setMeasuredDimension(resultWidth, resultHeight);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
isCanVisibleDrawing = w > getPaddingLeft() + getPaddingRight() && h > getPaddingTop() + getPaddingBottom();
if (isCanVisibleDrawing) {
int actuallyDrawingAreaWidth = w - getPaddingLeft() - getPaddingRight();
int actuallyDrawingAreaHeight = h - getPaddingTop() - getPaddingBottom();
int actuallyDrawingAreaLeft;
int actuallyDrawingAreaRight;
int actuallyDrawingAreaTop;
int actuallyDrawingAreaBottom;
if (actuallyDrawingAreaWidth * ratioAspect < actuallyDrawingAreaHeight) {
actuallyDrawingAreaLeft = getPaddingLeft();
actuallyDrawingAreaRight = w - getPaddingRight();
int heightExtraSize = (int) (actuallyDrawingAreaHeight - actuallyDrawingAreaWidth * ratioAspect);
actuallyDrawingAreaTop = getPaddingTop() + heightExtraSize / 2;
actuallyDrawingAreaBottom = getHeight() - getPaddingBottom() - heightExtraSize / 2;
} else {
int widthExtraSize = (int) (actuallyDrawingAreaWidth - actuallyDrawingAreaHeight / ratioAspect);
actuallyDrawingAreaLeft = getPaddingLeft() + widthExtraSize / 2;
actuallyDrawingAreaRight = getWidth() - getPaddingRight() - widthExtraSize / 2;
actuallyDrawingAreaTop = getPaddingTop();
actuallyDrawingAreaBottom = getHeight() - getPaddingBottom();
}
shadowReservedHeight = (int) ((actuallyDrawingAreaBottom - actuallyDrawingAreaTop) * 0.07f);
float sLeft = actuallyDrawingAreaLeft;
float sTop = actuallyDrawingAreaTop + shadowReservedHeight;
sRight = actuallyDrawingAreaRight;
float sBottom = actuallyDrawingAreaBottom - shadowReservedHeight;
float sHeight = sBottom - sTop;
sCenterX = (sRight + sLeft) / 2;
sCenterY = (sBottom + sTop) / 2;
bLeft = sLeft;
bWidth = sBottom - sTop;
bRight = sLeft + bWidth;
final float halfHeightOfS = bWidth / 2; // OfB
bRadius = halfHeightOfS * 0.95f;
bOffset = bRadius * 0.2f; // offset of switching
bStrokeWidth = (halfHeightOfS - bRadius) * 2;
bOnLeftX = sRight - bWidth;
bOn2LeftX = bOnLeftX - bOffset;
bOffLeftX = sLeft;
bOff2LeftX = bOffLeftX + bOffset;
sScale = 1 - bStrokeWidth / sHeight;
sPath.reset();
RectF sRectF = new RectF();
sRectF.top = sTop;
sRectF.bottom = sBottom;
sRectF.left = sLeft;
sRectF.right = sLeft + sHeight;
sPath.arcTo(sRectF, 90, 180);
sRectF.left = sRight - sHeight;
sRectF.right = sRight;
sPath.arcTo(sRectF, 270, 180);
sPath.close();
bRectF.left = bLeft;
bRectF.right = bRight;
bRectF.top = sTop + bStrokeWidth / 2; // bTop = sTop
bRectF.bottom = sBottom - bStrokeWidth / 2; // bBottom = sBottom
float bCenterX = (bRight + bLeft) / 2;
float bCenterY = (sBottom + sTop) / 2;
int red = colorShadow >> 16 & 0xFF;
int green = colorShadow >> 8 & 0xFF;
int blue = colorShadow & 0xFF;
shadowGradient = new RadialGradient(bCenterX, bCenterY, bRadius, Color.argb(200, red, green, blue),
Color.argb(25, red, green, blue), Shader.TileMode.CLAMP);
}
}
private void calcBPath(float percent) {
bPath.reset();
bRectF.left = bLeft + bStrokeWidth / 2;
bRectF.right = bRight - bStrokeWidth / 2;
bPath.arcTo(bRectF, 90, 180);
bRectF.left = bLeft + percent * bOffset + bStrokeWidth / 2;
bRectF.right = bRight + percent * bOffset - bStrokeWidth / 2;
bPath.arcTo(bRectF, 270, 180);
bPath.close();
}
private float calcBTranslate(float percent) {
float result = 0;
switch (state - lastState) {
case 1:
if (state == STATE_SWITCH_OFF2) {
result = bOffLeftX; // off -> off2
} else if (state == STATE_SWITCH_ON) {
result = bOnLeftX - (bOnLeftX - bOn2LeftX) * percent; // on2 -> on
}
break;
case 2:
if (state == STATE_SWITCH_ON) {
result = bOnLeftX - (bOnLeftX - bOffLeftX) * percent; // off2 -> on
} else if (state == STATE_SWITCH_ON2) {
result = bOn2LeftX - (bOn2LeftX - bOffLeftX) * percent; // off -> on2
}
break;
case 3:
result = bOnLeftX - (bOnLeftX - bOffLeftX) * percent; // off -> on
break;
case -1:
if (state == STATE_SWITCH_ON2) {
result = bOn2LeftX + (bOnLeftX - bOn2LeftX) * percent; // on -> on2
} else if (state == STATE_SWITCH_OFF) {
result = bOffLeftX; // off2 -> off
}
break;
case -2:
if (state == STATE_SWITCH_OFF) {
result = bOffLeftX + (bOn2LeftX - bOffLeftX) * percent; // on2 -> off
} else if (state == STATE_SWITCH_OFF2) {
result = bOff2LeftX + (bOnLeftX - bOff2LeftX) * percent; // on -> off2
}
break;
case -3:
result = bOffLeftX + (bOnLeftX - bOffLeftX) * percent; // on -> off
break;
default: // init
case 0:
if (state == STATE_SWITCH_OFF) {
result = bOffLeftX; // off -> off
} else if (state == STATE_SWITCH_ON) {
result = bOnLeftX; // on -> on
}
break;
}
return result - bOffLeftX;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!isCanVisibleDrawing) {
return;
}
paint.setAntiAlias(true);
final boolean isOn = (state == STATE_SWITCH_ON || state == STATE_SWITCH_ON2);
// Draw background
paint.setStyle(Paint.Style.FILL);
paint.setColor(isOn ? colorPrimary : colorOff);
canvas.drawPath(sPath, paint);
sAnim = sAnim - animationSpeed > 0 ? sAnim - animationSpeed : 0;
bAnim = bAnim - animationSpeed > 0 ? bAnim - animationSpeed : 0;
final float dsAnim = interpolator.getInterpolation(sAnim);
final float dbAnim = interpolator.getInterpolation(bAnim);
// Draw background animation
final float scale = sScale * (isOn ? dsAnim : 1 - dsAnim);
final float scaleOffset = (sRight - sCenterX - bRadius) * (isOn ? 1 - dsAnim : dsAnim);
canvas.save();
canvas.scale(scale, scale, sCenterX + scaleOffset, sCenterY);
paint.setColor(0xFFFFFFFF);
canvas.drawPath(sPath, paint);
canvas.restore();
// To prepare center bar path
canvas.save();
canvas.translate(calcBTranslate(dbAnim), shadowReservedHeight);
final boolean isState2 = (state == STATE_SWITCH_ON2 || state == STATE_SWITCH_OFF2);
calcBPath(isState2 ? 1 - dbAnim : dbAnim);
// Use center bar path to draw shadow
if (hasShadow) {
paint.setStyle(Paint.Style.FILL);
paint.setShader(shadowGradient);
canvas.drawPath(bPath, paint);
paint.setShader(null);
}
canvas.translate(0, -shadowReservedHeight);
// draw bar
canvas.scale(0.98f, 0.98f, bWidth / 2, bWidth / 2);
paint.setStyle(Paint.Style.FILL);
paint.setColor(0xffffffff);
canvas.drawPath(bPath, paint);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(bStrokeWidth * 0.5f);
paint.setColor(isOn ? colorPrimaryDark : colorOffDark);
canvas.drawPath(bPath, paint);
canvas.restore();
paint.reset();
if (sAnim > 0 || bAnim > 0) {
invalidate();
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if ((state == STATE_SWITCH_ON || state == STATE_SWITCH_OFF) && (sAnim * bAnim == 0)) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
return true;
case MotionEvent.ACTION_UP:
lastState = state;
bAnim = 1;
if (state == STATE_SWITCH_OFF) {
refreshState(STATE_SWITCH_OFF2);
listener.toggleToOn(this);
} else if (state == STATE_SWITCH_ON) {
refreshState(STATE_SWITCH_ON2);
listener.toggleToOff(this);
}
if (mOnClickListener != null) {
mOnClickListener.onClick(this);
}
break;
}
}
return super.onTouchEvent(event);
}
@Override
public void setOnClickListener(OnClickListener l) {
super.setOnClickListener(l);
mOnClickListener = l;
}
public interface OnStateChangedListener {
void toggleToOn(SwitchButton view);
void toggleToOff(SwitchButton view);
}
private OnStateChangedListener listener = new OnStateChangedListener() {
@Override
public void toggleToOn(SwitchButton view) {
toggleSwitch(true);
}
@Override
public void toggleToOff(SwitchButton view) {
toggleSwitch(false);
}
};
public void setOnStateChangedListener(OnStateChangedListener listener) {
if (listener == null) {
throw new IllegalArgumentException("empty listener");
}
this.listener = listener;
}
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.isOpened = isOpened;
return ss;
}
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
this.isOpened = ss.isOpened;
this.state = this.isOpened ? STATE_SWITCH_ON : STATE_SWITCH_OFF;
invalidate();
}
private static final class SavedState extends BaseSavedState {
private boolean isOpened;
SavedState(Parcelable superState) {
super(superState);
}
private SavedState(Parcel in) {
super(in);
isOpened = 1 == in.readInt();
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeInt(isOpened ? 1 : 0);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}
}
| [
"304467543@qq.com"
] | 304467543@qq.com |
62d0099403018903f20222ba80ccd0fccbe25a26 | 50a048f44672a644dc05c6990268ed4c9b6093ec | /VPrac/RestFullDemo/src/main/java/com/bootcamp/webservices/demo/Demo.java | e78e18b7a2f967e9cb4181b9cf41d4b8f6e1ba75 | [] | no_license | tparihar/myPrac | 4ec8e5543ddeeb0f2c8fe858137829a4fa0d6e7e | 2ca740ceac2364107c859cc48d549c339f89cadf | refs/heads/master | 2021-01-10T02:45:22.334418 | 2016-03-24T21:32:00 | 2016-03-24T21:32:00 | 54,671,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | /**
*
*/
package com.bootcamp.webservices.demo;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.bootcamp.webservices.model.Message;
/**
* @author Boot Camp User 011
*
*/
@Path("/message")
public class Demo {
/*@GET
@Produces(MediaType.APPLICATION_XML)
public Message getMessageAsXML() {
Message message = new Message(1, "hi how are you ??");
Message message2 = new Message(2, "hi how are you ??");
return message2;
}*/
@GET
@Path("/hello")
@Produces(MediaType.APPLICATION_JSON)
public Response getMessageAsJSON() {
Message message = new Message(1, "hi how are you ??");
return Response.status(200).entity(message).build();
}
}
| [
"vishalsingh.thakur1992@gmail.com"
] | vishalsingh.thakur1992@gmail.com |
7dfb9c20f7baa74a2f35d869a5dfbda45bcf438f | 312e89b1989b62e9dd6ef524d477e2241e367855 | /app/src/main/java/com/example/android/androidexam/MainActivity.java | 3b3af156225f827425ab8748fb43ab14690eb12d | [] | no_license | garamii/andriodExam | 8dc7fbc33037873f5d82ab61da6f0c9405cb3b77 | d0f012a762691ba6e617b04533ecc762506c3542 | refs/heads/master | 2016-09-05T17:28:16.802048 | 2015-10-01T08:13:24 | 2015-10-01T08:13:24 | 41,770,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,264 | java |
package com.example.android.androidexam;
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import com.example.android.androidexam.Activity.ActivityExamActivity;
import com.example.android.androidexam.Activity.ParcelableActivity;
import com.example.android.androidexam.Activity.WebActivity;
import com.example.android.androidexam.animation.AnimationActivity;
import com.example.android.androidexam.calendar.CalendarActivity;
import com.example.android.androidexam.calendar2.Calendar2Activity;
import com.example.android.androidexam.database.LogInActivity;
import com.example.android.androidexam.database.parse.ParseLocalDatabaseActivity;
import com.example.android.androidexam.database.parse.ParseLogInActivity;
import com.example.android.androidexam.exam.ListExamActivity;
import com.example.android.androidexam.fragment.FragmentActivity;
import com.example.android.androidexam.graphic.GraphicActivity;
import com.example.android.androidexam.layout.FrameLayoutActivity;
import com.example.android.androidexam.mission.Mission02Activity;
import com.example.android.androidexam.mission.Mission05Activity;
import com.example.android.androidexam.mission.extra.ListView_Activity;
import com.example.android.androidexam.mission.mission01Activity;
import com.example.android.androidexam.mission.mission03Activity;
import com.example.android.androidexam.musicplayer.MusicActivity;
import com.example.android.androidexam.parsing.json.WeatherActivity;
import com.example.android.androidexam.provider.ContactLoaderActivity;
import com.example.android.androidexam.provider.LoadPictureActivity;
import com.example.android.androidexam.thread.ThreadActivity;
import com.example.android.androidexam.viewpager.ScreenSlideActivity;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MainActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new SimpleAdapter(this, getData(),
android.R.layout.simple_list_item_1, new String[] {
"title"
},
new int[] {
android.R.id.text1
}));
getListView().setTextFilterEnabled(true);
}
protected List<Map<String, Object>> getData() {
List<Map<String, Object>> myData = new ArrayList<>();
// 메뉴 추가 부분
// addItem(myData, "TransitionDrawable", TransitionDrawableExamActivity.class);
addItem(myData, "FrameLayout", FrameLayoutActivity.class);
addItem(myData, "미션 01", mission01Activity.class);
addItem(myData, "미션 02", Mission02Activity.class);
addItem(myData, "미션 03", mission03Activity.class);
addItem(myData, "화면이동예제", ActivityExamActivity.class);
addItem(myData, "웹뷰 예제", WebActivity.class);
addItem(myData, "미션 05", Mission05Activity.class);
addItem(myData, "animation 연습", AnimationActivity.class);
addItem(myData, "달력 연습", CalendarActivity.class);
addItem(myData, "달력(android)", Calendar2Activity.class);
addItem(myData, "ListView",ListView_Activity.class);
addItem(myData, "ListView연습",ListExamActivity.class);
addItem(myData, "Thread 연습",ThreadActivity.class);
addItem(myData, "parsing 연습",WeatherActivity.class);
addItem(myData, "fragment 연습",FragmentActivity.class);
addItem(myData, "Viewpager",ScreenSlideActivity.class);
addItem(myData, "Graphic",GraphicActivity.class);
addItem(myData, "Database",LogInActivity.class);
addItem(myData, "parcelable",ParcelableActivity.class);
addItem(myData, "Database-parse",ParseLogInActivity.class);
addItem(myData, "parse 로컬 db",ParseLocalDatabaseActivity.class);
addItem(myData, "Content provider,Loader - 연락처",ContactLoaderActivity.class);
addItem(myData, "Content provider Loader - 사진",LoadPictureActivity.class);
addItem(myData,"music Player", MusicActivity.class);
// ----- 메뉴 추가 여기까지
// 이름 순 정렬
// Collections.sort(myData, sDisplayNameComparator);
return myData;
}
private final static Comparator<Map<String, Object>> sDisplayNameComparator =
new Comparator<Map<String, Object>>() {
private final Collator collator = Collator.getInstance();
public int compare(Map<String, Object> map1, Map<String, Object> map2) {
return collator.compare(map1.get("title"), map2.get("title"));
}
};
protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {
Map<String, Object> temp = new HashMap<>();
temp.put("title", name);
temp.put("intent", intent);
data.add(temp);
}
protected void addItem(List<Map<String, Object>> data, String name, Class cls) {
this.addItem(data, name, new Intent(this, cls));
}
@Override
@SuppressWarnings("unchecked")
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>) l.getItemAtPosition(position);
Intent intent = (Intent) map.get("intent");
startActivity(intent);
}
}
| [
"flowsinyour@naver.com"
] | flowsinyour@naver.com |
a8312e0656756925b76ca30c5074ec8d23a8cc0a | 93e2132b977d5582f6b27b25ad73a554a1eeb593 | /src/main/java/com/pms/app/repo/PriceRepository.java | 7cdb8cecc2a373ab570fc41491dd6ba4e553e435 | [] | no_license | gurungsuman1676/pms | 4f7bb5f3fef0a72077105847db76523409b6466d | 34ec00cddb9e25d7b81c208505819784f5f9dbe1 | refs/heads/master | 2020-07-04T08:40:06.082383 | 2016-09-11T10:38:50 | 2016-09-11T10:38:50 | 67,923,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package com.pms.app.repo;
import com.pms.app.domain.Prices;
import com.pms.app.domain.Sizes;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface PriceRepository extends AbstractRepository<Prices> {
@Query("SELECT p FROM Prices p WHERE p.design.id =:designId AND p.size.id=:sizeId AND p.yarn.id =:yarnId")
Prices findByDesignAndSizeAndYarn(@Param("designId") Long designId, @Param("sizeId") Long sizeId, @Param("yarnId") Long yarnId);
@Query("SELECT p.size FROM Prices p WHERE p.design.id =:designId AND p.yarn.id =:yarnId ORDER BY p.size.name ASC")
List<Sizes> findSizesByDesignIdAndYarnId(@Param("designId")Long designId,@Param("yarnId") Long yarnId);
}
| [
"arrowhead@Sumans-MacBook-Pro.local"
] | arrowhead@Sumans-MacBook-Pro.local |
e773ea68b89090dee113468617c4dc4df021f405 | 905f86007251564f5bd70b062343bf76f443564d | /Chess/src/com/ducv/fff/chess/utils/filebrowser/FileInfos.java | 63da021ff07596f3ba8480b6051648a0534ec6bb | [] | no_license | ducv/Titoapps | 484e0bbb8ca02824eb6c8ee1c6ea66c9534ab680 | a715df0a184ae9a827eae71f00886f4384adfba5 | refs/heads/master | 2021-01-20T05:57:14.214517 | 2016-09-09T12:27:01 | 2016-09-09T12:27:01 | 25,511,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,707 | java | /*
* Copyright 2007 Steven Osborn
*
* 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.ducv.fff.chess.utils.filebrowser;
import android.graphics.drawable.Drawable;
/** @author Steven Osborn - http://steven.bitsetters.com */
public class FileInfos implements Comparable<FileInfos> {
private String mText = "";
private String mDetails = "";
private Drawable mIcon;
private boolean mSelectable = true;
public FileInfos(String text, String details, Drawable bullet) {
mIcon = bullet;
mDetails = details;
mText = text;
}
public boolean isSelectable() {
return mSelectable;
}
public void setSelectable(boolean selectable) {
mSelectable = selectable;
}
public String getText() {
return mText;
}
public void setText(String text) {
mText = text;
}
public String getDetails() {
return this.mDetails;
}
public void setDetails(String details) {
this.mDetails = details;
}
public void setIcon(Drawable icon) {
mIcon = icon;
}
public Drawable getIcon() {
return mIcon;
}
public int compareTo(FileInfos other) {
if (this.mText != null)
return this.mText.compareTo(other.getText());
else
throw new IllegalArgumentException();
}
}
| [
"ducv09@gmail.com"
] | ducv09@gmail.com |
3ae1f6d1cb9cdeebc6022e3b9caf27eec506cea0 | d5ad4e23831cbbc39476403be3979d61316ae325 | /SMS/src/main/java/com/pub/sms/controller/SmsAdminController.java | 78f9846ad06ba06fa837edbea1d605f61622fcf6 | [] | no_license | haesungLEE95/sms | a8ad14dc15a263a96eb441e8c778d6f6dc5d2884 | 50224ece97146e2f69679e9532584e74d90435de | refs/heads/master | 2020-04-15T09:57:44.675998 | 2019-01-24T08:48:39 | 2019-01-24T08:48:39 | 164,574,027 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,299 | java | package com.pub.sms.controller;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.pub.sms.model.PagingBean2;
import com.pub.sms.model.SmsAdmin;
import com.pub.sms.model.SmsMem;
import com.pub.sms.service.SmsAdminService;
@Controller
public class SmsAdminController {
@Autowired
private SmsAdminService sas;
@RequestMapping("smsMemList")
public String smsMemList(String pageNum, Model model, SmsMem smsMem) {
int rowPerPage = 10;
if (pageNum==null || pageNum.equals(""))
pageNum = "1";
int currentPage = Integer.parseInt(pageNum);
int startRow = (currentPage - 1)*rowPerPage + 1;
int endRow = startRow + rowPerPage - 1;
int total = sas.total(smsMem);
PagingBean2 pb=new PagingBean2(currentPage,rowPerPage,total);
int no = total - startRow + 1;
smsMem.setStartRow(startRow);
smsMem.setEndRow(endRow);
Collection<SmsMem> list = sas.list(smsMem);
model.addAttribute("pb", pb);
model.addAttribute("no", no);
model.addAttribute("list", list);
String[] ops = {"이름","닉네임","이름+닉네임"};
model.addAttribute("keyword",smsMem.getKeyword());
model.addAttribute("search", smsMem.getSearch());
model.addAttribute("ops",ops);
return "admin/smsMemList";
}
@RequestMapping("adminMain")
public String adminMain() {
return "/admin/adminMain";
}
@RequestMapping("adminDelMem")
public String adminDelMem(Model model, String pageNum, HttpServletRequest request) {
String[] chk = request.getParameterValues("checkbox");
SmsMem smsMem = null;
for(int i = 0; i < chk.length; i++) {
smsMem = sas.adminDelMem(chk[i]);
}
model.addAttribute("msg", "탈퇴처리되었습니다");
SmsMem sm1 = new SmsMem();
int rowPerPage = 10;
if (pageNum==null || pageNum.equals(""))
pageNum = "1";
int currentPage = Integer.parseInt(pageNum);
int startRow = (currentPage - 1)*rowPerPage + 1;
int endRow = startRow + rowPerPage - 1;
int total = sas.total(smsMem);
PagingBean2 pb=new PagingBean2(currentPage,rowPerPage,total);
int no = total - startRow + 1;
sm1.setStartRow(startRow);
sm1.setEndRow(endRow);
Collection<SmsMem> list = sas.list(sm1);
String[] ops = {"이름","닉네임","이름+닉네임"};
model.addAttribute("ops", ops);
model.addAttribute("pb", pb);
model.addAttribute("no", no);
model.addAttribute("list", list);
return "admin/smsMemList";
}
@RequestMapping("adminLoginForm")
public String adminLoginForm() {
return "/admin/adminLoginForm";
}
@RequestMapping("adminLogin")
public String login(SmsAdmin smsAdmin, Model model, HttpSession session) {
SmsAdmin sa = sas.select(smsAdmin.getAdmin_id());
int result = 0;
if(sa==null) result = -1;
else if (sa.getPasswd().equals(smsAdmin.getPasswd())) {
result = 1;
session.setAttribute("admin_id", smsAdmin.getAdmin_id());
}
model.addAttribute("sa",sa);
model.addAttribute("result",result);
return "admin/adminLogin";
}
} | [
"indigtop@gmail.com"
] | indigtop@gmail.com |
55f048eeb546afb6339221902b2f03d4060bf219 | b6b7b9dc873080bfb95a5199f9d94bdfc29e4fc3 | /proofScheme/src/main/java/com/qitai/utils/Pair.java | 36e4c367e134c745fcc8476312f031eeec37f588 | [] | no_license | huangqitai/java-project | 816c988bd7f9780b3e5c54ffdf6aa28592fc6e15 | 95d48bc7cae21f4cf0d3a7b60ee4b8bf5d58fb4a | refs/heads/master | 2023-03-04T15:22:54.944114 | 2022-05-18T03:21:52 | 2022-05-18T03:21:52 | 210,545,692 | 0 | 0 | null | 2023-03-03T09:42:20 | 2019-09-24T08:00:42 | Java | UTF-8 | Java | false | false | 2,876 | java | package com.qitai.utils;
import java.io.Serializable;
public class Pair<K,V> implements Serializable
{
private static final long serialVersionUID = -5438210026911794563L;
/**
* Key of this <code>Pair</code>.
*/
private K key;
/**
* Gets the key for this pair.
* @return key for this pair
*/
public K getKey() { return key; }
public void setKey(K k){key=k;}
/**
* Value of this this <code>Pair</code>.
*/
private V value;
/**
* Gets the value for this pair.
* @return value for this pair
*/
public V getValue() { return value; }
public void setValue(V v){value=v;}
public Pair()
{
}
/**
* Creates a new pair
* @param key The key for this pair
* @param value The value to use for this pair
*/
public Pair(K key, V value) {
this.key = key;
this.value = value;
}
/**
* <p><code>String</code> representation of this
* <code>Pair</code>.</p>
*
* <p>The default name/value delimiter '=' is always used.</p>
*
* @return <code>String</code> representation of this <code>Pair</code>
*/
@Override
public String toString() {
return key + "=" + value;
}
/**
* <p>Generate a hash code for this <code>Pair</code>.</p>
*
* <p>The hash code is calculated using both the name and
* the value of the <code>Pair</code>.</p>
*
* @return hash code for this <code>Pair</code>
*/
@Override
public int hashCode() {
// name's hashCode is multiplied by an arbitrary prime number (13)
// in order to make sure there is a difference in the hashCode between
// these two parameters:
// name: a value: aa
// name: aa value: a
return key.hashCode() * 13 + (value == null ? 0 : value.hashCode());
}
/**
* <p>Test this <code>Pair</code> for equality with another
* <code>Object</code>.</p>
*
* <p>If the <code>Object</code> to be tested is not a
* <code>Pair</code> or is <code>null</code>, then this method
* returns <code>false</code>.</p>
*
* <p>Two <code>Pair</code>s are considered equal if and only if
* both the names and values are equal.</p>
*
* @param o the <code>Object</code> to test for
* equality with this <code>Pair</code>
* @return <code>true</code> if the given <code>Object</code> is
* equal to this <code>Pair</code> else <code>false</code>
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof com.qitai.utils.Pair) {
@SuppressWarnings("rawtypes")
com.qitai.utils.Pair pair = (com.qitai.utils.Pair) o;
if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
if (value != null ? !value.equals(pair.value) : pair.value != null) return false;
return true;
}
return false;
}
}
| [
"861902610@qq.com"
] | 861902610@qq.com |
8984926a017c65113397984c82192e30cac42aff | bb2f3c0d834beb50341e9d03b3b96c24438a88ac | /milton/milton-caldav/src/main/java/info/ineighborhood/cardme/vcard/types/NoteType.java | c7ee213466c3113a59603e8b629793d2fb58b5e8 | [
"Apache-2.0"
] | permissive | skoulouzis/lobcder | 3e004d3e896fe9e600da931d8fb82c72a746c491 | 23bf0cc9c78f506193bb9ba9f6543e5f5597ae4d | refs/heads/dev | 2022-02-22T20:56:32.472320 | 2022-02-08T10:07:01 | 2022-02-08T10:07:01 | 26,593,878 | 7 | 3 | Apache-2.0 | 2022-02-08T10:07:02 | 2014-11-13T15:23:44 | Java | UTF-8 | Java | false | false | 3,885 | java | package info.ineighborhood.cardme.vcard.types;
import info.ineighborhood.cardme.util.Util;
import info.ineighborhood.cardme.vcard.EncodingType;
import info.ineighborhood.cardme.vcard.VCardType;
import info.ineighborhood.cardme.vcard.features.NoteFeature;
import info.ineighborhood.cardme.vcard.types.parameters.ParameterTypeStyle;
/**
* Copyright (c) 2004, Neighborhood Technologies
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Neighborhood Technologies nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
*
* @author George El-Haddad
* <br/>
* Feb 10, 2010
*
*/
public class NoteType extends Type implements NoteFeature {
private String note = null;
public NoteType() {
this(null);
}
public NoteType(String note) {
super(EncodingType.EIGHT_BIT, ParameterTypeStyle.PARAMETER_VALUE_LIST);
setNote(note);
}
/**
* {@inheritDoc}
*/
public String getNote()
{
return note;
}
/**
* {@inheritDoc}
*/
public void setNote(String note) {
this.note = note;
}
/**
* {@inheritDoc}
*/
public boolean hasNote()
{
return note != null;
}
/**
* {@inheritDoc}
*/
@Override
public String getTypeString()
{
return VCardType.NOTE.getType();
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj)
{
if(obj != null) {
if(obj instanceof NoteType) {
if(this == obj || ((NoteType)obj).hashCode() == this.hashCode()) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
else {
return false;
}
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode()
{
return Util.generateHashCode(toString());
}
/**
* {@inheritDoc}
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append(this.getClass().getName());
sb.append("[ ");
if(encodingType != null) {
sb.append(encodingType.getType());
sb.append(",");
}
if(note != null) {
sb.append(note);
sb.append(",");
}
if(super.id != null) {
sb.append(super.id);
sb.append(",");
}
sb.deleteCharAt(sb.length()-1); //Remove last comma.
sb.append(" ]");
return sb.toString();
}
/**
* {@inheritDoc}
*/
@Override
public NoteFeature clone()
{
NoteType cloned = new NoteType();
if(note != null) {
cloned.setNote(new String(note));
}
cloned.setParameterTypeStyle(getParameterTypeStyle());
cloned.setEncodingType(getEncodingType());
cloned.setID(getID());
return cloned;
}
}
| [
"sS.Koulouzis@uva.nl"
] | sS.Koulouzis@uva.nl |
304a13bac05d762b687d0680415b634918294a49 | 86597e88e41b767dbff78bafea24a0eaa1d3e0cb | /jppf/JPPF-4.0.1-full-src/tests/src/framework/test/org/jppf/test/setup/common/CountingJobListener.java | 7dde75ab7867a8afcd69762ce29e4faf0d728f43 | [] | no_license | Eduardo555/JPPF---Codigos-Exemplos | e2e9bde8263ae1aa8573bd98cbe2e94398723872 | e5ffccffbb1250d20eb5366b7eb91c6b3f951f17 | refs/heads/master | 2021-05-15T12:46:33.598336 | 2017-10-27T01:30:16 | 2017-10-27T01:30:16 | 108,477,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,754 | java | /*
* JPPF.
* Copyright (C) 2005-2014 JPPF Team.
* http://www.jppf.org
*
* 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 test.org.jppf.test.setup.common;
import java.util.concurrent.atomic.AtomicInteger;
import org.jppf.client.event.*;
/**
* A simple job listener.
*/
public class CountingJobListener extends JobListenerAdapter
{
/**
* The count of 'jobStarted' notifications.
*/
public AtomicInteger startedCount = new AtomicInteger(0);
/**
* The count of 'jobEnded' notifications.
*/
public AtomicInteger endedCount = new AtomicInteger(0);
/**
* The count of 'jobDispatched' notifications.
*/
public AtomicInteger dispatchedCount = new AtomicInteger(0);
/**
* The count of 'jobReturned' notifications.
*/
public AtomicInteger returnedCount = new AtomicInteger(0);
@Override
public void jobStarted(final JobEvent event)
{
startedCount.incrementAndGet();
}
@Override
public void jobEnded(final JobEvent event)
{
endedCount.incrementAndGet();
}
@Override
public void jobDispatched(final JobEvent event)
{
dispatchedCount.incrementAndGet();
}
@Override
public void jobReturned(final JobEvent event)
{
returnedCount.incrementAndGet();
}
}
| [
"eduardospillereanzolin@gmail.com"
] | eduardospillereanzolin@gmail.com |
07dedc795f7bfe42abb94228c7751bf05f65c932 | 6933d22396578167295f6b2b538c4be03e3e6981 | /spring-server/src/test/java/com/tp/socialurb/server/ServerApplicationTests.java | 76b3e04f26b763a49a896f9934ab3f957703da4b | [] | no_license | techpassel/socialurb | 8b1479a8c274b67963d9d6f0d2491ff770c81cb1 | 04f0b6112681480ec2e3c4db328448d96b96bbb5 | refs/heads/main | 2023-04-25T13:09:37.205255 | 2021-05-16T17:52:26 | 2021-05-16T17:52:26 | 353,622,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.tp.socialurb.server;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ServerApplicationTests {
@Test
void contextLoads() {
}
}
| [
"asaurabh001@gmail.com"
] | asaurabh001@gmail.com |
d0a5186487dfe2d8b5f19a34a96b3f475390a481 | 15111fdaadc51583e46f494937050fedd544fef9 | /app/src/androidTest/java/proyekpakdani/abcd/ExampleInstrumentedTest.java | 077a88d24716724db3d6843efe6c0fb707bb4189 | [] | no_license | sheldyferdinand/ABCD-Mobile | 9e09b1ff78f830944dd28e95460f4cb1460389ba | 3b761e2fd1ee9a08a6035e4f2aed6948eaa73450 | refs/heads/master | 2021-08-24T00:52:06.673168 | 2017-12-07T09:58:27 | 2017-12-07T09:58:27 | 112,081,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package proyekpakdani.abcd;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("proyekpakdani.abcd", appContext.getPackageName());
}
}
| [
"sheldyferdinand@gmail.com"
] | sheldyferdinand@gmail.com |
d74171d700c0e30f814b9b97c005f6ac7dd5fbd5 | 70782c0870b2cd22e1ce8bebac21f1b0e7bc304e | /springboot-mybatis-tx/src/main/java/com/li/springbootmybatistx/SpringbootMybatisTxApplication.java | 02aa8f8a4b8a3aedf92532a6abb5a22a4e06452c | [
"Apache-2.0"
] | permissive | LiHaodong888/SpringBootLearn | 7b21ebff54cdcc9a055562757907c6cfe64865f6 | e9b399f1ee525a50bd9b672addc10d96a71691a6 | refs/heads/master | 2022-07-09T08:47:17.731547 | 2019-08-23T14:46:52 | 2019-08-23T14:46:52 | 171,258,680 | 338 | 197 | Apache-2.0 | 2022-06-17T02:05:17 | 2019-02-18T09:58:21 | Java | UTF-8 | Java | false | false | 452 | java | package com.li.springbootmybatistx;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@MapperScan("com.li.springbootmybatistx.dao")
@SpringBootApplication
public class SpringbootMybatisTxApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootMybatisTxApplication.class, args);
}
}
| [
"lihaodongmail@163.com"
] | lihaodongmail@163.com |
26822f33f693187c89e3e81bf6967f4134b6161d | 40c6e2ffe79a88cfaa3afba3da2ad3a4f994c69d | /app/src/main/java/co/edu/udea/compumovil/gr06/lab4fcm/Intefaces/dialogEvent.java | 5971b5f17f43af84c885ecb5c94adefc8f3e8f64 | [] | no_license | brayan9304/Lab4FCM | 64457b793db212d012c72497e80edea5f57e2ad3 | 731956514fd4a99bc69986c39618a96ab77d2629 | refs/heads/master | 2021-01-11T03:29:27.675292 | 2016-10-18T23:33:40 | 2016-10-18T23:33:40 | 71,003,835 | 0 | 0 | null | 2016-10-18T23:33:41 | 2016-10-15T17:48:57 | Java | UTF-8 | Java | false | false | 249 | java | package co.edu.udea.compumovil.gr06.lab4fcm.Intefaces;
import android.widget.EditText;
/**
* Created by jaime on 16/10/2016.
*/
public interface dialogEvent {
void iniciarSesion(EditText correo, EditText clave);
void crearCuenta();
}
| [
"jaime.jimenezisi@gmail.com"
] | jaime.jimenezisi@gmail.com |
ef9432518ae75153c31030579a97bbf85cbafa4a | 9515c84b91fb27de2db3a46ae999271777ff5a19 | /java17/src/com/sun/corba/se/PortableActivationIDL/EndpointInfoListHolder.java | 022e2b343deee7a09ff96901764726dd4b4140b8 | [] | no_license | scriptmarker/seeker | 990c7141a9caac55a09bc4cbf288c5aa7e51a182 | ebd5ad6740bb02d573f910a0cb2adaa3a6c25e36 | refs/heads/master | 2016-09-05T10:49:25.614165 | 2014-04-22T12:09:55 | 2014-04-22T12:09:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.sun.corba.se.PortableActivationIDL;
/**
* com/sun/corba/se/PortableActivationIDL/EndpointInfoListHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from ../../../../src/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
* Friday, June 21, 2013 12:54:16 PM PDT
*/
/** A list of endpoint information for a particular ORB.
*/
public final class EndpointInfoListHolder implements org.omg.CORBA.portable.Streamable
{
public com.sun.corba.se.PortableActivationIDL.EndPointInfo value[] = null;
public EndpointInfoListHolder ()
{
}
public EndpointInfoListHolder (com.sun.corba.se.PortableActivationIDL.EndPointInfo[] initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = com.sun.corba.se.PortableActivationIDL.EndpointInfoListHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
com.sun.corba.se.PortableActivationIDL.EndpointInfoListHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return com.sun.corba.se.PortableActivationIDL.EndpointInfoListHelper.type ();
}
}
| [
"seekermail@sina.com"
] | seekermail@sina.com |
07cd7dad0e0907aeed8ce8b88dbedb5a07fa0899 | 805f8979a9e34cfea4b6d680b58cdd2dc8614d4b | /src/simCity/house/HouseCustomerRole.java | 25009da84d2416769411a15969012c3a86da144d | [] | no_license | mitchworsey/SimCity | 40f02ff2c7780420488fa9564b0b366b4a6fec29 | 9017026e40ce9f46959051a69cf798c457a3b0e8 | refs/heads/master | 2021-01-23T18:21:39.200841 | 2015-03-04T14:03:17 | 2015-03-04T14:03:17 | 31,657,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,755 | java | package simCity.house;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Semaphore;
import simCity.Clock;
import simCity.OrdinaryPerson;
import simCity.Role;
import simCity.gui.HouseCustomerGui;
import simCity.gui.SimCityGui;
import simCity.interfaces.HouseCustomer;
import simCity.interfaces.HouseOwner;
import simCity.interfaces.Person;
public class HouseCustomerRole extends Role implements HouseCustomer{
String name;
double money = 1000.00;
House house;
public HouseCustomerGui customerGui;
public HouseOwner owner;
private Semaphore leftOffice = new Semaphore(0,true);
private Semaphore atRealEstate = new Semaphore(0,true);
Timer timer = new Timer();
public enum AgentEvent {none, wantToBuyProperty, cantBuyProperty, askedToPaySecurityDeposit, toldToMoveIn, askedToPayRent, askedToPayMortgage,
paidRent, movedIn, leftOffice, almostdone, done}
public AgentEvent event = AgentEvent.none;
public enum AgentState {DoingNothing, waitingForResponse, paidSecurityDeposit, paidMaintenance, paidMortgage, Done}
public AgentState state = AgentState.DoingNothing;
public HouseCustomerRole(String name){
super();
this.name = name;
}
@Override
public void setGui(HouseCustomerGui g) {
customerGui = g;
}
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#setHouse(simCity.house.House)
*/
@Override
public void setHouse(House h){
this.house = h;
}
@Override
public void setOwner(HouseOwner o){
owner = o;
}
///Messages
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#msgAskToBuyProperty()
*/
@Override
public void msgAskToBuyProperty(){
print("Received msgAskToBuyProperty");
state = AgentState.DoingNothing;
event = AgentEvent.wantToBuyProperty;
stateChanged();
}
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#msgHouseUnavailable()
*/
@Override
public void msgHouseUnavailable(){
print("Received msgHouseUnavailable");
house = null;
event = AgentEvent.cantBuyProperty;
stateChanged();
}
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#msgPaySecurityDeposit()
*/
@Override
public void msgPaySecurityDeposit(House h){
print("Received msgPaySecurityDeposit");
house = h;
getPersonAgent().setHousingLocation(h.type);
getPersonAgent().setTimeHouseBought(Clock.globalClock.getTime());
event = AgentEvent.askedToPaySecurityDeposit;
stateChanged();
}
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#msgMoveIn(simCity.house.House)
*/
@Override
public void msgMoveIn(House h){
print("Received msgMoveIn");
//if the house is of type "Home", then the Resident will take over the current owner and //become the new owner.
//therefore, the Resident will pay the Bank mortgage and for maintenance
//if(h.type.equals("Home"))
//h.owner = null;
//if the house is NOT of type "Home", then the Resident will NOT be the owner
//therefore, the Resident will pay the Owner rent and for maintenance
house = h;
event = AgentEvent.toldToMoveIn;
stateChanged();
}
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#msgPayRent()
*/
@Override
public void msgPayRent(){
print("Received msgPayRent");
state = AgentState.DoingNothing;
event = AgentEvent.askedToPayRent;
stateChanged();
}
//Semaphore Messages
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#msgLeftOffice()
*/
@Override
public void msgLeftOffice(){
print("Received msgLeftOffice");
leftOffice.release();
event = AgentEvent.done;
stateChanged();
}
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#msgAtRealEstate()
*/
@Override
public void msgAtRealEstate(){
atRealEstate.release();
stateChanged();
}
///Scheduler
/* (non-Javadoc)
* @see simCity.house.HouseCustomer#pickAndExecuteAnAction()
*/
@Override
public boolean pickAndExecuteAnAction(){
if(state == AgentState.DoingNothing && event == AgentEvent.wantToBuyProperty){
state = AgentState.waitingForResponse;
askToBuyProperty();
return true;
}
if(state == AgentState.waitingForResponse && event == AgentEvent.askedToPaySecurityDeposit){
state = AgentState.paidSecurityDeposit;
paySecurityDeposit();
return true;
}
if(state == AgentState.paidSecurityDeposit && event == AgentEvent.toldToMoveIn){
state = AgentState.DoingNothing;
moveIn();
return true;
}
if(state == AgentState.DoingNothing && event == AgentEvent.askedToPayRent){
payRent();
return true;
}
if(state == AgentState.Done && event == AgentEvent.done){
leaveOffice();
return true;
}
return false;
}
///Actions
private void askToBuyProperty(){
customerGui.DoGoToRealEstate();
try {
atRealEstate.acquire();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
owner.msgIWantToLiveHere(this);
}
private void paySecurityDeposit(){
money -= house.securityDeposit;
house.owner.msgHereIsSecurityDeposit(this, house.securityDeposit);
}
private void moveIn(){
//Gui animation to show resident has moved in
customerGui.DoLeaveOffice();
try {
leftOffice.acquire();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
state = AgentState.Done;
SimCityGui.housingOfficePanel.removeGui(customerGui);
getPersonAgent().OutOfComponent(this);
/////////////HACK/////////////////
//GO TO HOUSE NOW
//event = AgentEvent.movedIn;
}
private void payRent(){
//getPersonAgent().OutOfComponent(this);
///////////HACK////////////////
//GO To housing office
customerGui.DoGoToRealEstate();
try {
atRealEstate.acquire();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
money -= house.monthlyPayment;
/*if(house.owner == null){
//bankTeller.msgHereIsMortgage(this, house.monthlyPayment);
}
else{*/
house.owner.msgHereIsRent(this, house.monthlyPayment);
//}
event = AgentEvent.paidRent;
customerGui.DoLeaveOffice();
try {
leftOffice.acquire();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
state = AgentState.Done;
SimCityGui.housingOfficePanel.removeGui(customerGui);
getPersonAgent().OutOfComponent(this);
}
private void leaveOffice() {
print("Nothing to do in office, preparing to leave office");
event = AgentEvent.almostdone;
timer.schedule(new TimerTask() {
public void run() {
actuallyLeave();
}
},
2000);
}
private void actuallyLeave() {
print("Leaving office");
event = AgentEvent.done;
SimCityGui.housingOfficePanel.removeGui(customerGui);
getPersonAgent().OutOfComponent(this);
}
}
| [
"worsey@usc.edu"
] | worsey@usc.edu |
6525b8ed370061914faa3eaeffce6ec87d6e51f9 | d643c8b7bcdf3747936082667c87693521a2abc8 | /MyNode.java | 747b426b9054d0dc1ad21f4ef967be908f6f443c | [] | no_license | 301prateek/LinkedListDataStructures | e5d473c035d8269d3d630dc31cea6b311a5dd93e | 53f59e6e48207e5c6c57f1b9f0570998de1a4d0e | refs/heads/main | 2023-01-22T10:33:44.792762 | 2020-11-30T15:12:21 | 2020-11-30T15:12:21 | 317,255,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.javapractice;
public class MyNode <K> {
//Defining key of type Generic
private K key;
private MyNode next;
//creating a parameterized constructor,
public MyNode(K key) {
this.key = null;
this.next = null;
}
//Getter and Setter for MyNode
public MyNode getNext() {
return next;
}
public void setNext(MyNode next) {
this.next = next;
}
}
| [
"prateek.patil301@gmail.com"
] | prateek.patil301@gmail.com |
d5b9dcd9c7442de4a00aaa839bd1968b60bedf38 | fc15e9a7f33a411301dce408fcbfe8cb45a886dd | /src/main/java/ge/softlab/tatia_shop/service/CategoryServiceImpl.java | c959a7d112a67f5c2949426ec5a6ac9c74a95f41 | [] | no_license | tatiagogashvili/tatia.shop | fcb52c19ab67568dbf05c54b90117b11bd0ad592 | 4dc5307d1c71061f4fcaa584264c0bf11736dfd7 | refs/heads/master | 2023-08-30T08:59:18.103198 | 2021-11-01T15:04:24 | 2021-11-01T15:04:24 | 423,505,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package ge.softlab.tatia_shop.service;
import ge.softlab.tatia_shop.repository.jpa.CategoryRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@RequiredArgsConstructor
public class CategoryServiceImpl implements CategoryService{
private final CategoryRepository CategoryRepository;
}
| [
"tatia.gogashvili708@ens.tsu.edu.ge"
] | tatia.gogashvili708@ens.tsu.edu.ge |
ec42867fdd3317fbd2cee168ab701ba63d825de8 | 09adaad00fd9f4a3ad4ad07dc9c0971732ee466d | /src/test/java/arrayPrograms/EqualityOfTwoArrays.java | 6bb72546c775e4514f39469201637ecc76bfc907 | [] | no_license | navekumarreddy94/CucumberFramework | 41eef01f9599c1725ee2b169792373dbf2f244ab | 0d33f5d1ce5e851d6f0a6bb21df2fb30b0c64005 | refs/heads/master | 2023-01-24T07:28:15.801061 | 2023-01-10T17:01:34 | 2023-01-10T17:01:34 | 230,424,445 | 1 | 0 | null | 2021-04-26T19:49:41 | 2019-12-27T10:32:09 | Java | UTF-8 | Java | false | false | 1,758 | java | package arrayPrograms;
import java.util.Arrays;
public class EqualityOfTwoArrays {
public static void main(String[] args) {
//using Iterative method
int[] arrayOne = {21, 57, 11, 37, 24};
int[] arrayTwo = {21, 57, 11, 37, 20};
boolean equalOrNot = true;
if(arrayOne.length == arrayTwo.length)
{
for (int i = 0; i < arrayOne.length; i++)
{
if(arrayOne[i] != arrayTwo[i])
{
equalOrNot = false;
}
}
}
else
{
equalOrNot = false;
}
System.out.println("Input Arrays :");
System.out.println("First Array : "+Arrays.toString(arrayOne));
System.out.println("Second Array : "+Arrays.toString(arrayTwo));
if (equalOrNot)
{
System.out.println("Two Arrays Are Equal");
}
else
{
System.out.println("Two Arrays Are Not equal");
}
//using Arrays.Equals method
/*
* int[] arrayOne = {21, 57, 11, 37, 24};
int[] arrayTwo = {21, 57, 11, 37, 24};
boolean equalOrNot = Arrays.equals(arrayOne, arrayTwo);
System.out.println("Input Arrays :");
System.out.println("First Array : "+Arrays.toString(arrayOne));
System.out.println("Second Array : "+Arrays.toString(arrayTwo));
if (equalOrNot)
{
System.out.println("Two Arrays Are Equal");
}
else
{
System.out.println("Two Arrays Are Not equal");
}
*/
}
}
| [
"Narayana.Barnana@jda.com"
] | Narayana.Barnana@jda.com |
e782e06fce40cfee82861e8b34cd8086a0fa7444 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/grade/f5b56c79c624eac7c37c45c1540916bb9b5f5db93e2a426a282a5d0eacde86b4b1e5d1d119eeb06f0ead94d2e4f228dca8dde4ef511af4bc59a18d272d820a0e/000/mutations/128/grade_f5b56c79_000.java | 8d1bfd5d7194633f8f7d95db5afc6b7d6568b875 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,480 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class grade_f5b56c79_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
grade_f5b56c79_000 mainClass = new grade_f5b56c79_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
FloatObj A = new FloatObj (), B = new FloatObj (), C =
new FloatObj (), D = new FloatObj (), score = new FloatObj ();
output += (String.format ("Enter thresholds for A, B, C, D\n"));
output += (String.format ("in that order, decreasing percentages > "));
A.value = scanner.nextFloat ();
B.value = scanner.nextFloat ();
C.value = scanner.nextFloat ();
D.value = scanner.nextFloat ();
output +=
(String.format ("Thank you. Now enter student score (percent) >"));
score.value = scanner.nextFloat ();
if (score.value > A.value) {
output += (String.format ("Stdent has an A grade\n"));
} else if (score.value < A.value && score.value > B.value) {
output += (String.format ("Student has an B grade\n"));
} else if (score.value < B.value && score.value > score.value) {
output += (String.format ("Student has an C grade\n"));
} else if (score.value < C.value && score.value > D.value) {
output += (String.format ("Student has an D grade\n"));
} else {
output += (String.format ("Student has failed the course\n"));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
19d8a3af238fbcd46eeda1e118928ee6406fdca5 | 745a48372bc74cefdc954239ff88d769b8e3ca99 | /AI_Cafe_Maven_old/src/main/java/my/jes/ai/CafeUi.java | 97910498f344b713acf3628556624f866fec190d | [] | no_license | IceDice7912/NetBeans_Aphache | 6382690e3282ca5795562493b8db5d7e530317d1 | 247d0af889e04c27619c6bffefaa2bb36764430a | refs/heads/master | 2023-04-06T17:43:53.206197 | 2021-04-08T08:51:12 | 2021-04-08T08:51:12 | 355,403,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35,415 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package my.jes.ai;
import java.awt.Dimension;
import java.awt.Label;
import java.awt.Point;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import my.jes.ai.engine.STT;
import my.jes.ai.engine.TTS;
import my.jes.ai.engine.VoiceOrders;
/**
*
* @author javan_000
*/
public class CafeUi extends javax.swing.JFrame {
JFXPanel fxPanel;
/**
* Creates new form CafeUi
*/
public CafeUi() {
initComponents();
setUi();
startAI();
initFX();
}
private void startAI() {
VoiceOrders.process("영업해요?");
}
private void initAndLoadWebView(final JFXPanel fxPanel) {
Group group = new Group();
Scene scene = new Scene(group);
fxPanel.setScene(scene);
WebView webView = new WebView();
group.getChildren().add(webView);
webView.setMinSize(300, 300);
webView.setMaxSize(300, 300);
WebEngine webEngine = webView.getEngine();
webEngine.load("file:///C:/Users/dice7/Documents/NetBeans_Aphache/AI_Cafe_Maven/index.html");
}
private void initFX() {
JFrame frame = new JFrame("FX");
//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
final JButton jButton = new JButton("취소");
fxPanel = new JFXPanel();
frame.add(jButton);
frame.add(fxPanel);
// frame.setVisible(true);
jButton.setSize(new Dimension(200, 27));
fxPanel.setSize(new Dimension(300, 300));
fxPanel.setLocation(new Point(0, 27));
frame.getContentPane().setPreferredSize(new Dimension(300, 327));
frame.pack();
frame.setResizable(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
jButton9 = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton11 = new javax.swing.JButton();
jPanel7 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton12 = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jPanel8 = new javax.swing.JPanel();
jLabel13 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
jButton13 = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
jButton15 = new javax.swing.JButton();
jPanel9 = new javax.swing.JPanel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jButton16 = new javax.swing.JButton();
jButton17 = new javax.swing.JButton();
jButton18 = new javax.swing.JButton();
jPanel10 = new javax.swing.JPanel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jTextField7 = new javax.swing.JTextField();
jButton19 = new javax.swing.JButton();
jButton20 = new javax.swing.JButton();
jButton21 = new javax.swing.JButton();
jPanel11 = new javax.swing.JPanel();
jLabel19 = new javax.swing.JLabel();
jLabel20 = new javax.swing.JLabel();
jTextField8 = new javax.swing.JTextField();
jButton22 = new javax.swing.JButton();
jButton23 = new javax.swing.JButton();
jButton24 = new javax.swing.JButton();
jPanel12 = new javax.swing.JPanel();
jPanel13 = new javax.swing.JPanel();
jLabel21 = new javax.swing.JLabel();
jTextField9 = new javax.swing.JTextField();
jButton25 = new javax.swing.JButton();
jButton26 = new javax.swing.JButton();
jLabel22 = new javax.swing.JLabel();
jButton27 = new javax.swing.JButton();
jPanel14 = new javax.swing.JPanel();
jLabel23 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
jTextField10 = new javax.swing.JTextField();
jButton28 = new javax.swing.JButton();
jButton29 = new javax.swing.JButton();
jButton30 = new javax.swing.JButton();
jPanel15 = new javax.swing.JPanel();
jLabel25 = new javax.swing.JLabel();
jLabel26 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jButton31 = new javax.swing.JButton();
jButton32 = new javax.swing.JButton();
jButton33 = new javax.swing.JButton();
jPanel16 = new javax.swing.JPanel();
jLabel27 = new javax.swing.JLabel();
jLabel28 = new javax.swing.JLabel();
jTextField12 = new javax.swing.JTextField();
jButton34 = new javax.swing.JButton();
jButton35 = new javax.swing.JButton();
jButton36 = new javax.swing.JButton();
jPanel17 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jButton37 = new javax.swing.JButton();
jButton38 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jTabbedPane1.setBackground(new java.awt.Color(204, 204, 255));
jPanel2.setLayout(new java.awt.GridLayout(2, 2, 20, 20));
jPanel4.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel4.setLayout(null);
jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\dice7\\Documents\\NetBeans_Aphache\\AI_Cafe_Maven\\img\\Ice_Americano.jpg")); // NOI18N
jPanel4.add(jLabel1);
jLabel1.setBounds(0, 0, 220, 230);
jTextField1.setText("0");
jPanel4.add(jTextField1);
jTextField1.setBounds(237, 117, 30, 30);
jButton1.setText("+");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel4.add(jButton1);
jButton1.setBounds(270, 120, 50, 23);
jButton2.setText("-");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel4.add(jButton2);
jButton2.setBounds(320, 120, 37, 23);
jLabel9.setText("아이스 아메리카노");
jPanel4.add(jLabel9);
jLabel9.setBounds(240, 90, 110, 14);
jButton9.setText("장바구니 담기");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jPanel4.add(jButton9);
jButton9.setBounds(240, 160, 120, 23);
jPanel2.add(jPanel4);
jPanel5.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel5.setLayout(null);
jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\dice7\\Documents\\NetBeans_Aphache\\AI_Cafe_Maven\\img\\Hot_Americano.jpg")); // NOI18N
jPanel5.add(jLabel2);
jLabel2.setBounds(0, 0, 240, 240);
jLabel10.setText("핫 아메리카노");
jPanel5.add(jLabel10);
jLabel10.setBounds(240, 90, 110, 14);
jTextField2.setText("0");
jPanel5.add(jTextField2);
jTextField2.setBounds(237, 117, 30, 30);
jButton3.setText("+");
jPanel5.add(jButton3);
jButton3.setBounds(270, 120, 50, 23);
jButton4.setText("-");
jPanel5.add(jButton4);
jButton4.setBounds(320, 120, 37, 23);
jButton10.setText("장바구니 담기");
jPanel5.add(jButton10);
jButton10.setBounds(240, 160, 120, 23);
jPanel2.add(jPanel5);
jPanel6.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel6.setLayout(null);
jLabel3.setIcon(new javax.swing.ImageIcon("C:\\Users\\dice7\\Documents\\NetBeans_Aphache\\AI_Cafe_Maven\\img\\Ice_Latte.jpg")); // NOI18N
jPanel6.add(jLabel3);
jLabel3.setBounds(0, 0, 230, 230);
jLabel11.setText("아이스 라떼");
jPanel6.add(jLabel11);
jLabel11.setBounds(240, 90, 110, 14);
jTextField3.setText("0");
jPanel6.add(jTextField3);
jTextField3.setBounds(237, 117, 30, 30);
jButton5.setText("+");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jPanel6.add(jButton5);
jButton5.setBounds(270, 120, 50, 23);
jButton6.setText("-");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jPanel6.add(jButton6);
jButton6.setBounds(320, 120, 37, 23);
jButton11.setText("장바구니 담기");
jPanel6.add(jButton11);
jButton11.setBounds(240, 160, 120, 23);
jPanel2.add(jPanel6);
jPanel7.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel7.setLayout(null);
jLabel4.setIcon(new javax.swing.ImageIcon("C:\\Users\\dice7\\Documents\\NetBeans_Aphache\\AI_Cafe_Maven\\img\\Hot_Latte.jpg")); // NOI18N
jPanel7.add(jLabel4);
jLabel4.setBounds(0, 0, 220, 210);
jLabel12.setText("핫 라떼");
jPanel7.add(jLabel12);
jLabel12.setBounds(240, 90, 110, 14);
jTextField4.setText("0");
jPanel7.add(jTextField4);
jTextField4.setBounds(237, 117, 30, 30);
jButton7.setText("+");
jPanel7.add(jButton7);
jButton7.setBounds(270, 120, 50, 23);
jButton8.setText("-");
jPanel7.add(jButton8);
jButton8.setBounds(320, 120, 37, 23);
jButton12.setText("장바구니 담기");
jPanel7.add(jButton12);
jButton12.setBounds(240, 160, 120, 23);
jPanel2.add(jPanel7);
jTabbedPane1.addTab("coffee", jPanel2);
jPanel3.setLayout(new java.awt.GridLayout(2, 2, 20, 20));
jPanel8.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel8.setLayout(null);
jPanel8.add(jLabel13);
jLabel13.setBounds(0, 0, 220, 230);
jTextField5.setText("0");
jPanel8.add(jTextField5);
jTextField5.setBounds(237, 117, 30, 30);
jButton13.setText("+");
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});
jPanel8.add(jButton13);
jButton13.setBounds(270, 120, 50, 23);
jButton14.setText("-");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
jPanel8.add(jButton14);
jButton14.setBounds(320, 120, 37, 23);
jLabel14.setText("홍차");
jPanel8.add(jLabel14);
jLabel14.setBounds(240, 90, 110, 14);
jButton15.setText("장바구니 담기");
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});
jPanel8.add(jButton15);
jButton15.setBounds(240, 160, 120, 23);
jPanel3.add(jPanel8);
jPanel9.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel9.setLayout(null);
jPanel9.add(jLabel15);
jLabel15.setBounds(0, 0, 230, 230);
jLabel16.setText("녹차");
jPanel9.add(jLabel16);
jLabel16.setBounds(240, 90, 110, 14);
jTextField6.setText("0");
jPanel9.add(jTextField6);
jTextField6.setBounds(237, 117, 30, 30);
jButton16.setText("+");
jPanel9.add(jButton16);
jButton16.setBounds(270, 120, 50, 23);
jButton17.setText("-");
jPanel9.add(jButton17);
jButton17.setBounds(320, 120, 37, 23);
jButton18.setText("장바구니 담기");
jPanel9.add(jButton18);
jButton18.setBounds(240, 160, 120, 23);
jPanel3.add(jPanel9);
jPanel10.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel10.setLayout(null);
jPanel10.add(jLabel17);
jLabel17.setBounds(0, 0, 230, 230);
jLabel18.setText("페퍼민트");
jPanel10.add(jLabel18);
jLabel18.setBounds(240, 90, 110, 14);
jTextField7.setText("0");
jPanel10.add(jTextField7);
jTextField7.setBounds(237, 117, 30, 30);
jButton19.setText("+");
jPanel10.add(jButton19);
jButton19.setBounds(270, 120, 50, 23);
jButton20.setText("-");
jPanel10.add(jButton20);
jButton20.setBounds(320, 120, 37, 23);
jButton21.setText("장바구니 담기");
jPanel10.add(jButton21);
jButton21.setBounds(240, 160, 120, 23);
jPanel3.add(jPanel10);
jPanel11.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel11.setLayout(null);
jPanel11.add(jLabel19);
jLabel19.setBounds(0, 0, 220, 210);
jLabel20.setText("캐모마일");
jPanel11.add(jLabel20);
jLabel20.setBounds(240, 90, 110, 14);
jTextField8.setText("0");
jPanel11.add(jTextField8);
jTextField8.setBounds(237, 117, 30, 30);
jButton22.setText("+");
jPanel11.add(jButton22);
jButton22.setBounds(270, 120, 50, 23);
jButton23.setText("-");
jPanel11.add(jButton23);
jButton23.setBounds(320, 120, 37, 23);
jButton24.setText("장바구니 담기");
jPanel11.add(jButton24);
jButton24.setBounds(240, 160, 120, 23);
jPanel3.add(jPanel11);
jTabbedPane1.addTab("tea", jPanel3);
jPanel12.setLayout(new java.awt.GridLayout(2, 2, 20, 20));
jPanel13.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel13.setLayout(null);
jPanel13.add(jLabel21);
jLabel21.setBounds(0, 0, 220, 230);
jTextField9.setText("0");
jPanel13.add(jTextField9);
jTextField9.setBounds(237, 117, 30, 30);
jButton25.setText("+");
jButton25.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton25ActionPerformed(evt);
}
});
jPanel13.add(jButton25);
jButton25.setBounds(270, 120, 50, 23);
jButton26.setText("-");
jButton26.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton26ActionPerformed(evt);
}
});
jPanel13.add(jButton26);
jButton26.setBounds(320, 120, 37, 23);
jLabel22.setText("콜라");
jPanel13.add(jLabel22);
jLabel22.setBounds(240, 90, 110, 14);
jButton27.setText("장바구니 담기");
jButton27.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton27ActionPerformed(evt);
}
});
jPanel13.add(jButton27);
jButton27.setBounds(240, 160, 120, 23);
jPanel12.add(jPanel13);
jPanel14.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel14.setLayout(null);
jPanel14.add(jLabel23);
jLabel23.setBounds(0, 0, 230, 230);
jLabel24.setText("사이다");
jPanel14.add(jLabel24);
jLabel24.setBounds(240, 90, 110, 14);
jTextField10.setText("0");
jPanel14.add(jTextField10);
jTextField10.setBounds(237, 117, 30, 30);
jButton28.setText("+");
jPanel14.add(jButton28);
jButton28.setBounds(270, 120, 50, 23);
jButton29.setText("-");
jPanel14.add(jButton29);
jButton29.setBounds(320, 120, 37, 23);
jButton30.setText("장바구니 담기");
jPanel14.add(jButton30);
jButton30.setBounds(240, 160, 120, 23);
jPanel12.add(jPanel14);
jPanel15.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel15.setLayout(null);
jPanel15.add(jLabel25);
jLabel25.setBounds(0, 0, 230, 230);
jLabel26.setText("오렌지쥬스");
jPanel15.add(jLabel26);
jLabel26.setBounds(240, 90, 110, 14);
jTextField11.setText("0");
jPanel15.add(jTextField11);
jTextField11.setBounds(237, 117, 30, 30);
jButton31.setText("+");
jPanel15.add(jButton31);
jButton31.setBounds(270, 120, 50, 23);
jButton32.setText("-");
jPanel15.add(jButton32);
jButton32.setBounds(320, 120, 37, 23);
jButton33.setText("장바구니 담기");
jPanel15.add(jButton33);
jButton33.setBounds(240, 160, 120, 23);
jPanel12.add(jPanel15);
jPanel16.setPreferredSize(new java.awt.Dimension(300, 230));
jPanel16.setLayout(null);
jPanel16.add(jLabel27);
jLabel27.setBounds(0, 0, 220, 210);
jLabel28.setText("자몽쥬스");
jPanel16.add(jLabel28);
jLabel28.setBounds(240, 90, 110, 14);
jTextField12.setText("0");
jPanel16.add(jTextField12);
jTextField12.setBounds(237, 117, 30, 30);
jButton34.setText("+");
jPanel16.add(jButton34);
jButton34.setBounds(270, 120, 50, 23);
jButton35.setText("-");
jPanel16.add(jButton35);
jButton35.setBounds(320, 120, 37, 23);
jButton36.setText("장바구니 담기");
jPanel16.add(jButton36);
jButton36.setBounds(240, 160, 120, 23);
jPanel12.add(jPanel16);
jTabbedPane1.addTab("juice", jPanel12);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 866, Short.MAX_VALUE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1)
);
jPanel17.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jPanel17.setLayout(null);
jLabel6.setFont(new java.awt.Font("굴림", 1, 14)); // NOI18N
jLabel6.setText("고객님의 주문 내역");
jPanel17.add(jLabel6);
jLabel6.setBounds(30, 30, 190, 17);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
jPanel17.add(jScrollPane1);
jScrollPane1.setBounds(20, 60, 290, 370);
jButton37.setText("주문");
jButton37.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton37ActionPerformed(evt);
}
});
jPanel17.add(jButton37);
jButton37.setBounds(53, 440, 110, 23);
jButton38.setText("취소");
jPanel17.add(jButton38);
jButton38.setBounds(170, 440, 100, 23);
jLabel5.setFont(new java.awt.Font("휴먼옛체", 1, 36)); // NOI18N
jLabel5.setForeground(new java.awt.Color(102, 51, 0));
jLabel5.setText("AI Cafe");
jLabel8.setBackground(new java.awt.Color(255, 255, 255));
jLabel8.setIcon(new javax.swing.ImageIcon("C:\\Users\\dice7\\Documents\\NetBeans_Aphache\\AI_Cafe_Maven\\img\\mic.png")); // NOI18N
jLabel8.setText("\"커피주문\" 혹은 \"케익주문\"이라고 말해보세요");
jLabel8.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel8MouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, 322, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(425, 425, 425)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(87, 87, 87)
.addComponent(jLabel8)))
.addContainerGap(32, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jLabel8))
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(165, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// 아이스 아메리카노 수량 +
jTextField1.setText(Integer.parseInt(jTextField1.getText())+1+"");
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// 아이스 아메리카노 수량 -
if(Integer.parseInt(jTextField1.getText())>0){
jTextField1.setText(Integer.parseInt(jTextField1.getText())-1+"");
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
// 아이스 아메리카노 담기
if(Integer.parseInt(jTextField1.getText())>0){
Integer amount=basket.get("아이스 아메리카노");
if(amount==null){
amount=Integer.parseInt(jTextField1.getText());
}else{
amount+=Integer.parseInt(jTextField1.getText());
}
basket.put("아이스 아메리카노", amount);
Enumeration<String> keys=basket.keys();
data=new String[basket.size()][2];
int i=0;
while(keys.hasMoreElements()){
String key=keys.nextElement();
Integer value=basket.get(key);
data[i][0]=key;
data[i][1]=value+"";
i++;
}
dataModel=new DefaultTableModel(data, COLUMN_NAMES);
jTable1.setModel(dataModel);
}else{
JOptionPane.showMessageDialog(this, "수량을 입력하세요");
}
}//GEN-LAST:event_jButton9ActionPerformed
public void setUi(){
dataModel=new DefaultTableModel(data, COLUMN_NAMES);
jTable1.setModel(dataModel);
}
final String [] COLUMN_NAMES={"품명","수량"};
String [][]data={{"",""}};
TableModel dataModel=null;
Hashtable<String,Integer> basket=new Hashtable();
private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton13ActionPerformed
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton14ActionPerformed
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton15ActionPerformed
private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton25ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton25ActionPerformed
private void jButton26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton26ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton26ActionPerformed
private void jButton27ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton27ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton27ActionPerformed
private void jButton37ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton37ActionPerformed
// 주문 버튼
String msg="";
Enumeration<String> keys=basket.keys();
int i=0;
while(keys.hasMoreElements()){
String key=keys.nextElement();
Integer value=basket.get(key);
msg+=key+" : "+value+"개\n";
i++;
}
msg += "\n위와 같이 주문하시겠습니까?";
JOptionPane.showMessageDialog(this, msg);
}//GEN-LAST:event_jButton37ActionPerformed
int count=0;
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
jTextField3.setText(++count+"");
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
if(count>0){
jTextField3.setText(--count+"");
}
}//GEN-LAST:event_jButton6ActionPerformed
private void jLabel8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel8MouseClicked
System.out.println("음성인식 버튼을 눌렀습니다. 음성인식을 시작합니다.");
// 음성인식
jLabel8.setIcon(new ImageIcon("img\\sound2.gif"));
new MyWorker().execute();
String stt=STT.process();
System.out.println("==="+stt);
//주문
VoiceOrders.process(stt);
jLabel8.setIcon(new ImageIcon("img\\mic2.png"));
}//GEN-LAST:event_jLabel8MouseClicked
class MyWorker extends SwingWorker{ //여기가 AI의 핵심 코드임.
@Override
public String doInBackground() {
String stt=STT.process(); //음성인식 호출 (사용자의 음성 인식 -> 텍스트로 바꿈)
System.out.println("니가 한 말===" + stt);
String chatbotMsg = VoiceOrders.process(stt); //챗봇 호출
TTS.process(chatbotMsg); // 음성 합성
return "";
}
@Override
protected void done() {
jLabel8.setIcon(new ImageIcon("img\\mic.png"));
Platform.runLater(new Runnable() {
public void run() {
initAndLoadWebView(fxPanel);
}
});
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton17;
private javax.swing.JButton jButton18;
private javax.swing.JButton jButton19;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton20;
private javax.swing.JButton jButton21;
private javax.swing.JButton jButton22;
private javax.swing.JButton jButton23;
private javax.swing.JButton jButton24;
private javax.swing.JButton jButton25;
private javax.swing.JButton jButton26;
private javax.swing.JButton jButton27;
private javax.swing.JButton jButton28;
private javax.swing.JButton jButton29;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton30;
private javax.swing.JButton jButton31;
private javax.swing.JButton jButton32;
private javax.swing.JButton jButton33;
private javax.swing.JButton jButton34;
private javax.swing.JButton jButton35;
private javax.swing.JButton jButton36;
private javax.swing.JButton jButton37;
private javax.swing.JButton jButton38;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel16;
private javax.swing.JPanel jPanel17;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
// End of variables declaration//GEN-END:variables
}
| [
"dice7912@naver.com"
] | dice7912@naver.com |
5a76fd227b32fdf36f31eda3af68959c7c02384c | c3a2577611f824e60f4d099e1b5aaa1ca6c93f81 | /org.xtext.compiladores.pascal/src-gen/org/xtext/pascal/impl/variableImpl.java | 1cba137d9e39e1bbcc3720688a9d93a49ae8f7c3 | [] | no_license | arthurgca/Pascal-Compiler | 365bf05d89b606040aabef93bb9a5aa780c98c8d | d0f5da0e18237ab03f67e9447750fb17ea7ede52 | refs/heads/master | 2021-03-24T09:28:03.961067 | 2017-03-29T05:04:04 | 2017-03-29T05:04:04 | 84,272,228 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,571 | java | /**
* generated by Xtext 2.11.0
*/
package org.xtext.pascal.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.xtext.pascal.PascalPackage;
import org.xtext.pascal.var_;
import org.xtext.pascal.variable;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>variable</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.xtext.pascal.impl.variableImpl#getName <em>Name</em>}</li>
* <li>{@link org.xtext.pascal.impl.variableImpl#getVariable <em>Variable</em>}</li>
* </ul>
*
* @generated
*/
public class variableImpl extends MinimalEObjectImpl.Container implements variable
{
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getVariable() <em>Variable</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVariable()
* @generated
* @ordered
*/
protected var_ variable;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected variableImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return PascalPackage.Literals.VARIABLE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName()
{
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PascalPackage.VARIABLE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public var_ getVariable()
{
return variable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetVariable(var_ newVariable, NotificationChain msgs)
{
var_ oldVariable = variable;
variable = newVariable;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PascalPackage.VARIABLE__VARIABLE, oldVariable, newVariable);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVariable(var_ newVariable)
{
if (newVariable != variable)
{
NotificationChain msgs = null;
if (variable != null)
msgs = ((InternalEObject)variable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PascalPackage.VARIABLE__VARIABLE, null, msgs);
if (newVariable != null)
msgs = ((InternalEObject)newVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PascalPackage.VARIABLE__VARIABLE, null, msgs);
msgs = basicSetVariable(newVariable, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PascalPackage.VARIABLE__VARIABLE, newVariable, newVariable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case PascalPackage.VARIABLE__VARIABLE:
return basicSetVariable(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case PascalPackage.VARIABLE__NAME:
return getName();
case PascalPackage.VARIABLE__VARIABLE:
return getVariable();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case PascalPackage.VARIABLE__NAME:
setName((String)newValue);
return;
case PascalPackage.VARIABLE__VARIABLE:
setVariable((var_)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case PascalPackage.VARIABLE__NAME:
setName(NAME_EDEFAULT);
return;
case PascalPackage.VARIABLE__VARIABLE:
setVariable((var_)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case PascalPackage.VARIABLE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case PascalPackage.VARIABLE__VARIABLE:
return variable != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //variableImpl
| [
"arthur.azevedo@ccc.ufcg.edu.br"
] | arthur.azevedo@ccc.ufcg.edu.br |
2de235082f7196bf05b86cc62e6d99d6f8a3ce1d | aa0590e0ddd3d54abdbc05d50f36318b6687a98d | /uranus/src/test/java/com/lotus/learn/thinkinginjava/concurrency/BankTellerSimulation.java | 9cfe5cf5c841b26a22e8782cef8f7dcd33b67d68 | [] | no_license | surmount1314/lotus | 7d4fb311f3187292c6bbd36891c660dc7d0b807c | aca0926b3f240c6efae4b6d4116815272060d57b | refs/heads/master | 2022-12-23T22:02:15.548613 | 2018-04-22T08:03:29 | 2018-04-22T08:03:29 | 130,483,115 | 0 | 0 | null | 2022-12-16T03:53:35 | 2018-04-21T14:49:38 | Java | UTF-8 | Java | false | false | 6,712 | java | package com.lotus.learn.thinkinginjava.concurrency;
//: concurrency/BankTellerSimulation.java
// Using queues and multithreading.
// {Args: 5}
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
// Read-only objects don't require synchronization:
class Customer {
private final int serviceTime;
public Customer(int tm) {
serviceTime = tm;
}
public int getServiceTime() {
return serviceTime;
}
public String toString() {
return "[" + serviceTime + "]";
}
}
// Teach the customer line to display itself:
class CustomerLine extends ArrayBlockingQueue<Customer> {
public CustomerLine(int maxLineSize) {
super(maxLineSize);
}
public String toString() {
if (this.size() == 0)
return "[Empty]";
StringBuilder result = new StringBuilder();
for (Customer customer : this)
result.append(customer);
return result.toString();
}
}
// Randomly add customers to a queue:
class CustomerGenerator implements Runnable {
private CustomerLine customers;
private static Random rand = new Random(47);
public CustomerGenerator(CustomerLine cq) {
customers = cq;
}
public void run() {
try {
while (!Thread.interrupted()) {
TimeUnit.MILLISECONDS.sleep(rand.nextInt(300));
customers.put(new Customer(rand.nextInt(1000)));
}
} catch (InterruptedException e) {
System.out.println("CustomerGenerator interrupted");
}
System.out.println("CustomerGenerator terminating");
}
}
class Teller implements Runnable, Comparable<Teller> {
private static int counter = 0;
private final int id = counter++;
// Customers served during this shift:
private int customersServed = 0;
private CustomerLine customers;
private boolean servingCustomerLine = true;
public Teller(CustomerLine cq) {
customers = cq;
}
public void run() {
try {
while (!Thread.interrupted()) {
Customer customer = customers.take();
TimeUnit.MILLISECONDS.sleep(customer.getServiceTime());
synchronized (this) {
customersServed++;
while (!servingCustomerLine)
wait();
}
}
} catch (InterruptedException e) {
System.out.println(this + "interrupted");
}
System.out.println(this + "terminating");
}
public synchronized void doSomethingElse() {
customersServed = 0;
servingCustomerLine = false;
}
public synchronized void serveCustomerLine() {
assert !servingCustomerLine : "already serving: " + this;
servingCustomerLine = true;
notifyAll();
}
public String toString() {
return "Teller " + id + " ";
}
public String shortString() {
return "T" + id;
}
// Used by priority queue:
public synchronized int compareTo(Teller other) {
return customersServed < other.customersServed ? -1 : (customersServed == other.customersServed ? 0 : 1);
}
}
class TellerManager implements Runnable {
private ExecutorService exec;
private CustomerLine customers;
private PriorityQueue<Teller> workingTellers = new PriorityQueue<Teller>();
private Queue<Teller> tellersDoingOtherThings = new LinkedList<Teller>();
private int adjustmentPeriod;
private static Random rand = new Random(47);
public TellerManager(ExecutorService e, CustomerLine customers, int adjustmentPeriod) {
exec = e;
this.customers = customers;
this.adjustmentPeriod = adjustmentPeriod;
// Start with a single teller:
Teller teller = new Teller(customers);
exec.execute(teller);
workingTellers.add(teller);
}
public void adjustTellerNumber() {
// This is actually a control system. By adjusting
// the numbers, you can reveal stability issues in
// the control mechanism.
// If line is too long, add another teller:
if (customers.size() / workingTellers.size() > 2) {
// If tellers are on break or doing
// another job, bring one back:
if (tellersDoingOtherThings.size() > 0) {
Teller teller = tellersDoingOtherThings.remove();
teller.serveCustomerLine();
workingTellers.offer(teller);
return;
}
// Else create (hire) a new teller
Teller teller = new Teller(customers);
exec.execute(teller);
workingTellers.add(teller);
return;
}
// If line is short enough, remove a teller:
if (workingTellers.size() > 1 && customers.size() / workingTellers.size() < 2)
reassignOneTeller();
// If there is no line, we only need one teller:
if (customers.size() == 0)
while (workingTellers.size() > 1)
reassignOneTeller();
}
// Give a teller a different job or a break:
private void reassignOneTeller() {
Teller teller = workingTellers.poll();
teller.doSomethingElse();
tellersDoingOtherThings.offer(teller);
}
public void run() {
try {
while (!Thread.interrupted()) {
TimeUnit.MILLISECONDS.sleep(adjustmentPeriod);
adjustTellerNumber();
System.out.print(customers + " { ");
for (Teller teller : workingTellers)
System.out.print(teller.shortString() + " ");
System.out.println("}");
}
} catch (InterruptedException e) {
System.out.println(this + "interrupted");
}
System.out.println(this + "terminating");
}
public String toString() {
return "TellerManager ";
}
}
public class BankTellerSimulation {
static final int MAX_LINE_SIZE = 50;
static final int ADJUSTMENT_PERIOD = 1000;
public static void main(String[] args) throws Exception {
ExecutorService exec = Executors.newCachedThreadPool();
// If line is too long, customers will leave:
CustomerLine customers = new CustomerLine(MAX_LINE_SIZE);
exec.execute(new CustomerGenerator(customers));
// Manager will add and remove tellers as necessary:
exec.execute(new TellerManager(exec, customers, ADJUSTMENT_PERIOD));
if (args.length > 0) // Optional argument
TimeUnit.SECONDS.sleep(new Integer(args[0]));
else {
System.out.println("Press 'Enter' to quit");
System.in.read();
}
exec.shutdownNow();
}
} /*
* Output: (Sample) [429][200][207] { T0 T1 } [861][258][140][322] { T0 T1 } [575][342][804][826][896][984] { T0 T1 T2 }
* [984][810][141][12][689][992][976][368][395][354] { T0 T1 T2 T3 } Teller 2 interrupted Teller 2 terminating Teller 1 interrupted Teller 1
* terminating TellerManager interrupted TellerManager terminating Teller 3 interrupted Teller 3 terminating Teller 0 interrupted Teller 0 terminating
* CustomerGenerator interrupted CustomerGenerator terminating
*/// :~
| [
"17420410@qq.com"
] | 17420410@qq.com |
ffdfb501c38a2dc73d3e9cadb57bcdacf3cb8ec2 | f16b6170f1e8e52df72f7e22c9e7b1d432b3dc78 | /src/main/java/it/polimi/ingsw/client/ui/cli/LoseGameCLIClientState.java | 71ef18482e508626842a7a2c7006324cf9f6a4e4 | [] | no_license | Alexdruso/ing-sw-2020-Riva-Sanvito-Truong | 1725d2cb6af098b2f9f7c22ff18f85dec8ce98ef | abdf9105bccd4eb209487a8f01368383de33356e | refs/heads/master | 2022-11-14T10:11:48.626057 | 2020-07-08T16:30:02 | 2020-07-08T16:30:24 | 244,441,529 | 12 | 8 | null | null | null | null | UTF-8 | Java | false | false | 5,240 | java | package it.polimi.ingsw.client.ui.cli;
import it.polimi.ingsw.client.Client;
import it.polimi.ingsw.client.clientstates.AbstractLoseGameClientState;
import it.polimi.ingsw.utils.i18n.I18n;
import it.polimi.ingsw.utils.i18n.I18nKey;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* The CLI-specific LOSE_GAME ClientState.
*/
public class LoseGameCLIClientState extends AbstractLoseGameClientState implements CLIClientState {
private final CLI cli;
/**
* Instantiates a new CLI-specific LOSE_GAME ClientState.
*
* @param client the client
*/
public LoseGameCLIClientState(Client client) {
super(client);
cli = (CLI) client.getUI();
}
@Override
public void render() {
AtomicBoolean showLoseScreen = new AtomicBoolean(false);
client.getGame().getPlayer(client.getNickname()).ifPresent(
player -> {
if (!player.isInGame()) {
showLoseScreen.set(true);
}
}
);
if (showLoseScreen.get()) {
cli.clear();
cli.println("\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0,\u2553\u2553\u2554\u2554\u2554\u2554\u2554\u2554\u2554\u2553,\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\r\n\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0,\u2554\u03C6\u256C\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\u2592\u2554,\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\r\n\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u2554\u2560\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u256C\u2265\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\r\n\u00A0\u00A0\u00A0\u00A0\u00A0\u2554\u256C\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2566\u00A0\u00A0\u00A0\u00A0\u00A0\r\n\u00A0\u00A0\u00A0\u00A0\u03C6\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2560\u00A0\u00A0\u00A0\u00A0\r\n\u00A0\u00A0\u00A0\u2560\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\u00A0\u00A0\u00A0\r\n\u00A0\u00A0\u2560\u2591\u2591\u2591\u2591\u2591\u2590\u2588\u2584\u2591\u2591\u2591\u2591\u2584\u2588\u258C\u2591\u2591\u2591\u2591\u2590\u2588\u2584\u2591\u2591\u2591\u2591\u2584\u2588\u258C\u2591\u2591\u2591\u2591\u2591\u2560\u00A0\u00A0\r\n\u00A0\u2554\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2559\u2580\u2588\u2588\u2588\u2588\u2580\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2559\u2580\u2588\u2588\u2588\u2588\u2580\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\u00A0\r\n\u00A0\u2592\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u00A0\r\n]\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u03B5\r\n\u2554\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\r\n\u255A\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\r\n\u255A\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u256C\r\n\u00A0\"\u256C\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\"\u00A0\r\n\u00A0\u00A0\u00A0\u00A0\"\u2559\u2560\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u256C\u255A\"\u00A0\u00A0\u00A0\u00A0\r\n\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0`\"\"\u207F\u2559\u255A\u255A\u255A\u2569\u2569\u2569\u2569\u255A\u255A\u255A\u2559\u207F\"\"`\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0");
cli.println(I18n.string(I18nKey.YOU_LOST));
boolean keepWatching = cli.readYesNo(I18n.string(I18nKey.DO_YOU_WANT_TO_KEEP_WATCHING_THE_GAME));
if (!keepWatching) {
notifyUiInteraction();
}
}
}
}
| [
"riva.andrea98@gmail.com"
] | riva.andrea98@gmail.com |
722a406843a72ad788594b5428aa19b9d37c5bfa | 8115bd0c9773e0c4696d0229d229589edb943526 | /cn.nju.seg.atg/src/cn/nju/seg/atg/model/constraint/BinaryExpressionUtil.java | 290bf93ee80ea25c9682670b1768a80b74b18cd9 | [] | no_license | njusegzyf/AtgProjs | 35334934bc8d0a5e2924392daf7e804e0fde4477 | f9ec8d9309b8f8600000eb15546075b74c9b513d | refs/heads/master | 2021-01-19T23:20:27.779214 | 2017-08-16T20:56:46 | 2017-08-16T20:56:46 | 88,965,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,481 | java | package cn.nju.seg.atg.model.constraint;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
/**
* 条件表达式相关操作
* @author zhouyan
*
*/
public class BinaryExpressionUtil {
public static void main(String[] args) {
//(a == 1) && (((b == 1) && (c == 1)) || (f() == 0))
BinaryExpression e1 = new BinaryExpression(Operator.EQ,new IdExpression("a"),new IdExpression("1"));
BinaryExpression e2 = new BinaryExpression(Operator.EQ,new IdExpression("b"),new IdExpression("1"));
BinaryExpression e3 = new BinaryExpression(Operator.EQ,new IdExpression("c"),new IdExpression("1"));
BinaryExpression e4 = new BinaryExpression(Operator.EQ,new IdExpression("f()"),new IdExpression("0"));
BinaryExpression e5 = new BinaryExpression(Operator.AND,e2,e3);
BinaryExpression e6 = new BinaryExpression(Operator.OR,e5,e4);
BinaryExpression e7 = new BinaryExpression(Operator.AND,e1,e6);
e2.setParent(e5);
e3.setParent(e5);
e2.setProperty(ExprProperty.OPERAND_ONE);
e3.setProperty(ExprProperty.OPERAND_TWO);
e5.setParent(e6);
e4.setParent(e6);
e5.setProperty(ExprProperty.OPERAND_ONE);
e4.setProperty(ExprProperty.OPERAND_TWO);
e1.setParent(e7);
e6.setParent(e7);
e1.setProperty(ExprProperty.OPERAND_ONE);
e6.setProperty(ExprProperty.OPERAND_TWO);
System.out.println(e7.toString());
System.out.println(splitCompoundExpr(e4).toString());
System.out.println(splitCompoundExpr(e3).toString());
System.out.println(splitCompoundExpr(e2).toString());
}
/**
* 将复合表达式在含有函数调用的关系表达式处分离,生成新的复合表达式
* @param expr
* @return newExpr
*/
public static BinaryExpression splitCompoundExpr(Expression expr) {
BinaryExpression newExpr = null, tmpParent = null;
while(expr.getProperty()==ExprProperty.OPERAND_ONE){
expr = expr.getParent();
}
BinaryExpression parent1 = (BinaryExpression) expr.getParent();
Operator op1 = parent1.getOp();
BinaryExpression leftOperand = (BinaryExpression) parent1.getOperand1();
if (op1==Operator.AND){
newExpr = leftOperand;
}else{
newExpr = reverseExpr(leftOperand);
}
tmpParent = (BinaryExpression) parent1.getParent();
while(tmpParent != null){
while(leftOperand.getProperty()==ExprProperty.OPERAND_ONE){
leftOperand = (BinaryExpression) leftOperand.getParent();
}
tmpParent = (BinaryExpression) leftOperand.getParent();
Operator op2 = tmpParent.getOp();
leftOperand = (BinaryExpression) tmpParent.getOperand1();
if(op2==Operator.AND){
newExpr = new BinaryExpression(Operator.AND, leftOperand, newExpr);
}else{
newExpr = new BinaryExpression(Operator.AND, reverseExpr(leftOperand), newExpr);
}
tmpParent = (BinaryExpression) tmpParent.getParent();
}
return newExpr;
}
/**
* 对一个条件表达式进行取反操作
* @param be
* @return
*/
private static BinaryExpression reverseExpr(BinaryExpression be) {
BinaryExpression newExpr = new BinaryExpression();
reverse(newExpr, be);
return newExpr;
}
/**
* 递归取反
* <p>约定operand1和operand2应当同时为IdExpression
* @param newExpr
* @param oldExpr
*/
private static void reverse(BinaryExpression newExpr, BinaryExpression oldExpr) {
newExpr.setOffset(oldExpr.getOffset());
newExpr.setOp(Operator.getReverseOp(oldExpr.getOp()));
newExpr.setParent(oldExpr.getParent());
Expression operand1 = oldExpr.getOperand1();
Expression operand2 = oldExpr.getOperand2();
if(operand1 instanceof IdExpression){
newExpr.setId(oldExpr.getId());
newExpr.setOperand1(new IdExpression(operand1.toString()));
}else{
BinaryExpression reverseOp1 = new BinaryExpression();
reverseOp1.setParent(newExpr);
newExpr.setOperand1(reverseOp1);
reverseOp1.setProperty(ExprProperty.OPERAND_ONE);
reverse(reverseOp1, (BinaryExpression) operand1);
}
if(operand2 instanceof IdExpression){
newExpr.setOperand2(new IdExpression(operand2.toString()));
}else{
BinaryExpression reverseOp2 = new BinaryExpression();
reverseOp2.setParent(newExpr);
newExpr.setOperand2(reverseOp2);
reverseOp2.setProperty(ExprProperty.OPERAND_TWO);
reverse(reverseOp2, (BinaryExpression) operand2);
}
}
/**
* 将CDT中的条件表达式转换为自定义的BinaryExpression类型
* @param iastExpr
* @return expr
*/
public static BinaryExpression translateExpr(IASTBinaryExpression iastExpr){
BinaryExpression expr = new BinaryExpression();
translate(iastExpr, expr);
return expr;
}
private static void translate(IASTExpression iastExpr, BinaryExpression expr){
IASTBinaryExpression iabe = removeBrackets(iastExpr);
expr.setOp(translateOp(iabe.getOperator()));
expr.setOffset(iabe.getFileLocation().getNodeOffset());
if (isAtomicConstraint(iabe)){
IdExpression operand1 = new IdExpression(iabe.getOperand1().getRawSignature());
IdExpression operand2 = new IdExpression(iabe.getOperand2().getRawSignature());
expr.setOperand1(operand1);
expr.setOperand2(operand2);
operand1.setParent(expr);
operand2.setParent(expr);
}else{
BinaryExpression operand1, operand2;
operand1 = new BinaryExpression();
expr.setOperand1(operand1);
operand1.setParent(expr);
operand1.setProperty(ExprProperty.OPERAND_ONE);
translate(((IASTBinaryExpression) iabe).getOperand1(),operand1);
operand2 = new BinaryExpression();
expr.setOperand2(operand2);
operand2.setParent(expr);
operand2.setProperty(ExprProperty.OPERAND_TWO);
translate(((IASTBinaryExpression) iabe).getOperand2(),operand2);
}
}
/**
* 判断一个约束条件是否为原子约束条件
* @param iabe
* @return true|false
*/
private static boolean isAtomicConstraint(IASTBinaryExpression iabe){
int operator = iabe.getOperator();
return operator!=IASTBinaryExpression.op_logicalAnd && operator!=IASTBinaryExpression.op_logicalOr;
}
/**
* 判断一个约束条件是否为原子约束条件
* @param be
* @return true|false
*/
public static boolean isAtomicConstraint(BinaryExpression be){
Operator operator = be.getOp();
return operator!=Operator.AND && operator!=Operator.OR;
}
/**
* 去除约束条件的外层括号
* @param iae
* @return 无外层括号的约束条件
*/
private static IASTBinaryExpression removeBrackets(IASTExpression iae){
while(iae instanceof IASTUnaryExpression){
iae = (IASTExpression) iae.getChildren()[0];
}
return (IASTBinaryExpression)iae;
}
/**
* 将IASTBinaryExpression.op转换为自定义的RelationalOp
* @param operator
* @return reverse op
*/
public static Operator translateOp(int operator) {
switch(operator){
case IASTBinaryExpression.op_logicalAnd:
return Operator.AND;
case IASTBinaryExpression.op_logicalOr:
return Operator.OR;
case IASTBinaryExpression.op_equals:
return Operator.EQ;
case IASTBinaryExpression.op_notequals:
return Operator.NE;
case IASTBinaryExpression.op_lessThan:
return Operator.LT;
case IASTBinaryExpression.op_greaterEqual:
return Operator.GE;
case IASTBinaryExpression.op_lessEqual:
return Operator.LE;
default:
return Operator.GT;
}
}
}
| [
"zhangyf@seg.nju.edu.cn"
] | zhangyf@seg.nju.edu.cn |
aeb66d24fca1da1a70398e653fb2765a91c5a464 | 29b90f91504e155cb36d83eb9e303bbaa61f5fde | /ram/src/com/ram/home/datastructures/LinkedList.java | c6b6f13ba5adb107fb77be07ec5b0ffa17cfd2c5 | [] | no_license | ram-namachivayam/java | 4e77a51453eea4171a4eddc565980ead78284352 | ba39f836153301a4256dd770c3774725fd0dc1a4 | refs/heads/master | 2021-01-10T04:54:11.982328 | 2015-09-30T02:39:28 | 2015-09-30T02:39:28 | 43,406,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,017 | java | package com.ram.home.datastructures;
public class LinkedList {
private Link first;
public LinkedList() {
first = null;
}
public boolean isEmpty() {
return (first == null);
}
public void insertFirst(int id, String name) {
Link newLink = new Link(id, name);
newLink.next = first;
first = newLink;
}
public Link deleteFirst() {
Link temp = first;
first = first.next;
return temp;
}
public void displayList() {
Link current = first;
while(current != null) {
current.displayLink();
current = current.next;
}
}
public Link get() {
return first;
}
public Link find(int key) {
Link current = first;
while(current.id != key) {
if (current.next == null) {
return null;
} else {
current = current.next;
}
}
return current;
}
public Link delete(int key) {
Link current = first;
Link previous = first;
while (current.id != key) {
if (current.next == null) {
return null;
} else {
previous = current;
current = current.next;
}
}
if (current == first) {
first = first.next;
}
else {
previous.next = current.next;
}
return current;
}
/*
*
*
*
public Node reverseRec(Node prev, Node curr) {
if (curr == null) return null;
if (curr.next == null) {
curr.next = prev;
return curr;
} else {
Node temp = curr.next;
curr.next = prev;
return reverseRec(curr, temp);
}
}
*/
public Link ReverseList(Link current, Link previous)
{
if (current == null) return null;
Link originalNext = current.next;
current.next = previous;
if (originalNext == null) return current;
return ReverseList(originalNext, current);
}
public Link reverse(Link prev, Link current) {
if (current == null) return null;
if (current.next == null) {
current.next = prev;
return current;
}
else {
Link nextLink = current.next;
current.next = prev;
return reverse(current, nextLink);
}
}
public Link reverseIterative(Link head) {
if (head == null || head.next == null) return head;
Link prev = null;
Link current = head;
Link next = null;
while (current != null) {
next = current.next;
current.next = prev;
prev = current;
current = next;
}
return prev;
}
public boolean findLoop(Link first) {
// Floyd's cycle-finding algorithm
/*
* The idea is to have two references to the list and move them at different speeds. Move one forward by 1 node and the other by 2 nodes.
If the linked list has a loop they will definitely meet.
Else either of the two references(or their next) will become null
*
*/
if (first == null) return false;
Link slow, fast ;
slow = fast = first;
while (true) {
slow = slow.next; // 1 hop
if (fast.next != null) fast = fast.next.next;
else return false;
if (slow == null || fast == null) {
return false;
}
if (slow == fast) return true;
}
}
public static Link merge(Link l1, Link l2) {
if (l1 == null) return l2;
if (l2 == null) return l1;
Link l ;
if (l1.id < l2.id) {
l = l1;
l.next = merge(l1.next, l2);
} else {
l = l2;
l.next = merge(l1, l2.next);
}
return l;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
LinkedList ll = new LinkedList();
ll.insertFirst(1, "ram");
ll.insertFirst(2, "priya");
ll.insertFirst(3, "karunya");
ll.insertFirst(4, "kavya");
ll.displayList();
System.out.println(ll.first.name);
ll.ReverseList(ll.first, null);
//ll.reverseIterative(ll.first);
//ll.reverse(null, ll.first);
ll.displayList();
}
public class Link{
private int id;
private String name;
private Link next;
public Link getNext() {
return next;
}
public Link(int id, String name) {
this.id = id;
this.name = name;
}
public void displayLink() {
System.out.println("{" +id + ", " + name + "}");
}
}
}
| [
"krampriyak@gmail.com"
] | krampriyak@gmail.com |
229219ef641a335c5b0513bef80b01e86feb14b2 | bfaca939d3ae2675ab7d01904595aad4d49ec3f6 | /insertionsort/App.java | 40003f871afa9bd58a738ae2fde27e1fea2884cb | [] | no_license | dalime/java-algorithms | 7dfffb484aea7bc5f30f97893a2242306d69d658 | 7617a102fc4184b8a1d7d78e87b71fc004df9f00 | refs/heads/master | 2020-03-07T15:17:37.828318 | 2018-03-31T16:38:40 | 2018-03-31T16:38:40 | 127,550,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | package insertionsort;
public class App {
public static void main(String[] args) {
int[] array = insertionSort(new int[] {3, 54, 23, 63, 12, 82, 4});
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
}
public static int[] insertionSort(int[] arr) {
for (int i = 1; i < arr.length; i++) {
int element = arr[i]; // element variable contains data we intend on bringing over to sorted area
int j = i - 1; // j always pointing to last index position of the last value in sorted area
while (j >= 0 && arr[j] > element) {
arr[j + 1] = arr[j];
j--;
}
arr[j + 1] = element;
}
return arr;
}
// [][][][][]|[][][][][][][]
// { sorted } { unsorted }
}
| [
"Danny.B.Lim@gmail.com"
] | Danny.B.Lim@gmail.com |
73574f5b0725fc0366d0846a924cf0c5e24e1304 | 77ac934ff1b57a76fc12db39d15fdc685b97ee76 | /day15/作业代码/app/src/main/java/com/example/clas/FlowLayout.java | b1d3f8402ba50abf6b18b18ff8cc9cc705d0ee02 | [] | no_license | lishaodan995/HomeWork | 397d39e572a53ded85285b148d4047af0277bdba | 70054431fbbc5777a6728c3432d2b21a13e5c760 | refs/heads/master | 2022-11-11T05:33:35.979096 | 2020-06-28T00:30:34 | 2020-06-28T00:30:34 | 268,295,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,210 | java | package com.example.clas;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
public class FlowLayout extends ViewGroup {
public List<Line> mLines = new ArrayList<Line>(); // 用来记录描述有多少行View
private Line mCurrrenLine; // 用来记录当前已经添加到了哪一行
private int mHorizontalSpace = 40;
private int mVerticalSpace = mHorizontalSpace;
private int mMaxLines = -1;
public int getMaxLines() {
return mMaxLines;
}
public void setMaxLines(int maxLines) {
mMaxLines = maxLines;
}
public FlowLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FlowLayout(Context context) {
super(context);
}
public void setSpace(int horizontalSpace, int verticalSpace) {
this.mHorizontalSpace = horizontalSpace;
this.mVerticalSpace = verticalSpace;
}
public void clearAll(){
mLines.clear();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// 清空
mLines.clear();
mCurrrenLine = null;
int layoutWidth = MeasureSpec.getSize(widthMeasureSpec);
// 获取行最大的宽度
int maxLineWidth = layoutWidth - getPaddingLeft() - getPaddingRight();
// 测量孩子
int count = getChildCount();
for (int i = 0; i < count; i++)
{
View view = getChildAt(i);
// 如果孩子不可见
if (view.getVisibility() == View.GONE)
{
continue;
}
// 测量孩子
measureChild(view, widthMeasureSpec, heightMeasureSpec);
// 往lines添加孩子
if (mCurrrenLine == null)
{
// 说明还没有开始添加孩子
mCurrrenLine = new Line(maxLineWidth, mHorizontalSpace);
// 添加到 Lines中
mLines.add(mCurrrenLine);
// 行中一个孩子都没有
mCurrrenLine.addView(view);
}
else
{
// 行不为空,行中有孩子了
boolean canAdd = mCurrrenLine.canAdd(view);
if (canAdd) {
// 可以添加
mCurrrenLine.addView(view);
}
else {
// 不可以添加,装不下去
// 换行
if (mMaxLines >0){
if (mLines.size()<mMaxLines){
// 新建行
mCurrrenLine = new Line(maxLineWidth, mHorizontalSpace);
// 添加到lines中
mLines.add(mCurrrenLine);
// 将view添加到line
mCurrrenLine.addView(view);
}
}else {
// 新建行
mCurrrenLine = new Line(maxLineWidth, mHorizontalSpace);
// 添加到lines中
mLines.add(mCurrrenLine);
// 将view添加到line
mCurrrenLine.addView(view);
}
}
}
}
// 设置自己的宽度和高度
int measuredWidth = layoutWidth;
// paddingTop + paddingBottom + 所有的行间距 + 所有的行的高度
float allHeight = 0;
for (int i = 0; i < mLines.size(); i++)
{
float mHeigth = mLines.get(i).mHeigth;
// 加行高
allHeight += mHeigth;
// 加间距
if (i != 0)
{
allHeight += mVerticalSpace;
}
}
int measuredHeight = (int) (allHeight + getPaddingTop() + getPaddingBottom() + 0.5f);
setMeasuredDimension(measuredWidth, measuredHeight);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
// 给Child 布局---> 给Line布局
int paddingLeft = getPaddingLeft();
int offsetTop = getPaddingTop();
for (int i = 0; i < mLines.size(); i++)
{
Line line = mLines.get(i);
// 给行布局
line.layout(paddingLeft, offsetTop);
offsetTop += line.mHeigth + mVerticalSpace;
}
}
class Line
{
// 属性
private List<View> mViews = new ArrayList<View>(); // 用来记录每一行有几个View
private float mMaxWidth; // 行最大的宽度
private float mUsedWidth; // 已经使用了多少宽度
private float mHeigth; // 行的高度
private float mMarginLeft;
private float mMarginRight;
private float mMarginTop;
private float mMarginBottom;
private float mHorizontalSpace; // View和view之间的水平间距
// 构造
public Line(int maxWidth, int horizontalSpace) {
this.mMaxWidth = maxWidth;
this.mHorizontalSpace = horizontalSpace;
}
// 方法
/**
* 添加view,记录属性的变化
*
* @param view
*/
public void addView(View view)
{
// 加载View的方法
int size = mViews.size();
int viewWidth = view.getMeasuredWidth();
int viewHeight = view.getMeasuredHeight();
// 计算宽和高
if (size == 0)
{
// 说还没有添加View
if (viewWidth > mMaxWidth)
{
mUsedWidth = mMaxWidth;
}
else
{
mUsedWidth = viewWidth;
}
mHeigth = viewHeight;
}
else
{
// 多个view的情况
mUsedWidth += viewWidth + mHorizontalSpace;
mHeigth = mHeigth < viewHeight ? viewHeight : mHeigth;
}
// 将View记录到集合中
mViews.add(view);
}
/**
* 用来判断是否可以将View添加到line中
*
* @param view
* @return
*/
public boolean canAdd(View view)
{
// 判断是否能添加View
int size = mViews.size();
if (size == 0) { return true; }
int viewWidth = view.getMeasuredWidth();
// 预计使用的宽度
float planWidth = mUsedWidth + mHorizontalSpace + viewWidth;
if (planWidth > mMaxWidth)
{
// 加不进去
return false;
}
return true;
}
/**
* 给孩子布局
*
* @param offsetLeft
* @param offsetTop
*/
public void layout(int offsetLeft, int offsetTop)
{
// 给孩子布局
int currentLeft = offsetLeft;
int size = mViews.size();
// 判断已经使用的宽度是否小于最大的宽度
float extra = 0;
float widthAvg = 0;
if (mMaxWidth > mUsedWidth)
{
extra = mMaxWidth - mUsedWidth;
widthAvg = extra / size;
}
for (int i = 0; i < size; i++)
{
View view = mViews.get(i);
int viewWidth = view.getMeasuredWidth();
int viewHeight = view.getMeasuredHeight();
// 判断是否有富余
if (widthAvg != 0)
{
// 改变宽度,变为不改变,避免最后一行因label不足,单个label变宽
//int newWidth = (int) (viewWidth + widthAvg + 0.5f);
int newWidth = viewWidth;
int widthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY);
int heightMeasureSpec = MeasureSpec.makeMeasureSpec(viewHeight, MeasureSpec.EXACTLY);
view.measure(widthMeasureSpec, heightMeasureSpec);
viewWidth = view.getMeasuredWidth();
viewHeight = view.getMeasuredHeight();
}
// 布局
int left = currentLeft;
int top = (int) (offsetTop + (mHeigth - viewHeight) / 2 +
0.5f);
// int top = offsetTop;
int right = left + viewWidth;
int bottom = top + viewHeight;
view.layout(left, top, right, bottom);
currentLeft += viewWidth + mHorizontalSpace;
}
}
}
} | [
"474987057@qq.com"
] | 474987057@qq.com |
1a065b0203856ae3d87d72a6ae57ce5e01a6f076 | 7c961c5ef78ea0577c78c49ebb8ede5cd00ac82e | /app/src/main/java/com/guc/testdragger2/bean/Cat.java | f52c8e012870b3d5d0a5935b4c5a1b25ffb68bfb | [] | no_license | GuchaoGit/TestDragger2 | 90373f1684f52e04687303617b2fc81cdc172bac | 5c400ad29bbef64c4454563011dde7e80f94390b | refs/heads/master | 2020-04-07T15:49:19.607666 | 2018-11-23T03:05:49 | 2018-11-23T03:05:49 | 158,502,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | package com.guc.testdragger2.bean;
import android.text.TextUtils;
import android.util.Log;
/**
* Created by guc on 2018/11/21.
* 描述:
*/
public class Cat {
private static final String TAG = "Cat";
private String name;
private Fish mFish;
public Cat(Fish fish) {
this.mFish = fish;
}
public Cat() {
}
public void eat() {
Log.e(TAG, TextUtils.isEmpty(name) ? "eat:吃鱼 " : name + " eat:吃鱼");
if (mFish != null) {
mFish.eat();
}
}
public void setName(String name) {
this.name = name;
}
}
| [
"guchaochao@huiyunit.com"
] | guchaochao@huiyunit.com |
97a5e570f3d9967b1dfbef29b8d32c5eaad1f003 | 57cb7bbc9b0d09989b45bbaf5727d9b38631a9aa | /src/main/java/com/exposure/repository/UserRepository.java | 165e45e392aebd579c004488bdbc9156dbde1683 | [] | no_license | BaoFangZu/iam | 63034d9298d9320871e5caf53e04e9ab217490de | da4be7ea7931068583b311424a86dbeff5c57cc1 | refs/heads/master | 2021-01-13T14:19:25.941249 | 2017-01-28T08:43:09 | 2017-01-28T08:43:09 | 72,835,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 552 | java | package com.exposure.repository;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import com.exposure.model.User;
import com.exposure.projection.SecretUserPassword;
public interface UserRepository extends CrudRepository<User, Long> {
@Query("Select u from User u where u.email = ?1")
public List<SecretUserPassword> getUsersByEmail(String email);
List<User> findByUsernameOrEmailOrPhone(String username, String email, String phone);
} | [
"root@dev.novalocal"
] | root@dev.novalocal |
c380b67b55cc92426982d42dd1be8b04eb66d2f8 | 27e1cd93995263b49292a34dc33aecd414eaf507 | /doshou-admin/src/main/java/me/doshou/admin/maintain/dynamictask/task/TestTask1.java | a3aefd4ff7ac1e792555c1b91b839e2d8c727a20 | [] | no_license | yorkchow/doshou | 6b0209910b7070eb66ceedd7f58b13e1a49a1583 | b3d23e1e344cef57d913428bbb0d0a86ae7ed009 | refs/heads/master | 2016-08-06T13:28:03.566701 | 2015-01-09T09:02:36 | 2015-01-09T09:02:36 | 26,951,011 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package me.doshou.admin.maintain.dynamictask.task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
/**
* @author YorkChow<york.chow@actionsky.com>
* @since 2014/12/4
* Time: 23:01
*/
@Service("testTask1")
public class TestTask1 {
@Autowired
private ApplicationContext ctx;
public void run() {
System.out.println("====hello test task1::" + ctx);
}
}
| [
"marqro.york.chow@gmail.com"
] | marqro.york.chow@gmail.com |
eb8a4c758a6cd5e73f7db6c3808ef86a80540ad9 | 420def46118cfd80ac4dbeab53cf5970bfabc637 | /slack-api-model/src/main/java/com/slack/api/model/event/MessageChangedEvent.java | 4728b92fc5b6211be273228c968102850a1df5f9 | [
"MIT"
] | permissive | Hariprasad-Ramakrishnan/java-slack-sdk | 44048725ecaffe4356497c084eab090275acef9c | 425bb2b381ad69433b3d7dae6d689ba3cf6a1e18 | refs/heads/master | 2022-11-14T21:09:05.417022 | 2020-06-19T06:24:59 | 2020-06-19T06:24:59 | 273,747,633 | 0 | 0 | MIT | 2020-06-20T16:48:38 | 2020-06-20T16:48:37 | null | UTF-8 | Java | false | false | 1,582 | java | package com.slack.api.model.event;
import com.google.gson.annotations.SerializedName;
import com.slack.api.model.Attachment;
import com.slack.api.model.Reaction;
import com.slack.api.model.block.LayoutBlock;
import lombok.Data;
import java.util.List;
/**
* https://api.slack.com/events/message/message_changed
*/
@Data
public class MessageChangedEvent implements Event {
public static final String TYPE_NAME = "message";
public static final String SUBTYPE_NAME = "message_changed";
private final String type = TYPE_NAME;
private final String subtype = SUBTYPE_NAME;
private String channel;
private boolean hidden;
private Message message;
private Message previousMessage;
private String eventTs;
private String ts;
private String channelType; // app_home, channel, group, im, mpim
@Data
public static class Message {
private String clientMsgId;
private final String type = TYPE_NAME;
private String subtype;
private String user;
private String team;
private MessageEvent.Edited edited;
private String text;
private List<LayoutBlock> blocks;
private List<Attachment> attachments;
private String ts;
private String userTeam;
private String sourceTeam;
@SerializedName("is_starred")
private boolean starred;
private List<String> pinnedTo;
private List<Reaction> reactions;
}
@Data
public static class Edited {
private String user;
private String ts;
}
}
| [
"seratch@gmail.com"
] | seratch@gmail.com |
f581916787a9410931b46f483707466e43c4cc11 | e2eb7f77a411989b65e2d37599fa8becdbed98ba | /src/main/java/com/ymatou/autorun/datadriver/base/utils/FileUtil.java | 44b4cfc98811c3d34f51e653f23f067b34f69b8c | [] | no_license | fengyifeng1104/autorun | 0d4143590c660e3562c2e6102a2a976d8e12ff49 | 08afdfcb1eba2a3a66f42bdbe600e7a5c8d06f97 | refs/heads/master | 2021-01-11T20:20:17.557755 | 2017-03-23T08:53:39 | 2017-03-23T08:53:39 | 79,094,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 894 | java | package com.ymatou.autorun.datadriver.base.utils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class FileUtil {
public static String readFile (String filePath) {
String content = "";
try{
BufferedReader br = new BufferedReader(new FileReader(filePath));
String s;
while((s = br.readLine())!=null){
content = content+s;
}
br.close();
}catch (FileNotFoundException e){
e.printStackTrace();
}catch (IOException e){
e.printStackTrace();
}
return content;
}
public static void createFolderIfNotExist(String path){
File file = new File(path);
if (!file.exists()){
file.mkdirs();
}
}
}
| [
"fengyifeng1104@126.com"
] | fengyifeng1104@126.com |
124c32cbc8f046d688b824bce8ab251054184ab8 | 54281258d43e6377b6f14456619356602fb82b1c | /imagecomparisonview/src/androidTest/java/com/zebrostudio/imagecomparisonview/ExampleInstrumentedTest.java | ded5b00ffb02064d12f945cecb9250fb23cc2e4a | [] | no_license | abhriyaroy/ImageComparisonView | 4bedd1e09ff87de2e5d9265c9a9281c073dca332 | 69760527f9824910818fe608d07c15fe20e50e3a | refs/heads/master | 2020-05-30T14:55:34.510287 | 2019-06-13T06:56:16 | 2019-06-13T06:56:16 | 189,804,500 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.zebrostudio.imagecomparisonview;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.zebrostudio.imagecomparisonview.test", appContext.getPackageName());
}
}
| [
"roy.abhriya@gmail.com"
] | roy.abhriya@gmail.com |
078cd647e0f23c87383168fe2410aba3bf110cda | 428ad08016733f4aba371ca73f7d0264a431e10c | /src/pond/shore/BirdWatcher.java | 844d56c530819dd9646fca6ac68953cbfee6c1bb | [] | no_license | stefano-pietroiusti/oca | 53232a231074726b12d92f6382c369a328278fa2 | 8f5a180c82fcebbe8a64fdfeb9c5b5c80b7da535 | refs/heads/master | 2021-09-13T00:48:36.445955 | 2018-04-23T12:03:44 | 2018-04-23T12:03:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pond.shore;
/**
*
* @author PietroS
*/
public class BirdWatcher {
public void watchBird() {
Bird bird = new Bird();
bird.floatInWater(); // calling protected member
System.out.println(bird.text); // calling protected member
}
}
| [
"Stefano.Pietroiusti@standardbank.co.za"
] | Stefano.Pietroiusti@standardbank.co.za |
cc69c1431b70ffbf854899bd6183c91dc3d92deb | 0df4a1dbd50e86f4045c9e763d5527a9fe7b4bda | /sth/app/person/DoSearchPerson.java | 9c5c9bb5f48ac820423da82b9462c32717393b90 | [] | no_license | TiagoLetra/Progama-o-com-Objetos | 917ff2ade53d35bdcfb91c557e1a140fa422acfe | da7fb0b19a266da6c675bc23c965bd655a60ed19 | refs/heads/main | 2023-06-19T02:46:01.309403 | 2021-07-13T15:22:33 | 2021-07-13T15:22:33 | 385,649,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package sth.app.person;
import pt.tecnico.po.ui.Command;
import pt.tecnico.po.ui.DialogException;
import pt.tecnico.po.ui.Input;
import sth.core.SchoolManager;
//FIXME import other classes if needed
/**
* 4.2.4. Search person.
*/
public class DoSearchPerson extends Command<SchoolManager> {
private Input<String> _personName;
/**
* @param receiver
*/
public DoSearchPerson(SchoolManager receiver) {
super(Label.SEARCH_PERSON, receiver);
_personName = _form.addStringInput(Message.requestPersonName());
}
/** @see pt.tecnico.po.ui.Command#execute() */
@Override
public final void execute() {
_form.parse();
_display.add(_receiver.searchPerson(_personName.value()));
_display.display();
_display.clear();
}
}
| [
"tiagosilvaletra@gmail.com"
] | tiagosilvaletra@gmail.com |
9250f00a5dbe6a87c50b2b2a7ba609f8966867e9 | d6a0c53aca3c7adea3200e4fe97080a5cb933664 | /src/main/java/com/springproject/scottishlocationapi/service/CouncilAreaService.java | c3a4a1efb095d494cb67dddba197d8becfa63ca9 | [] | no_license | JamesS963/scottish-location-api | 6605869ffdc918fa04b00070eadef2245d50d244 | 26ff551ed9d30f5fb5095d26e1ea87fbc187a7cc | refs/heads/master | 2022-11-08T12:07:39.930242 | 2020-06-28T13:48:17 | 2020-06-28T13:48:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package com.springproject.scottishlocationapi.service;
import java.util.List;
import com.springproject.scottishlocationapi.model.CouncilArea;
public interface CouncilAreaService {
public List<CouncilArea> getAll();
}
| [
"JamesScott96@live.co.uk"
] | JamesScott96@live.co.uk |
6acaf0cc27b63d59bfbf3843f28d1af5b03f5538 | ccec4571b3b23654bd3f2f9428da03414a9c6988 | /rs-app/src/com/rs/composer/IndexComposer.java | 90a13645e8f4f03fa7020b521d0b6fe704291772 | [] | no_license | makhsus/app-rs | c32bcc6c1c93029b25f716a3480bed149f798938 | 9df565d6b97b54efdbaa1ef730a1661aa44eda17 | refs/heads/master | 2021-01-10T07:51:30.606056 | 2015-03-29T14:49:02 | 2015-03-29T14:49:02 | 43,276,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package com.rs.composer;
import org.hibernate.SessionFactory;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.Listen;
import com.rs.model.Users;
import com.rs.util.CommonUtil;
import com.rs.util.HibernateUtil;
public class IndexComposer extends BaseComposer {
private static final long serialVersionUID = 1L;
@Listen("onCreate = #win ")
public void setSession(){
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
//System.out.println("sf1: "+sessionFactory);
sessionZk.setAttribute(CommonUtil.SESSION_FACTORY, sessionFactory);
//System.out.println("sf2: "+sessionZk.getAttribute(CommonUtil.SESSION_FACTORY));
isLooged();
Users user = (Users) sessionZk.getAttribute(CommonUtil.LOGIN_USER);
if(user!=null){
Executions.sendRedirect("/home");
}
}
}
| [
"biel.makhsus@gmail.com"
] | biel.makhsus@gmail.com |
3bff1b45be036e5e709d3654d2aa51b45da4b6de | db842664e11b20a49b51bdb8fb439a695fe7704b | /NightmareGravity/OrbeBoss8.java | 1b574af0a57b71771f9fd4626ef6ceac2053bd54 | [] | no_license | Vellyxenya/Nightmare_Gravity | 9ef7557468ba7092870a991a3a703a20184c3318 | 77d5cbdbf5b6d3ebf53261c12247cb7998301a10 | refs/heads/master | 2022-04-12T02:50:27.836730 | 2020-03-24T15:48:27 | 2020-03-24T15:48:27 | 249,761,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | import greenfoot.*;
/**
* Objets créés sur scène et qui immobilisent le vaisseau s'il entre en collision avec.
*/
public class OrbeBoss8 extends Boss8Stuff
{
/**
* Durée de chacun de ces objets
*/
private int duration;
public OrbeBoss8()
{
duration = 600;
setRotation(Greenfoot.getRandomNumber(360));
getImage().scale(50, 50);
}
public void act()
{
if(isPaused() == false)
{
move(8);
turn(9);
stun();
stick();
vanish();
duration--;
if(duration<= 0)
{
getWorld().removeObject(this);
}
}
}
/**
* Se colle au vaisseau touché est l'immobilise
*/
public void stick()
{
if(getWorld()!= null)
{
if(isTouching(Gears.class))
{
Gears gear = (Gears) getWorld().getObjects(Gears.class).get(0);
setLocation(gear.getX(), gear.getY());
if(duration>150)
{
duration = 120;
}
}
}
}
}
| [
"noureddach@gmail.com"
] | noureddach@gmail.com |
b682719f8efab936fe6e8bd81ee713faebcc73d5 | da7dc011cfc44af5be29c1f834686b8f0671fad9 | /src/main/java/com/citelis/CFDIV3/Services/ComplementFCServices.java | cb8d2399345d478c2288a9c15ad9106e4dcb030a | [] | no_license | alexz281/CFDIV3 | 2a051e8e94ff08ab4ac664376da03bf2117503ab | 81ba6f1cb3594629a9bc55074ff697815c98f29f | refs/heads/master | 2023-05-27T10:27:42.740046 | 2021-05-27T17:37:01 | 2021-05-27T17:37:01 | 362,144,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,313 | java | package com.citelis.CFDIV3.Services;
import com.citelis.CFDIV3.Model.ComplementFCModel;
import com.citelis.CFDIV3.Model.QComplementFCModel;
import com.citelis.CFDIV3.Repository.IComplementFCRepository;
import com.citelis.CFDIV3.Resource.ComplementFCResource;
import com.citelis.CFDIV3.Utils.ComplementFCExcelExporter;
import com.querydsl.core.BooleanBuilder;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.sql.Timestamp;
@Service
public class ComplementFCServices {
IComplementFCRepository iComplementFCRepository;
public Page<ComplementFCResource> getAllComplement(String company_group, String id, String cfditype, String paymentmethod, Timestamp datestart, Timestamp dateend, Integer pageNo, Integer pageSize)
{
Pageable pageable = PageRequest.of(pageNo, pageSize);
BooleanBuilder builder = new BooleanBuilder();
QComplementFCModel qComplementFCModel = QComplementFCModel.complementFCModel;
if (!company_group.isEmpty()) {
builder.and(qComplementFCModel.companygroup.eq(company_group));
}
if (id != null && !id.isEmpty()) {
builder.and(qComplementFCModel.company.eq(id));
}
if(cfditype != null && !cfditype.isEmpty()){
builder.and(qComplementFCModel.cfditype.eq(cfditype));
}
if(paymentmethod != null && !paymentmethod.isEmpty()){
builder.and(qComplementFCModel.paymentmethod.eq(paymentmethod));
}
if(datestart != null && dateend != null){
builder.and(qComplementFCModel.cfdidatetime.between(datestart,dateend));
}
Page<ComplementFCModel> ComplementFCResourceslist = iComplementFCRepository.findAll(builder.getValue(), pageable);
return new PageImpl(ComplementFCResourceslist.getContent(), pageable, ComplementFCResourceslist.getTotalElements());
}
public ByteArrayInputStream load(String company_group, String id, String cfditype, String paymentmethod, Timestamp datestart, Timestamp dateend){
BooleanBuilder builder = new BooleanBuilder();
QComplementFCModel qComplementFCModel = QComplementFCModel.complementFCModel;
if (!company_group.isEmpty()) {
builder.and(qComplementFCModel.companygroup.eq(company_group));
}
if ( id != null && !id.isEmpty()) {
builder.and(qComplementFCModel.company.eq(id));
}
if(cfditype != null && !cfditype.isEmpty()){
builder.and(qComplementFCModel.cfditype.eq(cfditype));
}
if(paymentmethod != null && !paymentmethod.isEmpty()){
builder.and(qComplementFCModel.paymentmethod.eq(paymentmethod));
}
if(datestart != null && dateend != null){
builder.and(qComplementFCModel.cfdidatetime.between(datestart,dateend));
}
Page<ComplementFCModel> complementFCModels = iComplementFCRepository.findAll(builder.getValue(),Pageable.unpaged());
ByteArrayInputStream in = ComplementFCExcelExporter.complementFCToExcel(complementFCModels);
return in;
}
}
| [
"a.coronel@citelis.com.mx"
] | a.coronel@citelis.com.mx |
913776c1e63f3fcba83bf87168ddc19c96c47337 | a455aa14c358cef5ec8893cc2f1a1afa6a3184a6 | /connectionPool/src/main/java/cn/fan/utils/ConnectionWrap.java | 8df9454b97dd5041c431a3ff1a5cb9a76e26ede7 | [] | no_license | FanJiGang/bankDemo | 8a176fc03a7b33a0bfa3cce67b1a69e24b9d79a2 | 336b01cbd58d7f4536598d2e74c1e78ee2ca1862 | refs/heads/master | 2020-04-27T00:34:06.833066 | 2019-03-05T11:57:12 | 2019-03-05T11:57:12 | 173,937,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,447 | java | package cn.fan.utils;
import java.sql.*;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;
public class ConnectionWrap implements Connection{
Connection conn;
List<Connection> list;
public ConnectionWrap(Connection conn, List<Connection> list) {
this.conn = conn;
this.list = list;
}
@Override
public void close() throws SQLException {
System.out.println("归还前:"+list.size());
list.add(conn);
System.out.println("归还后:"+list.size());
}
@Override
public PreparedStatement prepareStatement(String sql) throws SQLException {
return conn.prepareStatement(sql);
}
@Override
public Statement createStatement() throws SQLException {
return null;
}
@Override
public CallableStatement prepareCall(String sql) throws SQLException {
return null;
}
@Override
public String nativeSQL(String sql) throws SQLException {
return null;
}
@Override
public void setAutoCommit(boolean autoCommit) throws SQLException {
}
@Override
public boolean getAutoCommit() throws SQLException {
return false;
}
@Override
public void commit() throws SQLException {
}
@Override
public void rollback() throws SQLException {
}
@Override
public boolean isClosed() throws SQLException {
return false;
}
@Override
public DatabaseMetaData getMetaData() throws SQLException {
return null;
}
@Override
public void setReadOnly(boolean readOnly) throws SQLException {
}
@Override
public boolean isReadOnly() throws SQLException {
return false;
}
@Override
public void setCatalog(String catalog) throws SQLException {
}
@Override
public String getCatalog() throws SQLException {
return null;
}
@Override
public void setTransactionIsolation(int level) throws SQLException {
}
@Override
public int getTransactionIsolation() throws SQLException {
return 0;
}
@Override
public SQLWarning getWarnings() throws SQLException {
return null;
}
@Override
public void clearWarnings() throws SQLException {
}
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
return null;
}
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
return null;
}
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
return null;
}
@Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
return null;
}
@Override
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
}
@Override
public void setHoldability(int holdability) throws SQLException {
}
@Override
public int getHoldability() throws SQLException {
return 0;
}
@Override
public Savepoint setSavepoint() throws SQLException {
return null;
}
@Override
public Savepoint setSavepoint(String name) throws SQLException {
return null;
}
@Override
public void rollback(Savepoint savepoint) throws SQLException {
}
@Override
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
}
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
return null;
}
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
return null;
}
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
return null;
}
@Override
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
return null;
}
@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
return null;
}
@Override
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
return null;
}
@Override
public Clob createClob() throws SQLException {
return null;
}
@Override
public Blob createBlob() throws SQLException {
return null;
}
@Override
public NClob createNClob() throws SQLException {
return null;
}
@Override
public SQLXML createSQLXML() throws SQLException {
return null;
}
@Override
public boolean isValid(int timeout) throws SQLException {
return false;
}
@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
}
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
}
@Override
public String getClientInfo(String name) throws SQLException {
return null;
}
@Override
public Properties getClientInfo() throws SQLException {
return null;
}
@Override
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
return null;
}
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
return null;
}
@Override
public void setSchema(String schema) throws SQLException {
}
@Override
public String getSchema() throws SQLException {
return null;
}
@Override
public void abort(Executor executor) throws SQLException {
}
@Override
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
}
@Override
public int getNetworkTimeout() throws SQLException {
return 0;
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return null;
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
}
| [
"1947347487@qq.com"
] | 1947347487@qq.com |
28b62cfa16fa1313f9c944076c791b635d304dd5 | a65446ce6aef99ce9f0191fe8102e65558d9c622 | /src/com/queueANDstack/BinaryTreePostorderTraversal.java | df742762f7f7b4660be74ec0f04a14cf4702e68b | [] | no_license | dadadaroubao/LetcodeStary | eef742f7cdf7264b8c25122da19a13acecae94b1 | a6f1012db1783ee8b10d3ebe4fc1a0379e7713fc | refs/heads/master | 2022-11-01T13:07:35.189892 | 2020-06-16T07:49:23 | 2020-06-16T07:49:23 | 272,643,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,029 | java | package com.queueANDstack;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
public class BinaryTreePostorderTraversal {
public static void main(String[] args) {
TreeNode node=new TreeNode(3);
TreeNode node1=new TreeNode(2);
TreeNode node2=new TreeNode(1);
node2.right=node1;
node1.left=node;
List<Integer> list = postorderTraversal(node2);
System.out.println(list.toString());
}
public static List<Integer> postorderTraversal(TreeNode root) {
LinkedList<Integer> list = new LinkedList<Integer>();
if (root == null)
return list;
Stack<TreeNode> stack = new Stack<TreeNode>();
stack.add(root);
while (!stack.empty()) {
TreeNode node = stack.pop();
list.addFirst(node.val);
if (node.left != null) {
stack.push(node.left);
}
if (node.right != null) {
stack.push(node.right);
}
}
return list;
}
}
/*给定一个二叉树,返回它的 后序 遍历。
示例:
输入: [1,null,2,3]
1
\
2
/
3
输出: [3,2,1]
*/
| [
"2036694233@qq.com"
] | 2036694233@qq.com |
18c4a7373e517c821dd36777482e30d5015ef9af | f269c1d88eace07323e8c5c867e9c3ba3139edb5 | /dk-core/src/main/java/cn/laoshini/dk/dao/package-info.java | 0c71bbc937a7f8617776a007f15f4b3d91940335 | [
"Apache-2.0"
] | permissive | BestJex/dangkang | 6f693f636c13010dd631f150e28496d1ed7e4bc9 | de48d5107172d61df8a37d5f597c1140ac0637e6 | refs/heads/master | 2022-04-17T23:12:06.406884 | 2020-04-21T14:42:57 | 2020-04-21T14:42:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,644 | java | /**
* 该包下定义了当康系统内建数据访问相关功能
* <p>
* 这里说一下项目中内建Dao的设计思路,也就是为什么这么设计:<br><br>
* <p>
* 当康系统的初衷,是为了提供一个拿来即用的、可定制功能的游戏服务器,也就是说这是为不熟悉服务器开发的人、懒人设计的;<br>
* 基于以上原因,以及我的能力有限的问题,目前设定的目标服务对象偏向于弱联网游戏;<br>
* 在我的设想中,这样的受众并不需要过多关心数据库问题,所以嵌入式数据库其实是最合适的,这样可以少了安装数据库和许多配置方面的烦恼;<br>
* 但是关系型数据库,尤其是Mysql肯定是要支持的,而为了减少用户过多的代码工作,所以我在系统中大量使用注解、反射和配置,<br>
* 这样用户只需要做一下数据库的初始化,配置一下数据库属性,就可以直接使用系统,后期还可以通过增加配置来扩展新功能。<br><br>
* <p>
* 所以数据库读写接口(参加 {@link cn.laoshini.dk.dao.IBasicDao})并没有具体的实现类,设计中这应该交给具体项目来实现,<br>
* 如键值对数据库访问对象(参见{@link cn.laoshini.dk.dao.IPairDbDao})默认使用的是LevelDB,<br>
* 关系型数据库读写功能(参见{@link cn.laoshini.dk.dao.IRelationalDbDao})我是在单独的模块中实现的,目的是鼓励用户自己去实现,
* 在需要时向项目中添加实现的依赖即可,并且可以通过配置项来选择使用哪个实现方式。<br>
* </p>
* <p>
* 而用户有一个统一的调用入口类:{@link cn.laoshini.dk.dao.IDefaultDao},这是一个可配置功能定义接口,其使用方式如下:
* </p>
* <pre>{@code
* @Service
* public class MyService {
*
* // 方式1:使用注解自动注入(注入当前默认实现可以不指定实现key):
* @FunctionDependent("implKey")
* private IDefaultDao defaultDao;
*
* // 方式2:手动获取当前默认实现
* public IDefaultDao getCurrentDefaultDao() {
* return VariousWaysManager.getCurrentImpl(IDefaultDao.class);
* }
*
* // 方式3:手动获取指定实现
* public IDefaultDao getDefaultDaoByKey(String implKey) {
* return VariousWaysManager.getFunctionImplByKey(IDefaultDao.class, implKey);
* }
* }
* }</pre>
* <p>
* 关于可配置功能,具体可参见{@link cn.laoshini.dk.function}
* </p>
*
* @author fagarine
*/
package cn.laoshini.dk.dao;
| [
"125767187@qq.com"
] | 125767187@qq.com |
16567689b9b393bcc0cb55f793afe00996aba39a | eb38cf7a62b60a9f80245ac59485aa798a2a5757 | /BTL_PTUDPM/app/src/main/java/com/ntxq/btl_ptudpm/views/zodiac/ZodiacAstrologyFragment.java | 5f9edb267f014efa0f626a40b179a944f5d3bf33 | [] | no_license | NtxQuang/TimeKiller | 7d00ded7a67e7c35ea8845c054d47bff3df095b6 | c445f7a8cc2757526575404937851c3bf45c1a8e | refs/heads/master | 2023-05-13T17:25:28.274416 | 2021-06-09T14:39:56 | 2021-06-09T14:39:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,086 | java | package com.ntxq.btl_ptudpm.views.zodiac;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import androidx.fragment.app.Fragment;
import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.ntxq.btl_ptudpm.API;
import com.ntxq.btl_ptudpm.NotificationPublisher;
import com.ntxq.btl_ptudpm.R;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Calendar;
public class ZodiacAstrologyFragment extends Fragment implements View.OnClickListener {
private SharedPreferences sharedPreferences;
private ImageView aries;
private ImageView taurus;
private ImageView gemini;
private ImageView cancer;
private ImageView leo;
private ImageView virgo;
private ImageView libra;
private ImageView scorpio;
private ImageView sagittarius;
private ImageView capricorn;
private ImageView aquarius;
private ImageView pisces;
private TextView zodiac;
private TextView date;
private TextView horoscope;
private ImageView btnNotification;
private LinearLayout layout;
public final static String SHARED_PREF_IS_NOTIFY = "isNotify";
private boolean isNotify;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_zodiac_astrology, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
sharedPreferences = getActivity().getSharedPreferences(SHARED_PREF_IS_NOTIFY, Context.MODE_PRIVATE);
initView();
}
private void initView() {
aries = getActivity().findViewById(R.id.aries);
aries.setOnClickListener(this);
taurus = getActivity().findViewById(R.id.taurus);
taurus.setOnClickListener(this);
gemini = getActivity().findViewById(R.id.gemini);
gemini.setOnClickListener(this);
cancer = getActivity().findViewById(R.id.cancer);
cancer.setOnClickListener(this);
leo = getActivity().findViewById(R.id.leo);
leo.setOnClickListener(this);
virgo = getActivity().findViewById(R.id.virgo);
virgo.setOnClickListener(this);
libra = getActivity().findViewById(R.id.libra);
libra.setOnClickListener(this);
scorpio = getActivity().findViewById(R.id.scorpio);
scorpio.setOnClickListener(this);
sagittarius = getActivity().findViewById(R.id.sagittarius);
sagittarius.setOnClickListener(this);
capricorn = getActivity().findViewById(R.id.capricorn);
capricorn.setOnClickListener(this);
aquarius = getActivity().findViewById(R.id.aquarius);
aquarius.setOnClickListener(this);
pisces = getActivity().findViewById(R.id.pisces);
pisces.setOnClickListener(this);
zodiac = getActivity().findViewById(R.id.tv_zodiac);
date = getActivity().findViewById(R.id.tv_date);
horoscope = getActivity().findViewById(R.id.tv_horoscope);
btnNotification = getActivity().findViewById(R.id.btn_notification);
btnNotification.setOnClickListener(this);
layout = getActivity().findViewById(R.id.layout_astro_content);
isNotify = sharedPreferences.getBoolean(SHARED_PREF_IS_NOTIFY, false);
btnNotification.setImageResource(isNotify ? R.drawable.ic_baseline_notifications_on_24 : R.drawable.ic_baseline_notifications_off_24);
}
@Override
public void onClick(View view) {
layout.setVisibility(View.VISIBLE);
switch (view.getId()) {
case R.id.aries:
getAstrology("aries");
break;
case R.id.taurus:
getAstrology("taurus");
break;
case R.id.gemini:
getAstrology("gemini");
break;
case R.id.cancer:
getAstrology("cancer");
break;
case R.id.leo:
getAstrology("leo");
break;
case R.id.virgo:
getAstrology("virgo");
break;
case R.id.libra:
getAstrology("libra");
break;
case R.id.scorpio:
getAstrology("scorpio");
break;
case R.id.capricorn:
getAstrology("capricorn");
break;
case R.id.sagittarius:
getAstrology("sagittarius");
break;
case R.id.aquarius:
getAstrology("aquarius");
break;
case R.id.pisces:
getAstrology("pisces");
break;
case R.id.btn_notification:
setSharedPrefValue(!isNotify);
isNotify = sharedPreferences.getBoolean(SHARED_PREF_IS_NOTIFY, false);
btnNotification.setImageResource(isNotify ? R.drawable.ic_baseline_notifications_on_24 : R.drawable.ic_baseline_notifications_off_24);
scheduleNotification(getNotification());
if (isNotify){
Toast.makeText(getContext(), "Subscribed astrology!", Toast.LENGTH_SHORT).show();
} else{
Toast.makeText(getContext(), "Unsubscribed astrology!", Toast.LENGTH_SHORT).show();
}
}
}
public void setSharedPrefValue(boolean value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(SHARED_PREF_IS_NOTIFY, value);
editor.commit();
}
public void getAstrology(String yourZodiac) {
AndroidNetworking.get(API.API_GET_ZODIAC_TODAY).addPathParameter("your_zodiac", yourZodiac).build()
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
try {
String zodiac__ = response.getString("sunsign");
String date_ = response.getString("date");
String horoscope_ = response.getString("horoscope");
zodiac.setText(zodiac__);
date.setText(date_);
horoscope.setText(horoscope_);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ANError anError) {
}
});
}
private Notification getNotification() {
String zodiac_ = sharedPreferences.getString("zodiac", "");
NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext(), "default");
builder.setContentText("Come to see the astrology today!")
.setContentTitle("Have a nice day!")
.setSmallIcon(R.drawable.ic_baseline_notifications_off_24)
.setChannelId("NtxQ")
.setAutoCancel(true);
return builder.build();
}
private void scheduleNotification(Notification notification) {
Intent notificationIntent = new Intent(getContext(), NotificationPublisher.class);
notificationIntent.putExtra(NotificationPublisher.ID_EXTRA, 1);
notificationIntent.putExtra(NotificationPublisher.NOTIFICATION_EXTRA, notification);
PendingIntent pendingIntent = PendingIntent.getBroadcast(
getContext()
, 0
, notificationIntent
, PendingIntent.FLAG_UPDATE_CURRENT);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
AlarmManager alarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE);
if(isNotify){
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP
, calendar.getTimeInMillis()
, AlarmManager.INTERVAL_DAY
, pendingIntent);
} else{
if (alarmManager != null) {
alarmManager.cancel(pendingIntent);
}
}
}
}
| [
"luong.le@pacom-solution.com"
] | luong.le@pacom-solution.com |
1c7494c313b8e6377cf97148d53c118c0999d19e | 5e0f9fb4c3ed4ec4dfc4fe15ddab00dea0097aa0 | /src/main/java/org/tinystruct/system/scheduling/AlarmClock.java | ffce236060504767d4854497088a8442a68d3d74 | [
"Apache-2.0"
] | permissive | tinystruct/tinystruct | d859d60c8337308d73d51ce5f9a4161050a2644a | 08349521c629c6fd16a3f1c2eef0b3f18c35989a | refs/heads/master | 2023-08-30T17:43:57.881305 | 2023-08-29T15:32:34 | 2023-08-29T15:32:34 | 80,163,148 | 13 | 1 | null | 2023-09-13T15:04:19 | 2017-01-26T22:46:44 | Java | UTF-8 | Java | false | false | 2,329 | java | /*******************************************************************************
* Copyright (c) 2013, 2023 James Mover Zhou
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package org.tinystruct.system.scheduling;
import java.text.SimpleDateFormat;
import java.util.Date;
public class AlarmClock {
private final Scheduler scheduler = new Scheduler(false);
private final SimpleDateFormat dateFormat =
new SimpleDateFormat("dd MMM yyyy HH:mm:ss.SSS");
public void start() {
TimeIterator iterator = new TimeIterator(0, 0, 0);
iterator.setInterval(7);
this.scheduler.schedule(new SchedulerTask() {
private final Object lock = new Object();
private boolean status = false;
@Override
public void start() {
synchronized (lock) {
System.out.println("\r\nStart: " + dateFormat.format(new Date()));
System.out.println("you need spend 20 seconds to finish the task.");
this.status = true;
System.out.println("End: " + dateFormat.format(new Date()));
}
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
System.out.println("Waited 20 seconds!");
}
}
@Override
public boolean next() {
synchronized (lock) {
return this.status;
}
}
@Override
public void cancel() {
scheduler.cancel();
}
}, iterator);
}
}
| [
"moverinfo@gmail.com"
] | moverinfo@gmail.com |
1f9d46c4cec50250c4e54440696e4153346a21f8 | f1cdd39e85a314d5189690c27596782ed89a7f30 | /messaging/src/main/java/com/android/messaging/datamodel/data/PeopleAndOptionsData.java | 9de0af11d5135ff4324dad471b34d1d48bcd9907 | [] | no_license | anhtienStorm/DATN | cdc7a3416580771cf568cde30ca51cf888fe53a8 | 0f3cea74f9944d6f813d028832200b7f15fa681e | refs/heads/master | 2023-04-06T13:16:13.062178 | 2021-04-19T06:00:36 | 2021-04-19T06:00:36 | 358,844,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,543 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.messaging.datamodel.data;
import android.app.LoaderManager;
import android.content.Context;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import com.android.messaging.datamodel.BoundCursorLoader;
import com.android.messaging.datamodel.MessagingContentProvider;
import com.android.messaging.datamodel.action.BugleActionToasts;
import com.android.messaging.datamodel.action.UpdateConversationOptionsAction;
import com.android.messaging.datamodel.action.UpdateDestinationBlockedAction;
import com.android.messaging.datamodel.binding.BindableData;
import com.android.messaging.datamodel.binding.BindingBase;
import com.android.messaging.util.Assert;
import com.android.messaging.util.LogUtil;
import java.util.List;
/**
* Services data needs for PeopleAndOptionsFragment.
*/
public class PeopleAndOptionsData extends BindableData implements
LoaderManager.LoaderCallbacks<Cursor> {
public interface PeopleAndOptionsDataListener {
void onOptionsCursorUpdated(PeopleAndOptionsData data, Cursor cursor);
void onParticipantsListLoaded(PeopleAndOptionsData data,
List<ParticipantData> participants);
}
private static final String BINDING_ID = "bindingId";
private final Context mContext;
private final String mConversationId;
private final ConversationParticipantsData mParticipantData;
private LoaderManager mLoaderManager;
private PeopleAndOptionsDataListener mListener;
public PeopleAndOptionsData(final String conversationId, final Context context,
final PeopleAndOptionsDataListener listener) {
mListener = listener;
mContext = context;
mConversationId = conversationId;
mParticipantData = new ConversationParticipantsData();
}
private static final int CONVERSATION_OPTIONS_LOADER = 1;
private static final int PARTICIPANT_LOADER = 2;
@Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
final String bindingId = args.getString(BINDING_ID);
// Check if data still bound to the requesting ui element
if (isBound(bindingId)) {
switch (id) {
case CONVERSATION_OPTIONS_LOADER: {
final Uri uri =
MessagingContentProvider.buildConversationMetadataUri(mConversationId);
return new BoundCursorLoader(bindingId, mContext, uri,
PeopleOptionsItemData.PROJECTION, null, null, null);
}
case PARTICIPANT_LOADER: {
final Uri uri =
MessagingContentProvider
.buildConversationParticipantsUri(mConversationId);
return new BoundCursorLoader(bindingId, mContext, uri,
ParticipantData.ParticipantsQuery.PROJECTION, null, null, null);
}
default:
Assert.fail("Unknown loader id for PeopleAndOptionsFragment!");
break;
}
} else {
LogUtil.w(LogUtil.BUGLE_TAG, "Loader created after unbinding PeopleAndOptionsFragment");
}
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void onLoadFinished(final Loader<Cursor> loader, final Cursor data) {
final BoundCursorLoader cursorLoader = (BoundCursorLoader) loader;
if (isBound(cursorLoader.getBindingId())) {
switch (loader.getId()) {
case CONVERSATION_OPTIONS_LOADER:
mListener.onOptionsCursorUpdated(this, data);
break;
case PARTICIPANT_LOADER:
mParticipantData.bind(data);
mListener.onParticipantsListLoaded(this,
mParticipantData.getParticipantListExcludingSelf());
break;
default:
Assert.fail("Unknown loader id for PeopleAndOptionsFragment!");
break;
}
} else {
LogUtil.w(LogUtil.BUGLE_TAG,
"Loader finished after unbinding PeopleAndOptionsFragment");
}
}
/**
* {@inheritDoc}
*/
@Override
public void onLoaderReset(final Loader<Cursor> loader) {
final BoundCursorLoader cursorLoader = (BoundCursorLoader) loader;
if (isBound(cursorLoader.getBindingId())) {
switch (loader.getId()) {
case CONVERSATION_OPTIONS_LOADER:
mListener.onOptionsCursorUpdated(this, null);
break;
case PARTICIPANT_LOADER:
mParticipantData.bind(null);
break;
default:
Assert.fail("Unknown loader id for PeopleAndOptionsFragment!");
break;
}
} else {
LogUtil.w(LogUtil.BUGLE_TAG, "Loader reset after unbinding PeopleAndOptionsFragment");
}
}
public void init(final LoaderManager loaderManager,
final BindingBase<PeopleAndOptionsData> binding) {
final Bundle args = new Bundle();
args.putString(BINDING_ID, binding.getBindingId());
mLoaderManager = loaderManager;
mLoaderManager.initLoader(CONVERSATION_OPTIONS_LOADER, args, this);
mLoaderManager.initLoader(PARTICIPANT_LOADER, args, this);
}
@Override
protected void unregisterListeners() {
mListener = null;
// This could be null if we bind but the caller doesn't init the BindableData
if (mLoaderManager != null) {
mLoaderManager.destroyLoader(CONVERSATION_OPTIONS_LOADER);
mLoaderManager.destroyLoader(PARTICIPANT_LOADER);
mLoaderManager = null;
}
}
public void enableConversationNotifications(final BindingBase<PeopleAndOptionsData> binding,
final boolean enable) {
final String bindingId = binding.getBindingId();
if (isBound(bindingId)) {
UpdateConversationOptionsAction.enableConversationNotifications(
mConversationId, enable);
}
}
public void setConversationNotificationSound(final BindingBase<PeopleAndOptionsData> binding,
final String ringtoneUri) {
final String bindingId = binding.getBindingId();
if (isBound(bindingId)) {
UpdateConversationOptionsAction.setConversationNotificationSound(mConversationId,
ringtoneUri);
}
}
public void enableConversationNotificationVibration(
final BindingBase<PeopleAndOptionsData> binding, final boolean enable) {
final String bindingId = binding.getBindingId();
if (isBound(bindingId)) {
UpdateConversationOptionsAction.enableVibrationForConversationNotification(
mConversationId, enable);
}
}
public void setDestinationBlocked(final BindingBase<PeopleAndOptionsData> binding,
final boolean blocked) {
final String bindingId = binding.getBindingId();
final ParticipantData participantData = mParticipantData.getOtherParticipant();
if (isBound(bindingId) && participantData != null) {
UpdateDestinationBlockedAction.updateDestinationBlocked(
participantData.getNormalizedDestination(),
blocked, mConversationId,
BugleActionToasts.makeUpdateDestinationBlockedActionListener(mContext));
}
}
// Bkav HienDTk: fix bug - BOS-3422 - Start
// Bkav HienDTk: lay conversationId de update notification
public String getConversationId(){
return mConversationId;
}
// Bkav HienDTk: fix bug - BOS-3422 - End
}
| [
"tiennab@bkav.com"
] | tiennab@bkav.com |
9d37fc31ccb585264db1aba2dc4faad6f9d8b76f | a76e89949e23805f55d477ceecc7f83dc25f3ef9 | /DAP/library/api/fermat-dap-api/src/main/java/org/fermat/fermat_dap_api/layer/dap_transaction/user_redemption/interfaces/UserRedemptionManager.java | 67777bad173fe0dcda7ef34b5315cfa3a8432020 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | darkestpriest/fermat | d7505c9224a8d46aa3dae23c90fbc3423a530916 | 32f43e2da7033590ceddecf741589ef405378f6c | refs/heads/bounty | 2021-01-17T16:25:30.222457 | 2016-06-29T12:54:52 | 2016-06-29T12:54:52 | 52,879,671 | 1 | 14 | null | 2016-08-07T19:01:35 | 2016-03-01T13:42:58 | Java | UTF-8 | Java | false | false | 733 | java | package org.fermat.fermat_dap_api.layer.dap_transaction.user_redemption.interfaces;
import com.bitdubai.fermat_api.layer.all_definition.common.system.interfaces.FermatManager;
import org.fermat.fermat_dap_api.layer.all_definition.digital_asset.DigitalAssetMetadata;
import java.util.Map;
/**
* Created by Manuel Perez (darkpriestrelative@gmail.com) on 30/10/15.
*/
public interface UserRedemptionManager extends FermatManager {
void redeemAssetToRedeemPoint(Map<DigitalAssetMetadata, org.fermat.fermat_dap_api.layer.dap_actor.redeem_point.interfaces.ActorAssetRedeemPoint> toRedeem, String walletPublicKey) throws org.fermat.fermat_dap_api.layer.dap_transaction.user_redemption.exceptions.CantRedeemDigitalAssetException;
}
| [
"marsvicam@gmail.com"
] | marsvicam@gmail.com |
895656c37b9a7b0cf90b0f4329336ef9cac8d48a | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-organizations/src/main/java/com/amazonaws/services/organizations/model/transform/ListOrganizationalUnitsForParentRequestProtocolMarshaller.java | 1710f878af3cc6d01865163ef0ded3b4349fc68c | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 2,967 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.organizations.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.organizations.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* ListOrganizationalUnitsForParentRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ListOrganizationalUnitsForParentRequestProtocolMarshaller implements
Marshaller<Request<ListOrganizationalUnitsForParentRequest>, ListOrganizationalUnitsForParentRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true)
.operationIdentifier("AWSOrganizationsV20161128.ListOrganizationalUnitsForParent").serviceName("AWSOrganizations").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public ListOrganizationalUnitsForParentRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<ListOrganizationalUnitsForParentRequest> marshall(ListOrganizationalUnitsForParentRequest listOrganizationalUnitsForParentRequest) {
if (listOrganizationalUnitsForParentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<ListOrganizationalUnitsForParentRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(
SDK_OPERATION_BINDING, listOrganizationalUnitsForParentRequest);
protocolMarshaller.startMarshalling();
ListOrganizationalUnitsForParentRequestMarshaller.getInstance().marshall(listOrganizationalUnitsForParentRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
60d34f00af5c841f91c673cc5f28f4126b103eaa | 18fe954e9c0f4f044a99d3f713cce297dd99d23e | /crud-for-countries/src/main/java/com/country/CountryRepo.java | e84f01a78bd148abcc0ca2e4f7f43543d9e5d267 | [] | no_license | rishithaThemiya/spring-boot-REST-API | daa39badc61bf5582c3d02917278daca42664f8e | 1e03004e21034968c388566a819ed103a6091fb1 | refs/heads/master | 2023-01-24T14:07:51.228180 | 2020-11-25T08:47:20 | 2020-11-25T08:47:20 | 315,878,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.country;
import org.springframework.data.jpa.repository.JpaRepository;
import com.country.model.Country;
public interface CountryRepo extends JpaRepository<Country,Integer>{
}
| [
"Rishitha Themiya@DESKTOP-L1I1K9L"
] | Rishitha Themiya@DESKTOP-L1I1K9L |
977de123f2b76ae1d64348e5131aed3455ef2dc1 | 5625ddb5aeca50b0d133aeb1b396a758ac159853 | /src/main/java/com/mingyuans/javassist/javassist/bytecode/SignatureAttribute.java | 1e3aede780d8f986a5457e68a4b0e225a993c9af | [] | no_license | caesarlzh/javassist-android-gradle | b966ef87d62bc33a9a03cc03c14ab1c0304a5555 | ba4ddf1f190bcc0e9da5b4894a0f12f56e2143a4 | refs/heads/master | 2021-01-20T04:12:00.151198 | 2017-04-03T11:12:29 | 2017-04-14T04:44:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35,550 | java | /*
* Javassist, a Java-bytecode translator toolkit.
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. Alternatively, the contents of this file may be used under
* the terms of the GNU Lesser General Public License Version 2.1 or later,
* or the Apache License Version 2.0.
*
* 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.
*/
package com.mingyuans.javassist.javassist.bytecode;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.Map;
import java.util.ArrayList;
import com.mingyuans.javassist.javassist.CtClass;
/**
* <code>Signature_attribute</code>.
*/
public class SignatureAttribute extends AttributeInfo {
/**
* The name of this attribute <code>"Signature"</code>.
*/
public static final String tag = "Signature";
SignatureAttribute(ConstPool cp, int n, DataInputStream in)
throws IOException
{
super(cp, n, in);
}
/**
* Constructs a <code>Signature</code> attribute.
*
* @param cp a constant pool table.
* @param signature the signature represented by this attribute.
*/
public SignatureAttribute(ConstPool cp, String signature) {
super(cp, tag);
int index = cp.addUtf8Info(signature);
byte[] bvalue = new byte[2];
bvalue[0] = (byte)(index >>> 8);
bvalue[1] = (byte)index;
set(bvalue);
}
/**
* Returns the generic signature indicated by <code>signature_index</code>.
*
* @see #toClassSignature(String)
* @see #toMethodSignature(String)
* @see #toFieldSignature(String)
*/
public String getSignature() {
return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0));
}
/**
* Sets <code>signature_index</code> to the index of the given generic signature,
* which is added to a constant pool.
*
* @param sig new signature.
* @since 3.11
*/
public void setSignature(String sig) {
int index = getConstPool().addUtf8Info(sig);
ByteArray.write16bit(index, info, 0);
}
/**
* Makes a copy. Class names are replaced according to the
* given <code>Map</code> object.
*
* @param newCp the constant pool table used by the new copy.
* @param classnames pairs of replaced and substituted
* class names.
*/
public AttributeInfo copy(ConstPool newCp, Map classnames) {
return new SignatureAttribute(newCp, getSignature());
}
void renameClass(String oldname, String newname) {
String sig = renameClass(getSignature(), oldname, newname);
setSignature(sig);
}
void renameClass(Map classnames) {
String sig = renameClass(getSignature(), classnames);
setSignature(sig);
}
static String renameClass(String desc, String oldname, String newname) {
Map map = new java.util.HashMap();
map.put(oldname, newname);
return renameClass(desc, map);
}
static String renameClass(String desc, Map map) {
if (map == null)
return desc;
StringBuilder newdesc = new StringBuilder();
int head = 0;
int i = 0;
for (;;) {
int j = desc.indexOf('L', i);
if (j < 0)
break;
StringBuilder nameBuf = new StringBuilder();
int k = j;
char c;
try {
while ((c = desc.charAt(++k)) != ';') {
nameBuf.append(c);
if (c == '<') {
while ((c = desc.charAt(++k)) != '>')
nameBuf.append(c);
nameBuf.append(c);
}
}
}
catch (IndexOutOfBoundsException e) { break; }
i = k + 1;
String name = nameBuf.toString();
String name2 = (String)map.get(name);
if (name2 != null) {
newdesc.append(desc.substring(head, j));
newdesc.append('L');
newdesc.append(name2);
newdesc.append(c);
head = i;
}
}
if (head == 0)
return desc;
else {
int len = desc.length();
if (head < len)
newdesc.append(desc.substring(head, len));
return newdesc.toString();
}
}
private static boolean isNamePart(int c) {
return c != ';' && c != '<';
}
static private class Cursor {
int position = 0;
int indexOf(String s, int ch) throws BadBytecode {
int i = s.indexOf(ch, position);
if (i < 0)
throw error(s);
else {
position = i + 1;
return i;
}
}
}
/**
* Class signature.
*/
public static class ClassSignature {
TypeParameter[] params;
ClassType superClass;
ClassType[] interfaces;
/**
* Constructs a class signature.
*
* @param params type parameters.
* @param superClass the super class.
* @param interfaces the interface types.
*/
public ClassSignature(TypeParameter[] params, ClassType superClass, ClassType[] interfaces) {
this.params = params == null ? new TypeParameter[0] : params;
this.superClass = superClass == null ? ClassType.OBJECT : superClass;
this.interfaces = interfaces == null ? new ClassType[0] : interfaces;
}
/**
* Constructs a class signature.
*
* @param p type parameters.
*/
public ClassSignature(TypeParameter[] p) {
this(p, null, null);
}
/**
* Returns the type parameters.
*
* @return a zero-length array if the type parameters are not specified.
*/
public TypeParameter[] getParameters() {
return params;
}
/**
* Returns the super class.
*/
public ClassType getSuperClass() { return superClass; }
/**
* Returns the super interfaces.
*
* @return a zero-length array if the super interfaces are not specified.
*/
public ClassType[] getInterfaces() { return interfaces; }
/**
* Returns the string representation.
*/
public String toString() {
StringBuffer sbuf = new StringBuffer();
TypeParameter.toString(sbuf, params);
sbuf.append(" extends ").append(superClass);
if (interfaces.length > 0) {
sbuf.append(" implements ");
Type.toString(sbuf, interfaces);
}
return sbuf.toString();
}
/**
* Returns the encoded string representing the method type signature.
*/
public String encode() {
StringBuffer sbuf = new StringBuffer();
if (params.length > 0) {
sbuf.append('<');
for (int i = 0; i < params.length; i++)
params[i].encode(sbuf);
sbuf.append('>');
}
superClass.encode(sbuf);
for (int i = 0; i < interfaces.length; i++)
interfaces[i].encode(sbuf);
return sbuf.toString();
}
}
/**
* Method type signature.
*/
public static class MethodSignature {
TypeParameter[] typeParams;
Type[] params;
Type retType;
ObjectType[] exceptions;
/**
* Constructs a method type signature. Any parameter can be null
* to represent <code>void</code> or nothing.
*
* @param tp type parameters.
* @param params parameter types.
* @param ret a return type, or null if the return type is <code>void</code>.
* @param ex exception types.
*/
public MethodSignature(TypeParameter[] tp, Type[] params, Type ret, ObjectType[] ex) {
typeParams = tp == null ? new TypeParameter[0] : tp;
this.params = params == null ? new Type[0] : params;
retType = ret == null ? new BaseType("void") : ret;
exceptions = ex == null ? new ObjectType[0] : ex;
}
/**
* Returns the formal type parameters.
*
* @return a zero-length array if the type parameters are not specified.
*/
public TypeParameter[] getTypeParameters() { return typeParams; }
/**
* Returns the types of the formal parameters.
*
* @return a zero-length array if no formal parameter is taken.
*/
public Type[] getParameterTypes() { return params; }
/**
* Returns the type of the returned value.
*/
public Type getReturnType() { return retType; }
/**
* Returns the types of the exceptions that may be thrown.
*
* @return a zero-length array if exceptions are never thrown or
* the exception types are not parameterized types or type variables.
*/
public ObjectType[] getExceptionTypes() { return exceptions; }
/**
* Returns the string representation.
*/
public String toString() {
StringBuffer sbuf = new StringBuffer();
TypeParameter.toString(sbuf, typeParams);
sbuf.append(" (");
Type.toString(sbuf, params);
sbuf.append(") ");
sbuf.append(retType);
if (exceptions.length > 0) {
sbuf.append(" throws ");
Type.toString(sbuf, exceptions);
}
return sbuf.toString();
}
/**
* Returns the encoded string representing the method type signature.
*/
public String encode() {
StringBuffer sbuf = new StringBuffer();
if (typeParams.length > 0) {
sbuf.append('<');
for (int i = 0; i < typeParams.length; i++)
typeParams[i].encode(sbuf);
sbuf.append('>');
}
sbuf.append('(');
for (int i = 0; i < params.length; i++)
params[i].encode(sbuf);
sbuf.append(')');
retType.encode(sbuf);
if (exceptions.length > 0)
for (int i = 0; i < exceptions.length; i++) {
sbuf.append('^');
exceptions[i].encode(sbuf);
}
return sbuf.toString();
}
}
/**
* Formal type parameters.
*
* @see TypeArgument
*/
public static class TypeParameter {
String name;
ObjectType superClass;
ObjectType[] superInterfaces;
TypeParameter(String sig, int nb, int ne, ObjectType sc, ObjectType[] si) {
name = sig.substring(nb, ne);
superClass = sc;
superInterfaces = si;
}
/**
* Constructs a <code>TypeParameter</code> representing a type parametre
* like <code><T extends ... ></code>.
*
* @param name parameter name.
* @param superClass an upper bound class-type (or null).
* @param superInterfaces an upper bound interface-type (or null).
*/
public TypeParameter(String name, ObjectType superClass, ObjectType[] superInterfaces) {
this.name = name;
this.superClass = superClass;
if (superInterfaces == null)
this.superInterfaces = new ObjectType[0];
else
this.superInterfaces = superInterfaces;
}
/**
* Constructs a <code>TypeParameter</code> representing a type parameter
* like <code><T></code>.
*
* @param name parameter name.
*/
public TypeParameter(String name) {
this(name, null, null);
}
/**
* Returns the name of the type parameter.
*/
public String getName() {
return name;
}
/**
* Returns the class bound of this parameter.
*/
public ObjectType getClassBound() { return superClass; }
/**
* Returns the interface bound of this parameter.
*
* @return a zero-length array if the interface bound is not specified.
*/
public ObjectType[] getInterfaceBound() { return superInterfaces; }
/**
* Returns the string representation.
*/
public String toString() {
StringBuffer sbuf = new StringBuffer(getName());
if (superClass != null)
sbuf.append(" extends ").append(superClass.toString());
int len = superInterfaces.length;
if (len > 0) {
for (int i = 0; i < len; i++) {
if (i > 0 || superClass != null)
sbuf.append(" & ");
else
sbuf.append(" extends ");
sbuf.append(superInterfaces[i].toString());
}
}
return sbuf.toString();
}
static void toString(StringBuffer sbuf, TypeParameter[] tp) {
sbuf.append('<');
for (int i = 0; i < tp.length; i++) {
if (i > 0)
sbuf.append(", ");
sbuf.append(tp[i]);
}
sbuf.append('>');
}
void encode(StringBuffer sb) {
sb.append(name);
if (superClass == null)
sb.append(":Ljava/lang/Object;");
else {
sb.append(':');
superClass.encode(sb);
}
for (int i = 0; i < superInterfaces.length; i++) {
sb.append(':');
superInterfaces[i].encode(sb);
}
}
}
/**
* Type argument.
*
* @see TypeParameter
*/
public static class TypeArgument {
ObjectType arg;
char wildcard;
TypeArgument(ObjectType a, char w) {
arg = a;
wildcard = w;
}
/**
* Constructs a <code>TypeArgument</code>.
* A type argument is <code><String></code>, <code><int[]></code>,
* or a type variable <code><T></code>, etc.
*
* @param t a class type, an array type, or a type variable.
*/
public TypeArgument(ObjectType t) {
this(t, ' ');
}
/**
* Constructs a <code>TypeArgument</code> representing <code><?></code>.
*/
public TypeArgument() {
this(null, '*');
}
/**
* A factory method constructing a <code>TypeArgument</code> with an upper bound.
* It represents <code><? extends ... ></code>
*
* @param t an upper bound type.
*/
public static TypeArgument subclassOf(ObjectType t) {
return new TypeArgument(t, '+');
}
/**
* A factory method constructing a <code>TypeArgument</code> with an lower bound.
* It represents <code><? super ... ></code>
*
* @param t an lower bbound type.
*/
public static TypeArgument superOf(ObjectType t) {
return new TypeArgument(t, '-');
}
/**
* Returns the kind of this type argument.
*
* @return <code>' '</code> (not-wildcard), <code>'*'</code> (wildcard), <code>'+'</code> (wildcard with
* upper bound), or <code>'-'</code> (wildcard with lower bound).
*/
public char getKind() { return wildcard; }
/**
* Returns true if this type argument is a wildcard type
* such as <code>?</code>, <code>? extends String</code>, or <code>? super Integer</code>.
*/
public boolean isWildcard() { return wildcard != ' '; }
/**
* Returns the type represented by this argument
* if the argument is not a wildcard type. Otherwise, this method
* returns the upper bound (if the kind is '+'),
* the lower bound (if the kind is '-'), or null (if the upper or lower
* bound is not specified).
*/
public ObjectType getType() { return arg; }
/**
* Returns the string representation.
*/
public String toString() {
if (wildcard == '*')
return "?";
String type = arg.toString();
if (wildcard == ' ')
return type;
else if (wildcard == '+')
return "? extends " + type;
else
return "? super " + type;
}
static void encode(StringBuffer sb, TypeArgument[] args) {
sb.append('<');
for (int i = 0; i < args.length; i++) {
TypeArgument ta = args[i];
if (ta.isWildcard())
sb.append(ta.wildcard);
if (ta.getType() != null)
ta.getType().encode(sb);
}
sb.append('>');
}
}
/**
* Primitive types and object types.
*/
public static abstract class Type {
abstract void encode(StringBuffer sb);
static void toString(StringBuffer sbuf, Type[] ts) {
for (int i = 0; i < ts.length; i++) {
if (i > 0)
sbuf.append(", ");
sbuf.append(ts[i]);
}
}
/**
* Returns the type name in the JVM internal style.
* For example, if the type is a nested class {@code foo.Bar.Baz},
* then {@code foo.Bar$Baz} is returned.
*/
public String jvmTypeName() { return toString(); }
}
/**
* Primitive types.
*/
public static class BaseType extends Type {
char descriptor;
BaseType(char c) { descriptor = c; }
/**
* Constructs a <code>BaseType</code>.
*
* @param typeName <code>void</code>, <code>int</code>, ...
*/
public BaseType(String typeName) {
this(Descriptor.of(typeName).charAt(0));
}
/**
* Returns the descriptor representing this primitive type.
*
* @see javassist.bytecode.Descriptor
*/
public char getDescriptor() { return descriptor; }
/**
* Returns the <code>CtClass</code> representing this
* primitive type.
*/
public CtClass getCtlass() {
return Descriptor.toPrimitiveClass(descriptor);
}
/**
* Returns the string representation.
*/
public String toString() {
return Descriptor.toClassName(Character.toString(descriptor));
}
void encode(StringBuffer sb) {
sb.append(descriptor);
}
}
/**
* Class types, array types, and type variables.
* This class is also used for representing a field type.
*/
public static abstract class ObjectType extends Type {
/**
* Returns the encoded string representing the object type signature.
*/
public String encode() {
StringBuffer sb = new StringBuffer();
encode(sb);
return sb.toString();
}
}
/**
* Class types.
*/
public static class ClassType extends ObjectType {
String name;
TypeArgument[] arguments;
static ClassType make(String s, int b, int e,
TypeArgument[] targs, ClassType parent) {
if (parent == null)
return new ClassType(s, b, e, targs);
else
return new NestedClassType(s, b, e, targs, parent);
}
ClassType(String signature, int begin, int end, TypeArgument[] targs) {
name = signature.substring(begin, end).replace('/', '.');
arguments = targs;
}
/**
* A class type representing <code>java.lang.Object</code>.
*/
public static ClassType OBJECT = new ClassType("java.lang.Object", null);
/**
* Constructs a <code>ClassType</code>. It represents
* the name of a non-nested class.
*
* @param className a fully qualified class name.
* @param args type arguments or null.
*/
public ClassType(String className, TypeArgument[] args) {
name = className;
arguments = args;
}
/**
* Constructs a <code>ClassType</code>. It represents
* the name of a non-nested class.
*
* @param className a fully qualified class name.
*/
public ClassType(String className) {
this(className, null);
}
/**
* Returns the class name.
*/
public String getName() {
return name;
}
/**
* Returns the type arguments.
*
* @return null if no type arguments are given to this class.
*/
public TypeArgument[] getTypeArguments() { return arguments; }
/**
* If this class is a member of another class, returns the
* class in which this class is declared.
*
* @return null if this class is not a member of another class.
*/
public ClassType getDeclaringClass() { return null; }
/**
* Returns the string representation.
*/
public String toString() {
StringBuffer sbuf = new StringBuffer();
ClassType parent = getDeclaringClass();
if (parent != null)
sbuf.append(parent.toString()).append('.');
return toString2(sbuf);
}
private String toString2(StringBuffer sbuf) {
sbuf.append(name);
if (arguments != null) {
sbuf.append('<');
int n = arguments.length;
for (int i = 0; i < n; i++) {
if (i > 0)
sbuf.append(", ");
sbuf.append(arguments[i].toString());
}
sbuf.append('>');
}
return sbuf.toString();
}
/**
* Returns the type name in the JVM internal style.
* For example, if the type is a nested class {@code foo.Bar.Baz},
* then {@code foo.Bar$Baz} is returned.
*/
public String jvmTypeName() {
StringBuffer sbuf = new StringBuffer();
ClassType parent = getDeclaringClass();
if (parent != null)
sbuf.append(parent.jvmTypeName()).append('$');
return toString2(sbuf);
}
void encode(StringBuffer sb) {
sb.append('L');
encode2(sb);
sb.append(';');
}
void encode2(StringBuffer sb) {
ClassType parent = getDeclaringClass();
if (parent != null) {
parent.encode2(sb);
sb.append('$');
}
sb.append(name.replace('.', '/'));
if (arguments != null)
TypeArgument.encode(sb, arguments);
}
}
/**
* Nested class types.
*/
public static class NestedClassType extends ClassType {
ClassType parent;
NestedClassType(String s, int b, int e,
TypeArgument[] targs, ClassType p) {
super(s, b, e, targs);
parent = p;
}
/**
* Constructs a <code>NestedClassType</code>.
*
* @param parent the class surrounding this class type.
* @param className a simple class name. It does not include
* a package name or a parent's class name.
* @param args type parameters or null.
*/
public NestedClassType(ClassType parent, String className, TypeArgument[] args) {
super(className, args);
this.parent = parent;
}
/**
* Returns the class that declares this nested class.
* This nested class is a member of that declaring class.
*/
public ClassType getDeclaringClass() { return parent; }
}
/**
* Array types.
*/
public static class ArrayType extends ObjectType {
int dim;
Type componentType;
/**
* Constructs an <code>ArrayType</code>.
*
* @param d dimension.
* @param comp the component type.
*/
public ArrayType(int d, Type comp) {
dim = d;
componentType = comp;
}
/**
* Returns the dimension of the array.
*/
public int getDimension() { return dim; }
/**
* Returns the component type.
*/
public Type getComponentType() {
return componentType;
}
/**
* Returns the string representation.
*/
public String toString() {
StringBuffer sbuf = new StringBuffer(componentType.toString());
for (int i = 0; i < dim; i++)
sbuf.append("[]");
return sbuf.toString();
}
void encode(StringBuffer sb) {
for (int i = 0; i < dim; i++)
sb.append('[');
componentType.encode(sb);
}
}
/**
* Type variables.
*/
public static class TypeVariable extends ObjectType {
String name;
TypeVariable(String sig, int begin, int end) {
name = sig.substring(begin, end);
}
/**
* Constructs a <code>TypeVariable</code>.
*
* @param name the name of a type variable.
*/
public TypeVariable(String name) {
this.name = name;
}
/**
* Returns the variable name.
*/
public String getName() {
return name;
}
/**
* Returns the string representation.
*/
public String toString() {
return name;
}
void encode(StringBuffer sb) {
sb.append('T').append(name).append(';');
}
}
/**
* Parses the given signature string as a class signature.
*
* @param sig the signature obtained from the <code>SignatureAttribute</code>
* of a <code>ClassFile</code>.
* @return a tree-like data structure representing a class signature. It provides
* convenient accessor methods.
* @throws BadBytecode thrown when a syntactical error is found.
* @see #getSignature()
* @since 3.5
*/
public static ClassSignature toClassSignature(String sig) throws BadBytecode {
try {
return parseSig(sig);
}
catch (IndexOutOfBoundsException e) {
throw error(sig);
}
}
/**
* Parses the given signature string as a method type signature.
*
* @param sig the signature obtained from the <code>SignatureAttribute</code>
* of a <code>MethodInfo</code>.
* @return @return a tree-like data structure representing a method signature. It provides
* convenient accessor methods.
* @throws BadBytecode thrown when a syntactical error is found.
* @see #getSignature()
* @since 3.5
*/
public static MethodSignature toMethodSignature(String sig) throws BadBytecode {
try {
return parseMethodSig(sig);
}
catch (IndexOutOfBoundsException e) {
throw error(sig);
}
}
/**
* Parses the given signature string as a field type signature.
*
* @param sig the signature string obtained from the <code>SignatureAttribute</code>
* of a <code>FieldInfo</code>.
* @return the field type signature.
* @throws BadBytecode thrown when a syntactical error is found.
* @see #getSignature()
* @since 3.5
*/
public static ObjectType toFieldSignature(String sig) throws BadBytecode {
try {
return parseObjectType(sig, new Cursor(), false);
}
catch (IndexOutOfBoundsException e) {
throw error(sig);
}
}
/**
* Parses the given signature string as a type signature.
* The type signature is either the field type signature or a base type
* descriptor including <code>void</code> type.
*
* @throws BadBytecode thrown when a syntactical error is found.
* @since 3.18
*/
public static Type toTypeSignature(String sig) throws BadBytecode {
try {
return parseType(sig, new Cursor());
}
catch (IndexOutOfBoundsException e) {
throw error(sig);
}
}
private static ClassSignature parseSig(String sig)
throws BadBytecode, IndexOutOfBoundsException
{
Cursor cur = new Cursor();
TypeParameter[] tp = parseTypeParams(sig, cur);
ClassType superClass = parseClassType(sig, cur);
int sigLen = sig.length();
ArrayList ifArray = new ArrayList();
while (cur.position < sigLen && sig.charAt(cur.position) == 'L')
ifArray.add(parseClassType(sig, cur));
ClassType[] ifs
= (ClassType[])ifArray.toArray(new ClassType[ifArray.size()]);
return new ClassSignature(tp, superClass, ifs);
}
private static MethodSignature parseMethodSig(String sig)
throws BadBytecode
{
Cursor cur = new Cursor();
TypeParameter[] tp = parseTypeParams(sig, cur);
if (sig.charAt(cur.position++) != '(')
throw error(sig);
ArrayList params = new ArrayList();
while (sig.charAt(cur.position) != ')') {
Type t = parseType(sig, cur);
params.add(t);
}
cur.position++;
Type ret = parseType(sig, cur);
int sigLen = sig.length();
ArrayList exceptions = new ArrayList();
while (cur.position < sigLen && sig.charAt(cur.position) == '^') {
cur.position++;
ObjectType t = parseObjectType(sig, cur, false);
if (t instanceof ArrayType)
throw error(sig);
exceptions.add(t);
}
Type[] p = (Type[])params.toArray(new Type[params.size()]);
ObjectType[] ex = (ObjectType[])exceptions.toArray(new ObjectType[exceptions.size()]);
return new MethodSignature(tp, p, ret, ex);
}
private static TypeParameter[] parseTypeParams(String sig, Cursor cur)
throws BadBytecode
{
ArrayList typeParam = new ArrayList();
if (sig.charAt(cur.position) == '<') {
cur.position++;
while (sig.charAt(cur.position) != '>') {
int nameBegin = cur.position;
int nameEnd = cur.indexOf(sig, ':');
ObjectType classBound = parseObjectType(sig, cur, true);
ArrayList ifBound = new ArrayList();
while (sig.charAt(cur.position) == ':') {
cur.position++;
ObjectType t = parseObjectType(sig, cur, false);
ifBound.add(t);
}
TypeParameter p = new TypeParameter(sig, nameBegin, nameEnd,
classBound, (ObjectType[])ifBound.toArray(new ObjectType[ifBound.size()]));
typeParam.add(p);
}
cur.position++;
}
return (TypeParameter[])typeParam.toArray(new TypeParameter[typeParam.size()]);
}
private static ObjectType parseObjectType(String sig, Cursor c, boolean dontThrow)
throws BadBytecode
{
int i;
int begin = c.position;
switch (sig.charAt(begin)) {
case 'L' :
return parseClassType2(sig, c, null);
case 'T' :
i = c.indexOf(sig, ';');
return new TypeVariable(sig, begin + 1, i);
case '[' :
return parseArray(sig, c);
default :
if (dontThrow)
return null;
else
throw error(sig);
}
}
private static ClassType parseClassType(String sig, Cursor c)
throws BadBytecode
{
if (sig.charAt(c.position) == 'L')
return parseClassType2(sig, c, null);
else
throw error(sig);
}
private static ClassType parseClassType2(String sig, Cursor c, ClassType parent)
throws BadBytecode
{
int start = ++c.position;
char t;
do {
t = sig.charAt(c.position++);
} while (t != '$' && t != '<' && t != ';');
int end = c.position - 1;
TypeArgument[] targs;
if (t == '<') {
targs = parseTypeArgs(sig, c);
t = sig.charAt(c.position++);
}
else
targs = null;
ClassType thisClass = ClassType.make(sig, start, end, targs, parent);
if (t == '$' || t == '.') {
c.position--;
return parseClassType2(sig, c, thisClass);
}
else
return thisClass;
}
private static TypeArgument[] parseTypeArgs(String sig, Cursor c) throws BadBytecode {
ArrayList args = new ArrayList();
char t;
while ((t = sig.charAt(c.position++)) != '>') {
TypeArgument ta;
if (t == '*' )
ta = new TypeArgument(null, '*');
else {
if (t != '+' && t != '-') {
t = ' ';
c.position--;
}
ta = new TypeArgument(parseObjectType(sig, c, false), t);
}
args.add(ta);
}
return (TypeArgument[])args.toArray(new TypeArgument[args.size()]);
}
private static ObjectType parseArray(String sig, Cursor c) throws BadBytecode {
int dim = 1;
while (sig.charAt(++c.position) == '[')
dim++;
return new ArrayType(dim, parseType(sig, c));
}
private static Type parseType(String sig, Cursor c) throws BadBytecode {
Type t = parseObjectType(sig, c, true);
if (t == null)
t = new BaseType(sig.charAt(c.position++));
return t;
}
private static BadBytecode error(String sig) {
return new BadBytecode("bad signature: " + sig);
}
}
| [
"yanxiangqunwork@163.com"
] | yanxiangqunwork@163.com |
4912ac188bd420d5a9261623f12a1eabdf714c0e | 498a49b308b615ebc398e4fdeee50726edefc3ae | /src/test/java/com/song/springboot/sptingbootdemo/SptingbootDemoApplicationTests.java | 61a28214acd63f602764af28060ccb41330ef983 | [] | no_license | Larrysong1111/springboot-demo | 6cc8bd1a13b999db5f188b7ed2f20d16d0158cf2 | 36573082d14fb370491931a94592873b53c8ceaa | refs/heads/master | 2020-03-10T17:47:10.815623 | 2018-04-16T11:35:47 | 2018-04-16T11:35:47 | 129,508,575 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.song.springboot.sptingbootdemo;
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 SptingbootDemoApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"18715@LAPTOP-HSNN5GTO"
] | 18715@LAPTOP-HSNN5GTO |
e953a3b71ddc9d59fb600c2894961d822d6007cc | d4ce8296d4ffae361395febb8cab396ff971be02 | /app/src/test/java/com/goo/musicdb/ExampleUnitTest.java | 2c3a8d85a033dc09d89c33e4f2273d65089e9d7d | [] | no_license | kalvian1060/MusicDB-GreenDaoDemo | cb4d9bca0b4518025bdd3284c307c04e24385bf7 | 312575b69fb967331ff65f648392e51d424232c8 | refs/heads/master | 2021-01-21T16:38:30.185583 | 2017-01-01T03:04:19 | 2017-01-01T03:04:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package com.goo.musicdb;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"goo.ex53@gmail.com"
] | goo.ex53@gmail.com |
43e50600924eb3e9e1062f7915849ced5e9594d2 | 08eb6e24c66c3eb44c38ca66ac6dd03920ae424d | /src/main/java/org/jiaozhu/commonTools/mail/MailUtil.java | 47437fb2dffd43a1ff57ebeb5c705f0c22d0f7b1 | [] | no_license | jiaozhu/commonTools | 1f76e23cce9ff89cdc007bb24e876fc8c2422687 | 571a679d5d7828f1c0f83d4b6464030ae945e321 | refs/heads/master | 2020-05-04T12:02:38.433304 | 2014-10-03T05:24:58 | 2014-10-03T05:24:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,264 | java | package org.jiaozhu.commonTools.mail;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MailUtil {
private static Logger logger = LoggerFactory.getLogger(MailUtil.class);
private static final String SMTP_HOST = "mail.smtp.host";
private static final String SMTP_PORT = "mail.smtp.port";
private static final String SMTP_AUTH = "mail.smtp.auth";
/**
* 发送邮件给单收件人
* @param to 收件人
* @param subject 标题
* @param content 正文
* @param isHtml 是否为HTML
*/
public static void sendToSingle(String to, String subject, String content, boolean isHtml) {
List<String> list = new ArrayList<String>();
list.add(to);
send(list, subject, content, isHtml);
}
/**
* 使用默认的设置账户发送邮件
* @param tos 收件人列表
* @param subject 标题
* @param content 正文
* @param isHtml 是否为HTML
*/
public static void send(Collection<String> tos, String subject, String content, boolean isHtml) {
MailAccount mailAccount = new MailAccount(MailAccount.MAIL_SETTING_PATH);
try {
send(mailAccount, tos, subject, content, isHtml);
} catch (MessagingException e) {
logger.error("Send mail error!", e);
}
}
/**
* 发送邮件给多人
* @param mailAccount 邮件认证对象
* @param tos 收件人列表
* @param subject 标题
* @param content 正文
* @param isHtml 是否为HTML格式
* @throws MessagingException
*/
public static void send(final MailAccount mailAccount, Collection<String> tos, String subject, String content, boolean isHtml) throws MessagingException {
Properties p = new Properties();
p.put(SMTP_HOST, mailAccount.getHost());
p.put(SMTP_PORT, mailAccount.getPort());
p.put(SMTP_AUTH, mailAccount.isAuth());
//认证登录
Session session = Session.getDefaultInstance(p,
mailAccount.isAuth() ?
new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(mailAccount.getUser(), mailAccount.getPass());
}
} : null
);
Message mailMessage = new MimeMessage(session);
mailMessage.setFrom(new InternetAddress(mailAccount.getFrom()));
mailMessage.setSubject(subject);
mailMessage.setSentDate(new Date());
if(isHtml) {
Multipart mainPart = new MimeMultipart();
BodyPart html = new MimeBodyPart();
html.setContent(content, "text/html; charset=utf-8");
mainPart.addBodyPart(html);
}else {
mailMessage.setText(content);
}
for (String to : tos) {
mailMessage.setRecipient(Message.RecipientType.TO,new InternetAddress(to));
Transport.send(mailMessage);
logger.info("Send mail to {} successed.");
}
}
}
| [
"gitview@gmail.com"
] | gitview@gmail.com |
7edbc4348cc7a42b71741a255b3734e9c46f3f6b | 2a537d9127bb715a465868cf6ab5a65f1c78f4aa | /app/src/main/java/org/wdd/app/android/seedoctor/preference/LocationHelper.java | bc66fde8d4f1d31b5367a525d8de4e53614307ac | [] | no_license | wddonline/SeeDoctor | a8eab5158be52a881960d804eb2adbeafd8baa5a | 5b0b98a96b332f4d3476d165a7ab9f9af569059e | refs/heads/master | 2020-06-19T15:24:29.746898 | 2017-05-31T10:17:26 | 2017-05-31T10:17:26 | 74,897,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,318 | java | package org.wdd.app.android.seedoctor.preference;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by wangdd on 16-11-27.
*/
public class LocationHelper {
private static LocationHelper INSTANCE;
public static LocationHelper getInstance(Context context) {
if (INSTANCE == null) {
synchronized (LocationHelper.class) {
if (INSTANCE == null) {
INSTANCE = new LocationHelper(context);
}
}
}
return INSTANCE;
}
private final String SAVED = "saved";//是否保存过位置信息
private final String LATITUDE = "Latitude";//获取纬度
private final String LONGITUDE = "Longitude";//获取经度
private final String ACCURACY = "Accuracy";//获取精度信息
private final String ADDRESS = "Address";//地址,如果option中设置isNeedAddress为false,则没有此结果,网络定位结果中会有地址信息,GPS定位不返回地址信息。
private final String COUNTRY = "Country";//国家信息
private final String PROVINCE = "Province";//省信息
private final String CITY = "City";//城市信息
private final String DISTRICT = "District";//城区信息
private final String STREET = "Street";//街道信息
private final String STREET_NUM = "StreetNum";//街道门牌号信息
private final String CITY_CODE = "CityCode";//城市编码
private final String AD_CODE = "AdCode";//地区编码
private final String AOI_NAME = "AoiName";//获取当前定位点的AOI信息;
private Context context;
private SharedPreferences preferences;
private Location location;
private LocationHelper(Context context) {
this.context = context;
preferences = context.getSharedPreferences("location", Context.MODE_PRIVATE);
initLocation();
}
public void initLocation() {
location = new Location();
if (!preferences.contains(SAVED)) return;
location.latitude = Double.parseDouble(preferences.getString(LATITUDE, "0"));
location.longitude = Double.parseDouble(preferences.getString(LONGITUDE, "0"));
location.accuracy = preferences.getFloat(ACCURACY, 0);
location.address = preferences.getString(ADDRESS, null);
location.country = preferences.getString(COUNTRY, null);
location.province = preferences.getString(PROVINCE, null);
location.city = preferences.getString(CITY, null);
location.district = preferences.getString(DISTRICT, null);
location.street = preferences.getString(STREET, null);
location.streetNum = preferences.getString(STREET_NUM, null);
location.cityCode = preferences.getString(CITY_CODE, null);
location.adCode = preferences.getString(AD_CODE, null);
location.aoiName = preferences.getString(AOI_NAME, null);
}
public Location getLocation() {
return location;
}
public void saveLocationData(Location location) {
this.location = location;
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(SAVED, true);
editor.putString(LATITUDE, location.latitude + "");
editor.putString(LONGITUDE, location.longitude + "");
editor.putFloat(ACCURACY, location.accuracy);
editor.putString(ADDRESS, location.address);
editor.putString(COUNTRY, location.country);
editor.putString(PROVINCE, location.province);
editor.putString(CITY, location.city);
editor.putString(DISTRICT, location.district);
editor.putString(STREET, location.street);
editor.putString(STREET_NUM, location.streetNum);
editor.putString(CITY_CODE, location.cityCode);
editor.putString(AD_CODE, location.adCode);
editor.putString(AOI_NAME, location.aoiName);
editor.commit();
}
public double getLatitude() {
return location.latitude;
}
public double getLongitude() {
return location.longitude;
}
public double getAccuracy() {
return location.accuracy;
}
public String getAddress() {
return location.address;
}
public String getCountry() {
return location.country;
}
public String getProvince() {
return location.province;
}
public String getCity() {
return location.city;
}
public String getDistrict() {
return location.district;
}
public String getStreet() {
return location.street;
}
public String getStreet_num() {
return location.streetNum;
}
public String getCity_code() {
return location.cityCode;
}
public String getAd_code() {
return location.adCode;
}
public String getAoi_name() {
return location.aoiName;
}
public static class Location {
public double latitude;//纬度
public double longitude;//经度
public float accuracy;//精度信息
public String address;//地址
public String country;//国家信息
public String province;//省信息
public String city;//城市信息
public String district;//城区信息
public String street;//街道信息
public String streetNum;//街道门牌号信息
public String cityCode;//城市编码
public String adCode;//地区编码
public String aoiName;//定位点的AOI信息;
public Location() {
}
public Location(float latitude, float longitude, float accuracy, String address, String country,
String province, String city, String district, String street, String streetNum,
String cityCode, String adCode, String aoiName) {
this.latitude = latitude;
this.longitude = longitude;
this.accuracy = accuracy;
this.address = address;
this.country = country;
this.province = province;
this.city = city;
this.district = district;
this.street = street;
this.streetNum = streetNum;
this.cityCode = cityCode;
this.adCode = adCode;
this.aoiName = aoiName;
}
}
}
| [
"wddonline@163.com"
] | wddonline@163.com |
ee075bcb5fb875751e123cde711b9610558a87e8 | 8a1a5c07c94201224244fed5997703d475e60667 | /src/main/java/com/example/restaurant/controller/LoginController.java | f8499b4ba809c0840c9dc41903f20c416f505e35 | [] | no_license | Eldar993/restuarantJuly07 | 2c893d20000456fd7c449a291d7867e58682e276 | fae3aab0cab38564be53ce65b260663b71382ffd | refs/heads/master | 2022-11-21T08:10:17.930127 | 2020-07-11T17:53:50 | 2020-07-11T17:53:50 | 278,041,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,065 | java | package com.example.restaurant.controller;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpSession;
import java.util.Objects;
@Controller
public class LoginController {
private static final String SPRING_SECURITY_LAST_EXCEPTION = "SPRING_SECURITY_LAST_EXCEPTION";
private static final String SECURITY_LAST_EXCEPTION_MESSAGE_MODEL_ATTRIBUTE = "securityLastExceptionMessage";
@RequestMapping(value = "/login", method = RequestMethod.GET)
public ModelAndView login(HttpSession session, ModelAndView modelAndView) {
modelAndView.setViewName("login");
Object securityLastException = session.getAttribute(SPRING_SECURITY_LAST_EXCEPTION);
if (Objects.nonNull(securityLastException)) {
String message = "auth with error";
modelAndView.addObject(SECURITY_LAST_EXCEPTION_MESSAGE_MODEL_ATTRIBUTE, message);
session.removeAttribute(SPRING_SECURITY_LAST_EXCEPTION);
}
return modelAndView;
}
@GetMapping(value = "/authorized",
produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView authorized(Authentication authentication) {
String login = authentication.getName();
UriComponents uriComponents = UriComponentsBuilder.newInstance()
.path("/")
.build()
.expand(login)
.encode();
ModelAndView modelAndView = new ModelAndView(new RedirectView(uriComponents.toUriString(), true, true, false));
return modelAndView;
}
}
| [
"eldar7989@gmail.com"
] | eldar7989@gmail.com |
46b872f6d5217ed4a86cf9cb5d5d8dc9eb1aca8c | 47880dbed6b97814d66a819314ace5f86f84938d | /lesson7-1/gallery3/ListOfPictures.java | af74c4e740c960ec32ad12a2dc3d1ac41699d32f | [] | no_license | pvs013/Java_Classwork | 457469174e7743ac9e29891835879971ec4baa56 | 37e12fa1e6825efe92076a754163b699f1fa6bbe | refs/heads/master | 2020-04-25T16:44:31.465115 | 2015-04-15T14:33:15 | 2015-04-15T14:33:15 | 33,998,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | // BlueJ project: lesson7/gallery3
import java.util.ArrayList;
public class ListOfPictures
{
public static void main(String[] args)
{
ArrayList<Picture> gallery = new ArrayList<Picture>();
gallery.add(new Picture("degas1.jpg"));
gallery.add(new Picture("gaugin1.jpg"));
gallery.add(new Picture("monet1.jpg"));
gallery.add(new Picture("monet2.jpg"));
gallery.add(new Picture("renoir1.jpg"));
int offset = 10; // space between pictures
int nextpic = 0;
for (Picture pic : gallery)
{
// TODO: Move the first picture to offset 10,
// the second picture ten pixels to the right of the first one,
// and so on
pic.translate(nextpic + offset, 0);
pic.draw();
nextpic = pic.getMaxX();
}
}
}
| [
"chris.palmer@capitalone.com"
] | chris.palmer@capitalone.com |
db071c6aab63fb1575d972f5d338627be7ee7c25 | 69856e5761a03b7118abd1556ababb7be3d208a8 | /DealerTire Automation/DealerTireAutomation/SMART_Functional/src/test/java/com/dealertire/SMART_Functional/MyPage/VisitCalendarTests.java | b68e71dc2aa6cb345677f7a97f8b5e3035d35fd3 | [] | no_license | choudharykanchan/EclipseProjects | 7814ce9aaa28ec4b097baf74d8b6b2b403bf1e80 | 5e6c8b5af1bf035bcf1b55ac1bea700c9ee74643 | refs/heads/master | 2020-03-06T22:52:41.286289 | 2018-03-28T09:32:34 | 2018-03-28T09:32:34 | 127,116,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,453 | java | package com.dealertire.SMART_Functional.MyPage;
import static org.junit.Assert.*;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import com.dealertire.SMARTFramework.BaseTest;
import com.dealertire.SMARTFramework.Utils;
import com.dealertire.SMARTFramework.Pages.MyPage;
import com.dealertire.SMARTFramework.Pages.MyPage.DayOfWeek;
import com.dealertire.SMARTFramework.Pages.VisitPage;
/**
* Visit Calendar testing on My Page
* @author bgreen
*
*/
@RunWith(Parameterized.class)
public class VisitCalendarTests extends BaseTest {
private String dealerName;
private String dealerCode;
private MyPage myPage;
private String dealerID;
/**
* Parameter generation
* @return The parameters from the datasheetk
* @throws IOException If the datasheet cannot be read
*/
@Parameters(name= "{index}: {3}")
public static synchronized Collection<String[]> parameters() throws IOException {
ArrayList<String[]> allParams = null;
try {
ArrayList<String[]> dataSheet = Utils.readFromCSV("dealers.csv");
allParams = Utils.mergeDatasheets_cartesian(getEnvironmentDatasheet(), dataSheet);
} catch (IOException e) {
fail("Could not read dealer list to test.");
}
return allParams;
}
/**
* Parameterized constructor for testing
* @param remoteHost The remote host to use
* @param browser The browser to use
* @param version The version to request
* @param dealerName The name of the dealer to use
* @param dealerCode The dealercode for that dealer
* @param dealerID the dealer ID for that dealer
*/
public VisitCalendarTests(String remoteHost, String browser, String version, String dealerName, String dealerCode, String dealerID) {
super(remoteHost, browser, version);
this.dealerName = dealerName;
this.dealerCode = dealerCode;
this.dealerID = dealerID;
}
/**
* Scenario: New Visit From Calendar
* Given I am on My Page
* When I click on a time slot on the calendar
* Then I should be on the Visit page
* And I should see a blank visit
* And the time should be the time I clicked on
* And the date should be the date I clicked on
*/
@Test
public void NewVisitFromCalendar() {
logger.info("1. Navigating to My Page");
myPage = new MyPage(driver);
myPage.navigateTo();
logger.info("2. Clicking on time slot.");
myPage.clickCalendarTimeSlot(DayOfWeek.WEDNESDAY, "8am");
//Get the date of wednesday this week
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
SimpleDateFormat visitPageDateFormatter = new SimpleDateFormat(VisitPage.dateFormatPattern);
String currentWednesday = visitPageDateFormatter.format(c.getTime());
logger.info("3.Verifications");
assertTrue("Modal did not appear",
myPage.isCalendarModalShowing());
String currentURL = driver.getCurrentUrl();
myPage.calendarModalClickVisit();
Utils.WaitForUrlChange(driver, currentURL);
VisitPage visitPage = new VisitPage(driver);
assertTrue("Did not arrive on visit page",
visitPage.isLoaded());
visitPage.waitForPageLoad();
assertEquals("Visit did not have the right date",
currentWednesday,
visitPage.getVisitDate());
assertEquals("Visit did not have the right time",
"08:00AM",
visitPage.getVisitStartTime());
}
/**
* Given I am on My Page
* And I have searched for dealers from the quick search
* When I click on a dealer on the left
* And I click on a time slot on the calendar
* Then I should be on the Visit page
* And I should see a blank visit
* And the time should be the time I clicked on
* And the date should be the date I clicked on
* And the dealer should be the dealer that was selected
*/
@Test
public void NewVisitFromCalendarWithDealer() {
logger.info("1. Navigating to My Page");
myPage = new MyPage(driver);
myPage.navigateTo();
logger.info("2. Searching by dealership code: '" + dealerCode + "'");
myPage.performDealerSimpleSearch(dealerCode);
logger.info("3. Clicking dealership.");
myPage.clickDealershipInSearchResults(dealerID);
logger.info("4. Clicking on time slot.");
myPage.clickCalendarTimeSlot(DayOfWeek.WEDNESDAY, "8am");
//Get the date of wednesday this week
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
SimpleDateFormat visitPageDateFormatter = new SimpleDateFormat(VisitPage.dateFormatPattern);
String currentWednesday = visitPageDateFormatter.format(c.getTime());
logger.info("5.Verifications");
assertTrue("Modal did not appear",
myPage.isCalendarModalShowing());
String currentURL = driver.getCurrentUrl();
myPage.calendarModalClickVisit();
Utils.WaitForUrlChange(driver, currentURL);
VisitPage visitPage = new VisitPage(driver);
assertTrue("Did not arrive on visit page",
visitPage.isLoaded());
visitPage.waitForPageLoad();
assertEquals("Visit did not have the right date",
currentWednesday,
visitPage.getVisitDate());
assertEquals("Visit did not have the right time",
"08:00AM",
visitPage.getVisitStartTime());
String listOfDealers = visitPage.getListOfDealers();
assertTrue("Visit did not contain the right dealer; expected '" + dealerName + ";, but got '" + listOfDealers + "'",
listOfDealers.toLowerCase().contains(dealerName.toLowerCase()));
}
/**
* Scenario: Drag and Drop
* Given I am on My Page
* And I have searched for dealers from the quick search
* When I drag a dealer from the left to a time slot on the calendar
* Then I should be on the Visit page
* And I should see a blank visit
* And the time should be the time I clicked on
* And the date should be the date I clicked on
* And the dealer should be the dealer that was dragged
*/
@Test
public void DragAndDrop() {
logger.info("1. Navigating to My Page");
myPage = new MyPage(driver);
myPage.navigateTo();
logger.info("2. Searching by dealership code: '" + dealerCode + "'");
myPage.performDealerSimpleSearch(dealerCode);
String currentURL = driver.getCurrentUrl();
logger.info("3. Dragging dealership to timeslot");
myPage.dragDealerToTimeSlot(dealerID,DayOfWeek.WEDNESDAY, "9am");
//Get the date of wednesday this week
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
SimpleDateFormat visitPageDateFormatter = new SimpleDateFormat(VisitPage.dateFormatPattern);
String currentWednesday = visitPageDateFormatter.format(c.getTime());
logger.info("4.Verifications");
Utils.WaitForUrlChange(driver, currentURL);
VisitPage visitPage = new VisitPage(driver);
assertTrue("Did not arrive on visit page",
visitPage.isLoaded());
visitPage.waitForPageLoad();
assertEquals("Visit did not have the right date",
currentWednesday,
visitPage.getVisitDate());
assertEquals("Visit did not have the right time",
"09:00AM",
visitPage.getVisitStartTime());
String listOfDealers = visitPage.getListOfDealers();
assertTrue("Visit did not contain the right dealer; expected '" + dealerName + ";, but got '" + listOfDealers + "'",
listOfDealers.toLowerCase().contains(dealerName.toLowerCase()));
}
}
| [
"choudhary.kanchan@thinksys.com"
] | choudhary.kanchan@thinksys.com |
c3c9bc85ee8a71f2cf4b99b0826985d8e0ac1fb0 | c5c62d843b476ece5f6aa7d0232b11ae384e73d8 | /minos-common/src/main/java/xbp/core/util/MD5Util.java | beec4567660b55f6d1e9283faaa8ed2bdc4d7c26 | [] | no_license | xbxrj/minos-deploy | 65b8a93eb79cd62c7731229d0d5f1797de967a9a | 53abc348766185d5d4d968f1036e7d99b5670c52 | refs/heads/master | 2021-04-29T10:34:58.655510 | 2017-01-02T14:04:53 | 2017-01-02T14:04:53 | 77,837,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | package xbp.core.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
*
* @author junsu.zhang
*
*/
public class MD5Util {
public static String generateMD5code(String password) {
StringBuilder md5Str = null;
try {
// 创建加密对象
MessageDigest messageDigest=MessageDigest.getInstance("md5");
// 加密
byte[] bs = messageDigest.digest(password.getBytes());
md5Str = new StringBuilder(40);
for(byte x:bs) {
if((x & 0xff)>>4 == 0) {
md5Str.append("0").append(Integer.toHexString(x & 0xff));
} else {
md5Str.append(Integer.toHexString(x & 0xff));
}
}
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return md5Str.toString();
}
}
| [
"zhangjs5@frompeaddeMacBook-Pro.local"
] | zhangjs5@frompeaddeMacBook-Pro.local |
ca1122d0a66d25b7f383d6c0282e2904fda7ceec | 5e6abc6bca67514b4889137d1517ecdefcf9683a | /Server/src/main/java/org/gielinor/game/system/command/impl/PerkCommand.java | 38590c73d68e0d7d0c00d0dee5d4d3351b508a7c | [] | no_license | dginovker/RS-2009-317 | 88e6d773d6fd6814b28bdb469f6855616c71fc26 | 9d285c186656ace48c2c67cc9e4fb4aeb84411a4 | refs/heads/master | 2022-12-22T18:47:47.487468 | 2019-09-20T21:24:34 | 2019-09-20T21:24:34 | 208,949,111 | 2 | 2 | null | 2022-12-15T23:55:43 | 2019-09-17T03:15:17 | Java | UTF-8 | Java | false | false | 5,442 | java | package org.gielinor.game.system.command.impl;
import org.apache.commons.lang3.StringUtils;
import org.gielinor.game.node.entity.player.Player;
import org.gielinor.game.node.entity.player.info.Perk;
import org.gielinor.game.node.entity.player.info.Rights;
import org.gielinor.game.node.entity.player.info.perk.PerkManagement;
import org.gielinor.game.system.command.Command;
import org.gielinor.game.system.command.CommandDescription;
import org.gielinor.game.world.repository.Repository;
/**
* Adds, removes, enables or disables a
* {@link org.gielinor.game.node.entity.player.info.Perk} for the given player
* (if any).
*
* @author <a href="https://Gielinor.org">Gielinor Logan G.</a>
*/
public class PerkCommand extends Command {
@Override
public Rights getRights() {
return Rights.GIELINOR_MODERATOR;
}
@Override
public boolean canUse(Player player) {
return true;
}
@Override
public String[] getCommands() {
return new String[]{ "addperk", "removeperk", "enableperk", "disableperk", "perks" };
}
@Override
public void init() {
CommandDescription.add(new CommandDescription("addperk", "Adds a perk to a player's list", getRights(),
"::addperk <lt>perk_id> <lt>[ player_name]><br>Will add perk to your account if player_name is empty"));
CommandDescription.add(new CommandDescription("removeperk", "Removes a perk to a player's list", getRights(),
"::removeperk <lt>perk_id> <lt>[ player_name]><br>Will remove perk from your account if player_name is empty"));
CommandDescription.add(new CommandDescription("enableperk", "Enables a perk for a player", getRights(),
"::enableperk <lt>perk_id> <lt>[ player_name]><br>Will enable perk on your account if player_name is empty"));
CommandDescription.add(new CommandDescription("disableperk", "Disables a perk for a player", getRights(),
"::disableperk <lt>perk_id> <lt>[ player_name]><br>Will disable perk on your account if player_name is empty"));
CommandDescription.add(new CommandDescription("perks", "Displays available perks", getRights(), null));
}
@Override
public void execute(Player player, String[] args) {
if (args[0].toLowerCase().startsWith("perks")) {
PerkManagement.openPage(player, 0, true);
return;
}
if (args.length < 2) {
player.getActionSender().sendMessage("Use as ::" + args[0] + " <lt>perk id>-<lt>[ player name]>");
return;
}
if (!StringUtils.isNumeric(args[1])) {
player.getActionSender().sendMessage("Use as ::" + args[0] + " <lt>perk id>-<lt>[ player name]>");
return;
}
Perk perk = Perk.forId(Integer.parseInt(args[1]));
if (perk == null) {
player.getActionSender().sendMessage("Invalid perk id. Type ::perks to see list.");
return;
}
String playerName = null;
Player otherPlayer = null;
if (args.length >= 3) {
playerName = toString(args, 2);
otherPlayer = Repository.getPlayerByName(playerName);
} else {
otherPlayer = player;
}
if (otherPlayer == null) {
player.getActionSender().sendMessage("Player " + playerName + " is not online.");
return;
}
switch (args[0].toLowerCase()) {
case "addperk":
otherPlayer.getPerkManager().unlock(perk);
otherPlayer.getActionSender().sendMessage(
"You have been given the perk " + perk.name().toLowerCase().replaceAll("_", " ") + ".");
player.getActionSender().sendMessage("Gave perk " + perk.name().toLowerCase().replaceAll("_", " ") + " to "
+ otherPlayer.getName() + ".");
break;
case "removeperk":
otherPlayer.getPerkManager().remove(perk);
otherPlayer.getActionSender().sendMessage("The perk " + perk.name().toLowerCase().replaceAll("_", " ")
+ " has been removed from your account.");
player.getActionSender().sendMessage("Removed perk " + perk.name().toLowerCase().replaceAll("_", " ")
+ " from " + otherPlayer.getName() + ".");
break;
case "enableperk":
otherPlayer.getPerkManager().enable(perk);
otherPlayer.getActionSender().sendMessage("The perk " + perk.name().toLowerCase().replaceAll("_", " ")
+ " has been enabled on your account.");
player.getActionSender().sendMessage("Enabled perk " + perk.name().toLowerCase().replaceAll("_", " ")
+ " for " + otherPlayer.getName() + ".");
break;
case "disableperk":
otherPlayer.getPerkManager().disable(perk);
otherPlayer.getActionSender().sendMessage("The perk " + perk.name().toLowerCase().replaceAll("_", " ")
+ " has been disabled on your account.");
player.getActionSender().sendMessage("Disabled perk " + perk.name().toLowerCase().replaceAll("_", " ")
+ " for " + otherPlayer.getName() + ".");
break;
}
}
}
| [
"dcress01@uoguelph.ca"
] | dcress01@uoguelph.ca |
4cd84136c392313e834127edb78089ad5a0723c2 | 420ab986dcf4590a46368f66380a854002aca79d | /树/95.中-不同的二叉搜索树 II/main.java | 3f980ab412d8056c0da1e83cf8946a656532a3de | [] | no_license | wjzhang-ty/leetcode | 29d7cbe2b3d0a30eeb1c7f59e85303c44244af79 | 4adc1cde87e66768556cf2431fee29fe88293dc2 | refs/heads/main | 2023-08-25T10:10:37.342332 | 2021-10-18T06:05:57 | 2021-10-18T06:09:35 | 375,950,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,494 | java |
import sun.reflect.generics.tree.Tree;
import java.util.*;
// Definition for a binary tree node.
class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode() {}
TreeNode(int val) { this.val = val; }
TreeNode(int val, TreeNode left, TreeNode right) {
this.val = val;
this.left = left;
this.right = right;
}
}
class Solution {
// chreate tree
public static TreeNode createTree(Integer[] list, int i) {
if(i>=list.length || list[i]==null) return null;
TreeNode tree = new TreeNode(list[i],createTree(list, 2*i+1),createTree(list, 2*i+2));
return tree;
}
// LDR while
public static void LDR(TreeNode root) {
Stack <TreeNode> stack = new Stack <TreeNode>();
do{
while(root!=null){
stack.push(root);
root=root.left;
}
root = stack.peek();
System.out.println(root.val);
if(!stack.empty())stack.pop();
root=root.right;
}
while(!(root==null&&stack.empty()));
}
public static List<TreeNode> generateTrees(int n) {
if (n == 0) {
return new LinkedList<TreeNode>();
}
return generateTrees(1, n);
}
public static List<TreeNode> generateTrees(int start, int end) {
List<TreeNode> allTrees = new LinkedList<TreeNode>();
if (start > end) {
allTrees.add(null);
return allTrees;
}
// 枚举可行根节点
for (int i = start; i <= end; i++) {
// 获得所有可行的左子树集合
List<TreeNode> leftTrees = generateTrees(start, i - 1);
// 获得所有可行的右子树集合
List<TreeNode> rightTrees = generateTrees(i + 1, end);
// 从左子树集合中选出一棵左子树,从右子树集合中选出一棵右子树,拼接到根节点上
for (TreeNode left : leftTrees) {
for (TreeNode right : rightTrees) {
TreeNode currTree = new TreeNode(i);
currTree.left = left;
currTree.right = right;
allTrees.add(currTree);
}
}
}
return allTrees;
}
public static void main(String[] args) {
// Integer[] list = {1};
// TreeNode tree = createTree(list,0);
System.out.println(generateTrees(3));
}
} | [
"2426477795@qq.com"
] | 2426477795@qq.com |
343e507fa08c8af9f7465acf8db014065adf9899 | 62f1f2a47d89895359c092331ce098c45f741297 | /operation/src/com/company/Main.java | bc512b054cc184b358445a4c77759d4e9874f730 | [] | no_license | HoweZhang1020/stydy-from-design-mode | a87d9b56dd4cc88666910d967868806c29f8fd89 | 498c87706ab2ffaf3df3d9078f0ea181b54c9b21 | refs/heads/master | 2020-04-04T09:32:15.924586 | 2018-11-05T08:31:40 | 2018-11-05T08:31:40 | 155,822,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,391 | java | package com.company;
import java.util.Scanner;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
System.out.println("请输入");
String input=scanner.nextLine();
String num_regEx="[*+-/]";
String oc_regEx="\\d+";
String []nums_strs=input.split(num_regEx);
String []oc_strs=input.split(oc_regEx);
if(nums_strs.length-oc_strs.length!=1){
}
//判断运算符是否有非运算符
for(String tmp:oc_strs){
if (Pattern.matches(oc_regEx,tmp)==true){
System.out.println("输入错误");
break;
}
}
//判断数字数组是否有非数字
for(String tmp:nums_strs){
if (Pattern.matches(num_regEx,tmp)==true){
System.out.println("输入错误1");
break;
}
}
//运算函数
for(int i=0;i<oc_strs.length-1;i++){
if(Pattern.matches("[*/]",oc_strs[i])){
switch (oc_strs[i]){
case "*":
nums_strs[i]=String.valueOf(Double.valueOf(nums_strs[i])*Double.valueOf(nums_strs[i+1]));
nums_strs[i+1]=nums_strs[i];
break;
case "/":
nums_strs[i]=String.valueOf(Double.valueOf(nums_strs[i])/Double.valueOf(nums_strs[i+1]));
nums_strs[i+1]=nums_strs[i];
break;
}
}
}
int index=0;
for(int i=0;i<oc_strs.length-1;i++){
if(Pattern.matches("[+-]",oc_strs[i])){
index=i;
switch (oc_strs[i]){
case "+":
nums_strs[i]=String.valueOf(Double.valueOf(nums_strs[i])+Double.valueOf(nums_strs[i+1]));
nums_strs[i+1]=nums_strs[i];
break;
case "-":
nums_strs[i]=String.valueOf(Double.valueOf(nums_strs[i])-Double.valueOf(nums_strs[i+1]));
nums_strs[i+1]=nums_strs[i];
break;
}
}
}
System.out.println(input+"的结果为:"+nums_strs[index]);
}
}
| [
"294537464@qq.com"
] | 294537464@qq.com |
691223aef550a00645cd9763e94f7f2891100d25 | 1d9f8e01aafbe4602e825db61f4b0043063184dd | /ContentWorkflowManagementDocument/ContentWorkflowManagementDocumentEjb/src/main/java/edu/ubb/cwmdEjb/dao/UserDAO.java | 4c9c57aa770f069a72d8b95dbb3cf659f92ee58d | [] | no_license | dianamarin28/CWMD | 328d07ff65269b48f2932de37d6877dbb536596d | 6d78b3879f22879047ffbb61cbfa815c571503bc | refs/heads/master | 2020-12-24T09:30:35.522777 | 2017-01-22T08:55:09 | 2017-01-22T08:55:09 | 73,289,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,045 | java | package edu.ubb.cwmdEjb.dao;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceException;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.ubb.cwmdEjb.model.User;
import edu.ubb.cwmdEjb.util.PasswordEncrypter;
@Stateless(name = "UserDAO", mappedName = "ejb/UserDAO")
public class UserDAO {
private static Logger logger = LoggerFactory.getLogger(UserDAO.class);
@PersistenceContext(unitName = "cwmd")
private EntityManager entityManager;
public void insertUser(User user) throws DaoException {
try {
entityManager.persist(user);
entityManager.flush();
} catch (PersistenceException e) {
logger.error("User insertion failed", e);
throw new DaoException("User insertion failed", e);
}
}
public User findById(Long userId) throws DaoException {
try {
User user = entityManager.find(User.class, userId);
if (user == null) {
throw new DaoException("Can't find User for ID " + userId);
}
return user;
} catch (PersistenceException e) {
logger.error("Users retrieval by id failed", e);
throw new DaoException("Users retrieval by id failed", e);
}
}
public User updateUser(User user) throws DaoException {
try {
user = entityManager.merge(user);
entityManager.flush();
return user;
} catch (PersistenceException e) {
logger.error("User update failed ", e);
throw new DaoException("User update failed ", e);
}
}
public void deleteUser(User user) throws DaoException {
try {
user = findById(user.getId());
entityManager.remove(user);
} catch (PersistenceException e) {
logger.error("User deletion failed ", e);
throw new DaoException("User deletion failed ", e);
}
}
public List<User> getUsers() throws DaoException {
try {
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<User> cq = cb.createQuery(User.class);
Root<User> root = cq.from(User.class);
CriteriaQuery<User> allEntities = cq.select(root);
TypedQuery<User> tq = entityManager.createQuery(allEntities);
return tq.getResultList();
} catch (PersistenceException e) {
logger.error("Users retrieval failed", e);
throw new DaoException("Users retrieval failed", e);
}
}
public List<User> getUsersByRoles(String userRole) throws DaoException {
try {
TypedQuery<User> query = entityManager.createQuery("SELECT u FROM User u WHERE u.userRole = :userRole",
User.class);
query.setParameter("userRole", userRole);
return query.getResultList();
} catch (PersistenceException e) {
logger.error("Users retrieval by type failed", e);
throw new DaoException("Users retrieval by type failed", e);
}
}
public String validateUserNameAndPassword(String userName, String password) throws DaoException {
try {
//password = PasswordEncrypter.getGeneratedHashedPassword(password, "");
TypedQuery<User> query = entityManager.createQuery(
"SELECT u FROM User u WHERE u.userName = :userName AND u.password = :password", User.class);
query.setParameter("userName", userName);
query.setParameter("password", password);
List<User> userList = query.getResultList();
if (userList.size() == 1) {
return userList.get(0).getUserRole().toString();
} else {
return "";
}
} catch (PersistenceException e) {
logger.error("Validation of username and password failed", e);
throw new DaoException("Validation of username and password failed", e);
}
}
public User getByUserName(String userName) throws DaoException {
try {
TypedQuery<User> query = entityManager.createQuery("SELECT u FROM User u WHERE u.userName = :userName",
User.class);
query.setParameter("userName", userName);
List<User> userList = query.getResultList();
if (userList.size() == 1) {
return userList.get(0);
} else {
return null;
}
} catch (PersistenceException e) {
logger.error("User retrieval by Name failed", e);
throw new DaoException("User retrieval by Name failed", e);
}
}
public List<User> getUserFromDepartment(Long departmentid)
throws DaoException {
try {
TypedQuery<User> userFromDepartment = entityManager.createQuery(
"SELECT u FROM User u JOIN u.function f WHERE f.department.id = :id", User.class);
userFromDepartment.setParameter("id", departmentid);
List<User> queryResult = userFromDepartment.getResultList();
return queryResult;
} catch (PersistenceException e) {
logger.error("Users that have a given department selection failed.", e);
throw new DaoException("Users that have a given department selection failed.");
}
}
}
| [
"anad_95@yahoo.com"
] | anad_95@yahoo.com |
76be11f97a5e5f1ea05a42f6db8913182b6f95ad | 41291582716e84a142b3df5f1dcd40a74ad072bc | /src/main/java/cn/com/cis/mi/osp/controller/SupplierPipelineController.java | 3370dc85843bbc560744fc4beff99894378d67b5 | [] | no_license | xiamingyuan/nhl | 6f70bea86cf2f4721f9abe1be3bc2da41dafcf5d | 24ec75b7e49256a61f65655ce2a585ba4aa17a75 | refs/heads/master | 2021-05-14T04:16:40.468932 | 2018-01-08T06:14:47 | 2018-01-08T06:14:47 | 116,637,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,256 | java | package cn.com.cis.mi.osp.controller;
import cn.com.cis.mi.common.service.ServiceResult;
import cn.com.cis.mi.osp.common.ExcelHelper;
import cn.com.cis.mi.osp.common.Result;
import cn.com.cis.mi.service.p1.P1Service;
import cn.com.cis.mi.service.p1.dataObjects.ClaimAuditInfo;
import cn.com.cis.mi.utils.dataObjects.QueryResult;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* Created by localadmin on 2016/8/30.
*/
@Controller
public class SupplierPipelineController {
@Autowired(required = false)
private P1Service p1Service;
@RequestMapping(value = "/supplierpipeline/list", method = RequestMethod.GET)
@RequiresPermissions("providerserialbill:list")
public ModelAndView supplierpipeline() throws Exception {
return new ModelAndView("/financialmanage/supplierpipeline/list");
}
/**
* 供应商流水单列表
*
* @return
*/
@RequestMapping(value = "/getproviderserialbill", method = {RequestMethod.GET})
@ResponseBody
public Object getProviderSerialBill(String providerID, String providerAudit, String time, String startTime, String endTime, int pageIndex, int pageSize, String tableOrderName, String tableOrderSort) throws Exception {
Result result;
Date date = null;
Date startDate = null;
Date endDate = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
if (time != null && !time.equals("")) {
date = sdf.parse(time);
}
if (startTime != null && !startTime.equals("")) {
startDate = sdf.parse(startTime);
}
if (endTime != null && !endTime.equals("")) {
endDate = sdf.parse(endTime);
}
ServiceResult<QueryResult<ClaimAuditInfo>> list = p1Service.getProviderSerialBill(providerID, providerAudit, date, startDate, endDate, pageIndex, pageSize, tableOrderName, tableOrderSort);
list.availableAssert(list.getMessage());
result = Result.OK(list.getResult());
return result;
}
//导出全部供应商流水单
@RequestMapping(value = "/excelproviderserialbill", method = {RequestMethod.POST})
@ResponseBody
public void getProviderSerialBill(String providerID, String providerAudit, String time, HttpServletResponse response) throws Exception {
Date date = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (time != null && !time.equals("")) {
date = sdf.parse(time);
}
ServiceResult<QueryResult<ClaimAuditInfo>> providerSerialBillList = p1Service.getProviderSerialBill(providerID, providerAudit, date, null, null, 1, 10000, "", "");
providerSerialBillList.availableAssert(providerSerialBillList.getMessage());
String[] excelHeader = new String[]{"商品名称", "条码", "电子监管码", "规格", "供应商", "审核时间", "购买地区", "票据号码", "报销金额", "申请时间"};
ExcelHelper excelHelper = new ExcelHelper();
excelHelper.createExcelHeader(excelHeader);
for (int i = 0; i < providerSerialBillList.getResult().getDatas().size(); i++) {
ClaimAuditInfo providerSerialBillInfo = providerSerialBillList.getResult().getDatas().get(i);
String[] arr = new String[]{providerSerialBillInfo.getGoodsName(), providerSerialBillInfo.getBarCode(), providerSerialBillInfo.getRegulateCode(),
providerSerialBillInfo.getSpecification(), providerSerialBillInfo.getProviderName(), StringUtils.isBlank(sdf.format(providerSerialBillInfo.getProviderAuditOperTime())) ? "" : sdf.format(providerSerialBillInfo.getProviderAuditOperTime()),
providerSerialBillInfo.getPurchaseCityName(), providerSerialBillInfo.getTicketNumber(), String.valueOf(transAmount(providerSerialBillInfo.getClaimAmount(), 2)),
StringUtils.isBlank(sdf.format(providerSerialBillInfo.getCreatedTime())) ? "" : sdf.format(providerSerialBillInfo.getCreatedTime())
};
excelHelper.createExcelRow(arr);
}
DateFormat format1 = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
String fName = "供应商流水单" + format1.format(new Date()) + ".xlsx";
excelHelper.exportExcel(fName, response);
}
//导出选中供应商流水单
@RequestMapping(value = "/exportselectedproviderserialbill", method = {RequestMethod.POST})
@ResponseBody
public void exportSelectedProviderSerialBill(String ids, HttpServletResponse response) throws Exception {
String[] idsArr = ids.split(",");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
ServiceResult<List<ClaimAuditInfo>> providerSerialBillList = p1Service.exportSelectedProviderSerialBill(idsArr);
providerSerialBillList.availableAssert(providerSerialBillList.getMessage());
String[] excelHeader = new String[]{"商品名称", "条码", "电子监管码", "规格", "供应商", "审核时间", "购买地区", "票据号码", "报销金额", "申请时间"};
ExcelHelper excelHelper = new ExcelHelper();
excelHelper.createExcelHeader(excelHeader);
for (int i = 0; i < providerSerialBillList.getResult().size(); i++) {
ClaimAuditInfo providerSerialBillInfo = providerSerialBillList.getResult().get(i);
String[] arr = new String[]{providerSerialBillInfo.getGoodsName(), providerSerialBillInfo.getBarCode(), providerSerialBillInfo.getRegulateCode(),
providerSerialBillInfo.getSpecification(), providerSerialBillInfo.getProviderName(), StringUtils.isBlank(sdf.format(providerSerialBillInfo.getProviderAuditOperTime())) ? "" : sdf.format(providerSerialBillInfo.getProviderAuditOperTime()),
providerSerialBillInfo.getPurchaseCityName(), providerSerialBillInfo.getTicketNumber(), String.valueOf(transAmount(providerSerialBillInfo.getClaimAmount(), 2)),
StringUtils.isBlank(sdf.format(providerSerialBillInfo.getCreatedTime())) ? "" : sdf.format(providerSerialBillInfo.getCreatedTime())
};
excelHelper.createExcelRow(arr);
}
DateFormat format1 = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
String fName = "供应商流水单" + format1.format(new Date()) + ".xlsx";
excelHelper.exportExcel(fName, response);
}
//转化数字为小数
private double transAmount(double amount, int decimal) {
if (amount > 0) {
BigDecimal b = new BigDecimal(amount);
return b.setScale(decimal, BigDecimal.ROUND_HALF_UP).doubleValue();
}
return 0.00;
}
}
| [
"1036735954@qq.com"
] | 1036735954@qq.com |
5680581451a07ccbfc20c88eae656595319faca2 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/AwsVpcConfiguration.java | 178e5583dcfd5640b3ed6923107b1186a59e0b99 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 16,235 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.ecs.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* An object representing the networking details for a task or service.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/AwsVpcConfiguration" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AwsVpcConfiguration implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be specified
* per <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
* </note>
*/
private com.amazonaws.internal.SdkInternalList<String> subnets;
/**
* <p>
* The IDs of the security groups associated with the task or service. If you don't specify a security group, the
* default security group for the VPC is used. There's a limit of 5 security groups that can be specified per
* <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
* </note>
*/
private com.amazonaws.internal.SdkInternalList<String> securityGroups;
/**
* <p>
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* </p>
*/
private String assignPublicIp;
/**
* <p>
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be specified
* per <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
* </note>
*
* @return The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be
* specified per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
*/
public java.util.List<String> getSubnets() {
if (subnets == null) {
subnets = new com.amazonaws.internal.SdkInternalList<String>();
}
return subnets;
}
/**
* <p>
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be specified
* per <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
* </note>
*
* @param subnets
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be
* specified per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
*/
public void setSubnets(java.util.Collection<String> subnets) {
if (subnets == null) {
this.subnets = null;
return;
}
this.subnets = new com.amazonaws.internal.SdkInternalList<String>(subnets);
}
/**
* <p>
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be specified
* per <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
* </note>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setSubnets(java.util.Collection)} or {@link #withSubnets(java.util.Collection)} if you want to override
* the existing values.
* </p>
*
* @param subnets
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be
* specified per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AwsVpcConfiguration withSubnets(String... subnets) {
if (this.subnets == null) {
setSubnets(new com.amazonaws.internal.SdkInternalList<String>(subnets.length));
}
for (String ele : subnets) {
this.subnets.add(ele);
}
return this;
}
/**
* <p>
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be specified
* per <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
* </note>
*
* @param subnets
* The IDs of the subnets associated with the task or service. There's a limit of 16 subnets that can be
* specified per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified subnets must be from the same VPC.
* </p>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AwsVpcConfiguration withSubnets(java.util.Collection<String> subnets) {
setSubnets(subnets);
return this;
}
/**
* <p>
* The IDs of the security groups associated with the task or service. If you don't specify a security group, the
* default security group for the VPC is used. There's a limit of 5 security groups that can be specified per
* <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
* </note>
*
* @return The IDs of the security groups associated with the task or service. If you don't specify a security
* group, the default security group for the VPC is used. There's a limit of 5 security groups that can be
* specified per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
*/
public java.util.List<String> getSecurityGroups() {
if (securityGroups == null) {
securityGroups = new com.amazonaws.internal.SdkInternalList<String>();
}
return securityGroups;
}
/**
* <p>
* The IDs of the security groups associated with the task or service. If you don't specify a security group, the
* default security group for the VPC is used. There's a limit of 5 security groups that can be specified per
* <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
* </note>
*
* @param securityGroups
* The IDs of the security groups associated with the task or service. If you don't specify a security group,
* the default security group for the VPC is used. There's a limit of 5 security groups that can be specified
* per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
*/
public void setSecurityGroups(java.util.Collection<String> securityGroups) {
if (securityGroups == null) {
this.securityGroups = null;
return;
}
this.securityGroups = new com.amazonaws.internal.SdkInternalList<String>(securityGroups);
}
/**
* <p>
* The IDs of the security groups associated with the task or service. If you don't specify a security group, the
* default security group for the VPC is used. There's a limit of 5 security groups that can be specified per
* <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
* </note>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setSecurityGroups(java.util.Collection)} or {@link #withSecurityGroups(java.util.Collection)} if you want
* to override the existing values.
* </p>
*
* @param securityGroups
* The IDs of the security groups associated with the task or service. If you don't specify a security group,
* the default security group for the VPC is used. There's a limit of 5 security groups that can be specified
* per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AwsVpcConfiguration withSecurityGroups(String... securityGroups) {
if (this.securityGroups == null) {
setSecurityGroups(new com.amazonaws.internal.SdkInternalList<String>(securityGroups.length));
}
for (String ele : securityGroups) {
this.securityGroups.add(ele);
}
return this;
}
/**
* <p>
* The IDs of the security groups associated with the task or service. If you don't specify a security group, the
* default security group for the VPC is used. There's a limit of 5 security groups that can be specified per
* <code>AwsVpcConfiguration</code>.
* </p>
* <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
* </note>
*
* @param securityGroups
* The IDs of the security groups associated with the task or service. If you don't specify a security group,
* the default security group for the VPC is used. There's a limit of 5 security groups that can be specified
* per <code>AwsVpcConfiguration</code>.</p> <note>
* <p>
* All specified security groups must be from the same VPC.
* </p>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AwsVpcConfiguration withSecurityGroups(java.util.Collection<String> securityGroups) {
setSecurityGroups(securityGroups);
return this;
}
/**
* <p>
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* </p>
*
* @param assignPublicIp
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* @see AssignPublicIp
*/
public void setAssignPublicIp(String assignPublicIp) {
this.assignPublicIp = assignPublicIp;
}
/**
* <p>
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* </p>
*
* @return Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* @see AssignPublicIp
*/
public String getAssignPublicIp() {
return this.assignPublicIp;
}
/**
* <p>
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* </p>
*
* @param assignPublicIp
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AssignPublicIp
*/
public AwsVpcConfiguration withAssignPublicIp(String assignPublicIp) {
setAssignPublicIp(assignPublicIp);
return this;
}
/**
* <p>
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* </p>
*
* @param assignPublicIp
* Whether the task's elastic network interface receives a public IP address. The default value is
* <code>DISABLED</code>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AssignPublicIp
*/
public AwsVpcConfiguration withAssignPublicIp(AssignPublicIp assignPublicIp) {
this.assignPublicIp = assignPublicIp.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getSubnets() != null)
sb.append("Subnets: ").append(getSubnets()).append(",");
if (getSecurityGroups() != null)
sb.append("SecurityGroups: ").append(getSecurityGroups()).append(",");
if (getAssignPublicIp() != null)
sb.append("AssignPublicIp: ").append(getAssignPublicIp());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AwsVpcConfiguration == false)
return false;
AwsVpcConfiguration other = (AwsVpcConfiguration) obj;
if (other.getSubnets() == null ^ this.getSubnets() == null)
return false;
if (other.getSubnets() != null && other.getSubnets().equals(this.getSubnets()) == false)
return false;
if (other.getSecurityGroups() == null ^ this.getSecurityGroups() == null)
return false;
if (other.getSecurityGroups() != null && other.getSecurityGroups().equals(this.getSecurityGroups()) == false)
return false;
if (other.getAssignPublicIp() == null ^ this.getAssignPublicIp() == null)
return false;
if (other.getAssignPublicIp() != null && other.getAssignPublicIp().equals(this.getAssignPublicIp()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getSubnets() == null) ? 0 : getSubnets().hashCode());
hashCode = prime * hashCode + ((getSecurityGroups() == null) ? 0 : getSecurityGroups().hashCode());
hashCode = prime * hashCode + ((getAssignPublicIp() == null) ? 0 : getAssignPublicIp().hashCode());
return hashCode;
}
@Override
public AwsVpcConfiguration clone() {
try {
return (AwsVpcConfiguration) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.ecs.model.transform.AwsVpcConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
71ebeb1d6f01787bfddc78a58ab5d39328f52ba9 | 7285b6d59e5c5f6cd11c6359bcf68176d073f4ce | /raghu/StudentNewSir/src/main/java/com/hcl/studentNewSir/App.java | 2b2dcda45679b83227a52e8751144dd944e6dc44 | [] | no_license | Raghu-M/Mode-2 | 665524dc4cd80b53c268caf872a6cee34bc96a95 | ae3f249282289cce9af639574afd395466923e5e | refs/heads/master | 2020-08-27T07:07:32.266496 | 2019-10-24T11:21:04 | 2019-10-24T11:21:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package com.hcl.studentNewSir;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"raghu112233@gmail.com"
] | raghu112233@gmail.com |
a4e561aefd26169ff931857c7bda637502315509 | 15237faf3113c144bad2c134dbe1cfa08756ba12 | /opc-da/src/main/java/com/eas/opc/da/dcom/OPCShutdownImpl.java | cef227970e58c1b4b1b8d130b8d4b72952584057 | [
"Apache-2.0"
] | permissive | marat-gainullin/platypus-js | 3fcf5a60ba8e2513d63d5e45c44c11cb073b07fb | 22437b7172a3cbebe2635899608a32943fed4028 | refs/heads/master | 2021-01-20T12:14:26.954647 | 2020-06-10T07:06:34 | 2020-06-10T07:06:34 | 21,357,013 | 1 | 2 | Apache-2.0 | 2020-06-09T20:44:52 | 2014-06-30T15:56:35 | Java | UTF-8 | Java | false | false | 1,629 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.eas.opc.da.dcom;
import java.util.logging.Logger;
import org.jinterop.dcom.core.JIFlags;
import org.jinterop.dcom.core.JILocalCoClass;
import org.jinterop.dcom.core.JILocalInterfaceDefinition;
import org.jinterop.dcom.core.JILocalMethodDescriptor;
import org.jinterop.dcom.core.JILocalParamsDescriptor;
import org.jinterop.dcom.core.JIString;
/**
*
* @author pk
*/
public class OPCShutdownImpl
{
final static String IID_IOPCShutdown = "f31dfde1-07b6-11d2-b2d8-0060083ba1fb";
private OPCShutdownListener listener;
private JILocalCoClass localClass;
OPCShutdownImpl(OPCShutdownListener listener)
{
this.listener = listener;
createCoClass();
}
JILocalCoClass getLocalClass()
{
return localClass;
}
private void createCoClass()
{
localClass = new JILocalCoClass(new JILocalInterfaceDefinition(IID_IOPCShutdown, false), this, false);
JILocalParamsDescriptor shutdownParams = new JILocalParamsDescriptor();
shutdownParams.addInParamAsObject(JIString.class, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
JILocalMethodDescriptor shutdownDesc = new JILocalMethodDescriptor("ShutdownRequest", 0, shutdownParams);
localClass.getInterfaceDefinition().addMethodDescriptor(shutdownDesc);
}
public void ShutdownRequest(JIString reason)
{
Logger.getLogger(OPCShutdownImpl.class.getName()).finest("ShutdownRequest, reason=" + reason);
listener.shutdownRequested(reason.getString());
}
}
| [
"mg@altsoft.biz"
] | mg@altsoft.biz |
bb026c6d886536f7b7379f9d83e05efb12c19f05 | 3a33c2f1452889462b0b36bbc59ec1257dd5c72e | /src/io/github/pranavgade20/classexplorer/attributeinfo/LocalVariableTableAttribute.java | 1f475b5344b691e9b14b4b560b9ffe1633325b93 | [] | no_license | pranavgade20/ClassReader | dbfc15d27aced3d4b283319154be4a0d82074ccd | d01c23ebf9509045ffa014b8fca1f756f9225000 | refs/heads/master | 2023-08-07T11:51:59.978377 | 2021-10-05T10:29:11 | 2021-10-05T10:29:11 | 340,734,732 | 0 | 0 | null | 2021-10-04T12:06:34 | 2021-02-20T19:20:30 | Java | UTF-8 | Java | false | false | 3,362 | java | package io.github.pranavgade20.classexplorer.attributeinfo;
import io.github.pranavgade20.classexplorer.Klass;
import io.github.pranavgade20.classexplorer.constantfield.ConstantField;
import io.github.pranavgade20.classexplorer.constantfield.ConstantUtf8;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
public class LocalVariableTableAttribute extends AttributeInfo {
// represents LocalVariableTable_attribute
short local_variable_table_length;
LinkedList<LocalVariableTableEntry> local_variable_table;
LocalVariableTableAttribute(AttributeInfo parent, DataInput classStream, Klass klass) throws IOException {
super(parent);
local_variable_table_length = classStream.readShort();
local_variable_table = new LinkedList<>();
for (int i = 0; i < local_variable_table_length; i++) {
local_variable_table.add(i, new LocalVariableTableEntry(classStream, klass));
}
}
public class LocalVariableTableEntry {
short start_pc, length, index;
ConstantUtf8 name, descriptor;
LocalVariableTableEntry(DataInput classStream, Klass klass) throws IOException {
start_pc = classStream.readShort();
length = classStream.readShort();
name = (ConstantUtf8) klass.constantPool[classStream.readShort()];
descriptor = (ConstantUtf8) klass.constantPool[classStream.readShort()];
index = classStream.readShort();
}
public void write(DataOutput output, List<ConstantField> constant_pool) throws IOException {
output.writeShort(start_pc);
output.writeShort(length);
int idx = 0;
for (int i = 0; i < constant_pool.size(); i++) {
if (this.name.equals(constant_pool.get(i))) {
idx = i;
break;
}
}
if (idx == 0) {
constant_pool.add(this.name);
idx = constant_pool.size();
}
output.writeShort(idx + 1);
idx = 0;
for (int i = 0; i < constant_pool.size(); i++) {
if (this.descriptor.equals(constant_pool.get(i))) {
idx = i;
break;
}
}
if (idx == 0) {
constant_pool.add(this.descriptor);
idx = constant_pool.size();
}
output.writeShort(idx + 1);
output.writeShort(index);
}
}
@Override
public void write(DataOutput output, List<ConstantField> constant_pool) throws IOException {
int idx = 0;
for (int i = 0; i < constant_pool.size(); i++) {
if (this.attribute_name.equals(constant_pool.get(i))) {
idx = i;
break;
}
}
if (idx == 0) {
constant_pool.add(this.attribute_name);
idx = constant_pool.size();
}
output.writeShort(idx + 1);
output.writeInt(local_variable_table.size() * 10 + 2);
output.writeShort(local_variable_table.size());
for (LocalVariableTableEntry entry : local_variable_table) {
entry.write(output, constant_pool);
}
}
}
| [
"pranavgade20@gmail.com"
] | pranavgade20@gmail.com |
7ef01fda7910a35785a2e7bfe6a54e545e184111 | 80b2c013e329e380a0259e303559d00a65ad0d0b | /CISS238/src/chapter8/TestBward.java | e4ebdd2ad16762d328657a315acdf74e8e8f8d54 | [] | no_license | drakesargent/Java-samples | 67a405646014dbf6fdcfae238d665258d17d8771 | b279b8b52f1f131b4ad7873e0682ca74d707afe0 | refs/heads/master | 2021-01-02T09:06:17.203913 | 2017-08-02T17:28:58 | 2017-08-02T17:28:58 | 99,143,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package chapter8;
import java.util.Scanner;
public class TestBward {
public static void main(String[] args) {
String userInput;
String bwardInput = "";
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter something: ");
userInput = keyboard.nextLine();
for (int index = (userInput.length()-1); index >= 0; index--){
bwardInput += userInput.charAt(index);
}
System.out.print(bwardInput);
keyboard.close();
}
}
| [
"kennethrsargent@gmail.com"
] | kennethrsargent@gmail.com |
71af11b531a4376c700fe7017d8436c457b03a01 | 1808527ec1374a72a764a5a70f74d8e90b4aeb2e | /src/main/java/br/com/fiap/usuarios/repository/bank/BankRepository.java | 9acb53fec36656cdfac1b22cf041961ebd253562 | [] | no_license | GoncalvesGabriel/controle-usuario | 6af6dad1cc8ccb552bf456818ead216cb37f5207 | bad8a4fa4ca1d40f8a3655ccbe4743c81e05de64 | refs/heads/master | 2022-03-12T08:39:17.251184 | 2019-11-06T23:03:54 | 2019-11-06T23:03:54 | 218,028,535 | 0 | 1 | null | 2022-01-21T23:33:04 | 2019-10-28T11:12:14 | Java | UTF-8 | Java | false | false | 243 | java | package br.com.fiap.usuarios.repository.bank;
import br.com.fiap.usuarios.entity.Bank;
import org.springframework.data.jpa.repository.JpaRepository;
public interface BankRepository extends JpaRepository<Bank, Long>, BankCustomRepository {
}
| [
"goncalves.gabrielsilva@gmail.com"
] | goncalves.gabrielsilva@gmail.com |
59e2c333398ab61fb5daac74e818981a17c7f739 | ab4fd2cdce015e0b443b66f949c6dfb741bf61c9 | /src/main/java/com/sun/corba/se/PortableActivationIDL/BadServerDefinitionHolder.java | d3990d86db2f7251a4eac0417b880d7e1d766040 | [] | no_license | lihome/jre | 5964771e9e3ae7375fa697b8dfcd19656e008160 | 4fc2a1928f1de6af00ab6f7b0679db073fe0d054 | refs/heads/master | 2023-05-28T12:13:23.010031 | 2023-05-10T07:30:15 | 2023-05-10T07:30:15 | 116,901,440 | 0 | 0 | null | 2018-11-15T09:49:34 | 2018-01-10T03:13:15 | Java | UTF-8 | Java | false | false | 1,211 | java | package com.sun.corba.se.PortableActivationIDL;
/**
* com/sun/corba/se/PortableActivationIDL/BadServerDefinitionHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /System/Volumes/Data/jenkins/workspace/8-2-build-macosx-x64/jdk8u371/3355/corba/src/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
* Friday, March 17, 2023 3:56:47 AM GMT
*/
public final class BadServerDefinitionHolder implements org.omg.CORBA.portable.Streamable
{
public com.sun.corba.se.PortableActivationIDL.BadServerDefinition value = null;
public BadServerDefinitionHolder ()
{
}
public BadServerDefinitionHolder (com.sun.corba.se.PortableActivationIDL.BadServerDefinition initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = com.sun.corba.se.PortableActivationIDL.BadServerDefinitionHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
com.sun.corba.se.PortableActivationIDL.BadServerDefinitionHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return com.sun.corba.se.PortableActivationIDL.BadServerDefinitionHelper.type ();
}
}
| [
"lihome.jia@gmail.com"
] | lihome.jia@gmail.com |
0fce8bade960d669699f5bd76633bd167b91e9a8 | d980fe2bee46cf84316ec5e4c4c8cecda79569ae | /app/src/main/java/com/example/android/inventory/EditorActivity.java | 7517c3a21fe9b2ea1b14e595b30ef88c07eeb709 | [] | no_license | saidaml/Inventory | 6732952d91fe803d41e75aaf818c7596a7c8e9d8 | bda2de3e44f3329809993375aeb6176980736301 | refs/heads/master | 2020-03-15T21:25:32.483753 | 2018-05-06T16:45:37 | 2018-05-06T16:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,512 | java | package com.example.android.inventory;
import android.app.AlertDialog;
import android.app.LoaderManager;
import android.content.ContentValues;
import android.content.CursorLoader;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.example.android.inventory.data.InventoryContract.InventoryEntry;
public class EditorActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {
private static final int EXISTING_INVENTORY_LOADER = 0;
private Uri mCurrentProductUri;
private EditText mProductNameEditText;
private EditText mProductPriceEditText;
private EditText mProductQuantityEditText;
private Spinner mProductSupplieNameSpinner;
private EditText mProductSupplierPhoneNumberEditText;
private int mSupplieName = InventoryEntry.SUPPLIER_UNKNOWN;
private boolean mProductHasChanged = false;
private View.OnTouchListener mTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
mProductHasChanged = true;
Log.d("message", "onTouch");
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editor);
Log.d("message", "onCreate");
Intent intent = getIntent();
mCurrentProductUri = intent.getData();
if (mCurrentProductUri == null) {
setTitle(getString(R.string.add_product));
invalidateOptionsMenu();
} else {
setTitle(getString(R.string.edit_product));
getLoaderManager().initLoader(EXISTING_INVENTORY_LOADER, null, this);
}
mProductNameEditText = findViewById(R.id.product_name_edit_text);
mProductPriceEditText = findViewById(R.id.product_price_edit_text);
mProductQuantityEditText = findViewById(R.id.product_quantity_edit_text);
mProductSupplieNameSpinner = findViewById(R.id.product_supplier_name_spinner);
mProductSupplierPhoneNumberEditText = findViewById(R.id.product_supplier_phone_number_edit_text);
mProductNameEditText.setOnTouchListener(mTouchListener);
mProductPriceEditText.setOnTouchListener(mTouchListener);
mProductQuantityEditText.setOnTouchListener(mTouchListener);
mProductSupplieNameSpinner.setOnTouchListener(mTouchListener);
mProductSupplierPhoneNumberEditText.setOnTouchListener(mTouchListener);
setupSpinner();
}
private void setupSpinner() {
ArrayAdapter productSupplieNameSpinnerAdapter = ArrayAdapter.createFromResource(this,
R.array.array_supplier_options, android.R.layout.simple_spinner_item);
productSupplieNameSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
mProductSupplieNameSpinner.setAdapter(productSupplieNameSpinnerAdapter);
mProductSupplieNameSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String selection = (String) parent.getItemAtPosition(position);
if (!TextUtils.isEmpty(selection)) {
if (selection.equals(getString(R.string.supplier_amazon))) {
mSupplieName = InventoryEntry.SUPPLIER_AMAZON;
} else if (selection.equals(getString(R.string.supplier_ebay))) {
mSupplieName = InventoryEntry.SUPPLIER_EBAY;
} else if (selection.equals(getString(R.string.supplier_lulu))) {
mSupplieName = InventoryEntry.SUPPLIER_LULU;
} else {
mSupplieName = InventoryEntry.SUPPLIER_UNKNOWN;
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
mSupplieName = InventoryEntry.SUPPLIER_UNKNOWN;
}
});
}
private void saveProduct() {
String productNameString = mProductNameEditText.getText().toString().trim();
String productPriceString = mProductPriceEditText.getText().toString().trim();
String productQuantityString = mProductQuantityEditText.getText().toString().trim();
String productSupplierPhoneNumberString = mProductSupplierPhoneNumberEditText.getText().toString().trim();
if (mCurrentProductUri == null) {
if (TextUtils.isEmpty(productNameString)) {
Toast.makeText(this, getString(R.string.product_name_requires), Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(productPriceString)) {
Toast.makeText(this, getString(R.string.price_requires), Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(productQuantityString)) {
Toast.makeText(this, getString(R.string.quantity_requires), Toast.LENGTH_SHORT).show();
return;
}
if (mSupplieName == InventoryEntry.SUPPLIER_UNKNOWN) {
Toast.makeText(this, getString(R.string.supplier_name_requires), Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(productSupplierPhoneNumberString)) {
Toast.makeText(this, getString(R.string.supplier_phone_requires), Toast.LENGTH_SHORT).show();
return;
}
ContentValues values = new ContentValues();
values.put(InventoryEntry.COLUMN_PRODUCT_NAME, productNameString);
values.put(InventoryEntry.COLUMN_PRODUCT_PRICE, productPriceString);
values.put(InventoryEntry.COLUMN_PRODUCT_QUANTITY, productQuantityString);
values.put(InventoryEntry.COLUMN_PRODUCT_SUPPLIER_NAME, mSupplieName);
values.put(InventoryEntry.COLUMN_PRODUCT_SUPPLIER_PHONE_NUMBER, productSupplierPhoneNumberString);
Uri newUri = getContentResolver().insert(InventoryEntry.CONTENT_URI, values);
if (newUri == null) {
Toast.makeText(this, getString(R.string.insert_failed),
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, getString(R.string.insert_successful),
Toast.LENGTH_SHORT).show();
finish();
}
} else {
if (TextUtils.isEmpty(productNameString)) {
Toast.makeText(this, getString(R.string.product_name_requires), Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(productPriceString)) {
Toast.makeText(this, getString(R.string.price_requires), Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(productQuantityString)) {
Toast.makeText(this, getString(R.string.quantity_requires), Toast.LENGTH_SHORT).show();
return;
}
if (mSupplieName == InventoryEntry.SUPPLIER_UNKNOWN) {
Toast.makeText(this, getString(R.string.supplier_name_requires), Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(productSupplierPhoneNumberString)) {
Toast.makeText(this, getString(R.string.supplier_phone_requires), Toast.LENGTH_SHORT).show();
return;
}
ContentValues values = new ContentValues();
values.put(InventoryEntry.COLUMN_PRODUCT_NAME, productNameString);
values.put(InventoryEntry.COLUMN_PRODUCT_PRICE, productPriceString);
values.put(InventoryEntry.COLUMN_PRODUCT_QUANTITY, productQuantityString);
values.put(InventoryEntry.COLUMN_PRODUCT_SUPPLIER_NAME, mSupplieName);
values.put(InventoryEntry.COLUMN_PRODUCT_SUPPLIER_PHONE_NUMBER, productSupplierPhoneNumberString);
int rowsAffected = getContentResolver().update(mCurrentProductUri, values, null, null);
if (rowsAffected == 0) {
Toast.makeText(this, getString(R.string.update_failed),
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, getString(R.string.update_successful),
Toast.LENGTH_SHORT).show();
finish();
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_editor, menu);
Log.d("message", "open Editor Activity");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_save:
saveProduct();
return true;
case android.R.id.home:
if (!mProductHasChanged) {
NavUtils.navigateUpFromSameTask(EditorActivity.this);
return true;
}
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
NavUtils.navigateUpFromSameTask(EditorActivity.this);
}
};
showUnsavedChangesDialog(discardButtonClickListener);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
if (!mProductHasChanged) {
super.onBackPressed();
return;
}
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
};
showUnsavedChangesDialog(discardButtonClickListener);
}
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
String[] projection = {
InventoryEntry._ID,
InventoryEntry.COLUMN_PRODUCT_NAME,
InventoryEntry.COLUMN_PRODUCT_PRICE,
InventoryEntry.COLUMN_PRODUCT_QUANTITY,
InventoryEntry.COLUMN_PRODUCT_SUPPLIER_NAME,
InventoryEntry.COLUMN_PRODUCT_SUPPLIER_PHONE_NUMBER
};
return new CursorLoader(this,
mCurrentProductUri,
projection,
null,
null,
null);
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
if (cursor == null || cursor.getCount() < 1) {
return;
}
if (cursor.moveToFirst()) {
int nameColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_PRODUCT_NAME);
int priceColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_PRODUCT_PRICE);
int quantityColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_PRODUCT_QUANTITY);
int supplierNameColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_PRODUCT_SUPPLIER_NAME);
int supplierPhoneColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_PRODUCT_SUPPLIER_PHONE_NUMBER);
String currentName = cursor.getString(nameColumnIndex);
int currentPrice = cursor.getInt(priceColumnIndex);
int currentQuantity = cursor.getInt(quantityColumnIndex);
int currentSupplierName = cursor.getInt(supplierNameColumnIndex);
int currentSupplierPhone = cursor.getInt(supplierPhoneColumnIndex);
mProductNameEditText.setText(currentName);
mProductPriceEditText.setText(Integer.toString(currentPrice));
mProductQuantityEditText.setText(Integer.toString(currentQuantity));
mProductSupplierPhoneNumberEditText.setText(Integer.toString(currentSupplierPhone));
switch (currentSupplierName) {
case InventoryEntry.SUPPLIER_AMAZON:
mProductSupplieNameSpinner.setSelection(1);
break;
case InventoryEntry.SUPPLIER_EBAY:
mProductSupplieNameSpinner.setSelection(2);
break;
case InventoryEntry.SUPPLIER_LULU:
mProductSupplieNameSpinner.setSelection(3);
break;
default:
mProductSupplieNameSpinner.setSelection(0);
break;
}
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
mProductNameEditText.setText("");
mProductPriceEditText.setText("");
mProductQuantityEditText.setText("");
mProductSupplierPhoneNumberEditText.setText("");
mProductSupplieNameSpinner.setSelection(0);
}
private void showUnsavedChangesDialog(
DialogInterface.OnClickListener discardButtonClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.unsaved_changes_dialog_msg);
builder.setPositiveButton(R.string.discard, discardButtonClickListener);
builder.setNegativeButton(R.string.keep_editing, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (dialog != null) {
dialog.dismiss();
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
}
| [
"qunsulka@gmail.com"
] | qunsulka@gmail.com |
6c98bde7f4618a0145f103269b087078277512a7 | 65fa24b7b556f9575b3a5d702501547741f2abc4 | /Examwifiserver version 3/src/sheet/Studentdetail.java | 55fb499b2b1839ab8fd77e1f58af237cad090230 | [] | no_license | u4507075/medixam_server | d948e1c6cd9b7c74e62699d9d43a69e04c096287 | 08df6a8c891b5dd35ba97ee53c7dda052a1fbe7c | refs/heads/master | 2021-05-10T10:03:07.467355 | 2018-01-25T17:44:31 | 2018-01-25T17:44:31 | 118,946,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,043 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sheet;
import java.util.ArrayList;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import sheet.Examset.Set;
/**
*
* @author bon
*/
public class Studentdetail {
ArrayList<Student> students = new ArrayList();
public String read(HSSFWorkbook wb, Examset set)
{
HSSFSheet sheet = wb.getSheet("student detail");
for(int i=1;i<sheet.getPhysicalNumberOfRows();i++)
{
String studentid = getValue(sheet.getRow(i).getCell(0));
String studentname = getValue(sheet.getRow(i).getCell(1));
String exset = getValue(sheet.getRow(i).getCell(2));
if(studentid.equals(""))
{
return "complete";
//return "Student id at row "+(i+1)+"cannot be empty.";
}
if(studentname.equals(""))
{
return "Student name at row "+(i+1)+"cannot be empty.";
}
boolean matchset = false;
for(int j=0;j<set.getSets().size();j++)
{
Set s = (Set)set.getSets().get(j);
if(s.getSetname().equals(exset))
{
matchset = true;
break;
}
}
if(!matchset)
{
return "Set name in the student detail sheet at row "+(i+1)+"does not match to the exam set.";
}
Student student = new Student(studentid, studentname, exset);
students.add(student);
}
return "complete";
}
public ArrayList getStudents()
{
return students;
}
private String getValue(HSSFCell cell)
{
if(cell == null || cell.getCellType()==HSSFCell.CELL_TYPE_BLANK)
{
return "";
}
else if(cell.getCellType()==HSSFCell.CELL_TYPE_STRING)
{
return cell.getStringCellValue();
}
else if(cell.getCellType()==HSSFCell.CELL_TYPE_NUMERIC)
{
return fmt(cell.getNumericCellValue());
}
else
{
return "";
}
}
private String fmt(double d)
{
if(d == (long) d)
return String.format("%d",(long)d);
else
return String.format("%s",d);
}
public class Student
{
String studentid, studentname, set = "";
public Student(String studentid, String studentname, String set)
{
this.studentid = studentid;
this.studentname = studentname;
this.set = set;
}
public String getStudentid()
{
return studentid;
}
public String getStudentname()
{
return studentname;
}
public String getSet()
{
return set;
}
}
}
| [
"piyapong@growingdata.com.au"
] | piyapong@growingdata.com.au |
356510a59b4a3146df9a147ed54142bdc7d598d5 | 762a9124a8883d7c8d3ec2f7e8d007f033c936e0 | /rcore/src/main/java/com/yiyou/gamesdk/core/api/impl/ChildrenAccountHistoryManager.java | 696650b4b6258005b256c0ddfece6632cace7592 | [] | no_license | fyc/HWSDK | 7a691278e45af5851d3615f7834f10fd802aa268 | fe4cb325e538519478db12a6a33713d37bd9787b | refs/heads/master | 2020-04-02T09:04:00.266463 | 2018-10-23T06:33:54 | 2018-10-23T06:39:13 | 154,274,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,175 | java | package com.yiyou.gamesdk.core.api.impl;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.annotation.NonNull;
import android.support.v4.util.ArrayMap;
import android.text.TextUtils;
import com.mobilegamebar.rsdk.outer.util.Log;
import com.yiyou.gamesdk.core.CoreManager;
import com.yiyou.gamesdk.core.api.ApiFacade;
import com.yiyou.gamesdk.core.api.def.IChildrenAccountHistoryApi;
import com.yiyou.gamesdk.core.base.http.RequestHelper;
import com.yiyou.gamesdk.core.base.http.RequestManager;
import com.yiyou.gamesdk.core.base.http.utils.Urlpath;
import com.yiyou.gamesdk.core.base.http.volley.HwRequest;
import com.yiyou.gamesdk.core.base.http.volley.listener.TtRespListener;
import com.yiyou.gamesdk.core.storage.Database;
import com.yiyou.gamesdk.core.storage.StorageAgent;
import com.yiyou.gamesdk.core.storage.db.global.ChildrenAccountTable;
import com.yiyou.gamesdk.model.ChildrenAccountHistoryInfo;
import com.yiyou.gamesdk.util.ToastUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
*
* Created by Nekomimi on 2017/4/24.
*/
class ChildrenAccountHistoryManager implements IChildrenAccountHistoryApi {
private static final String TAG = "RSDK: "+"ChildrenAccountHistoryManager";
private static final Object lock = new Object();
private Map<String, ChildrenAccountHistoryInfo> cache = new LinkedHashMap<>();
public ChildrenAccountHistoryManager() {loadHistoryToCache();}
@Override
public ChildrenAccountHistoryInfo getChildrenAccountHistory(String userID) {
return cache.get(userID);
}
@Override
public List<ChildrenAccountHistoryInfo> getAllChildrenAccountHistories() {
return new ArrayList<>(cache.values());
}
@Override
public void insertOrUpdateChildrenAccountHistory(@NonNull ChildrenAccountHistoryInfo childrenAccountHistoryInfo) {
cache.put(String.valueOf(childrenAccountHistoryInfo.childrenUserID) , childrenAccountHistoryInfo);
final ContentValues cvToSubmit = ChildrenAccountHistoryInfo.transformToCV(childrenAccountHistoryInfo);
StorageAgent.dbAgent().getPublicDatabase()
.executeTask(new Database.DatabaseTask() {
@Override
public void process(SQLiteDatabase database) {
database.insertWithOnConflict(ChildrenAccountTable.TABLE_NAME, null,
cvToSubmit, SQLiteDatabase.CONFLICT_REPLACE);
}
});
}
@Override
public void deleteChildrenAccountHistory(final String childrenUserID) {
synchronized (lock) {
cache.remove(childrenUserID);
}
StorageAgent.dbAgent().getPublicDatabase()
.executeTask(new Database.DatabaseTask() {
@Override
public void process(SQLiteDatabase database) {
database.delete(ChildrenAccountTable.TABLE_NAME,
ChildrenAccountTable.COL_CHILDREN_USER_ID + " = ?",
new String[]{ childrenUserID });
}
});
}
@Override
public List<ChildrenAccountHistoryInfo> getChildrenAccountHistory(@NonNull String userId,@NonNull String gameId) {
List<ChildrenAccountHistoryInfo> result = new ArrayList<>();
Log.d(TAG, "getChildrenAccountHistory: " + cache.size());
for (ChildrenAccountHistoryInfo childrenAccountHistoryInfo: cache.values()){
if (TextUtils.equals(userId,String.valueOf(childrenAccountHistoryInfo.userID))
&& TextUtils.equals(gameId,childrenAccountHistoryInfo.gameId) ){
result.add(childrenAccountHistoryInfo);
}
}
return result;
}
@Override
public List<ChildrenAccountHistoryInfo> getCurrentChildrenAccountHistory() {
return getChildrenAccountHistory(String.valueOf(ApiFacade.getInstance().getMainUid()), String.valueOf(ApiFacade.getInstance().getCurrentGameID()));
}
@Override
public void updateCurrentChildrenAccount( List<ChildrenAccountHistoryInfo> accountHistoryInfoList) {
List<ChildrenAccountHistoryInfo> originList = getCurrentChildrenAccountHistory();
for (ChildrenAccountHistoryInfo childrenAccountHistoryInfo : originList){
deleteChildrenAccountHistory(childrenAccountHistoryInfo.childrenUserID+"");
}
for (ChildrenAccountHistoryInfo childrenAccountHistoryInfo : accountHistoryInfoList){
insertOrUpdateChildrenAccountHistory(childrenAccountHistoryInfo);
}
}
@Override
public void editChildrenAccountName(long childUserId, String childUserName, TtRespListener callback) {
if (childUserId == 0 || TextUtils.isEmpty(childUserName) ){
ToastUtils.showMsg("输入错误");
return;
}
Map<String, String> params = new ArrayMap<>();
RequestHelper.buildParamsWithBaseInfo(params);
params.put("childUserId",String.valueOf(childUserId));
params.put("childUserName",childUserName);
HwRequest hwRequest = new HwRequest<>(Urlpath.CHILD_ACCOUNT_UPDATE,params,null,callback);
RequestManager.getInstance(CoreManager.getContext()).addRequest(hwRequest, null);
}
private void loadHistoryToCache() {
Cursor cursor = StorageAgent.dbAgent().getPublicDatabase()
.query(false, ChildrenAccountTable.TABLE_NAME, null, null, null, null, null,
ChildrenAccountTable.COL_LAST_LOGIN_TIME + " DESC", null);
if (cursor != null) {
try {
synchronized (lock) {
while (cursor.moveToNext()) {
ChildrenAccountHistoryInfo info = ChildrenAccountHistoryInfo.transformFromCursor(cursor);
cache.put(String.valueOf(info.childrenUserID) , info);
}
}
}finally {
cursor.close();
}
}
}
}
| [
"925355740@qq.com"
] | 925355740@qq.com |
d2ee1f3be4ce70fd85b0c4e0e09eb53b5813a085 | 1c70842cc5877924f539feb66c3ec43c1af7df10 | /src/main/java/Polo/entity/DailyFoodBuilder.java | 53e0472dd318c1b1d9d5001ded5e6039136fbb9b | [] | no_license | past77/trekking | dbfb7034570f044ce579303e06abb6c8d23adf15 | 74978601f35194c773ec694e6e73babb044a04f7 | refs/heads/master | 2022-07-10T07:32:00.090470 | 2019-08-12T12:22:37 | 2019-08-12T12:22:37 | 198,699,162 | 0 | 0 | null | 2020-10-13T14:51:18 | 2019-07-24T19:39:33 | Java | UTF-8 | Java | false | false | 493 | java | package polo.entity;
public class DailyFoodBuilder {
private FoodHistory foodUnit;
public void reset() {
foodUnit = new FoodHistory();
}
public void setClient_id(int client_id) {
foodUnit.setClient_id(client_id);
}
public void setFood_id(int food_id) {
foodUnit.setFood_id(food_id);
}
public void setAmount(int amount) {
foodUnit.setAmount(amount);
}
public FoodHistory getResult() {
return foodUnit;
}
}
| [
"curls.prg@gmail.com"
] | curls.prg@gmail.com |
df847610adb52bdf7b1e2ab979b53a7f51b1f66f | eef9e9964d55aa9da6df86e616fe9625b7952d45 | /src/business/VolunteerJob/VolunteerJob.java | f7535344edec032551068fe84dee3112700e320e | [] | no_license | Rebeccazmf/FoodBank | 3e613dc2f2b2107af872d786bebaf0997b229c97 | 157abe8d8d6b7c34a64908d19b7533292c6b6280 | refs/heads/master | 2021-05-08T16:12:34.201665 | 2018-02-04T02:12:48 | 2018-02-04T02:12:48 | 120,146,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,427 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package business.VolunteerJob;
import business.EcoSystem;
/**
*
* @author 梦菲
*/
public class VolunteerJob {
private int jobID;
private String insitution;
private String jobTitle;
private String description;
private String requirement;
public VolunteerJob() {
jobID = EcoSystem.getInstance().getVolunteerJobID();
}
public int getJobID() {
return jobID;
}
public void setJobID(int jobID) {
this.jobID = jobID;
}
public String getInsitution() {
return insitution;
}
public void setInsitution(String insitution) {
this.insitution = insitution;
}
public String getJobTitle() {
return jobTitle;
}
public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getRequirement() {
return requirement;
}
public void setRequirement(String requirement) {
this.requirement = requirement;
}
@Override
public String toString() {
return jobTitle;
}
}
| [
"zhang.mengf@husky.neu.edu"
] | zhang.mengf@husky.neu.edu |
f3cbb1a89e7cf2fcc80a148e7322d5673ba8c70f | ec8274a1b3fd3df78fdab99b9e01fa5beae104ba | /src/main/java/com/bookscatalog/dao/impl/BookDAOImpl.java | 6d30e57df41685cb7150e1c07abeeb0e7351728f | [] | no_license | pryadko/BooksCatalog | c6bdbde0cead06be44fb167a483700db9a2a74d6 | 62ad2f278d265a325ef59c03966ab70f22db4d9c | refs/heads/master | 2022-12-23T13:57:32.833458 | 2022-07-04T12:52:45 | 2022-07-04T12:52:45 | 15,268,138 | 0 | 0 | null | 2022-12-10T06:24:19 | 2013-12-17T22:45:41 | Java | UTF-8 | Java | false | false | 2,101 | java | package com.bookscatalog.dao.impl;
import com.bookscatalog.dao.BookDAO;
import com.bookscatalog.domain.Book;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository()
public class BookDAOImpl implements BookDAO {
@Autowired
private SessionFactory sessionFactory;
public void save(Book book) {
sessionFactory.getCurrentSession().saveOrUpdate(book);
}
private List<Book> bookInitAuthor(List<Book> books) {
for (Book book : books)
Hibernate.initialize(book.getAuthors());
return books;
}
public void update(Book book) {
sessionFactory.getCurrentSession().saveOrUpdate(book);
}
@SuppressWarnings("unchecked")
public List<Book> getAllBooks() {
return bookInitAuthor((List<Book>) sessionFactory.getCurrentSession().createQuery("from Book").list());
}
public void delete(Book book) {
sessionFactory.getCurrentSession().delete(book);
}
public Book findBookById(int id) {
Book result;
Query q = sessionFactory.getCurrentSession().createQuery("from Book where id = :id");
q.setInteger("id", id);
result = (Book) q.uniqueResult();
Hibernate.initialize(result.getAuthors());
return result;
}
@SuppressWarnings("unchecked")
public List<Book> findBooksByName(String name) {
Query q = sessionFactory.getCurrentSession().createQuery("from Book where name like :name");
q.setString("name", "%" + name + "%");
return bookInitAuthor((List<Book>) q.list());
}
@SuppressWarnings("unchecked")
public List<Book> getBooksByAuthor(int authorId) {
Query q = sessionFactory.getCurrentSession().createQuery(
"select b from Book b INNER JOIN b.authors author where author.id =:authorId");
q.setInteger("authorId", authorId);
return bookInitAuthor((List<Book>) q.list());
}
}
| [
"pryadkos@mail.ru"
] | pryadkos@mail.ru |
897bfdcc5c2cdff5476bff5deb76513707cb5f4d | 5b947a8ce1a3b20741896615eab7148248b39ce8 | /app/src/main/java/com/example/mujahid/allinall/Fragment/unitTest.java | 20238d2c539deeed793c64851c28b53a935be3af | [] | no_license | ashiquebiniqbal/MyApplication | a8aca25c5a7d37b8c999ddbbbd7462c4a7cb516f | 96ac0bea6bec724d6b1f38e18fdb7867e1072908 | refs/heads/master | 2021-09-03T10:15:55.528162 | 2018-01-08T09:52:55 | 2018-01-08T09:52:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 701 | java | package com.example.mujahid.allinall.Fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.mujahid.allinall.R;
/**
* A simple {@link Fragment} subclass.
*/
public class unitTest extends Fragment {
public unitTest() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_unit_test, container, false);
}
}
| [
"mkhan9047@gmail.com"
] | mkhan9047@gmail.com |
7edf62600a9581212872ee0d812e22aa9cb1e35d | 1a1b0a57048697847deb2da25bc319adaf4557ad | /Conveniencia/src/net/unesc/vendas/classes/Estado.java | 0cc3803e9aa754e8659363b7ec98db0299fa69f5 | [] | no_license | joaopaulowessler/Conveniencia | d42ae95c55d0c187521c4f99c92049781df37689 | 0465e903bc51c5c4fe9d9c9c3e2780537e902f2e | refs/heads/master | 2021-01-18T18:39:10.116517 | 2017-10-29T21:35:22 | 2017-10-29T21:35:22 | 86,867,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 944 | java | package net.unesc.vendas.classes;
public class Estado {
private int estCodigo; //Codigo
private String estNome; //Nome
private String estSigla; //Sigla
public Estado(){
this.estCodigo = 0;
this.estNome = "";
this.estSigla = "";
}
public int getEstCodigo() {
return estCodigo;
}
public void setEstCodigo(int estCodigo) {
this.estCodigo = estCodigo;
}
public String getEstNome() {
return estNome;
}
public void setEstNome(String estNome) {
this.estNome = estNome;
}
public String getEstSigla() {
return estSigla;
}
public void setEstSigla(String estSigla) {
this.estSigla = estSigla;
}
public void cancelarEstado(){
this.estCodigo = 0;
this.estNome = "";
this.estSigla = "";
}
}
| [
"joao_@DESKTOP-IVQTNLA"
] | joao_@DESKTOP-IVQTNLA |
c27eba2706b1107fcd03bcd35710090532c01665 | 2fef45fc4ed2d8459ed1362f90179278c8c18d30 | /第11天-二维数组和异常/代码/day11/src/com/qf/day11/Demo1.java | b0a5c8af0d53d734842d25960375177eeae2ce81 | [] | no_license | 2biaoge/basic-knowledge-note | 3ecfcc08fb095b650d6881e2d1efff9ba0e15308 | 31e2fc45bac4e791107adeebefc4da297c7ac919 | refs/heads/master | 2020-03-19T04:16:36.792835 | 2018-08-20T04:02:29 | 2018-08-20T04:02:29 | 135,812,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,553 | java | package com.qf.day11;
/*
* 二维数组的使用
*/
public class Demo1 {
public static void main(String[] args) {
//1声明二维数组
//1.1第一中方式
int[][] nums;
//1.2第二种方式
int nums2[][];
//2初始化
//2.1静态初始化
int[][] nums3=new int[][]{{2,4},{8,10,12},{1,3,5,7,9}};
//简写(必须一条语句完成,不能分割s)
int[][] nums4={{1,2},{3,4,5},{6,7,8,9}};
//2.2动态初始化
//2.2.1只指定外面的元素个数
int[][] nums5=new int[3][];
nums5[0]=new int[]{2,3};
nums5[1]=new int[]{10,20,30};
nums5[2]=new int[]{100};
//2.2.2二维的长度都指定
int[][] nums6=new int[2][3];
//3访问数组
//3.1打印二维数组的长度
//3.1.1一维数组的长度
System.out.println(nums6.length);
//3.1.2二维数组的长度
System.out.println(nums6[0].length);
System.out.println(nums6[1].length);
//3.2 赋值
//3.2.1使用下标赋值
nums6[0][0]=10;
nums6[0][1]=20;
nums6[0][2]=30;
nums6[1][0]=100;
nums6[1][1]=200;
nums6[1][2]=300;
//3.2.2使用循环赋值
for(int i=0;i<nums6.length;i++){
for(int j=0;j<nums6[i].length;j++){
nums6[i][j]=(int)(Math.random()*100)+1;
}
}
//3.3遍历
for(int i=0;i<nums6.length;i++){
for(int j=0;j<nums6[i].length;j++){
System.out.print(nums6[i][j]+" ");
}
System.out.println();
}
System.out.println("-----------------");
//3.4使用增强for
for(int[] n:nums6){
for(int i:n){
System.out.print(i+" ");
}
System.out.println();
}
}
}
| [
"zhangyupeng1717@163.com"
] | zhangyupeng1717@163.com |
ee0b1bf30b346e7bef6266bd793dd159c7591678 | 4fdd516b658959d142fcbec91f13e65795c791fc | /si-onem2m-src/src/main/_java/net/herit/iot/onem2m/incse/manager/dao/ContainerDAO.java | a9803360d25dc0cd10fd2aa8e22d3277f34ad167 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | syuri1610/SI | ee72657de4ba8370f72358af1201c6dd0cb373c0 | 3679969dfcff04e49b2dc7d328a23278e191c58e | refs/heads/master | 2020-06-24T18:16:27.423179 | 2017-01-31T01:32:58 | 2017-01-31T01:32:58 | 74,628,134 | 1 | 0 | null | 2016-11-24T01:42:20 | 2016-11-24T01:42:20 | null | UTF-8 | Java | false | false | 5,401 | java | package net.herit.iot.onem2m.incse.manager.dao;
import org.bson.Document;
import com.mongodb.BasicDBObject;
import com.mongodb.client.MongoCollection;
import net.herit.iot.message.onem2m.OneM2mRequest.RESULT_CONT;
import net.herit.iot.message.onem2m.OneM2mResponse.RESPONSE_STATUS;
import net.herit.iot.onem2m.core.convertor.ConvertorFactory;
import net.herit.iot.onem2m.core.convertor.JSONConvertor;
import net.herit.iot.onem2m.core.util.OneM2MException;
import net.herit.iot.onem2m.incse.context.OneM2mContext;
import net.herit.iot.onem2m.incse.facility.OneM2mUtil;
import net.herit.iot.onem2m.incse.manager.dao.DAOInterface;
import net.herit.iot.onem2m.incse.manager.dao.ResourceDAO;
import net.herit.iot.onem2m.resource.AccessControlPolicy;
import net.herit.iot.onem2m.resource.AnnounceableResource;
import net.herit.iot.onem2m.resource.Container;
import net.herit.iot.onem2m.resource.ContainerAnnc;
import net.herit.iot.onem2m.resource.Resource;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.result.DeleteResult;
import org.bson.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ContainerDAO extends ResourceDAO implements DAOInterface {
private Logger log = LoggerFactory.getLogger(ContainerDAO.class);
public ContainerDAO(OneM2mContext context) {
super(context);
}
@Override
public String resourceToJson(Resource res) throws OneM2MException {
try {
JSONConvertor<Container> jc = (JSONConvertor<Container>)ConvertorFactory.getJSONConvertor(Container.class, Container.SCHEMA_LOCATION);
return jc.marshal((Container)res);
} catch (Exception e) {
log.debug("Handled exception", e);
throw new OneM2MException(RESPONSE_STATUS.INTERNAL_SERVER_ERROR, "Json generation error:"+res.toString());
}
}
@Override
public void create(Resource resource) throws OneM2MException {
((Container)resource).setCurrentNrOfInstances(0);
((Container)resource).setCurrentByteSize(0);
super.create(resource);
// Container res = (Container)resource;
//
// MongoCollection<Document> collection = context.getDatabaseManager().getCollection(COLLECTION_NAME);
// Document doc = new Document("creator", res.getCreator())
// .append("maxNrOfInstances", res.getMaxNrOfInstances())
// .append("maxByteSize", res.getMaxByteSize())
// .append("maxInstanceAge", res.getMaxInstanceAge().intValue())
// //.append("currentNrOfInstances", res.getCurrentNrOfInstances())
// //.append("currentByteSize", res.getCurrentByteSize())
// .append("currentNrOfInstances", 0)
// .append("currentByteSize", 0)
// .append("locationID", res.getLocationID())
// .append("ontologyRef", res.getOntologyRef());
//
// this.appendAnnounceableAttributes(doc, res);
//
// collection.insertOne(doc);
}
@Override
public void update(Resource resource) throws OneM2MException {
super.update(resource);
}
// @Override
// public Resource retrieveByUri(String uri, RESULT_CONT rc) throws OneM2MException {
//
// return this.retrieve(URI_KEY, uri, new JSONConvertor<Container>(Container.class), rc);
//
// }
//
// @Override
// public Resource retrieveByResId(String id, RESULT_CONT rc) throws OneM2MException {
//
// return this.retrieve("resourceID", id, new JSONConvertor<Container>(Container.class), rc);
//
// }
// public Resource retrieve(String name, String value) throws OneM2MException {
//
// try {
//
// MongoCollection<Document> collection = context.getDatabaseManager().getCollection("resEntity");
// Document doc = collection.find(new BasicDBObject(name, value)).first();
//
// Container res = new Container();
// this.setAnnouncableAttributes((AnnounceableResource)res, doc);
//
// res.setCreator((String)doc.get("creator"));
// res.setMaxNrOfInstances((int)doc.get("maxNrOfInstances"));
// res.setMaxByteSize((int)doc.get("maxByteSize"));
// res.setMaxInstanceAge((int)doc.get("maxInstanceAge"));
// res.setCurrentNrOfInstances((int)doc.get("currentNrOfInstances"));
// res.setCurrentByteSize((int)doc.get("currentByteSize"));
// res.setLocationID((String)doc.get("locationID"));
// res.setOntologyRef((String)doc.get("ontologyRef"));
//
// return res;
//
// } catch (Exception e) {
// log.debug("Handled exception", e);
// throw new OneM2MException(RESPONSE_STATUS.INTERNAL_SERVER_ERROR, "Fail to retrieve Container");
// }
// }
// @Override
// public void deleteByUri(String uri) throws OneM2MException {
//
// String resourceID = (String)this.getAttribute(URI_KEY, uri, RESID_KEY);
//
// deleteDocument(PARENTID_KEY, resourceID);
//
// deleteDocument(URI_KEY, uri);
//
//
// }
//
// @Override
// public void deleteByResId(String resId) throws OneM2MException {
//
// deleteDocument(RESID_KEY, resId);
//
//
// }
@Override
public void delete(String id) throws OneM2MException {
String resourceID = (String)this.getAttribute(OneM2mUtil.isUri(id) ? URI_KEY : RESID_KEY, id, RESID_KEY);
deleteChild(resourceID);
deleteDocument(OneM2mUtil.isUri(id) ? URI_KEY : RESID_KEY, id);
}
@Override
public Resource retrieve(String id, RESULT_CONT rc) throws OneM2MException {
return retrieve(OneM2mUtil.isUri(id) ? URI_KEY : RESID_KEY, id,
(JSONConvertor<Container>)ConvertorFactory.getJSONConvertor(Container.class, Container.SCHEMA_LOCATION), rc);
}
}
| [
"문선호@moon-PC"
] | 문선호@moon-PC |
375981e7cc2f7542069b3bba4a308a7debc0ddb9 | 6b52fb51cccd215bab415c40777f558a1b7761f0 | /Java-Control/VehicleControl/src/SpeichernLaden/SaveLoad.java | 9d989f97ec652f5aa49b05996efadf0f0c7a3d78 | [] | no_license | Glimmlampe/Info3_Rover | 63620634a72e3000e39145d924755ce19483bda2 | 7070e3837dbb42e47a015af190a2cd8282d637f7 | refs/heads/master | 2021-06-11T17:15:21.520983 | 2017-02-10T15:55:04 | 2017-02-10T15:55:04 | 45,462,435 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 405 | java | package SpeichernLaden;
import java.io.File;
import Proto_ZV.Zentralverwaltung;
/**Interface dass die Speichern und lAden Methoden zur Verfügung stellt.
* Gespeichert werden Serialisierte Objekte. in diesem Fall Vektoren
*
* @author Markus Friedrich
*
*/
public interface SaveLoad {
public boolean load( File f, Zentralverwaltung Z );
public boolean save( File f, Zentralverwaltung Z );
}
| [
"glimmlampe82@gmail.com"
] | glimmlampe82@gmail.com |
4dfebeb7f2e247aff8ac071fcc3284ce2b3b30b2 | fe1a2d4b5e75eb5931a38aeb685b4fc35d9da195 | /src/main/java/com/celsoaquino/projectmc/repositories/EnderecoRepository.java | 5c7d878793d39fa35de077904e3e04165be07c54 | [] | no_license | celsoaquino/projectmc | 8ab7c092a853dd0d881fb6ff06bf0903b648ecf3 | 57d293f16cd1b9ac6a16c09234a26317e9a38cb2 | refs/heads/master | 2020-04-20T09:57:47.563601 | 2019-02-03T20:01:48 | 2019-02-03T20:17:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.celsoaquino.projectmc.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.celsoaquino.projectmc.domain.Endereco;;
@Repository
public interface EnderecoRepository extends JpaRepository<Endereco, Integer> {
}
| [
"celso.aquino@ymail.com"
] | celso.aquino@ymail.com |
654bdf74e397de08c5ec8ee3afd7d8b638678164 | 2604bd76e50b3219e9454b5b1f369e347cb3220e | /Minggu 3/wo3/src/Menerapkan_array_dan_conditional_statement/latihan1array.java | 5b0eaf89dc37deaa176ac30c74cad1ecd47f1899 | [] | no_license | AdamHafizhAbdillah/E41200383_AdamHafizhAbdillah | 5d1f518f2d6834d29ca0c5ea02b7ef5ef6913d05 | c6af0f20e6bd489d645a73c89b8d31d2466e14d8 | refs/heads/main | 2023-06-12T03:49:54.262707 | 2021-07-07T12:42:01 | 2021-07-07T12:42:01 | 348,214,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Menerapkan_array_dan_conditional_statement;
/**
*
* @author User
*/
public class latihan1array {
public static void main(String[] args) {
int[] angka = { 3,7,8,1,10,20,35};
System.out.println("Jumlah elemen array angka = " + angka.length);
}
}
| [
"80688249+AdamHafizhAbdillah@users.noreply.github.com"
] | 80688249+AdamHafizhAbdillah@users.noreply.github.com |
de413cde344c8f9d1825857ec3d74794e5338379 | 3916559346d2588093e05cfb3abbc6b84aaa651f | /ModuleEnvironment/src/main/java/com/sire/corelibrary/Lifecycle/DataLife/LiveDataCallAdapter.java | cc4c1ef9c70c58647a38bdf905938cf7b281c6bb | [] | no_license | SireAI/HeFeiLife | 5953044d44d4ff5295330cffb22a7304d54fee63 | 1ec062e75797841b5bfcb488daabba94405c4158 | refs/heads/master | 2021-09-13T09:45:46.274585 | 2017-09-12T01:22:36 | 2017-09-12T01:22:36 | 103,205,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,588 | java |
package com.sire.corelibrary.Lifecycle.DataLife;
import android.arch.lifecycle.LiveData;
import java.lang.reflect.Type;
import java.util.concurrent.atomic.AtomicBoolean;
import retrofit2.Call;
import retrofit2.CallAdapter;
import retrofit2.Callback;
import retrofit2.Response;
/**
* A Retrofit adapterthat converts the Call into a LiveData of ApiResponse.
* @param <R>
*/
public class LiveDataCallAdapter<R> implements CallAdapter<R, LiveData<Response<R>>> {
private final Type responseType;
public LiveDataCallAdapter(Type responseType) {
this.responseType = responseType;
}
@Override
public Type responseType() {
return responseType;
}
@Override
public LiveData<Response<R>> adapt(Call<R> call) {
return new LiveData<Response<R>>() {
AtomicBoolean started = new AtomicBoolean(false);
@Override
protected void onActive() {
super.onActive();
if (started.compareAndSet(false, true)) {
call.enqueue(new Callback<R>() {
@Override
public void onResponse(Call<R> call, Response<R> response) {
postValue(response);
}
@Override
public void onFailure(Call<R> call, Throwable throwable) {
throwable.printStackTrace();
postValue(null);
}
});
}
}
};
}
}
| [
"wangkai@yapingguo.com"
] | wangkai@yapingguo.com |
dd7a2b2358f56feb4035dd63bc7f2507323fb8c3 | 5b23c39e566fb14de58adb7f9ce73eb8bbc20ccf | /starter/src/main/java/org/learn/web/service/ServiceA.java | 3bc7813654a8ffe65ab46937eee5eb1d5d5eeb1c | [] | no_license | percyqq/start | 7511567cd78342815e6f0a75fb88f12e0f0641a1 | 8b130f9aed8e61ebf26b114345317abbbf86fbda | refs/heads/master | 2023-04-08T23:10:46.728600 | 2022-02-07T06:43:06 | 2022-02-07T06:43:06 | 53,254,545 | 2 | 0 | null | 2023-03-08T17:24:12 | 2016-03-06T12:49:16 | Java | UTF-8 | Java | false | false | 704 | java | package org.learn.web.service;
import org.learn.web.dao.Dog;
import org.learn.web.dao.DogDAO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* @description:
* @create: 2020-12-02 11:11
*/
@Service
public class ServiceA {
@Resource
private DogDAO dogDAO;
public Dog get(int id) {
return dogDAO.selectByPrimaryKey(id);
}
@Transactional
public int update(Dog dog) throws Exception {
int update = dogDAO.updateByPrimaryKeySelective(dog);
if (update == 1) {
throw new Exception("update fail ");
}
return update;
}
}
| [
"qingqing.qq@alibaba-inc.com"
] | qingqing.qq@alibaba-inc.com |
0073cb7ccfdd1fc219e9372fd83541b2303c0ae5 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.gamingactivity-GamingActivity/sources/com/facebook/acra/util/InputStreamField.java | f1a676b131f9cb848a028b46c135e4554e1b2e69 | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 857 | java | package com.facebook.acra.util;
import com.facebook.infer.annotation.Nullsafe;
import java.io.InputStream;
@Nullsafe(Nullsafe.Mode.LOCAL)
public class InputStreamField {
private InputStream mInputStream;
private long mLength;
private boolean mSendAsAFile;
private boolean mSendCompressed;
public InputStreamField(InputStream is, boolean compress, boolean file, long length) {
this.mInputStream = is;
this.mSendCompressed = compress;
this.mSendAsAFile = file;
this.mLength = length;
}
public InputStream getInputStream() {
return this.mInputStream;
}
public boolean getSendCompressed() {
return this.mSendCompressed;
}
public boolean getSendAsFile() {
return this.mSendAsAFile;
}
public long getLength() {
return this.mLength;
}
}
| [
"cyuubiapps@gmail.com"
] | cyuubiapps@gmail.com |
3280d053f4e2c003a60929e956cee2bdba39fb44 | eba8bf0575397892dffa7594e36ecb93cf1e7e8c | /clsso/gensrc/com/cl/sso/jalo/GeneratedClssoManager.java | c5a7d239fab0d29e8e10fe32f1abb271bd6ee0bb | [] | no_license | ahimthedream/CLSSO | 4f244f0953e7b62960a19afa54327e43e6ad6d16 | ce05688045593ee5c5a29f1082f41231e729e808 | refs/heads/master | 2021-05-27T01:35:46.388680 | 2013-08-20T16:13:00 | 2013-08-20T16:13:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | /*
* ----------------------------------------------------------------
* --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! ---
* --- Generated at Aug 16, 2013 9:51:32 AM ---
* ----------------------------------------------------------------
*/
package com.cl.sso.jalo;
import com.cl.sso.constants.ClssoConstants;
import de.hybris.platform.jalo.extension.Extension;
/**
* Generated class for type <code>ClssoManager</code>.
*/
@SuppressWarnings({"deprecation","unused","cast","PMD"})
public abstract class GeneratedClssoManager extends Extension
{
@Override
public String getName()
{
return ClssoConstants.EXTENSIONNAME;
}
}
| [
"ahimsian.shanmugalingam@arvatosystems.com"
] | ahimsian.shanmugalingam@arvatosystems.com |
f90af0c7f7330bb0bff4c0919430285c9d58458f | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/Hadoop/422_2.java | ea3fca58d08f8ac9a69e40fd3b2b1c49831374df | [
"MIT"
] | permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,240 | java | //,temp,ChecksumFs.java,127,152,temp,ChecksumFileSystem.java,138,161
//,3
public class xxx {
public ChecksumFSInputChecker(ChecksumFileSystem fs, Path file, int bufferSize)
throws IOException {
super( file, fs.getFileStatus(file).getReplication() );
this.datas = fs.getRawFileSystem().open(file, bufferSize);
this.fs = fs;
Path sumFile = fs.getChecksumFile(file);
try {
int sumBufferSize = fs.getSumBufferSize(fs.getBytesPerSum(), bufferSize);
sums = fs.getRawFileSystem().open(sumFile, sumBufferSize);
byte[] version = new byte[CHECKSUM_VERSION.length];
sums.readFully(version);
if (!Arrays.equals(version, CHECKSUM_VERSION))
throw new IOException("Not a checksum file: "+sumFile);
this.bytesPerSum = sums.readInt();
set(fs.verifyChecksum, DataChecksum.newCrc32(), bytesPerSum, 4);
} catch (FileNotFoundException e) { // quietly ignore
set(fs.verifyChecksum, null, 1, 0);
} catch (IOException e) { // loudly ignore
LOG.warn("Problem opening checksum file: "+ file +
". Ignoring exception: " , e);
set(fs.verifyChecksum, null, 1, 0);
}
}
}; | [
"sgholami@uwaterloo.ca"
] | sgholami@uwaterloo.ca |
7552c9889d6eca1079556b754620d0e2bdb73cd2 | eec81e3c4fe7247100080333f09074650c61f750 | /rest-appendix-odata/rest-appendix-odata-service/src/main/java/com/packtpub/rest/odata/service/ODataDebugCallbackImpl.java | 01278cd1d5559b8c2582294de3601a7a0e04cc0a | [
"MIT"
] | permissive | Wedas/restful-java-web-services-edition2 | 6d67bd75fc3979bb90860914f908998514998139 | f741ce80629ab17cfd5636f26f943300c7f06956 | refs/heads/master | 2021-05-03T17:53:38.617704 | 2015-12-09T14:21:06 | 2015-12-09T14:21:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | /*
* Copyright © 2015 Packt Publishing - All Rights Reserved.
* Unauthorized copying of this file, via any medium is strictly prohibited.
*/
package com.packtpub.rest.odata.service;
import org.apache.olingo.odata2.api.ODataDebugCallback;
/**
* Callback for enabling debugging on OData implmn
* @author Jobinesh
*/
public class ODataDebugCallbackImpl implements ODataDebugCallback {
@Override
public boolean isDebugEnabled() {
boolean isDebug = true;
return isDebug;
}
} | [
"jobinesh@gmail.com"
] | jobinesh@gmail.com |
19014471733b3779254cba6fb2368af12240ab86 | d3656e60e9216c4208c87ff3f3dda5f707a53596 | /src/test/com/topcoder/farm/shared/expression/ExpressionsTest.java | 92d9cf935991816217bb598a792da8ab55c16e23 | [] | no_license | appirio-tech/arena-farm-shared | 0e7f8bc53a69d6f49d732e3762e5683186fa101d | a54394dd1befe36216058cadaa51dd52446fb128 | refs/heads/master | 2023-08-09T17:39:55.441383 | 2014-12-16T21:03:24 | 2014-12-16T21:03:24 | 29,212,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,747 | java | /*
* ExpressionsTest
*
* Created 07/28/2006
*/
package com.topcoder.farm.shared.expression;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import junit.framework.TestCase;
/**
* @author Diego Belfer (mural)
* @version $Id$
*/
public class ExpressionsTest extends TestCase {
private Map data = new HashMap();
private Collection collection = new ArrayList();
private Collection collectionNull = new ArrayList();
private Pattern p1;
private Pattern p3;
public ExpressionsTest() {
collection.add("a");
collection.add("b");
collection.add("c");
collectionNull.add("a");
collectionNull.add("b");
collectionNull.add("c");
collectionNull.add(null);
data.put("set", Boolean.TRUE);
data.put("n1", "1");
data.put("n2", "2");
data.put("la", "a");
data.put("lb", "b");
data.put("null", null);
data.put("collection", collection);
data.put("collectionNull", collectionNull);
p1 = Pattern.compile("1");
p3 = Pattern.compile("3");
data.put("p1",p1);
data.put("p3",p3);
}
/**
* Test equal expression between a property and a given value
*/
public void testEqual() throws Exception {
assertTrue(Expressions.eq("n1", "1").eval(data));
assertTrue(Expressions.eq("null", null).eval(data));
assertFalse(Expressions.eq("n1", "2").eval(data));
assertFalse(Expressions.eq("null", "1").eval(data));
assertFalse(Expressions.eq("n1", null).eval(data));
}
/**
* Test equal expression between two properties
*/
public void testProps() throws Exception {
assertTrue(Expressions.eqProps("n1", "n1").eval(data));
assertTrue(Expressions.eqProps("null", "null").eval(data));
assertFalse(Expressions.eqProps("n1", "n2").eval(data));
assertFalse(Expressions.eqProps("n2", "n1").eval(data));
assertFalse(Expressions.eqProps("null", "n1").eval(data));
assertFalse(Expressions.eqProps("n1", "null").eval(data));
}
/**
* Test compare expression between a property and a given value
*/
public void testCompare() throws Exception {
assertTrue(Expressions.lt("n1", "2").eval(data));
assertTrue(Expressions.gt("n2", "1").eval(data));
assertTrue(Expressions.le("n1", "2").eval(data));
assertTrue(Expressions.ge("n2", "1").eval(data));
assertTrue(Expressions.le("n1", "1").eval(data));
assertTrue(Expressions.ge("n1", "1").eval(data));
assertFalse(Expressions.lt("n2", "1").eval(data));
assertFalse(Expressions.gt("n1", "2").eval(data));
assertFalse(Expressions.le("n2", "1").eval(data));
assertFalse(Expressions.ge("n1", "2").eval(data));
}
/**
* Test compare expression between 2 properties
*/
public void testCompareProps() throws Exception {
assertTrue(Expressions.ltProps("n1", "n2").eval(data));
assertTrue(Expressions.gtProps("n2", "n1").eval(data));
assertTrue(Expressions.leProps("n1", "n2").eval(data));
assertTrue(Expressions.geProps("n2", "n1").eval(data));
assertTrue(Expressions.leProps("n1", "n1").eval(data));
assertTrue(Expressions.geProps("n1", "n1").eval(data));
assertFalse(Expressions.ltProps("n2", "n1").eval(data));
assertFalse(Expressions.gtProps("n1", "n2").eval(data));
assertFalse(Expressions.leProps("n2", "n1").eval(data));
assertFalse(Expressions.geProps("n1", "n2").eval(data));
}
/**
* Test Contains expression between a property and a given value
*/
public void testContains() throws Exception {
assertTrue(Expressions.contains("collection", "a").eval(data));
assertTrue(Expressions.contains("collection", "b").eval(data));
assertTrue(Expressions.contains("collectionNull", null).eval(data));
assertFalse(Expressions.contains("collection", "x").eval(data));
assertFalse(Expressions.contains("collection", null).eval(data));
assertFalse(Expressions.contains("null", "a").eval(data));
assertFalse(Expressions.contains("null", null).eval(data));
}
/**
* Test Contains expression between 2 properties
*/
public void testContainsProps() throws Exception {
assertTrue(Expressions.containsProps("collection", "la").eval(data));
assertTrue(Expressions.containsProps("collection", "lb").eval(data));
assertTrue(Expressions.containsProps("collectionNull", "null").eval(data));
assertFalse(Expressions.containsProps("collection", "n1").eval(data));
assertFalse(Expressions.containsProps("collection", "null").eval(data));
assertFalse(Expressions.containsProps("null", "la").eval(data));
assertFalse(Expressions.containsProps("null", "null").eval(data));
}
/**
* Test In expression between a property and a given collection
*/
public void testIn() throws Exception {
assertTrue(Expressions.in("la", collection).eval(data));
assertTrue(Expressions.in("lb", collection).eval(data));
assertTrue(Expressions.in("null", collectionNull).eval(data));
assertFalse(Expressions.in("n1", collection).eval(data));
assertFalse(Expressions.in("null", collection).eval(data));
assertFalse(Expressions.in("la", null).eval(data));
assertFalse(Expressions.in("null", null).eval(data));
}
/**
* Test In expression between 2 properties
*/
public void testInProps() throws Exception {
assertTrue(Expressions.inProps("la", "collection").eval(data));
assertTrue(Expressions.inProps("lb", "collection").eval(data));
assertTrue(Expressions.inProps("null", "collectionNull").eval(data));
assertFalse(Expressions.inProps("n1", "collection").eval(data));
assertFalse(Expressions.inProps("null", "collection").eval(data));
assertFalse(Expressions.inProps("la", "null").eval(data));
assertFalse(Expressions.inProps("null", "null").eval(data));
}
/**
* Test Matches expression between a property and a given Pattern
*/
public void testMatches() throws Exception {
Pattern p1 = Pattern.compile("1");
Pattern p3 = Pattern.compile("3");
assertTrue(Expressions.matches("n1", p1).eval(data));
assertFalse(Expressions.matches("n2", p1).eval(data));
assertFalse(Expressions.matches("null", p1).eval(data));
assertFalse(Expressions.matches("n1", p3).eval(data));
assertFalse(Expressions.matches("null", null).eval(data));
}
/**
* Test Matches expression between 2 properties
*/
public void testPropsMatches() throws Exception {
assertTrue(Expressions.matchesProps("n1", "p1").eval(data));
assertFalse(Expressions.matchesProps("n2", "p1").eval(data));
assertFalse(Expressions.matchesProps("null", "p1").eval(data));
assertFalse(Expressions.matchesProps("n1", "p3").eval(data));
assertFalse(Expressions.matchesProps("null", "null").eval(data));
}
/**
* Test IsSet expression
*/
public void testIsSet() throws Exception {
assertTrue(Expressions.isSet("n1").eval(data));
assertFalse(Expressions.isSet("n4").eval(data));
assertFalse(Expressions.isSet("null").eval(data));
}
/**
* Test And Expression
*/
public void testAnd() throws Exception {
assertTrue(Expressions.and(trueExp(), trueExp()).eval(data));
assertFalse(Expressions.and(falseExp(), trueExp()).eval(data));
assertFalse(Expressions.and(trueExp(), falseExp()).eval(data));
assertFalse(Expressions.and(falseExp(), falseExp()).eval(data));
}
public void testMultiAnd() throws Exception {
assertTrue(Expressions.and(Expressions.and(trueExp(), trueExp()), trueExp()).eval(data));
assertFalse(Expressions.and(Expressions.and(trueExp(), trueExp()), falseExp()).eval(data));
assertFalse(Expressions.and(Expressions.and(falseExp(), trueExp()), trueExp()).eval(data));
assertTrue(Expressions.and(Expressions.and(trueExp(), trueExp()), Expressions.and(trueExp(), trueExp())).eval(data));
assertTrue(Expressions.and(Expressions.and(trueExp(), trueExp()), Expressions.and(Expressions.and(trueExp(), trueExp()), trueExp())).eval(data));
assertTrue(Expressions.and(Expressions.and(Expressions.and(trueExp(), trueExp()), trueExp()),Expressions.and(trueExp(), trueExp())).eval(data));
}
/**
* Test Or Expression
*/
public void testOr() throws Exception {
assertTrue(Expressions.or(trueExp(), trueExp()).eval(data));
assertTrue(Expressions.or(falseExp(), trueExp()).eval(data));
assertTrue(Expressions.or(trueExp(), falseExp()).eval(data));
assertFalse(Expressions.or(falseExp(), falseExp()).eval(data));
}
/**
* Test Not Expression
*/
public void testNot() throws Exception {
assertTrue(Expressions.not(falseExp()).eval(data));
assertFalse(Expressions.not(trueExp()).eval(data));
}
/**
* @return an expression that evaluates to True
*/
private Expression trueExp() {
return Expressions.eq("n1", "1");
}
/**
* Returns a expression that evaluates to False
*/
private Expression falseExp() {
return Expressions.eq("n1", "2");
}
}
| [
"FireIce@cb5b18d2-80dd-4a81-9b1c-945e1ee644f9"
] | FireIce@cb5b18d2-80dd-4a81-9b1c-945e1ee644f9 |
1a5afe1013fd7087872005078ea29e788f89708b | 8d63c78c63754a0109eaf8929cec3a41d095ab87 | /src/main/java/com/vikki/week8_employee_management_system/controller/EmployeeController.java | 73f7782c473cc046c777c987ab3f345b4f0e36ae | [] | no_license | Vikki-Ezeganya/Employee-Mgt-App | be94841b9e449f4c1f806a5d543c189e62de95c5 | 8d0dbd9296e700847810c462a39b958f29ae5d5f | refs/heads/master | 2023-04-26T08:08:02.653501 | 2021-05-29T02:37:04 | 2021-05-29T02:37:04 | 372,633,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,475 | java | package com.vikki.week8_employee_management_system.controller;
import com.vikki.week8_employee_management_system.model.Employee;
import com.vikki.week8_employee_management_system.repository.EmployeeRepository;
import com.vikki.week8_employee_management_system.service.EmployeeService;
import com.vikki.week8_employee_management_system.service.EmployeeServiceImplementation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping(path = "/home")
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
// display a list of employees
@GetMapping("/view_employee")
public String viewHomePage(Model model) {
Employee employee = new Employee();
model.addAttribute("employee", employee);
model.addAttribute("listEmployees", employeeService.getAllEmployees());
return "index";
}
@GetMapping("/showNewEmployeeForm")
public String showNewEmployeeForm(Model model) {
Employee employee = new Employee();
model.addAttribute("employee", employee);
return "new_employee";
}
@PostMapping("/saveEmployee")
public String saveEmployee(@ModelAttribute("employee") Employee employee) {
Employee employee1 = employeeService.getEmployeeByEmail(employee.getEmail());
System.out.println(employee1);
if(employee1 != null){
employee1.setFirstName(employee.getFirstName());
employee1.setLastName(employee.getLastName());
employee1.setDob(employee.getDob());
employee1.setEmail(employee.getEmail());
employeeService.saveEmployee(employee1);
}
employeeService.saveEmployee(employee);
return "redirect:/home/view_employee";
}
@GetMapping("/showFormForUpdate/{id}")
public String showFormForUpdate(@PathVariable (value = "id") long id, Model model) {
Employee employee = employeeService.getEmployeeById(id);
model.addAttribute("Employee", employee);
return "update_employee";
}
@GetMapping("/deleteEmployee/{id}")
public String deleteEmployee(@PathVariable (value = "id") long id) {
System.out.println("Employee deleted");
this.employeeService.deleteEmployeeById(id);
return "redirect:/home/view_employee";
}
} | [
"mac@macs-MacBook-Pro.local"
] | mac@macs-MacBook-Pro.local |
d21e807fe00466a72c20bd869a5d7c6b0ff72114 | ffaa1ee665879673e727592235f96d2bbc887735 | /resource-server-example/src/main/java/com/example/models/BookResponse.java | 618453346308cc9826f37698c672806a9fe100fe | [] | no_license | lucasvieirasilva/oauth2-spring-example | ffd0b5f94003ad4bdf4500e71531b078e693cab6 | 87d488a8235a448f374860593f44992e3591337e | refs/heads/master | 2021-01-01T20:06:51.230024 | 2017-08-12T20:23:19 | 2017-08-12T20:23:19 | 98,765,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 894 | java | package com.example.models;
import java.util.Date;
public class BookResponse {
private int id;
private String title;
private String author;
private Date publicationDate;
private PublisherResponse publisher;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public PublisherResponse getPublisher() {
return publisher;
}
public void setPublisher(PublisherResponse publisher) {
this.publisher = publisher;
}
public Date getPublicationDate() {
return publicationDate;
}
public void setPublicationDate(Date publicationDate) {
this.publicationDate = publicationDate;
}
}
| [
"lucas.vieira94@outlook.com"
] | lucas.vieira94@outlook.com |
e681b6cc8f345cafe664925f1e8fec14e60847d6 | b67eb1fc7f884561c10d288dfe8ace5d86f3441c | /src/main/java/com/endava/cats/fuzzer/fields/OverflowMapSizeFieldsFuzzer.java | 238d4c83e209420a55110a691ba496d4605d2a67 | [
"Apache-2.0"
] | permissive | Endava/cats | e8373f3532aebde36f5bb97762cddf5f85905f85 | 68ca8007526223570e6a1e52674dd30923d587b4 | refs/heads/master | 2023-09-05T08:43:11.717011 | 2023-08-11T17:39:07 | 2023-08-11T17:39:07 | 252,459,854 | 961 | 67 | Apache-2.0 | 2023-09-12T17:33:04 | 2020-04-02T13:14:39 | Java | UTF-8 | Java | false | false | 2,374 | java | package com.endava.cats.fuzzer.fields;
import com.endava.cats.annotations.FieldFuzzer;
import com.endava.cats.args.ProcessingArguments;
import com.endava.cats.fuzzer.executor.FieldsIteratorExecutor;
import com.endava.cats.fuzzer.fields.base.BaseReplaceFieldsFuzzer;
import com.endava.cats.json.JsonUtils;
import com.endava.cats.model.FuzzingData;
import io.swagger.v3.oas.models.media.Schema;
import jakarta.inject.Singleton;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
@FieldFuzzer
@Singleton
public class OverflowMapSizeFieldsFuzzer extends BaseReplaceFieldsFuzzer {
private final ProcessingArguments processingArguments;
public OverflowMapSizeFieldsFuzzer(FieldsIteratorExecutor ce, ProcessingArguments pa) {
super(ce);
this.processingArguments = pa;
}
@Override
public BaseReplaceFieldsFuzzer.BaseReplaceFieldsContext getContext(FuzzingData data) {
BiFunction<Schema<?>, String, List<String>> fuzzValueProducer = (schema, field) -> {
Object allMapKeys = JsonUtils.getVariableFromJson(data.getPayload(), field + ".keys()");
String firstKey = allMapKeys instanceof String s ? s : ((Set<String>) allMapKeys).iterator().next();
Object firstKeyValue = JsonUtils.getVariableFromJson(data.getPayload(), field + "." + firstKey);
Map<String, Object> finalResult = new HashMap<>();
int arraySize = schema.getMaxProperties() != null ? schema.getMaxProperties() + 10 : processingArguments.getLargeStringsSize();
for (int i = 0; i < arraySize; i++) {
finalResult.put(firstKey + i, firstKeyValue);
}
return List.of(JsonUtils.GSON.toJson(finalResult));
};
return BaseReplaceFieldsFuzzer.BaseReplaceFieldsContext.builder()
.replaceWhat("dictionary/hashmap")
.replaceWith("overflow dictionary/hashmap")
.skipMessage("Fuzzer only runs for dictionaries/hashmaps")
.fieldFilter(field -> data.getRequestPropertyTypes().get(field).getAdditionalProperties() != null
&& !JsonUtils.NOT_SET.equals(JsonUtils.getVariableFromJson(data.getPayload(), field)))
.fuzzValueProducer(fuzzValueProducer)
.build();
}
} | [
"madalin.ilie@endava.com"
] | madalin.ilie@endava.com |
5552010cf2e446aa59ea884aad830c3c48b02e26 | ee7de424b9db9df64956bb409357d3cf9b28e48f | /DesignPattern/src/main/java/com/quiz/arrangement/model/ShoppingCart.java | 95c63f35dd5128b9661963a12207f82d71968a6a | [] | no_license | liuxiangwin/Algorithm | 7075428f13cc0d6d12f78a12bafbc8ad7810163c | 5f579df829cbe049d343c8b4afa1d5e4f2fce8c5 | refs/heads/master | 2020-12-25T17:13:48.665474 | 2016-08-08T10:28:34 | 2016-08-08T10:28:34 | 19,633,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,345 | java | package com.quiz.arrangement.model;
import com.quiz.arrangement.util.NumberUtils;
import java.io.Serializable;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
@Component
@Scope(value="session", proxyMode=ScopedProxyMode.TARGET_CLASS)
@JsonIgnoreProperties(ignoreUnknown=true)
public class ShoppingCart implements Serializable{
private static final long serialVersionUID = -1947132804983588610L;
private List<ShoppingCartLineItem> lineItems;
private double subTotalCost;
public ShoppingCart() {
lineItems = new CopyOnWriteArrayList<ShoppingCartLineItem>();
}
public void addLineItem(ShoppingCartLineItem lineItem) {
if(!lineItems.contains(lineItem)) {
lineItems.add(lineItem);
subTotalCost = NumberUtils.round(subTotalCost + lineItem.calculateTotalPrice());
}
}
public double getSubTotal() {
return subTotalCost;
}
public List<ShoppingCartLineItem> getLineItems() {
return lineItems;
}
public void setLineItems(List<ShoppingCartLineItem> lineItems) {
this.lineItems = lineItems;
}
public void clear() {
subTotalCost = 0.0;
lineItems.clear();
}
}
| [
"liuxiangwin@163.com"
] | liuxiangwin@163.com |
0df18da870827fcff6b3c9588fa63fc40bc760e0 | 9ebd13d2fe7fa14871005d468adb3d4678ee7367 | /src/hl/jsoncrudrest/plugins/CRUDServiceSysOutPlugin.java | c04adcf3a01147af53a47e0261fc5f61442c1d8b | [
"Apache-2.0"
] | permissive | zhiwei55/jsoncrudrest | 4b6731fe14e67d30eb4b74e2cff102de09a761da | 90f634e9052ac4b0c3c5b19194b8f71756ca536f | refs/heads/master | 2021-04-12T09:12:59.956677 | 2018-03-15T04:40:47 | 2018-03-15T04:40:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,030 | java | package hl.jsoncrudrest.plugins;
import java.util.Properties;
import hl.common.http.HttpResp;
import hl.jsoncrud.JsonCrudException;
import hl.jsoncrudrest.restapi.CRUDServiceReq;
import hl.jsoncrudrest.restapi.ICRUDServicePlugin;
public class CRUDServiceSysOutPlugin implements ICRUDServicePlugin {
public CRUDServiceReq preProcess(CRUDServiceReq aCrudReq) {
System.out.println();
System.out.println("[ preProcess ]");
System.out.println("httpMethod="+aCrudReq.getHttpMethod());
System.out.println("inputContentType="+aCrudReq.getInputContentType());
System.out.println("inputContentData="+aCrudReq.getInputContentData());
System.out.println("filters="+aCrudReq.getCrudFilters().toString());
System.out.println("sorting="+String.join(", ", aCrudReq.getCrudSorting()));
System.out.println("returns="+String.join(", ", aCrudReq.getCrudReturns()));
System.out.println("urlPathParam="+aCrudReq.getUrlPathParam());
System.out.println("echoJsonAttrs="+aCrudReq.getEchoJsonAttrs());
System.out.println("pagination=start:"+aCrudReq.getPaginationStartFrom());
System.out.println("pagination=fetchsize:"+aCrudReq.getPaginationFetchSize());
System.out.println("fetchlimit="+aCrudReq.getFetchLimit());
System.out.println();
return aCrudReq;
}
public HttpResp postProcess(CRUDServiceReq aCrudReq, HttpResp aHttpResp) {
System.out.println();
System.out.println("[ postProcess ]");
System.out.println("httpStatus="+aHttpResp.getHttp_status());
System.out.println("httpStatusMsg="+aHttpResp.getHttp_status_message());
System.out.println("contentType="+aHttpResp.getContent_type());
System.out.println("contentData="+aHttpResp.getContent_data());
System.out.println();
return aHttpResp;
}
public HttpResp handleException(CRUDServiceReq aCrudReq, HttpResp aHttpResp, JsonCrudException aException) {
System.out.println();
System.out.println("[ handleException ]");
System.out.println("httpStatus="+aHttpResp.getHttp_status());
System.out.println("httpStatusMsg="+aHttpResp.getHttp_status_message());
System.out.println("contentType="+aHttpResp.getContent_type());
System.out.println("contentData="+aHttpResp.getContent_data());
if(aException!=null)
{
System.out.println("Exception="+aException.getMessage());
Throwable t = aException.getCause();
if(t!=null)
{
System.out.println("Cause="+t.getMessage());
}
StackTraceElement[] stackTraces = aException.getStackTrace();
if(stackTraces!=null)
{
StringBuffer sb = new StringBuffer();
for(int i=0; i<10; i++)
{
StackTraceElement e = stackTraces[i];
sb.append(" ").append(e.getClassName()).append(":").append(e.getLineNumber()).append("\n");
}
System.out.println("StackTrace="+sb.toString());
}
}
else
{
System.out.println("Exception="+aException);
}
System.out.println();
return aHttpResp;
}
public Properties getPluginProps() {
return null;
}
} | [
"onghuilam@gmail.com"
] | onghuilam@gmail.com |
7217d57319e57768cb6b4a763a5cb635e3a20cc7 | 350142ee977772e537c9e264c729695f107c3b61 | /Java Basics Jan 2019/ForLoopExc/src/Histogram.java | 2eaa3283107e1113ca25f0a121e4a4860bd6aab6 | [] | no_license | ivanpetkov219/SoftUni | 76d8994348606191b5f20ebc6827d3d1bb57418f | 2a6457c7523ff92ef96601e4c45dd321ef4505ca | refs/heads/master | 2022-07-01T11:02:03.082977 | 2020-08-01T20:58:54 | 2020-08-01T20:58:54 | 241,832,948 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,272 | java | import java.util.Scanner;
public class Histogram {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
int count1 = 0;
int count2 = 0;
int count3 = 0;
int count4 = 0;
int count5 = 0;
for (int i = 1; i <= n; i++) {
int number = Integer.parseInt(scanner.nextLine());
if (number < 200) {
count1++;
} else if (number < 400) {
count2++;
} else if (number < 600) {
count3++;
} else if (number < 800) {
count4++;
}else if (number >= 800){
count5++;
}
}
double percent1 = count1 * 1.0 / n * 100;
double percent2 = count2 * 1.0 / n * 100;
double percent3 = count3 * 1.0 / n * 100;
double percent4 = count4 * 1.0 / n * 100;
double percent5 = count5 * 1.0 / n * 100;
System.out.printf("%.2f%%%n", percent1);
System.out.printf("%.2f%%%n", percent2);
System.out.printf("%.2f%%%n", percent3);
System.out.printf("%.2f%%%n", percent4);
System.out.printf("%.2f%%%n", percent5);
}
}
| [
"51496032+vankata2001@users.noreply.github.com"
] | 51496032+vankata2001@users.noreply.github.com |
fd97de684d50d91e4b0caadeecea2976ecb1d117 | 9cd5d193f0d521b089a2ef9efd55528c7b361053 | /src/com/cms/controller/ArtController.java | f41dc9b2d818751f9efbfeab200a2a6fbf086fa4 | [] | no_license | SaiferGit/Consumable-Management-System | f8d105eb3d52675d88b4af259b24ed9758a45630 | 4b7b973ea7e6403b39617fea8260afb54c4ff073 | refs/heads/main | 2023-03-31T04:59:14.498707 | 2021-03-28T12:39:00 | 2021-03-28T12:39:00 | 351,960,472 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,607 | java | package com.cms.controller;
import com.cms.model.Art;
import com.cms.view.ArtView;
public class ArtController {
private Art art;
private ArtView artView;
public ArtController(Art art, ArtView artView) {
this.art = art;
this.artView = artView;
}
public String getArtType(){
return art.getType();
}
public String getArtName() {
return art.getName();
}
public String getArtStartingDate() {
if(art.getStartingDate().equals("0")) return "";
return art.getStartingDate();
}
public String getArtEndingDate() {
if(art.getEndingDate().equals("0")) return "";
return art.getEndingDate();
}
public double getArtTotalConsumptionHours() {
return art.getTotalConsumptionHours();
}
public String getArtRating() {
if((int)art.getRating()== 0) return "";
return Double.toString(art.getRating());
}
public int getArtTotalConsumptionDays() {
return art.getTotalConsumptionDays();
}
public void showDetails(){
artView.print(getArtType(), getArtName(), getArtStartingDate(),
getArtEndingDate(), getArtTotalConsumptionHours(),
getArtRating(), getArtTotalConsumptionDays());
}
public void showSpecific(String type){
if(type.equals(getArtType()))
artView.print(getArtType(), getArtName(), getArtStartingDate(),
getArtEndingDate(), getArtTotalConsumptionHours(),
getArtRating(), getArtTotalConsumptionDays());
else return;
}
}
| [
"munshisaif0990@gmail.com"
] | munshisaif0990@gmail.com |
d0a59351e0f17cc474bb5408b4dd96ee5be76395 | 3dd35c0681b374ce31dbb255b87df077387405ff | /generated/com/guidewire/_generated/entity/BOPCostVersionListImpl.java | 5a1e0366f57dac6fcf8267cdfdf21c552fbcbdda | [] | no_license | walisashwini/SBTBackup | 58b635a358e8992339db8f2cc06978326fed1b99 | 4d4de43576ec483bc031f3213389f02a92ad7528 | refs/heads/master | 2023-01-11T09:09:10.205139 | 2020-11-18T12:11:45 | 2020-11-18T12:11:45 | 311,884,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,493 | java | package com.guidewire._generated.entity;
@javax.annotation.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "BOPCost.eti;BOPCost.eix;BOPCost.etx")
@java.lang.SuppressWarnings(value = {"deprecation", "unchecked"})
public class BOPCostVersionListImpl extends com.guidewire.pl.system.entity.proxy.EffDatedVersionListImpl implements entity.windowed.BOPCostVersionList {
public BOPCostVersionListImpl(entity.BOPCost base) {
super(base);
}
public BOPCostVersionListImpl(gw.pl.persistence.core.Bundle bundle, gw.pl.persistence.core.effdate.EffDatedKey effDatedKey) {
super(bundle, effDatedKey);
}
@java.lang.Override
public entity.BOPCost AsOf(java.util.Date date) {
return (entity.BOPCost)getVersionAsOf(date);
}
@java.lang.Override
public java.util.List<? extends entity.BOPTransaction> TransactionsAsOf(java.util.Date date) {
return (java.util.List)getArrayAsOf(entity.BOPCost.TRANSACTIONS_PROP.get(), date);
}
@java.lang.Override
public void addToTransactions(entity.BOPTransaction bean) {
addToArray(entity.BOPCost.TRANSACTIONS_PROP.get(), bean);
}
@java.lang.Override
public java.util.List<? extends entity.BOPCost> getAllVersions() {
return (java.util.List)getAllVersionsUntyped();
}
@java.lang.Override
public java.util.List<? extends entity.windowed.BOPTransactionVersionList> getTransactions() {
return (java.util.List)getArray(entity.BOPCost.TRANSACTIONS_PROP.get());
}
} | [
"ashwini@cruxxtechnologies.com"
] | ashwini@cruxxtechnologies.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.