text stringlengths 10 2.72M |
|---|
package be.dpms.medwan.common.model.vo.occupationalmedicine;
import be.mxs.common.model.vo.IIdentifiable;
import be.mxs.common.util.db.MedwanQuery;
import java.io.Serializable;
/**
* User: MichaŽl
* Date: 16-juin-2003
*/
public class RiskProfileRiskCodeVO implements Serializable, IIdentifiable, Comparable {
public Integer riskCodeId;
public String code;
public String messageKey;
public String type;
public Integer status;
//--- COMPARE TO ------------------------------------------------------------------------------
public int compareTo(Object o){
int comp;
if (o.getClass().isInstance(this)){
comp = this.code.compareTo(((RiskProfileRiskCodeVO)o).code);
}
else {
throw new ClassCastException();
}
return comp;
}
//--- RISKPROFILE RISKCODE --------------------------------------------------------------------
public RiskProfileRiskCodeVO(Integer riskCodeId, String code, String messageKey, String type, Integer status) {
this.riskCodeId = riskCodeId;
this.code = code;
this.messageKey = messageKey;
this.type = type;
this.status = status;
}
public Integer getRiskCodeId() {
return riskCodeId;
}
public String getCode() {
return code;
}
public String getMessageKey() {
return messageKey;
}
public String getTranslatedType(String language){
return MedwanQuery.getInstance().getLabel("web.occup",getType(),language);
}
public String getType() {
return type;
}
public Integer getStatus() {
return status;
}
public String getTranslatedStatusMessageKey(String language){
return MedwanQuery.getInstance().getLabel("web.occup",getStatusMessageKey(),language);
}
//--- GET STATUS MESSAGE KEY ------------------------------------------------------------------
public String getStatusMessageKey() {
if (getStatus().intValue() == be.dpms.medwan.common.model.IConstants.RISK_PROFILE_ITEM__STATUS_DEFAULT) {
return be.dpms.medwan.common.model.IConstants.RISK_PROFILE_MESSSAGE_KEY_ITEM__STATUS_DEFAULT;
}
else if (getStatus().intValue() == be.dpms.medwan.common.model.IConstants.RISK_PROFILE_ITEM__STATUS_ADDED) {
return be.dpms.medwan.common.model.IConstants.RISK_PROFILE_MESSSAGE_KEY_ITEM__STATUS_ADDED;
}
else if (getStatus().intValue() == be.dpms.medwan.common.model.IConstants.RISK_PROFILE_ITEM__STATUS_NONE) {
return be.dpms.medwan.common.model.IConstants.RISK_PROFILE_MESSSAGE_KEY_ITEM__STATUS_NONE;
}
// else getStatus().intValue() == be.dpms.medwan.common.model.IConstants.RISK_PROFILE_MESSSAGE_KEY_ITEM__STATUS_REMOVED
return be.dpms.medwan.common.model.IConstants.RISK_PROFILE_MESSSAGE_KEY_ITEM__STATUS_REMOVED;
}
public void setRiskCodeId(Integer riskCodeId) {
this.riskCodeId = riskCodeId;
}
public void setCode(String code) {
this.code = code;
}
public void setMessageKey(String messageKey) {
this.messageKey = messageKey;
}
public void setType(String type) {
this.type = type;
}
public void setStatus(Integer status) {
this.status = status;
}
//--- EQUALS ----------------------------------------------------------------------------------
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof RiskProfileRiskCodeVO)) return false;
final RiskProfileRiskCodeVO riskProfileRiskCodeVO = (RiskProfileRiskCodeVO)o;
return riskCodeId.equals(riskProfileRiskCodeVO.riskCodeId);
}
public int hashCode() {
return riskCodeId.hashCode();
}
}
|
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.sdk.metrics.data;
import java.util.List;
/** A single data point in a timeseries that describes the time-varying value of a double metric. */
public interface DoublePointData extends PointData {
/**
* Returns the value of the data point.
*
* @return the value of the data point.
*/
double getValue();
/** List of exemplars collected from measurements that were used to form the data point. */
@Override
List<DoubleExemplarData> getExemplars();
}
|
package com.vpt.pw.demo.model.FormCrf1;
import com.vpt.pw.demo.model.PregnantWoman;
import com.vpt.pw.demo.model.Team;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@Table(name = "FORM_CRF_1")
@Entity
public class FormCrf1 {
@Id
@GeneratedValue(
strategy = GenerationType.AUTO,
generator = "native"
)
@GenericGenerator(
name = "native",
strategy = "native"
)
@Column(name = "form_crf_1_id")
private Long id;
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "pw_assis_id")
private PregnantWoman pregnantWoman;
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "team_id")
private Team team;
/*@OneToMany(cascade = CascadeType.PERSIST, mappedBy = "form")
private List<UltrasoundExamination> ultrasoundExaminations;
*/
@Column(name = "pw_crf1_02")
private String q02;
@Column(name = "pw_crf1_03")
private String q03;
@Column(name = "pw_crf1_17")
private String q17;
@Column(name = "pw_crf1_18")
private String q18;
@Column(name = "pw_crf1_19")
private String q19;
@Column(name = "refused_reason")
private String refusedReason;
@Column(name = "pw_crf1_38")
private String q38;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getQ02() {
return q02;
}
public void setQ02(String q02) {
this.q02 = q02;
}
public String getQ03() {
return q03;
}
public void setQ03(String q03) {
this.q03 = q03;
}
public String getQ17() {
return q17;
}
public void setQ17(String q17) {
this.q17 = q17;
}
public String getQ18() {
return q18;
}
public void setQ18(String q18) {
this.q18 = q18;
}
public String getQ19() {
return q19;
}
public void setQ19(String q19) {
this.q19 = q19;
}
public String getQ38() {
return q38;
}
public void setQ38(String q38) {
this.q38 = q38;
}
public PregnantWoman getPregnantWoman() {
return pregnantWoman;
}
public void setPregnantWoman(PregnantWoman pregnantWoman) {
this.pregnantWoman = pregnantWoman;
}
public Team getTeam() {
return team;
}
public void setTeam(Team team) {
this.team = team;
}
public String getRefusedReason() {
return refusedReason;
}
public void setRefusedReason(String refusedReason) {
this.refusedReason = refusedReason;
}
}
|
package com.game.cwtetris.ui;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.MotionEvent;
import android.view.View;
import com.game.cwtetris.CanvasView;
import com.game.cwtetris.data.CellPoint;
import com.game.cwtetris.data.GameState;
import com.game.cwtetris.data.ImageCache;
import com.game.cwtetris.data.Point;
import com.game.cwtetris.data.UserSettings;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Created by gena on 1/7/2017.
*/
public class LevelButton extends ImageElement implements View.OnTouchListener {
private int levelNumber;
private int levelColor;
private int cellSize;
private boolean isTwoDigit = false;
private final Paint paintFill = new Paint();
private final Paint paintBorder = new Paint();
private Set<CellPoint> cells;
private final Set<CellPoint> selectedCells = new HashSet<>();
public LevelButton(Point p, int cellSize, int levelNumber, int color) {
super(null, p, cellSize * 9);
this.levelNumber = levelNumber;
this.cellSize = cellSize;
this.levelColor = color;
isTwoDigit = (levelNumber > 9);
width = cellSize * (isTwoDigit?11:7);
cells = LevelButtonNumber.getNumberCells(levelNumber, color);
paintFill.setStyle(Paint.Style.FILL);
paintBorder.setAntiAlias(true);
paintBorder.setColor(Color.BLACK);
paintBorder.setStyle(Paint.Style.STROKE);
paintBorder.setStrokeJoin(Paint.Join.ROUND);
paintBorder.setStrokeWidth(4f);
}
@Override
public void draw(CanvasView view) {
for (int i = 0; i < 8; i++) {
int x1 = x - cellSize/2;
int y1 = y + cellSize / 2 + cellSize * i;
view.mCanvas.drawLine( x1, y1, x1 + width, y1, paintBorder);
}
view.mCanvas.drawLine( x - cellSize/2, y - cellSize/2,
x + cellSize + cellSize/2, y - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - 2 * cellSize - cellSize/2, y - cellSize/2,
x + width - cellSize/2, y - cellSize/2, paintBorder);
view.mCanvas.drawLine( x - cellSize/2, y + height - cellSize/2,
x + cellSize + cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - 2 * cellSize - cellSize/2, y + height - cellSize/2,
x + width - cellSize/2, y + height - cellSize/2, paintBorder);
// y
view.mCanvas.drawLine( x - cellSize/2, y - cellSize/2,
x - cellSize/2, y + cellSize + cellSize/2, paintBorder);
view.mCanvas.drawLine( x - cellSize/2, y + cellSize * 2 + cellSize/2,
x - cellSize/2, y + cellSize * 5 + cellSize/2, paintBorder);
view.mCanvas.drawLine( x - cellSize/2, y + cellSize * 6 + cellSize/2,
x - cellSize/2, y + cellSize * 8 + cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - cellSize/2, y - cellSize/2,
x + width - cellSize/2, y + cellSize + cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - cellSize/2, y + cellSize * 2 + cellSize/2,
x + width - cellSize/2, y + cellSize * 5 + cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - cellSize/2, y + cellSize * 6 + cellSize/2,
x + width - cellSize/2, y + cellSize * 8 + cellSize/2, paintBorder);
view.mCanvas.drawLine( x + cellSize/2, y - cellSize/2,
x + cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + cellSize + cellSize/2, y - cellSize/2,
x + cellSize + cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + cellSize * 2 + cellSize/2, y + cellSize/2,
x + cellSize * 2 + cellSize/2, y + height - cellSize - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - cellSize - cellSize/2, y - cellSize/2,
x + width - cellSize - cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - cellSize * 2 - cellSize/2, y - cellSize/2,
x + width - cellSize * 2 - cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + width - cellSize * 3 - cellSize/2, y + cellSize/2,
x + width - cellSize * 3 - cellSize/2, y + height - cellSize - cellSize/2, paintBorder);
if (isTwoDigit) {
//x
view.mCanvas.drawLine( x + cellSize * 3 + cellSize/2, y - cellSize/2,
x + cellSize * 6 + cellSize/2, y - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + cellSize * 3 + cellSize/2, y + height - cellSize/2,
x + cellSize * 6 + cellSize/2, y + height - cellSize/2, paintBorder);
//y
view.mCanvas.drawLine( x + cellSize * 3 + cellSize/2, y - cellSize/2,
x + cellSize * 3 + cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + cellSize * 4 + cellSize/2, y - cellSize/2,
x + cellSize * 4 + cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + cellSize * 5 + cellSize/2, y - cellSize/2,
x + cellSize * 5 + cellSize/2, y + height - cellSize/2, paintBorder);
view.mCanvas.drawLine( x + cellSize * 6 + cellSize/2, y - cellSize/2,
x + cellSize * 6 + cellSize/2, y + height - cellSize/2, paintBorder);
}
paintFill.setColor(ImageCache.getColor(isLevelEnabled()?levelColor:0));
for (CellPoint cell : getCells()) {
int r = cellSize / 2;
RectF rect = new RectF( x + cell.x * cellSize - r,
y + cell.y * cellSize - r,
x + cell.x * cellSize + r,
y + cell.y * cellSize + r);
view.mCanvas.drawRect(rect, paintFill);
}
}
@Override
public boolean isSelected(float eventX, float eventY) {
return super.isSelected(eventX - width/2 + cellSize / 2, eventY - height/2 + cellSize / 2);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
boolean result = super.onTouch(v, event);
CanvasView view = (CanvasView) v;
if (result && isLevelEnabled()) {
UserSettings.setCurrentLevelToDb( levelNumber );
view.setState(GameState.GAME);
view.newGame(0);
}
return result;
}
public boolean isLevelEnabled() {
return UserSettings.getLevelCompletedValueFromDb() >= levelNumber - 1;
}
public Set<CellPoint> getCells() {
if (levelNumber != UserSettings.getCurrentLevelFromDb()) {
return cells;
}
Set<CellPoint> result = new HashSet<CellPoint>();
result.addAll(cells);
result.addAll(getSelectedCells());
return result;
}
public Set<CellPoint> getSelectedCells() {
if (selectedCells.size() == 0) {
selectedCells.add(new CellPoint(0, 0, levelColor));
selectedCells.add(new CellPoint(1, 0, levelColor));
selectedCells.add(new CellPoint(0, 1, levelColor));
selectedCells.add(new CellPoint(0, 7, levelColor));
selectedCells.add(new CellPoint(0, 8, levelColor));
selectedCells.add(new CellPoint(1, 8, levelColor));
int x = isTwoDigit?9:5;
selectedCells.add(new CellPoint(x, 0, levelColor));
selectedCells.add(new CellPoint(x+1, 0, levelColor));
selectedCells.add(new CellPoint(x+1, 1, levelColor));
selectedCells.add(new CellPoint(x+1, 7, levelColor));
selectedCells.add(new CellPoint(x, 8, levelColor));
selectedCells.add(new CellPoint(x+1, 8, levelColor));
}
return selectedCells;
}
}
|
public class banco{
private double dinero;
private double cantidad;
public void setDinero(double dinero){
this.dinero=dinero;
}
public double Calcula(){
cantidad=dinero*.20;
dinero=dinero+cantidad;
if(cantidad>7000){
dinero*=2;
}
return dinero;
}
} |
package pro.likada.util.converter;
import pro.likada.model.Vehicle;
import pro.likada.service.VehicleService;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
/**
* Created by Yusupov on 3/19/2017.
*/
@FacesConverter("vehicleConverter")
public class VehicleConverter implements Converter {
@Override
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value) {
if (value != null && value.trim().length() > 0) {
FacesContext context = FacesContext.getCurrentInstance();
VehicleService vehicleService = context.getApplication().evaluateExpressionGet(context, "#{vehicleService}", VehicleService.class);
Vehicle vehicle = vehicleService.findById(Long.parseLong(value));
return vehicle;
}
return null;
}
@Override
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) {
if(object!=null){
Vehicle vehicle = (Vehicle) object;
return vehicle.getId()!=null ? vehicle.getId().toString(): "";
}
return "";
}
}
|
package qqclient.view;
import qqclient.service.FileClientService;
import qqclient.service.MessageClientService;
import qqclient.service.UserClientService;
import qqclient.utils.Utility;
/**
* @author xiaochen
* @version 1.0
* @create 2021-09-12 20:54
* 客户端的菜单界面
*/
public class QQView {
private boolean loop = true; // 控制是偶发显示菜单
private String key = ""; //接收用户的键盘输入
private UserClientService userClientService = new UserClientService(); //对象是用户登录/注册用户
private MessageClientService messageClientService = new MessageClientService(); //对象用户私聊/群聊
private FileClientService fileClientService = new FileClientService(); //该对象用于传输文件
public static void main(String[] args) {
new QQView().mainMenu();
System.out.println("客户端退出系统....");
}
//显示主菜单
private void mainMenu() {
while (loop) {
System.out.println("==========欢迎登录系统==========");
System.out.println("\t\t 1 登录系统");
System.out.println("\t\t 9 退出系统");
System.out.print("请输入你的选择: ");
key = Utility.readString(1);
//根据用户的输入,来处理不同的逻辑
switch (key) {
case "1":
System.out.print("请输入用户名: ");
String userId = Utility.readString(50);
System.out.print("请输入密 码: ");
String pwd = Utility.readString(50);
// 先编写一个类 UserClientServer 【用户登录/注册】
if (userClientService.checkUser(userId,pwd)) { //登录成功
System.out.println("=====欢迎 (用户 " + userId + " ) 登录成功=====");
//进入二级菜单
while (loop) {
System.out.println("\n===网络通信系统二级菜单(用户 " + userId + " )===");
System.out.println("\t\t 1 显示在线用户列表");
System.out.println("\t\t 2 群发消息");
System.out.println("\t\t 3 私聊消息");
System.out.println("\t\t 4 发送文件");
System.out.println("\t\t 9 退出系统");
System.out.print("请输入你的选择: ");
key = Utility.readString(1);
switch (key) {
case "1":
userClientService.onlineFriendList();
//这里准备写一个方法,来获取在线用户列表
System.out.println("显示在线用户列表");
break;
case "2":
System.out.println("请输入想对大家说的话");
String s = Utility.readString(100);
messageClientService.sendMessageToAll(s, userId);
System.out.println("群发消息");
break;
case "3":
System.out.print("请输入想聊天的用户号(在线):");
String getterId = Utility.readString(50);
System.out.println("请输入想说的话");
String content = Utility.readString(100);
//编写一个方法,将消息发送给服务端
messageClientService.sendMessageToOne(content, userId, getterId);
System.out.println("私聊消息");
break;
case "4":
System.out.print("请输入你想把文件发给哪个用户(在线):");
getterId = Utility.readString(50);
System.out.print("请输入发送文件的路径(d:\\xxx.jpg):");
String src = Utility.readString(100);
System.out.print("请输入要发送到对方的哪个路径:");
String dest = Utility.readString(100);
fileClientService.senFileToOne(src,dest,userId,getterId);
System.out.println("发送文件");
break;
case "9":
//调用方法,给服务器发送退出服务器的消息。
userClientService.logout();
loop = false;
break;
}
}
} else { //登录失败
System.out.println("=======登录失败=======");
}
break;
case "9":
loop = false;
break;
}
}
}
}
|
package socialnetwork.service;
import socialnetwork.domain.*;
import socialnetwork.repository.Repository;
import socialnetwork.repository.Status;
import socialnetwork.repository.exceptions.RepoException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class RequestService {
private Repository<Tuple<Long,Long>, Prietenie> prietenieRepository;
private Repository<Long, Utilizator> utilizatorRepository;
private Repository<Tuple<Long,Long>, Request> requestRepository;
public RequestService(Repository<Tuple<Long, Long>, Prietenie> prietenieRepository, Repository<Long, Utilizator> utilizatorRepository, Repository<Tuple<Long, Long>, Request> requestRepository) {
this.prietenieRepository = prietenieRepository;
this.utilizatorRepository = utilizatorRepository;
this.requestRepository = requestRepository;
}
public void sendRequest(Utilizator user, Long id){
Tuple a = new Tuple(user.getId(),id);
Optional<Utilizator> utilizator = utilizatorRepository.findOne(id);
if(utilizator.isEmpty())
throw new RepoException("Nu exista user-ul!");
Optional<Prietenie> x = prietenieRepository.findOne(new Tuple<>(user.getId(), id));
Optional<Prietenie> y = prietenieRepository.findOne(new Tuple<>( id,user.getId()));
if(!x.isEmpty() || !y.isEmpty())
throw new RepoException("Deja sunteti prieteni!");
Optional b = requestRepository.findOne(a);
if(!b.isEmpty())
throw new RepoException("Cererea deja exista");
Status c = Status.valueOf("pending");
Request request = new Request(user,utilizatorRepository.findOne(id).get(),Status.valueOf("pending"));
requestRepository.save(request);
//Prietenie prietenie = new Prietenie(a);
//prietenieRepository.save(prietenie);
}
public List<Request> getRequests(Utilizator user){
Iterable<Request> all = requestRepository.findAll();
List<Request> All = new ArrayList<>();
all.forEach(All::add);
List<Request> cereri = new ArrayList<>();
// List<Request> cereri = All.stream()
// .filter(x->(x.getTo().getId()==user.getId()))
// .collect(Collectors.toList());
for (Request request : All) {
if(request.getTo().getId()==user.getId())
cereri.add(request);
}
return cereri;
}
public void respondRequest(Utilizator user, Status a, Long id){
Optional<Request> ms = requestRepository.findOne(new Tuple<>(user.getId(),id));
if(ms.isEmpty())
throw new RepoException("Nu exista cererea!");
Request m = requestRepository.findOne(new Tuple<>(user.getId(),id)).get();
Status c = Status.valueOf("pending");
if(m.getStatus()!=c)
throw new RepoException("Cerea deja are un raspuns!");
m.setStatus(a);
requestRepository.update(m);
Prietenie prietenie = new Prietenie(new Tuple(user.getId(),id));
Status b = Status.valueOf("approved");
if(a == b)
prietenieRepository.save(prietenie);
}
public void deleteRequest(Long id, Long id1) {
Status c = Status.valueOf("pending");
if(requestRepository.findOne(new Tuple<>(id,id1)).get().getStatus() != c)
throw new RepoException("You have already received an answer to the request!");
requestRepository.delete(new Tuple<>(id,id1));
}
public void deleteRequest1(Long id, Long id1) {
requestRepository.delete(new Tuple<>(id,id1));
}
public List<Request> getMyRequests(Utilizator user){
Iterable<Request> all = requestRepository.findAll();
List<Request> All = new ArrayList<>();
all.forEach(All::add);
List<Request> cereri = new ArrayList<>();
// List<Request> cereri = All.stream()
// .filter(x->(x.getTo().getId()==user.getId()))
// .collect(Collectors.toList());
for (Request request : All) {
if(request.getFrom().getId()==user.getId())
cereri.add(request);
}
return cereri;
}
}
|
package ClockFigures;
import Lamps.Lamp;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
/**
* Created by Matt on 16/12/2016.
*/
public class SecondsDisplayTest extends DisplayTestSpecification {
private SecondsDisplay display;
@Before
public void init() {
Displays displays = new Displays();
display = new SecondsDisplay(displays);
}
@Test
public void On_off_on_are_Yellow_Off_Yellow() {
List<Lamp> firstActiveDisplays = display.activateDisplays(10);
String firstReturnedColour = firstActiveDisplays.get(0).getColour();
List<Lamp> secondActiveDisplays = display.activateDisplays(11);
String secondReturnedColour = secondActiveDisplays.get(0).getColour();
List<Lamp> thirdActiveDisplays = display.activateDisplays(12);
String thirdReturnedColour = thirdActiveDisplays.get(0).getColour();
assertThat(firstReturnedColour, is("Y"));
assertThat(secondReturnedColour, is("O"));
assertThat(thirdReturnedColour, is("Y"));
}
@Test
public void one_second_returns_off_display() {
String expected = ANSI_BLACK
+ " * *\n"
+ " * *\n"
+ " * O *\n"
+ " * *\n"
+ " * *\n"
+ ANSI_RESET;
display.activateDisplays(1);
assertThat(display.getPrintableDisplay(), is(expected));
}
@Test
public void ten_seconds_returns_yellow_display() {
String expected = ANSI_YELLOW
+ " * *\n"
+ " * *\n"
+ " * Y *\n"
+ " * *\n"
+ " * *\n"
+ ANSI_RESET;
display.activateDisplays(10);
assertThat(display.getPrintableDisplay(), is(expected));
}
}
|
package iterator;
import java.net.MalformedURLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import businessLogic.BLFacade;
import businessLogic.BLFacadeImplementation;
import configuration.ConfigXML;
import dataAccess.DataAccess;
import domain.Event;
import factory.DataMode;
import factory.LocalData;
public class Main {
public static void main(String[] args) throws ParseException, MalformedURLException {
//Facade objektua lortu lehendabiziko ariketa erabiliz
DataMode datamode = new LocalData();
BLFacade appFacadeInterface=datamode.dataMode();
String eguna = "17/03/2020";
String pattern = "dd/MM/yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
Date data = simpleDateFormat.parse(eguna);
ExtendedIterator<Event> i=appFacadeInterface.getEvents(data);
Event ev;
i.goLast();
while (i.hasPrevious()){
ev=i.previous();
System.out.println(ev.toString());
}
//Nahiz eta suposatu hasierara ailegatu garela, eragiketa egiten dugu.
System.out.println();
i.goFirst();
while (i.hasNext()){
ev=i.next();
System.out.println(ev.toString());
}
}
} |
package TicTacToe;
public class Board {
private BoxStatus box[][];
private boolean isFilled;
private int n;
Board(final int n) {
this.n = n;
box = new BoxStatus[n][n];
this.isFilled = false;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++)
box[i][j] = BoxStatus.EMPTY;
}
}
public void getBoard() {
for(int i = 0; i < n ;i++) {
for(int j = 0; j < n; j++)
System.out.print(box[i][j].toString() + " ");
System.out.println();
}
}
private boolean moveInsideBoard(int row, int col) {
return (row >= 0 && row < n && col >= 0 && col < n);
}
private boolean isBoardFilled() {
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(box[i][j] == BoxStatus.EMPTY)
return false;
}
}
return true;
}
public GameStatus makeMove(Move move) throws IllegalStateException {
if(this.isFilled)
return GameStatus.DRAW;
int row = move.row;
int col = move.col;
if(!moveInsideBoard(row, col)) {
throw new IllegalStateException("TicTacToe.Move is out of TicTacToe.Board!");
}
if(box[row][col] != BoxStatus.EMPTY) {
throw new IllegalStateException("Box is not Empty");
}
BoxStatus boxStatus = move.player.getId() == 1 ? BoxStatus.PLAYER_1 : BoxStatus.PLAYER_2;
box[row][col] = boxStatus;
boolean rowWinner = true, colWinner = true, diagWinner = true, revdiagWinner = true;
for(int i = 0; i < n; i++) {
if(box[i][col] != boxStatus)
colWinner = false;
if(box[row][i] != boxStatus)
rowWinner = false;
if(box[i][i] != boxStatus)
diagWinner = false;
if(box[i][n-i-1] != boxStatus)
revdiagWinner = false;
}
if(colWinner || rowWinner || diagWinner || revdiagWinner)
return boxStatus == BoxStatus.PLAYER_1 ? GameStatus.PLAYER_1 : GameStatus.PLAYER_2;
this.isFilled = isBoardFilled();
if(this.isFilled) {
return GameStatus.DRAW;
}
return GameStatus.UNDECIDED;
}
}
|
//Name: Adham Elarabawy
public class MatrixCount1 {
private static int[][] matrix = { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 0 }, { 6, 7, 1, 2, 5 }, { 6, 7, 8, 9, 0 },
{ 5, 4, 3, 2, 1 } };
public static int count(int val) {
int count = 0;
for(int[] x : matrix) {
for(int y : x) {
if(y == val)
count++;
}
}
return count;
}
}
|
package com.esum.comp.tcpip.message;
import java.sql.SQLException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.esum.comp.tcpip.TCPIPCode;
import com.esum.comp.tcpip.TCPIPConfig;
import com.esum.comp.tcpip.TCPIPException;
import com.esum.framework.core.component.ComponentException;
import com.esum.framework.core.component.table.InfoTableManager;
import com.esum.router.RouterConfig;
import com.esum.router.table.svc.SvcInfoRecord;
import com.esum.router.table.svc.SvcInfoTable;
public class XtrusLogin extends Message {
private Logger log = LoggerFactory.getLogger(Message.class);
private String mType = null;
private String mID = null;
private String mPassword = null;
/**
* 생성자
*/
public XtrusLogin() {
super(CodeList.CODE_LOGIN);
}
/**
* 형식(송신 or 수신) 설정
*
* @param type TYPE_SEND or TYPE_RECV
*/
public void setType(String type) {
mType = type;
}
/**
* 로그인 아이디 설정
*
* @param id Login ID
*/
public void setID(String id){
mID = id;
}
/**
* 로그인 암호 설정
*
* @param password Login Password
*/
public void setPassword(String password){
mPassword = password;
}
/**
* 로그인 아이디 리턴
*
* @return String
*/
public String getClientId() {
return mID;
}
/**
* 형식(송신 or 수신) 리턴
*
* @return
*/
public String getType() {
return mType;
}
/* (non-Javadoc)
* @see com.esum.connectors.tcpip.message.Message#build()
*/
public void build() {
// Type
addData(mType);
// ID
addData(mID, 20);
// Password
addData(mPassword, 20);
}
/* (non-Javadoc)
* @see com.esum.connectors.tcpip.message.Message#extract(byte[])
*/
public void extract(byte[] data){
String message = new String(data);
setType(message.substring(3, 4));
setID(message.substring(4, 24).trim());
setPassword(message.substring(24, 44).trim());
}
public boolean checkLogin() {
boolean result = false;
try {
SvcInfoTable infoTable = (SvcInfoTable)InfoTableManager.getInstance().getInfoTable(RouterConfig.SVC_INFO_TABLE_ID);
// log.debug("jinu svc_info:" + infoTable);
SvcInfoRecord infoRecord = (SvcInfoRecord)infoTable.getInfoRecord(mID);
// log.debug("jinu infoTable:" + infoTable);
// log.debug("jinu FtpInfoRecord:" + infoRecord);
if (infoRecord != null) {
//패스워드를 비교하지 않는다.
result = true;
} else {
log.info("record is not exist:" + mID);
}
} catch (ComponentException e) {
log.error("[" + TCPIPConfig.COMPONENT_ID + "] checkLogin() fail", e);
// throw new TCPIPException(e.getErrorCode(), "checkLogin()", e.getMessage());
}
return result;
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("Code: " + getCode() + ", ");
sb.append("Type: " + mType + ", ");
sb.append("ID: " + mID + ", ");
sb.append("Password: " + mPassword);
return sb.toString();
}
}
|
package handin05;
public class MagicSquareTester {
public static void main(String[] args) {
MagicSquare magicSquare = new MagicSquare();
magicSquare.add(1);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
System.out.println();
magicSquare.add(2);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
System.out.println();
magicSquare.add(3);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
System.out.println();
magicSquare.add(4);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
System.out.println();
magicSquare.add(5);
magicSquare.add(6);
magicSquare.add(7);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
System.out.println();
magicSquare.add(8);
magicSquare.add(9);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
System.out.println();
magicSquare.add(11);
magicSquare.add(9);
magicSquare.add(11);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
System.out.println();
System.out.println("magicSquare.clearSquare:");
magicSquare.clearSquare();
System.out.println(magicSquare.toString());
System.out.println();
magicSquare.add(8);
magicSquare.add(1);
magicSquare.add(6);
magicSquare.add(3);
magicSquare.add(5);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println();
magicSquare.add(7);
magicSquare.add(4);
magicSquare.add(9);
magicSquare.add(2);
System.out.println("magicSquare:");
System.out.println(magicSquare.toString());
System.out.println("magicSquare.isSquare: " + magicSquare.isSquare());
System.out.println("magicSquare.isCorrectNumberSequence: " + magicSquare.isCorrectNumberSequence());
System.out.println("magicSquare.isMagic: " + magicSquare.isMagic());
}
}
|
package com.atlassian.theplugin.idea.ui;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
/**
* User: jgorycki
* Date: Mar 5, 2009
* Time: 11:34:17 AM
*/
public class WhiteLabel extends JLabel {
public WhiteLabel() {
setForeground(UIUtil.getTableForeground());
}
}
|
package com.mingrisoft;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class ConsoleWriter {
public static void main(String[] args) {
System.out.println("请输入要保存的字符串:");// 提示用户输入字符串
Scanner scanner = new Scanner(System.in);// 获得控制台输入流
String text = scanner.nextLine();// 获得用户输入
FileWriter writer = null;
try {
writer = new FileWriter("d://test.txt");// 获得文件写入流
writer.write(text);// 写入字符串
writer.flush();// 刷新缓存
} catch (IOException e) {
e.printStackTrace();
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
|
package com.whoisericballard.gsenchants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.whoisericballard.gsenchants.EnchantmentType.Category;
import com.whoisericballard.gsenchants.EnchantmentType.Enchantments;
import com.whoisericballard.gsenchants.EnchantmentType.Types;
import com.whoisericballard.gsenchants.commands.handlers.CooldownHandler;
import net.md_5.bungee.api.ChatColor;
public class Enchantment {
EnchantmentType.Enchantments eType;
Category eCat;
Rarity rarity;
public Enchantment(Enchantments enchant) {
this.rarity = enchant.getRarity();
this.eCat = enchant.getCategory();
this.eType = enchant;
}
public Category getCategory() {
return this.eCat;
}
public Enchantments getType() {
return this.eType;
}
public Rarity getRarity() {
return this.rarity;
}
public static boolean isEnchanted(ItemStack item, Location l) {
for (UUID id : CooldownHandler.nulled.keySet()) {
Location llcoolj = CooldownHandler.nulled.get(id);
if (l.distance(llcoolj) < 10)
return false;
}
if (item != null && item.getItemMeta() != null && item.getItemMeta().getLore() != null)
return (Enchantments.getByName((ChatColor.stripColor(item.getItemMeta().getLore().get(0))).split(" ")[0].replace("[", "").trim()) != null);
return false;
}
public static Enchantment getEnchant(ItemStack item) {
if (item.getItemMeta() != null && item.getItemMeta().getLore() != null)
return (new Enchantment(Enchantments.getByName((ChatColor.stripColor(item.getItemMeta().getLore().get(0))).split(" ")[0].replace("[", "").trim())));
return null;
}
public static ItemStack getSacredPiece(String title, Category eCat) {
ItemStack eP = null;
eP = new ItemStack(Material.NETHER_BRICK_ITEM, 1);
ItemMeta im = eP.getItemMeta();
im.setDisplayName(title);
im.setLore(Arrays.asList(new String[] { ChatColor.DARK_GRAY + "[" + Category.getChatColor(eCat) + eCat.name() + ChatColor.GRAY + " Enchantment" + ChatColor.DARK_GRAY + "]", "", ChatColor.GRAY + "Right click to receieve a random enchantment" }));
eP.setItemMeta(im);
return eP;
}
public static ItemStack getEnchantPiece(String title, Category eCat) {
ItemStack eP = null;
if (eCat == Category.Partial)
eP = new ItemStack(Material.FLINT, 1);
else if (eCat == Category.Impartial)
eP = new ItemStack(Material.QUARTZ, 1);
else
eP = new ItemStack(Material.INK_SACK, 1, Category.getColor(eCat));
ItemMeta im = eP.getItemMeta();
im.setDisplayName(Category.getChatColor(eCat) + Category.getIngedientName(eCat));
im.setLore(Arrays.asList(new String[] { ChatColor.DARK_GRAY + "Type: " + title.split(" ")[0], "", ChatColor.GRAY + "Place on Book For Results" }));
eP.setItemMeta(im);
return eP;
}
public static ItemStack getEnchantBook(Category eCat, Rarity rarity) {
Random r = new Random();
Enchantments enchant = getRandomEnchant(eCat, rarity);
int amp = r.nextInt(100);
ItemStack eP = new ItemStack(Material.BOOK, 1);
ItemMeta im = eP.getItemMeta();
String name = enchant.getType().name().substring(0, 1) + enchant.getType().name().toLowerCase().substring(1);
im.setDisplayName(ChatColor.GRAY + "[" + ChatColor.UNDERLINE + Rarity.getChatColor(rarity) + name + " " + (amp > 66 ? "III" : amp > 33 ? "II" : "I") + ChatColor.RESET + ChatColor.GRAY + "]");
im.setLore(Arrays.asList(new String[] { (ChatColor.GREEN + String.valueOf(r.nextInt(100)) + "% Success Rate"), (ChatColor.RED + String.valueOf(r.nextInt(100)) + "% Fail Rate"), (Rarity.getChatColor(rarity) + Settings.getDesc(enchant.getType().name().toUpperCase())), (ChatColor.GRAY + (Types.ItemType.get(enchant)).name() + " Enchantment"), (Settings.bookDesc) }));
eP.setItemMeta(im);
return eP;
}
public static ItemStack getEnchantBook(Category eCat) {
ItemStack eP = new ItemStack(Material.BOOK, 1);
ItemMeta im = eP.getItemMeta();
im.setDisplayName(ChatColor.GRAY + "[" + Category.getChatColor(eCat) + ChatColor.UNDERLINE + ChatColor.MAGIC + "EATASSANDDIE" + ChatColor.RESET + ChatColor.GRAY + "]");
eP.setItemMeta(im);
return eP;
}
public static Enchantments getRandomEnchant(Category eCat, Rarity rarity) {
List<Enchantments> e = new ArrayList<Enchantments>();
for (Enchantments ee : Enchantments.values())
if (ee.getCategory() == eCat & ee.getRarity() == rarity) {
e.add(ee);
}
Random r = new Random();
boolean found = false;
while (!found)
for (int i = 0; i < e.size(); i++)
if (r.nextInt(100) <= (100 / e.size())) {
found = true;
return e.get(i);
}
return null;
}
public enum Rarity {
Unique, Mythical, Ultra, Rare, Uncommon, Simple, Sacred;
public static Rarity getbyName(String name) {
if (name.contains("Unique"))
return Rarity.Unique;
else if (name.contains("Mythical"))
return Rarity.Mythical;
else if (name.contains("Ultra"))
return Rarity.Ultra;
else if (name.contains("Rare"))
return Rarity.Rare;
else if (name.contains("Uncommon"))
return Rarity.Uncommon;
else if (name.contains("Simple"))
return Rarity.Simple;
else if (name.contains("Sacred"))
return Rarity.Sacred;
return null;
}
public static short getColor(Rarity rare) {
if (rare == Rarity.Unique) // red
return (short) 1;
else if (rare == Rarity.Mythical) // gold
return (short) 14;
else if (rare == Rarity.Ultra) // yellow
return (short) 11;
else if (rare == Rarity.Rare) // blue
return (short) 12;
else if (rare == Rarity.Uncommon) // green
return (short) 10;
else if (rare == Rarity.Simple) // white
return (short) 15;
else
return 0;
}
public static ChatColor getChatColor(Rarity rare) {
if (rare == Rarity.Unique) // red
return ChatColor.RED;
else if (rare == Rarity.Mythical) // gold
return ChatColor.GOLD;
else if (rare == Rarity.Ultra) // yellow
return ChatColor.YELLOW;
else if (rare == Rarity.Rare) // blue
return ChatColor.BLUE;
else if (rare == Rarity.Uncommon) // green
return ChatColor.GREEN;
else if (rare == Rarity.Simple) // white
return ChatColor.WHITE;
else if (rare == Rarity.Sacred) // purple
return ChatColor.DARK_PURPLE;
return null;
}
}
}
|
/* ForEachImpl.java
Purpose:
Description:
History:
Wed Mar 8 14:21:08 2006, Created by tomyeh
Copyright (C) 2006 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under LGPL Version 2.1 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zk.ui.util;
import java.util.List;
import java.util.Collection;
import java.util.Map;
import java.util.Enumeration;
import java.util.Iterator;
import org.zkoss.lang.Classes;
import org.zkoss.util.CollectionsX;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.UiException;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.ext.Scope;
import org.zkoss.zk.xel.ExValue;
import org.zkoss.zk.xel.impl.EvaluatorRef;
/**
* An implementation of {@link ForEach}.
*
* <p>Note: the use of {@link ForEachImpl} is different from
* {@link ConditionImpl}. While you could use the same instance of
* {@link ConditionImpl} for all evaluation, each instance of
* {@link ForEachImpl} can be used only once (drop it after {@link #next}
* returns false).
*
* @author tomyeh
*/
public class ForEachImpl implements ForEach {
private final EvaluatorRef _evalr;
private final Page _page;
private final Component _comp;
private final ExValue[] _expr;
private final ExValue _begin, _end;
private Status _status;
private Iterator _it;
private Object _oldEach;
private boolean _done;
/** Returns an instance that represents the iterator for the
* specified collection.
*
* @param expr an array of expressions. There are two formats.
* <ol>
* <li>length == 1: it iterates thru the content of expr[0].
* For example, if expr[0] is an array, all items in this array will
* be iterated.</li>
* <li>length > 1, it will iterate thru expr[0]</li>
* <li>length == 0 or expr is null, null is returned</li>
* </ol>
* @since 3.0.6
*/
public static
ForEach getInstance(EvaluatorRef evalr, Component comp,
ExValue[] expr, ExValue begin, ExValue end) {
if (expr == null || expr.length == 0)
return null;
return new ForEachImpl(evalr, comp, expr, begin, end);
}
/** Returns an instance that represents the iterator for the
* specified collection, or null if expr is null or empty.
*
* @param expr an array of expressions. There are two formats.
* <ol>
* <li>length == 1: it iterates thru the content of expr[0].
* For example, if expr[0] is an array, all items in this array will
* be iterated.</li>
* <li>length > 1, it will iterate thru expr[0]</li>
* <li>length == 0 or expr is null, null is returned</li>
* </ol>
* @since 3.0.6
*/
public static
ForEach getInstance(EvaluatorRef evalr, Page page,
ExValue[] expr, ExValue begin, ExValue end) {
if (expr == null || expr.length == 0)
return null;
return new ForEachImpl(evalr, page, expr, begin, end);
}
/** Constructor.
* In most cases, use {@link #getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)}
* instead of this constructor.
* @exception IllegalArgumentException if comp or evalr is null
* @since 3.0.6
*/
public ForEachImpl(EvaluatorRef evalr, Component comp,
ExValue[] expr, ExValue begin, ExValue end) {
if (comp == null || evalr == null)
throw new IllegalArgumentException();
_evalr = evalr;
_page = null;
_comp = comp;
_expr = expr;
_begin = begin;
_end = end;
}
/** Constructor.
* In most cases, use {@link #getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)}
* instead of this constructor.
* @exception IllegalArgumentException if page or evalr is null
* @since 3.0.6
*/
public ForEachImpl(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end) {
if (page == null || evalr == null)
throw new IllegalArgumentException();
_evalr = evalr;
_page = page;
_comp = null;
_expr = expr;
_begin = begin;
_end = end;
}
/** Returns an instance that represents the iterator for the
* specified collection, or null if expr is null or empty.
*
* @param expr an EL expression that shall return a collection of objects.
* @see #getInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)
*/
public static
ForEach getInstance(EvaluatorRef evalr, Component comp, String expr, String begin, String end) {
if (expr == null || expr.length() == 0)
return null;
return new ForEachImpl(evalr, comp, expr, begin, end);
}
/** Returns an instance that represents the iterator for the
* specified collection, or null if expr is null or empty.
*
* @param expr an EL expression that shall return a collection of objects.
* @since 3.0.0
* @see #getInstance(EvaluatorRef, Page, ExValue[], ExValue, ExValue)
*/
public static
ForEach getInstance(EvaluatorRef evalr, Page page, String expr, String begin, String end) {
if (expr == null || expr.length() == 0)
return null;
return new ForEachImpl(evalr, page, expr, begin, end);
}
/** Constructor.
* In most cases, use {@link #getInstance(EvaluatorRef, Component, String, String, String)}
* instead of this constructor.
* @exception IllegalArgumentException if comp or evalr is null
* @since 3.0.0
* @see #ForEachImpl(EvaluatorRef, Component, ExValue[], ExValue, ExValue)
*/
public ForEachImpl(EvaluatorRef evalr, Component comp, String expr, String begin, String end) {
if (comp == null || evalr == null)
throw new IllegalArgumentException();
_evalr = evalr;
_page = null;
_comp = comp;
_expr = expr != null ? new ExValue[] {new ExValue(expr, Object.class)}: null;
_begin = begin != null && begin.length() > 0 ? new ExValue(begin, Integer.class): null;
_end = end != null && end.length() > 0 ? new ExValue(end, Integer.class): null;
}
/** Constructor.
* In most cases, use {@link #getInstance(EvaluatorRef, Component, String, String, String)}
* instead of this constructor.
* @exception IllegalArgumentException if page or evalr is null
* @since 3.0.0
* @see #ForEachImpl(EvaluatorRef, Page, ExValue[], ExValue, ExValue)
*/
public ForEachImpl(EvaluatorRef evalr, Page page, String expr, String begin, String end) {
if (page == null || evalr == null)
throw new IllegalArgumentException();
_evalr = evalr;
_page = page;
_comp = null;
_expr = expr != null ? new ExValue[] {new ExValue(expr, Object.class)}: null;
_begin = begin != null && begin.length() > 0 ? new ExValue(begin, Integer.class): null;
_end = end != null && end.length() > 0 ? new ExValue(end, Integer.class): null;
}
private Object eval(ExValue value) {
return value == null ? null:
_comp != null ?
value.getValue(_evalr, _comp): value.getValue(_evalr, _page);
}
//-- ForEach --//
public boolean next() {
if (_done)
throw new IllegalStateException("Iterate twice not allowed");
if (_status == null) {
//Bug 2188572: we have to evaluate _expr before setupStatus
final Object o;
if (_expr == null || _expr.length == 0) {
o = null;
} else if (_expr.length == 1) {
o = eval(_expr[0]);
} else {
Object[] ary = new Object[_expr.length];
for (int j = 0; j < _expr.length; ++j)
ary[j] = eval(_expr[j]);
o = ary;
}
if (o == null) {
_done = true;
return false;
}
//Bug 1786154: we have to prepare _status first since _expr,
//_begin or _end might depend on it
setupStatus();
Integer ibeg = (Integer)eval(_begin);
int vbeg = ibeg != null ? ibeg.intValue(): 0;
if (vbeg < 0) ibeg = new Integer(vbeg = 0);
_status.setBegin(ibeg);
_status.setEnd((Integer)eval(_end));
prepare(o, vbeg); //prepare iterator
}
if ((_status.end == null || _status.index < _status.end.intValue())
&& _it.hasNext()) {
++_status.index;
_status.each = _it.next();
getScope().setAttribute("each", _status.each);
return true;
}
//restore
_done = true;
restoreStatus();
return false;
}
private void setupStatus() {
final Scope scope = getScope();
_oldEach = scope.getAttribute("each", true);
_status = new Status(scope.getAttribute("forEachStatus", true));
scope.setAttribute("forEachStatus", _status);
}
private void restoreStatus() {
final Scope scope = getScope();
if (_status.previous != null)
scope.setAttribute("forEachStatus", _status.previous);
else
scope.removeAttribute("forEachStatus");
if (_oldEach != null)
scope.setAttribute("each", _oldEach);
else
scope.removeAttribute("each");
_it = null; _status = null; //recycle (just in case)
}
private Scope getScope() {
return _comp != null ? (Scope)_comp: _page;
}
private void prepare(Object o, final int begin) {
if (begin > 0 && (o instanceof List)) {
final List l = (List)o;
final int size = l.size();
_it = l.listIterator(begin > size ? size: begin);
} else if (o instanceof Collection) {
_it = ((Collection)o).iterator();
forward(begin);
} else if (o instanceof Map) {
_it = ((Map)o).entrySet().iterator();
forward(begin);
} else if (o instanceof Iterator) {
_it = (Iterator)o;
forward(begin);
} else if (o instanceof Enumeration) {
_it = new CollectionsX.EnumerationIterator((Enumeration)o);
forward(begin);
} else if (o instanceof Object[]) {
final Object[] ary = (Object[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return ary[_j++];
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof int[]) {
final int[] ary = (int[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return new Integer(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof long[]) {
final long[] ary = (long[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return new Long(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof short[]) {
final short[] ary = (short[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return new Short(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof byte[]) {
final byte[] ary = (byte[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return new Byte(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof double[]) {
final double[] ary = (double[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return new Double(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof float[]) {
final float[] ary = (float[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return new Float(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof char[]) {
final char[] ary = (char[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return new Character(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else if (o instanceof boolean[]) {
final boolean[] ary = (boolean[])o;
_it = new Iterator() {
private int _j = begin;
public boolean hasNext() {
return _j < ary.length;
}
public Object next() {
return Boolean.valueOf(ary[_j++]);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} else {
_it = new CollectionsX.OneIterator(o);
forward(begin);
}
}
private void forward(int begin) {
while (--begin >= 0 && _it.hasNext())
_it.next();
}
private static class Status implements ForEachStatus {
private final Object previous;
private Object each;
private int index;
private Integer begin, end;
private Status(Object previous) {
this.previous = previous;
this.index = -1;
}
private void setBegin(Integer begin) {
this.begin = begin;
this.index = begin != null ? begin.intValue() - 1: -1;
}
private void setEnd(Integer end) {
this.end = end;
}
public ForEachStatus getPrevious() {
return this.previous instanceof ForEachStatus ?
(ForEachStatus)this.previous: null;
}
public Object getEach() {
return this.each;
}
public int getIndex() {
return this.index;
}
public Integer getBegin() {
return this.begin;
}
public Integer getEnd() {
return this.end;
}
public String toString() {
return "[index=" + index + ']';
}
}
}
|
package base.driver;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Scanner;
import base.Contact;
import base.Directory;
public class Main {
static String prompt = "1) Add contact 2) Search 3) Exit";
static String namePrompt = "Enter name :";
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Directory directory = new Directory();
boolean stop = false;
while (true) {
System.out.println(prompt);
int input;
try {
input = sc.nextInt();
} catch (InputMismatchException ime) {
sc.nextLine();
System.err.println("Invalid Command");
continue;
}
sc.nextLine();
String line;
switch (input) {
case 1:
System.out.print(namePrompt);
line = sc.nextLine();
directory.addContact(Contact.parseContact(line));
break;
case 2:
System.out.print(namePrompt);
line = sc.nextLine();
List<Contact> contact = directory.findContact(line);
if (!contact.isEmpty()) {
contact.forEach(t -> System.out.println(t.toString()));
} else {
System.out.println("NO MATCH !!");
}
break;
case 3:
stop = true;
break;
default:
System.out.println("Invalid Command");
}
if (stop) {
break;
}
}
}
}
|
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main
{
public enum foodType
{
APPRETIZER, DESSERT, DRINKS, MAINDISH
}
private static Map<String, String> userInput = new HashMap<String,String>();
private static ArrayList<ArrayList<Food>> menu = new ArrayList<ArrayList<Food>>();
private static ArrayList<Food> appretizerList = new ArrayList<Food>();
private static ArrayList<Food> mainDishList = new ArrayList<Food>();
private static ArrayList<Food> drinkList = new ArrayList<Food>();
private static ArrayList<Food> dessertList = new ArrayList<Food>();
public static Map<String, String> getUserInput()
{
// Import user input
Scanner input = new Scanner(System.in);
boolean appretizer;
boolean mainDish;
boolean drink;
boolean dessert;
double budget;
System.out.println("Would you like to order appretizer?");
appretizer = input.nextBoolean();
System.out.println("Would you like to order main dish?");
mainDish = input.nextBoolean();
System.out.println("Would you like to order drink?");
drink = input.nextBoolean();
System.out.println("Would you like to order dessert?");
dessert = input.nextBoolean();
System.out.println("Please enter your budget");
budget = input.nextDouble();
userInput.put("appretizer",String.valueOf(appretizer));
userInput.put("mainDish",String.valueOf(mainDish));
userInput.put("drink",String.valueOf(drink));
userInput.put("dessert",String.valueOf(dessert));
userInput.put("budget", String.valueOf(budget));
return userInput;
}
public static void importMenu() throws FileNotFoundException
{
Scanner inFile = new Scanner(new File("Food_Data.txt"));
while(inFile.hasNextLine())
{
String input = inFile.nextLine();
input.trim();
String[] inputArray = input.split(",");
if (inputArray[0].equals(foodType.APPRETIZER.toString()))
{
appretizerList.add(new Appretizer(inputArray[1],foodType.APPRETIZER,inputArray[2]));
}
else if (inputArray[0].equals(foodType.DESSERT.toString()))
{
dessertList.add(new Appretizer(inputArray[1],foodType.DESSERT,inputArray[2]));
}
else if (inputArray[0].equals(foodType.MAINDISH.toString()))
{
mainDishList.add(new Appretizer(inputArray[1],foodType.MAINDISH,inputArray[2]));
}
else if (inputArray[0].equals(foodType.DRINKS.toString()))
{
drinkList.add(new Appretizer(inputArray[1],foodType.DRINKS,inputArray[2]));
}
}
System.out.println("Import completed!!");
}
public static void main(String arg[])
{
try {
importMenu();
} catch (FileNotFoundException e) {
System.out.println("File not found...exiting program...");
System.exit(0);
}
getUserInput();
menu.add(appretizerList);
menu.add(mainDishList);
menu.add(drinkList);
menu.add(dessertList);
//calculatePrice(menu, budget);
}
}
|
package swsk.cn.rgyxtq.subs.work.C;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import swsk.cn.rgyxtq.R;
import swsk.cn.rgyxtq.main.Common.PushUtils;
import swsk.cn.rgyxtq.main.Common.Topbar;
import swsk.cn.rgyxtq.subs.work.Common.NetUtil;
/**
* Created by apple on 16/3/1.
*/
public class WorkPlanSelListActivity extends Activity implements AdapterView.OnItemClickListener{
private static final String TAG ="WorkPlanSelListActivity";
private List<HashMap<String,Object>> planList;
ListView list_work_plan;
SimpleAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_work_plan_sel_list);
list_work_plan=(ListView)findViewById(R.id.list_work_plan);
Topbar top= (Topbar)findViewById(R.id.workPlanSelListTopbar);
top.setRightButtonIsvisable(false);
top.setOnTopbarClickListener(new Topbar.topbarClickListener() {
@Override
public void leftClick() {
finish();
}
@Override
public void rightClick() {
}
});
planList=new ArrayList<>();
adapter=new SimpleAdapter(this,planList,R.layout.activity_work_plan_sel_list_item,
new String[]{"WORK_PLAN_NAME"},new int[]{R.id.lbl_work_plan_sel_list_item_title});
list_work_plan.setAdapter(adapter);
list_work_plan.setOnItemClickListener(this);
NetUtil.commonRequest(this, "rgyx/appWorkInfoManage/findWorkPlanList?token=" +
PushUtils.token + "&status=1", new NetUtil.RequestCB() {
@Override
public void cb(Map<String, Object> map) {
List<HashMap<String,Object>> list = (ArrayList)map.get("workPlanList");
if(list!=null && list.size()>0){
planList.addAll(list);
adapter.notifyDataSetChanged();
}
}
});
// TODO
Intent i = new Intent();
i.setClass(this,WorkInfoUploadActivity.class);
i.putExtra("workPlanId", "123123");
i.putExtra("workPlanName","plana");
startActivity(i);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
HashMap<String,Object> map=planList.get(position);
Intent i = new Intent();
i.setClass(this,WorkInfoUploadActivity.class);
i.putExtra("workPlanId",map.get("ID").toString());
i.putExtra("workPlanName",map.get("WORK_PLAN_NAME").toString());
startActivity(i);
finish();
}
}
|
package com.example.shouhei.mlkitdemo.util;
import java.util.Comparator;
public class SortElementWrapperByXComparator implements Comparator<ElementWrapper> {
@Override
public int compare(ElementWrapper o1, ElementWrapper o2) {
return o1.getX() - o2.getX();
}
}
|
package com.pibs.action;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.pibs.constant.ActionConstant;
import com.pibs.constant.MapConstant;
import com.pibs.constant.MiscConstant;
import com.pibs.constant.ModuleConstant;
import com.pibs.constant.ParamConstant;
import com.pibs.form.PrognosisFormBean;
import com.pibs.model.Prognosis;
import com.pibs.model.User;
import com.pibs.service.ServiceManager;
import com.pibs.service.ServiceManagerImpl;
import com.pibs.util.PIBSUtils;
public class PrognosisAction extends Action {
private final static Logger logger = Logger.getLogger(PrognosisAction.class);
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// TODO Auto-generated method stub
PrognosisFormBean formBean = (PrognosisFormBean) form;
String forwardAction = ActionConstant.NONE;
String command = request.getParameter("command");
//session expired checking
if (request.getSession().getAttribute(MiscConstant.USER_SESSION) == null) {
forwardAction = ActionConstant.SHOW_AJAX_EXPIRED;
} else {
if (command!=null) {
int module = ModuleConstant.PROGNOSIS;
if (command.equalsIgnoreCase(ParamConstant.AJAX_GO_TO_CHILD)) {
//fetch the data
int patientSystemCaseId = Integer.parseInt(request.getParameter("patientSystemCaseId"));
Prognosis model = new Prognosis();
model.setPatientCaseSystemId(patientSystemCaseId);
HashMap<String,Object> dataMap = new HashMap<String, Object>();
dataMap.put(MapConstant.MODULE, module);
dataMap.put(MapConstant.CLASS_DATA, model);
dataMap.put(MapConstant.ACTION, ActionConstant.GET_DATA);
ServiceManager service = new ServiceManagerImpl();
Map<String, Object> resultMap = service.executeRequest(dataMap);
if (resultMap!=null && !resultMap.isEmpty()) {
model = (Prognosis) resultMap.get(MapConstant.CLASS_DATA);
formBean.populateFormBean(model);
} else {
formBean.setPatientCaseSystemId(model.getPatientCaseSystemId());
}
formBean.setTransactionStatus(false);
formBean.setTransactionMessage(MiscConstant.TRANS_MESSSAGE_RESET);
forwardAction = ActionConstant.SHOW_AJAX_ADD;
} else if (command.equalsIgnoreCase(ParamConstant.AJAX_SAVE)) {
//populateModel
Prognosis model = (Prognosis) formBean.populateModel(formBean);
User user = (User) request.getSession().getAttribute(MiscConstant.USER_SESSION);
HashMap<String,Object> dataMap = new HashMap<String, Object>();
dataMap.put(MapConstant.MODULE, module);
dataMap.put(MapConstant.CLASS_DATA, model);
dataMap.put(MapConstant.USER_SESSION_DATA, user);
if (model.getId()==0) {//diagnosisid in form
dataMap.put(MapConstant.ACTION, ActionConstant.SAVE);
} else {
dataMap.put(MapConstant.ACTION, ActionConstant.UPDATE);
}
ServiceManager service = new ServiceManagerImpl();
Map<String, Object> resultMap = service.executeRequest(dataMap);
if (resultMap!=null && !resultMap.isEmpty()) {
//check resultmap action status
boolean transactionStatus = (boolean) resultMap.get(MapConstant.TRANSACTION_STATUS);
formBean.setTransactionStatus(transactionStatus);
if (transactionStatus) {
//show success page
//add confirmation message
if (dataMap.get(MapConstant.ACTION).equals(ActionConstant.SAVE)) {
formBean.setTransactionMessage(MiscConstant.TRANS_MESSSAGE_SAVED);
PIBSUtils.writeLogInfo(logger, MiscConstant.TRANS_MESSSAGE_SAVED+" - "+module);
//logger.info(MiscConstant.TRANS_MESSSAGE_SAVED);
}else {
formBean.setTransactionMessage(MiscConstant.TRANS_MESSSAGE_UPDATED);
PIBSUtils.writeLogInfo(logger, MiscConstant.TRANS_MESSSAGE_UPDATED+" - "+module);
//logger.info(MiscConstant.TRANS_MESSSAGE_UPDATED);
}
//update the diagnosis id in the form
service = null;
resultMap = null;
model = new Prognosis();
model.setPatientCaseSystemId(formBean.getPatientCaseSystemId());
dataMap = new HashMap<String, Object>();
dataMap.put(MapConstant.MODULE, module);
dataMap.put(MapConstant.CLASS_DATA, model);
dataMap.put(MapConstant.ACTION, ActionConstant.GET_DATA);
service = new ServiceManagerImpl();
resultMap = service.executeRequest(dataMap);
if (resultMap!=null && !resultMap.isEmpty()) {
model = (Prognosis) resultMap.get(MapConstant.CLASS_DATA);
formBean.populateFormBean(model);
}
forwardAction = ActionConstant.AJAX_SUCCESS;
} else {
formBean.setTransactionMessage(MiscConstant.TRANS_MESSSAGE_ERROR);
//logger.info(MiscConstant.TRANS_MESSSAGE_ERROR);
PIBSUtils.writeLogInfo(logger, MiscConstant.TRANS_MESSSAGE_ERROR+" - "+module);
forwardAction = ActionConstant.AJAX_FAILED;
}
}
}
} else {
//show main screen
forwardAction = ActionConstant.SHOW_AJAX_MAIN;
}
}
return mapping.findForward(forwardAction);
}
}
|
package test;
import java.util.Arrays;
public class Short {
public static void main(String args[])
{
int data[] = { 4, -5, 2, 6, 1 };
Arrays.sort(data);
for (int c: data)
{
System.out.print(c+",");
}
}
}
|
/*
* Copyright © 2018 www.noark.xyz All Rights Reserved.
*
* 感谢您选择Noark框架,希望我们的努力能为您提供一个简单、易用、稳定的服务器端框架 !
* 除非符合Noark许可协议,否则不得使用该文件,您可以下载许可协议文件:
*
* http://www.noark.xyz/LICENSE
*
* 1.未经许可,任何公司及个人不得以任何方式或理由对本框架进行修改、使用和传播;
* 2.禁止在本项目或任何子项目的基础上发展任何派生版本、修改版本或第三方版本;
* 3.无论你对源代码做出任何修改和改进,版权都归Noark研发团队所有,我们保留所有权利;
* 4.凡侵犯Noark版权等知识产权的,必依法追究其法律责任,特此郑重法律声明!
*/
package xyz.noark.network.filter;
import xyz.noark.core.annotation.Autowired;
import xyz.noark.core.annotation.Value;
import xyz.noark.core.network.NetworkListener;
import xyz.noark.core.network.NetworkPacket;
import xyz.noark.core.network.Session;
import xyz.noark.network.IncodeSession;
import xyz.noark.network.NetworkConstant;
import static xyz.noark.log.LogHelper.logger;
/**
* 抽象封包检测过滤器.
*
* @author 小流氓[176543888@qq.com]
* @since 3.1
*/
public abstract class AbstractPacketCheckFilter implements PacketCheckFilter {
/**
* 网络安全之自增校验位检测:默认false不开启
*/
@Value(NetworkConstant.INCODE)
protected boolean incode = false;
/**
* 网络安全之checksum检测:默认false不开启
*/
@Value(NetworkConstant.CHECKSUM)
protected boolean checksum = false;
@Autowired(required = false)
protected NetworkListener networkListener;
@Override
public boolean checkIncode(IncodeSession session, NetworkPacket packet) {
if (incode) {
if (!checkPacketIncode(session, packet)) {
logger.warn(" ^0^ duplicate packet. playerId={}, opcode={}", session.getPlayerId(), packet.getOpcode());
if (networkListener != null) {
return networkListener.handleDuplicatePacket(session, packet);
}
}
}
return true;
}
/**
* 检测封包自增校验位.
*
* @param session Session对象
* @param packet 网络封包
* @return 如果检测通过返回true
*/
protected abstract boolean checkPacketIncode(IncodeSession session, NetworkPacket packet);
@Override
public boolean checkChecksum(Session session, NetworkPacket packet) {
if (checksum) {
if (!this.checkPacketChecksum(packet)) {
logger.warn(" ^0^ checksum fail. playerId={}, opcode={}", session.getPlayerId(), packet.getOpcode());
if (networkListener != null) {
return networkListener.handleChecksumFail(session, packet);
}
}
}
return true;
}
/**
* 检测封包Checksum.
*
* @param packet 网络封包
* @return 如果检测通过返回true
*/
protected abstract boolean checkPacketChecksum(NetworkPacket packet);
} |
package test;
import com.blog.interceptor.BundlingMethod;
/**
* 测试拦截的类
* @author duanjigui
*@time 2016/5/15
*/
public class Apple implements BundlingMethod {
@Override
public void bundleMethod() {
System.out.println("绑定的方法!");
}
}
|
/*
* 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 model.ORM;
import controller.DatabaseController;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
/**
*
* @author PimGame
*/
@SuppressWarnings("unchecked")
public class ItemTable extends DbTable<ItemRow> {
private ItemRowset list;
private static ItemTable instance;
protected ItemTable() {
super("item");
ArrayList<String> columns = new ArrayList<>();
setIdField("id");
columns.add("name");
columns.add("description");
columns.add("accurate_price");
columns.add("current_trend");
columns.add("current_price");
columns.add("category");
columns.add("members");
columns.add("today_trend");
columns.add("today_price_change");
columns.add("30day_trend");
columns.add("30day_change");
columns.add("90day_trend");
columns.add("90day_change");
columns.add("180day_trend");
columns.add("180day_change");
columns.add("last_updated");
setColumns(columns);
}
public static synchronized ItemTable getInstance() {
if (ItemTable.instance == null) {
ItemTable.instance = new ItemTable();
}
return ItemTable.instance;
}
public ItemRowset fetchAll() {
if (list == null) {
list = new ItemRowset();
try {
String query = "SELECT * FROM " + this.getName();
ArrayList<String> params = new ArrayList<>();
ResultSet res = DatabaseController.executeGetQuery(query, params);
while (res.next()) {
ItemRow ir = createRow();
for (String columnName : this.getColumns()) {
ir.set(columnName, res.getString(columnName));
// System.out.println(columnName + ": " + res.getString(columnName));
}
ir.setID(Integer.parseInt(res.getString(this.getIdField())));
list.add(ir);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
public ItemRow fetch(int id) {
ItemRow ir = null;
try {
String query = "SELECT * FROM " + this.getName()
+ " WHERE " + this.getIdField() + " = " + id;
ArrayList<String> params = new ArrayList<>();
ResultSet res = DatabaseController.executeGetQuery(query, params);
if (res.next()) {
ir = createRow();
for (String columnName : this.getColumns()) {
ir.set(columnName, res.getString(columnName));
System.out.println(columnName + ": " + res.getString(columnName));
}
}
} catch (SQLException e) {
System.err.println("Error in fetch with item id: " + id);
System.err.println(e);
}
return ir;
}
public void replace(int itemId, ItemRow itemRow) {
for (ItemRow ir : list) {
if (ir.getItemId() == itemId) {
ir = itemRow;
break;
}
}
}
public void addItem(ItemRow item) {
this.list.add(item);
}
public ItemRow createRow() {
ItemRow ir = new ItemRow();
ir.setTable(this);
return ir;
}
}
|
package run;
import chess.Cell;
import chess.ChessBoard;
import piece.Bishop;
import piece.King;
import piece.Knight;
import piece.Pawn;
import piece.Piece;
import piece.Queen;
import piece.Rook;
public class Check
{
private ChessBoard board = ChessBoard.getInstance();
private int king_x,king_y;
private boolean color;
public Check(boolean color){
this.color = color;
}
private void findKing(){
for(int i=0; i<8; i++){
for(int j=0; j<8; j++){
if(board.getFromPosition(i, j).getpiece() instanceof King && board.getFromPosition(i, j).getpiece().color==color){
king_x=i;
king_y=j;
}
}
}
}
private boolean checkRowAndCol(){//for rook and queen
for(int i=king_x-1; i>-1;i--){
Piece temp= board.getFromPosition(i, king_y).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Rook||temp instanceof Queen){
return true;
}
}
}
for(int i=king_x+1; i<8; i++){
Piece temp= board.getFromPosition(i, king_y).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Rook||temp instanceof Queen){
return true;
}
}
}
for(int i=king_y-1; i>-1;i--){
Piece temp= board.getFromPosition(king_x,i).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Rook||temp instanceof Queen){
return true;
}
}
}
for(int i=king_y+1; i<8;i++){
Piece temp= board.getFromPosition(king_x,i).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Rook||temp instanceof Queen){
return true;
}
}
}
return false;
}
private boolean checkDiagonal(){//for bishop and queen
int x = king_x;
int y = king_y;
while(x<7 && y<7){//northEast
x++;
y++;
Piece temp= board.getFromPosition(x, y).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Bishop||temp instanceof Queen){
return true;
}
}
}
while(x>0 && y>0){//southWest
x--;
y--;
Piece temp= board.getFromPosition(x, y).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Bishop||temp instanceof Queen){
return true;
}
}
}
while(x>0 && y<7){//northWest
x--;
y++;
Piece temp= board.getFromPosition(x, y).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Bishop||temp instanceof Queen){
return true;
}
}
}
while(x<7 && y>0){//southEast
x++;
y--;
Piece temp= board.getFromPosition(x, y).getpiece();
if(temp!=null){
if(temp.color==color)
return false;
else
if(temp instanceof Bishop||temp instanceof Queen){
return true;
}
}
}
return false;
}
private boolean checkKnight(){
int x = king_x;
int y = king_y;
Piece temp;
if(x+2<8){
if(y+1<8){
temp = board.getFromPosition(x+2, y+1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
if(y-1>-1){
temp = board.getFromPosition(x+2, y-1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
}
if(x-2>-1){
if(y+1<8){
temp = board.getFromPosition(x+2, y+1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
if(y-1>-1){
temp = board.getFromPosition(x+2, y-1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
}
if(y-2>-1){
if(x+1<8){
temp = board.getFromPosition(x+2, y+1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
if(x-1>-1){
temp = board.getFromPosition(x+2, y-1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
}
if(y+2<8){
if(x+1<8){
temp = board.getFromPosition(x+2, y+1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
if(x-1>-1){
temp = board.getFromPosition(x+2, y-1).getpiece();
if(temp!=null && temp instanceof Knight && temp.color!=color)
return true;
}
}
return false;
}
private boolean checkPawn(){
int x = king_x;
int y = king_y;
Piece temp1,temp2;
if(color){
temp1 = board.getFromPosition(x+1, y+1).getpiece();
temp2 = board.getFromPosition(x-1, y+1).getpiece();
if((temp1!=null && temp1 instanceof Pawn && temp1.color!=color) ||
(temp2!=null && temp2 instanceof Pawn && temp2.color!=color))
return true;
else
return false;
}
else{
temp1 = board.getFromPosition(x+1, y-1).getpiece();
temp2 = board.getFromPosition(x-1, y-1).getpiece();
if((temp1!=null && temp1 instanceof Pawn && temp1.color!=color) ||
(temp2!=null && temp2 instanceof Pawn && temp2.color!=color))
return true;
else
return false;
}
}
public boolean checkmate(){
findKing();
return checkRowAndCol() || checkDiagonal() || checkKnight() || checkPawn();
}
}
|
package com.gaoshin.dating;
import javax.xml.bind.annotation.XmlRootElement;
import net.sf.oval.constraint.Length;
import net.sf.oval.constraint.NotEmpty;
import com.gaoshin.beans.Gender;
import com.gaoshin.beans.Location;
@XmlRootElement
public class DatingUser {
@NotEmpty
@Length(max = 32, min = 1)
private String name;
@NotEmpty
@Length(max = 20, min = 6)
private String phone;
@NotEmpty
@Length(min = 1)
private String password;
@NotEmpty
private Gender gender;
@NotEmpty
private Integer birthyear;
@NotEmpty
private Location location;
@NotEmpty
private String interests;
@NotEmpty
private DatingPurpose lookingfor;
@NotEmpty
private String clientType;
private String deviceInfo;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getBirthyear() {
return birthyear;
}
public void setBirthyear(Integer birthyear) {
this.birthyear = birthyear;
}
public String getInterests() {
return interests;
}
public void setInterests(String interests) {
this.interests = interests;
}
public String getClientType() {
return clientType;
}
public void setClientType(String clientType) {
this.clientType = clientType;
}
public void setGender(Gender gender) {
this.gender = gender;
}
public Gender getGender() {
return gender;
}
public void setLookingfor(DatingPurpose lookingfor) {
this.lookingfor = lookingfor;
}
public DatingPurpose getLookingfor() {
return lookingfor;
}
public void setLocation(Location location) {
this.location = location;
}
public Location getLocation() {
return location;
}
public void setDeviceInfo(String deviceInfo) {
this.deviceInfo = deviceInfo;
}
public String getDeviceInfo() {
return deviceInfo;
}
} |
package com.rk.jarjuggler.service;
import junit.framework.TestCase;
public class HttpUtilTest extends TestCase {
public void testGetFileName() throws Exception {
String url = "http://localhost/asm/asm/1.4/asm-1.4.jar";
assertEquals("asm-1.4.jar", HttpUtil.getFileName(url));
}
public void testPrefixSuffix() throws Exception {
String fileName = "asm-1.4.jar";
assertEquals("asm-1.4", HttpUtil.getPrefix(fileName));
assertEquals("jar", HttpUtil.getSuffix(fileName));
}
public void testSlashify() throws Exception {
String currentUrl = "C:\\Documents and Settings\\stmorgan.SFO\\IdeaProjects\\temp\\mylib\\altrmi-client-impl-0.9.6.jar";
assertEquals("C:/Documents and Settings/stmorgan.SFO/IdeaProjects/temp/mylib/altrmi-client-impl-0.9.6.jar", HttpUtil.slashify(currentUrl));
}
} |
package tech.szymanskazdrzalik.a2048_app.credits;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import tech.szymanskazdrzalik.a2048_app.R;
import tech.szymanskazdrzalik.a2048_app.helpers.DarkModeHelper;
public class Credits extends AppCompatActivity {
private final static String PRZEMEK_GITHUB = "https://github.com/ZdrzalikPrzemyslaw";
private final static String JULIA_GITHUB = "https://github.com/JuliaSzymanska";
/**
* {@inheritDoc}
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_credits);
((SwipeDownCreditsButton) findViewById(R.id.authors)).setupSwipeBottomListener(this, findViewById(R.id.constraintLayoutCredits));
this.loadData();
}
/**
* On click listener for Przemek's text view.
*
* @param v view.
*/
public void onClickTextViewPrzemek(View v) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(PRZEMEK_GITHUB));
startActivity(i);
}
/**
* On click listener for Julia's text view.
*
* @param v view.
*/
public void onClickTextViewJulia(View v) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(JULIA_GITHUB));
startActivity(i);
}
/**
* {@inheritDoc}
*/
@Override
public void onBackPressed() {
((SwipeDownCreditsButton) findViewById(R.id.authors)).swipeDownCreditsButtonOnClick();
}
/**
* Call method to set theme.
* Loads volume and current theme.
*/
private void loadData() {
DarkModeHelper.setTheme(findViewById(R.id.darkThemeView));
}
} |
package com.awakenguys.kmitl.ladkrabangcountry;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.awakenguys.kmitl.ladkrabangcountry.model.Review;
import java.util.ArrayList;
import java.util.List;
public class Review_View extends AppCompatActivity {
private List<Review> reviewList = new ArrayList<Review>();
private ListView listview;
private ReviewListAdapter adapter;
private TextView emptyView;
private UpdateReviewTask updateReviewTask;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_review_list);
listview = (ListView) findViewById(android.R.id.list);
adapter = new ReviewListAdapter(this, reviewList);
listview.setAdapter(adapter);
emptyView = (TextView) findViewById(R.id.emptyList);
emptyView.setVisibility(View.INVISIBLE);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startPost();
//finish();
}
});
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
view_review(position);
//finish();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.guest_anotherpage_menu, 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.home_icon) {
startActivity(new Intent(this, MainActivity.class));
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onResume() {
super.onResume();
reviewList.clear();
adapter.notifyDataSetChanged();
updateReviewTask = new UpdateReviewTask();
updateReviewTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
protected void onPause() {
super.onPause();
if(updateReviewTask !=null) updateReviewTask.cancel(true);
}
@Override
protected void onStop() {
super.onStop();
if(updateReviewTask !=null) updateReviewTask.cancel(true);
}
@Override
protected void onDestroy() {
super.onDestroy();
if(updateReviewTask !=null) updateReviewTask.cancel(true);
}
private void view_review(int position){
Intent intent = new Intent(this, Review_Info.class);
intent.putExtra("id", ((Review) adapter.getItem(position)).getId());
intent.putExtra("topic", ((Review) adapter.getItem(position)).getTopic());
intent.putExtra("content", ((Review) adapter.getItem(position)).getContent());
//intent.putExtra("other", ((Review) adapter.getItem(position)).getImg_path());
startActivity(intent);
}
private void startPost() {
startActivity(new Intent(this, Review_Create.class));
}
public class UpdateReviewTask extends AsyncTask<Void,Void,Void>{
@Override
protected Void doInBackground(Void... params) {
ContentProvider provider = new ContentProvider();
int i = provider.getReviewSize();
for(;i>0;i--) {
if (isCancelled()) break;
try {
publishProgress();
reviewList.add(provider.getReviewByIndex(i - 1));
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
adapter.notifyDataSetChanged();
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
if(reviewList.size()==0)emptyView.setVisibility(View.VISIBLE);
adapter.notifyDataSetChanged();
}
}
}
|
import java.io.IOException;
import USJavaAPI.AvsInfo;
import USJavaAPI.ResolveData;
import USJavaAPI.USResolverHttpsPostRequest;
import USJavaAPI.USResolverReceipt;
import USJavaAPI.USEncResUpdateCC;
public class TestEncResUpdateCC
{
public static void main(String args[]) throws IOException
{
/********************** Request Variables ****************************/
String host = "esplusqa.moneris.com";
String store_id = "monusqa024";
String api_token = "qatoken";
String data_key = "1p9CB3leH45vFS2n7223E20d1";
String enc_track2 = "";
String device_type = "idtech";
String phone = "55555555555";
String email = "test.user@moneris.com";
String note = "my note";
String cust_id = "customer2";
String crypt = "7";
AvsInfo avsinfo = new AvsInfo();
avsinfo.setAvsStreetNumber("212");
avsinfo.setAvsStreetName("Smith Street");
avsinfo.setAvsZipcode("M1M1M1");
USEncResUpdateCC usEncResUpdateCC = new USEncResUpdateCC (data_key);
usEncResUpdateCC.setAvsInfo(avsinfo);
usEncResUpdateCC.setCustId(cust_id);
usEncResUpdateCC.setEncTrack2(enc_track2);
usEncResUpdateCC.setDeviceType(device_type);
usEncResUpdateCC.setPhone(phone);
usEncResUpdateCC.setEmail(email);
usEncResUpdateCC.setNote(note);
usEncResUpdateCC.setCryptType(crypt);
USResolverHttpsPostRequest mpgReq =
new USResolverHttpsPostRequest(host, store_id, api_token, usEncResUpdateCC);
try
{
USResolverReceipt resreceipt = mpgReq.getResolverReceipt();
ResolveData resdata = resreceipt.getResolveData();
System.out.println("DataKey = " + resreceipt.getDataKey());
System.out.println("ResponseCode = " + resreceipt.getResponseCode());
System.out.println("Message = " + resreceipt.getMessage());
System.out.println("TransDate = " + resreceipt.getTransDate());
System.out.println("TransTime = " + resreceipt.getTransTime());
System.out.println("Complete = " + resreceipt.getComplete());
System.out.println("TimedOut = " + resreceipt.getTimedOut());
System.out.println("ResSuccess = " + resreceipt.getResSuccess());
System.out.println("PaymentType = " + resreceipt.getPaymentType() + "\n");
//Contents of ResolveData
System.out.println("Cust ID = " + resdata.getResCustId());
System.out.println("Phone = " + resdata.getResPhone());
System.out.println("Email = " + resdata.getResEmail());
System.out.println("Note = " + resdata.getResNote());
System.out.println("MaskedPan = " + resdata.getResMaskedPan());
System.out.println("Exp Date = " + resdata.getResExpDate());
System.out.println("Crypt Type = " + resdata.getResCryptType());
System.out.println("Avs Street Number = " + resdata.getResAvsStreetNumber());
System.out.println("Avs Street Name = " + resdata.getResAvsStreetName());
System.out.println("Avs Zipcode = " + resdata.getResAvsZipcode());
}
catch (Exception e)
{
e.printStackTrace();
}
}
} // end TestEncResUpdateCC example
|
package com.mabaya.test.domain;
public enum Category {
smartphone, shoes, tshirts
}
|
package ch5;
import java.util.Scanner;
import java.util.Random;
public class Ex_RecursivelyGuessMyNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
Random rnd = new Random();
int ans = rnd.nextInt(100)+1;
guessing(ans);
}
public static void guessing(int answer) {
Scanner scn = new Scanner(System.in);
System.out.print("Choose your number btw 1 to 100> ");
int i = scn.nextInt();
if(i==answer) {
System.out.println("Correct!");
return;
}else {
System.out.println("Try again!");
System.out.println("Your answer is off by "+Math.abs(i-answer));
System.out.println();
guessing(answer);
}
}
}
|
package com.xiezh.findlost.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.xiezh.fragmentdemo2.R;
public class MessageActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
String username = savedInstanceState.getString("username");
}
}
|
package com.esum.framework.core.monitor;
import java.io.Serializable;
import com.esum.framework.common.util.DateUtil;
/**
* Component Status.
*/
public class ComponentStatus implements Serializable {
// data를 insert할지 update할지 여부를 설정한다.
private boolean insert = true;
private String nodeId = "";
private String channelName = "";
private String messageCtrlId = "";
private int retryCnt = 0;
private String logDate = DateUtil.getCYMD();
private String logTime = DateUtil.getHHMISSS();
private String compId = "";
private String messageName = "";
private String routingId = "";
private String senderTpId = "";
private String recverTpId = "";
private long elapsedTime = 0;
private String procStatus = "";
private int maxValue = -1;
private int normalLimit = -1;
private int warnLimit = -1;
public boolean isInsert() {
return insert;
}
public void setInsert(boolean insert) {
this.insert = insert;
}
public String getNodeId() {
return nodeId;
}
public void setNodeId(String nodeId) {
this.nodeId = nodeId;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public String getMessageCtrlId() {
return messageCtrlId;
}
public void setMessageCtrlId(String messageCtrlId) {
this.messageCtrlId = messageCtrlId;
}
public int getRetryCnt() {
return retryCnt;
}
public void setRetryCnt(int retryCnt) {
this.retryCnt = retryCnt;
}
public String getLogDate() {
return logDate;
}
public void setLogDate(String logDate) {
this.logDate = logDate;
}
public String getLogTime() {
return logTime;
}
public void setLogTime(String logTime) {
this.logTime = logTime;
}
public String getCompId() {
return compId;
}
public void setCompId(String compId) {
this.compId = compId;
}
public String getMessageName() {
return messageName;
}
public void setMessageName(String messageName) {
this.messageName = messageName;
}
public String getRoutingId() {
return routingId;
}
public void setRoutingId(String routingId) {
this.routingId = routingId;
}
public String getSenderTpId() {
return senderTpId;
}
public void setSenderTpId(String senderTpId) {
this.senderTpId = senderTpId;
}
public String getRecverTpId() {
return recverTpId;
}
public void setRecverTpId(String recverTpId) {
this.recverTpId = recverTpId;
}
public long getElapsedTime() {
return elapsedTime;
}
public void setElapsedTime(long elapsedTime) {
this.elapsedTime = elapsedTime;
}
public String getProcStatus() {
return procStatus;
}
public void setProcStatus(String procStatus) {
this.procStatus = procStatus;
}
public int getMaxValue() {
return maxValue;
}
public void setMaxValue(int maxValue) {
this.maxValue = maxValue;
}
public int getNormalLimit() {
return normalLimit;
}
public void setNormalLimit(int normalLimit) {
this.normalLimit = normalLimit;
}
public int getWarnLimit() {
return warnLimit;
}
public void setWarnLimit(int warnLimit) {
this.warnLimit = warnLimit;
}
}
|
/*
* Artem Pipich
* Copyright (c) 2015 pipich3
*/
package ua.epam.course.java.block02;
import java.util.Arrays;
/**
* contains methods, executes laboratory work tasks by variants
* @author Artem Pipich
* @version 1.0
* @since 27.10.15
*/
public class LW4 {
/**
* array, loaded from command line
*/
private static int[] arrayA;
/**
* main class method
* @param args command line arguments
*/
public static void main(String[] args) {
setArrayA(args);
printIntArray(getArrayA());
printIntArray(separateBySign());
printLine( Arrays.toString(checkSorted()));
printIntArray(markEquals());
printIntArray(shiftRightA());
printLine( Arrays.toString(checkSignConst()));
printIntArray(findLocalMins());
printIntArray(ArrayTool.getValues(arrayA,findLocalMins()));
printLine(""+getMinDelta());
printLine( Arrays.toString(getAverageExtremalDifferences()));
printLine(findMaximals()[0] + ", " + findMaximals()[1]);
printIntArray(separateByParity());
printIntArray(countEqualsForEven());
printIntArray(ArrayTool.getValues(arrayA,findOutOfValueRange()));
printLine(Boolean.toString(checkArithmeticalProgression()));
printLine(Boolean.toString(checkForSet()));
printIntArray(getDoubled(new int[] {4, 8, 10, 17, -12, 19}));
printIntArray(getUniques(new int[] {4, 8, 10, 17, -12, 19}));
printIntArray(calculateDifferenceFromMax());
printIntArray(evaluateIntervals(new int[] {1,9,16,18}));
printIntArray(findUnique());
printIntArray(ArrayTool.getValues(arrayA,findUnique()));
printLine(Arrays.toString(statisticAverageRelated()));
printLine(Boolean.toString(checkLinearCombination(new int[] { 3, 9, 15, 21, 27, 33, 39, 15 })));
printIntArray(getIndexesByDecreasingValues());
printLine(Arrays.toString(getRepeats()));
arrayA = new int[] {1,29};
printLine(Integer.toString(getYearDayNumber(true)));
}
/**
* Variant-01
* separates negative and non negative elements in massive, like {{negative elements}, {non negative elements}}
* @param array array of elements to separate
* @return separated array
* @throws IllegalArgumentException array is null
*/
public static int[] separateBySign() throws IllegalArgumentException {
checkArrayNull(arrayA);
int[] arrayB = new int[arrayA.length];
int nonNegativeCount = 0;
for (int i = 0; i < arrayA.length; i++) {
if (arrayA[i] < 0) {
arrayB[i - nonNegativeCount] = arrayA[i];
} else {
nonNegativeCount++;
arrayB[arrayB.length - nonNegativeCount] = arrayA[i];
}
}
return arrayB;
}
/**
* Variant-02
* gets positions of first and second maximal element in array
* @return array of two Strings with position and value of elements
* @throws IllegalArgumentException array is null, empty or has not second maximal element
*/
public static String[] findMaximals() throws IllegalArgumentException {
checkArrayNull(arrayA);
checkHasArrayElement(arrayA,0);
int max = arrayA[0];
int prevMax = max;
for (int i = 0; i < arrayA.length; i++) {
if (arrayA[i] > max) {
prevMax = max;
max = arrayA[i];
}
if (arrayA[i] > prevMax && arrayA[i] < max) {
prevMax = arrayA[i];
}
}
if(prevMax == max) {
throw new IllegalArgumentException("Array has only one unique value - " + max);
}
int[] maxIndexes = ArrayTool.findElement(arrayA, max);
final String maxList = Arrays.toString(maxIndexes) + " = " + max;
int[] prevMaxIndexes = ArrayTool.findElement(arrayA, prevMax);
final String prevMaxList = Arrays.toString(prevMaxIndexes) + " = " + prevMax;
String[] Lists = new String[] {maxList,prevMaxList};
return Lists;
}
/**
* Variant-03
* returns 1 for elements, equals to some another element, an 0 for unique
* @return array of 1 and 0
* @throws IllegalArgumentException array is null
*/
public static int[] markEquals() throws IllegalArgumentException {
checkArrayNull(arrayA);
int[] array = new int[arrayA.length];
for (int i = 0; i < arrayA.length; i++) {
if (array[i] == 0) {
boolean isEqual = false;
for (int j = i + 1; j < arrayA.length; j++) {
if (arrayA[j] == arrayA[i]) {
array[j] = 1;
isEqual = true;
}
}
if (isEqual) {
array[i] = 1;
}
}
}
return array;
}
/**
* Variant-04
* shifts last (array.length - 1) array elements right into the count of positions, equals it's first element
* @return shifted array
* @throws IllegalArgumentException array is null or array or array has no first element
*/
public static int[] shiftRightA() throws IllegalArgumentException {
checkArrayNull(arrayA);
checkHasArrayElement(arrayA,1);
int shift = arrayA[0];
int[] array = new int[arrayA.length - 1];
System.arraycopy(arrayA,1,array,0,array.length);
return ArrayTool.shiftRight(array,shift);
}
/**
* Variant-05
* checks have elements of arrays same sign
* @return is elements positive, is elements negative, has elements different signs
* @throws IllegalArgumentException array is null
*/
public static boolean[] checkSignConst() throws IllegalArgumentException {
checkArrayNull(arrayA);
boolean positive = true;
boolean negative = true;
for (int i = 0; i < arrayA.length && (positive || negative); i++) {
if (negative && arrayA[i] >= 0) {
negative = false;
}
if (positive && arrayA[i] <= 0) {
positive = false;
}
}
return new boolean[] {positive, negative, !positive && !negative};
}
/**
* Variant-06
* gets positions of array local minimums
* @return local minimum positions
* can be used in ArrayTools.getValues() as elementPositions
* @throws IllegalArgumentException array is null
*/
public static int[] findLocalMins() throws IllegalArgumentException {
checkArrayNull(arrayA);
int[] mins = new int[arrayA.length];
int minCount = 0;
for(int i = 0; i < arrayA.length; i++) {
if (((i == 0) || (arrayA[i] < arrayA[i - 1])) &&
((i == arrayA.length - 1) || (arrayA[i] < arrayA[i + 1]))) {
mins[minCount] = i;
minCount++;
}
}
return Arrays.copyOf(mins,minCount);
}
/**
* Variant-07
* gets minimal difference between two array elements
* @return minimal difference
* @throws IllegalArgumentException array is null or contains less than two elements
*/
public static int getMinDelta() throws IllegalArgumentException {
checkArrayNull(arrayA);
checkHasArrayElement(arrayA, 1);
int[] array = Sorter.sortMerge(arrayA);
int minDelta = Math.abs(array[1] - array[0]);
int Delta;
for(int i = 1; i < array.length - 1; i++) {
Delta = Math.abs(array[i] - array[i + 1]);
if (Delta < minDelta) {
minDelta = Delta;
}
}
return minDelta;
}
/**
* Variant-08
* gets minimal and maximal differences of array elements from average array value
* @return array [minimal difference, maximal difference]
* @throws IllegalArgumentException array is null or empty
*/
public static double[] getAverageExtremalDifferences() throws IllegalArgumentException {
checkArrayNull(arrayA);
checkHasArrayElement(arrayA, 0);
double average = ArrayTool.calculateAverage(arrayA);
double minDiff = Math.abs(arrayA[0] - average);
double maxDiff = Math.abs(arrayA[0] - average);
double diff;
for (int i = 1; i < arrayA.length; i++) {
diff = Math.abs(arrayA[i] - average);
if (diff < minDiff) {
minDiff = diff;
}
if (diff > maxDiff) {
maxDiff = diff;
}
}
return new double[] {minDiff, maxDiff};
}
/**
* Variant-09
* break array into two parts:
* <ul>
* <li>even, sorted by increasing;
* <li>odd, sorted by decreasing
* </ul>
* @return array with two sorted parts
* @throws IllegalArgumentException array is null
*/
public static int[] separateByParity() throws IllegalArgumentException {
checkArrayNull(arrayA);
int array[] = ArrayTool.resetEvenValues(arrayA);
for (int i = 0; i < array.length; i++) {
if (array[i] != 0) {
array[i] = 1;
}
}
int arrayOdd[] = ArrayTool.getValues(arrayA, ArrayTool.findElement(array,1));
int arrayEven[] = ArrayTool.getValues(arrayA, ArrayTool.findElement(array,0));
arrayOdd = Sorter.sortMerge(arrayOdd);
arrayEven = Sorter.sortMerge(arrayEven);
for (int i = 0; i < arrayOdd.length / 2; i++) {
arrayOdd = ArrayTool.swapElements(arrayOdd,i,arrayOdd.length - 1 - i);
}
System.arraycopy(arrayEven,0,array,0,arrayEven.length);
System.arraycopy(arrayOdd,0,array,arrayEven.length,arrayOdd.length);
return array;
}
/**
* Variant-10
* count for every array element equals from this array
* @return array of equals count
* @throws IllegalArgumentException array is null
*/
public static int[] countEqualsForEven() throws IllegalArgumentException {
checkArrayNull(arrayA);
int[] array = new int[arrayA.length];
int valueOfEqual;
for (int i = 0; i < array.length; i++) {
if (array[i] == 0) {
valueOfEqual = ArrayTool.countEquals(arrayA, arrayA[i]);
for (int j : ArrayTool.findElement(arrayA, arrayA[i])) {
array[j] = valueOfEqual;
}
}
}
return array;
}
/**
* Variant-11
* gets indexes of elements less than first element or greater than second
* requires getValues()
* @return array of indexes
* @throws IllegalArgumentException array is null or contains less than two elements
*/
public static int[] findOutOfValueRange() throws IllegalArgumentException {
checkArrayNull(arrayA);
checkHasArrayElement(arrayA,1);
int[] indexes = new int[arrayA.length - 2];
int indexCount = 0;
for (int i = 2; i < arrayA.length; i++) {
if ((arrayA[i] < arrayA[0]) || (arrayA[i] > arrayA[1])) {
indexes[indexCount] = i;
indexCount++;
}
}
return Arrays.copyOf(indexes,indexCount);
}
/**
* Variant-12
* checks if array sorted
* @return is array increasing, is array decreasing, is array unsorted
* @throws IllegalArgumentException array is null
*/
public static boolean[] checkSorted() throws IllegalArgumentException {
checkArrayNull(arrayA);
boolean increasing = true;
boolean decreasing = true;
boolean increasingWeek = true;
boolean decreasingWeek = true;
for (int i = 0; i < arrayA.length -1; i++) {
if (arrayA[i + 1] >= arrayA[i]) {
decreasing = false;
if (arrayA[i + 1] > arrayA[i]) {
decreasingWeek = false;
}
}
if (arrayA[i + 1] <= arrayA[i]) {
increasing = false;
if (arrayA[i + 1] < arrayA[i]) {
increasingWeek = false;
}
}
}
return new boolean[] {increasing,decreasing,!decreasingWeek && !increasingWeek};
}
/**
* Variant-13
* checks array for arithmetical progression
* @return is array elements in progression
* @throws IllegalArgumentException array is null
*/
public static boolean checkArithmeticalProgression() throws IllegalArgumentException {
checkArrayNull(arrayA);
if (arrayA.length < 3) {
return true;
}
boolean progression = true;
int step = arrayA[1] - arrayA[0];
for (int i = 2; progression && (i < arrayA.length); i++) {
if (step != arrayA[i] - arrayA[i - 1]) {
return false;
}
}
return true;
}
/**
* Variant-14
* checks array for set
* @return is array set
* @throws IllegalArgumentException array is null
*/
public static boolean checkForSet() throws IllegalArgumentException {
checkArrayNull(arrayA);
for(int i : arrayA) {
if (ArrayTool.countEquals(arrayA,i) > 1) {
return false;
}
}
return true;
}
/**
* Variant-15
* gets elements which is contained by arrayA and arrayB
* @param arrayB array of elements
* @return array of elements, presents in both arrays
* @throws IllegalArgumentException arrayA is null or arrayB is null
*/
public static int[] getDoubled(int[] arrayB) throws IllegalArgumentException{
checkArrayNull(arrayA);
checkArrayNull(arrayB);
int[] arrayDoubles = new int[arrayA.length];
int countDoubles = 0;
for(int i = 0; i < arrayA.length; i++) {
if (ArrayTool.countEquals(arrayB, arrayA[i]) > 0) {
arrayDoubles[countDoubles] = arrayA[i];
countDoubles++;
}
}
return Arrays.copyOf(arrayDoubles, countDoubles);
}
/**
* Variant-16
* gets elements, consisted only by arrayA or only by arrayB
* @param arrayB array of elements
* @return array of unique elements
* @throws IllegalArgumentException arrayA is null or arrayB is null
*/
public static int[] getUniques(int[] arrayB) throws IllegalArgumentException {
checkArrayNull(arrayA);
checkArrayNull(arrayB);
return ArrayTool.mergeArrays(ArrayTool.getValues(arrayA,ArrayTool.findUnique(arrayA,arrayB)),
ArrayTool.getValues(arrayB,ArrayTool.findUnique(arrayB,arrayA)));
}
/**
* Variant-17
* gets differences for every element of array with maximal element of array
* @return array of differences
* @throws IllegalArgumentException array is null
*/
public static int[] calculateDifferenceFromMax() throws IllegalArgumentException {
checkArrayNull(arrayA);
int max = ArrayTool.getMax(arrayA);
int[] differences = new int[arrayA.length];
for (int i = 0; i < arrayA.length; i++) {
differences[i] = max - arrayA[i];
}
return differences;
}
/**
* Variant-18
* gets count of arrayA elements in intervals, limited by arrayB elements
* @param arrayB limits of intervals
* @return array with count of elements in every interval; count of elements out of any interval
* @throws IllegalArgumentException arrayA or arrayB is null, or arrayB not contains at least two elements
*/
public static int[] evaluateIntervals(int[] arrayB) throws IllegalArgumentException {
checkArrayNull(arrayA);
checkArrayNull(arrayB);
checkHasArrayElement(arrayB, 1);
int[] intervalSize = new int[arrayB.length];
for (int i = 1; i < arrayB.length; i++) {
for (int j : arrayA) {
if ((arrayB[i - 1] < j) && (j < arrayB[i])) {
intervalSize[i - 1]++;
}
}
}
intervalSize[intervalSize.length - 1] = arrayA.length - ArrayTool.calculateSum(intervalSize);
return intervalSize;
}
/**
* Variant-19
* finds unique elements
* requires getValues() calling
* @return indexes of unique elements
* @throws IllegalArgumentException
*/
public static int[] findUnique() throws IllegalArgumentException {
checkArrayNull(arrayA);
return ArrayTool.findUnique(arrayA);
}
/**
* Variant-20
* gets percent of array elements, less than average, equals to average and greater than average
* @return array of three double percent values [less, equal, greater]
* @throws IllegalArgumentException array is null or empty
*/
public static double[] statisticAverageRelated() throws IllegalArgumentException {
checkArrayNull(arrayA);
checkHasArrayElement(arrayA, 0);
int[] count = new int[3];
double average = ArrayTool.calculateAverage(arrayA);
for (int i : arrayA) {
if (Math.abs(average - i) < 1e-10) {
count[1]++;
} else if (average > i) {
count[0]++;
} else {
count[2]++;
}
}
double[] statistic = new double[] { count[0] * 100. / arrayA.length,
count[1] * 100. / arrayA.length, count[2] * 100. / arrayA.length};
return statistic;
}
/**
* Variant-21
* checks is arrayA is linear combination of arrayB
* @param arrayB array elements linear combination of
* @return is arrayA is linear combination of arrayB
* @throws IllegalArgumentException arrayA or arrayB is null, or arrayA or ArrayB contains less than two elements
*/
public static boolean checkLinearCombination(int[] arrayB) throws IllegalArgumentException {
checkArrayNull(arrayA);
checkArrayNull(arrayB);
checkHasArrayElement(arrayA,1);
checkHasArrayElement(arrayB,1);
if (arrayA.length != arrayB.length) {
return false;
}
double k = (arrayA[0] - arrayA[1]) / (double) (arrayB[0] - arrayB[1]);
double c = (arrayA[1] * arrayB[0] - arrayA[0] * arrayB[1]) / (double) (arrayB[0] - arrayB[1]);
for (int i = 2; i < arrayA.length; i++) {
if (Math.abs(arrayA[i] - arrayB[i] * k - c) > 1e-10) {
return false;
}
}
return true;
}
/**
* Variant-22
* gets order of indexes in sorted by decreasing array
* @return order of indexes
* @throws IllegalArgumentException array is null
*/
public static int[] getIndexesByDecreasingValues() throws IllegalArgumentException {
checkArrayNull(arrayA);
int[] array = Arrays.copyOf(arrayA, arrayA.length);
int[] indexes = new int[arrayA.length];
for (int i = 0; i < indexes.length; i++) {
indexes[i] = i;
}
for (int i = array.length - 1; i >= 0; i--) {
for (int j = i; j >= 0; j--) {
if (array[i] > array[j]) {
array = ArrayTool.swapElements(array, i, j);
indexes = ArrayTool.swapElements(indexes, i, j);
}
}
}
return indexes;
}
/**
* Variant-23
* gets groups of equal elements in array
* @return array of strings; each contains equal elements and their value
*/
public static String[] getRepeats() throws IllegalArgumentException {
checkArrayNull(arrayA);
return ArrayTool.getRepeats(arrayA);
}
/**
* Variant-24
* gets number of a day in a current year
* @param intercalary is year an intercalary
* @return number of day in a year
* @throws IllegalArgumentException array is null or contains less than two elements or invalid day or month number
*/
public static int getYearDayNumber(boolean intercalary) throws IllegalArgumentException {
checkArrayNull(arrayA);
checkHasArrayElement(arrayA, 1);
if (arrayA[0] > 11) {
throw new IllegalArgumentException("invalid month number");
}
final int[] daysBeforeMonth = new int[] { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
if (arrayA[1] > daysBeforeMonth[arrayA[0] + 1] - daysBeforeMonth[arrayA[0]] +
(intercalary && (arrayA[0] == 1) ? 1 : 0)) {
throw new IllegalArgumentException("invalid day number");
}
return daysBeforeMonth[arrayA[0]] + arrayA[1] + (intercalary && (arrayA[0] > 1) ? 1 : 0);
}
/**
* converts command line arguments into int[]
* @param args command line arguments
*/
public static void setArrayA(String[] args) {
arrayA = new int[args.length];
int invalidArguments = 0;
for (int i = 0; i < args.length; i++) {
try {
arrayA[i - invalidArguments] = Integer.parseInt(args[i]);
} catch (IllegalArgumentException e) {
printLine("invalid " + (i+1) + "th argument " + args[i] + " was ignored");
invalidArguments++;
}
}
arrayA = Arrays.copyOf(arrayA,arrayA.length - invalidArguments);
}
/**
* sets arrayA
* @param array array of int to set arrayA
* @throws IllegalArgumentException array is null
*/
public static void setArrayA(int[] array) throws IllegalArgumentException {
checkArrayNull(array);
arrayA = Arrays.copyOf(array,array.length);
}
/**
* gets copy of arrayA
* @return copy of arrayA
*/
public static int[] getArrayA() {
return Arrays.copyOf(arrayA, arrayA.length);
}
/**
* checks is array null
* @param array array to checking
* @throws IllegalArgumentException array is null exception
*/
private static void checkArrayNull(int[] array)
throws IllegalArgumentException {
if (array == null) {
throw new IllegalArgumentException("array must not be null");
}
}
/**
* @param array array to check
* @param k element to check
* @throws IllegalArgumentException
*/
private static void checkHasArrayElement(int[] array, int k) throws IllegalArgumentException {
if (array.length < k) {
throw new IllegalArgumentException("There is no "+k+"th element in array");
}
}
/**
* prints String line
* @param s String to print
*/
private static void printLine(String s) {
System.out.println(s);
}
/**
* uses Arrays.toString() to convert int[] array into String and print it
*/
private static void printIntArray(int[] array) {
printLine( Arrays.toString(array));
}
}
|
package com.epitech.ToDoList.DataBase;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.epitech.ToDoList.DataBase.TaskContract;
/**
* Created by Yoshax on 02/02/2018.
*/
public class DataBaseH extends SQLiteOpenHelper {
public DataBaseH(Context context) {
super(context, TaskContract.DB_NAME, null, TaskContract.DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String createTable = "CREATE TABLE " + TaskContract.TaskEntry.TABLE + " ( " +
TaskContract.TaskEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
TaskContract.TaskEntry.COL_TASK_TITLE + " TEXT NOT NULL, " +
TaskContract.TaskEntry.COL_TASK_DESCRIPTION + " TEXT NOT NULL, " +
TaskContract.TaskEntry.COL_TASK_DH + " TEXT NOT NULL);";
db.execSQL(createTable);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TaskContract.TaskEntry.TABLE);
onCreate(db);
}
} |
package Test;
public interface C {
void calculator(int num_a,int num_b);
}
|
package com.alura.controller;
import com.alura.dto.DetalhesTopicoDto;
import com.alura.dto.TopicoDto;
import com.alura.form.TopicoForm;
import com.alura.modelo.Topico;
import com.alura.service.TopicoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/alura")
public class TopicoController {
@Autowired
private TopicoService topicoService;
@GetMapping
@ResponseStatus(HttpStatus.OK)
public List<Topico> listar(){
return topicoService.listar();
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public Topico cadastrar(@RequestBody @Valid final TopicoForm form){
Topico topico = topicoService.cadastrar(form);
return topico;
}
@GetMapping("/{id}")
@ResponseStatus(HttpStatus.ACCEPTED)
public DetalhesTopicoDto buscar(@PathVariable final Long id){
return topicoService.buscar(id);
}
@PutMapping("/{id}")
@ResponseStatus(HttpStatus.ACCEPTED)
public void atualizar(@RequestBody @Valid final TopicoDto topicoDto, @PathVariable final Long id){
topicoService.atualizar(topicoDto, id);
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deletar(@PathVariable final Long id){
topicoService.deletar(id);
}
}
|
import java.awt.event.KeyListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
/**
* When initialized to a jFrame, directs flow of input. This abstracts away java's weird swing input and output mechanisms into something nicer.
*
*/
public class Display {
public JFrame frame;
public JPanel panel = null;
private KeyListener keyListener = null;
private MouseListener mouseListener = null;
private MouseMotionListener mouseMotionListener = null;
private MouseWheelListener mouseWheelListener = null;
/**
* Creates a new GameInterface attached to the specified JFrame.
* @param frame
*/
public Display(JFrame frame) {
this.frame = frame;
}
/**
* Switches the JFrame to the specified JPanel, and changes the current JPanel's input listeners.
* @param panel
*/
public void possess(JPanel panel, KeyListener keyListener, MouseListener mouseListener, MouseMotionListener mouseMotionListener, MouseWheelListener mouseWheelListener) {
// Remove previous listeners
frame.removeKeyListener(this.keyListener);
frame.removeMouseMotionListener(this.mouseMotionListener);
frame.removeMouseWheelListener(this.mouseWheelListener);
frame.removeMouseListener(this.mouseListener);
// set current listeners
this.keyListener = keyListener;
this.mouseListener = mouseListener;
this.mouseWheelListener = mouseWheelListener;
this.mouseMotionListener = mouseMotionListener;
// attach new listeners
frame.addKeyListener(keyListener);
frame.addMouseListener(mouseListener);
frame.addMouseMotionListener(mouseMotionListener);
frame.addMouseWheelListener(mouseWheelListener);
final JPanel pane = panel;
// Swap the JPanel
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// TODO Auto-generated method stub
frame.getContentPane().removeAll();
frame.validate();
frame.add(pane);
frame.validate();
frame.repaint();
System.out.println("Panel added");
frame.requestFocus();
}
});
}
/**
* Get the width of the frame
* @return frame width
*/
public int getWidth() {
return frame.getWidth();
}
/**
* Get the height of the frame
* @return frame height
*/
public int getHeight() {
return frame.getHeight();
}
public static int DEFAULT_WIDTH = 1000;
public static int DEFAULT_HEIGHT = 800;
public static int FRAME_DELAY_MS = 20;
}
|
package com.youthlin.example.swing;
import javafx.beans.property.SimpleIntegerProperty;
import java.awt.*;
import static com.youthlin.utils.i18n.Translation._f;
/**
* @author : youthlin.chen @ 2019-10-24 22:39
*/
public class ScoreText extends GameObject {
private SimpleIntegerProperty score = new SimpleIntegerProperty();
@Override
public void logic(double fps) {
}
@Override
public void paint(Graphics g) {
g.setColor(Color.WHITE);
g.drawString(_f("Score: {0}", score.get()), 510, 30);
}
}
|
package com.legaoyi.protocol.up.messagebody;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.legaoyi.protocol.message.MessageBody;
/**
* 查询终端属性应答
*
* @author <a href="mailto:shengbo.gao@gmail.com;78772895@qq.com">gaoshengbo</a>
* @version 1.0.0
* @since 2015-01-30
*/
@Scope("prototype")
@Component(MessageBody.MESSAGE_BODY_BEAN_PREFIX + "0107_2013" + MessageBody.MESSAGE_BODY_BEAN_SUFFIX)
public class JTT808_0107_2013_MessageBody extends MessageBody {
private static final long serialVersionUID = -3392914164582453750L;
public static final String MESSAGE_ID = "0107";
/** 终端类型 **/
@JsonProperty("terminalType")
private String terminalType;
/** 制造商id **/
@JsonProperty("mfrsId")
private String mfrsId;
/** 终端型号 **/
@JsonProperty("terminalModel")
private String terminalModel;
/** 终端id **/
@JsonProperty("terminalId")
private String terminalId;
/** 终端sim卡iccid **/
@JsonProperty("iccId")
private String iccId;
/** 终端硬件版本号 **/
@JsonProperty("hardwareVersion")
private String hardwareVersion;
/** 终端固件版本号 **/
@JsonProperty("firmwareVersion")
private String firmwareVersion;
/** gnss模块属性 **/
@JsonProperty("gnssAttribute")
private String gnssAttribute;
/** 通讯模块属性 **/
@JsonProperty("cmAttribute")
private String cmAttribute;
public final String getTerminalType() {
return terminalType;
}
public final void setTerminalType(String terminalType) {
this.terminalType = terminalType;
}
public final String getMfrsId() {
return mfrsId;
}
public final void setMfrsId(String mfrsId) {
this.mfrsId = mfrsId;
}
public final String getTerminalModel() {
return terminalModel;
}
public final void setTerminalModel(String terminalModel) {
this.terminalModel = terminalModel;
}
public final String getTerminalId() {
return terminalId;
}
public final void setTerminalId(String terminalId) {
this.terminalId = terminalId;
}
public final String getIccId() {
return iccId;
}
public final void setIccId(String iccId) {
this.iccId = iccId;
}
public final String getHardwareVersion() {
return hardwareVersion;
}
public final void setHardwareVersion(String hardwareVersion) {
this.hardwareVersion = hardwareVersion;
}
public final String getFirmwareVersion() {
return firmwareVersion;
}
public final void setFirmwareVersion(String firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
public final String getGnssAttribute() {
return gnssAttribute;
}
public final void setGnssAttribute(String gnssAttribute) {
this.gnssAttribute = gnssAttribute;
}
public final String getCmAttribute() {
return cmAttribute;
}
public final void setCmAttribute(String cmAttribute) {
this.cmAttribute = cmAttribute;
}
}
|
package com.apap.tugas1_apap.service;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.apap.tugas1_apap.model.InstansiModel;
import com.apap.tugas1_apap.model.JabatanModel;
import com.apap.tugas1_apap.model.PegawaiModel;
import com.apap.tugas1_apap.repository.PegawaiDb;
@Service
public class PegawaiServiceImpl implements PegawaiService{
@Autowired
private PegawaiDb pegawaiDb;
@Override
public Optional<PegawaiModel> getPegawaiByNip(String nip) {
return pegawaiDb.findByNip(nip);
}
@Override
public BigDecimal calculateGaji(PegawaiModel pegawai) {
Double persen_tunjangan = pegawai.getInstansi().getProvinsi().getPresentase_tunjangan();
Double gaji_pokok = pegawai.getJabatan().get(0).getGajiPokok();
Double gaji = gaji_pokok + ((persen_tunjangan/100) * gaji_pokok);
BigDecimal bd = new BigDecimal(gaji).setScale(0);
return bd;
}
@Override
public List<PegawaiModel> findByInstansiSortTglLahirDesc(InstansiModel instansi) {
return pegawaiDb.findByInstansiOrderByTanggalLahirDesc(instansi);
}
@Override
public void addPegawai(PegawaiModel pegawai) {
pegawaiDb.save(pegawai);
}
@Override
public String generateNip(PegawaiModel pegawai) {
// NIP = idInstansi+tgllahir dd-mm-yy + mulai kerja + nomor urut
// cek perubahan nip
if (pegawai.getNip() != null) {
PegawaiModel oldData = pegawaiDb.getOne(pegawai.getId());
if (pegawai.getInstansi().equals(oldData.getInstansi()) && pegawai.getTahunMasuk().equals(oldData.getTahunMasuk()) && pegawai.getTanggalLahir().equals(oldData.getTanggalLahir())) {
return pegawai.getNip();
}
}
String kodeInstansi = String.valueOf(pegawai.getInstansi().getId());
String mulaiMasuk = String.format("%04d", Integer.parseInt(pegawai.getTahunMasuk()));
int noUrut = 1;
DateFormat df = new SimpleDateFormat("ddMMyy");
String kodeTglLahir = df.format(pegawai.getTanggalLahir());
System.out.println("Kode tanggal lahir: "+kodeTglLahir);
List<PegawaiModel> listTglLahirTahunMasukSama = pegawaiDb.findByTanggalLahirAndTahunMasukAndInstansi(pegawai.getTanggalLahir(), pegawai.getTahunMasuk(), pegawai.getInstansi());
System.out.println(listTglLahirTahunMasukSama.size());
if (listTglLahirTahunMasukSama.size()>=1) {
System.out.println(listTglLahirTahunMasukSama.get(listTglLahirTahunMasukSama.size()-1).getNama());
String lastElementSameNip = listTglLahirTahunMasukSama.get(listTglLahirTahunMasukSama.size()-1).getNip();
String lastNoUrut = lastElementSameNip.substring(14, 16);
System.out.println("last NIP: "+ lastElementSameNip);
System.out.println("Last No urut: "+lastNoUrut);
noUrut = Integer.parseInt(lastNoUrut)+1;
}
System.out.println("current No Urut: "+String.valueOf(noUrut));
String nip = kodeInstansi.concat(kodeTglLahir).concat(mulaiMasuk).concat(String.format("%02d", noUrut));
// while(pegawaiDb.existsByNip(nip)) {
// nomorUrut+=01;
// nip = nip.substring(0,14).concat(String.format("%02d", nomorUrut));
// System.out.println(nip);
// }
return nip;
}
@Override
public List<PegawaiModel> findByInstansi(InstansiModel instansi){
return pegawaiDb.findByInstansi(instansi);
}
@Override
public List<PegawaiModel> findByJabatan(JabatanModel jabatan){
return pegawaiDb.findByJabatan(jabatan);
}
@Override
public List<PegawaiModel> findAll(){
return pegawaiDb.findAll();
}
@Override
public List<PegawaiModel> findByInstansiJabatan(InstansiModel instansi, JabatanModel jabatan){
return pegawaiDb.findByInstansiAndJabatan(instansi, jabatan);
}
@Override
public HashMap<String, Integer> getPegawaiNumOnJabatan(List<JabatanModel> allJabatan){
HashMap<String, Integer> jabatanWithPegawaiNum = new HashMap<String, Integer>();
for (JabatanModel jabatan : allJabatan) {
jabatanWithPegawaiNum.put(String.valueOf(jabatan.getId()), pegawaiDb.findByJabatan(jabatan).size());
System.out.println(jabatanWithPegawaiNum.get(jabatan.getId()));
}
return jabatanWithPegawaiNum;
}
}
|
package serviceTests;
import com.google.gson.Gson;
import dao.AuthTokenDao;
import dao.DataAccessException;
import dao.Database;
import dao.PersonDao;
import model.AuthToken;
import model.Person;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import request.LoadRequest;
import response.ErrorResponse;
import response.PersonResponse;
import response.Response;
import service.ClearService;
import service.LoadService;
import service.PersonService;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.UUID;
import static org.junit.Assert.*;
public class PersonServiceTest {
Person person;
AuthToken authToken;
AuthToken sheilaToken;
@Before
public void setUp() throws Exception {
ClearService cs = new ClearService();
cs.clear();
Database db = new Database();
db.openConnection();
db.createTables();
person = new Person("personID", "username", "firstName",
"lastName", "m", "fatherID", "motherID", "spouseID");
PersonDao personDao = new PersonDao(db.getConn());
personDao.insert(person);
authToken = new AuthToken(UUID.randomUUID().toString(), "username");
AuthTokenDao authTokenDao = new AuthTokenDao(db.getConn());
authTokenDao.insert(authToken);
db.closeConnection(true);
db = null;
}
@After
public void tearDown() throws Exception {
ClearService cs = new ClearService();
cs.clear();
}
@Test
public void getPerson() {
PersonService ps = new PersonService();
PersonResponse pr = (PersonResponse) ps.getPerson(authToken.getAuthToken(), "personID");
assertTrue(pr.getMessage() == null);
assertTrue(pr.getAssociatedUsername().equals(person.getAssociatedUsername()));
assertTrue(pr.getPersonID().equals(person.getPersonID()));
assertTrue(pr.getFirstName().equals(person.getFirstName()));
assertTrue(pr.getLastName().equals(person.getLastName()));
assertTrue(pr.getGender().equals(person.getGender()));
}
@Test
public void getPersonFail(){
PersonService ps = new PersonService();
ErrorResponse er = (ErrorResponse) ps.getPerson(authToken.getAuthToken(), "personid"); //Check for case sensitive searching
assertTrue(er.getMessage() != null);
String targetMessage = "Invalid data";
assertTrue(targetMessage.equals(er.getMessage()));
}
@Test
public void getFamily() {
File location = new File("C:/Users/jacob/IdeaProjects/FamilyMap/fms/json/example.json");
LoadRequest req;
try (Reader reader = new FileReader(location)){
Gson gson = new Gson();
req = gson.fromJson(reader, LoadRequest.class);
LoadService ls = new LoadService();
ls.load(req);
Database db = new Database();
db.openConnection();
AuthTokenDao atd = new AuthTokenDao(db.getConn());
sheilaToken = new AuthToken(UUID.randomUUID().toString(), "sheila");
atd.insert(sheilaToken);
db.closeConnection(true);
}
catch (IOException e) {
e.printStackTrace();
}
catch (DataAccessException e){
e.printStackTrace();
}
PersonService ps = new PersonService();
Response[] pr = ps.getFamily(sheilaToken.getAuthToken());
assertTrue(pr.length == 3);
}
@Test
public void getFamilyFail() {
PersonService ps = new PersonService();
Response[] response = ps.getFamily(null);
assertTrue(response[0] instanceof ErrorResponse);
}
} |
package dev.bltucker.conway.game;
import dev.bltucker.conway.tickmethods.TickMethod;
import dev.bltucker.conway.tickmethods.TimedTick;
import dev.bltucker.conway.ui.CommandLine;
import dev.bltucker.conway.ui.UserInterface;
import junit.framework.Assert;
import org.junit.Test;
public class GameTest {
@Test
public void TestGameInitialization(){
TickMethod tickMethod = new TimedTick(10000);
UserInterface ui = new CommandLine();
Game game = new Game(100, 100, tickMethod, ui);
Assert.assertEquals(100, game.getWidth());
Assert.assertEquals(100, game.getHeight());
Assert.assertEquals(game.getTickMethod(), tickMethod);
}
} |
package com.arthur.bishi.xiecheng0415;
import java.util.Scanner;
/**
* @title: No1
* @Author ArthurJi
* @Date: 2021/4/15 18:57
* @Version 1.0
*/
public class No1 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String res;
String _n;
try {
_n = in.nextLine();
} catch (Exception e) {
_n = null;
}
res = buildingHouse(_n);
System.out.println(res);
}
private static String buildingHouse(String n) {
StringBuilder sb = new StringBuilder();
int k;
try {
k = Integer.valueOf(n);
if(k > 12 || k <= 0) {
return "O";
}
dfs(sb, k, "R");
return sb.toString();
} catch (Exception e) {
return "N";
}
}
private static void dfs(StringBuilder sb, int n, String ch) {
if (n == 0) {
return;
}
dfs(sb, n - 1, "G");
sb.append(ch);
dfs(sb, n - 1, "R");
}
}
|
package com.oracle.notebookserver.configuration;
public class GeneralConfiguration {
public static final int REQUEST_TIMEOUT = 10_000; // in miliseconds
}
|
package org.giddap.dreamfactory.leetcode.onlinejudge.implementations;
import org.giddap.dreamfactory.leetcode.commons.ListNode;
import org.giddap.dreamfactory.leetcode.onlinejudge.AddTwoNumbers;
public class AddTwoNumbersImpl implements AddTwoNumbers {
@Override
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode head = new ListNode(0);
ListNode prev = head;
int c = 0;
while (l1 != null || l2 != null) {
int sum = c;
if (l1 != null) {
sum += l1.val;
l1 = l1.next;
}
if (l2 != null) {
sum += l2.val;
l2 = l2.next;
}
ListNode curr = new ListNode(sum % 10);
prev.next = curr;
prev = curr;
c = sum / 10;
}
if (c != 0) {
ListNode curr = new ListNode(c);
prev.next = curr;
}
return head.next;
}
}
|
package f.star.iota.milk.ui.akabe.kabe;
import android.os.Bundle;
import f.star.iota.milk.base.FixedImageFragment;
public class KabeFragment extends FixedImageFragment<KabePresenter, KabeAdapter> {
public static KabeFragment newInstance(String url) {
KabeFragment fragment = new KabeFragment();
Bundle bundle = new Bundle();
bundle.putString("base_url", url);
fragment.setArguments(bundle);
return fragment;
}
@Override
protected KabePresenter getPresenter() {
return new KabePresenter(this);
}
@Override
protected KabeAdapter getAdapter() {
return new KabeAdapter();
}
@Override
protected boolean isHideFab() {
return false;
}
}
|
package com.ut.module_mine.viewModel;
import android.annotation.SuppressLint;
import android.app.Application;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData;
import android.arch.lifecycle.Observer;
import android.support.annotation.NonNull;
import com.ut.base.ErrorHandler;
import com.ut.database.daoImpl.LockGroupDaoImpl;
import com.ut.database.entity.LockGroup;
import com.ut.module_mine.R;
import java.util.List;
public class LockGroupViewModel extends BaseViewModel {
public LiveData<List<LockGroup>> mLockGroups;
public MutableLiveData<Void> addGroupSuccess = new MutableLiveData<>();
public MutableLiveData<Boolean> loadLockGroupState = new MutableLiveData<>();
public LockGroupViewModel(@NonNull Application application) {
super(application);
mLockGroups = LockGroupDaoImpl.get().getAllLockGroup();
}
@SuppressLint("CheckResult")
public void loadLockGroup(boolean isShowTip) {
service.getGroup()
.doOnNext(stringResult -> {
if (stringResult == null) {
throw new NullPointerException(getApplication().getString(R.string.serviceErr));
}
if (!stringResult.isSuccess()) {
throw new Exception(stringResult.msg);
}
})
.subscribe(listResult -> {
LockGroupDaoImpl.get().deleteAll();
LockGroupDaoImpl.get().insertAll(listResult.data);
loadLockGroupState.postValue(true);
},
new ErrorHandler(){
@Override
public void accept(Throwable throwable) {
super.accept(throwable);
loadLockGroupState.postValue(false);
}
}
);
}
@SuppressLint("CheckResult")
public void addLockGroup(String groupName) {
service.addGroup(groupName)
.doOnNext(stringResult -> {
if (stringResult == null) {
throw new NullPointerException(getApplication().getString(R.string.serviceErr));
}
if (!stringResult.isSuccess()) {
throw new Exception(stringResult.msg);
}
addGroupSuccess.postValue(null);
})
.subscribe(voidResult -> tip.postValue(voidResult.msg),
new ErrorHandler());
}
}
|
package com.mobile.bataillenavale.lulu.bataillenavalemobile.controleur.communication;
import android.app.Activity;
/**
* Created by Cyril on 10/01/2018.
*/
public abstract class MultijoueurActivity extends Activity {
private boolean isWifiP2pEnabled = false;
public void setIsWifiP2pEnabled(boolean isWifiP2pEnabled) {
this.isWifiP2pEnabled = isWifiP2pEnabled;
}
}
|
import java.util.*;
class shaurya
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the string ");
String s=sc.nextLine();
s=s+"S";
int x,y,z,sum=0,start=0,end=0;
for(x=1;x<s.length();x++)
{
char ch=s.charAt(x);
if(Character.isUpperCase(ch))
{
sum++;
end=x;
String s1=s.substring(start,end);
start=end;
System.out.println(s1);
}
}
System.out.println(sum);
}
}
|
package com.example.laboratorio_ahorcado;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
//creando obejtos para enlazar los componente
EditText edtTryWord, edtE, edtT, edtP, edtS;
TextView tvCounter, tvResult;
Button btnVerify, btnClean;
int counter = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//enlazando los componente
edtTryWord = findViewById(R.id.edtWordToTry);
edtE = findViewById(R.id.edtLetterE);
edtT = findViewById(R.id.edtLetterT);
edtP = findViewById(R.id.edtLetterP);
edtS = findViewById(R.id.edtLetterS);
btnVerify = findViewById(R.id.btnVerify);
btnClean = findViewById(R.id.btnClean);
tvCounter = findViewById(R.id.tvCounter);
tvResult = findViewById(R.id.tvResult);
btnClean.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
edtTryWord.setText("");
}
});
btnVerify.setOnClickListener(new View.OnClickListener() {
@SuppressLint("WrongConstant")
@Override
public void onClick(View view) {
String word = edtTryWord.getText().toString().trim();
if(TextUtils.isEmpty(word)){
edtTryWord.setError("Valor requerido");
edtTryWord.requestFocus();
} else {
tvResult.setText("");
counter++;
tvCounter.setText(String.valueOf(counter));
if(counter ==7){
tvResult.setText("PERDISTE.");
edtTryWord.setText("");
counter = 0;
}else{
int time=1;
if(word.contains("e") || word.contains("E")){
edtE.setText("E");
}
if(word.contains("t") || word.contains("T")){
edtT.setText("T");
}
if(word.contains("p") || word.contains("P")){
edtP.setText("P");
}
if(word.contains("s") || word.contains("S")){
edtS.setText("S");
}
String e = edtE.getText().toString();
String t = edtT.getText().toString();
String p = edtP.getText().toString();
String s = edtS.getText().toString();
if(TextUtils.isEmpty(e) || TextUtils.isEmpty(t) || TextUtils.isEmpty(p) || TextUtils.isEmpty(s)){
Toast.makeText(getApplicationContext(), "continua intentando", time).show();
edtTryWord.setText("");
}else{
tvResult.setText("GANASTE");
edtTryWord.setText("");
}
}
}
}
});
}
} |
package pl.morecraft.dev.datagrammer.misc;
import sun.nio.cs.US_ASCII;
import java.nio.charset.Charset;
public class Config {
public static final Charset DEFAULT_CHARSET = new US_ASCII();
public static Integer DEFAULT_PACKET_SIZE = 12;
public static Integer DEFAULT_TIMEOUT = 1000;
}
|
package org.sheehan.fortune.service.Impl;
import org.sheehan.fortune.service.PictureCurator;
import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@Service
public class PictureCuratorImpl implements PictureCurator {
@Override
public void CuratePicture(String[] participants) throws IOException {
Color[] colors = {new Color(110,109,109),new Color(255,170,113),new Color(255,113,113)};
BufferedImage image = new BufferedImage(400, 400, BufferedImage.TYPE_INT_ARGB);
// create graphics
Graphics2D graphics = image.createGraphics();
//set graphics profile
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
graphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,RenderingHints.VALUE_COLOR_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
if(participants.length%2==0){
for(int i = 0; i<participants.length; i++){
graphics.setPaint(colors[i%2]);
graphics.drawArc(0,0,400,400,90+(i*360/participants.length),360/participants.length);
graphics.fillArc(0,0,400,400,90+(i*360/participants.length),360/participants.length);
}
} else if((participants.length-1)%3==0){
for(int i = 0; i<participants.length-1; i++){
graphics.setPaint(colors[i%3]);
graphics.drawArc(0,0,400,400,90+(i*360/participants.length),360/participants.length);
graphics.fillArc(0,0,400,400,90+(i*360/participants.length),360/participants.length);
}
graphics.setPaint(colors[1]);
graphics.drawArc(0,0,400,400,90+((participants.length-1)*360/participants.length),360/participants.length);
graphics.fillArc(0,0,400,400,90+((participants.length-1)*360/participants.length),360/participants.length);
} else {
for(int i = 0; i<participants.length; i++){
graphics.setPaint(colors[i%3]);
graphics.drawArc(0,0,400,400,90+(i*360/participants.length),360/participants.length);
graphics.fillArc(0,0,400,400,90+(i*360/participants.length),360/participants.length);
}
}
graphics.rotate(Math.PI/participants.length,200,200);
graphics.setFont(new Font("宋体",Font.PLAIN,20));
graphics.setPaint(Color.BLACK);
for(int p = 0; p<participants.length; p++){
char[] strcha = participants[p].toCharArray();
int strWidth = graphics.getFontMetrics().charsWidth(strcha, 0, participants[p].length());
graphics.drawString(participants[p],200-strWidth/2,20);
graphics.rotate((2*Math.PI)/participants.length,200,200);
}
graphics.dispose();
ImageIO.write(image, "png", new File("result.png"));
}
@Override
public void CurateRectanglePicture(String[] participants) {
BufferedImage image = new BufferedImage(100, 30*participants.length, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
graphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,RenderingHints.VALUE_COLOR_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
graphics.setFont(new Font("宋体",Font.PLAIN,20));
graphics.setPaint(Color.BLACK);
for(int p = 0; p<participants.length; p++) {
char[] strcha = participants[p].toCharArray();
int strWidth = graphics.getFontMetrics().charsWidth(strcha, 0, participants[p].length());
graphics.drawString(participants[p], 50 - strWidth / 2, (p+1)*30-10);
}
graphics.dispose();
try {
ImageIO.write(image, "png", new File("result.png"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
package com.sirma.itt.javacourse.inputoutput.task6.serialization;
import java.io.IOException;
import org.apache.log4j.Logger;
import com.sirma.itt.javacourse.InputUtils;
/**
* Class for running serialization example we create a new {@link UserDefinedObject} and save it to
* a file and then we read the object and save it into a file then we read the file and retrieve the
* object from it.
*
* @author Simeon Iliev
*/
public class RunSerializathionObjects {
private static Logger log = Logger.getLogger(RunSerializathionObjects.class.getName());
/**
* Main method for the application
*
* @param args
* arguments for the main method
*/
public static void main(String[] args) {
String path = null;
int myNumber;
String say;
InputUtils.printConsoleMessage("Input number and String to say something");
InputUtils.printConsoleMessage("Input my number ");
myNumber = InputUtils.readInt();
InputUtils.printConsoleMessage("Input say something for the object");
say = InputUtils.readLine();
UserDefinedObject object = new UserDefinedObject(myNumber, say);
InputUtils.printConsoleMessage("Input path to file to save the object");
path = InputUtils.readLine();
object.saveObject("target/" + path, object);
UserDefinedObject object2 = null;
try {
object2 = object.getObject("target/" + path);
InputUtils.printConsoleMessage("The object read says " + object2.getSaySomething());
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
}
|
/***********************************************************
* @Description :
* @author : 梁山广(Liang Shan Guang)
* @date : 2020/5/1 20:18
* @email : liangshanguang2@gmail.com
***********************************************************/
package 第4到27章_23大设计模式.第07章_建造者模式.V2链式调用;
public class Course {
public Course(CourseBuilder courseBuilder) {
this.courseName = courseBuilder.courseName;
this.coursePpt = courseBuilder.coursePpt;
this.courseVideo = courseBuilder.courseArticle;
this.courseArticle = courseBuilder.courseArticle;
this.courseQa = courseBuilder.courseQa;
}
/**
* 课程名
*/
private String courseName;
/**
* PPT
*/
private String coursePpt;
/**
* 课程视频
*/
private String courseVideo;
/**
* 手记
*/
private String courseArticle;
/**
* 问答
*/
private String courseQa;
@Override
public String toString() {
return "Course{" +
"courseName='" + courseName + '\'' +
", coursePpt='" + coursePpt + '\'' +
", courseVideo='" + courseVideo + '\'' +
", courseArticle='" + courseArticle + '\'' +
", courseQa='" + courseQa + '\'' +
'}';
}
/**
* 静态内部类,把实体类和实体类的Builder放在一起
*/
public static class CourseBuilder {
/**
* 课程名
*/
private String courseName;
/**
* PPT
*/
private String coursePpt;
/**
* 课程视频
*/
private String courseVideo;
/**
* 手记
*/
private String courseArticle;
/**
* 问答
*/
private String courseQa;
public CourseBuilder buildCourseName(String courseName) {
this.courseName = courseName;
// 返回当前对象本身,方便调用
return this;
}
public CourseBuilder buildCoursePpt(String coursePpt) {
this.coursePpt = coursePpt;
// 返回当前对象本身,方便调用
return this;
}
public CourseBuilder buildCourseVideo(String courseVideo) {
this.courseVideo = courseVideo;
// 返回当前对象本身,方便调用
return this;
}
public CourseBuilder buildCourseArticle(String courseArticle) {
this.courseArticle = courseArticle;
// 返回当前对象本身,方便调用
return this;
}
public CourseBuilder buildCourseQa(String courseQa) {
this.courseQa = courseQa;
// 返回当前对象本身,方便调用
return this;
}
public Course build() {
// 调用Course的构造器
return new Course(this);
}
}
}
|
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.limegroup.gnutella.gui.init;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.apache.commons.io.IOUtils;
import org.limewire.util.OSUtils;
import org.limewire.util.SystemUtils;
import com.limegroup.gnutella.gui.I18n;
import com.limegroup.gnutella.gui.LanguageFlagFactory;
import com.limegroup.gnutella.gui.LanguageUtils;
import com.limegroup.gnutella.gui.ResourceManager;
import com.limegroup.gnutella.settings.ApplicationSettings;
public class LanguagePanel extends JPanel {
private final JLabel languageLabel;
private final ActionListener actionListener;
private final JComboBox<Object> languageOptions;
/**
* Constructs a LanguagePanel that will notify the given listener when the
* language changes.
*/
public LanguagePanel(ActionListener actionListener) {
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.actionListener = actionListener;
this.languageLabel = new JLabel();
languageOptions = new JComboBox<Object>();
Font font = new Font("Dialog", Font.PLAIN, 11);
languageOptions.setFont(font);
Locale[] locales = LanguageUtils.getLocales(font);
languageOptions.setModel(new DefaultComboBoxModel<Object>(locales));
languageOptions.setRenderer(LanguageFlagFactory.getListRenderer());
Locale locale = guessLocale(locales);
languageOptions.setSelectedItem(locale);
applySettings(false);
// It is important that the listener is added after the selected item
// is set. Otherwise the listener will call methods that are not ready
// to be called at this point.
languageOptions.addItemListener(new StateListener());
add(languageLabel);
add(Box.createHorizontalStrut(5));
add(languageOptions);
}
/**
* Overrides applySettings in SetupWindow superclass.
* Applies the settings handled in this window.
*/
public void applySettings(boolean loadCoreComponents) {
Locale locale = (Locale) languageOptions.getSelectedItem();
LanguageUtils.setLocale(locale);
ResourceManager.validateLocaleAndFonts(locale);
languageLabel.setText(I18n.tr("Language:"));
}
private class StateListener implements ItemListener {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
applySettings(false);
actionListener.actionPerformed(null);
languageOptions.requestFocus();
}
}
}
private Locale guessLocale(Locale[] locales) {
String[] language = guessLanguage();
Locale result = null;
try {
for (Locale l : locales) {
if (l.getLanguage().equalsIgnoreCase(language[0]) && l.getCountry().equalsIgnoreCase(language[1]) && l.getVariant().equalsIgnoreCase(language[2])) {
result = l;
}
if (l.getLanguage().equalsIgnoreCase(language[0]) && l.getCountry().equalsIgnoreCase(language[1]) && result == null) {
result = l;
}
if (l.getLanguage().equalsIgnoreCase(language[0]) && result == null) {
result = l;
}
}
} catch (Throwable e) {
//shhh!
}
return (result == null) ? new Locale(language[0], language[1], language[2]) : result;
}
private String[] guessLanguage() {
String ln = ApplicationSettings.LANGUAGE.getValue();
String cn = ApplicationSettings.COUNTRY.getValue();
String vn = ApplicationSettings.LOCALE_VARIANT.getValue();
String[] registryLocale = null;
if (OSUtils.isWindows() && (registryLocale = getDisplayLanguageFromWindowsRegistry()) != null) {
return registryLocale;
}
File file = new File("language.prop");
if (!file.exists())
return new String[] { ln, cn, vn };
InputStream in = null;
BufferedReader reader = null;
String code = "";
try {
in = new FileInputStream(file);
reader = new BufferedReader(new InputStreamReader(in));
code = reader.readLine();
} catch (IOException ignored) {
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(reader);
}
String[] mapped = getLCID(code);
if (mapped != null)
return mapped;
else
return new String[] { ln, cn, vn };
}
/**
* Returns the String[] { languageCode, countryCode, variantCode }
* for the Windows LCID.
*/
private String[] getLCID(String code) {
Map<String, String[]> map = new HashMap<String, String[]>();
map.put("1078", new String[] { "af", "", "" });
map.put("1052", new String[] { "sq", "", "" });
map.put("5121", new String[] { "ar", "", "" });
map.put("15361", new String[] { "ar", "", "" });
map.put("3073", new String[] { "ar", "", "" });
map.put("2049", new String[] { "ar", "", "" });
map.put("11265", new String[] { "ar", "", "" });
map.put("13313", new String[] { "ar", "", "" });
map.put("12289", new String[] { "ar", "", "" });
map.put("4097", new String[] { "ar", "", "" });
map.put("6145", new String[] { "ar", "", "" });
map.put("8193", new String[] { "ar", "", "" });
map.put("16385", new String[] { "ar", "", "" });
map.put("1025", new String[] { "ar", "", "" });
map.put("10241", new String[] { "ar", "", "" });
map.put("7169", new String[] { "ar", "", "" });
map.put("14337", new String[] { "ar", "", "" });
map.put("9217", new String[] { "ar", "", "" });
map.put("1069", new String[] { "eu", "", "" });
map.put("1059", new String[] { "be", "", "" });
map.put("1093", new String[] { "bn", "", "" });
map.put("1027", new String[] { "ca", "", "" });
map.put("3076", new String[] { "zh", "", "" });
map.put("5124", new String[] { "zh", "", "" });
map.put("2052", new String[] { "zh", "", "" });
map.put("4100", new String[] { "zh", "", "" });
map.put("1028", new String[] { "zh", "TW", "" });
map.put("1050", new String[] { "hr", "", "" });
map.put("1029", new String[] { "cs", "", "" });
map.put("1030", new String[] { "da", "", "" });
map.put("2067", new String[] { "nl", "", "" });
map.put("1043", new String[] { "nl", "", "" });
map.put("3081", new String[] { "en", "", "" });
map.put("10249", new String[] { "en", "", "" });
map.put("4105", new String[] { "en", "", "" });
map.put("9225", new String[] { "en", "", "" });
map.put("6153", new String[] { "en", "", "" });
map.put("8201", new String[] { "en", "", "" });
map.put("5129", new String[] { "en", "", "" });
map.put("13321", new String[] { "en", "", "" });
map.put("7177", new String[] { "en", "", "" });
map.put("11273", new String[] { "en", "", "" });
map.put("2057", new String[] { "en", "", "" });
map.put("1033", new String[] { "en", "", "" });
map.put("12297", new String[] { "en", "", "" });
map.put("1061", new String[] { "et", "", "" });
map.put("1035", new String[] { "fi", "", "" });
map.put("2060", new String[] { "fr", "", "" });
map.put("11276", new String[] { "fr", "", "" });
map.put("3084", new String[] { "fr", "", "" });
map.put("9228", new String[] { "fr", "", "" });
map.put("12300", new String[] { "fr", "", "" });
map.put("1036", new String[] { "fr", "", "" });
map.put("5132", new String[] { "fr", "", "" });
map.put("13324", new String[] { "fr", "", "" });
map.put("6156", new String[] { "fr", "", "" });
map.put("10252", new String[] { "fr", "", "" });
map.put("4108", new String[] { "fr", "", "" });
map.put("7180", new String[] { "fr", "", "" });
map.put("3079", new String[] { "de", "", "" });
map.put("1031", new String[] { "de", "", "" });
map.put("5127", new String[] { "de", "", "" });
map.put("4103", new String[] { "de", "", "" });
map.put("2055", new String[] { "de", "", "" });
map.put("1032", new String[] { "el", "", "" });
map.put("1037", new String[] { "iw", "", "" });
map.put("1081", new String[] { "hi", "", "" });
map.put("1038", new String[] { "hu", "", "" });
map.put("1039", new String[] { "is", "", "" });
map.put("1057", new String[] { "id", "", "" });
map.put("1040", new String[] { "it", "", "" });
map.put("2064", new String[] { "it", "", "" });
map.put("1041", new String[] { "ja", "", "" });
map.put("1042", new String[] { "ko", "", "" });
map.put("1062", new String[] { "lv", "", "" });
map.put("2110", new String[] { "ms", "", "" });
map.put("1086", new String[] { "ms", "", "" });
map.put("1082", new String[] { "mt", "", "" });
map.put("1044", new String[] { "no", "", "" });
map.put("2068", new String[] { "nn", "", "" });
map.put("1045", new String[] { "pl", "", "" });
map.put("1046", new String[] { "pt", "BR", "" }); // FTA: Portu Brazil
map.put("2070", new String[] { "pt", "", "" });
map.put("1048", new String[] { "ro", "", "" });
map.put("2072", new String[] { "ro", "", "" });
map.put("1049", new String[] { "ru", "", "" });
map.put("2073", new String[] { "ru", "", "" });
map.put("3098", new String[] { "sr", "", "" });
map.put("2074", new String[] { "sr", "", "" });
map.put("1051", new String[] { "sk", "", "" });
map.put("1060", new String[] { "sl", "", "" });
map.put("11274", new String[] { "es", "", "" });
map.put("16394", new String[] { "es", "", "" });
map.put("13322", new String[] { "es", "", "" });
map.put("9226", new String[] { "es", "", "" });
map.put("5130", new String[] { "es", "", "" });
map.put("7178", new String[] { "es", "", "" });
map.put("12298", new String[] { "es", "", "" });
map.put("17418", new String[] { "es", "", "" });
map.put("4106", new String[] { "es", "", "" });
map.put("18442", new String[] { "es", "", "" });
map.put("3082", new String[] { "es", "", "" });
map.put("2058", new String[] { "es", "", "" });
map.put("19466", new String[] { "es", "", "" });
map.put("6154", new String[] { "es", "", "" });
map.put("15370", new String[] { "es", "", "" });
map.put("10250", new String[] { "es", "", "" });
map.put("20490", new String[] { "es", "", "" });
map.put("1034", new String[] { "es", "", "" });
map.put("14346", new String[] { "es", "", "" });
map.put("8202", new String[] { "es", "", "" });
map.put("1053", new String[] { "sv", "", "" });
map.put("2077", new String[] { "sv", "", "" });
map.put("1097", new String[] { "ta", "", "" });
map.put("1054", new String[] { "th", "", "" });
map.put("1055", new String[] { "tr", "", "" });
map.put("1058", new String[] { "uk", "", "" });
map.put("1056", new String[] { "ur", "", "" });
map.put("2115", new String[] { "uz", "", "" });
map.put("1091", new String[] { "uz", "", "" });
map.put("1066", new String[] { "vi", "", "" });
return map.get(code);
}
private String[] getDisplayLanguageFromWindowsRegistry() {
//HKCU/Control Panel/Desktop/PreferredUILanguages
String[] result = null;
try {
String registryReadText = SystemUtils.registryReadText("HKEY_CURRENT_USER", "Control Panel\\Desktop", "PreferredUILanguages");
String[] splitLocale = registryReadText.split("-");
switch (splitLocale.length) {
case 1:
result = new String[] { splitLocale[0], "", "" };
break;
case 2:
result = new String[] { splitLocale[0], splitLocale[1], "" };
break;
case 3:
result = new String[] { splitLocale[0], splitLocale[1], splitLocale[2] };
break;
default:
result = null;
break;
}
} catch (Throwable e) {
}
return result;
}
}
|
public class P2_13
{public static void main(String [] args)
{
String greeting = "Hello World!";
greeting = greeting.replace('o','x');
greeting = greeting.replace('e','o');
greeting = greeting.replace('x','e');
System.out.print(greeting);
}
} |
package com.spring.professional.exam.tutorial.module03.question29.dao;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import com.spring.professional.exam.tutorial.module03.question29.ds.Employee;
public interface EmployeeDao extends CrudRepository<Employee, Integer> {
@Query("select e from Employee e where e.firstName= ?1 and e.lastName= ?2")
Employee findByFirstNameAndLastName(String firstName,String lastName);
}
|
package com.example.ips.mapper;
import com.example.ips.model.ServerplanSvnMaintain;
import java.util.List;
public interface ServerplanSvnMaintainMapper {
int deleteByPrimaryKey(Integer id);
int insert(ServerplanSvnMaintain record);
int insertSelective(ServerplanSvnMaintain record);
ServerplanSvnMaintain selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ServerplanSvnMaintain record);
int updateByPrimaryKey(ServerplanSvnMaintain record);
/**
* 查询全部集合
* @return
*/
List<ServerplanSvnMaintain> getAllSvnMaintain();
} |
package com.migu.spider.model;
public class Compet {
private String type;
private String videoType;
//列表页
private String shortTitle;
private String url;
//详细页
private String title;
private String content;
/**
* type.
*
* @return the type
*/
public String getType() {
return type;
}
/**
* type.
*
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* shortTitle.
*
* @return the shortTitle
*/
public String getShortTitle() {
return shortTitle;
}
/**
* shortTitle.
*
* @param shortTitle the shortTitle to set
*/
public void setShortTitle(String shortTitle) {
this.shortTitle = shortTitle;
}
/**
* url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* url.
*
* @param url the url to set
*/
public void setUrl(String url) {
this.url = url;
}
/**
* title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* title.
*
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* content.
*
* @return the content
*/
public String getContent() {
return content;
}
/**
* content.
*
* @param content the content to set
*/
public void setContent(String content) {
this.content = content;
}
}
|
package service.impl;
import service.IHelloService;
public class HelloServiceImpl implements IHelloService {
@Override
public void sayHello(String name) {
System.out.println("Hello " + name);
}
}
|
import java.io.*;
class Solution{
static void printPascal(int n){
for(int line=0; line<n; line++){
for(int i=0; i<=line; i++){
System.out.print(binomialCoefficient(line, i)+ " ");
System.out.println();
}
}
}
static int binomialCoefficient(int n, int k){
int res = 1;
if(k > n-k){
k = n-k;
}
for(int i=0; i<k; i++){
res *= (n-i);
res /= (i+1);
}
return res;
}
public static void main(String args[]){
int n = 7;
printPascal(7);
}
}
|
package com.example.oodlesdemoproject.viewmodel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.oodlesdemoproject.model.countrydetails.CountryDetailsResponse;
import com.example.oodlesdemoproject.model.repo.CountryListRepo;
import java.util.ArrayList;
public class MainActivityViewModel extends ViewModel {
CountryListRepo countryListRepo;
MutableLiveData<ArrayList<CountryDetailsResponse>> countryListData;
MutableLiveData<CountryDetailsResponse> countryDetails;
public CountryListRepo init() {
if (countryListRepo != null) return countryListRepo;
else {
countryListRepo = CountryListRepo.getInstance();
return countryListRepo;
}
}
public LiveData<ArrayList<CountryDetailsResponse>> getData() {
countryListData = countryListRepo.getCountryList();
return countryListData;
}
public LiveData<CountryDetailsResponse> getCountryDetails(String iso2) {
countryDetails = countryListRepo.getCountyDetails(iso2);
return countryDetails;
}
}
|
package com.reservation.service;
import java.util.List;
import java.util.Optional;
import org.springframework.stereotype.Service;
import com.reservation.model.Company;
@Service
public interface CompanyService {
public List<Company> getCompany();
public Company insertCompany(Company request);
public Optional<Company> getById(Company request);
public void deleteCompany(Company request);
public List<Company> getPagedCompany(Integer pageNo, Integer pageSize);
public List<Company> getPagedCompanyWithOrder(Integer pageNo, Integer pageSize, String sortBy);
}
|
package com.nube.core.instance.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
import com.nube.core.instance.dto.Instance;
public class InstanceDaoRowMapper implements RowMapper<Instance> {
public Instance mapRow(ResultSet resultSet, int rowNum) throws SQLException {
return new Instance(
resultSet.getString(InstanceDaoSql.Cols.KEY),
resultSet.getString(InstanceDaoSql.Cols.VALUE),
resultSet.getString(InstanceDaoSql.Cols.DESCR)
);
}
}
|
/**
* @author TATTYPLAY
* @date Jul 11, 2018
* @created 12:43:07 AM
* @filename Handler_1_8_R1.java
* @project ChatColor
* @package com.tattyhost.chatcolor.listener.chat.v1_8
* @copyright 2018
*/
package com.tattyhost.reporter.versions.v1_8;
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import com.tattyhost.reporter.IVersionHandler;
import net.minecraft.server.v1_8_R1.ChatSerializer;
import net.minecraft.server.v1_8_R1.IChatBaseComponent;
import net.minecraft.server.v1_8_R1.PacketPlayOutChat;
/**
*
*/
public class Handle_1_8_R1 implements IVersionHandler {
/*
* @see com.tattyhost.chatcolor.listener.chat.FormatChat#sendToPlayer(java.lang.String, java.lang.String, org.bukkit.entity.Player, org.bukkit.entity.Player)
*/
@Override
public void sendToPlayers(String message, Player ply, Player sender) {
IChatBaseComponent chat = ChatSerializer.a("[\"\"" + message + "]");
PacketPlayOutChat packet = new PacketPlayOutChat(chat);
((CraftPlayer) ply).getHandle().playerConnection.sendPacket(packet);
}
}
|
package pageObjects;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;
public class regPage {
public WebDriver ldriver;
public regPage(WebDriver rdriver) {
ldriver= rdriver;
PageFactory.initElements(rdriver, this);
}
@FindBy(id="u_0_m")
@CacheLookup
WebElement txtfirstName;
@FindBy(id="u_0_o")
@CacheLookup
WebElement txtsecondtName;
@FindBy(id="u_0_r")
@CacheLookup
WebElement txtemail;
@FindBy(xpath="//input[@id='u_0_w']")
@CacheLookup
WebElement txtpassword;
@FindBy(xpath="//select[@id='month']")
@CacheLookup
WebElement txtbirthmonth;
@FindBy(xpath="//button[@id='loginbutton']")
@CacheLookup
WebElement btnlogin;
@FindBy(xpath="//input[@id='u_0_b']")
@CacheLookup
WebElement btnlogout;
public void setfirstName(String firstName ) {
txtfirstName.clear();
txtfirstName.sendKeys(firstName);
}
public void setlastName(String lastName ) {
txtsecondtName.clear();
txtsecondtName.sendKeys(lastName);
}
public void setemail(String email ) {
txtemail.clear();
txtemail.sendKeys(email);
}
public void setpassword(String password ) {
txtpassword.clear();
txtpassword.sendKeys(password);
}
public void setbirthMonth(String birthMonth ) {
txtbirthmonth.clear();
Select dropmonth=new Select(txtbirthmonth);
dropmonth.selectByVisibleText(birthMonth);
// txtbirthmonth.sendKeys(birthMonth);
}
public void clicklogin() {
btnlogin.click();
}
public void clicklogout() {
btnlogout.click();
}
}
|
package sesion03_cg_mul_a;
public class Esferica
{
private double radio //Radio de la esfera
,AnguloE//Angulo teta
,AnguloF;//Angulo beta
//Constructores
public Esferica(double radio, double AnguloE, double AnguloF)
{
this.radio = radio;
this.AnguloE = AnguloE;
this.AnguloF = AnguloF;
}
public Esferica()
{
}
//Getter y setter
public double getRadio() {
return radio;
}
public void setR(double r) {
this.radio = r;
}
public double getAnguloE() {
return AnguloE;
}
public void setAnguloE(double anguloE) {
this.AnguloE = anguloE;
}
public double getAnguloF() {
return AnguloF;
}
public void setAnguloF(double AnguloF) {
this.AnguloF = AnguloF;
}
}
|
/**
* Contains the authoring User Interface. This package is self-contained except
* for internal references to commands and listeners, and should be used to
* launch the program (see GUI class)
*/
package authoring; |
/*
* Copyright (C) 2014 Vasilis Vryniotis <bbriniotis at datumbox.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.datumbox.framework.machinelearning.common.bases.featureselection;
import com.google.common.collect.Ordering;
import java.util.Iterator;
import java.util.Map;
/**
* Abstract class which is the base of every Categorical Feature Selection algorithm.
*
* @author Vasilis Vryniotis <bbriniotis at datumbox.com>
* @param <MP>
* @param <TP>
*/
public abstract class ScoreBasedFeatureSelection<MP extends ScoreBasedFeatureSelection.ModelParameters, TP extends ScoreBasedFeatureSelection.TrainingParameters> extends FeatureSelection<MP, TP> {
public static abstract class ModelParameters extends FeatureSelection.ModelParameters {
}
public static abstract class TrainingParameters extends FeatureSelection.TrainingParameters {
}
protected ScoreBasedFeatureSelection(String dbName, Class<MP> mpClass, Class<TP> tpClass) {
super(dbName, mpClass, tpClass);
}
public static void selectHighScoreFeatures(Map<Object, Double> featureScores, Integer maxFeatures) {
Double minPermittedScore=Ordering.<Double>natural().greatestOf(featureScores.values().iterator(), maxFeatures).get(maxFeatures-1);
boolean mongoDBhackRequired = featureScores.getClass().getName().contains("mongo"); //the MongoDB does not support iterator remove. We use this nasty hack to detect it and use remove instead
//remove any entry with score less than the minimum permitted one
Iterator<Map.Entry<Object, Double>> it = featureScores.entrySet().iterator();
while(it.hasNext()) {
Map.Entry<Object, Double> entry = it.next();
if(entry.getValue()<minPermittedScore) {
if(!mongoDBhackRequired) {
it.remove();
}
else {
featureScores.remove(entry.getKey()); //hack for mongo
}
}
}
//if some extra features still exist (due to ties on the scores) remove some of those extra features
int numOfExtraFeatures = featureScores.size()-maxFeatures;
if(numOfExtraFeatures>0) {
it = featureScores.entrySet().iterator();
while(it.hasNext() && numOfExtraFeatures>0) {
Map.Entry<Object, Double> entry = it.next();
if(entry.getValue()-minPermittedScore<=0.0) { //DO NOT COMPARE THEM DIRECTLY USE SUBTRACTION!
if(!mongoDBhackRequired) {
it.remove();
}
else {
featureScores.remove(entry.getKey()); //hack for mongo
}
--numOfExtraFeatures;
}
}
}
}
}
|
package com.web.common.config;
public class MenuDTO {
protected String MenuID;
protected String MenuName;
protected String UpMenuID;
protected int MenuStep=1;
protected int MenuSort=1;
protected String MenuType;
protected String UpdateDateTime;
protected String DeleteYN;
//Screen data
protected String ScreenID;
protected String AuthType;
//Auth set
protected String Auth;
public String getMenuID() {
return MenuID;
}
public void setMenuID(String menuID) {
MenuID = menuID;
}
public String getMenuName() {
return MenuName;
}
public void setMenuName(String menuName) {
MenuName = menuName;
}
public String getUpMenuID() {
return UpMenuID;
}
public void setUpMenuID(String upMenuID) {
UpMenuID = upMenuID;
}
public int getMenuStep() {
return MenuStep;
}
public void setMenuStep(int menuStep) {
MenuStep = menuStep;
}
public int getMenuSort() {
return MenuSort;
}
public void setMenuSort(int menuSort) {
MenuSort = menuSort;
}
public String getMenuType() {
return MenuType;
}
public void setMenuType(String menuType) {
MenuType = menuType;
}
public String getUpdateDateTime() {
return UpdateDateTime;
}
public void setUpdateDateTime(String updateDateTime) {
UpdateDateTime = updateDateTime;
}
public String getDeleteYN() {
return DeleteYN;
}
public void setDeleteYN(String deleteYN) {
DeleteYN = deleteYN;
}
public String getScreenID() {
return ScreenID;
}
public void setScreenID(String screenID) {
ScreenID = screenID;
}
public String getAuthType() {
return AuthType;
}
public void setAuthType(String authType) {
AuthType = authType;
}
public String getAuth() {
return Auth;
}
public void setAuth(String auth) {
Auth = auth;
}
}
|
package se.rtz.mltool.commnads;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Reader;
import net.htmlparser.jericho.Renderer;
import net.htmlparser.jericho.Source;
import se.rtz.csvtool.commonArgs.ReaderExtractor;
import se.rtz.tool.arg.Param;
import se.rtz.tool.arg.freetextoutput.FreeTextPrintStreamExtractor;
import se.rtz.tool.commands.Command;
import se.rtz.tool.commands.CommandDoc;
import se.rtz.tool.util.UnclosableReader;
@CommandDoc(author = "Daniel Schwartz, schw@rtz.se", description = "Produces text from HTML.", name = "htmlToText")
public class HtmlToText implements Command
{
private Reader in;
private PrintStream out;
@Override
public void execute()
{
try
{
htmlToText(in, out);
}
catch (IOException e)
{
System.err.println(String.format("could not produce text from incoming html. becuase %s says %s",
e.getClass().getSimpleName(), e.getMessage()));
}
}
public static void htmlToText(Reader in2, PrintStream out2) throws IOException
{
final Source source = new Source(in2);
final Renderer renderer = source.getRenderer();
renderer.setIncludeHyperlinkURLs(true);
renderer.setIncludeAlternateText(true);
renderer.setDecorateFontStyles(false);
renderer.setMaxLineLength(72);
renderer.setBlockIndentSize(3);
renderer.setHRLineLength(72);
renderer.setConvertNonBreakingSpaces(false);
renderer.setNewLine("\n");
renderer.writeTo(new PrintWriter(out2));
}
@Override
public void close() throws IOException
{
in.close();
out.close();
}
@Param(description = "Free text output.", exampleValues = "./anOutputFile.txt", token = "-out",
moreInfo = "If omitted or if ':out:' is passed as value, then std out will be used.",
extractor = FreeTextPrintStreamExtractor.class)
public void setPrintStream(PrintStream outputStream)
{
out = outputStream;
}
@Param(token = "-in", description = "Html input.", exampleValues = "./anInputFile.html",
extractor = ReaderExtractor.class)
public void setInReader(Reader inFile)
{
if (inFile == null)
in = new UnclosableReader(System.in);
else
in = inFile;
}
}
|
package edu.upenn.cis350.androidapp.DataInteraction.Management.ItemManagement;
import java.net.URL;
import java.util.*;
import org.json.simple.parser.*;
import org.json.simple.*;
import java.text.*;
import edu.upenn.cis350.androidapp.AccessWebTask;
import edu.upenn.cis350.androidapp.DataInteraction.Data.*;
public class LostJSONReader {
private LostJSONReader() {}
private static LostJSONReader instance = new LostJSONReader();
public static LostJSONReader getInstance() {
return instance;
}
public Collection<LostItem> getAllLostItems() {
Collection<LostItem> lostItems = new HashSet<LostItem>();
JSONParser parser = new JSONParser();
try {
URL url = new URL("http://10.0.2.2:3000/all-lost-items");
AccessWebTask task = new AccessWebTask();
task.execute(url);
JSONObject jo = (JSONObject) parser.parse(task.get());
JSONArray items = (JSONArray) jo.get("items");
Iterator iter = items.iterator();
while (iter.hasNext()) {
JSONObject item = (JSONObject) iter.next();
long id = (long) item.get("id");
long posterId = ((long) item.get("posterId"));
String category = (String) item.get("category");
String rawDate = (String) item.get("date");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
// Kevin look in discord chat to see what you have to do for SimpleDateFormat
Date date = null;
date = dateFormat.parse(rawDate);
double latitude = Double.valueOf(item.get("latitude").toString());
double longitude = Double.valueOf(item.get("longitude").toString());
String around = (String) item.get("around");
String attachmentLoc = (String) item.get("attachmentLoc");
String description = (String) item.get("description");
String additionalInfo = (String) item.get("additionalInfo");
LostItem l = new LostItem(id, posterId, category, date, latitude, longitude,
around, attachmentLoc, description, additionalInfo);
lostItems.add(l);
}
} catch (Exception e) {
System.out.println(e);
}
return lostItems;
}
}
|
/*
* 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 bbdd;
/**
*
* @author JD
*/
public class Sesion {
private String idSesion;
private String pelicula;
private String sala;
private Fecha fecha;
private String hora;
private String diaSemana, diaMes, mes, fechaS;
public String getFechaS() {
return this.diaSemana+": "+this.diaMes+"/"+this.mes+"/2017";
}
public void setFechaS(String fechaS) {
this.fechaS = fechaS;
}
public Sesion(String idSesion, String pelicula, String sala, Fecha fecha, String hora) {
this.idSesion = idSesion;
this.pelicula = pelicula;
this.sala = sala;
this.fecha = fecha;
this.hora = hora;
}
public String getDiaSemana() {
return diaSemana;
}
public void setDiaSemana(String diaSemana) {
this.diaSemana = diaSemana;
}
public String getDiaMes() {
return diaMes;
}
public void setDiaMes(String diaMes) {
this.diaMes = diaMes;
}
public String getMes() {
return mes;
}
public void setMes(String mes) {
this.mes = mes;
}
public Sesion(){}
public String getIdSesion() {
return idSesion;
}
public void setIdSesion(String idSesion) {
this.idSesion = idSesion;
}
public String getPelicula() {
return pelicula;
}
public void setPelicula(String pelicula) {
this.pelicula = pelicula;
}
public String getSala() {
return sala;
}
public void setSala(String sala) {
this.sala = sala;
}
public Fecha getFecha() {
return fecha;
}
public void setFecha(Fecha fecha) {
this.fecha = fecha;
}
public String getHora() {
return hora;
}
public void setHora(String hora) {
this.hora = hora;
}
@Override
public String toString() {
return "Sesion{" + "idSesion=" + idSesion + ", pelicula=" + pelicula + ", sala=" + sala + ", fecha=" + fecha + ", hora=" + hora + '}';
}
}
|
/**
* 不同路径 III https://leetcode-cn.com/problems/unique-paths-iii/
*/
public class 不同路径III {
public int uniquePathsIII(int[][] grid) {//DFS比DP好理解,这里用DFS做
int startX=0,startY=0,count=0;
for(int i=0;i<grid.length;i++){
for(int j=0;j<grid[0].length;j++){
if(grid[i][j]==1){
startX=i;
startY=j;
continue;
}
if(grid[i][j]==0) count++;
}
}
return dfs(startX,startY,count+1,grid);
}
private int dfs(int i, int j, int restSteps, int[][] grid) {
if(i<0||i>=grid.length||j<0||j>=grid[0].length||grid[i][j]==-1) return 0;
if(grid[i][j]==2) return restSteps==0?1:0;
int count=0;
grid[i][j]=-1;
count+=dfs(i-1,j,restSteps-1,grid);
count+=dfs(i+1,j,restSteps-1,grid);
count+=dfs(i,j-1,restSteps-1,grid);
count+=dfs(i,j+1,restSteps-1,grid);
grid[i][j]=0;
return count;
}
}
|
/**
* Kenny Akers
* Mr. Paige
* Homework #17
* 2/9/18
*/
public class Number extends Leaf {
private final int value;
public Number(int value) {
super(7); // Numbers have a precedence of 4.
this.value = value;
}
@Override
public int evaluate() {
return this.value;
}
@Override
public String format() {
return "" + this.value;
}
}
|
package 算法.分治算法;
import 算法._计时工具类.MyTimer;
/**
* Created by Yingjie.Lu on 2018/8/23.
*/
/**
* @Title: 使用分治算法来求 解逆序数对,时间复杂度为nlogn,即归并排序的时间复杂度
* @Date: 2018/8/24 11:20
*/
public class 求逆序对 extends MyTimer {
public static long sum=0;//记录总对数
//分
private static void sort(int[] arr,int left,int right,int[] temp){
if(left < right){
int mid = (left+right)/2;
sort(arr,left,mid,temp);//左边归并排序,使得左子序列有序
sort(arr,mid+1,right,temp);//右边归并排序,使得右子序列有序
merge(arr,left,mid,right,temp);//将两个有序子数组合并操作
}
}
//治---将被分成小份的数组排好序
private static void merge(int[] arr,int left,int mid,int right,int[] temp){//以mid为分割两个数组分成左右两个,left~mid为左边数组,mid+1~right为右边数组
int left_index=left;//记录左边数组的游标
int right_index=mid+1;//记录右边数组的游标
int temp_index=left;//标记临时数组的游标
//每次从左右两个已经排好序的数组中选出每个数组最左边的最小值放入临时数组中
while(left_index<=mid && right_index<=right){
if(arr[left_index]>arr[right_index]){//这里的大于号还是小于号控制了数组是降序排列还是升序排列
temp[temp_index++]=arr[left_index++];
/**
* 累加逆序数对 : 因为左右两边数组都是已经按降序排列好的,所以只要左边有一个数大于右边,那么就会有右边数组个数的逆序数对
*/
sum += right - right_index+1;
}else{
temp[temp_index++]=arr[right_index++];
}
}
//如果左边数组有剩余,则全部复制到临时数组中
while(left_index<=mid){
temp[temp_index++]=arr[left_index++];
}
//如果右边数组有剩余,则全部复制到临时数组中
while(right_index<=right){
temp[temp_index++]=arr[right_index++];
}
//复制对应的数据到原来的数组中
for(int i=left;i<=right;i++){
arr[i]=temp[i];
}
}
//获取一个随机数数组
public int[] getRandomArray(int n) {
int[] result = new int[n];
for(int i = 0;i < n;i++) {
if((int)(Math.random()*10)>5){
result[i] = (int)( Math.random() * 50); //生成0~50之间的随机数
}else{
result[i] = -(int)( Math.random() * 50); //生成0~50之间的随机数
}
}
return result;
}
@Override
public void myTimer() {
int[] arr = getRandomArray(1000000);
// int[] arr=new int[]{5,3,1,7,4,9,8,11};
int[] temp=new int[arr.length];
sort(arr,0,arr.length-1,temp);
System.out.println(sum);
// for( int a:arr ){
// System.out.print(a+",");
// }
}
public static void main(String[] args) {
new 求逆序对().start();
}
}
|
package Study.ex01;
import java.io.IOException;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
public class Servlet01 implements Servlet{
@Override
public void init(ServletConfig config) throws ServletException {
//서블릿을 실행할 때 사용할 자원을 이 메서드에서 준비한다.
}
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
// 클라이언트가 이 서블릿의 실행을 요청할 때마다 호출된다.
}
@Override
public void destroy() {
//웹 애플리케이션 종료할 때(서버종료포함) 이 서블릿이 만든 자원을 해제
}
@Override
public ServletConfig getServletConfig() {
//서블릿 관련 설정 정보를 꺼낼 때 이메서드사용
return null;
}
@Override
public String getServletInfo() {
return null;
}
}
|
package com.cdkj.model.system.pojo;
import com.cdkj.common.base.model.pojo.BaseModel;
import java.util.List;
/**
* PackageName:com.cdkj.model.system.pojo
* Descript:用户<br/>
* date: 2018-6-19 <br/>
* @author: yw
* version 1.0
*/
public class SysUser extends BaseModel {
private String relationId;
private String username;
private String nickName;
private String pic;
private String password;
private String salt;
private String lastLoginDt;
private Integer isLogin;
private String mobile;
private String mac;
private Integer sourceLogin;
private List<String> roleIds;
private SysDept sysDept;
public Integer getSourceLogin() {
return sourceLogin;
}
public void setSourceLogin(Integer sourceLogin) {
this.sourceLogin = sourceLogin;
}
public SysDept getSysDept() {
return sysDept;
}
public void setSysDept(SysDept sysDept) {
this.sysDept = sysDept;
}
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId == null ? null : relationId.trim();
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName == null ? null : nickName.trim();
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic == null ? null : pic.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt == null ? null : salt.trim();
}
public String getLastLoginDt() {
return lastLoginDt;
}
public void setLastLoginDt(String lastLoginDt) {
this.lastLoginDt = lastLoginDt == null ? null : lastLoginDt.trim();
}
public Integer getIsLogin() {
return isLogin;
}
public void setIsLogin(Integer isLogin) {
this.isLogin = isLogin;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile == null ? null : mobile.trim();
}
public String getMac() {
return mac;
}
public void setMac(String mac) {
this.mac = mac == null ? null : mac.trim();
}
public List<String> getRoleIds() {
return roleIds;
}
public void setRoleIds(List<String> roleIds) {
this.roleIds = roleIds;
}
} |
import java.util.*;
import java.io.*;
public class prob07 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
//Scanner in = new Scanner(System.in);
Scanner in = new Scanner(new File("prob07-2-in.txt"));
while (in.hasNextDouble()) {
double period = in.nextDouble();
if (period == 0) break;
double square = period * period;
double axis = Math.pow(square, (double) 1 / 3);
System.out.println(axis);
}
in.close();
}
} |
import java.util.*;
public class Ch18_07 {
public static void main(String []args) {
List<Integer> gallonsAtCity = new ArrayList<Integer>(Arrays.asList(10, 45, 25, 20, 15,
15, 15, 35, 25, 30, 15, 65, 45));
List<Integer> distances = new ArrayList<Integer>(Arrays.asList(200, 300, 300, 300, 400,
1000, 300, 300, 600, 400, 1100, 400, 1000));
List<Integer> gallonsNecessary = new ArrayList<Integer>();
for (int i = 0; i < distances.size(); i++) {
gallonsNecessary.add(distances.get(i) / 20);
}
List<Integer> xI = new ArrayList<Integer>();
for (int i = 0; i < gallonsAtCity.size(); i++) {
xI.add(gallonsAtCity.get(i) - gallonsNecessary.get(i));
}
List<Integer> sI = new ArrayList<Integer>();
sI.add(xI.get(0));
for (int i = 1; i < xI.size(); i++) {
sI.add(sI.get(i - 1) + xI.get(i));
}
System.out.println(gallonsAtCity);
System.out.println(distances);
System.out.println(gallonsNecessary);
System.out.println(xI);
System.out.println(sI);
}
}
|
package psoft.backend.exception.user;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.CONFLICT)
public class UserEmailInvalidoException extends RuntimeException {
public UserEmailInvalidoException(String s) {
super(s);
}
}
|
/*
* Copyright 2017 Rundeck, Inc. (http://rundeck.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rundeck.client.tool.commands;
import org.rundeck.client.tool.InputError;
import org.rundeck.client.api.model.ProjectNode;
import org.rundeck.client.tool.extension.BaseCommand;
import org.rundeck.client.tool.options.NodeFilterOptions;
import org.rundeck.client.tool.options.NodeOutputFormatOption;
import org.rundeck.client.tool.options.ProjectNameOptions;
import org.rundeck.client.util.Format;
import picocli.CommandLine;
import java.io.IOException;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author greg
* @since 11/22/16
*/
@CommandLine.Command(description = "List node resources.", name = "nodes")
public class Nodes extends BaseCommand {
@CommandLine.Command(description = "List all nodes for a project. You can use the -F/--filter to specify a node filter, or " +
"simply add the filter on the end of the command")
public void list(@CommandLine.Mixin
ProjectNameOptions options,
@CommandLine.Mixin
NodeOutputFormatOption nodeOutputFormatOption,
@CommandLine.Mixin
NodeFilterOptions nodeFilterOptions) throws IOException, InputError {
String project = getRdTool().projectOrEnv(options);
Map<String, ProjectNode> body = apiCall(api -> api.listNodes(project, nodeFilterOptions.filterString()));
if (!nodeOutputFormatOption.isOutputFormat()) {
getRdOutput().info(String.format("%d Nodes%s in project %s:%n", body.size(),
nodeFilterOptions.isFilter() ? " matching filter" : "",
project
));
}
Function<ProjectNode, ?> field;
if (nodeOutputFormatOption.isOutputFormat()) {
field = Format.formatter(nodeOutputFormatOption.getOutputFormat(), ProjectNode::getAttributes, "%", "");
} else if (nodeOutputFormatOption.isVerbose()) {
field = ProjectNode::getAttributes;
} else {
field = ProjectNode::getName;
}
getRdOutput().output(body.values().stream().map(field).collect(Collectors.toList()));
}
}
|
/*
* 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 jc.fog.logic;
import java.util.List;
import jc.fog.exceptions.FogException;
import jc.fog.logic.dto.CarportRequestDTO;
import jc.fog.logic.dto.MaterialDTO;
/**
* Facade interface som tilbyder offentlige metoder mod Logic laget.
* @author Claus
*/
public interface LogicFacade
{
List<BillItem> calculateBill(CarportRequestDTO carportRequest, List<MaterialDTO> materials) throws FogException;
List<Rectangle> drawCarport(CarportRequestDTO carportRequest, List<MaterialDTO> materials) throws FogException;
}
|
package com.example.selfhelpcity.util;
import com.example.selfhelpcity.bean.db.MsgBean;
import com.example.selfhelpcity.model.ObjectBox;
import com.starrtc.starrtcsdk.apiInterface.IXHChatManagerListener;
import com.starrtc.starrtcsdk.core.im.message.XHIMMessage;
import java.text.SimpleDateFormat;
public class XHChatManagerListener implements IXHChatManagerListener {
@Override
public void onReceivedMessage(XHIMMessage message) {
MsgBean messageBean = new MsgBean();
messageBean.setConversationId(message.fromId);
messageBean.setTime(new SimpleDateFormat("MM-dd HH:mm").format(new java.util.Date()));
messageBean.setMsg(message.contentData);
messageBean.setFromId(message.fromId);
// MLOC.saveMessage(messageBean);
ObjectBox.addMessageToDB(messageBean);
AEvent.notifyListener(AEvent.AEVENT_C2C_REV_MSG, true, message);
}
@Override
public void onReceivedSystemMessage(XHIMMessage message) {
MsgBean messageBean = new MsgBean();
messageBean.setConversationId(message.fromId);
messageBean.setTime(new SimpleDateFormat("MM-dd HH:mm").format(new java.util.Date()));
messageBean.setMsg(message.contentData);
messageBean.setFromId(message.fromId);
// MLOC.saveMessage(messageBean);
ObjectBox.addMessageToDB(messageBean);
AEvent.notifyListener(AEvent.AEVENT_REV_SYSTEM_MSG, true, message);
}
}
|
package nl.topicus.wqplot.components.plugins;
/**
* @author Ernesto Reinaldo Barreiro
*/
public class JQPlotCanvasAxisTickRenderer extends Renderer
{
private static final JQPlotCanvasAxisTickRenderer INSTANCE = new JQPlotCanvasAxisTickRenderer();
private JQPlotCanvasAxisTickRenderer()
{
super("$.jqplot.CanvasAxisTickRenderer", JQPlotCanvasAxisTickRendererResourceReference
.get());
}
public static JQPlotCanvasAxisTickRenderer get()
{
return INSTANCE;
}
}
|
package edu.neu.ccs.cs5010;
import java.io.IOException;
public interface IGraph {
//void createGraph(String nodeCsvFile,String edgeCsvFile) throws IOException;
int getVexNum();// return vertex numbers in this graph
int getEdgeNum();//return the edges number in this graph;
Users getVexElement(int v) throws Exception;//return the users in this vertex
int getLocate(UserVertex userVertex);// return the users position in this graph
int firsrAdjVex(UserVertex userVertex) throws Exception; //return the first adjacent of this node
int nextAdjVex(int V, int W) throws Exception;//return the next asjacent of V with w
}
|
package com.company;
public class Main {
public static void main(String[] args) {
// write your code here
int num [] = {1,2,10,11,15,25,2,3,5,7,12,100,17,50,65,85,81,55,3};
System.out.println("** Bubble Sort ascending order **");
bubbleSort(num);
for(int i =0; i<num.length;i++){
System.out.print(num[i] +" ");
}
System.out.println("\n\n** Bubble Sort descending order **");
bubbleSortDesc(num);
for(int i =0; i<num.length;i++){
System.out.print(num[i] +" ");
}
}
public static void bubbleSort(int [] num){
int count = num.length;
int temp =0;
for(int i =0; i < count ;i ++){
for(int j =1; j < count; j++){
if(num[j-1] > num [j]){
swap(j-1,j,num);
}
}
}
}
public static void bubbleSortDesc(int [] num){
int count = num.length;
int temp =0;
for(int i =0; i < count ;i ++){
for(int j =1; j < count; j++){
if(num[j-1] < num [j]){
swap(j-1,j,num);
}
}
}
}
public static void swap(int a, int b,int [] num){
int temp = num[a];
num[a] = num[b];
num[ b] = temp;
}
}
|
public class BubbleSort {
public static void main(String[] args) {
GenerateArray ger = new GenerateArray();
ArrayOutput out = new ArrayOutput();
int []arr = ger.generateRandomArray(6,1,100);
//bubbleSort(arr);
bubbleSortUp(arr);
out.arrayOutput(arr);
}
public static void bubbleSort(int []array){
int n = array.length;
if(n <= 1){
return;
}else{
for(int i = 0;i < n;i++){
for(int j = 0;j < n-i-1;j++){
if(array[j] > array[j+1]){
int temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}
}
}
}
public static void bubbleSortUp(int[] array){
int n = array.length;
if(n <= 1){
return;
}else{
for(int i = 0;i < n;i++){
boolean flag = false;
for(int j = 0;j < n-i-1;j++){
if(array[j] > array[j+1]){
flag = true;
int temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}
if(!flag){
break;
}
}
}
}
}
|
package com.forever.service;
/**
* @Description:
* @Author: zhang
* @Date: 2019/6/18
*/
public interface IRpcService {
public int add(int a, int b);
public int sub(int a, int b);
public int mult(int a, int b);
public int div(int a, int b);
}
|
package com.example.user.hangman;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.MediaPlayer;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void switcher(View view)
{ final MediaPlayer mp=MediaPlayer.create(this,R.raw.snd);
mp.start();
Intent intent=new Intent(MainActivity.this,Main4Activity.class);
startActivity(intent);
}
public void dog(View view)
{
final MediaPlayer mp=MediaPlayer.create(this,R.raw.snd);
mp.start();
//AlertDialog.Builder builder=new AlertDialog.Builder(this);
AlertDialog.Builder builder = new AlertDialog.Builder(this,android.R.style.Theme_DeviceDefault_Dialog_NoActionBar_MinWidth);
//AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom));
builder.setTitle("Warning!!");
builder.setMessage("Are you sure want to exit?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
builder.setNegativeButton("No",null);
builder.create();
builder.show();
}
}
|
package algorithms.kd.nn;
import algorithms.kd.Entry;
import algorithms.kd.Point;
import algorithms.kd.dist.Distance;
import lombok.Getter;
import java.util.*;
@Getter
public class WithinRadius<T> extends TargetDistance {
private final double radius;
private final PriorityQueue<NodeDistance<T>> minPq;
public WithinRadius(Point target, Distance distance, double radius) {
super(target, distance);
this.radius = radius;
Comparator<NodeDistance<T>> maxComparator = Comparator.comparingDouble(NodeDistance::getDist);
this.minPq = new PriorityQueue<>(maxComparator);
}
public void addNode(NodeDistance<T> result) {
minPq.add(result);
}
public List<Entry<T>> getEntryList() {
if (minPq.isEmpty()) {
return Collections.emptyList();
}
List<Entry<T>> result = new ArrayList<>(minPq.size());
for (NodeDistance<T> tnnResult : minPq) {
result.add(tnnResult.getEntry());
}
return result;
}
}
|
package com.sinotech.settle.config;
/**
*
*/
public class ErrorCodes {
/**登录信息有误*/
public static final String LOGIN_FAILED_ERROR = "5000";
/**权限不足*/
public static final String UNAUTHORIZED_ERROR = "5001";
/**参数为空*/
public static final String NULL_PARAM_ERROR = "5003";
/**没有登录*/
public static final String UNAUTHENTICATED_ERROR = "5002";
/**数据库异常*/
public static final String DATABASE_ERROR = "5004";
/**查询结果为空*/
public static final String NULL_QUERY_ERROR = "5005";
/**参数异常*/
public static final String TYPE_PARAM_ERROR = "5006";
/**添加数据失败*/
public static final String ADD_DATA_ERROR = "5009";
/**修改数据失败*/
public static final String UPDATE_DATA_ERROR = "5010";
/**删除数据失败*/
public static final String DELETE_DATA_ERROR = "5011";
/**订单转换运单失败*/
public static final String CAN_NOT_CONVERT = "5014";
/**添加运单失败*/
public static final String ADD_ORDER_ERROR = "5015";
/**运单分配承运商确认失败*/
public static final String ALLOT_ORDER_ERROR = "5016";
/**运单分配查询运单失败*/
public static final String QUERY_DISTRIBUTION_ORDER_ERROR = "5017";
/**运单分配确认查询运单失败*/
public static final String QUERY_ALLOT_ORDER_ERROR = "5018";
/**数字转换异常 */
public static final String NUMBER_FORMAT_ERROR = "5019";
/**sql语法错误 */
public static final String SQL_SYNTAX_ERROR = "5020";
/**值超过列最大值 */
public static final String SQL_DATA_ERROR = "5021";
/**未知异常 */
public static final String COMMON_EXCEPTION_ERROR = "5022";
/**数据库服务器网络异常 */
public static final String DATABASE_NETWORK_ERROR = "5023";
/**更新订单异常**/
public static final String UPDATE_ORDER_ERROR = "5024";
/**存储过程异常**/
public static final String PROC_ERROR = "5025";
/**自定义异常**/
public static final String CUSTOM_ERROR = "5026";
/**业务上不允许**/
public static final String BUSSINESS_FORBIDDEN = "5027";
/**流程引擎错误**/
public static final String WORKFLOW_ERROR = "5028";
/**文件格式错误*/
public static final String FILE_FORMAT_ERROR = "5029";
/**非法参数*/
public static final String ILLEGAL_PARAMETERS_ERROR = "5030";
/**文件服务器异常*/
public static final String FASTDFS_ERROR = "5031";
/**系统IO异常*/
public static final String SYSTEM_IO_ERROR = "5032";
/**json数据格式化异常*/
public static final String JSON_FORMAT_ERROR = "5033";
}
|
package io.nekohasekai.wsm;
public abstract class WebSocketListener {
protected void onOpen(WebSocket socket) {
}
protected void onPing(WebSocket socket, byte[] payload) {
}
protected void onPong(WebSocket socket, byte[] payload) {
}
protected void onMessage(WebSocket socket, String message) {
}
protected void onMessage(WebSocket socket, byte[] message) {
}
protected void onClose(WebSocket socket, int code, String reason) {
}
protected void onFailure(WebSocket socket, Throwable t) {
}
}
|
package co.sblock.events.region;
import java.util.Map.Entry;
import co.sblock.machines.utilities.Direction;
import co.sblock.machines.utilities.Shape;
import co.sblock.machines.utilities.Shape.MaterialDataValue;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.TravelAgent;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Block;
import org.bukkit.material.MaterialData;
import org.bukkit.util.Vector;
public class SblockTravelAgent implements TravelAgent {
private int searchRadius = 0, creationRadius = 0;
private final int mediumNetherOffset = 329;
private boolean canCreatePortal = true;
private final Shape shape;
private Block from;
public SblockTravelAgent() {
shape = new Shape();
MaterialDataValue value = shape.new MaterialDataValue(Material.OBSIDIAN);
// Platform
shape.setVectorData(new Vector(-2, -1, 1), value);
shape.setVectorData(new Vector(-1, -1, 1), value);
shape.setVectorData(new Vector(0, -1, 1), value);
shape.setVectorData(new Vector(1, -1, 1), value);
shape.setVectorData(new Vector(-2, -1, -1), value);
shape.setVectorData(new Vector(-1, -1, -1), value);
shape.setVectorData(new Vector(0, -1, -1), value);
shape.setVectorData(new Vector(1, -1, -1), value);
// Frame
shape.setVectorData(new Vector(-2, -1, 0), value);
shape.setVectorData(new Vector(-1, -1, 0), value);
shape.setVectorData(new Vector(0, -1, 0), value);
shape.setVectorData(new Vector(1, -1, 0), value);
shape.setVectorData(new Vector(-2, 0, 0), value);
shape.setVectorData(new Vector(1, 0, 0), value);
shape.setVectorData(new Vector(-2, 1, 0), value);
shape.setVectorData(new Vector(1, 1, 0), value);
shape.setVectorData(new Vector(-2, 2, 0), value);
shape.setVectorData(new Vector(1, 2, 0), value);
shape.setVectorData(new Vector(-2, 3, 0), value);
shape.setVectorData(new Vector(-1, 3, 0), value);
shape.setVectorData(new Vector(0, 3, 0), value);
shape.setVectorData(new Vector(1, 3, 0), value);
value = shape.new MaterialDataValue(Material.AIR);
// Surrounding air
shape.setVectorData(new Vector(-2, 0, 1), value);
shape.setVectorData(new Vector(-1, 0, 1), value);
shape.setVectorData(new Vector(0, 0, 1), value);
shape.setVectorData(new Vector(1, 0, 1), value);
shape.setVectorData(new Vector(-2, 0, -1), value);
shape.setVectorData(new Vector(-1, 0, -1), value);
shape.setVectorData(new Vector(0, 0, -1), value);
shape.setVectorData(new Vector(1, 0, -1), value);
shape.setVectorData(new Vector(-2, 1, 1), value);
shape.setVectorData(new Vector(-1, 1, 1), value);
shape.setVectorData(new Vector(0, 1, 1), value);
shape.setVectorData(new Vector(1, 1, 1), value);
shape.setVectorData(new Vector(-2, 1, -1), value);
shape.setVectorData(new Vector(-1, 1, -1), value);
shape.setVectorData(new Vector(0, 1, -1), value);
shape.setVectorData(new Vector(1, 1, -1), value);
shape.setVectorData(new Vector(-2, 2, 1), value);
shape.setVectorData(new Vector(-1, 2, 1), value);
shape.setVectorData(new Vector(0, 2, 1), value);
shape.setVectorData(new Vector(1, 2, 1), value);
shape.setVectorData(new Vector(-2, 2, -1), value);
shape.setVectorData(new Vector(-1, 2, -1), value);
shape.setVectorData(new Vector(0, 2, -1), value);
shape.setVectorData(new Vector(1, 2, -1), value);
shape.setVectorData(new Vector(-2, 3, 1), value);
shape.setVectorData(new Vector(-1, 3, 1), value);
shape.setVectorData(new Vector(0, 3, 1), value);
shape.setVectorData(new Vector(1, 3, 1), value);
shape.setVectorData(new Vector(-2, 3, -1), value);
shape.setVectorData(new Vector(-1, 3, -1), value);
shape.setVectorData(new Vector(0, 3, -1), value);
shape.setVectorData(new Vector(1, 3, -1), value);
value = shape.new MaterialDataValue(Material.PORTAL, Direction.NORTH, "portal");
// Portal
shape.setVectorData(new Vector(-1, 0, 0), value);
shape.setVectorData(new Vector(0, 0, 0), value);
shape.setVectorData(new Vector(-1, 1, 0), value);
shape.setVectorData(new Vector(0, 1, 0), value);
shape.setVectorData(new Vector(-1, 2, 0), value);
shape.setVectorData(new Vector(0, 2, 0), value);
}
@Override
public TravelAgent setSearchRadius(int radius) {
this.searchRadius = radius;
return this;
}
@Override
public int getSearchRadius() {
return this.searchRadius;
}
@Override
public TravelAgent setCreationRadius(int radius) {
creationRadius = radius;
return this;
}
@Override
public int getCreationRadius() {
return creationRadius;
}
@Override
public boolean getCanCreatePortal() {
return canCreatePortal;
}
public void setFrom(Block block) {
from = block;
}
@Override
public Location findOrCreate(Location location) {
Location destination = findPortal(location);
if (destination == null || destination.equals(destination.getWorld().getSpawnLocation())) {
destination = location.clone();
createPortal(destination);
}
return destination;
}
@Override
public Location findPortal(Location location) {
Block block = location.getBlock();
for (int dX = -searchRadius; dX <= searchRadius; dX++) {
// When travelling to the overworld, allow 2 blocks of y-forgiveness in case of rounding errors
int searchY = location.getWorld().getEnvironment() == Environment.NORMAL ? 3 : 1;
for (int dY = 0; dY < searchY; ++dY) {
for (int dZ = -searchRadius; dZ <= searchRadius; dZ++) {
Block portal = block.getRelative(dX, dY, dZ);
if (portal.getType() == Material.PORTAL) {
Location center = findCenter(portal);
center.setYaw(location.getYaw());
center.setPitch(location.getPitch());
return center;
}
}
}
}
return null;
}
@SuppressWarnings("deprecation")
@Override
public boolean createPortal(Location location) {
if (from == null) {
return false;
}
Direction direction = from.getData() % 2 == 0 ? Direction.EAST : Direction.NORTH;
for (Entry<Location, MaterialData> entry : shape.getBuildLocations(location, direction).entrySet()) {
Block block = entry.getKey().getBlock();
block.setTypeIdAndData(entry.getValue().getItemTypeId(), entry.getValue().getData(), false);
}
return true;
}
public Location findCenter(Block portal) {
if (portal == null) {
return null;
}
double minX = 0;
while (portal.getRelative((int) minX - 1, 0, 0).getType() == Material.PORTAL) {
minX -= 1;
}
double maxX = 0;
while (portal.getRelative((int) maxX + 1, 0, 0).getType() == Material.PORTAL) {
maxX += 1;
}
double minY = 0;
while (portal.getRelative(0, (int) minY - 1, 0).getType() == Material.PORTAL) {
minY -= 1;
}
double minZ = 0;
while (portal.getRelative(0, 0, (int) minZ - 1).getType() == Material.PORTAL) {
minZ -= 1;
}
double maxZ = 0;
while (portal.getRelative(0, 0, (int) maxZ + 1).getType() == Material.PORTAL) {
maxZ += 1;
}
double x = portal.getX() + (maxX + 1 + minX) / 2.0;
double y = portal.getY() + minY + 0.1;
double z = portal.getZ() + (maxZ + 1 + minZ) / 2.0;
return new Location(portal.getWorld(), x, y, z);
}
@Override
public void setCanCreatePortal(boolean create) {
canCreatePortal = create;
}
public TravelAgent reset() {
searchRadius = 1;
creationRadius = 0;
canCreatePortal = true;
from = null;
return this;
}
public Block getAdjacentPortalBlock(Block block) {
// Player isn't standing inside the portal block, they're next to it.
if (block.getType() == Material.PORTAL) {
return block;
}
for (int dX = -1; dX < 2; dX++) {
for (int dZ = -1; dZ < 2; dZ++) {
if (dX == 0 && dZ == 0) {
continue;
}
Block maybePortal = block.getRelative(dX, 0, dZ);
if (maybePortal.getType() == Material.PORTAL) {
return maybePortal;
}
}
}
return null;
}
public Location getTo(Location from) {
World world = null;
double x, y, z;
switch (from.getWorld().getName()) {
case "Earth":
world = Bukkit.getWorld("Earth_nether");
x = from.getX() / 8;
y = from.getY();
z = from.getZ() / 8;
break;
case "Earth_nether":
world = Bukkit.getWorld("Earth");
x = from.getX() * 8;
y = from.getY();
z = from.getZ() * 8;
break;
case "LOFAF":
world = Bukkit.getWorld("Medium_nether");
x = from.getX() / 8 + mediumNetherOffset;
y = from.getY() / 2.05;
z = from.getZ() / 8 + mediumNetherOffset;
break;
case "LOHAC":
world = Bukkit.getWorld("Medium_nether");
x = from.getX() / 8 + mediumNetherOffset;
y = from.getY() / 2.05;
z = from.getZ() / 8 - mediumNetherOffset;
break;
case "LOLAR":
world = Bukkit.getWorld("Medium_nether");
x = from.getX() / 8 - mediumNetherOffset;
y = from.getY() / 2.05;
z = from.getZ() / 8 - mediumNetherOffset;
break;
case "LOWAS":
world = Bukkit.getWorld("Medium_nether");
x = from.getX() / 8 - mediumNetherOffset;
y = from.getY() / 2.05;
z = from.getZ() / 8 + mediumNetherOffset;
break;
case "Medium_nether":
String worldName;
if (from.getX() < 0) {
x = from.getX() + mediumNetherOffset;
if (from.getZ() < 0) {
// -x -z: LOLAR (Northwest)
z = from.getZ() + mediumNetherOffset;
worldName = "LOLAR";
} else {
// -x +z: LOWAS (Southwest)
z = from.getZ() - mediumNetherOffset;
worldName = "LOWAS";
}
} else {
x = from.getX() - mediumNetherOffset;
if (from.getZ() < 0) {
// +x -z: LOHAC (Northeast)
z = from.getZ() + mediumNetherOffset;
worldName = "LOHAC";
} else {
// +x +z: LOFAF (Southeast)
z = from.getZ() - mediumNetherOffset;
worldName = "LOFAF";
}
}
world = Bukkit.getWorld(worldName);
x *= 8;
y = from.getY() * 2.05;
z *= 8;
break;
default:
if (from.getWorld().getEnvironment() == Environment.NORMAL) {
world = Bukkit.getWorld(from.getWorld().getName() + "_nether");
x = from.getX() / 8;
y = from.getY() / 2.05;
z = from.getZ() / 8;
} else if (from.getWorld().getEnvironment() == Environment.NETHER) {
world = Bukkit.getWorld(from.getWorld().getName().replaceAll("_.*", ""));
if (world == null || world.equals(from.getWorld())) {
return null;
}
x = from.getX() * 8;
y = from.getY() * 2.05;
z = from.getZ() * 8;
} else {
x = y = z = 0;
}
}
if (world == null) {
return null;
}
if (y < 2) {
y = 2;
}
return new Location(world, x, y, z, from.getYaw(), from.getPitch());
}
}
|
package com.bofsoft.laio.customerservice.DataClass.Order;
import java.util.ArrayList;
/**
* Created by jason.xu on 2017/3/28.
*/
public class OrderDetailRsp {
private Integer Id;
private String Num;
private String CustomerCode;
private String Name;
private Float DealSum;
private String View;
private String ViewOrder;
private String ViewPro;
private String CoachTel;
private Integer SendMsg;
private String OrderTime;
private String CoachUserUUID;
private String CoachName;
private String ProPicUrl;
private String BuyerUUID;
private String BuyerName;
private String BuyerTel;
private Integer OrderType;
private Integer TrainType;
private Integer Status;
private Integer StatusTrain;
private Integer CanCancel;
private Integer PayDeposit;
private Integer TrainRemainMin;
private Integer StatusAppraise;
private Integer StatusAccepted;
private Double CancelFine;
private String CancelTime;
private String CancelReason;
private String StartTime;
private String EndTime;
private Integer RefundStatus;
private Double RefundSum;
private String DeadTime;
private String ConfirmTime;
private String StartAddr;
private String DistrictMC;
private String TrainSite;
private String SiteAddr;
private Integer Amount;
private Integer TestSubId;
private Double DepositFee;
private Integer DepositStatus;
private Double FinalFee;
private Integer FinalStatus;
private String RefundRequestTime;
private String FirstStuName;
private String FirstStuMobile;
private String FirstStuUUID;
private String FirstStuAppointMsg;
private ArrayList<Timelist> TimeList = new ArrayList<>();
private ArrayList<Addrlist> AddrList = new ArrayList<>();
private ArrayList<Vaslist> VasList = new ArrayList<>();
private String ModOrder;
public Integer getId() {
return Id;
}
public void setId(Integer id) {
Id = id;
}
public String getNum() {
return Num;
}
public void setNum(String num) {
Num = num;
}
public String getCustomerCode() {
return CustomerCode;
}
public void setCustomerCode(String customerCode) {
CustomerCode = customerCode;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public Float getDealSum() {
return DealSum;
}
public void setDealSum(Float dealSum) {
DealSum = dealSum;
}
public String getView() {
return View;
}
public void setView(String view) {
View = view;
}
public String getViewOrder() {
return ViewOrder;
}
public void setViewOrder(String viewOrder) {
ViewOrder = viewOrder;
}
public String getViewPro() {
return ViewPro;
}
public void setViewPro(String viewPro) {
ViewPro = viewPro;
}
public String getCoachTel() {
return CoachTel;
}
public void setCoachTel(String coachTel) {
CoachTel = coachTel;
}
public Integer getSendMsg() {
return SendMsg;
}
public void setSendMsg(Integer sendMsg) {
SendMsg = sendMsg;
}
public String getOrderTime() {
return OrderTime;
}
public void setOrderTime(String orderTime) {
OrderTime = orderTime;
}
public String getCoachUserUUID() {
return CoachUserUUID;
}
public void setCoachUserUUID(String coachUserUUID) {
CoachUserUUID = coachUserUUID;
}
public String getCoachName() {
return CoachName;
}
public void setCoachName(String coachName) {
CoachName = coachName;
}
public String getProPicUrl() {
return ProPicUrl;
}
public void setProPicUrl(String proPicUrl) {
ProPicUrl = proPicUrl;
}
public String getBuyerUUID() {
return BuyerUUID;
}
public void setBuyerUUID(String buyerUUID) {
BuyerUUID = buyerUUID;
}
public String getBuyerName() {
return BuyerName;
}
public void setBuyerName(String buyerName) {
BuyerName = buyerName;
}
public String getBuyerTel() {
return BuyerTel;
}
public void setBuyerTel(String buyerTel) {
BuyerTel = buyerTel;
}
public Integer getOrderType() {
return OrderType;
}
public void setOrderType(Integer orderType) {
OrderType = orderType;
}
public Integer getTrainType() {
return TrainType;
}
public void setTrainType(Integer trainType) {
TrainType = trainType;
}
public Integer getStatus() {
return Status;
}
public void setStatus(Integer status) {
Status = status;
}
public Integer getStatusTrain() {
return StatusTrain;
}
public void setStatusTrain(Integer statusTrain) {
StatusTrain = statusTrain;
}
public Integer getCanCancel() {
return CanCancel;
}
public void setCanCancel(Integer canCancel) {
CanCancel = canCancel;
}
public Integer getPayDeposit() {
return PayDeposit;
}
public void setPayDeposit(Integer payDeposit) {
PayDeposit = payDeposit;
}
public Integer getTrainRemainMin() {
return TrainRemainMin;
}
public void setTrainRemainMin(Integer trainRemainMin) {
TrainRemainMin = trainRemainMin;
}
public Integer getStatusAppraise() {
return StatusAppraise;
}
public void setStatusAppraise(Integer statusAppraise) {
StatusAppraise = statusAppraise;
}
public Integer getStatusAccepted() {
return StatusAccepted;
}
public void setStatusAccepted(Integer statusAccepted) {
StatusAccepted = statusAccepted;
}
public Double getCancelFine() {
return CancelFine;
}
public void setCancelFine(Double cancelFine) {
CancelFine = cancelFine;
}
public String getCancelTime() {
return CancelTime;
}
public void setCancelTime(String cancelTime) {
CancelTime = cancelTime;
}
public String getCancelReason() {
return CancelReason;
}
public void setCancelReason(String cancelReason) {
CancelReason = cancelReason;
}
public String getStartTime() {
return StartTime;
}
public void setStartTime(String startTime) {
StartTime = startTime;
}
public String getEndTime() {
return EndTime;
}
public void setEndTime(String endTime) {
EndTime = endTime;
}
public Integer getRefundStatus() {
return RefundStatus;
}
public void setRefundStatus(Integer refundStatus) {
RefundStatus = refundStatus;
}
public Double getRefundSum() {
return RefundSum;
}
public void setRefundSum(Double refundSum) {
RefundSum = refundSum;
}
public String getDeadTime() {
return DeadTime;
}
public void setDeadTime(String deadTime) {
DeadTime = deadTime;
}
public String getConfirmTime() {
return ConfirmTime;
}
public void setConfirmTime(String confirmTime) {
ConfirmTime = confirmTime;
}
public String getStartAddr() {
return StartAddr;
}
public void setStartAddr(String startAddr) {
StartAddr = startAddr;
}
public String getDistrictMC() {
return DistrictMC;
}
public void setDistrictMC(String districtMC) {
DistrictMC = districtMC;
}
public String getTrainSite() {
return TrainSite;
}
public void setTrainSite(String trainSite) {
TrainSite = trainSite;
}
public String getSiteAddr() {
return SiteAddr;
}
public void setSiteAddr(String siteAddr) {
SiteAddr = siteAddr;
}
public Integer getAmount() {
return Amount;
}
public void setAmount(Integer amount) {
Amount = amount;
}
public Integer getTestSubId() {
return TestSubId;
}
public void setTestSubId(Integer testSubId) {
TestSubId = testSubId;
}
public Double getDepositFee() {
return DepositFee;
}
public void setDepositFee(Double depositFee) {
DepositFee = depositFee;
}
public Integer getDepositStatus() {
return DepositStatus;
}
public void setDepositStatus(Integer depositStatus) {
DepositStatus = depositStatus;
}
public Double getFinalFee() {
return FinalFee;
}
public void setFinalFee(Double finalFee) {
FinalFee = finalFee;
}
public Integer getFinalStatus() {
return FinalStatus;
}
public void setFinalStatus(Integer finalStatus) {
FinalStatus = finalStatus;
}
public String getRefundRequestTime() {
return RefundRequestTime;
}
public void setRefundRequestTime(String refundRequestTime) {
RefundRequestTime = refundRequestTime;
}
public String getFirstStuName() {
return FirstStuName;
}
public void setFirstStuName(String firstStuName) {
FirstStuName = firstStuName;
}
public String getFirstStuMobile() {
return FirstStuMobile;
}
public void setFirstStuMobile(String firstStuMobile) {
FirstStuMobile = firstStuMobile;
}
public String getFirstStuUUID() {
return FirstStuUUID;
}
public void setFirstStuUUID(String firstStuUUID) {
FirstStuUUID = firstStuUUID;
}
public String getFirstStuAppointMsg() {
return FirstStuAppointMsg;
}
public void setFirstStuAppointMsg(String firstStuAppointMsg) {
FirstStuAppointMsg = firstStuAppointMsg;
}
public ArrayList<Timelist> getTimeList() {
return TimeList;
}
public void setTimeList(ArrayList<Timelist> timeList) {
TimeList = timeList;
}
public ArrayList<Addrlist> getAddrList() {
return AddrList;
}
public void setAddrList(ArrayList<Addrlist> addrList) {
AddrList = addrList;
}
public ArrayList<Vaslist> getVasList() {
return VasList;
}
public void setVasList(ArrayList<Vaslist> vasList) {
VasList = vasList;
}
public String getModOrder() {
return ModOrder;
}
public void setModOrder(String modOrder) {
ModOrder = modOrder;
}
public static class Timelist {
private String Name;
private String ClassType;
private String Times;
private Integer Count;
private double Price;
private double Total;
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getClassType() {
return ClassType;
}
public void setClassType(String classType) {
ClassType = classType;
}
public String getTimes() {
return Times;
}
public void setTimes(String times) {
Times = times;
}
public Integer getCount() {
return Count;
}
public void setCount(Integer count) {
Count = count;
}
public double getPrice() {
return Price;
}
public void setPrice(double price) {
Price = price;
}
public double getTotal() {
return Total;
}
public void setTotal(double total) {
Total = total;
}
}
public static class Vaslist {
private String Id;
private Integer VasType;
private String Name;
private Integer VasAmount;
private double VasPrice;
public String getId() {
return Id;
}
public void setId(String id) {
Id = id;
}
public Integer getVasType() {
return VasType;
}
public void setVasType(Integer vasType) {
VasType = vasType;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public Integer getVasAmount() {
return VasAmount;
}
public void setVasAmount(Integer vasAmount) {
VasAmount = vasAmount;
}
public double getVasPrice() {
return VasPrice;
}
public void setVasPrice(double vasPrice) {
VasPrice = vasPrice;
}
}
public static class Addrlist {
public String getAddr() {
return Addr;
}
public void setAddr(String addr) {
Addr = addr;
}
private String Addr;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.