blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
4b38c06398eb5db9db02552446726cb1f62bcb56
0e62b4edaef27aa2a54158e8652e6a8a1253969c
/day14/src/클래스생성/계산기.java
e702edb0cc2efe5378d70c5cb554b5e07287c497
[]
no_license
2554mj/java_project
09fe3cf39bbb84820ccdd233d2673757a2747d99
fb1b75f5fcc08c5f05369e70810c7a5b49954a59
refs/heads/main
2023-08-31T09:50:45.235489
2021-10-04T07:29:36
2021-10-04T07:29:36
380,983,919
0
0
null
null
null
null
UTF-8
Java
false
false
983
java
package 클래스생성; public class 계산기 { //사칙연산계산기 //여긴 메인이 없어서 f11이 실행되지 않음 public void order(String food) { System.out.println("당신이 주문한 것은 " + food + "입니다."); } public void 더하기(int n1, int n2) { System.out.println("더하기 기능 처리 내용 구현"); int result2 = n1 + n2 ; System.out.println("두 수의 더하기 결과는 " + result2); } public void 빼기() { System.out.println("빼기 기능 처리 내용 구현"); } public void 곱하기(int price, int count) { System.out.println("곱하기 기능 처리 내용 구현"); int result = price * count; System.out.println("두 수의 곱의 결과는 " + result); } public void 나누기(double no1, double no2) { System.out.println("나누기 기능 처리 내용 구현"); double result3 = no1 / no2 ; System.out.println("두 수의 나누기 결과는 " + result3); } }
1710bf43f1ccff0c11f1fe38ea4f4121de1bf4bb
e634177d6b3c3ae3830925ba82625c7d12c20bdf
/springcloud-02-shopping-common/src/main/java/com/springcloud/entity/Class1.java
5b19054fb28bc4907178444518d0ab1e20a5ec79
[]
no_license
qfmx/shopping-admin
40a51e426cc7a54811a5f2ef80a0a624efdfe587
9b3dfbc19f8505e4e2da7f22b8ec66a4e6328fb1
refs/heads/master
2022-06-28T08:23:04.518998
2019-06-28T07:24:17
2019-06-28T07:24:17
192,259,547
1
0
null
2022-06-17T02:16:15
2019-06-17T02:11:49
Java
UTF-8
Java
false
false
707
java
package com.springcloud.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * CLASS1表对应的实体类,用于保存表中一行一级类别信息 * @author Ya * */ @Data @NoArgsConstructor @AllArgsConstructor public class Class1 implements java.io.Serializable{ /** * 序列化编号 */ private static final long serialVersionUID = -5094573667413124189L; /** * 类别一编号 */ private Integer class1Id; /** * 类别一名称 */ private String class1Name; /** * 类别一序号 */ private Integer class1Number; /** * 备注 */ private String remarks; }
cf171dafeacfbc637330e91536fbe387705e4707
472d7820a5f5d9d5ab2ec150eab0c9bdeb2008c7
/Aries/Sodi/dis/disEnumerations/EntityAppearancePlatformPowerPlantStatusField_1.java
871663be0230ac7180c48936a7eae299f0690670
[]
no_license
slacker247/GPDA
1ad5ebe0bea4528d9a3472d3c34580648ffb670e
fa9006d0877a691f1ddffe88799c844a3e8a669a
refs/heads/master
2022-10-08T07:39:09.786313
2020-06-10T22:22:58
2020-06-10T22:22:58
105,063,261
2
0
null
null
null
null
UTF-8
Java
false
false
4,372
java
/* File: EntityAppearancePlatformPowerPlantStatusField.java CVS Info: $Id$ Compiler: jdk 1.2.2 */ package disEnumerations; import mil.navy.nps.dis.*; import mil.navy.nps.util.*; /** * Entity Appearance Platform Power-Plant Status Field -- Describes the power-plant status of a platform *@version 1.1 *@author Ronan Fauglas *@author <a href="mailto:[email protected]?subject=dis-java-vrml: disEnumerations.EntityAppearancePlatformPowerPlantStatusField feedback ">Don Brutzman</a> * *<dt><b>References:</b> *<dd> DIS Data Dictionary: <A href="../../../../../../mil/navy/nps/disEnumerations/JdbeHtmlFiles/pdu/49.htm">Entity Appearance Platform Power-Plant Status Field</A> (local) * <A href="http://SISO.sc.ist.ucf.edu/dis/dis-dd/pdu/49.htm">Entity Appearance Platform Power-Plant Status Field</A> (SISO) *<dd> JDBE:<a href="http://208.145.129.4/jdbe/proj/dis_cd/dis-dd/">DIS Data Dictionary Version 1.0a (DIS-DD)</A> *<dd> Perl script (converting html enumerations to java enumerations) * <A href="../../../../../../mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl"><i>convertJdbeDisEnumerationsToJava.pl</i></A> (local) or * <A href="http://web.3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl"> * <i>http://web.3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl</i></A> *<dd> "Named Constants," <i>The Java Programming Language</i>, Gosling & Arnold. * *<dt><b>Explanation:</b> *<dd>This file has been automatically generated from a local copy of the * <A href="../../../../../../mil/navy/nps/disEnumerations/JdbeHtmlFiles/dis-dd.html">DIS Data Dictionary</A> at * <A href="http://SISO.sc.ist.ucf.edu/dis/dis-dd/">http://SISO.sc.ist.ucf.edu/dis/dis-dd/</A> * html source file by * <A href="../../../../../../mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl">convertJdbeDisEnumerationsToJava.pl</a> (local) or * <A href="http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl">http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl</a>. * <P> * This is effectively a C-style enumeration. Java doesn't do enumerations * like C, so you have to wrap a class around it. It's a bit more typing, * but pretty simple-minded. * Note that the variables are declared public. The default for access * is package-wide, but these variables might need to be accessed from * outside the package. Since all the variables are final (i.e. constant), nobody can * change anything anyway, so this is no biggie.<p> * To use these enumerations in your Java code, import the package first: * <b><PRE>import mil.navy.nps.disEnumerations.*;</PRE></b> * You access this via something like <b><code>EntityAppearancePlatformPowerPlantStatusField.POWERPLANTON</code></b>, i.e. combine * the class name, a period, and a class variable (enumeration) name.<P> * *<dt><b>History:</b> *<dd> 21jan98 /Ronan Fauglas /New *<dd> 30mar99 /Don Brutzman /Revised Javadoc, many more enumeration classes * *<dt><b>Location:</b> *<dd><a href="../../../../../../mil/navy/nps/disEnumerations/EntityAppearancePlatformPowerPlantStatusField.java"><i>EntityAppearancePlatformPowerPlantStatusField.java</i></A> (local) *<dd><a href="http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/EntityAppearancePlatformPowerPlantStatusField.java"> * <i>http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/EntityAppearancePlatformPowerPlantStatusField.java</i></a> * */ public class EntityAppearancePlatformPowerPlantStatusField_1 extends Object { /** *(0) Power Plant Off */ public static final short POWERPLANTOFF = 0; /** *(1) Power Plant On */ public static final short POWERPLANTON = 1; /** * Returns a string containing the enumeration name which corresponds to an enumeration value, * as in <b><code>EntityAppearancePlatformPowerPlantStatusField.toString (0)</code></b> returns the string "<b><code>POWERPLANTOFF</code></b>" */ public static String toString(int idNumber) { switch (idNumber) { case 0: return "Power Plant Off"; case 1: return "Power Plant On"; default : return ""; } }//end of toString }//End of class
4b6ac87f4f849ce705429f37a63d57ef2222141b
46e5b636da0580a6d7eddd10538ce507f30bee6c
/portalpack.portlets.genericportlets/src/main/java/org/netbeans/modules/portalpack/portlets/genericportlets/ddapi/impl/PortletXmlHelper.java
ead4a02f07b6a5dfce959b8135da20e81aa7871d
[ "Apache-2.0" ]
permissive
timboudreau/netbeans-contrib
b96c700768cca0932a0e2350362352352b3b91f6
f1e67dbd0f5c6ae596bd9754b5b1ba22cfe8cb8e
refs/heads/master
2023-01-25T00:36:37.680959
2023-01-06T06:07:09
2023-01-06T06:07:09
141,208,493
4
2
NOASSERTION
2022-09-01T22:50:24
2018-07-17T00:13:23
Java
UTF-8
Java
false
false
21,684
java
/* * The contents of this file are subject to the terms of the Common Development * and Distribution License (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at http://www.netbeans.org/cddl.html * or http://www.netbeans.org/cddl.txt. * * When distributing Covered Code, include this CDDL Header Notice in each file * and include the License file at http://www.netbeans.org/cddl.txt. * If applicable, add the following below the CDDL Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * Portions Copyrighted 2007 Sun Microsystems, Inc. */ package org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.impl; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.FilterMappingType; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.PortletApp; import org.netbeans.modules.portalpack.portlets.genericportlets.node.ddloaders.PortletXMLDataObject; import org.openide.filesystems.FileLock; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Logger; import java.util.logging.Level; import javax.xml.namespace.QName; import org.netbeans.modules.portalpack.portlets.genericportlets.core.util.CoreUtil; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.PortletType; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.PublicRenderParameterType; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.eventing.EventObject; import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; /** * This is a helper class to add/delete/modify portlet xml elements * @author Satyaranjan */ public class PortletXmlHelper { private PortletXMLDataObject dbObj; private static Logger logger = Logger.getLogger(CoreUtil.CORE_LOGGER); public PortletXmlHelper(PortletXMLDataObject pDObj) { this.dbObj = pDObj; } public boolean addFilter(String portletName, String filterName) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addFilter() : PortletXmlHelper"); return false; } FilterMappingType filterMapping = null; FilterMappingType[] filterMappings = portletApp.getFilterMapping(); if(filterMappings == null) { } else { for(FilterMappingType filterMap:filterMappings) { if(filterMap.getFilterName().equals(filterName)) { filterMapping = filterMap; break; } } } if(filterMapping == null) { filterMapping = portletApp.newFilterMappingType(); filterMapping.setFilterName(filterName); portletApp.addFilterMapping(filterMapping); }else{ if(isPortletAlreadyPresentInFilterMapping(filterMapping, portletName)) { NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "PORTLET_FILTER_MAPPING_ALREADY_PRESENT"), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } } filterMapping.addPortletName(portletName); save(); return true; } public boolean removeFilterMapping(String portletName,String filterName) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in removeFilterMapping() : PortletXmlHelper"); return false; } boolean isChanged = false; FilterMappingType[] filterMappings = portletApp.getFilterMapping(); if(filterMappings == null) { return true; } else { for(FilterMappingType filterMap:filterMappings) { if(filterMap.getFilterName().equals(filterName)) { if(isPortletAlreadyPresentInFilterMapping(filterMap, portletName)) { filterMap.removePortletName(portletName); if(filterMap.getPortletName().length == 0) portletApp.removeFilterMapping(filterMap); isChanged = true; } } } } if(isChanged) save(); return true; } public boolean addPublicRenderParameterAsQName(String identifier,QName qname) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addPublicRenderParameterAsQName() : PortletXmlHelper"); return false; } PublicRenderParameterType prType = getPublicRenderParameterForId(identifier); if(prType != null) { Object[] param = {identifier}; NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "MSG_IDENTIFIER_EXISTS",param), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } PublicRenderParameterType publicRenderParameterType = portletApp.newPublicRenderParameterType(); publicRenderParameterType.setIdentifier(identifier); publicRenderParameterType.setQname(qname); /// if(isPublicRenderParamAlreadyExists(publicRenderParameterType, portletApp.getPublicRenderParameter())) /// return true; portletApp.addPublicRenderParameter(publicRenderParameterType); save(); return true; } public boolean addPublicRenderParameterAsName(String identifier,String name) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addPublicRenderParameterAsName() : PortletXmlHelper"); return false; } PublicRenderParameterType prType = getPublicRenderParameterForId(identifier); if(prType != null) { Object[] param = {identifier}; NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "MSG_IDENTIFIER_EXISTS",param), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } PublicRenderParameterType publicRenderParameterType = portletApp.newPublicRenderParameterType(); publicRenderParameterType.setIdentifier(identifier); publicRenderParameterType.setName(name); /// if(isPublicRenderParamAlreadyExists(publicRenderParameterType, portletApp.getPublicRenderParameter())) /// return true; portletApp.addPublicRenderParameter(publicRenderParameterType); save(); return true; } public boolean addSupportedPublicRenderParameter(String portletName,String identifier) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addSupportedPublicRenderParameter() : PortletXmlHelper"); return false; } PortletType portletType = null; PortletType[] portlets = portletApp.getPortlet(); for(PortletType portlet:portlets) { if(portlet.getPortletName().equals(portletName)) { portletType = portlet; break; } } if(portletType == null) { logger.log(Level.WARNING,"No portlet found with name : "+portletName); return false; } String[] params = portletType.getSupportedPublicRenderParameter(); for(String param:params) { if(param.equalsIgnoreCase(identifier)) { NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "SUPPORTED_PUBLIC_RENDER_PARAMETER_ALREADY_PRESENT"), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } } portletType.addSupportedPublicRenderParameter(identifier); save(); return true; } public boolean removeSupportedPublicRenderParameter(String portletName,String identifier) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addFilter() : PortletXmlHelper"); return false; } PortletType portletType = null; PortletType[] portlets = portletApp.getPortlet(); for(PortletType portlet:portlets) { if(portlet.getPortletName().equals(portletName)) { portletType = portlet; break; } } if(portletType == null) { logger.log(Level.WARNING,"No portlet found with name : "+portletName); return false; } portletType.removeSupportedPublicRenderParameter(identifier); if(!isPublicRenderParameterIDIsUsedByAnyPortlet(identifier)) { Object[] params = {identifier}; NotifyDescriptor.Confirmation nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(PortletXmlHelper.class, "MSG_PRP_IS_NOT_USED_WANT_TO_DELETE", params), NotifyDescriptor.YES_NO_OPTION); Object retVal = DialogDisplayer.getDefault().notify(nd); if(retVal == NotifyDescriptor.YES_OPTION) { PublicRenderParameterType paramType = getPublicRenderParameterForId(identifier); portletApp.removePublicRenderParameter(paramType); } } save(); return true; } private boolean isPublicRenderParameterIDIsUsedByAnyPortlet(String identifier) { PortletApp portletApp = getPortletApp(); PortletType[] portlets = portletApp.getPortlet(); for(int i=0;i<portlets.length; i++) { String[] ids = portlets[i].getSupportedPublicRenderParameter(); for(String id:ids) { if(id.equals(identifier)) return true; } } return false; } public List<EventObject> getSupportedPublicRenderParameters(String portletName) { PortletApp portletApp = getPortletApp(); if(portletApp == null) return Collections.EMPTY_LIST; PortletType portlet = getPortlet(portletName); if(portlet == null) return Collections.EMPTY_LIST; List<EventObject> prpObjs = new ArrayList(); String[] sprp = portlet.getSupportedPublicRenderParameter(); for(int i=0;i<sprp.length;i++) { PublicRenderParameterType prp = getPublicRenderParameterForId(sprp[i]); if(prp == null) continue; EventObject evt = new EventObject(); evt.setPublicRenderParamId(sprp[i]); evt.setType(EventObject.PUBLIC_RENDER_PARAMETER_TYPE); if(prp.getQname() != null) evt.setQName(prp.getQname()); else evt.setName(prp.getName()); evt.setDefaultNameSpace(portletApp.getPortletDefaultNamespace()); evt.setAlias(prp.getAlias()); prpObjs.add(evt); } return prpObjs; } //Called by storyboard public EventObject addSupportedPublicRenderParameter(String portletName,EventObject prp) { boolean addPRP = true; PortletApp portletApp = getPortletApp(); if(portletApp == null) return null; String id = prp.getPublicRenderParamId(); PublicRenderParameterType prpType = getPublicRenderParameterForId(id); if(prpType == null) //prp entry needs to be added first { //Check if a render parameter with same name but different Id exists String existingId = getPublicRenderParamIDWithSameValue(prp); if(existingId != null) { Object[] param ={existingId}; NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(PortletXmlHelper.class,"MSG_PRP_WITH_SAME_VALUE_EXIST_FOR_ID",param),NotifyDescriptor.Confirmation.YES_NO_OPTION); Object selectedVal = DialogDisplayer.getDefault().notify(nd); if(selectedVal == NotifyDescriptor.NO_OPTION){ //do nothing }else { id = existingId; addPRP = false; } } if(addPRP){ if(prp.isName()) addPublicRenderParameterAsName(id, prp.getName()); else addPublicRenderParameterAsQName(id, prp.getQName()); } } else { //Check if the name/QName is actually same if(!isEqual(prpType, prp)) { String existingId = getPublicRenderParamIDWithSameValue(prp); if(existingId != null) { Object[] param ={existingId}; NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(PortletXmlHelper.class,"MSG_PRP_WITH_SAME_VALUE_EXIST_FOR_ID",param),NotifyDescriptor.Confirmation.YES_NO_OPTION); Object selectedVal = DialogDisplayer.getDefault().notify(nd); if(selectedVal == NotifyDescriptor.NO_OPTION) id = getAFreeIdentifier(id); else { id = existingId; addPRP = false; } } else { id = getAFreeIdentifier(id); } if(addPRP) { if(prp.isName()) addPublicRenderParameterAsName(id, prp.getName()); else addPublicRenderParameterAsQName(id, prp.getQName()); } } } //crate a new EventObject and return EventObject returnEvent = new EventObject(); returnEvent.setQName(prp.getQName()); returnEvent.setName(prp.getName()); returnEvent.setPublicRenderParamId(id); returnEvent.setType(EventObject.PUBLIC_RENDER_PARAMETER_TYPE); addSupportedPublicRenderParameter(portletName, id); return returnEvent; } private String getAFreeIdentifier(String id) { String identifier = id; PublicRenderParameterType p = getPublicRenderParameterForId(identifier); int i = 0; while(p != null) { i++; identifier = id + i; p = getPublicRenderParameterForId(identifier); } return identifier; } private boolean isEqual(PublicRenderParameterType prp,EventObject evt) { if(evt.isName()) { if(evt.getName().equals(prp.getName())) return true; }else { if(evt.getQName().equals(prp.getQname())) return true; } return false; } private static boolean isPortletAlreadyPresentInFilterMapping(FilterMappingType filterMapping, String portletName) { String[] portlets = filterMapping.getPortletName(); for(String portlet:portlets) { if(portlet.equals(portletName)) return true; } return false; } public PublicRenderParameterType getPublicRenderParameterForId(String id) { PortletApp portletApp = getPortletApp(); PublicRenderParameterType[] prpTypes = portletApp.getPublicRenderParameter(); for(PublicRenderParameterType prp:prpTypes) { if(id.equals(prp.getIdentifier())) return prp; } return null; } private String getPublicRenderParamIDWithSameValue(EventObject evt) { String name = evt.getName(); QName qName = evt.getQName(); if (name == null || name.length() == 0) { name = null; } PublicRenderParameterType[] evts = getPortletApp().getPublicRenderParameter(); for (int i = 0; i < evts.length; i++) { if (qName == null) { String tempName = evts[i].getName(); if (name == null) { continue; } if (name.equals(tempName)) { return evts[i].getIdentifier(); } } else { QName tempQName = evts[i].getQname(); if (qName == null) { continue; } if (qName.equals(tempQName)) { return evts[i].getIdentifier(); } } } return null; } private boolean isPublicRenderParamAlreadyExists(PublicRenderParameterType evt, PublicRenderParameterType[] evts) { String name = evt.getName(); QName qName = evt.getQname(); if (name == null || name.length() == 0) { name = null; } for (int i = 0; i < evts.length; i++) { if (qName == null) { String tempName = evts[i].getName(); if (name == null) { continue; } if (name.equals(tempName)) { return true; } } else { QName tempQName = evts[i].getQname(); if (qName == null) { continue; } if (qName.equals(tempQName)) { return true; } } } return false; } public PortletType getPortlet(String portletName) { PortletApp portletApp = getPortletApp(); if (portletApp == null) { return null; } PortletType[] portlets = portletApp.getPortlet(); if (portlets == null) { return null; } for (int i = 0; i < portlets.length; i++) { if (portlets[i].getPortletName().equals(portletName)) { return portlets[i]; } } return null; } public PortletApp getPortletApp() { try{ return dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return null; } } public void save() { try { PortletApp portletApp = dbObj.getPortletApp(); FileLock lock = dbObj.getPrimaryFile().lock(); OutputStream out = dbObj.getPrimaryFile().getOutputStream(lock); // ((BaseBean)portletApp).write(out); portletApp.write(out); try{ out.flush(); out.close(); }catch(Exception e){ logger.log(Level.SEVERE,"Error",e); } lock.releaseLock(); } catch (IOException ex) { logger.log(Level.SEVERE,"Error",ex); } } }
2db2df83f43921498b83dc395de39e60803a686f
8f4788ac46f7628509478a3dc7099058ae70d07a
/org-netbeans-api-visualfx/src/test/java/test/lod/LevelOfDetailsTest.java
8f33fe15594d42c5cde42bd97bfed407d061fc7f
[]
no_license
theanuradha/visual-library-fx
8cc29d066f06ad4073b5db91b98bca46587c7683
03b40eca1d7e3d57eeda3dc7a59cc2e936d4a942
refs/heads/master
2021-06-24T05:42:44.100965
2020-10-30T11:01:41
2020-10-30T11:01:41
90,547,495
12
1
null
2020-10-30T11:01:42
2017-05-07T16:50:24
Java
UTF-8
Java
false
false
3,637
java
/* * The contents of this file are subject to the terms of the Common Development * and Distribution License (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at http://www.netbeans.org/cddl.html * or http://www.netbeans.org/cddl.txt. * * When distributing Covered Code, include this CDDL Header Notice in each file * and include the License file at http://www.netbeans.org/cddl.txt. * If applicable, add the following below the CDDL Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * The Original Software is NetBeans. The Initial Developer of the Original * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun * Microsystems, Inc. All Rights Reserved. */ package test.lod; import java.awt.Color; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.TwoStateHoverProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.border.BorderFactory; import org.netbeans.api.visual.layout.LayoutFactory; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.LevelOfDetailsWidget; import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; import test.SceneSupport; /** * @author David Kaspar */ public class LevelOfDetailsTest { public static void main(String[] args) { Scene scene = new Scene(); scene.setZoomFactor(0.2); scene.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, 0)); scene.getActions().addAction(ActionFactory.createZoomAction(1.1, false)); scene.getActions().addAction(ActionFactory.createPanAction()); WidgetAction hover = ActionFactory.createHoverAction(new TwoStateHoverProvider() { public void setHovering(Widget widget) { widget.setOpaque(true); widget.setBackground(Color.GREEN); } public void unsetHovering(Widget widget) { widget.setOpaque(false); widget.setBackground(Color.WHITE); } }); scene.getActions().addAction(hover); scene.addChild(createLabel(scene, "Use mouse-wheel for zooming, use middle button for panning.", 72)); scene.addChild(createLabel(scene, "For more details zoom into the rectangle below.", 72)); Widget root = new LevelOfDetailsWidget(scene, 0.21, 0.3, Double.MAX_VALUE, Double.MAX_VALUE); root.setBorder(BorderFactory.createLineBorder(10)); root.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 4)); scene.addChild(root); for (int a = 0; a < 10; a++) { root.addChild(createLabel(scene, "Row: " + a, 36)); Widget row = new LevelOfDetailsWidget(scene, 0.3, 0.5, Double.MAX_VALUE, Double.MAX_VALUE); row.setBorder(BorderFactory.createLineBorder(4)); row.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 4)); row.getActions().addAction(hover); root.addChild(row); for (int b = 0; b < 20; b++) { Widget item = new LevelOfDetailsWidget(scene, 0.5, 1.0, Double.MAX_VALUE, Double.MAX_VALUE); item.setBorder(BorderFactory.createLineBorder(2)); item.addChild(createLabel(scene, "Item-" + a + "," + b, 18)); item.getActions().addAction(hover); row.addChild(item); } } SceneSupport.show(scene); } private static Widget createLabel(Scene scene, String text, int size) { LabelWidget label = new LabelWidget(scene, text); label.setFont(scene.getDefaultFont().deriveFont((float) size)); return label; } }
801e63ccf3894f7fcf2b2c4f4dae591d23dd72c8
1547cb466b4888e5ab7c70020f3f3bac66cb7d0b
/target/.generated/com/google/gwt/editor/client/adapters/TakesValueEditor_com_puglieseweb_test_trms_shared_domain_TaxiOptions_RequestFactoryEditorDelegate.java
f643690d220dda5ac0bc23af0127cc82ffaa28ff
[]
no_license
puglieseweb/TaxiRankMS
2a1b3c10fcc20b6f268eb7fd769e6b09618ad77c
d0c64fb2a141e3170bc713d7045c2c3aa2179252
refs/heads/master
2020-04-10T11:55:35.279594
2011-03-15T13:14:58
2011-03-15T13:14:58
1,482,697
0
0
null
null
null
null
UTF-8
Java
false
false
1,373
java
package com.google.gwt.editor.client.adapters; public class TakesValueEditor_com_puglieseweb_test_trms_shared_domain_TaxiOptions_RequestFactoryEditorDelegate extends com.google.gwt.requestfactory.client.impl.RequestFactoryEditorDelegate { private com.google.gwt.editor.client.adapters.TakesValueEditor editor; protected com.google.gwt.editor.client.adapters.TakesValueEditor getEditor() {return editor;} protected void setEditor(com.google.gwt.editor.client.Editor editor) {this.editor=(com.google.gwt.editor.client.adapters.TakesValueEditor)editor;} private com.puglieseweb.test.trms.shared.domain.TaxiOptions object; public com.puglieseweb.test.trms.shared.domain.TaxiOptions getObject() {return object;} protected void setObject(Object object) {this.object=(com.puglieseweb.test.trms.shared.domain.TaxiOptions)object;} protected void attachSubEditors(com.google.gwt.editor.client.impl.DelegateMap delegateMap) { } protected void flushSubEditors(java.util.List errorAccumulator) { } protected void flushSubEditorErrors(java.util.List errorAccumulator) { } protected void refreshEditors() { } protected void traverse(java.util.List paths) { traverseEditor(getEditor(), "", paths); } public static void traverseEditor(com.google.gwt.editor.client.adapters.TakesValueEditor editor, String prefix, java.util.List<String> paths) { } }
0baa072ee47ab7b92215007a2195576d9cf467f7
f578d80a43fc03d5328b14cf69d067263f06722d
/src/DAO/dao.java
b5c02261b100c6607dd7640652ad09f7c98e6731
[]
no_license
AnggaraAng/Library-App
fe540ad02a92661af3cf7b1342466a24a1c919dd
7d15114fd4a82ed5db79f8dc1a7acb2e1d129f6f
refs/heads/master
2022-10-17T03:29:20.757234
2020-06-19T06:34:42
2020-06-19T06:34:42
273,422,028
0
0
null
null
null
null
UTF-8
Java
false
false
5,536
java
package DAO; import ENTITAS.entitas; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class dao { private Connection conn = null; public dao(Connection con) { this.conn = con; } public List<entitas> getUser() { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM usser"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setUser(rs.getString(1)); t.setPass(rs.getString(2)); get.add(t); } } catch (Exception e) { } return get; } public List<entitas> getPegawai() { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM pegawai"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setPegawai(rs.getString(1)); t.setPas(rs.getString(2)); get.add(t); } } catch (Exception e) { } return get; } public boolean inputdata(entitas t) { PreparedStatement ps; try { ps = conn.prepareStatement("INSERT INTO perpus_new (isbn,judul,kategori,nama_pengarang,nama_penerbit,tahun_terbit) " + "VALUES(?,?,?,?,?,?)"); ps.setString(1, t.getIsbn()); ps.setString(2, t.getJudul()); ps.setString(3, t.getKategori()); ps.setString(4, t.getNama_pengarang()); ps.setString(5, t.getNama_penerbit()); ps.setString(6, t.getTahun_terbit()); if (ps.executeUpdate() > 0) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; } public boolean inputuser(entitas t) { PreparedStatement ps; try { ps = conn.prepareStatement("INSERT INTO usser (user,pass) " + "VALUES(?,?)"); ps.setString(1, t.getUser()); ps.setString(2, t.getPass()); if (ps.executeUpdate() > 0) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; } public List<entitas> getall() { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM perpus_new"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setIsbn(rs.getString(1)); t.setJudul(rs.getString(2)); t.setKategori(rs.getString(3)); t.setNama_pengarang(rs.getString(4)); t.setNama_penerbit(rs.getString(5)); t.setTahun_terbit(rs.getString(6)); get.add(t); } } catch (Exception e) { } return get; } public List<entitas> CariBuku(String judul) { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM perpus_new WHERE judul LIKE '%" + judul + "%' OR nama_pengarang LIKE '%" + judul + "%' OR nama_penerbit LIKE '%" + judul + "%' OR tahun_terbit LIKE '%" + judul + "%'"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setIsbn(rs.getString(1)); t.setJudul(rs.getString(2)); t.setKategori(rs.getString(3)); t.setNama_pengarang(rs.getString(4)); t.setNama_penerbit(rs.getString(5)); t.setTahun_terbit(rs.getString(6)); get.add(t); } } catch (Exception e) { } return get; } public String hapus(String isbn) { String hasil = "Tidak Berhasil dihapus"; String query = "DELETE FROM perpus_new WHERE isbn='" + isbn + "'"; Statement st; try { st = conn.createStatement(); if (st.executeUpdate(query) > 0) { hasil = "Berhasil dihapus"; } } catch (Exception e) { } return hasil; } public String Perbarui(String isbn, String judul, String kategori, String nama_pengarang, String nama_penerbit, String tahun_terbit) { String hasil = "Tidak Berhasil diperbarui"; String sql = "UPDATE perpus_new SET isbn='" + isbn + "',judul='" + judul + "',kategori='" + kategori + "'" + ",nama_pengarang = '" + nama_pengarang + "',nama_penerbit = '" + nama_penerbit + "',tahun_terbit = '" + tahun_terbit + "' WHERE isbn = '" + isbn + "'"; Statement st; try { st = conn.createStatement(); if (st.executeUpdate(sql) > 0) { hasil = "Berhasil diupdate"; } } catch (Exception e) { } return hasil; } }
b4f2f1cab9a04ee766fed247bedc5f2f7f7ceb34
560268487348149621b6c44f67ad0652276cf5fb
/src/java/billservlet/.svn/text-base/Err.java.svn-base
e0d2e109b30e663c2d6a659a9bf50df1ac126de1
[]
no_license
ruchijindal/OnlineDMS
8e2bdf577d75eecfc231f2cb426d6d20b84deb60
0965e9dbcb4a0cf10d13bf0c29790b8a1071dd46
refs/heads/master
2021-01-18T17:25:41.579283
2013-05-19T12:14:19
2013-05-19T12:14:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,989
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package billservlet; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Element; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import com.smp.jal.ConvertToDate; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import javax.naming.InitialContext; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.sql.DataSource; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.NodeList; /** * * @author smp */ public class Err extends HttpServlet { public class MyPdf implements Runnable { Connection con; String sector; String sec; String cons_no; PreparedStatement ps; ResultSet rs; java.sql.Date billdate; String bdate = null; ConvertToDate ctd; java.sql.Date calbilldate; Calendar dt = Calendar.getInstance(); String cons_nm1; String con_tp; String cons_ctg; String flat_type; String plot_size; String pipe_size; String conn_dt; String nodue_dt; int totcons = -1; Object o; String division; ArrayList<ArrayList> alsec = new <ArrayList>ArrayList(); ArrayList al = new ArrayList(); ; ArrayList alrow; int i = 0; int rows; public Thread t; int p = 0; float p1 = 0; int j = 0; DocumentBuilderFactory dbf = null; DocumentBuilder db = null; org.w3c.dom.Document doc = null; NodeList nl = null; String xmlpath = null; ServletContext context = null; String div = null; MyPdf(java.sql.Date billdate, String sec1) { calbilldate = billdate; sec = sec1; t = new Thread(this); al = new ArrayList<ArrayList>(); alrow = new ArrayList(); t.start(); } public void run() { try { dbf = DocumentBuilderFactory.newInstance(); db = dbf.newDocumentBuilder(); context = getServletContext(); xmlpath = context.getRealPath("") + "/resources/jalutilXML/" + "jal.xml"; // get path on the server doc = db.parse(xmlpath); InitialContext initialContext = new InitialContext(); DataSource dataSource = (DataSource) initialContext.lookup("OnlineJal"); con = dataSource.getConnection(); //con = DBConnection1.dbConnection(xmlpath); NodeList nl1 = doc.getElementsByTagName("division"); div = nl1.item(0).getFirstChild().getNodeValue().trim(); division = "JAL" + div; NodeList nl2 = doc.getElementsByTagName("master_tab"); //sector="MASTER_"+division; sector = nl2.item(0).getFirstChild().getNodeValue().trim(); String sql1 = "select COUNT(DISTINCT CONS_NO) from " + sector + " where trim(sector)='" + sec + "' and CONS_NO is not null and (CONS_NM1 is null or CON_TP is null or CONS_CTG is null or FLAT_TYPE is null or (FLAT_TYPE='PLOT'and PLOT_SIZE is null) or PIPE_SIZE is null or CONN_DT is null " + "or ((to_char(CAL_DATE,'YYYY-MM-DD')>='" + billdate + "' and NODUE_DT IS NULL) or (NODUE_DT IS NOT NULL and to_char(NODUE_DT,'YYYY-MM-DD')>='" + billdate + "'))) order by cons_no"; ps = con.prepareStatement(sql1); rs = ps.executeQuery(); if (rs.next()) { totcons = rs.getInt(1); } String sql = "select cons_no,cons_nm1,con_tp,cons_ctg,flat_type,plot_size,pipe_size,conn_dt,nodue_dt from " + sector + " where trim(sector)='" + sec + "' and CONS_NO is not null and (CONS_NM1 is null or CON_TP is null or CONS_CTG is null or FLAT_TYPE is null or (FLAT_TYPE='PLOT'and PLOT_SIZE is null) or PIPE_SIZE is null or CONN_DT is null " + "or ((to_char(CAL_DATE,'YYYY-MM-DD')>='" + billdate + "' and NODUE_DT IS NULL) or (NODUE_DT IS NOT NULL and to_char(NODUE_DT,'YYYY-MM-DD')>='" + billdate + "'))) order by cons_no"; ps = con.prepareStatement(sql); rs = ps.executeQuery(); while (rs.next()) { p++; cons_no = rs.getString(1); cons_nm1 = rs.getString(2); con_tp = rs.getString(3); cons_ctg = rs.getString(4); flat_type = rs.getString(5); plot_size = rs.getString(6); pipe_size = rs.getString(7); conn_dt = rs.getString(8); nodue_dt = rs.getString(9); al.add(0, cons_no); al.add(1, cons_nm1); al.add(2, con_tp); al.add(3, cons_ctg); al.add(4, flat_type); al.add(5, plot_size); al.add(6, pipe_size); al.add(7, conn_dt); al.add(8, nodue_dt); alsec.add(new ArrayList(al)); al.clear(); } rs.close(); con.commit(); con.close(); // if (!con.isClosed()) { // con.close(); // } } catch (Exception ex) { System.out.println("Exception in Err:" + ex); } //p=totcons; } public ArrayList<ArrayList> calAl() { return alsec; } public int getPercentage() { return p; } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String cons_no; String sec = null; Calendar calbilldate = Calendar.getInstance(); java.sql.Date billdate = null; String bdate = null; ConvertToDate ctd; String strbill_date = null; ArrayList<ArrayList> alsec; int i = 0; int totcons = 0; Object o; HttpSession session = request.getSession(true); //System.out.print("Inside doGet()"); MyPdf pdf; try { ctd = new ConvertToDate(); sec = request.getParameter("sec"); bdate = request.getParameter("billdate"); if (bdate.equals("")) { billdate = null; calbilldate = null; } else { calbilldate.setTimeInMillis(ctd.convertStringToCLDate(bdate).getTimeInMillis()); billdate = new java.sql.Date(calbilldate.getTimeInMillis()); } i++; o = session.getAttribute("myPdf"); if (o == null) { pdf = new MyPdf(billdate, sec); session.setAttribute("myPdf", pdf); //Thread t = new Thread(pdf); //t.start(); } else { pdf = (MyPdf) o; } response.setContentType("text/html"); switch (pdf.getPercentage()) { case -1: isError(response.getOutputStream()); return; default: totcons = pdf.totcons; if (pdf.getPercentage() == totcons) { alsec = pdf.calAl(); session.removeAttribute("myPdf"); isFinished(response.getOutputStream(), strbill_date, sec, alsec); System.out.println("Error List Generated-----------------------------"); return; } isBusy(pdf, response.getOutputStream()); return; } } catch (Exception ex) { System.out.println(ex); } } private void isBusy(MyPdf pdf, ServletOutputStream stream) throws IOException { stream.print("<html><head><title>Please wait...</title><meta http-equiv=\"Refresh\" content=\"5\">" + "<link rel=\"stylesheet\" type=\"text/css\" href=\"resources/css/style.css\" />" + "<div id=\"login\"><div id=\"login-wrapper\" class=\"png_bg\"><div id=\"login-top\">" + "<img alt=\"DMS-JAL\" src=\"resources/images/logo.png\"/><div id=\"profile-links\">" + "<a href=\"jsppages/common/logout.jsp\" title=\"Sign Out\">Sign Out</a>&nbsp;|&nbsp;" + "<a href=\"/DMS/RedirectToCP?page=Err\" title=\"Sign Out\"> Change Password</a> </div> </div></div></div></head>" + "<body> <div id=\"body-wrapper\"> "); stream.print(" <div id=\"main-content\"> <div class=\"content-box\"><div class=\"content-box-header\"></div><div class=\"content-box-content \">"); stream.print("Please Wait while this page refreshes automatically (every 5 seconds)</div></div></div><div id=\"footer\">" + "<p>&copy; 2009 <a href=\"http//www.smptechnologies.org\">SMP Technologies Pvt. Ltd.</a></p></div></div></body>\n</html>"); } private void isFinished(ServletOutputStream stream, String bill_date, String sec, ArrayList<ArrayList> al) throws IOException { stream.print("<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"resources/css/style.css\" />" + "<div id=\"login\"><div id=\"login-wrapper\" class=\"png_bg\"><div id=\"login-top\">" + "<a href=\"jsppages/Search/search.jsp\"><img alt=\"DMS-JAL\" src=\"resources/images/logo.png\"/></a><div id=\"profile-links\">" + "<a href=\"jsppages/common/logout.jsp\" title=\"Sign Out\">Sign Out</a>&nbsp;|&nbsp;" + "<a href=\"jsppages/common/ch_pass.jsp\" title=\"Sign Out\"> Change Password</a> </div> </div></div></div></head>" + "<body> <div id=\"body-wrapper\">"); stream.print(" <div id=\"main-content\"> <div class=\"content-box\"><div class=\"content-box-header\"></div><div class=\"content-box-content \">" + " <div class=\"notification information png_bg\"><a href=\"#\" class=\"close\">" + "<img src=\"resources/images/icons/cross_grey_small.png\" title=\"Close this notification\" alt=\"close\" /></a><div>" + "The document is finished:&nbsp;&nbsp;&nbsp;&nbsp;</div></div><form method=\"POST\">" + "<input type=\"hidden\" name=\"al\" value=\"" + al + "\">" + "<input type=\"hidden\" name=\"sec\" value=\"" + sec + "\"><input type=\"hidden\" name=\"billdate\" value=\"" + bill_date + "\">" + "<input type=\"Submit\" class=\"button\" value=\"Get PDF\"> <a href=\"jsppages/duprecords/error_list.jsp\"><input type=\"button\" class=\"button\" value=\"Back\"></a></form></div></div></div><div id=\"footer\"><small>" + "<p >Copyright &copy; 2009 Developed for JAL by <a href=\"http://smptechnologies.org/\">SMP Technologies Pvt Ltd</a></p></small></div></div></body>\n</html>"); } private void isError(ServletOutputStream stream) throws IOException { stream.print("<html>\n\t<head>\n\t\t<title>Error</title>\n\t</head>\n\t<body>"); stream.print("An error occured.\n\t</body>\n</html>"); } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DocumentException { //Connection con; String sector; String sec; String cons_no; PreparedStatement ps; ResultSet rs; java.sql.Date billdate; String bdate = null; ConvertToDate ctd; Calendar calbilldate = Calendar.getInstance(); Calendar dt = Calendar.getInstance(); String cons_nm1; String con_tp; String cons_ctg; String flat_type; String plot_size; String pipe_size; String conn_dt; String nodue_dt; int totcons = 0; Object o; String division; ArrayList<ArrayList> alsec = new <ArrayList>ArrayList(); ArrayList alr1; ArrayList al = new ArrayList(); ArrayList alrow; int i = 0; int rows; ByteArrayOutputStream baos; SimpleDateFormat formatter; java.util.Date utilconn_dt = null; java.util.Date utilnodue_dt = null; String alist = request.getParameter("al"); alr1 = new ArrayList(); alsec = new ArrayList<ArrayList>(); alist = alist.substring(alist.indexOf("[") + 1, alist.lastIndexOf("]")); String[] aliststr = alist.split("]"); for (int l = 0; l < aliststr.length; l++) { String[] alstr = aliststr[l].split(","); for (int m = 0; m < alstr.length; m++) { if (m == 0 && l == 0) { alr1.add(alstr[m].substring(1)); } else if (m == 1 && l != 0) { alr1.add(alstr[m].substring(2)); } else if (m != 0) { alr1.add(alstr[m]); } } alsec.add(new ArrayList(alr1)); alr1.clear(); } rows = alsec.size(); sector = (String) request.getParameter("sec"); response.setHeader("Content-Disposition", "attachment;filename=" + "ErrorList.pdf"); //response.setContentType("application/pdf"); Rectangle pageSize = new Rectangle(720, 864); Document document = new Document(pageSize); try { //PdfWriter.getInstance(document,new FileOutputStream("C:/DEFAULTER"+sector+".pdf") ); baos = new ByteArrayOutputStream(); PdfWriter docWriter = null; docWriter = PdfWriter.getInstance(document, baos); //document.setPageSize(PageSize.ARCH_B); document.open(); float[] widths1 = {2f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f}; PdfPTable table = new PdfPTable(widths1); table.getDefaultCell().setBorder(PdfPCell.NO_BORDER); PdfPCell cell = new PdfPCell(new Paragraph("NEW OKHLA INDUSTRIAL DEVELOPMENT AUTHORITY")); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(9); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(30.0f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Error list of consumers for Sector-" + sector)); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(6); cell.setHorizontalAlignment(Element.ALIGN_MIDDLE); cell.setPaddingBottom(10.0f); table.addCell(cell); cell = new PdfPCell(new Paragraph()); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(6); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPaddingBottom(10.0f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Consumer Name")); cell.setBorder(Rectangle.BOTTOM); table.addCell(cell); cell = new PdfPCell(new Paragraph("Consumer Number")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Connection Type")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Connection Category")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Flat Type")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Plot size")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Pipe size")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Connection Date")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("No Due Date")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); for (int k = 0; k < rows; k++) { alrow = (ArrayList) alsec.get(k); cons_no = (String) alrow.get(0); if (cons_no.trim().equals("null")) { cons_no = " "; } cons_nm1 = (String) alrow.get(1); if (cons_nm1.trim().equals("null")) { cons_nm1 = " "; } con_tp = (String) alrow.get(2); if (con_tp.trim().equals("null")) { con_tp = " "; } cons_ctg = (String) alrow.get(3); if (cons_ctg.trim().equals("null")) { cons_ctg = " "; } flat_type = (String) alrow.get(4); if (flat_type.trim().equals("null")) { flat_type = " "; } plot_size = (String) alrow.get(5); if (plot_size.trim().equals("null")) { plot_size = " "; } pipe_size = (String) alrow.get(6); if (pipe_size.trim().equals("null")) { pipe_size = " "; } conn_dt = (String) alrow.get(7); if (conn_dt.trim().equals("null")) { conn_dt = " "; } else { try { formatter = new SimpleDateFormat("yyyy-MM-dd"); utilconn_dt = (java.util.Date) formatter.parse(conn_dt); } catch (ParseException e) { System.out.println("Exception:" + e); } formatter = new SimpleDateFormat("dd-MMM-yy"); conn_dt = formatter.format(new java.sql.Date(utilconn_dt.getTime())); } nodue_dt = (String) alrow.get(8); if (nodue_dt.trim().equals("null")) { nodue_dt = " "; } else { try { formatter = new SimpleDateFormat("yyyy-MM-dd"); utilnodue_dt = (java.util.Date) formatter.parse(nodue_dt); } catch (ParseException e) { System.out.println("Exception:" + e); } formatter = new SimpleDateFormat("dd-MMM-yy"); nodue_dt = formatter.format(new java.sql.Date(utilnodue_dt.getTime())); } cell = new PdfPCell(new Paragraph(cons_nm1)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); //table.addCell (cons_no); cell = new PdfPCell(new Paragraph(cons_no)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); // table.addCell (address); cell = new PdfPCell(new Paragraph(con_tp)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(cons_ctg)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(flat_type)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(plot_size)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); // table.addCell (Double.toString(interest)); cell = new PdfPCell(new Paragraph(pipe_size)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(conn_dt)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(nodue_dt)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } table.setWidthPercentage(100); table.setHorizontalAlignment(Element.ALIGN_CENTER); document.add(table); document.newPage(); document.add(new Paragraph(" ")); document.close(); docWriter.close(); response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "public"); response.setContentType("application/pdf"); response.setContentLength(baos.size()); //System.out.println("ByteArrayOutputStream size"+baos.size()); ServletOutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); } catch (Exception e) { e.printStackTrace(); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); HttpSession session = request.getSession(false); session.removeAttribute("myPdf"); } catch (DocumentException e) { e.printStackTrace(); } } }
96da45eb029d9bd2dddf0592cd601c9d285134cf
c0dd3ad8a2bda1b8e070d00a15006584e82730bb
/Web-Automation/src/com/sgtesting/testscripts/Assign7.java
abec1f54201b3ab22cfc9e03e60227503163ee25
[]
no_license
RAKESHSHARMAJ/TestAutomation
59d147d59ab82aa69ba29977601c5e95416d15a8
c169a9adb1312926932505be3bdfbbbcedc2d6d5
refs/heads/master
2023-08-25T20:00:37.481851
2021-11-05T16:59:50
2021-11-05T16:59:50
425,008,059
0
0
null
null
null
null
UTF-8
Java
false
false
5,672
java
package com.sgtesting.testscripts; import java.time.Duration; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Assign7 { public static WebDriver oBrowser=null; public static void main(String[] args) { launchBrowser(); navigate(); login(); minimizeFlyoutWindow(); CreateCustomer(); createProject(); createTask(); deleteTask(); deleteProject(); deleteCustomer(); logout(); closeApplication(); } static void launchBrowser() { try { System.setProperty("webdriver.chrome.driver", "D:\\Exampleautomation\\Automation\\Web-Automation\\Library\\Drivers\\chromedriver.exe"); oBrowser=new ChromeDriver(); }catch(Exception e) { e.printStackTrace(); } } static void navigate() { try { oBrowser.navigate().to("http://localhost/login.do"); oBrowser.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(60)); }catch(Exception e) { e.printStackTrace(); } } static void login() { try { oBrowser.findElement(By.id("username")).sendKeys("admin"); oBrowser.findElement(By.name("pwd")).sendKeys("manager"); oBrowser.findElement(By.xpath("//*[@id=\"loginButton\"]/div")).click(); Thread.sleep(3000); }catch (Exception e) { e.printStackTrace(); } } static void minimizeFlyoutWindow() { try { oBrowser.findElement(By.id("gettingStartedShortcutsPanelId")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void CreateCustomer() { try { oBrowser.findElement(By.xpath("//*[@id=\"topnav\"]/tbody/tr/td[3]/a/div[1]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"cpTreeBlock\"]/div[2]/div[1]/div[2]/div/div[3]")).click(); Thread.sleep(3000); oBrowser.findElement(By.xpath("/html/body/div[14]/div[1]")).click(); Thread.sleep(2000); oBrowser.findElement(By.id("customerLightBox_nameField")).sendKeys("bbbb"); oBrowser.findElement(By.xpath("//*[@id=\"customerLightBox_commitBtn\"]/div/span")).click(); Thread.sleep(5000); }catch(Exception e) { e.printStackTrace(); } } static void createProject() { try { oBrowser.findElement(By.xpath("//*[@id=\"cpTreeBlock\"]/div[2]/div[1]/div[2]/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("/html/body/div[14]/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.id("projectPopup_projectNameField")).sendKeys("ttt"); oBrowser.findElement(By.xpath("//*[@id=\"projectPopup_commitBtn\"]/div/span")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void createTask() { try { oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[1]/div[1]/div[3]/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("/html/body/div[13]/div[1]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"createTasksPopup_createTasksTableContainer\"]/table/tbody/tr[1]/td[1]/input")).sendKeys("ccc"); oBrowser.findElement(By.xpath("//*[@id=\"createTasksPopup_commitBtn\"]/div/span")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void deleteTask() { try { oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[1]/div[2]/div[1]/table[1]/tbody/tr/td[2]/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[3]/div[1]/div[2]/div[3]/div/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[3]/div[4]/div/div[3]/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskPanel_deleteConfirm_submitTitle\"]")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void deleteProject() { try { oBrowser.findElement(By.xpath ("//*[@id=\"cpTreeBlock\"]/div[2]/div[2]/div/div[2]/div/div[1]/div[2]/div[3]/div[3]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[4]/div[1]/div[2]/div[3]/div/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[4]/div[4]/div/div[3]/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"projectPanel_deleteConfirm_submitTitle\"]")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void deleteCustomer() { try { oBrowser.findElement(By.xpath("//*[@id=\"cpTreeBlock\"]/div[2]/div[2]/div/div[2]/div/div[1]/div[2]/div[2]/div[4]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[2]/div[1]/div[4]/div/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[2]/div[4]/div/div[3]/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"customerPanel_deleteConfirm_submitBtn\"]/div")).click(); Thread.sleep(5000); }catch(Exception e) { e.printStackTrace(); } } static void logout() { try { oBrowser.findElement(By.id("logoutLink")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void closeApplication() { try { oBrowser.quit(); }catch(Exception e) { e.printStackTrace(); } } }
b39dc7f709083264645a493529467de107307dbe
6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386
/google/cloud/metastore/v1/google-cloud-metastore-v1-java/proto-google-cloud-metastore-v1-java/src/main/java/com/google/cloud/metastore/v1/DeleteBackupRequest.java
529c39e248a1ef3eaf2b2b281cc4630339c93b66
[ "Apache-2.0" ]
permissive
oltoco/googleapis-gen
bf40cfad61b4217aca07068bd4922a86e3bbd2d5
00ca50bdde80906d6f62314ef4f7630b8cdb6e15
refs/heads/master
2023-07-17T22:11:47.848185
2021-08-29T20:39:47
2021-08-29T20:39:47
null
0
0
null
null
null
null
UTF-8
Java
false
true
30,534
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/metastore/v1/metastore.proto package com.google.cloud.metastore.v1; /** * <pre> * Request message for [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. * </pre> * * Protobuf type {@code google.cloud.metastore.v1.DeleteBackupRequest} */ public final class DeleteBackupRequest extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.metastore.v1.DeleteBackupRequest) DeleteBackupRequestOrBuilder { private static final long serialVersionUID = 0L; // Use DeleteBackupRequest.newBuilder() to construct. private DeleteBackupRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private DeleteBackupRequest() { name_ = ""; requestId_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new DeleteBackupRequest(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private DeleteBackupRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { java.lang.String s = input.readStringRequireUtf8(); name_ = s; break; } case 18: { java.lang.String s = input.readStringRequireUtf8(); requestId_ = s; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.metastore.v1.DeleteBackupRequest.class, com.google.cloud.metastore.v1.DeleteBackupRequest.Builder.class); } public static final int NAME_FIELD_NUMBER = 1; private volatile java.lang.Object name_; /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The name. */ @java.lang.Override public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); name_ = s; return s; } } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The bytes for name. */ @java.lang.Override public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int REQUEST_ID_FIELD_NUMBER = 2; private volatile java.lang.Object requestId_; /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The requestId. */ @java.lang.Override public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The bytes for requestId. */ @java.lang.Override public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (!getRequestIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, requestId_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (!getRequestIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, requestId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.metastore.v1.DeleteBackupRequest)) { return super.equals(obj); } com.google.cloud.metastore.v1.DeleteBackupRequest other = (com.google.cloud.metastore.v1.DeleteBackupRequest) obj; if (!getName() .equals(other.getName())) return false; if (!getRequestId() .equals(other.getRequestId())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER; hash = (53 * hash) + getRequestId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.cloud.metastore.v1.DeleteBackupRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * Request message for [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. * </pre> * * Protobuf type {@code google.cloud.metastore.v1.DeleteBackupRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.metastore.v1.DeleteBackupRequest) com.google.cloud.metastore.v1.DeleteBackupRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.metastore.v1.DeleteBackupRequest.class, com.google.cloud.metastore.v1.DeleteBackupRequest.Builder.class); } // Construct using com.google.cloud.metastore.v1.DeleteBackupRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); name_ = ""; requestId_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_descriptor; } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest getDefaultInstanceForType() { return com.google.cloud.metastore.v1.DeleteBackupRequest.getDefaultInstance(); } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest build() { com.google.cloud.metastore.v1.DeleteBackupRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest buildPartial() { com.google.cloud.metastore.v1.DeleteBackupRequest result = new com.google.cloud.metastore.v1.DeleteBackupRequest(this); result.name_ = name_; result.requestId_ = requestId_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.metastore.v1.DeleteBackupRequest) { return mergeFrom((com.google.cloud.metastore.v1.DeleteBackupRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.metastore.v1.DeleteBackupRequest other) { if (other == com.google.cloud.metastore.v1.DeleteBackupRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getRequestId().isEmpty()) { requestId_ = other.requestId_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.metastore.v1.DeleteBackupRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.metastore.v1.DeleteBackupRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private java.lang.Object name_ = ""; /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); name_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @param value The name to set. * @return This builder for chaining. */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } name_ = value; onChanged(); return this; } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return This builder for chaining. */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @param value The bytes for name to set. * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); name_ = value; onChanged(); return this; } private java.lang.Object requestId_ = ""; /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The requestId. */ public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The bytes for requestId. */ public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @param value The requestId to set. * @return This builder for chaining. */ public Builder setRequestId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } requestId_ = value; onChanged(); return this; } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return This builder for chaining. */ public Builder clearRequestId() { requestId_ = getDefaultInstance().getRequestId(); onChanged(); return this; } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @param value The bytes for requestId to set. * @return This builder for chaining. */ public Builder setRequestIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); requestId_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.metastore.v1.DeleteBackupRequest) } // @@protoc_insertion_point(class_scope:google.cloud.metastore.v1.DeleteBackupRequest) private static final com.google.cloud.metastore.v1.DeleteBackupRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.metastore.v1.DeleteBackupRequest(); } public static com.google.cloud.metastore.v1.DeleteBackupRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<DeleteBackupRequest> PARSER = new com.google.protobuf.AbstractParser<DeleteBackupRequest>() { @java.lang.Override public DeleteBackupRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new DeleteBackupRequest(input, extensionRegistry); } }; public static com.google.protobuf.Parser<DeleteBackupRequest> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<DeleteBackupRequest> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
26b9a78f84f26520e0c40462b4cf7ad85bd28cf0
84745d0ad0fdeb70957eacf45c84271c20ebecdc
/HashMapsAndHeaps/FindUniqueElement.java
e90a87c0775fdbfb06efdf92ceda13b19a8efe7d
[]
no_license
AnandKshitij/Java-Codes
1f6c39c882161c360ce9bb5e149311fd4b23696b
f5ca324efd01d214e45c3646c8e878ec7eab99b7
refs/heads/main
2023-01-07T04:51:07.031104
2020-11-05T10:05:01
2020-11-05T10:05:01
310,256,830
0
0
null
null
null
null
UTF-8
Java
false
false
1,227
java
package HashMapsAndHeaps; /* 1. You will be given an Array and its length. 2. You will also be given k, the number of times each element repeats in that array, except ONE element. 3. You need to find that ONE unique element, which does not repeat and return it 4. Input and output is handled for you 5. It is a functional problem ,please do not modify main() Sample Input 7 2 2 8 2 9 0 9 0 Sample Output 8 */ import java.util.*; import java.lang.*; import java.io.*; public class FindUniqueElement { public static void main (String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int input[] = new int [n]; for(int i=0; i<n; i++) { input[i] = s.nextInt(); } solve(input,k); } public static void solve(int [] arr,int k) { HashMap<Integer,Integer> H = new HashMap<>(); for(int i=0; i<arr.length; i++) { int val = arr[i]; if(!H.containsKey(val)) { H.put(val,1); } else { H.put(val,H.get(val)+1); } } for(int i : H.keySet()) { if(H.get(i)==1) { System.out.println(i); } } } }
5876e2f75dd3307322fa93b0f7352ff20836b43e
f6df9ef80940c3c51688f924cb3d0a6697a88aa6
/JavaProgrammingSpring2019/src/PracticeForAll/Apple.java
270673088ac474c11d16cc52abfc5de3deb5b2ce
[]
no_license
habibisrafilov/java_programming-Spring-2019
7441ba321eeb9abb99afd244561eb8510ceb86f5
79a05275e96f0b6afe9543b88f3e7c76b31de632
refs/heads/master
2020-05-31T20:20:23.099790
2019-06-05T21:52:52
2019-06-05T21:52:52
190,473,456
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package PracticeForAll; public class Apple extends Shopping { public String shopping(String item , int price) { String word = item; int number = price; return word+" "+number; } }
6440318cac9f2c8a51128ca9fd9abeda3d15fdc4
7c58036ce3281636a98ca0c2c449985498e40cfc
/Serialize/Person.java
12bb8a73f1db7284230fe3950d9ef04a7bee27cf
[]
no_license
SweeneyWEI/Test
150e33a18f530243754001bf5e92d2b460080c5d
0a6cfd485d38e5706af8871ef54e317e0270ad95
refs/heads/master
2021-01-20T12:16:21.456365
2017-10-07T12:49:03
2017-10-07T12:49:03
101,706,342
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package org.Test.Serialize; import java.io.Serializable; /** * Created by weixin on 17-7-30. */ public class Person implements Serializable{ private String name; private String sex; private int age; private int Snumber; public int getSnumber() { return Snumber; } public void setSnumber(int snumber) { Snumber = snumber; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
9d9647e85ef93e16c4fd58901d9a8f6e28910f95
a9f5b738e2f61019ff13d4c854a1b7b2acf0dc90
/test6/src/main/java/test1/DetailController.java
03a8d8887fd33a0a18a2c0279983209f2e167008
[]
no_license
Duy-Phuong/SPRING-MVC
7ba5f18cef2d4c759f21b58a6695f8875f513ee2
6cc2fe39bf26c2df33734a6ec3a9ccd1a34ccd13
refs/heads/master
2020-03-09T08:36:11.470753
2018-05-17T02:00:50
2018-05-17T02:00:50
128,693,083
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
package test1; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import entity.NhanVien; @Controller @RequestMapping("/chitiet") public class DetailController { @GetMapping public String Default() { return "chitiet"; } ///phai SD cai nay: viet k dau @PostMapping public String Display(@ModelAttribute NhanVien nv, ModelMap modelmap) { modelmap.addAttribute("nv", nv); return "chitiet"; } }
c1d4eaf9a389e1c18032c94e4d7bc510fca032cd
5dc459ebd5fa612e9c5c8cefdc470eabb77d5641
/src/main/java/com/sforce/soap/partner/fault/ObjectFactory.java
06a792929d43125955351248eeccddfe5ff361eb
[]
no_license
jsuarez-chipiron/audit-trail-extractor
65e043fe6e420aab5fa3c2786d74c21b6e68b218
ff62b5e1da0189e19d016a0598d2bb10f8d31566
refs/heads/master
2021-01-22T03:40:32.930145
2017-05-25T10:54:05
2017-05-25T10:54:05
92,394,046
2
0
null
null
null
null
UTF-8
Java
false
false
8,658
java
package com.sforce.soap.partner.fault; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the com.sforce.soap.partner.fault package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { private final static QName _UnexpectedErrorFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"); private final static QName _Fault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "fault"); private final static QName _LoginFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "LoginFault"); private final static QName _InvalidQueryLocatorFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"); private final static QName _InvalidNewPasswordFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault"); private final static QName _InvalidSObjectFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"); private final static QName _MalformedQueryFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"); private final static QName _InvalidIdFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"); private final static QName _InvalidFieldFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"); private final static QName _MalformedSearchFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sforce.soap.partner.fault * */ public ObjectFactory() { } /** * Create an instance of {@link InvalidSObjectFault } * */ public InvalidSObjectFault createInvalidSObjectFault() { return new InvalidSObjectFault(); } /** * Create an instance of {@link MalformedQueryFault } * */ public MalformedQueryFault createMalformedQueryFault() { return new MalformedQueryFault(); } /** * Create an instance of {@link InvalidIdFault } * */ public InvalidIdFault createInvalidIdFault() { return new InvalidIdFault(); } /** * Create an instance of {@link MalformedSearchFault } * */ public MalformedSearchFault createMalformedSearchFault() { return new MalformedSearchFault(); } /** * Create an instance of {@link InvalidFieldFault } * */ public InvalidFieldFault createInvalidFieldFault() { return new InvalidFieldFault(); } /** * Create an instance of {@link UnexpectedErrorFault } * */ public UnexpectedErrorFault createUnexpectedErrorFault() { return new UnexpectedErrorFault(); } /** * Create an instance of {@link ApiFault } * */ public ApiFault createApiFault() { return new ApiFault(); } /** * Create an instance of {@link InvalidQueryLocatorFault } * */ public InvalidQueryLocatorFault createInvalidQueryLocatorFault() { return new InvalidQueryLocatorFault(); } /** * Create an instance of {@link LoginFault } * */ public LoginFault createLoginFault() { return new LoginFault(); } /** * Create an instance of {@link InvalidNewPasswordFault } * */ public InvalidNewPasswordFault createInvalidNewPasswordFault() { return new InvalidNewPasswordFault(); } /** * Create an instance of {@link ApiQueryFault } * */ public ApiQueryFault createApiQueryFault() { return new ApiQueryFault(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link UnexpectedErrorFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "UnexpectedErrorFault") public JAXBElement<UnexpectedErrorFault> createUnexpectedErrorFault(UnexpectedErrorFault value) { return new JAXBElement<UnexpectedErrorFault>(_UnexpectedErrorFault_QNAME, UnexpectedErrorFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link ApiFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "fault") public JAXBElement<ApiFault> createFault(ApiFault value) { return new JAXBElement<ApiFault>(_Fault_QNAME, ApiFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link LoginFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "LoginFault") public JAXBElement<LoginFault> createLoginFault(LoginFault value) { return new JAXBElement<LoginFault>(_LoginFault_QNAME, LoginFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidQueryLocatorFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidQueryLocatorFault") public JAXBElement<InvalidQueryLocatorFault> createInvalidQueryLocatorFault(InvalidQueryLocatorFault value) { return new JAXBElement<InvalidQueryLocatorFault>(_InvalidQueryLocatorFault_QNAME, InvalidQueryLocatorFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidNewPasswordFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidNewPasswordFault") public JAXBElement<InvalidNewPasswordFault> createInvalidNewPasswordFault(InvalidNewPasswordFault value) { return new JAXBElement<InvalidNewPasswordFault>(_InvalidNewPasswordFault_QNAME, InvalidNewPasswordFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidSObjectFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidSObjectFault") public JAXBElement<InvalidSObjectFault> createInvalidSObjectFault(InvalidSObjectFault value) { return new JAXBElement<InvalidSObjectFault>(_InvalidSObjectFault_QNAME, InvalidSObjectFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link MalformedQueryFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "MalformedQueryFault") public JAXBElement<MalformedQueryFault> createMalformedQueryFault(MalformedQueryFault value) { return new JAXBElement<MalformedQueryFault>(_MalformedQueryFault_QNAME, MalformedQueryFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidIdFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidIdFault") public JAXBElement<InvalidIdFault> createInvalidIdFault(InvalidIdFault value) { return new JAXBElement<InvalidIdFault>(_InvalidIdFault_QNAME, InvalidIdFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidFieldFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidFieldFault") public JAXBElement<InvalidFieldFault> createInvalidFieldFault(InvalidFieldFault value) { return new JAXBElement<InvalidFieldFault>(_InvalidFieldFault_QNAME, InvalidFieldFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link MalformedSearchFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "MalformedSearchFault") public JAXBElement<MalformedSearchFault> createMalformedSearchFault(MalformedSearchFault value) { return new JAXBElement<MalformedSearchFault>(_MalformedSearchFault_QNAME, MalformedSearchFault.class, null, value); } }
536bb02a1dae21bc76fa8c7ca0ae1e4f6df9054f
ec3c9056ab5e1c8697a996a7fb57baed3a090bfb
/e3-item-web/target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/jsp/commons/header_jsp.java
ec7b81a97236f0451b2c862a6bcb0761ebe9370c
[]
no_license
lhsjohn/e3mall
7192c682aeff983425361b4cf8068103f2d5f6cb
2582c5abecf11b4e0445c39d33bbb8d871ec3015
refs/heads/master
2020-03-27T04:29:46.579862
2018-08-24T05:58:45
2018-08-24T05:58:45
145,945,218
1
0
null
null
null
null
UTF-8
Java
false
false
6,599
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.47 * Generated at: 2018-08-23 07:42:02 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.WEB_002dINF.jsp.commons; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class header_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("<!--shortcut start-->\r\n"); org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "shortcut.jsp", out, false); out.write("\r\n"); out.write("<!--shortcut end-->\r\n"); out.write("<div id=\"header\">\r\n"); out.write(" <div class=\"header_inner\">\r\n"); out.write(" <div class=\"logo\">\r\n"); out.write("\t\t\t<a name=\"sfbest_hp_hp_head_logo\" href=\"http://www.e3mall.cn\" class=\"trackref logoleft\">\r\n"); out.write("\t\t</a>\r\n"); out.write("\t\t\t<div class=\"logo-text\">\r\n"); out.write("\t\t\t\t<img src=\"/images/html/logo_word.jpg\">\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t</div>\r\n"); out.write(" <div class=\"index_promo\"></div>\r\n"); out.write(" <div class=\"search\">\r\n"); out.write(" <form action=\"/productlist/search\" id=\"searchForm\" name=\"query\" method=\"GET\">\r\n"); out.write(" <input type=\"hidden\" name=\"inputBox\" value=\"1\"><input type=\"hidden\" name=\"categoryId\" value=\"0\">\r\n"); out.write(" <input type=\"text\" class=\"text keyword ac_input\" name=\"keyword\" id=\"keyword\" value=\"\" style=\"color: rgb(153, 153, 153);\" onkeydown=\"javascript:if(event.keyCode==13) search_keys('searchForm');\" autocomplete=\"off\">\r\n"); out.write(" <input type=\"button\" value=\"\" class=\"submit\" onclick=\"search_keys('searchForm')\">\r\n"); out.write(" </form>\r\n"); out.write(" <div class=\"search_hot\"><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E5%A4%A7%E9%97%B8%E8%9F%B9#trackref=sfbest_hp_hp_head_Keywords1\">大闸蟹</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%9F%B3%E6%A6%B4#trackref=sfbest_hp_hp_head_Keywords2\">石榴</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E6%9D%BE%E8%8C%B8#trackref=sfbest_hp_hp_head_Keywords3\">松茸</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%89%9B%E6%8E%92#trackref=sfbest_hp_hp_head_Keywords4\">牛排</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%99%BD%E8%99%BE#trackref=sfbest_hp_hp_head_Keywords5\">白虾</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E5%85%A8%E8%84%82%E7%89%9B%E5%A5%B6#trackref=sfbest_hp_hp_head_Keywords6\">全脂牛奶</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E6%B4%8B%E6%B2%B3#trackref=sfbest_hp_hp_head_Keywords7\">洋河</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%BB%BF%E8%B1%86#trackref=sfbest_hp_hp_head_Keywords8\">绿豆</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E4%B8%80%E5%93%81%E7%8E%89#trackref=sfbest_hp_hp_head_Keywords9\">一品玉</a></div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"shopingcar\" id=\"topCart\">\r\n"); out.write(" <s class=\"setCart\"></s><a href=\"http://cart.e3mall.cn\" class=\"t\" rel=\"nofollow\">我的购物车</a><b id=\"cartNum\">0</b>\r\n"); out.write(" <span class=\"outline\"></span>\r\n"); out.write(" <span class=\"blank\"></span>\r\n"); out.write(" <div id=\"cart_lists\">\r\n"); out.write(" <!--cartContent--> \r\n"); out.write(" <div class=\"clear\"></div>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write("</div>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
1771ecd210e9feb1b21e37b8d472d1e2d595445b
47d0c52d8a73baf2271ec281160c575293821506
/Uebung3_2/src/uebung3_1/Server.java
bc4b1b4b2f55118e416f8370a3da53c1e5c14695
[]
no_license
xchrx/VS2018
54631d4071d4fc5342ea11e67e94cf144b80ef18
e5c57e81cc1213547f75d36f58a6aed64ead4c6f
refs/heads/master
2020-03-19T10:02:00.146512
2018-06-20T15:21:56
2018-06-20T15:21:56
136,337,506
0
0
null
null
null
null
UTF-8
Java
false
false
1,330
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 uebung3_1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Chris */ public class Server { /** * @param args the command line arguments */ public static void main(String[] args) { ExecutorService es = Executors.newFixedThreadPool(10); try { ServerSocket servSocket = new ServerSocket(8080); System.out.println("Wartet auf Verbindung"); while(true) { Socket s = servSocket.accept(); System.out.println("Neue Verbindung"); es.execute(new Requesthandler(s)); } } catch (IOException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); } } }
7b98757aa51e148248f959d83bf2838d43ff9fee
21ed1fb22cabc0c69d463e0acfaec3dc4ec7c180
/src/test/java/com/desilva/record/DayRangeRecordCustomCollectorTest.java
fed346240cfc06f819d8daba9fb467cb74eb40bd
[]
no_license
stevedesilva/addressBook
1f2f6b9d1115478e6d8305a087d3abb3d49a7fd4
47105ad27cf39525242bae3a64f774aeb8908f40
refs/heads/master
2021-01-18T18:01:10.298187
2017-03-31T16:15:32
2017-03-31T16:15:32
86,836,660
0
0
null
null
null
null
UTF-8
Java
false
false
6,120
java
package com.desilva.record; import org.junit.Test; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collector; import static com.desilva.record.DayRangeRecordCustomCollector.*; import static com.desilva.record.DayRangeRecordCustomCollector.AgeBoundary.*; import static com.desilva.record.DayRangeRecordCustomCollector.AgeBoundary.OLDER; import static com.desilva.record.DayRangeRecordCustomCollector.AgeBoundary.YOUNGER; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; /** * Created by stevedesilva. */ public class DayRangeRecordCustomCollectorTest { final private Record olderRecord = new Record("Older, Male, 01/01/80"); final private Record youngerRecord = new Record("Younger, Male, 01/01/81"); @Test public void dayRangeRecordCustomCollectorCollectorConstructor_WhenCreated_ShouldNotBeNull() { assertNotNull(new DayRangeRecordCustomCollectorTest()); } @Test public void calculateDifferenceInDaysBetweenBirthDates_GivenYoungerAndOlder_ShouldReturnDiff(){ Map collector = createDayRangeCustomCollector("Older, Male, 01/01/80", "Younger, Male, 01/01/81"); long value = new DayRangeRecordCustomCollector("Younger","Older").calculateDifferenceInDaysBetweenBirthDates(collector); assertEquals(366L, value); } @Test public void calculateDifferenceInDaysBetweenBirthDates_WhenGivenIncorrectOrder_ShouldReorderAndCalculateDiff(){ Map collector = createDayRangeCustomCollector("Younger, Male, 01/01/81","Older, Male, 01/01/80"); long value = new DayRangeRecordCustomCollector("Younger","Older").calculateDifferenceInDaysBetweenBirthDates(collector); assertEquals(366L, value); } private Map createDayRangeCustomCollector(String olderRow, String youngerRow) { Map collector = new HashMap<AgeBoundary,Record>(); Record olderRecord = new Record(olderRow); Record youngerRecord = new Record(youngerRow); collector.put(OLDER, olderRecord); collector.put(YOUNGER, youngerRecord); return collector; } @Test public void supplier_WhenCalled_ShouldReturnSupplierFunc() throws Exception { Supplier<Map<AgeBoundary, Record>> value = new DayRangeRecordCustomCollector("Younger","Older").supplier(); assertNotNull(value); } @Test public void accumulator_WhenCalled_ShouldReturnBiConsumer() throws Exception { BiConsumer<Map<AgeBoundary, Record>, Record> accumulator = new DayRangeRecordCustomCollector("Younger","Older").accumulator(); assertNotNull(accumulator); } @Test public void updateCollectorWithYoungOldRecord_WhenMatchOlderRecord_ShouldAddToOlderMap() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap = new HashMap<AgeBoundary,Record>(); customCollector.updateCollectorWithYoungOldRecord(accumulatorMap, olderRecord); assertEquals(olderRecord,accumulatorMap.get(OLDER)); } @Test public void updateCollectorWithYoungOldRecord_WhenMatchingOlderRecord_ShouldAddToYoungerMap() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap = new HashMap<AgeBoundary,Record>(); customCollector.updateCollectorWithYoungOldRecord(accumulatorMap, youngerRecord); assertEquals(youngerRecord,accumulatorMap.get(YOUNGER)); } @Test public void updateCollectorWithYoungOldRecord_WhenNoMatchFound_ShouldNotAddToMap() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap = new HashMap<AgeBoundary,Record>(); customCollector.updateCollectorWithYoungOldRecord(accumulatorMap, new Record("Not Matching, Male, 01/01/81")); assertEquals(null,accumulatorMap.get(OLDER)); assertEquals(null,accumulatorMap.get(YOUNGER)); } @Test public void combiner_WhenJoiningMaps_ShouldUpdateMap1IfEmptyAndMap2HasARecord() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap1 = new HashMap<AgeBoundary,Record>(); Map accumulatorMap2 = new HashMap<AgeBoundary,Record>(); accumulatorMap2.put(YOUNGER,youngerRecord); accumulatorMap2.put(OLDER,olderRecord); customCollector.combineAgeBoundaryRecordMaps(accumulatorMap1,accumulatorMap2); assertEquals(youngerRecord, accumulatorMap1.get(YOUNGER)); assertEquals(olderRecord, accumulatorMap1.get(OLDER)); } @Test public void combiner_WhenJoiningMaps_ShouldNotUpdateMap1IfAlreadyContainsRecord() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap1 = new HashMap<AgeBoundary,Record>(); Map accumulatorMap2 = new HashMap<AgeBoundary,Record>(); accumulatorMap1.put(YOUNGER,youngerRecord); accumulatorMap1.put(OLDER,olderRecord); customCollector.combineAgeBoundaryRecordMaps(accumulatorMap1,accumulatorMap2); assertEquals(youngerRecord, accumulatorMap1.get(YOUNGER)); assertEquals(olderRecord, accumulatorMap1.get(OLDER)); } @Test public void finisher_WhenCalled_ShouldReturnBiConsumer() throws Exception { Function<Map<AgeBoundary, Record>, Long> finisher = new DayRangeRecordCustomCollector("Younger","Older").finisher(); assertNotNull(finisher); } @Test public void characteristics_WhenCalled_ShouldReturnBiConsumer() throws Exception { Set<Collector.Characteristics> characteristics = new DayRangeRecordCustomCollector("Younger","Older").characteristics(); assertNotNull(characteristics); } }
945953aa988e3470b14a78766c2512d318febe9d
cd4052964b0cecd0439ceae60f76db3bd05b0587
/Task 3/Additional tasks/Task6.java
25f00ec052358ab0fc1342e8f82751e046908e78
[]
no_license
olia0303/JAVA-Test-Automation
f9c9604ba3d018570418229407bd957423783dd3
02ae11991fa3ecb76586e510c780617a7f8a2c14
refs/heads/master
2020-04-19T05:54:42.420720
2019-03-30T19:47:02
2019-03-30T19:49:59
168,002,640
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
894
java
package start; import java.util.Scanner; public class Task6 { public static void main(String[] args) { // пройти по массиву и поменять местами каждые 2 соседних элемента System.out.print("Введите размер массива: "); Scanner scan = new Scanner(System.in); int size_mas = scan.nextInt(); int[] mas = new int[size_mas]; for (int i = 0; i < size_mas; i++) { mas[i] = (int) (Math.random() * 50); System.out.print(mas[i] + " "); } System.out.println("\nИзмененный массив: "); scan.close(); printMasMultiply(mas); for (int x : mas) System.out.print(x + " "); } public static void printMasMultiply(int[] anyMas) { for (int i = 0; i < anyMas.length - 1; i++) { int temp = anyMas[i]; anyMas[i] = anyMas[i + 1]; anyMas[i + 1] = temp; } System.out.println(); } }
453ba4805d4adc5e1a518270c2cf85974b8460fe
114d7cfd55f487b2038344e65a28d47c107b98d5
/src/main/java/cl/awakelab/stsproj/controller/HomeController.java
a99973c7cf0882fb8f1896bfab4a817e7ddbec66
[]
no_license
bguzmanm/stsproj
7656cbf6bee6c14c9d2c6703fff2c6fb8f5ce895
1587fd6932b1aec74d06c24e53bdcaffae6ebdbd
refs/heads/main
2023-07-18T11:15:01.286948
2021-08-26T13:58:07
2021-08-26T13:58:07
397,983,389
0
0
null
null
null
null
UTF-8
Java
false
false
2,025
java
package cl.awakelab.stsproj.controller; import java.util.Map; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.MatrixVariable; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import cl.awakelab.stsproj.model.Facilitador; /** * Handles requests for the application home page. */ @Controller public class HomeController { /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Model model) { Facilitador f = new Facilitador("1-1", "Brian", "Guzmán"); model.addAttribute("f", f); return "home"; } /** * Definimos una expresión regular donde * @param nombre recibe letras desde a hasta la z, entre 1 y 20 caracteres. * @param version recibe números entre 0 y 9, entre 1 y dos digitos, tres veces. * @param extension recibe letras desde la a hasta la z, A hasta la Z, y números desde el 0 al 9, desde 1 a 10 veces. * @return retorna "home", y muestra por consola lo que ingresaste. */ @RequestMapping(value = "/jome/{nombre:[a-zA-Z]{1,20}}.{version:[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}}.{extension:[a-zA-Z0-9]{1,10}}", method = RequestMethod.GET) public String jome(@PathVariable("nombre") String nombre, @PathVariable("version") String version, @PathVariable("extension") String extension) { System.out.println(nombre + "." + version + "." + extension); return "home"; } //GET /pets/42;q=11;r=22 //GET /estudiantes/156-2;gabriel;daniel;ronald;luis //GET /estudiantes/156-2;gabriel;eliseo;ronald;luis;esteban @RequestMapping(value="/pets/{petId}", method = RequestMethod.GET) public String findPet(@MatrixVariable(pathVar="petId") Map<String, String> petMatrixVars) { System.out.println("q= " + petMatrixVars.size()); return "home"; } }
ecab7695f4d7ea697db90556f7160a2017ac2553
4a35eb46507eb8207f634e6dad23762d0aec94df
/project/MapExplore/jMetal-jmetal-5.1/jmetal-exec/src/main/java/org/uma/jmetal/runner/multiobjective/SMPSOMeasuresRunner.java
7611f0bea43e935fd82426d4ed2063346dbf74c1
[]
no_license
fairanswers/fss16joe
8800ad81c60ab06f90b9643bf601c6c2c9a51107
f5dde87038ec5404a6bb2d9a538b2ceef571ac9d
refs/heads/master
2020-05-22T06:44:32.138162
2016-12-07T19:46:54
2016-12-07T19:46:54
65,820,114
2
1
null
null
null
null
UTF-8
Java
false
false
6,638
java
// NSGAIIRunner.java // // Author: // Antonio J. Nebro <[email protected]> // // Copyright (c) 2014 Antonio J. Nebro // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package org.uma.jmetal.runner.multiobjective; import org.uma.jmetal.algorithm.Algorithm; import org.uma.jmetal.algorithm.multiobjective.nsgaii.NSGAIIBuilder; import org.uma.jmetal.algorithm.multiobjective.nsgaii.NSGAIIMeasures; import org.uma.jmetal.algorithm.multiobjective.smpso.SMPSOBuilder; import org.uma.jmetal.algorithm.multiobjective.smpso.SMPSOMeasures; import org.uma.jmetal.measure.MeasureListener; import org.uma.jmetal.measure.MeasureManager; import org.uma.jmetal.measure.impl.BasicMeasure; import org.uma.jmetal.measure.impl.CountingMeasure; import org.uma.jmetal.measure.impl.DurationMeasure; import org.uma.jmetal.operator.CrossoverOperator; import org.uma.jmetal.operator.MutationOperator; import org.uma.jmetal.operator.SelectionOperator; import org.uma.jmetal.operator.impl.crossover.SBXCrossover; import org.uma.jmetal.operator.impl.mutation.PolynomialMutation; import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; import org.uma.jmetal.problem.DoubleProblem; import org.uma.jmetal.problem.Problem; import org.uma.jmetal.runner.AbstractAlgorithmRunner; import org.uma.jmetal.solution.DoubleSolution; import org.uma.jmetal.util.AlgorithmRunner; import org.uma.jmetal.util.JMetalException; import org.uma.jmetal.util.JMetalLogger; import org.uma.jmetal.util.ProblemUtils; import org.uma.jmetal.util.archive.BoundedArchive; import org.uma.jmetal.util.archive.impl.CrowdingDistanceArchive; import org.uma.jmetal.util.comparator.RankingAndCrowdingDistanceComparator; import org.uma.jmetal.util.evaluator.impl.SequentialSolutionListEvaluator; import org.uma.jmetal.util.pseudorandom.impl.MersenneTwisterGenerator; import java.io.FileNotFoundException; import java.util.List; import java.util.concurrent.TimeUnit; /** * Class to configure and run the NSGA-II algorithm (variant with measures) */ public class SMPSOMeasuresRunner extends AbstractAlgorithmRunner { /** * @param args Command line arguments. * @throws SecurityException * Invoking command: java org.uma.jmetal.runner.multiobjective.NSGAIIMeasuresRunner problemName [referenceFront] */ public static void main(String[] args) throws JMetalException, InterruptedException, FileNotFoundException { DoubleProblem problem; Algorithm<List<DoubleSolution>> algorithm; MutationOperator<DoubleSolution> mutation; String referenceParetoFront = "" ; String problemName ; if (args.length == 1) { problemName = args[0]; } else if (args.length == 2) { problemName = args[0] ; referenceParetoFront = args[1] ; } else { problemName = "org.uma.jmetal.problem.multiobjective.zdt.ZDT4"; referenceParetoFront = "jmetal-problem/src/test/resources/pareto_fronts/ZDT4.pf" ; } problem = (DoubleProblem) ProblemUtils.<DoubleSolution> loadProblem(problemName); BoundedArchive<DoubleSolution> archive = new CrowdingDistanceArchive<DoubleSolution>(100) ; double mutationProbability = 1.0 / problem.getNumberOfVariables() ; double mutationDistributionIndex = 20.0 ; mutation = new PolynomialMutation(mutationProbability, mutationDistributionIndex) ; int maxIterations = 250 ; int swarmSize = 100 ; algorithm = new SMPSOBuilder(problem, archive) .setMutation(mutation) .setMaxIterations(maxIterations) .setSwarmSize(swarmSize) .setRandomGenerator(new MersenneTwisterGenerator()) .setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>()) .setVariant(SMPSOBuilder.SMPSOVariant.Measures) .build(); /* Measure management */ MeasureManager measureManager = ((SMPSOMeasures)algorithm).getMeasureManager() ; CountingMeasure currentIteration = (CountingMeasure) measureManager.<Long>getPullMeasure("currentIteration"); DurationMeasure currentComputingTime = (DurationMeasure) measureManager.<Long>getPullMeasure("currentExecutionTime"); BasicMeasure<List<DoubleSolution>> solutionListMeasure = (BasicMeasure<List<DoubleSolution>>) measureManager.<List<DoubleSolution>> getPushMeasure("currentPopulation"); CountingMeasure iteration2 = (CountingMeasure) measureManager.<Long>getPushMeasure("currentIteration"); solutionListMeasure.register(new Listener()); iteration2.register(new Listener2()); /* End of measure management */ Thread algorithmThread = new Thread(algorithm) ; algorithmThread.start(); /* Using the measures */ int i = 0 ; while(currentIteration.get() < maxIterations) { TimeUnit.SECONDS.sleep(5); System.out.println("Iteration (" + i + ") : " + currentIteration.get()) ; System.out.println("Computing time (" + i + ") : " + currentComputingTime.get()) ; i++ ; } algorithmThread.join(); List<DoubleSolution> population = algorithm.getResult() ; long computingTime = currentComputingTime.get() ; JMetalLogger.logger.info("Total execution time: " + computingTime + "ms"); printFinalSolutionSet(population); if (!referenceParetoFront.equals("")) { printQualityIndicators(population, referenceParetoFront) ; } } private static class Listener implements MeasureListener<List<DoubleSolution>> { private int counter = 0 ; @Override synchronized public void measureGenerated(List<DoubleSolution> solutions) { if ((counter % 1 == 0)) { System.out.println("PUSH MEASURE. Counter = " + counter+ " First solution: " + solutions.get(0)) ; } counter ++ ; } } private static class Listener2 implements MeasureListener<Long> { @Override synchronized public void measureGenerated(Long value) { if ((value % 50 == 0)) { System.out.println("PUSH MEASURE. Iteration: " + value) ; } } } }
1fa1c9728c16dcd28d6898060b2675dfe1d6a754
29423f34238795c607a5ecd9de8acad6c5aef583
/src/test/java/hackathon/epam/selfcoop/customwebdrivers/WebDriverWrapper.java
a70d9e2fc3aa2a81902ac1a3a4477373a9e6c042
[ "MIT" ]
permissive
itev4n7/self-coop-hackathon
98d60fde200814bdb46ecefd79eb3dfd8de74155
2d80f031d6b29cfb13e1d6158475bc25a0c9963f
refs/heads/main
2023-08-24T17:23:13.001825
2021-09-19T06:20:32
2021-09-19T06:20:32
407,802,163
1
0
null
null
null
null
UTF-8
Java
false
false
416
java
package hackathon.epam.selfcoop.customwebdrivers; import org.openqa.selenium.WebDriver; public class WebDriverWrapper { private static final ThreadLocal<WebDriver> driver = new ThreadLocal<>(); private WebDriverWrapper() {} public static void setDriver(WebDriver customDriver) { driver.set(customDriver); } public static WebDriver getDriver() { return driver.get(); } }
8e90f3d436a931ebf01eab73dae0dcc519200f55
bbc40cd27dba2d138fe0f9b56becaaa36cc0272f
/springboot-test/src/test/java/com/busekylin/springboottest/ContextTest.java
2831ca7c0f42fa0c384bdf7ebe88031881f4804e
[]
no_license
zhaoleigege/spring-boot
9ec548f8f7dd7aaac0fa070b58ab3c26d655845c
47c0b6abd0322bea7954451aeea194f466d1f1b9
refs/heads/master
2020-04-12T18:07:14.758042
2019-03-21T10:08:34
2019-03-21T10:08:34
162,669,926
3
0
null
null
null
null
UTF-8
Java
false
false
973
java
package com.busekylin.springboottest; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc public class ContextTest { @Autowired private MockMvc mockMvc; @Test public void contextTest() throws Exception { this.mockMvc.perform(get("/web")).andDo(print()).andExpect(status().isOk()); } }
132ec1d733a45fb9b9c38b7246264875b19c9bec
88b3628394c545c30e00c23402a4c05449d73cf2
/javaConcurrentInPractice/src/main/java/net/jcip/examples/_11_performanceAndScalability/WorkerThread.java
cf03075d8c4033753e6941a812a4c3493fadc5a7
[]
no_license
cyhbyw/ProjectA
42d61d1696978606592a9ec4e9fb17988fe6c2cd
688c62460e5b828618fbe9b346d1f2cba5f1b4b8
refs/heads/master
2022-07-26T13:07:27.971783
2021-03-26T02:09:09
2021-03-26T02:09:09
119,479,548
1
2
null
2022-06-29T17:02:51
2018-01-30T03:54:37
Java
UTF-8
Java
false
false
668
java
package net.jcip.examples._11_performanceAndScalability; import java.util.concurrent.BlockingQueue; /** * WorkerThread * <p/> * Serialized access to a task queue * * @author Brian Goetz and Tim Peierls */ public class WorkerThread extends Thread { private final BlockingQueue<Runnable> queue; public WorkerThread(BlockingQueue<Runnable> queue) { this.queue = queue; } public void run() { while (true) { try { Runnable task = queue.take(); task.run(); } catch (InterruptedException e) { break; /* Allow thread to exit */ } } } }
10040cfd8e47962f568e420ce27ab9eab318b8dc
4d8aa9979d99d0fad6a384b15c62a54bea0404c8
/app/src/main/java/com/pubnub/sarath/ssw/ui/login/LoginActivity.java
21c96efe0e821945c22fc5069ec609853a0ba035
[]
no_license
sarathpathan/projectSSW
2c6b1be7b9cd72a795a3e0b048a2a5f213fb2f16
2aa88863a449ce2a2fe4d42fcc519b62bdcc5fc7
refs/heads/master
2021-01-05T10:15:11.655097
2020-02-17T00:27:02
2020-02-17T00:27:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,227
java
package com.pubnub.sarath.ssw.ui.login; import android.app.Activity; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import android.content.Intent; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.appcompat.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.pubnub.sarath.ssw.R; import com.pubnub.sarath.ssw.MainActivity; public class LoginActivity extends AppCompatActivity { private LoginViewModel loginViewModel; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); loginViewModel = ViewModelProviders.of(this, new LoginViewModelFactory()) .get(LoginViewModel.class); final EditText usernameEditText = findViewById(R.id.username); final EditText passwordEditText = findViewById(R.id.password); final Button loginButton = findViewById(R.id.login); final ProgressBar loadingProgressBar = findViewById(R.id.loading); loginViewModel.getLoginFormState().observe(this, new Observer<LoginFormState>() { @Override public void onChanged(@Nullable LoginFormState loginFormState) { if (loginFormState == null) { return; } loginButton.setEnabled(loginFormState.isDataValid()); if (loginFormState.getUsernameError() != null) { usernameEditText.setError(getString(loginFormState.getUsernameError())); } if (loginFormState.getPasswordError() != null) { passwordEditText.setError(getString(loginFormState.getPasswordError())); } } }); loginViewModel.getLoginResult().observe(this, new Observer<LoginResult>() { @Override public void onChanged(@Nullable LoginResult loginResult) { Log.d("bharath ",""+loginResult.getError()); Log.d("bharath success ",""+loginResult.getSuccess().toString()); if (loginResult == null) { return; } loadingProgressBar.setVisibility(View.GONE); if (loginResult.getError() != null) { showLoginFailed(loginResult.getError()); } if (loginResult.getSuccess() != null) { updateUiWithUser(loginResult.getSuccess()); } setResult(Activity.RESULT_OK); //Complete and destroy login activity once successful finish(); } }); TextWatcher afterTextChangedListener = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // ignore } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // ignore } @Override public void afterTextChanged(Editable s) { loginViewModel.loginDataChanged(usernameEditText.getText().toString(), passwordEditText.getText().toString()); } }; usernameEditText.addTextChangedListener(afterTextChangedListener); passwordEditText.addTextChangedListener(afterTextChangedListener); passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { loginViewModel.login(usernameEditText.getText().toString(), passwordEditText.getText().toString()); } return false; } }); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadingProgressBar.setVisibility(View.VISIBLE); loginViewModel.login(usernameEditText.getText().toString(), passwordEditText.getText().toString()); } }); } private void updateUiWithUser(LoggedInUserView model) { String welcome = getString(R.string.welcome) + model.getDisplayName(); // TODO : initiate successful logged in experience Toast.makeText(getApplicationContext(), welcome, Toast.LENGTH_LONG).show(); startActivity(new Intent(LoginActivity.this, MainActivity.class)); } private void showLoginFailed(@StringRes Integer errorString) { Toast.makeText(getApplicationContext(), errorString, Toast.LENGTH_SHORT).show(); } }
909ff46ff5dff546a41c6db50e3aaa5253550508
3670a40842738cca302cf7093385db87c8245a9e
/com.nickfirsov.composite_config_plugin/src/com/nickfirsov/composite_config_plugin/LaunchConfigUtils.java
080b78ec51e0e62a24b4f118750de70504872579
[]
no_license
NFirsov/Common_Java
e8d2a89967c9eca02378333b24b43a975d1491df
44e200204ab4b6f881144148458d98885a687b26
refs/heads/master
2021-01-16T00:05:01.561347
2016-09-18T21:30:53
2016-09-18T21:30:53
68,548,010
0
0
null
null
null
null
UTF-8
Java
false
false
1,901
java
package com.nickfirsov.composite_config_plugin; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; public class LaunchConfigUtils { private static String InnerConfigs = "InnerConfigs"; private static String LaunchConfigurationType = "com.nickfirsov.composite_config_plugin.composite_launch_config"; public static List<String> GetInnerConfigs(ILaunchConfiguration config) { List<String> list = null; try { list = config.getAttribute(InnerConfigs, list); } catch (CoreException e) { e.printStackTrace(); } return list != null ? list : new ArrayList<String>(); } public static void SetInnerConfigs(ILaunchConfigurationWorkingCopy configWc, List<String> innerConfigs) { configWc.setAttribute(InnerConfigs, innerConfigs); } // Get available configs except of compositeLaunchConfigs to avoid cycles public static List<ILaunchConfiguration> GetAvailableConfigs() { ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType compositeLaunchConfigType = manager.getLaunchConfigurationType(LaunchConfigurationType); ILaunchConfiguration[] allConfigs = null; try { allConfigs = manager.getLaunchConfigurations(); } catch (CoreException e) { e.printStackTrace(); } List<ILaunchConfiguration> result = new ArrayList<ILaunchConfiguration>(); for(ILaunchConfiguration config : allConfigs) { try { ILaunchConfigurationType cType = config.getType(); if(cType != compositeLaunchConfigType) result.add(config); } catch (CoreException e) { e.printStackTrace(); } } return result; } }
2c153252d20f3794bc2e7f1e49e6af016ab4f704
77a4eed4b2c4866bfd3956b4e0c420ade50f9351
/app/src/main/java/com/rha/app/rha/view/activity/IntroActivity.java
c4b4f953b971ac20cfe7f17e5928e4e8a11d33f1
[]
no_license
manishaprasad38/RHA1
9495977e1275f76b7e44557f8f97676399d8c188
21f23fd08ddf55840e64dfe4cb76c708fb08defa
refs/heads/master
2020-04-01T05:10:44.133624
2018-12-08T05:40:49
2018-12-08T05:40:49
152,893,210
0
0
null
null
null
null
UTF-8
Java
false
false
4,532
java
package com.rha.app.rha.view.activity; import android.app.Activity; import android.content.Intent; import android.os.Handler; import android.support.v4.view.ViewPager; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; import com.rha.app.rha.R; import com.rha.app.rha.view.adapters.ViewPagerAdapter; import java.util.Timer; import java.util.TimerTask; import me.relex.circleindicator.CircleIndicator; public class IntroActivity extends Activity { ViewPager viewPager; ViewPagerAdapter viewPagerAdapter; private int[] txtHeaders = {R.string.action_headers1,R.string.action_headers2,R.string.action_headers3, R.string.action_headers4,R.string.action_headers5}; private int[] txtHeadersDesc1 = {R.string.action_headers1_desc1,R.string.action_headers2_desc1,R.string.action_headers3_desc1 ,R.string.action_headers4_desc1,R.string.action_headers5_desc1}; private int[] txtHeadersDesc2 = {R.string.action_headers1_desc2,R.string.action_headers2_desc2,R.string.action_headers3_desc2 ,R.string.action_headers4_desc2,R.string.action_headers5_desc2}; private int[] txtHeadersDesc3 = {R.string.action_headers1_desc3,R.string.action_headers2_desc3,R.string.action_headers3_desc3 ,R.string.action_headers4_desc3,R.string.action_headers5_desc3}; private int[] txtHeadersDesc4 = {R.string.action_headers1_desc4,R.string.action_headers2_desc4,R.string.action_headers4_desc4 ,R.string.action_headers4_desc4,R.string.action_headers5_desc4}; private static int currentPage = 0; private static int NUM_PAGES = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_intro); viewPager = (ViewPager)findViewById(R.id.pager); viewPagerAdapter = new ViewPagerAdapter(IntroActivity.this,txtHeaders,txtHeadersDesc1, txtHeadersDesc2,txtHeadersDesc3,txtHeadersDesc4); viewPager.setAdapter(viewPagerAdapter); CircleIndicator indicator = (CircleIndicator) findViewById(R.id.indicator); indicator.setViewPager(viewPager); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { currentPage = position; } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int state) { if (state == ViewPager.SCROLL_STATE_IDLE) { int pageCount = txtHeaders.length; if (currentPage == 0) { viewPager.setCurrentItem(pageCount - 1, false); } else if (currentPage == pageCount - 1) { Intent i = new Intent(getApplicationContext(),LoginActivity.class); startActivity(i); finish(); // viewPager.setCurrentItem(0, false); } } } }); // final Handler handler = new Handler(); // final Runnable update = new Runnable() { // @Override // public void run() { // if (currentPage == NUM_PAGES) { // currentPage = 0; // } // viewPager.setCurrentItem(currentPage++, true); // } // }; // Timer swipeTimer = new Timer(); // swipeTimer.schedule(new TimerTask() { // // @Override // public void run() { // handler.post(update); // } // }, 3000, 3000); indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { currentPage = position; } @Override public void onPageScrolled(int pos, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int pos) { } }); } }
a0b243489d949a89e5284a1f14ea5f3efc2676c2
e3935418d2d8426f418f5732dd7448c82fae5ff5
/src/crazyrun/Car.java
7042713435b21b1dcb8d7f2e1b091b894a73410a
[]
no_license
hosseini-sajad/crazy-run
6d9cc2c0b74052c1972f646ba40ab5eee182e779
a356391a348de8bade0da0b896727fd5fbdc7d8d
refs/heads/master
2020-03-13T05:35:33.445189
2018-06-21T15:46:16
2018-06-21T15:46:16
130,987,349
0
1
null
null
null
null
UTF-8
Java
false
false
2,433
java
package crazyrun; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.net.URL; import javax.swing.ImageIcon; public class Car { private double x; private int y; private int width; private int height; private int xSpeedLeft = 10; private int xSpeedRight = 10; private boolean isRight = true; public boolean isIsRight() { return isRight; } public void setIsRight(boolean isRight) { this.isRight = isRight; } public Car(int x, int y, int width, int height, Color color) { setX(x); setY(y); setWidth(width); setHeight(height); } public double getX() { return x; } public void setX(double x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getxSpeedLeft() { return xSpeedLeft; } public void setxSpeedLeft(int xSpeedLeft) { this.xSpeedLeft = xSpeedLeft; } public int getxSpeedRight() { return xSpeedRight; } public void setxSpeedRight(int xSpeedRight) { this.xSpeedRight = xSpeedRight; } public void draw(Graphics g) { URL iconUrl; if (isRight) { iconUrl = getClass().getClassLoader().getResource("car3.gif"); } else { iconUrl = getClass().getClassLoader().getResource("cabriolet.gif"); } if (iconUrl != null) { ImageIcon icon = new ImageIcon(iconUrl); Image image = icon.getImage(); g.drawImage(image, (int) x, y, 100, 50, null); } else { g.setColor(Color.GRAY); g.fillRect((int) getX(), getY(), getWidth(), getHeight()); } } public void moveRight(int gameWidth, int gameHeight) { x += getxSpeedRight(); } public void moveLeft(int gameWidth, int gameHeight) { x -= getxSpeedLeft(); } public Rectangle getBound() { return new Rectangle((int) getX(), getY() + 30, getWidth() - 10, getHeight() - 30); } }
600b87b465197b81d6ff85b5a9a18a1f6d8c4e48
45b3284b991a219633feadff255b915cf0570ae4
/src/runJava/ch04/Ch04Ex09.java
1651a2d3f2fd42c79fac4e9517c3ad50f4f1cb25
[]
no_license
tkillman/runJava
26dc1194a349a7f2801166f3d0dd541a2902bc9b
1525048977220137898fc856c92167507e32914f
refs/heads/master
2022-12-21T04:50:50.943107
2020-09-20T14:02:55
2020-09-20T14:02:55
276,281,167
0
0
null
null
null
null
UHC
Java
false
false
566
java
package runJava.ch04; public class Ch04Ex09 { //*****do while문******* public static void main(String[] args) { int total =0; int i=1; do{ total+=i; i++; //그냥 while문이었다면 i가 1보다 크지 않기 때문에 반복문이 실행되지 않지만 //do while문이기 때문에 반복문이 한번 실행되고 i값이 2가 되면서 //반복문이 실행된다. }while(i>1 && i<10); System.out.println(total); /*while(i>1 && i<10){ total+=i; i++; } System.out.println(total); */ } }
530f4d592a69557adc139406730b4adb4d73cce0
9c5e10ba39daafd864d52260ea4f98ef5a93fd98
/Algorithms/GeekForGeeks/src/com/christy/arrays/LeftRotateByDPositions.java
d35c04951376a1ac5fbaf415a36b14c03afa4098
[]
no_license
christyjohn/practice
817b1214233224daa6260e5c762ca2b6fce2bc87
60bdcb8e58b3c346df83837fb6ec0cfc7e807a5c
refs/heads/master
2023-04-29T00:50:49.137042
2022-05-16T06:57:45
2022-05-16T06:57:45
95,289,669
0
2
null
2023-04-18T16:54:33
2017-06-24T10:00:02
Java
UTF-8
Java
false
false
1,079
java
package com.christy.arrays; import java.util.Arrays; public class LeftRotateByDPositions { public static void main(String[] args) { int[] arr = { 2, 3, 5, 7, 9 }; int[] arr2 = { 2, 3, 5, 7, 9, 10, 13, 15 }; int d = 3; System.out.println("Array before rotating: " + Arrays.toString(arr)); rotateLeft(arr, d); System.out.print("Array after rotating " + d + " positions: "); System.out.println(Arrays.toString(arr)); System.out.println("------------"); System.out.println("Array before rotating: " + Arrays.toString(arr2)); rotateLeft(arr2, d); System.out.print("Array after rotating " + d + " positions: "); System.out.println(Arrays.toString(arr2)); } public static void rotateLeft(int[] arr, int d) { reverse(arr, 0, d-1); reverse(arr, d, arr.length-1); reverse(arr, 0, arr.length -1); } public static void reverse(int[] arr, int startIndex, int endIndex) { while (startIndex < endIndex) { int temp = arr[startIndex]; arr[startIndex] = arr[endIndex]; arr[endIndex] = temp; startIndex++; endIndex--; } } }
1cc5e52dd4e235a95d733d8db787588121950f59
5b3ffc791cbd4e7d1d7640ff5efb56ecfe46dcf6
/src/main/java/dev/klepto/lazyvoids/When.java
ced09ec53c6360f43745ce5243e6a709c6a278f0
[ "Unlicense" ]
permissive
klepto/lazy-voids
cea30393fc32616791d113d762ef7ea626e211b8
9444db27f20c8f08a3acd6a1aa43d1085dd46af3
refs/heads/master
2022-08-19T13:57:19.489332
2020-05-21T17:22:22
2020-05-21T17:22:22
265,895,878
0
0
null
null
null
null
UTF-8
Java
false
false
4,967
java
package dev.klepto.lazyvoids; import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.RequiredArgsConstructor; import java.util.function.Consumer; import java.util.function.Supplier; /** * A key-value pair container object which may or may not contain a non-null value. When enables simplified key-value * mapping while preserving some of the compile-time type safety provided by more verbose patterns such as using * {@link java.util.Map}. * * <p>If a value is non-null, {@code isPresent()} will return {@code true} and {@code get()} will return the value. * <p>If a value is null, {@code isEmpty()} will return {@code true} and {@code orElse()} will return the given * default value. * <p>Additional methods are included to somewhat resemble functionality of {@link java.util.Optional}. * * @author <a href="https://klepto.dev/">Augustinas R.</a> * @since 0.1 */ @EqualsAndHashCode @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public final class When<K, V> { private final K key; private final V result; /** * Creates a new when mapper for a given key with an empty result. * * @param key the key object * @param <K> the key type for compile-time type safety * @param <V> the value type for compile-time type safety, ({@link Object} until the first call of * {@link When#map(Object, Object)}. * @return a new when mapper for a given key */ public static <K, V> When<K, V> when(K key) { return new When<>(key, null); } /** * Creates a new mapping for key-value pair, if given key equals to key of this container, a new when container * will be created with given value as the result. Otherwise {@code this} is returned. Using polymorphic value * types should be avoided, due to how compile time type-inference works, each subsequent call of this method may * alter the result type when using polymorphic values. If you absolutely need to use polymorphic values you have to * make sure your last call of this method is done with the super type. * * @param key the mapping key * @param value the mapping value * @param <T> generic type to infer value type for future calls of this method * @return this or new when object if key matched the key of this container */ @SuppressWarnings("unchecked") public <T extends V> When<K, T> map(K key, T value) { if (this.key.equals(key)) { return new When<>(key, value); } return (When<K, T>) this; } /** * Returns true if result value is present, otherwise false. * * @return true if result has a non-null value, otherwise false */ public boolean isPresent() { return result != null; } /** * Returns true if result value is not present, otherwise false. * * @return true if result has a null value, otherwise false */ public boolean isEmpty() { return !isPresent(); } /** * Returns the result value (if key didn't match any mappings, value will be {@code null}). * * @return the result value */ public V get() { return result; } /** * If a value is present, performs the given action with the value, otherwise does nothing. * * @param action the action to be performed, if a value is present */ public void ifPresent(Consumer<? super V> action) { if (isPresent()) { action.accept(result); } } /** * If a value is present, returns the value, otherwise returns other. * * @param other the value to be returned, if no value is present (may be {@code null}) * @return the value, if present, otherwise other */ public V orElse(V other) { return isPresent() ? result : other; } /** * If a value is present, returns the value, otherwise returns the result produced by the supplying function. * * @param supplier the supplying function that produces a value to be returned * @return the value, if present, otherwise the result produced by the supplying function */ public V orElseGet(Supplier<? extends V> supplier) { // we don't call orElse because we want supplier to be evaluated lazily return isPresent() ? result : supplier.get(); } /** * If a value is present, returns the value, otherwise throws an throwable produced by the throwable supplying function. * @param throwableSupplier the supplying function that produces an throwable to be thrown * @param <X> type of the exception to be thrown * @return the value, if present * @throws X if no value is present */ public <X extends Throwable> V orElseThrow(Supplier<? extends X> throwableSupplier) throws X { if (isEmpty()) { throw throwableSupplier.get(); } return result; } }
b06fd9cfa9a1d1c087be75b46a4252044e3619b3
65e17c4f2111559ce06bc9c561824a2af67820bc
/RestGen/examples/Axis1x/CustService/generated/gov/nih/nci/restgen/generated/client/ObjectFactory.java
c6527ebc64c376292eebf8842d0a131df6f0b0ee
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
GothamGeneral/cacore-sdk
82cac4ccb40ed4d025e4013998c80c56426b3870
86f04f3c043f1384af71ad943b0801ff7094aba4
refs/heads/master
2021-01-12T14:24:13.593850
2016-03-09T18:27:20
2016-03-09T18:27:20
69,933,063
1
1
null
2016-10-04T04:01:43
2016-10-04T04:01:43
null
UTF-8
Java
false
false
4,560
java
/*L * Copyright Ekagra Software Technologies Ltd. * Copyright SAIC, SAIC-Frederick * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/cacore-sdk/LICENSE.txt for details. */ package gov.nih.nci.restgen.generated.client; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the gov.nih.nci.restgen.generated.client package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { private final static QName _NoSuchCustomer_QNAME = new QName("http://customerservice.example.com/", "NoSuchCustomer"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: gov.nih.nci.restgen.generated.client * */ public ObjectFactory() { } /** * Create an instance of {@link DeleteCustomerByIdResponse } * */ public DeleteCustomerByIdResponse createDeleteCustomerByIdResponse() { return new DeleteCustomerByIdResponse(); } /** * Create an instance of {@link AddCustomerResponse } * */ public AddCustomerResponse createAddCustomerResponse() { return new AddCustomerResponse(); } /** * Create an instance of {@link GetCustomerByName } * */ public GetCustomerByName createGetCustomerByName() { return new GetCustomerByName(); } /** * Create an instance of {@link UpdateCustomer } * */ public UpdateCustomer createUpdateCustomer() { return new UpdateCustomer(); } /** * Create an instance of {@link Customer } * */ public Customer createCustomer() { return new Customer(); } /** * Create an instance of {@link GetCustomerByNameResponse } * */ public GetCustomerByNameResponse createGetCustomerByNameResponse() { return new GetCustomerByNameResponse(); } /** * Create an instance of {@link NoSuchCustomer } * */ public NoSuchCustomer createNoSuchCustomer() { return new NoSuchCustomer(); } /** * Create an instance of {@link DeleteCustomerById } * */ public DeleteCustomerById createDeleteCustomerById() { return new DeleteCustomerById(); } /** * Create an instance of {@link GetCustomersResponse } * */ public GetCustomersResponse createGetCustomersResponse() { return new GetCustomersResponse(); } /** * Create an instance of {@link GetCustomers } * */ public GetCustomers createGetCustomers() { return new GetCustomers(); } /** * Create an instance of {@link UpdateCustomerResponse } * */ public UpdateCustomerResponse createUpdateCustomerResponse() { return new UpdateCustomerResponse(); } /** * Create an instance of {@link DeleteCustomerResponse } * */ public DeleteCustomerResponse createDeleteCustomerResponse() { return new DeleteCustomerResponse(); } /** * Create an instance of {@link AddCustomer } * */ public AddCustomer createAddCustomer() { return new AddCustomer(); } /** * Create an instance of {@link DeleteCustomer } * */ public DeleteCustomer createDeleteCustomer() { return new DeleteCustomer(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link NoSuchCustomer }{@code >}} * */ @XmlElementDecl(namespace = "http://customerservice.example.com/", name = "NoSuchCustomer") public JAXBElement<NoSuchCustomer> createNoSuchCustomer(NoSuchCustomer value) { return new JAXBElement<NoSuchCustomer>(_NoSuchCustomer_QNAME, NoSuchCustomer.class, null, value); } }
93a3b4fb89198ad592bbd7e72bd05455e7ec1c97
a422de59c29d077c512d66b538ff17d179cc077a
/hsxt/hsxt-access/hsxt-access-web/hsxt-access-web-mcs/src/main/java/com/gy/hsxt/access/web/mcs/services/systemmanage/OperatorService.java
89ac208352c8b1297afe1ffa8bc7ca033be062d4
[]
no_license
liveqmock/hsxt
c554e4ebfd891e4cc3d57e920d8a79ecc020b4dd
40bb7a1fe5c22cb5b4f1d700e5d16371a3a74c04
refs/heads/master
2020-03-28T14:09:31.939168
2018-09-12T10:20:46
2018-09-12T10:20:46
148,461,898
0
0
null
2018-09-12T10:19:11
2018-09-12T10:19:10
null
UTF-8
Java
false
false
2,315
java
/* * Copyright (c) 2015-2018 SHENZHEN GUIYI SCIENCE AND TECHNOLOGY DEVELOP CO., LTD. All rights reserved. * * 注意:本内容仅限于深圳市归一科技研发有限公司内部传阅,禁止外泄以及用于其他的商业目的 */ package com.gy.hsxt.access.web.mcs.services.systemmanage; import java.util.List; import java.util.Map; import com.gy.hsxt.access.web.bean.MCSBase; import com.gy.hsxt.access.web.common.service.IBaseService; import com.gy.hsxt.common.exception.HsException; import com.gy.hsxt.tm.bean.Group; import com.gy.hsxt.uc.as.bean.operator.AsOperator; /** * * 操作员管理服务 * @Package: com.gy.hsxt.access.web.mcs.services.systemmanage * @ClassName: OperatorService * @Description: TODO * * @author: zhangcy * @date: 2016-1-9 下午12:12:30 * @version V1.0 */ @SuppressWarnings("rawtypes") public interface OperatorService extends IBaseService{ /** * 添加操作员 * @param oper * @param adminCustId * @throws HsException */ public String addOper(AsOperator oper, String adminCustId ,List<Long> groupIds) throws HsException; /** * 查询操作员 * @param operCustId * @return * @throws HsException */ public AsOperator searchOperByCustId (String operCustId) throws HsException; /** * 查询企业操作员列表 * @param entCustId * @return * @throws HsException */ public List<AsOperator> listOperByEntCustId(String entCustId) throws HsException; /** * 修改企业操作员信息 * @param oper * @param adminCustId * @throws HsException */ public void updateOper (AsOperator oper, String adminCustId,List<Long> groupIds) throws HsException; /** * 删除操作员 * @param operCustId * @param adminCustId * @throws HsException */ public void deleteOper (String operCustId, String adminCustId) throws HsException; /** * 获取操作员详情 * @param mcsBase * @return */ public Map<String, Object> getOperatorDetail(MCSBase mcsBase); /** * 查询所有工单分组及分组下的所有操作员 * @param entCustId * @return */ public List<Group> findTaskGroupInfo(String entCustId); }
fd9ade85f51f7a45bf5693e74ca3506fe54663f2
cfaff18751b2b1712b554c04572a7b3175971a37
/Pratice 1/src/AdditionArray.java
d4526ca914d76dc72034fcf3f0f9dddc8d3d4493
[]
no_license
ArangMaa/Mani-Code
651cc334598348f3c37cb922b6754a97f69bc981
3f2ff487c10e8b6c5b4476a5c4114c4fcf46c6aa
refs/heads/master
2023-06-04T23:29:17.449090
2021-06-21T16:19:47
2021-06-21T16:19:47
378,984,831
0
0
null
null
null
null
UTF-8
Java
false
false
687
java
public class AdditionArray { public static void main(String[] args) { int [] a=new int [5]; { for(int i=0; i<a.length;i++){// 1st approach to print all the values System.out.println(i); } } boolean []b= new boolean [3]; { for(boolean bb:b){// second approach to print all the values System.out.println(bb); } } //user define data type AdditionArray[] x= new AdditionArray[5];//AdditionArray is name of class { for(AdditionArray yy:x){ System.out.println(yy); } } int []z= new int [3];// addition of 2 arrays z[0]=10; z[1]=20; z[2]=z[0]+z[1]; { System.out.println(z[2]); } } }
[ "MANITA@DESKTOP-LMJT05L" ]
MANITA@DESKTOP-LMJT05L
d77bc1a28f65984141c04e8b17c35d05d9856852
cd4165438fc5399810da3c9e596c34197c56b8b2
/SpringRestfulWebServices/src/main/java/org/springRestful/services/CountryService.java
633e39ebd0337227af8c22bb79a7fdf05e98452d
[]
no_license
SweetFudge/SpringRestfulWebServices-Example
c266e8d970eaa69c95fb17e901a2ff1dc320c985
4824fb859051943b500c07bef908e2413229b2a3
refs/heads/master
2021-07-24T11:03:59.986794
2017-11-04T20:56:45
2017-11-04T20:56:45
109,529,380
0
0
null
null
null
null
UTF-8
Java
false
false
1,649
java
package org.springRestful.services; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import org.springRestful.beans.Country; public class CountryService { private static List<Country> countries; public CountryService() { if(countries == null){ countries = createListCountries(); } } public List<Country> getCountries(){ return countries; } public Country getCountryById(int id){ Optional<Country> countryRes = countries.stream().filter(u -> u.getId() == id).findFirst(); Country country = (Country)countryRes.orElse(null); return country; } public Country addCountry(Country country){ countries.add(country); return country; } public Country updateCountry(Country country){ countries = countries.stream().map(o -> {if(o.getId() == country.getId()) {return country;} else{return o;}}).collect(Collectors.toList()); return country; } public void deleteCountry(int id){ countries = countries.stream().filter(o -> o.getId() != id).collect(Collectors.toList()); } private List<Country> createListCountries(){ List<Country> countries = new ArrayList<Country>(); countries.add(new Country(1,"Suisse",6000000)); countries.add(new Country(2,"France",60000000)); countries.add(new Country(3,"Italie",40000000)); countries.add(new Country(4,"USA",360000000)); countries.add(new Country(5,"Espagne",35000000)); countries.add(new Country(6,"Allemagne",5000000)); countries.add(new Country(7,"Portugal",35000000)); return countries; } }
b175970604d3d139df820043a2a57538ffbae0bd
86335cbec1af4aac99b5fe23631f88f9f884ecba
/src/main/java/com/example/catalogue/catalogueservice/service/impl/ManufacturerServiceImpl.java
cc00fcbd4412963491f8a223c9d1f27cd22a5466
[]
no_license
Hydropumpon/catalogue-service
579900b846d2c43b7585f1fd00fc0fac2376186d
dcd334e4169c422553ffef3f1d0307885012e7c3
refs/heads/master
2020-12-26T09:03:37.337614
2020-02-22T14:53:14
2020-02-22T14:53:14
237,457,907
0
0
null
null
null
null
UTF-8
Java
false
false
3,801
java
package com.example.catalogue.catalogueservice.service.impl; import com.example.catalogue.catalogueservice.entity.Manufacturer; import com.example.catalogue.catalogueservice.exception.ErrorMessage; import com.example.catalogue.catalogueservice.exception.NotFoundException; import com.example.catalogue.catalogueservice.exception.ServiceErrorCode; import com.example.catalogue.catalogueservice.repository.ManufacturerRepository; import com.example.catalogue.catalogueservice.service.ItemService; import com.example.catalogue.catalogueservice.service.ManufacturerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; @Service public class ManufacturerServiceImpl implements ManufacturerService { private ManufacturerRepository manufacturerRepository; private ItemService itemService; @Autowired public ManufacturerServiceImpl( ItemService itemService, ManufacturerRepository manufacturerRepository) { this.manufacturerRepository = manufacturerRepository; this.itemService = itemService; } @Override @Transactional public Manufacturer addManufacturer(Manufacturer manufacturer) { return manufacturerRepository.save(manufacturer); } @Override @Transactional(readOnly = true) public Page<Manufacturer> getManufacturers(Pageable pageable) { return manufacturerRepository.findAll(pageable); } @Override @Transactional(readOnly = true) public List<Manufacturer> getManufacturersByIdIn(List<Integer> ids) { return manufacturerRepository.findManufacturersByIdIn(ids); } @Override @Transactional public Manufacturer updateManufacturer(Manufacturer manufacturer, Integer id) { return manufacturerRepository.findById(id) .map(manufacturerDb -> { manufacturerDb.setAddress(manufacturer.getAddress()); manufacturerDb.setEmail(manufacturer.getEmail()); manufacturerDb.setFoundationYear(manufacturer.getFoundationYear()); manufacturerDb.setName(manufacturer.getName()); return manufacturerRepository.save(manufacturerDb); }).orElseThrow( () -> new NotFoundException(ErrorMessage.MANUFACTURER_NOT_FOUND, ServiceErrorCode.NOT_FOUND)); } @Override @Transactional public void deleteManufacturer(Integer id) { manufacturerRepository.findById(id) .map(manufacturer -> { itemService.deleteItemsByManufacturer(manufacturer); manufacturerRepository.delete(manufacturer); return Optional.empty(); }) .orElseThrow(() -> new NotFoundException(ErrorMessage.MANUFACTURER_NOT_FOUND, ServiceErrorCode.NOT_FOUND)); } @Override @Transactional(readOnly = true) public Manufacturer getManufacturer(Integer id) { return manufacturerRepository.findById(id).orElseThrow( () -> new NotFoundException(ErrorMessage.MANUFACTURER_NOT_FOUND, ServiceErrorCode.NOT_FOUND)); } }
0f02056e9eda3967f097d4da3a3c8de4508450c8
b0f3e88423fe84d4d6966b7351cf741e1659bfc8
/src/c17/NorthwindServlet.java
6cb7f3b799d5e68cde5094346192efd04167e68a
[]
no_license
zhaoxiaoer/csj
4a9381aa52565387a5c32c31777b515319e7ebcc
6f6c8ff889720df690810d2547bdcc86f39b4f9c
refs/heads/master
2020-03-24T22:38:11.961170
2018-10-15T00:31:16
2018-10-15T00:31:16
143,095,425
0
0
null
null
null
null
UTF-8
Java
false
false
2,115
java
package c17; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import util.ServletUtilities; public class NorthwindServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "Northwind Results"; out.print(ServletUtilities.headWithTitle(title) + "<body bgcolor=\"#FDF5E6\"><center>\n" + "<h1>" + title + "</h1>\n"); showTable(out); out.println("</center></body></html>"); } public void showTable(PrintWriter out) { try { Class.forName("com.mysql.cj.jdbc.Driver"); String url = "jdbc:mysql://127.0.0.1:3306/ztest"; String username = "root"; String password = ""; Connection connection = DriverManager.getConnection(url, username, password); out.println("<ul>"); DatabaseMetaData dbMetaData = connection.getMetaData(); String productName = dbMetaData.getDatabaseProductName(); String productVersion = dbMetaData.getDatabaseProductVersion(); out.println(" <li><b>Database:</b> " + productName + "</li>\n" + " <li><b>Version:</b> " + productVersion + "</li>\n" + "</ul>"); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT * FROM employee"); out.println("<table border=1>"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); int columnCount = resultSetMetaData.getColumnCount(); out.println("<tr>"); for (int i = 1; i <= columnCount; i++) { out.println("<th>" + resultSetMetaData.getColumnName(i) + "</th>"); } out.println("</tr>"); while (resultSet.next()) { out.println("<tr>"); for (int i = 1; i <= columnCount; i++) { out.println(" <td>" + resultSet.getString(i) + "</td>"); } out.println("</tr>"); } out.println("</table>"); connection.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqle) { sqle.printStackTrace(); } } }
f392180e1714e7988d28d94606c892fbf2422a6f
e50182c0865619394753777d9d7274864b780f39
/hrmsToplu2/src/main/java/kodlamaio/hrms/dataAccess/abstracts/JobAdvertisementDao.java
be8efa5628ed3a37f50197f7e665aef8045cd2fb
[]
no_license
KdrSkrGok78/EDJavaCamp
345ef89387dfa24ee082df3b718e6598813a30cd
e34c3750793e9d84449eb59f8880433fd9bce32e
refs/heads/main
2023-08-24T17:10:28.535510
2021-10-27T02:09:44
2021-10-27T02:09:44
361,358,518
7
0
null
null
null
null
UTF-8
Java
false
false
504
java
package kodlamaio.hrms.dataAccess.abstracts; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Service; import kodlamaio.hrms.entities.concretes.JobAdvertisement; @Service public interface JobAdvertisementDao extends JpaRepository<JobAdvertisement, Integer> { @Query("From JobAdvertisement where isActive=true") List<JobAdvertisement> getByIsActive(); }
1cb9c169a82ceb1205fd803d0924ee0aeefe948e
213c6fd61f9aa2426c2b669f0fca646e407a0b35
/src/core/se/jbee/inject/Typed.java
18e5bbf2c5f1358f8b5faf3a7aaf68aad968a111
[ "Apache-2.0" ]
permissive
CurtainDog/silk
d332e365c635d4f8369e191da49eb4bf7dd298f7
ae08ff6a5bfffe7e9461c4228b2f8f0d3bc79333
refs/heads/master
2021-01-21T00:36:18.609993
2013-03-10T11:09:18
2013-03-10T11:09:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
530
java
/* * Copyright (c) 2012, Jan Bernitt * * Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0 */ package se.jbee.inject; /** * <i>Has a {@link Type}, is typed</i>. * * @author Jan Bernitt ([email protected]) * * @param <T> * The actual type ({@link Class}) */ public interface Typed<T> { /** * @return The {@link Type} of this object. */ Type<T> getType(); /** * @return This object with the given {@link Type}. */ <E> Typed<E> typed( Type<E> type ); }
2d0ef578c1695d161ee3631412e6961a1646776c
6ab6106a023a7f485a9ea1ca37db3fb79ed2e36b
/xremoting-core/src/test/java/com/googlecode/xremoting/core/test/CoolService.java
b52329b87051e20e34d67c48fe4d1c1fedf8be59
[ "Apache-2.0" ]
permissive
rpuch/xremoting
b17de05533327bf4e316f82f276d057fc7e4c790
ddae4ee8c7c03f27794e700b19ca841c87d9ee64
refs/heads/master
2023-04-08T21:02:12.802976
2023-03-25T11:23:33
2023-03-25T11:23:33
32,251,973
1
0
Apache-2.0
2022-06-11T08:03:31
2015-03-15T08:58:31
Java
UTF-8
Java
false
false
455
java
package com.googlecode.xremoting.core.test; public class CoolService implements CoolServiceInterface { public String doCoolStuff(String stringArg, Integer integerArg, int intArg, Class<?>[] classArrayArg) { return stringArg + integerArg + intArg + classArrayArg[0].getSimpleName(); } public void throwing() throws Exception { throw new Exception("Just thrown"); } public Person justInvoke(String abc, Object[] objects) { return null; } }
[ "roman.puchkovskiy@0f6dab97-b9ee-1a6d-9288-fe3b798723e7" ]
roman.puchkovskiy@0f6dab97-b9ee-1a6d-9288-fe3b798723e7
6376af833347154c6e863ecb5ac47efc46a6991f
5ca2c8a9e3f334aa70c25c82da55d22cf2bf4caf
/src/main/java/com/tom/util/UrlToImgUtil.java
00a09719f4b146036fc01cbf7b7fd3f8ccbb0df2
[]
no_license
RemcoG/TomZnFilmWebsite
5f95a98615364b4803c0e51c7f530107cf37ebff
926bab427b899360df2303ca94388939d8b376c0
refs/heads/master
2021-01-17T03:08:44.651210
2015-09-16T12:33:04
2015-09-16T12:33:04
42,585,760
0
0
null
null
null
null
UTF-8
Java
false
false
501
java
package com.tom.util; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.net.URL; /** * Created by Tom on 9-9-2015. */ public class UrlToImgUtil { public static BufferedImage urlToImage(String url){ try { URL urlImage = new URL(url); BufferedImage image = ImageIO.read(urlImage); return image; } catch (Exception ex) { ex.printStackTrace(); } return null; } }
[ "Ih1haNV!" ]
Ih1haNV!
ec732e873e91497266db55b6688e79dbe29b5b12
0b1f4a47230ca0eb36c5f6970648cbd0e8fadba4
/WS11bSwapping.java
b8b3b50b692e4010dcc23efcaaaf46e251ba556b
[ "MIT" ]
permissive
Guama1239/JavaInputValidation
1a87f0c6c13b1683423ea3ac998d8b79c838cc43
46e38b6997be9f51c427a01a10e0ff5c0014af1d
refs/heads/master
2020-07-14T02:49:33.044857
2019-12-12T18:01:20
2019-12-12T18:01:20
205,217,883
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
//CS 200 //FALL 2019 //LUIS ROSALES //INSTRUCTOR: Y. GUTSTEIN //WS 11B //DUE 12-04-2019 //FILE NAME: WS11bSwapping.java import java.util.Scanner; public class WS11bSwapping { public static void main (String[] args) { Scanner kbd = new Scanner(System.in); System.out.print("Total numbers to input? "); int total = kbd.nextInt(); System.out.print("Enter numbers: "); int[] array = new int[total]; for (int i=0; i < array.length; i++) array[i] = kbd.nextInt(); array = swapEnds(array); for (int i = 0; i < array.length; i++) System.out.print(array[i] + " "); System.out.println(); } public static int[] swapEnds(int[]nums) { int temp = nums[0]; nums[0] = nums[nums.length-1]; nums[nums.length-1] = temp; return nums; } }
b72e81aacb1b5cadd89bcf976dafe01715eb7b42
6ba3c8a23348423934c0d7c1173a31f720b40074
/pms/pms-module/pms-core/src/main/java/priv/yzwbblan/pms/base/util/MD5Util.java
e0ae90f8bd4a35e77f3e159e08f210b25d0414d4
[ "Apache-2.0" ]
permissive
ZG0nn71/pms
cdecb2dede68da03018909f66e34b32c373baa14
874e6c3b2c9f818d1ccfe10a0e2dfb8cf50c8f2d
refs/heads/master
2023-05-02T19:51:58.425892
2021-05-26T07:15:53
2021-05-26T07:15:53
363,602,672
1
0
null
null
null
null
UTF-8
Java
false
false
1,122
java
package priv.yzwbblan.pms.base.util; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * MD5加密类(封装jdk自带的md5加密方法) * * @author fengshuonan * @date 2016年12月2日 下午4:14:22 */ public class MD5Util { public static String encrypt(String source) { return encodeMd5(source.getBytes()); } private static String encodeMd5(byte[] source) { try { return encodeHex(MessageDigest.getInstance("MD5").digest(source)); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e.getMessage(), e); } } private static String encodeHex(byte[] bytes) { StringBuffer buffer = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { if (((int) bytes[i] & 0xff) < 0x10) buffer.append("0"); buffer.append(Long.toString((int) bytes[i] & 0xff, 16)); } return buffer.toString(); } public static void main(String[] args) { System.out.println(encrypt("123456")); } }
e713369703d13e8150509774d9bb738cba1f8ab3
8dcdf1748ac6a0466b933d6f1469a938aab6df54
/kodilla-good-patterns/src/main/java/com/kodilla/good/patterns/challenges/food2door/HealthyShop.java
844f3fb35a159d205fd505cc44ac56d75b9fd937
[]
no_license
brzezyn/modul-6.1
600b8e18124bb5e76d03b2d835a360bb10900d6f
fc55458d3167187903c3366d7f159fdcef778dbd
refs/heads/master
2023-05-04T22:53:22.381410
2021-05-25T08:31:52
2021-05-25T08:31:52
302,575,913
0
0
null
null
null
null
UTF-8
Java
false
false
297
java
package com.kodilla.good.patterns.challenges.food2door; import java.util.Map; public class HealthyShop implements OrderService { public boolean process(OrderRequest orderRequest, Map<String, Integer> productsAvailable) { System.out.println("Process 1"); return true; } }
be0eb6507ef433716791f58cbe119876f7872ad8
40619e3443cee989d262011b16d0103058218806
/heavycenter/src/main/java/com/siweisoft/heavycenter/module/acct/role/RoleFrag.java
4f949775134462faa4079df49a538c82fb21f959
[]
no_license
summerviwox/ZX
227b75a2178bdfef9b97786af4f0fc7db7822591
fe5bbe8b11f90ac0b154324eef3542ea84784df0
refs/heads/master
2020-12-05T10:17:45.665391
2020-01-06T10:57:40
2020-01-06T10:57:40
232,078,243
0
1
null
null
null
null
UTF-8
Java
false
false
3,535
java
package com.siweisoft.heavycenter.module.acct.role; //by summer on 2017-12-18. import android.os.Bundle; import android.view.View; import com.android.lib.network.news.UINetAdapter; import com.android.lib.util.IntentUtil; import com.android.lib.util.ToastUtil; import com.android.lib.util.fragment.two.FragManager2; import com.siweisoft.heavycenter.R; import com.siweisoft.heavycenter.base.AppFrag; import com.siweisoft.heavycenter.data.locd.LocalValue; import com.siweisoft.heavycenter.data.netd.acct.login.LoginResBean; import com.siweisoft.heavycenter.data.netd.user.usertype.UserTypeReqBean; import com.siweisoft.heavycenter.data.netd.user.usertype.UserTypeResBean; import com.siweisoft.heavycenter.module.acct.acct.AcctAct; import com.siweisoft.heavycenter.module.main.main.MainAct; import butterknife.OnClick; public class RoleFrag extends AppFrag<RoleUIOpe,RoleDAOpe>{ public static String 直接登录 = "直接登录"; public static RoleFrag getInstance(boolean login){ RoleFrag roleFrag = new RoleFrag(); roleFrag.setArguments(new Bundle()); roleFrag.getArguments().putBoolean(直接登录,login); return roleFrag; } @OnClick({R.id.tv_notdriver,R.id.tv_driver}) public void onClick(final View vv){ super.onClick(vv); getUI().showTip(R.id.tv_driver==vv.getId(),new View.OnClickListener() { @Override public void onClick(final View v) { switch (v.getId()){ case R.id.tv_sure: getDE().login(LocalValue.get登录参数(), new UINetAdapter<LoginResBean>(RoleFrag.this,UINetAdapter.Loading) { @Override public void onSuccess(LoginResBean o) { getUI().getUserTypeReqBean().setId(o.getUserId()); getUI().getUserTypeReqBean().setUserType((R.id.tv_driver==vv.getId())?UserTypeReqBean.驾驶员 :UserTypeReqBean.非驾驶员); LocalValue.save登录返回信息(o); getDE().setUserType(getUI().getUserTypeReqBean(), new UINetAdapter<UserTypeResBean>(RoleFrag.this,UINetAdapter.Loading) { @Override public void onSuccess(UserTypeResBean o) { ToastUtil.getInstance().showShort(getContext(),"设置用户角色成功"); if(getArguments().getBoolean(直接登录,false)){ LoginResBean resBean = LocalValue.get登录返回信息(); resBean.setUserType((R.id.tv_driver==vv.getId())?UserTypeReqBean.驾驶员 :UserTypeReqBean.非驾驶员); LocalValue.save登录返回信息(resBean); IntentUtil.startActivityWithFinish(getBaseUIAct(), MainAct.class,null); }else{ getBaseUIAct().onBackPressed(); } } }); } }); break; } FragManager2.getInstance().setFinishAnim(R.anim.fade_in,R.anim.fade_out).finish(getBaseUIAct(), AcctAct.账号,true); } }); } }
5e799ddc2fb9993b4cb9db98576076f3ce27f28a
1067224e87046fe0d0138ec24ad210c4d0338cb8
/InterviewQuestions/HashMap/src/hashmap/HashTable.java
55ec2c4b6a09afcfcd998786172a0fdbaec7d9ea
[]
no_license
lovelylavs/InterviewQuestions
f021339dd0338bbad3cb82bb90e34877f6086dee
aa932f85d82e387707f8d3d22892ba5efa52124c
refs/heads/master
2021-01-10T07:38:04.005810
2020-05-15T06:50:28
2020-05-15T06:50:28
45,262,671
0
0
null
null
null
null
UTF-8
Java
false
false
2,263
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 hashmap; /** * * @author Lavanya */ public class HashTable { private Item[] data; private int capacity; private int size; private static final Item AVAILABLE = new Item("Available",null); public HashTable(int capacity) { this.capacity = capacity; data = new Item[capacity]; for(int i=0;i<data.length;i++) { data[i]=AVAILABLE; } size = 0; } public int size() { return size; } public int hashThis(String key) { return key.hashCode() % capacity;//hashCode returns a hash code for this string } public Object get(String key) { int hash = hashThis(key); while(data[hash] != AVAILABLE && (!data[hash].getKey().equals(key))) { hash = (hash +1) % capacity; } return data[hash].getElement(); } public void put(String key,Object element) { if(key!= null) { size++; int hash = hashThis(key); while(data[hash] != AVAILABLE && (!data[hash].getKey().equals(key))) { hash = (hash +1) % capacity; } data[hash] = new Item(key,element); } } public Object remove(String key) { throw new UnsupportedOperationException("Can't remove"); } public String toString() { String s = "<HashTable["; for(int i =0;i<this.capacity ; i++) { if(data[i].getElement() != null) { s += data[i].toString(); if(i<this.size -1) { s+=","; } } } s += "]>"; return s; } public static void main(String args[]) { HashTable hm = new HashTable(5); hm.put("1", "a"); String x = hm.toString(); System.out.println(x); hm.put("2","b"); String y = hm.toString(); System.out.println(y); } }
5b42706cebc7f18b824a8f7ab36326c2003a1ada
ecf06a6fc1d7a6557442c807673cbd546bf491a7
/src/java/jdbc/GenerateReport.java
ae3c3c5ee90e1ffd429d1c564a36fbb41755810f
[]
no_license
praveen7523/Fire_Fitness
c6bd1271a96f085902038242d60ea08cd335a499
e074533b477cdc52dbcad065aa3c97785e9c5b79
refs/heads/master
2023-06-01T17:38:09.749966
2020-04-25T15:19:47
2020-04-25T15:19:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,806
java
package jdbc; import java.sql.*; import java.util.ArrayList; import java.util.Date; public class GenerateReport { private java.sql.Date date; private String activity; private DBConnection db = new DBConnection(); private Connection newCon = null; //private ArrayList timetable = new ArrayList<>(); private ResultSet result = null; public GenerateReport() {} public GenerateReport(java.sql.Date d, String activity) { this.date = d; this.activity = activity; } public String generateDay() throws ClassNotFoundException, SQLException { String dayInString = null; String query = null; if (db.isConnected()) { newCon = DBConnection.getCon(); int day = date.getDay(); switch (day) { case 0 : dayInString = "Sunday"; break; case 1 : dayInString = "Monday"; break; case 2 : dayInString = "Tuesday"; break; case 3 : dayInString = "Wednesday"; break; case 4 : dayInString = "Thursday"; break; case 5 : dayInString = "Friday"; break; case 6 : dayInString = "Saturday"; break; } Statement stmt = newCon.createStatement(); if (activity.equalsIgnoreCase("Sport")) { query = "select * from sports_trainer_schedule where day = '" +dayInString+ "'"; } else if (activity.equalsIgnoreCase("Gym")) { query = "select * from trainer_schedule where day = '" +dayInString+ "'"; } ResultSet rs = stmt.executeQuery(query); if (rs.next()) return dayInString; else return null; } else return null; } public ResultSet getTimeTable() throws ClassNotFoundException, SQLException, NoRecordFoundException { String day = generateDay(); String query = null; if (db.isConnected()) { newCon = DBConnection.getCon(); Statement stmt = newCon.createStatement(); if (activity.equalsIgnoreCase("Gym")) query = "SELECT s.Name, sp.workout_name, sc.start_time, sc.end_time FROM trainer s, trainer_schedule sts, workout sp, schedule sc where s.Trainer_ID = sts.trainer_ID AND sp.workout_ID = s.Specialization AND sts.schedule_ID = sc.schedule_ID AND sts.day = '" +day+ "'"; else if (activity.equalsIgnoreCase("Sport")) query = "SELECT s.trainer_name, sp.sport_name, sc.start_time, sc.end_time FROM sports_trainer s, sports_trainer_schedule sts, sports sp, schedule sc where s.trainer_ID = sts.trainer_ID AND sp.sport_ID = s.sport AND sts.schedule_ID = sc.schedule_ID AND sts.day = '" +day+ "'"; result = stmt.executeQuery(query); if (result != null) return result; else throw new NoRecordFoundException(); } else return null; } public java.sql.Date getSearchDate() { return this.date; } public String getActivity() { return this.activity; } }
aaf1ef8f969d2bc2873c16f4b89a411a1ad328b6
28b7651affdf2f1c2cacf7e0f7e0f95e514a3de5
/src/main/java/com/tomgibara/coding/CodedReader.java
c757545c0146b315b668c2fb064212d3b4e84fa4
[ "Apache-2.0" ]
permissive
lequietriot/coding
c0e640b6f72746ea359e5669fabbbe0c389c1610
1ba3b05c7b226f258974af2b931266c7e67fa831
refs/heads/master
2022-12-31T21:29:47.397823
2016-11-19T12:25:36
2016-11-19T12:25:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,205
java
/* * Copyright 2011 Tom Gibara * * 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.tomgibara.coding; import java.io.Reader; import java.math.BigDecimal; import java.math.BigInteger; import com.tomgibara.bits.BitReader; import com.tomgibara.bits.BitStreamException; /** * Pairs a {@link Reader} with an {@link ExtendedCoding} to provide a convenient * way of reading coded data. * * @author Tom Gibara * */ public class CodedReader { // fields private final BitReader reader; private final ExtendedCoding coding; // constructors /** * Creates a coded reader. * * @param reader * the reader from which bits will be read * @param coding * used to decode the bits into values */ public CodedReader(BitReader reader, ExtendedCoding coding) { if (reader == null) throw new IllegalArgumentException("null reader"); if (coding == null) throw new IllegalArgumentException("null coding"); this.reader = reader; this.coding = coding; } // accessors /** * The reader that supplies the bits for the coding. * * @return the bit reader */ public BitReader getReader() { return reader; } /** * The coding that decodes the bits. * * @return the coding */ public ExtendedCoding getCoding() { return coding; } // methods /** * Decodes a positive integer from the reader. * * @return an integer greater than or equal to zero * @throws BitStreamException * if there was a problem reading bits from the stream */ public int readPositiveInt() { return coding.decodePositiveInt(reader); } /** * Decodes a positive long from the reader. * * @return a long greater than or equal to zero * @throws BitStreamException * if there was a problem reading bits from the stream */ public long readPositiveLong() { return coding.decodePositiveLong(reader); } /** * Decodes a positive BigInteger from the reader. * * @return a BigInteger greater than or equal to zero * @throws BitStreamException * if there was a problem reading bits from the stream */ public BigInteger readPositiveBigInt() { return coding.decodePositiveBigInt(reader); } /** * Decodes an integer from the reader. * * @return an integer * @throws BitStreamException * if there was a problem reading bits from the stream */ public int readInt() { return coding.decodeInt(reader); } /** * Decodes a long from the reader. * * @return a long * @throws BitStreamException * if there was a problem reading bits from the stream */ public long readLong() { return coding.decodeLong(reader); } /** * Decodes a BigInteger from the reader. * * @return a BigInteger * @throws BitStreamException * if there was a problem reading bits from the stream */ public BigInteger readBigInt() { return coding.decodeBigInt(reader); } /** * Decodes a float from the reader. * * @return a float * @throws BitStreamException * if there was a problem reading bits from the stream */ public float readFloat() { return coding.decodeFloat(reader); } /** * Decodes a double from the reader. * * @return a double * @throws BitStreamException * if there was a problem reading bits from the stream */ public double readDouble() { return coding.decodeDouble(reader); } /** * Decodes a BigDecimal from the reader. * * @return a BigDecimal * @throws BitStreamException * if there was a problem reading bits from the stream */ public BigDecimal readDecimal() { return coding.decodeDecimal(reader); } }
747babff889b5e795f060f694bd56218e7cfa790
88889ec386935f4c60369b25ca2c2e0b295e60a1
/movie_review_API/src/main/java/com/company/movie_review/movie_review/movie_review/cast/generated/GeneratedCastCacheHolder.java
46986b85fcc8334954236f81a02f21bca62f87f2
[]
no_license
nameless2708/Greenwich-final
d347397d57fca64b0124a4c67b26d0d2c7efcf96
cdd3b0e12d249f9ea9e6da134a455b009c49827e
refs/heads/master
2022-03-19T01:18:47.339992
2019-11-22T16:07:45
2019-11-22T16:07:45
214,947,590
0
0
null
null
null
null
UTF-8
Java
false
false
11,137
java
package com.company.movie_review.movie_review.movie_review.cast.generated; import com.company.movie_review.movie_review.movie_review.cast.Cast; import com.company.movie_review.movie_review.movie_review.cast.CastEntityStoreSerializerImpl; import com.company.movie_review.movie_review.movie_review.cast.CastManager; import com.speedment.common.annotation.GeneratedCode; import com.speedment.common.tuple.Tuple2; import com.speedment.common.tuple.Tuples; import com.speedment.enterprise.datastore.runtime.entitystore.EntityStore; import com.speedment.enterprise.datastore.runtime.entitystore.EntityStoreHolder; import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache.OfComparable; import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache.OfInt; import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache.OfString; import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache; import com.speedment.enterprise.datastore.runtime.fieldcache.MultiFieldCache; import com.speedment.enterprise.datastore.runtime.statistic.Statistics; import com.speedment.enterprise.datastore.runtime.util.DataStoreHolderUtil; import com.speedment.enterprise.datastore.runtime.util.StatisticsUtil; import com.speedment.runtime.bulk.PersistOperation; import com.speedment.runtime.bulk.RemoveOperation; import com.speedment.runtime.bulk.UpdateOperation; import com.speedment.runtime.config.identifier.ColumnIdentifier; import com.speedment.runtime.config.identifier.ColumnLabel; import com.speedment.runtime.config.identifier.TableIdentifier; import com.speedment.runtime.core.component.StreamSupplierComponent; import com.speedment.runtime.field.Field; import com.speedment.runtime.field.trait.HasIdentifier; import java.sql.Date; import java.util.Arrays; import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.stream.Stream; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.toMap; import static java.util.stream.Collectors.toSet; /** * A holder class for the various caches that are used to speed up the {@link * CastManager}. * * Generated by * com.speedment.enterprise.datastore.generator.internal.code.GeneratedEntityCacheHolderTranslator * <p> * This file has been automatically generated by Speedment. Any changes made to * it will be overwritten. * * @author Speedment */ @GeneratedCode("Speedment") public final class GeneratedCastCacheHolder implements EntityStoreHolder<Cast> { private final EntityStore<Cast> entityStore; private final OfInt fieldIdCache; private final OfString fieldCastNameCache; private final OfInt fieldCastGenderCache; private final OfString fieldCastImageCache; private final OfString fieldCastDescriptionCache; private final OfComparable<Date> fieldCastBirthdayCache; public GeneratedCastCacheHolder( EntityStore<Cast> entityStore, OfInt fieldIdCache, OfString fieldCastNameCache, OfInt fieldCastGenderCache, OfString fieldCastImageCache, OfString fieldCastDescriptionCache, OfComparable<Date> fieldCastBirthdayCache) { this.entityStore = requireNonNull(entityStore); this.fieldIdCache = requireNonNull(fieldIdCache); this.fieldCastNameCache = requireNonNull(fieldCastNameCache); this.fieldCastGenderCache = requireNonNull(fieldCastGenderCache); this.fieldCastImageCache = requireNonNull(fieldCastImageCache); this.fieldCastDescriptionCache = requireNonNull(fieldCastDescriptionCache); this.fieldCastBirthdayCache = requireNonNull(fieldCastBirthdayCache); } @Override public EntityStore<Cast> getEntityStore() { return entityStore; } @Override @SuppressWarnings("unchecked") public <CACHE extends FieldCache<CACHE>> CACHE getFieldCache(ColumnIdentifier<Cast> columnId) { if (columnId instanceof Cast.Identifier) { final Cast.Identifier _id = (Cast.Identifier) columnId; switch (_id) { case ID : return (CACHE) fieldIdCache; case CAST_NAME : return (CACHE) fieldCastNameCache; case CAST_GENDER : return (CACHE) fieldCastGenderCache; case CAST_IMAGE : return (CACHE) fieldCastImageCache; case CAST_DESCRIPTION : return (CACHE) fieldCastDescriptionCache; case CAST_BIRTHDAY : return (CACHE) fieldCastBirthdayCache; default : { throw new UnsupportedOperationException( String.format("Unknown enum constant '%s'.", _id) ); } } } else { final String _colName = columnId.getColumnId(); switch (_colName) { case "ID" : return (CACHE) fieldIdCache; case "Cast_name" : return (CACHE) fieldCastNameCache; case "Cast_gender" : return (CACHE) fieldCastGenderCache; case "Cast_image" : return (CACHE) fieldCastImageCache; case "Cast_description" : return (CACHE) fieldCastDescriptionCache; case "Cast_birthday" : return (CACHE) fieldCastBirthdayCache; default : { throw new UnsupportedOperationException( String.format("Unknown column name '%s'.", _colName) ); } } } } @Override public boolean isHavingMultiFieldCache(ColumnIdentifier<Cast> columnId) { return false; } public static CompletableFuture<GeneratedCastCacheHolder> reload(StreamSupplierComponent streamSupplier, ExecutorService executor) { return reload(DataStoreHolderUtil.buildEntityStore( streamSupplier, executor, CastEntityStoreSerializerImpl::new, TableIdentifier.of("movie_review", "movie_review", "cast") ), executor); } @Override public EntityStoreHolder<Cast> recycleAndPersist(PersistOperation<Cast> persistOperation) { return wrapped().recycleAndPersist(persistOperation); } @Override public EntityStoreHolder<Cast> recycleAndRemove(RemoveOperation<Cast> removeOperation) { return wrapped().recycleAndRemove(removeOperation); } @Override public EntityStoreHolder<Cast> recycleAndUpdate(UpdateOperation<Cast> updateOperation) { return wrapped().recycleAndUpdate(updateOperation); } private EntityStoreHolder<Cast> wrapped() { // Use explicit type for Stream to improve compilation time. final Map<ColumnLabel, FieldCache<?>> fieldCaches = Stream.<Tuple2<HasIdentifier<Cast>, FieldCache<?>>>of( Tuples.of(Cast.ID, fieldIdCache), Tuples.of(Cast.CAST_NAME, fieldCastNameCache), Tuples.of(Cast.CAST_GENDER, fieldCastGenderCache), Tuples.of(Cast.CAST_IMAGE, fieldCastImageCache), Tuples.of(Cast.CAST_DESCRIPTION,fieldCastDescriptionCache), Tuples.of(Cast.CAST_BIRTHDAY, fieldCastBirthdayCache) ) .collect(toMap(t2 -> t2.get0().identifier().label(), Tuple2::get1)); final Map<ColumnLabel, Map<ColumnLabel, MultiFieldCache<?, ?, ?>>> multiFieldCaches = createMultiCacheMap(); final Set<ColumnIdentifier<Cast>> columnIdentifiers = Stream.<HasIdentifier<Cast>>of( Cast.ID, Cast.CAST_NAME, Cast.CAST_GENDER, Cast.CAST_IMAGE, Cast.CAST_DESCRIPTION, Cast.CAST_BIRTHDAY ) .map(HasIdentifier::identifier) .collect(toSet()); return EntityStoreHolder.of( entityStore, fieldCaches, multiFieldCaches, columnIdentifiers ); } public static CompletableFuture<GeneratedCastCacheHolder> reload(CompletableFuture<EntityStore<Cast>> entityStoreFuture, ExecutorService executor) { final CompletableFuture<FieldCache.OfInt> fieldIdCacheFuture = DataStoreHolderUtil.buildIntCache(entityStoreFuture, executor, Cast.ID, FieldCache.DISTINCT); final CompletableFuture<FieldCache.OfString> fieldCastNameCacheFuture = DataStoreHolderUtil.buildStringCache(entityStoreFuture, executor, Cast.CAST_NAME, 0); final CompletableFuture<FieldCache.OfInt> fieldCastGenderCacheFuture = DataStoreHolderUtil.buildIntCache(entityStoreFuture, executor, Cast.CAST_GENDER, 0); final CompletableFuture<FieldCache.OfString> fieldCastImageCacheFuture = DataStoreHolderUtil.buildStringCache(entityStoreFuture, executor, Cast.CAST_IMAGE, 0); final CompletableFuture<FieldCache.OfString> fieldCastDescriptionCacheFuture = DataStoreHolderUtil.buildStringCache(entityStoreFuture, executor, Cast.CAST_DESCRIPTION, 0); final CompletableFuture<FieldCache.OfComparable<Date>> fieldCastBirthdayCacheFuture = DataStoreHolderUtil.buildComparableCache(entityStoreFuture, executor, Cast.CAST_BIRTHDAY, 0); return entityStoreFuture.thenApplyAsync(entityStore -> { try { return new GeneratedCastCacheHolder( entityStore, fieldIdCacheFuture.get(), fieldCastNameCacheFuture.get(), fieldCastGenderCacheFuture.get(), fieldCastImageCacheFuture.get(), fieldCastDescriptionCacheFuture.get(), fieldCastBirthdayCacheFuture.get() ); } catch (final ExecutionException | InterruptedException ex) { throw new RuntimeException(ex); } }); } @Override public void close() { entityStore.close(); fieldIdCache.close(); fieldCastNameCache.close(); fieldCastGenderCache.close(); fieldCastImageCache.close(); fieldCastDescriptionCache.close(); fieldCastBirthdayCache.close(); } @Override public Statistics getStatistics() { return StatisticsUtil.getStatistics( this, entityStore.identifier(), Arrays.asList( Cast.Identifier.ID, Cast.Identifier.CAST_NAME, Cast.Identifier.CAST_GENDER, Cast.Identifier.CAST_IMAGE, Cast.Identifier.CAST_DESCRIPTION, Cast.Identifier.CAST_BIRTHDAY ) ); } private Map<ColumnLabel, Map<ColumnLabel, MultiFieldCache<?, ?, ?>>> createMultiCacheMap() { return Collections.emptyMap(); } }
4d4ff8489f913d70b906c6c91d79f5081e2300d6
47070c01274f0133acc48f22a40819b943f828dc
/app/src/main/java/com/example/tianjun/projecttest/SQLite/Baskbar/BaskbarDaoMaster.java
57247f8c1f88f9e72aa060c55c07bcb44145d1ab
[]
no_license
Summ1995/ProjectTest
d88cd75233ef601caa244ee930b7fd27c6794bb2
04f3670374dfc22ef232ae26ebfac0f5937324ba
refs/heads/master
2020-12-07T10:59:54.256159
2016-09-19T02:29:23
2016-09-19T02:29:23
67,221,580
0
0
null
null
null
null
UTF-8
Java
false
false
3,334
java
package com.example.tianjun.projecttest.SQLite.Baskbar; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.util.Log; import org.greenrobot.greendao.AbstractDaoMaster; import org.greenrobot.greendao.database.StandardDatabase; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseOpenHelper; import org.greenrobot.greendao.identityscope.IdentityScopeType; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * Master of DAO (schema version 1): knows all DAOs. */ public class BaskbarDaoMaster extends AbstractDaoMaster { public static final int SCHEMA_VERSION = 1; /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { BaskbarDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { BaskbarDao.dropTable(db, ifExists); } /** * WARNING: Drops all table on Upgrade! Use only during development. * Convenience method using a {@link DevOpenHelper}. */ public static BaskbarDaoSession newDevSession(Context context, String name) { Database db = new DevOpenHelper(context, name).getWritableDb(); BaskbarDaoMaster daoMaster = new BaskbarDaoMaster(db); return daoMaster.newSession(); } public BaskbarDaoMaster(SQLiteDatabase db) { this(new StandardDatabase(db)); } public BaskbarDaoMaster(Database db) { super(db, SCHEMA_VERSION); registerDaoClass(BaskbarDao.class); } public BaskbarDaoSession newSession() { return new BaskbarDaoSession(db, IdentityScopeType.Session, daoConfigMap); } public BaskbarDaoSession newSession(IdentityScopeType type) { return new BaskbarDaoSession(db, type, daoConfigMap); } /** * Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} - */ public static abstract class OpenHelper extends DatabaseOpenHelper { public OpenHelper(Context context, String name) { super(context, name, SCHEMA_VERSION); } public OpenHelper(Context context, String name, CursorFactory factory) { super(context, name, factory, SCHEMA_VERSION); } @Override public void onCreate(Database db) { Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION); createAllTables(db, false); } } /** WARNING: Drops all table on Upgrade! Use only during development. */ public static class DevOpenHelper extends OpenHelper { public DevOpenHelper(Context context, String name) { super(context, name); } public DevOpenHelper(Context context, String name, CursorFactory factory) { super(context, name, factory); } @Override public void onUpgrade(Database db, int oldVersion, int newVersion) { Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables"); dropAllTables(db, true); onCreate(db); } } }
0e2bf05124cf5db23f69dadee846d011d355add0
569c073d5468431b3dba510bbee60578e020a427
/app/src/main/java/org/piwigo/internal/di/module/ApiModule.java
3fac0f282bbe2aa648e2aa2848fc2a5b52632cf6
[]
no_license
jeff-amn/Piwigo-Android-JCAWork
e43853fa2c7058386ad5d45210ccd9337e932f9f
1ef2879f10fa767e0cbfc2530f0d81ee27e3f70d
refs/heads/master
2021-09-24T18:54:47.199656
2017-10-01T19:38:57
2017-10-01T19:38:57
104,969,642
0
0
null
null
null
null
UTF-8
Java
false
false
3,000
java
/* * Copyright 2015 Phil Bayfield https://philio.me * Copyright 2015 Piwigo Team http://piwigo.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 org.piwigo.internal.di.module; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.squareup.okhttp.OkHttpClient; import org.piwigo.BuildConfig; import org.piwigo.io.DynamicEndpoint; import org.piwigo.io.RestService; import org.piwigo.io.Session; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RequestInterceptor; import retrofit.RestAdapter; import retrofit.client.OkClient; import retrofit.converter.GsonConverter; import rx.Scheduler; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; import static retrofit.RestAdapter.LogLevel.FULL; import static retrofit.RestAdapter.LogLevel.NONE; @Module public class ApiModule { @Provides @Singleton Session provideSession() { return new Session(); } @Provides @Singleton DynamicEndpoint provideDynamicEndpoint() { return new DynamicEndpoint(); } @Provides @Singleton RequestInterceptor provideRequestInterceptor(Session session) { return request -> { request.addQueryParam("format", "json"); if (session.getCookie() != null) { request.addHeader("Cookie", "pwg_id=" + session.getCookie()); } }; } @Provides @Singleton Gson provideGson() { return new GsonBuilder() .setDateFormat("yyyy-MM-dd HH:mm:ss") .create(); } @Provides @Singleton RestAdapter provideRestAdapter(OkHttpClient client, DynamicEndpoint endpoint, RequestInterceptor interceptor, Gson gson) { return new RestAdapter.Builder() .setClient(new OkClient(client)) .setLogLevel(BuildConfig.DEBUG ? FULL : NONE) .setEndpoint(endpoint) .setRequestInterceptor(interceptor) .setConverter(new GsonConverter(gson)) .build(); } @Provides @Singleton RestService provideRestService(RestAdapter restAdapter) { return restAdapter.create(RestService.class); } @Provides @Singleton @Named("IoScheduler") Scheduler provideIoScheduler() { return Schedulers.io(); } @Provides @Singleton @Named("UiScheduler") Scheduler provideUiScheduler() { return AndroidSchedulers.mainThread(); } }
0b8f45ab1bb2084c2ddec8313b04641f9ada37b3
6e58ce5bef4a34fd90f9871f08ae06bbf417d4de
/src/main/java/com/edto/cursomc/dto/ProductDTO.java
45b4434207adff40f7cd1ca39f8f3a4c82c2e3bb
[]
no_license
Oliveira-86/coursemc
d067aa94afdf69078a7e12d4947919aa3c3ea31b
1ea6265202b49717b7d0808281ffc7120449c211
refs/heads/master
2023-01-19T05:10:56.878123
2020-11-18T16:29:44
2020-11-18T16:29:44
294,813,361
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package com.edto.cursomc.dto; import java.io.Serializable; import com.edto.cursomc.domain.Product; public class ProductDTO implements Serializable{ private static final long serialVersionUID = 1L; private Long id; private String name; private Double price; public ProductDTO() { } public ProductDTO(Product obj) { id = obj.getId(); name = obj.getName(); price = obj.getPrice(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } }
b7b96b447ae941f6dfb0be4b0dada4ed2e935b97
a51b22c7601fbc1e7d5e852f5db4614001c61b5f
/springboot/src/main/java/com/neuedu/pojo/Shipping.java
dbb8cc1bcdee442f89dbf207c063f31f0a2b63ba
[]
no_license
yuecay/shopping
160dd98fce6111c65ab06ae973aa11a23a1133ca
14f0c41d02cfc0a70b820f6f115d0aa9766bb21f
refs/heads/master
2022-11-20T00:16:11.713270
2019-12-28T07:40:29
2019-12-28T07:40:29
228,355,141
1
0
null
2022-11-16T10:31:44
2019-12-16T09:55:14
PLpgSQL
UTF-8
Java
false
false
11,335
java
package com.neuedu.pojo; import java.util.Date; public class Shipping { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.id * * @mbg.generated */ private Integer id; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.user_id * * @mbg.generated */ private Integer userId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_name * * @mbg.generated */ private String receiverName; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_phone * * @mbg.generated */ private String receiverPhone; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_mobile * * @mbg.generated */ private String receiverMobile; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_province * * @mbg.generated */ private String receiverProvince; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_city * * @mbg.generated */ private String receiverCity; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_district * * @mbg.generated */ private String receiverDistrict; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_address * * @mbg.generated */ private String receiverAddress; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.receiver_zip * * @mbg.generated */ private String receiverZip; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.create_time * * @mbg.generated */ private Date createTime; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column neuedu_shipping.update_time * * @mbg.generated */ private Date updateTime; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.id * * @return the value of neuedu_shipping.id * * @mbg.generated */ public Integer getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.id * * @param id the value for neuedu_shipping.id * * @mbg.generated */ public void setId(Integer id) { this.id = id; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.user_id * * @return the value of neuedu_shipping.user_id * * @mbg.generated */ public Integer getUserId() { return userId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.user_id * * @param userId the value for neuedu_shipping.user_id * * @mbg.generated */ public void setUserId(Integer userId) { this.userId = userId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_name * * @return the value of neuedu_shipping.receiver_name * * @mbg.generated */ public String getReceiverName() { return receiverName; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_name * * @param receiverName the value for neuedu_shipping.receiver_name * * @mbg.generated */ public void setReceiverName(String receiverName) { this.receiverName = receiverName == null ? null : receiverName.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_phone * * @return the value of neuedu_shipping.receiver_phone * * @mbg.generated */ public String getReceiverPhone() { return receiverPhone; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_phone * * @param receiverPhone the value for neuedu_shipping.receiver_phone * * @mbg.generated */ public void setReceiverPhone(String receiverPhone) { this.receiverPhone = receiverPhone == null ? null : receiverPhone.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_mobile * * @return the value of neuedu_shipping.receiver_mobile * * @mbg.generated */ public String getReceiverMobile() { return receiverMobile; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_mobile * * @param receiverMobile the value for neuedu_shipping.receiver_mobile * * @mbg.generated */ public void setReceiverMobile(String receiverMobile) { this.receiverMobile = receiverMobile == null ? null : receiverMobile.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_province * * @return the value of neuedu_shipping.receiver_province * * @mbg.generated */ public String getReceiverProvince() { return receiverProvince; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_province * * @param receiverProvince the value for neuedu_shipping.receiver_province * * @mbg.generated */ public void setReceiverProvince(String receiverProvince) { this.receiverProvince = receiverProvince == null ? null : receiverProvince.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_city * * @return the value of neuedu_shipping.receiver_city * * @mbg.generated */ public String getReceiverCity() { return receiverCity; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_city * * @param receiverCity the value for neuedu_shipping.receiver_city * * @mbg.generated */ public void setReceiverCity(String receiverCity) { this.receiverCity = receiverCity == null ? null : receiverCity.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_district * * @return the value of neuedu_shipping.receiver_district * * @mbg.generated */ public String getReceiverDistrict() { return receiverDistrict; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_district * * @param receiverDistrict the value for neuedu_shipping.receiver_district * * @mbg.generated */ public void setReceiverDistrict(String receiverDistrict) { this.receiverDistrict = receiverDistrict == null ? null : receiverDistrict.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_address * * @return the value of neuedu_shipping.receiver_address * * @mbg.generated */ public String getReceiverAddress() { return receiverAddress; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_address * * @param receiverAddress the value for neuedu_shipping.receiver_address * * @mbg.generated */ public void setReceiverAddress(String receiverAddress) { this.receiverAddress = receiverAddress == null ? null : receiverAddress.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.receiver_zip * * @return the value of neuedu_shipping.receiver_zip * * @mbg.generated */ public String getReceiverZip() { return receiverZip; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.receiver_zip * * @param receiverZip the value for neuedu_shipping.receiver_zip * * @mbg.generated */ public void setReceiverZip(String receiverZip) { this.receiverZip = receiverZip == null ? null : receiverZip.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.create_time * * @return the value of neuedu_shipping.create_time * * @mbg.generated */ public Date getCreateTime() { return createTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.create_time * * @param createTime the value for neuedu_shipping.create_time * * @mbg.generated */ public void setCreateTime(Date createTime) { this.createTime = createTime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column neuedu_shipping.update_time * * @return the value of neuedu_shipping.update_time * * @mbg.generated */ public Date getUpdateTime() { return updateTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column neuedu_shipping.update_time * * @param updateTime the value for neuedu_shipping.update_time * * @mbg.generated */ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } }
f7f53542a11bb4e3c8cb328dc87adea56475cc33
c4d54f1a461c40811d3f0874959a4971dec5bf4c
/app/src/main/java/com/ruslan_hlushen/cleanroom/receivers/BadAnswerReceiver.java
af4f773cf569f129833b395280efe0501ce90a80
[]
no_license
ruslanHlushen/CleanRoom
1260bcd4393038bbc95cdb63a568e6154f545d31
4d289600a31283696cee347040e19a39ebc72794
refs/heads/master
2021-01-11T22:10:24.027479
2017-02-24T22:27:24
2017-02-24T22:27:24
78,931,743
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.ruslan_hlushen.cleanroom.receivers; import android.content.Context; import android.content.Intent; /** * Created by Руслан on 27.11.2016. */ public class BadAnswerReceiver extends ParentAnswerReceiver { @Override public void onReceive(Context context, Intent intent) { myOnReceive(context, intent, false); } }
b98f55cffe9f5976cc09e1c6c391e59150d1c9fb
e3b1b470121d9f506e69de25ffe06a9c80beb7e9
/src/main/java/com/meicloud/model/Queue.java
f113ce86bc00f47ae6ad09528a43b4917477ad57
[]
no_license
zhougit86/MSS
a7673241c2c9c06009b54b7c209e3cf98c7142b0
5cf2072673c594e35ec6ee1a9c05fd835daf3af5
refs/heads/master
2020-04-11T07:51:00.934140
2018-12-13T10:40:41
2018-12-13T10:40:41
161,624,007
0
0
null
null
null
null
UTF-8
Java
false
false
2,716
java
package com.meicloud.model; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @ApiModel("集群信息") public class Queue { @ApiModelProperty( value = "集群编码", example = "1" ) private String queueId; @ApiModelProperty( value = "集群编码", example = "GXT_UAT", required = true ) private String queueCode; @ApiModelProperty( value = "集群名称", example = "默认集群", required = true ) private String queueName; @ApiModelProperty( value = "git地址", example = "http://10.16.28.73/IBD/bdis.git" ) private String gitUrl; @ApiModelProperty( value = "git登录账号", example = "root" ) private String gitUserName; @ApiModelProperty( value = "git登录密码", example = "123456" ) private String gitPassWord; @ApiModelProperty( value = "svn地址", example = "https://lijl38519.cn.midea.com/svn/YONGHUI/ECI/trunk/10_DEPLOY_DEV" ) private String svnUrl; @ApiModelProperty( value = "svn登录账号", example = "root" ) private String svnUserName; @ApiModelProperty( value = "svn登录密码", example = "123456" ) private String svnPassWord; public String getQueueId() { return this.queueId; } public void setQueueId(String queueId) { this.queueId = queueId; } public String getQueueCode() { return this.queueCode; } public void setQueueCode(String queueCode) { this.queueCode = queueCode; } public String getQueueName() { return this.queueName; } public void setQueueName(String queueName) { this.queueName = queueName; } public String getGitUrl() { return this.gitUrl; } public void setGitUrl(String gitUrl) { this.gitUrl = gitUrl; } public String getGitUserName() { return this.gitUserName; } public void setGitUserName(String gitUserName) { this.gitUserName = gitUserName; } public String getGitPassWord() { return this.gitPassWord; } public void setGitPassWord(String gitPassWord) { this.gitPassWord = gitPassWord; } public String getSvnUrl() { return this.svnUrl; } public void setSvnUrl(String svnUrl) { this.svnUrl = svnUrl; } public String getSvnUserName() { return this.svnUserName; } public void setSvnUserName(String svnUserName) { this.svnUserName = svnUserName; } public String getSvnPassWord() { return this.svnPassWord; } public void setSvnPassWord(String svnPassWord) { this.svnPassWord = svnPassWord; } }
820f7bc5fd0e99e1dae4cedd5c2e51224e41d414
0d4a94b90ead351554d2a252f809e56e6ce64d91
/android/app/src/main/java/com/ccrn/MainApplication.java
5eb8ba545379627417a2572edb43d2f07b433aa3
[]
no_license
pocket-law/react-native-test-cc
bbae24d933904ef85c7e58ffb611f2743ed582c2
7f3dbe03c849f62298ba19312cf1ff3b10905b0b
refs/heads/master
2020-04-18T05:47:03.049042
2019-02-08T00:04:19
2019-02-08T00:04:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,201
java
package com.ccrn; import android.app.Application; import com.facebook.react.ReactApplication; import net.no_mad.tts.TextToSpeechPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; import org.pgsqlite.SQLitePluginPackage; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new TextToSpeechPackage(), new SQLitePluginPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
045f6f5edb704d4fa8ee1b9b7397401984fe6464
951579c55d34469e7a30d806196cc67558bc23df
/extensions/addOns/typoSquat/src/main/java/org/zaproxy/zap/extension/typoSquat/actions/userActions/UserRedirectAction.java
8f2627b58ad5ec175eb8c4953f7fcf7be63c053b
[]
no_license
fluffydeer/team-project-owasp-zap
e3b1e9934d526f7caed9c33f1e0c4a46817cb131
e520ab7d96d80e4e60fb41c4518cb6885d33f27d
refs/heads/main
2023-03-06T09:44:52.751473
2021-02-24T11:36:34
2021-02-24T11:36:34
341,623,337
0
0
null
null
null
null
UTF-8
Java
false
false
1,150
java
package org.zaproxy.zap.extension.typoSquat.actions.userActions; import org.zaproxy.zap.extension.typoSquat.fileHandler.DomainHandler; import org.parosproxy.paros.network.HttpMessage; import org.zaproxy.zap.extension.typoSquat.session.SessionManager; import org.zaproxy.zap.extension.typoSquat.warningPage.TypoSquatSuggestion; public class UserRedirectAction extends AbstractUserAction { private DomainHandler domainHandler; private String redirectDomain; public UserRedirectAction(TypoSquatSuggestion suggestion, String originalDomain, DomainHandler domainHandler) { super(suggestion.getUUID(), originalDomain); this.redirectDomain = suggestion.getDomain(); this.domainHandler = domainHandler; } @Override public boolean execute(HttpMessage msg, SessionManager manager) { if (! isValid(uuid, originalDomain)) { throw new IllegalArgumentException("UUID does not match domain."); } domainHandler.addToBlackList(originalDomain, redirectDomain); this.invalidateOtherActions(manager); return this.setRedirectResponse(msg, redirectDomain); } }
ae851313f440ce57fc1911b2647a5ebec53bc4bb
5336396efa4e9fa77e8052ec5dc98ab9af85b783
/app/src/main/java/me/uptop/mvpgoodpractice/data/network/RestService.java
f7e45cd42fa87e13195d860102c6f76b6f740120
[]
no_license
posix-dev/Shop
948a0d6b01feba1a8ecaf4a6af29224cdb22f404
d35e0df1208ed4f17d6aa9ef1328c6296580c0d0
refs/heads/master
2021-06-15T02:37:11.397841
2017-04-01T08:10:26
2017-04-01T08:10:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,366
java
package me.uptop.mvpgoodpractice.data.network; import java.util.List; import me.uptop.mvpgoodpractice.data.network.req.UserLoginReq; import me.uptop.mvpgoodpractice.data.network.res.AvatarUrlRes; import me.uptop.mvpgoodpractice.data.network.res.ProductRes; import me.uptop.mvpgoodpractice.data.network.res.UserRes; import me.uptop.mvpgoodpractice.data.network.res.models.AddCommentRes; import me.uptop.mvpgoodpractice.data.network.res.models.Comments; import me.uptop.mvpgoodpractice.utils.ConstantManager; import okhttp3.MultipartBody; import retrofit2.Response; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.Path; import rx.Observable; public interface RestService { @GET("products") Observable<Response<List<ProductRes>>> getProductResObs (@Header(ConstantManager.IF_MODIFIED_SINCE_HEADER) String lastEntityUpdate); @POST("products/{id}/comments") Observable<Comments> sendCommentToServer(@Path("id") String id, @Body AddCommentRes post); @Multipart @POST("avatar") Observable<AvatarUrlRes> uploadUserAvatar(@Part MultipartBody.Part file); @POST("login") Observable<Response<UserRes>> loginUser(@Body UserLoginReq userLoginReq); }
cbf1fc76baab6afb829970f289c99a98dc66d5ae
6c4b3ce3e12c5a8ceda91006dfaceddbcd5908aa
/com/afrisoftech/hospital/CreditFinalInPatientlnvPdf.java
96f032532cda0b387a442ebbf6a454466604d7de
[]
no_license
josefloso/FunsoftHMIS
a34bcc6f88c15e85069804814ecef1f9738d7576
0ba481260737382e57ac2c674acd03e00e9dde90
refs/heads/master
2021-01-15T22:20:32.504511
2015-12-01T07:02:42
2015-12-01T07:02:42
50,920,224
1
0
null
2016-02-02T12:49:53
2016-02-02T12:49:53
null
UTF-8
Java
false
false
42,538
java
//Author Charles Waweru //Made to test Java support for Threads. //Revision : Ver 1.0a //import java.lang.*; package com.afrisoftech.hospital; import java.awt.Point; import java.awt.Color; import java.io.FileOutputStream; import java.io.IOException; import com.lowagie.text.*; import com.lowagie.text.pdf.PdfWriter; import com.lowagie.text.pdf.*; public class CreditFinalInPatientlnvPdf implements java.lang.Runnable { java.lang.String MNo = null; com.afrisoftech.lib.DBObject dbObject; java.util.Date beginDate = null; java.lang.String endDate = null; double osBalance = 0.00; double osBalance1 = 0.00; double current = 0.00; public static java.sql.Connection connectDB = null; public java.lang.String dbUserName = null; org.netbeans.lib.sql.pool.PooledConnectionSource pConnDB = null; boolean threadCheck = true; // java.lang.String memNo2Use = null; java.lang.Thread threadSample; com.lowagie.text.Font pFontHeader = FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL); com.lowagie.text.Font pFontHeader1 = FontFactory.getFont(FontFactory.HELVETICA, 9, Font.BOLD); // com.lowagie.text.ParagraphFont pgraph = Paragraph(); com.lowagie.text.Font pFontHeader11 = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD); java.lang.Runtime rtThreadSample = java.lang.Runtime.getRuntime(); java.lang.Process prThread; public void CreditFinalInPatientInvPdf(java.sql.Connection connDb, java.lang.String combox) { MNo = combox; //beginDate = begindate; connectDB = connDb; dbObject = new com.afrisoftech.lib.DBObject(); // beginDate = begindate; // endDate = endate; threadSample = new java.lang.Thread(this,"SampleThread"); System.out.println("threadSample created"); threadSample.start(); System.out.println("threadSample fired"); } public static void main(java.lang.String[] args) { // new MemberStatementPdf().MemberStatementPdf(args[0]); } public void run() { System.out.println("System has entered running mode"); while (threadCheck) { System.out.println("O.K. see how we execute target program"); this.generatePdf(MNo); try { System.out.println("Right, let's wait for task to complete of fail"); java.lang.Thread.currentThread().sleep(100); System.out.println("It's time for us threads to get back to work after the nap"); } catch(java.lang.InterruptedException IntExec) { System.out.println(IntExec.getMessage()); } threadCheck = false; System.out.println("We shall be lucky to get back to start in one piece"); } if (!threadCheck) { Thread.currentThread().stop(); } } public java.lang.String getDateLable() { java.lang.String date_label = null; java.lang.String month_now_strs = null; java.lang.String date_now_strs = null; java.lang.String year_now_strs = null; java.lang.String minute_now_strs = null; java.lang.String hour_now_strs = null; java.lang.Runtime rt = java.lang.Runtime.getRuntime(); java.util.Calendar calinst = java.util.Calendar.getInstance(); java.util.Date date_now = calinst.getTime(); int date_now_str = date_now.getDate(); int month_now_str = date_now.getMonth(); int year_now_str = date_now.getYear(); int hour_now_str = date_now.getHours(); int minute_now_str = date_now.getMinutes(); int year_now_abs = year_now_str - 100; if (year_now_abs < 10) { year_now_strs = "200"+year_now_abs; } else { year_now_strs = "20"+year_now_abs; } switch (month_now_str) { case 0 : month_now_strs = "JAN"; break; case 1 : month_now_strs = "FEB"; break; case 2 : month_now_strs = "MAR"; break; case 3 : month_now_strs = "APR"; break; case 4 : month_now_strs = "MAY"; break; case 5 : month_now_strs = "JUN"; break; case 6 : month_now_strs = "JUL"; break; case 7 : month_now_strs = "AUG"; break; case 8 : month_now_strs = "SEP"; break; case 9 : month_now_strs = "OCT"; break; case 10 : month_now_strs = "NOV"; break; case 11 : month_now_strs = "DEC"; break; default : if (month_now_str < 10){ month_now_strs = "0"+month_now_str; } else { month_now_strs = ""+month_now_str; } } if (date_now_str < 10) { date_now_strs = "0"+date_now_str; } else { date_now_strs = ""+date_now_str; } if (minute_now_str < 10) { minute_now_strs = "0"+minute_now_str; } else { minute_now_strs = ""+minute_now_str; } if (hour_now_str < 10) { hour_now_strs = "0"+hour_now_str; } else { hour_now_strs = ""+hour_now_str; } date_label = date_now_strs+month_now_strs+year_now_strs+"@"+hour_now_strs+minute_now_strs; return date_label; } public void generatePdf(java.lang.String memNo) { java.lang.Process wait_for_Pdf2Show; java.util.Calendar cal = java.util.Calendar.getInstance(); java.util.Date dateStampPdf = cal.getTime(); java.lang.String pdfDateStamp = dateStampPdf.toString(); try { java.io.File tempFile = java.io.File.createTempFile("REP"+this.getDateLable()+"_", ".pdf"); tempFile.deleteOnExit(); java.lang.Runtime rt = java.lang.Runtime.getRuntime(); java.lang.String debitTotal = null; java.lang.String creditTotal = null; com.lowagie.text.Document docPdf = new com.lowagie.text.Document(); try { try { com.lowagie.text.pdf.PdfWriter.getInstance(docPdf, new java.io.FileOutputStream(tempFile)); String compName = null; String date = null; String Messg = null; try { java.sql.Statement st31 = connectDB.createStatement(); // java.sql.Statement st4 = connectDB.createStatement(); java.sql.ResultSet rset2 = st31.executeQuery("select name from pb_notice"); // java.sql.ResultSet rset2 = st3.executeQuery("SELECT hospital_name from pb_hospitalprofile"); // java.sql.ResultSet rset4 = st4.executeQuery("SELECT date('now') as Date"); while(rset2.next()){ Messg = rset2.getString(1); } com.lowagie.text.HeaderFooter footer = new com.lowagie.text.HeaderFooter(new Phrase(""+Messg+""),false);// FontFactory.getFont(com.lowagie.text.FontFactory.HELVETICA, 14, Font.BOLDITALIC,java.awt.Color.blue))); // com.lowagie.text.HeaderFooter headerFoter = new com.lowagie.text.HeaderFooter(new Phrase(""+compName+""),false);// FontFactory.getFont(com.lowagie.text.FontFactory.HELVETICA, 14, Font.BOLDITALIC,java.awt.Color.blue))); // headerFoter.ALIGN_CENTER; // headerFoter.setRight(5); docPdf.setFooter(footer); } catch(java.sql.SQLException SqlExec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage()); } docPdf.open(); try { java.util.Calendar calendar = java.util.Calendar.getInstance(); long dateNow = calendar.getTimeInMillis(); java.sql.Date datenowSql= new java.sql.Date(dateNow); System.out.println(datenowSql.toString()); // java.lang.Object listofStaffNos[] = this.getListofStaffNos(); com.lowagie.text.pdf.PdfPTable table1 = new com.lowagie.text.pdf.PdfPTable(6); // com.lowagie.text.Table table = new com.lowagie.text.Table(7); // table.endHeaders(); int headerwidths[] = {15,15,30,15,15,15}; table1.setWidths(headerwidths); // if (docPdf.getPageNumber() > 1) { // table1.setHeaderRows(4); // } table1.setWidthPercentage((100)); table1.getDefaultCell().setBorder(Rectangle.BOTTOM); table1.getDefaultCell().setColspan(6); Phrase phrase = new Phrase(); Phrase phrase1 = new Phrase(); Phrase phrase2 = new Phrase(); Phrase phrase3 = new Phrase(); Phrase phrase4 = new Phrase(); Phrase phrase5 = new Phrase(); Phrase phrase6 = new Phrase(); Phrase phrase7 = new Phrase(); Phrase phrase8 = new Phrase(); Phrase phrase9 = new Phrase(); Phrase phrase10 = new Phrase(); Phrase phrase11 = new Phrase(); // table.addCell(phrase); //table1.getDefaultCell().setColspan(1); //table1.getDefaultCell().setBackgroundColor(java.awt.Color.WHITE); //table1.getDefaultCell().setBorderColor(java.awt.Color.WHITE); table1.getDefaultCell().setBorderColor(java.awt.Color.BLACK); try { java.sql.Statement stc = connectDB.createStatement(); java.sql.Statement stb = connectDB.createStatement(); java.sql.Statement sta = connectDB.createStatement(); java.sql.Statement st3 = connectDB.createStatement(); java.sql.Statement st22 = connectDB.createStatement(); java.sql.Statement st = connectDB.createStatement(); java.sql.Statement st32 = connectDB.createStatement(); java.sql.Statement std = connectDB.createStatement(); java.sql.Statement st321 = connectDB.createStatement(); java.sql.ResultSet rset3 = st321.executeQuery("select header_name from pb_header"); while (rset3.next()){ table1.getDefaultCell().setColspan(6); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER); phrase = new Phrase(rset3.getObject(1).toString(), pFontHeader11); table1.addCell(phrase); } java.sql.ResultSet rsetc = stc.executeQuery("select distinct adm_date from hp_inpatient_register hr,hp_patient_card pc where pc.patient_no = hr.patient_no and pc.reference = '"+memNo+"'"); java.sql.ResultSet rsetb = stb.executeQuery("select distinct (hr.discharge_date - hr.adm_date),hr.account_no, hr.discharge_date from hp_inpatient_register hr,hp_patient_card pc where pc.patient_no = hr.patient_no and pc.reference = '"+memNo+"'"); java.sql.ResultSet rseta = sta.executeQuery("select distinct ad.ward,ad.bed_no,ad.doctor from hp_admission ad,hp_patient_card pr where pr.reference = '"+memNo+"' and pr.patient_no = ad.patient_no"); java.sql.ResultSet rset = st.executeQuery("select distinct pr.patient_no,initcap(pr.first_name||' '||pr.second_name||' '||pr.last_name),pr.address,pr.residence,pr.tel_no,pr.payer,pr.description,pr.category from hp_inpatient_register pr,hp_patient_card ac where ac.reference = '"+memNo+"' and ac.patient_no = pr.patient_no"); table1.getDefaultCell().setBorderColor(java.awt.Color.WHITE); table1.getDefaultCell().setColspan(6); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER); phrase = new Phrase("CREDIT NOTE", pFontHeader1); table1.addCell(phrase); table1.getDefaultCell().setBorder(Rectangle.BOTTOM); table1.getDefaultCell().setBorderColor(java.awt.Color.WHITE); while (rset.next()){ table1.getDefaultCell().setColspan(3); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase("Payer : "+dbObject.getDBObject(rset.getObject(6), "-"), pFontHeader1); table1.addCell(phrase); table1.getDefaultCell().setColspan(3); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase1 = new Phrase("Scheme Name : "+dbObject.getDBObject(rset.getObject(7), "-"), pFontHeader1); //table1.addCell(phrase); table1.getDefaultCell().setColspan(3); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase2 = new Phrase("Patient No: "+dbObject.getDBObject(rset.getObject(1), "-"), pFontHeader1); //table1.addCell(phrase); table1.getDefaultCell().setColspan(3); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase3 = new Phrase("Patient Name: "+dbObject.getDBObject(rset.getObject(2), "-"), pFontHeader1); //table1.addCell(phrase); } while (rseta.next()){ table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase("CR Note No.: "+memNo, pFontHeader1); table1.addCell(phrase); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase4 = new Phrase("Member Name: " , pFontHeader1); //table1.addCell(phrase); // while (rseta.next()) table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase5 = new Phrase("Ward: "+dbObject.getDBObject(rseta.getObject(1), "-"), pFontHeader1); //table1.addCell(phrase); //while (rseta.next()) table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase6 = new Phrase("Bed No: "+dbObject.getDBObject(rseta.getObject(2), "-"), pFontHeader1); // table1.addCell(phrase); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase9 = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1); // table1.addCell(phrase); } // while (rseta.next()) // table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1); // table1.addCell(phrase); table1.getDefaultCell().setColspan(3); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("Scheme Name : "+dbObject.getDBObject(rset.getObject(7), "-"), pFontHeader1); table1.addCell(phrase1); table1.getDefaultCell().setColspan(3); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("Patient No: "+dbObject.getDBObject(rset.getObject(1), "-"), pFontHeader1); table1.addCell(phrase2); while (rsetb.next()){ table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase("Member No.: "+dbObject.getDBObject(rsetb.getObject(2), "-"), pFontHeader1); table1.addCell(phrase); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase7 = new Phrase("Discharge Date: "+dbObject.getDBObject(rsetb.getObject(3), "-"), pFontHeader1); // table1.addCell(phrase); // if(rsetc.getBoolean(1) == true){ table1.getDefaultCell().setColspan(6); // while (rsetb.next()){ table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase8 = new Phrase("No.of Days : "+dbObject.getDBObject(rsetb.getObject(1), "-"), pFontHeader1); // table1.addCell(phrase); } // while (rset.next()){ table1.getDefaultCell().setColspan(3); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("Patient Name: "+dbObject.getDBObject(rset.getObject(2), "-"), pFontHeader1); table1.addCell(phrase3); // } // while (rseta.next()){ // while (rseta.next()) table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("Ward: "+dbObject.getDBObject(rseta.getObject(1), "-"), pFontHeader1); table1.addCell(phrase4); //while (rseta.next()) table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("Bed No: "+dbObject.getDBObject(rseta.getObject(2), "-"), pFontHeader1); table1.addCell(phrase5); // while (rseta.next()) table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); //phrase = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1); table1.addCell(phrase6); table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); //phrase = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1); table1.addCell(phrase9); while (rsetc.next()){ table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase("Adm Date: "+dbObject.getDBObject(rsetc.getObject(1), "-"), pFontHeader1); table1.addCell(phrase); } // while (rsetb.next()){ table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("Discharge Date: "+dbObject.getDBObject(rsetb.getObject(3), "-"), pFontHeader1); table1.addCell(phrase7); // if(rsetc.getBoolean(1) == true){ table1.getDefaultCell().setColspan(6); // while (rsetb.next()){ table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); // phrase = new Phrase("No.of Days : "+dbObject.getDBObject(rsetb.getObject(1), "-"), pFontHeader1); table1.addCell(phrase8); //} } catch(java.sql.SQLException SqlExec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage()); } docPdf.add(table1); } catch(com.lowagie.text.BadElementException BadElExec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), BadElExec.getMessage()); } try { com.lowagie.text.pdf.PdfPTable table = new com.lowagie.text.pdf.PdfPTable(6); int headerwidths[] = {25,25,20,15,15,15}; table.setWidths(headerwidths); table.setHeaderRows(1); table.setWidthPercentage((100)); table.getDefaultCell().setBorder(Rectangle.BOTTOM); table.getDefaultCell().setColspan(6); Phrase phrase = new Phrase(); // table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setBackgroundColor(java.awt.Color.WHITE); table.getDefaultCell().setBorderColor(java.awt.Color.WHITE); try { java.sql.Statement st11 = connectDB.createStatement(); java.sql.Statement st21 = connectDB.createStatement(); java.sql.Statement st1 = connectDB.createStatement(); java.sql.Statement st2 = connectDB.createStatement(); // } java.sql.ResultSet rset1 = st1.executeQuery(" select date::date,initcap(service) as service,dosage,invoice_no,credit-debit from hp_patient_card where reference = '"+memNo+"' and paid = 'true' and service != 'N.H.I.F' AND service not ilike 'Receipt' AND service != 'Invoice' order by date::date");// union select date::date,initcap(service) as service,dosage,reference,credit from hp_patient_card where patient_no = '"+memNo+"' and credit > 0 order by date"); java.sql.ResultSet rsetTotals = st2.executeQuery("select sum(credit) from hp_patient_card where reference = '"+memNo+"' and service != 'N.H.I.F' and service not ilike 'Receipt' and paid = 'true' and service != 'Invoice'"); java.sql.ResultSet rset11 = st11.executeQuery(" select date::date,initcap(service) as service,dosage,invoice_no,credit from hp_patient_card where reference = '"+memNo+"' AND (service = 'N.H.I.F' OR service ilike 'Receipt') order by date::date");// union select date::date,initcap(service) as service,dosage,reference,credit from hp_patient_card where patient_no = '"+memNo+"' and credit > 0 order by date"); java.sql.ResultSet rsetTotals1 = st21.executeQuery("select sum(credit) from hp_patient_card where reference = '"+memNo+"' and (service = 'N.H.I.F' OR service ilike 'Receipt')"); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); table.getDefaultCell().setBorderColor(java.awt.Color.BLACK); table.getDefaultCell().setBorderWidth(Rectangle.TOP); table.getDefaultCell().setColspan(1); phrase = new Phrase("Date",pFontHeader1); table.addCell(phrase); table.getDefaultCell().setColspan(1); phrase = new Phrase("Description",pFontHeader1); table.addCell(phrase); table.getDefaultCell().setColspan(1); phrase = new Phrase("Qty",pFontHeader1); table.addCell(phrase); table.getDefaultCell().setColspan(1); phrase = new Phrase("Ref",pFontHeader1); table.addCell(phrase); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT); table.getDefaultCell().setColspan(1); phrase = new Phrase("Amt. KShs",pFontHeader1); table.addCell(phrase); phrase = new Phrase("Bal. KShs",pFontHeader1); table.addCell(phrase); while (rset1.next()){ table.getDefaultCell().setColspan(1); table.getDefaultCell().setBorderColor(java.awt.Color.WHITE); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(dbObject.getDBObject(rset1.getObject(1), "-"), pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(dbObject.getDBObject(rset1.getObject(2), "-"), pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(dbObject.getDBObject(rset1.getObject(3), "-"), pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(dbObject.getDBObject(rset1.getObject(4), "-"), pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rset1.getString(5)),pFontHeader); table.addCell(phrase); osBalance = osBalance + rset1.getDouble(5); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance)), pFontHeader); // current = current + osBalance; table.addCell(phrase); } table.getDefaultCell().setBorderColor(java.awt.Color.BLACK); table.getDefaultCell().setBorder(Rectangle.BOTTOM | Rectangle.TOP); while (rsetTotals.next()) { table.getDefaultCell().setColspan(3); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase("Total", pFontHeader1); table.addCell(phrase); table.getDefaultCell().setColspan(3); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rsetTotals.getString(1)),pFontHeader); // table.addCell(phrase); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance)), pFontHeader1); table.addCell(phrase); //phrase = new Phrase(" "); } while (rset11.next()){ table.getDefaultCell().setColspan(1); table.getDefaultCell().setBorderColor(java.awt.Color.WHITE); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(dbObject.getDBObject(rset11.getObject(1), "-"), pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(dbObject.getDBObject(rset11.getObject(2), "-"), pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(" ", pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(dbObject.getDBObject(rset11.getObject(4), "-"), pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(1); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rset11.getString(5)),pFontHeader); table.addCell(phrase); osBalance1 = osBalance1 + rset11.getDouble(5); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance1)), pFontHeader); // current = current + osBalance; table.addCell(phrase); } table.getDefaultCell().setBorderColor(java.awt.Color.BLACK); table.getDefaultCell().setBorder(Rectangle.BOTTOM | Rectangle.TOP); /* while (rsetTotals1.next()) { table.getDefaultCell().setColspan(2); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(" ", pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(2); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase("Total Receipts", pFontHeader1); table.addCell(phrase); table.getDefaultCell().setColspan(2); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rsetTotals1.getString(1)),pFontHeader); //table.addCell(phrase); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance1)), pFontHeader1); table.addCell(phrase); //phrase = new Phrase(" "); } // while (rsetTotals.next()) { table.getDefaultCell().setBorderColor(java.awt.Color.BLACK); table.getDefaultCell().setBorder(Rectangle.BOTTOM | Rectangle.TOP); table.getDefaultCell().setColspan(2); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase(" ", pFontHeader); table.addCell(phrase); table.getDefaultCell().setColspan(2); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT); phrase = new Phrase("Net Amount", pFontHeader1); table.addCell(phrase); table.getDefaultCell().setColspan(2); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT); // phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rsetTotals.getString(1)),pFontHeader); // table.addCell(phrase); phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance - osBalance1)), pFontHeader1); table.addCell(phrase); //phrase = new Phrase(" "); */ // } docPdf.add(table); } catch(java.sql.SQLException SqlExec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage()); } // } } catch(com.lowagie.text.BadElementException BadElExec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), BadElExec.getMessage()); } } catch(java.io.FileNotFoundException fnfExec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), fnfExec.getMessage()); } } catch(com.lowagie.text.DocumentException lwDocexec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), lwDocexec.getMessage()); } docPdf.close(); com.afrisoftech.lib.PDFRenderer.renderPDF(tempFile); } catch(java.io.IOException IOexec) { javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), IOexec.getMessage()); } } }
[ "Charles@Funsoft" ]
Charles@Funsoft
1a49491f79f27534e1e4b85a35bdcd6e6d6a1616
34f8d4ba30242a7045c689768c3472b7af80909c
/JDK10-Java SE Development Kit 10/src/jdk.internal.vm.compiler/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotLoweringProvider.java
faf15014b895cf3cd34ccbb6a39e10b94c83f134
[ "Apache-2.0" ]
permissive
lovelycheng/JDK
5b4cc07546f0dbfad15c46d427cae06ef282ef79
19a6c71e52f3ecd74e4a66be5d0d552ce7175531
refs/heads/master
2023-04-08T11:36:22.073953
2022-09-04T01:53:09
2022-09-04T01:53:09
227,544,567
0
0
null
2019-12-12T07:18:30
2019-12-12T07:18:29
null
UTF-8
Java
false
false
751
java
/* * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * */ package org.graalvm.compiler.hotspot.meta; import org.graalvm.compiler.debug.DebugHandlersFactory; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; import org.graalvm.compiler.nodes.spi.LoweringProvider; import org.graalvm.compiler.options.OptionValues; /** * HotSpot implementation of {@link LoweringProvider}. */ public interface HotSpotLoweringProvider extends LoweringProvider { void initialize(OptionValues options, Iterable<DebugHandlersFactory> factories, HotSpotProviders providers, GraalHotSpotVMConfig config); }
0b8e2d003af243851d45419b9cd0bc5fd99c8d89
b00fecb4125056bd3954f84bc06aea23cb55cd68
/src/android/utils/FileHelper.java
4575cc643b97f62b71010404b3bbcc1676e4ff3c
[]
no_license
realidfarm/cordova-plugin-xmstep
5606c019ba90c11bf67f321de48aa4d75265a1b7
8a4bca051ee12288e46ea9452fd8e6b6697ac07d
refs/heads/master
2021-01-01T19:03:34.319150
2017-07-31T09:11:54
2017-07-31T09:11:54
98,494,114
0
0
null
null
null
null
UTF-8
Java
false
false
8,079
java
package com.realidfarm.xmstep.utils; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import android.text.TextUtils; public class FileHelper { public static final int KB = 1024; public static final int MB = KB * KB; public static final int GB = KB * MB; public static final int TB = KB * GB; public static final String GBK = "GBK"; public static final String UTF8 = "UTF-8"; public static String charset = GBK; public static boolean exist(String pathAndFileName) { return new File(pathAndFileName).exists(); } public static boolean notExist(String pathAndFileName) { return !exist(pathAndFileName); } public static boolean create(String pathAndFileName) { boolean re = false; try { File file = new File(pathAndFileName); if (!file.exists() && haveFreeSpace(file.getParent())) { re = file.createNewFile(); } } catch (IOException e) { e.printStackTrace(); } return re; } public static boolean delete(String pathAndFileName) { boolean re = false; re = new File(pathAndFileName).delete(); return re; } public static boolean backup(String sourcePathAndFileName, String destinationPathAndFileName) { return copy(sourcePathAndFileName, destinationPathAndFileName); } public static boolean recover(String sourcePathAndFileName, String destinationPathAndFileName) { return copy(sourcePathAndFileName, destinationPathAndFileName); } public static boolean copy(String sourcePathAndFileName, String destinationPathAndFileName) { boolean re = false; try { if (!TextUtils.isEmpty(sourcePathAndFileName) && !TextUtils.isEmpty(destinationPathAndFileName)) { FileInputStream in = new FileInputStream(sourcePathAndFileName); boolean toCopy = true; if (notExist(destinationPathAndFileName)) { toCopy = create(destinationPathAndFileName); } if (toCopy) { FileOutputStream out = new FileOutputStream( destinationPathAndFileName); byte[] bt = new byte[1024]; int count; while ((count = in.read(bt)) > 0) { out.write(bt, 0, count); } in.close(); out.close(); re = true; } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return re; } public static boolean move(String sourcePathAndFileName, String destinationPathAndFileName) { boolean re = false; if (copy(sourcePathAndFileName, destinationPathAndFileName)) { re = delete(sourcePathAndFileName); } return re; } public static boolean rename(String sourcePathAndFileName, String destinationPathAndFileName) { return move(sourcePathAndFileName, destinationPathAndFileName); } public static File getFile(String pathAndFileName) { File file = new File(pathAndFileName); if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } return file; } public static boolean haveFreeSpace(String pathAndFileName) { return getFreeSpace(pathAndFileName) > 0; } public static boolean haveFreeSpace(File file) { return getFreeSpace(file) > 0; } public static long getFreeSpace(File file) { return getFreeSpace(file.getParent(), charset) * MB; } private static long getFreeSpace(String path, String charset) { long re = -1; try { if (System.getProperty("os.name").startsWith("Linux")) { re = getFreeSpaceOnLinux(path); } if (re == -1) { throw new UnsupportedOperationException( "The method getFreeSpace(String path) has not been implemented for this operating system."); } } catch (Exception e) { e.printStackTrace(); } return re; } private static long getFreeSpaceOnLinux(String path) throws Exception { long bytesFree = -1; Process p = Runtime.getRuntime().exec("df " + path); InputStream reader = new BufferedInputStream(p.getInputStream()); StringBuffer buffer = new StringBuffer(); for (;;) { int c = reader.read(); if (c == -1) break; buffer.append((char) c); } String outputText = buffer.toString(); reader.close(); // parse the output text for the bytes free info StringTokenizer tokenizer = new StringTokenizer(outputText, "\n"); tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) { String line2 = tokenizer.nextToken(); StringTokenizer tokenizer2 = new StringTokenizer(line2, " "); if (tokenizer2.countTokens() >= 4) { String tmp = tokenizer2.nextToken(); tmp = tokenizer2.nextToken(); tmp = tokenizer2.nextToken(); tmp = tokenizer2.nextToken(); if (!TextUtils.isEmpty(tmp)) { bytesFree = Long.parseLong(tmp.trim().substring(0, tmp.length() - 1)); return bytesFree; } } return bytesFree; } throw new Exception("Can not read the free space of " + path + " path"); } public static long getFreeSpace(String pathAndFileName) { return getFreeSpace(new File(pathAndFileName)); } public static long getFileSizes(File f) { long s = 0; FileInputStream fis = null; try { if (f.exists()) { fis = new FileInputStream(f); s = fis.available(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (fis != null) { fis.close(); } } catch (IOException e) { e.printStackTrace(); } } return s; } public static String read(String pathAndFileName) { String re = ""; File file = new File(pathAndFileName); if (file.exists()) { BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); String temp = null; StringBuffer sb = new StringBuffer(); temp = br.readLine(); while (temp != null) { sb.append(temp + "\n"); temp = br.readLine(); } re = sb.toString(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } } return re; } public static boolean write(String pathAndFileName, String msg) { return append(pathAndFileName, msg); } public static boolean append(String pathAndFileName, String msg) { return write(pathAndFileName, msg, true); } public static boolean cover(String pathAndFileName, String msg) { return write(pathAndFileName, msg, false); } public static boolean write(String pathAndFileName, String msg, boolean isAppened) { boolean re = false; if (haveFreeSpace(pathAndFileName)) { File file = new File(pathAndFileName); BufferedWriter bw = null; try { if (!file.exists()) { file.createNewFile(); } if (file.exists()) { bw = new BufferedWriter(new FileWriter(file, isAppened)); bw.write(msg); re = true; } } catch (IOException e) { e.printStackTrace(); } finally { if (bw != null) { try { bw.close(); } catch (IOException e) { e.printStackTrace(); } } } } return re; } public Byte[] readFile(String fileName) { File f = new File(fileName); InputStream file; try { List<Byte> bufferList = new ArrayList<Byte>(); file = new FileInputStream(f); int length = 0; byte[] buffer = new byte[1024]; while ((length = file.read(buffer)) > 0) { for (int i = 0; i < length; i++) { bufferList.add(Byte.valueOf(buffer[i])); } } Byte[] bufArray = new Byte[bufferList.size()]; return bufferList.toArray(bufArray); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; } }
73d6c9c6f1152cd5fba087a795084c0f343151f0
6db6185a1a42bbcbc63749bcdaf13c3347908655
/draven-springboot/noxus-draven-springboot-2.2.x/noxus-draven-mybatis/noxus-draven-mybatis-mybatis-plus/src/main/java/com/noxus/draven/plus/mapper/UserMapper.java
89412f6dc224b792f517e4d2c3e8e7e462636b93
[]
no_license
the-glorious-executione-noxus/draven-spring
f09a4937d907932abc5a85ccbf56c5daac33d96b
1fb10c33b72b4ec5b8d26ffb067bb085fafb2e8b
refs/heads/master
2023-08-14T14:08:13.810602
2020-03-24T11:21:25
2020-03-24T11:21:25
228,608,382
0
0
null
2023-07-23T00:37:04
2019-12-17T12:08:27
JavaScript
UTF-8
Java
false
false
394
java
package com.noxus.draven.plus.mapper; import com.noxus.draven.plus.entity.User; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Select; /** * <p> * Mapper 接口 * </p> * * @author draven * @since 2020-01-11 */ public interface UserMapper extends BaseMapper<User> { @Select("select * from User where id = 1 ") User selectOnes(); }
[ "w1994z0115x" ]
w1994z0115x
e39d53a2ada1ea00882042c0ee1f69d7c1d6f87d
059bcece1a759624e6894b2533cb6b5a6a250321
/spring-geode-autoconfigure/src/test/java/org/springframework/geode/boot/autoconfigure/repository/service/CustomerService.java
9a1c54b5da3df05f7ecb22bb74969fb7c57a4295
[ "Apache-2.0" ]
permissive
koalaanntree/spring-boot-data-geode
7364e3a698048b84988bf434d3b7b0dbd6035abf
2a4f0b0f4e2fb7e33ae4f34bee19b5b223d0df83
refs/heads/master
2020-05-18T00:31:30.379791
2019-04-24T19:13:59
2019-04-24T19:13:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,561
java
/* * Copyright 2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing * permissions and limitations under the License. */ package org.springframework.geode.boot.autoconfigure.repository.service; import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalArgumentException; import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalStateException; import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import org.springframework.geode.boot.autoconfigure.repository.model.Customer; import org.springframework.geode.boot.autoconfigure.repository.repo.CustomerRepository; import org.springframework.stereotype.Service; /** * The {@link CustomerService} class is an application service for managing {@link Customer Customers}. * * @author John Blum * @see org.springframework.geode.boot.autoconfigure.repository.model.Customer * @see org.springframework.geode.boot.autoconfigure.repository.repo.CustomerRepository * @see org.springframework.stereotype.Service * @since 1.0.0 */ @Service public class CustomerService { private final CustomerRepository customerRepository; private final AtomicLong identifierSequence = new AtomicLong(0L); public CustomerService(CustomerRepository customerRepository) { this.customerRepository = customerRepository; } public CustomerRepository getCustomerRepository() { return Optional.ofNullable(this.customerRepository) .orElseThrow(() -> newIllegalStateException("CustomerRepository was not properly configured")); } public Optional<Customer> findBy(String name) { return Optional.ofNullable(getCustomerRepository().findByName(name)); } protected Long nextId() { return identifierSequence.incrementAndGet(); } public Customer save(Customer customer) { return Optional.ofNullable(customer) .map(it -> { if (customer.isNew()) { customer.identifiedBy(nextId()); } return getCustomerRepository().save(customer); }) .orElseThrow(() -> newIllegalArgumentException("Customer is required")); } }
ea63ca2d4382c4a1afefdda6815954da4785fd2c
d93edde87418e88c12b151f96a0f033f70a1a578
/libraries/core/src/main/java/uk/ac/kcl/inf/mdeoptimiser/libraries/core/optimisation/specification/SearchSpecification.java
7fd1573a372cc0de1632da33f9c0954298880d0d
[]
no_license
mde-optimiser/mde_optimiser
99537347ac5b0b235b9029d991d834c8018bdc4f
201a7e5633277993933182cb31af8c83ba7a8247
refs/heads/master
2022-08-15T21:43:41.463403
2022-07-14T22:33:03
2022-07-14T22:33:03
74,063,717
4
10
null
2023-07-19T15:01:31
2016-11-17T20:16:05
Java
UTF-8
Java
false
false
9,546
java
package uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.specification; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.eclipse.core.runtime.IPath; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.henshin.model.Module; import org.eclipse.emf.henshin.model.Unit; import org.eclipse.emf.henshin.model.resource.HenshinResourceSet; import uk.ac.kcl.inf.mdeoptimiser.languages.mopt.Optimisation; import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction; import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IModelInitialiser; import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IModelProvider; import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.executor.UserModelProvider; import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.GuidanceFunctionAdapter; import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.GuidanceFunctionsFactory; import uk.ac.kcl.inf.mdeoptimiser.libraries.core.reflection.LanguageClassLoader; import uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen.RulesGenerator; import uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen.metamodel.Multiplicity; import uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen.metamodel.RuleSpec; public class SearchSpecification implements ISearchSpecification { private Optimisation model; HenshinResourceSet henshinResourceSet; EPackage theMetamodel; List<Unit> breedingOperators; List<Unit> mutationOperators; IPath projectRootPath; Map<EPackage, List<Module>> generatedOperators; List<IGuidanceFunction> fitnessFunctions; List<IGuidanceFunction> constraintFunctions; public SearchSpecification(IPath projectRootPath, Optimisation model) { this.model = model; this.projectRootPath = projectRootPath; } public Optimisation getOptimisationModel() { return this.model; } public List<Unit> getBreedingOperators() { if (breedingOperators != null) { return this.breedingOperators; } breedingOperators = new LinkedList<Unit>(); breedingOperators.addAll( this.getOptimisationModel().getSearch().getEvolvers().stream() .filter(operator -> operator.getEvolverType().getName().equals("BREED")) .map( operator -> getResourceSet() .getModule(URI.createURI(operator.getRule_location()), false) .getUnit(operator.getUnit())) .collect(Collectors.toList())); return breedingOperators; } public List<Unit> getMutationOperators() { if (this.mutationOperators != null) { return this.mutationOperators; } mutationOperators = new LinkedList<>(); mutationOperators.addAll( model.getSearch().getEvolvers().stream() .filter(operator -> operator.getEvolverType().getName().equals("MUTATE")) .map( operator -> getResourceSet() .getModule(URI.createURI(operator.getRule_location()), false) .getUnit(operator.getUnit())) .collect(Collectors.toList())); // Automatically generate mutations operators var generatedMutations = this.getRulegenOperators(); if (!generatedMutations.isEmpty()) { // For each of the automatically generated modules, add the generated mutations // to the list of evolvers // Are we ever going to have more than one metamodel? Perhaps this should be a // pair instead var metamodel = generatedMutations.keySet().iterator().next(); var mutations = generatedMutations.get(metamodel); mutations.forEach(mutation -> mutationOperators.addAll(mutation.getAllRules())); } return mutationOperators; } public List<Multiplicity> getMultiplicityRefinements() { // A list of multiplicity refinements specified by the user in the DSL. // This is optional. var refinements = model.getGoal().getRefinements(); var multiplicityRefinements = new ArrayList<Multiplicity>(); if (!refinements.isEmpty()) { refinements.forEach( refinement -> multiplicityRefinements.add( new Multiplicity( refinement.getNode(), refinement.getEdge(), refinement.getLowerBound(), refinement.getUpperBound(), getMetamodel()))); } return multiplicityRefinements; } public List<RuleSpec> getRulegenSpecs() { var rulegenSpecs = model.getSearch().getRulegen(); var ruleSpecs = new ArrayList<RuleSpec>(); if (!rulegenSpecs.isEmpty()) { rulegenSpecs.forEach( rulegenSpec -> { // Crete the spec for a node, if configured in the MOPT file or an edge generation if (rulegenSpec.getNodeSpec() != null) { ruleSpecs.add( new RuleSpec( rulegenSpec.getNodeSpec().getNode(), rulegenSpec.getNodeSpec().getGenerationRestriction())); } else { ruleSpecs.add( new RuleSpec( rulegenSpec.getEdgeSpec().getNode(), rulegenSpec.getEdgeSpec().getEdge(), rulegenSpec.getEdgeSpec().getGenerationRestriction())); } }); } return ruleSpecs; } /** * If there are any rule generation instructions present, then generate the corresponding rules. * * @return list of generated mutation operators * @throws Exception */ public Map<EPackage, List<Module>> getRulegenOperators() { if (this.generatedOperators == null) { // Generate the list of modules that are automatically generated var mutations = new RulesGenerator( this.getMetamodel(), this.getMultiplicityRefinements(), this.getRulegenSpecs()); this.generatedOperators = mutations.generateRules(); } return this.generatedOperators; } public HenshinResourceSet getResourceSet() { if (henshinResourceSet == null) { henshinResourceSet = new HenshinResourceSet( projectRootPath .append(this.getOptimisationModel().getProblem().getBasepath().getLocation()) .toPortableString()); } return henshinResourceSet; } public EPackage getMetamodel() { if (theMetamodel == null) { if (!this.getOptimisationModel() .getProblem() .getMetamodel() .getLocation() .endsWith(".ecore")) { // The location is not an ecore file, assume it's a class name theMetamodel = LanguageClassLoader.load(this.getOptimisationModel().getProblem().getMetamodel()); } else { theMetamodel = getResourceSet() .registerDynamicEPackages( this.getOptimisationModel().getProblem().getMetamodel().getLocation()) .get(0); } } return theMetamodel; } public IModelProvider getModelProvider() { // TODO Extend the DSL to allow the user to specify a generic extension to factory map. Then we // can // initialise that and dynamically load any type of model and handle it with the correct factory // Resource.Factory.Registry.INSTANCE // .getExtensionToFactoryMap() // .put("*", new XMIResourceFactoryImpl()); if (this.getOptimisationModel().getProblem().getModelInitialiser() != null) { return new UserModelProvider( this.getModelInitialiser(), getResourceSet(), this.getOptimisationModel().getProblem().getModel().getLocation()); } return new UserModelProvider( getResourceSet(), this.getOptimisationModel().getProblem().getModel().getLocation()); } public IModelInitialiser getModelInitialiser() { if (this.getOptimisationModel().getProblem().getModelInitialiser() != null) { return LanguageClassLoader.load( this.getOptimisationModel().getProblem().getModelInitialiser()); } return null; } @Override public List<IGuidanceFunction> getConstraintFunctions() { if (this.constraintFunctions == null) { setConstraintFunctions(); } return this.constraintFunctions; } public void setConstraintFunctions() { if (constraintFunctions == null) { this.constraintFunctions = getOptimisationModel().getGoal().getConstraints().stream() .map( constraint -> new GuidanceFunctionsFactory() .loadFunction(new GuidanceFunctionAdapter(constraint))) .collect(Collectors.toList()); } } @Override public List<IGuidanceFunction> getObjectiveFunctions() { if (this.fitnessFunctions == null) { setObjectiveFunctions(); } return this.fitnessFunctions; } public void setObjectiveFunctions() { if (fitnessFunctions == null) { this.fitnessFunctions = getOptimisationModel().getGoal().getObjectives().stream() .map( objective -> new GuidanceFunctionsFactory() .loadFunction(new GuidanceFunctionAdapter(objective))) .collect(Collectors.toList()); } } }
9744b8ec79e2d2ebe23b49af7184c14a2d7dedeb
c6d931a0b96addf006061f4f1e8bc78e53e35263
/core/src/main/java/org/openstack4j/openstack/internal/MicroVersion.java
6ae876a1eb32647773ed5cffbe975782b5965fbf
[ "Apache-2.0" ]
permissive
17862953931/openstack4j
a8ea441009d14afa839cf6f42d128652687751e1
9d5f1a0c91b6db8942019fddd2997e6b2a33ef57
refs/heads/master
2020-09-04T09:29:26.354230
2020-02-19T02:52:06
2020-02-19T02:52:06
219,702,460
2
1
NOASSERTION
2020-02-19T02:52:07
2019-11-05T09:09:05
Java
UTF-8
Java
false
false
1,731
java
package org.openstack4j.openstack.internal; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Common representation of an API micro version. * * @author Daniel Gonzalez Nothnagel */ public class MicroVersion implements Comparable<MicroVersion> { private final static Pattern VERSION_REGEX = Pattern.compile("^([1-9]\\d*)\\.([1-9]\\d*|0|)$"); private final int majorVersion; private final int minorVersion; public MicroVersion(String version) { Matcher versionMatcher = VERSION_REGEX.matcher(version); if (!versionMatcher.matches()) { throw new IllegalArgumentException(String.format( "Invalid version pattern %s, should be 'X.Y' (Major.Minor)", version)); } majorVersion = Integer.valueOf(versionMatcher.group(1)); minorVersion = Integer.valueOf(versionMatcher.group(2)); } public MicroVersion(int majorVersion, int minorVersion) { this.majorVersion = majorVersion; this.minorVersion = minorVersion; } @Override public int compareTo(MicroVersion o) { int majorDifference = majorVersion - o.majorVersion; if (majorDifference != 0) { return majorDifference; } return minorVersion - o.minorVersion; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof MicroVersion) { MicroVersion v = (MicroVersion) obj; return compareTo(v) == 0; } return false; } @Override public String toString() { return String.format("%d.%d", majorVersion, minorVersion); } }
da5319f639ee333e8948e3ede27336eca721da7e
9798b9682e2fa6ccff42387ba8f9c754bad2c5fa
/fast-orm/src/main/java/com/che/fast_orm/helper/SqlGenerater.java
4f3e886238505fb2ac9f771192002c58c5c12aee
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
LovingMy/BaseUtil
d9fc89d31d17c8a3487f04c731298aa599eaeb35
ba8773682d5e6d9e7f1b43e5ebed7d7a7b61d026
refs/heads/master
2021-01-19T16:01:25.195680
2016-09-19T12:26:09
2016-09-19T12:26:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,023
java
package com.che.fast_orm.helper; /** * Sql语句生成器 * <p> * 作者:余天然 on 16/9/15 下午9:03 */ public class SqlGenerater { public final static String BAK_SUFFIX = "_bak";//备份的后缀 /** * 生成create语句 * <p> * 格式:create table Student(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age TEXT) */ public static String create(Class<?> clazz) { TableWrapper wrapper = ReflectHelper.parseClass(clazz); //拼接:create table Student(id INTEGER PRIMARY KEY AUTOINCREMENT, StringBuilder sb = new StringBuilder("create table if not exists " + wrapper.name); //拼接:(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age TEXT) sb.append(TypeConverter.zipNameType(wrapper)); return sb.toString(); } /** * 生成drop语句 * <p> * 格式:drop table if exists Student; */ public static String drop(Class<?> clazz) { StringBuilder sb = new StringBuilder("drop table if exists " + ReflectHelper.getTableName(clazz)); return sb.toString(); } /** * 生成insert语句 * <p> * 格式:insert or replace into Student (name,age) values ('Fishyer',23) */ public static <T> String insert(T t) { TableWrapper wrapper = ReflectHelper.parseObject(t); //拼接:insert into Student StringBuilder sb = new StringBuilder("insert or replace into " + wrapper.name + " "); //拼接:(name,age) sb.append(TypeConverter.zipName(wrapper)); //拼接: values sb.append(" values "); //拼接:('Fishyer',23) sb.append(TypeConverter.zipValue(wrapper)); return sb.toString(); } /** * 生成queryAll语句 * <p> * 格式:select * from Student */ public static String queryAll(Class<?> clazz) { StringBuilder sb = new StringBuilder("select * from " + ReflectHelper.getTableName(clazz)); return sb.toString(); } /** * 生成deleteAll语句 * <p> * 格式:delete from Student */ public static String deleteAll(Class<?> clazz) { StringBuilder sb = new StringBuilder("delete from " + ReflectHelper.getTableName(clazz)); return sb.toString(); } /** * 生成queryObj语句 * <p> * 格式:select * from Student where name='Fishyer' and age=23 */ public static <T> String queryObj(T t) { TableWrapper wrapper = ReflectHelper.parseObject(t); //拼接:select * from Student StringBuilder sb = new StringBuilder("select * from " + wrapper.name); //拼接: where name='Fishyer' and age=23 sb.append(TypeConverter.zipConnNameValue(wrapper)); return sb.toString(); } /** * 生成deleteObj语句 * <p> * 格式:delete from Student where name='Fishyer' and age=23 */ public static <T> String deleteObj(T t) { TableWrapper wrapper = ReflectHelper.parseObject(t); //拼接:select * from Student StringBuilder sb = new StringBuilder("delete from " + wrapper.name); //拼接: where name='Fishyer' and age=23 sb.append(TypeConverter.zipConnNameValue(wrapper)); return sb.toString(); } /** * 生成bak语句 * <p> * 格式:create table Student2 as select *from Student */ public static <T> String bak(Class<T> clazz) { String table = ReflectHelper.getTableName(clazz); String tableBak = table + BAK_SUFFIX; StringBuilder sb = new StringBuilder("create table " + tableBak + " as select *from " + table); return sb.toString(); } /** * 生成queryBak语句 * <p> * 格式:select * from Student */ public static String queryBak(Class<?> clazz) { StringBuilder sb = new StringBuilder("select * from " + ReflectHelper.getTableName(clazz) + BAK_SUFFIX); return sb.toString(); } }
12eaf7ac9b69bcdbf7dff3d83095029e3d6e6b4c
81aaec416bf47dfba52ebfd657e17dbab0ed5c97
/app/src/main/java/com/digestivethinking/madridshops/fragments/ShopsFragment.java
1c85f3314852ab3fac85295dcd09aa36b31008e8
[]
no_license
pigmonchu/MadridShoppingAndroid
adbc81740858c5f1c92a4a07023ad4b39c9b0ebf
7807eab11628401d891a5bb8fc0e0aa74a83e8ba
refs/heads/master
2020-12-02T18:05:00.965022
2017-07-10T06:02:13
2017-07-10T06:02:13
96,469,146
0
0
null
null
null
null
UTF-8
Java
false
false
2,178
java
package com.digestivethinking.madridshops.fragments; import android.content.Context; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.digestivethinking.madridshops.R; import com.digestivethinking.madridshops.adapters.ShopsAdapter; import com.digestivethinking.madridshops.domain.model.Shop; import com.digestivethinking.madridshops.domain.model.Shops; import com.digestivethinking.madridshops.views.OnElementClick; import java.lang.ref.WeakReference; public class ShopsFragment extends Fragment { private OnElementClick<Shop> listener; private RecyclerView shopsRecyclerView; private ShopsAdapter adapter; private Shops shops; public ShopsFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_shops, container, false); shopsRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_shops__recycler_view); shopsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); return view; } public void setShops(Shops shops) { this.shops = shops; adapter = new ShopsAdapter(shops, getActivity()); shopsRecyclerView.setAdapter(adapter); adapter.setOnClickListener(new OnElementClick<Shop>() { @Override public void clickedOn(@NonNull Shop shop, int position) { Log.d("Click", shop.getName()); if (listener != null) { ShopsFragment.this.listener.clickedOn(shop, position); } } }); } public void setOnElementClickListener(OnElementClick<Shop> listener) { this.listener = listener; } }
6fd4996cfc57331b2eb2d264a624fbadfea2eade
87f989b37e9961742ec32f7b5466e0052f0487dd
/Codebase/Roomix/ui/src/main/java/at/fhv/roomix/ui/view/checkin/edit/CheckInEditViewModel.java
9bd05ab412b52e6804cd2d740cda0df46ba9336e
[]
no_license
HeilOliver/Roomix
c2273a1f8bb70c0be1673069f35f2838ec2514e3
4117e9d719cd271d209a87b82fe335b8852ab0cd
refs/heads/master
2021-03-22T01:13:42.708315
2018-05-07T11:55:48
2018-05-07T11:55:48
122,192,618
2
0
null
2018-06-10T09:56:40
2018-02-20T12:00:27
Java
UTF-8
Java
false
false
140
java
package at.fhv.roomix.ui.view.checkin.edit; import de.saxsys.mvvmfx.ViewModel; public class CheckInEditViewModel implements ViewModel { }
d9cd0424e7ec0d66e79207388dcf0a4f9ea49271
f6c75e31355c878fb0e215c7549932746f9945c4
/src/test/java/com/scp/CrudWithTestNG/AppTest.java
f3f40b2db2e6564a6b2f1cde8c5f027a2797d0c5
[]
no_license
sk4092/CrudWithTestNG
4a8bf8bcf63982e1e7acdb2a3f22a0fcbb3202e5
5cff08edabd4f8b41ea5ca403258681b82f1ba39
refs/heads/master
2020-03-23T00:43:16.227853
2018-07-13T20:56:16
2018-07-13T20:56:16
140,881,635
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package com.scp.CrudWithTestNG; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
32e852ebb9af0c12b6873c00b98f99b2689ae7f1
ffeaf567e9b1aadb4c00d95cd3df4e6484f36dcd
/Hotgram/com/google/firebase/iid/k.java
6105ef1761a79a10d52a6b8bfcfad1c6be56e87b
[]
no_license
danielperez9430/Third-party-Telegram-Apps-Spy
dfe541290c8512ca366e401aedf5cc5bfcaa6c3e
f6fc0f9c677bd5d5cd3585790b033094c2f0226d
refs/heads/master
2020-04-11T23:26:06.025903
2018-12-18T10:07:20
2018-12-18T10:07:20
162,166,647
0
0
null
null
null
null
UTF-8
Java
false
false
1,213
java
package com.google.firebase.iid; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.util.Log; final class k { private final Messenger a; private final zzk b; k(IBinder arg4) { super(); String v0 = arg4.getInterfaceDescriptor(); zzk v2 = null; if("android.os.IMessenger".equals(v0)) { this.a = new Messenger(arg4); this.b = v2; return; } if("com.google.android.gms.iid.IMessengerCompat".equals(v0)) { this.b = new zzk(arg4); this.a = ((Messenger)v2); return; } String v4 = "Invalid interface descriptor: "; v0 = String.valueOf(v0); v4 = v0.length() != 0 ? v4.concat(v0) : new String(v4); Log.w("MessengerIpcClient", v4); throw new RemoteException(); } final void a(Message arg2) { if(this.a != null) { this.a.send(arg2); return; } if(this.b != null) { this.b.a(arg2); return; } throw new IllegalStateException("Both messengers are null"); } }
a5273105e2056322f2e6918de8c3f20e78ef16a0
1157ddeba3a715637d131a03820236ba072c48b3
/omod/src/main/java/org/openmrs/module/drugshistory/page/controller/DrugsHistoryPageController.java
6cfebf32364512f205d6c6db705e79cd5c8fe6d3
[]
no_license
Guerschon/drugshistory
0baf8f46e900d62cbeb66153969d6e25d13ef8de
e0e88d97d27dcc2a0a7eea3209223d41d037909f
refs/heads/master
2020-07-07T01:53:16.153019
2016-09-16T16:13:07
2016-09-16T16:13:07
67,516,071
0
1
null
null
null
null
UTF-8
Java
false
false
814
java
package org.openmrs.module.drugshistory.page.controller; import java.util.List; import org.json.JSONObject; import org.openmrs.Obs; import org.openmrs.Patient; import org.openmrs.api.context.Context; import org.openmrs.module.drugshistory.api.DrugsHistoryService; import org.openmrs.ui.framework.page.PageModel; import org.springframework.web.bind.annotation.RequestParam; public class DrugsHistoryPageController { public void controller(PageModel model, @RequestParam("patientId") Patient patient) { JSONObject patientOpts = new JSONObject(); patientOpts.put("name", patient.getPersonName().getFullName()); model.addAttribute("patientPropts", patientOpts); List<Obs> drugname = Context.getService(DrugsHistoryService.class).getDrugsHistory(patient); model.addAttribute("drugname", drugname); } }
7545537c90d9645fc82f941d0e8be21693bd857e
fd73e79976bcccee8ef84d92881a8265c5773b0d
/app/src/main/java/com/example/outla/myapplication/Receipt.java
07c4f7c8843b4c515388908cb72336a66a8a15ee
[]
no_license
cathalaherne2/receiptsGatherer
caeaf55483927e095b8ccf02a060e1536a7363ab
290dae3f2133000d78f6b1168c3faa48cace1fdf
refs/heads/master
2020-05-02T17:26:34.006445
2019-04-11T19:13:08
2019-04-11T19:13:08
178,098,353
0
0
null
null
null
null
UTF-8
Java
false
false
1,234
java
package com.example.outla.myapplication; public class Receipt { private String Total; private String ShopName; private String URL; private String TimeDate; private String Logo; public Receipt(String shopName, String total, String url, String logo, String timeDate) { ShopName = shopName; Total = total; URL = url; TimeDate = timeDate; Logo = logo; } public String getTotal() { return Total; } public void setTotal(String total) { Total = total; } public String getShopName() { return ShopName; } public void setShopName(String shopName) { ShopName = shopName; } public void setURL(String URL) { this.URL = URL; } public String getTimeDate() { return TimeDate; } public void setTimeDate(String timeDate) { TimeDate = timeDate; } public String getDate() { return TimeDate; } public void setDate(String date) { TimeDate = date; } public String getLogo() { return Logo; } public void setLogo(String logo) { Logo = logo; } public String getURL() { return URL; } }
a1a52592a509a40e883127b649eb594e41387e75
e8246c71b0635c26371695d57e2e74a023347924
/backend/web/src/main/java/com/smingjob/web/repositories/AliveRepository.java
37ff7f17d720354c41cbc25193a7725b6bf962af
[]
no_license
hemolee/JobALive
a1da5372310223959481c306fd1c4d41b0a4b80d
40ee27fff3322d15cf5a50ba3c9a75f1626cd1f5
refs/heads/master
2023-02-16T01:08:13.225913
2019-07-22T11:49:23
2019-07-22T11:49:23
197,924,441
0
0
null
2021-01-05T12:15:08
2019-07-20T12:00:25
JavaScript
UTF-8
Java
false
false
283
java
package com.smingjob.web.repositories; import com.smingjob.web.enttites.Alive; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface AliveRepository extends JpaRepository<Alive, Long> { }
1ae4b38612d0e9e93a66e2ea0b5ca2a1b8f30790
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/test/java/org/gradle/test/performancenull_447/Testnull_44655.java
8a30479573e0a715ac20d5f36ca6a239703508b4
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
308
java
package org.gradle.test.performancenull_447; import static org.junit.Assert.*; public class Testnull_44655 { private final Productionnull_44655 production = new Productionnull_44655("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
cc31d7a6a2726a566c34ab9e3e4621f87e682f23
8e213530ea37b6cb081d06f03078bc681e07063c
/src/quiz/SortBubble.java
e11bc8b4987f3145aaa62a6619f758263c6c9fe9
[]
no_license
kadun1/K01Java
66cea669787e46a56909fe36a7e4e6ee2d61aaba
c80099bcd34d36636e0cb7d0f679930cc9a1ab47
refs/heads/master
2023-02-25T16:43:57.049059
2021-01-27T15:14:37
2021-01-27T15:14:37
309,946,553
0
0
null
null
null
null
UTF-8
Java
false
false
4,970
java
package quiz; import java.util.Random; import java.util.Scanner; /* 버블정렬(Bubble Sort) : 정렬이 진행되는 과정이 거품이 보글보글 피어오르는 모습과 비슷하다 하여 지어진 명칭이다. 정렬 알고리즘 중에서는 가장 단순하고 효율성이 떨어지는 알고리즘이다. 데이터가 10개인 경우 45번의 비교가 필요하다. */ public class SortBubble { //전역변수 형태로 생성하여 모든 메소드에서 접근가능 static Random rnd = new Random(); static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { //1]중복되지 않는 난수 10개를 생성한다. int[] arr = new int[10]; //난수생성후 arr배열에 저장하기 위한 메소드 호출 randomCreate(arr); //2]생성된 난수를 통해 초기화된 배열을 출력한다.(정렬 전 출력) showArray(arr, "난수생성직후 배열출력"); //3]정렬의 방법을 선택한다.(1.오름차순, 2.내림차순) int orderSelect = menuSelect(); //4]버블정렬 알고리즘을 통한 정렬을 진행한다. bubbleSort(arr, orderSelect); //5]정렬된 결과를 출력한다(정렬 후 출력) showArray(arr, "버블정렬 이후 배열출력"); } public static void bubbleSort(int[] arrParam, int ordSel) { //swap(자리변경)을 위한 임시변수 생성 int temp, swapCount=1; /* 크기가 10인 배열이므로 스캔은 9번만 반복하면 된다. 즉, i의 증가치는 0~8까지 변하게 된다. */ for(int i=0 ; i<arrParam.length-1 ; i++) { /* 실제 요소값에 대한 비교를 진행한다. 버블정렬의 목적은 오름차순일때 큰 숫자를 제일뒤로 보내주는 것이다. 즉 요소1과 요소2를 비교하여 요소1이 크다면 서로 자리를 바꿔서 큰 숫자를 뒤로 보내준다. */ for(int j=0 ; j<(arrParam.length-1)-i ; j++) { /* j가0일때 : arrParam[0] > arrParam[1] 비교 j가1일때 : arrParam[1] > arrParam[2] 비교 ..... */ if(ordSel==1) {//오름차순을 선택했을때 if(arrParam[j] > arrParam[j+1]) { /* 앞의 요소가 크다고 판단이 되면 서로 swap하여 자리를 서로 바꿔서 큰 숫자를 뒤로 보내준다. */ temp = arrParam[j]; arrParam[j] = arrParam[j+1]; arrParam[j+1] = temp; //값의 변경이 있을때마다 배열전체 출력하기 showArray(arrParam,"SWAP중(오름차순 정렬중):"+ (swapCount++) + "회교환됨"); } } else if(ordSel==2) {//내림차순을 선택했을때 if(arrParam[j] < arrParam[j+1]) { /* 앞의 요소가 작다고 판단이 되면 서로 swap하여 자리를 서로 바꿔서 작은 숫자를 뒤로 보내준다. */ temp = arrParam[j]; arrParam[j] = arrParam[j+1]; arrParam[j+1] = temp; //값의 변경이 있을때마다 배열전체 출력하기 showArray(arrParam,"SWAP중(내림차순 정렬중):"+ (swapCount++) + "회교환됨"); } } } } }//end of bubbleSort() public static int menuSelect() { System.out.println("정렬할 방법을 선택하세요"); System.out.println("1.오름차순, 2.내림차순"); return scanner.nextInt(); } public static void showArray(int[] arr, String message) { System.out.println(message); for(int i=0 ; i<arr.length ; i++) { System.out.printf("%d ", arr[i]); } System.out.println(); }//end of showArray() public static void randomCreate(int[] arrParam) { //난수생성을 위한 씨드설정 rnd.setSeed(System.currentTimeMillis()); /* 난수생성 방법1: 1]난수 10개를 우선 생성한후 배열에 담아준다. 2]배열 전체를 대상으로 중복확인을 한다. 3]만약 중복되는 요소가 발견되면 다시 1번으로 돌아가서 난수를 생성한다. 4]중복되는 요소가 없다면 함수를 종료하고 메인으로 돌아간다. */ while(true) { //1.난수10개 생성후 배열담기 for(int i=0 ; i<arrParam.length ; i++) { arrParam[i] = rnd.nextInt(99) + 1;//1~99까지의 정수 생성 } //2.중복확인 boolean rndFlag = false;/*중복체크를 위한 변수(false라면 중복된 난수가 없는경우이고, 중복된 난수가 발견된다면 true로 값을 변경할것임 */ for(int i=0 ; i<arrParam.length ; i++) { for(int j=0 ; j<arrParam.length ; j++) { /* 비교의 조건은 인덱스i와 인덱스j가 서로 다를때이다. 인덱스가 동일하다면 같은숫자일테니까... */ if(i!=j && arrParam[i]==arrParam[j]) { //중복된 값이 발견된다면 true로 값을 변경 rndFlag = true; } } } //3.중복된값이 없다면 break로 while루프 탈출하기 if(rndFlag==false) break; }//end of while }//end of randomCreate() }
97050c661cad39b8e48587c33207b6c8192f2e48
f1824494a26543ccbb686b7090d6c56250554f77
/src/main/java/com/wrox/Filter/AuthenticationFilter.java
eaa0c1ccbfa729842f03073dfe43e26cc8d4b165
[]
no_license
zxg680/javaweb
fd244f0664c71edbf239b9f09f5b25de850648cd
ca5c5027db12ca8cb6bfe7a6f44912289f4f790e
refs/heads/master
2021-01-23T10:29:30.400560
2017-06-01T14:19:14
2017-06-01T14:19:14
93,064,623
0
0
null
null
null
null
UTF-8
Java
false
false
1,380
java
/** * @Title: AuthenticationFilter.java * @Package com.wrox.Filter * @Description: TODO * @author Xiaogang.Zhang * @date 2017年5月29日 下午8:14:12 * @version V1.0 */ package com.wrox.Filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * @ClassName: AuthenticationFilter * @Description: TODO * @author Xiaogang.Zhang * @date 2017年5月29日 下午8:14:12 * */ public class AuthenticationFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpSession session = ((HttpServletRequest) request).getSession(false); if (session != null && session.getAttribute("username") == null) { ((HttpServletResponse) response).sendRedirect("login"); } else { chain.doFilter(request, response); } } @Override public void init(FilterConfig config) throws ServletException { } @Override public void destroy() { } }
10d89db8d06328ad1ff38b93e7eb180e1bceee24
5d07ac5c253fdb4d7f99ba8d2e1fe45b26ef03b4
/editor/SimpleNoteChartPlayer.java
e74b11949133288e91a40d87cbba2f30bbe8b7b6
[]
no_license
TigerHix/cytus
3c15de3a52f0ec34c418a415bd427fae2fd38bfb
b8be85edc36fb8b163f3947b553c93598c660009
refs/heads/master
2021-01-22T14:20:52.988729
2014-11-30T06:31:42
2014-11-30T06:31:42
27,483,262
1
0
null
null
null
null
UTF-8
Java
false
false
5,643
java
package cytus.editor; import cytus.*; import java.awt.*; import java.awt.image.*; import java.text.*; import javax.swing.*; import javax.media.*; import java.util.*; import java.io.*; public class SimpleNoteChartPlayer { NoteChart pdata = null; LinkedList<NoteChart.Note> selection = new LinkedList<NoteChart.Note>(); BufferedImage buf = new BufferedImage(720, 480, BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D) buf.getGraphics(); Player player = null; // MediaPlayer int WIDTH = 675, HEIGHT = 375, XOFF = 22, YOFF = 52; public SimpleNoteChartPlayer(NoteChart pdata, Player player) { this.pdata = pdata; this.player = player; g.setStroke(new BasicStroke(5)); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } public int calcPage(double time) { return (int) ((time + pdata.pshift) / pdata.beat); } public int calcX(double x) { return (int) (x * WIDTH + XOFF); } public int calcY(double time) { int cpage = calcPage(time); double y = (time + pdata.pshift) / pdata.beat - cpage; if (cpage % 2 == 0) y = 1 - y; return (int) (y * HEIGHT + YOFF); } public void paint() { double time = player.getMediaTime().getSeconds(); g.setColor(Color.WHITE); g.fillRect(0, 0, 720, 480); int CSIZE = 72, NSIZE = 36, TSIZE = 36; for (int i = 0; i < pdata.links.size(); i++) { NoteChart.Link l = pdata.links.get(i); if ((l.nodes.getFirst().time <= time + pdata.beat) && (time <= l.nodes.getLast().time)) { int last = -1; for (int j = 0; j < l.n; j++) { NoteChart.Note node = l.nodes.get(j); int x = calcX(node.x); int y = calcY(node.time); if ((time + pdata.beat > node.time) && (time < node.time)) { if (selection.contains(node)) { g.setColor(new Color(255, 0, 0, 100)); g.fillOval(x - 20, y - 20, 40, 40); } if (time <= node.time - pdata.beat / 2) { double alpha = (time - (node.time - pdata.beat)) / (pdata.beat / 2); g.setComposite(AlphaComposite.SrcOver .derive((float) alpha)); } else g.setComposite(AlphaComposite.SrcOver); if (j < l.n - 1) { g.setColor(Color.BLACK); int nextx = calcX(l.nodes.get(j + 1).x); int nexty = calcY(l.nodes.get(j + 1).time); g.drawLine(x, y, nextx, nexty); } g.setColor(new Color(255, 255, 0, 100)); g.fillOval(x - NSIZE / 2, y - NSIZE / 2, NSIZE, NSIZE); g.setColor(Color.RED); g.drawString(String.valueOf(node.id), x, y); } if (time >= node.time) last = j; } int cx = calcX(l.nodes.getFirst().x); int cy = calcY(l.nodes.getFirst().time); if (last != -1) { if (last == l.n - 1) last--; NoteChart.Note node = l.nodes.get(last); NoteChart.Note next = l.nodes.get(last + 1); int x = calcX(node.x); int y = calcY(node.time); int nextx = calcX(next.x); int nexty = calcY(next.time); double pos = (time - node.time) / (next.time - node.time); cx = (int) ((nextx - x) * pos + x); cy = (int) ((nexty - y) * pos + y); } g.setComposite(AlphaComposite.SrcOver); g.setColor(new Color(0, 255, 0, 100)); g.fillOval(cx - CSIZE / 2, cy - CSIZE / 2, CSIZE, CSIZE); g.setColor(new Color(255, 255, 0, 100)); g.drawOval(cx - CSIZE / 2, cy - CSIZE / 2, CSIZE, CSIZE); } } int start = -1, end = -1; for (int i = 0; i < pdata.notes.size(); i++) { NoteChart.Note note = pdata.notes.get(i); if ((note.time <= time + pdata.beat) && (time <= note.time + note.holdtime)) { if (start == -1) start = i; end = i; } } if (end != -1) { for (int i = end; i >= start; i--) { NoteChart.Note note = pdata.notes.get(i); if (note.linkref != -1) continue; int x = calcX(note.x); int y = calcY(note.time); int y2 = 0; if (time + pdata.beat <= note.time + note.holdtime) y2 = calcY(time + pdata.beat); else y2 = calcY(note.time + note.holdtime); if (selection.contains(note)) { g.setColor(new Color(255, 0, 0, 100)); g.fillOval(x - 40, y - 40, 80, 80); } if (time <= note.time - pdata.beat / 2) { double alpha = (time - (note.time - pdata.beat)) / (pdata.beat / 2); g.setComposite(AlphaComposite.SrcOver.derive((float) alpha)); } else g.setComposite(AlphaComposite.SrcOver); if (note.holdtime == 0) { // Circle g.setColor(new Color(0, 0, 0, 100)); g.fillOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE); g.setColor(note.page % 2 == 0 ? Color.MAGENTA : Color.GREEN); g.drawOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE); } else { // Hold g.setColor(Color.YELLOW); if (y < y2) g.fillRect(x - TSIZE / 2, y, TSIZE, y2 - y); else g.fillRect(x - TSIZE / 2, y2, TSIZE, y - y2); if (time > note.time) { int pos = (int) ((y2 - y) * (time - note.time) / note.holdtime) + y; g.setColor(Color.CYAN); if (y < pos) g.fillRect(x - TSIZE / 2, y, TSIZE, pos - y); else g.fillRect(x - TSIZE / 2, pos, TSIZE, y - pos); } g.setColor(Color.YELLOW); g.fillOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE); g.setColor(new Color(0, 0, 0, 100)); g.drawOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE); } g.setColor(Color.RED); g.drawString(String.valueOf(note.id), x, y); } } int liney = calcY(time); g.setComposite(AlphaComposite.SrcOver); g.setColor(Color.BLACK); g.drawLine(0, liney, 720, liney); g.drawString( "Time:" + new java.text.DecimalFormat("0.000").format(time), 10, 20); } }
1fbb83923e8d7f32df99d3f5c055e9d2de3e30ec
5fc8c26644b67fffa682c5d5e8c2de49051ac005
/blockChainMonitor/src/main/java/com/fuzamei/service/ExceptionLogService.java
c2defd44b208fce44771d7910ca735f8fc5c4940
[]
no_license
caibei1/blockChainMonitor
c08304e4a807a17d988bc725652a943db75460f0
7d90bedfc8b8efdc48d279c0c8036593de7629f8
refs/heads/master
2020-03-18T11:41:42.515450
2018-05-24T08:36:36
2018-05-24T08:36:36
134,686,282
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.fuzamei.service; import com.fuzamei.entity.ExceptionLog; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; public interface ExceptionLogService { boolean insertAppLog(ExceptionLog exceptionLog); boolean updateExceptionState(@Param("id")int id,@Param("state")int state); }
c1238f2cbdd709e1631661b9f9c6b196ba7c5702
b7012c80a3086d5935ac520cd3918be784e99af2
/src/Lecture5/SimpleThread/ThreeThreadsTest.java
2db91a3530b90b46a72232285e530c03c502988f
[]
no_license
SuienS/concurrent-programming
677e7c8e2b6486f4aa6ee9f099eacaa811e4e779
4cfcb1f80178125db8a1a21845b433cf0f282361
refs/heads/main
2023-05-15T23:10:39.181181
2020-11-08T10:44:24
2020-11-08T10:44:24
311,038,106
0
0
null
null
null
null
UTF-8
Java
false
false
583
java
/* package Lecture5.SimpleThread; public class ThreeThreadsTest { public static void main (String args[]) { // Declare 3 thread variables Thread firstThrd ; Thread secondThrd ; Thread thirdThrd ; // Create the 3 threads firstThrd = new SimpleThread("FirstThread") ; secondThrd = new SimpleThread("SecondThread") ; thirdThrd = new SimpleThread("ThirdThread") ; // Start the 3 threads executing firstThrd.start() ; secondThrd.start() ; thirdThrd.start() ; } } */
79cf0ca6fe334c55b86bc9e12374d194352c72c2
48a773185c79945dbc3a989163a743b45ba26077
/model2/src/com/naver/action/BoardModifyView.java
1c38343ab9cc283bd0a52a75ea6afd15bf7024f7
[]
no_license
mochangyong/model2
cc5ff86be720a6880847ea4e0093de8940ad4f25
a3091a93ddd50aaadb99fd019e458ce8797f8cd1
refs/heads/master
2020-06-02T22:01:53.547007
2014-06-11T08:20:07
2014-06-11T08:20:07
null
0
0
null
null
null
null
UHC
Java
false
false
986
java
package com.naver.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.naver.dao.Board18DAO; import com.naver.model.Board18Bean; public class BoardModifyView implements Action { @Override public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception { ActionForward forward = new ActionForward(); request.setCharacterEncoding("euc-kr"); Board18DAO boarddao = new Board18DAO(); Board18Bean boarddata = new Board18Bean(); int no = Integer.parseInt(request.getParameter("no")); boarddata = boarddao.getDetail(no); if(boarddata == null ){ System.out.println("(수정)상세보기 실패"); return null; } System.out.println("(수정)상세보기 성공"); request.setAttribute("boarddata", boarddata); forward.setRedirect(false); forward.setPath("./board/board_modify.jsp"); return forward; } }
[ "lee yunhee@my_computer" ]
lee yunhee@my_computer
bd97091fe46d4132bd8f2904898e47826fcb7eb3
90446fee39885af358b61e596b8a89ff2198d02a
/Test/src/Test2.java
830e709cbe90db077c9301b709e547f0d53404cd
[]
no_license
pawan-bloglovin/myRepository4
ce384097d95a60771bf7f9b8ff8b7ceffb585d9d
546eac3e4283a9e3dff604914ac57563b5d5c7f3
refs/heads/master
2021-01-10T05:25:03.094063
2016-03-02T12:09:03
2016-03-02T12:09:03
52,959,420
0
0
null
null
null
null
UTF-8
Java
false
false
143
java
public class Test2 { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(""); } }
db600dd4a15f84e9d8cc394f77df779a6113cc8f
d5005ff5e9b921c39d32f40fb2787755b88abbb7
/OrikaTesting/src/au/com/home/local/orika/output/IndividualDetail.java
c320494942db5f5b32d246250a608ad7ae64b93a
[]
no_license
sushantwarik/macproject
99d51777e8c080b6f64adbe6f56f778de5cdaaf6
89990dfcb969ee2c3b4e856d9f4acf02fde17d80
refs/heads/master
2022-11-18T07:02:57.317015
2019-08-19T09:43:43
2019-08-19T09:43:43
71,018,655
0
0
null
2022-11-16T04:59:35
2016-10-15T23:15:13
Java
UTF-8
Java
false
false
513
java
package au.com.home.local.orika.output; public class IndividualDetail { private NamePart name; private String dateOfBirth; private String sex; public NamePart getName() { return name; } public void setName(NamePart name) { this.name = name; } public String getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(String dateOfBirth) { this.dateOfBirth = dateOfBirth; } public String getSex() { return sex; } public void setSex(String gender) { this.sex = gender; } }
f821db197120e5a32242403e5cf527ab979bc58e
e3e3cd88f96cd543f2b2befd34d39ad973294270
/app/src/androidTest/java/jc/tarjetas/com/proyectotarjetas/ApplicationTest.java
4de2741f50001474dd5136f53bcad9898c650c45
[]
no_license
datoncito/ProyectoTarjetas
b8c3b64508d94aad65d96786285c3b7a57008008
2db543927c576b1abef7757b15d67fa94a96fd6d
refs/heads/master
2021-01-19T09:41:07.400973
2014-12-11T00:41:07
2014-12-11T00:41:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package jc.tarjetas.com.proyectotarjetas; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
26c0ab8c42c359d8c0dac02541f535007d3a54e3
7bddbcc6ae7a317abe1085c2d338529f9972500d
/app/src/main/java/com/orange/oy/activity/shakephoto_318/PutInTask2Activity.java
6d841d71181540a758763b5434fb40033974932c
[]
no_license
cherry98/Rose_ouye
a76158443444bb46bc03b402f44ff3f7723626a4
705a1cfedea65ac92e8cee2ef2421bbee56aed4c
refs/heads/master
2020-03-28T15:44:50.818307
2018-09-13T10:36:14
2018-09-13T10:36:14
148,622,312
0
0
null
null
null
null
UTF-8
Java
false
false
24,545
java
package com.orange.oy.activity.shakephoto_318; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.widget.ListView; import com.android.volley.Response; import com.android.volley.VolleyError; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.orange.oy.R; import com.orange.oy.activity.createtask_317.TaskCheckDesActivity; import com.orange.oy.activity.createtask_317.TaskMouldActivity; import com.orange.oy.activity.createtask_321.AddfeeActivity; import com.orange.oy.activity.shakephoto_316.CollectPhotoActivity; import com.orange.oy.adapter.PutInTaskAdapter2; import com.orange.oy.base.AppInfo; import com.orange.oy.base.BaseActivity; import com.orange.oy.base.MyUMShareUtils; import com.orange.oy.base.Tools; import com.orange.oy.dialog.ConfirmDialog; import com.orange.oy.dialog.CustomProgressDialog; import com.orange.oy.dialog.UMShareDialog; import com.orange.oy.info.PutInTaskInfo; import com.orange.oy.network.NetworkConnection; import com.orange.oy.network.NetworkView; import com.orange.oy.network.Urls; import com.orange.oy.view.AppTitle; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import static com.orange.oy.R.id.putin_listview2; import static com.orange.oy.R.id.putin_listview3; import static com.orange.oy.R.id.putin_one; import static com.orange.oy.R.id.putin_oneing; import static com.orange.oy.R.id.putin_three; import static com.orange.oy.R.id.putin_threeing; import static com.orange.oy.R.id.putin_two; import static com.orange.oy.R.id.putin_twoing; /** * beibei 我发布的任务(已投放,草稿箱,已结束) 把V3.17拆成三个页面 */ public class PutInTask2Activity extends BaseActivity implements AppTitle.OnBackClickForAppTitle, PutInTaskAdapter2.IPutInTask { private void initTitle() { appTitle = (AppTitle) findViewById(R.id.titleview); appTitle.showBack(this); if (!Tools.isEmpty(activity_status)) { switch (activity_status) { case "1": appTitle.settingName("草稿箱"); //右侧有删除按钮 settingDel1(); break; case "2": appTitle.settingName("投放中"); break; default: appTitle.settingName("已结束"); break; } } } private void settingDel1() { appTitle.hideExit(); if (putInTaskAdapter != null) { putInTaskAdapter.setDelet(false); } appTitle.showIllustrate(R.mipmap.grrw_button_shanchu, new AppTitle.OnExitClickForAppTitle() { public void onExit() { settingDel2(); } }); } private void settingDel2() { appTitle.hideIllustrate(); if (putInTaskAdapter != null) { putInTaskAdapter.setDelet(true); } appTitle.settingExit("完成", new AppTitle.OnExitClickForAppTitle() { public void onExit() { settingDel1(); } }); } private void iniNetworkConnection() { activityList = new NetworkConnection(this) { public Map<String, String> getNetworkParams() { Map<String, String> params = new HashMap<>(); params.put("usermobile", AppInfo.getName(PutInTask2Activity.this)); params.put("token", Tools.getToken()); params.put("activity_status", activity_status); // 活动状态1:草稿箱未发布;2:投放中;3:已结束 params.put("page", page + ""); params.put("sort_type", "2");//按创建时间排序,1为正序,2为倒序,不传时默认为正序 return params; } }; closeProject = new NetworkConnection(this) { public Map<String, String> getNetworkParams() { Map<String, String> params = new HashMap<>(); params.put("usermobile", AppInfo.getName(PutInTask2Activity.this)); params.put("token", Tools.getToken()); params.put("project_id", project_id); return params; } }; delActivityInfo = new NetworkConnection(this) { public Map<String, String> getNetworkParams() { Map<String, String> params = new HashMap<>(); params.put("usermobile", AppInfo.getName(PutInTask2Activity.this)); params.put("token", Tools.getToken()); params.put("ai_id", ai_id); // ai_id 活动id【必传】 return params; } }; } public void onResume() { super.onResume(); if (activity_status != null) { getDataLeft(); } } public void onPause() { super.onPause(); } public void onStop() { super.onStop(); if (activityList != null) { activityList.stop(Urls.ActivityList); } if (closeProject != null) { closeProject.stop(Urls.CloseProject); } if (delActivityInfo != null) { delActivityInfo.stop(Urls.DelActivityInfo); } } private String activity_status, project_id, ai_id; public static final String TAG = PutInTask2Activity.class.getName(); private NetworkConnection activityList, delActivityInfo; private NetworkConnection closeProject; private ArrayList<PutInTaskInfo> listLeft; private PullToRefreshListView putin_listview; private NetworkView putin_networkview; private PutInTaskAdapter2 putInTaskAdapter; private AppTitle appTitle; private int page = 1; private String IsGrantInAidActivity; //判断是否从赞助费存为草稿来的 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_putin_task); putin_listview = (PullToRefreshListView) findViewById(R.id.putin_listview); putin_networkview = (NetworkView) findViewById(R.id.putin_networkview); activity_status = getIntent().getStringExtra("activity_status"); initTitle(); iniNetworkConnection(); initView(); refreshListView(); IsGrantInAidActivity = getIntent().getStringExtra("IsGrantInAidActivity"); } private void initView() throws NullPointerException { listLeft = new ArrayList<>(); putInTaskAdapter = new PutInTaskAdapter2(PutInTask2Activity.this, listLeft, activity_status); putin_listview.setAdapter(putInTaskAdapter); putInTaskAdapter.setiPutInTask(this); } public void getDataLeft() { activityList.stop(Urls.ActivityList); activityList.sendPostRequest(Urls.ActivityList, new Response.Listener<String>() { public void onResponse(String s) { Tools.d(s); JSONObject jsonObject; try { jsonObject = new JSONObject(s); if ("200".equals(jsonObject.getString("code"))) { if (page == 1) { if (listLeft != null) listLeft.clear(); else listLeft = new ArrayList<PutInTaskInfo>(); } putin_listview.onRefreshComplete(); if (!jsonObject.isNull("data")) { JSONArray jsonArray = jsonObject.getJSONObject("data").getJSONArray("list"); int length = jsonArray.length(); if (length > 0) { putin_networkview.setVisibility(View.GONE); for (int i = 0; i < length; i++) { jsonObject = jsonArray.getJSONObject(i); PutInTaskInfo putInTaskInfo = new PutInTaskInfo(); putInTaskInfo.setAi_id(jsonObject.optString("ai_id")); putInTaskInfo.setActivity_name(jsonObject.optString("activity_name")); putInTaskInfo.setTarget_num(jsonObject.optString("target_num")); //目标照片数 putInTaskInfo.setGet_num(jsonObject.optString("get_num")); //收到的照片数 putInTaskInfo.setBegin_date(jsonObject.optString("begin_date")); putInTaskInfo.setEnd_date(jsonObject.optString("end_date")); putInTaskInfo.setActivity_status(jsonObject.optString("activity_status")); putInTaskInfo.setActivity_type(jsonObject.optString("activity_type")); //活动类型(1:集图活动;2:偶业项目) putInTaskInfo.setProject_id(jsonObject.optString("project_id")); putInTaskInfo.setTemplate_img(jsonObject.optString("template_img")); //图标 putInTaskInfo.setProject_total_money(jsonObject.optString("project_total_money")); putInTaskInfo.setMoney(jsonObject.optString("money")); // 执行单价 putInTaskInfo.setTotal_num(jsonObject.optString("total_num")); //执行总量 putInTaskInfo.setGettask_num(jsonObject.optString("gettask_num"));//已领数量 putInTaskInfo.setDone_num(jsonObject.optString("done_num")); // 已做数量 putInTaskInfo.setCheck_num(jsonObject.optString("check_num")); // 待审核数量 putInTaskInfo.setComplete_num(jsonObject.optString("complete_num")); // 已做数量 putInTaskInfo.setPass_num(jsonObject.optString("pass_num")); putInTaskInfo.setUnpass_num(jsonObject.optString("unpass_num")); putInTaskInfo.setReward_money(jsonObject.optString("reward_money")); //发放奖励金额" putInTaskInfo.setAd_show_num(jsonObject.optString("ad_show_num")); putInTaskInfo.setAd_click_num(jsonObject.optString("ad_click_num")); putInTaskInfo.setSponsor_num(jsonObject.optString("sponsor_num")); // 活动状态1:草稿箱未发布;2:投放中;3:已结束 listLeft.add(putInTaskInfo); } if (putInTaskAdapter != null) { putInTaskAdapter.notifyDataSetChanged(); } if (length < 15) { putin_listview.setMode(PullToRefreshBase.Mode.PULL_FROM_START); } else { putin_listview.setMode(PullToRefreshBase.Mode.BOTH); } } else { if (page == 1) { putin_networkview.setVisibility(View.VISIBLE); if ("2".equals(activity_status)) { putin_listview.setVisibility(View.GONE); putin_networkview.SettingMSG(R.mipmap.grrw_image, "没有投放中的任务哦~"); } else if ("1".equals(activity_status)) { putin_listview.setVisibility(View.GONE); putin_networkview.SettingMSG(R.mipmap.grrw_image, "草稿箱是空的哦~"); } else if ("3".equals(activity_status)) { putin_listview.setVisibility(View.GONE); putin_networkview.SettingMSG(R.mipmap.grrw_image, "暂无结束活动哦~"); } } else { putin_listview.setMode(PullToRefreshBase.Mode.PULL_FROM_START); } } } } else { Tools.showToast(PutInTask2Activity.this, jsonObject.getString("msg")); } } catch (JSONException e) { Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_error)); putin_listview.onRefreshComplete(); } putin_listview.onRefreshComplete(); } }, new Response.ErrorListener() { public void onErrorResponse(VolleyError volleyError) { try { activityList.stop(Urls.ActivityList); putin_listview.onRefreshComplete(); putin_networkview.setVisibility(View.VISIBLE); putin_networkview.NoNetwork(getResources().getString(R.string.network_fail) + "点击重试"); putin_networkview.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { putin_networkview.setOnClickListener(null); putin_networkview.NoNetwork("正在重试..."); getDataLeft(); } }); } catch (Exception e) { e.printStackTrace(); } } }); } private void refreshListView() { putin_listview.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { page = 1; getDataLeft(); } @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { page++; getDataLeft(); } }); } @Override public void onBack() { baseFinish(); } // "activity_type":"活动类型(1:集图活动;2:偶业项目)" @Override public void PutIntask(int position) {//草稿箱投放(可编辑) if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { PutInTaskInfo putInTaskInfo = listLeft.get(position); if (putInTaskInfo.getActivity_type().equals("2")) { project_id = putInTaskInfo.getProject_id(); Intent intent = new Intent(this, TaskMouldActivity.class); intent.putExtra("project_id", project_id); intent.putExtra("which_page", "1"); startActivity(intent); } else { Intent intent = new Intent(this, CollectPhotoActivity.class); intent.putExtra("ai_id", listLeft.get(position).getAi_id()); intent.putExtra("which_page", "2");//草稿箱 集图活动 V3.20 startActivity(intent); } } } @Override public void NextPutIntask(int position) { //再投放 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { PutInTaskInfo putInTaskInfo = listLeft.get(position); project_id = putInTaskInfo.getProject_id(); Intent intent = new Intent(this, TaskMouldActivity.class); intent.putExtra("project_id", project_id); intent.putExtra("which_page", "2"); startActivity(intent); } } @Override public void Look(int position) { //已经结束的 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { PutInTaskInfo putInTaskInfo = listLeft.get(position); project_id = putInTaskInfo.getProject_id(); Intent intent = new Intent(PutInTask2Activity.this, TaskCheckDesActivity.class); intent.putExtra("IsTaskFinish", "2"); intent.putExtra("project_id", putInTaskInfo.getProject_id()); startActivity(intent); } } @Override public void Looktwo(int position) { //已投放的 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { PutInTaskInfo putInTaskInfo = listLeft.get(position); project_id = putInTaskInfo.getProject_id(); Intent intent = new Intent(PutInTask2Activity.this, TaskCheckDesActivity.class); intent.putExtra("IsTaskFinish", "1"); intent.putExtra("project_id", putInTaskInfo.getProject_id()); startActivity(intent); } } //==================================集图活动==================================// @Override public void Edit(int position) { //集图活动编辑 V3.20 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { Intent intent = new Intent(this, CollectPhotoActivity.class); intent.putExtra("ai_id", listLeft.get(position).getAi_id()); intent.putExtra("which_page", "1");//已投放->编辑 startActivity(intent); } } @Override public void Lookthree(int position) { //集图活动查看 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { PutInTaskInfo putInTaskInfo = listLeft.get(position); Intent intent = new Intent(PutInTask2Activity.this, NewActivityDetailActivity.class); intent.putExtra("activity_status", putInTaskInfo.getActivity_status()); intent.putExtra("ai_id", putInTaskInfo.getAi_id()); intent.putExtra("template_img", putInTaskInfo.getTemplate_img()); startActivity(intent); } } @Override public void PutIntasktwo(int position) { //草稿箱投放(可编辑) 集图活动 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { Intent intent = new Intent(this, CollectPhotoActivity.class); intent.putExtra("ai_id", listLeft.get(position).getAi_id()); intent.putExtra("which_page", "2"); startActivity(intent); } } public void FinishTask(int position) { //结束按钮 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { PutInTaskInfo putInTaskInfo = listLeft.get(position); ConfirmDialog.showDialog(this, "提示", 1, "确定要结束这个活动吗?", "取消", "确定", putInTaskInfo, true, new ConfirmDialog.OnSystemDialogClickListener() { public void leftClick(Object object) { } public void rightClick(Object object) { PutInTaskInfo putInTaskInfo = (PutInTaskInfo) object; project_id = putInTaskInfo.getProject_id(); closeProject(); } }); } } public void PutAgain(int position) {//集图再次投放 V3.20 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { Intent intent = new Intent(this, CollectPhotoActivity.class); intent.putExtra("ai_id", listLeft.get(position).getAi_id()); intent.putExtra("which_page", "4"); intent.putExtra("putagain", true); startActivity(intent); } } @Override public void deleteDraft(int position) { //删除草稿 if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { ai_id = listLeft.get(position).getAi_id(); ConfirmDialog.showDialog(this, "您确定要删除草稿?", true, new ConfirmDialog.OnSystemDialogClickListener() { @Override public void leftClick(Object object) { putInTaskAdapter.setDelet(false); putInTaskAdapter.notifyDataSetChanged(); settingDel1(); } @Override public void rightClick(Object object) { putInTaskAdapter.setDelet(false); putInTaskAdapter.notifyDataSetChanged(); abandon(); settingDel1(); } }); } } @Override public void additionalexpenses(int position) { if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { Intent intent = new Intent(this, AddfeeActivity.class); intent.putExtra("project_id", listLeft.get(position).getProject_id()); startActivity(intent); } } private void abandon() { delActivityInfo.sendPostRequest(Urls.DelActivityInfo, new Response.Listener<String>() { @Override public void onResponse(String s) { Tools.d(s); try { JSONObject jsonObject = new JSONObject(s); if (jsonObject.getInt("code") == 200) { getDataLeft(); Tools.showToast(PutInTask2Activity.this, "删除成功"); } else { Tools.showToast(PutInTask2Activity.this, jsonObject.getString("msg")); } } catch (JSONException e) { Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_error)); } CustomProgressDialog.Dissmiss(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_volleyerror)); CustomProgressDialog.Dissmiss(); } }); } private void closeProject() { closeProject.sendPostRequest(Urls.CloseProject, new Response.Listener<String>() { public void onResponse(String s) { try { JSONObject jsonObject = new JSONObject(s); if (jsonObject.getInt("code") == 200) { page = 1; activity_status = "2"; getDataLeft(); ConfirmDialog.showDialog(PutInTask2Activity.this, "项目已关闭", 2, "剩余金额将在24小时内转回您的账户。", "", "我知道了", null, true, null); } else { Tools.showToast(PutInTask2Activity.this, jsonObject.getString("msg")); } } catch (JSONException e) { Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_error)); } } }, new Response.ErrorListener() { public void onErrorResponse(VolleyError volleyError) { Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_volleyerror)); } }); } public void Share(int position) { if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) { final String webUrl = Urls.InviteToActivity + "usermobile=" + AppInfo.getName(PutInTask2Activity.this) + "&ai_id=" + listLeft.get(position).getAi_id(); UMShareDialog.showDialog(PutInTask2Activity.this, false, new UMShareDialog.UMShareListener() { public void shareOnclick(int type) { MyUMShareUtils.umShare(PutInTask2Activity.this, type, webUrl); } }); } } }
0705f99f28ec04ccbb690173128dccb30a26e41c
932f97398da1f32eb4f20d4664b0089a935ed01c
/app/src/test/java/net/pramodk/canvasapplication/ExampleUnitTest.java
256212d5716251de325f619c8003e9e8520eaa81
[]
no_license
Dual-Task/CanvasApplication
1ed472c22ce9f703b25fe7a6c748e1a007136452
60728fb2d848e67743e515f585e44eccae0fc64c
refs/heads/master
2020-04-03T12:51:59.423603
2018-10-29T19:10:47
2018-10-29T19:10:47
155,266,638
0
0
null
null
null
null
UTF-8
Java
false
false
407
java
package net.pramodk.canvasapplication; 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); } }
0839c40e2c85e230a1214fa6c138d5f5628a7a4c
f01a039566621a87938bd5c7dcfcd9baf10c164e
/examples/junit4/MoneyTest.java
efc71268b0c8895f9739cb6f58dfbae61ad24da5
[]
no_license
litaowan/JtestExample
94ae4cc7c552de21d340571319adf3f8a6da4ce1
b99138bc7dc6cd2aad7c4d2b353ab26284075a76
refs/heads/master
2020-05-22T11:38:18.323147
2019-05-13T03:30:34
2019-05-13T03:30:34
186,326,955
0
0
null
null
null
null
UTF-8
Java
false
false
5,528
java
package examples.junit4; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import junit.framework.JUnit4TestAdapter; import org.junit.Before; import org.junit.Test; /** * MoneyTest is a JUnit 4 test class for class Money and MoneyBag. * @see examples.junit4.Money */ public class MoneyTest { private Money f12CHF; private Money f14CHF; private Money f7USD; private Money f21USD; private IMoney fMB1; private IMoney fMB2; @Before public void setUp() { f12CHF= new Money(12, "CHF"); f14CHF= new Money(14, "CHF"); f7USD= new Money( 7, "USD"); f21USD= new Money(21, "USD"); fMB1= MoneyBag.create(f12CHF, f7USD); fMB2= MoneyBag.create(f14CHF, f21USD); } @Test public void testBagMultiply() { // {[12 CHF][7 USD]} *2 == {[24 CHF][14 USD]} IMoney expected= MoneyBag.create(new Money(24, "CHF"), new Money(14, "USD")); assertEquals(expected, fMB1.multiply(2)); assertEquals(fMB1, fMB1.multiply(1)); assertTrue(fMB1.multiply(0).isZero()); } @Test public void testBagNegate() { // {[12 CHF][7 USD]} negate == {[-12 CHF][-7 USD]} IMoney expected= MoneyBag.create(new Money(-12, "CHF"), new Money(-7, "USD")); assertEquals(expected, fMB1.negate()); } @Test public void testBagSimpleAdd() { // {[12 CHF][7 USD]} + [14 CHF] == {[26 CHF][7 USD]} IMoney expected= MoneyBag.create(new Money(26, "CHF"), new Money(7, "USD")); assertEquals(expected, fMB1.add(f14CHF)); } @Test public void testBagSubtract() { // {[12 CHF][7 USD]} - {[14 CHF][21 USD] == {[-2 CHF][-14 USD]} IMoney expected= MoneyBag.create(new Money(-2, "CHF"), new Money(-14, "USD")); assertEquals(expected, fMB1.subtract(fMB2)); } @Test public void testBagSumAdd() { // {[12 CHF][7 USD]} + {[14 CHF][21 USD]} == {[26 CHF][28 USD]} IMoney expected= MoneyBag.create(new Money(26, "CHF"), new Money(28, "USD")); assertEquals(expected, fMB1.add(fMB2)); } @Test public void testIsZero() { assertTrue(fMB1.subtract(fMB1).isZero()); assertTrue(MoneyBag.create(new Money (0, "CHF"), new Money (0, "USD")).isZero()); } @Test public void testMixedSimpleAdd() { // [12 CHF] + [7 USD] == {[12 CHF][7 USD]} IMoney expected= MoneyBag.create(f12CHF, f7USD); assertEquals(expected, f12CHF.add(f7USD)); } @Test public void testBagNotEquals() { IMoney bag= MoneyBag.create(f12CHF, f7USD); assertFalse(bag.equals(new Money(12, "DEM").add(f7USD))); } @Test public void testMoneyBagEquals() { assertTrue(!fMB1.equals(null)); assertEquals(fMB1, fMB1); IMoney equal= MoneyBag.create(new Money(12, "CHF"), new Money(7, "USD")); assertTrue(fMB1.equals(equal)); assertTrue(!fMB1.equals(f12CHF)); assertTrue(!f12CHF.equals(fMB1)); assertTrue(!fMB1.equals(fMB2)); } @Test public void testMoneyBagHash() { IMoney equal= MoneyBag.create(new Money(12, "CHF"), new Money(7, "USD")); assertEquals(fMB1.hashCode(), equal.hashCode()); } @Test public void testMoneyEquals() { assertTrue(!f12CHF.equals(null)); Money equalMoney= new Money(12, "CHF"); assertEquals(f12CHF, f12CHF); assertEquals(f12CHF, equalMoney); assertEquals(f12CHF.hashCode(), equalMoney.hashCode()); assertTrue(!f12CHF.equals(f14CHF)); } @Test public void zeroMoniesAreEqualRegardlessOfCurrency() { Money zeroDollars= new Money(0, "USD"); Money zeroFrancs= new Money(0, "CHF"); assertEquals(zeroDollars, zeroFrancs); assertEquals(zeroDollars.hashCode(), zeroFrancs.hashCode()); } @Test public void testMoneyHash() { assertTrue(!f12CHF.equals(null)); Money equal= new Money(12, "CHF"); assertEquals(f12CHF.hashCode(), equal.hashCode()); } @Test public void testSimplify() { IMoney money= MoneyBag.create(new Money(26, "CHF"), new Money(28, "CHF")); assertEquals(new Money(54, "CHF"), money); } @Test public void testNormalize2() { // {[12 CHF][7 USD]} - [12 CHF] == [7 USD] Money expected= new Money(7, "USD"); assertEquals(expected, fMB1.subtract(f12CHF)); } @Test public void testNormalize3() { // {[12 CHF][7 USD]} - {[12 CHF][3 USD]} == [4 USD] IMoney ms1= MoneyBag.create(new Money(12, "CHF"), new Money(3, "USD")); Money expected= new Money(4, "USD"); assertEquals(expected, fMB1.subtract(ms1)); } @Test public void testNormalize4() { // [12 CHF] - {[12 CHF][3 USD]} == [-3 USD] IMoney ms1= MoneyBag.create(new Money(12, "CHF"), new Money(3, "USD")); Money expected= new Money(-3, "USD"); assertEquals(expected, f12CHF.subtract(ms1)); } @Test public void testPrint() { assertEquals("[12 CHF]", f12CHF.toString()); } @Test public void testSimpleAdd() { // [12 CHF] + [14 CHF] == [26 CHF] Money expected= new Money(26, "CHF"); assertEquals(expected, f12CHF.add(f14CHF)); } @Test public void testSimpleBagAdd() { // [14 CHF] + {[12 CHF][7 USD]} == {[26 CHF][7 USD]} IMoney expected= MoneyBag.create(new Money(26, "CHF"), new Money(7, "USD")); assertEquals(expected, f14CHF.add(fMB1)); } @Test public void testSimpleMultiply() { // [14 CHF] *2 == [28 CHF] Money expected= new Money(28, "CHF"); assertEquals(expected, f14CHF.multiply(2)); } @Test public void testSimpleNegate() { // [14 CHF] negate == [-14 CHF] Money expected= new Money(-14, "CHF"); assertEquals(expected, f14CHF.negate()); } @Test public void testSimpleSubtract() { // [14 CHF] - [12 CHF] == [2 CHF] Money expected= new Money(2, "CHF"); assertEquals(expected, f14CHF.subtract(f12CHF)); } public Class getTestedClass() { return Money.class; } }
4786fdbb633465446e1aebd58eac4356a859c336
cebbb3eb50323299a9fc0bcb007dfc8ec4c33493
/sidi-app-ptof/src/main/java/it/istruzione/ptof/helper/CustomCalendarExDeserializer.java
dedcad0e6eedaf9b0b1fb164874f66affe60ab4c
[]
no_license
sronca/sic
386641239d827f7c1ae055b4a4f45933c6fd5daf
2d725e1c4d7e9b38956386450ebcbc767cf2f7c9
refs/heads/master
2021-05-04T21:50:41.739660
2018-02-02T16:08:10
2018-02-02T16:08:10
119,974,741
0
0
null
null
null
null
UTF-8
Java
false
false
1,039
java
package it.istruzione.ptof.helper; import java.io.IOException; import java.text.ParseException; import java.util.Calendar; import org.apache.commons.lang3.time.FastDateFormat; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; public class CustomCalendarExDeserializer extends JsonDeserializer<Calendar> { @Override public Calendar deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { try { if(org.apache.commons.lang.StringUtils.isBlank(jp.getText())){ return null; } return CommonsUtility.getCalendar(FastDateFormat.getInstance("dd/MM/yyyy HH:mm").parse(jp.getText())); } catch (ParseException e) { // TODO Auto-generated catch block throw new RuntimeException(e); } } }
a595a0adb54fa5530653832edbd9c41904608fc0
52019a46c8f25534afa491a5f68bf5598e68510b
/core/runtime/src/main/java/org/nakedobjects/runtime/objectstore/inmemory/internal/ObjectStoreInstances.java
83efefcd9329872eea813236ec2f713c12068ec1
[ "Apache-2.0" ]
permissive
JavaQualitasCorpus/nakedobjects-4.0.0
e765b4980994be681e5562584ebcf41e8086c69a
37ee250d4c8da969eac76749420064ca4c918e8e
refs/heads/master
2023-08-29T13:48:01.268876
2020-06-02T18:07:23
2020-06-02T18:07:23
167,005,009
0
1
Apache-2.0
2022-06-10T22:44:43
2019-01-22T14:08:50
Java
UTF-8
Java
false
false
9,237
java
package org.nakedobjects.runtime.objectstore.inmemory.internal; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Vector; import org.nakedobjects.applib.clock.Clock; import org.nakedobjects.metamodel.adapter.NakedObject; import org.nakedobjects.metamodel.adapter.oid.Oid; import org.nakedobjects.metamodel.adapter.version.SerialNumberVersion; import org.nakedobjects.metamodel.adapter.version.Version; import org.nakedobjects.metamodel.authentication.AuthenticationSession; import org.nakedobjects.metamodel.commons.debug.DebugString; import org.nakedobjects.metamodel.spec.NakedObjectSpecification; import org.nakedobjects.runtime.context.NakedObjectsContext; import org.nakedobjects.runtime.objectstore.inmemory.InMemoryObjectStore; import org.nakedobjects.runtime.persistence.PersistenceSession; import org.nakedobjects.runtime.persistence.PersistenceSessionHydrator; import org.nakedobjects.runtime.persistence.adaptermanager.AdapterManager; import org.nakedobjects.runtime.persistence.query.PersistenceQueryBuiltIn; import org.nakedobjects.runtime.persistence.query.PersistenceQueryFindByTitle; /* * The objects need to store in a repeatable sequence so the elements and instances method return the same data for any repeated * call, and so that one subset of instances follows on the previous. This is done by keeping the objects in the order that they * where created. */ public final class ObjectStoreInstances { private final Map<Oid, Object> pojoByOidMap = new HashMap<Oid, Object>(); private final Map<Oid, String> titleByOidMap = new HashMap<Oid, String>(); private final Map<Oid, SerialNumberVersion> versionByOidMap = new HashMap<Oid, SerialNumberVersion>(); @SuppressWarnings("unused") private final NakedObjectSpecification spec; ///////////////////////////////////////////////////////// // Constructors ///////////////////////////////////////////////////////// public ObjectStoreInstances(NakedObjectSpecification spec) { this.spec = spec; } ///////////////////////////////////////////////////////// // Object Instances ///////////////////////////////////////////////////////// /** * TODO: shouldn't really be exposing this directly. */ public Map<Oid, Object> getObjectInstances() { return pojoByOidMap; } public Set<Oid> getOids() { return Collections.unmodifiableSet(pojoByOidMap.keySet()); } public Object getPojo(Oid oid) { return pojoByOidMap.get(oid); } public Version getVersion(Oid oid) { return versionByOidMap.get(oid); } ///////////////////////////////////////////////////////// // shutdown ///////////////////////////////////////////////////////// public void shutdown() { pojoByOidMap.clear(); titleByOidMap.clear(); versionByOidMap.clear(); } ///////////////////////////////////////////////////////// // save, remove ///////////////////////////////////////////////////////// public void save(final NakedObject adapter) { pojoByOidMap.put(adapter.getOid(), adapter.getObject()); titleByOidMap.put(adapter.getOid(), adapter.titleString().toLowerCase()); SerialNumberVersion version = versionByOidMap.get(adapter.getOid()); SerialNumberVersion nextVersion = nextVersion(version); versionByOidMap.put(adapter.getOid(), nextVersion); adapter.setOptimisticLock(nextVersion); } private synchronized SerialNumberVersion nextVersion(SerialNumberVersion version) { long sequence = (version != null? version.getSequence(): 0) +1; return new SerialNumberVersion(sequence, getAuthenticationSession().getUserName(), new Date(Clock.getTime())); } public void remove(final Oid oid) { pojoByOidMap.remove(oid); titleByOidMap.remove(oid); versionByOidMap.remove(oid); } ///////////////////////////////////////////////////////// // retrieveObject ///////////////////////////////////////////////////////// /** * If the pojo exists in the object store, then looks up the * {@link NakedObject adapter} from the {@link AdapterManager}, and only * if none found does it {@link PersistenceSessionHydrator#recreateAdapter(Oid, Object) recreate} * a new {@link NakedObject adapter}. */ public NakedObject retrieveObject(final Oid oid) { final Object pojo = getObjectInstances().get(oid); if (pojo == null) { return null; } NakedObject adapterLookedUpByPojo = getAdapterManager().getAdapterFor(pojo); if (adapterLookedUpByPojo != null) { return adapterLookedUpByPojo; } NakedObject adapterLookedUpByOid = getAdapterManager().getAdapterFor(oid); if (adapterLookedUpByOid != null) { return adapterLookedUpByOid; } return getHydrator().recreateAdapter(oid, pojo); } ///////////////////////////////////////////////////////// // instances, numberOfInstances, hasInstances ///////////////////////////////////////////////////////// /** * Not API, but <tt>public</tt> so can be called by {@link InMemoryObjectStore}. */ public void findInstancesAndAdd(final PersistenceQueryBuiltIn persistenceQuery, final Vector<NakedObject> foundInstances) { if (persistenceQuery instanceof PersistenceQueryFindByTitle) { for (final Oid oid : titleByOidMap.keySet()) { final String title = titleByOidMap.get(oid); if (((PersistenceQueryFindByTitle) persistenceQuery).matches(title)) { final NakedObject adapter = retrieveObject(oid); foundInstances.add(adapter); } } return; } for (final NakedObject element : elements()) { if (persistenceQuery.matches(element)) { foundInstances.addElement(element); } } } public int numberOfInstances() { return getObjectInstances().size(); } public boolean hasInstances() { return numberOfInstances() > 0; } private List<NakedObject> elements() { final List<NakedObject> v = new ArrayList<NakedObject>(getObjectInstances().size()); for (final Oid oid : getObjectInstances().keySet()) { v.add(retrieveObject(oid)); } return v; } ///////////////////////////////////////////////////////// // Debugging ///////////////////////////////////////////////////////// public void debugData(final DebugString debug) { debug.indent(); if (getObjectInstances().size() == 0) { debug.appendln("no instances"); } for (final Oid oid : getObjectInstances().keySet()) { final String title = titleByOidMap.get(oid); final Object object = getObjectInstances().get(oid); debug.appendln(oid.toString(), object + " (" + title + ")"); } debug.appendln(); debug.unindent(); } // /////////////////////////////////////////////////////// // Dependencies (from context) // /////////////////////////////////////////////////////// /** * Must use {@link NakedObjectsContext context}, because although this object is recreated with each * {@link PersistenceSession session}, the persisted objects that get * {@link #attachPersistedObjects(MemoryObjectStorePersistedObjects) attached} to it span multiple * sessions. * * <p> * The alternative design would be to laboriously inject this object via the * {@link InMemoryObjectStore}. */ private PersistenceSession getPersistenceSession() { return NakedObjectsContext.getPersistenceSession(); } /** * Must use {@link NakedObjectsContext context}, because although this object is recreated with each * {@link PersistenceSession session}, the persisted objects that get * {@link #attachPersistedObjects(MemoryObjectStorePersistedObjects) attached} to it span multiple * sessions. * * <p> * The alternative design would be to laboriously inject this object via the * {@link InMemoryObjectStore}. */ private AdapterManager getAdapterManager() { return getPersistenceSession().getAdapterManager(); } /** * Must use {@link NakedObjectsContext context}, because although this object is recreated with each * {@link PersistenceSession session}, the persisted objects that get * {@link #attachPersistedObjects(MemoryObjectStorePersistedObjects) attached} to it span multiple * sessions. * * <p> * The alternative design would be to laboriously inject this object via the * {@link InMemoryObjectStore}. */ private PersistenceSessionHydrator getHydrator() { return getPersistenceSession(); } private static AuthenticationSession getAuthenticationSession() { return NakedObjectsContext.getAuthenticationSession(); } } // Copyright (c) Naked Objects Group Ltd.
7575bb48f2e817cfe40b27537600fa642e8753f0
1279d9ce2d688e8f085683423414568383c3d44f
/Euler_8.java
a87ac1aad909d50ae361d558ddf0ebd653710d96
[]
no_license
cofax48/Project-Euler
4fb886fc32929e71ce1356f557e01c7751f2e482
d1472806e406d1114b3676c3881910698b48343f
refs/heads/master
2021-01-20T18:15:07.172440
2018-09-21T19:59:03
2018-09-21T19:59:03
90,911,526
0
0
null
null
null
null
UTF-8
Java
false
false
2,635
java
public class Euler_8 { public static void main(String args[]) { String longNum = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"; long longNumLength = longNum.length() - 12; int i = 0; long highestProdSum = 0; while (i < longNumLength) { long firstNum = Long.parseLong(Character.toString(longNum.charAt(i))); long secondNum = Long.parseLong(Character.toString(longNum.charAt(i + 1))); long thirdNum = Long.parseLong(Character.toString(longNum.charAt(i + 2))); long fourthNum = Long.parseLong(Character.toString(longNum.charAt(i + 3))); long fiveNum = Long.parseLong(Character.toString(longNum.charAt(i + 4))); long sixNum = Long.parseLong(Character.toString(longNum.charAt(i + 5))); long sevNum = Long.parseLong(Character.toString(longNum.charAt(i + 6))); long eightNum = Long.parseLong(Character.toString(longNum.charAt(i + 7))); long nineNum = Long.parseLong(Character.toString(longNum.charAt(i + 8))); long tenNum = Long.parseLong(Character.toString(longNum.charAt(i + 9))); long elevNum = Long.parseLong(Character.toString(longNum.charAt(i + 10))); long twelvNum = Long.parseLong(Character.toString(longNum.charAt(i + 11))); long thirtNum = Long.parseLong(Character.toString(longNum.charAt(i + 12))); long numSum = firstNum * secondNum * thirdNum * fourthNum * fiveNum * sixNum * sevNum * eightNum * nineNum * tenNum * elevNum * twelvNum * thirtNum; if (numSum >= highestProdSum) { highestProdSum = numSum; System.out.println(numSum); } i++; } System.out.println("The greatest product is: " + highestProdSum); } }
69587f084f97636f034c15236d75529729397d64
b7c81772761c67e001dcb7d1ed23f5d4c8ba8a80
/app/src/main/java/com/example/andrey/newtmpclient/activities/needdoingtasks/di/NeedDoingTasksScope.java
c08cc0dd37239d4d06985ab29431642c2c25eda8
[]
no_license
samaromku/NewTmpClient
18bf5a83297c9fe54b7422b2393ef413f5cf8a33
3840423f770f1f245848c33ed8d7dba327fc9f60
refs/heads/master
2021-01-01T06:12:52.114585
2019-02-14T13:05:51
2019-02-14T13:05:51
97,379,734
0
0
null
null
null
null
UTF-8
Java
false
false
262
java
package com.example.andrey.newtmpclient.activities.needdoingtasks.di; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Scope; @Scope @Retention(RetentionPolicy.RUNTIME) @interface NeedDoingTasksScope { }
287afe256ee1118d19446768458bb1ad9ccb25bc
ac68b309495d823bf081d168c4a013095c76b1fd
/HubbleBackend/src/com/hubble/hubblebackend/postgressql/model/ReleaseGroupSecondaryType.java
e86e828d8f8da494d04b369d12e5f66a38fb90d1
[]
no_license
hmehrotra/hubble
f6d726b8a9d7deed94f67893c3c44c2763be88c3
3762613ed351d3fd4b31c369c3f10b33c06edf70
refs/heads/master
2016-08-04T14:16:38.080270
2015-09-21T00:22:10
2015-09-21T00:22:10
12,354,502
0
0
null
2015-08-30T00:45:27
2013-08-25T05:18:10
HTML
UTF-8
Java
false
false
1,425
java
package com.hubble.hubblebackend.postgressql.model; // Generated Sep 7, 2015 5:12:35 PM by Hibernate Tools 3.4.0.CR1 /** * ReleaseGroupSecondaryType generated by hbm2java */ public class ReleaseGroupSecondaryType implements java.io.Serializable { private int id; private String name; private Integer parent; private int childOrder; private String description; public ReleaseGroupSecondaryType() { } public ReleaseGroupSecondaryType(int id, String name, int childOrder) { this.id = id; this.name = name; this.childOrder = childOrder; } public ReleaseGroupSecondaryType(int id, String name, Integer parent, int childOrder, String description) { this.id = id; this.name = name; this.parent = parent; this.childOrder = childOrder; this.description = description; } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public Integer getParent() { return this.parent; } public void setParent(Integer parent) { this.parent = parent; } public int getChildOrder() { return this.childOrder; } public void setChildOrder(int childOrder) { this.childOrder = childOrder; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } }
34f538058d3694da9a9afeff69d8abf95258ae9c
9712188a580f63f698c2a903151c1711b1680ff8
/src/loops/Ptn3.java
c25ce8af8a12f255e6d443e58bb29081cce9a04a
[]
no_license
b19java0101/sheetal_assigment_1
975e8ef504c527b00b06db12b11173eb4fd7b328
c20e9f4906ceb75b6095e7b3d301ccd25fe0fad0
refs/heads/master
2020-04-20T19:05:17.870748
2019-02-04T07:05:23
2019-02-04T07:05:23
169,039,616
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package loops; class Ptn3 { public static void main (String args[]) { int i,j; //for(i=1;i<=5;i++) for(i=1;i<=5;i++) { //for(j=1;j<=i;j++) for(j=5;j>=i;j--) { //System.out.print(i); System.out.print(j); } System.out.println(); }}}
[ "ACER@DESKTOP-4V51LTM" ]
ACER@DESKTOP-4V51LTM
13fe6832edf404ccfadc1a80b36a8a2959b0f547
da93046a3e78cf1743661eded45f37698a2e9333
/src/test/java/EntityTagTest.java
c23dd8abe42811c1ffb5ae220389a2d36b493f5e
[]
no_license
IuliiaLinda/PlatformaticaQA
4770abbc556410ad9ebe76a3c89862342dc81ca7
0e616b8fa9c224b7b27388c76fb4b0202d0c4d4f
refs/heads/main
2023-01-30T12:16:58.761667
2020-12-16T01:15:11
2020-12-16T01:15:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,163
java
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.testng.Assert; import org.testng.annotations.Test; import runner.BaseTest; import java.util.List; public class EntityTagTest extends BaseTest { private static WebElement tagItem(WebDriver driver) { By tagListItemLocator = By.xpath("//tr[@data-row_id='5']//span[@class='check']"); return driver.findElement(tagListItemLocator); } private static WebElement assignButton(WebDriver driver) { return driver.findElement(By.xpath("//button[contains(text(), 'Assign tags')]")); } private static List<WebElement> assignedTag(WebDriver driver) { return driver.findElements(By.xpath("//tr[@data-row_id='5']//span[@class='pa-tag']")); } @Test public void editTest() { WebDriver driver = getDriver(); driver.get("https://ref.eteam.work"); ProjectUtils.login(driver, "[email protected]", "ah1QNmgkEO"); WebElement sidebar = driver.findElement(By.xpath("//div[contains(@class, 'sidebar-wrapper')]")); Actions builder = new Actions(driver); builder.moveToElement(sidebar).perform(); WebElement tag = driver.findElement(By.xpath("//li/a/p[contains(text(), 'Tag')]")); builder.moveToElement(tag).build().perform(); tag.click(); By tagIconLocator = By.xpath("//li/a[contains(@href, 'index.php?action=action_list&list_type=table&entity_id=42&taggable=1')]"); WebElement tagIcon = driver.findElement(tagIconLocator); tagIcon.click(); By tagCheckboxLocator = By.xpath("//div/label[@class='form-check-label'][contains(text(), 'tag for view')]"); WebElement tagCheckbox = driver.findElement(tagCheckboxLocator); tagCheckbox.click(); tagItem(driver).click(); assignButton(driver).click(); Assert.assertEquals(assignedTag(driver).get(0).getText(), "tag for view"); tagItem(driver).click(); assignButton(driver).click(); Assert.assertEquals(assignedTag(driver).size(), 0); } }
a35e444f5a2f7fe0d70ccf591f88e8ea027694ca
fa10cb2e1f0d97a31e253a31029688e48001a28e
/src/main/java/com/ustcck/library/config/CacheConfiguration.java
a0e857f17619aea20f085055d9193af2b041bde4
[]
no_license
ustcck/library
e1854f6ea0a8ded6316f379639a9f2147ac8d864
fc4098e1302649fe2c73950fbf0659db18aa9103
refs/heads/main
2023-01-12T02:48:46.861510
2020-11-17T06:01:51
2020-11-17T06:01:51
313,521,962
0
0
null
null
null
null
UTF-8
Java
false
false
5,610
java
package com.ustcck.library.config; import io.github.jhipster.config.JHipsterConstants; import io.github.jhipster.config.JHipsterProperties; import com.hazelcast.config.*; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.Hazelcast; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cache.CacheManager; import org.springframework.boot.info.BuildProperties; import org.springframework.boot.info.GitProperties; import org.springframework.cache.interceptor.KeyGenerator; import org.springframework.beans.factory.annotation.Autowired; import io.github.jhipster.config.cache.PrefixedKeyGenerator; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.*; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; import javax.annotation.PreDestroy; @Configuration @EnableCaching public class CacheConfiguration { private GitProperties gitProperties; private BuildProperties buildProperties; private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class); private final Environment env; public CacheConfiguration(Environment env) { this.env = env; } @PreDestroy public void destroy() { log.info("Closing Cache Manager"); Hazelcast.shutdownAll(); } @Bean public CacheManager cacheManager(HazelcastInstance hazelcastInstance) { log.debug("Starting HazelcastCacheManager"); return new com.hazelcast.spring.cache.HazelcastCacheManager(hazelcastInstance); } @Bean public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) { log.debug("Configuring Hazelcast"); HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("library"); if (hazelCastInstance != null) { log.debug("Hazelcast already initialized"); return hazelCastInstance; } Config config = new Config(); config.setInstanceName("library"); config.getNetworkConfig().setPort(5701); config.getNetworkConfig().setPortAutoIncrement(true); // In development, remove multicast auto-configuration if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) { System.setProperty("hazelcast.local.localAddress", "127.0.0.1"); config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false); config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false); } config.getMapConfigs().put("default", initializeDefaultMapConfig(jHipsterProperties)); // Full reference is available at: https://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties)); config.getMapConfigs().put("com.ustcck.library.domain.*", initializeDomainMapConfig(jHipsterProperties)); return Hazelcast.newHazelcastInstance(config); } private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) { ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig(); managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled()); managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl()); managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval()); return managementCenterConfig; } private MapConfig initializeDefaultMapConfig(JHipsterProperties jHipsterProperties) { MapConfig mapConfig = new MapConfig(); /* Number of backups. If 1 is set as the backup-count for example, then all entries of the map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. */ mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount()); /* Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* Maximum size of the map. When max size is reached, map is evicted based on the policy defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default is 0. */ mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; } private MapConfig initializeDomainMapConfig(JHipsterProperties jHipsterProperties) { MapConfig mapConfig = new MapConfig(); mapConfig.setTimeToLiveSeconds(jHipsterProperties.getCache().getHazelcast().getTimeToLiveSeconds()); return mapConfig; } @Autowired(required = false) public void setGitProperties(GitProperties gitProperties) { this.gitProperties = gitProperties; } @Autowired(required = false) public void setBuildProperties(BuildProperties buildProperties) { this.buildProperties = buildProperties; } @Bean public KeyGenerator keyGenerator() { return new PrefixedKeyGenerator(this.gitProperties, this.buildProperties); } }
a1bc68fe4dd120e59b4f9ad49d9c52cce761c1db
776e937de0534e2817584ed015285ad47395c875
/app/src/main/java/com/example/codeli_klip/LoginGoogleActivity.java
8034b2c03d5029407b4aab3bc591ef53dfb43165
[]
no_license
KBOHYUN/codeli_android_klip_ver
40ce4f1d07f734765a47c18194273f5e167f6d07
f98a878396d260823e675e21e34023d5277ac46c
refs/heads/master
2023-05-14T17:36:31.574540
2021-06-14T00:59:33
2021-06-14T00:59:33
365,611,079
0
0
null
null
null
null
UTF-8
Java
false
false
5,077
java
package com.example.codeli_klip; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.text.method.SingleLineTransformationMethod; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInResult; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.ApiException; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.android.material.snackbar.Snackbar; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.GoogleAuthProvider; public class LoginGoogleActivity extends AppCompatActivity { private FirebaseAuth firebaseAuth = null; private GoogleSignInClient googleSignInClient; private static final int RC_SIGN_IN = 9001; private SignInButton signInButton; private String name; private String email; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_google_login); ImageView ivGlide = (ImageView)findViewById(R.id.iv_glide); signInButton = findViewById(R.id.google_login_button); // 파이어베이스 인증 객체 선언 firebaseAuth = FirebaseAuth.getInstance(); // Google 로그인을 앱에 통합 // GoogleSignInOptions 개체를 구성할 때 requestIdToken을 호출 GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); googleSignInClient = GoogleSignIn.getClient(this, googleSignInOptions); signInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent signInIntent = googleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN); } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // 구글로그인 버튼 응답 if (requestCode == RC_SIGN_IN) { Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); try { // 구글 로그인 성공 GoogleSignInAccount account = task.getResult(ApiException.class); email=account.getEmail(); name=account.getDisplayName(); firebaseAuthWithGoogle(account); } catch (ApiException e) { } } } // 사용자가 정상적으로 로그인한 후에 GoogleSignInAccount 개체에서 ID 토큰을 가져와서 // Firebase 사용자 인증 정보로 교환하고 Firebase 사용자 인증 정보를 사용해 Firebase에 인증합니다. private void firebaseAuthWithGoogle(GoogleSignInAccount acct) { AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null); firebaseAuth.signInWithCredential(credential) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // 로그인 성공 Toast.makeText(getApplicationContext(), "구글 로그인 성공", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(getApplicationContext(), SigninActivity.class); intent.putExtra("name",name); intent.putExtra("email",email); startActivity(intent); } else { // 로그인 실패 Toast.makeText(getApplicationContext(), "구글 로그인 실패", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(getApplicationContext(), LoginGoogleActivity.class); startActivity(intent); } } }); } }
e329a1b6a4acedbf8a1c4718ae0b67ebc978b3fb
43d2b1ca2aaabbef582bef6a6269ae57c78afc69
/app/src/main/java/ava/shadesofme/MainActivity.java
f8dcb050f7fc3b724057a0b5c1d3628ad812bb38
[]
no_license
alina-beck/ShadesOfMe
a710dfd9268ab0d551b8fa3ac47e49cf62cb23d4
5db16339f78b5abbf723b1ed4f2ec0f453af4b46
refs/heads/master
2021-05-31T20:08:38.714772
2016-07-19T11:05:17
2016-07-19T11:05:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,558
java
package ava.shadesofme; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import ava.shadesofme.Content.ContentFragment; import ava.shadesofme.Content.ContentViewModel; import ava.shadesofme.Content.Inventory.InventoryFragment; import ava.shadesofme.Content.Item.InventoryItemFragment; import ava.shadesofme.Dashboard.DashboardFragment; import ava.shadesofme.Dashboard.DashboardViewModel; /** Starting point for the game - the MainActivity is responsible for starting the Initialiser. * * The MainActivity acts as container for DashboardFragment and ContentFragments * and manages the navigation between ContentFragments when prompted. */ public class MainActivity extends AppCompatActivity { // ViewModel names public static final String DASHBOARD = "Dashboard"; public static final String INVENTORY = "Inventory"; public static final String INVENTORY_ITEM = "Inventory Item"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Initialiser initialiser = new Initialiser(this); initialiser.startGame(); } public void initDashboardFragment(DashboardViewModel dashboardViewModel) { Bundle bundle = new Bundle(); bundle.putParcelable(DASHBOARD, dashboardViewModel); DashboardFragment dashboardFragment = new DashboardFragment(); dashboardFragment.setArguments(bundle); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(R.id.container_fragment_dashboard, dashboardFragment); ft.commit(); } public void setContentFragment(String name, ContentViewModel viewModel) { Bundle bundle = new Bundle(); bundle.putParcelable(name, viewModel); ContentFragment fragment; switch (name) { case INVENTORY: fragment = new InventoryFragment(); break; case INVENTORY_ITEM: fragment = new InventoryItemFragment(); break; default: // TODO: throw and handle exception System.out.println("no such fragment"); return; } fragment.setArguments(bundle); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(R.id.container_fragment_dashboard, fragment); ft.addToBackStack(null); ft.commit(); } }
16427b52729aa8955eb70164e4aba81cc59062ec
55c907680407105a8227c451842c889c7aeff887
/src/main/java/com/hrznstudio/galacticraft/block/special/TinLadderBlock.java
0e547b29fe496d25f8a71b54a7b52be676e05280
[ "MIT" ]
permissive
Geolykt/Galacticraft-Rewoven
049a8c6fcac244f6e15854b4a26c6d83c8e84967
931788d6eb7b2c3d2895dad099d7ab7af4e6fbe1
refs/heads/main
2023-03-31T16:17:59.513643
2021-03-20T02:24:16
2021-03-20T02:24:16
349,740,751
0
0
MIT
2021-03-20T14:01:58
2021-03-20T14:01:58
null
UTF-8
Java
false
false
8,839
java
/* * Copyright (c) 2019-2021 HRZN LTD * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.hrznstudio.galacticraft.block.special; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalFacingBlock; import net.minecraft.block.ShapeContext; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.Properties; import net.minecraft.util.ActionResult; import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; /** * @author <a href="https://github.com/StellarHorizons">StellarHorizons</a> */ public class TinLadderBlock extends Block { public static final DirectionProperty FACING; public static final BooleanProperty WATERLOGGED; protected static final VoxelShape EAST_SHAPE; protected static final VoxelShape WEST_SHAPE; protected static final VoxelShape SOUTH_SHAPE; protected static final VoxelShape NORTH_SHAPE; public TinLadderBlock(Settings settings) { super(settings); this.setDefaultState(this.stateManager.getDefaultState() .with(FACING, Direction.NORTH) .with(WATERLOGGED, false)); } @Nullable private ActionResult checkCanTinLadderBePlaced(World world, BlockPos checkPos, BlockState state) { if (world.getBlockState(checkPos).isAir()) { BlockState newState = this.getDefaultState().with(FACING, state.get(FACING)); world.setBlockState(checkPos, newState); return ActionResult.SUCCESS; } else if (!(world.getBlockState(checkPos).getBlock() instanceof TinLadderBlock)) { return ActionResult.PASS; } return null; } @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ItemStack item = player.inventory.getStack(player.inventory.selectedSlot); if (Block.getBlockFromItem(item.getItem()) instanceof TinLadderBlock) { if (!player.isCreative()) item.decrement(1); if (player.pitch < 0f) { for (BlockPos checkPos = new BlockPos.Mutable(pos.getX(), pos.getY(), pos.getZ()); checkPos.getY() < world.getDimensionHeight(); checkPos = checkPos.add(0, 1, 0)) { ActionResult result = this.checkCanTinLadderBePlaced(world, checkPos, state); if (result != null) return result; } } else { for (BlockPos checkPos = new BlockPos.Mutable(pos.getX(), pos.getY(), pos.getZ()); checkPos.getY() > 0; checkPos = checkPos.add(0, -1, 0)) { ActionResult result = this.checkCanTinLadderBePlaced(world, checkPos, state); if (result != null) return result; } } } return ActionResult.PASS; } @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { if (!world.isClient) { world.getBlockTickScheduler().schedule(pos, this, 1); } else { super.onBlockAdded(state, world, pos, oldState, notify); } } @Override @Environment(EnvType.CLIENT) public float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) { return 1.0F; } @Override public VoxelShape getVisualShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return VoxelShapes.empty(); } @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { switch(state.get(FACING)) { case NORTH: return NORTH_SHAPE; case SOUTH: return SOUTH_SHAPE; case WEST: return WEST_SHAPE; case EAST: default: return EAST_SHAPE; } } @Override public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) { return VoxelShapes.empty(); } @Override public boolean isTranslucent(BlockState state, BlockView world, BlockPos pos) { return true; } public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { return true; } public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) { if (state.get(WATERLOGGED)) { world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } return super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom); } @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { BlockState blockState2; if (!ctx.canReplaceExisting()) { blockState2 = ctx.getWorld().getBlockState(ctx.getBlockPos().offset(ctx.getSide().getOpposite())); if (blockState2.isOf(this) && blockState2.get(FACING) == ctx.getSide()) { return null; } } blockState2 = this.getDefaultState(); WorldView worldView = ctx.getWorld(); BlockPos blockPos = ctx.getBlockPos(); FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); Direction[] var6 = ctx.getPlacementDirections(); for (Direction direction : var6) { if (direction.getAxis().isHorizontal()) { blockState2 = blockState2.with(FACING, direction.getOpposite()); if (blockState2.canPlaceAt(worldView, blockPos)) { return blockState2.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); } } } return null; } public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(FACING, rotation.rotate(state.get(FACING))); } public BlockState mirror(BlockState state, BlockMirror mirror) { return state.rotate(mirror.getRotation(state.get(FACING))); } protected void appendProperties(StateManager.Builder<Block, BlockState> builder) { builder.add(FACING, WATERLOGGED); } public FluidState getFluidState(BlockState state) { return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); } static { FACING = HorizontalFacingBlock.FACING; WATERLOGGED = Properties.WATERLOGGED; EAST_SHAPE = Block.createCuboidShape(0.0D, 0.0D, 0.0D, 3.0D, 16.0D, 16.0D); WEST_SHAPE = Block.createCuboidShape(13.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); SOUTH_SHAPE = Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 3.0D); NORTH_SHAPE = Block.createCuboidShape(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D); } }
c8bd60146febb935d1c8178077e9ce55ee0893d7
b3ad513a6083d21cbfc21938a6fc01b58feaff95
/app/src/main/java/com/appjumper/silkscreen/bean/Province.java
e37f2e59c31e9458787cb21a95367a356557f805
[]
no_license
beyondbox/net
e0d9b12b8d5e45d31f6a1430a9399ccc2c6a249a
5c2bbc2f1e77a75dc541ac58192fd7361a4603d6
refs/heads/master
2021-01-20T14:29:34.517648
2018-03-20T08:13:03
2018-03-20T08:13:03
90,618,930
0
1
null
null
null
null
UTF-8
Java
false
false
800
java
package com.appjumper.silkscreen.bean; /** * Created by botx on 2017/9/30. */ public class Province { /** * province_id : 820 * province_name : 江苏 * shuling : 12 */ private String province_id; private String province_name; private String shuling; public String getProvince_id() { return province_id; } public void setProvince_id(String province_id) { this.province_id = province_id; } public String getProvince_name() { return province_name; } public void setProvince_name(String province_name) { this.province_name = province_name; } public String getShuling() { return shuling; } public void setShuling(String shuling) { this.shuling = shuling; } }
21e9bf56dab60388d4571765e83f4f7742e6ff92
68e0c2a454d453bb95271d9ede2330149878c2fe
/app/src/main/java/adapter/BooksAdapter.java
bc4a9e6665bf52529c13d1a53f3631451e42c69f
[]
no_license
SartikaHsb/BookStoreApps
b5a1a986db0e598a65f9376cd60584189a62dd78
016b84f5f4179cd0e006e151f1dc52b94800cb7a
refs/heads/master
2021-01-11T06:17:49.024634
2016-10-04T23:33:42
2016-10-04T23:33:42
69,968,919
0
0
null
null
null
null
UTF-8
Java
false
false
11,332
java
package adapter; /** * Created by sartikahasibuan on 7/8/2016. */ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Point; import android.graphics.Rect; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.DecelerateInterpolator; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.zxcvbn.bookstore.R; import com.squareup.picasso.Picasso; import activity.Detail_Book; import provider.GlobalData; import model.DataContentProvider; public class BooksAdapter extends BaseAdapter { String [] result; Context context; String [] imageCover; String[] price; String[] getBookTitle; String[] getBookPrice; String[] getBookCover; private static LayoutInflater inflater=null; GlobalData global_data = new GlobalData(); DataContentProvider dataContentProvider; private Animator mCurrentAnimator; private int mShortAnimationDuration; private String URL = "http://www.g-i.com.my:3002"; public BooksAdapter(Context c, String id) { // TODO Auto-generated constructor stub context= c; if(id!=null) { getBookTitle = DataContentProvider.getBookTitle(context, id); getBookPrice = DataContentProvider.getBookPrice(context, id); } else { getBookTitle = DataContentProvider.getBookTit(context); getBookPrice = DataContentProvider.getBookPr(context); getBookCover = DataContentProvider.getCoverBook(context); } int[] getCover = DataContentProvider.getCover(context); result=getBookTitle; price = getBookPrice; imageCover = getBookCover; //imageId=getCover; inflater = ( LayoutInflater )context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { // TODO Auto-generated method stub return result.length; } @Override public Object getItem(int position) { // TODO Auto-generated method stub return position; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } public class Holder { TextView tvTitle; TextView tvPrice; ImageView img; } @Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub Holder holder=new Holder(); View rowView; ImageView imageView = new ImageView(this.context); rowView = inflater.inflate(R.layout.book_list, null); holder.tvTitle=(TextView) rowView.findViewById(R.id.textView1); holder.tvPrice=(TextView) rowView.findViewById(R.id.textView2); holder.img=(ImageView) rowView.findViewById(R.id.imageView1); holder.tvTitle.setText(result[position]); holder.tvPrice.setText("RM "+price[position]); Picasso.with(context).load(URL+imageCover[position]).into(holder.img); Log.d("URL Images",""+URL+imageCover[position]); //holder.img.setImageResource(imageId[position]); imageView.setLayoutParams(new GridView.LayoutParams(200,150)); rowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(context, "You Clicked "+result[position], Toast.LENGTH_LONG).show(); String res=result[position]; // int id = (Integer) v.getTag(); //zoomImageFromThumb(v, imageId[position]); Intent intent = new Intent(context, Detail_Book.class); intent.putExtra("book_name",res); context.startActivity(intent); } }); return rowView; } private void zoomImageFromThumb(final View thumbView, int imageResId) { // If there's an animation in progress, cancel it immediately and // proceed with this one. if (mCurrentAnimator != null) { mCurrentAnimator.cancel(); } // Load the high-resolution "zoomed-in" image. final ImageView expandedImageView = (ImageView) ((Activity) context) .findViewById(R.id.expanded_image); expandedImageView.setImageResource(imageResId); // Calculate the starting and ending bounds for the zoomed-in image. // This step // involves lots of math. Yay, math. final Rect startBounds = new Rect(); final Rect finalBounds = new Rect(); final Point globalOffset = new Point(); // The start bounds are the global visible rectangle of the thumbnail, // and the // final bounds are the global visible rectangle of the container view. // Also // set the container view's offset as the origin for the bounds, since // that's // the origin for the positioning animation properties (X, Y). thumbView.getGlobalVisibleRect(startBounds); ((Activity) context).findViewById(R.id.container) .getGlobalVisibleRect(finalBounds, globalOffset); startBounds.offset(-globalOffset.x, -globalOffset.y); finalBounds.offset(-globalOffset.x, -globalOffset.y); // Adjust the start bounds to be the same aspect ratio as the final // bounds using the // "center crop" technique. This prevents undesirable stretching during // the animation. // Also calculate the start scaling factor (the end scaling factor is // always 1.0). float startScale; if ((float) finalBounds.width() / finalBounds.height() > (float) startBounds .width() / startBounds.height()) { // Extend start bounds horizontally startScale = (float) startBounds.height() / finalBounds.height(); float startWidth = startScale * finalBounds.width(); float deltaWidth = (startWidth - startBounds.width()) / 2; startBounds.left -= deltaWidth; startBounds.right += deltaWidth; } else { // Extend start bounds vertically startScale = (float) startBounds.width() / finalBounds.width(); float startHeight = startScale * finalBounds.height(); float deltaHeight = (startHeight - startBounds.height()) / 2; startBounds.top -= deltaHeight; startBounds.bottom += deltaHeight; } // Hide the thumbnail and show the zoomed-in view. When the animation // begins, // it will position the zoomed-in view in the place of the thumbnail. thumbView.setAlpha(0f); expandedImageView.setVisibility(View.VISIBLE); // Set the pivot point for SCALE_X and SCALE_Y transformations to the // top-left corner of // the zoomed-in view (the default is the center of the view). expandedImageView.setPivotX(0f); expandedImageView.setPivotY(0f); // Construct and run the parallel animation of the four translation and // scale properties // (X, Y, SCALE_X, and SCALE_Y). AnimatorSet set = new AnimatorSet(); set.play( ObjectAnimator.ofFloat(expandedImageView, View.X, startBounds.left, finalBounds.left)) .with(ObjectAnimator.ofFloat(expandedImageView, View.Y, startBounds.top, finalBounds.top)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X, startScale, 1f)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y, startScale, 1f)); set.setDuration(mShortAnimationDuration); set.setInterpolator(new DecelerateInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mCurrentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { mCurrentAnimator = null; } }); set.start(); mCurrentAnimator = set; // Upon clicking the zoomed-in image, it should zoom back down to the // original bounds // and show the thumbnail instead of the expanded image. final float startScaleFinal = startScale; expandedImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mCurrentAnimator != null) { mCurrentAnimator.cancel(); } // Animate the four positioning/sizing properties in parallel, // back to their // original values. AnimatorSet set = new AnimatorSet(); set.play( ObjectAnimator.ofFloat(expandedImageView, View.X, startBounds.left)) .with(ObjectAnimator.ofFloat(expandedImageView, View.Y, startBounds.top)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X, startScaleFinal)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y, startScaleFinal)); set.setDuration(mShortAnimationDuration); set.setInterpolator(new DecelerateInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { thumbView.setAlpha(1f); expandedImageView.setVisibility(View.GONE); mCurrentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { thumbView.setAlpha(1f); expandedImageView.setVisibility(View.GONE); mCurrentAnimator = null; } }); set.start(); mCurrentAnimator = set; } }); } }
ede767320f49669c1eb95de7b4637aab35e8bb03
9dfb2d0bf7691f388ef6bde3c5e8cc0c40f57948
/coding/src/Nets/no1.java
ebdc0db70d1844c1072b84abc911e9ffc648181b
[]
no_license
fengxiaozhou/job_coding
0cc392395f4be371ca08961757e6755618ae4868
50200d740927152cff74ae05f331711da11b4db4
refs/heads/master
2020-03-21T22:49:27.318604
2018-10-30T09:08:58
2018-10-30T09:08:58
139,149,513
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package Nets; import java.util.Scanner; /** * @author Fz * @date 2018/9/8 16:57 */ public class no1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); if(sc.next()=="bwbwb") System.out.println(5); if(sc.next()=="wwb") System.out.println(3); } }