blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
81d7bde36d0ba05b27f94b977b49c7e5280057c5
34d85e5e98bd95843994743af79467acea947fca
/src/geometries/Geometry.java
c5df3d0df5315f2b9641b6ecfe3efb4c35c6b72f
[]
no_license
DavidWeiss2/Java-rayTrace
a2b914214ad326d4bf7f925e49dc72aeeaa5bf73
9895252e1edc43393d1dd205781ac97e72c32974
refs/heads/master
2022-10-16T22:50:58.522328
2020-06-18T06:31:30
2020-06-18T06:31:30
272,812,202
1
0
null
null
null
null
UTF-8
Java
false
false
416
java
package geometries; import primitives.Point3D; import primitives.Vector; /** * Interface to get the basic functionality of any Geometric object. * * @author david weiss */ public interface Geometry { /** * getNotmal of a geometry object to the point provided * * @param point3D point to calculate the normal from * @return normal vector */ Vector getNormal(Point3D point3D); }
5a40c8e9a8bdcfdce13f0b8fe31779e4e0eda98b
de9cecdf643a573cc809a9ebf85cae7cd64f4a5a
/design/src/main/java/com/yiyun/_1_strategy/FlyBehavior.java
293cea088ef04f132fb6eb2988408723540ac0da
[]
no_license
yi-yun/JavaExercise
f91504219319f7ae2ea79a5e79d94da5b0e72e90
ad63edb47c2cd22f4f902fc51644df5501f65552
refs/heads/master
2021-06-27T22:25:10.995097
2019-10-15T15:24:23
2019-10-15T15:24:23
167,016,851
0
0
null
2021-06-07T18:22:24
2019-01-22T15:23:39
Java
UTF-8
Java
false
false
352
java
package com.yiyun._1_strategy; public interface FlyBehavior { void fly(); } class FlyWithWings implements FlyBehavior{ @Override public void fly() { System.out.println("合翅膀一起飞"); } } class FlyNoway implements FlyBehavior{ @Override public void fly() { System.out.println("不会飞..."); } }
7c0c1c026182d083bd0489d47611c5790cc1e44a
1b5987a7e72a58e12ac36a36a60aa6add2661095
/code/org/processmining/analysis/epc/epcmetrics/ControlFlow.java
92850cf53c8f9f24b96070b0818ac5d4b95a59d1
[]
no_license
qianc62/BePT
f4b1da467ee52e714c9a9cc2fb33cd2c75bdb5db
38fb5cc5521223ba07402c7bb5909b17967cfad8
refs/heads/master
2021-07-11T16:25:25.879525
2020-09-22T10:50:51
2020-09-22T10:50:51
201,562,390
36
0
null
null
null
null
UTF-8
Java
false
false
3,440
java
/* * The Complexity formula implemented * on this class was proposed by Jorge Cardoso * on his paper "How to Measure the Control-flow Complexity of Web Processes and Workflows" . * http://dme.uma.pt/jcardoso/Research/Papers/Control-flow Complexity-WorkflowHandbook.pdf * */ package org.processmining.analysis.epc.epcmetrics; import org.processmining.framework.models.epcpack.ConfigurableEPC; import org.processmining.framework.models.epcpack.EPCConnector; import org.processmining.framework.models.epcpack.EPCObject; import org.processmining.framework.ui.Message; public class ControlFlow implements ICalculator { private final static String TYPE = "Control-Flow"; private final static String NAME = "Control-Flow"; private ConfigurableEPC epc; public ControlFlow(ConfigurableEPC aEpc) { epc = aEpc; } public String Calculate() { Message.add("\t<CFC>", Message.TEST); int i = epc.getConnectors().size(); int result = 0; for (int count = 0; count < i; count++) { if (epc.getConnectors().get(count).toString().endsWith("join")) { continue; } if (epc.getConnectors().get(count).toString().startsWith("XOR")) { EPCObject epcObj = (EPCObject) epc.getConnectors().get(count); result = result + fanout(epcObj); Message.add("\t\t<XORConnector " + "name=\"" + ((EPCConnector) epc.getConnectors().get(count)) .toString() + "\" " + "value=\"" + fanout(epcObj) + "\"/>", Message.TEST); } else if (epc.getConnectors().get(count).toString().startsWith( "OR")) { EPCObject epcObj = (EPCObject) epc.getConnectors().get(count); int temp = power(2, fanout(epcObj)) - 1; result = result + temp; Message.add("\t\t<ORConnector " + "name=\"" + ((EPCConnector) epc.getConnectors().get(count)) .toString() + "\" " + "value=\"" + temp + "\"/>", Message.TEST); } else if (epc.getConnectors().get(count).toString().startsWith( "AND")) { ++result; Message.add("\t\t<ANDConnector " + "name=\"" + ((EPCConnector) epc.getConnectors().get(count)) .toString() + "\" " + "value=\"" + 1 + "\"/>", Message.TEST); } } String output = "" + result; Message.add("\t\t<TotalCFC value=\"" + output + "\">", Message.TEST); Message.add("\t</CFC>", Message.TEST); return output; } private int fanout(EPCObject aEpcObj) { return aEpcObj.getSuccessors().size(); } private int power(int base, int expoente) { int resultado = 1; for (int i = 0; i < expoente; i++) { resultado = resultado * base; } return resultado; } /* * The basic requirements for this metric: At least one connector,one * function and one */ public String VerifyBasicRequirements() { if (epc.getConnectors().size() == 0) { return "The metric cannot be applied to this EPC because it does not have any connector, maybe it is not designed properly"; } else { if (epc.getFunctions().size() == 0) { return "The EPC does not contain any function, it is not designed properly!"; } else { if (epc.getEvents().size() < 2) { return "The EPC does not contain at least 2 events, it is not designed properly!"; } else { if (epc.getEdges().size() < 2) { return "The EPC does not contain at least 2 edges, it is not designed properly!"; } } } } return "."; } public String getType() { return this.TYPE; } public String getName() { return this.NAME; } }
2efc995316fab3045d626d071aeadc5abefc1a53
cb177f7f892bd059fb470caec797f16e0c6ab169
/demo/designpatterns/objectadapterpattern/GuiMessager.java
6e7676d20d4dacaa20ee32f2b9106c2350a41535
[]
no_license
NBoetkjaer/Course2020_DesignPatters
3bc7763b6fea25c8fcb239f1299e34adb764835a
d201eb7378ebdf98d0d59ab6fd36630f1b60d296
refs/heads/master
2021-02-05T12:54:42.239518
2020-03-02T12:24:09
2020-03-02T12:24:09
243,782,677
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package demo.designpatterns.objectadapterpattern; import javax.swing.*; /* * This is one of the Adaptee classes in the adapter pattern. */ public class GuiMessager { public void displayInfoMessage(String message) { JOptionPane.showMessageDialog(null, message, "Information message", JOptionPane.INFORMATION_MESSAGE); } public void displayWarningMessage(String message) { JOptionPane.showMessageDialog(null, message, "Warning message", JOptionPane.WARNING_MESSAGE); } public void displayErrorMessage(String message) { JOptionPane.showMessageDialog(null, message, "Error message", JOptionPane.ERROR_MESSAGE); } }
7f41b8574841780e6f93ad4af594272b765917d8
0f11a58f4f8957d611e03b6a7ba200105332bcca
/oiscn-encounter/src/main/java/com/varian/oiscn/encounter/treatmentworkload/TreatmentWorkloadServiceImp.java
e15625792cd3bc21a64dc5e5e95fbbe4dd207ad7
[]
no_license
yugezi-gjw/SDCH-server-release-2
955c82dac6c888c2c69e80146476245607af1237
d78aa8a0ee0376aaf688201688ef009ec4179b65
refs/heads/master
2020-03-25T04:11:43.980187
2018-08-03T07:04:45
2018-08-03T07:04:45
143,382,229
0
1
null
null
null
null
UTF-8
Java
false
false
14,552
java
package com.varian.oiscn.encounter.treatmentworkload; import com.varian.oiscn.anticorruption.resourceimps.PatientAntiCorruptionServiceImp; import com.varian.oiscn.anticorruption.resourceimps.TreatmentSummaryAntiCorruptionServiceImp; import com.varian.oiscn.base.util.DateUtil; import com.varian.oiscn.connection.ConnectionPool; import com.varian.oiscn.core.treatmentsummary.PlanSummaryDto; import com.varian.oiscn.core.treatmentsummary.TreatmentSummaryDto; import com.varian.oiscn.core.user.UserContext; import com.varian.oiscn.encounter.dao.EncounterDAO; import com.varian.oiscn.util.DatabaseUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import java.sql.Connection; import java.sql.SQLException; import java.text.ParseException; import java.util.*; /** * Created by BHP9696 on 2017/8/21. */ @Slf4j public class TreatmentWorkloadServiceImp { private UserContext userContext; private TreatmentWorkloadDAO treatmentWorkloadDAO; private EncounterDAO encounterDAO; private TreatmentSummaryAntiCorruptionServiceImp treatmentSummaryAntiCorruptionServiceImp; private PatientAntiCorruptionServiceImp patientAntiCorruptionServiceImp; public TreatmentWorkloadServiceImp(UserContext userContext) { this.userContext = userContext; treatmentWorkloadDAO = new TreatmentWorkloadDAO(userContext); encounterDAO = new EncounterDAO(userContext); treatmentSummaryAntiCorruptionServiceImp = new TreatmentSummaryAntiCorruptionServiceImp(); patientAntiCorruptionServiceImp = new PatientAntiCorruptionServiceImp(); } /** * 技师进入到记录单时调用的接口,初始化治疗记录 * * @param patientSer * @return */ public TreatmentWorkloadVO queryTreatmentWorkloadByPatientSer(Long patientSer,Long encounterId) { Connection connection = null; TreatmentWorkloadVO treatmentWorkload = new TreatmentWorkloadVO(); try { connection = ConnectionPool.getConnection(); treatmentWorkload.setPlanList(new ArrayList<>()); treatmentWorkloadDAO.selectLatestWorkloadPlanByPatientSer(connection,patientSer,encounterId).forEach(workloadPlan -> treatmentWorkload.getPlanList().add(new WorkloadPlanVO() {{ setNum(workloadPlan.getDeliveredFractions()); setPlanId(workloadPlan.getPlanId()); setSelected(workloadPlan.getSelected() == 1); }}) ); Optional<TreatmentSummaryDto> treatmentSummaryDtoOptional = treatmentSummaryAntiCorruptionServiceImp.getApproveTxSummaryByPatientIdAndEncounterId(String.valueOf(patientSer),String.valueOf(encounterId)); treatmentWorkload.setEncounterId(String.valueOf(encounterId)); treatmentWorkload.setSign(new ArrayList<>()); treatmentWorkload.setWorker(new ArrayList<>()); if (treatmentSummaryDtoOptional != null && treatmentSummaryDtoOptional.isPresent() && treatmentSummaryDtoOptional.get().getPlans() != null && !treatmentSummaryDtoOptional.get().getPlans().isEmpty()) { List<PlanSummaryDto> need2AddList = new ArrayList<>(); for (PlanSummaryDto planSummaryDto : treatmentSummaryDtoOptional.get().getPlans()) { boolean has = false; for (WorkloadPlanVO workloadPlan : treatmentWorkload.getPlanList()) { if (planSummaryDto.getPlanSetupId().equals(workloadPlan.getPlanId())) { has = true; break; } } if (!has) { need2AddList.add(planSummaryDto); } } for (PlanSummaryDto planSummaryDto : need2AddList) { treatmentWorkload.getPlanList().add(new WorkloadPlanVO() {{ setPlanId(planSummaryDto.getPlanSetupId()); setNum(0); }}); } for (PlanSummaryDto planSummaryDto : treatmentSummaryDtoOptional.get().getPlans()) { treatmentWorkload.getPlanList().forEach(workloadPlanVO -> { if(workloadPlanVO.getPlanId().equals(planSummaryDto.getPlanSetupId())){ workloadPlanVO.setDeliveredFractions(planSummaryDto.getDeliveredFractions()); workloadPlanVO.setPlannedFractions(planSummaryDto.getPlannedFractions()); workloadPlanVO.setDeliveredDose(planSummaryDto.getDeliveredDose()); workloadPlanVO.setPlannedDose(planSummaryDto.getPlannedDose()); } }); } } Collections.sort(treatmentWorkload.getPlanList()); } catch (SQLException e) { log.error("SQLException SQLState=[{}]", e.getSQLState()); } finally { DatabaseUtil.safeCloseConnection(connection); } return treatmentWorkload; } public List<TreatmentWorkloadVO> queryTreatmentWorkloadListByPatientSer(Long patientSer,Long encounterId) { Connection conn = null; List<TreatmentWorkloadVO> list = new ArrayList<>(); try { conn = ConnectionPool.getConnection(); treatmentWorkloadDAO.queryTreatmentWorkloadListByPatientSer(conn, patientSer,encounterId).forEach(treatmentWorkload -> { list.add(entity2TreatmentWorkloadVO(treatmentWorkload)); }); Optional<TreatmentSummaryDto> treatmentSummaryDtoOptional = treatmentSummaryAntiCorruptionServiceImp.getApproveTxSummaryByPatientIdAndEncounterId(String.valueOf(patientSer),String.valueOf(encounterId)); if(!list.isEmpty()) { // 处理中途增加的计划 if (treatmentSummaryDtoOptional.isPresent() && treatmentSummaryDtoOptional.get().getPlans() != null && !treatmentSummaryDtoOptional.get().getPlans().isEmpty()) { List<PlanSummaryDto> planSummaryDtoList = treatmentSummaryDtoOptional.get().getPlans(); list.forEach(treatmentWorkloadVO -> { // 循环每个treatmentWorkloadVO if (treatmentWorkloadVO.getPlanList().size() < planSummaryDtoList.size()) { // 需要增加计划 List<WorkloadPlanVO> needAddList = new ArrayList<>(); planSummaryDtoList.forEach(planSummaryDto -> { boolean have = false; for (WorkloadPlanVO planVO : treatmentWorkloadVO.getPlanList()) { if (planVO.getPlanId().equals(planSummaryDto.getPlanSetupId())) { have = true; break; } } if (!have) { needAddList.add(new WorkloadPlanVO() {{ setNum(0); setPlanId(planSummaryDto.getPlanSetupId()); }}); } }); treatmentWorkloadVO.getPlanList().addAll(needAddList); } Collections.sort(treatmentWorkloadVO.getPlanList()); }); } }else{ if (treatmentSummaryDtoOptional.isPresent() && treatmentSummaryDtoOptional.get().getPlans() != null && !treatmentSummaryDtoOptional.get().getPlans().isEmpty()) { List<PlanSummaryDto> planSummaryDtoList = treatmentSummaryDtoOptional.get().getPlans(); TreatmentWorkloadVO treatmentWorkloadVO = new TreatmentWorkloadVO(); treatmentWorkloadVO.setHisId(null); treatmentWorkloadVO.setEncounterId(String.valueOf(encounterId)); treatmentWorkloadVO.setPlanList(new ArrayList<>()); planSummaryDtoList.forEach(planSummaryDto ->treatmentWorkloadVO.getPlanList().add(new WorkloadPlanVO(){{ setPlanId(planSummaryDto.getPlanSetupId()); }}) ); Collections.sort(treatmentWorkloadVO.getPlanList()); list.add(treatmentWorkloadVO); } } } catch (SQLException e) { log.error("SQLException SQLState=[{}]", e.getSQLState()); } finally { DatabaseUtil.safeCloseConnection(conn); } return list; } public boolean createTreatmentWorkLoad(TreatmentWorkloadVO treatmentWorkloadVO) { Connection conn = null; boolean ok = false; try { conn = ConnectionPool.getConnection(); DatabaseUtil.safeSetAutoCommit(conn, false); TreatmentWorkload treatmentWorkload = treatmentWorkloadVO2Entity(treatmentWorkloadVO); if (StringUtils.isEmpty(treatmentWorkload.getEncounterId())) { treatmentWorkload.setEncounterId(encounterDAO.queryByPatientSer(conn, treatmentWorkload.getPatientSer()).getId()); } String id = treatmentWorkloadDAO.create(conn, treatmentWorkloadVO2Entity(treatmentWorkloadVO)); if (StringUtils.isNotEmpty(id)) { ok = true; } conn.commit(); } catch (SQLException e) { log.error("SQLException SQLState=[{}]", e.getSQLState()); DatabaseUtil.safeRollback(conn); } finally { DatabaseUtil.safeCloseConnection(conn); } return ok; } private TreatmentWorkload treatmentWorkloadVO2Entity(TreatmentWorkloadVO treatmentWorkloadVO) { TreatmentWorkload treatmentWorkload = new TreatmentWorkload(); try { treatmentWorkload.setTreatmentDate(DateUtil.parse(treatmentWorkloadVO.getTreatmentDate())); } catch (ParseException e) { log.error("treatmentWorkloadVO2Entity ParseException: {}", e.getMessage()); } treatmentWorkload.setEncounterId(treatmentWorkloadVO.getEncounterId()); treatmentWorkload.setHisId(treatmentWorkloadVO.getHisId()); treatmentWorkload.setPatientSer(treatmentWorkloadVO.getPatientSer()); treatmentWorkload.setWorkloadPlans(new ArrayList<>()); treatmentWorkload.setWorkloadSignatures(new ArrayList<>()); treatmentWorkload.setWorkloadWorkers(new ArrayList<>()); if (treatmentWorkloadVO.getPlanList() != null) { treatmentWorkloadVO.getPlanList().forEach(workloadPlanVO -> { treatmentWorkload.getWorkloadPlans().add(new WorkloadPlan() {{ setPlanId(workloadPlanVO.getPlanId()); setComment(workloadPlanVO.getComments()); setDeliveredFractions(workloadPlanVO.getNum()); setSelected(workloadPlanVO.isSelected()?(byte)1:(byte)0); }}); }); } if (treatmentWorkloadVO.getSign() != null) { Calendar calendar = Calendar.getInstance(); treatmentWorkloadVO.getSign().forEach(workloadSignatureVO -> { treatmentWorkload.getWorkloadSignatures().add(new WorkloadSignature() {{ try { setSignDate(new Date(DateUtil.parse(workloadSignatureVO.getTime()).getTime()+calendar.getTimeZone().getRawOffset())); } catch (ParseException e) { log.error("treatmentWorkloadVO2Entity setSignDate ParseException: {}", e.getMessage()); } setResourceName(workloadSignatureVO.getName()); setSignType(workloadSignatureVO.getType()); }}); }); } if (treatmentWorkloadVO.getWorker() != null) { final int[] order = {0}; treatmentWorkloadVO.getWorker().forEach(workloadWorkerVO -> { treatmentWorkload.getWorkloadWorkers().add(new WorkloadWorker() {{ setWorkerName(workloadWorkerVO); setOrderNum(++order[0]); }}); }); } return treatmentWorkload; } private TreatmentWorkloadVO entity2TreatmentWorkloadVO(TreatmentWorkload treatmentWorkload) { TreatmentWorkloadVO treatmentWorkloadVO = new TreatmentWorkloadVO(); treatmentWorkloadVO.setTreatmentDate(treatmentWorkload.getTreatmentDate().getTime() + ""); treatmentWorkloadVO.setEncounterId(treatmentWorkload.getEncounterId()); treatmentWorkloadVO.setHisId(treatmentWorkload.getHisId()); treatmentWorkloadVO.setPatientSer(treatmentWorkload.getPatientSer()); treatmentWorkloadVO.setPlanList(new ArrayList<>()); treatmentWorkloadVO.setSign(new ArrayList<>()); treatmentWorkloadVO.setWorker(new ArrayList<>()); if (treatmentWorkload.getWorkloadPlans() != null) { treatmentWorkload.getWorkloadPlans().forEach(workloadPlan -> { treatmentWorkloadVO.getPlanList().add(new WorkloadPlanVO() {{ setPlanId(workloadPlan.getPlanId()); setComments(workloadPlan.getComment()); setNum(workloadPlan.getDeliveredFractions()); }}); }); } if (treatmentWorkload.getWorkloadSignatures() != null) { treatmentWorkload.getWorkloadSignatures().forEach(workloadSignature -> { treatmentWorkloadVO.getSign().add(new WorkloadSignatureVO() {{ setTime(workloadSignature.getSignDate().getTime() + ""); setName(workloadSignature.getResourceName()); setType(workloadSignature.getSignType()); }}); }); } if (treatmentWorkload.getWorkloadWorkers() != null) { treatmentWorkload.getWorkloadWorkers().forEach(workloadWorker -> { treatmentWorkloadVO.getWorker().add(workloadWorker.getWorkerName()); }); } return treatmentWorkloadVO; } }
48b988632bee0090db7234839f3f089135e99f2f
8335c45145055bac93d5853d9001ad03899e8aa0
/Java programs/Strategy_Pattern/src/Dog.java
b7207d14ba75fa6377fa046b1ea56ce7647848e7
[]
no_license
shashank17hn/Projects
3be9f5cc33495439273f534eb19664e8e364a2ad
40b7ea27a1f1b2a72eafd7c0753e999da93b7b4c
refs/heads/master
2020-04-05T14:08:35.800433
2018-08-11T20:59:08
2018-08-11T20:59:08
51,495,234
0
0
null
null
null
null
UTF-8
Java
false
false
93
java
public class Dog extends Animal{ Dog() { super(); flying = new CantFly(); } }
2f029febbb9c9ab82bacab9179b52edf38281a0e
30549661854fab0df590004cc0282a506e601ddd
/excel/ClassPupilsImporter.java
5fb0bd21526fb3acbd1a6400bb93b81aeeaad492
[]
no_license
EfimSirotkin/ClientSideClone
9c32c3d3f729bb7d45277b3226141189fb03af58
78005bf55bfa6f4fe0171a24207b7c049898ea35
refs/heads/master
2023-04-26T21:56:07.303435
2021-05-19T08:42:37
2021-05-19T08:42:37
364,498,116
0
0
null
null
null
null
UTF-8
Java
false
false
2,319
java
package sample.excel; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import sample.Main; import sample.objects.ObjectUtils; import sample.objects.Pupil; import sample.objects.SchoolClass; import java.io.File; import java.io.IOException; public class ClassPupilsImporter implements Importer { @Override public boolean importTemplate(String filePath) { Workbook workbook = null; boolean isDuplicate = false; try { workbook = Workbook.getWorkbook(new File(filePath)); Sheet sheet = workbook.getSheet(0); int yMax = sheet.getRows(); String currentClass = sheet.getCell(0,0).getContents(); SchoolClass schoolClass = ObjectUtils.findClassByName(Main.schoolClassArrayList, currentClass); String currentTeacherName = sheet.getCell(0,2).getContents(); int teacherID = ObjectUtils.findTeacherByName(Main.teachers, currentTeacherName).getId(); for (int i = 1; i < yMax; ++i) { String currentPupilName = sheet.getCell(1, i).getContents(); String currentPupilMail = sheet.getCell(2,i).getContents(); String currentPupilAge = sheet.getCell(3,i).getContents(); String currentPupilSex = sheet.getCell(4,i).getContents(); Pupil currentNewPupil = new Pupil(Main.pupils.size()+ 1, currentPupilName, currentPupilMail, Integer.parseInt(currentPupilAge), Integer.parseInt(currentPupilSex)); if((isDuplicate = ObjectUtils.isDuplicatePresent(Main.pupils, currentNewPupil))) continue; currentNewPupil.setTeacherID(teacherID); currentNewPupil.setPupilClass(schoolClass); Main.pupils.add(currentNewPupil); } } catch (IOException e) { e.printStackTrace(); } catch (BiffException e) { e.printStackTrace(); } finally { if (workbook != null) { workbook.close(); } } return isDuplicate; } }
82364f7eb8a61bccfc2346614cad7382b2abb92d
4db65cadb4130b4a72cb93f1e4c54010a85ca984
/src/main/java/n3/client/ClientMain.java
f42c205b2f8b3fc12193e95cb13d587a7949a830
[]
no_license
Hayaking/netty-example
1d9546251c35ca6d933f7a83370ea6af09b3f577
8935905861821f0d0053d9a2d76f9b0ad9095852
refs/heads/master
2020-07-26T19:52:21.438600
2019-09-26T13:26:26
2019-09-26T13:26:26
208,750,482
0
0
null
2019-11-02T07:15:33
2019-09-16T08:37:31
Java
UTF-8
Java
false
false
180
java
package n3.client; /** * @author haya */ public class ClientMain { public static void main(String[] args) throws Exception { new ChatClient( 8888 ).start(); } }
9c05507cc7f364e844d68ebd8906cdf8c3c6582e
5cf4325de1158ff0489087ab2f56811ec024d50a
/src/Arrays/Assignment3_10.java
fd89899892943690887a779d0a65a6c2263a78ee
[]
no_license
Ankitwww99/WiproTalentnext
c438e8c538846d44f8830795b168ba4ddfc1b69d
4c6dcef440bd228e9a27c45c8cebe0e97608213a
refs/heads/master
2022-11-19T00:53:21.785318
2020-07-19T17:48:13
2020-07-19T17:48:13
273,468,581
1
0
null
null
null
null
UTF-8
Java
false
false
1,124
java
package Arrays; /* Print an array that contains the exact same numbers as the given array, but rearranged so that all the even numbers come before all the odd numbers. Other than that, the numbers can be in any order. You may modify and print the given array, or make a new array. evenOdd([1, 0, 1, 0, 0, 1, 1]) → [0, 0, 0, 1, 1, 1, 1] evenOdd([3, 3, 2]) → [2, 3, 3] evenOdd([2, 2, 2]) → [2, 2, 2] */ public class Assignment3_10 { public static int[] evenOdd(int arr[]){ int n=arr.length; int l=0,r=n-1; int a[]=new int[n]; for(int i=0;i<n;i++){ if(arr[i]%2==0){ a[l]=arr[i]; l++; } else{ a[r]=arr[i]; r--; } } return a; } public static void main(String[] args) { int[] arr=new int[args.length]; for (int i = 0; i < args.length; i++) { arr[i]=Integer.parseInt(args[i]); } arr=evenOdd(arr); for (int i = 0; i < arr.length; i++) { System.out.print(arr[i]+" "); } } }
be998847cfbb978c32555e37c05707d155077508
d9c79f63b432bfb8c14752a5d170313542ed8188
/data/src/main/java/com/architecture/babypadawans/net/RestApiImpl.java
54f3ee66f8e822e88da18c538afccc5b9efbaf1a
[ "Apache-2.0" ]
permissive
metalgreymon121/AndroidArchitecture-BabyPadawans
9c90fffefe68086a86e031e4df2b224cb55eb0c9
1ea4407f9934e2d0fb2220ed29052a395852e122
refs/heads/master
2021-01-12T19:51:21.877410
2015-11-19T13:58:50
2015-11-19T13:58:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,513
java
package com.architecture.babypadawans.net; import com.architecture.babypadawans.entities.user.UserEntity; import com.architecture.babypadawans.entities.user.mapper.UserEntityDataMapper; import com.architecture.babypadawans.net.response.common.BaseResponse; import com.architecture.babypadawans.net.response.login.UserDTO; import com.architecture.babypadawans.event.login.LoginEvent; import com.architecture.babypadawans.event.register.RegisterEvent; import com.squareup.otto.Bus; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.RetrofitError; import retrofit.client.Response; /** * Created by Spiros I. Oikonomakis on 11/12/15. */ public class RestApiImpl implements RestApi { private final Bus bus; private final ResourceService resourceService; private final UserEntityDataMapper userEntityDataMapper = new UserEntityDataMapper(); public RestApiImpl(Bus bus) { RestAdapter restApi = new RestAdapter.Builder().setEndpoint(Constants.API_URL) .setLogLevel(RestAdapter.LogLevel.FULL) .build(); this.resourceService = restApi.create(ResourceService.class); this.bus = bus; } @Override public void login(String username, String password) { this.resourceService.login(username, password, new Callback<BaseResponse<UserDTO>>() { @Override public void success(BaseResponse<UserDTO> loginResponseBaseResponse, Response response) { if (loginResponseBaseResponse.getResponse() != null) { UserEntity userEntity = userEntityDataMapper.transform(loginResponseBaseResponse.getResponse()); bus.post(new LoginEvent(userEntity, loginResponseBaseResponse.getMessage())); } } @Override public void failure(RetrofitError error) { bus.post(new LoginEvent(error.getLocalizedMessage())); } }); } @Override public void register(String username, String password, String email) { this.resourceService.register(username, password, email, new Callback<BaseResponse<UserDTO>>() { @Override public void success(BaseResponse<UserDTO> registerResponseBaseResponse, Response response) { if (registerResponseBaseResponse.getResponse() != null) { bus.post(new RegisterEvent(true, registerResponseBaseResponse.getMessage())); } } @Override public void failure(RetrofitError error) { bus.post(new LoginEvent(error.getLocalizedMessage())); } }); } }
5aba75fcb0885ebb529501f6116d65df726f24c1
3bf60cf3f1a527233bafefccf03eb60b78895c02
/src/test/java/gds/demo/web/rest/errors/ExceptionTranslatorIT.java
060e0d5054a7487c27d861354fb6e13cf2fd142c
[]
no_license
tongpi/jhi-oauth2-app1
8b4c78adf85993f4f57eaf6190a232fa3fa9d38d
11f5fa45a56495eb2ef3e267ee92abc39fb374c2
refs/heads/master
2022-12-22T05:27:31.775333
2019-06-28T11:26:50
2019-06-28T11:26:50
193,457,941
0
0
null
2022-12-16T04:59:47
2019-06-24T07:40:32
TypeScript
UTF-8
Java
false
false
5,593
java
package gds.demo.web.rest.errors; import gds.demo.JhiOauth2App1App; import gds.demo.config.TestSecurityConfiguration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** * Integration tests {@link ExceptionTranslator} controller advice. */ @SpringBootTest(classes = {JhiOauth2App1App.class, TestSecurityConfiguration.class}) public class ExceptionTranslatorIT { @Autowired private ExceptionTranslatorTestController controller; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; private MockMvc mockMvc; @BeforeEach public void setup() { mockMvc = MockMvcBuilders.standaloneSetup(controller) .setControllerAdvice(exceptionTranslator) .setMessageConverters(jacksonMessageConverter) .build(); } @Test public void testConcurrencyFailure() throws Exception { mockMvc.perform(get("/test/concurrency-failure")) .andExpect(status().isConflict()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE)); } @Test public void testMethodArgumentNotValid() throws Exception { mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION)) .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO")) .andExpect(jsonPath("$.fieldErrors.[0].field").value("test")) .andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull")); } @Test public void testMissingServletRequestPartException() throws Exception { mockMvc.perform(get("/test/missing-servlet-request-part")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value("error.http.400")); } @Test public void testMissingServletRequestParameterException() throws Exception { mockMvc.perform(get("/test/missing-servlet-request-parameter")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value("error.http.400")); } @Test public void testAccessDenied() throws Exception { mockMvc.perform(get("/test/access-denied")) .andExpect(status().isForbidden()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value("error.http.403")) .andExpect(jsonPath("$.detail").value("test access denied!")); } @Test public void testUnauthorized() throws Exception { mockMvc.perform(get("/test/unauthorized")) .andExpect(status().isUnauthorized()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value("error.http.401")) .andExpect(jsonPath("$.path").value("/test/unauthorized")) .andExpect(jsonPath("$.detail").value("test authentication failed!")); } @Test public void testMethodNotSupported() throws Exception { mockMvc.perform(post("/test/access-denied")) .andExpect(status().isMethodNotAllowed()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value("error.http.405")) .andExpect(jsonPath("$.detail").value("Request method 'POST' not supported")); } @Test public void testExceptionWithResponseStatus() throws Exception { mockMvc.perform(get("/test/response-status")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value("error.http.400")) .andExpect(jsonPath("$.title").value("test response status")); } @Test public void testInternalServerError() throws Exception { mockMvc.perform(get("/test/internal-server-error")) .andExpect(status().isInternalServerError()) .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(jsonPath("$.message").value("error.http.500")) .andExpect(jsonPath("$.title").value("Internal Server Error")); } }
b1feff826fb17510797ddf394e09d4201a0f9bb4
934c4c73bd3b0b5c56f455928ad07062ac69470a
/src/main/java/com/sjsu/market/dao/ProductDao.java
58911e9d13b3744ca66ba8bdef03a296973aed60
[]
no_license
maneamol/RESTful-marketplace
67fb194ef5d7fc2922c67f9f136ab4f3eddcacc1
b34d240fe73497b582ec30453c86af0176445503
refs/heads/master
2022-06-24T02:43:30.439338
2020-08-08T22:34:56
2020-08-08T22:34:56
26,663,825
0
1
null
2022-06-20T23:38:15
2014-11-15T00:32:20
Java
UTF-8
Java
false
false
987
java
package com.sjsu.market.dao; import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.sjsu.market.beans.Product; public class ProductDao { public boolean addProduct(DB db, Product product) { // System.out.println("product add" + productName + " " + productDesc + // " " +productPrice + " " + productCategory); /* * "product_name": "dell xps", "product_count": 500, "product_price": * 1500.45, "description": "Laptop" */ try { DBCollection productColletion = db.getCollection("featured"); BasicDBObject document = new BasicDBObject(); document.put("product_name", product.getName()); document.put("product_count", product.getCount()); document.put("product_price", product.getPrice()); document.put("description", product.getDescription()); document.put("category", product.getCategory()); productColletion.insert(document); } catch (Exception exception) { return false; } return true; } }
ca0ae1b90077052e5cd0c63789e5d0f5abe5de06
2a920f5f42c588dad01740da5d8c3d9aecbc2a90
/src/org/deegree/io/shpapi/ShapeUtils.java
e5707f905875fb4e077ca7c670a677b9ec7a4d00
[]
no_license
lat-lon/deegree2-rev30957
40b50297cd28243b09bfd05db051ea4cecc889e4
22aa8f8696e50c6e19c22adb505efb0f1fc805d8
refs/heads/master
2020-04-06T07:00:21.040695
2016-06-28T15:21:56
2016-06-28T15:21:56
12,290,316
0
0
null
2016-06-28T15:21:57
2013-08-22T06:49:45
Java
UTF-8
Java
false
false
5,022
java
//$HeadURL: https://scm.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/io/shpapi/ShapeUtils.java $ /*---------------------------------------------------------------------------- This file is part of deegree, http://deegree.org/ Copyright (C) 2001-2009 by: Department of Geography, University of Bonn and lat/lon GmbH This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact information: lat/lon GmbH Aennchenstr. 19, 53177 Bonn Germany http://lat-lon.de/ Department of Geography, University of Bonn Prof. Dr. Klaus Greve Postfach 1147, 53001 Bonn Germany http://www.geographie.uni-bonn.de/deegree/ e-mail: [email protected] ----------------------------------------------------------------------------*/ package org.deegree.io.shpapi; import org.deegree.model.spatialschema.ByteUtils; /** * Utilities for reading and writing the components of shape files. * * * <B>Last changes<B>:<BR> * 25.11.1999 ap: memory allocation dynaminized<BR> * 17.1.2000 ap: method SHPPoint readPoint(byte[] b, int off) modified<BR> * 17.1.2000 ap: method SHPEnvelope readBox(byte[] b, int off) modified<BR> * 17.1.2000 ap: method writePoint(..) modified<BR> * * <!----------------------------------------------------------------------------> * * @version 25.1.2000 * @author Andreas Poth * */ public class ShapeUtils { /** * readPoint(byte[] b, int off)<BR> * Reads a point record. A point record is a double representing the x value and a double * representing a y value. * * @param b * the raw data buffer * @param off * the offset into the buffer where the int resides * @return the point read from the buffer at the offset location */ public static SHPPoint readPoint( byte[] b, int off ) { SHPPoint point = new SHPPoint(); point.x = ByteUtils.readLEDouble( b, off ); point.y = ByteUtils.readLEDouble( b, off + 8 ); return point; } /** * method: readBox(byte[] b, int off)<BR> * Reads a bounding box record. A bounding box is four double representing, in order, xmin, * ymin, xmax, ymax. * * @param b * the raw data buffer * @param off * the offset into the buffer where the int resides * @return the point read from the buffer at the offset location */ public static SHPEnvelope readBox( byte[] b, int off ) { SHPEnvelope bb = new SHPEnvelope(); SHPPoint min = readPoint( b, off ); SHPPoint max = readPoint( b, off + 16 ); bb.west = min.x; bb.south = min.y; bb.east = max.x; bb.north = max.y; return bb; } /** * method: writePoint(byte[] b, int off, ESRIPoint point)<BR> * Writes the given point to the given buffer at the given location. The point is written as a * double representing x followed by a double representing y. * * @param b * the data buffer * @param off * the offset into the buffer where writing should occur * @param point * the point to write * @return the number of bytes written */ public static int writePoint( byte[] b, int off, SHPPoint point ) { int nBytes = ByteUtils.writeLEDouble( b, off, point.x ); nBytes += ByteUtils.writeLEDouble( b, off + nBytes, point.y ); return nBytes; } /** * method: writeBox(byte[] b, int off, ESRIBoundingBox box)<BR> * Writes the given bounding box to the given buffer at the given location. The bounding box is * written as four doubles representing, in order, xmin, ymin, xmax, ymax. * * @param b * the data buffer * @param off * the offset into the buffer where writing should occur * @param box * the bounding box to write * @return the number of bytes written */ public static int writeBox( byte[] b, int off, SHPEnvelope box ) { SHPPoint min = new SHPPoint(); min.x = box.west; min.y = box.south; SHPPoint max = new SHPPoint(); max.x = box.east; max.y = box.north; int nBytes = writePoint( b, off, min ); nBytes += writePoint( b, off + nBytes, max ); return nBytes; } }
cb32c5bf46935917c58d078ff65dab5da9ec5073
d91e82338a970396080799d1f33b353e45a58ba8
/app/src/main/java/com/movie/app/Views/MainActivity.java
5faf8ddfc09c801c8c19599ce972cb6ffb515b0c
[ "MIT" ]
permissive
amranya/Movie-app
f2d8c7f6ab6d58ffcff52548e11fd825d7a40a76
9f47c62674730af24f96f752a307431fc0518066
refs/heads/master
2020-04-09T01:15:25.444134
2018-12-03T10:36:30
2018-12-03T10:36:30
159,897,637
0
0
null
null
null
null
UTF-8
Java
false
false
3,442
java
package com.movie.app.Views; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.AbsListView; import android.widget.Toast; import com.movie.app.Adapter.MovieAdapter; import com.movie.app.Data.DataTest; import com.movie.app.Data.TheMovieDbData; import com.movie.app.Model.MovieModel; import com.movie.app.R; import com.movie.app.Utils.Utils; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { RecyclerView recyclerView; LinearLayoutManager manager; MovieAdapter adapter; List<MovieModel> movies = new ArrayList<>(); boolean isScrolling = false; int currentItems, totalItems, scrollOutItems; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Utils.initializeSSLContext(this); recyclerView = findViewById(R.id.my_recycler_view); manager = new LinearLayoutManager(this); adapter = new MovieAdapter(this, movies); getData(); recyclerView.setLayoutManager(manager); recyclerView.setAdapter(adapter); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); if (newState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { isScrolling = true; } } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); currentItems = manager.getChildCount(); totalItems = manager.getItemCount(); scrollOutItems = manager.findFirstVisibleItemPosition(); if (isScrolling && (currentItems + scrollOutItems >= totalItems)) { isScrolling = false; getData(); } } }); } public void getData() { TheMovieDbData.getLastMoviesData(this, adapter); //DataTest.getDataTest(this, adapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if(id == R.id.popularity){ TheMovieDbData.filter(this, adapter, TheMovieDbData.Sort.POPULARITY_DESC); Toast.makeText(this, "by popularity", Toast.LENGTH_SHORT).show(); } else if (id == R.id.rating){ TheMovieDbData.filter(this, adapter, TheMovieDbData.Sort.VOTE_AVERAGE_DESC); Toast.makeText(this, "by top voted", Toast.LENGTH_SHORT).show(); } else if (id == R.id.release){ TheMovieDbData.filter(this, adapter, TheMovieDbData.Sort.RELEASE_DATE_DESC); Toast.makeText(this, "by newest", Toast.LENGTH_SHORT).show(); } return super.onOptionsItemSelected(item); } }
580c741244860ef92bad9fb4d8fb43e8f67c3d7a
e6bbac148667bd85ccd202d17c9cd7c412ad1e18
/Proyecto/src/CellContent.java
0008fd9651acdf778b6e6102f4cf9a684953cef8
[]
no_license
alorozco53/ialab
38dae1c8b252a186baf013852663883b94239ebb
88f5e0e56cb2b843024f76a9472bbe2f04a56928
refs/heads/master
2021-03-19T08:29:30.420467
2017-03-04T06:07:17
2017-03-04T06:07:17
83,869,648
1
0
null
null
null
null
UTF-8
Java
false
false
158
java
/** * Either a cell has a robot insie, or an obstacle, or is empty. * @author AlOrozco53 */ public enum CellContent { ROBOT, OBSTACLE, EMPTY }
e01e7e370754f8bb4707ff19503d92545d76740b
bc5f5fa9a2d4fd7b9cbbdf2f25a8b529a6b8d4ee
/src/main/java/com/bupt/qingzaoreading/po/Lecturer.java
61b1b6fc9a0f0a7178f4d249f3c4004d94796716
[]
no_license
greenjujubereading/GreenJujubeBack
f1e32c68bb918691d3e1a0f02d3862f40e5eaf64
321034924c4c94478522b934f19df80da47dc961
refs/heads/master
2020-05-15T11:08:03.230966
2019-04-19T06:36:20
2019-04-19T06:36:20
182,214,594
0
0
null
null
null
null
UTF-8
Java
false
false
2,125
java
package com.bupt.qingzaoreading.po; import javax.persistence.*; public class Lecturer { /** * 讲师id */ @Id @Column(name = "lecturer_id") private Long lecturerId; /** * 讲师姓名 */ @Column(name = "lecturer_name") private String lecturerName; /** * 讲师头像url */ @Column(name = "lecturer_head_portrait_url") private String lecturerHeadPortraitUrl; /** * 讲师介绍 */ @Column(name = "lecturer_introduction") private String lecturerIntroduction; /** * 获取讲师id * * @return lecturer_id - 讲师id */ public Long getLecturerId() { return lecturerId; } /** * 设置讲师id * * @param lecturerId 讲师id */ public void setLecturerId(Long lecturerId) { this.lecturerId = lecturerId; } /** * 获取讲师姓名 * * @return lecturer_name - 讲师姓名 */ public String getLecturerName() { return lecturerName; } /** * 设置讲师姓名 * * @param lecturerName 讲师姓名 */ public void setLecturerName(String lecturerName) { this.lecturerName = lecturerName; } /** * 获取讲师头像url * * @return lecturer_head_portrait_url - 讲师头像url */ public String getLecturerHeadPortraitUrl() { return lecturerHeadPortraitUrl; } /** * 设置讲师头像url * * @param lecturerHeadPortraitUrl 讲师头像url */ public void setLecturerHeadPortraitUrl(String lecturerHeadPortraitUrl) { this.lecturerHeadPortraitUrl = lecturerHeadPortraitUrl; } /** * 获取讲师介绍 * * @return lecturer_introduction - 讲师介绍 */ public String getLecturerIntroduction() { return lecturerIntroduction; } /** * 设置讲师介绍 * * @param lecturerIntroduction 讲师介绍 */ public void setLecturerIntroduction(String lecturerIntroduction) { this.lecturerIntroduction = lecturerIntroduction; } }
edb668e85f49d5ab889de609cc8d6bbcced7e182
0bd3b14751ee355d2f8029fff1029bba11a897c1
/app/src/main/java/com/csr/csrmeshdemo/DuplicateDeviceIdException.java
ee4fe5e6a7697b3132ab654aadd451b1becab77f
[]
no_license
zhourenjun/CSRmeshDemo
4ad7216eb530fbea2472bf4af8ce4e2e3893639f
7135a87ca666e0e260ffa758a63787e9bffa79db
refs/heads/master
2021-06-03T19:24:03.120789
2016-06-22T05:55:55
2016-06-22T05:57:12
61,693,081
1
0
null
null
null
null
UTF-8
Java
false
false
473
java
/****************************************************************************** Copyright Cambridge Silicon Radio Limited 2014 - 2015. ******************************************************************************/ package com.csr.csrmeshdemo; public class DuplicateDeviceIdException extends RuntimeException { private static final long serialVersionUID = 1L; public DuplicateDeviceIdException(String message) { super(message); } }
51864fa581a3596e0965ff2b1bae85ce4d9ab2f0
25d2442d2ec28abd7099bc4f1f91c452ae2af17b
/src/main/java/com/spring/codeblog/configuration/SecurityConfig.java
72ec030b2921747ebdf2f94e8d622058338ec37c
[]
no_license
UlyssesWerlich/CodeBlog-Spring
9af3dc8ceace96fe2ccef0dd47ba127308e1c252
c3d54f53f7312435e0bd97887c06badca24f845e
refs/heads/main
2023-01-20T13:46:37.955212
2020-12-01T23:35:22
2020-12-01T23:35:22
317,683,965
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
package com.spring.codeblog.configuration; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { private static final String[] AUTH_LIST = { "/", "/posts", "/posts/{id}" }; @Override protected void configure(HttpSecurity http) throws Exception{ http.csrf().disable().authorizeRequests() .antMatchers(AUTH_LIST).permitAll() .anyRequest().authenticated() .and().formLogin().permitAll() .and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception{ auth.inMemoryAuthentication() .withUser("ulysses").password("{noop}123").roles("ADMIN"); } @Override public void configure(WebSecurity web) throws Exception{ web.ignoring().antMatchers("/bootstrap/**"); web.ignoring().antMatchers("/bootstrap/**", "/style/**"); } }
79c3405563a645e73d8cb2bc600651cfa39fb8c4
a0a84d050e69af7f9a46008f64a240f8b152cee5
/src/main/java/com/maple/game/osee/dao/data/entity/gm/GmCdkTypeInfo.java
b5c35e4b7d6b19e85b38202d67d665ad2e8b627b
[]
no_license
xxxJppp/ttmy-server
f749ca2c48e106ff4cae614fe8a551fe73c3f108
ebe3ba85bb00a0180f9868b2b0f92cc3a6f7d594
refs/heads/master
2022-03-31T02:33:39.073653
2019-12-13T01:35:29
2019-12-13T01:35:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.maple.game.osee.dao.data.entity.gm; /** * 后台CDK类型数据 */ public class GmCdkTypeInfo { /** * 类型id */ private long id; /** * 类型名 */ private String name; 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; } }
f457c83611323fed1a71df0e5e13c04c8af7ff45
fd36363467b1bdc767135eb252e525cd907d4fa6
/src/main/java/com/widerplanet/refactor01/before/Movie.java
f6632d7a77511e3e11a0b750e66fbb37db54437c
[]
no_license
ryudwig/RefactoringExam
55e1e07832e1560ecadcd18ac0f80822a379eeba
0cc8d4de41264155a3270d67769002c7fbaf24dc
refs/heads/master
2022-11-30T02:51:37.495954
2020-08-13T07:44:21
2020-08-13T07:44:21
271,488,073
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package com.widerplanet.refactor01.before; public class Movie { public static final int CHILDREN = 2; public static final int REGULAR = 0; public static final int NEW_RELEASE = 1; private String _title; private int _priceCode; public Movie(String title, int priceCode){ _title = title; _priceCode = priceCode; } public int getPriceCode() { return _priceCode; } public void setPriceCode(int arg) { _priceCode = arg; } public String getTitle() { return _title; } }
1433a51200f2124c64032efbd5edb1b01f8e64ec
db391dd4994f87993091c55a75b8e2d3235f71f9
/MIS/src/main/java/com/ParkMIS/DAO/ManageDAOImpl.java
bd28348916f7bc8921f9a99f37ae963a87dc0432
[]
no_license
FirstXYZ/HomeWork
65bfbc1d9a035d8431393a0a0ea294a8c0feb0c0
eac657fda2c26fb32e7bbd8a8eb556c7e181d531
refs/heads/master
2020-03-22T15:15:23.855412
2016-12-15T09:15:38
2016-12-15T09:15:38
74,272,933
0
2
null
2016-12-07T11:05:24
2016-11-20T12:35:30
JavaScript
UTF-8
Java
false
false
3,379
java
package com.ParkMIS.DAO; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.ParkMIS.Util.DbUtil; import com.ParkMIS.entity.Manage; import com.ParkMIS.entity.Vip; public class ManageDAOImpl implements ManageDAO{ @Override public boolean add(Manage manage) { // TODO Auto-generated method stub return DbUtil.executeUpdate("insert into manage values(?,?,?,?,?,?,?,?)", new Object[]{manage.getMid(),manage.getAid(),manage.getOid(),manage.getVid(), manage.getAppTime(),manage.getStartTime(),manage.getEndTime(),manage.getYesNo()}); } @Override public boolean delete(Manage manage) { // TODO Auto-generated method stub return DbUtil.executeUpdate("delete from manage where mid=?", new Object[]{manage.getMid()}); } @Override public boolean update(Manage manage1, Manage manage2) { // TODO Auto-generated method stub return DbUtil.executeUpdate("update manage set aid=?,oid=?,mid=?,appTime=?,startTime=?," + "endTime=?,yesNo=? where mid=?", new Object[]{manage1.getAid(),manage1.getOid(),manage1.getMid(),manage1.getAppTime(), manage1.getStartTime(),manage1.getEndTime(),manage1.getYesNo(),manage2.getMid()}); } @Override //Admin in out quxiaoyueyudefangfa public Manage getMangeByOid(int i) { // TODO Auto-generated method stub Manage manage=new Manage(); ResultSet rs=DbUtil.executeQuery("select * from manage where oid=? and yesNo in('预约中','停放中')", new Object[]{i}); try { while(rs.next()){ manage.setMid(rs.getInt(1)); manage.setAid(rs.getInt(2)); manage.setOid(rs.getInt(3)); manage.setVid(rs.getInt(4)); manage.setAppTime(rs.getString(5)); manage.setStartTime(rs.getString(6)); manage.setEndTime(rs.getString(7)); manage.setYesNo(rs.getString(8)); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return manage; } @Override public Manage getLastByVip(Vip vip) { // TODO Auto-generated method stub Manage manage=new Manage(); ResultSet rs=DbUtil.executeQuery("select * from manage where vid=? and yesNo in('预约中','未停') order by asc", new Object[]{vip.getVid()}); try { while(rs.next()){ manage.setMid(rs.getInt(1)); manage.setAid(rs.getInt(2)); manage.setOid(rs.getInt(3)); manage.setVid(rs.getInt(4)); manage.setAppTime(rs.getString(5)); manage.setStartTime(rs.getString(6)); manage.setEndTime(rs.getString(7)); manage.setYesNo(rs.getString(8)); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return manage; } @Override public List<Manage> hy(int vid) throws Exception { List<Manage> glist=new ArrayList<Manage>(); ResultSet rs=DbUtil.executeQuery("select * from manage where vid=? and yesNo='预约中'", new Object[]{vid}); try { while(rs.next()){ Manage manage=new Manage(); manage.setMid(rs.getInt(1)); manage.setAid(rs.getInt(2)); manage.setOid(rs.getInt(3)); manage.setVid(rs.getInt(4)); manage.setAppTime(rs.getString(5)); manage.setStartTime(rs.getString(6)); manage.setEndTime(rs.getString(7)); manage.setYesNo(rs.getString(8)); glist.add(manage); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return glist; } }
bf213ba7c73f9ba908dec5c461439c6fef1ac195
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/tags/2.2.0/code/base/dso-l2/src/com/tc/objectserver/tx/ServerTransactionImpl.java
990796635459637cbb72ebdc29632c6fe6a50150
[]
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
3,371
java
/* * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved. */ package com.tc.objectserver.tx; import com.tc.net.protocol.tcm.ChannelID; import com.tc.object.dna.api.DNA; import com.tc.object.dna.impl.ObjectStringSerializer; import com.tc.object.lockmanager.api.LockID; import com.tc.object.tx.ServerTransactionID; import com.tc.object.tx.TransactionID; import com.tc.object.tx.TxnBatchID; import com.tc.object.tx.TxnType; import com.tc.util.SequenceID; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Represents an atomic change to the states of objects on the server * * @author steve */ public class ServerTransactionImpl implements ServerTransaction { private final ServerTransactionID serverTxID; private final SequenceID seqID; private final List changes; private final LockID[] lockIDs; private final TransactionID txID; private final Map newRoots; private final ChannelID channelID; private final TxnType transactionType; private final ObjectStringSerializer serializer; private final Collection notifies; private final Collection objectIDs; private final TxnBatchID batchID; public ServerTransactionImpl(TxnBatchID batchID, TransactionID txID, SequenceID sequenceID, LockID[] lockIDs, ChannelID channelID, List dnas, ObjectStringSerializer serializer, Map newRoots, TxnType transactionType, Collection notifies) { this.batchID = batchID; this.txID = txID; this.seqID = sequenceID; this.lockIDs = lockIDs; this.newRoots = newRoots; this.channelID = channelID; this.serverTxID = new ServerTransactionID(channelID, txID); this.transactionType = transactionType; this.notifies = notifies; this.changes = dnas; this.serializer = serializer; List ids = new ArrayList(changes.size()); for (Iterator i = changes.iterator(); i.hasNext();) { ids.add(((DNA) i.next()).getObjectID()); } this.objectIDs = ids; } public ObjectStringSerializer getSerializer() { return serializer; } public LockID[] getLockIDs() { return lockIDs; } public ChannelID getChannelID() { return channelID; } public TransactionID getTransactionID() { return txID; } public SequenceID getClientSequenceID() { return seqID; } public List getChanges() { return changes; } public Map getNewRoots() { return newRoots; } public TxnType getTransactionType() { return transactionType; } public Collection getObjectIDs() { return this.objectIDs; } public Collection addNotifiesTo(List list) { list.addAll(notifies); return list; } public String toString() { return "ServerTransaction[" + seqID + " , " + txID + "," + channelID + "," + transactionType + "] = { changes = " + changes.size() + ", notifies = " + notifies.size() + ", newRoots = " + newRoots.size() + "}"; } public ServerTransactionID getServerTransactionID() { return serverTxID; } public TxnBatchID getBatchID() { return batchID; } }
[ "nharward@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
nharward@7fc7bbf3-cf45-46d4-be06-341739edd864
6e61d0f080d9a3b57c8a86e795af0c95bfa76361
17515d92e1ae20bcd91eb22b55de0aa95045140b
/服务器端技术攻关/Server_Island_cv_1.0/src/controller/OrderController.java
acfab1b69e123583348c53024e0f39c1c5e8d8de
[]
no_license
xujihui/IslandTrading
3040e0591667684e3c45adf35ec7901db157fd9c
7d68f50e91f161df8e07cf118e2b7ac6c678e379
refs/heads/master
2020-07-05T18:41:36.397108
2016-12-24T01:06:44
2016-12-24T01:06:44
73,985,625
8
34
null
2016-11-24T06:08:37
2016-11-17T03:15:14
JavaScript
UTF-8
Java
false
false
941
java
package controller; import java.util.List; import interceptor.LoginInterceptor; import service.OrderBiz; import com.jfinal.aop.Before; import com.jfinal.core.Controller; import com.jfinal.plugin.activerecord.Record; @Before(LoginInterceptor.class) public class OrderController extends Controller { OrderBiz orderService = this.enhance(OrderBiz.class); public void detail() { String oid = this.getPara(0); List<Record> detailList = orderService.findDetailByID(oid); this.setSessionAttr("detailList", detailList); this.render("/orderDetail.jsp"); } public void list() { List<Record> orderlist = orderService.findAll(); this.setSessionAttr("orderlist", orderlist); this.render("/orderList.jsp"); } public void findByID() { String oid = this.getPara("id"); System.out.print("para.id" + oid); Record order = orderService.findByID(oid); this.setSessionAttr("order", order); this.render("/findOrder.jsp"); } }
d4d30f61df069a92c7044b1d76a8293239a52cfd
4da0d6c35a864675274f71c7784a70d56c8482c3
/src/com/class33/HW4.java
6bf00eed02e13431ec40b24e33e0509f81fbd2a8
[]
no_license
JaimeA1980/javaClasses
310b68dc13086aa57b689c9a5a948be6799b8b92
77e67cf4236878ef8b5db90f60b96e927f0e275a
refs/heads/master
2022-03-24T06:42:13.987952
2019-12-26T23:22:18
2019-12-26T23:22:18
219,891,288
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.class33; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class HW4 { public static void main(String[] args) { /* Create an arrayList of even numbers from 1 to 50. * Using Iterator remove any number that is divisible * by 5 from that arrayList. */ //creating an Object of arrayList and reffering to the List List<Integer> numbers = new ArrayList<>(); //removing number that are divisible by 5 using Iterator for (int i = 1; i<=50; i++) { if (i%2==0) { numbers.add(i); } } System.out.println(numbers); Iterator<Integer> it = numbers.iterator(); while (it.hasNext()) { if (it.next()%5==0) { it.remove(); } } System.out.println(numbers); } }
a9dada56faa60e302d46be52c6657e856bbc241c
6b1f32241df43667f2d05c21b1adc2d73f8f4a9d
/src/edu/caltech/cs2/lab08/Point.java
36cac65d4a74332d78f06031e3ec8049790dba67
[]
no_license
sashafomina/Othello-Bot
6f224abf8514862982e1bfd94dec79515ab00d76
16b0a781c99ed3a47c1be0aea3fd102a81a660ac
refs/heads/master
2020-12-27T01:16:41.423861
2020-02-02T04:06:47
2020-02-02T04:06:47
237,716,319
0
0
null
null
null
null
UTF-8
Java
false
false
626
java
package edu.caltech.cs2.lab08; public class Point { public int x; // x coordinate of point public int y; // y coordinate of point public Point parent; // Parent node of point (may be null) public Point(int x, int y) { this.x = x; this.y = y; this.parent = null; } /* * Returns true if the point passed has the same x and y coordinate as * this point, or false otherwise. */ public boolean isEqual(Point point) { if (point == null) return false; int x = point.x; int y = point.y; return (this.x == x && this.y == y); } }
410871acb0a2924e9bc5cb22ab1d0dace36aa642
52eb95308a93dc6c982dc0088fca9fb2b33e03cb
/core/src/main/java/com/example/core/provider/ProvideApiDataSource.java
c5af7ff47d513be6950f3d4ac1dda14605638eb2
[]
no_license
LucioDarcon/orama
ea77481ae7d1fcd6e15b3a30bc7b7b0b70e4d087
5010d0544b4be21212ac123866b57ac1f4c237ac
refs/heads/master
2023-04-28T08:35:34.964979
2021-05-14T01:17:22
2021-05-14T01:17:22
364,674,812
0
0
null
null
null
null
UTF-8
Java
false
false
441
java
package com.example.core.provider; import com.example.core.BuildConfig; import com.example.infrastructure.apidatasource.FundApiDataSource; public class ProvideApiDataSource { private static ApiDataSource provideApiDataSource() { return ApiDataSource.getInstance(BuildConfig.BASE_URL); } public static FundApiDataSource provideFundApiDataSource() { return provideApiDataSource().fundApiDataSource(); } }
6e0c866300a89c35a205ef49fc778b0b957e22b5
30609a76509f8c02d6e8d8d87bdeaeb90e485c58
/src/mx/com/certificacion/tema/tres/genericos/Test.java
18395145d3628e705bd9a1836b6ddea13a9ea1d9
[]
no_license
oxcesare/CertificacionJava8
cb90abd6890a9f43269e037b5d321121303a8bef
9053dcc352563f933d14c307df82339367508f43
refs/heads/master
2021-04-09T14:33:09.416014
2019-01-13T19:38:22
2019-01-13T19:38:22
125,762,062
0
0
null
null
null
null
UTF-8
Java
false
false
676
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 mx.com.certificacion.tema.tres.genericos; /** * * @author consultor006 */ public class Test { public static void main(String[] args) { String x="COHCD7098438F41D47B49191E9E505"; System.out.println(x.length()); String d ="PRE16110917410866919"; System.out.println(d.length()); System.out.println(""+x.substring(0,20)); } }
585c580894a05473ad95e2a071d2f2c4c181b593
0ea710a5c4fd70ced765ab54408e1c01ad41a6d8
/src/main/java/com/dsc/student_social_network/dto/GradeDto.java
f1953ee18eb9e66ff39edff17bed7519b5917705
[]
no_license
AndersonBarbosaDeFreitas/Student-Social-Network
a53b25cb97ee5308179ad5e7cbfad2b4a0fe3ff5
ba14bd003c0165dd86a38cc0c5fac5beac8c9323
refs/heads/main
2023-08-21T22:28:02.521650
2021-10-21T02:07:21
2021-10-21T02:07:21
397,782,660
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package com.dsc.student_social_network.dto; import lombok.Data; @Data public class GradeDto { private double grade; public GradeDto() { super(); } public GradeDto(double grade) { this.grade = grade; } }
b0a97684da6c8bb9458bc83704022127bd459eee
1aa7b1c75a96c222c1a3721d0c6195b6b716a7d2
/Document.java
ba36c22f5e020f85ff2dcb298d480b71be4c2b9f
[]
no_license
kiendt07/666
c8ce49f514e6f8eb3bef0b4acbbf2968c2df40c4
a4cb8ebe1c2d196a310835865eaa8907f69ceaf2
refs/heads/master
2020-05-30T22:51:14.950838
2016-06-08T05:41:13
2016-06-08T05:41:13
60,671,229
0
0
null
null
null
null
UTF-8
Java
false
false
1,223
java
import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; /** * Created by j on 07/06/2016. */ public class Document { private Analyzer analyzer; public static final int LINE_LENGTH = 130; public Document (InputStream source) throws WrongMode { this.analyzer = new Analyzer(source, Analyzer.DOCUMENT); analyzer.analyze(); } public Collection<WordInfo> getWordInfos() { WordList<String, WordInfo> list = analyzer.getWordList(); Collection<WordInfo> collection = new ArrayList<>(); for (WordInfo info : list.getList()) { if (info.getWord() instanceof NonSyllableWord) collection.add(info); } return collection; } public int getNonSyllableWords() { return getWordInfos().size(); } public int getParagraphs() { return analyzer.getParagraphs(); } public int getLines() { return analyzer.getLines(); } public int getWords() { return analyzer.getWords(); } public int getDistinceWords() { return analyzer.getDistinceWords(); } public int getLetters() { return analyzer.getLetters(); } }
25d61c1e992ba17fdaa1c82397ae18fc60500288
af1b90c961e6c8dfc0b4fcf9980a758faf4748d1
/src/Algorithm/package_total.java
05ba435e5075040713784b33df2f823a899ac442
[]
no_license
cchuhu/AlgorithmPratice
32884ed5f5ce107b7de6ff2f903fb263f0c7b5d6
a28a4d3d6d00702978d75620c2521957dcc5a132
refs/heads/master
2021-01-21T14:12:13.816452
2016-05-14T05:32:04
2016-05-14T05:32:04
55,901,502
0
0
null
null
null
null
UTF-8
Java
false
false
1,137
java
package Algorithm; /** * Created by zhangwen on 5/14/16. * 完全背包问题 */ public class package_total { public static void main(String[] args) { //物品的重量 int w[] = {5, 2, 6, 4}; //背包的价值 int v[] = {10, 20, 30, 50}; //背包总容量 int weight = 10; //表示背包价值的一维数组,value[i]表示当背包容量为i时对应的价值量 int value[] = new int[11]; //第一层循环表示放第j个物品 for (int j = 0; j < w.length; j++) { //注意i的起始条件,不能从0开始,若从0开始会数组越界. for (int i = w[j]; i < weight + 1; i++) { value[i] = ((value[i - w[j]] + v[j]) > value[i]) ? (value[i - w[j]] + v[j]) : (value[i]); } System.out.println("存放第" + j + "个物品时数组的状态:"); for (int i = 0; i < value.length; i++) { System.out.print(value[i] + " "); } System.out.println(""); } System.out.println("最大价值量为" + value[weight]); } }
005da5095dbc9418931604b07a39ab2b05b1c950
a7cdda31bdd89e93f73bf5c8f8e3cb3dcbd3bcf3
/OnlineBanking2/src/main/java/com/synex/service/MailService.java
15327d039ca086fbc07516a6b70090f13ad2cde4
[]
no_license
bk1613/spring-mircosoft-project
d5b33acf5b48a94e3eeec2372786c56c82696fdb
f4deb8fbf5a52be13b6604a60a9c1ec6420ed314
refs/heads/main
2023-03-23T23:33:46.410836
2021-03-07T02:55:37
2021-03-07T02:55:37
322,388,585
0
0
null
null
null
null
UTF-8
Java
false
false
806
java
package com.synex.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Service; import com.synex.domain.BankTransaction; @Service public class MailService { @Autowired JavaMailSender javaMailSender; public SimpleMailMessage sendEmailBTr(BankTransaction btr) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo("[email protected]"); message.setSubject(btr.getTransactionType() + " transaction " + " has been made"); message.setText("Your transaction has been made" + "\nThank you\n\nThis is a system generated message.\nPlease don't reply"); javaMailSender.send(message); return message; } }
7bd28e269b8976cd5e050130cd4ae39e8f4febea
933281e92d2af810fd442ba07d220e3f7d8d09c4
/src/main/java/com/car/demo/dao/entity/Template.java
67d3560f825cd222005b0242ec81f1e2633bc914
[]
no_license
OSCAR-super/javaCar
5ae3bffa225d0198abf296b400d013aeb8a63f6a
61bbe06264366ca14142b59a3cc5c58b6cf3713c
refs/heads/master
2023-05-10T11:09:07.772649
2021-06-13T06:59:23
2021-06-13T06:59:23
376,463,774
0
0
null
null
null
null
UTF-8
Java
false
false
1,909
java
package com.car.demo.dao.entity; import java.util.List; public class Template { private String touser; private String template_id; private String page; private List<TemplateParam> templateParamList; public String getTouser() { return touser; } public void setTouser(String touser) { this.touser = touser; } public String getTemplate_id() { return template_id; } public void setTemplate_id(String template_id) { this.template_id = template_id; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public String toJSON() { StringBuffer buffer = new StringBuffer(); buffer.append("{"); buffer.append(String.format("\"touser\":\"%s\"", this.touser)).append(","); buffer.append(String.format("\"template_id\":\"%s\"", this.template_id)).append(","); buffer.append(String.format("\"page\":\"%s\"", this.page)).append(","); buffer.append("\"data\":{"); TemplateParam param = null; for (int i = 0; i < this.templateParamList.size(); i++) { param = templateParamList.get(i); // 判断是否追加逗号 if (i < this.templateParamList.size() - 1) { buffer.append(String.format("\"%s\": {\"value\":\"%s\"},", param.getKey(), param.getValue())); } else { buffer.append(String.format("\"%s\": {\"value\":\"%s\"}", param.getKey(), param.getValue())); } } buffer.append("}"); buffer.append("}"); return buffer.toString(); } public List<TemplateParam> getTemplateParamList() { return templateParamList; } public void setTemplateParamList(List<TemplateParam> templateParamList) { this.templateParamList = templateParamList; } }
6d31c7ee16e6d66a9191dc09fe6e3cb81db53201
4e106fad1969eb3bba9ec958197a292cba3ef0ac
/android_study/Onulhalin-shop/onulshop/src/main/java/me/onulhalin/sample/onul_shop/model/Product.java
e43fbd0a4d968ade8abd4883505118b13c086b9b
[ "Apache-2.0" ]
permissive
louis-25/android_study
f025dc5960a604fad09bf46be4dac0116c7aa598
ba7b667124ca521b04d71f5334f55009ad220d83
refs/heads/master
2023-03-31T06:39:05.641443
2021-04-05T14:21:25
2021-04-05T14:21:25
309,548,228
0
0
null
null
null
null
UTF-8
Java
false
false
718
java
package me.onulhalin.sample.onul_shop.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class Product implements Serializable { public Long id; public String name; public String image; public int price; public int price_discount; public int stock; public int draft; public String description; public String status; public String created_at; public String last_update; public String userid; public String ptstart; public String ptend; public String delivery; public String type; public List<Category> categories = new ArrayList<>(); public List<ProductImage> product_images = new ArrayList<>(); }
6a00ed26d303d69a8d3ef53aff6303f4d6851548
d1e6fb03bd248f1e5255d4ab31eb18faf0b611a7
/src/com/hamit/dersler/Ders_032_static_final.java
f856447c82232a6efb2db96b8d2474c103516e1d
[]
no_license
hamitmizrak/java_12Grup
c6e4ab7ca0d945b514449465fe00b3773842943f
b64c5d79adcb8b87065ea48c464d64e6cad9a259
refs/heads/master
2023-07-19T01:08:27.130167
2021-09-12T23:43:13
2021-09-12T23:43:13
391,320,506
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package com.hamit.dersler; //javada 1 tane public class var (inner class) //javada static class yazamam (inner class) public final class Ders_032_static_final { //bu classı extends edemezsiniz. // static: new oluşturmadan nesneleri çağırmak için kullanıyoruz. durağan // 1 tane new oluşturuluru ve sonradan gelen nesneler hepsi oluşturulan new üzerinden devam eder. // bir static method başka bir değişkeni çağırmak istiyorsa diğer nesnede static olmak zorundadır. //final //1-) değişkenlerde sabitlemek için //2-) metotlarda kullanırsak @Override edemeyiz //3-) classlarda kullanırsak extends edemeyiz. public final double sabit=4; public void deneme() { System.out.println("bu metodu @Override edemezsiniz"); } //Sabitleyici public static final String DEGISKEN_ADI=" değiştirimezsin."; } class deneme2{}
69d05d5aa8690f98cbbba0e653f35d4b5e6eea4e
32ac531c4d0562b7b807c65bb7f8be7f1b1cee74
/src/main/java/com/github/pimvoeten/jpa/example/controllers/BookController.java
a224037440df1f46614838c6aad93a3a549653c2
[]
no_license
pimvoeten/jpa-example
b43810430986941f2616aca9ee02c945a3fcbbe5
6deb20ae684708fb5925e2367607aa16f8dacccc
refs/heads/master
2023-03-16T04:43:51.952104
2020-06-18T07:12:16
2020-06-18T07:12:16
260,645,443
0
0
null
null
null
null
UTF-8
Java
false
false
2,865
java
package com.github.pimvoeten.jpa.example.controllers; import com.github.pimvoeten.jpa.example.controllers.requestmodels.KnownBook; import com.github.pimvoeten.jpa.example.controllers.requestmodels.NewBook; import com.github.pimvoeten.jpa.example.controllers.responsemodels.BookDetails; import com.github.pimvoeten.jpa.example.controllers.responsemodels.Title; import com.github.pimvoeten.jpa.example.services.BookService; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.web.PageableDefault; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.validation.Valid; import java.util.UUID; @Slf4j @RestController @RequestMapping(path = "/books") public class BookController { @Resource private BookService bookService; @GetMapping public Page<Title> getListOfTitles( @PageableDefault( page = 0, size = 50, sort = {"title"}, direction = Sort.Direction.ASC ) Pageable pageable) { return bookService.getListOfTitles(pageable); } @GetMapping(path = "/count") public Long countBooks() { return bookService.countAllBooks(); } @GetMapping(path = "/{id}") public BookDetails getBookDetails(@PathVariable UUID id) { return bookService.getBook(id); } @GetMapping(path = "/{id}/2") public BookDetails getBookDetailsJoin(@PathVariable UUID id) { return bookService.getBookWithAuthors(id); } @GetMapping(path = "/{id}/3") public BookDetails getBookDetailsJoinNamed(@PathVariable UUID id) { return bookService.getBookWithAuthorsNamed(id); } @PostMapping public ResponseEntity<Title> createBook(@RequestBody @Valid NewBook newBook) { return bookService .createNewBook(newBook) .map(ResponseEntity::ok) .orElse(ResponseEntity.badRequest().build()); } @PutMapping(path = "/{id}") @ResponseStatus(HttpStatus.NO_CONTENT) public void updateBook(@RequestBody @Valid KnownBook book, @PathVariable UUID id) { bookService.updateBook(id, book); } }
[ "" ]
d1ca77fd3e9e2e16afbb0fee3793cfa6d5ef7155
55e013e75ab9bc7b97f054080a7b2523b75aed2a
/app/src/main/java/com/example/atame/minecraftrehber/FragmentCrafting.java
1503d284c1f84600a788a97732f2f44075493b28
[]
no_license
atameric/Rehber
446516dd8b72ed2bd30047157874ac17c90d0925
8510bf214da17a6b7da3d155276aff87d0050f78
refs/heads/master
2021-08-23T02:27:29.938259
2017-12-02T14:17:32
2017-12-02T14:17:32
112,847,936
0
0
null
null
null
null
UTF-8
Java
false
false
718
java
package com.example.atame.minecraftrehber; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; /** * Created by atame on 2.12.2017. */ public class FragmentCrafting extends Fragment { TextView textView; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_crafting,container,false); textView = (TextView) view.findViewById(R.id.textView); return view; } }
90e732338ecdc539941e881d1f2f20dfe3057bb5
a1fad8ea8dd0debbc5194c89ef3707a5a57429a1
/app/src/main/java/com/jiyun/asmodeus/xyxy/model/biz/IWorkDetail.java
abbdd0cff11da2af1d9735cadea20996d3db99ac
[]
no_license
Asmodeus0p/XYXY
3e21a5fcdba9b68be3080cb770421c2d6026ce82
6f667edf4ddb8296b5ea248cdde721576cd60f31
refs/heads/master
2020-03-15T12:03:54.782417
2018-05-14T12:03:41
2018-05-14T12:03:41
131,949,819
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.jiyun.asmodeus.xyxy.model.biz; import com.jiyun.asmodeus.xyxy.model.entity.WokDetailBean; import io.reactivex.Observable; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; public interface IWorkDetail { @FormUrlEncoded @POST("/v1/m/homewok/detail") Observable<WokDetailBean> loadWorkDetail(@Field("homewokId") int homewokId, @Field("loginUserId") Integer loginUserId); }
72bb3d594760fb2bf2cdfd1eda70b0b7a84e15e4
4798498079da3c6a8f728054d7a47995bfff41b8
/src/main/java/com/rsachdev/sandbox/Pizza/PizzaController.java
d535c762b526e6f611517e13eee058c30bde7f9b
[]
no_license
rsachdevch/PizzaService
18fd4cb36fd973c7baf058bf3a216b8ee5a8a166
f8cf291b570dc661480e8e3e6d923fc9dcd5fb4b
refs/heads/master
2020-03-21T07:20:38.804280
2018-06-28T09:44:24
2018-06-28T09:44:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,339
java
package com.rsachdev.sandbox.Pizza; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Optional; @RestController @RequestMapping("/pizzas") public class PizzaController { private PizzaRepository pizzaRepository; public PizzaController(PizzaRepository pizzaRepository){ this.pizzaRepository = pizzaRepository; } @GetMapping("/all") public List<Pizza> getAll(){ List<Pizza> pizzas = this.pizzaRepository.findAll(); return pizzas; } @GetMapping("/id/{id}") public Optional<Pizza> getById(@PathVariable("id") String id){ Optional<Pizza> pizza = this.pizzaRepository.findById(id); return pizza; } @GetMapping("/name/{name}") public Pizza getByName(@PathVariable("name") String name){ Pizza pizza = this.pizzaRepository.findByName(name); return pizza; } @PostMapping public void insert(@RequestBody Pizza pizza){ this.pizzaRepository.insert(pizza); } @PutMapping public void update(@RequestBody Pizza pizza){ this.pizzaRepository.save(pizza); } @GetMapping("pizzaId/{name}") public String getPizzaIdFromName(@PathVariable("name") String name){ Pizza pizza = this.pizzaRepository.findByName(name); return pizza.getId(); } }
cb022e5b10c5be88aa28109468a590c7db57088c
bce0b62b02cf0b867088709ec634a3ffc73aefa2
/utilitypackage/src/main/java/com/creative/utilitypackage/CloseSoftKeyBoardOnTouchOutside.java
326977654818a79cf4cb3ed053ffe1475e8b2346
[]
no_license
iHaiderAli/Utility-Package-App
e65e0e8646b2c8fef7b98e978ca9a2b0c5576c8a
25699cd3200f99fd19ea21f0b6c8a8e98723e967
refs/heads/master
2021-06-30T04:24:39.880891
2021-02-12T12:38:39
2021-02-12T12:38:39
213,633,288
2
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
package com.creative.utilitypackage; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; public class CloseSoftKeyBoardOnTouchOutside { Context context; public void setupUI(View view, final Context context) { // Set up touch listener for non-text box views to hide keyboard. if (!(view instanceof EditText)) { view.setOnTouchListener(new View.OnTouchListener() { @SuppressLint("ClickableViewAccessibility") public boolean onTouch(View v, MotionEvent event) { hideSoftKeyboard((Activity) context); return false; } }); } //If a layout container, iterate over children and seed recursion. if (view instanceof ViewGroup) { for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) { View innerView = ((ViewGroup) view).getChildAt(i); setupUI(innerView, context); } } } public void hideSoftKeyboard(Activity activity) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); if (inputMethodManager != null && activity.getCurrentFocus() != null) { inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); } } }
8acb2d96f43fd5f8d3db8e2be085185f25e56a50
4413f4ea52fb78ed833028d7b52346360d410f71
/src/main/java/com/icemetalpunk/totemessentials/items/essences/ItemEssenceGluttony.java
656130a8237ea3aea0754dde85885ed02bdc30e0
[]
no_license
IceMetalPunk/TotemEssentials
41b0b8458aac8dda6ff4254f62cf5491a5804860
f71b545cae9d8a2d83a220b41bdc15c7c170ea25
refs/heads/master
2021-01-20T06:17:07.909821
2017-11-01T04:32:53
2017-11-01T04:32:53
101,499,515
3
0
null
null
null
null
UTF-8
Java
false
false
276
java
package com.icemetalpunk.totemessentials.items.essences; public class ItemEssenceGluttony extends ItemEssenceBase { public ItemEssenceGluttony(String name) { super(name); } public ItemEssenceGluttony(String name, boolean isEnsouled) { super(name, isEnsouled); } }
7c53b328daf3972247e602bb914a10fd2e234307
72442cc0934df318460c772659e744c042b62f33
/app/src/main/java/com/example/irfan/exerproject/Activities/DetailsActivity.java
ca6b3efb1e57d0b72a14fcc121c802d6f6b1d186
[]
no_license
HamzaRajput007/Exer-Services
b02a77c60ba61657e80cbb87647ef84e544e9259
600cbb9951d6cd0d695c4aad48ce126ccee82dd1
refs/heads/master
2020-05-03T09:56:28.917949
2019-03-30T14:10:08
2019-03-30T14:10:08
178,566,609
1
0
null
null
null
null
UTF-8
Java
false
false
2,562
java
//package com.example.irfan.exerproject.Activities; // //import android.os.Bundle; //import android.support.v4.view.ViewPager; //import android.support.v7.app.AppCompatActivity; //import android.view.View; //import android.view.View.OnClickListener; //import android.widget.ImageView; //import android.widget.TextView; //import com.zamhtech.exer.Adapters.ViewPagerAdapter; //import com.zamhtech.exer.Fragments.ExclusiveDealsFragment; //import com.zamhtech.exer.Fragments.InfoFragment; //import com.zamhtech.exer.Fragments.LocationFragment; // //public class DetailsActivity extends AppCompatActivity { // static String name; // static int shopID; // TextView details_name_tv; // ImageView fav_btn; // private TabLayout tabLayout; // private ViewPager viewPager; // // /* renamed from: com.zamhtech.exer.Activities.DetailsActivity$1 */ // class C05531 implements OnClickListener { // int select = null; // // C05531() { // } // // public void onClick(View view) { // if (this.select % 2 == null) { // DetailsActivity.this.fav_btn.setImageResource(C0586R.drawable.ic_y_favorite_red); // } else { // DetailsActivity.this.fav_btn.setImageResource(C0586R.drawable.ic_n_favorite_white_); // } // this.select++; // } // } // // public static int getShopID() { // return shopID; // } // // public static String getShopName() { // return name; // } // // protected void onCreate(Bundle bundle) { // super.onCreate(bundle); // setContentView((int) C0586R.layout.activity_details); // this.details_name_tv = (TextView) findViewById(C0586R.id.details_name_tv); // this.fav_btn = (ImageView) findViewById(C0586R.id.details_image_fav); // this.fav_btn.setOnClickListener(new C05531()); // name = getIntent().getStringExtra("name"); // shopID = getIntent().getIntExtra("shopID", 0); // this.details_name_tv.setText(name); // this.viewPager = (ViewPager) findViewById(C0586R.id.viewpager); // bundle = new ViewPagerAdapter(getSupportFragmentManager()); // bundle.addFragment(new ExclusiveDealsFragment(), "Exclusive Deals"); // bundle.addFragment(new InfoFragment(), "Info"); // bundle.addFragment(new LocationFragment(), "Location"); // this.viewPager.setAdapter(bundle); // this.tabLayout = (TabLayout) findViewById(C0586R.id.tabs); // this.tabLayout.setupWithViewPager(this.viewPager); // } //}
962911f80ad60ee26e3a4ab708a1e4970a8a8dd8
2f58c2e3579be9ad51509b918389b55f9b42c1f3
/src/test/java/com/demo/petshopping/servicetest/ConfirmationServiceImplTest.java
30b90885cd9a2909635b5b351b7a244f879c2897
[]
no_license
LahariPotli/petshopping
a79e5a3fefb9bf85bab79987ed2a92d01c5cf3ce
d6c0615975875aff9fb7e3f41fe18fcd677416a0
refs/heads/master
2022-11-20T18:16:07.794792
2020-07-07T16:05:41
2020-07-07T16:05:41
277,724,208
1
0
null
null
null
null
UTF-8
Java
false
false
2,721
java
package com.demo.petshopping.servicetest; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import com.demo.petshopping.dao.ConfirmationDao; import com.demo.petshopping.dto.ConfirmationListResponseDto; import com.demo.petshopping.dto.PurchaseListDto; import com.demo.petshopping.exception.InvalidUserIdException; import com.demo.petshopping.model.Confirmation; import com.demo.petshopping.service.PetService; import com.demo.petshopping.serviceimpl.ConfirmationServiceImpl; @ExtendWith(MockitoExtension.class) public class ConfirmationServiceImplTest { @Mock ConfirmationDao confirmationDao; @InjectMocks ConfirmationServiceImpl confirmationServiceImpl; Confirmation confirmation =new Confirmation(); ConfirmationListResponseDto confirmationListResponseDto; @Mock PetService petsService; @BeforeEach public void setUp() { confirmationListResponseDto=new ConfirmationListResponseDto(); } @Test public void getPetsByUserId() { List<Confirmation> confirmation = new ArrayList<>(); PurchaseListDto responseDto = new PurchaseListDto(); responseDto.setPrice(5000); responseDto.setPetName("pug"); when(confirmationDao.findAllByUserId(1)).thenReturn(Optional.of(confirmation)); confirmationServiceImpl.getPetsByUserId(1); verify(confirmationDao).findAllByUserId(1); } @Test public void getPetsByUserId1() { List<Confirmation> confirmation = new ArrayList<>(); PurchaseListDto responseDto = new PurchaseListDto(); responseDto.setPrice(5000); responseDto.setPetName("pug"); when(confirmationDao.findAllByUserId(1)).thenReturn(Optional.ofNullable(confirmation)); confirmationServiceImpl.getPetsByUserId(1); verify(confirmationDao).findAllByUserId(1); } @Test public void getPetsByUserId2() throws InvalidUserIdException { PurchaseListDto responseDto = new PurchaseListDto(); responseDto.setPrice(5000); responseDto.setPetName("husky"); InvalidUserIdException exception = assertThrows(InvalidUserIdException.class, () -> { confirmationServiceImpl.getPetsByUserId(1); }); String expectedMessage = "no pets are purchased by this userId."; String actualMessage = exception.getMessage(); assertTrue(actualMessage.contains(expectedMessage)); } }
2ce28d42b02afd1927e4c6238785d28e87606261
a636258c60406f8db850d695b064836eaf75338b
/src-gen/com/rcss/humanresource/data/RchrEmployeeweekoffs.java
e2cba6bf3110eab3489539836c9a7fcf436cb5f5
[]
no_license
Afford-Solutions/openbravo-payroll
ed08af5a581fa41455f4e9b233cb182d787d5064
026fee4fe79b1f621959670fdd9ae6dec33d263e
refs/heads/master
2022-03-10T20:43:13.162216
2019-11-07T18:31:05
2019-11-07T18:31:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,497
java
/* ************************************************************************* * The contents of this file are subject to the Openbravo Public License * Version 1.1 (the "License"), being the Mozilla Public License * Version 1.1 with a permitted attribution clause; you may not use this * file except in compliance with the License. You may obtain a copy of * the License at http://www.openbravo.com/legal/license.html * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU * All portions are Copyright (C) 2008-2011 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ */ package com.rcss.humanresource.data; import java.util.Date; import org.openbravo.base.structure.ActiveEnabled; import org.openbravo.base.structure.BaseOBObject; import org.openbravo.base.structure.ClientEnabled; import org.openbravo.base.structure.OrganizationEnabled; import org.openbravo.base.structure.Traceable; import org.openbravo.model.ad.access.User; import org.openbravo.model.ad.system.Client; import org.openbravo.model.common.enterprise.Organization; /** * Entity class for entity Rchr_Employeeweekoffs (stored in table Rchr_Employeeweekoffs). * * NOTE: This class should not be instantiated directly. To instantiate this * class the {@link org.openbravo.base.provider.OBProvider} should be used. */ public class RchrEmployeeweekoffs extends BaseOBObject implements Traceable, ClientEnabled, OrganizationEnabled, ActiveEnabled { private static final long serialVersionUID = 1L; public static final String TABLE_NAME = "Rchr_Employeeweekoffs"; public static final String ENTITY_NAME = "Rchr_Employeeweekoffs"; public static final String PROPERTY_ID = "id"; public static final String PROPERTY_CLIENT = "client"; public static final String PROPERTY_ORGANIZATION = "organization"; public static final String PROPERTY_ACTIVE = "active"; public static final String PROPERTY_CREATIONDATE = "creationDate"; public static final String PROPERTY_CREATEDBY = "createdBy"; public static final String PROPERTY_UPDATED = "updated"; public static final String PROPERTY_UPDATEDBY = "updatedBy"; public static final String PROPERTY_EMPLOYEE = "employee"; public static final String PROPERTY_ONDATE = "ondate"; public static final String PROPERTY_ENDINGDATE = "endingDate"; public static final String PROPERTY_WEEKLYOFF = "weeklyOff"; public static final String PROPERTY_PROCESS = "process"; public RchrEmployeeweekoffs() { setDefaultValue(PROPERTY_ACTIVE, true); setDefaultValue(PROPERTY_PROCESS, false); } @Override public String getEntityName() { return ENTITY_NAME; } public String getId() { return (String) get(PROPERTY_ID); } public void setId(String id) { set(PROPERTY_ID, id); } public Client getClient() { return (Client) get(PROPERTY_CLIENT); } public void setClient(Client client) { set(PROPERTY_CLIENT, client); } public Organization getOrganization() { return (Organization) get(PROPERTY_ORGANIZATION); } public void setOrganization(Organization organization) { set(PROPERTY_ORGANIZATION, organization); } public Boolean isActive() { return (Boolean) get(PROPERTY_ACTIVE); } public void setActive(Boolean active) { set(PROPERTY_ACTIVE, active); } public Date getCreationDate() { return (Date) get(PROPERTY_CREATIONDATE); } public void setCreationDate(Date creationDate) { set(PROPERTY_CREATIONDATE, creationDate); } public User getCreatedBy() { return (User) get(PROPERTY_CREATEDBY); } public void setCreatedBy(User createdBy) { set(PROPERTY_CREATEDBY, createdBy); } public Date getUpdated() { return (Date) get(PROPERTY_UPDATED); } public void setUpdated(Date updated) { set(PROPERTY_UPDATED, updated); } public User getUpdatedBy() { return (User) get(PROPERTY_UPDATEDBY); } public void setUpdatedBy(User updatedBy) { set(PROPERTY_UPDATEDBY, updatedBy); } public RchrEmployee getEmployee() { return (RchrEmployee) get(PROPERTY_EMPLOYEE); } public void setEmployee(RchrEmployee employee) { set(PROPERTY_EMPLOYEE, employee); } public Date getOndate() { return (Date) get(PROPERTY_ONDATE); } public void setOndate(Date ondate) { set(PROPERTY_ONDATE, ondate); } public Date getEndingDate() { return (Date) get(PROPERTY_ENDINGDATE); } public void setEndingDate(Date endingDate) { set(PROPERTY_ENDINGDATE, endingDate); } public String getWeeklyOff() { return (String) get(PROPERTY_WEEKLYOFF); } public void setWeeklyOff(String weeklyOff) { set(PROPERTY_WEEKLYOFF, weeklyOff); } public Boolean isProcess() { return (Boolean) get(PROPERTY_PROCESS); } public void setProcess(Boolean process) { set(PROPERTY_PROCESS, process); } }
e0e4d0fb1f2ca87a1a1c5dca350f38faf7ed41c2
12839f57b865720691b863bf2eadfac1cb4d0135
/practice/src/abstractexample/abstractkeywords/interfacekeywords/printExample.java
6ce1c0062b0095460599ca5c74eb571630ae6ceb
[]
no_license
Sherry2117/Corejava
edb742bc51c779800b1ea821230633425164034e
8527ba16d1b0f03cf23557947b37eec695da42dd
refs/heads/main
2023-03-18T11:28:50.298851
2021-02-27T03:58:14
2021-02-27T03:58:14
329,503,867
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package abstractexample.abstractkeywords.interfacekeywords; interface printable { void print(); } public class printExample implements printable { @Override public void print() { System.out.println("Hello print"); } public static void main(String[] args) { printExample printExample = new printExample(); printExample.print(); } }
eb9faaba3a6819885aeb53d32b001f7292232d1f
1ee3270a461979c848195079fcb5b7d640d40f26
/backend/src/main/java/com/suveen/react/todoapp/service/impl/TodoHardCodedServiceImpl.java
4e85d77520de93fa8f779d3da394b9db017e0072
[]
no_license
SuveenVundavalli/FullStack-React-Spring-Boot-ToDo-App
f644493c5de65036e8bf7561f6bfe1a278a63430
38d41a687b8286825e8a4bd0eb5f8523da536258
refs/heads/master
2020-04-30T16:47:24.661917
2019-04-06T10:25:35
2019-04-06T10:25:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,709
java
package com.suveen.react.todoapp.service.impl; import com.suveen.react.todoapp.database.domain.Todo; import com.suveen.react.todoapp.service.TodoService; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.springframework.stereotype.Service; @Service("todoHardCodedService") public class TodoHardCodedServiceImpl implements TodoService { private static List<Todo> todos = new ArrayList<>(); private static Long idCounter = 0l; static { todos.add(new Todo(++idCounter, "admin", "Learn to dance", new Date(), false)); todos.add(new Todo(++idCounter, "admin", "Learn about Micro Services", new Date(), false)); todos.add(new Todo(++idCounter, "admin", "Learn React", new Date(), false)); } @Override public List<Todo> findAll(String username) { return todos; } @Override public Todo deleteById(Long id) { Todo todo = findById(id); if (todo == null || !todos.remove(todo)) { return null; } return todo; } @Override public Todo findById(Long id) { for (Todo todo : todos) { if (todo.getId() == id) { return todo; } } return null; } @Override public Todo save(Todo todo) { if (todo.getId() == null || todo.getId() == -1 || todo.getId() == 0) { todo.setId(++idCounter); todos.add(todo); } else { deleteById(todo.getId()); todos.add(todo); } System.out.println(String.format("--> todo: %s", todo)); return todo; } // @Override // public List<Todo> findAll(String username) { // return todos.stream() // .filter(todo -> todo.getUsername().equals(username)) // .collect(Collectors.toList()); // } }
38b989ab1ed490b892a86a876fa95ce20120f5e7
62dbd10ec4db71ce9fb621d419f4d086af7a42df
/app/src/main/java/umn/ac/id/chatapp/MainActivity.java
769f23876400fc7504a790d4eede01db56038047
[]
no_license
fedroaja/WeTalk
7a6d53c68e7aa56a144253d1985a63b04e22b65d
566416cb8cbb81d96cd4acd524b4c9d93ec618e4
refs/heads/master
2022-06-20T21:55:38.369862
2020-05-12T16:43:00
2020-05-12T16:43:00
263,244,955
0
0
null
null
null
null
UTF-8
Java
false
false
4,727
java
package umn.ac.id.chatapp; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import org.w3c.dom.Text; public class MainActivity extends AppCompatActivity { TextView tvRegister, tvForgetPassword; EditText etEmail, etPassword; Button btnLogin; FirebaseAuth auth; FirebaseUser firebaseUser; @Override protected void onStart() { super.onStart(); firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); //check if user is null if (firebaseUser != null){ if (firebaseUser.isEmailVerified()){ Intent intent = new Intent(MainActivity.this,ChatActivity.class); startActivity(intent); finish(); } } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); auth = FirebaseAuth.getInstance(); tvRegister = (TextView) findViewById(R.id.creatAcc); etEmail = (EditText) findViewById(R.id.etEmail); etPassword = (EditText) findViewById(R.id.etPassword); btnLogin = (Button) findViewById(R.id.btnLogin); tvForgetPassword = (TextView) findViewById(R.id.forgetPass); tvForgetPassword.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent IntentForgetPassword = new Intent(MainActivity.this, ResetPasswordActivity.class); startActivity(IntentForgetPassword); } }); tvRegister.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent IntentRegister = new Intent(MainActivity.this , RegisterActivity.class); startActivity(IntentRegister); } }); btnLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String txtEmail = etEmail.getText().toString(); String txtPassword = etPassword.getText().toString(); if (TextUtils.isEmpty(txtEmail) || TextUtils.isEmpty(txtPassword)){ Toast.makeText(MainActivity.this, "All fields are required ", Toast.LENGTH_SHORT).show(); }else { final ProgressDialog pd = new ProgressDialog(MainActivity.this); pd.setMessage("Log in"); pd.show(); auth.signInWithEmailAndPassword(txtEmail,txtPassword) .addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()){ firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); if (firebaseUser.isEmailVerified()){ pd.dismiss(); Intent intent = new Intent(MainActivity.this, ChatActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK ); startActivity(intent); finish(); }else { Toast.makeText(MainActivity.this, "Please Verify your email !", Toast.LENGTH_SHORT).show(); pd.dismiss(); } }else { Toast.makeText(MainActivity.this, "Authentication failed !", Toast.LENGTH_SHORT).show(); pd.dismiss(); } } }); } } }); } }
d3777c9d8254006d34c89ab1d796cb417dbbef1d
270d5ac24b98489569154641f4421773c50a059a
/src/main/java/com/qsmy/redis/entity/User.java
1b9d59087e0ca37ac153242b6e374757cdd7fb37
[]
no_license
qsmy0424/spring-boot-redis
53b67fd308e6a9578682a1a9bcf95a941ed1a178
bccf7150fcc465c52ec26834d53b55edb8b50bc3
refs/heads/master
2020-05-09T18:02:41.381901
2019-04-15T03:29:40
2019-04-15T03:29:40
181,323,880
0
0
null
null
null
null
UTF-8
Java
false
false
586
java
package com.qsmy.redis.entity; import java.io.Serializable; public class User implements Serializable { private String name; private Integer age; public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } @Override public String toString() { return "User{" + "name='" + name + '\'' + ", age=" + age + '}'; } }
421ddc3e7f660a0c2c699b3fd02bcc0f79ef7050
fbd7896a6371ded709dc0a98c5499a1574b277b4
/app/src/main/java/com/flipkart/todo/ToDoApplication.java
5251a76f8c99fc328d6088f27cdee5f38ed08b09
[]
no_license
antonybritto/Todo-APP
a479a324148c8a1aceef847bc2faeb90df0a6145
6cf112868279a0b2039fb085672aff0f7f308e45
refs/heads/master
2021-01-10T13:49:35.035530
2016-01-04T16:47:55
2016-01-04T16:47:55
46,771,043
2
1
null
null
null
null
UTF-8
Java
false
false
603
java
package com.flipkart.todo; import android.app.Application; import android.util.Log; import com.flipkart.todo.model.DBAdapter; /** * Created by monish.kumar on 30/11/15. */ public class ToDoApplication extends Application { DBAdapter dbAdapter; ServiceSchedular serviceSchedular; @Override public void onCreate() { super.onCreate(); Log.i("ToDoApplication", "application started"); dbAdapter = new DBAdapter(getApplicationContext()); serviceSchedular = new ServiceSchedular(getApplicationContext()); serviceSchedular.startReporting(); } }
284491017362a8276d9fcd70f86ca6ba99551507
6ed9c572b1fab0c9bb99fa9cbc69030ddcdb3150
/app/src/main/java/org/ecaib/todos/provider/base/AbstractCursor.java
7d54c83a7303948ba495071d1faa815285df4848
[]
no_license
46066294/Todos
8bf0216369f0f05361ef963a618901d437cfbc9e
94e4e990161c741a3aaa2cf382e3d3cd4de2880f
refs/heads/master
2021-01-22T00:24:42.461957
2017-02-14T16:35:41
2017-02-14T16:35:41
46,438,009
0
0
null
2015-11-18T18:14:08
2015-11-18T18:14:08
null
UTF-8
Java
false
false
2,322
java
package org.ecaib.todos.provider.base; import java.util.Date; import java.util.HashMap; import android.database.Cursor; import android.database.CursorWrapper; import android.provider.BaseColumns; public abstract class AbstractCursor extends CursorWrapper { private final HashMap<String, Integer> mColumnIndexes; public AbstractCursor(Cursor cursor) { super(cursor); mColumnIndexes = new HashMap<String, Integer>(cursor.getColumnCount() * 4 / 3, .75f); } public abstract long getId(); protected int getCachedColumnIndexOrThrow(String colName) { Integer index = mColumnIndexes.get(colName); if (index == null) { index = getColumnIndexOrThrow(colName); mColumnIndexes.put(colName, index); } return index; } public String getStringOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return getString(index); } public Integer getIntegerOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return getInt(index); } public Long getLongOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return getLong(index); } public Float getFloatOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return getFloat(index); } public Double getDoubleOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return getDouble(index); } public Boolean getBooleanOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return getInt(index) != 0; } public Date getDateOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return new Date(getLong(index)); } public byte[] getBlobOrNull(String colName) { int index = getCachedColumnIndexOrThrow(colName); if (isNull(index)) return null; return getBlob(index); } }
0bff402eba037a478d3fd32df04114d1e9ae6259
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/19/19_9915df1b747c38fe570f507d4ba6700e399e010f/DrawableGun/19_9915df1b747c38fe570f507d4ba6700e399e010f_DrawableGun_t.java
3ba7e6331fa0948c76daad76672ef5ddd994d6af
[]
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
11,459
java
//File: Bot.java //Purpose: Game Bot class. package edu.sru.andgate.bitbot.graphics; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.util.ArrayList; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.opengl.GLUtils; import edu.sru.andgate.bitbot.Bot; public class DrawableGun implements Drawable { float[] parameters; int ID = 0; int textureCount = 0; int MAX_TEXTURE_ARRAY_SIZE = 5; int SELECTED_TEXTURE = 0; float moveAngle = 90.0f; float moveStepSize = 0.05f; //1.7 MAX before tunneling ArrayList<Integer> textureHopper; ArrayList<Integer> layerIdList; boolean textureLoaded = false; BotLayer masterTurret; DrawableBot masterBot; int masterBotID = -1; int numLiveRounds = 0; float[][] bullets; public int numShotsFired=0; int[] liveRounds; int MAX_BULLETS = 4; float BOUNDING_RADIUS = 0.2f; int DAMAGE = 20; //35 float SPEED = 0.4f; float LIFESPAN = 6.0f; float BARREL_LENGTH = 0.8f; public FloatBuffer vertexBuffer; // buffer holding the vertices public float vertices[] = { -1.0f, -1.0f, 0.0f, // V1 - bottom left -1.0f, 1.0f, 0.0f, // V2 - top left 1.0f, -1.0f, 0.0f, // V3 - bottom right 1.0f, 1.0f, 0.0f // V4 - top right }; public FloatBuffer textureBuffer; // buffer holding the texture coordinates public float texture[] = { // Mapping coordinates for the vertices 0.0f, 1.0f, // top left (V2) 0.0f, 0.0f, // bottom left (V1) 1.0f, 1.0f, // top right (V4) 1.0f, 0.0f // bottom right (V3) }; //Texture pointer public int[] textures = new int[MAX_TEXTURE_ARRAY_SIZE]; public DrawableGun(DrawableBot bot, BotLayer turret) { //Attach to bot masterTurret = turret; masterBot = bot; // a float has 4 bytes so we allocate for each coordinate 4 bytes ByteBuffer byteBuffer = ByteBuffer.allocateDirect(vertices.length * 4); byteBuffer.order(ByteOrder.nativeOrder()); // allocates the memory from the byte buffer vertexBuffer = byteBuffer.asFloatBuffer(); // fill the vertexBuffer with the vertices vertexBuffer.put(vertices); // set the cursor position to the beginning of the buffer vertexBuffer.position(0); byteBuffer = ByteBuffer.allocateDirect(texture.length * 4); byteBuffer.order(ByteOrder.nativeOrder()); textureBuffer = byteBuffer.asFloatBuffer(); textureBuffer.put(texture); textureBuffer.position(0); parameters = new float[11]; textureHopper = new ArrayList<Integer>(MAX_TEXTURE_ARRAY_SIZE); //Initialize parameters parameters[0] = 0.3f; //tX parameters[1] = 0.1f; //tY parameters[2] = -5.0f; //tZ parameters[3] = 0.0f; //rotationAngle parameters[4] = 0.0f; //rX parameters[5] = 0.0f; //rY parameters[6] = 1.0f; //rZ parameters[7] = 0.85f; //sX 0.3 parameters[8] = 0.85f; //sY parameters[9] = 0.85f; //sZ parameters[10] = 1.0f; //textureUpdateFlag (NO = 0.0, YES = 1.0) (Avoid at all costs) //liveRounds = new ArrayList<Integer>(MAX_BULLETS); liveRounds = new int[MAX_BULLETS]; for(int i=0;i<MAX_BULLETS;i++) { liveRounds[i] = 0; } bullets = new float[MAX_BULLETS][4]; //Index -> LocX, LocY, Lifetime Remaining, Trajectory } @Override public void attachBot(Bot bot) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#getCurrentParameters() */ @Override public float[] getCurrentParameters() { return parameters; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#setTranslation(float, float, float) */ @Override public void setTranslation(float newTX, float newTY, float newTZ) { parameters[0] = newTX; parameters[1] = newTY; parameters[2] = newTZ; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#setRotation(float, float, float, float) */ @Override public void setRotation(float newAngle, float newRX, float newRY, float newRZ) { parameters[3] = newAngle; parameters[4] = newRX; parameters[5] = newRY; parameters[6] = newRZ; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#setRotationAngle(float) */ @Override public void setRotationAngle(float newAngle) { parameters[3] = newAngle; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#move(float, float, float) */ @Override public void moveByTouch(float speed) { // } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#move(float, float) */ @Override public void move(float angle, float stepSize) { float rise = (float)(Math.sin(angle * (Math.PI / 180)) * stepSize) + parameters[1]; float run = (float)(Math.cos(angle * (Math.PI / 180)) * stepSize) + parameters[0]; parameters[0] = run; parameters[1] = rise; } public void move() { float rise = (float)(Math.sin(moveAngle * (Math.PI / 180)) * moveStepSize) + parameters[1]; float run = (float)(Math.cos(moveAngle * (Math.PI / 180)) * moveStepSize) + parameters[0]; parameters[0] = run; parameters[1] = rise; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#setScale(float, float, float) */ @Override public void setScale(float newSX, float newSY, float newSZ) { parameters[7] = newSX; parameters[8] = newSY; parameters[9] = newSZ; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#setTextureUpdateFlag(float) */ @Override public void setTextureUpdateFlag(float flag) { parameters[10] = flag; } public void setBoundingRadius(float radius) { BOUNDING_RADIUS = radius; } public void onBoundaryCollision() { // //For now, flip angle and continue // moveAngle = Math.abs(moveAngle - 360.0f) % 360.0f; // parameters[3] = moveAngle + 90.0f; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#setSelectedTexture(int) */ @Override public void setSelectedTexture(int selectedTex) { SELECTED_TEXTURE = selectedTex; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#getSelectedTexture() */ @Override public int getSelectedTexture() { return SELECTED_TEXTURE; } /* public void setID(int id) { ID = id; } public int getID() { return ID; } */ /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#addTexture(int) */ @Override public void addTexture(int texturePointer) { textureHopper.add(texturePointer); } public void attachMasterBot(DrawableBot bot) { masterBot = bot; masterBotID = masterBot.ID; } public void setMasterBotID(int ID) { masterBotID = ID; } public void fire() { int workingBulletID = -1; //Get an available BulletID if(numLiveRounds < MAX_BULLETS) { for(int i=0;i<MAX_BULLETS;i++) { if(liveRounds[i] == 0) { workingBulletID = i; liveRounds[i] = 1; numLiveRounds++; break; } } } //If a bulletID was available, calculate bullet info if(workingBulletID != -1) { //Calculate Trajectory Info float trajectoryAngle = masterTurret.layerParameters[3]; float startingX = masterTurret.masterBotLayer.parameters[0] - ((float)(Math.sin(trajectoryAngle * (Math.PI / 180)) * BARREL_LENGTH)); float startingY = (float)(Math.cos(trajectoryAngle * (Math.PI / 180)) * BARREL_LENGTH) + masterTurret.masterBotLayer.parameters[1]; //Index -> LocX, LocY, Lifetime Remaining, Trajectory bullets[workingBulletID][0] = startingX; bullets[workingBulletID][1] = startingY; bullets[workingBulletID][2] = LIFESPAN; bullets[workingBulletID][3] = trajectoryAngle; numShotsFired++; } } public void update() { //Update live bullet positions, decrement lifetime remaining for(int i=0;i<MAX_BULLETS;i++) { if(liveRounds[i] == 1) { //Calculate next bullet x and y position float nextX = bullets[i][0] - ((float)(Math.sin(bullets[i][3] * (Math.PI / 180)) * SPEED)); float nextY = (float)(Math.cos(bullets[i][3] * (Math.PI / 180)) * SPEED) + bullets[i][1]; //Update Bullet Position bullets[i][0] = nextX; bullets[i][1] = nextY; //Decrement Lifespan bullets[i][2] -= 0.2f; //If the bullet has reached the end of its life, make it inactive if(bullets[i][2] <= 0) { liveRounds[i] = 0; numLiveRounds--; } } } } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#loadGLTexture(javax.microedition.khronos.opengles.GL10, android.content.Context, int) */ @Override public void loadGLTexture(GL10 gl, Context context, int curTexPointer) { Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),textureHopper.get(curTexPointer)); // generate one texture pointer gl.glGenTextures(1, textures, curTexPointer); // ...and bind it to our array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[curTexPointer]); // create nearest filtered texture gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); // Use Android GLUtils to specify a two-dimensional texture image from our bitmap GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); // Clean up bitmap.recycle(); //textureLoaded = true; } /* (non-Javadoc) * @see edu.sru.andgate.bitbot.graphics.Drawable#draw(javax.microedition.khronos.opengles.GL10) */ @Override public void draw(GL10 gl) { // bind the previously generated texture gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[SELECTED_TEXTURE]); // Point to our buffers gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Set the face rotation gl.glFrontFace(GL10.GL_CW); // Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); //Draw live rounds to screen for(int i=0;i<MAX_BULLETS;i++) { //If live round, prepare and draw if(liveRounds[i] == 1) { gl.glLoadIdentity(); //Translate Bullet gl.glTranslatef(bullets[i][0],bullets[i][1], -5.0f); //Translate Object //gl.glRotatef(parameters[3], parameters[4], parameters[5], parameters[6]); //Rotate Object gl.glScalef(0.2f, 0.2f, 0.2f); //Scale Object //Draw gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3); } } //Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); } }
4299924cd7b02617d55bf9cc9b6b6f62a97972cd
fb0c4caa5de127fb07211e52670c8f09753bddd5
/app/src/main/java/com/example/retrofitpractice2/model/Post.java
148ace9397b879f16d0f86414b1838ad69e4fcc4
[]
no_license
AFRIDI-2020/Android-retrofit-practice-for-nested-object
26aad431f1c0eba06b8516286b4d7aedb69ef8ef
e7b4a0bf283a48419a3267b52a2c553de74fc414
refs/heads/main
2023-03-15T11:22:30.892759
2021-03-10T05:44:05
2021-03-10T05:44:05
346,242,619
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
package com.example.retrofitpractice2.model; import com.google.gson.annotations.SerializedName; public class Post { private int userId; private int id; private String title; @SerializedName("body") private String text; public int getUserId() { return userId; } public int getId() { return id; } public String getTitle() { return title; } public String getText() { return text; } }
c217f0c893867389a4ec8d818f46111f4b4d6089
42c50e58c738d67fd65105172c3291fbedfc1ecb
/src/com/szit/arbitrate/chat/junit/ChatRoomServiceJunitTest.java
d0bb0bcecb1367978d2c4a4f7c735ae101b415bf
[]
no_license
xmxnkj/interact
44860df5ad4550f972c26a5bab32460d9228d5c2
f97b4631fc6bffcfc4606cac36286e6e59165f4e
refs/heads/master
2020-08-08T20:31:53.681178
2019-01-10T07:33:31
2019-01-10T07:33:31
213,910,518
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
package com.szit.arbitrate.chat.junit; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import com.szit.arbitrate.api.common.utils.BaseApiJunitTest; import com.szit.arbitrate.chat.service.ChatRoomService; import com.szit.arbitrate.client.service.NeteaseClientService; public class ChatRoomServiceJunitTest extends BaseApiJunitTest{ @Autowired private ChatRoomService service; @Autowired private NeteaseClientService neteaseClientService; @Test public void openNeteaseCloud(){ String clientid = "68b1340a-af83-40ce-8961-a30cc3589b6d"; neteaseClientService.createNeteaseCloudAccount(clientid); } }
35f08c39644e7cac6bc4dc8346a2ccce20f0eecd
07f9a5471e88e82026d87412241fbd69e80263a6
/app/src/main/java/com/somnus/androidanimatelayoutchanges/MainActivity.java
971741f24416add0454e3ba60333e7797ba95308
[]
no_license
SomnusWu/AndroidAnimateLayoutChanges
dd6afd3bfd2dafa777510caeb494712ec3ff757e
6171162b851aa0dd2239aba168d03a1c94308a55
refs/heads/master
2021-05-03T11:22:37.468211
2016-09-23T06:37:44
2016-09-23T06:37:44
68,987,244
2
0
null
null
null
null
UTF-8
Java
false
false
4,194
java
package com.somnus.androidanimatelayoutchanges; import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Toast; import java.util.Random; public class MainActivity extends AppCompatActivity { private LinearLayout mLinearLayout; private LinearLayout mll_layout_01; LayoutTransition mTransitioner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mLinearLayout = (LinearLayout) findViewById(R.id.ll_layout); mll_layout_01 = (LinearLayout) findViewById(R.id.ll_layout_01); mTransitioner = new LayoutTransition(); //入场动画:view在这个容器中消失时触发的动画 ObjectAnimator animIn = ObjectAnimator.ofFloat(null, "rotationY", 0f, 360f, 0f); mTransitioner.setAnimator(LayoutTransition.APPEARING, animIn); //出场动画:view显示时的动画 ObjectAnimator animOut = ObjectAnimator.ofFloat(null, "rotation", 0f, 90f, 0f); mTransitioner.setAnimator(LayoutTransition.DISAPPEARING, animOut); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("ADD", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_add) { Button button = new Button(MainActivity.this); button.setText("" + new Random().nextInt(100)); mLinearLayout.addView(button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mLinearLayout.removeView(view); } }); return true; } else if (id == R.id.action_add1) { //自定义动画 Button button = new Button(MainActivity.this); button.setText("" + new Random().nextInt(100)); mll_layout_01.addView(button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mll_layout_01.removeView(view); } }); mll_layout_01.setLayoutTransition(mTransitioner); } return super.onOptionsItemSelected(item); } @Override public void onBackPressed() { /*写在主页 , 按返回键返回桌面,不结束Activity*/ moveTaskToBack(true); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.d("tag",keyCode+""); Log.d("event",event.toString()); return super.onKeyDown(keyCode, event); } public void onAction(View v){ Toast.makeText(this, "啦啦啦", Toast.LENGTH_SHORT).show(); } }
29dddb94b15ed2f7d30af952f4dca10396ad6ece
16b96c455271d376931e1ed65fdcaa2b3eeac3f2
/src/main/java/com/artfactory/project01/todayart/model/MemberUpdate.java
6f4e0f3ef1a57a327ee7c6efcf415f740d61eece
[]
no_license
ksh9891/TodayArt
92f220578356f9dd406a11530ecae47ecc85c51d
7bc74e294ddebaaf44a7099fa88fcf7b4d693e8c
refs/heads/develop
2022-05-31T01:41:05.514224
2019-09-01T10:38:57
2019-09-01T10:38:57
200,626,668
0
0
null
2022-05-20T21:06:29
2019-08-05T09:39:18
Java
UTF-8
Java
false
false
344
java
package com.artfactory.project01.todayart.model; import com.artfactory.project01.todayart.entity.Member; import lombok.Getter; import lombok.Setter; import lombok.ToString; @Getter @Setter @ToString public class MemberUpdate { private String nickname; private String realName; private String phone; private String password; }
f0978be01e9e071a62fcd19f25986e15edf45f09
849de8ffbe1abba816a3effa5fb53a2b2902a676
/Semester-Project/app/src/main/java/com/example/myapplication/ProfileActivity.java
da77628bea73826a4f80ffe090ae8891041a1134
[]
no_license
mominaadar/Software-Design-Analysis
788249f0c08e4a246d8a003107ec456fde933145
e50125a61756310776e667683279a630f1f6d488
refs/heads/main
2023-03-14T10:55:05.066775
2021-03-05T20:23:41
2021-03-05T20:23:41
312,509,996
0
0
null
null
null
null
UTF-8
Java
false
false
2,922
java
package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; public class ProfileActivity extends AppCompatActivity{ Button btn_freecourses; Button btn_paidcourses; Button btn_mycourses; Button btn_faqs; Button btn_ask; Button btn_about; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); btn_freecourses = findViewById(R.id.freecourses); btn_freecourses.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent free_courses_intent = new Intent(ProfileActivity.this, FreeCourses.class); startActivity(free_courses_intent); } }); btn_paidcourses = findViewById(R.id.paidcourses); btn_paidcourses.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent paid_courses_intent = new Intent(ProfileActivity.this, PaidCourses.class); startActivity(paid_courses_intent); } }); btn_mycourses = findViewById(R.id.my_courses); btn_mycourses.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent mycourses_intent = new Intent(ProfileActivity.this, MyCourses.class); startActivity(mycourses_intent); } }); btn_faqs = findViewById(R.id.faqs); btn_faqs.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent paid_courses_intent = new Intent(ProfileActivity.this, FAQs.class); startActivity(paid_courses_intent); } }); btn_ask = findViewById(R.id.onlineguide); btn_ask.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uri = Uri.parse("https://docs.google.com/forms/d/e/1FAIpQLSfjShN-RgcZ8gQQhw-CMV4XuG7LJEP__Pscbl9TO9TMJR5f1g/viewform"); Intent btn_ask = new Intent(Intent.ACTION_VIEW, uri); startActivity(btn_ask); } }); btn_about = findViewById(R.id.about); btn_about.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent about_intent = new Intent(ProfileActivity.this, About.class); startActivity(about_intent); } }); } }
898d8b1eea913581c8b5b61dec2862977b3651fc
0c65977fabb1aa251423b4e470364f44c235aedb
/src/main/java/com/github/bookong/zest/runner/junit4/statement/package-info.java
8ecceaa76bf953621ad17e442b823e90165126c9
[ "Apache-2.0" ]
permissive
bookong/zest
f0c4fbc3ab3c1bf41dafa10f88aa1af74bccc49e
7f66b1ed9c0af60e2b2b94084f8daa91a081ecb9
refs/heads/master
2023-08-31T14:39:44.767516
2023-08-29T01:01:20
2023-08-29T01:01:20
21,806,007
20
2
Apache-2.0
2023-07-07T21:55:03
2014-07-14T03:11:57
Java
UTF-8
Java
false
false
732
java
/** * Copyright 2014-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Contains customized statements for JUnit 4. */ package com.github.bookong.zest.runner.junit4.statement;
7ba093cf5e4dbfed92ac35e265b416e00281361e
8ab35478380fd514bfdcede13c34575a3a9b8e5f
/demo1200-mvn/account-email/src/main/java/com/eplusing/mvnbook/account/email/AccountEmailServiceImpl.java
c0670b1e799700c31be14f83f27d94bddf022107
[]
no_license
eeplusing/demo1200
c7280b0ea88d2370f1d96046493d29b4c942794d
0e1b9ab39745340a4e3282cd46c04d2e54cd3032
refs/heads/master
2023-08-10T02:53:42.026829
2023-07-22T03:38:04
2023-07-22T03:38:04
154,924,736
1
0
null
2022-12-16T02:16:33
2018-10-27T04:10:35
Java
UTF-8
Java
false
false
1,184
java
package com.eplusing.mvnbook.account.email; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; public class AccountEmailServiceImpl implements AccountEmailService { private JavaMailSender javaMailSender; private String systemEmail; public void sendMail(String to, String subject, String html) throws MessagingException { try { MimeMessage msg = javaMailSender.createMimeMessage(); MimeMessageHelper msgHelper = new MimeMessageHelper(msg); msgHelper.setFrom(systemEmail); msgHelper.setTo(to); msgHelper.setSubject(subject); msgHelper.setText(html); javaMailSender.send(msg); } catch (MessagingException e) { throw new MessagingException("Fail to send mail.", e); } } public JavaMailSender getJavaMailSender() { return javaMailSender; } public void setJavaMailSender(JavaMailSender javaMailSender) { this.javaMailSender = javaMailSender; } public String getSystemEmail() { return systemEmail; } public void setSystemEmail(String systemEmail) { this.systemEmail = systemEmail; } }
bc7c983b63674e196788f1f2ad25eae69ae58911
320009e47bf3eb6e0092e90fa444d436a28605b2
/topico3/src/main/java/br/ufg/inf/es/integracao/questao4/Vinculo.java
9cfe9d8e38ef0483a0d14f3665d4b866fd330d08
[]
no_license
BeatrizN/i-2018
d4f38cb8bf689113f4eee504ab6fed1a0d3e5fc6
530fb7f9527bd8771e6ae2ff87d558048a90a01e
refs/heads/master
2021-04-12T05:33:13.868981
2018-06-11T01:02:56
2018-06-11T01:02:56
125,933,407
0
1
null
2018-05-21T01:59:47
2018-03-19T23:27:02
Java
UTF-8
Java
false
false
1,385
java
/* * Copyright (c) 2018. * Beatriz Nogueira Carvalho da Silveira * Creative Commons Attribution 4.0 International License. */ package br.ufg.inf.es.integracao.questao4; import java.util.Calendar; /** * Classe que cria uma instância de vinculo. */ public class Vinculo { private String relacionamento; private Calendar dataInicio; private Calendar dataFim; /** * Método que retorna o valor do atributo relacionamento. */ public String getRelacionamento() { return relacionamento; } /** * Método de acesso ao atributo relacionamento. */ public void setRelacionamento(String relacionamento) { this.relacionamento = relacionamento; } /** * Método que retorna o valor do atributo data inicial. */ public Calendar getDataInicio() { return dataInicio; } /** * Método de acesso ao atributo data inicial. */ public void setDataInicio(Calendar dataInicio) { this.dataInicio = dataInicio; } /** * Método que retorna o valor do atributo data de fim. */ public Calendar getDataFim() { return dataFim; } /** * Método de acesso ao atributo data de fim. */ public void setDataFim(Calendar dataFim) { this.dataFim = dataFim; } }
0695335a103d073f001ffcbfc50c2012508f8dc2
eca6896d5817895866beb624a7fd44e16814bddc
/app/src/main/java/com/example/myapplication/Myservice.java
a9dc245472ed30e68df44cef44e706ee5430f87e
[]
no_license
shehzadkhan984/MyApplication
3837e2fa9db1642e50ca1732bea199689ae70988
c7e994b64911eeac4f256cd2bac273c421fe700d
refs/heads/main
2023-03-19T15:38:01.068703
2021-03-15T18:17:22
2021-03-15T18:17:22
327,527,054
0
0
null
null
null
null
UTF-8
Java
false
false
30,034
java
package com.example.myapplication; import android.app.Activity; import android.app.Service; import android.content.Context; import android.content.Intent; import android.media.AudioAttributes; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.SoundPool; import android.os.Build; import android.os.CountDownTimer; import android.os.Handler; import android.os.IBinder; import android.provider.MediaStore; import android.util.Log; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.io.IOException; import java.security.Provider; public class Myservice extends Service { public MediaPlayer player = null; public MediaPlayer player1; public MediaPlayer player2; public MediaPlayer player3; public MediaPlayer player4; private SoundPool soundPool; private int sound1,sound2,sound3,sound4,sound5,sound6,sound7,sound8,sound9,sound10,sound11,sound12,sound13,sound14,sound15,sound16,sound17,sound18,sound19,sound20,sound21; private int sound1id,sound2id,sound3id,sound4id,sound5id,sound6id,sound7id,sound8id,sound9id,sound10id,sound11id,sound12id,sound13id,sound14id,sound15id,sound16id,sound17id,sound18id,sound19id,sound20id,sound21id; //player1,player2,player3,player4,player5,player6,player7; FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference myref2 = database.getReference("Sensors"); DatabaseReference myref3 = database.getReference("Notification"); DatabaseReference myref4 = database.getReference("Water"); DatabaseReference myref5 = database.getReference("ground"); DatabaseReference myref6 = database.getReference("iot"); private Context mContext; private Myservice mActivity; @Nullable @Override public IBinder onBind(Intent intent) { return null; } public void onCreate() { Toast.makeText(this,"Service create",Toast.LENGTH_SHORT).show(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ){ AudioAttributes audioAttributes = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_GAME) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) .build(); soundPool = new SoundPool.Builder().setMaxStreams(22).setAudioAttributes(audioAttributes).build(); }else{ soundPool = new SoundPool(22, AudioManager.STREAM_MUSIC,0); } sound1 = soundPool.load(this,R.raw.left,1); sound2 = soundPool.load(this,R.raw.front,1); sound3 = soundPool.load(this,R.raw.right,1); sound4 = soundPool.load(this,R.raw.stairs,1); sound5 = soundPool.load(this,R.raw.ditch,1); sound6 = soundPool.load(this,R.raw.front_left,1); sound7 = soundPool.load(this,R.raw.left_right,1); sound8 = soundPool.load(this,R.raw.everything,1); sound9 = soundPool.load(this,R.raw.everything,1); sound10 = soundPool.load(this,R.raw.front_right,1); sound11 = soundPool.load(this,R.raw.front_stair,1); sound12 = soundPool.load(this,R.raw.front_ditch,1); sound13 = soundPool.load(this,R.raw.everything,1); sound14 = soundPool.load(this,R.raw.everything,1); sound15 = soundPool.load(this,R.raw.everything,1); sound16 = soundPool.load(this,R.raw.everything,1); sound17 = soundPool.load(this,R.raw.everything,1); sound18 = soundPool.load(this,R.raw.everything,1); sound19 = soundPool.load(this,R.raw.everything,1); sound20 = soundPool.load(this,R.raw.water,1); sound21 = soundPool.load(this,R.raw.emergency,1); } public void onStart(Intent intent, int startid){ Toast.makeText(this, "Service Start", Toast.LENGTH_SHORT).show(); mContext = getApplicationContext(); mActivity = Myservice.this; ValueEventListener listener2 = myref6.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { int distance1 = snapshot.child("obstacle_sensor1").getValue(int.class); int distance2 = snapshot.child("obstacle_sensor2").getValue(int.class); int distance3 = snapshot.child("obstacle_sensor3").getValue(int.class); int distance4 = snapshot.child("ditch_stair_sensor").getValue(int.class); int WaterState0 = snapshot.child("water").getValue(int.class); int ButtonState1 = snapshot.child("noti").getValue(int.class); if(distance1 == 1 && distance2 == 0 && distance3 == 0 && distance4 == 0 && WaterState0 == 0 && ButtonState1 == 0){ // left sensor soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound1id = soundPool.play(sound1,1,1,0,0,1); } else if(distance1 == 0 && distance2 == 1 && distance3 == 0 && distance4 == 0 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound2id = soundPool.play(sound2,1,1,0,0,1); } else if(distance1 == 0 && distance2 == 0 && distance3 == 1 && distance4 == 0 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound3id = soundPool.play(sound3,1,1,0,0,1); } else if(distance1 == 0 && distance2 == 0 && distance3 == 0 && distance4 == 1 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound4id = soundPool.play(sound4,1,1,0,0,1); } else if(distance1 == 0 && distance2 == 0 && distance3 == 0 && distance4 == 2 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound5id = soundPool.play(sound5,1,1,0,0,1); } else if(distance1 == 1 && distance2 == 1 && distance3 == 0 && distance4 == 0 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound6id = soundPool.play(sound6,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 0 && distance3 == 1 && distance4 == 0 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound7id = soundPool.play(sound7,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 0 && distance3 == 0 && distance4 == 1 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound8id = soundPool.play(sound8,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 0 && distance3 == 0 && distance4 == 2 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound9id = soundPool.play(sound9,1,1,0,0,1); // left and front } else if(distance1 == 0 && distance2 == 1 && distance3 == 1 && distance4 == 0 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound10id = soundPool.play(sound10,1,1,0,0,1); // left and front } else if(distance1 == 0 && distance2 == 1 && distance3 == 0 && distance4 == 1 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound11id = soundPool.play(sound11,1,1,0,0,1); // left and front } else if(distance1 == 0 && distance2 == 1 && distance3 == 0 && distance4 == 2 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound12id = soundPool.play(sound12,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 1 && distance3 == 1 && distance4 == 0 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound13id = soundPool.play(sound13,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 1 && distance3 == 0 && distance4 == 1 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound14id = soundPool.play(sound14,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 1 && distance3 == 0 && distance4 == 2 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound15id = soundPool.play(sound15,1,1,0,0,1); // left and front } else if(distance1 == 0 && distance2 == 1 && distance3 == 1 && distance4 == 1 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound16id = soundPool.play(sound16,1,1,0,0,1); // left and front } else if(distance1 == 0 && distance2 == 1 && distance3 == 1 && distance4 == 2 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound17id = soundPool.play(sound17,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 1 && distance3 == 1 && distance4 == 1 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound19id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound18id = soundPool.play(sound18,1,1,0,0,1); // left and front } else if(distance1 == 1 && distance2 == 1 && distance3 == 1 && distance4 == 2 && WaterState0 == 0 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound20id); soundPool.pause(sound21id); sound19id = soundPool.play(sound19,1,1,0,0,1); // left and front }else if(WaterState0 == 1 && ButtonState1 == 0){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound21id); sound20id = soundPool.play(sound20,1,1,0,0,1); }else if(ButtonState1 == 1){ soundPool.pause(sound1id); soundPool.pause(sound2id); soundPool.pause(sound3id); soundPool.pause(sound4id); soundPool.pause(sound5id); soundPool.pause(sound6id); soundPool.pause(sound7id); soundPool.pause(sound8id); soundPool.pause(sound9id); soundPool.pause(sound10id); soundPool.pause(sound11id); soundPool.pause(sound12id); soundPool.pause(sound13id); soundPool.pause(sound14id); soundPool.pause(sound15id); soundPool.pause(sound16id); soundPool.pause(sound17id); soundPool.pause(sound18id); soundPool.pause(sound19id); soundPool.pause(sound20id); sound21id = soundPool.play(sound21,1,1,0,0,1); } } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } public void onDestroy(){ Toast.makeText(this, "Service Stopped", Toast.LENGTH_SHORT).show(); soundPool.release(); soundPool = null; } }
18fc23c70c2fb42055a5d2999d628528599bd195
22ea7d3c6a9358e7195bd49cab97a4ea511b4408
/src/com/detail0805/principle/demeter/improve/Demeter1.java
20b1dc90e15bf098f29ee2c8ddfbe9392661b164
[ "Apache-2.0" ]
permissive
Detail0805/DesingPattern
14a63836d10a54fcf9081be3c9924ad9fa588dfc
ad9fb577c46c31ba72f376e15a954a96cb96a5be
refs/heads/master
2022-03-04T12:41:52.371504
2019-11-08T02:20:35
2019-11-08T02:20:35
114,344,897
1
0
null
null
null
null
UTF-8
Java
false
false
2,443
java
package com.detail0805.principle.demeter.improve; import java.util.ArrayList; import java.util.List; //客戶端 public class Demeter1 { public static void main(String[] args) { System.out.println("~~~使用迪米特法則的改進~~~"); //建立了一個 SchoolManager 對像 SchoolManager schoolManager = new SchoolManager(); //輸出學院的員工id 和 學校總部的員工資訊 schoolManager.printAllEmployee(new CollegeManager()); } } //學校總部員工類 class Employee { private String id; public void setId(String id) { this.id = id; } public String getId() { return id; } } //學院的員工類 class CollegeEmployee { private String id; public void setId(String id) { this.id = id; } public String getId() { return id; } } //管理學院員工的管理類 class CollegeManager { //返回學院的所有員工 public List<CollegeEmployee> getAllEmployee() { List<CollegeEmployee> list = new ArrayList<CollegeEmployee>(); for (int i = 0; i < 10; i++) { //這裡我們增加了10個員工到 list CollegeEmployee emp = new CollegeEmployee(); emp.setId("學院員工id= " + i); list.add(emp); } return list; } //輸出學院員工的資訊 public void printEmployee() { //獲取到學院員工 List<CollegeEmployee> list1 = getAllEmployee(); System.out.println("------------學院員工------------"); for (CollegeEmployee e : list1) { System.out.println(e.getId()); } } } //學校管理類 //分析 SchoolManager 類的直接朋友類有哪些 Employee、CollegeManager //CollegeEmployee 不是 直接朋友 而是一個陌生類,這樣違背了 迪米特法則 class SchoolManager { //返回學校總部的員工 public List<Employee> getAllEmployee() { List<Employee> list = new ArrayList<Employee>(); for (int i = 0; i < 5; i++) { //這裡我們增加了5個員工到 list Employee emp = new Employee(); emp.setId("學校總部員工id= " + i); list.add(emp); } return list; } //該方法完成輸出學校總部和學院員工資訊(id) void printAllEmployee(CollegeManager sub) { //分析問題 //1. 將輸出學院的員工方法,封裝到CollegeManager sub.printEmployee(); //獲取到學校總部員工 List<Employee> list2 = this.getAllEmployee(); System.out.println("------------學校總部員工------------"); for (Employee e : list2) { System.out.println(e.getId()); } } }
ec248923e5f77578aebef7a0d2496756c45f4891
98f4398c82940632a495f146c6536465a89c8c0a
/gen/org/rhok/pta/sifiso/donatemystuff/R.java
8453f8fd00ce336c078f43c9a6bbda3d779b8520
[]
no_license
ishmaelmakitla/donate-my-stuff-za-mobile
ad7175d9d5c0465e45ac6a21dd1f0225a28ccb64
07a2c5298abddabef05b04882bd85d8a299517d1
refs/heads/master
2021-01-10T22:13:27.303795
2014-12-07T20:47:04
2014-12-07T20:47:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,225
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package org.rhok.pta.sifiso.donatemystuff; public final class R { public static final class anim { public static final int cycle_7=0x7f040000; public static final int fade=0x7f040001; public static final int fly_in=0x7f040002; public static final int hold=0x7f040003; public static final int hyperspace_in=0x7f040004; public static final int hyperspace_out=0x7f040005; public static final int layout_animation_row_left_slide=0x7f040006; public static final int layout_animation_row_right_slide=0x7f040007; public static final int layout_animation_table=0x7f040008; public static final int layout_bottom_to_top_slide=0x7f040009; public static final int layout_grid_fade=0x7f04000a; public static final int layout_grid_inverse_fade=0x7f04000b; public static final int layout_random_fade=0x7f04000c; public static final int layout_wave_scale=0x7f04000d; public static final int push_left_in=0x7f04000e; public static final int push_left_out=0x7f04000f; public static final int push_up_in=0x7f040010; public static final int push_up_out=0x7f040011; public static final int shake=0x7f040012; public static final int slide_left=0x7f040013; public static final int slide_right=0x7f040014; public static final int slide_top_to_bottom=0x7f040015; public static final int up_from_bottom=0x7f040016; public static final int wave_scale=0x7f040017; public static final int zoom_enter=0x7f040018; public static final int zoom_exit=0x7f040019; } public static final class array { public static final int donatio_items=0x7f080002; public static final int gender_data=0x7f080003; public static final int get_provinces=0x7f080009; public static final int get_type=0x7f080006; public static final int get_type_Beneficiary=0x7f080008; public static final int get_type_donor=0x7f080007; /** Nav Drawer List Item Icons Keep them in order as the titles are in */ public static final int nav_drawer_icons=0x7f080001; /** Nav Drawer Menu Items */ public static final int nav_drawer_items=0x7f080000; public static final int uniform_pants=0x7f080005; public static final int uniform_upper=0x7f080004; } public static final class attr { } public static final class color { public static final int counter_text_bg=0x7f050004; public static final int counter_text_color=0x7f050005; public static final int custom_theme_color=0x7f05000f; public static final int dividerColor=0x7f05000e; public static final int green=0x7f050008; public static final int greenText=0x7f05000c; public static final int grey=0x7f050007; public static final int greyPost=0x7f050009; public static final int greyTime=0x7f05000b; public static final int list_background=0x7f050001; public static final int list_background_pressed=0x7f050002; public static final int list_divider=0x7f050003; public static final int list_item_title=0x7f050000; public static final int navBackground=0x7f05000d; public static final int navFont=0x7f05000a; public static final int white=0x7f050006; } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f060000; public static final int activity_vertical_margin=0x7f060001; public static final int spacing=0x7f060002; } public static final class drawable { public static final int bg_sky=0x7f020000; public static final int blanket=0x7f020001; public static final int blankets=0x7f020002; public static final int book=0x7f020003; public static final int books=0x7f020004; public static final int card_placeholder=0x7f020005; public static final int card_shadow=0x7f020006; public static final int cloth=0x7f020007; public static final int clothes=0x7f020008; public static final int corner=0x7f020009; public static final int cosmo=0x7f02000a; public static final int counter_bg=0x7f02000b; public static final int gradient=0x7f02000c; public static final int ic_action_overflow=0x7f02000d; public static final int ic_action_previous_item=0x7f02000e; public static final int ic_action_refresh=0x7f02000f; public static final int ic_communities=0x7f020010; public static final int ic_drawer=0x7f020011; public static final int ic_home=0x7f020012; public static final int ic_launcher=0x7f020013; public static final int ic_pages=0x7f020014; public static final int ic_people=0x7f020015; public static final int ic_photos=0x7f020016; public static final int ic_whats_hot=0x7f020017; public static final int list=0x7f020018; public static final int list_focused_cinema=0x7f020019; public static final int list_item_bg_normal=0x7f02001a; public static final int list_item_bg_pressed=0x7f02001b; public static final int list_selector=0x7f02001c; public static final int log_button=0x7f02001d; public static final int pressed_background_cinema=0x7f02001e; public static final int result=0x7f02001f; public static final int round=0x7f020020; public static final int round_l=0x7f020021; public static final int selectable_background_cinema=0x7f020022; public static final int shoe=0x7f020023; public static final int shoes=0x7f020024; public static final int uniform=0x7f020025; } public static final class id { public static final int action_settings=0x7f0b005b; public static final int areaname=0x7f0b0037; public static final int back_icon =0x7f0b005c; public static final int blanketSubmit=0x7f0b0004; public static final int bookAge=0x7f0b0009; public static final int bookAgeRest=0x7f0b000d; public static final int bookName=0x7f0b0005; public static final int bookQuantity=0x7f0b000b; public static final int bookSize=0x7f0b0007; public static final int bookSubmit=0x7f0b0010; public static final int chkCollect=0x7f0b0026; public static final int chkDeliver=0x7f0b005a; public static final int chkUniformBlazer=0x7f0b0045; public static final int city=0x7f0b0038; public static final int clickView2=0x7f0b004a; public static final int clothGender=0x7f0b0013; public static final int clothName=0x7f0b0011; public static final int clothQuantity=0x7f0b0014; public static final int clothSize=0x7f0b0012; public static final int clothSubmit=0x7f0b0015; public static final int counter=0x7f0b0053; public static final int create_account=0x7f0b001e; public static final int deliver=0x7f0b004b; public static final int description=0x7f0b0022; public static final int donated_date=0x7f0b004e; public static final int donor_id=0x7f0b0016; public static final int donor_quantity=0x7f0b004f; public static final int drawer_layout=0x7f0b001f; public static final int email=0x7f0b002d; public static final int frame_container=0x7f0b0020; public static final int gridview=0x7f0b0050; public static final int icon=0x7f0b0051; public static final int imageView1=0x7f0b0001; public static final int isbn=0x7f0b000f; public static final int item=0x7f0b0049; public static final int item_code=0x7f0b0018; public static final int item_name=0x7f0b0017; public static final int layout_root=0x7f0b0056; public static final int listRequest=0x7f0b0046; public static final int list_slidermenu=0x7f0b0021; public static final int log_password=0x7f0b001c; public static final int log_submit=0x7f0b001d; public static final int log_username=0x7f0b001b; public static final int logingSubmit=0x7f0b003b; public static final int logo=0x7f0b004d; public static final int mobile=0x7f0b002b; public static final int name=0x7f0b0028; public static final int opt_quantity=0x7f0b0059; public static final int pager=0x7f0b0041; public static final int passowrd=0x7f0b002f; public static final int quantity=0x7f0b0003; public static final int radioBeneficary=0x7f0b0032; public static final int radioDonor=0x7f0b0031; public static final int rdRole=0x7f0b0030; public static final int recarga_thumb=0x7f0b0048; public static final int registerSubmit=0x7f0b003a; public static final int requestSubmit=0x7f0b001a; public static final int result=0x7f0b0047; public static final int scrollView1=0x7f0b0000; public static final int section_label=0x7f0b0055; public static final int shoeGender=0x7f0b003e; public static final int shoeName=0x7f0b003c; public static final int shoeQuantity=0x7f0b003f; public static final int shoeSize=0x7f0b003d; public static final int shoeSubmit=0x7f0b0040; public static final int size=0x7f0b004c; public static final int spGender=0x7f0b002a; public static final int spProvince=0x7f0b0039; public static final int spType=0x7f0b0033; public static final int streetname=0x7f0b0036; public static final int surname=0x7f0b0029; public static final int telephone=0x7f0b002c; public static final int textView1=0x7f0b0002; public static final int textView2=0x7f0b0006; public static final int textView3=0x7f0b0008; public static final int textView4=0x7f0b000a; public static final int textView5=0x7f0b000c; public static final int textView6=0x7f0b000e; public static final int title=0x7f0b0052; public static final int tvPromptLabel=0x7f0b0057; public static final int txtIsbn=0x7f0b0019; public static final int txtLabel=0x7f0b0054; public static final int type=0x7f0b0025; public static final int uniformGender=0x7f0b0043; public static final int uniformPants=0x7f0b0023; public static final int uniformQuantity=0x7f0b0044; public static final int uniformShirts=0x7f0b0042; public static final int uniformSize=0x7f0b0024; public static final int uniformSubmit=0x7f0b0027; public static final int unitname=0x7f0b0035; public static final int unitnumber=0x7f0b0034; public static final int userInput=0x7f0b0058; public static final int username=0x7f0b002e; } public static final class layout { public static final int activity_blanket_donation=0x7f030000; public static final int activity_book_donate=0x7f030001; public static final int activity_cloth_donation=0x7f030002; public static final int activity_detail_item_view=0x7f030003; public static final int activity_login=0x7f030004; public static final int activity_main=0x7f030005; public static final int activity_make_request=0x7f030006; public static final int activity_register_donor=0x7f030007; public static final int activity_shoes_donation=0x7f030008; public static final int activity_tap_fragment=0x7f030009; public static final int activity_unbidded_request=0x7f03000a; public static final int activity_uniforms_donation=0x7f03000b; public static final int activity_view_request=0x7f03000c; public static final int cards=0x7f03000d; public static final int customize_offer_list=0x7f03000e; public static final int customize_request_list=0x7f03000f; public static final int detail_request_items=0x7f030010; public static final int donate=0x7f030011; public static final int donate_fragment=0x7f030012; public static final int drawer_list_item=0x7f030013; public static final int fragment_home=0x7f030014; public static final int fragment_main_dummy=0x7f030015; public static final int fragment_request=0x7f030016; public static final int items_prompt_layout=0x7f030017; public static final int promp_dialog=0x7f030018; } public static final class menu { public static final int blanket_donation=0x7f0a0000; public static final int book_donate=0x7f0a0001; public static final int cloth_donation=0x7f0a0002; public static final int detail_item_view=0x7f0a0003; public static final int fragment_request=0x7f0a0004; public static final int home_fragment=0x7f0a0005; public static final int login=0x7f0a0006; public static final int main=0x7f0a0007; public static final int make_request=0x7f0a0008; public static final int register_donor=0x7f0a0009; public static final int shoes_donation=0x7f0a000a; public static final int tap=0x7f0a000b; public static final int unbidded_request=0x7f0a000c; public static final int uniforms_donation=0x7f0a000d; public static final int view_request=0x7f0a000e; } public static final class string { public static final int action_settings=0x7f070001; public static final int add=0x7f070007; public static final int app_name=0x7f070000; public static final int blazer=0x7f070006; /** Content Description */ public static final int desc_list_item_icon=0x7f07000a; public static final int drawer_close=0x7f070004; public static final int drawer_open=0x7f070003; public static final int hello_world=0x7f070002; public static final int hinter=0x7f070005; public static final int prompt_label_offer=0x7f070018; public static final int prompt_label_request=0x7f070017; public static final int title_activity_blanket_donation=0x7f07000f; /** <string name="title_activity_donate_fragment">DonateFragment</string> */ public static final int title_activity_book_donate=0x7f07000b; public static final int title_activity_cloth_donation=0x7f07000c; public static final int title_activity_detail_item_view=0x7f070015; public static final int title_activity_fragment_request=0x7f070011; public static final int title_activity_login=0x7f070012; public static final int title_activity_make_request=0x7f070016; public static final int title_activity_register_donor=0x7f07000e; public static final int title_activity_shoes_donation=0x7f07000d; public static final int title_activity_unbidded_request=0x7f070014; public static final int title_activity_uniforms_donation=0x7f070010; public static final int title_activity_view_request=0x7f070013; public static final int title_section1=0x7f070008; public static final int title_section2=0x7f070009; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here.android:Theme.Light */ public static final int AppBaseTheme=0x7f090000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f090001; public static final int CustomTheme=0x7f090002; } }
[ "NTOKOZO@NTOKOZO-PC" ]
NTOKOZO@NTOKOZO-PC
a7fa26858582b8914b73c43c6d42d423c7435517
1a28088febe9254e8e70aab6f0e283c3da1f215c
/recurso2-documentacion-expvirtual-sharedlib/src/main/java/pe/gob/sunat/recurso2/documentacion/expvirtual/service/Sgs33Service.java
9672af30266f92f4754817f7c25ffe673396d2af
[]
no_license
avilcanarvaez/expvirtual
d37bc514d5dda9769ba0261267ffeea17f1bbf1a
4f4179980cdcd2bbb7e91f3837bc23b5a6afb189
refs/heads/master
2022-12-05T05:14:41.464921
2020-08-26T17:28:46
2020-08-26T17:28:46
288,569,191
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package pe.gob.sunat.recurso2.documentacion.expvirtual.service; import java.util.Map; /** * * @author nchavez * @date 25/05/2016 * @time 4:06pm */ //Inicio [nchavez 26/05/2015] public interface Sgs33Service { boolean validarFechaDiaHabil(Map<String, Object> parametros) throws Exception; } //Fin [nchavez 26/05/2015]
7edc4eb54bd656d5a664a4735abd0fdf53f8d23d
1374237fa0c18f6896c81fb331bcc96a558c37f4
/java/com/winnertel/ems/epon/iad/eoc/formatter/AnalogAlarmEnableFormatter.java
b2b772b07ff2eacfaba117f252baa8702ea0e579
[]
no_license
fangniude/lct
0ae5bc550820676f05d03f19f7570dc2f442313e
adb490fb8d0c379a8b991c1a22684e910b950796
refs/heads/master
2020-12-02T16:37:32.690589
2017-12-25T01:56:32
2017-12-25T01:56:32
96,560,039
0
0
null
null
null
null
UTF-8
Java
false
false
1,896
java
package com.winnertel.ems.epon.iad.eoc.formatter; import com.winnertel.em.framework.IApplication; import com.winnertel.em.framework.gui.IGuiComposer; import com.winnertel.em.framework.model.snmp.SnmpMibBean; import com.winnertel.em.framework.model.util.MibBeanUtil; import com.winnertel.em.standard.snmp.gui.formatter.SnmpFieldFormatter; /** * Created by IntelliJ IDEA. * User: hz03446 * Date: 2010-8-3 * Time: 11:14:14 * To change this template use File | Settings | File Templates. */ public class AnalogAlarmEnableFormatter extends SnmpFieldFormatter { public AnalogAlarmEnableFormatter(IApplication anApplication) { super(anApplication); } public Object format(SnmpMibBean aMibBean, String aProperty) throws Exception { Object obj = MibBeanUtil.getSimpleProperty(aMibBean, aProperty); if (obj == null) return null; byte[] tmpObj = (byte[]) obj; StringBuffer sb = new StringBuffer(); IGuiComposer composer = fApplication.getActiveDeviceManager().getGuiComposer(); if (tmpObj != null && tmpObj.length > 0) { if ((tmpObj[0] & (0x01)) == (0x01)) { sb.append(" ").append(composer.getString("analogAlarmEnable_LOLO")); } else if ((tmpObj[0] & (0x02)) == (0x02)) { sb.append(" ").append(composer.getString("analogAlarmEnable_LO")); } else if ((tmpObj[0] & (0x04)) == (0x04)) { sb.append(" ").append(composer.getString("analogAlarmEnable_HI")); } else if ((tmpObj[0] & (0x08)) == (0x08)) { sb.append(" ").append(composer.getString("analogAlarmEnable_HIHI")); } else { sb.append(" ").append(composer.getString("analogAlarmEnable_ALLCLOSE")); } // sb.append(" 0x").append(Integer.toHexString(tmpObj[0])); } return sb.toString(); } }
f2e6ec460d143e71b31e0b6d5d87bc7668846608
46f5cd60733353048163211c87be39fe3ca42435
/src/main/java/meli/exam/mutants/repositories/DnaRepository.java
9c5700944a0d370b98bec602664e5d71d245e8a1
[]
no_license
Chrisnarto/mutants
d939524f226782c2f4798d861bef8fad42c8d595
e64f29f7f19c759c28408ba0b1ad5733565aecaa
refs/heads/master
2022-10-29T06:03:59.608155
2020-06-17T21:22:50
2020-06-17T21:22:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package meli.exam.mutants.repositories; import org.springframework.data.repository.CrudRepository; import meli.exam.mutants.model.Dna; public interface DnaRepository extends CrudRepository<Dna, Integer> { Dna findBySequence(String[] sequence); long countAllByIsMutant(Boolean isMutant); }
ff2ee80f362b9a4e4eea18521d21c95517a2345a
3dcf03853533541943f2c407b2f3826c432dece9
/src/main/java/nl/toefel/server/Identity.java
7186e8c1c9ab15b96f1e1f533d0a1031cb46e3b5
[]
no_license
denisraison/transcoding-grpc-to-http-json
b31fc037ad41e568cea2d5e17ea21116fa556489
fa5bfe419e919e613778b148982e7b0f9ab9e5f5
refs/heads/master
2023-07-27T11:28:53.710261
2021-09-13T01:53:42
2021-09-13T01:53:42
404,216,627
0
0
null
2021-09-08T05:00:16
2021-09-08T05:00:16
null
UTF-8
Java
false
false
139
java
package nl.toefel.server; public class Identity { public String token; public Identity(String token) { this.token = token; } }
066cf48fed0f29320f18a8d2a38ae216dfa354a4
1aeb7c11b3ee994a354c9bf1bcaccd302d8a57b2
/app/src/main/java/com/example/bahroel/consumptionjsonretrofit/Model/Android.java
c5c58d934456b26d432bb41536ba2a1b8a4ae2ec
[]
no_license
Bahroel0/Android-ConsumeJSONAPIUsingRetrofit
47c7da3757c70677839ab40d8d3c54b39914935f
71e5aac007ef5b6a845a90fddf734291fbe98cc3
refs/heads/master
2020-03-11T12:26:40.197009
2018-04-18T03:19:37
2018-04-18T03:19:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
package com.example.bahroel.consumptionjsonretrofit.Model; public class Android { private String ver; private String name; public String getVer() { return ver; } public void setVer(String ver) { this.ver = ver; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getApi() { return api; } public void setApi(String api) { this.api = api; } private String api; }
1e4f3ee7fc0398cd2dff7bba903574f206615120
d0e8665d31254fb66442392d8981f9be339b5e98
/tstMaven/src/main/java/blog/mainguy/Flight.java
74c38a1ce1d7f135f454c429172633243587d1d5
[]
no_license
mikemainguy/mainguy_blog
7b0f83bffce2300daaa233654a7b725691ec52a4
7f63ee93bab4ca94f4473a71799f590fe77c7112
refs/heads/master
2021-01-20T12:13:14.457066
2012-06-15T11:41:16
2012-06-15T11:41:16
2,114,624
0
2
null
null
null
null
UTF-8
Java
false
false
727
java
package blog.mainguy; import java.sql.Date; /** * Created with IntelliJ IDEA. * User: michaelmainguy * Date: 4/23/12 * Time: 7:33 PM * To change this template use File | Settings | File Templates. */ public class Flight implements Auditable { public Date start; public String getAuditString() { return "done"; } public Date getStart() { return start; } public void setStart(Date start) { this.start = start; } public Date getFinish() { return finish; } public void setFinish(Date finish) { this.finish = finish; } public Date finish; public long getDuration() { return finish.getTime() - start.getTime(); } }
1dec9e6dbd83fc54df9808a2d5dd5aa885b2e30f
34895d74a96a8d913c0d3e858f8eaf0df485c5b2
/src/main/java/org/jenkinsci/plugins/workflow/graphanalysis/ForkScanner.java
7b36e5ce067955922b95a3187c6391bd73ea5ba6
[]
no_license
svanoort/workflow-api-plugin
04b0d4adf1f772039b5e99499b9e02425118de9a
765367294041f864af09a5522575d48f75ccfb9c
refs/heads/master
2021-01-13T05:44:06.535499
2017-02-07T18:49:41
2017-02-07T18:49:41
81,583,212
0
0
null
2017-02-10T16:22:36
2017-02-10T16:22:36
null
UTF-8
Java
false
false
29,600
java
/* * The MIT License * * Copyright (c) 2016, CloudBees, Inc. * * 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 org.jenkinsci.plugins.workflow.graphanalysis; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import org.jenkinsci.plugins.workflow.actions.ThreadNameAction; import org.jenkinsci.plugins.workflow.actions.TimingAction; import org.jenkinsci.plugins.workflow.graph.BlockEndNode; import org.jenkinsci.plugins.workflow.graph.BlockStartNode; import org.jenkinsci.plugins.workflow.graph.FlowEndNode; import org.jenkinsci.plugins.workflow.graph.FlowNode; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.concurrent.NotThreadSafe; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.ListIterator; import java.util.Set; /** * Scanner that will scan down all forks when we hit parallel blocks before continuing, but generally runs in linear order * <p>Think of it as the opposite of {@link DepthFirstScanner}. * * <p>This is a fairly efficient way to visit all FlowNodes, and provides four useful guarantees: * <ul> * <li>Every FlowNode is visited, and visited EXACTLY ONCE (not true for LinearScanner, which misses some)</li> * <li>All parallel branches are visited before we move past the parallel block (not true for DepthFirstScanner)</li> * <li>For parallels, we visit branches in reverse order (in fitting with end to start general flow)</li> * <li>For EVERY block, the BlockEndNode is visited before the BlockStartNode (not true for DepthFirstScanner, with parallels)</li> * </ul> * * <p>The big advantages of this approach: * <ul> * <li>Blocks are visited in the order they end (no backtracking) - helps with working a block at a time</li> * <li>Points are visited in linear order within a block (easy to use for analysis)</li> * <li>Minimal state information needed</li> * <li>Branch information is available for use here</li> * </ul> * * @author Sam Van Oort */ @NotThreadSafe public class ForkScanner extends AbstractFlowScanner { @CheckForNull public NodeType getCurrentType() { return currentType; } @CheckForNull public NodeType getNextType() { return nextType; } /** Used to recognize special nodes */ public enum NodeType { /** Not any of the parallel types */ NORMAL, /**{@link BlockStartNode} starting a parallel block */ PARALLEL_START, /**{@link BlockEndNode} ending a parallel block */ PARALLEL_END, /**{@link BlockStartNode} starting a branch of a parallel */ PARALLEL_BRANCH_START, /**{@link BlockEndNode} ending a parallel block... or last executed nodes */ PARALLEL_BRANCH_END, } // Last element in stack is end of myCurrent parallel start, first is myCurrent start ArrayDeque<ParallelBlockStart> parallelBlockStartStack = new ArrayDeque<ParallelBlockStart>(); /** FlowNode that will terminate the myCurrent parallel block */ FlowNode currentParallelStartNode = null; ParallelBlockStart currentParallelStart = null; private boolean walkingFromFinish = false; NodeType currentType = null; NodeType nextType = null; public ForkScanner() { } public ForkScanner(@Nonnull Collection<FlowNode> heads) { this.setup(heads); } public ForkScanner(@Nonnull Collection<FlowNode> heads, @Nonnull Collection<FlowNode> blackList) { this.setup(heads, blackList); } @Override protected void reset() { parallelBlockStartStack.clear(); currentParallelStart = null; currentParallelStartNode = null; myCurrent = null; myNext = null; } // A bit of a dirty hack, but it works around the fact that we need trivial access to classes from workflow-cps // For this and only this test. So, we load them from a context that is aware of them. // Ex: workflow-cps can automatically set this correctly. Not perfectly graceful but it works. private static Predicate<FlowNode> parallelStartPredicate = Predicates.alwaysFalse(); // Invoke this passing a test against the ParallelStep conditions public static void setParallelStartPredicate(@Nonnull Predicate<FlowNode> pred) { parallelStartPredicate = pred; } // Needed because the *next* node might be a parallel start if we start in middle and we don't know it public static boolean isParallelStart(@CheckForNull FlowNode f) { return parallelStartPredicate.apply(f); } // Needed because the *next* node might be a parallel end and we don't know it from a normal one public static boolean isParallelEnd(@CheckForNull FlowNode f) { return f != null && f instanceof BlockEndNode && (f.getParents().size()>1 || isParallelStart(((BlockEndNode) f).getStartNode())); } /** If true, we are walking from the flow end node and have a complete view of the flow * Needed because there are implications when not walking from a finished flow (blocks without a {@link BlockEndNode})*/ public boolean isWalkingFromFinish() { return walkingFromFinish; } /** Tracks state for parallel blocks, so we can ensure all are visited and know the branch starting point */ static class ParallelBlockStart { BlockStartNode forkStart; // This is the node with child branches ArrayDeque<FlowNode> unvisited = new ArrayDeque<FlowNode>(); // Remaining branches of this that we have have not visited yet ParallelBlockStart(BlockStartNode forkStart) { this.forkStart = forkStart; } /** Strictly for internal use in the least common ancestor problem */ ParallelBlockStart() {} } interface FlowPiece { // Mostly a marker /** If true, this is not a fork and has no following forks */ boolean isLeaf(); } /** Linear (no parallels) run of FLowNodes */ // TODO see if this can be replaced with a FlowChunk acting as a container class for a list of FlowNodes static class FlowSegment implements FlowPiece { ArrayList<FlowNode> visited = new ArrayList<FlowNode>(); FlowPiece after; boolean isLeaf = true; @Override public boolean isLeaf() { return isLeaf; } /** * We have discovered a forking node intersecting our FlowSegment in the middle or meeting at the end * Now we need to split the flow, or pull out the fork point and make both branches follow it * @param nodeMapping Mapping of BlockStartNodes to flowpieces (forks or segments) * @param joinPoint Node where the branches intersect/meet (fork point) * @param joiningBranch Flow piece that is joining this * @throws IllegalStateException When you try to split a segment on a node that it doesn't contain, or invalid graph structure * @return Recreated fork */ Fork split(@Nonnull HashMap<FlowNode, FlowPiece> nodeMapping, @Nonnull BlockStartNode joinPoint, @Nonnull FlowPiece joiningBranch) { int index = visited.lastIndexOf(joinPoint); // Fork will be closer to end, so this is better than indexOf Fork newFork = new Fork(joinPoint); if (index < 0) { throw new IllegalStateException("Tried to split a segment where the node doesn't exist in this segment"); } else if (index == this.visited.size()-1) { // We forked just off the most recent node newFork.following.add(this); newFork.following.add(joiningBranch); this.visited.remove(index); } else if (index == 0) { throw new IllegalStateException("We have a cyclic graph or heads that are not separate branches!"); } else { // Splitting at some midpoint within the segment, everything before becomes part of the following // Execute the split: create a new fork at the fork point, and shuffle the part of the flow after it // to a new segment and add that to the fork. FlowSegment newSegment = new FlowSegment(); newSegment.after = this.after; newSegment.visited.addAll(this.visited.subList(0, index)); newFork.following.add(newSegment); newFork.following.add(joiningBranch); this.after = newFork; this.isLeaf = false; // Remove the part before the fork point this.visited.subList(0, index+1).clear(); for (FlowNode n : newSegment.visited) { nodeMapping.put(n, newSegment); } } nodeMapping.put(joinPoint, newFork); return newFork; } public void add(FlowNode f) { this.visited.add(f); } } /** Internal class used for constructing the LeastCommonAncestor structure */ // TODO see if this can be replaced with a FlowChunk acting as a container class for parallels // I.E. ParallelMemoryFlowChunk or similar static class Fork extends ParallelBlockStart implements FlowPiece { List<FlowPiece> following = new ArrayList<FlowPiece>(); @Override public boolean isLeaf() { return false; } public Fork(BlockStartNode forkNode) { this.forkStart = forkNode; } } /** Does a conversion of the fork container class to a set of block starts */ ArrayDeque<ParallelBlockStart> convertForksToBlockStarts(ArrayDeque<Fork> parallelForks) { // Walk through and convert forks to parallel block starts, and find heads that point to them ArrayDeque<ParallelBlockStart> output = new ArrayDeque<ParallelBlockStart>(); for (Fork f : parallelForks) { // Do processing to assign heads to flowsegments ParallelBlockStart start = new ParallelBlockStart(); start.forkStart = f.forkStart; start.unvisited = new ArrayDeque<FlowNode>(); // Add the nodes to the parallel starts here for (FlowPiece fp : f.following) { if (fp.isLeaf()) { // Forks are never leaves start.unvisited.add(((FlowSegment)fp).visited.get(0)); } } output.add(start); } return output; } /** * Create the necessary information about parallel blocks in order to provide flowscanning from inside incomplete parallel branches * This works by walking back to construct the tree of parallel blocks covering all heads back to the Least Common Ancestor of all heads * (the top parallel block). One by one, as branches join, we remove them from the list of live pieces and replace with their common ancestor. * * <p> The core algorithm is simple in theory but the many cases render the implementation quite complex. In gist: * <ul> * <li>We track FlowPieces, which are Forks (where branches merge) and FlowSegments (where there's a unforked sequence of nodes)</li> * <li>A map of FlowNode to its containing FlowPiece is created </li> * <li>For each head we start a new FlowSegment and create an iterator of all enclosing blocks (all we need for this)</li> * <li>We do a series of passes through all iterators looking to see if the parent of any given piece maps to an existing FlowPiece</li> * <ol> * <li>Where there are no mappings, we add another node to the FlowSegment</li> * <li>Where an existing piece exists, <strong>if it's a Fork</strong>, we add the current piece on as a new branch</li> * <li>Where an existing piece exists <strong>if it's a FlowSegment</strong>, we create a fork: * <ul><li>If we're joining at the most recent point, create a Fork with both branches following it, and replace that item's ForkSegment in the piece list with a Fork</li> * <li>If joining midway through, split the segment and create a fork as needed</li></ul> * </li> * <li>When two pieces join together, we remove one from the list</li> * <li>When we're down to a single piece, we have the full ancestry & we're done</li> * <li>When we're down to a single piece, all heads have merged and we're done</li> * </ol> * <li>Each time we merge a branch in, we need to remove an entry from enclosing blocks & live pieces</li> * </ul> * * <p> There are some assumptions you need to know about to understand why this works: * <ul> * <li>None of the pieces have multiple parents, since we only look at enclosing blocks (only be a BlockEndNodes for a parallel block have multipel parents)</li> * <li>No cycles exist in the graph</li> * <li>Flow graphs are correctly constructed</li> * <li>Heads are all separate branches</li> * </ul> * * @param heads */ ArrayDeque<ParallelBlockStart> leastCommonAncestor(@Nonnull final Set<FlowNode> heads) { HashMap<FlowNode, FlowPiece> branches = new HashMap<FlowNode, FlowPiece>(); ArrayList<Filterator<FlowNode>> iterators = new ArrayList<Filterator<FlowNode>>(); ArrayList<FlowPiece> livePieces = new ArrayList<FlowPiece>(); ArrayDeque<Fork> parallelForks = new ArrayDeque<Fork>(); // Tracks the discovered forks in order of encounter Predicate<FlowNode> notAHead = new Predicate<FlowNode>() { // Filter out pre-existing heads Collection<FlowNode> checkHeads = convertToFastCheckable(heads); @Override public boolean apply(FlowNode input) { return !(checkHeads.contains(input)); } }; for (FlowNode f : heads) { iterators.add(FlowScanningUtils.fetchEnclosingBlocks(f).filter(notAHead)); // We can do this because Parallels always meet at a BlockStartNode FlowSegment b = new FlowSegment(); b.add(f); livePieces.add(b); branches.put(f, b); } // Walk through, merging flownodes one-by-one until everything has merged to one ancestor boolean mergedAll = false; // Ends when we merged all branches together, or hit the start of the flow without it while (!mergedAll && iterators.size() > 0) { ListIterator<Filterator<FlowNode>> itIterator = iterators.listIterator(); ListIterator<FlowPiece> pieceIterator = livePieces.listIterator(); while (itIterator.hasNext()) { Filterator<FlowNode> blockStartIterator = itIterator.next(); FlowPiece myPiece = pieceIterator.next(); //Safe because we always remove/add with both iterators at once // Welp we hit the end of a branch if (!blockStartIterator.hasNext()) { pieceIterator.remove(); itIterator.remove(); continue; } FlowNode nextBlockStart = blockStartIterator.next(); // Look for cases where two branches merge together FlowPiece existingPiece = branches.get(nextBlockStart); if (existingPiece == null && myPiece instanceof FlowSegment) { // No merge, just add to segment ((FlowSegment) myPiece).add(nextBlockStart); branches.put(nextBlockStart, myPiece); } else if (existingPiece == null && myPiece instanceof Fork) { // No merge, we had a fork. Start a segment preceding the fork FlowSegment newSegment = new FlowSegment(); newSegment.isLeaf = false; newSegment.add(nextBlockStart); newSegment.after = myPiece; pieceIterator.remove(); pieceIterator.add(newSegment); branches.put(nextBlockStart, newSegment); } else if (existingPiece != null) { // Always not null. We're merging into another thing, we're going to eliminate a branch if (existingPiece instanceof Fork) { ((Fork) existingPiece).following.add(myPiece); } else { // Split a flow segment so it forks against this one Fork f = ((FlowSegment) existingPiece).split(branches, (BlockStartNode)nextBlockStart, myPiece); // If we split the existing segment at its end, we created a fork replacing its latest node // Thus we must replace the piece with the fork ahead of it if (f.following.contains(existingPiece) ) { int headIndex = livePieces.indexOf(existingPiece); livePieces.set(headIndex, f); } parallelForks.add(f); } // Merging removes the piece & its iterator from heads itIterator.remove(); pieceIterator.remove(); if (iterators.size() == 1) { // Merged in the final branch mergedAll = true; } } } } // If we hit issues with the ordering of blocks by depth, apply a sorting to the parallels by depth return convertForksToBlockStarts(parallelForks); } @Override protected void setHeads(@Nonnull Collection<FlowNode> heads) { if (heads.size() > 1) { parallelBlockStartStack = leastCommonAncestor(new LinkedHashSet<FlowNode>(heads)); assert parallelBlockStartStack.size() > 0; currentParallelStart = parallelBlockStartStack.pop(); currentParallelStartNode = currentParallelStart.forkStart; myCurrent = currentParallelStart.unvisited.pop(); myNext = myCurrent; nextType = NodeType.PARALLEL_BRANCH_END; walkingFromFinish = false; } else { FlowNode f = heads.iterator().next(); walkingFromFinish = f instanceof FlowEndNode; myCurrent = f; myNext = f; if (isParallelEnd(f)) { nextType = NodeType.PARALLEL_END; } else if (isParallelStart(f)) { nextType = NodeType.PARALLEL_START; } else { nextType = NodeType.NORMAL; } } currentType = null; } /** * Return the node that begins the current parallel head * @return The FlowNode that marks current parallel start */ @CheckForNull public FlowNode getCurrentParallelStartNode() { return currentParallelStartNode; } /** Return number of levels deep we are in parallel blocks */ public int getParallelDepth() { return (currentParallelStart == null) ? 0 : 1 + parallelBlockStartStack.size(); } /** * Invoked when we start entering a parallel block (walking from head of the flow, so we see the block end first) * @param endNode Node where parents merge (final end node for the parallel block) * @param parents Parent nodes that end here * @return FlowNode myNext node to visit */ FlowNode hitParallelEnd(BlockEndNode endNode, List<FlowNode> parents, Collection<FlowNode> blackList) { BlockStartNode start = endNode.getStartNode(); ArrayDeque<FlowNode> branches = new ArrayDeque<FlowNode>(); for (FlowNode f : parents) { if (!blackList.contains(f)) { branches.addFirst(f); } } FlowNode output = null; if (branches.size() > 0) { // Push another branch start ParallelBlockStart parallelBlockStart = new ParallelBlockStart(start); output = branches.pop(); parallelBlockStart.unvisited = branches; if (currentParallelStart != null) { parallelBlockStartStack.push(currentParallelStart); } currentParallelStart = parallelBlockStart; currentParallelStartNode = start; } return output; } /** * Invoked when we complete parallel block, walking from the head (so encountered after the end) * @return FlowNode if we're the last node */ FlowNode hitParallelStart() { FlowNode output = null; if (currentParallelStart != null) { if (currentParallelStart.unvisited.isEmpty()) { // Strip off a completed branch // We finished a nested set of parallel branches, visit the head and move up a level output = currentParallelStartNode; if (parallelBlockStartStack.size() > 0) { // Finished a nested parallel block, move up a level currentParallelStart = parallelBlockStartStack.pop(); currentParallelStartNode = currentParallelStart.forkStart; } else { // At the top level, not inside any parallel block currentParallelStart = null; currentParallelStartNode = null; } } } else { throw new IllegalStateException("Hit a BlockStartNode with multiple children, and no record of the start!"); } // Handle cases where the BlockStartNode for the parallel block is blackListed return (output != null && !myBlackList.contains(output)) ? output : null; } @Override public FlowNode next() { currentType = nextType; FlowNode output = super.next(); return output; } @Override protected FlowNode next(@Nonnull FlowNode current, @Nonnull Collection<FlowNode> blackList) { FlowNode output = null; // First we look at the parents of the current node if present List<FlowNode> parents = current.getParents(); if (parents.isEmpty()) { // welp, we're done with this node, guess we consult the queue? } else if (parents.size() == 1) { FlowNode p = parents.get(0); if (p == currentParallelStartNode) { // Terminating a parallel scan FlowNode temp = hitParallelStart(); if (temp != null) { // Start node for current parallel block now that it is done nextType = NodeType.PARALLEL_START; return temp; } } else if (!blackList.contains(p)) { if (p instanceof BlockStartNode && p.getPersistentAction(ThreadNameAction.class) != null) { nextType = NodeType.PARALLEL_BRANCH_START; } else if (ForkScanner.isParallelEnd(p)) { nextType = NodeType.PARALLEL_END; } else { nextType = NodeType.NORMAL; } return p; } } else if (current instanceof BlockEndNode && parents.size() > 1) { // We must be a BlockEndNode that begins this BlockEndNode end = ((BlockEndNode) current); FlowNode possibleOutput = hitParallelEnd(end, parents, blackList); // What if output is block but other branches aren't? if (possibleOutput != null) { nextType = NodeType.PARALLEL_BRANCH_END; return possibleOutput; } } else { throw new IllegalStateException("Found a FlowNode with multiple parents that isn't the end of a block! "+ this.myCurrent); } if (currentParallelStart != null && currentParallelStart.unvisited.size() > 0) { output = currentParallelStart.unvisited.pop(); nextType = NodeType.PARALLEL_BRANCH_END; } if (output == null) { nextType = null; } return output; } public static void visitSimpleChunks(@Nonnull Collection<FlowNode> heads, @Nonnull Collection<FlowNode> blacklist, @Nonnull SimpleChunkVisitor visitor, @Nonnull ChunkFinder finder) { ForkScanner scanner = new ForkScanner(); scanner.setup(heads, blacklist); scanner.visitSimpleChunks(visitor, finder); } public static void visitSimpleChunks(@Nonnull Collection<FlowNode> heads, @Nonnull SimpleChunkVisitor visitor, @Nonnull ChunkFinder finder) { ForkScanner scanner = new ForkScanner(); scanner.setup(heads); scanner.visitSimpleChunks(visitor, finder); } /** Ensures we find the last *begun* node when there are multiple heads (parallel branches) * This means that the simpleBlockVisitor gets the *actual* last node, not just the end of the last declared branch * (See issue JENKINS-38536) */ @CheckForNull private static FlowNode findLastStartedNode(@Nonnull List<FlowNode> candidates) { if (candidates.size() == 0) { return null; } else if (candidates.size() == 1) { return candidates.get(0); } else { FlowNode returnOut = candidates.get(0); long startTime = Long.MIN_VALUE; for(FlowNode f : candidates) { TimingAction ta = f.getAction(TimingAction.class); // Null timing with multiple heads is probably a node where the GraphListener hasn't fired to add TimingAction yet long myStart = (ta == null) ? System.currentTimeMillis() : ta.getStartTime(); if (myStart > startTime) { returnOut = f; startTime = myStart; } } return returnOut; } } /** Walk through flows */ public void visitSimpleChunks(@Nonnull SimpleChunkVisitor visitor, @Nonnull ChunkFinder finder) { FlowNode prev = null; if (finder.isStartInsideChunk() && hasNext()) { if (currentParallelStart == null ) { visitor.chunkEnd(this.myNext, null, this); } else { // Last node is the last started branch List<FlowNode> branchEnds = new ArrayList<FlowNode>(currentParallelStart.unvisited); branchEnds.add(this.myNext); FlowNode lastStarted = this.findLastStartedNode(branchEnds); if (lastStarted != null) { visitor.chunkEnd(lastStarted, null, this); } else { throw new IllegalStateException("Flow is inside parallel block, but shows no executing heads!"); } } } while(hasNext()) { prev = (myCurrent != myNext) ? myCurrent : null; FlowNode f = next(); boolean boundary = false; if (finder.isChunkStart(myCurrent, prev)) { visitor.chunkStart(myCurrent, myNext, this); boundary = true; } if (finder.isChunkEnd(myCurrent, prev)) { visitor.chunkEnd(myCurrent, prev, this); boundary = true; } if (!boundary) { visitor.atomNode(myNext, f, prev, this); } // Trigger on parallels switch (currentType) { case NORMAL: break; case PARALLEL_END: visitor.parallelEnd(this.currentParallelStartNode, myCurrent, this); break; case PARALLEL_START: visitor.parallelStart(myCurrent, prev, this); break; case PARALLEL_BRANCH_END: visitor.parallelBranchEnd(this.currentParallelStartNode, myCurrent, this); break; case PARALLEL_BRANCH_START: // Needed because once we hit the start of the last branch, the next node is our currentParallelStart FlowNode parallelStart = (nextType == NodeType.PARALLEL_START) ? myNext : this.currentParallelStartNode; visitor.parallelBranchStart(parallelStart, myCurrent, this); break; default: throw new IllegalStateException("Unhandled type for current node"); } } } }
93cc7a73ededecff8959309102dedc878e720074
a370ff524a6e317488970dac65d93a727039f061
/archive/unsorted/2020.10/2020.10.22 - URI Online Judge - Beginner/HelloWorld.java
b9a208bd481de28b1ac443139b146bd4ce296271
[]
no_license
taodaling/contest
235f4b2a033ecc30ec675a4526e3f031a27d8bbf
86824487c2e8d4fc405802fff237f710f4e73a5c
refs/heads/master
2023-04-14T12:41:41.718630
2023-04-10T14:12:47
2023-04-10T14:12:47
213,876,299
9
1
null
2021-06-12T06:33:05
2019-10-09T09:28:43
Java
UTF-8
Java
false
false
219
java
package contest; import template.io.FastInput; import java.io.PrintWriter; public class HelloWorld { public void solve(int testNumber, FastInput in, PrintWriter out) { out.println("Hello World!"); } }
fcf578d560975b5a557bb57c5c729f80b536c223
9c0b2b45963404de491fc4fd04f185ecfdad5bb6
/src/main/java/com/easy/guice/rpc/client/module/RpcClientModule.java
51f4a979c01bdd1dd65b5b9ba313d566376ab09b
[]
no_license
cgb-netty/netty-guice-http2-fastjson-rpc
99428ec31db5b4f2975a3757b6f9a122c08c30ff
62ee24cc88b67f5b64633a461e72da0b1a59f6ce
refs/heads/master
2021-12-27T15:13:32.394079
2018-01-12T06:08:47
2018-01-12T06:08:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,451
java
package com.easy.guice.rpc.client.module; import com.easy.guice.rpc.client.RpcClient; import com.easy.guice.rpc.client.httpClient.Http2Impl; import com.easy.guice.rpc.client.httpClient.HttpClientInterface; import com.easy.guice.rpc.zk.ServiceDiscovery; import com.google.inject.AbstractModule; import com.google.inject.Inject; import com.google.inject.Provides; import com.google.inject.name.Named; import org.apache.commons.collections4.CollectionUtils; import java.util.List; /** * Created by liuchengjun on 2018/1/10. */ public class RpcClientModule extends AbstractModule { List<Class> serviceInterfaceList; String zkAddress; public RpcClientModule(String zkAddress, List<Class> serviceInterfaceList) { this.zkAddress = zkAddress; this.serviceInterfaceList = serviceInterfaceList; } @Override protected void configure() { RpcClient rpcClient = new RpcClient(getServiceDiscovery(),getHttpClient()); bind(RpcClient.class).toInstance(rpcClient); if (!CollectionUtils.isEmpty(serviceInterfaceList)) { serviceInterfaceList.forEach(clazz -> { bind(clazz).toInstance(rpcClient.create(clazz)); }); } } @Provides private ServiceDiscovery getServiceDiscovery() { return new ServiceDiscovery(zkAddress); } @Provides private HttpClientInterface getHttpClient() { return new Http2Impl(); } }
f48ac48e361cca1909fc8e014aafb28e01b3acca
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/20/20_473602d63f20b3c5ec1c0e84ed02d8f2473a0270/PropertyReader/20_473602d63f20b3c5ec1c0e84ed02d8f2473a0270_PropertyReader_s.java
709c9b2bd66eb67b8f850d6ce4b8ecb3183b7880
[]
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
901
java
package PropertyReader; import java.io.IOException; import java.util.Properties; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author daniela */ public abstract class PropertyReader { protected Properties props; protected PropertyReader(String path) { readPropertyFile(path); } private void readPropertyFile(String path) { java.io.InputStream is = ClassLoader.getSystemResourceAsStream(path); if (is != null) { props = new java.util.Properties(); try { props.load(is); } catch(IOException e) { System.err.println("Couldn't read Properties file + " + path); } } else { System.err.println("Properties file not found! " + path); } } }
4d1984ef4ef4b8158ea665874f586b43bffabb6b
e22220cac44fb8889368a070d2be669a6b38bdec
/Recursive/src/day6_9_20/Day6_9_20.java
0af391185b71130ea53f7dadbbd370feb09e4298
[]
no_license
Zr0118/Solution_Java
c95df2d2aa0987970f5fcaaf3621275b4b039166
c89dc2a92326ecfd25900765c3c0794a3f948bda
refs/heads/master
2022-11-01T06:49:45.064552
2020-06-18T08:31:03
2020-06-18T08:31:03
267,891,330
0
0
null
null
null
null
UTF-8
Java
false
false
1,225
java
package day6_9_20; //Day6/9/20 动态规划 /* 题目描述:现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0,第1项是1)。 */ public class Day6_9_20 { public static void main(String[] args) { int index = 2; int res = Fibonacci(index); System.out.println(res); } // 时间复杂度 O(2^n) // 方法一 static int Fibonacci(int n) { if (n==0 || n==1) return n; return Fibonacci(n-1) + Fibonacci(n-2); } // 方法二 动态规划 由下而上 数组存储 static int Fibonacci2(int n) { int ans[] = new int[40]; ans[0] = 0; ans[1] = 1; for(int i=2;i<=n;i++){ ans[i] = ans[i-1] + ans[i-2]; } return ans[n]; } // 方法三 动态规划 优化存储 -- 仅用到了两个变量 static public int Fibonacci3(int n) { if(n == 0){ return 0; }else if(n == 1){ return 1; } int sum = 0; int two = 0; int one = 1; for(int i=2;i<=n;i++){ sum = two + one; two = one; one = sum; } return sum; } }
24465af6076e18b2a7329f3f83e0d6607cca8927
66d3122f8f031d6e8b27e8ead7aa5ae0d7e33b45
/net/minecraft/structure/StructureManager.java
1c74d03385a2824955eb8f8e76df79a41a7e3d9a
[]
no_license
gurachan/minecraft1.14-dp
c10059787555028f87a4c8183ff74e6e1cfbf056
34daddc03be27d5a0ee2ab9bc8b1deb050277208
refs/heads/master
2022-01-07T01:43:52.836604
2019-05-08T17:18:13
2019-05-08T17:18:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,693
java
package net.minecraft.structure; import org.apache.logging.log4j.LogManager; import java.nio.file.InvalidPathException; import net.minecraft.util.InvalidIdentifierException; import net.minecraft.util.FileNameUtil; import java.io.OutputStream; import java.io.FileOutputStream; import java.nio.file.attribute.FileAttribute; import java.nio.file.Files; import java.nio.file.LinkOption; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.TagHelper; import net.minecraft.datafixers.DataFixTypes; import net.minecraft.nbt.NbtIo; import java.io.InputStream; import java.io.IOException; import java.io.FileInputStream; import net.minecraft.resource.Resource; import java.io.FileNotFoundException; import net.minecraft.resource.ResourceManager; import javax.annotation.Nullable; import net.minecraft.resource.ResourceReloadListener; import com.google.common.collect.Maps; import java.io.File; import java.nio.file.Path; import net.minecraft.server.MinecraftServer; import com.mojang.datafixers.DataFixer; import net.minecraft.util.Identifier; import java.util.Map; import org.apache.logging.log4j.Logger; import net.minecraft.resource.SynchronousResourceReloadListener; public class StructureManager implements SynchronousResourceReloadListener { private static final Logger LOGGER; private final Map<Identifier, Structure> structures; private final DataFixer dataFixer; private final MinecraftServer server; private final Path generatedPath; public StructureManager(final MinecraftServer server, final File worldDir, final DataFixer dataFixer) { this.structures = Maps.newHashMap(); this.server = server; this.dataFixer = dataFixer; this.generatedPath = worldDir.toPath().resolve("generated").normalize(); server.getDataManager().registerListener(this); } public Structure getStructureOrBlank(final Identifier id) { Structure structure2 = this.getStructure(id); if (structure2 == null) { structure2 = new Structure(); this.structures.put(id, structure2); } return structure2; } @Nullable public Structure getStructure(final Identifier identifier) { final Structure structure2; return this.structures.computeIfAbsent(identifier, identifier -> { structure2 = this.loadStructureFromFile(identifier); return (structure2 != null) ? structure2 : this.loadStructureFromResource(identifier); }); } @Override public void apply(final ResourceManager manager) { this.structures.clear(); } @Nullable private Structure loadStructureFromResource(final Identifier id) { final Identifier identifier2 = new Identifier(id.getNamespace(), "structures/" + id.getPath() + ".nbt"); try (final Resource resource3 = this.server.getDataManager().getResource(identifier2)) { return this.readStructure(resource3.getInputStream()); } catch (FileNotFoundException fileNotFoundException3) { return null; } catch (Throwable throwable3) { StructureManager.LOGGER.error("Couldn't load structure {}: {}", id, throwable3.toString()); return null; } } @Nullable private Structure loadStructureFromFile(final Identifier id) { if (!this.generatedPath.toFile().isDirectory()) { return null; } final Path path2 = this.getAndCheckStructurePath(id, ".nbt"); try (final InputStream inputStream3 = new FileInputStream(path2.toFile())) { return this.readStructure(inputStream3); } catch (FileNotFoundException fileNotFoundException3) { return null; } catch (IOException iOException3) { StructureManager.LOGGER.error("Couldn't load structure from {}", path2, iOException3); return null; } } private Structure readStructure(final InputStream structureInputStream) throws IOException { final CompoundTag compoundTag2 = NbtIo.readCompressed(structureInputStream); if (!compoundTag2.containsKey("DataVersion", 99)) { compoundTag2.putInt("DataVersion", 500); } final Structure structure3 = new Structure(); structure3.fromTag(TagHelper.update(this.dataFixer, DataFixTypes.f, compoundTag2, compoundTag2.getInt("DataVersion"))); return structure3; } public boolean saveStructure(final Identifier id) { final Structure structure2 = this.structures.get(id); if (structure2 == null) { return false; } final Path path3 = this.getAndCheckStructurePath(id, ".nbt"); final Path path4 = path3.getParent(); if (path4 == null) { return false; } try { Files.createDirectories(Files.exists(path4) ? path4.toRealPath() : path4, new FileAttribute[0]); } catch (IOException iOException5) { StructureManager.LOGGER.error("Failed to create parent directory: {}", path4); return false; } final CompoundTag compoundTag5 = structure2.toTag(new CompoundTag()); try (final OutputStream outputStream6 = new FileOutputStream(path3.toFile())) { NbtIo.writeCompressed(compoundTag5, outputStream6); } catch (Throwable throwable6) { return false; } return true; } private Path getStructurePath(final Identifier id, final String string) { try { final Path path3 = this.generatedPath.resolve(id.getNamespace()); final Path path4 = path3.resolve("structures"); return FileNameUtil.b(path4, id.getPath(), string); } catch (InvalidPathException invalidPathException3) { throw new InvalidIdentifierException("Invalid resource path: " + id, invalidPathException3); } } private Path getAndCheckStructurePath(final Identifier id, final String string) { if (id.getPath().contains("//")) { throw new InvalidIdentifierException("Invalid resource path: " + id); } final Path path3 = this.getStructurePath(id, string); if (!path3.startsWith(this.generatedPath) || !FileNameUtil.isNormal(path3) || !FileNameUtil.isAllowedName(path3)) { throw new InvalidIdentifierException("Invalid resource path: " + path3); } return path3; } public void unloadStructure(final Identifier id) { this.structures.remove(id); } static { LOGGER = LogManager.getLogger(); } }
8451d735c80a5812e31b3e56b6cbff0253367f54
794e8eac0494d59279ad39717b01cf76c5e9f192
/src/com/example/TestApp/view/SnakeView.java
b216f774e5b1823d03c2552af413fcc6f49411a3
[]
no_license
xiaozongzi/TestApp
e3c3a2b911639cdd0d0b02c0696afe6e7e905759
dc6c731e7d1853a6e191b23b813fd423f3727eca
refs/heads/master
2021-01-15T15:44:43.261861
2016-09-25T09:39:01
2016-09-25T09:39:01
31,399,758
0
0
null
null
null
null
UTF-8
Java
false
false
16,699
java
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.TestApp.view; import android.content.Context; import android.content.res.Resources; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.TextView; import com.example.TestApp.R; import java.util.ArrayList; import java.util.Random; /** * SnakeView: implementation of a simple game of Snake * * */ public class SnakeView extends TileView { private static final String TAG = "SnakeView"; /** * Current mode of application: READY to run, RUNNING, or you have already * lost. static final ints are used instead of an enum for performance * reasons. */ private int mMode = READY; public static final int PAUSE = 0; public static final int READY = 1; public static final int RUNNING = 2; public static final int LOSE = 3; /** * Current direction the snake is headed. */ private int mDirection = NORTH; private int mNextDirection = NORTH; private static final int NORTH = 1; private static final int SOUTH = 2; private static final int EAST = 3; private static final int WEST = 4; /** * Labels for the drawables that will be loaded into the TileView class */ private static final int RED_STAR = 1; private static final int YELLOW_STAR = 2; private static final int GREEN_STAR = 3; /** * mScore: used to track the number of apples captured mMoveDelay: number of * milliseconds between snake movements. This will decrease as apples are * captured. */ private long mScore = 0; private long mMoveDelay = 600; /** * mLastMove: tracks the absolute time when the snake last moved, and is used * to determine if a move should be made based on mMoveDelay. */ private long mLastMove; /** * mStatusText: text shows to the user in some run states */ private TextView mStatusText; /** * mSnakeTrail: a list of Coordinates that make up the snake's body * mAppleList: the secret location of the juicy apples the snake craves. */ private ArrayList<Coordinate> mSnakeTrail = new ArrayList<Coordinate>(); private ArrayList<Coordinate> mAppleList = new ArrayList<Coordinate>(); /** * Everyone needs a little randomness in their life */ private static final Random RNG = new Random(); /** * Create a simple handler that we can use to cause animation to happen. We * set ourselves as a target and we can use the sleep() * function to cause an update/invalidate to occur at a later date. */ private RefreshHandler mRedrawHandler = new RefreshHandler(); class RefreshHandler extends Handler { @Override public void handleMessage(Message msg) { SnakeView.this.update(); SnakeView.this.invalidate(); } public void sleep(long delayMillis) { this.removeMessages(0); sendMessageDelayed(obtainMessage(0), delayMillis); } }; /** * Constructs a SnakeView based on inflation from XML * * @param context * @param attrs */ public SnakeView(Context context, AttributeSet attrs) { super(context, attrs); initSnakeView(); } public SnakeView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initSnakeView(); } private void initSnakeView() { setFocusable(true); Resources r = this.getContext().getResources(); resetTiles(4); loadTile(RED_STAR, r.getDrawable(R.drawable.redstar)); loadTile(YELLOW_STAR, r.getDrawable(R.drawable.yellowstar)); loadTile(GREEN_STAR, r.getDrawable(R.drawable.greenstar)); } private void initNewGame() { mSnakeTrail.clear(); mAppleList.clear(); // For now we're just going to load up a short default eastbound snake // that's just turned north mSnakeTrail.add(new Coordinate(7, 7)); mSnakeTrail.add(new Coordinate(6, 7)); mSnakeTrail.add(new Coordinate(5, 7)); mSnakeTrail.add(new Coordinate(4, 7)); mSnakeTrail.add(new Coordinate(3, 7)); mSnakeTrail.add(new Coordinate(2, 7)); mNextDirection = NORTH; // Two apples to start with addRandomApple(); addRandomApple(); mMoveDelay = 600; mScore = 0; } /** * Given a ArrayList of coordinates, we need to flatten them into an array of * ints before we can stuff them into a map for flattening and storage. * * @param cvec : a ArrayList of Coordinate objects * @return : a simple array containing the x/y values of the coordinates * as [x1,y1,x2,y2,x3,y3...] */ private int[] coordArrayListToArray(ArrayList<Coordinate> cvec) { int count = cvec.size(); int[] rawArray = new int[count * 2]; for (int index = 0; index < count; index++) { Coordinate c = cvec.get(index); rawArray[2 * index] = c.x; rawArray[2 * index + 1] = c.y; } return rawArray; } /** * Save game state so that the user does not lose anything * if the game process is killed while we are in the * background. * * @return a Bundle with this view's state */ public Bundle saveState() { Bundle map = new Bundle(); map.putIntArray("mAppleList", coordArrayListToArray(mAppleList)); map.putInt("mDirection", Integer.valueOf(mDirection)); map.putInt("mNextDirection", Integer.valueOf(mNextDirection)); map.putLong("mMoveDelay", Long.valueOf(mMoveDelay)); map.putLong("mScore", Long.valueOf(mScore)); map.putIntArray("mSnakeTrail", coordArrayListToArray(mSnakeTrail)); return map; } /** * Given a flattened array of ordinate pairs, we reconstitute them into a * ArrayList of Coordinate objects * * @param rawArray : [x1,y1,x2,y2,...] * @return a ArrayList of Coordinates */ private ArrayList<Coordinate> coordArrayToArrayList(int[] rawArray) { ArrayList<Coordinate> coordArrayList = new ArrayList<Coordinate>(); int coordCount = rawArray.length; for (int index = 0; index < coordCount; index += 2) { Coordinate c = new Coordinate(rawArray[index], rawArray[index + 1]); coordArrayList.add(c); } return coordArrayList; } /** * Restore game state if our process is being relaunched * * @param icicle a Bundle containing the game state */ public void restoreState(Bundle icicle) { setMode(PAUSE); mAppleList = coordArrayToArrayList(icicle.getIntArray("mAppleList")); mDirection = icicle.getInt("mDirection"); mNextDirection = icicle.getInt("mNextDirection"); mMoveDelay = icicle.getLong("mMoveDelay"); mScore = icicle.getLong("mScore"); mSnakeTrail = coordArrayToArrayList(icicle.getIntArray("mSnakeTrail")); } /* * handles key events in the game. Update the direction our snake is traveling * based on the DPAD. Ignore events that would cause the snake to immediately * turn back on itself. * * (non-Javadoc) * * @see android.view.View#onKeyDown(int, android.os.KeyEvent) */ @Override public boolean onKeyDown(int keyCode, KeyEvent msg) { if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { if (mMode == READY | mMode == LOSE) { /* * At the beginning of the game, or the end of a previous one, * we should start a new game. */ initNewGame(); setMode(RUNNING); update(); return (true); } if (mMode == PAUSE) { /* * If the game is merely paused, we should just continue where * we left off. */ setMode(RUNNING); update(); return (true); } if (mDirection != SOUTH) { mNextDirection = NORTH; } return (true); } if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { if (mDirection != NORTH) { mNextDirection = SOUTH; } return (true); } if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { if (mDirection != EAST) { mNextDirection = WEST; } return (true); } if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { if (mDirection != WEST) { mNextDirection = EAST; } return (true); } return super.onKeyDown(keyCode, msg); } /** * Sets the TextView that will be used to give information (such as "Game * Over" to the user. * * @param newView */ public void setTextView(TextView newView) { mStatusText = newView; } /** * Updates the current mode of the application (RUNNING or PAUSED or the like) * as well as sets the visibility of textview for notification * * @param newMode */ public void setMode(int newMode) { int oldMode = mMode; mMode = newMode; if (newMode == RUNNING & oldMode != RUNNING) { mStatusText.setVisibility(View.INVISIBLE); update(); return; } Resources res = getContext().getResources(); CharSequence str = ""; if (newMode == PAUSE) { str = res.getText(R.string.mode_pause); } if (newMode == READY) { str = res.getText(R.string.mode_ready); } if (newMode == LOSE) { str = res.getString(R.string.mode_lose_prefix) + mScore + res.getString(R.string.mode_lose_suffix); } mStatusText.setText(str); mStatusText.setVisibility(View.VISIBLE); } /** * Selects a random location within the garden that is not currently covered * by the snake. Currently _could_ go into an infinite loop if the snake * currently fills the garden, but we'll leave discovery of this prize to a * truly excellent snake-player. * */ private void addRandomApple() { Coordinate newCoord = null; boolean found = false; while (!found) { // Choose a new location for our apple int newX = 1 + RNG.nextInt(mXTileCount - 2); int newY = 1 + RNG.nextInt(mYTileCount - 2); newCoord = new Coordinate(newX, newY); // Make sure it's not already under the snake boolean collision = false; int snakelength = mSnakeTrail.size(); for (int index = 0; index < snakelength; index++) { if (mSnakeTrail.get(index).equals(newCoord)) { collision = true; } } // if we're here and there's been no collision, then we have // a good location for an apple. Otherwise, we'll circle back // and try again found = !collision; } if (newCoord == null) { Log.e(TAG, "Somehow ended up with a null newCoord!"); } mAppleList.add(newCoord); } /** * Handles the basic update loop, checking to see if we are in the running * state, determining if a move should be made, updating the snake's location. */ public void update() { if (mMode == RUNNING) { long now = System.currentTimeMillis(); if (now - mLastMove > mMoveDelay) { clearTiles(); updateWalls(); updateSnake(); updateApples(); mLastMove = now; } mRedrawHandler.sleep(mMoveDelay); } } /** * Draws some walls. * */ private void updateWalls() { for (int x = 0; x < mXTileCount; x++) { setTile(GREEN_STAR, x, 0); setTile(GREEN_STAR, x, mYTileCount - 1); } for (int y = 1; y < mYTileCount - 1; y++) { setTile(GREEN_STAR, 0, y); setTile(GREEN_STAR, mXTileCount - 1, y); } } /** * Draws some apples. * */ private void updateApples() { for (Coordinate c : mAppleList) { setTile(YELLOW_STAR, c.x, c.y); } } /** * Figure out which way the snake is going, see if he's run into anything (the * walls, himself, or an apple). If he's not going to die, we then add to the * front and subtract from the rear in order to simulate motion. If we want to * grow him, we don't subtract from the rear. * */ private void updateSnake() { boolean growSnake = false; // grab the snake by the head Coordinate head = mSnakeTrail.get(0); Coordinate newHead = new Coordinate(1, 1); mDirection = mNextDirection; switch (mDirection) { case EAST: { newHead = new Coordinate(head.x + 1, head.y); break; } case WEST: { newHead = new Coordinate(head.x - 1, head.y); break; } case NORTH: { newHead = new Coordinate(head.x, head.y - 1); break; } case SOUTH: { newHead = new Coordinate(head.x, head.y + 1); break; } } // Collision detection // For now we have a 1-square wall around the entire arena if ((newHead.x < 1) || (newHead.y < 1) || (newHead.x > mXTileCount - 2) || (newHead.y > mYTileCount - 2)) { setMode(LOSE); return; } // Look for collisions with itself int snakelength = mSnakeTrail.size(); for (int snakeindex = 0; snakeindex < snakelength; snakeindex++) { Coordinate c = mSnakeTrail.get(snakeindex); if (c.equals(newHead)) { setMode(LOSE); return; } } // Look for apples int applecount = mAppleList.size(); for (int appleindex = 0; appleindex < applecount; appleindex++) { Coordinate c = mAppleList.get(appleindex); if (c.equals(newHead)) { mAppleList.remove(c); addRandomApple(); mScore++; mMoveDelay *= 0.9; growSnake = true; } } // push a new head onto the ArrayList and pull off the tail mSnakeTrail.add(0, newHead); // except if we want the snake to grow if (!growSnake) { mSnakeTrail.remove(mSnakeTrail.size() - 1); } int index = 0; for (Coordinate c : mSnakeTrail) { if (index == 0) { setTile(YELLOW_STAR, c.x, c.y); } else { setTile(RED_STAR, c.x, c.y); } index++; } } /** * Simple class containing two integer values and a comparison function. * There's probably something I should use instead, but this was quick and * easy to build. * */ private class Coordinate { public int x; public int y; public Coordinate(int newX, int newY) { x = newX; y = newY; } public boolean equals(Coordinate other) { if (x == other.x && y == other.y) { return true; } return false; } @Override public String toString() { return "Coordinate: [" + x + "," + y + "]"; } } }
3ae8554bb1a0d2826a246787eb5e893613636e95
1462395a20dcdb4f20603a3793cd3d6fa3770658
/src/main/java/com/xiao/wx_order/service/impl/CategoryServiceImpl.java
646166065ba67c23cc9a3f6c0009a926ee605f2c
[]
no_license
xiaoElevener/wx_sell
dbc26d52706cadad8caa7c5d220739b2048d0b98
f786a4535de6f2e78c17ac374c5a97707571cd39
refs/heads/master
2021-08-15T04:03:40.550293
2017-11-17T09:15:37
2017-11-17T09:15:37
111,078,796
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package com.xiao.wx_order.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.xiao.wx_order.entity.ProductCategory; import com.xiao.wx_order.repository.ProductCategoryRepository; import com.xiao.wx_order.service.CategoryService; @Service public class CategoryServiceImpl implements CategoryService { @Autowired private ProductCategoryRepository repository; @Override public ProductCategory findOne(Integer categoryId) { return repository.findOne(categoryId); } @Override public List<ProductCategory> findAll() { return repository.findAll(); } @Override public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) { return repository.findByCategoryTypeIn(categoryTypeList); } @Override public ProductCategory save(ProductCategory productCategory) { return repository.save(productCategory); } }
da5f1fa6a1148c435d51b5adff2b6e6dec0b4bd3
8f18c2f5f90278d3a194b1759434a74cfea22187
/src/edu/rosehulman/serg/smellbuster/gui/TableCell.java
7e384e29a42710ec06d1ffe3b46cb450d8e31c6f
[ "MIT" ]
permissive
RhitSerg/SmellBuster
d0b31d891f5a6a680c1afd59ab00459b9b5d68fc
6fc7f885b6ea07f333645e049527668c826bd0b6
refs/heads/master
2020-06-08T21:43:50.048146
2015-04-24T04:36:52
2015-04-24T04:36:52
25,468,563
0
0
null
null
null
null
UTF-8
Java
false
false
4,548
java
package edu.rosehulman.serg.smellbuster.gui; import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Paint; import java.awt.RenderingHints; import javax.swing.Icon; import javax.swing.JLabel; import edu.rosehulman.serg.smellbuster.logic.ResultTableLogic; public class TableCell extends JLabel { private static final long serialVersionUID = 5620866148119992503L; private int row; private int col; private String[][] dataValues; private String[] columnNames; private int selectedMetric; private ResultTableLogic resultTableLogic; private boolean isHeader; public TableCell() { super(); } public TableCell(String text, int row, int col, ResultTableLogic resultTableLogic) { super(text); this.row = row; this.col = col; this.resultTableLogic = resultTableLogic; this.selectedMetric = 0; this.isHeader = false; } public TableCell(String text, Icon icon, int horizontalAlignment, int row, int col, ResultTableLogic resultTableLogic) { super(text, icon, horizontalAlignment); this.row = row; this.col = col; this.resultTableLogic = resultTableLogic; this.selectedMetric = 0; this.isHeader = false; } public void setDataValues(String[][] dataValues) { this.dataValues = dataValues; } public void setColumnNames(String[] columnNames) { this.columnNames = columnNames; } public void setSelectedMetric(int selectedMetric) { this.selectedMetric = selectedMetric; } public void setIsHeader(boolean isHeader) { this.isHeader = isHeader; } @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); int w = getWidth(); int h = getHeight(); float leftFactor = 0.3f; float rightFactor = 0.7f; GradientPaint[] gp = getGradientPaint(w, leftFactor, rightFactor); Paint oldPaint = g2d.getPaint(); g2d.setPaint(gp[0]); g2d.fillRect(0, 0, (int) (leftFactor * w), h); g2d.setPaint(gp[1]); g2d.fillRect((int) (leftFactor * w), 0, (int) (0.4 * w) + 1, h); g2d.setPaint(gp[2]); g2d.fillRect((int) (rightFactor * w), 0, (int) (leftFactor * w) + 1, h); g2d.setPaint(oldPaint); super.paintComponent(g); } private GradientPaint[] getGradientPaint(int w, float leftFactor, float rightFactor) { Color current = this.getColorForCell(row, col); float leftX = leftFactor * w; float rightX = rightFactor * w; GradientPaint[] gradients = new GradientPaint[] { new GradientPaint(0, 0, current, leftX, 0, current), new GradientPaint(leftX, 0, current, rightX, 0, current), new GradientPaint(rightX, 0, current, w, 0, current) }; this.setFontColor(current); if (this.dataValues[row][col].length() == 0 && !isHeader){ return gradients; }else if (isHeader) { this.setForeground(Color.WHITE); gradients[0] = new GradientPaint(0, 0, Color.BLACK, leftX, 0, Color.BLACK); gradients[1] = new GradientPaint(leftX, 0, Color.BLACK, rightX, 0, Color.BLACK); gradients[2] = new GradientPaint(rightX, 0, Color.BLACK, w, 0, Color.BLACK); return gradients; } if (col == 0) { Color right = this.getColorForCell(row, col + 1); gradients[2] = new GradientPaint(rightX, 0, current, w, 0, right); } else if (col == dataValues[0].length - 1) { Color left = this.getColorForCell(row, col - 1); gradients[0] = new GradientPaint(0, 0, left, leftX, 0, current); } else { Color left = this.getColorForCell(row, col - 1); Color right = this.getColorForCell(row, col + 1); String leftCell = this.dataValues[row][col-1]; if (!current.equals(left) && leftCell.length()==0) { gradients[0] = new GradientPaint(0, 0, left, leftX, 0, current); } if (!current.equals(right)) { gradients[2] = new GradientPaint(rightX, 0, current, w, 0, right); } } return gradients; } private Color getColorForCell(int row, int col) { String value = this.dataValues[row][col]; if (value.length() == 0) { return Color.LIGHT_GRAY; } return this.resultTableLogic.getColorForMetricScore( this.selectedMetric, value, this.columnNames[col]); } private void setFontColor(Color currentColor) { int r = currentColor.getRed(); int g = currentColor.getGreen(); int b = currentColor.getBlue(); int d = 0; double a = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255; if (a < 0.5) d = 0; else d = 255; Color newColor = new Color(d, d, d); this.setForeground(newColor); } }
670ca89eced4d29267adf0dc7fcc33e4838c664b
f8cb6ba0fb47ae01b2620b4603504f14fddab0b7
/ibator/src/org/mybatis/generator/config/MergeConstants.java
fdd2cfa1fd5a378ed6ca3247175ed476ad6215c8
[]
no_license
shijiyu/mybatis-tool
3a4015c9370f7ba471a3932e28f7acf3722cd2d6
1cef575358489ded82293d488418365a0978a928
refs/heads/master
2020-04-05T02:32:31.686876
2018-11-08T02:56:08
2018-11-08T02:56:08
156,480,967
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package org.mybatis.generator.config; public class MergeConstants { public static final String[] OLD_XML_ELEMENT_PREFIXES = { "ibatorgenerated_", "abatorgenerated_" }; public static final String NEW_ELEMENT_TAG = "@ibatorgenerated"; public static final String[] OLD_ELEMENT_TAGS = { "@ibatorgenerated", "@abatorgenerated", "@mbggenerated" }; }
e4332f827842f7e5518b61872ac3bf0164f3c3a1
f47601411f4be6f5af44b5d4ce5be212f393ecd2
/core/src/thread/thread_0428/ThreadInterrupt.java
7027616923b08802e3c0841010b199e669594c76
[]
no_license
Gussie998/Web
cde0a6f4165b6c3ab694204621a26d6ad9584ebd
8b40c178675692ab3cec8a7252bda8e829394ede
refs/heads/master
2023-07-09T11:33:19.239580
2021-08-07T12:17:24
2021-08-07T12:17:24
353,667,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,179
java
package thread.thread_0428; /** * User:DELL * Date:2021-04-28 * Time:10:46 */ public class ThreadInterrupt { public static boolean flag = false; public static void main(String[] args) throws InterruptedException { Thread t1 = new Thread(new Runnable() { @Override public void run() { while (!flag){ try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("转账 ing"); } System.out.println("转账 stop"); } }); t1.start(); Thread t2 = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(310); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("有内鬼,终止交易"); flag=true; } }); t2.start(); t1.join(); t2.join(); } }
cf3ec8a1fd4a602ef041d7168252cc5b0bbe91f3
0f9bd20b5e26323150f564bd6a7b3c2f95cd78d3
/src/main/java/com/bdth/traceplus/domain/BaseResult.java
5a885550266c8f88ea3cf2efb1cc167b66348641
[]
no_license
kokoroni0607/tracePlus
ced817ab9fa607f96ff33898537a8344bcdc5216
e2d641a907b552e7f2092b9e72b70aa87ccbf42a
refs/heads/master
2022-06-25T18:29:01.676969
2019-06-15T08:05:36
2019-06-15T08:05:36
192,052,784
0
0
null
2022-06-21T01:17:16
2019-06-15T08:00:27
Java
UTF-8
Java
false
false
1,538
java
package com.bdth.traceplus.domain; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; /** * @author weiming.zhu * @date 2019/4/22 9:45 */ @Data @NoArgsConstructor @JsonInclude(value = JsonInclude.Include.NON_NULL) @Builder public class BaseResult implements Serializable { private static final long serialVersionUID = 1L; private String msg; private Integer code; private Object data; private Page page; public BaseResult(String msg, Integer code, Object data) { this.msg = msg; this.code = code; this.data = data; } public BaseResult(String msg, Integer code, Object data, Page page) { this.msg = msg; this.code = code; this.data = data; this.page = page; } public static BaseResult success(Object data) { return new BaseResult("success", 200, data); } public static BaseResult successPage(Object data, Page page) { return new BaseResult("success", 200, data, page); } public static BaseResult failed(Object data) { return new BaseResult("failed", 201, data); } public static BaseResult failed(String message,Object data) { return new BaseResult(message, 201, data); } public static BaseResult detail(String msg, Integer code, Object data) { return new BaseResult(msg, code, data); } }
7cc932a8ac4fda0c2285cfbeee01d103aaa6660c
6675ae81570c84e5c5feb7d0f0f91301fe57b311
/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
4462690ed2b1ce7eae65676d9b3e9be817b268eb
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
GeoPlatform/sis
babf402d7239bf285f6a3c80ca1f5bbdda01b5d5
5f24c696d3f54c1dfb5b42342cda2bdb6b80783b
refs/heads/trunk
2021-01-15T14:34:34.887850
2017-01-12T06:01:13
2017-01-12T06:01:13
78,760,242
0
0
null
2017-01-12T15:41:32
2017-01-12T15:41:32
null
UTF-8
Java
false
false
9,400
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.sis.storage; import java.util.Locale; import java.util.NoSuchElementException; import org.opengis.metadata.Metadata; import org.apache.sis.util.Localized; import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.logging.WarningListener; import org.apache.sis.util.logging.WarningListeners; /** * Manages a series of features, coverages or sensor data. * * <div class="section">Thread safety policy</div> * This {@code DataStore} base class is thread-safe. However subclasses do not need to be thread-safe. * Unless otherwise specified, users should assume that {@code DataStore} instances are not thread-safe. * * @author Johann Sorel (Geomatys) * @author Martin Desruisseaux (Geomatys) * @since 0.3 * @version 0.8 * @module * * @see DataStores#open(Object) */ public abstract class DataStore implements Localized, AutoCloseable { /** * The factory that created this {@code DataStore} instance, or {@code null} if unspecified. * This information can be useful for fetching information common to all {@code DataStore} * instances of the same class. * * @since 0.8 */ protected final DataStoreProvider provider; /** * The store name (typically filename) for formatting error messages, or {@code null} if unknown. * Shall <strong>not</strong> be used as an identifier. * * @see #getDisplayName() */ private final String name; /** * The locale to use for formatting warnings. * This is not the locale for formatting data in the storage. * * @see #getLocale() * @see #setLocale(Locale) */ private Locale locale; /** * The set of registered {@link WarningListener}s for this data store. */ protected final WarningListeners<DataStore> listeners; /** * Creates a new instance with no provider and initially no listener. */ protected DataStore() { provider = null; name = null; locale = Locale.getDefault(Locale.Category.DISPLAY); listeners = new WarningListeners<>(this); } /** * Creates a new instance for the given storage (typically file or database). * The {@code provider} argument is an optional information. * The {@code connector} argument is mandatory. * * @param provider the factory that created this {@code DataStore} instance, or {@code null} if unspecified. * @param connector information about the storage (URL, stream, reader instance, <i>etc</i>). * @throws DataStoreException if an error occurred while creating the data store for the given storage. * * @since 0.8 */ protected DataStore(final DataStoreProvider provider, final StorageConnector connector) throws DataStoreException { ArgumentChecks.ensureNonNull("connector", connector); this.provider = provider; this.name = connector.getStorageName(); this.locale = Locale.getDefault(Locale.Category.DISPLAY); this.listeners = new WarningListeners<>(this); /* * Above locale is NOT OptionKey.LOCALE because we are not talking about the same locale. * The one in this DataStore is for warning and exception messages, not for parsing data. */ } /** * Returns a short name or label for this data store. * The returned name can be used in user interfaces or in error messages. * It may be a title in natural language, but should be relatively short. * The name may be localized in the language specified by the value of {@link #getLocale()} * if this data store is capable to produce a name in various languages. * * <p>This name should not be used as an identifier since there is no guarantee that the name * is unique among data stores, and no guarantee that the name is the same in all locales. * The name may also contain any Unicode characters, including characters usually not allowed * in identifiers like white spaces.</p> * * <p>This method should never throw an exception since it may be invoked for producing error * messages, in which case throwing an exception here would mask the original exception.</p> * * <p>Default implementation returns the {@link StorageConnector#getStorageName()} value, * or {@code null} if this data store has been created by the no-argument constructor. * Note that this default value may change in any future SIS version. Subclasses should * override this method if they can provide a better name.</p> * * @return a short name of label for this data store, or {@code null} if unknown. * * @since 0.8 */ public String getDisplayName() { return name; } /** * The locale to use for formatting warnings and other messages. This locale if for user interfaces * only – it has no effect on the data to be read or written from/to the data store. * * <p>The default value is the {@linkplain Locale#getDefault() system default locale}.</p> */ @Override public synchronized Locale getLocale() { return locale; } /** * Sets the locale to use for formatting warnings and other messages. * In a client-server architecture, it should be the locale on the <em>client</em> side. * * <p>This locale is used on a <cite>best-effort</cite> basis; whether messages will honor this locale or not * depends on the code that logged warnings or threw exceptions. In Apache SIS implementation, this locale has * better chances to be honored by the {@link DataStoreException#getLocalizedMessage()} method rather than * {@code getMessage()}. See {@code getLocalizedMessage()} javadoc for more information.</p> * * @param locale the new locale to use. * * @see DataStoreException#getLocalizedMessage() */ public synchronized void setLocale(final Locale locale) { ArgumentChecks.ensureNonNull("locale", locale); this.locale = locale; } /** * Returns information about the dataset as a whole. The returned metadata object, if any, can contain * information such as the spatiotemporal extent of the dataset, contact information about the creator * or distributor, data quality, update frequency, usage constraints and more. * * @return information about the dataset, or {@code null} if none. * @throws DataStoreException if an error occurred while reading the data. */ public abstract Metadata getMetadata() throws DataStoreException; /** * Adds a listener to be notified when a warning occurred while reading from or writing to the storage. * When a warning occurs, there is a choice: * * <ul> * <li>If this data store has no warning listener, then the warning is logged at * {@link java.util.logging.Level#WARNING}.</li> * <li>If this data store has at least one warning listener, then all listeners are notified * and the warning is <strong>not</strong> logged by this data store instance.</li> * </ul> * * Consider invoking this method in a {@code try} … {@code finally} block if the {@code DataStore} * lifetime is longer than the listener lifetime, as below: * * {@preformat java * datastore.addWarningListener(listener); * try { * // Do some work... * } finally { * datastore.removeWarningListener(listener); * } * } * * @param listener the listener to add. * @throws IllegalArgumentException if the given listener is already registered in this data store. */ public void addWarningListener(final WarningListener<? super DataStore> listener) throws IllegalArgumentException { listeners.addWarningListener(listener); } /** * Removes a previously registered listener. * * @param listener the listener to remove. * @throws NoSuchElementException if the given listener is not registered in this data store. */ public void removeWarningListener(final WarningListener<? super DataStore> listener) throws NoSuchElementException { listeners.removeWarningListener(listener); } /** * Closes this data store and releases any underlying resources. * * @throws DataStoreException if an error occurred while closing this data store. */ @Override public abstract void close() throws DataStoreException; }
77560c60eebf9e7ce02733ebe6ae64985d1d7a1c
ab7c05a76ded0e6341c72b2c5f7a4e4647fe3f8f
/src/Die.java
8eaaf40d9418a937f13edf4e9543201f164a3c1c
[]
no_license
MpenduloNk/Project_Dice
60ac6d6005137b728e7e3f1c6c91054b41eef951
287cb00553dfdcd2ceef772bb0996370bb2a7c5d
refs/heads/master
2022-04-22T04:07:39.411143
2020-04-20T09:21:35
2020-04-20T09:21:35
257,230,364
0
0
null
null
null
null
UTF-8
Java
false
false
1,228
java
import java.util.Random; import java.util.Scanner; public class Die { public int sides; public int[] probabilities; public Die(int sides, int[] probabilities){ this.sides = sides; this.probabilities = probabilities; setProbabilities(probabilities); } public int roll(){ int min = 0; Random diceNumber = new Random(); return diceNumber.nextInt((sides - min) + 1) + min; } public int[] setProbabilities(int[] probabilities){ int totalSum = 0; if (probabilities.length == 0 && roll() == 6){ probabilities = new int[]{1,1,1,1,1,1}; } if (probabilities.length == 0 && roll() == 10){ probabilities = new int[]{1,1,1,1,1,1,1,1,1,1}; } for (int i = 0; i < probabilities.length; i++) { if (probabilities[i] < 0){ System.out.println("ERROR: negative probabilities not allowed"); totalSum = 1; break; } totalSum += probabilities[i]; } if (totalSum < 1){ System.out.println("ERROR: probability sum must be greater than 0"); } return probabilities; } }
884a9b6e940155fc3f4698c18e4b4aeb786db2c7
16b20c1ef3f133607b9124c36ed10500ac383267
/test/front_end/view/TestHeader.java
22957340aabf61d52156087e3b65b6259b36197f
[]
no_license
klhutch/AskNote
2fbe82ed890998b99ea096b83ac73772594063ee
927bb40739ecb6bdc0edb60a0d7e0304b9217bf3
refs/heads/master
2021-01-18T19:42:12.912978
2015-12-05T16:03:56
2015-12-05T16:03:56
45,583,181
0
0
null
null
null
null
UTF-8
Java
false
false
817
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 front_end.view; import java.net.MalformedURLException; import javax.swing.*; import view.*; /** * * @author Maha Alkhairy */ public class TestHeader { public static void main (String[] argv) throws MalformedURLException { JFrame f = new JFrame (); // Set the title and other parameters. f.setTitle ("AskNote"); f.setResizable (true); // Background is going to be Panel's background. // f.getContentPane().setBackground (Color.cyan); f.setSize (1000, 600); f.getContentPane().add (new HeaderPanel("Home", 0)); // Show the frame. f.setVisible (true); } }
7594564e2a1867fc4f3a14f3e2eac375da716edf
f1a206f40aa450771cf9ce14091189764f8fe8c9
/src/primeNumber/PrimeNumber.java
24f14ccbdc004d3afe3cd0ec6cbabbf644905552
[]
no_license
cincinik/ProgrammrChallenges
d7bf423485e84e9b8cd2ba6300e80e89ec238c60
133ad1da9b5998c7012521b245f685958441a5c5
refs/heads/master
2021-01-24T12:36:21.623288
2018-03-07T18:41:30
2018-03-07T18:41:30
123,138,231
0
0
null
null
null
null
UTF-8
Java
false
false
902
java
/* package for prime number validation * Version 1.0 * © 2018 Lori, Inc. All rights reserved. */ package primeNumber; import java.util.Scanner; /**Class PrimeNumber - tests if an input number is prime o not * @author Lori * @version 1.0 February 2018 */ public class PrimeNumber { public static Scanner scanner = new Scanner(System.in); public static int y; public static int i = 2; public static void main(String[] args) { System.out.println("Insert number: "); y = scanner.nextInt(); // while loop to divide the number to all its predecesors while(i<y){ if (y%i==0){ System.out.println("Not prime"); break; } else i++; } // if i reaches same value as y, it means it didn't find any divisor if (i==y) System.out.println("Prime"); } }
[ "envy@hp" ]
envy@hp
6e1a0173e8ae08c0873205ae4b0caf399e8b6e53
dbb8f8642ca95a2e513c9afae27c7ee18b3ab7d8
/anchor-image-voxel/src/main/java/org/anchoranalysis/image/voxel/iterator/neighbor/kernel/WalkPredicate.java
da900c410bc614acffe6ed643d960cc8b98f921e
[ "Apache-2.0", "MIT" ]
permissive
anchoranalysis/anchor
19c2a40954515e93da83ddfc99b0ff4a95dc2199
b3b589e0d76f51b90589893cfc8dfbb5d7753bc9
refs/heads/master
2023-07-19T17:38:19.940164
2023-07-18T08:33:10
2023-07-18T08:33:10
240,029,306
3
0
MIT
2023-07-18T08:33:11
2020-02-12T14:12:28
Java
UTF-8
Java
false
false
6,582
java
/*- * #%L * anchor-image-voxel * %% * Copyright (C) 2010 - 2021 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche * %% * 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. * #L% */ package org.anchoranalysis.image.voxel.iterator.neighbor.kernel; import java.util.Optional; import java.util.function.Supplier; import lombok.AllArgsConstructor; import org.anchoranalysis.image.voxel.buffer.primitive.UnsignedByteBuffer; import org.anchoranalysis.image.voxel.kernel.BufferRetriever; import org.anchoranalysis.image.voxel.kernel.KernelPointCursor; /** * Walks in X, Y and Z directions from a point, test a {@link NeighborPredicate} to determine if a * neighbor satisfies conditions. * * <p>As soon as any neighbor matches the predicate, a true value is returned for the voxel. A false * is returned only if no neighbors match the predicate. * * @author Owen Feehan */ @AllArgsConstructor public class WalkPredicate { /** The cursor used for iterating through points. */ private final KernelPointCursor point; /** Whether a neighbor qualifies or not. */ private final NeighborPredicate predicate; /** * Whether to use a big-neighborhood or not. * * <p>if true, a big neighborhood is used 2D-plane (8-connected instead of 4-connected), but not * in Z-direction (remains 2-connected). */ private final boolean bigNeighborhood; /** * Do any neighboring voxels in <i>any</i> direction satisfy the predicate? * * @param buffer the buffer associated with the current slice * @param bufferRetriever a means of retrieving buffers for other slices, accepting a relative * shift compared to current slice (e.g. -1, +1) etc. * @return true iff at least one neighbor voxel in <i>any</i> direction satisfies the predicate. */ public boolean walk(UnsignedByteBuffer buffer, BufferRetriever bufferRetriever) { return walkX(buffer) || walkY(buffer) || walkZ(bufferRetriever) || maybeQualifyFromBigNeighborhood(buffer); } /** Do any neighboring voxels in X direction qualify the voxel? */ private boolean walkX(UnsignedByteBuffer buffer) { // We walk up and down in x point.decrementX(); if (testIf(point.nonNegativeX(), () -> buffer, 0)) { point.incrementX(); return true; } point.incrementXTwice(); try { if (testIf(point.lessThanMaxX(), () -> buffer, 0)) { return true; } } finally { point.decrementX(); } return false; } /** Do any neighboring voxels in Y direction qualify the voxel? */ private boolean walkY(UnsignedByteBuffer buffer) { point.decrementY(); if (testIf(point.nonNegativeY(), () -> buffer, 0)) { point.incrementY(); return true; } point.incrementYTwice(); try { if (testIf(point.lessThanMaxY(), () -> buffer, 0)) { return true; } } finally { point.decrementY(); } return false; } /** Do any neighboring voxels in Z direction qualify the voxel? */ private boolean walkZ(BufferRetriever bufferRetriever) { if (point.isUseZ()) { return qualifyFromZDirection(bufferRetriever, -1) || qualifyFromZDirection(bufferRetriever, +1); } else { return false; } } /** * If big-neighbor is enabled, do any voxels from the big neighborhood (not already covered) * qualify the voxel? */ private boolean maybeQualifyFromBigNeighborhood(UnsignedByteBuffer buffer) { return bigNeighborhood && qualifyFromBigNeighborhood(buffer); } /** Do any voxels from the big neighborhood (not already covered) qualify the voxel? */ private boolean qualifyFromBigNeighborhood(UnsignedByteBuffer buffer) { // x-1, y-1 point.decrementX(); point.decrementY(); if (testIf(point.nonNegativeX() && point.nonNegativeY(), () -> buffer, 0)) { point.incrementX(); point.incrementY(); return true; } // x-1, y+1 point.incrementYTwice(); if (testIf(point.nonNegativeX() && point.lessThanMaxY(), () -> buffer, 0)) { point.incrementX(); point.decrementY(); return true; } // x+1, y+1 point.incrementXTwice(); if (testIf(point.lessThanMaxX() && point.lessThanMaxY(), () -> buffer, 0)) { point.decrementX(); point.decrementY(); return true; } // x+1, y-1 point.decrementYTwice(); try { if (testIf(point.lessThanMaxX() && point.nonNegativeY(), () -> buffer, 0)) { return true; } } finally { point.decrementX(); point.incrementY(); } return false; } /** Does a neighbor voxel in <b>a specific Z-direction</b> qualify the voxel? */ private boolean qualifyFromZDirection(BufferRetriever bufferRetriever, int zShift) { Optional<UnsignedByteBuffer> buffer = bufferRetriever.getLocal(zShift); return testIf(buffer.isPresent(), buffer::get, zShift); } private boolean testIf(boolean inside, Supplier<UnsignedByteBuffer> buffer, int zShift) { return predicate.test(inside, point, buffer, zShift); } }
3f95a4dc5e559ce8e16957dc69e7c3e84eb62fd5
dff6d0e75edf6859bf4ecfa7597bad720eb775cd
/src/application/Movable.java
2709bde1a5a1cdc5a6f997024d534399c5526d97
[]
no_license
ShibutaniKouhei/RPGFX
fe7af41fc2f73bd55a0f2119d68a3167b731ad7e
1ad049cd95779bc33ae8f3b8b95d075a3004b913
refs/heads/master
2020-05-15T03:03:43.834046
2019-04-19T10:59:47
2019-04-19T10:59:47
182,060,875
0
0
null
null
null
null
UTF-8
Java
false
false
165
java
package application; public interface Movable{ String move(Character c); // void introduce(); // boolean isDead(); // String getName(); // int getHp(); }
19027a4ae6dd0f0740e1dd0ea93babf48cc5c835
c672d5f26dc34abf2173951384fa5740c71cf16c
/TaskOne.java
43c6cad185dd61bc1c365f22bf585fc2db23d8da
[]
no_license
Graphickorir/zeraki
c952a5f358480d3867c5cf3614bd94058ab1c531
19682ef90f640fa4bb3de810efc64649481e15c0
refs/heads/main
2022-12-29T00:24:40.755766
2020-10-18T19:52:21
2020-10-18T19:52:21
305,184,231
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
import java.util.Arrays; public class TaskOne { public static void main(String[] args) { int[] k = {3,5,4,1}; System.out.println(missingInt(k)); } private static int missingInt(int[] k){ Arrays.sort(k); int s = k.length; int val = 0; for (int i=0;i < s;i++){ if(i+1 == s) val = k[s-1] + 1; else if(k[i]+1 == k[i+1]){ continue; }else{ val = k[i]+1; break; } } return val; } }
2868676a14b6aa70af64a6c0e6543f30ba8590a2
ceb9fe4fece8e1ca5365ab34894f5774091ededc
/Huanke Space/src/com/huanke/api/ProductService.java
713318ed04dd36c524098a7354b8f79cc0d21804
[]
no_license
mt5225/Huanke
89ac547cfa6b2b48566f6e22ee6e14f35261ec33
a1a46a9d0d26461f718433ad452173808fcfc0bb
refs/heads/master
2021-01-25T12:09:05.612921
2012-03-30T09:25:19
2012-03-30T09:25:19
3,438,176
0
0
null
null
null
null
UTF-8
Java
false
false
4,940
java
package com.huanke.api; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Vector; import org.ksoap2.serialization.SoapObject; import com.huanke.api.soap.Constants; import com.huanke.api.soap.KeyValue; import com.huanke.api.soap.MessageParser; import com.huanke.api.soap.SoapClient; public class ProductService { private SoapClient soapClient; private static final Map<String, String> dummyAttr = new HashMap<String, String>() { private static final long serialVersionUID = 4083541861317888487L; { put("cost", "1.0"); put("status", "1"); put("price", "1.0"); put("short_description", "shortDescription"); put("description", "description"); put("weight", "1.0"); put("tax_class_id", "0"); put("meta_description", "metaDescription"); put("visibility", "4"); } }; public ProductService(SoapClient soapClient) { this.soapClient = soapClient; } private ArrayList<Product> getAllProduct() { ArrayList<Product> list = new ArrayList<Product>(); Map<String, Object> params = new HashMap<String, Object>(); params.put("sessionId", this.soapClient.getSessionID()); try { @SuppressWarnings("rawtypes") List soapResp = (List) soapClient.call(Constants.METHOD_CALL, ResourcePath.ProductList.getPath(), params); for (Object line : soapResp) { list.add(makeProduct(line.toString())); } } catch (Exception e) { e.printStackTrace(); } return list; } /** * Fetch all products * * @return */ public ArrayList<Product> getAllProductFull() { ArrayList<Product> products = getAllProduct(); for (Product p : products) { try { p = getProductDetailsByID(p.getProduct_id()); } catch (Exception e) { e.printStackTrace(); } } return products; } /** * Get product details by id * * @param id * @return * @throws Exception */ public Product getProductDetailsByID(String id) throws Exception { Map<String, Object> params = new HashMap<String, Object>(); params.put("sessionId", this.soapClient.getSessionID()); params.put("args", id); soapClient.clearObjMap(); Object soapResp = soapClient.call(Constants.METHOD_CALL, ResourcePath.ProductInfo.getPath(), params); String line = soapResp.toString(); Product product = makeProduct(line); getMoreDetail(product, line); return product; } /** * Parse soap message and construct product object * * @param line * @return */ private Product makeProduct(String line) { Product p = new Product(); p.setProduct_id(MessageParser.getValueFromString("product_id", line)); p.setSku(MessageParser.getValueFromString("sku", line)); p.setName(MessageParser.getValueFromString("name", line)); return p; } private void getMoreDetail(Product product, String line) { product.setDescription(MessageParser.getValueFromString("description", line)); product.setMeta_description(MessageParser.getValueFromString( "meta_description", line)); product.setShort_description(MessageParser.getValueFromString( "short_description", line)); } /** * Create a new product * * @param product * @return product_id */ public String CreateProduct(Product product) { try { soapClient.clearObjMap(); soapClient.addMapping(new KeyValue()); Object soapResp; soapResp = soapClient.call(Constants.METHOD_CALL, ResourcePath.ProductCreate.getPath(), addAttributeHelper(product)); return (soapResp.toString()); } catch (Exception e) { e.printStackTrace(); } return null; } private Map<String, Object> addAttributeHelper(Product product) { Map<String, Object> params = new HashMap<String, Object>(); params.put("sessionId", this.soapClient.getSessionID()); Vector<Object> args = new Vector<Object>(); args.add("simple"); args.add(4); args.add(product.getSku()); SoapObject so = new SoapObject(Constants.NAMESPACE_SOAPXML, "Map"); KeyValue kv = new KeyValue("name", product.getName()); so.addProperty("item", kv); // TODO add dummy data for future use for (String key : dummyAttr.keySet()) { kv = new KeyValue(key, dummyAttr.get(key)); so.addProperty("item", kv); } args.add(so); params.put("args", args); return params; } /** * delete product * * @param product_id * @return */ public Boolean deleteProduct(String product_id) { Map<String, Object> params = new HashMap<String, Object>(); params.put("sessionId", this.soapClient.getSessionID()); params.put("args", product_id); try { soapClient.clearObjMap(); soapClient.call(Constants.METHOD_CALL, ResourcePath.ProductDelete.getPath(), params); return true; } catch (Exception e) { e.printStackTrace(); } return false; } }
30f85b7720229fbca750ad840a7e7e8616db2952
f87843622ddeab09b12702cd28beb274e2bb8d05
/src/tinymonkeys/vue/VueCarte.java
e4f52cd9a8eaa710765f002481f767a68797fdf5
[]
no_license
Clemzd/GoMonkeys
621b7168e2d1382d031337069461e42a1f7e5434
e34496a060e5037174c444c5c0179a7350e498b1
refs/heads/master
2016-09-05T11:11:47.928478
2014-03-07T23:15:33
2014-03-07T23:15:33
null
0
0
null
null
null
null
MacCentralEurope
Java
false
false
5,637
java
package tinymonkeys.vue; import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; /** * Classe du panneau de la carte. * * @version 1.0 * @author Clťment Guet * */ public class VueCarte extends JPanel { /** * UID auto-g√©n√©r√©. */ private static final long serialVersionUID = 4884966649331011259L; /** * Rapport entre la taille de la carte et la taille de l'√©cran. */ private static final double RAPPORT_ECRAN = 0.75; /** * Constante permettant de placer un objet √† la moiti√© de l'√©cran. */ private static final int DIVISEUR_MILIEU = 2; /** * Constante permettant de placer un objet au quart de l'√©cran. */ private static final int DIVISEUR_QUART = 4; /** * Constante indiquant la couleur des cases repr√©sentant la mer. */ private static final Color OCEAN = new Color(0, 120, 220); /** * Taille de la case en nombre de pixels. */ private int tailleCase; /** * La coordonnee en abscisse du coin sup√©rieur gauche de la grille. */ private int xGrille; /** * La coordonnee en ordonn√©e du coin sup√©rieur gauche de la grille. */ private int yGrille; /** * Largeur de l'ecran en nombre de pixels. */ private final int largeurEcran; /** * Hauteur de l'ecran en nombre de pixels. */ private final int hauteurEcran; /** * Largeur de la grille en nombre de cases. */ private int largeurGrille; /** * Hauteur de la grille en nombre de cases. */ private int hauteurGrille; /** * La carte. */ private int[][] carte; /** * Constructeur de la vue de la carte. * * @param largeurEcran largeur de l'ecran en nombre de pixels. * @param hauteurEcran hauteur de l'ecran en nombre de pixels. * @param carte la carte a dessiner */ public VueCarte(final int largeurEcran, final int hauteurEcran, final int[][] carte) { super(); this.largeurEcran = largeurEcran; this.hauteurEcran = hauteurEcran; this.largeurGrille = carte.length; this.hauteurGrille = carte[0].length; this.copieCarte(carte); this.placementGrille(); this.setBounds(this.xGrille, this.yGrille, this.largeurGrille * this.tailleCase + 1, this.hauteurGrille * this.tailleCase + 1); this.setOpaque(false); } /** * Dessine la carte de l'ile avec la grille. * * @param g le graphique dans lequel dessiner. */ public void paintComponent(final Graphics g) { super.paintComponent(g); dessineIle(g); dessineGrille(g); } /** * Place la carte au centre de l'√©cran. */ private void placementGrille() { final int diviseurLargeur; final int diviseurHauteur; final int largeurCase = (int) ((this.largeurEcran * RAPPORT_ECRAN) / this.largeurGrille); final int hauteurCase = (int) ((this.hauteurEcran * RAPPORT_ECRAN) / this.hauteurGrille); if (largeurCase < hauteurCase) { this.tailleCase = largeurCase; diviseurLargeur = DIVISEUR_QUART; diviseurHauteur = DIVISEUR_MILIEU; } else { this.tailleCase = hauteurCase; diviseurLargeur = DIVISEUR_MILIEU; diviseurHauteur = DIVISEUR_QUART; } this.xGrille = (int) ((this.largeurEcran - (this.tailleCase * this.largeurGrille)) / diviseurLargeur); this.yGrille = (int) ((this.hauteurEcran - (this.tailleCase * this.hauteurGrille)) / diviseurHauteur); } /** * Dessine la grille. * * @param g le graphique dans lequel dessiner. */ public void dessineGrille(final Graphics g) { //La grille apparait en noir. g.setColor(Color.BLACK); //colonnes for (int i = 0; i <= (this.tailleCase * this.largeurGrille); i += this.tailleCase) { g.drawLine(i, 0, i, this.tailleCase * this.hauteurGrille); } //lignes for (int j = 0; j <= this.tailleCase * this.hauteurGrille; j += this.tailleCase) { g.drawLine(0, j, this.tailleCase * this.largeurGrille, j); } } /** * Dessine l'ile. * * @param g le graphique dans lequel dessiner. */ public void dessineIle(final Graphics g) { for (int i = 0; i < this.largeurGrille; i++) { for (int j = 0; j < this.hauteurGrille; j++) { // Si la case est de type mer. if (this.carte[i][j] == Integer.valueOf(0)) { g.setColor(OCEAN); g.fillRect(i * this.tailleCase, j * this.tailleCase, this.tailleCase, this.tailleCase); } // Coloration inutile pour les cases terre. } } } /** * Modifie la carte de l'ile. * * @param carte la nouvelle carte. */ public void setVueCarte(final int[][] carte) { this.largeurGrille = carte.length; this.hauteurGrille = carte[0].length; this.copieCarte(carte); this.placementGrille(); this.setBounds(this.xGrille, this.yGrille, this.largeurGrille * this.tailleCase + 1, this.hauteurGrille * this.tailleCase + 1); this.setOpaque(false); } /** * Accesseur en lecture de la taille d'une case. * * @return la taille d'une case. */ public int getTailleCase() { return this.tailleCase; } /** * Accesseur en lecture de l'abscisse de la grille. * * @return l'abscisse de la grille. */ public int getXGrille() { return this.xGrille; } /** * Accesseur en lecture de l'ordonnee de la grille. * * @return l'ordonnee de la grille. */ public int getYGrille() { return this.yGrille; } /** * Recopie de la carte dans l'attribut carte. * * @param carte la carte a copier. */ private void copieCarte(final int[][] carte) { this.carte = new int[carte.length][carte[0].length]; for (int i = 0; i < carte.length; i++) { for (int j = 0; j < carte[0].length; j++) { this.carte[i][j] = carte[i][j]; } } } }
aedad555fb7022394e21895f9f62f11aca0a39c4
75ab89823b3719f9a2aa7f48525b2bd819242e25
/poto-spring/src/main/java/com/weibo/poto/spring/ParameterResolverFactoryProxy.java
d5f556873560636a1d745e3083794b66975f1118
[]
no_license
freeCoder-ahl/poto-framework
a5487ebff3c28dd2228231db4b387ea64bccdabc
4530f082d0010f3f5e904e9296aa6e632e0d2ebb
refs/heads/master
2023-08-28T23:09:16.036425
2021-10-15T04:12:33
2021-10-15T04:12:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,011
java
package com.weibo.poto.spring; import com.weibo.poto.bus.common.ParametersResolverFactory; import com.weibo.poto.bus.common.ParametersResolverFactoryImpl; import org.springframework.beans.factory.FactoryBean; import java.util.ArrayList; import java.util.List; public class ParameterResolverFactoryProxy implements FactoryBean<ParametersResolverFactory> { private final List<ParametersResolverFactory> factories; private ParametersResolverFactory parametersResolverFactory; public ParameterResolverFactoryProxy(List<ParametersResolverFactory> defaultFactories) { this.factories = new ArrayList<ParametersResolverFactory>(defaultFactories); } @Override public ParametersResolverFactory getObject() throws Exception { return new ParametersResolverFactoryImpl(factories); } @Override public Class<?> getObjectType() { return ParametersResolverFactoryImpl.class; } @Override public boolean isSingleton() { return true; } }
143f6cbf3b3463a0e6fe888e176d102681117031
dc25b23f8132469fd95cee14189672cebc06aa56
/vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/exif/ExifData.java
52d743c78f911ad7a0c9fc76f5fd2b399fdafde5
[ "Apache-2.0" ]
permissive
nofearnohappy/alps_mm
b407d3ab2ea9fa0a36d09333a2af480b42cfe65c
9907611f8c2298fe4a45767df91276ec3118dd27
refs/heads/master
2020-04-23T08:46:58.421689
2019-03-28T21:19:33
2019-03-28T21:19:33
171,048,255
1
5
null
2020-03-08T03:49:37
2019-02-16T20:25:00
Java
UTF-8
Java
false
false
10,048
java
/* * Copyright (C) 2014 MediaTek Inc. * Modification based on code covered by the mentioned copyright * and/or permission notice(s). */ /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.mms.exif; import android.util.Log; import java.io.UnsupportedEncodingException; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * This class stores the EXIF header in IFDs according to the JPEG * specification. It is the result produced by {@link ExifReader}. * * @see ExifReader * @see IfdData */ class ExifData { private static final String TAG = "ExifData"; private static final byte[] USER_COMMENT_ASCII = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x00, 0x00, 0x00 }; private static final byte[] USER_COMMENT_JIS = { 0x4A, 0x49, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00 }; private static final byte[] USER_COMMENT_UNICODE = { 0x55, 0x4E, 0x49, 0x43, 0x4F, 0x44, 0x45, 0x00 }; private final IfdData[] mIfdDatas = new IfdData[IfdId.TYPE_IFD_COUNT]; private byte[] mThumbnail; private final ArrayList<byte[]> mStripBytes = new ArrayList<byte[]>(); private final ByteOrder mByteOrder; ExifData(ByteOrder order) { mByteOrder = order; } /** * Gets the compressed thumbnail. Returns null if there is no compressed * thumbnail. * * @see #hasCompressedThumbnail() */ protected byte[] getCompressedThumbnail() { return mThumbnail; } /** * Sets the compressed thumbnail. */ protected void setCompressedThumbnail(byte[] thumbnail) { mThumbnail = thumbnail; } /** * Returns true it this header contains a compressed thumbnail. */ protected boolean hasCompressedThumbnail() { return mThumbnail != null; } /** * Adds an uncompressed strip. */ protected void setStripBytes(int index, byte[] strip) { if (index < mStripBytes.size()) { mStripBytes.set(index, strip); } else { for (int i = mStripBytes.size(); i < index; i++) { mStripBytes.add(null); } mStripBytes.add(strip); } } /** * Gets the strip count. */ protected int getStripCount() { return mStripBytes.size(); } /** * Gets the strip at the specified index. * * @exceptions #IndexOutOfBoundException */ protected byte[] getStrip(int index) { return mStripBytes.get(index); } /** * Returns true if this header contains uncompressed strip. */ protected boolean hasUncompressedStrip() { return mStripBytes.size() != 0; } /** * Gets the byte order. */ protected ByteOrder getByteOrder() { return mByteOrder; } /** * Returns the {@link IfdData} object corresponding to a given IFD if it * exists or null. */ protected IfdData getIfdData(int ifdId) { if (ExifTag.isValidIfd(ifdId)) { return mIfdDatas[ifdId]; } return null; } /** * Adds IFD data. If IFD data of the same type already exists, it will be * replaced by the new data. */ protected void addIfdData(IfdData data) { mIfdDatas[data.getId()] = data; } /** * Returns the {@link IfdData} object corresponding to a given IFD or * generates one if none exist. */ protected IfdData getOrCreateIfdData(int ifdId) { IfdData ifdData = mIfdDatas[ifdId]; if (ifdData == null) { ifdData = new IfdData(ifdId); mIfdDatas[ifdId] = ifdData; } return ifdData; } /** * Returns the tag with a given TID in the given IFD if the tag exists. * Otherwise returns null. */ protected ExifTag getTag(short tag, int ifd) { IfdData ifdData = mIfdDatas[ifd]; return (ifdData == null) ? null : ifdData.getTag(tag); } /** * Adds the given ExifTag to its default IFD and returns an existing ExifTag * with the same TID or null if none exist. */ protected ExifTag addTag(ExifTag tag) { if (tag != null) { int ifd = tag.getIfd(); return addTag(tag, ifd); } return null; } /** * Adds the given ExifTag to the given IFD and returns an existing ExifTag * with the same TID or null if none exist. */ protected ExifTag addTag(ExifTag tag, int ifdId) { if (tag != null && ExifTag.isValidIfd(ifdId)) { IfdData ifdData = getOrCreateIfdData(ifdId); return ifdData.setTag(tag); } return null; } protected void clearThumbnailAndStrips() { mThumbnail = null; mStripBytes.clear(); } /** * Removes the thumbnail and its related tags. IFD1 will be removed. */ protected void removeThumbnailData() { clearThumbnailAndStrips(); mIfdDatas[IfdId.TYPE_IFD_1] = null; } /** * Removes the tag with a given TID and IFD. */ protected void removeTag(short tagId, int ifdId) { IfdData ifdData = mIfdDatas[ifdId]; if (ifdData == null) { return; } ifdData.removeTag(tagId); } /** * Decodes the user comment tag into string as specified in the EXIF * standard. Returns null if decoding failed. */ protected String getUserComment() { IfdData ifdData = mIfdDatas[IfdId.TYPE_IFD_0]; if (ifdData == null) { return null; } ExifTag tag = ifdData.getTag(ExifInterface.getTrueTagKey(ExifInterface.TAG_USER_COMMENT)); if (tag == null) { return null; } if (tag.getComponentCount() < 8) { return null; } byte[] buf = new byte[tag.getComponentCount()]; tag.getBytes(buf); byte[] code = new byte[8]; System.arraycopy(buf, 0, code, 0, 8); try { if (Arrays.equals(code, USER_COMMENT_ASCII)) { return new String(buf, 8, buf.length - 8, "US-ASCII"); } else if (Arrays.equals(code, USER_COMMENT_JIS)) { return new String(buf, 8, buf.length - 8, "EUC-JP"); } else if (Arrays.equals(code, USER_COMMENT_UNICODE)) { return new String(buf, 8, buf.length - 8, "UTF-16"); } else { return null; } } catch (UnsupportedEncodingException e) { Log.w(TAG, "Failed to decode the user comment"); return null; } } /** * Returns a list of all {@link ExifTag}s in the ExifData or null if there * are none. */ protected List<ExifTag> getAllTags() { ArrayList<ExifTag> ret = new ArrayList<ExifTag>(); for (IfdData d : mIfdDatas) { if (d != null) { ExifTag[] tags = d.getAllTags(); if (tags != null) { for (ExifTag t : tags) { ret.add(t); } } } } if (ret.size() == 0) { return null; } return ret; } /** * Returns a list of all {@link ExifTag}s in a given IFD or null if there * are none. */ protected List<ExifTag> getAllTagsForIfd(int ifd) { IfdData d = mIfdDatas[ifd]; if (d == null) { return null; } ExifTag[] tags = d.getAllTags(); if (tags == null) { return null; } ArrayList<ExifTag> ret = new ArrayList<ExifTag>(tags.length); for (ExifTag t : tags) { ret.add(t); } if (ret.size() == 0) { return null; } return ret; } /** * Returns a list of all {@link ExifTag}s with a given TID or null if there * are none. */ protected List<ExifTag> getAllTagsForTagId(short tag) { ArrayList<ExifTag> ret = new ArrayList<ExifTag>(); for (IfdData d : mIfdDatas) { if (d != null) { ExifTag t = d.getTag(tag); if (t != null) { ret.add(t); } } } if (ret.size() == 0) { return null; } return ret; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj instanceof ExifData) { ExifData data = (ExifData) obj; if (data.mByteOrder != mByteOrder || data.mStripBytes.size() != mStripBytes.size() || !Arrays.equals(data.mThumbnail, mThumbnail)) { return false; } for (int i = 0; i < mStripBytes.size(); i++) { if (!Arrays.equals(data.mStripBytes.get(i), mStripBytes.get(i))) { return false; } } for (int i = 0; i < IfdId.TYPE_IFD_COUNT; i++) { IfdData ifd1 = data.getIfdData(i); IfdData ifd2 = getIfdData(i); if (ifd1 != ifd2 && ifd1 != null && !ifd1.equals(ifd2)) { return false; } } return true; } return false; } }
a03165d3a655a456c5776e995a5b21e179fe8292
381f27b583fbce487976f65714d7a39fb3adecd3
/src/box/box/Boxy_NormalBoard.java
65127a363b2d8cfd465892aaba8566655418c3cb
[]
no_license
slixurd/myBoxyBeta
dd49703aed079010489ced5db0dadfbb12bfdec0
7fb472cc109a6c3c95baaf6784a93164ec292dd3
refs/heads/master
2016-09-05T17:05:27.259606
2013-03-22T08:50:09
2013-03-22T08:50:09
null
0
0
null
null
null
null
GB18030
Java
false
false
2,463
java
package box.box; import org.andengine.extension.physics.box2d.PhysicsConnector; import org.andengine.extension.physics.box2d.PhysicsFactory; import org.andengine.opengl.texture.TextureOptions; import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas; import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory; import org.andengine.opengl.texture.region.ITiledTextureRegion; import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; import com.badlogic.gdx.physics.box2d.FixtureDef; //public class Boxy_NormalBoard extends Boxy_Board{ public class Boxy_NormalBoard extends Boxy_Board { private static BitmapTextureAtlas NormalBoardTextureAtlas; private static ITiledTextureRegion NormalBoardTextureRegion; public final static FixtureDef NormalBoardFixtureDef = PhysicsFactory.createFixtureDef(1f, 0.5f, 0.5f); //固体参数 /** * * @param pX * @param pY * @param length 板长度 * @param angle 板角度 初始竖直 * @param pTextureRegion * @param pVertexBufferObjectManager * @param BoxyActivity */ public Boxy_NormalBoard(float pX, float pY, float length, float angle, MyBoxyBetaActivity BoxyActivity) { super(BoxyActivity); this.x=(float) (pX+(length/2)*Math.sin(angle)); this.y=(float) (pY-(length/2)*(1-Math.cos(angle))); this.angle = angle; this.length = length; BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("pix/"); NormalBoardTextureAtlas= new BitmapTextureAtlas(parent.getTextureManager(), 512, 256,TextureOptions.NEAREST); NormalBoardTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(NormalBoardTextureAtlas,parent,"normal_board_all.png",0,0,21,1); NormalBoardTextureAtlas.load(); int index = (int)((length - 40)/8); // pX+=length/2; // pY+=8.5; NormalBoardTextureRegion.setCurrentTileIndex(index); BoxySprite = new SmoothSprite(x, y, 17, length,NormalBoardTextureRegion, parent.getVertexBufferObjectManager()); BoxyBody = PhysicsFactory.createBoxBody(parent.mPhysicsWorld, x+8.5f, y+length/2, 15, length - 2f, angle,BodyType.StaticBody, NormalBoardFixtureDef); parent.mScene.attachChild(BoxySprite); if(BoxyBody != null) BoxySprite.setUserData(BoxyBody); //测试测试~ parent.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(BoxySprite, BoxyBody,true,true)); BoxySprite.setRotation(angle); } }
26b2d75c6e609de4b44c5fec02a8e903da57062d
23e174316e8eb5c3623c93925f4a5a2d321676a1
/src/main/java/fr/brouillard/oss/jgitver/cfg/schema/ConfigurationSchema.java
3d7ac3b67328cf7b92bff15e009ff822043d1f11
[ "Apache-2.0" ]
permissive
McFoggy/jgitver-maven-plugin
7bef3a3022517a055440227532d5c0e36a382d44
75b4048ab0e5ec336fcd85085a3cdf34156f1ceb
refs/heads/master
2021-01-20T07:29:31.738936
2017-03-15T08:25:01
2017-03-15T09:31:34
90,006,795
0
0
null
2017-05-02T07:57:23
2017-05-02T07:57:23
null
UTF-8
Java
false
false
3,090
java
/** * Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] ([email protected]) * * 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 fr.brouillard.oss.jgitver.cfg.schema; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import fr.brouillard.oss.jgitver.cfg.Configuration; @XmlRootElement(name = "configuration") @XmlAccessorType(XmlAccessType.FIELD) public class ConfigurationSchema { @XmlElement(name = "mavenLike") public boolean mavenLike = true; @XmlElement public boolean autoIncrementPatch = true; @XmlElement public boolean useCommitDistance = false; @XmlElement public boolean useDirty = false; @XmlElement public boolean failIfDirty = false; @XmlElement public boolean useDefaultBranchingPolicy = true; @XmlElement public boolean useGitCommitId = false; @XmlElement public int gitCommitIdLength = 8; @XmlElement public String nonQualifierBranches = "master"; @XmlElement(name = "regexVersionTag") public String regexVersionTag; @XmlElementWrapper(name = "exclusions") @XmlElement(name = "exclusion") public List<String> exclusions = new LinkedList<>(); @XmlElementWrapper(name = "branchPolicies") @XmlElement(name = "branchPolicy") public List<BranchPolicySchema> branchPolicies = new LinkedList<>(); /** * Converts this instance into a {@link Configuration} one. * @return a non null {@link Configuration} object containing the same values than this instance. */ public Configuration asConfiguration() { Configuration c = new Configuration(); c.mavenLike = mavenLike; c.autoIncrementPatch = autoIncrementPatch; c.useCommitDistance = useCommitDistance; c.useDirty = useDirty; c.failIfDirty = failIfDirty; c.useDefaultBranchingPolicy = useDefaultBranchingPolicy; c.useGitCommitId = useGitCommitId; c.gitCommitIdLength = gitCommitIdLength; c.nonQualifierBranches = nonQualifierBranches; c.regexVersionTag = regexVersionTag; c.exclusions.addAll(exclusions); c.branchPolicies.addAll(branchPolicies.stream().map(BranchPolicySchema::asBranchPolicy).collect(Collectors.toList())); return c; } }
7cad42dcf9e44f2b2d61b40dc0807d9033b6f693
52d4ff710666567921eb04ef3b56aa5e26c75da8
/app/src/main/java/com/intkhabahmed/solarcalculator/util/AppConstants.java
43340b34d31e2193928e19cad0e572ed951f8517
[]
no_license
intkhabahmed/Solar-Calculator
8c2d6bf75dacdccd5f7eef03bf24de178a2fff35
f4233f387a76ad34e4c20a6e8259875c05e34e27
refs/heads/master
2020-04-16T13:06:18.767867
2019-01-14T06:59:09
2019-01-14T06:59:09
165,611,562
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.intkhabahmed.solarcalculator.util; public interface AppConstants { int MILLIS_IN_A_DAY = 86400000; /** * The sunrise and moonrise algorithms return values in a double[] vector * where result[RISE] is the time of sun (moon) rise and result[SET] is the * value of sun (moon) set. Sun.riseSetLST() also returns result[ASIMUTH_RISE] * and result[ASIMUTH_SET]. */ int RISE = 0; int SET = 1; /** * ABOVE_HORIZON and BELOW_HORIZON are returned for sun and moon calculations * where the astronomical object does not cross the horizon. */ double ABOVE_HORIZON = Double.POSITIVE_INFINITY; double BELOW_HORIZON = Double.NEGATIVE_INFINITY; /** * Degrees -> Radians: degree * DegRad Radians -> Degrees: radians / DegRad */ double DegRad = (Math.PI / 180.0); }
9a9b8822b98f476c0a7564ecd6552c4cd13f1ef6
06e4817f846f8f3ce4867fd7b4d4bb19fcef2423
/src/EmployeeManager.java
5d80e9a45e49d858a5c17b31f4c9aa70a03211b2
[]
no_license
wilfercala/ProyEmpleados
922869babdbf7898f2450d252ed87376d3bbd01a
f2e40567431e867a16f93759fbb6aaf618594aff
refs/heads/master
2022-12-03T10:19:41.516909
2020-07-28T13:32:53
2020-07-28T13:32:53
281,264,650
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
import java.util.Objects; public class EmployeeManager { public static void main(String args[]) { MenuService.printWelcomeMessage(); Integer optionSelected = null; while (!Objects.equals(optionSelected, MenuService.EXIT)) { MenuService.printMenu(); optionSelected = MenuService.captureOption(); MenuService.processOption(optionSelected); } } }
7d0d70adfccb5da8a4623e3e83af16ddcd3d84f7
67c04a2305bd001d84447ee615dff0e1278ade32
/src/main/java/com/ymnns/his/backend/entity/Prescription_Content.java
cad2909bbd5e3d5d137f8f8f4b17019be4b43a18
[]
no_license
YMNNs/his-springboot-backend
c5247af7e1e6b9cc08e2f2308fa6cfb9fdf25a6a
71eed2bab6dd06f3b4494f649615bf20cfda7ca2
refs/heads/master
2023-03-22T08:07:35.154147
2021-03-13T02:23:17
2021-03-13T02:23:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package com.ymnns.his.backend.entity; import lombok.Data; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity @Data public class Prescription_Content { @Id // 设置自增 @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private Integer prescription_id; private Integer drug_id; private Integer quantity; private Integer status; }
3ba99ed3fb2ca92ef09f9cffe628600426b371eb
f3f93c4ea9a4996eacf1ef1d643aef5fa214e6f9
/src/main/java/com/ankamagames/dofus/core/movement/Map.java
f1bc54a0ecffd76fb38118da3c2aa7799e3c96da
[ "MIT" ]
permissive
ProjectBlackFalcon/BlackFalconAPI
fb94774056eacd053b3daf0931a9ef9c0fb477f6
b038f2f1bc300e549b5f6469c82530b6245f54e2
refs/heads/master
2022-12-05T09:58:36.499535
2019-10-02T21:58:54
2019-10-02T21:58:54
188,725,082
6
0
MIT
2022-11-16T12:22:14
2019-05-26T19:49:10
Java
UTF-8
Java
false
false
869
java
package com.ankamagames.dofus.core.movement; import java.util.List; public class Map { private boolean isUsingNewMovementSystem; private List<CellData> cells; public Map() { } public Map(final boolean isUsingNewMovementSystem, final List<CellData> cells) { this.isUsingNewMovementSystem = isUsingNewMovementSystem; this.cells = cells; } public boolean isUsingNewMovementSystem() { return isUsingNewMovementSystem; } public void setUsingNewMovementSystem(final boolean usingNewMovementSystem) { isUsingNewMovementSystem = usingNewMovementSystem; } public List<CellData> getCells() { return cells; } public void setCells(final List<CellData> cells) { this.cells = cells; } public boolean NoEntitiesOnCell(int cellId) { return true; } }
40e84ad8dd3ff88945f10c71b3540f2470660570
73be283ccea51e97f7a1fa29b7f3c4fa5eb10a21
/src/main/java/com/barlo/numista/security/SecurityConfig.java
f2c25129b6a9f6f6022b835f53b91a2d503d1985
[]
no_license
barlo921/Numista
5b3eaccc4e24052635b3fe123cfb1e89e825369e
4e17f472bd1619723c2e7de53ebc566fb2a9b8fe
refs/heads/webUI
2023-06-21T00:21:59.666854
2022-05-03T12:19:55
2022-05-03T12:19:55
187,077,066
0
0
null
2023-06-14T22:27:14
2019-05-16T17:59:49
Java
UTF-8
Java
false
false
2,870
java
package com.barlo.numista.security; import com.barlo.numista.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension; import static com.barlo.numista.model.users.Role.ADMIN; import static com.barlo.numista.model.users.Role.USER; @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { private final PasswordEncoder passwordEncoder; private final UserService userService; @Autowired public SecurityConfig(PasswordEncoder passwordEncoder, UserService userService) { this.passwordEncoder = passwordEncoder; this.userService = userService; } @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/", "/about", "/connect", "/signup", "/resources/img/**", "/resources/css/**").permitAll() .antMatchers("/numista/**").hasAnyRole(ADMIN.name(), USER.name()) .anyRequest() .authenticated() .and() .formLogin() .loginPage("/login") .usernameParameter("email") .defaultSuccessUrl("/numista", true) .permitAll() ; } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(authenticationProvider()); } @Bean public DaoAuthenticationProvider authenticationProvider() { DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); provider.setPasswordEncoder(passwordEncoder); provider.setUserDetailsService(userService); return provider; } @Bean public SecurityEvaluationContextExtension securityEvaluationContextExtension (){ return new SecurityEvaluationContextExtension(); } }
3f2c75ef87ef26074738b32783e24f7a14091f6d
60ac2c7e52eee0926f86cb39d1622f02e9f73f90
/mcclans-api/src/main/java/nl/riebie/mcclans/api/events/ClanHomeTeleportEvent.java
a7e61f593571f831ffb872983b8c0b15cb273822
[ "MIT" ]
permissive
iLefty/mcClans
a9a19f71b7aa07ac71b2c3586d2cdf0f88908e43
f24da4f3a5c39124448af81d9a150919ae0c5615
refs/heads/master
2021-01-16T18:38:04.574884
2017-08-17T18:30:38
2017-08-17T18:30:38
100,104,303
1
1
null
2017-08-13T13:03:01
2017-08-12T10:06:39
Java
UTF-8
Java
false
false
1,590
java
package nl.riebie.mcclans.api.events; import nl.riebie.mcclans.api.Clan; import nl.riebie.mcclans.api.ClanPlayer; import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.event.cause.NamedCause; /** * Event fired when a Player attempts to start a clan home teleport. Is fired before the countdown or checking the user's economy balance. * <p> * Created by Kippers on 05/02/2017. */ public class ClanHomeTeleportEvent extends CancellableClanEvent { private Clan clan; private ClanPlayer clanPlayer; public ClanHomeTeleportEvent(Clan clan, ClanPlayer clanPlayer) { super("Clan home teleport cancelled by an external plugin", Cause.of(NamedCause.owner(clanPlayer))); this.clan = clan; this.clanPlayer = clanPlayer; } /** * Get the clan whose home is being teleported to. */ public Clan getClan() { return clan; } /** * Get the clan player who is starting a clan home teleport. */ public ClanPlayer getClanPlayer() { return clanPlayer; } /** * The teleporting player used a user command to start the teleport. */ public static class User extends ClanHomeTeleportEvent { public User(Clan clan, ClanPlayer clanPlayer) { super(clan, clanPlayer); } } /** * The teleporting player used an admin command to start the teleport. */ public static class Admin extends ClanHomeTeleportEvent { public Admin(Clan clan, ClanPlayer clanPlayer) { super(clan, clanPlayer); } } }
0f1964b88578b6330488dd995448e221f40441c3
d954876ae141ad266e2ebc280e0fcd8c62ffd722
/app/src/androidTest/java/com/example/pertemuan3_navigationn/ExampleInstrumentedTest.java
48114e38cc84eaa758415e3f26b6cc383e92fbab
[]
no_license
Irwandy19211013/prak3-19211013-irwandy
9304b6a2a78b1105f3d8b327cd1c279ac0507ffb
2d594746e43ebb06b3a212f338cfcf542fe0c837
refs/heads/main
2023-08-21T20:21:13.845930
2021-10-18T15:57:26
2021-10-18T15:57:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package com.example.pertemuan3_navigationn; 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.pertemuan3_navigationn", appContext.getPackageName()); } }
209a0c3d9e59affa85f84b97074243c7156020a3
9b664f13978672bb3fbb666fb585a0a0556e6a3e
/com.kin207.zn.api/src/main/java/com/wx/pay/util/http/TrustAnyTrustManager.java
e3b951f686051b2eecb60d9c138f3b87ab9df96f
[]
no_license
lihaibozi/javaCode
aa36de6ae160e4278bc0d718881db9abbb5c39c0
1fa50e7c88545cfa9d9cd1579d21b1725eef7239
refs/heads/master
2020-03-29T18:11:30.894495
2018-12-27T03:55:16
2018-12-27T03:55:16
150,198,657
0
0
null
null
null
null
UTF-8
Java
false
false
564
java
package com.wx.pay.util.http; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.X509TrustManager; /** * * @author Administrator * */ public class TrustAnyTrustManager implements X509TrustManager{ public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public X509Certificate[] getAcceptedIssuers() { return null; } }