blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
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
listlengths
1
1
author_id
stringlengths
0
313
cae2a5a97bfee84a7b171c7c6f28952da057b5bc
8df5741c65fbe977a9bac401424a9844281bde56
/app/src/main/java/uk/co/barkersmedia/iitcv2/PrefferencesActivity.java
25653775102871441fadd22bc525f8ddedf6c7c4
[]
no_license
barkermn01/IITC_Android_V2
d0a1e6cf7a35befe5da4531ec7e02e1d614b3ef1
6abfa06db2082b8a54602a446d1ba0ef39a7ccd6
refs/heads/master
2020-03-29T00:59:43.102448
2018-09-18T23:56:34
2018-09-18T23:56:34
149,366,116
0
0
null
null
null
null
UTF-8
Java
false
false
783
java
package uk.co.barkersmedia.iitcv2; import android.os.Bundle; import android.preference.PreferenceFragment; public class PrefferencesActivity extends AppCompatPreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getFragmentManager().beginTransaction().replace(android.R.id.content, new HomePreffernceFragment()).commit(); } public static class HomePreffernceFragment extends PreferenceFragment { @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs_home); } } }
[ "martin-barker@hotmail.co.uk" ]
martin-barker@hotmail.co.uk
a2f0a14486413a3bc299cdf25d738888b33b625f
5979994b215fabe125cd756559ef2166c7df7519
/aimir-service-mvm/src/main/java/com/aimir/service/mvm/impl/MvmHmChartViewManagerImpl.java
5f2f2ba2dbbcd8708eb71927bf089352b20a278c
[]
no_license
TechTinkerer42/Haiti
91c45cb1b784c9afc61bf60d43e1d5623aeba888
debaea96056d1d4611b79bd846af8f7484b93e6e
refs/heads/master
2023-04-28T23:39:43.176592
2021-05-03T10:49:42
2021-05-03T10:49:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,906
java
package com.aimir.service.mvm.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.aimir.dao.mvm.DayHMDao; import com.aimir.dao.mvm.LpHMDao; import com.aimir.dao.mvm.MonthHMDao; import com.aimir.dao.mvm.SeasonDao; import com.aimir.dao.view.DayHMViewDao; import com.aimir.dao.view.MonthHMViewDao; import com.aimir.model.mvm.DayHM; import com.aimir.model.mvm.LpHM; import com.aimir.model.mvm.MonthHM; import com.aimir.model.mvm.Season; import com.aimir.model.view.DayHMView; import com.aimir.model.view.MonthHMView; import com.aimir.util.Condition; import com.aimir.util.Condition.Restriction; import com.aimir.util.SearchCalendarUtil; @Service(value = "MvmHmChartViewManagerImpl") public class MvmHmChartViewManagerImpl { @Autowired LpHMDao lpHMDao; @Autowired DayHMDao dayHMDao; @Autowired DayHMViewDao dayHMViewDao; @Autowired MonthHMDao monthHMDao; @Autowired MonthHMViewDao monthHMViewDao; @Autowired SeasonDao seasonDao; /** * @Method Name : getHMSearchDataHour * @Date : 2010. 4. 15. * @Method 설명 : 시간별 차트 조회 * @param set * @param custList * @return */ public HashMap<String, Object> getHMSearchDataHour(Set<Condition> set, Integer[] custList) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); Double[] avgValue = new Double[custList.length]; Double[] maxValue = new Double[custList.length]; Double[] minValue = new Double[custList.length]; Double[] sumValue = new Double[custList.length]; if(custList.length >0 && custList != null) { for(int idx=0;idx < custList.length;idx++) { Condition cdt = new Condition("contract.id", new Object[] { custList[idx] }, null,Restriction.EQ);// set.add(cdt); avgValue[idx] = (Double) lpHMDao.getLpHMsMaxMinSumAvg(set, "avg").get(0); maxValue[idx] = (Double) lpHMDao.getLpHMsMaxMinSumAvg(set, "max").get(0); minValue[idx] = (Double) lpHMDao.getLpHMsMaxMinSumAvg(set, "min").get(0); sumValue[idx] = (Double) lpHMDao.getLpHMsMaxMinSumAvg(set, "sum").get(0); set.remove(cdt); } Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); List<LpHM> dataList = lpHMDao.getLpHMsByListCondition(set); resultHm.put("arrAvgValue", avgValue); resultHm.put("arrMaxValue", maxValue); resultHm.put("arrMinValue", minValue); resultHm.put("arrSumValue", sumValue); resultHm.put("arrContId", custList); resultHm.put("dataList", dataList); } return resultHm; } /** * @Method Name : getHMSearchDataDay * @Date : 2010. 4. 15. * @Method 설명 : 일자/기간별차트 조회 * @param set : 조회조건 * @param custList : 고객정보 * @return */ public HashMap<String, Object> getHMSearchDataDay(Set<Condition> set, Integer[] custList) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); Double[] avgValue = new Double[custList.length]; Double[] maxValue = new Double[custList.length]; Double[] minValue = new Double[custList.length]; Double[] sumValue = new Double[custList.length]; if(custList.length >0 && custList != null) { for(int idx=0;idx < custList.length;idx++) { Condition cdt = new Condition("contract.id", new Object[] { custList[idx] }, null,Restriction.EQ);// set.add(cdt); avgValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "avg").get(0); maxValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "max").get(0); minValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "min").get(0); sumValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "sum").get(0); set.remove(cdt); } Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); List<DayHM> dataList = dayHMDao.getDayHMsByListCondition(set); resultHm.put("arrAvgValue", avgValue); resultHm.put("arrMaxValue", maxValue); resultHm.put("arrMinValue", minValue); resultHm.put("arrSumValue", sumValue); resultHm.put("arrContId", custList); resultHm.put("dataList", dataList); } return resultHm; } public HashMap<String, Object> getHMSearchDataDayView(Set<Condition> set, Integer[] custList) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); Double[] avgValue = new Double[custList.length]; Double[] maxValue = new Double[custList.length]; Double[] minValue = new Double[custList.length]; Double[] sumValue = new Double[custList.length]; if(custList.length >0 && custList != null) { for(int idx=0;idx < custList.length;idx++) { Condition cdt = new Condition("contract.id", new Object[] { custList[idx] }, null,Restriction.EQ);// set.add(cdt); avgValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "avg").get(0); maxValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "max").get(0); minValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "min").get(0); sumValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "sum").get(0); set.remove(cdt); } Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); List<DayHMView> dataList = dayHMViewDao.getDayHMsByListCondition(set); resultHm.put("arrAvgValue", avgValue); resultHm.put("arrMaxValue", maxValue); resultHm.put("arrMinValue", minValue); resultHm.put("arrSumValue", sumValue); resultHm.put("arrContId", custList); resultHm.put("dataList", dataList); } return resultHm; } /** * @Method Name : getHMSearchDataMonth * @Date : 2010. 4. 15. * @Method 설명 : 월별조회 * @param set * @param custList * @return */ public HashMap<String, Object> getHMSearchDataMonth(Set<Condition> set, Integer[] custList) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); Double[] avgValue = new Double[custList.length]; Double[] maxValue = new Double[custList.length]; Double[] minValue = new Double[custList.length]; Double[] sumValue = new Double[custList.length]; if(custList.length >0 && custList != null) { for(int idx=0;idx < custList.length;idx++) { Condition cdt = new Condition("contract.id", new Object[] { custList[idx] }, null,Restriction.EQ);// set.add(cdt); avgValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "avg").get(0); maxValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "max").get(0); minValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "min").get(0); sumValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "sum").get(0); set.remove(cdt); } Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); List<MonthHM> dataList = monthHMDao.getMonthHMsByListCondition(set); resultHm.put("arrAvgValue", avgValue); resultHm.put("arrMaxValue", maxValue); resultHm.put("arrMinValue", minValue); resultHm.put("arrSumValue", sumValue); resultHm.put("arrContId", custList); resultHm.put("dataList", dataList); } return resultHm; } public HashMap<String, Object> getHMSearchDataMonthView(Set<Condition> set, Integer[] custList) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); Double[] avgValue = new Double[custList.length]; Double[] maxValue = new Double[custList.length]; Double[] minValue = new Double[custList.length]; Double[] sumValue = new Double[custList.length]; if(custList.length >0 && custList != null) { for(int idx=0;idx < custList.length;idx++) { Condition cdt = new Condition("contract.id", new Object[] { custList[idx] }, null,Restriction.EQ);// set.add(cdt); avgValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "avg").get(0); maxValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "max").get(0); minValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "min").get(0); sumValue[idx] = (Double) monthHMDao.getMonthHMsMaxMinAvgSum(set, "sum").get(0); set.remove(cdt); } Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); List<MonthHMView> dataList = monthHMViewDao.getMonthHMsByListCondition(set); resultHm.put("arrAvgValue", avgValue); resultHm.put("arrMaxValue", maxValue); resultHm.put("arrMinValue", minValue); resultHm.put("arrSumValue", sumValue); resultHm.put("arrContId", custList); resultHm.put("dataList", dataList); } return resultHm; } /** * @Method Name : getHMSearchDataDayWeek * @Date : 2010. 4. 15. * @Method 설명 : 요일별조회 * @param set * @param custList * @return */ public HashMap<String, Object> getHMSearchDataDayWeek(Set<Condition> set, Integer[] custList) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); Double[] avgValue = new Double[custList.length]; Double[] maxValue = new Double[custList.length]; Double[] minValue = new Double[custList.length]; Double[] sumValue = new Double[custList.length]; if(custList.length >0 && custList != null) { for(int idx=0;idx < custList.length;idx++) { Condition cdt = new Condition("contract.id", new Object[] { custList[idx] }, null,Restriction.EQ);// set.add(cdt); avgValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "avg").get(0); maxValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "max").get(0); minValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "min").get(0); sumValue[idx] = (Double) dayHMDao.getDayHMsMaxMinAvgSum(set, "sum").get(0); set.remove(cdt); } Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); List<DayHM> dataList = dayHMDao.getDayHMsByListCondition(set); resultHm.put("arrAvgValue", avgValue); resultHm.put("arrMaxValue", maxValue); resultHm.put("arrMinValue", minValue); resultHm.put("arrSumValue", sumValue); resultHm.put("arrContId", custList); resultHm.put("dataList", dataList); } return resultHm; } /** * @Method Name : getHMSearchDataSeason * @Date : 2010. 4. 14. * @Method 설명 : 계절별조회 * @param set * @param custList * @param year * @return : 계절별데이터, 계절명 */ public HashMap<String, Object> getHMSearchDataSeason(Set<Condition> set,Integer[] custList, String year) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); // season별 조회조건 가져오기 List<Season> searchDataList = getSeasonDate(year); ArrayList<String> arrFirstName = new ArrayList<String>(); int rowNum =searchDataList.size(); for (int idx = 0; idx < searchDataList.size(); idx++) { String beginDate = searchDataList.get(idx).getSyear() + searchDataList.get(idx).getSmonth()+ searchDataList.get(idx).getSday(); String endDate = searchDataList.get(idx).getEyear() + searchDataList.get(idx).getEmonth()+ searchDataList.get(idx).getEday(); arrFirstName.add(searchDataList.get(idx).getName()); if ((beginDate != null && beginDate.length() != 0) && (endDate != null && endDate.length() != 0)) { Condition cdt3 = new Condition("id.yyyymmdd", new Object[] { beginDate, endDate }, null, Restriction.BETWEEN); set.add(cdt3); List<Object> dataList = dayHMDao.getDayHMsSumList(set); resultHm.put("dataList"+idx, dataList); set.remove(cdt3); } } resultHm.put("firstColNm", arrFirstName); resultHm.put("rowNum", rowNum); resultHm.put("contractId", custList); return resultHm; } /** * @Method Name : getHMSearchDataWeek * @Date : 2010. 4. 15. * @Method 설명 : 주별조회 * @param set * @param custList * @param yyMM * @return */ public HashMap<String, Object> getHMSearchDataWeek(Set<Condition> set, Integer[] custList, String yyMM) { HashMap<String, Object> resultHm = new HashMap<String, Object>(); ArrayList<String> arrFirstName = new ArrayList<String>(); int rowNum= 0; Condition cdt = new Condition("contract.id", custList, null,Restriction.IN);// set.add(cdt); SearchCalendarUtil sCaldUtil = new SearchCalendarUtil(); List<String> DateList = sCaldUtil.getMonthToBeginDateEndDate(yyMM); // 조회일자 가져오기 for (rowNum = 0; rowNum < DateList.size(); rowNum++) { String val = DateList.get(rowNum); String beginDate = val.substring(0, 8); String endDate = val.substring(8, 16); if ((beginDate != null && beginDate.length() != 0) && (endDate != null && endDate.length() != 0)) { Condition cdt1 = new Condition("id.yyyymmdd", new Object[] { beginDate, endDate }, null, Restriction.BETWEEN); set.add(cdt1); List<Object> dataList = dayHMDao.getDayHMsSumList(set); resultHm.put("dataList"+rowNum, dataList); set.remove(cdt1); arrFirstName.add((rowNum+1)+"Week"); } } resultHm.put("firstColNm", arrFirstName); resultHm.put("rowNum", rowNum); resultHm.put("contractId", custList); return resultHm; } /* * Season의 계절별 시작일, 종료일 가져오기 */ private List<Season> getSeasonDate (String year) { List<Season> result = new ArrayList<Season>(); List<Season> searchSeasonList = seasonDao.getSeasonsBySyear(year); if (searchSeasonList.size() > 0 && searchSeasonList != null) { result = searchSeasonList; } else { List<Season> seasonList = seasonDao.getSeasonsBySyearIsNull(); Iterator it = seasonList.iterator(); while (it.hasNext()) { Season retSeason = (Season) it.next(); String[] searchDate = new String[2]; if("Spring".equals(retSeason.getName())) { retSeason.setSyear(year); retSeason.setSday("01"); retSeason.setEyear(year); retSeason.setEmonth("31"); result.add(retSeason); } else if("Summer".equals(retSeason.getName())) { retSeason.setSyear(year); retSeason.setSday("01"); retSeason.setEyear(year); retSeason.setEmonth("31"); result.add(retSeason); } else if("Autumn".equals(retSeason.getName())) { retSeason.setSyear(year); retSeason.setSday("01"); retSeason.setEyear(year); retSeason.setEmonth("31"); result.add(retSeason); } else { retSeason.setSyear(year); retSeason.setSday("01"); retSeason.setEyear((Integer.parseInt(year)+1)+""); retSeason.setEmonth("31"); result.add(retSeason); } } } return result; } }
[ "marsr0913@nuritelecom.com" ]
marsr0913@nuritelecom.com
46cc6f8852d6e7938b5061f97906695a8dae6fb1
29ea3a1ded09a11de2b9afacbad39796f665613e
/src/struts/src/com/helloweenvsfei/struts/form/PersonForm.java
8780e0d6831b4b64fc98da5bea312e37848baa7c
[]
no_license
seuqer/webStudy
af51262edabaed4ee652c718d5b675b30c3236c6
bb19f582b5ea18ddc0a239b2b451693e8a3dadc1
refs/heads/master
2021-07-21T11:55:03.940999
2017-10-29T12:53:10
2017-10-29T12:53:10
108,733,115
0
0
null
null
null
null
UTF-8
Java
false
false
3,149
java
/* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.helloweenvsfei.struts.form; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; /** * MyEclipse Struts Creation date: 04-30-2008 * * XDoclet definition: * * @struts.form name="personForm" */ public class PersonForm extends ActionForm { private static final long serialVersionUID = -4399412058693078781L; /** id property */ private Integer id; /** birthday property */ private String birthday; /** name property */ private String name; /** hobby property */ private String[] hobby; /** action property */ private String action; /** secret property */ private boolean secret; /** account property */ private String account; /* * Generated Methods */ /** * Method validate * * @param mapping * @param request * @return ActionErrors */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { // TODO Auto-generated method stub return null; } /** * Method reset * * @param mapping * @param request */ public void reset(ActionMapping mapping, HttpServletRequest request) { // TODO Auto-generated method stub } /** * Returns the id. * * @return Integer */ public Integer getId() { return id; } /** * Set the id. * * @param id * The id to set */ public void setId(Integer id) { this.id = id; } /** * Returns the birthday. * * @return String */ public String getBirthday() { return birthday; } /** * Set the birthday. * * @param birthday * The birthday to set */ public void setBirthday(String birthday) { this.birthday = birthday; } /** * Returns the name. * * @return String */ public String getName() { return name; } /** * Set the name. * * @param name * The name to set */ public void setName(String name) { this.name = name; } /** * Returns the hobby. * * @return String[] */ public String[] getHobby() { return hobby; } /** * Set the hobby. * * @param hobby * The hobby to set */ public void setHobby(String[] hobby) { this.hobby = hobby; } /** * Returns the action. * * @return String */ public String getAction() { return action; } /** * Set the action. * * @param action * The action to set */ public void setAction(String action) { this.action = action; } /** * Returns the secret. * * @return boolean */ public boolean getSecret() { return secret; } /** * Set the secret. * * @param secret * The secret to set */ public void setSecret(boolean secret) { this.secret = secret; } /** * Returns the account. * * @return String */ public String getAccount() { return account; } /** * Set the account. * * @param account * The account to set */ public void setAccount(String account) { this.account = account; } }
[ "seuqer@163.com" ]
seuqer@163.com
5f9b5d764f84b3e205b72a81d451387ca1635865
0f9f222244915c73a3d5bd53c19549e10d0590bb
/src/main/java/uk/gov/hmcts/reform/bulkscanprocessor/model/out/msg/ErrorMsg.java
bcdfaf6d57afbf3bd41c93b5180e92ed9a81f313
[ "MIT" ]
permissive
7u4/bulk-scan-processor
ab4507244cbaf109dead73e1927c00ccae0c20d4
aa6fd4fee2d5ed4e0e878ed0aa3697bcc001e802
refs/heads/master
2020-09-04T23:22:41.399107
2019-11-05T13:27:16
2019-11-05T13:27:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,805
java
package uk.gov.hmcts.reform.bulkscanprocessor.model.out.msg; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** * Message describing an error processing an envelope. */ public class ErrorMsg implements Msg { public final String id; public final Long eventId; public final String zipFileName; public final String jurisdiction; public final String poBox; public final String documentControlNumber; public final ErrorCode errorCode; public final String errorDescription; // region constructors @SuppressWarnings("squid:S00107") // number of params public ErrorMsg( @JsonProperty(value = "id", required = true) String id, @JsonProperty(value = "eventId", required = true) Long eventId, @JsonProperty(value = "zipFileName", required = true) String zipFileName, @JsonProperty("jurisdiction") String jurisdiction, @JsonProperty("poBox") String poBox, @JsonProperty("documentControlNumber") String documentControlNumber, @JsonProperty(value = "errorCode", required = true) ErrorCode errorCode, @JsonProperty(value = "errorDescription", required = true) String errorDescription ) { this.id = id; this.eventId = eventId; this.zipFileName = zipFileName; this.jurisdiction = jurisdiction; this.poBox = poBox; this.documentControlNumber = documentControlNumber; this.errorCode = errorCode; this.errorDescription = errorDescription; } // endregion // region getters @JsonIgnore @Override public String getMsgId() { return this.id; } @JsonIgnore @Override public String getLabel() { return null; } // endregion }
[ "noreply@github.com" ]
7u4.noreply@github.com
b29cc9479b1ce03ccdd40ce5396df51005df379a
6859095764765927a9ff4a36591800464a9b7f65
/src/com/jmex/model/collada/ColladaRootNode.java
e66a9718aa24693ab46b61da37512e80421c0aab
[]
no_license
dertom95/openwonderland-jme2
1fcaff4b1a6410c3cfc132b9072323f5dd52188b
4aa3f2772cc3f64be8bc6fc0bfa953e84ea9d3b8
refs/heads/master
2022-01-15T06:40:45.198913
2015-10-12T06:20:16
2015-10-12T06:20:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,085
java
/* * Copyright (c) 2011 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'jMonkeyEngine' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.jmex.model.collada; import com.jme.renderer.Renderer; import com.jme.scene.Node; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; /** * The root of a COLLADA model * @author Jonathan Kaplan */ public class ColladaRootNode extends Node { private final Map<String, ColladaAnimationGroup> animationGroups = new LinkedHashMap<String, ColladaAnimationGroup>(); private ColladaAnimationGroup currentGroup; public ColladaRootNode(String name) { super ("ColladaRoot - " + name); } /** * Add an animation group * @param group the group to add */ public void addAnimationGroup(ColladaAnimationGroup group) { animationGroups.put(group.getName(), group); // if there is no current group, set the current group if (currentGroup == null) { currentGroup = group; currentGroup.setPlaying(true); } } /** * Get the current animation group * @return the current animation group, or null if there is no current * group */ public ColladaAnimationGroup getCurrentGroup() { return currentGroup; } /** * Set the current animation group to the group with the given name * @param name the name of the animation group to make current * @return the group that was made current */ public ColladaAnimationGroup setCurrentGroup(String name) { currentGroup = animationGroups.get(name); return currentGroup; } /** * Set the current animation group to the given animation group * @return the group to set */ public void setCurrentGroup(ColladaAnimationGroup group) { currentGroup = group; } /** * Get all animation groups * @return all animation groups */ public Collection<ColladaAnimationGroup> getAnimationGroups() { return animationGroups.values(); } /** * Get the names of all animation groups * @return the names of all groups. */ public Set<String> getAnimationNames() { return animationGroups.keySet(); } @Override public void draw(Renderer r) { // before drawing chilren, update the current animation group (if any) ColladaAnimationGroup current = getCurrentGroup(); if (current != null) { current.update(); } super.draw(r); } }
[ "abhiit61@1c5ca2ba-d46e-4326-9e01-d7f1c7c16fc5" ]
abhiit61@1c5ca2ba-d46e-4326-9e01-d7f1c7c16fc5
6c92d48530e39691402fe4a7c153d66f4b0a7554
5d993c08dfad80ef8566a5bd902475c0aab8c1ff
/src/test/java/org/apache/mina/core/buffer/IoBufferTest.java
b8757dcb18385bef506b9d8c3b12bb2fdd1f216d
[]
no_license
nameliyang/mina
743dcfeed5bd86f6f9b83fb3052be677e166b1e4
7619765c4a0c9d3e0b326f5790c4fb38959d5aaa
refs/heads/master
2021-01-22T22:44:57.647261
2017-06-01T03:57:21
2017-06-01T03:57:21
92,791,739
0
0
null
null
null
null
UTF-8
Java
false
false
54,416
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.mina.core.buffer; import org.apache.mina.util.Bar; import org.junit.Test; import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ReadOnlyBufferException; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.util.ArrayList; import java.util.Date; import java.util.EnumSet; import java.util.List; import static org.junit.Assert.*; /** * Tests the {@link IoBuffer} class. * * @author <a href="http://mina.apache.org">Apache MINA Project</a> */ public class IoBufferTest { private static interface NonserializableInterface { } public static class NonserializableClass { } /** * Test the capacity(newCapacity) method. */ @Test public void testCapacity() { IoBuffer buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); // See if we can decrease the capacity (we shouldn't be able to go under the minimul capacity) IoBuffer newBuffer = buffer.capacity(7); assertEquals(10, newBuffer.capacity()); assertEquals(buffer, newBuffer); // See if we can increase the capacity buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); newBuffer = buffer.capacity(14); assertEquals(14, newBuffer.capacity()); assertEquals(buffer, newBuffer); newBuffer.put(0, (byte)'9'); assertEquals((byte)'9', newBuffer.get(0)); assertEquals((byte)'9', buffer.get(0)); // See if we can go down when the minimum capacity is below the current capacity // We should not. buffer = IoBuffer.allocate(10); buffer.capacity(5); assertEquals(10, buffer.minimumCapacity()); assertEquals(10, buffer.capacity()); } /** * Test the expand(expectedRemaining) method. */ @Test public void testExpand() { IoBuffer buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); assertEquals(6, buffer.remaining()); // See if we can expand with a lower number of remaining bytes. We should not. IoBuffer newBuffer = buffer.expand(2); assertEquals(6, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(0, newBuffer.position()); // Now, let's expand the buffer above the number of current bytes but below the limit buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); newBuffer = buffer.expand(8); assertEquals(8, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(0, newBuffer.position()); // Last, expand the buffer above the limit buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); newBuffer = buffer.expand(12); assertEquals(12, newBuffer.limit()); assertEquals(12, newBuffer.capacity()); assertEquals(0, newBuffer.position()); // Now, move forward in the buffer buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); buffer.position(4); // See if we can expand with a lower number of remaining bytes. We should not. newBuffer = buffer.expand(2); assertEquals(6, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(4, newBuffer.position()); // Expand above the current limit buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); buffer.position(4); newBuffer = buffer.expand(3); assertEquals(7, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(4, newBuffer.position()); // Expand above the current capacity buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); buffer.position(4); newBuffer = buffer.expand(7); assertEquals(11, newBuffer.limit()); assertEquals(11, newBuffer.capacity()); assertEquals(4, newBuffer.position()); } /** * Test the expand(position, expectedRemaining) method. */ @Test public void testExpandPos() { IoBuffer buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); assertEquals(6, buffer.remaining()); // See if we can expand with a lower number of remaining bytes. We should not. IoBuffer newBuffer = buffer.expand(3, 2); assertEquals(6, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(0, newBuffer.position()); // Now, let's expand the buffer above the number of current bytes but below the limit buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); newBuffer = buffer.expand(3, 5); assertEquals(8, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(0, newBuffer.position()); // Last, expand the buffer above the limit buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); newBuffer = buffer.expand(3,9); assertEquals(12, newBuffer.limit()); assertEquals(12, newBuffer.capacity()); assertEquals(0, newBuffer.position()); // Now, move forward in the buffer buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); buffer.position(4); // See if we can expand with a lower number of remaining bytes. We should not be. newBuffer = buffer.expand(5, 1); assertEquals(6, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(4, newBuffer.position()); // Expand above the current limit buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); buffer.position(4); newBuffer = buffer.expand(5, 2); assertEquals(7, newBuffer.limit()); assertEquals(10, newBuffer.capacity()); assertEquals(4, newBuffer.position()); // Expand above the current capacity buffer = IoBuffer.allocate(10); buffer.put("012345".getBytes()); buffer.flip(); buffer.position(4); newBuffer = buffer.expand(5, 6); assertEquals(11, newBuffer.limit()); assertEquals(11, newBuffer.capacity()); assertEquals(4, newBuffer.position()); } /** * Test the normalizeCapacity(requestedCapacity) method. */ @Test public void testNormalizeCapacity() { // A few sanity checks assertEquals(Integer.MAX_VALUE, IoBufferImpl.normalizeCapacity(-10)); assertEquals(0, IoBufferImpl.normalizeCapacity(0)); assertEquals(Integer.MAX_VALUE, IoBufferImpl.normalizeCapacity(Integer.MAX_VALUE)); assertEquals(Integer.MAX_VALUE, IoBufferImpl.normalizeCapacity(Integer.MIN_VALUE)); assertEquals(Integer.MAX_VALUE, IoBufferImpl.normalizeCapacity(Integer.MAX_VALUE - 10)); // A sanity check test for all the powers of 2 for (int i = 0; i < 30; i++) { int n = 1 << i; assertEquals(n, IoBufferImpl.normalizeCapacity(n)); if (i > 1) { // test that n - 1 will be normalized to n (notice that n = 2^i) assertEquals(n, IoBufferImpl.normalizeCapacity(n - 1)); } // test that n + 1 will be normalized to 2^(i + 1) assertEquals(n << 1, IoBufferImpl.normalizeCapacity(n + 1)); } // The first performance test measures the time to normalize integers // from 0 to 2^27 (it tests 2^27 integers) long time = System.currentTimeMillis(); for (int i = 0; i < 1 << 27; i++) { int n = IoBufferImpl.normalizeCapacity(i); // do a simple superfluous test to prevent possible compiler or JVM // optimizations of not executing non used code/variables if (n == -1) { System.out.println("n should never be -1"); } } long time2 = System.currentTimeMillis(); //System.out.println("Time for performance test 1: " + (time2 - time) + "ms"); // The second performance test measures the time to normalize integers // from Integer.MAX_VALUE to Integer.MAX_VALUE - 2^27 (it tests 2^27 // integers) time = System.currentTimeMillis(); for (int i = Integer.MAX_VALUE; i > Integer.MAX_VALUE - (1 << 27); i--) { int n = IoBufferImpl.normalizeCapacity(i); // do a simple superfluous test to prevent possible compiler or JVM // optimizations of not executing non used code/variables if (n == -1) { System.out.println("n should never be -1"); } } time2 = System.currentTimeMillis(); //System.out.println("Time for performance test 2: " + (time2 - time) + "ms"); } @Test public void autoExpand() { IoBuffer buffer = IoBuffer.allocate(8, false); buffer.setAutoExpand(true); assertTrue("Should AutoExpand", buffer.isAutoExpand()); IoBuffer slice = buffer.slice(); assertFalse("Should *NOT* AutoExpand", buffer.isAutoExpand()); assertFalse("Should *NOT* AutoExpand", slice.isAutoExpand()); } /** * This class extends the AbstractIoBuffer class to have direct access to * the protected IoBuffer.normalizeCapacity() method and to expose it for * the tests. */ private static class IoBufferImpl extends AbstractIoBuffer { public static int normalizeCapacity(int requestedCapacity) { return IoBuffer.normalizeCapacity(requestedCapacity); } protected IoBufferImpl(AbstractIoBuffer parent) { super(parent); } protected IoBuffer asReadOnlyBuffer0() { return null; } protected void buf(ByteBuffer newBuf) { } protected IoBuffer duplicate0() { return null; } protected IoBuffer slice0() { return null; } public byte[] array() { return null; } public int arrayOffset() { return 0; } public ByteBuffer buf() { return null; } public void free() { } public boolean hasArray() { return false; } } @Test public void testObjectSerialization() throws Exception { IoBuffer buf = IoBuffer.allocate(16); buf.setAutoExpand(true); List<Object> o = new ArrayList<Object>(); o.add(new Date()); o.add(long.class); // Test writing an object. buf.putObject(o); // Test reading an object. buf.clear(); Object o2 = buf.getObject(); assertEquals(o, o2); // This assertion is just to make sure that deserialization occurred. assertNotSame(o, o2); } @Test public void testNonserializableClass() throws Exception { Class<?> c = NonserializableClass.class; IoBuffer buffer = IoBuffer.allocate(16); buffer.setAutoExpand(true); buffer.putObject(c); buffer.flip(); Object o = buffer.getObject(); assertEquals(c, o); assertSame(c, o); } @Test public void testNonserializableInterface() throws Exception { Class<?> c = NonserializableInterface.class; IoBuffer buffer = IoBuffer.allocate(16); buffer.setAutoExpand(true); buffer.putObject(c); buffer.flip(); Object o = buffer.getObject(); assertEquals(c, o); assertSame(c, o); } @Test public void testAllocate() throws Exception { for (int i = 10; i < 1048576 * 2; i = i * 11 / 10) // increase by 10% { IoBuffer buf = IoBuffer.allocate(i); assertEquals(0, buf.position()); assertEquals(buf.capacity(), buf.remaining()); assertTrue(buf.capacity() >= i); assertTrue(buf.capacity() < i * 2); } } /** * Test that we can't allocate a buffser with a negative value * @throws Exception */ @Test(expected=IllegalArgumentException.class) public void testAllocateNegative() throws Exception { IoBuffer.allocate(-1); } @Test public void testAutoExpand() throws Exception { IoBuffer buf = IoBuffer.allocate(1); buf.put((byte) 0); try { buf.put((byte) 0); fail("Buffer can't auto expand, with autoExpand property set at false"); } catch (BufferOverflowException e) { // Expected Exception as auto expand property is false assertTrue(true); } buf.setAutoExpand(true); buf.put((byte) 0); assertEquals(2, buf.position()); assertEquals(2, buf.limit()); assertEquals(2, buf.capacity()); buf.setAutoExpand(false); try { buf.put(3, (byte) 0); fail("Buffer can't auto expand, with autoExpand property set at false"); } catch (IndexOutOfBoundsException e) { // Expected Exception as auto expand property is false assertTrue(true); } buf.setAutoExpand(true); buf.put(3, (byte) 0); assertEquals(2, buf.position()); assertEquals(4, buf.limit()); assertEquals(4, buf.capacity()); // Make sure the buffer is doubled up. buf = IoBuffer.allocate(1).setAutoExpand(true); int lastCapacity = buf.capacity(); for (int i = 0; i < 1048576; i++) { buf.put((byte) 0); if (lastCapacity != buf.capacity()) { assertEquals(lastCapacity * 2, buf.capacity()); lastCapacity = buf.capacity(); } } } @Test public void testAutoExpandMark() throws Exception { IoBuffer buf = IoBuffer.allocate(4).setAutoExpand(true); buf.put((byte) 0); buf.put((byte) 0); buf.put((byte) 0); // Position should be 3 when we reset this buffer. buf.mark(); // Overflow it buf.put((byte) 0); buf.put((byte) 0); assertEquals(5, buf.position()); buf.reset(); assertEquals(3, buf.position()); } @Test public void testAutoShrink() throws Exception { IoBuffer buf = IoBuffer.allocate(8).setAutoShrink(true); // Make sure the buffer doesn't shrink too much (less than the initial // capacity.) buf.sweep((byte) 1); buf.fill(7); buf.compact(); assertEquals(8, buf.capacity()); assertEquals(1, buf.position()); assertEquals(8, buf.limit()); buf.clear(); assertEquals(1, buf.get()); // Expand the buffer. buf.capacity(32).clear(); assertEquals(32, buf.capacity()); // Make sure the buffer shrinks when only 1/4 is being used. buf.sweep((byte) 1); buf.fill(24); buf.compact(); assertEquals(16, buf.capacity()); assertEquals(8, buf.position()); assertEquals(16, buf.limit()); buf.clear(); for (int i = 0; i < 8; i++) { assertEquals(1, buf.get()); } // Expand the buffer. buf.capacity(32).clear(); assertEquals(32, buf.capacity()); // Make sure the buffer shrinks when only 1/8 is being used. buf.sweep((byte) 1); buf.fill(28); buf.compact(); assertEquals(8, buf.capacity()); assertEquals(4, buf.position()); assertEquals(8, buf.limit()); buf.clear(); for (int i = 0; i < 4; i++) { assertEquals(1, buf.get()); } // Expand the buffer. buf.capacity(32).clear(); assertEquals(32, buf.capacity()); // Make sure the buffer shrinks when 0 byte is being used. buf.fill(32); buf.compact(); assertEquals(8, buf.capacity()); assertEquals(0, buf.position()); assertEquals(8, buf.limit()); // Expand the buffer. buf.capacity(32).clear(); assertEquals(32, buf.capacity()); // Make sure the buffer doesn't shrink when more than 1/4 is being used. buf.sweep((byte) 1); buf.fill(23); buf.compact(); assertEquals(32, buf.capacity()); assertEquals(9, buf.position()); assertEquals(32, buf.limit()); buf.clear(); for (int i = 0; i < 9; i++) { assertEquals(1, buf.get()); } } @Test public void testGetString() throws Exception { IoBuffer buf = IoBuffer.allocate(16); CharsetDecoder decoder; Charset charset = Charset.forName("UTF-8"); buf.clear(); buf.putString("hello", charset.newEncoder()); buf.put((byte) 0); buf.flip(); assertEquals("hello", buf.getString(charset.newDecoder())); buf.clear(); buf.putString("hello", charset.newEncoder()); buf.flip(); assertEquals("hello", buf.getString(charset.newDecoder())); decoder = Charset.forName("ISO-8859-1").newDecoder(); buf.clear(); buf.put((byte) 'A'); buf.put((byte) 'B'); buf.put((byte) 'C'); buf.put((byte) 0); buf.position(0); assertEquals("ABC", buf.getString(decoder)); assertEquals(4, buf.position()); buf.position(0); buf.limit(1); assertEquals("A", buf.getString(decoder)); assertEquals(1, buf.position()); buf.clear(); assertEquals("ABC", buf.getString(10, decoder)); assertEquals(10, buf.position()); buf.clear(); assertEquals("A", buf.getString(1, decoder)); assertEquals(1, buf.position()); // Test a trailing garbage buf.clear(); buf.put((byte) 'A'); buf.put((byte) 'B'); buf.put((byte) 0); buf.put((byte) 'C'); buf.position(0); assertEquals("AB", buf.getString(4, decoder)); assertEquals(4, buf.position()); buf.clear(); buf.fillAndReset(buf.limit()); decoder = Charset.forName("UTF-16").newDecoder(); buf.put((byte) 0); buf.put((byte) 'A'); buf.put((byte) 0); buf.put((byte) 'B'); buf.put((byte) 0); buf.put((byte) 'C'); buf.put((byte) 0); buf.put((byte) 0); buf.position(0); assertEquals("ABC", buf.getString(decoder)); assertEquals(8, buf.position()); buf.position(0); buf.limit(2); assertEquals("A", buf.getString(decoder)); assertEquals(2, buf.position()); buf.position(0); buf.limit(3); assertEquals("A", buf.getString(decoder)); assertEquals(2, buf.position()); buf.clear(); assertEquals("ABC", buf.getString(10, decoder)); assertEquals(10, buf.position()); buf.clear(); assertEquals("A", buf.getString(2, decoder)); assertEquals(2, buf.position()); buf.clear(); try { buf.getString(1, decoder); fail(); } catch (IllegalArgumentException e) { // Expected an Exception, signifies test success assertTrue(true); } // Test getting strings from an empty buffer. buf.clear(); buf.limit(0); assertEquals("", buf.getString(decoder)); assertEquals("", buf.getString(2, decoder)); // Test getting strings from non-empty buffer which is filled with 0x00 buf.clear(); buf.putInt(0); buf.clear(); buf.limit(4); assertEquals("", buf.getString(decoder)); assertEquals(2, buf.position()); assertEquals(4, buf.limit()); buf.position(0); assertEquals("", buf.getString(2, decoder)); assertEquals(2, buf.position()); assertEquals(4, buf.limit()); } @Test public void testGetStringWithFailure() throws Exception { String test = "\u30b3\u30e1\u30f3\u30c8\u7de8\u96c6"; IoBuffer buffer = IoBuffer.wrap(test.getBytes("Shift_JIS")); // Make sure the limit doesn't change when an exception arose. int oldLimit = buffer.limit(); int oldPos = buffer.position(); try { buffer.getString(3, Charset.forName("ASCII").newDecoder()); fail(); } catch (Exception e) { assertEquals(oldLimit, buffer.limit()); assertEquals(oldPos, buffer.position()); } try { buffer.getString(Charset.forName("ASCII").newDecoder()); fail(); } catch (Exception e) { assertEquals(oldLimit, buffer.limit()); assertEquals(oldPos, buffer.position()); } } @Test public void testPutString() throws Exception { CharsetEncoder encoder; IoBuffer buf = IoBuffer.allocate(16); encoder = Charset.forName("ISO-8859-1").newEncoder(); buf.putString("ABC", encoder); assertEquals(3, buf.position()); buf.clear(); assertEquals('A', buf.get(0)); assertEquals('B', buf.get(1)); assertEquals('C', buf.get(2)); buf.putString("D", 5, encoder); assertEquals(5, buf.position()); buf.clear(); assertEquals('D', buf.get(0)); assertEquals(0, buf.get(1)); buf.putString("EFG", 2, encoder); assertEquals(2, buf.position()); buf.clear(); assertEquals('E', buf.get(0)); assertEquals('F', buf.get(1)); assertEquals('C', buf.get(2)); // C may not be overwritten // UTF-16: We specify byte order to omit BOM. encoder = Charset.forName("UTF-16BE").newEncoder(); buf.clear(); buf.putString("ABC", encoder); assertEquals(6, buf.position()); buf.clear(); assertEquals(0, buf.get(0)); assertEquals('A', buf.get(1)); assertEquals(0, buf.get(2)); assertEquals('B', buf.get(3)); assertEquals(0, buf.get(4)); assertEquals('C', buf.get(5)); buf.putString("D", 10, encoder); assertEquals(10, buf.position()); buf.clear(); assertEquals(0, buf.get(0)); assertEquals('D', buf.get(1)); assertEquals(0, buf.get(2)); assertEquals(0, buf.get(3)); buf.putString("EFG", 4, encoder); assertEquals(4, buf.position()); buf.clear(); assertEquals(0, buf.get(0)); assertEquals('E', buf.get(1)); assertEquals(0, buf.get(2)); assertEquals('F', buf.get(3)); assertEquals(0, buf.get(4)); // C may not be overwritten assertEquals('C', buf.get(5)); // C may not be overwritten // Test putting an emptry string buf.putString("", encoder); assertEquals(0, buf.position()); buf.putString("", 4, encoder); assertEquals(4, buf.position()); assertEquals(0, buf.get(0)); assertEquals(0, buf.get(1)); } @Test public void testGetPrefixedString() throws Exception { IoBuffer buf = IoBuffer.allocate(16); CharsetEncoder encoder; CharsetDecoder decoder; encoder = Charset.forName("ISO-8859-1").newEncoder(); decoder = Charset.forName("ISO-8859-1").newDecoder(); buf.putShort((short) 3); buf.putString("ABCD", encoder); buf.clear(); assertEquals("ABC", buf.getPrefixedString(decoder)); } @Test public void testPutPrefixedString() throws Exception { CharsetEncoder encoder; IoBuffer buf = IoBuffer.allocate(16); buf.fillAndReset(buf.remaining()); encoder = Charset.forName("ISO-8859-1").newEncoder(); // Without autoExpand buf.putPrefixedString("ABC", encoder); assertEquals(5, buf.position()); assertEquals(0, buf.get(0)); assertEquals(3, buf.get(1)); assertEquals('A', buf.get(2)); assertEquals('B', buf.get(3)); assertEquals('C', buf.get(4)); buf.clear(); try { buf.putPrefixedString("123456789012345", encoder); fail(); } catch (BufferOverflowException e) { // Expected an Exception, signifies test success assertTrue(true); } // With autoExpand buf.clear(); buf.setAutoExpand(true); buf.putPrefixedString("123456789012345", encoder); assertEquals(17, buf.position()); assertEquals(0, buf.get(0)); assertEquals(15, buf.get(1)); assertEquals('1', buf.get(2)); assertEquals('2', buf.get(3)); assertEquals('3', buf.get(4)); assertEquals('4', buf.get(5)); assertEquals('5', buf.get(6)); assertEquals('6', buf.get(7)); assertEquals('7', buf.get(8)); assertEquals('8', buf.get(9)); assertEquals('9', buf.get(10)); assertEquals('0', buf.get(11)); assertEquals('1', buf.get(12)); assertEquals('2', buf.get(13)); assertEquals('3', buf.get(14)); assertEquals('4', buf.get(15)); assertEquals('5', buf.get(16)); } @Test public void testPutPrefixedStringWithPrefixLength() throws Exception { CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder(); IoBuffer buf = IoBuffer.allocate(16).sweep().setAutoExpand(true); buf.putPrefixedString("A", 1, encoder); assertEquals(2, buf.position()); assertEquals(1, buf.get(0)); assertEquals('A', buf.get(1)); buf.sweep(); buf.putPrefixedString("A", 2, encoder); assertEquals(3, buf.position()); assertEquals(0, buf.get(0)); assertEquals(1, buf.get(1)); assertEquals('A', buf.get(2)); buf.sweep(); buf.putPrefixedString("A", 4, encoder); assertEquals(5, buf.position()); assertEquals(0, buf.get(0)); assertEquals(0, buf.get(1)); assertEquals(0, buf.get(2)); assertEquals(1, buf.get(3)); assertEquals('A', buf.get(4)); } @Test public void testPutPrefixedStringWithPadding() throws Exception { CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder(); IoBuffer buf = IoBuffer.allocate(16).sweep().setAutoExpand(true); buf.putPrefixedString("A", 1, 2, (byte) 32, encoder); assertEquals(3, buf.position()); assertEquals(2, buf.get(0)); assertEquals('A', buf.get(1)); assertEquals(' ', buf.get(2)); buf.sweep(); buf.putPrefixedString("A", 1, 4, (byte) 32, encoder); assertEquals(5, buf.position()); assertEquals(4, buf.get(0)); assertEquals('A', buf.get(1)); assertEquals(' ', buf.get(2)); assertEquals(' ', buf.get(3)); assertEquals(' ', buf.get(4)); } @Test public void testWideUtf8Characters() throws Exception { Runnable r = new Runnable() { public void run() { IoBuffer buffer = IoBuffer.allocate(1); buffer.setAutoExpand(true); Charset charset = Charset.forName("UTF-8"); CharsetEncoder encoder = charset.newEncoder(); for (int i = 0; i < 5; i++) { try { buffer.putString("\u89d2", encoder); buffer.putPrefixedString("\u89d2", encoder); } catch (CharacterCodingException e) { fail(e.getMessage()); } } } }; Thread t = new Thread(r); t.setDaemon(true); t.start(); for (int i = 0; i < 50; i++) { Thread.sleep(100); if (!t.isAlive()) { break; } } if (t.isAlive()) { t.interrupt(); fail("Went into endless loop trying to encode character"); } } @Test public void testInheritedObjectSerialization() throws Exception { IoBuffer buf = IoBuffer.allocate(16); buf.setAutoExpand(true); Bar expected = new Bar(); expected.setFooValue(0x12345678); expected.setBarValue(0x90ABCDEF); // Test writing an object. buf.putObject(expected); // Test reading an object. buf.clear(); Bar actual = (Bar) buf.getObject(); assertSame(Bar.class, actual.getClass()); assertEquals(expected.getFooValue(), actual.getFooValue()); assertEquals(expected.getBarValue(), actual.getBarValue()); // This assertion is just to make sure that deserialization occurred. assertNotSame(expected, actual); } @Test public void testSweepWithZeros() throws Exception { IoBuffer buf = IoBuffer.allocate(4); buf.putInt(0xdeadbeef); buf.clear(); assertEquals(0xdeadbeef, buf.getInt()); assertEquals(4, buf.position()); assertEquals(4, buf.limit()); buf.sweep(); assertEquals(0, buf.position()); assertEquals(4, buf.limit()); assertEquals(0x0, buf.getInt()); } @Test public void testSweepNonZeros() throws Exception { IoBuffer buf = IoBuffer.allocate(4); buf.putInt(0xdeadbeef); buf.clear(); assertEquals(0xdeadbeef, buf.getInt()); assertEquals(4, buf.position()); assertEquals(4, buf.limit()); buf.sweep((byte) 0x45); assertEquals(0, buf.position()); assertEquals(4, buf.limit()); assertEquals(0x45454545, buf.getInt()); } @Test public void testWrapNioBuffer() throws Exception { ByteBuffer nioBuf = ByteBuffer.allocate(10); nioBuf.position(3); nioBuf.limit(7); IoBuffer buf = IoBuffer.wrap(nioBuf); assertEquals(3, buf.position()); assertEquals(7, buf.limit()); assertEquals(10, buf.capacity()); } @Test public void testWrapSubArray() throws Exception { byte[] array = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; IoBuffer buf = IoBuffer.wrap(array, 3, 4); assertEquals(3, buf.position()); assertEquals(7, buf.limit()); assertEquals(10, buf.capacity()); buf.clear(); assertEquals(0, buf.position()); assertEquals(10, buf.limit()); assertEquals(10, buf.capacity()); } @Test public void testDuplicate() throws Exception { IoBuffer original; IoBuffer duplicate; // Test if the buffer is duplicated correctly. original = IoBuffer.allocate(16).sweep(); original.position(4); original.limit(10); duplicate = original.duplicate(); original.put(4, (byte) 127); assertEquals(4, duplicate.position()); assertEquals(10, duplicate.limit()); assertEquals(16, duplicate.capacity()); assertNotSame(original.buf(), duplicate.buf()); assertSame(original.buf().array(), duplicate.buf().array()); assertEquals(127, duplicate.get(4)); // Test a duplicate of a duplicate. original = IoBuffer.allocate(16); duplicate = original.duplicate().duplicate(); assertNotSame(original.buf(), duplicate.buf()); assertSame(original.buf().array(), duplicate.buf().array()); // Try to expand. original = IoBuffer.allocate(16); original.setAutoExpand(true); duplicate = original.duplicate(); assertFalse(original.isAutoExpand()); try { original.setAutoExpand(true); fail("Derived buffers and their parent can't be expanded"); } catch (IllegalStateException e) { // Expected an Exception, signifies test success assertTrue(true); } try { duplicate.setAutoExpand(true); fail("Derived buffers and their parent can't be expanded"); } catch (IllegalStateException e) { // Expected an Exception, signifies test success assertTrue(true); } } @Test public void testSlice() throws Exception { IoBuffer original; IoBuffer slice; // Test if the buffer is sliced correctly. original = IoBuffer.allocate(16).sweep(); original.position(4); original.limit(10); slice = original.slice(); original.put(4, (byte) 127); assertEquals(0, slice.position()); assertEquals(6, slice.limit()); assertEquals(6, slice.capacity()); assertNotSame(original.buf(), slice.buf()); assertEquals(127, slice.get(0)); } @Test public void testReadOnlyBuffer() throws Exception { IoBuffer original; IoBuffer duplicate; // Test if the buffer is duplicated correctly. original = IoBuffer.allocate(16).sweep(); original.position(4); original.limit(10); duplicate = original.asReadOnlyBuffer(); original.put(4, (byte) 127); assertEquals(4, duplicate.position()); assertEquals(10, duplicate.limit()); assertEquals(16, duplicate.capacity()); assertNotSame(original.buf(), duplicate.buf()); assertEquals(127, duplicate.get(4)); // Try to expand. try { original = IoBuffer.allocate(16); duplicate = original.asReadOnlyBuffer(); duplicate.putString("A very very very very looooooong string", Charset.forName("ISO-8859-1").newEncoder()); fail("ReadOnly buffer's can't be expanded"); } catch (ReadOnlyBufferException e) { // Expected an Exception, signifies test success assertTrue(true); } } @Test public void testGetUnsigned() throws Exception { IoBuffer buf = IoBuffer.allocate(16); buf.put((byte) 0xA4); buf.put((byte) 0xD0); buf.put((byte) 0xB3); buf.put((byte) 0xCD); buf.flip(); buf.order(ByteOrder.LITTLE_ENDIAN); buf.mark(); assertEquals(0xA4, buf.getUnsigned()); buf.reset(); assertEquals(0xD0A4, buf.getUnsignedShort()); buf.reset(); assertEquals(0xCDB3D0A4L, buf.getUnsignedInt()); } @Test public void testIndexOf() throws Exception { boolean direct = false; for (int i = 0; i < 2; i++, direct = !direct) { IoBuffer buf = IoBuffer.allocate(16, direct); buf.put((byte) 0x1); buf.put((byte) 0x2); buf.put((byte) 0x3); buf.put((byte) 0x4); buf.put((byte) 0x1); buf.put((byte) 0x2); buf.put((byte) 0x3); buf.put((byte) 0x4); buf.position(2); buf.limit(5); assertEquals(4, buf.indexOf((byte) 0x1)); assertEquals(-1, buf.indexOf((byte) 0x2)); assertEquals(2, buf.indexOf((byte) 0x3)); assertEquals(3, buf.indexOf((byte) 0x4)); } } // We need an enum with 64 values private static enum TestEnum { E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15, E16, E17, E18, E19, E20, E21, E22, E23, E24, E25, E26, E27, E28, E29, E30, E31, E32, E33, E34, E35, E36, E37, E38, E39, E40, E41, E42, E43, E44, E45, E46, E77, E48, E49, E50, E51, E52, E53, E54, E55, E56, E57, E58, E59, E60, E61, E62, E63, E64 } private static enum TooBigEnum { E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15, E16, E17, E18, E19, E20, E21, E22, E23, E24, E25, E26, E27, E28, E29, E30, E31, E32, E33, E34, E35, E36, E37, E38, E39, E40, E41, E42, E43, E44, E45, E46, E77, E48, E49, E50, E51, E52, E53, E54, E55, E56, E57, E58, E59, E60, E61, E62, E63, E64, E65 } @Test public void testPutEnumSet() { IoBuffer buf = IoBuffer.allocate(8); // Test empty set buf.putEnumSet(EnumSet.noneOf(TestEnum.class)); buf.flip(); assertEquals(0, buf.get()); buf.clear(); buf.putEnumSetShort(EnumSet.noneOf(TestEnum.class)); buf.flip(); assertEquals(0, buf.getShort()); buf.clear(); buf.putEnumSetInt(EnumSet.noneOf(TestEnum.class)); buf.flip(); assertEquals(0, buf.getInt()); buf.clear(); buf.putEnumSetLong(EnumSet.noneOf(TestEnum.class)); buf.flip(); assertEquals(0, buf.getLong()); // Test complete set buf.clear(); buf.putEnumSet(EnumSet.range(TestEnum.E1, TestEnum.E8)); buf.flip(); assertEquals((byte) -1, buf.get()); buf.clear(); buf.putEnumSetShort(EnumSet.range(TestEnum.E1, TestEnum.E16)); buf.flip(); assertEquals((short) -1, buf.getShort()); buf.clear(); buf.putEnumSetInt(EnumSet.range(TestEnum.E1, TestEnum.E32)); buf.flip(); assertEquals(-1, buf.getInt()); buf.clear(); buf.putEnumSetLong(EnumSet.allOf(TestEnum.class)); buf.flip(); assertEquals(-1L, buf.getLong()); // Test high bit set buf.clear(); buf.putEnumSet(EnumSet.of(TestEnum.E8)); buf.flip(); assertEquals(Byte.MIN_VALUE, buf.get()); buf.clear(); buf.putEnumSetShort(EnumSet.of(TestEnum.E16)); buf.flip(); assertEquals(Short.MIN_VALUE, buf.getShort()); buf.clear(); buf.putEnumSetInt(EnumSet.of(TestEnum.E32)); buf.flip(); assertEquals(Integer.MIN_VALUE, buf.getInt()); buf.clear(); buf.putEnumSetLong(EnumSet.of(TestEnum.E64)); buf.flip(); assertEquals(Long.MIN_VALUE, buf.getLong()); // Test high low bits set buf.clear(); buf.putEnumSet(EnumSet.of(TestEnum.E1, TestEnum.E8)); buf.flip(); assertEquals(Byte.MIN_VALUE + 1, buf.get()); buf.clear(); buf.putEnumSetShort(EnumSet.of(TestEnum.E1, TestEnum.E16)); buf.flip(); assertEquals(Short.MIN_VALUE + 1, buf.getShort()); buf.clear(); buf.putEnumSetInt(EnumSet.of(TestEnum.E1, TestEnum.E32)); buf.flip(); assertEquals(Integer.MIN_VALUE + 1, buf.getInt()); buf.clear(); buf.putEnumSetLong(EnumSet.of(TestEnum.E1, TestEnum.E64)); buf.flip(); assertEquals(Long.MIN_VALUE + 1, buf.getLong()); } @Test public void testGetEnumSet() { IoBuffer buf = IoBuffer.allocate(8); // Test empty set buf.put((byte) 0); buf.flip(); assertEquals(EnumSet.noneOf(TestEnum.class), buf.getEnumSet(TestEnum.class)); buf.clear(); buf.putShort((short) 0); buf.flip(); assertEquals(EnumSet.noneOf(TestEnum.class), buf.getEnumSet(TestEnum.class)); buf.clear(); buf.putInt(0); buf.flip(); assertEquals(EnumSet.noneOf(TestEnum.class), buf.getEnumSet(TestEnum.class)); buf.clear(); buf.putLong(0L); buf.flip(); assertEquals(EnumSet.noneOf(TestEnum.class), buf.getEnumSet(TestEnum.class)); // Test complete set buf.clear(); buf.put((byte) -1); buf.flip(); assertEquals(EnumSet.range(TestEnum.E1, TestEnum.E8), buf.getEnumSet(TestEnum.class)); buf.clear(); buf.putShort((short) -1); buf.flip(); assertEquals(EnumSet.range(TestEnum.E1, TestEnum.E16), buf.getEnumSetShort(TestEnum.class)); buf.clear(); buf.putInt(-1); buf.flip(); assertEquals(EnumSet.range(TestEnum.E1, TestEnum.E32), buf.getEnumSetInt(TestEnum.class)); buf.clear(); buf.putLong(-1L); buf.flip(); assertEquals(EnumSet.allOf(TestEnum.class), buf.getEnumSetLong(TestEnum.class)); // Test high bit set buf.clear(); buf.put(Byte.MIN_VALUE); buf.flip(); assertEquals(EnumSet.of(TestEnum.E8), buf.getEnumSet(TestEnum.class)); buf.clear(); buf.putShort(Short.MIN_VALUE); buf.flip(); assertEquals(EnumSet.of(TestEnum.E16), buf.getEnumSetShort(TestEnum.class)); buf.clear(); buf.putInt(Integer.MIN_VALUE); buf.flip(); assertEquals(EnumSet.of(TestEnum.E32), buf.getEnumSetInt(TestEnum.class)); buf.clear(); buf.putLong(Long.MIN_VALUE); buf.flip(); assertEquals(EnumSet.of(TestEnum.E64), buf.getEnumSetLong(TestEnum.class)); // Test high low bits set buf.clear(); byte b = Byte.MIN_VALUE + 1; buf.put(b); buf.flip(); assertEquals(EnumSet.of(TestEnum.E1, TestEnum.E8), buf.getEnumSet(TestEnum.class)); buf.clear(); short s = Short.MIN_VALUE + 1; buf.putShort(s); buf.flip(); assertEquals(EnumSet.of(TestEnum.E1, TestEnum.E16), buf.getEnumSetShort(TestEnum.class)); buf.clear(); buf.putInt(Integer.MIN_VALUE + 1); buf.flip(); assertEquals(EnumSet.of(TestEnum.E1, TestEnum.E32), buf.getEnumSetInt(TestEnum.class)); buf.clear(); buf.putLong(Long.MIN_VALUE + 1); buf.flip(); assertEquals(EnumSet.of(TestEnum.E1, TestEnum.E64), buf.getEnumSetLong(TestEnum.class)); } @Test public void testBitVectorOverFlow() { IoBuffer buf = IoBuffer.allocate(8); try { buf.putEnumSet(EnumSet.of(TestEnum.E9)); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException e) { // Expected an Exception, signifies test success assertTrue(true); } try { buf.putEnumSetShort(EnumSet.of(TestEnum.E17)); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException e) { // Expected an Exception, signifies test success assertTrue(true); } try { buf.putEnumSetInt(EnumSet.of(TestEnum.E33)); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException e) { // Expected an Exception, signifies test success assertTrue(true); } try { buf.putEnumSetLong(EnumSet.of(TooBigEnum.E65)); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException e) { // Expected an Exception, signifies test success assertTrue(true); } } @Test public void testGetPutEnum() { IoBuffer buf = IoBuffer.allocate(4); buf.putEnum(TestEnum.E64); buf.flip(); assertEquals(TestEnum.E64, buf.getEnum(TestEnum.class)); buf.clear(); buf.putEnumShort(TestEnum.E64); buf.flip(); assertEquals(TestEnum.E64, buf.getEnumShort(TestEnum.class)); buf.clear(); buf.putEnumInt(TestEnum.E64); buf.flip(); assertEquals(TestEnum.E64, buf.getEnumInt(TestEnum.class)); } @Test public void testGetMediumInt() { IoBuffer buf = IoBuffer.allocate(3); buf.put((byte) 0x01); buf.put((byte) 0x02); buf.put((byte) 0x03); assertEquals(3, buf.position()); buf.flip(); assertEquals(0x010203, buf.getMediumInt()); assertEquals(0x010203, buf.getMediumInt(0)); buf.flip(); assertEquals(0x010203, buf.getUnsignedMediumInt()); assertEquals(0x010203, buf.getUnsignedMediumInt(0)); buf.flip(); assertEquals(0x010203, buf.getUnsignedMediumInt()); buf.flip().order(ByteOrder.LITTLE_ENDIAN); assertEquals(0x030201, buf.getMediumInt()); assertEquals(0x030201, buf.getMediumInt(0)); // Test max medium int buf.flip().order(ByteOrder.BIG_ENDIAN); buf.put((byte) 0x7f); buf.put((byte) 0xff); buf.put((byte) 0xff); buf.flip(); assertEquals(0x7fffff, buf.getMediumInt()); assertEquals(0x7fffff, buf.getMediumInt(0)); // Test negative number buf.flip().order(ByteOrder.BIG_ENDIAN); buf.put((byte) 0xff); buf.put((byte) 0x02); buf.put((byte) 0x03); buf.flip(); assertEquals(0xffff0203, buf.getMediumInt()); assertEquals(0xffff0203, buf.getMediumInt(0)); buf.flip(); assertEquals(0x00ff0203, buf.getUnsignedMediumInt()); assertEquals(0x00ff0203, buf.getUnsignedMediumInt(0)); } @Test public void testPutMediumInt() { IoBuffer buf = IoBuffer.allocate(3); checkMediumInt(buf, 0); checkMediumInt(buf, 1); checkMediumInt(buf, -1); checkMediumInt(buf, 0x7fffff); } private void checkMediumInt(IoBuffer buf, int x) { buf.putMediumInt(x); assertEquals(3, buf.position()); buf.flip(); assertEquals(x, buf.getMediumInt()); assertEquals(3, buf.position()); buf.putMediumInt(0, x); assertEquals(3, buf.position()); assertEquals(x, buf.getMediumInt(0)); buf.flip(); } @Test public void testPutUnsigned() { IoBuffer buf = IoBuffer.allocate(4); byte b = (byte) 0x80; // We should get 0x0080 short s = (short) 0x8F81; // We should get 0x0081 int i = 0x8FFFFF82; // We should get 0x0082 long l = 0x8FFFFFFFFFFFFF83L; // We should get 0x0083 buf.mark(); // Put the unsigned bytes buf.putUnsigned(b); buf.putUnsigned(s); buf.putUnsigned(i); buf.putUnsigned(l); buf.reset(); // Read back the unsigned bytes assertEquals(0x0080, buf.getUnsigned()); assertEquals(0x0081, buf.getUnsigned()); assertEquals(0x0082, buf.getUnsigned()); assertEquals(0x0083, buf.getUnsigned()); } @Test public void testPutUnsignedIndex() { IoBuffer buf = IoBuffer.allocate(4); byte b = (byte) 0x80; // We should get 0x0080 short s = (short) 0x8F81; // We should get 0x0081 int i = 0x8FFFFF82; // We should get 0x0082 long l = 0x8FFFFFFFFFFFFF83L; // We should get 0x0083 buf.mark(); // Put the unsigned bytes buf.putUnsigned(3, b); buf.putUnsigned(2, s); buf.putUnsigned(1, i); buf.putUnsigned(0, l); buf.reset(); // Read back the unsigned bytes assertEquals(0x0083, buf.getUnsigned()); assertEquals(0x0082, buf.getUnsigned()); assertEquals(0x0081, buf.getUnsigned()); assertEquals(0x0080, buf.getUnsigned()); } @Test public void testPutUnsignedShort() { IoBuffer buf = IoBuffer.allocate(8); byte b = (byte) 0x80; // We should get 0x0080 short s = (short) 0x8181; // We should get 0x8181 int i = 0x82828282; // We should get 0x8282 long l = 0x8383838383838383L; // We should get 0x8383 buf.mark(); // Put the unsigned bytes buf.putUnsignedShort(b); buf.putUnsignedShort(s); buf.putUnsignedShort(i); buf.putUnsignedShort(l); buf.reset(); // Read back the unsigned bytes assertEquals(0x0080L, buf.getUnsignedShort()); assertEquals(0x8181L, buf.getUnsignedShort()); assertEquals(0x8282L, buf.getUnsignedShort()); assertEquals(0x8383L, buf.getUnsignedShort()); } @Test public void testPutUnsignedShortIndex() { IoBuffer buf = IoBuffer.allocate(8); byte b = (byte) 0x80; // We should get 0x00000080 short s = (short) 0x8181; // We should get 0x00008181 int i = 0x82828282; // We should get 0x82828282 long l = 0x8383838383838383L; // We should get 0x83838383 buf.mark(); // Put the unsigned shorts buf.putUnsignedShort(6, b); buf.putUnsignedShort(4, s); buf.putUnsignedShort(2, i); buf.putUnsignedShort(0, l); buf.reset(); // Read back the unsigned bytes assertEquals(0x8383L, buf.getUnsignedShort()); assertEquals(0x8282L, buf.getUnsignedShort()); assertEquals(0x8181L, buf.getUnsignedShort()); assertEquals(0x0080L, buf.getUnsignedShort()); } @Test public void testPutUnsignedInt() { IoBuffer buf = IoBuffer.allocate(16); byte b = (byte) 0x80; // We should get 0x00000080 short s = (short) 0x8181; // We should get 0x00008181 int i = 0x82828282; // We should get 0x82828282 long l = 0x8383838383838383L; // We should get 0x83838383 buf.mark(); // Put the unsigned bytes buf.putUnsignedInt(b); buf.putUnsignedInt(s); buf.putUnsignedInt(i); buf.putUnsignedInt(l); buf.reset(); // Read back the unsigned bytes assertEquals(0x0000000000000080L, buf.getUnsignedInt()); assertEquals(0x0000000000008181L, buf.getUnsignedInt()); assertEquals(0x0000000082828282L, buf.getUnsignedInt()); assertEquals(0x0000000083838383L, buf.getUnsignedInt()); } /** * Test the IoBuffer.putUnsignedInIndex() method. */ @Test public void testPutUnsignedIntIndex() { IoBuffer buf = IoBuffer.allocate(16); byte b = (byte) 0x80; // We should get 0x00000080 short s = (short) 0x8181; // We should get 0x00008181 int i = 0x82828282; // We should get 0x82828282 long l = 0x8383838383838383L; // We should get 0x83838383 buf.mark(); // Put the unsigned bytes buf.putUnsignedInt(12, b); buf.putUnsignedInt(8, s); buf.putUnsignedInt(4, i); buf.putUnsignedInt(0, l); buf.reset(); // Read back the unsigned bytes assertEquals(0x0000000083838383L, buf.getUnsignedInt()); assertEquals(0x0000000082828282L, buf.getUnsignedInt()); assertEquals(0x0000000000008181L, buf.getUnsignedInt()); assertEquals(0x0000000000000080L, buf.getUnsignedInt()); } /** * Test the getSlice method (even if we haven't flipped the buffer) */ @Test public void testGetSlice() { IoBuffer buf = IoBuffer.allocate(36); for (byte i = 0; i < 36; i++) { buf.put(i); } IoBuffer res = buf.getSlice(1, 3); // The limit should be 3, the pos should be 0 and the bytes read // should be 0x01, 0x02 and 0x03 assertEquals(0, res.position()); assertEquals(3, res.limit()); assertEquals(0x01, res.get()); assertEquals(0x02, res.get()); assertEquals(0x03, res.get()); // Now test after a flip buf.flip(); res = buf.getSlice(1, 3); // The limit should be 3, the pos should be 0 and the bytes read // should be 0x01, 0x02 and 0x03 assertEquals(0, res.position()); assertEquals(3, res.limit()); assertEquals(0x01, res.get()); assertEquals(0x02, res.get()); assertEquals(0x03, res.get()); } /** * Test the IoBuffer.shrink() method. */ @Test public void testShrink() { IoBuffer buf = IoBuffer.allocate(36); buf.put( "012345".getBytes()); buf.flip(); buf.position(4); buf.minimumCapacity(8); IoBuffer newBuf = buf.shrink(); assertEquals(4, newBuf.position()); assertEquals(6, newBuf.limit()); assertEquals(9, newBuf.capacity()); assertEquals(8, newBuf.minimumCapacity()); buf = IoBuffer.allocate(6); buf.put( "012345".getBytes()); buf.flip(); buf.position(4); newBuf = buf.shrink(); assertEquals(4, newBuf.position()); assertEquals(6, newBuf.limit()); assertEquals(6, newBuf.capacity()); assertEquals(6, newBuf.minimumCapacity()); } /** * Test the IoBuffer.position(newPosition) method. */ @Test public void testSetPosition() { } @Test public void testFillByteSize() { int length = 1024*1020; IoBuffer buffer = IoBuffer.allocate(length); buffer.fill((byte)0x80, length); buffer.flip(); for (int i=0; i<length; i++) { assertEquals((byte)0x80, buffer.get()); } } @Test public void iobufferMyTest() throws CharacterCodingException{ IoBuffer testBuffer = IoBuffer.allocate(5).setAutoExpand(true); testBuffer.putString("hello",Charset.forName("utf-8").newEncoder()); System.out.println(testBuffer); testBuffer.put((byte)'l'); System.out.println(testBuffer); } }
[ "1289714862@qq.com" ]
1289714862@qq.com
94f875828aee347904429f7dd69a6e2ed3f84e72
732d7c600b9eb5e31510344ab07997d9cd68c32d
/target/generated-sources/mule/org/mule/modules/ethereum/generated/processors/GetBalanceMessageProcessorDebuggable.java
7b747aa289d57c090d519257d2b1607bcef7c869
[]
no_license
djuang1/ethereum-connector
78f11c0fcb159d28e3f88268e8b8bc1bc80c6ac5
a58b91a9be960308fd0b7681040d517f56a3a6ec
refs/heads/master
2021-09-10T21:41:37.957181
2018-04-02T19:05:33
2018-04-02T19:05:33
124,268,695
1
1
null
null
null
null
UTF-8
Java
false
false
2,955
java
package org.mule.modules.ethereum.generated.processors; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.annotation.Generated; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.debug.DebugInfoProvider; import org.mule.api.debug.FieldDebugInfo; import org.mule.api.debug.FieldDebugInfoFactory; import org.mule.api.transformer.TransformerException; import org.mule.api.transformer.TransformerMessagingException; import org.mule.util.ClassUtils; import org.mule.util.TemplateParser; @SuppressWarnings("all") @Generated(value = "Mule DevKit Version 3.9.0", date = "2018-03-22T09:49:46-05:00", comments = "Build UNNAMED.2793.f49b6c7") public class GetBalanceMessageProcessorDebuggable extends GetBalanceMessageProcessor implements DebugInfoProvider { public GetBalanceMessageProcessorDebuggable(String operationName) { super(operationName); } private boolean isConsumable(Object evaluate) { return (ClassUtils.isConsumable(evaluate.getClass())||Iterator.class.isAssignableFrom(evaluate.getClass())); } private Object getEvaluatedValue(MuleContext muleContext, MuleEvent muleEvent, String fieldName, Object field) throws NoSuchFieldException, TransformerException, TransformerMessagingException { Object evaluate = null; if (!(field == null)) { evaluate = this.evaluate(TemplateParser.createMuleStyleParser().getStyle(), muleContext.getExpressionManager(), muleEvent.getMessage(), field); Type genericType = this.getClass().getSuperclass().getDeclaredField(fieldName).getGenericType(); if (!isConsumable(evaluate)) { evaluate = this.evaluateAndTransform(muleContext, muleEvent, genericType, null, field); } } return evaluate; } private FieldDebugInfo createDevKitFieldDebugInfo(String name, String friendlyName, Class type, Object value, MuleEvent muleEvent) { try { return FieldDebugInfoFactory.createFieldDebugInfo(friendlyName, type, getEvaluatedValue(muleContext, muleEvent, ("_"+name+"Type"), value)); } catch (NoSuchFieldException e) { return FieldDebugInfoFactory.createFieldDebugInfo(friendlyName, type, e); } catch (TransformerMessagingException e) { return FieldDebugInfoFactory.createFieldDebugInfo(friendlyName, type, e); } catch (TransformerException e) { return FieldDebugInfoFactory.createFieldDebugInfo(friendlyName, type, e); } } @Override public List<FieldDebugInfo<?>> getDebugInfo(MuleEvent muleEvent) { List<FieldDebugInfo<?>> fieldDebugInfoList = new ArrayList<FieldDebugInfo<?>>(); fieldDebugInfoList.add(createDevKitFieldDebugInfo("address", "Address", (java.lang.String.class), address, muleEvent)); return fieldDebugInfoList; } }
[ "dejim.juang@gmail.com" ]
dejim.juang@gmail.com
b216313bc4f007f56dc0ef05ff1e90521e6b3e0b
cce30408c4563baf17372a415f956500b4d9af45
/Bootcamp1/desafios-logica/desafio07/Desafio07.java
5d435e321183b9d2c7169bf673e0389b7cd88011
[ "MIT" ]
permissive
thiagojacinto/pos-unit-porto
99156ca1164e4ce78d518a582a2a8fccba13979f
49644648d812b8fe03931b2cccc26bb1dedd6f42
refs/heads/master
2021-07-14T01:01:14.724009
2020-12-04T01:16:06
2020-12-04T01:16:06
205,291,511
1
0
null
null
null
null
UTF-8
Java
false
false
1,747
java
package desafio07; import java.text.NumberFormat; import java.util.Locale; public class Desafio07 { /** * Cálculo do FATORIAL de um número. * @param numero {@code Double} * @return resultado do fatorial {@code Double} */ private Double calcularFatorial(Double numero) { if (numero < 1) { return 1d; } return numero * calcularFatorial(numero - 1); } /** * Calcula a subtração entre duas somas: a soma dos pares e dos ímpares contidos em um intervalo. * @param intervalo {@code int[]} * @return resultado da subtração {@code Double} */ private Double calcularSubtracaoDaSomaDosParesESomaDosImpares(int[] intervalo) { Double somaPares = 0d; Double somaImpares = 0d; for (int i = intervalo[0]; i <= intervalo[1]; i++) { if (i % 2 == 0) { somaPares += i; } else { somaImpares += i; } } return somaPares - somaImpares; } /** * Utiliza os métodos "{@code calcularSubtracaoDaSomaDosParesESomaDosImpares}" e "{@code calcularFatorial}" * @param intervalo {@code int[]} * @return resultado {@code Double} do cálculo composto: fatorial do resultado da subtração. */ private Double calculoComposto(int[] intervalo) { Double resultadoSubtracao = calcularSubtracaoDaSomaDosParesESomaDosImpares(intervalo); return calcularFatorial(resultadoSubtracao); } /** * Exibe no console o resultado do cálculo composto pretendido. * @param intervalo {@code int[]} contendo os limites inferior e superior. */ public void exibirResultadoCalculoComposto(int[] intervalo) { Double resultado = calculoComposto(intervalo); System.out.println( NumberFormat .getInstance(new Locale("pt", "Brasil")) .format(resultado) ); } }
[ "46906069+thiagojacinto@users.noreply.github.com" ]
46906069+thiagojacinto@users.noreply.github.com
8a531f0aef24c7925aa9a721cb53472715832418
ccc3d82fa2fd0d184ba746de0e5df954f1070229
/src/BinaryTree.java
488b575d46bf5b78720d82088e364d9e53927e35
[]
no_license
yaseenhull/Binary-Search-Tree
6a33d5aa430ca0a300cbf05ec77ba528bb0a46b5
74350e4fa7a84573508739af1f94db0a4020adff
refs/heads/master
2020-07-11T12:22:17.598165
2019-08-26T18:36:17
2019-08-26T18:36:17
204,537,743
0
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
// Binary Search Tree // 04 April 2017 // Yaseen Hull public class BinaryTree<dataType> { /** * The first node is the root node */ BinaryTreeNode<dataType> root; public BinaryTree () { root = null; } public int getHeight () { return getHeight (root); } public int getHeight ( BinaryTreeNode<dataType> node ) { if (node == null) return -1; else return 1 + Math.max (getHeight (node.getLeft ()), getHeight (node.getRight ())); } public int getSize () { return getSize (root); } public int getSize ( BinaryTreeNode<dataType> node ) { if (node == null) return 0; else return 1 + getSize (node.getLeft ()) + getSize (node.getRight ()); } /** * prints value of data * @param node is the node currently be referred to */ public void visit ( BinaryTreeNode<dataType> node ) { System.out.println (node.data2); } public void printIt () { printIt (root); } /** * traverses through data structure and prints inorder node data * @param node is the node currently be referred to */ public void printIt ( BinaryTreeNode<dataType> node ) { if (node != null) { printIt (node.getLeft ()); visit (node); printIt (node.getRight ()); } } }
[ "yahuu001@gmail.com" ]
yahuu001@gmail.com
0a5b2ff901db97a8d248a3f793194fc484e6169d
c46479c58c7bbb38e6f42b14fb94d9e9b84d614f
/src/main/java/io/choerodon/agile/infra/mapper/ProjectReportReceiverMapper.java
4edb39ab92f733be39061bdfc16564ecb78eaafe
[]
no_license
whywuzeng/agile-service
5011adf2438e830246c8764e7fde30d8f0da6f8c
5d455a1680cdc3d57943759d40b2599a39e3c048
refs/heads/master
2023-07-16T21:53:16.820451
2021-08-30T07:15:38
2021-08-30T07:15:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package io.choerodon.agile.infra.mapper; import java.util.List; import io.choerodon.agile.infra.dto.ProjectReportReceiverDTO; import io.choerodon.mybatis.common.BaseMapper; import org.apache.ibatis.annotations.Param; /** * @author jiaxu.cui@hand-china.com 2020/9/15 下午5:54 */ public interface ProjectReportReceiverMapper extends BaseMapper<ProjectReportReceiverDTO> { List<ProjectReportReceiverDTO> selectReceiver(@Param("reportIdList") List<Long> reportIdList, @Param("type") String type); }
[ "hand1234" ]
hand1234
07e3dde1547fde062928dd0dadbb562cbbe2124e
316f670a1c27a43022fec420eec9783519a18712
/jeedev-jpush-server/src/main/java/org/jeedevframework/jpush/server/dao/hibernate/NotificationDaoHibernate.java
c905f98bf585c8159e7317eb2c221eabf76be4d2
[]
no_license
huligong1234/Android-Push-Notification
32ddccd084f6aca34fa9dcb9c37e0f564b38f43a
78d47db6384ff3982a6f733489cfe9141a9324b4
refs/heads/master
2016-09-05T08:54:21.591390
2014-12-28T10:43:47
2014-12-28T10:43:47
28,403,983
1
1
null
null
null
null
UTF-8
Java
false
false
1,785
java
/** * */ package org.jeedevframework.jpush.server.dao.hibernate; import java.util.List; import org.jeedevframework.jpush.server.dao.NotificationDao; import org.jeedevframework.jpush.server.model.NotificationMO; import org.jeedevframework.jpush.server.model.ReportVO; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; /** * @author chengqiang.liu * */ public class NotificationDaoHibernate extends HibernateDaoSupport implements NotificationDao { public void deleteNotification(Long id) { getHibernateTemplate().delete(queryNotificationById(id)); } public NotificationMO queryNotificationById(Long id) { NotificationMO notificationMO = (NotificationMO) getHibernateTemplate() .get(NotificationMO.class, id); return notificationMO; } public void saveNotification(NotificationMO notificationMO) { getHibernateTemplate().saveOrUpdate(notificationMO); getHibernateTemplate().flush(); } public void updateNotification(NotificationMO notificationMO) { getHibernateTemplate().update(notificationMO); getHibernateTemplate().flush(); } @SuppressWarnings("unchecked") public List<NotificationMO> queryNotificationByUserName(String userName, String messageId) { Object[] params = new Object[] {userName, messageId}; return getHibernateTemplate() .find( "from NotificationMO n where n.username=? and n.messageId=? order by n.createTime desc", params); } public int queryCountByStatus(String status, String messageId) { return 0; } @SuppressWarnings("unchecked") public List<NotificationMO> queryNotification(NotificationMO mo) { return getHibernateTemplate().findByExample(mo); } public List<ReportVO> queryReportVO(NotificationMO mo) { // TODO Auto-generated method stub return null; } }
[ "com.software@163.com" ]
com.software@163.com
c3b95461d23e92866119f431bfb4128b686a3e3c
6610d350e222b1e6dbbd349fc802358a0f2412da
/app/src/main/java/uz/how/simplemvp/view/activity/LoginActivity.java
44539bec1676c928ffdb5dbf8328a37bc471e60e
[]
no_license
Uzdroid/android-mvp-dagger2-1
15f635d4a2957e7f0dbd1116d2c3e5abf4242155
91b4756237efaae530cd7d109bcf030c48247867
refs/heads/master
2021-01-21T21:10:08.392665
2017-06-10T03:11:28
2017-06-10T03:11:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,789
java
package uz.how.simplemvp.view.activity; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import dagger.android.AndroidInjection; import uz.how.simplemvp.R; import uz.how.simplemvp.model.Constants; import uz.how.simplemvp.presenter.impl.LoginPresenterImpl; import uz.how.simplemvp.view.LoginView; /** * Created by mirjalol on 6/9/17. */ public class LoginActivity extends AppCompatActivity implements LoginView { @BindView(R.id.username) EditText username; @BindView(R.id.password) EditText password; @BindView(R.id.loginButton) Button loginButton; @BindView(R.id.progressBar) ProgressBar progressBar; @Inject LoginPresenterImpl loginPresenter; @Inject SharedPreferences prefs; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); if (prefs.contains(Constants.LOGIN)) { ProfileActivity.start(this); return; } setContentView(R.layout.activity_login); ButterKnife.bind(this); } @Override public void validationError() { if (username.getText().toString().trim().isEmpty()) { username.setError("Fill username"); } if (password.getText().toString().trim().isEmpty()) { password.setError("Fill password"); } } @Override public void authError() { Toast.makeText(this, R.string.auth_error_message, Toast.LENGTH_SHORT).show(); } @Override public void authSuccess() { ProfileActivity.start(this); } @Override public void showProgress() { username.setEnabled(false); password.setEnabled(false); loginButton.setEnabled(false); progressBar.setVisibility(View.VISIBLE); } @Override public void hideProgress() { username.setEnabled(true); password.setEnabled(true); loginButton.setEnabled(true); progressBar.setVisibility(View.GONE); } @Override public void connectionError() { Toast.makeText(this, R.string.connection_error, Toast.LENGTH_SHORT).show(); } @OnClick(R.id.loginButton) void onLogin() { loginPresenter.provideLogin( username.getText().toString().trim(), password.getText().toString().trim() ); } }
[ "mirjalol.bahodirov@gmail.com" ]
mirjalol.bahodirov@gmail.com
00b50eba2243c1fe49439e74f9ab80aed8c9cc2b
55cbb627291583922a69886531a7f935f5a3cf10
/src/test/java/com/hubspot/jackson/test/FailOnNullPrimitivesTest.java
04b0e2f4bb92ab71b3902fa654ccc3f01f3a9dd7
[ "Apache-2.0" ]
permissive
mikea/jackson-datatype-protobuf
d595a02c924281435930536a4b9a2afbf037d23d
99e89de88a032b4c8de84d0f1bfcbef5e45b227f
refs/heads/master
2021-01-19T07:54:44.654792
2015-03-22T00:40:25
2015-03-22T00:40:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,826
java
package com.hubspot.jackson.test; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.hubspot.jackson.test.util.TestProtobuf.AllFields; import org.junit.Test; import static com.hubspot.jackson.test.util.ObjectMapperHelper.camelCase; import static org.fest.assertions.api.Assertions.assertThat; public class FailOnNullPrimitivesTest { @Test(expected = JsonMappingException.class) public void testIntEnabled() throws JsonProcessingException { ObjectNode node = buildNode("int32"); objectMapper(true).treeToValue(node, AllFields.class); } @Test public void testIntDisabled() throws JsonProcessingException { ObjectNode node = buildNode("int32"); AllFields parsed = objectMapper(false).treeToValue(node, AllFields.class); assertThat(parsed.hasInt32()).isFalse(); } @Test(expected = JsonMappingException.class) public void testLongEnabled() throws JsonProcessingException { ObjectNode node = buildNode("int64"); objectMapper(true).treeToValue(node, AllFields.class); } @Test public void testLongDisabled() throws JsonProcessingException { ObjectNode node = buildNode("int64"); AllFields parsed = objectMapper(false).treeToValue(node, AllFields.class); assertThat(parsed.hasInt64()).isFalse(); } @Test(expected = JsonMappingException.class) public void testFloatEnabled() throws JsonProcessingException { ObjectNode node = buildNode("float"); objectMapper(true).treeToValue(node, AllFields.class); } @Test public void testFloatDisabled() throws JsonProcessingException { ObjectNode node = buildNode("float"); AllFields parsed = objectMapper(false).treeToValue(node, AllFields.class); assertThat(parsed.hasFloat()).isFalse(); } @Test(expected = JsonMappingException.class) public void testDoubleEnabled() throws JsonProcessingException { ObjectNode node = buildNode("double"); objectMapper(true).treeToValue(node, AllFields.class); } @Test public void tesDoubleDisabled() throws JsonProcessingException { ObjectNode node = buildNode("double"); AllFields parsed = objectMapper(false).treeToValue(node, AllFields.class); assertThat(parsed.hasDouble()).isFalse(); } @Test(expected = JsonMappingException.class) public void testBooleanEnabled() throws JsonProcessingException { ObjectNode node = buildNode("bool"); objectMapper(true).treeToValue(node, AllFields.class); } @Test public void testBooleanDisabled() throws JsonProcessingException { ObjectNode node = buildNode("bool"); AllFields parsed = objectMapper(false).treeToValue(node, AllFields.class); assertThat(parsed.hasBool()).isFalse(); } @Test public void testOnlyAffectsPrimitives() throws JsonProcessingException { ObjectNode node = buildNode("string", "bytes", "enum", "nested"); AllFields parsed = objectMapper(true).treeToValue(node, AllFields.class); assertThat(parsed.hasString()).isFalse(); assertThat(parsed.hasBytes()).isFalse(); assertThat(parsed.hasEnum()).isFalse(); assertThat(parsed.hasNested()).isFalse(); } private ObjectNode buildNode(String... fieldNames) { ObjectNode node = camelCase().createObjectNode(); for (String fieldName : fieldNames) { node.putNull(fieldName); } return node; } private static ObjectMapper objectMapper(boolean enabled) { if (enabled) { return camelCase().enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); } else { return camelCase().disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); } } }
[ "jhaber@hubspot.com" ]
jhaber@hubspot.com
12068cb2f43228c8f036b59868b63a6618f6269b
525b0378990017ad68b689ce8ff005ad4d50bade
/src/main/java/leetcode7/Solution1.java
2784a5f8390c27a4e348262bea4d338fa10aa406
[]
no_license
manghuang/Leetcode2
f0d4142b16d41e1da9f732ab833269765430bfe5
42de7597653dec3d4bc4ff2327d9cddd5ff03344
refs/heads/master
2023-03-23T09:40:00.348257
2021-03-20T03:09:12
2021-03-20T03:09:12
281,826,729
0
0
null
null
null
null
UTF-8
Java
false
false
1,540
java
package leetcode7; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class Solution1 { /* 依赖问题 */ private HashMap<Integer, Node> hashMap; public Node cloneGraph(Node node) { if (node == null) { return new Node(); } hashMap = new HashMap<>(); Node newNode = new Node(node.val); hashMap.put(node.val, newNode); dps(newNode, node); return newNode; } private void dps(Node newNode, Node node) { List<Node> neighbors = node.neighbors; if (neighbors == null) { return; } for (Node neightbor : neighbors) { if (hashMap.containsKey(neightbor.val)) { newNode.neighbors.add(hashMap.get(neightbor.val)); } else { Node newNeightbor = new Node(neightbor.val); hashMap.put(neightbor.val, newNeightbor); newNode.neighbors.add(newNeightbor); dps(newNeightbor, neightbor); } } } static class Node { public int val; public List<Node> neighbors; public Node() { val = 0; neighbors = new ArrayList<Node>(); } public Node(int _val) { val = _val; neighbors = new ArrayList<Node>(); } public Node(int _val, ArrayList<Node> _neighbors) { val = _val; neighbors = _neighbors; } } }
[ "1255529524@qq.com" ]
1255529524@qq.com
11e54081e0a7e4fab7ff9e06765f1ef984aaf34c
6d02c53aecde02f455b135242af1c362f0a9a389
/app/src/main/java/com/example/astroweather/MoonFragment.java
17c557e07fc8a91126b31b7c848292d48057d271
[]
no_license
Stonsky/AstroWeatherAndroid
360e3baecb049fa0ff623d544c7395769c5f39bc
3a2f437b95e0a4e7270ae29ba90183f818721f2a
refs/heads/main
2023-05-10T08:57:57.179732
2021-06-29T19:53:27
2021-06-29T19:53:27
381,479,453
0
0
null
null
null
null
UTF-8
Java
false
false
3,379
java
package com.example.astroweather; import android.os.Bundle; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; /** * A simple {@link Fragment} subclass. * Use the {@link MoonFragment#newInstance} factory method to * create an instance of this fragment. */ public class MoonFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public MoonFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment moonFragment. */ // TODO: Rename and change types and number of parameters public static MoonFragment newInstance(String param1, String param2) { MoonFragment fragment = new MoonFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root1 = inflater.inflate(R.layout.fragment_moon, container, false); Model model1 = new ViewModelProvider(requireActivity()).get(Model.class); TextView moon_dzien1 = root1.findViewById(R.id.moon_dzien); TextView moon_now1 = root1.findViewById(R.id.moon_now); TextView moon_faza1 = root1.findViewById(R.id.moon_faza); TextView moon_wch = root1.findViewById(R.id.moon_wschod); TextView moon_zach = root1.findViewById(R.id.moon_zachod); TextView moon_pelnia1 = root1.findViewById(R.id.moon_pelnia); TextView wsporzedne = root1.findViewById(R.id.wspolrzedne_text1); wsporzedne.setText( String.valueOf(model1.getLocation().getLatitude()) +" " + String.valueOf( model1.getLocation().getLongitude())); model1.getMoonFull().observe(getViewLifecycleOwner(), moon_pelnia1::setText); model1.getMoonDaysToInterlunar().observe(getViewLifecycleOwner(), moon_dzien1::setText); model1.getMoonPhase().observe(getViewLifecycleOwner(), moon_faza1::setText); model1.getInterlunar().observe(getViewLifecycleOwner(), moon_now1::setText); model1.getMoonRise().observe(getViewLifecycleOwner(), moon_wch::setText); model1.getMoonSet().observe(getViewLifecycleOwner(), moon_zach::setText); return root1; } }
[ "jfkjakubkaminski@gmail.com" ]
jfkjakubkaminski@gmail.com
132916e2e34952491225c517c0d65be52b403b6a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_5b4bdd18426b498895ce6cb2723c8a08c9da4c27/MainActivity/23_5b4bdd18426b498895ce6cb2723c8a08c9da4c27_MainActivity_s.java
9cf8696bbc2e2aec10bb5038a88fc02da13053ba
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
15,165
java
package com.vitaltech.bioink; import com.vitaltech.bioink.RangeSeekBar.OnRangeSeekBarChangeListener; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { private static final String TAG = MainActivity.class.getSimpleName(); public static final Boolean DEBUG=true; private Button vizButton; private Button menuButton; private Discovery discovery; private BroadcastReceiver broadcastReceiver; private IntentFilter intentFilter; private BluetoothAdapter btAdapter; private LinearLayout linearControl; private LinearLayout linearAdvanced; private LinearLayout linearStub; private Button acceptButton; private String startText = "Start Visualization"; private String enableBlue = "Enable Bluetooth"; // Settings private float minHR = DataProcess.MIN_HR; private float maxHR = DataProcess.MAX_HR; private float minResp = DataProcess.MIN_RESP; private float maxResp = DataProcess.MAX_RESP; private BiometricType colorType = BiometricType.RESPIRATION; private BiometricType energyType = BiometricType.HEARTRATE; private LinearLayout settingsLayout; private LinearLayout.LayoutParams settingsParams; // **** Start Lifecycle **** @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(DEBUG) Log.d(TAG, "__onCreate()__"); btAdapter=BluetoothAdapter.getDefaultAdapter(); if(btAdapter == null){ Toast.makeText(getApplicationContext(),"Bluetooth not available on this device",Toast.LENGTH_LONG).show(); Log.e(TAG, "Bluetooth not available on this device"); finish(); } if(! btAdapter.isEnabled()){ startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), 1); } discovery = new Discovery(this, btAdapter); // Catch Bluetooth radio events intentFilter = new IntentFilter(); intentFilter.addAction(android.bluetooth.BluetoothAdapter.ACTION_STATE_CHANGED); intentFilter.addAction(android.bluetooth.BluetoothAdapter.ACTION_DISCOVERY_STARTED); intentFilter.addAction(android.bluetooth.BluetoothAdapter.ACTION_DISCOVERY_FINISHED); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context contxt, Intent intent) { String action = intent.getAction(); if(DEBUG) Log.v(TAG, "intent received: " + intent.toString() + ", " + action); if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)){ if(DEBUG) Log.v(TAG, "discovery finished"); discovery.stopListener(); discovery.showDevices(); }else if(BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(action)){ if(DEBUG) Log.v(TAG, "discovery started"); discovery.showProgress(true); }else{ int code = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -99); switch(code){ case BluetoothAdapter.STATE_ON: if(DEBUG) Log.v(TAG, "bluetooth broadcast receiver => on"); vizButton.setText(startText); doDiscovery(); break; case BluetoothAdapter.STATE_OFF: if(DEBUG) Log.v(TAG, "bluetooth broadcast receiver => off"); vizButton.setText(enableBlue); discovery.stopListener(); discovery.showDevices(); break; case BluetoothAdapter.STATE_TURNING_OFF: case BluetoothAdapter.STATE_TURNING_ON: if(DEBUG) Log.v(TAG, "bluetooth broadcast receiver => changing"); break; default: Log.w(TAG, "bluetooth broadcast receiver => undefined: " + action + ", "+ code); break; } } } }; registerReceiver(broadcastReceiver, intentFilter); connectButton(); } @Override protected void onResume() { // Activity was partially visible if(DEBUG) Log.d(TAG, "__onResume()__"); registerReceiver(broadcastReceiver, intentFilter); super.onResume(); if(DEBUG) Log.d(TAG, "return to menu"); setContentView(R.layout.activity_main); linearStub = null; connectButton(); } // **** Activity is running at this point **** @Override public void onPause(){ // Activity was visible but now is now partially visible if(DEBUG) Log.d(TAG, "__onPause()__"); unregisterReceiver(broadcastReceiver); btAdapter.cancelDiscovery(); discovery.stopListener(); super.onPause(); } // **** End Lifecycle **** private void connectButton(){ // Configure single Button system vizButton = (Button) findViewById(R.id.vizButton); if(btAdapter.isEnabled()){ Log.v(TAG, "radio is on"); vizButton.setText(startText); doDiscovery(); }else{ Log.v(TAG, "radio is off"); vizButton.setText(enableBlue); discovery.showDevices(); } vizButton.setOnClickListener( new OnClickListener() { public void onClick(View v) { if(DEBUG) Log.d(TAG, "Viz Button pressed"); if(vizButton.getText() == enableBlue){ if (DEBUG) Log.d(TAG,"enabling bluetooth"); startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), 1); }else if(vizButton.getText() == startText){ if (DEBUG) Log.d(TAG,"starting viz"); Intent myIntent = new Intent(v.getContext(), RajActivity.class); // transfer settings to RajActivity myIntent.putExtra("minHR", minHR); myIntent.putExtra("maxHR", maxHR); myIntent.putExtra("minResp", minResp); myIntent.putExtra("maxResp", maxResp); myIntent.putExtra("colorType", colorType); myIntent.putExtra("energyType", energyType); startActivityForResult(myIntent, 0); }else{ Log.w(TAG, "button labeled as " + vizButton.getText()); } } } ); // swap static logo for animated gif // ImageView img = (ImageView) findViewById(R.id.logoImageView); // img.setVisibility(ImageView.GONE); // VideoView gifView = (VideoView) findViewById( R.id.logoVideoView); // gifView.setMediaController( new MediaController( getApplicationContext())); // gifView.setVideoURI( Uri.parse( "android.resource://" + getPackageName() + "/" + R.raw.logo)); // gifView.requestFocus(); // gifView.start(); // gifView.setVisibility( VideoView.VISIBLE); // WebView gifView = (WebView) findViewById(R.id.logoWebView); // gifView.loadUrl("file:///android_res/raw/logo.gif"); // gifView.setInitialScale(100); // gifView.setVisibility(WebView.VISIBLE); // Movie gifMovie = (Movie) findViewById(R.id.logoMovieView); // LinearLayout linearLogo = (LinearLayout) findViewById(R.id.logoSide); // linearLogo.addView(gifView); linearControl = (LinearLayout) findViewById(R.id.linearControl); linearAdvanced = (LinearLayout) findViewById(R.id.linearAdvanced); acceptButton = (Button) findViewById(R.id.accept_button); menuButton = (Button) findViewById(R.id.menuButton); menuButton.setOnClickListener( new OnClickListener() { public void onClick(View v) { if(DEBUG) Log.d(TAG, "add right side advanced controls"); showAdvanced(); } } ); } private void showAdvanced(){ linearControl.setVisibility(LinearLayout.GONE); linearAdvanced.setVisibility(LinearLayout.VISIBLE); if(linearStub == null){ Log.w(TAG, "linearStub == null"); linearStub = (LinearLayout) findViewById(R.id.linearStub); setupSettingsMenu(linearStub); } acceptButton.setOnClickListener( new OnClickListener() { public void onClick(View v) { if(DEBUG) Log.d(TAG, "advanced settings have been chosen"); linearControl.setVisibility(LinearLayout.VISIBLE); linearAdvanced.setVisibility(LinearLayout.GONE); } } ); } private void setupSettingsMenu(LinearLayout ll_stub){ // Grabbing the Application context final Context context = getApplication(); // Setting the orientation to vertical settingsLayout = ll_stub; settingsLayout.setOrientation(LinearLayout.VERTICAL); // Defining the LinearLayout layout parameters to fill the parent. settingsParams = new LinearLayout.LayoutParams( // LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); settingsParams.weight = 1; LinearLayout HRLayout = new LinearLayout(this); HRLayout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout RespLayout = new LinearLayout(this); RespLayout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout ColorLayout = new LinearLayout(this); ColorLayout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout EnergyLayout = new LinearLayout(this); EnergyLayout.setOrientation(LinearLayout.HORIZONTAL); TextView HRText = new TextView(this); final TextView minHRText = new TextView(this); final TextView maxHRText = new TextView(this); TextView RespText = new TextView(this); final TextView minRespText = new TextView(this); final TextView maxRespText = new TextView(this); TextView colorText = new TextView(this); TextView energyText = new TextView(this); HRText.setWidth(150); RespText.setWidth(150); colorText.setWidth(150); energyText.setWidth(150); minHRText.setWidth(50); maxHRText.setWidth(50); minRespText.setWidth(50); maxRespText.setWidth(50); minHRText.setText(String.format("%d", (int)minHR)); maxHRText.setText(String.format("%d", (int)maxHR)); minRespText.setText(String.format("%d", (int)minResp)); maxRespText.setText(String.format("%d", (int)maxResp)); HRText.setText("Heartrate:"); RespText.setText("Respiration:"); colorText.setText("Color:"); energyText.setText("Energy:"); // create RangeSeekBar as Float for Heartrate RangeSeekBar<Float> seekBarHR = new RangeSeekBar<Float>(DataProcess.MIN_HR, DataProcess.MAX_HR, context); seekBarHR.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Float>() { public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar, Float minValue, Float maxValue) { if(minValue.equals(maxValue)){ Log.w(TAG, "fixing: min == max"); minValue -= 0.00001f; maxValue += 0.00001f; } minHR = minValue; maxHR = maxValue; minHRText.setText(String.format("%d", (int)minHR)); maxHRText.setText(String.format("%d", (int)maxHR)); if(DEBUG) Log.d(TAG + "menu", "minHR: "+minHR+", maxHR: "+maxHR); } }); // create RangeSeekBar as Float for Respiration RangeSeekBar<Float> seekBarResp = new RangeSeekBar<Float>(DataProcess.MIN_RESP, DataProcess.MAX_RESP, context); seekBarResp.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Float>() { public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar, Float minValue, Float maxValue) { if(minValue.equals(maxValue)){ minValue -= 0.00001f; maxValue += 0.00001f; } minResp = minValue; maxResp = maxValue; minRespText.setText(String.format("%d", (int)minResp)); maxRespText.setText(String.format("%d", (int)maxResp)); if(DEBUG) Log.d(TAG + "menu", "minResp: "+minResp+", maxResp: "+maxResp); } }); final String[] biometricTypes = { "Heartrate", "Respiration" }; ArrayAdapter<String> aa = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, biometricTypes); aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner colorSpinner = new Spinner(this); colorSpinner.setAdapter(aa); colorSpinner.setSelection(1); // start this one with Respiration selected instead of heartrate colorSpinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){ public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { if(biometricTypes[position].equals("Heartrate")){ colorType = BiometricType.HEARTRATE; } if(biometricTypes[position].equals("Respiration")){ colorType = BiometricType.RESPIRATION; } if(DEBUG) Log.d(TAG + "menu", "colorType: "+colorType); } public void onNothingSelected(AdapterView<?> parent) {} }); Spinner energySpinner = new Spinner(this); energySpinner.setAdapter(aa); energySpinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){ public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { if(biometricTypes[position].equals("Heartrate")){ energyType = BiometricType.HEARTRATE; } if(biometricTypes[position].equals("Respiration")){ energyType = BiometricType.RESPIRATION; } if(DEBUG) Log.d(TAG + "menu", "energyType: " + energyType); } public void onNothingSelected(AdapterView<?> parent) {} }); HRLayout.addView(HRText); HRLayout.addView(minHRText); HRLayout.addView(seekBarHR,settingsParams); HRLayout.addView(maxHRText); RespLayout.addView(RespText); RespLayout.addView(minRespText); RespLayout.addView(seekBarResp,settingsParams); RespLayout.addView(maxRespText); ColorLayout.addView(colorText); ColorLayout.addView(colorSpinner,settingsParams); EnergyLayout.addView(energyText); EnergyLayout.addView(energySpinner,settingsParams); settingsLayout.addView(HRLayout); settingsLayout.addView(RespLayout); settingsLayout.addView(ColorLayout); settingsLayout.addView(EnergyLayout); } public boolean onKeyDown(int keyCode, KeyEvent event) { if(DEBUG) Log.d(TAG, "keycode: " + keyCode + ", keyevent: " + event.toString()); if (keyCode == KeyEvent.KEYCODE_BACK) { if(DEBUG) Log.d(TAG, "ending app"); finish(); }else if (keyCode == KeyEvent.KEYCODE_MENU){ if(DEBUG) Log.d(TAG, "onCreateOptionsMenu()"); doDiscovery(); // TODO toggle advanced settings return true; } return false; } private void doDiscovery(){ if(DEBUG) Log.v(TAG, "doDiscovery(): start"); new Thread( new Runnable() { public void run(){ if(DEBUG) Log.v(TAG,"doDiscovery(): start finding devices"); discovery.findDevices(); if(DEBUG) Log.d(TAG,"doDiscovery(): finding devices finished"); runOnUiThread( new Runnable() { public void run() { if(DEBUG) Log.v(TAG,"doDiscovery(): show devices start"); discovery.showDevices(); if(DEBUG) Log.d(TAG,"doDiscovery(): finish showing devices"); } } ); if(DEBUG) Log.v(TAG, "doDiscovery() finished"); } } ).start(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
2f501b2e7aae6ed0b5b355a901c064c5f3b2a6f0
a736a28523d0b63b923ac6ccd9a9118e93f72da1
/src/main/java/org/itv/biobase2/service/mapper/UserMapper.java
46d9505b86b9cdb1ad8301ce7eac04451fbad8ed
[]
no_license
andre3103/bioBaseJava
5646bf58858db84a5b9f97fa8e0472bf7ee1b162
4ffaf2c8bb5c35d14b54c22a9cfcda57d0f4dcb3
refs/heads/main
2023-03-13T04:05:09.215251
2021-02-18T00:27:54
2021-02-18T00:27:54
339,818,446
0
0
null
2021-02-18T00:27:55
2021-02-17T18:28:57
Java
UTF-8
Java
false
false
2,555
java
package org.itv.biobase2.service.mapper; import java.util.*; import java.util.stream.Collectors; import org.itv.biobase2.domain.Authority; import org.itv.biobase2.domain.User; import org.itv.biobase2.service.dto.UserDTO; import org.springframework.stereotype.Service; /** * Mapper for the entity {@link User} and its DTO called {@link UserDTO}. * * Normal mappers are generated using MapStruct, this one is hand-coded as MapStruct * support is still in beta, and requires a manual step with an IDE. */ @Service public class UserMapper { public List<UserDTO> usersToUserDTOs(List<User> users) { return users.stream().filter(Objects::nonNull).map(this::userToUserDTO).collect(Collectors.toList()); } public UserDTO userToUserDTO(User user) { return new UserDTO(user); } public List<User> userDTOsToUsers(List<UserDTO> userDTOs) { return userDTOs.stream().filter(Objects::nonNull).map(this::userDTOToUser).collect(Collectors.toList()); } public User userDTOToUser(UserDTO userDTO) { if (userDTO == null) { return null; } else { User user = new User(); user.setId(userDTO.getId()); user.setLogin(userDTO.getLogin()); user.setFirstName(userDTO.getFirstName()); user.setLastName(userDTO.getLastName()); user.setEmail(userDTO.getEmail()); user.setImageUrl(userDTO.getImageUrl()); user.setActivated(userDTO.isActivated()); user.setLangKey(userDTO.getLangKey()); Set<Authority> authorities = this.authoritiesFromStrings(userDTO.getAuthorities()); user.setAuthorities(authorities); return user; } } private Set<Authority> authoritiesFromStrings(Set<String> authoritiesAsString) { Set<Authority> authorities = new HashSet<>(); if (authoritiesAsString != null) { authorities = authoritiesAsString .stream() .map( string -> { Authority auth = new Authority(); auth.setName(string); return auth; } ) .collect(Collectors.toSet()); } return authorities; } public User userFromId(Long id) { if (id == null) { return null; } User user = new User(); user.setId(id); return user; } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
0e77918fb4f3d58ab45cabf4cc6377e698c46624
ac82c09fd704b2288cef8342bde6d66f200eeb0d
/projects/OG-Component/src/test/java/com/opengamma/component/ComponentRepositoryTest.java
a725727ff022684c58d79de4f4dbb60347ed20e3
[ "Apache-2.0" ]
permissive
cobaltblueocean/OG-Platform
88f1a6a94f76d7f589fb8fbacb3f26502835d7bb
9b78891139503d8c6aecdeadc4d583b23a0cc0f2
refs/heads/master
2021-08-26T00:44:27.315546
2018-02-23T20:12:08
2018-02-23T20:12:08
241,467,299
0
2
Apache-2.0
2021-08-02T17:20:41
2020-02-18T21:05:35
Java
UTF-8
Java
false
false
13,793
java
/** * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.component; import static org.testng.AssertJUnit.assertEquals; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import javax.management.AttributeNotFoundException; import javax.management.InstanceNotFoundException; import javax.management.MBeanException; import javax.management.MBeanServer; import javax.management.MXBean; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.ReflectionException; import javax.management.openmbean.CompositeData; import javax.servlet.ServletContext; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.Lifecycle; import org.springframework.context.Phased; import org.springframework.jmx.support.MBeanServerFactoryBean; import org.springframework.mock.web.MockServletContext; import org.springframework.web.context.ServletContextAware; import org.testng.annotations.Test; import com.opengamma.util.SingletonFactoryBean; import com.opengamma.util.test.TestGroup; /** * Test component repository. */ @Test(groups = TestGroup.UNIT) public class ComponentRepositoryTest { private static final ComponentLogger LOGGER = ComponentLogger.Sink.INSTANCE; public void test_registerSimple() { ComponentRepository repo = new ComponentRepository(LOGGER); ComponentInfo info = new ComponentInfo(MockSimple.class, "test"); MockSimple mock = new MockSimple(); repo.registerComponent(info, mock); assertEquals(1, repo.getInstanceMap().size()); assertEquals(mock, repo.getInstanceMap().get(info.toComponentKey())); assertEquals(1, repo.getInstances(MockSimple.class).size()); assertEquals(mock, repo.getInstances(MockSimple.class).iterator().next()); assertEquals(1, repo.getTypeInfo().size()); assertEquals(MockSimple.class, repo.getTypeInfo().iterator().next().getType()); assertEquals(MockSimple.class, repo.getTypeInfo(MockSimple.class).getType()); assertEquals(info, repo.getTypeInfo(MockSimple.class).getInfo("test")); assertEquals(info, repo.findInfo(MockSimple.class, "test")); assertEquals(info, repo.findInfo("MockSimple", "test")); assertEquals(info, repo.findInfo("MockSimple::test")); LinkedHashMap<String, String> input = new LinkedHashMap<>(); input.put("a", "MockSimple::test"); input.put("b", "Rubbish::test"); input.put("c", "MockSimple::test"); LinkedHashMap<String, ComponentInfo> found = repo.findInfos(input); assertEquals(2, found.size()); assertEquals(info, found.get("a")); assertEquals(info, found.get("c")); assertEquals(false, found.containsKey("b")); repo.start(); repo.stop(); } public void test_registerLifecycle() { ComponentRepository repo = new ComponentRepository(LOGGER); ComponentInfo info = new ComponentInfo(MockInterfaces.class, "test"); MockInterfaces mock = new MockInterfaces(); repo.registerComponent(info, mock); assertEquals(1, repo.getInstanceMap().size()); assertEquals(mock, repo.getInstanceMap().get(info.toComponentKey())); assertEquals(1, repo.getInstances(MockInterfaces.class).size()); assertEquals(mock, repo.getInstances(MockInterfaces.class).iterator().next()); assertEquals(1, repo.getTypeInfo().size()); assertEquals(MockInterfaces.class, repo.getTypeInfo().iterator().next().getType()); assertEquals(MockInterfaces.class, repo.getTypeInfo(MockInterfaces.class).getType()); assertEquals(info, repo.getTypeInfo(MockInterfaces.class).getInfo("test")); assertEquals(0, mock.starts); assertEquals(0, mock.stops); repo.start(); assertEquals(1, mock.starts); assertEquals(0, mock.stops); repo.stop(); assertEquals(1, mock.starts); assertEquals(1, mock.stops); } public void test_registerPhased() { ComponentRepository repo = new ComponentRepository(LOGGER); final List<String> order = new ArrayList<>(); class Simple1 implements Lifecycle { @Override public void start() { order.add("Simple1"); } @Override public void stop() { order.add("Simple1"); } @Override public boolean isRunning() { return false; } } class Simple2 implements Lifecycle { @Override public void start() { order.add("Simple2"); } @Override public void stop() { order.add("Simple2"); } @Override public boolean isRunning() { return false; } } class PhaseMinus1 implements Lifecycle, Phased { @Override public void start() { order.add("-1"); } @Override public void stop() { order.add("-1"); } @Override public boolean isRunning() { return false; } @Override public int getPhase() { return -1; } } class PhasePlus1 implements Lifecycle, Phased { @Override public void start() { order.add("1"); } @Override public void stop() { order.add("1"); } @Override public boolean isRunning() { return false; } @Override public int getPhase() { return 1; } } repo.registerLifecycle(new PhasePlus1()); repo.registerLifecycle(new Simple1()); repo.registerLifecycle(new PhaseMinus1()); repo.registerLifecycle(new Simple2()); repo.start(); assertEquals("-1", order.get(0)); assertEquals("Simple1", order.get(1)); assertEquals("Simple2", order.get(2)); assertEquals("1", order.get(3)); order.clear(); repo.stop(); assertEquals("1", order.get(0)); assertEquals("Simple2", order.get(1)); assertEquals("Simple1", order.get(2)); assertEquals("-1", order.get(3)); } public void test_registerSCAware() { ComponentRepository repo = new ComponentRepository(LOGGER); ComponentInfo info = new ComponentInfo(MockInterfaces.class, "test"); MockInterfaces mock = new MockInterfaces(); repo.registerComponent(info, mock); assertEquals(1, repo.getInstanceMap().size()); assertEquals(mock, repo.getInstanceMap().get(info.toComponentKey())); assertEquals(1, repo.getInstances(MockInterfaces.class).size()); assertEquals(mock, repo.getInstances(MockInterfaces.class).iterator().next()); assertEquals(1, repo.getTypeInfo().size()); assertEquals(MockInterfaces.class, repo.getTypeInfo().iterator().next().getType()); assertEquals(MockInterfaces.class, repo.getTypeInfo(MockInterfaces.class).getType()); assertEquals(info, repo.getTypeInfo(MockInterfaces.class).getInfo("test")); assertEquals(0, mock.servletContexts); repo.setServletContext(new MockServletContext()); assertEquals(1, mock.servletContexts); } public void test_registerInitializingBean() { ComponentRepository repo = new ComponentRepository(LOGGER); ComponentInfo info = new ComponentInfo(MockInterfaces.class, "test"); MockInterfaces mock = new MockInterfaces(); assertEquals(0, mock.inits); repo.registerComponent(info, mock); assertEquals(1, mock.inits); assertEquals(1, repo.getInstanceMap().size()); assertEquals(mock, repo.getInstanceMap().get(info.toComponentKey())); assertEquals(1, repo.getInstances(MockInterfaces.class).size()); assertEquals(mock, repo.getInstances(MockInterfaces.class).iterator().next()); assertEquals(1, repo.getTypeInfo().size()); assertEquals(MockInterfaces.class, repo.getTypeInfo().iterator().next().getType()); assertEquals(MockInterfaces.class, repo.getTypeInfo(MockInterfaces.class).getType()); assertEquals(info, repo.getTypeInfo(MockInterfaces.class).getInfo("test")); } public void test_registerFactoryBean() { ComponentRepository repo = new ComponentRepository(LOGGER); ComponentInfo info = new ComponentInfo(MockInterfaces.class, "test"); MockFactory mock = new MockFactory(); assertEquals(0, mock.inits); assertEquals(0, mock.created.inits); repo.registerComponent(info, mock); assertEquals(1, mock.inits); assertEquals(1, mock.created.inits); assertEquals(1, repo.getInstanceMap().size()); assertEquals(mock.created, repo.getInstanceMap().get(info.toComponentKey())); assertEquals(1, repo.getInstances(MockInterfaces.class).size()); assertEquals(mock.created, repo.getInstances(MockInterfaces.class).iterator().next()); assertEquals(1, repo.getTypeInfo().size()); assertEquals(MockInterfaces.class, repo.getTypeInfo().iterator().next().getType()); assertEquals(MockInterfaces.class, repo.getTypeInfo(MockInterfaces.class).getType()); assertEquals(info, repo.getTypeInfo(MockInterfaces.class).getInfo("test")); } @Test(expectedExceptions = RuntimeException.class) public void test_registerAfterStart() { ComponentRepository repo = new ComponentRepository(LOGGER); ComponentInfo info = new ComponentInfo(MockSimple.class, "test"); repo.registerComponent(info, new MockSimple()); repo.start(); repo.registerComponent(info, new MockSimple()); } /** * Test that we can register MBeans on the server and access their attributes. * * @throws MalformedObjectNameException * @throws AttributeNotFoundException * @throws MBeanException * @throws ReflectionException * @throws InstanceNotFoundException */ @Test public void test_registerMBean() throws MalformedObjectNameException, AttributeNotFoundException, MBeanException, ReflectionException, InstanceNotFoundException { MBeanServer server = createMBeanServer(); ComponentRepository repo = createComponentRepository(server); ObjectName registrationName = new ObjectName("test:name=MBean"); repo.registerMBean(new TestMBean(), registrationName); repo.start(); assertEquals(true, server.isRegistered(registrationName)); assertEquals(server.getAttribute(registrationName, "Answer"), 42); } /** * Test that we can register MX Beans on the server and access their * attributes. MX Bean attributes should be converted to composite data types. * * @throws MalformedObjectNameException * @throws AttributeNotFoundException * @throws MBeanException * @throws ReflectionException * @throws InstanceNotFoundException */ @Test public void test_registerMXBean() throws MalformedObjectNameException, AttributeNotFoundException, MBeanException, ReflectionException, InstanceNotFoundException { MBeanServer server = createMBeanServer(); ComponentRepository repo = createComponentRepository(server); ObjectName registrationName = new ObjectName("test:name=MXBean"); repo.registerMBean(new TestMXBean(), registrationName); repo.start(); assertEquals(true, server.isRegistered(registrationName)); // Real test is whether we can access "remotely" - we should get type of // CompositeData rather than ComplexAttribute CompositeData data = (CompositeData) server.getAttribute(registrationName, "Answer"); assertEquals(42, data.get("inty")); assertEquals("forty-two", data.get("stringy")); } private ComponentRepository createComponentRepository(MBeanServer server) { ComponentRepository repo = new ComponentRepository(LOGGER); // Register the MBean server repo.registerComponent(MBeanServer.class, "", server); return repo; } private MBeanServer createMBeanServer() { MBeanServerFactoryBean factoryBean = new MBeanServerFactoryBean(); factoryBean.setLocateExistingServerIfPossible(true); // Ensure the server is created factoryBean.afterPropertiesSet(); return factoryBean.getObject(); } public static class TestMBean { private int answer = 42; public int getAnswer() { return answer; } } public static class TestMXBean implements TestMXInterface { private ComplexAttribute answer = new ComplexAttribute(); public ComplexAttribute getAnswer() { return answer; } } @MXBean public interface TestMXInterface { public ComplexAttribute getAnswer(); } // Standard MBean can't handle this without having the defintion on the // client side as well. MX Beans should be able to handle public static class ComplexAttribute { public String getStringy() { return "forty-two"; } public int getInty() { return 42; } } //------------------------------------------------------------------------- static class MockSimple { } static class MockInterfaces implements Lifecycle, ServletContextAware, InitializingBean { int starts; int stops; int servletContexts; int inits; @Override public void start() { starts++; } @Override public void stop() { stops++; } @Override public boolean isRunning() { return false; } @Override public void setServletContext(ServletContext servletContext) { servletContexts++; } @Override public void afterPropertiesSet() throws Exception { inits++; } } static class MockFactory extends SingletonFactoryBean<MockInterfaces> implements Lifecycle { int starts; int stops; int inits; MockInterfaces created = new MockInterfaces(); @Override public void start() { starts++; } @Override public void stop() { stops++; } @Override public boolean isRunning() { return false; } @Override public void afterPropertiesSet() { inits++; super.afterPropertiesSet(); } @Override protected MockInterfaces createObject() { return created; } } }
[ "cobaltblue.ocean@gmail.com" ]
cobaltblue.ocean@gmail.com
3f327739a5e32ee6c18812a497724850c212eff2
0e7233ddf4f25f0d51e26f0087b415442a71a9ad
/Turbine/src/robot/ShovelBladeRobot.java
6ff94806741c6cf7698b1d7e820b1a34b2acd403
[]
no_license
mortenterhart/AirplaneDoor_Turbine
6831c46a1093297ec9224d54f7587704bf012b56
bf7100360eed5baccebdcf6e5d77e89e323438d5
refs/heads/master
2021-04-28T03:02:05.356618
2018-02-24T16:15:29
2018-02-24T16:15:29
122,129,435
1
0
null
null
null
null
UTF-8
Java
false
false
2,848
java
package robot; import blade.CarbonBlade; import blade.ShovelBlade; import blade.TitanBlade; import logging.Logger; import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; public class ShovelBladeRobot implements IShovelBladeVisitor { private List<ShovelBlade> blades; private ListIterator<ShovelBlade> listIterator; private ShovelBlade currentBlade; private boolean robotTurnedOn = false; public ShovelBladeRobot(List<ShovelBlade> turbineBlades) { Logger.instance.log("--- Creating ShovelBladeRobot with list of blades and ListIterator"); blades = turbineBlades; listIterator = turbineBlades.listIterator(); } public boolean visit(CarbonBlade blade) { Logger.instance.log("> ShovelBladeRobot: Visiting this CarbonBlade and checking if it is intact"); return robotTurnedOn && blade != null && blade.isIntact(); } public boolean visit(TitanBlade blade) { Logger.instance.log("> ShovelBladeRobot: Visiting this TitanBlade and checking if it is undamaged"); return robotTurnedOn && blade != null && blade.isUndamaged(); } public void start() { Logger.instance.log("> ShovelBladeRobot: Starting robot ...\n"); turnOn(); } public boolean hasNextBlade() { return robotTurnedOn && listIterator.hasNext(); } public void checkNext() throws NoSuchElementException { if (hasNextBlade()) { currentBlade = listIterator.next(); boolean checkSuccessful = currentBlade.checkFunctionality(this); Logger.instance.log("> ShovelBladeRobot: Check of this blade was " + (checkSuccessful ? "successful" : "not successful")); Logger.instance.log(" Blade is fully functional\n"); return; } Logger.instance.logError("> ERROR: ShovelBladeRobot: Reached end of blade stream or robot turned off"); throw new NoSuchElementException("Either robot is turned off or reached end of blade stream " + "(use method hasNextBlade() in that case)"); } public void resetPosition() { Logger.instance.log("> ShovelBladeRobot: Resetting the robot's position and starting again from index 1"); currentBlade = null; listIterator = blades.listIterator(); } public void stop() { Logger.instance.log("> ShovelBladeRobot: Stopping robot ...\n"); turnOff(); } private void turnOn() { robotTurnedOn = true; } private void turnOff() { robotTurnedOn = false; } public int getNumberOfBlades() { return blades.size(); } public ShovelBlade getCurrentBlade() { return currentBlade; } public boolean isTurnedOn() { return robotTurnedOn; } }
[ "morten.terhart@gmail.com" ]
morten.terhart@gmail.com
407461649b7bd07ae81c7c533b0d268b3e696e22
b4a66765f1a1c52e19da94bfb16125cfd0a83b88
/src/com/actitime/generic/package-info.java
027555115aa705bd90fb3ef68c838c7b5cf00675
[]
no_license
smkamble/Automation
5b2f7ac4c615f9792597809e2806d89a4186a29a
3848719692addae4bbba531efaba14213cfed080
refs/heads/master
2020-04-22T10:15:59.018831
2018-09-07T14:56:18
2018-09-07T14:56:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
/** * */ /** * @author dell * */ package com.actitime.generic;
[ "nishimittaldec12@gmail.com" ]
nishimittaldec12@gmail.com
1d5b36d9e4c8407613b0e53f35e30396b7bd1c3e
64d299ef26e2b18b2faab62ebadce8b63158b1ba
/src/algorithm/studyGroup/study2/칸토어집합_1.java
1ce3aaa5cddb276c4501b5cca2e15d57e13fc643
[]
no_license
NaKyouTae/algorithm
7cb530ce2161ac6be5ae4fd4c31fd88e422932c2
eedb6a012782e58f504d79498d2b39ce140830e5
refs/heads/master
2023-08-29T16:15:02.066901
2021-11-01T02:21:56
2021-11-01T02:21:56
367,398,692
0
0
null
null
null
null
UTF-8
Java
false
false
1,141
java
package algorithm.studyGroup.study2; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //0 //1 //3 //2 //https://www.acmicpc.net/problem/4779 public class 칸토어집합_1 { public static StringBuilder sb = new StringBuilder(); public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = ""; while (!(str = br.readLine()).equals("")) { int n = Integer.parseInt(str); if (n == 0) { sb.append("-").append("\n"); } else { int pow = (int) Math.pow(3, n); print(pow); sb.append("\n"); } } System.out.println(sb.toString()); } public static void print(int n) { if (n == 1) { sb.append("-"); return; } print(n / 3); space(n / 3); print(n / 3); } public static void space(int n) { for (int i = 0; i < n; i++) { sb.append(" "); } } }
[ "qppk@naver.com" ]
qppk@naver.com
3a8faee373821b452045cfc97c6c4fb47178b065
af7d07279c42be675a3fe194ee3a097afe03d84e
/3 - Java/Clase 12__13-05/LangostaAhumada/src/com/nacho/Main.java
d8bb8c994a8ac42b7c25a7daf185b221a31b9598
[ "MIT" ]
permissive
cavigna/modulo_programacion_basica_en_java
5bf15cd561b1468ec7e685b473736b75135e5a96
122fa7854d79410c960a777ef859218bd20868da
refs/heads/main
2023-05-26T21:32:03.933006
2021-06-07T03:06:37
2021-06-07T03:06:37
362,890,003
0
0
null
null
null
null
UTF-8
Java
false
false
1,312
java
// ----- LANGOSTA AHUMADA ----- // package com.nacho; import java.util.Scanner; public class Main { //Creación de un Método public static int langostaAhumadaMain(int cantidadComensales){ int costoXpersona; if (cantidadComensales>=200 && cantidadComensales<=300){ costoXpersona = 8500; } else if( cantidadComensales>300){ costoXpersona = 7500; } else{ costoXpersona = 9500; } return (costoXpersona * cantidadComensales); } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numPersona = scanner.nextInt(); System.out.println("Cuantos comensales tendremos el agrado de" + " agasajar: " + numPersona); //con método int soloMetodo = langostaAhumadaMain(numPersona); System.out.println("EL costo total es: " + soloMetodo); // con una Clase y un método int soloClase = LangostaAhumada.langostaAhumada(numPersona); System.out.println("------------------"); System.out.println(); System.out.println("EL costo total es: " + soloMetodo); } }
[ "40524472+cavigna@users.noreply.github.com" ]
40524472+cavigna@users.noreply.github.com
c6065578c4690c5270616bc8051fa56665b05cca
f1b469068ef94a750a72acd50e073c8ec3867751
/src/main/java/org/essencemc/essence/modules/kits/KitsMenu.java
b6af2464055a1564f9b81190efd701690844980d
[ "MIT" ]
permissive
Rojoss/Essence
2491a22d690dffb614b206553b09d0c5ee33253b
a584095aa792b4e3dec99f85e8ea085509be5728
refs/heads/master
2016-08-12T13:44:27.999110
2015-12-01T13:48:15
2015-12-01T13:48:15
52,707,783
0
0
null
null
null
null
UTF-8
Java
false
false
4,160
java
package org.essencemc.essence.modules.kits; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.essencemc.essence.EssMessage; import org.essencemc.essence.Essence; import org.essencemc.essence.modules.signs.SignModule; import org.essencemc.essence.modules.signs.config.SignData; import org.essencemc.essencecore.entity.EItem; import org.essencemc.essencecore.menu.Menu; import org.essencemc.essencecore.message.Message; import org.essencemc.essencecore.message.Param; import org.essencemc.essencecore.util.NumberUtil; import org.essencemc.essencecore.util.Util; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; public class KitsMenu extends Menu { private KitModule kitModule; private Map<UUID, String> playerMenu = new HashMap<UUID, String>(); public KitsMenu(KitModule kitModule) { super(Essence.inst(), "ess-kits", 6, EssMessage.CORE_KITS_MENU_TITLE.msg().getText()); this.kitModule = kitModule; } @Override protected void onDestroy() {} @Override protected void onShow(InventoryOpenEvent event) { updateContent((Player) event.getPlayer()); } @Override protected void onClose(InventoryCloseEvent event) {} @Override protected void onClick(InventoryClickEvent event) { event.setCancelled(true); Player player = (Player)event.getWhoClicked(); UUID uuid = player.getUniqueId(); String menu = playerMenu.get(uuid); if (event.getRawSlot() == 0) { //Previous page int page = NumberUtil.getInt(menu.split("-")[1]); if (page > 1) { playerMenu.put(uuid, "main-" + (page-1)); updateContent(player); } } else if (event.getRawSlot() == 8) { //Next page int page = NumberUtil.getInt(menu.split("-")[1]); if (kitModule.getConfig().getKitList().size() > page * 45) { playerMenu.put(uuid, "main-" + (page+1)); updateContent(player); } } else if (event.getRawSlot() > 8 && event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR) { //Click on kit. if (event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { kitModule.getKitDisplayMenu().setPlayerKit(player, Util.stripAllColor(new EItem(event.getCurrentItem()).getName())); kitModule.getKitDisplayMenu().show(player); } else { kitModule.giveKit(player, Util.stripAllColor(new EItem(event.getCurrentItem()).getName())); } } } private void updateContent(Player player) { UUID uuid = player.getUniqueId(); if (!playerMenu.containsKey(uuid)) { playerMenu.put(uuid, "main-0"); } String menu = playerMenu.get(uuid); int page = NumberUtil.getInt(menu.split("-")[1]); setSlot(0, new EItem(Material.SKULL_ITEM).setName(Message.PREVIOUS_PAGE.msg().getText()).setSkull("MHF_ArrowLeft").addAllFlags(true), player); setSlot(4, new EItem(Material.PAPER).setName(Message.INFORMATION.msg().getText()).setLore(EssMessage.CORE_KITS_MENU_INFO.msg().getText()), player); setSlot(8, new EItem(Material.SKULL_ITEM).setName(Message.NEXT_PAGE.msg().getText()).setSkull("MHF_ArrowRight").addAllFlags(true), player); List<KitData> kits = kitModule.getConfig().getKitList(); int slot = 9; for (int i = page * 45; i < page * 45 + 45 && i < kits.size(); i++) { KitData kit = kits.get(i); EItem item = kit.getIcon(); if (item == null || item.getType() == Material.AIR) { item = new EItem(Material.ENDER_CHEST); } item.setName("&a&l" + kit.getName()); setSlot(slot, item, player); slot++; } } }
[ "josroossien@hotmail.com" ]
josroossien@hotmail.com
35cd38e09ba05db1690182a9c74e44b058f62ea6
2295ec5c6fef1a561d667f96fd4d4f6d0c9f5345
/proj1b/OffByOne.java
51bcf32068734cca1b6b8dca3a086dc8f136f574
[]
no_license
0-yy-0/cs61b-su18
8603775953ec37922b83aa9f68b12af97adede51
a0127bbebf55c8d24e6463f1d3c7280d7ae53289
refs/heads/master
2023-05-06T16:14:04.514971
2021-05-28T13:43:37
2021-05-28T13:43:37
369,451,570
0
0
null
null
null
null
UTF-8
Java
false
false
230
java
public class OffByOne implements CharacterComparator { @Override public boolean equalChars(char x, char y){ if ((x - y) == 1 || (x - y) == -1) { return true; } else return false; } }
[ "310484121@qq.com" ]
310484121@qq.com
dfae49a14f034a1004f9a188eb7dff236b07ba25
59e9976b7457b46174c64daf4c0d15462ae8b3b4
/android/app/src/main/java/com/reactnativetravisdetox/MainActivity.java
4b05f6fc70af060871b8324c30476674b2881f0b
[ "MIT" ]
permissive
pablo-albaladejo/react-native-travis-detox
90cf819be5b6550082089c4a3cceae307c2b5014
42b2c4d0c3db545c946f71e28993b217a2f98405
refs/heads/master
2023-01-09T06:55:48.027226
2020-02-06T15:26:55
2020-02-06T15:26:55
238,419,979
0
0
MIT
2022-12-10T17:09:45
2020-02-05T10:07:58
Objective-C
UTF-8
Java
false
false
371
java
package com.reactnativetravisdetox; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "ReactNativeTravisDetox"; } }
[ "pablo.albaladejo@guidesmiths.com" ]
pablo.albaladejo@guidesmiths.com
fa2c1b2d8fd200532be949117fe8bee669008e17
f8d8059671a4757a7bc11467f3e5f618555d274f
/Classes/Test4/Test4.java
5a36a559ba4c52f0ee68e7cb88eca07587d3bb86
[]
no_license
DenisKursakov/EpamJavaIntroduction
67e42aafb3abf76783e088d9c8c9d69c58480bde
d0c151bf741530a1af5bc69f1e09d449ac416d8e
refs/heads/master
2023-08-29T05:43:08.033036
2021-10-11T12:27:25
2021-10-11T12:27:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
943
java
package EpamJavaTrainee.Classes.Test4; import java.util.Scanner; public class Test4 { int max = 10; int min = 0; private int realy = 1; public int getRealy() { return realy; } public void setRealy(int realy) { this.realy = realy; } public void newrealy() { System.out.println("Задайте состояние счетчика"); Scanner scanner = new Scanner(System.in); int k = scanner.nextInt(); if(k <= max && k>= min) { setRealy(k); } else return; System.out.println(realy); } public int up (int realy){ if(realy+1 <= max) { realy++; System.out.println(realy); } return realy; } public int down (int realy){ if(realy-1 >= min) { realy--; } return realy; } public int now (int realy) { return realy; } }
[ "itisfunny4x@gmail.com" ]
itisfunny4x@gmail.com
c5ffd82f0923deca77acbc0941dc1bc18eb1cab6
ba16181a0a69aada6101ad536139648fc0ef2f21
/src/main/java/anax/pang/repository/UserLogRepository.java
23c655087112343a125e3550a77d1f690e5c5947
[]
no_license
Makli92/SpringDraft
5e6c7a305acd7433c96c75ea67d663df61f2a485
5a4c4d485e6ec487eda74e5bc8189a97b1ba0fee
refs/heads/master
2022-12-24T09:07:06.980794
2018-10-19T17:23:51
2018-10-19T17:23:51
90,549,668
0
0
null
2022-12-16T10:31:50
2017-05-07T17:27:54
Java
UTF-8
Java
false
false
3,422
java
package anax.pang.repository; import java.util.Date; import java.util.List; import javax.persistence.TypedQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import anax.pang.model.UserLog; @Transactional @Repository public class UserLogRepository { @Autowired private SessionFactory sessionFactory; protected Session currentSession(){ return sessionFactory.getCurrentSession(); } public UserLog getUserLog(Long userLogId) { return currentSession().get(UserLog.class, userLogId); } @SuppressWarnings("unchecked") public List<UserLog> getUserLogs(String email, Integer page, String sort, Integer limit) { String queryStr = "select ul from UserLog ul inner join ul.user u"; String orderByStr = ""; TypedQuery<UserLog> query = null; // Check if sorting exists and set if so if ( sort != null ) { if (sort.equals("asc") || sort.equals("desc")) { orderByStr = " order by ul.dateLoggedIn " + sort + " "; } } // Check if for regular user or admin use if ( email != null ) { query = currentSession().createQuery(queryStr + " where email = :email" + orderByStr); query.setParameter("email", email); } else { query = currentSession().createQuery(queryStr + orderByStr); } // Check if pagination and limit requested if ( ((limit != null) && (limit.intValue() >= 0)) && ((page != null) && (page.intValue() >= 0)) ) { query.setFirstResult(page.intValue() * limit.intValue()); query.setMaxResults(limit.intValue()); } return query.getResultList(); } //--------------------------------Thomas--------------------------------------------------------------- @SuppressWarnings("unchecked") public List<UserLog> getAppLogPerAppPerTimeGap(int AppId,Date Start_DateTime,Date End_DateTime){ TypedQuery<UserLog> query = null; query = currentSession().createQuery(" from UserLog ul where app_id = :app_id and ((ul.event=3 and ul.eventDate>= :start_event_datetime) or (ul.event=4 and ul.eventDate<= :end_event_datetime)) ").setParameter("app_id", AppId).setParameter("start_event_datetime", Start_DateTime).setParameter("end_event_datetime", End_DateTime); return query.getResultList(); } @SuppressWarnings("unchecked") public List<UserLog> getAppLogPerAppPerActiveUser(int AppId){ TypedQuery<UserLog> query = null; query = currentSession().createQuery(" from UserLog ul where app_id = :app_id and (ul.event=3 or ul.event=4) ").setParameter("app_id", AppId); return query.getResultList(); } @SuppressWarnings("unchecked") public List<UserLog> getAppLogPerUserPerTotalTime(int AppId){ TypedQuery<UserLog> query = null; query = currentSession().createQuery(" from UserLog ul where app_id = :app_id and (ul.event=3 or ul.event=4) ").setParameter("app_id", AppId); return query.getResultList(); } @SuppressWarnings("unchecked") public List<UserLog> getAppLogPerUserPerTotalPoints(int AppId){ TypedQuery<UserLog> query = null; query = currentSession().createQuery(" from UserLog ul where app_id = :app_id and (ul.event=3 and ()) ").setParameter("app_id", AppId); return query.getResultList(); } //--------------------------------Thomas--------------------------------------------------------------- }
[ "kostahiri@gmail.com" ]
kostahiri@gmail.com
676f2b8140a4b837b147cf1d37d3436da2d061c7
d2984ba2b5ff607687aac9c65ccefa1bd6e41ede
/metamodel/net/datenwerke/security/service/security/entities/AceAccessMap__.java
04c53a91fa55da56b9fa72aad86f232830a40aa8
[]
no_license
bireports/ReportServer
da979eaf472b3e199e6fbd52b3031f0e819bff14
0f9b9dca75136c2bfc20aa611ebbc7dc24cfde62
refs/heads/master
2020-04-18T10:18:56.181123
2019-01-25T00:45:14
2019-01-25T00:45:14
167,463,795
0
0
null
null
null
null
UTF-8
Java
false
false
1,521
java
/* * ReportServer * Copyright (c) 2018 InfoFabrik GmbH * http://reportserver.net/ * * * This file is part of ReportServer. * * ReportServer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.datenwerke.security.service.security.entities; import net.datenwerke.dtoservices.dtogenerator.annotations.GeneratedType; /** * This file was automatically created by DtoAnnotationProcessor, version 0.1 */ @GeneratedType("net.datenwerke.entityservices.metadatagenerator.EntityMetadataProcessor") public class AceAccessMap__ implements net.datenwerke.entityservices.metadatagenerator.interfaces.EntityMetadataProvider { public static final String access = "access"; public static final String id = "id"; public static final String securee = "securee"; public static final String serialVersionUID = "serialVersionUID"; public static final String version = "version"; }
[ "srbala@gmail.com" ]
srbala@gmail.com
8f21c06be52a008580308374f268c92589b569cb
d5b8416c746c67cbe682d178fbb20e49b3dd896a
/Unit1/Lesson1/Activity1.java
ca1262e44cd911520bf1a343795a17b08b9d92e0
[]
no_license
TomBinford/EdhesiveCSA
4f84e1e4cfcf70966957a5932c3cef2f787c9739
89ab40f0f48d95390d6c22e69671ac5d350a1881
refs/heads/master
2022-04-09T10:13:30.324980
2019-09-23T20:31:49
2019-09-23T20:31:49
205,568,467
1
1
null
2019-09-23T20:31:51
2019-08-31T16:22:18
Java
UTF-8
Java
false
false
443
java
/* * Lesson 1 Coding Activity Question 1 * * Write a program to print your name to the center of the output screen. * Use tabs or spaces to center your output, depending on how wide your screen is. * For the code-runner, only one tab or space will be needed for your program to * be counted as acceptable. * */ class Lesson_1_Activity_One { public static void main(String[] args) { System.out.println(" Tom "); } }
[ "tjbof123@gmail.com" ]
tjbof123@gmail.com
2d7190b82ee71bef7d23262d70852a42f6f1f658
bd2625b37d57cfb60dd5fcc4e192992f6d9968e0
/src/main/java/cn/liubaicheng/nettyclient/HttpSnoopClientInitializer.java
ef95d44a3ffc76bc859b43404738dc8b25630564
[]
no_license
samlomg/nettyClientTest
c1f21d927795df1c4430b16599d1f0fba23b1b86
bf8153f945c195fba5e07784c8342eb734ec8512
refs/heads/master
2021-01-12T14:34:38.844576
2016-10-26T16:21:18
2016-10-26T16:21:22
72,021,586
0
0
null
null
null
null
UTF-8
Java
false
false
1,252
java
package cn.liubaicheng.nettyclient; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.http.HttpClientCodec; import io.netty.handler.codec.http.HttpContentDecompressor; import io.netty.handler.ssl.SslContext; /** * Created by LbcLT on 2016/10/27. */ public class HttpSnoopClientInitializer extends ChannelInitializer<SocketChannel> { private final SslContext sslCtx; public HttpSnoopClientInitializer(SslContext sslCtx) { this.sslCtx = sslCtx; } @Override protected void initChannel(SocketChannel socketChannel) throws Exception { ChannelPipeline p = socketChannel.pipeline(); // Enable HTTPS if necessary. if (sslCtx != null) { p.addLast(sslCtx.newHandler(socketChannel.alloc())); } p.addLast(new HttpClientCodec()); // Remove the following line if you don't want automatic content decompression. p.addLast(new HttpContentDecompressor()); // Uncomment the following line if you don't want to handle HttpContents. //p.addLast(new HttpObjectAggregator(1048576)); p.addLast(new HttpSnoopClientHandler()); } }
[ "youaadd@163.com" ]
youaadd@163.com
38c381b38233f0342bca858b3dbb2881fa7493b7
11452535dfd9b794ae5ddb1b787da024a56faaa9
/src/main/java/br/com/codefleck/tradebot/conf/AppWebConfiguration.java
96ff9e5988675f76939c54251f15568184dcf524
[]
no_license
CodeFleck/fleckbot
0e1211483404c5d4656f610aa1e21494ed800e45
fccd6c9daae00ab052c1599daa77ba21d82bcdb7
refs/heads/master
2022-12-25T00:45:19.253244
2021-05-23T14:32:26
2021-05-23T14:32:26
123,620,733
0
1
null
2022-12-16T10:41:32
2018-03-02T19:19:58
Java
UTF-8
Java
false
false
1,106
java
package br.com.codefleck.tradebot.conf; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @EnableWebMvc @ComponentScan(basePackages = "br.com.codefleck.tradebot") public class AppWebConfiguration extends WebMvcConfigurerAdapter { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Bean public InternalResourceViewResolver internalResourceViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); return resolver; } }
[ "danielfleck@live.ca" ]
danielfleck@live.ca
e160832f57eb6f4e48247053a5f8058706285897
32124ccafb7a7582553bdf77a0a952f145fc9a28
/Projekt/src/main/java/com/revature/projekt/ProjektApplication.java
432fc1be42cab42c1fa7fe9d025ed72a39fafb67
[]
no_license
1810Oct29SPARK/CouchM
01cd957a4ce3248acf461096cfecea3f62325d56
99165544e9a1a9b7aa25b5331d9c2d4db8b136a1
refs/heads/master
2021-06-18T17:40:26.833526
2021-01-25T14:25:45
2021-01-25T14:25:45
155,909,818
0
0
null
2018-11-13T18:58:42
2018-11-02T18:59:27
HTML
UTF-8
Java
false
false
315
java
package com.revature.projekt; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProjektApplication { public static void main(String[] args) { SpringApplication.run(ProjektApplication.class, args); } }
[ "caxmouch@gmail.com" ]
caxmouch@gmail.com
782644caf61b74b060e05aa2b9ba4a3a5a4a6954
4e46e0e8ff52237f620b5e3e0c3bc5a95a09df35
/app/src/androidTest/java/com/example/joudar/convertisseurkm/ExampleInstrumentedTest.java
cf3fffad1e8019d4c612053b19a6376cfb42b9e5
[]
no_license
maryous/Convertisseur_android
3506e8d1d247c7fd3a31fab7a532293217672043
04ece18735952e861e1777830c3a042bc0170a66
refs/heads/master
2021-07-14T00:39:18.723514
2017-10-19T14:21:40
2017-10-19T14:21:40
107,555,741
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.example.joudar.convertisseurkm; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.joudar.convertisseurkm", appContext.getPackageName()); } }
[ "hasnasara40@gmail.com" ]
hasnasara40@gmail.com
9f2c0996a76741064903cb11ff9ddc2da251c204
a1eb65ace104b5abb61e800147d9c039e93361c1
/src/com/company/RandomNumberGenerator.java
351ef1d563ff67bb84f71cb190452323952c7d86
[]
no_license
emgamble/luckynumber
547e6486baaeba351aca6e59c10b9bf86d5a9652
cdfe681695597bce605e55214f555252310fdffc
refs/heads/master
2020-03-31T13:56:37.174234
2018-10-12T00:28:21
2018-10-12T00:28:21
152,274,041
0
0
null
null
null
null
UTF-8
Java
false
false
410
java
package com.company; /** * Created by eg913 on 10/9/18. */ public class RandomNumberGenerator { public String name; public int r; public int luckyNumber; public RandomNumberGenerator(String n){ name = n; r = (int) (Math.random() * 10); luckyNumber = r * r; //System.out.println("Hello " + name + "! " + "Your Lucky number is " + luckyNumber + "."); } }
[ "eg913@pvsd.org" ]
eg913@pvsd.org
b412f32ec1aee051d3a66dea55c956c710838675
03a289c1012bc0f84d6b232bf5e274a4eb5dfec0
/javaCrazy/src/leon/ExecuteTest.java
0673f7773f8a5a2dfe62cdcf271b51e6dd213f71
[]
no_license
severalfly/MyTest
f4d93f0cf8a4b7204861a2254670a095affccbe7
27f831899378b5602b32e29ca778cab63d604a14
refs/heads/master
2022-12-20T08:13:10.727855
2019-07-16T14:21:28
2019-07-16T14:21:28
22,954,817
0
0
null
2022-12-10T04:18:57
2014-08-14T13:30:12
C
UTF-8
Java
false
false
476
java
package leon; public class ExecuteTest { public void initParam(String paramFile) throws Exception { GetSql getSql = new GetSql("mysql.ini"); SqlConn sqlconn = getSql.getSqlConn(); } public static void main(String[] args) throws Exception{ ExecuteTest ed = new ExecuteTest(); ed.initParam("mysql.ini"); // ed.createTable("create table jdbc_test (jdbc_id int auto_increment primary key, jdbc_name varchar(250));"); System.out.println("Sucess"); } }
[ "zhangsmile90@gmail.com" ]
zhangsmile90@gmail.com
d8c411f13ae5c6e2062a5479f44b2271197829b4
8a778baa7bef3ecb72268cb0c1cd86dd2f19f554
/src/org/magenpurp/Onfimarist/ServerChatPlus/commands/ServerChatPlusCommand.java
0e1551dedc9013ec17baa9c8b02ba76a84d5caa9
[ "MIT" ]
permissive
Onfimarist/ServerChatPlus
3a579d50ba6b2c2899ee4dedcf0de8d53ae7562a
08e3ca4f1ef945c7fe67b189e0de0ab9927c5530
refs/heads/master
2020-09-07T14:15:57.069155
2020-06-10T23:54:02
2020-06-10T23:54:02
220,807,174
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package org.magenpurp.onfimarist.ServerChatPlus.commands; import org.magenpurp.onfimarist.ServerChatPlus.Main; import org.bukkit.command.CommandSender; import org.magenpurp.api.command.ParentCommand; import org.magenpurp.onfimarist.ServerChatPlus.files.Messages; public class ServerChatPlusCommand extends ParentCommand { public ServerChatPlusCommand() { super("serverChatPlus"); } @Override public void sendDefaultMessage(CommandSender s) { if (s.hasPermission("scp.commands")) { showCommandsList(s); } } @Override public String noPermissionMessage() { return Main.messages.getString(Messages.noPermission); } }
[ "unconfigured@null.spigotmc.org" ]
unconfigured@null.spigotmc.org
6fad6ec354e121067b24af27c3788e338d1fe0c4
02762a2474cf97fe668919e56ca73e3f5ba55cb4
/app/src/main/java/com/aleksa/syndroid/fragments/keyboard/buttons/EnterButton.java
05ac6d62c847d420e1f3458090005c65daa3ffbb
[]
no_license
aleksa-sukovic/syndroid-mobile
05ce4c5f338b1db5566eb161e4b23a042c073b9c
d03e04b0bccbc2926113bff9e9122172a403676c
refs/heads/master
2020-04-17T11:13:47.038817
2020-01-30T12:16:52
2020-01-30T12:16:52
166,532,800
1
0
null
null
null
null
UTF-8
Java
false
false
880
java
package com.aleksa.syndroid.fragments.keyboard.buttons; import android.content.Context; import android.util.AttributeSet; import androidx.annotation.NonNull; import androidx.annotation.Nullable; public class EnterButton extends KeyboardButton { public EnterButton(@NonNull Context context) { super(context); } public EnterButton(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public EnterButton(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public EnterButton(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override public String getKeyCode() { return "enter"; } }
[ "sukovic.aleksa@gmail.com" ]
sukovic.aleksa@gmail.com
d0035a33de696243c19700b2af8f8f140690f356
b53b2e56c3c4f7ed465771274a09312934664526
/국비지원교육 5일차/enum1/enumMethod.java
d5c7b4eac3f0664bb73cc2204e672160f8aba86e
[]
no_license
sosogngngn/Study-in-National-Education
fdf51df985c0f20c8df17a79ed28a15eb4cea4c6
14fb214d71609452ed0419072e8da29e8039de2a
refs/heads/master
2023-03-04T08:50:50.057255
2021-02-10T08:57:01
2021-02-10T08:57:01
330,947,058
0
0
null
null
null
null
UHC
Java
false
false
2,131
java
package enum1; import java.util.Scanner; public class enumMethod { public static void main(String[] args) { //name 매소드 Week today = Week.SUNDAY; String name = today.name(); //-> 객체가 가지고 있는 문자열을 리턴, 이때 리턴되는 문자열은 여거 타입을 정의할 때 사용한 상수 이름과 동일하다. System.out.println(name); //Sunday 출력 //name() 매소드는 열거 객체 내부의 문자열인 "SUNDAY"를 리턴하고 name 변수에 저장한다. //original() 메소드 int ordinal = today.ordinal(); //ordinal() 메소드는 전체 열거 객체 중 몇 번째 열거 객체인지 알려준다. 열거 객체의 순번은 열거타입을 정의할 때 주어진 순번을 말함. //0부터 시작한다. -> Week enum에 MODAY가 제일 위에있다. -> 이게 0 System.out.println(ordinal);//6출력 SUNDAY는 6번째에 위치해 있다. //비교할것.comparTo(비교당할것) 메소드 Week day1 = Week.MONDAY; Week day2 = Week.WENDSDAY; int result1 = day1.compareTo(day2); // day1 - day2 MONDAY=1 , WENDSDAY=3 ->-2 출력 int result2 = day2.compareTo(day1); // day2 - day1 -> 어렵게 생각하지말고 앞에서 뒤에꺼 뺀다 생각하자 ->2출력 System.out.println(result1); System.out.println(result2); //valueOf 메소드 ->매개값으로 주어지는 문자열과 동일한 문자열을 가지는 열거 객체를 리턴한다. //이 매소드는 외부로부터 문자열을 입력받아 열거 객체로 변환할 때 유용하게 사용할 수 있다. Scanner sc = new Scanner(System.in); if(args.length==1) { String strDay = sc.next(); Week weekDay = Week.valueOf(strDay); if(weekDay == Week.SATUARDAY || weekDay == Week.SUNDAY) { System.out.println("주말이군요."); } else { System.out.println("평일 이군요"); } } //value(); 매소드 ->열거 타입의 모든 열거 객체들을 배열로 만들어 리턴한다. (형식을 외워두자) Week[] days=Week.values(); for(Week day : days) { System.out.println(day); } } }
[ "33564796+sosogngngn@users.noreply.github.com" ]
33564796+sosogngngn@users.noreply.github.com
3631908285338555723e3305250645d34bfca697
e1de859ab00d157a365765b8c0156e4fc71c3045
/yckx/src/com/brother/BaseActivity.java
50468f3831da2329a441303fe71f6a5b0396e049
[]
no_license
paomian2/yckx
fedf1370a723a3284e3687c95acb06e3f7b73d39
07e074bfcac2b2558385acc374f433868c4d41d1
refs/heads/master
2021-01-10T05:22:37.434059
2016-04-11T05:23:19
2016-04-11T05:23:19
55,936,017
0
0
null
null
null
null
GB18030
Java
false
false
8,264
java
package com.brother; import java.util.Stack; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import android.app.Activity; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.TextView; import com.androide.lib3.volley.RequestQueue; import com.brother.utils.logic.LogUtil; import com.brother.yckx.R; import com.nostra13.universalimageloader.core.ImageLoader; /*** * FragmentActivity基础类 ,主要实现了以下功能: * * @see 1 实现了对Activity生命周期的日志管理; * @see 2 实现对所有“在线”Activity的管理 {@link #finishAll()}; * @see 3 实现了对startActivity的二次封装 {@link #openActivity(Class)}; * @see 4 fragment替换操作 {@link #smartFragmentReplace(int, Fragment)} * @see 5 setAction() * @see 6 获取Volley请求队列 * * @author yuanc */ public abstract class BaseActivity extends FragmentActivity{ public ImageLoader imageLoader; private static final String TAG = "ActivityLife"; /** 用来保存所有已打开的Activity */ private static Stack<Activity> onLineActivityList = new Stack<Activity>(); /* *********************************************************************** */ /** 获取BaseApplication类中的唯一一个请求队列(Volley) */ public RequestQueue getVolleyRequestQueue() { BaseApplication application = (BaseApplication) getApplication(); return application.getRequestQueue(); } /* *********************************************************************** */ private Fragment currentFragment; /** Fragment替换(当前destrory,新的create) */ public void fragmentReplace(int target, Fragment toFragment, boolean backStack) { FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); String toClassName = toFragment.getClass().getSimpleName(); if (manager.findFragmentByTag(toClassName) == null) { transaction.replace(target, toFragment, toClassName); if (backStack) { transaction.addToBackStack(toClassName); } transaction.commit(); } } /** 聪明的Fragment替换(核心为隐藏当前的,显示现在的,用过的将不会destrory与create) */ public void smartFragmentReplace(int target, Fragment toFragment) { FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); // 如有当前在使用的->隐藏当前的 if (currentFragment != null) { transaction.hide(currentFragment); } String toClassName = toFragment.getClass().getSimpleName(); // toFragment之前添加使用过->显示出来 if (manager.findFragmentByTag(toClassName) != null) { transaction.show(toFragment); } else {// toFragment还没添加使用过->添加上去 transaction.add(target, toFragment, toClassName); } transaction.commit(); // toFragment更新为当前的 currentFragment = toFragment; } /* ********************************************************************* */ /** 关闭所有(前台、后台)Activity,注意:请已BaseActivity为父类 */ protected static void finishAll() { int len = onLineActivityList.size(); for (int i = 0; i < len; i++) { Activity activity = onLineActivityList.pop(); activity.finish(); } } /* ********************************************************************* */ public static final int NULL_ID = -1; /** * 设置ActionBar控件上的数据 * * @param resIdTitle * 中间主标题文本id,没有标题时可使用{@link #NULL_ID} * @param resIdLeft * 左侧图标资源id,没有图标时可使用{@link #NULL_ID} * @param resIdRight * 右侧图标资源id,没有图标时可使用{@link #NULL_ID} * @param actionbarListener * 动作导航条onclick监听 */ public void setActionBar(int resIdTitle, int resIdLeft, int resIdRight, OnClickListener actionListener) { try { TextView tv_action_title = (TextView) findViewById(R.id.tv_actionbar_title); ImageView iv_action_left = (ImageView) findViewById(R.id.iv_action_left); ImageView iv_action_right = (ImageView) findViewById(R.id.iv_action_right); if (actionListener != null) { tv_action_title.setOnClickListener(actionListener); iv_action_left.setOnClickListener(actionListener); iv_action_right.setOnClickListener(actionListener); } tv_action_title.setVisibility(View.INVISIBLE); iv_action_left.setVisibility(View.INVISIBLE); iv_action_right.setVisibility(View.INVISIBLE); if (resIdLeft != NULL_ID) { iv_action_left.setVisibility(View.VISIBLE); iv_action_left.setImageResource(resIdLeft); } if (resIdRight != NULL_ID) { iv_action_right.setVisibility(View.VISIBLE); iv_action_right.setImageResource(resIdRight); } if (resIdTitle != NULL_ID) { tv_action_title.setVisibility(View.VISIBLE); tv_action_title.setText(resIdTitle); } } catch (Exception e) { LogUtil.w("BaseActionbarActivity", "ActionBar有异常,是否当前页面并没有includle==> include_actionbar.xml布局?"); } } /* 生命周期管理 *********************************************************** */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); imageLoader = ImageLoader.getInstance(); LogUtil.d(TAG, getClass().getSimpleName() + " onCreate()"); onLineActivityList.push(this); } @Override protected void onStart() { super.onStart(); LogUtil.d(TAG, getClass().getSimpleName() + " onStart()"); } @Override protected void onResume() { super.onResume(); LogUtil.d(TAG, getClass().getSimpleName() + " onResume()"); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); LogUtil.d(TAG, getClass().getSimpleName() + " onPause()"); } @Override protected void onStop() { // TODO Auto-generated method stub super.onStop(); LogUtil.d(TAG, getClass().getSimpleName() + " onStop()"); } @Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); LogUtil.d(TAG, getClass().getSimpleName() + " onDestroy()"); if (onLineActivityList.contains(this)) { onLineActivityList.remove(this); } } @Override protected void onSaveInstanceState(Bundle outState) { // TODO Auto-generated method stub super.onSaveInstanceState(outState); LogUtil.d(TAG, getClass().getSimpleName() + " onSaveInstanceState()"); } @Override public void onConfigurationChanged(Configuration newConfig) { // TODO Auto-generated method stub super.onConfigurationChanged(newConfig); LogUtil.d(TAG, getClass().getSimpleName() + " onConfigurationChanged()"); } @Override public void finish() { super.finish(); overridePendingTransition(R.anim.slide_in_from_right, R.anim.slide_out_to_left); } /* 启动Activity控制******************************************************* */ public void openActivity(Class<?> targetActivityClass) { openActivity(targetActivityClass, null); } public void openActivity(Class<?> targetActivityClass, Bundle bundle) { Intent intent = new Intent(this, targetActivityClass); if (bundle != null) { intent.putExtras(bundle); } startActivity(intent); overridePendingTransition(R.anim.slide_in_from_right, R.anim.slide_out_to_left); } public void openActivityAndCloseThis(Class<?> targetActivityClass) { openActivity(targetActivityClass); this.finish(); } public void openActivityAndCloseThis(Class<?> targetActivityClass, Bundle bundle) { openActivity(targetActivityClass, bundle); this.finish(); } /** * 清除内存缓存 */ public void clearMemoryCache() { imageLoader.clearMemoryCache(); } /** * 清除SD卡中的缓存 */ public void clearDiscCache() { imageLoader.clearDiscCache(); } }
[ "497490337@qq.com" ]
497490337@qq.com
96fbe616e60dd7558a8bb12c8ca49f1c2129945a
385debbb4b5c2febd3a7ca42b87c05b5c97d0d9e
/src/main/java/rza/myLibrary/core/utilities/results/ErrorDataResult.java
8169af585396f4d90540075e6925d677df39763b
[]
no_license
rizacantire/myLibrary
d289d050610004a98276af991698cf3a70e650ec
799528911c2f118a5e18ac2713067714c632c879
refs/heads/master
2023-07-02T06:53:08.567191
2021-08-01T20:30:31
2021-08-01T20:30:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package rza.myLibrary.core.utilities.results; public class ErrorDataResult<T> extends DataResult<T> { public ErrorDataResult(T data, String message) { super(data, false ,message); } public ErrorDataResult(T data) { super(data,false); } public ErrorDataResult(String message) { super(null, false ,message); } public ErrorDataResult() { super(null, false); } }
[ "riza_tire@hotmail.com" ]
riza_tire@hotmail.com
d54ff0c6ae91aff1aa81748a0598dfe6d7c3a0c5
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/tags/3.7.5/common/src/test/java/com/tc/test/TimeBombTest.java
8aa4d734773f9bb62c87f0e1db5cd62a1d0aadc5
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
352
java
/* * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright * notice. All rights reserved. */ package com.tc.test; public class TimeBombTest extends TCTestCase { public TimeBombTest() { disableTest(); } public void testShouldNotRun() { fail("this test should not run"); } }
[ "cruise@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
cruise@7fc7bbf3-cf45-46d4-be06-341739edd864
ecb4450d4d510511438062ea99f2bae2b2c379a3
d13c0bee7588f56c67193720dfb3e79b7cca8d93
/Strategy/src/main/java/Main.java
6b2f27983a3e010242b170b65e1ffae5503035c7
[]
no_license
Tom-hayden/DesignPatterns
3253be0456cf276cc1b53536c66a8897875586a0
e726aa8b229eeefd6cc91d481892fb9aee697072
refs/heads/main
2023-01-19T11:42:51.080942
2020-11-16T17:19:55
2020-11-16T17:19:55
308,306,375
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
import SortingStrategies.AlphabeticalSorting; import SortingStrategies.ReverseSorting; import SortingStrategies.ScrabblePointsSorting; import SortingStrategies.SortingStrategy; import java.util.Arrays; public class Main { public static void main(String[] args) { String[] strings = new String[]{"a","b","c","d","e","z","a"}; SortingStrategy sortingStrategy = new AlphabeticalSorting(); System.out.println("Alphabetical sorting"); System.out.println(sortingStrategy.sort(Arrays.asList(strings))); sortingStrategy = new ScrabblePointsSorting(); System.out.println("Scrabble sorting"); System.out.println(sortingStrategy.sort(Arrays.asList(strings))); sortingStrategy = new ReverseSorting(sortingStrategy); System.out.println("Reverse alphabetical sorting"); System.out.println(sortingStrategy.sort(Arrays.asList(strings))); } }
[ "thayden@scottlogic.com" ]
thayden@scottlogic.com
e0cd5d5c1467556db3ff36f6f3a95eb20695393f
46b8c61e3e4ddf346bab4731c23b5da4c4963ee6
/WebProject/src/com/lh/service/DataService.java
85eec8c14753e26b051f89f55378de3f38ad270a
[]
no_license
luohao18738666637/PYYMRepository
7007ca33070c0a26b4c9d27538de44e5ed664927
5b57323583262562dbb524f35106c3da6e91cb38
refs/heads/master
2022-04-14T00:20:42.034547
2020-04-11T12:21:35
2020-04-11T12:21:35
254,860,647
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.lh.service; import java.util.List; import com.lh.entity.Data; import com.lh.entity.FenyeData; public interface DataService { FenyeData selectdataAll(FenyeData fenyeData); List<Data> selectdatabySid(Integer sid); Integer deletedatabyId(Integer dataid); Integer insertData(Data data); }
[ "lh18738666637@163.com" ]
lh18738666637@163.com
8d3c40fe17f10d0f1e33a6418ebe8d505f4bc1b5
1a1fac983fafbedb4effb6df92a4682f9f060919
/src/handle/AccessToken.java
18f674bd3eab1e396d1c032ce7bbf5ce99909ee9
[]
no_license
Dobby312/weChat
e44c487858cc5171519fc8315c5112afc6fd88b0
6787d880f0aec0006873171b0e137e741a522950
refs/heads/master
2020-04-14T18:56:00.557350
2019-01-21T08:33:30
2019-01-21T08:33:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package handle; public class AccessToken { private String accessToken; private long expiresTime; public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public long getExpiresTime() { return expiresTime; } public void setExpiresTime(long expiresTime) { this.expiresTime = expiresTime; } public AccessToken(String accessToken, String expiresIn) { super(); this.accessToken = accessToken; expiresTime = System.currentTimeMillis()+Integer.parseInt(expiresIn)*1000; } /** * 判断token是否过期 * @return */ public boolean isExpired() { return System.currentTimeMillis() > expiresTime; } }
[ "12345" ]
12345
51159b479d797842d39a56e57a2b4d9564c56ace
1024090003d6112a12a823803c15a9b612309c0c
/src/com/cafe24/bookmall/dao/test/Test.java
938a4ce035cd2f495264af91a0367560d7a1c4ad
[]
no_license
gonomujasic/bookmall
ded80bb093de4eed00997fc8ad2a75f40e7829d4
7e0ac8fd2b19677bbb8424300c4fc910709609a2
refs/heads/master
2021-09-08T12:00:59.541099
2018-03-09T12:10:40
2018-03-09T12:10:40
124,529,062
0
0
null
null
null
null
UTF-8
Java
false
false
2,085
java
package com.cafe24.bookmall.dao.test; import java.util.List; import com.cafe24.bookmall.dao.BookmallDao; import com.cafe24.bookmall.util.BookmallUtil; import com.cafe24.bookmall.util.DaoFactory; import com.cafe24.bookmall.vo.BookmallVo; import com.cafe24.bookmall.vo.OrdersVo; public class Test { static DaoFactory dfc = new DaoFactory(); public static void main(String[] args) { //BookmallDao bd = dfc.getDao("CustomerDao"); //BookmallDao bd = dfc.getDao("CategoryDao"); //BookmallDao bd = dfc.getDao("BookDao"); //BookmallDao bd = dfc.getDao("CartDao"); BookmallDao bd = dfc.getDao("OrdersDao"); //BookmallDao bd = dfc.getDao("OrderBookDao"); insert(bd); getList(bd); } public static void insert(BookmallDao bd) { //고객정보 삽입 CustomerDao // CustomerVo vo = // new CustomerVo("아무개", "010-1111-2222", // "amuge@hotmail.com", "1234"); // CustomerVo vo = // new CustomerVo("이민규", "010-5559-9634", // "gonomujasic@hotmail.com", "1234"); //카테고리정보 삽입 CategoryDao // CategoryVo vo = new CategoryVo(); // vo.setCategory("문학"); // vo.setCategory("자연과학"); // vo.setCategory("사회과학"); //서적정보 삽입 BookDao // BookVo vo = new BookVo("사회학개론",30000, 3); // BookVo vo = new BookVo("컴퓨터개론",30000, 2); // BookVo vo = new BookVo("경제학개론",30000, 3); //카트정보 삽입 CartDao // CartVo vo = new CartVo(2L,1L,1); // CartVo vo = new CartVo(1L,1L,1); //주문정보 삽입 OrdersDao OrdersVo vo = new OrdersVo(BookmallUtil.getOrderingNo(), "서울시 금천구", 60000, 1L); //주문서적정보 삽입 OrderBookDao // OrderBookVo vo = new OrderBookVo(30000, 1, 1L, 1L); // OrderBookVo vo = new OrderBookVo(30000, 2, 2L, 2L); bd.insert(vo); } public static void getList(BookmallDao bd) { List<BookmallVo> list = bd.getList(1); for(BookmallVo vo : list) { System.out.println(vo.toString()); } } }
[ "bit@DESKTOP-LTSU2K0" ]
bit@DESKTOP-LTSU2K0
0662f98c4b0be8d818a657efddfa39b3545a0882
7aa6502e3b6dea837f15f421c8359e79292a1388
/Adapter-pattern/src/com/ugb/adapter/AudioPlayer.java
6dd707439bf7eaebcdfe44fd4f5202edaf2df9ef
[]
no_license
umeshbongale/designpatterns
d099309e42035100ffd70597842d7a9aba540dcc
5c39f868217cb9762c9e3ffd7ba3681692513a49
refs/heads/master
2020-05-03T03:26:54.040068
2019-03-31T16:56:48
2019-03-31T16:56:48
178,398,059
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package com.ugb.adapter; public class AudioPlayer implements MediaPlayer { MediaAdapter mediaAdapter; @Override public void play(String audioType, String fileName) { //inbuilt support to play mp3 music files if(audioType.equalsIgnoreCase("mp3")){ System.out.println("Playing mp3 file. Name: " + fileName); } //mediaAdapter is providing support to play other file formats else if(audioType.equalsIgnoreCase("vlc") || audioType.equalsIgnoreCase("mp4")){ mediaAdapter = new MediaAdapter(audioType); mediaAdapter.play(audioType, fileName); } else{ System.out.println("Invalid media. " + audioType + " format not supported"); } } }
[ "umeshbongale@gmail.com" ]
umeshbongale@gmail.com
c28e0d5f96b8ddff7478e52d3d7377d222962e31
7b7b40805686b9af10dac545babc134d0501eef9
/lingshibang/lingshibang-api/src/main/java/com/juxi/lingshibang/api/controller/UserInfoExtendController.java
432d4f7aee5dae9ba1732f685b85d5fd4c646e21
[]
no_license
kongfangzi/juxikeji
0d90a81d61247fa2b771389111b7ffe74cbdd071
24dfc96197a8ca506945acf01a5de55162bae600
refs/heads/main
2023-02-28T03:43:16.521973
2021-01-25T10:59:55
2021-01-25T10:59:55
332,716,139
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package com.juxi.lingshibang.api.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.juxi.lingshibang.common.base.BaseController; /** * <p> * 前端控制器 * </p> * * @author liufeng * @since 2021-01-10 */ @RestController @RequestMapping("/user-info-extend") public class UserInfoExtendController extends BaseController { }
[ "2780966392@qq.com" ]
2780966392@qq.com
1cff0d7a914da0d5114244acbea2744dea337b9c
8f4ced6ec229ba4a7957bd7cbd12c863996a3a5e
/app/src/main/java/com/example/knowyourlimit/HistoryString.java
dfd552647999695a8e44baf154c59cb91b7caa82
[]
no_license
Dund0/KnowYourLimits
2ea869ad8b65b1f3f4a790e19184ad45de5877f4
3dffd20e1b14b56e4fbe833b3afcf7b154ab47e4
refs/heads/master
2020-12-27T10:25:53.191354
2020-02-03T02:48:01
2020-02-03T02:48:01
237,869,179
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.example.knowyourlimit; public class HistoryString { private String history; public HistoryString(Expense e) { this.history += e.toString(); } public HistoryString (String s) { this.history = s; } public String getHistory() { return this.history; } public void addHistory (Expense e){ this.history += e.toString(); } }
[ "daniel.sanandaj@gmail.com" ]
daniel.sanandaj@gmail.com
af8c2c977c18aae1915faecca7590ff56837e0f9
370cc752431bfdfc9df71dd842b985669ccbac46
/src/main/java/org/cauris/gesfisco/dao/VersementTransportRepository.java
1f37057080eab5c8832e5fa0e93d20da2a654ee0
[]
no_license
ckiad/gesfisco
4b9a33fff6a0455214482751848720b4f76b59f2
0125de61e491be80b7f3247374317c8d4691b564
refs/heads/master
2021-06-09T14:33:09.849734
2019-05-31T02:35:40
2019-05-31T02:35:40
189,514,463
0
0
null
2021-06-04T22:00:33
2019-05-31T02:33:48
Roff
UTF-8
Java
false
false
315
java
/** * */ package org.cauris.gesfisco.dao; import org.cauris.gesfisco.entities.VersementTransport; import org.springframework.data.jpa.repository.JpaRepository; /** * @author cedrickiadjeu * */ public interface VersementTransportRepository extends JpaRepository<VersementTransport, Long> { }
[ "ckiadjeu@gmail.com" ]
ckiadjeu@gmail.com
c705d4e8b85f804a4307675c3826d27100e49ea8
ef37f583873719080de4b88d9070df402e2aefea
/OS_PVRP_CPSC_464/Zeus_Core/CarrierLinkedList.java
4782e26bd917c832eb9e666d68aeff6c62cc74de
[]
no_license
arockburn/PVRP
cf776720a4f349d34634edbfa303d652d0c68140
d8a96a5e01b2ca998b1e4484cb8b4960cae1a97f
refs/heads/master
2021-01-16T18:43:59.120570
2014-10-12T16:15:16
2014-10-12T16:15:16
24,742,702
1
0
null
null
null
null
UTF-8
Java
false
false
73
java
package edu.sru.thangiah.zeus.core; public class CarrierLinkedList { }
[ "arockburn@gmail.com" ]
arockburn@gmail.com
d8eecec22dfa39ac7d438886e3ec0ecfc6a833bd
757c99bc37bcbc6c7331360943e5398e92d73757
/RestTemplate/consumer/src/test/java/com/me/gacl/ConsumerApplicationTests.java
358b4948c8eae8e7b6802d45954a63ff3501091c
[]
no_license
2HYhy/workspace
1f3440b25b77d818c1b4a10a88f8ff3284753dcf
8cb9003b16cbc4c1a773b1fafcd96970e7114960
refs/heads/master
2023-01-13T20:43:07.275247
2019-06-05T03:40:32
2019-06-05T03:40:32
100,564,591
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.me.gacl; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ConsumerApplicationTests { @Test public void contextLoads() { } }
[ "yunhua.he@changhong.com" ]
yunhua.he@changhong.com
ed11abf581709417436cf3f3b40703645d6ec4d8
cb8bb7a174ca5f79310eedd4730a422ab30944c7
/src/hitlistener/ScoreTrackingListener.java
2ecb57ca235a778d8b5fda48ae85ebef1dfe234e
[]
no_license
TamirKariv/Arkanoid
b3fdf6615a9eeefec32b71ac23526b12c1afc1f4
69cd971992a3bb68f63ee65841c24f4b61b0cecf
refs/heads/main
2023-02-04T19:33:11.178795
2020-12-26T18:56:21
2020-12-26T18:56:21
324,616,574
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package hitlistener; import sprite.Ball; import collidables.Block; /** * The type Score tracking listener. */ public class ScoreTrackingListener implements HitListener { private Counter currentScore; /** * Instantiates a new Score tracking listener. * * @param scoreCounter the score counter */ public ScoreTrackingListener(Counter scoreCounter) { this.currentScore = scoreCounter; } @Override public void hitEvent(Block beingHit, Ball hitter) { //add 5 points for hitting a block and 10 for destroying it. if (beingHit.getHitPoints() == 0) { this.currentScore.increase(15); } else { this.currentScore.increase(5); } } }
[ "tamir.kariv@gmail.com" ]
tamir.kariv@gmail.com
e8c54fd14950d5ea762c6dd6ce4e859ddce74c77
df24d9206119abbebbff528de3a78807f4e66314
/src/com/yanlin/shop/interceptor/PrivilegeInterceptor.java
105d1799f43f6918261731993508bafd84ab45e8
[]
no_license
bubblelin/OnlineShop
bcfdb4ff955a05e5864bbe4953f4422e6fb28191
cbf6147c7b706e122fd079cd15e752ed4ec00b3a
refs/heads/master
2020-09-20T10:11:01.380609
2016-09-17T01:37:37
2016-09-17T01:37:37
66,759,142
0
0
null
null
null
null
UTF-8
Java
false
false
1,017
java
package com.yanlin.shop.interceptor; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor; import com.yanlin.shop.adminuser.vo.AdminUser; /** * 后台权限检验的拦截器 * @author bubblelin * */ public class PrivilegeInterceptor extends MethodFilterInterceptor{ /** * */ private static final long serialVersionUID = 1L; protected String doIntercept(ActionInvocation actionInvocation) throws Exception { //判断session中是否有保存的用户信息 AdminUser existAdminUser = (AdminUser) ServletActionContext.getRequest().getSession().getAttribute("existAdminUser"); if(existAdminUser == null){ ActionSupport actionSupport = (ActionSupport) actionInvocation.getAction(); actionSupport.addActionError("您没有权限访问,请先去登陆"); return "loginFail"; }else{ return actionInvocation.invoke(); } } }
[ "yl.anin@qq.com" ]
yl.anin@qq.com
4364b2b54c5a1cb0018a0c1c165814928d2d82ba
a0004116ca4a605bb64eb0b22b55cca32bad889d
/LoveLog/src/main/java/com/smarter/LoveLog/wxapi/WXPayEntryActivity.java
92ce65b6d5b2714fefbfc0cd116a03116917c9ba
[]
no_license
luozhimin0918/LoveLogAppCode
09dca89f79a8d5e218803f3a91947c0f270bc82b
924ee505e5606128fa793f7a97ac64a9f64bc756
refs/heads/master
2021-01-21T14:07:59.537327
2017-05-08T05:33:46
2017-05-08T05:33:46
58,599,560
0
0
null
null
null
null
UTF-8
Java
false
false
2,989
java
package com.smarter.LoveLog.wxapi; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.smarter.LoveLog.R; import com.smarter.LoveLog.activity.BaseFragmentActivity; import com.smarter.LoveLog.activity.MainActivity; import com.smarter.LoveLog.db.ConstantsWeixin; import com.smarter.LoveLog.http.ZhifuPay; import com.smarter.LoveLog.utills.DeviceUtil; import com.tencent.mm.sdk.constants.Build; import com.tencent.mm.sdk.modelpay.PayReq; import com.tencent.mm.sdk.openapi.IWXAPI; import com.tencent.mm.sdk.openapi.WXAPIFactory; import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; import java.util.Map; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import com.tencent.mm.sdk.constants.ConstantsAPI; import com.tencent.mm.sdk.modelbase.BaseReq; import com.tencent.mm.sdk.modelbase.BaseResp; import com.tencent.mm.sdk.openapi.IWXAPI; import com.tencent.mm.sdk.openapi.IWXAPIEventHandler; import com.tencent.mm.sdk.openapi.WXAPIFactory; /** * Created by Administrator on 2015/11/30. */ public class WXPayEntryActivity extends BaseFragmentActivity implements IWXAPIEventHandler { String Tag = "WXPayEntryActivity"; private static final String TAG = "MicroMsg.SDKSample.WXPayEntryActivity"; // private IWXAPI api; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pay_result_weixin_view); ButterKnife.bind(this); // api = WXAPIFactory.createWXAPI(this, ConstantsWeixin.APP_ID); MainActivity.api.handleIntent(getIntent(), this); } @Override protected void onResume() { super.onResume(); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); MainActivity.api.handleIntent(intent, this); } @Override public void onReq(BaseReq req) { } @SuppressLint("LongLogTag") @Override public void onResp(BaseResp resp) { // Log.d(TAG,"onPayCode"+ resp.errCode); Log.d(TAG,"onRespBase"+resp.errCode); if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("提示"); builder.setMessage(getString(R.string.pay_result_callback_msg, String.valueOf(resp.errCode))); builder.show(); } } }
[ "838111691@qq.com" ]
838111691@qq.com
373015f07f97ec0e2e7964ef34c5d7aa03eaeb6f
5e01f1a1974d637bcb6461530838502114c52a62
/src/main/java/videoclub_online/rest/MovieRest.java
4bb702552dee17b1983918613edc7591f5086ce3
[]
no_license
alexanders0/videoclub-online
e2490f7640f3d8cbcee423d8bdfaf4b91cdf2812
7f78ba718d5fe4e6510299e30cad090bf9da12bf
refs/heads/master
2016-09-12T22:52:07.565775
2016-05-29T12:57:49
2016-05-29T12:57:49
56,377,411
0
0
null
null
null
null
UTF-8
Java
false
false
596
java
package videoclub_online.rest; public class MovieRest { private String status; private Integer Code; private String message; private Data data; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Integer getCode() { return Code; } public void setCode(Integer code) { Code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Data getData() { return data; } public void setData(Data data) { this.data = data; } }
[ "alexandersn059@gmail.com" ]
alexandersn059@gmail.com
b499dfe211cce4a8dafc1c2de061f6dced4a0e43
856bab3c9891d3ec8c21a0985646fd5160427499
/src/main/test/ua/yuriydr/hospital/dao/EntitiesGenerator.java
9c8c7e71567d7dc33e0b1d69129f18851039efef
[]
no_license
DovRYuriy/HospitalSystem
714377ee8411f5fb8a7320ab85375391aff09751
094708d11ba6cdf435dfa7323b4c0fc1b38e1dc1
refs/heads/master
2021-01-11T21:14:40.296016
2017-01-30T19:24:11
2017-01-30T19:24:11
79,276,116
0
0
null
null
null
null
UTF-8
Java
false
false
2,589
java
package ua.yuriydr.hospital.dao; import ua.yuriydr.hospital.entity.*; import java.sql.Date; import java.sql.Timestamp; import java.time.LocalDate; import java.time.LocalDateTime; class EntitiesGenerator { static Role createRole(long temp) { Role role = new Role(); role.setIdRole(temp); role.setName("roleName " + temp); return role; } static Person createPerson(long temp) { Person person = new Person(); person.setIdPerson(temp); person.setName("Name " + temp); person.setSurname("Surname " + temp); person.setPhone("1234567890 " + temp); person.setEmail("email " + temp); person.setPassword("password " + temp); person.setBirthday(Date.valueOf(LocalDate.now())); person.setIdChamber(temp); person.setRole(createRole(temp)); return person; } static Diagnosis createDiagnosis(long temp) { Diagnosis diagnosis = new Diagnosis(); diagnosis.setIdDiagnosis(temp); diagnosis.setName("Name " + temp); diagnosis.setDescription("Description " + temp); return diagnosis; } static Prescription createPrescription(long temp) { Prescription prescription = new Prescription(); prescription.setIdPrescription(temp); prescription.setDrugs("Drugs " + temp); prescription.setProcedure("Procedure " + temp); prescription.setOperation("Operation " + temp); return prescription; } static ChamberType createChamberType(long temp) { ChamberType chamberType = new ChamberType(); chamberType.setIdChamberType(temp); chamberType.setChamberName("Name " + temp); return chamberType; } static Chamber createChamber(long temp) { Chamber chamber = new Chamber(); chamber.setIdChamber(temp); chamber.setNumber(temp); chamber.setMaxCount(temp); chamber.setChamberType(createChamberType(temp)); return chamber; } static PersonDiagnosis createPersonDiagnosis(long temp) { PersonDiagnosis personDiagnosis = new PersonDiagnosis(); personDiagnosis.setPatient(createPerson(temp)); personDiagnosis.setDoctor(createPerson(temp)); personDiagnosis.setPrescription(createPrescription(temp)); personDiagnosis.setDiagnosis(createDiagnosis(temp)); personDiagnosis.setDate(Timestamp.valueOf(LocalDateTime.now())); personDiagnosis.setDischargeDate(Timestamp.valueOf(LocalDateTime.now())); return personDiagnosis; } }
[ "dovzhenkoyuriy@gmail.com" ]
dovzhenkoyuriy@gmail.com
292b506fa2e04f86b411f27b1afd21cca4f0c08e
6bc1540f30aed35b064b0308d7acf387b6dc6d2c
/design-mode/src/main/java/com/zhangrui/deadlock/synchronines/TransferMoney.java
403a8b9627af5eab685a36024e0031beba03751e
[]
no_license
ruizhangtwite/rachel-man
9e0d2aa3f337d6cb10773a1cc84360aa6376a64b
7953376a82cd777884f45082d61edd6a5ce68a91
refs/heads/master
2022-12-25T16:52:08.465840
2020-05-08T01:49:28
2020-05-08T01:49:28
133,678,933
0
0
null
2022-12-16T06:13:16
2018-05-16T14:34:27
Java
UTF-8
Java
false
false
163
java
package com.zhangrui.deadlock.synchronines; /** * @Author zr * @Date 2019-05-27 **/ public interface TransferMoney { void transfer(User from, User to); }
[ "zhangrui6@kingsoft.com" ]
zhangrui6@kingsoft.com
ec839640b7b4922d592b8b91f73e16cec8ef0793
7eb2f17d16f728610d20be7310a7f4b72c718974
/example/src/main/java/com/zz/project/provide/projectmanager/entity/ProjectFillIn.java
20f4a3e74d42c88c161bf340818116f5d0410b11
[ "Apache-2.0" ]
permissive
chenzhenguo/spring-boot-plus-zz
afe963cfadc939e5e63167802a11d547950e8e65
9a2411a999f13ece7202d1e47e87cf85b6e9d79e
refs/heads/master
2023-03-27T13:06:43.973683
2021-04-02T13:37:20
2021-04-02T13:37:20
352,616,526
0
0
null
null
null
null
UTF-8
Java
false
false
3,037
java
package com.zz.project.provide.projectmanager.entity; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; import java.util.Date; import com.baomidou.mybatisplus.annotation.Version; import com.baomidou.mybatisplus.annotation.TableId; import com.zz.common.base.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import com.baomidou.mybatisplus.annotation.TableField; /** * 申报填报申请信息表 * * @author czg * @since 2021-04-02 */ @Data @Accessors(chain = true) @EqualsAndHashCode(callSuper = true) @TableName("zz_project_fill_in") @ApiModel(value = "ProjectFillIn实体对象") public class ProjectFillIn extends BaseEntity { private static final long serialVersionUID = 1L; @ApiModelProperty("项目名称") private String projectName; @ApiModelProperty("行业领域字典表user_industry") private String projectTerritoryTypeDicCodes; @ApiModelProperty("行业领域字典表user_industry-已查询字典") @TableField(exist=false) private String projectTerritoryTypeDicCodesString; @ApiModelProperty("推荐单位") private String recommendDepartment; @ApiModelProperty("承担单位(申请单位)(存当前登录用户单位的ID)") private Integer applyForDepartment; @ApiModelProperty("社会统一信用代码") private String socialUnifiedCreditCode; @ApiModelProperty("法定代表人") private String declareContentAttachment; @ApiModelProperty("项目负责人") private String projectLeader; @ApiModelProperty("负责人联系电话") private String projectLeaderPhone; @ApiModelProperty("申报表ID") private Integer declareId; @ApiModelProperty("项目附件") private String projectAttachment; @ApiModelProperty("发布状态") private Integer releaseStatus; @ApiModelProperty("申报时间") private Date declareTime; @ApiModelProperty("发布状态0 待审批1初审通过待复审2返回修改3 待上会 4上会中5上会结束6初审未通过7复审未通过8审核通过") private Integer declareStatus; @ApiModelProperty("发布时间") private Date releaseTime; @ApiModelProperty("是否需要上会0否1是") private Integer toMeeting; @ApiModelProperty("项目类型字典project_type") private String projectTypeDicCodes; @ApiModelProperty("项目类型字典project_type-已查询字典") @TableField(exist=false) private String projectTypeDicCodesString; @ApiModelProperty("申报类型查询 字典:declare_type") private String declareTypeDicCodes; @ApiModelProperty("申报类型查询 字典:declare_type-已查询字典") @TableField(exist=false) private String declareTypeDicCodesString; @ApiModelProperty("执行时间") private Date executeTime; }
[ "1403975610@qq.com" ]
1403975610@qq.com
f232324c883f89f311c4e86909d8c511ecf56f53
2b540e42d4b1db7ed76bbee0f8c4f68e90c980a1
/src/main/java/com/ronaldocarvalho/cursomc/repositoiries/CidadeRespository.java
bfe9da6dde10f084642cb1b23b372d787a4b2313
[]
no_license
ronaldobinho/Spring-boot-Ionic
8e95bad27c733942bcd6f2d443e22eda0a187f36
d9117a573870b678da5628ae5319793ae78c1dd4
refs/heads/master
2020-03-09T01:11:38.166143
2018-05-31T02:43:27
2018-05-31T02:43:27
128,507,580
0
0
null
null
null
null
UTF-8
Java
false
false
700
java
package com.ronaldocarvalho.cursomc.repositoiries; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.ronaldocarvalho.cursomc.domain.Cidade; @Repository public interface CidadeRespository extends JpaRepository<Cidade, Integer> { @Transactional(readOnly=true) @Query("SELECT obj FROM Cidade obj WHERE obj.estado.id = :estadoId ORDER BY obj.nome") public List<Cidade> findCidades(@Param("estadoId") Integer estado_id); }
[ "ronaldobinho@gmail.com" ]
ronaldobinho@gmail.com
df3f4e93b985c24e12c280da0aa8496e73fadf52
78e9396fb4d5e130712d4ca59a6533fa124c32ac
/final/server/src/produshow/src/main/java/com/mc437/produshow/model/product/Product.java
41514d924f7225839e6696f6e2391a7fca08ef3d
[]
no_license
BlenoClaus/MC437
793485d3649c45985cc7d395e7b97a8cf2172da6
f03b85f358b1f461d9654a70a23350aac2611c9f
refs/heads/master
2021-01-19T07:41:49.080984
2017-11-24T15:27:44
2017-11-24T15:27:44
100,644,199
0
0
null
null
null
null
UTF-8
Java
false
false
2,198
java
package com.mc437.produshow.model.product; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonIgnoreProperties(ignoreUnknown=true) @JsonInclude(Include.NON_EMPTY) public class Product { @Id @GeneratedValue private Long id; @Column(name="name") private String name; @Column(name="description") private String description; @Column(name="amount") private Long amount; @Column(name="category") private String category; @Column(name="price") private Long price; @OneToMany(cascade={CascadeType.ALL}) @JoinColumn(name="product_id") private List<Attribute> attributes; @OneToMany(cascade={CascadeType.ALL}) @JoinColumn(name="product_id") private List<Image> images; 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 String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Long getAmount() { return amount; } public void setAmount(Long amount) { this.amount = amount; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public Long getPrice() { return price; } public void setPrice(Long price) { this.price = price; } public List<Attribute> getAttributes() { return attributes; } public void setAttributes(List<Attribute> attributes) { this.attributes = attributes; } public List<Image> getImages() { return images; } public void setImages(List<Image> images) { this.images = images; } }
[ "lucascpds@gmail.com" ]
lucascpds@gmail.com
31ca0063cff2395128d2b2aa2366d6480326f983
625c3f270a0b108299b0ad31c4fa82ac83949619
/Daily/src/main/java/vo/Product_qnaVO.java
e464239604887350362109fa93afee2081eb2f76
[]
no_license
p1umstudio/Daily
5fb45bc64352d57de8f33f8283ac1db4a14f9903
208e4a29291725539c3b516721b77f87b3b60fbb
refs/heads/master
2023-08-11T17:35:18.699377
2021-10-13T08:50:31
2021-10-13T08:50:31
416,655,991
0
0
null
null
null
null
UTF-8
Java
false
false
291
java
package vo; import lombok.Data; @Data public class Product_qnaVO { private int prodqnanum; private String name; private String id; private String title; private String content; private int root ; private int step; private String date; private char state; private char secret; }
[ "plumstudio20@gmail.com" ]
plumstudio20@gmail.com
7d03ad4201fa52443b7e48b9603f47fb1e5b6901
142f84c30eadacebea471548324d49e20fdc62f2
/redis/src/br/furb/bingo/ctrl/SorteioNumero.java
6d2628e8e66cd17f236e8837b76e3ce05e485205
[]
no_license
laglasenapp/data_science_nosql-furb
24448b1ecebec045b0eb799d92ff805441b8f839
d6c28f4f4294fd5196b0b82cedf59fc36fe01f10
refs/heads/master
2022-05-23T05:04:38.153869
2020-04-30T18:25:04
2020-04-30T18:25:04
253,075,635
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package br.furb.bingo.ctrl; import java.util.HashSet; import java.util.Random; import java.util.Set; /** * Classe responsável por sortear um número único * * @author Luiz * */ public final class SorteioNumero { private int max; private int min; private Set<Integer> numerosSorteados = new HashSet<Integer>(); public SorteioNumero(int max, int min) { this.max = max; this.min = min; } public synchronized Integer sortear() throws PossibilidadeSorteioEsgotadasException { int setSize = numerosSorteados.size() + 1; if (setSize == max) { throw new PossibilidadeSorteioEsgotadasException(max); } Integer numero = new Random().nextInt(max); if (numero < min || numerosSorteados.contains(numero)) { return sortear(); } numerosSorteados.add(numero); return numero; } public final Set<Integer> getNumerosSorteados(){ return numerosSorteados; } }
[ "luizglasenapp@gmail.com" ]
luizglasenapp@gmail.com
34713942a49d72ad3e0e3957e7288bcfaecbe716
c01c6b768c023a74bafc7a1fc8b4f637f3425d8f
/src/main/java/com/wikigame/wikigame/App.java
ad4e4a8c2c0d653e10fa6d10a61393b290036d2b
[]
no_license
gleixner/wikigame
1bd067f9ed104db7d848240e47d2ac067d640679
86fdfabeeb55c31ee100f97b8593d171d5de0ed7
refs/heads/master
2020-12-30T14:00:06.890906
2018-02-20T20:40:33
2018-02-20T20:40:33
91,271,057
0
0
null
2018-02-20T20:40:34
2017-05-14T20:57:55
Java
UTF-8
Java
false
false
2,594
java
package com.wikigame.wikigame; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Queue; import java.util.Set; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executor; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class App { private static BlockingQueue<Runnable> qu = new LinkedBlockingQueue<>(); private static ThreadPoolExecutor executor = new ThreadPoolExecutor(4, 10, 100, TimeUnit.MILLISECONDS, qu); private static Set<String> visitedUrls = ConcurrentHashMap.newKeySet(); private static AtomicInteger addedTasks = new AtomicInteger(0); private static AtomicInteger executedTasks = new AtomicInteger(0); private static AtomicInteger completedTasks = new AtomicInteger(0); private static long startTime; public static void main( String[] args ) throws IOException { String start = "https://en.wikipedia.org/wiki/Fenestrelle_Fort"; // String start = "https://en.wikipedia.org/wiki/Phalonidia_hapalobursa"; // String start = "https://en.wikipedia.org/wiki/Mystic_River_(film)"; // String start = "https://en.wikipedia.org/wiki/76th_Academy_Awards"; // String start = "https://en.wikipedia.org/wiki/Michael_Caine"; // String start = "https://en.wikipedia.org/wiki/Hollywood_Walk_of_Fame"; String end = "/wiki/Kevin_Bacon"; startTime = System.currentTimeMillis(); executor.execute(new GameTask(new Page(start, null), visitedUrls, end)); } public static void success(Page winner, String target) { synchronized (qu) { executor.shutdownNow(); System.out.println("Time elapsed is " + (System.currentTimeMillis() - startTime)); System.out.println(winner.getHistory() + " --> " + target); System.out.println(executedTasks.get() + " tasks were started"); System.out.println(completedTasks.get() + " tasks were finished"); System.out.println(addedTasks.get() + " tasks were scheduled to run"); } } public static void addTask(GameTask task) { addedTasks.incrementAndGet(); try { executor.execute(task); } catch(RejectedExecutionException e) { } } public static void startTask() { executedTasks.incrementAndGet(); } public static void completeTask() { completedTasks.incrementAndGet(); } }
[ "jvgleixner@gmail.com" ]
jvgleixner@gmail.com
87f95c25f60be2ffa32b3a854f684294f8c18eeb
f6a87da64e9c8a4d5f066337c39e97dd2e9e07ea
/MyNewCucumberProject/src/main/java/pages/HomePage.java
ba93213f7a190f166956cad3f85c5d3854eafdc0
[]
no_license
AnastasiiaKrav/CucumberProject
5e24bbfad2a486e447441019cea2a8d9f3003f6c
c4bf12bba4bbd099a660ee67aaca5468e3242559
refs/heads/master
2023-06-01T20:51:14.445600
2021-06-11T21:15:22
2021-06-11T21:15:22
375,969,965
0
0
null
null
null
null
UTF-8
Java
false
false
3,485
java
package pages; import java.util.List; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class HomePage extends BasePage { @FindBy(xpath = "//header") private WebElement header; @FindBy(xpath = "//footer") private WebElement footer; @FindBy(xpath = "//a[contains(@href, 'cart.')]") private WebElement cartIcon; @FindBy(xpath = "//span[@id='gh-ug']//a[contains(@href, 'signin')]") private WebElement signInButton; @FindBy(xpath = "//span[@id='gh-ug']//a[contains(@href, 'reg')]") private WebElement registerButton; @FindBy(xpath = "//button[@id='gh-shop-a']") private WebElement shopByCategoryButton; @FindBy(xpath = "//td[@class='gh-td']//div[contains(@class, 'active')]") private WebElement shopByCategoryPopup; @FindBy(xpath = "//input[@placeholder='Search for anything']") private WebElement searchField; @FindBy(xpath = "//td[@class= 'gh-td gh-sch-btn']") private WebElement searchButton; @FindBy(xpath = "//div[@class='hl-cat-nav']") private WebElement categoriesNavigationContainer; @FindBy(xpath = "//ul[contains(@id, '2-match-media')]") private WebElement upperCarousel; @FindBy(xpath = "//div[@id='destinations_list1']") private WebElement upperPopularCategoriesList; @FindBy(xpath = "//ul[contains(@id, '4-match-media')]") private WebElement belowCarousel; @FindBy(xpath = "//div[@id='destinations_list2']") private WebElement belowPopularCategoriesList; @FindBy(xpath = "//li[@class= 'hl-cat-nav__js-tab']//a[contains(@href, 'Fashion')]") private WebElement fashionCategoryButton; @FindBy(xpath = "//ul[@class='srp-results srp-list clearfix']") private List<WebElement> itemListOnHomePage; public HomePage(WebDriver driver) { super(driver); } public void openHomePage(String url) { driver.get(url); } public void isHeaderVisible() { header.isDisplayed(); } public void isFooterVisible() { footer.isDisplayed(); } public void isCartIconVisible() { cartIcon.isDisplayed(); } public void isSignInButtonVisible() { signInButton.isDisplayed(); } public void clickSignInButton() { signInButton.click(); } public void isRegisterButtonVisible() { registerButton.isDisplayed(); } public void isShopByCategoryButtonVisible() { shopByCategoryButton.isDisplayed(); } public void clickShopByCategoryButton() { shopByCategoryButton.click(); } public void isShopByCategoryPopupVisible() { shopByCategoryPopup.isDisplayed(); } public void clickToCloseShopByCategoryButton() { shopByCategoryButton.click(); } public void isSearchFieldVisible() { searchField.isDisplayed(); } public void isCategoriesNavigationContainerVisible() { categoriesNavigationContainer.isDisplayed(); } public void isUpperCarouselVisible() { upperCarousel.isDisplayed(); } public void isUpperPopularCategoriesListVisible() { upperPopularCategoriesList.isDisplayed(); } public void isBelowCarouselVisible() { belowCarousel.isDisplayed(); } public void isBelowPopularCategoriesListVisible() { belowPopularCategoriesList.isDisplayed(); } public void clickOnFashionCategoryButton() { fashionCategoryButton.click(); } public void enterKeywordIntoSearchField(final String searchText) { searchField.clear(); searchField.sendKeys(searchText); } public void clickOnSearchButton() { searchButton.click(); } public List<WebElement> getItemListOnHomePage() { return itemListOnHomePage; } }
[ "anastasiiaks@me.com" ]
anastasiiaks@me.com
e0136073d86fe8bcef6d1bcdacc62f7dfe1661c9
0f1c2c4dbd792c5df1b544e32d4c90a7a60718bc
/Chapter7/DatabaseTest/app/src/androidTest/java/com/example/armada/databasetest/ExampleInstrumentedTest.java
40bb8632d7ee99ab149e0a8f03b43334e898cfc4
[]
no_license
ChineseRoyalStar/AndroidTyro
19fda17234d1110c7568b0858a4ef9ad9514f1f5
94dffe832fc70787710c9a0c28965d6a85b17965
refs/heads/master
2021-09-12T21:04:58.147746
2018-04-20T17:56:49
2018-04-20T17:56:49
73,454,133
1
0
null
null
null
null
UTF-8
Java
false
false
763
java
package com.example.armada.databasetest; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.armada.databasetest", appContext.getPackageName()); } }
[ "chineseroyalstar@gmail.com" ]
chineseroyalstar@gmail.com
1db73219d4e5c22e2594d1dac8dca2638b1a31af
944f2adb186e093d7ff0736ae41c3aac3fcd600f
/ConnectGym/src/main/java/com/jasla/ConnectGym/dao/SearchDAO.java
7e7f3d26ae68dc483d634d7e012cc48323b0414b
[]
no_license
de526/connectGym
10dcf3c88970301290e727daf16017c302dade55
e59e50c412f8e9e03ead399061731fb3884f1710
refs/heads/master
2023-01-05T03:36:10.659310
2020-11-05T07:22:10
2020-11-05T07:22:10
302,204,306
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.jasla.ConnectGym.dao; import java.util.List; import com.jasla.ConnectGym.domain.GymDTO; import com.jasla.ConnectGym.domain.MemberDTO; public interface SearchDAO { List<GymDTO> selectGymAll(); List<MemberDTO> selectTraAll(); List<MemberDTO> trainerSearchResult(String query); List<GymDTO> gymSearchResult(String query); }
[ "de526@daum.net" ]
de526@daum.net
4638a507abf9b9651257e8c2e6d3a64197dab9f8
256cc4a21f3c554f590abb0399195972735bc755
/src/main/java/com/example/score/service/ScoreService.java
23fe1463b6eb8a0c2efe424235b79b9105748041
[]
no_license
zhoutianqi613/consumer-score
49150b2db93a9898f9f63a428dc098e06b860c07
5bc9813ce221378d24620cb506c58a0cad5ff52d
refs/heads/master
2021-07-15T00:37:23.568482
2017-10-18T02:53:42
2017-10-18T02:53:42
107,230,709
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
package com.example.score.service; public interface ScoreService { public void Score(String accountId, double score); }
[ "568447361@qq.com" ]
568447361@qq.com
e09186bd0c297cd95081ee6136bf8ac8d67d9ea0
abc9c13d9b8ddcf4a7f22d09fe05907d834f1079
/cs455/overlay/wireformats/LinkWeights.java
001ed69739485f2d33f301a27e8c049c8958f905
[]
no_license
ansross/CS455_PA1
e62861c9752acf6696f650f78dfb21db8cdfed85
4ecabcd4a02eb111bca5dbcc50916e9050e22b3d
refs/heads/master
2016-09-05T19:39:41.963369
2014-02-18T01:35:25
2014-02-18T01:35:25
16,354,535
0
1
null
null
null
null
UTF-8
Java
false
false
3,170
java
package cs455.overlay.wireformats; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Random; public class LinkWeights implements Event { private int type=Protocol.LINK_WEIGHTS; private long numOfLinks; //string in form hostA:portA hostB:portB weight private ArrayList<String> links; public ArrayList<String> getLinks(){ return links; } public LinkWeights(long numLinksArg, ArrayList<String> linkArg){ numOfLinks = numLinksArg; links = new ArrayList<String>(); for(String s: linkArg){ links.add(s); } if(Protocol.DEBUG){ System.out.println("link info strings:" ); for(String s: links){ System.out.println(s); } } //TODO!!! // for(Link l: linkArg){ // links.add(l.clone()); // // } } public LinkWeights(byte[] marshalledBytes) throws IOException { links = new ArrayList<String>(); ByteArrayInputStream baInStr = new ByteArrayInputStream(marshalledBytes); DataInputStream din = new DataInputStream(new BufferedInputStream(baInStr)); //type int msgType = din.readInt(); if(msgType != type){ System.out.println("ERROR: types do not match. Actual type: "+type+", passed type: "+msgType); } this.numOfLinks = din.readLong(); //System.out.println("Num of links: "+numOfLinks); for(int i=0; i<numOfLinks; ++i){ int linkInfoLength = din.readInt(); byte [] linkInfoBytes = new byte[linkInfoLength]; din.readFully(linkInfoBytes); this.links.add(new String(linkInfoBytes)); } baInStr.close(); din.close(); if(Protocol.DEBUG){ System.out.println("link info strings:" ); for(String s: links){ System.out.println(s); } } } @Override public int getType() { return type; // TODO Auto-generated method stub } @Override public byte[] getByte() throws IOException { byte[] marshalledBytes=null; ByteArrayOutputStream baOutputStream = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(new BufferedOutputStream(baOutputStream)); dout.writeInt(type); dout.writeLong(numOfLinks); if(Protocol.DEBUG){ System.out.println("link info strings in marshalling:" ); for(String s: links){ System.out.println(s); } } for(int i=0; i<numOfLinks; ++i){ //for each link write hostnameA:portNumA hostnameB:portNumB weight byte[] linkInfoBytes = links.get(i).getBytes();//. //getFirstNode().messageNodeInfo().getBytes(); int elementLength = linkInfoBytes.length; dout.writeInt(elementLength); dout.write(linkInfoBytes); /* byte[] nodeBInfoBytes = links.get(i).getBytes();//.getSecondNode(). //messageNodeInfo().getBytes(); elementLength = nodeBInfoBytes.length; dout.writeInt(elementLength); dout.write(nodeBInfoBytes);*/ } dout.flush(); marshalledBytes = baOutputStream.toByteArray(); baOutputStream.close(); dout.close(); return marshalledBytes; // TODO Auto-generated method stub } }
[ "anross@rams.colostate.edu" ]
anross@rams.colostate.edu
ea858ca1800f16464f47e1c2953ce003a9f2daef
34f8d4ba30242a7045c689768c3472b7af80909c
/JDK1.6-Java SE Development Kit 6u45/src/org/omg/IOP/IOR.java
06d57aedd8653c38eb9dd5e6732800c1023c7689
[ "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
727
java
package org.omg.IOP; /** * org/omg/IOP/IOR.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from ../../../../src/share/classes/org/omg/PortableInterceptor/IOP.idl * Tuesday, March 26, 2013 2:15:00 PM GMT-08:00 */ public final class IOR implements org.omg.CORBA.portable.IDLEntity { /** The type id, represented as a String. */ public String type_id = null; /** * An array of tagged profiles associated with this * object reference. */ public org.omg.IOP.TaggedProfile profiles[] = null; public IOR () { } // ctor public IOR (String _type_id, org.omg.IOP.TaggedProfile[] _profiles) { type_id = _type_id; profiles = _profiles; } // ctor } // class IOR
[ "zeng-dream@live.com" ]
zeng-dream@live.com
86ebdd56de87abb174564b5482ac536de3d2d48c
4efd09dc0770d0b9634ccac998d630b600c4f78d
/src/main/java/br/com/alura/forum/controller/HomeController.java
36064ef62d6586248309b33663c2a5a799ce44dc
[]
no_license
renatochencci/caelum-fj27-spring-course
c17ff6a05579d6b6a596b8cdbe4f7d85899bc67d
ac6ebee4c441cda65318d4e0ed3d7ffc3cbdbfb6
refs/heads/master
2020-12-26T14:52:55.247217
2020-02-01T02:06:06
2020-02-01T02:06:06
237,543,803
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package br.com.alura.forum.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class HomeController { @RequestMapping("/") @ResponseBody public String index () { System.out.println("Oi"); return "hehe"; } }
[ "renato.games.123@gmail.com" ]
renato.games.123@gmail.com
069eb7e1609866df3070d29c63c1ad16ff9562ca
dddc864dfa09c22a28939bc6eeae09aa6058214e
/kangde-collection/src/main/java/com/kangde/collection/mapper/MessageReminderMapper.java
637646cbc436b4af2af835f4bd27d067dc49007f
[]
no_license
sdfsun/collection-full
e726242477839dd74fa8102c4a5bfaee2ee652bb
1a00393bfaa877b2bffc6f60f11c9a27c947db00
refs/heads/master
2020-03-20T08:47:24.916532
2018-04-29T01:06:07
2018-04-29T01:06:07
137,318,875
1
0
null
2018-06-14T06:57:30
2018-06-14T06:57:30
null
UTF-8
Java
false
false
499
java
package com.kangde.collection.mapper; import java.util.Date; import org.apache.ibatis.annotations.Param; import com.kangde.collection.model.MessageReminderModel; import com.kangde.commons.mapper.BaseMapper; public interface MessageReminderMapper extends BaseMapper<MessageReminderModel, String>{ int save(MessageReminderModel record); void updateMessageReminder(@Param(value = "id") String id, @Param(value = "modifyTime") Date modifyTime); void deleteReminderMapper(String dateStr); }
[ "349788131@qq.com" ]
349788131@qq.com
ce1b4b29fa2a497e32f8ca574e04c94f2a2d7ea8
1108f8280699cb854207b140dbb0f297aedbeb5f
/Playlist/app/src/androidTest/java/com/example/playlist/ExampleInstrumentedTest.java
b921017419d18ae351bba8a02d6da5b6cc91b5b5
[]
no_license
TheGreatestHacker/Android-Studio
dfd3bde5a81a5505135fb5c9a34bbd43740bb6f1
7b7fecc42c82b94e0dfcc34e67363edeb7b846b1
refs/heads/master
2020-12-29T11:34:39.584488
2020-04-16T23:10:06
2020-04-16T23:10:06
238,593,930
3
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.example.playlist; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.playlist", appContext.getPackageName()); } }
[ "bcruzcastillo@hawk.iit.edu" ]
bcruzcastillo@hawk.iit.edu
06a6234cb8643d7fe58ecc57a55a169ed84395ec
4ecb9284b6d9b56953fdc158413ba1bf7ec2f924
/src/java/until/CookieHelper.java
c92d4cf5ab72fb3f5c4d88d848352fc7e5b6adfe
[]
no_license
greenspaceml/Bookworm
6c1a058bfeca39726703687fc4626e6d491b5904
3fdaa6bb732fcee84b35be6928edcf53a2179869
refs/heads/master
2021-03-26T14:24:26.439930
2020-03-27T05:12:50
2020-03-27T05:12:50
247,708,076
0
0
null
null
null
null
UTF-8
Java
false
false
765
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 until; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; /** * * @author sonnt */ public class CookieHelper { public static void sendCookie(HttpServletResponse response,String key, String value) { Cookie cooky = new Cookie(key, value); cooky.setMaxAge(24*3600); response.addCookie(cooky); } public static void removeCookie(HttpServletResponse response,String key) { Cookie cooky = new Cookie(key, ""); cooky.setMaxAge(-1); response.addCookie(cooky); } }
[ "greenspaceml@gmail.com" ]
greenspaceml@gmail.com
a2b5c0165a23e90e20ba5d44c0de41cbac4020b0
fab3dc27ead8e1938cc780d3aefe4e630aa067f8
/src/main/java/org/jokerd/opensocial/scheduler/IActivitiesCache.java
6da147e9643f1563a70d3137096c85781e91b9df
[]
no_license
cogniumsystems/org.jokerd.opensocial.base
301b1be963570b0892a02e7e4e3e8a358a022a98
ee4d9e18a6b09fcc6696094dcc5d5c4967df4327
refs/heads/master
2020-05-20T13:11:19.480892
2013-03-06T17:25:52
2013-03-06T17:25:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
package org.jokerd.opensocial.scheduler; import java.util.Set; import org.jokerd.opensocial.api.model.ObjectId; import org.jokerd.opensocial.cursors.IActivityCursor; import org.jokerd.opensocial.cursors.StreamException; public interface IActivitiesCache { IActivityCursor getActivities(Set<ObjectId> sourceIds) throws StreamException; void storeActivities(ObjectId sourceId, IActivityCursor cursor) throws StreamException; }
[ "slauriere@ubimix.com" ]
slauriere@ubimix.com
985f3c9e8d1bbecbda9b4f94ca5547bc550dcce8
c041f6a4b6c761bf7c72d79afe5d2db0645a3bbf
/src/main/lombok/com/restfb/types/send/airline/AirlineField.java
48b7752a681e6b44ec00da407ccf17fd0adab173
[ "MIT" ]
permissive
nunam-ru/restfb
9ba0183c2ab0e60b3010b4cef248848d803cb436
92f7534aaafce3e04e004ce78b79fdb84afb4bf4
refs/heads/master
2023-09-03T01:17:19.138213
2021-11-18T13:42:33
2021-11-18T13:42:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,534
java
/* * Copyright (c) 2010-2021 Mark Allen, Norbert Bartels. * * 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.restfb.types.send.airline; import com.restfb.Facebook; import com.restfb.types.AbstractFacebookType; import lombok.Getter; public class AirlineField extends AbstractFacebookType { @Getter @Facebook private String label; @Getter @Facebook private String value; public AirlineField(String label, String value) { this.label = label; this.value = value; } }
[ "n.bartels@phpmonkeys.de" ]
n.bartels@phpmonkeys.de
759822c67a553189993b9d6c9f8e367d2f94c743
82840d747ee76fb4774bb6fd258e33b93b4e1553
/app/src/main/java/com/example/aalap/blogs/Constants.java
d7ceabb83dd547e5ee01cb35bdc6f0e592d42f31
[]
no_license
aalap03/FirebaseBlog
2e608607c8e73b45e4001fb79619597791f9dfe6
5403c723ebbfc0550f4daa9f9d2e90f45ecb78e9
refs/heads/master
2020-03-22T06:45:19.757081
2018-07-27T05:48:21
2018-07-27T05:48:21
139,655,406
0
0
null
null
null
null
UTF-8
Java
false
false
120
java
package com.example.aalap.blogs; public class Constants { public static final String DB_REFERENCE = "Blogzone"; }
[ "aalapptl02@gmail.com" ]
aalapptl02@gmail.com
dd3b987d295e78d65346ab905bd7e6c465022b8a
66e2f35b7b56865552616cf400e3a8f5928d12a2
/src/main/java/com/alipay/api/domain/AntfortuneYebInfoAdvertisingQueryModel.java
4b62c2ea4441b2d1f58e74d23b833e40cb2d8ec9
[ "Apache-2.0" ]
permissive
xiafaqi/alipay-sdk-java-all
18dc797400847c7ae9901566e910527f5495e497
606cdb8014faa3e9125de7f50cbb81b2db6ee6cc
refs/heads/master
2022-11-25T08:43:11.997961
2020-07-23T02:58:22
2020-07-23T02:58:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 余额宝外部渠道广告投放决策接口 * * @author auto create * @since 1.0, 2019-01-28 15:18:51 */ public class AntfortuneYebInfoAdvertisingQueryModel extends AlipayObject { private static final long serialVersionUID = 2119929867853788198L; /** * 参数名:mobile 应用场景:外部渠道传递手机号,由余额宝来判断是否需要进行投放并告知外部渠道 如何获取:外部渠道自己获取传过来 */ @ApiField("mobile") private String mobile; public String getMobile() { return this.mobile; } public void setMobile(String mobile) { this.mobile = mobile; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
8a850d117bc6423ec80817c435ede84e1be0251c
dd0e37400e32e7d5e61f8671c9e7a6fd998b5186
/src/main/java/com/springchat/serviceImpl/ChatServiceImpl.java
4dd00862c5308b84d211b32d69ca10b79c49fcd4
[]
no_license
anilchaurshiya22/Chatting-App
7077cf6fb8c53de35541d34256e15fb17bf963cf
5c077e40dc66d75e0bd44580bc6231d09123e3b1
refs/heads/master
2021-01-22T07:52:25.517811
2017-09-04T04:55:53
2017-09-04T04:55:53
102,317,748
0
0
null
null
null
null
UTF-8
Java
false
false
4,008
java
package com.springchat.serviceImpl; import com.springchat.dao.ChatDao; import com.springchat.dao.UserDao; import com.springchat.domain.Chat; import com.springchat.domain.ChatMember; import com.springchat.domain.ChatMessage; import com.springchat.domain.User; import com.springchat.service.ChatService; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; /** * * @author Devil */ @Transactional(propagation = Propagation.REQUIRES_NEW) @Service public class ChatServiceImpl implements ChatService { private ChatDao chatDao; private UserDao userDao; public void setChatDao(ChatDao chatDao) { this.chatDao = chatDao; } public void setUserDao(UserDao userDao) { this.userDao = userDao; } @Override public int createNewChat(User currentUser, String[] friend_ids, String message) { if (friend_ids.length == 1) { Chat chat = chatDao.getChatByTwoUser(currentUser.getId(), Long.parseLong(friend_ids[0])); if(chat != null) { createNewMessage(currentUser, chat.getId(), message); return chat.getId(); } } Chat chat = new Chat(); List<ChatMember> members = new ArrayList<>(); String chatName = currentUser.getName(); ChatMember chatMember = new ChatMember(currentUser); members.add(chatMember); if (friend_ids.length > 1) { for (String friend_id : friend_ids) { chatMember = new ChatMember(userDao.findUserById(Long.parseLong(friend_id))); chatMember.setLastActivity(new Date(0)); chatName += ", " + chatMember.getUser().getName(); members.add(chatMember); } chat.setName(chatName); chat.setIsGroup(true); chat.setChatStatus(currentUser.getName() + " started group chat"); } else { chatMember = new ChatMember(userDao.findUserById(Long.parseLong(friend_ids[0]))); chatMember.setLastActivity(new Date(0)); chatName += "/" + chatMember.getUser().getName(); members.add(chatMember); chat.setName(chatName); chat.setIsGroup(false); chat.setChatStatus(currentUser.getName() + " started chat"); } chat.setMembers(members); ChatMessage chatMessage = new ChatMessage(currentUser, message); chat.getMessages().add(chatMessage); chatMessage.setChat(chat); chatDao.insertChat(chat); return chat.getId(); } @Override public int createNewMessage(User currentUser, int chatId, String message) { Chat chat = chatDao.getChatById(chatId, currentUser.getId()); ChatMessage chatmessage = new ChatMessage(currentUser, message, chat); chatDao.insertChatMessage(chatmessage); chatDao.updateChatLastActivity(chatId); chatDao.updateChatMemberLastActivity(chatId, currentUser.getId()); return chatmessage.getId(); } @Override public List<Chat> getAllChats(long userId) { return chatDao.getChatListByUserId(userId); } @Override public List<Chat> getAllUpdatedChats(long userId) { return chatDao.getUpdatedChatListByUserId(userId); } @Override public Chat getChat(User currentUser, int chatId) { return chatDao.getChatById(chatId, currentUser.getId()); } @Override public List<ChatMessage> getNewChatMessages(User currentUser, int chatId, int messageId) { chatDao.updateChatMemberLastActivity(chatId, currentUser.getId()); return chatDao.getNewMessages(chatId, currentUser.getId(), messageId); } }
[ "syraz37@gmail.com" ]
syraz37@gmail.com
f6b73ed8539d13e35987df089ad7bda572650055
aaabffe8bf55973bfb1390cf7635fd00ca8ca945
/src/main/java/com/microsoft/graph/requests/generated/BaseWorkbookFunctionsSqrtPiRequest.java
11b7f4150698dbc6e6764038a2e1a2e6301d9070
[ "MIT" ]
permissive
rgrebski/msgraph-sdk-java
e595e17db01c44b9c39d74d26cd925b0b0dfe863
759d5a81eb5eeda12d3ed1223deeafd108d7b818
refs/heads/master
2020-03-20T19:41:06.630857
2018-03-16T17:31:43
2018-03-16T17:31:43
137,648,798
0
0
null
2018-06-17T11:07:06
2018-06-17T11:07:05
null
UTF-8
Java
false
false
2,921
java
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.requests.generated; import com.microsoft.graph.concurrency.*; import com.microsoft.graph.core.*; import com.microsoft.graph.models.extensions.*; import com.microsoft.graph.models.generated.*; import com.microsoft.graph.http.*; import com.microsoft.graph.requests.extensions.*; import com.microsoft.graph.requests.generated.*; import com.microsoft.graph.options.*; import com.microsoft.graph.serializer.*; import java.util.Arrays; import java.util.EnumSet; // **NOTE** This file was generated by a tool and any changes will be overwritten. /** * The class for the Base Workbook Functions Sqrt Pi Request. */ public class BaseWorkbookFunctionsSqrtPiRequest extends BaseRequest implements IBaseWorkbookFunctionsSqrtPiRequest { protected final WorkbookFunctionsSqrtPiBody body; /** * The request for this WorkbookFunctionsSqrtPi * * @param requestUrl the request URL * @param client the service client * @param requestOptions the options for this request */ public BaseWorkbookFunctionsSqrtPiRequest(final String requestUrl, final IBaseClient client, final java.util.List<? extends Option> requestOptions) { super(requestUrl, client, requestOptions, WorkbookFunctionResult.class); body = new WorkbookFunctionsSqrtPiBody(); } public void post(final ICallback<WorkbookFunctionResult> callback) { send(HttpMethod.POST, callback, body); } public WorkbookFunctionResult post() throws ClientException { return send(HttpMethod.POST, body); } /** * Sets the select clause for the request * * @param value the select clause * @return the updated request */ public IWorkbookFunctionsSqrtPiRequest select(final String value) { getQueryOptions().add(new QueryOption("$select", value)); return (WorkbookFunctionsSqrtPiRequest)this; } /** * Sets the top value for the request * * @param value the max number of items to return * @return the updated request */ public IWorkbookFunctionsSqrtPiRequest top(final int value) { getQueryOptions().add(new QueryOption("$top", value+"")); return (WorkbookFunctionsSqrtPiRequest)this; } /** * Sets the expand clause for the request * * @param value the expand clause * @return the updated request */ public IWorkbookFunctionsSqrtPiRequest expand(final String value) { getQueryOptions().add(new QueryOption("$expand", value)); return (WorkbookFunctionsSqrtPiRequest)this; } }
[ "caitbal@microsoft.com" ]
caitbal@microsoft.com
842595a5ce586b3bc989006b1a8e432b0d0caedf
f487532281c1c6a36a5c62a29744d8323584891b
/sdk/java/src/main/java/com/pulumi/azure/mssql/inputs/VirtualMachineAutoPatchingArgs.java
a4e0826a444696dc70c24676d4fa832a36ac7ed0
[ "BSD-3-Clause", "MPL-2.0", "Apache-2.0" ]
permissive
pulumi/pulumi-azure
a8f8f21c46c802aecf1397c737662ddcc438a2db
c16962e5c4f5810efec2806b8bb49d0da960d1ea
refs/heads/master
2023-08-25T00:17:05.290397
2023-08-24T06:11:55
2023-08-24T06:11:55
103,183,737
129
57
Apache-2.0
2023-09-13T05:44:10
2017-09-11T20:19:15
Java
UTF-8
Java
false
false
5,812
java
// *** WARNING: this file was generated by pulumi-java-gen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package com.pulumi.azure.mssql.inputs; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.Integer; import java.lang.String; import java.util.Objects; public final class VirtualMachineAutoPatchingArgs extends com.pulumi.resources.ResourceArgs { public static final VirtualMachineAutoPatchingArgs Empty = new VirtualMachineAutoPatchingArgs(); /** * The day of week to apply the patch on. Possible values are `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday` and `Sunday`. * */ @Import(name="dayOfWeek", required=true) private Output<String> dayOfWeek; /** * @return The day of week to apply the patch on. Possible values are `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday` and `Sunday`. * */ public Output<String> dayOfWeek() { return this.dayOfWeek; } /** * The size of the Maintenance Window in minutes. * */ @Import(name="maintenanceWindowDurationInMinutes", required=true) private Output<Integer> maintenanceWindowDurationInMinutes; /** * @return The size of the Maintenance Window in minutes. * */ public Output<Integer> maintenanceWindowDurationInMinutes() { return this.maintenanceWindowDurationInMinutes; } /** * The Hour, in the Virtual Machine Time-Zone when the patching maintenance window should begin. * */ @Import(name="maintenanceWindowStartingHour", required=true) private Output<Integer> maintenanceWindowStartingHour; /** * @return The Hour, in the Virtual Machine Time-Zone when the patching maintenance window should begin. * */ public Output<Integer> maintenanceWindowStartingHour() { return this.maintenanceWindowStartingHour; } private VirtualMachineAutoPatchingArgs() {} private VirtualMachineAutoPatchingArgs(VirtualMachineAutoPatchingArgs $) { this.dayOfWeek = $.dayOfWeek; this.maintenanceWindowDurationInMinutes = $.maintenanceWindowDurationInMinutes; this.maintenanceWindowStartingHour = $.maintenanceWindowStartingHour; } public static Builder builder() { return new Builder(); } public static Builder builder(VirtualMachineAutoPatchingArgs defaults) { return new Builder(defaults); } public static final class Builder { private VirtualMachineAutoPatchingArgs $; public Builder() { $ = new VirtualMachineAutoPatchingArgs(); } public Builder(VirtualMachineAutoPatchingArgs defaults) { $ = new VirtualMachineAutoPatchingArgs(Objects.requireNonNull(defaults)); } /** * @param dayOfWeek The day of week to apply the patch on. Possible values are `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday` and `Sunday`. * * @return builder * */ public Builder dayOfWeek(Output<String> dayOfWeek) { $.dayOfWeek = dayOfWeek; return this; } /** * @param dayOfWeek The day of week to apply the patch on. Possible values are `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday` and `Sunday`. * * @return builder * */ public Builder dayOfWeek(String dayOfWeek) { return dayOfWeek(Output.of(dayOfWeek)); } /** * @param maintenanceWindowDurationInMinutes The size of the Maintenance Window in minutes. * * @return builder * */ public Builder maintenanceWindowDurationInMinutes(Output<Integer> maintenanceWindowDurationInMinutes) { $.maintenanceWindowDurationInMinutes = maintenanceWindowDurationInMinutes; return this; } /** * @param maintenanceWindowDurationInMinutes The size of the Maintenance Window in minutes. * * @return builder * */ public Builder maintenanceWindowDurationInMinutes(Integer maintenanceWindowDurationInMinutes) { return maintenanceWindowDurationInMinutes(Output.of(maintenanceWindowDurationInMinutes)); } /** * @param maintenanceWindowStartingHour The Hour, in the Virtual Machine Time-Zone when the patching maintenance window should begin. * * @return builder * */ public Builder maintenanceWindowStartingHour(Output<Integer> maintenanceWindowStartingHour) { $.maintenanceWindowStartingHour = maintenanceWindowStartingHour; return this; } /** * @param maintenanceWindowStartingHour The Hour, in the Virtual Machine Time-Zone when the patching maintenance window should begin. * * @return builder * */ public Builder maintenanceWindowStartingHour(Integer maintenanceWindowStartingHour) { return maintenanceWindowStartingHour(Output.of(maintenanceWindowStartingHour)); } public VirtualMachineAutoPatchingArgs build() { $.dayOfWeek = Objects.requireNonNull($.dayOfWeek, "expected parameter 'dayOfWeek' to be non-null"); $.maintenanceWindowDurationInMinutes = Objects.requireNonNull($.maintenanceWindowDurationInMinutes, "expected parameter 'maintenanceWindowDurationInMinutes' to be non-null"); $.maintenanceWindowStartingHour = Objects.requireNonNull($.maintenanceWindowStartingHour, "expected parameter 'maintenanceWindowStartingHour' to be non-null"); return $; } } }
[ "noreply@github.com" ]
pulumi.noreply@github.com
31034ac6dedaaa6f3eb7565cc2d15434f1a82d82
a04ee44da0fe1997540fa977806253c20e66d1f7
/app/src/main/java/com/baisidai/mvvmbasic/MainActivity.java
d8aba3f36f4c3141bddd7a100aebaf7edf7ca833
[]
no_license
scYao/MvvmBasic
3dea2d70f701805516aeaf7a62baee75393257eb
5bb2bb89ce6168d704bbde5e527eaf0e12643b0e
refs/heads/master
2020-05-13T19:03:06.590944
2019-04-16T08:51:07
2019-04-16T08:51:07
181,651,539
1
1
null
null
null
null
UTF-8
Java
false
false
1,406
java
package com.baisidai.mvvmbasic; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import com.baisidai.mvvmbasic.adapter.MainAdapter; import com.baisidai.mvvmbasic.base.BaseActivity; import com.baisidai.mvvmbasic.databinding.ActivityMainBinding; import com.baisidai.mvvmbasic.viewmodel.MainViewModel; public class MainActivity extends BaseActivity implements CompletedListener{ private MainViewModel viewModel; private LinearLayoutManager layoutManager; private MainAdapter adapter; private ActivityMainBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_main); initView(); } private void initView() { layoutManager = new LinearLayoutManager(this); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); binding.recyclerView.setLayoutManager(layoutManager); adapter = new MainAdapter(this); binding.recyclerView.setAdapter(adapter); viewModel = new MainViewModel(adapter,this); showWaitDialog();//显示加载动画 viewModel.getList(); } @Override public void onCompleted() { dismissWaitDialog(); } }
[ "858552039@qq.com" ]
858552039@qq.com
0393ee84480fb4527d53f01a1bdb36cab35dcd38
24b14668d624f783ee3a742c7211d7db74b6de44
/mytest/app/src/main/java/com/zs/rebuid/base/ToolbarPresenter.java
0a0b71efa467c5bfb8868da76199fa008b760f49
[]
no_license
songszs/android_comm
0eaff3c7a0151896e9530ee40dc1a3537a25b3de
d27361ec2dcfbef89d0d2ca69af34a2fa221c6b4
refs/heads/master
2021-12-25T05:54:40.812863
2021-08-11T00:22:03
2021-08-11T00:22:03
190,842,909
0
0
null
null
null
null
UTF-8
Java
false
false
727
java
package com.zs.rebuid.base; import com.zs.rebuid.base.contract.IPtrContract; import com.zs.rebuid.base.contract.IToolbarContract; import com.zs.rebuid.base.presenter.base.BasePresenter; /** * @author: zang song * @version: V1.0 * @date: 2020-03-17 19:14 * @email: gnoszsong@gmail.com * @description: description */ public class ToolbarPresenter extends BasePresenter implements IToolbarContract.IPresenter, IPtrContract.IPresenter { @Override public void onCreate() { super.onCreate(); } @Override public void backPress() { } @Override public void menuPress() { } @Override public void refresh() { } @Override public void loadMore() { } }
[ "448683710@qq.com" ]
448683710@qq.com
dd942d95e525d4b3087441b6609bc9785c18624b
fdae7c739bed035b968e914c7e656d2074c4260d
/rongly-springcloud-feign/src/main/java/com/rongly/springcloud/feign/controller/OkHttpClientController.java
d961ca89aec34d2801fd7162e069ca386fd77faa
[]
no_license
angiely1115/rongly-springcloud
3ddf884786bce9a21b1df7e43979b027db3fcdaa
01e2019f6a356dca595c04543667651d7482dfc3
refs/heads/master
2020-04-01T00:40:14.698136
2019-08-03T06:47:08
2019-08-03T06:47:08
152,707,295
3
0
null
null
null
null
UTF-8
Java
false
false
1,184
java
package com.rongly.springcloud.feign.controller; import com.google.common.collect.Maps; import com.rongly.springcloud.feign.config.okhttp.MyOkHttpBuilder; import com.rongly.springcloud.feign.config.okhttp.MyOkHttpClient; import okhttp3.Response; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * @Author: lvrongzhuan * @Description: okhttpclient 测试 * @Date: 2018/10/31 17:09 * @Version: 1.0 * modified by: */ @RestController @RequestMapping("okhttp") public class OkHttpClientController { @Autowired private MyOkHttpClient myOkHttpClient; @GetMapping("get") public Response okHttpGet(@RequestParam(required = false) String name){ Map<String,String> map = Maps.newHashMapWithExpectedSize(3); map.put("name",name); return myOkHttpClient.get(MyOkHttpBuilder.builder().url("http://localhost:7001/hello/hystrix/demo1").params(map).build()); } }
[ "lvrongzhuan@cnhnkj.com" ]
lvrongzhuan@cnhnkj.com
96bb0a9b9b04eb0130398383b4fd12aa61bbc350
72130ff045bebee3131fe5e7ba70b077d2a65925
/odalic/src/main/java/cz/cuni/mff/xrg/odalic/files/formats/package-info.java
8214a6a87c4e455c39c5369e187f920264aa89af
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
odalic/sti
f29dbcd5e0d8633f108146e04d1d8e312d0fe169
580785a88ea9789d87f003eecf818bed93cf4bf4
refs/heads/master
2020-12-26T02:12:06.839462
2017-06-01T22:54:39
2017-06-01T22:54:39
54,390,133
4
0
Apache-2.0
2018-03-07T00:23:16
2016-03-21T13:15:09
Web Ontology Language
UTF-8
Java
false
false
138
java
/** * Parsing and presentation format of the input CSV files and implementing classes. */ package cz.cuni.mff.xrg.odalic.files.formats;
[ "brodecva@gmail.com" ]
brodecva@gmail.com
c2af222ee6d753201d64448ddf71bea32adf6f8e
da46e058a8a9485c6969cf8829cff6bccdb0ad41
/src/com/madbros/adventurecraft/PerlinGenerator.java
ad2f6b6636947f1486f042767b7c34f8f7f9c3bd
[]
no_license
rpmadden08/adventure-craft
f52020a0d37bb770fe0260784c8258c6d4f9c887
9584431ba721811406cefb22ab70ffb0474ff299
refs/heads/master
2020-05-17T01:00:23.628127
2013-08-02T22:52:46
2013-08-02T22:52:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,410
java
package com.madbros.adventurecraft; import java.util.*; public class PerlinGenerator { private int GradientSizeTable = 256; private Random _random; private float[] _gradients = new float[GradientSizeTable * 3]; private int[] _perm = new int[] { 225,155,210,108,175,199,221,144,203,116, 70,213, 69,158, 33,252, 5, 82,173,133,222,139,174, 27, 9, 71, 90,246, 75,130, 91,191, 169,138, 2,151,194,235, 81, 7, 25,113,228,159,205,253,134,142, 248, 65,224,217, 22,121,229, 63, 89,103, 96,104,156, 17,201,129, 36, 8,165,110,237,117,231, 56,132,211,152, 20,181,111,239,218, 170,163, 51,172,157, 47, 80,212,176,250, 87, 49, 99,242,136,189, 162,115, 44, 43,124, 94,150, 16,141,247, 32, 10,198,223,255, 72, 53,131, 84, 57,220,197, 58, 50,208, 11,241, 28, 3,192, 62,202, 18,215,153, 24, 76, 41, 15,179, 39, 46, 55, 6,128,167, 23,188, 106, 34,187,140,164, 73,112,182,244,195,227, 13, 35, 77,196,185, 26,200,226,119, 31,123,168,125,249, 68,183,230,177,135,160,180, 12, 1,243,148,102,166, 38,238,251, 37,240,126, 64, 74,161, 40, 184,149,171,178,101, 66, 29, 59,146, 61,254,107, 42, 86,154, 4, 236,232,120, 21,233,209, 45, 98,193,114, 78, 19,206, 14,118,127, 48, 79,147, 85, 30,207,219, 54, 88,234,190,122, 95, 67,143,109, 137,214,145, 93, 92,100,245, 0,216,186, 60, 83,105, 97,204, 52}; public PerlinGenerator(int seed) { _random = new Random(seed); InitGradients(); } public float Noise(float x, float y, float z) { int ix = (int)Math.floor(x); float fx0 = x - ix; float fx1 = fx0 - 1; float wx = Smooth(fx0); int iy = (int)Math.floor(y); float fy0 = y - iy; float fy1 = fy0 - 1; float wy = Smooth(fy0); int iz = (int)Math.floor(z); float fz0 = z - iz; float fz1 = fz0 - 1; float wz = Smooth(fz0); float vx0 = Lattice(ix, iy, iz, fx0, fy0, fz0); float vx1 = Lattice(ix + 1, iy, iz, fx1, fy0, fz0); float vy0 = Lerp(wx, vx0, vx1); vx0 = Lattice(ix, iy + 1, iz, fx0, fy1, fz0); vx1 = Lattice(ix + 1, iy + 1, iz, fx1, fy1, fz0); float vy1 = Lerp(wx, vx0, vx1); float vz0 = Lerp(wy, vy0, vy1); vx0 = Lattice(ix, iy, iz + 1, fx0, fy0, fz1); vx1 = Lattice(ix + 1, iy, iz + 1, fx1, fy0, fz1); vy0 = Lerp(wx, vx0, vx1); vx0 = Lattice(ix, iy + 1, iz + 1, fx0, fy1, fz1); vx1 = Lattice(ix + 1, iy + 1, iz + 1, fx1, fy1, fz1); vy1 = Lerp(wx, vx0, vx1); float vz1 = Lerp(wy, vy0, vy1); return Lerp(wz, vz0, vz1); } private void InitGradients() { for (int i = 0; i < GradientSizeTable; i++) { float z = 1f - 2f * (float)_random.nextDouble(); float r = (float)Math.sqrt(1f - z * z); float theta = 2 * (float)Math.PI * (float)_random.nextDouble(); _gradients[i * 3] = r * (float)Math.cos(theta); _gradients[i * 3 + 1] = r * (float)Math.sin(theta); _gradients[i * 3 + 2] = z; } } private int Permutate(int x) { int mask = GradientSizeTable - 1; return _perm[x & mask]; } private int Index(int ix, int iy, int iz) { return Permutate(ix + Permutate(iy + Permutate(iz))); } private float Lattice(int ix, int iy, int iz, float fx, float fy, float fz) { int index = Index(ix, iy, iz); int g = index * 3; return _gradients[g] * fx + _gradients[g + 1] * fy + _gradients[g + 2] * fz; } private float Lerp(float t, float value0, float value1) { return value0 + t * (value1 - value0); } private float Smooth(float x) { return x * x * (3 - 2 * x); } }
[ "rpmadden08@gmail.com" ]
rpmadden08@gmail.com
690bdb348759d0082e1c8da29c33d2672a6f86b1
002c0e91226df99e2f1f08c7265609646f18e11e
/OCAPractice/Chapter4/src/p214_lambda_predicates/PredicateSearch.java
7281786661c0ca0f73da80821dd28a095479590b
[]
no_license
L154L1/juansProjects
bff191ef3d2fb1fd9c2a63975067f5d8711651bf
0a1692f9b85e0e2a237bdcbc65d515c5cc2dd84e
refs/heads/master
2020-11-30T23:45:04.092269
2019-12-28T17:20:48
2019-12-28T17:20:48
230,510,327
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
package p214_lambda_predicates; import java.util.*; import java.util.function.*; public class PredicateSearch { public static void main(String[] args) { List<Animal> animals = new ArrayList<>(); animals.add(new Animal("fish", false, true)); animals.add(new Animal("bunny", true, false)); print(animals, a -> a.canHop()); // bunny } private static void print(List<Animal> animals, Predicate<Animal> checker) { for (Animal animal : animals) { if(checker.test(animal)) System.out.print(animal + " "); } System.out.println(); } } class Animal { private String species; private boolean canHop; private boolean canSwim; Animal(String speciesName, boolean hopper, boolean swimmer) { species = speciesName; canHop = hopper; canSwim = swimmer; } public boolean canHop() { return canHop; } public boolean canSwim() { return canSwim; } public String toString() { return species; } }
[ "jfu@gamingnationinc.com" ]
jfu@gamingnationinc.com
a49d432cbb85fa82833cc21000ec5150aa812b79
3c753ab1cad59878e45d773d41db02aab7d72a58
/src/main/java/com/lanou/login/mapper/AdminInfoMapper.java
deba54c3ee3de4b07a0de13f4f9887b2b1203ff5
[]
no_license
dadaxiaozhang/SSMNetCloud
829e3bd7082c53f43e028a923e0997bb94e13bfa
a3b5528ca5def1470ee82cdb66e489df009c033d
refs/heads/master
2021-09-01T13:01:48.211325
2017-12-27T04:40:54
2017-12-27T04:40:54
113,397,647
5
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
package com.lanou.login.mapper; import com.lanou.admin.bean.AdminList; import com.lanou.login.bean.AdminInfo; import com.lanou.bean.ModuleInfo; import com.lanou.role.bean.RoleInfo; import java.util.List; public interface AdminInfoMapper { int insert(AdminInfo record); int insertSelective(AdminInfo record); // 登录时查询账户是否存在并返回用户数据 AdminInfo checkUser(AdminInfo admin); // 通过用户id查询用户权限 List<ModuleInfo> getModule(int adminId); // 更新用户信息 void updateUser(AdminInfo admin); // 根据用户id查询用户信息 AdminInfo getUser(AdminInfo admin); // 修改密码 void updatePwd(AdminInfo admin); // 获取所有管理员信息 List<AdminList> getAdmin(); // 根据账户名获取管理员id Integer getAdminCodebyid(String admin_code); // 根据管理员id删除对应信息 int delAdmin(AdminInfo adminInfo); // 修改管理员信息 void update(AdminInfo adminInfo); // 重置密码 int resetPwd(int adminId); // 高级查询 List<AdminList> getAdminByCondition(RoleInfo roleInfo); }
[ "836042860@qq.com" ]
836042860@qq.com
c26696819261091fda8b96d5456616b31c0bdae3
7dc826e2299d91307c8b8048f478a3ba1a929e7b
/SistemaFinanciero/SistemaFinanciero-web/src/main/java/org/ventura/flow/definition/AperturaCuentacorrienteFlowdefinition.java
1fed38ac8cc295c37a2a7383e0a55b2579450325
[]
no_license
ernestoz1/sistema-financiero
93d5d644e541d389b162794fae8680a59630751c
fdac5ab17985d76a993f485bf14128ea60216446
refs/heads/master
2021-05-28T18:01:27.533634
2014-06-09T13:35:37
2014-06-09T13:35:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,341
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.ventura.flow.definition; import java.io.Serializable; import javax.enterprise.inject.Produces; import javax.faces.flow.Flow; import javax.faces.flow.builder.FlowBuilder; import javax.faces.flow.builder.FlowBuilderParameter; import javax.faces.flow.builder.FlowDefinition; public class AperturaCuentacorrienteFlowdefinition implements Serializable { @Produces @FlowDefinition public Flow defineFlow(@FlowBuilderParameter FlowBuilder flowBuilder) { String flowId = "aperturarCuentacorriente-flow"; flowBuilder.id("", flowId); flowBuilder.viewNode(flowId, "/" + flowId + "/" + flowId + ".xhtml").markAsStartNode(); flowBuilder.returnNode("returnFromAperturarCorrienteFlow").fromOutcome("#{aperturarCuentacorrienteBean.returnValue}"); flowBuilder.flowCallNode("imprimirAperturaCuenta-flow").flowReference("", "imprimirAperturaCuenta-flow") .outboundParameter("tipocuenta", "CUENTA CORRIENTE") .outboundParameter("numerocuenta", "#{aperturarCuentacorrienteBean.cuentacorriente.numerocuentacorriente}") .outboundParameter("moneda", "#{aperturarCuentacorrienteBean.cuentacorriente.tipomoneda.denominacion}") .outboundParameter("fechaapertura", "#{aperturarCuentacorrienteBean.cuentacorriente.fechaapertura}") .outboundParameter("isPersonanatural", "#{aperturarCuentacorrienteBean.personaNatural}") .outboundParameter("isPersonajuridica", "#{aperturarCuentacorrienteBean.personaJuridica}") .outboundParameter("dniPersonanatural", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personanatural.dni}") .outboundParameter("nombrecompletoPersonanatural", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personanatural.nombreCompleto}") .outboundParameter("sexoPersonanatural", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personanatural.sexo.denominacion}") .outboundParameter("fechanacimientoPersonanatural", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personanatural.fechanacimiento}") .outboundParameter("ruc", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personajuridica.ruc}") .outboundParameter("razonsocial", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personajuridica.razonsocial}") .outboundParameter("fechaconstitucion", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personajuridica.fechaconstitucion}") .outboundParameter("dniPersonajuridica", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personajuridica.personanatural.dni}") .outboundParameter("nombrecompletoPersonajuridica", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personajuridica.personanatural.nombreCompleto}") .outboundParameter("fechanacimientoPersonajuridica", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personajuridica.personanatural.fechanacimiento}") .outboundParameter("sexoPersonajuridica", "#{aperturarCuentacorrienteBean.cuentacorriente.socio.personajuridica.personanatural.sexo.denominacion}") .outboundParameter("titulares", "#{aperturarCuentacorrienteBean.cuentacorriente.titularcuentas}") .outboundParameter("beneficiarios", "#{aperturarCuentacorrienteBean.cuentacorriente.beneficiariocuentas}"); return flowBuilder.getFlow(); } }
[ "eA4QU8hx6PE2" ]
eA4QU8hx6PE2
5065c09bffac68eb1f99769030c54608c5aad6b0
06a8bf2d175b7bd3fb40b03c51476ef087265271
/src/test/java/AllTests.java
74135e51fdd0ba9f816eda7a21705b9caf05fdb3
[ "MIT" ]
permissive
bugtamer/WorkerApp2
00d42ed5fbef5824811340724d3cfe972dbe1d82
cda6218ef825e5115613e182fc882c5232215f49
refs/heads/master
2020-03-18T12:59:54.047662
2018-07-28T23:29:36
2018-07-28T23:29:36
134,755,025
1
0
null
null
null
null
UTF-8
Java
false
false
878
java
import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import com.worker.db.DDBBLoginTest; import com.worker.db.DDBBTest; import com.worker.models.ManitasTest; import com.worker.models.UbicacionTest; import com.worker.persistence.UsuarioEMTest; import com.worker.persistence.dao.AllDaoTests; import com.worker.util.HaversineTest; import com.worker.util.database.DataParserTest; import com.worker.util.database.DataRetrieverTest; @RunWith(Suite.class) @SuiteClasses({ HaversineTest.class, DataParserTest.class, DataRetrieverTest.class, DDBBLoginTest.class, DDBBTest.class, ManitasTest.class, UbicacionTest.class, UbicacionTest.class, // MensajeEMTest.class, // REQUIERE: hibernate.cfg.xml de test (hibernate.cfg.xml.test) para el ContextMoking UsuarioEMTest.class, AllDaoTests.class }) public class AllTests { }
[ "javrm357@gmail.com" ]
javrm357@gmail.com
021488fa50c6376049f196246b6f1cfc66b7e81f
5b5f90c99f66587cea981a640063a54b6ea75185
/src/main/java/com/coxandkings/travel/operations/service/whitelabel/WhiteLabelTemplateService.java
eb57dd7d8a6e46f7242374ca0ed348f582344499
[]
no_license
suyash-capiot/operations
02558d5f4c72a895d4a7e7e743495a118b953e97
b6ad01cbdd60190e3be1f2a12d94258091fec934
refs/heads/master
2020-04-02T06:22:30.589898
2018-10-26T12:11:11
2018-10-26T12:11:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
518
java
package com.coxandkings.travel.operations.service.whitelabel; import com.coxandkings.travel.operations.exceptions.OperationException; import com.coxandkings.travel.operations.model.whitelabel.WhiteLabel; import com.coxandkings.travel.operations.resource.whitelabel.WhiteLabelTemplateResource; import org.springframework.stereotype.Service; @Service public interface WhiteLabelTemplateService { WhiteLabel saveWhiteLabelTemplate(WhiteLabelTemplateResource whiteLabelTemplateResource) throws OperationException; }
[ "sahil@capiot.com" ]
sahil@capiot.com
5565a0120f405e87e14f7c94d5f5c6a86b2cd493
6fe7198bfe1318a834f2f2ec239b68d9ef4601e3
/distribution/src/main/java/com/core/model/WxOrderAddress.java
e40ca46d39e107e93930c3e21a566868634d6926
[]
no_license
Core83/Distribution
43ab1eb7f14253b8c23d23032a72e9f00f22096d
0b740c828f6bb09399eb7cee6e6a74e6f26aa2af
refs/heads/master
2021-01-10T17:39:10.924888
2015-11-29T03:18:53
2015-11-29T03:18:55
45,100,609
0
0
null
null
null
null
UTF-8
Java
false
false
6,021
java
package com.core.model; import org.springframework.stereotype.Repository; public class WxOrderAddress { public WxOrderAddress() { } /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.user_id * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private Integer userId; public void setUserId(Integer userId) { this.userId = userId; } public void setOrderId(Long orderId) { this.orderId = orderId; } public void setProvince(String province) { this.province = province; } public void setCity(String city) { this.city = city; } public void setCounty(String county) { this.county = county; } public void setAddress(String address) { this.address = address; } public void setReceiver(String receiver) { this.receiver = receiver; } public void setMobilePhone(String mobilePhone) { this.mobilePhone = mobilePhone; } /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.order_id * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private Long orderId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.province * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private String province; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.city * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private String city; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.county * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private String county; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.address * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private String address; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.receiver * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private String receiver; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column wx_order_address.mobile_phone * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ private String mobilePhone; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table wx_order_address * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public WxOrderAddress(Integer userId, Long orderId, String province, String city, String county, String address, String receiver, String mobilePhone) { this.userId = userId; this.orderId = orderId; this.province = province; this.city = city; this.county = county; this.address = address; this.receiver = receiver; this.mobilePhone = mobilePhone; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.user_id * * @return the value of wx_order_address.user_id * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public Integer getUserId() { return userId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.order_id * * @return the value of wx_order_address.order_id * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public Long getOrderId() { return orderId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.province * * @return the value of wx_order_address.province * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public String getProvince() { return province; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.city * * @return the value of wx_order_address.city * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public String getCity() { return city; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.county * * @return the value of wx_order_address.county * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public String getCounty() { return county; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.address * * @return the value of wx_order_address.address * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public String getAddress() { return address; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.receiver * * @return the value of wx_order_address.receiver * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public String getReceiver() { return receiver; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wx_order_address.mobile_phone * * @return the value of wx_order_address.mobile_phone * * @mbggenerated Tue Nov 03 21:32:31 CST 2015 */ public String getMobilePhone() { return mobilePhone; } }
[ "18267727801@163.com" ]
18267727801@163.com
5e9b189421a48822aa7a41e26eee6c31bb701d14
432ed306387288d9bd4055268b1261aa1789dd41
/junit4/src/test/java/org/jboss/weld/junit4/interceptor/MockInterceptorTest.java
5d401fa8603f6a11b8f4dc68f030ed5a3f4b8517
[ "Apache-2.0" ]
permissive
philippkunz/weld-junit
e2c1c1ff2a6a624c683befb0adbd3b77d09b9025
4160f466d7a5cba132b084800c574534009768de
refs/heads/master
2023-02-09T22:43:29.593846
2020-11-18T14:23:05
2020-11-19T10:47:31
270,218,631
0
0
Apache-2.0
2020-06-07T06:42:37
2020-06-07T06:42:37
null
UTF-8
Java
false
false
3,745
java
/* * JBoss, Home of Professional Open Source * Copyright 2018, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * 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.jboss.weld.junit4.interceptor; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.util.ArrayList; import java.util.List; import javax.enterprise.inject.spi.InterceptionType; import javax.enterprise.inject.spi.Interceptor; import javax.enterprise.util.AnnotationLiteral; import javax.interceptor.InterceptorBinding; import org.jboss.weld.junit.MockInterceptor; import org.jboss.weld.junit4.WeldInitiator; import org.junit.Before; import org.junit.Rule; import org.junit.Test; public class MockInterceptorTest { private List<String> aroundInvokes; private List<String> postConstructs; @Rule public WeldInitiator weld = WeldInitiator.from(Foo.class).addBeans( MockInterceptor.withBindings(FooBinding.Literal.INSTANCE).aroundInvoke((ctx, b) -> { aroundInvokes.add(b.getBeanClass().getName()); return ctx.proceed(); }), // This interceptor is disabled MockInterceptor.withBindings(FooBinding.Literal.INSTANCE).beanClass(String.class).aroundInvoke((ctx, b) -> { return false; }), MockInterceptor.withBindings(FooBinding.Literal.INSTANCE).postConstruct((ctx, b) -> postConstructs.add(b.getBeanClass().getName()))).build(); @Before public void setup() { aroundInvokes = new ArrayList<>(); postConstructs = new ArrayList<>(); } @Test public void testInterception() { assertTrue(aroundInvokes.isEmpty()); assertTrue(postConstructs.isEmpty()); assertTrue(weld.select(Foo.class).get().ping()); assertEquals(1, aroundInvokes.size()); assertEquals(Foo.class.getName(), aroundInvokes.get(0)); assertEquals(1, postConstructs.size()); assertEquals(Foo.class.getName(), postConstructs.get(0)); } @Test public void testDisabledInterceptor() { List<Interceptor<?>> interceptors = weld.getBeanManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, FooBinding.Literal.INSTANCE); assertEquals(1, interceptors.size()); assertEquals(MockInterceptor.class, interceptors.get(0).getBeanClass()); } @FooBinding static class Foo { boolean ping() { return true; } } @Target({ TYPE, METHOD }) @Retention(RUNTIME) @Documented @InterceptorBinding static @interface FooBinding { @SuppressWarnings("serial") static final class Literal extends AnnotationLiteral<FooBinding> implements FooBinding { public static final Literal INSTANCE = new Literal(); }; } }
[ "mkouba@redhat.com" ]
mkouba@redhat.com
8cb3a161a26a29d17d614584bd2949038abecbb6
463590cef27381578f6731ff39249c6583edfc37
/src/main/java/com/awabcodes/mystation/web/rest/AuditResource.java
3bd1630fd816865b0dcc19792411e4b33c9805d2
[]
no_license
awabcodes/my-station-backend
bd2f5e9dc65f4ab242f2d710c44902a016987dba
e7651073dbd2aee3d5823c7f08db1320bc24f9f7
refs/heads/master
2022-12-22T01:15:49.797401
2020-01-19T19:09:54
2020-01-19T19:09:54
234,940,315
0
0
null
2022-12-16T04:42:39
2020-01-19T17:48:53
Java
UTF-8
Java
false
false
3,322
java
package com.awabcodes.mystation.web.rest; import com.awabcodes.mystation.service.AuditEventService; import io.github.jhipster.web.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; import org.springframework.boot.actuate.audit.AuditEvent; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; import java.util.List; /** * REST controller for getting the {@link AuditEvent}s. */ @RestController @RequestMapping("/management/audits") public class AuditResource { private final AuditEventService auditEventService; public AuditResource(AuditEventService auditEventService) { this.auditEventService = auditEventService; } /** * {@code GET /audits} : get a page of {@link AuditEvent}s. * * @param pageable the pagination information. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of {@link AuditEvent}s in body. */ @GetMapping public ResponseEntity<List<AuditEvent>> getAll(Pageable pageable) { Page<AuditEvent> page = auditEventService.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * {@code GET /audits} : get a page of {@link AuditEvent} between the {@code fromDate} and {@code toDate}. * * @param fromDate the start of the time period of {@link AuditEvent} to get. * @param toDate the end of the time period of {@link AuditEvent} to get. * @param pageable the pagination information. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of {@link AuditEvent} in body. */ @GetMapping(params = {"fromDate", "toDate"}) public ResponseEntity<List<AuditEvent>> getByDates( @RequestParam(value = "fromDate") LocalDate fromDate, @RequestParam(value = "toDate") LocalDate toDate, Pageable pageable) { Instant from = fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant(); Instant to = toDate.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant(); Page<AuditEvent> page = auditEventService.findByDates(from, to, pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * {@code GET /audits/:id} : get an {@link AuditEvent} by id. * * @param id the id of the entity to get. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the {@link AuditEvent} in body, or status {@code 404 (Not Found)}. */ @GetMapping("/{id:.+}") public ResponseEntity<AuditEvent> get(@PathVariable Long id) { return ResponseUtil.wrapOrNotFound(auditEventService.find(id)); } }
[ "awabcodes@gmail.com" ]
awabcodes@gmail.com
5337e2d9c82766ac6b1470113f93bf58d56bf507
1d95fa1b8bbe562f92e9a955e3bc088161c89164
/src/client/controller/CacnellationReport.java
06fc842e316646543c55c35a8842eb9fd15b8437
[]
no_license
GadyEilat/MiniProject
10d96bd9e148c24d508720497463a84ba90e25e5
8f3909a4a14af49f80e978855e7dd4eb831dba82
refs/heads/main
2023-03-15T12:35:52.013440
2021-01-15T12:37:47
2021-01-15T12:37:47
511,856,279
0
1
null
2022-07-08T10:32:35
2022-07-08T10:32:34
null
UTF-8
Java
false
false
5,118
java
package client.controller; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.net.URL; import java.time.LocalDate; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import client.ChatClient; import javafx.scene.SnapshotParameters; import javafx.scene.chart.BarChart; import javafx.scene.chart.CategoryAxis; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; import javafx.stage.Stage; import javafx.stage.Window; import javafx.application.Application; import javafx.application.Platform; import javafx.embed.swing.SwingFXUtils; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.geometry.Side; import javafx.print.PageLayout; import javafx.print.PageRange; import javafx.print.PrinterJob; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.image.WritableImage; import javafx.scene.text.Text; import javafx.scene.transform.Scale; public class CacnellationReport implements Initializable { @FXML private Text reportName; @FXML private Text monthText; @FXML private CategoryAxis xAxis; @FXML private NumberAxis yAxis; @FXML private BarChart<String, Number> barCancelation; @FXML private Button printReport; final static String Regular_Traveler = "Regular Traveler"; final static String Family_subscription = "Family subscription"; final static String Group = "Group"; int regularNumCancel; int subNumCancel; int guideNumCancel; int regularNumNotArrived; int subNumNotArrived; int guideNumNotArrived; public static void printCurrWindow(Window myWindow) { print(myWindow, myWindow.getScene().getRoot().snapshot(null, null)); } @FXML void printCancelReport(ActionEvent event) { printCurrWindow(printReport.getScene().getWindow()); } private static void print(Window myWindow, WritableImage screenshot) { PrinterJob job = PrinterJob.createPrinterJob(); if (job != null) { job.getJobSettings().setPageRanges(new PageRange(1, 1)); if (!job.showPageSetupDialog(myWindow) || !job.showPrintDialog(myWindow)) { return; } final PageLayout pageLayout = job.getJobSettings().getPageLayout(); final double sizeX = pageLayout.getPrintableWidth() / screenshot.getWidth(); final double sizeY = pageLayout.getPrintableHeight() / screenshot.getHeight(); final double size = Math.min(sizeX, sizeY); final ImageView print_node = new ImageView(screenshot); print_node.getTransforms().add(new Scale(size, size)); job.printPage(print_node); job.endJob(); } } @SuppressWarnings({ "rawtypes", "unchecked" }) public void initialize(URL location, ResourceBundle resources) { reportName.setText("Cacnellation Report"); monthText.setText(LocalDate.now().withDayOfMonth(1) + " To " + LocalDate.now().minusDays(1)); if (ChatClient.reportsData.getRegularCancel() != null) { regularNumCancel = Integer.valueOf(ChatClient.reportsData.getRegularCancel()); } else { regularNumCancel = 0; } if (ChatClient.reportsData.getSubCancel() != null) { subNumCancel = Integer.valueOf(ChatClient.reportsData.getSubCancel()); } else { subNumCancel = 0; } if (ChatClient.reportsData.getGuideCancel() != null) { guideNumCancel = Integer.valueOf(ChatClient.reportsData.getGuideCancel()); } else { guideNumCancel = 0; } if (ChatClient.reportsData.getRegularnotArrived() != null) { regularNumNotArrived = Integer.valueOf(ChatClient.reportsData.getRegularnotArrived()); } else { regularNumNotArrived = 0; } if (ChatClient.reportsData.getSubnotArrived() != null) { subNumNotArrived = Integer.valueOf(ChatClient.reportsData.getSubnotArrived()); } else { subNumNotArrived = 0; } if (ChatClient.reportsData.getGuidenotArrived() != null) { guideNumNotArrived = Integer.valueOf(ChatClient.reportsData.getGuidenotArrived()); } else { guideNumNotArrived = 0; } barCancelation.setTitle("Cacnellation Report"); xAxis.setLabel("Traveler kind"); yAxis.setLabel("Number of visitors"); XYChart.Series Canceld = new XYChart.Series<>(); Canceld.setName("Canceled"); Canceld.getData().add(new XYChart.Data(Regular_Traveler, regularNumCancel)); Canceld.getData().add(new XYChart.Data(Family_subscription, subNumCancel)); Canceld.getData().add(new XYChart.Data(Group, guideNumCancel)); // XYChart.Series approvedAndNotArrived = new XYChart.Series(); approvedAndNotArrived.setName("Not Arrived"); approvedAndNotArrived.getData().add(new XYChart.Data(Regular_Traveler, regularNumNotArrived)); approvedAndNotArrived.getData().add(new XYChart.Data(Family_subscription, subNumNotArrived)); approvedAndNotArrived.getData().add(new XYChart.Data(Family_subscription, guideNumNotArrived)); barCancelation.getData().addAll(Canceld, approvedAndNotArrived); } }
[ "58631201+liranami@users.noreply.github.com" ]
58631201+liranami@users.noreply.github.com
b0c1e1bf0bf0a557f6d22d845b83ef9f894b6a99
69b85b6bb486b0d1620f4ab832e56337ea561555
/BookingOfficeProject/src/main/java/com/bionic/edu/services/FlightServiceImpl.java
ddb9cf015aa4fd03cf9173361e8d8e71a88cf1f1
[]
no_license
mexess/mxs
0b1a80b37ac28932c75341ed2dc90b30d8438fe2
2be6dbf8f8ce6e65f34b0fc6f680fb8d58036506
refs/heads/master
2020-05-18T13:19:56.029483
2015-07-07T17:31:57
2015-07-07T17:31:57
38,701,850
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package com.bionic.edu.services; import java.util.List; import javax.inject.Inject; import javax.inject.Named; import org.springframework.transaction.annotation.Transactional; import com.bionic.edu.dao.FlightDao; import com.bionic.edu.entities.Flight; @Named public class FlightServiceImpl implements FlightService { @Inject private FlightDao flightDao; public Flight findById(int id) { return flightDao.findById(id); } @Transactional public void save(Flight flight) { flightDao.save(flight); } @Transactional public void remove(int id) { Flight flight = findById(id); if (flight != null) { flightDao.remove(id); } } @Override public List<Flight> findByDest(String dest) { return flightDao.findByDest(dest); } @Override public List<String> getDepCities() { return flightDao.getDepCities(); } @Override public List<String> getDestCities() { return flightDao.getDestCities(); } }
[ "mexes14@ukr.net" ]
mexes14@ukr.net
1957aa69d42ae49ef64ca291dd78e03873f683c6
002c314cec41b98a1a256c7221f7cb05833aa507
/src/main/java/dev/rfj/blog/blogposts/retriever/FileBlogPostParser.java
dee0ea5ffa1afe10cd153d8261e8f81cb04b03b2
[]
no_license
RFJBraunstingl/rfj-blog
6081b7a19ce8fd522bde7113db39a95b4dcd386d
2b87531f45d285e10f9baf0dc80e1a86916b9da9
refs/heads/master
2021-01-04T12:38:47.338265
2020-04-13T16:32:05
2020-04-13T16:32:05
240,553,881
0
0
null
null
null
null
UTF-8
Java
false
false
1,522
java
package dev.rfj.blog.blogposts.retriever; import dev.rfj.blog.adapter.markdown.MarkdownHtmlConversionAdapter; import dev.rfj.blog.model.BlogPost; import dev.rfj.blog.util.StreamUtils; import lombok.NoArgsConstructor; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import java.io.*; @ApplicationScoped @NoArgsConstructor class FileBlogPostParser { private MarkdownHtmlConversionAdapter markdownHtmlConverter; @Inject FileBlogPostParser(MarkdownHtmlConversionAdapter markdownHtmlConverter) { this.markdownHtmlConverter = markdownHtmlConverter; } public BlogPost parseFile(File file) { try (InputStream fileInputStream = new FileInputStream(file)) { String fileName = file.getName(); String fileContent = StreamUtils.readStream(fileInputStream); String fileContentAsHtml = markdownHtmlConverter.convertMarkdownToHtml(fileContent); return BlogPost.builder() .name(fileName) // TODO change the description as soon as adding meta data support! .description(fileContentAsHtml) .text(fileContentAsHtml) .build(); } catch (FileNotFoundException e) { throw new IllegalStateException("Could not read the file to be parsed, this should not happen!"); } catch (IOException e) { throw new IllegalStateException("Error reading the given blog post file!"); } } }
[ "rfj.braunstingl@gmail.com" ]
rfj.braunstingl@gmail.com
b21fbc8bbe87579b3dc4942f0c6d2adc364ae72c
4a20f5f7b7e7b4cec454ea4c76e8fc4ba5c2509e
/maven/src/org/netbeans/modules/maven/problems/JavaPlatformProblemProvider.java
e06b3ca932f4a19b1b26ae90a347863d46491918
[]
no_license
emilianbold/main-silver
fea82811ef5b63b5593ef2a441c7934a99de4d5e
57e1ce4fedba4deb6ec779c802d38a5432e2d76e
refs/heads/master
2021-08-03T08:09:02.254662
2016-12-26T03:43:09
2016-12-26T03:43:09
75,871,292
1
4
null
2017-01-14T07:55:59
2016-12-07T20:04:37
null
UTF-8
Java
false
false
8,455
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2013 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, 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-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * If you wish your version of this file to be governed by only the CDDL * or only the GPL Version 2, indicate your decision by adding * "[Contributor] elects to include this software in this distribution * under the [CDDL or GPL Version 2] license." If you do not indicate a * single choice of license, a recipient has the option to distribute * your version of this file under either the CDDL, the GPL Version 2 or * to extend the choice of license to its licensees as provided above. * However, if you add GPL Version 2 code and therefore, elected the GPL * Version 2 license, then the option applies only if the new code is * made subject to such option by the copyright holder. * * Contributor(s): * * Portions Copyrighted 2013 Sun Microsystems, Inc. */ package org.netbeans.modules.maven.problems; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import javax.swing.SwingUtilities; import org.netbeans.api.annotations.common.NonNull; import org.netbeans.api.java.platform.JavaPlatform; import org.netbeans.api.java.platform.JavaPlatformManager; import org.netbeans.api.java.platform.PlatformsCustomizer; import org.netbeans.api.project.Project; import org.netbeans.modules.maven.api.Constants; import org.netbeans.modules.maven.api.NbMavenProject; import org.netbeans.modules.maven.classpath.BootClassPathImpl; import org.netbeans.spi.project.AuxiliaryProperties; import org.netbeans.spi.project.ProjectServiceProvider; import org.netbeans.spi.project.ui.ProjectProblemResolver; import org.netbeans.spi.project.ui.ProjectProblemsProvider; import org.netbeans.spi.project.ui.support.ProjectProblemsProviderSupport; import org.openide.util.NbBundle; import org.openide.util.Parameters; import org.openide.util.WeakListeners; import static org.netbeans.modules.maven.problems.Bundle.*; /** * * @author mkleint */ @ProjectServiceProvider(service=ProjectProblemsProvider.class, projectType="org-netbeans-modules-maven") public class JavaPlatformProblemProvider implements ProjectProblemsProvider { private final ProjectProblemsProviderSupport support; private final Project project; private final PropertyChangeListener pchListener; private final PropertyChangeListener pchJavaPlatformListener; private JavaPlatformManager platformManager; public JavaPlatformProblemProvider(Project project) { support = new ProjectProblemsProviderSupport(this); this.project = project; this.pchListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (NbMavenProject.PROP_PROJECT.equals(evt.getPropertyName())) { support.fireProblemsChange(); //always fire or first calculate and then fire? } } }; this.pchJavaPlatformListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { support.fireProblemsChange(); } }; } @Override public void addPropertyChangeListener(PropertyChangeListener listener) { support.addPropertyChangeListener(listener); } @Override public void removePropertyChangeListener(PropertyChangeListener listener) { support.removePropertyChangeListener(listener); } @Override @NbBundle.Messages({ "# {0} - jdk platform id", "MGS_No_such_JDK=No such Java Platform: {0}", "# {0} - jdk platform id", "DESC_No_such_JDK=There is no Java Platform with value \"{0}\" defined in the current IDE. The default platform is used instead. To fix, introduce a Java Platform with the given name or change the project's used Java Platform."}) public Collection<? extends ProjectProblem> getProblems() { if (platformManager == null) { platformManager = JavaPlatformManager.getDefault(); platformManager.addPropertyChangeListener(WeakListeners.propertyChange(pchJavaPlatformListener, platformManager)); NbMavenProject watch = project.getLookup().lookup(NbMavenProject.class); watch.addPropertyChangeListener(pchListener); } return support.getProblems(new ProjectProblemsProviderSupport.ProblemsCollector() { @Override public Collection<? extends ProjectProblem> collectProblems() { List<ProjectProblem> toRet = new ArrayList<ProjectProblem>(); String val = project.getLookup().lookup(AuxiliaryProperties.class).get(Constants.HINT_JDK_PLATFORM, true); if (val != null) { JavaPlatform plat = BootClassPathImpl.getActivePlatform(val); if (plat == null) { //we have a problem. toRet.add(ProjectProblemsProvider.ProjectProblem.createWarning(MGS_No_such_JDK(val), DESC_No_such_JDK(val), new ProjectProblemResolver() { @Override public Future<Result> resolve() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { PlatformsCustomizer.showCustomizer(null); } }); return new Done(ProjectProblemsProvider.Result.create(Status.UNRESOLVED)); } })); } } return toRet; } }); } private static final class Done implements Future<ProjectProblemsProvider.Result> { private final ProjectProblemsProvider.Result result; Done(@NonNull final ProjectProblemsProvider.Result result) { Parameters.notNull("result", result); //NOI18N this.result = result; } @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } @Override public boolean isCancelled() { return false; } @Override public boolean isDone() { return true; } @Override public ProjectProblemsProvider.Result get() throws InterruptedException, ExecutionException { return result; } @Override public ProjectProblemsProvider.Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return get(); } } }
[ "mkleint@netbeans.org" ]
mkleint@netbeans.org
90b94f0e7249a6345019819cf71095ea78e3f741
2d96713e7742dc65b07d5273e78247db1c2d2f1d
/src/main/java/ru/otus/springshelldemo/SpringShellDemoApplication.java
ff6f60bbaf8c505526c5727d1e77410abfd4f229
[]
no_license
a-trusov/spring-shell
672521c5b75e7b5018083ea893bb461fa7948066
7db68639dcb2a0e6dd04b49ef24d446e6fe4ee08
refs/heads/master
2020-12-13T01:56:49.100353
2020-01-16T09:39:45
2020-01-16T09:39:45
234,282,627
0
0
null
2020-01-16T09:25:26
2020-01-16T09:25:24
null
UTF-8
Java
false
false
334
java
package ru.otus.springshelldemo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringShellDemoApplication { public static void main(String[] args) { SpringApplication.run(SpringShellDemoApplication.class, args); } }
[ "ydvorzhetskiy@navicons.ru" ]
ydvorzhetskiy@navicons.ru
5c93860e1bcd4efcd9b2344051275dc49515507b
7eecef9e67ac192503b049fced4ca2c59b5767f6
/src/main/java/com/ringcentral/definitions/ExtensionPresenceEvent.java
d59985c051ea98e120a8e794d904130a3267ee8c
[]
no_license
PacoVu/ringcentral-java
985edecd37a92751a5f3206b7a045d9a99a63980
df6833104538fc75757a41a3542c3263cf421d28
refs/heads/master
2020-05-29T12:56:18.438431
2019-05-30T14:42:02
2019-05-30T14:42:02
140,632,299
0
0
null
2018-07-11T22:08:32
2018-07-11T22:08:31
null
UTF-8
Java
false
false
2,382
java
package com.ringcentral.definitions; import com.alibaba.fastjson.annotation.JSONField; public class ExtensionPresenceEvent { // Internal identifier of an extension. Optional parameter public String extensionId; public ExtensionPresenceEvent extensionId(String extensionId) { this.extensionId = extensionId; return this; } // Telephony presence status. Returned if telephony status is changed. public String telephonyStatus; public ExtensionPresenceEvent telephonyStatus(String telephonyStatus) { this.telephonyStatus = telephonyStatus; return this; } // Order number of a notification to state the chronology public Long sequence; public ExtensionPresenceEvent sequence(Long sequence) { this.sequence = sequence; return this; } // Aggregated presence status, calculated from a number of sources public String presenceStatus; public ExtensionPresenceEvent presenceStatus(String presenceStatus) { this.presenceStatus = presenceStatus; return this; } // User-defined presence status (as previously published by the user) public String userStatus; public ExtensionPresenceEvent userStatus(String userStatus) { this.userStatus = userStatus; return this; } // Extended DnD (Do not Disturb) status public String dndStatus; public ExtensionPresenceEvent dndStatus(String dndStatus) { this.dndStatus = dndStatus; return this; } // If 'True' enables other extensions to see the extension presence status public Boolean allowSeeMyPresence; public ExtensionPresenceEvent allowSeeMyPresence(Boolean allowSeeMyPresence) { this.allowSeeMyPresence = allowSeeMyPresence; return this; } // If 'True' enables to ring extension phone, if any user monitored by this extension is ringing public Boolean ringOnMonitoredCall; public ExtensionPresenceEvent ringOnMonitoredCall(Boolean ringOnMonitoredCall) { this.ringOnMonitoredCall = ringOnMonitoredCall; return this; } // If 'True' enables the extension user to pick up a monitored line on hold public Boolean pickUpCallsOnHold; public ExtensionPresenceEvent pickUpCallsOnHold(Boolean pickUpCallsOnHold) { this.pickUpCallsOnHold = pickUpCallsOnHold; return this; } }
[ "tyler4long@gmail.com" ]
tyler4long@gmail.com
a4539204995fcd3f3a6208a498d3700766e9f22d
a838defc5d85c4ee4d458b1e4e145dce30a90d94
/app/src/main/java/com/example/abdullahil/assemblyproblemsandsolution/MainActivity.java
478e55ccc48f4c9105152ea3beed79506e84558b
[]
no_license
BakiAdol/Assembly-Problems-and-Solution
bff1e2dd6b6dd876b40a65b894eccd73984a22da
dfb10cc1baac72efe2e7a13cdee128fab22b5852
refs/heads/master
2020-06-25T22:27:10.013901
2019-07-29T11:58:14
2019-07-29T11:58:14
199,439,886
0
1
null
null
null
null
UTF-8
Java
false
false
859
java
package com.example.abdullahil.assemblyproblemsandsolution; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView go_problem_acti_btn = findViewById(R.id.problems_activity_go_btn); go_problem_acti_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, Problems.class)); } }); } }
[ "bakiadol89@gmail.com" ]
bakiadol89@gmail.com