text stringlengths 10 2.72M |
|---|
package design.mode.proxy.staticProxy;
/**
* 静态代理----代理对象一定要持有被代理对象的引用,代理工作完成后,需要被代理对象最终做出决定
* 缺点:被代理对象知道要代理的业务方法,但是一旦业务方法有变动,就需要修改代理对象以应对业务方法改动,不灵活
*/
public class StaticProxyTest {
public static void main(String[] args) {
YoungBoy boy = new YoungBoy();
MeipoProxy meipo = new MeipoProxy(boy);
meipo.findLove();
LietouProxy lieTou = new LietouProxy(boy);
lieTou.findJob();
}
}
|
package a.cotroller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import a.service.MessageService;
@Controller("logonSocketController")
public class LogonSocketController extends TextWebSocketHandler{
@Autowired
MessageService message;
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
Map<String,Object> map = session.getAttributes();
String id = (String) map.get("logon");
message.inertId(id,session);
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
Map<String,Object> map = session.getAttributes();
String id = (String) map.get("logon");
message.remove(id,session);
}
}
|
package me.cursedblackcat.dajibot2.rewards;
import java.util.Date;
import org.javacord.api.entity.user.User;
public class Reward {
private User user;
private ItemType itemType;
private int amount;
private Date expiryDate;
private int cardID;
private String text;
public Reward(User u, ItemType t, int a, Date e, int c, String txt) {
user = u;
itemType = t;
amount = a;
expiryDate = e;
cardID = c;
text = txt;
}
public User getUser() {
return user;
}
public ItemType getItemType() {
return itemType;
}
public int getAmount() {
return amount;
}
public Date getExpiryDate() {
return expiryDate;
}
public int getCardID() {
return cardID;
}
public String getText() {
return text;
}
}
|
package com.epam.bd;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class ImpressionEntry implements Writable {
long cityId;
int biddingPrice;
int count;
String userAgent;
public ImpressionEntry() {}
public ImpressionEntry(long cityId, int biddingPrice, int count, String userAgent){
this.cityId = cityId;
this.biddingPrice = biddingPrice;
this.count = count;
}
public long getCityId() {
return cityId;
}
public int getBiddingPrice() {
return biddingPrice;
}
public int getCount() {
return count;
}
public String getUserAgent()
{
return userAgent;
}
public void set(long cityId, int biddingPrice, int count, String userAgent) {
this.cityId = cityId;
this.biddingPrice = biddingPrice;
this.count = count;
this.userAgent = userAgent;
}
public void write(DataOutput dataOutput) throws IOException {
WritableUtils.writeVLong(dataOutput, cityId);
WritableUtils.writeVInt(dataOutput, biddingPrice);
WritableUtils.writeVInt(dataOutput, count);
WritableUtils.writeString(dataOutput, userAgent);
}
public void readFields(DataInput dataInput) throws IOException {
cityId = WritableUtils.readVLong(dataInput);
biddingPrice = WritableUtils.readVInt(dataInput);
count = WritableUtils.readVInt(dataInput);
userAgent = WritableUtils.readString(dataInput);
}
public void aggregate(ImpressionEntry val) {
if (val.getCityId() == this.cityId) {
this.count += val.getCount();
}
}
@Override
public boolean equals(Object o) {
if (o instanceof ImpressionEntry) {
ImpressionEntry ie = (ImpressionEntry)o;
return (this.cityId == ie.cityId)
&& (this.biddingPrice == ie.biddingPrice)
&& (this.count == ie.count);
} else return false;
}
}
|
package com.tencent.mm.plugin.mmsight.segment;
import android.graphics.Point;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import com.tencent.mm.modelcontrol.VideoTransPara;
import com.tencent.mm.sdk.f.e;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
public final class h implements e$a {
private static int llI = -1;
long aBL = -1;
int bYE;
private int lht;
private int lhu;
String lkm;
long lkn = -1;
int lkp = -1;
Thread lkw;
private int llA;
private int llB;
a llC;
private int llD = 0;
MediaExtractor llE;
int llF;
e llG;
private boolean llH = false;
private MediaFormat llJ;
VideoTransPara lln;
private int llw;
private int llx;
private int lly;
private int llz;
private Object lock = new byte[0];
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
public static int beW() {
/*
r6 = 21;
r5 = 3;
r4 = 2;
r3 = -1;
r2 = 1;
r0 = com.tencent.mm.plugin.mmsight.model.CaptureMMProxy.getInstance();
r1 = com.tencent.mm.storage.aa.a.sUI;
r0 = r0.getInt(r1, r3);
if (r0 == r3) goto L_0x002a;
L_0x0012:
if (r0 != r2) goto L_0x0022;
L_0x0014:
r0 = com.tencent.mm.compatible.util.d.fR(r6);
if (r0 == 0) goto L_0x001f;
L_0x001a:
llI = r4;
L_0x001c:
r0 = llI;
L_0x001e:
return r0;
L_0x001f:
llI = r2;
goto L_0x001c;
L_0x0022:
if (r0 != r4) goto L_0x0027;
L_0x0024:
llI = r2;
goto L_0x001c;
L_0x0027:
llI = r5;
goto L_0x001c;
L_0x002a:
r0 = llI;
if (r0 == r3) goto L_0x0031;
L_0x002e:
r0 = llI;
goto L_0x001e;
L_0x0031:
r0 = com.tencent.mm.compatible.e.q.deT;
r0 = r0.dff;
if (r0 == r3) goto L_0x0051;
L_0x0037:
if (r0 != r2) goto L_0x003e;
L_0x0039:
llI = r2;
L_0x003b:
r0 = llI;
goto L_0x001e;
L_0x003e:
if (r0 != r4) goto L_0x004c;
L_0x0040:
r0 = com.tencent.mm.compatible.util.d.fR(r6);
if (r0 == 0) goto L_0x0049;
L_0x0046:
llI = r4;
goto L_0x003b;
L_0x0049:
llI = r2;
goto L_0x003b;
L_0x004c:
if (r0 != r5) goto L_0x003b;
L_0x004e:
llI = r5;
goto L_0x003b;
L_0x0051:
r0 = com.tencent.mm.plugin.mmsight.model.CaptureMMProxy.getInstance();
r1 = "SightSegCutMinApiLevel";
r0 = r0.getDynamicConfig(r1);
r0 = com.tencent.mm.sdk.platformtools.bi.getInt(r0, r6);
r0 = com.tencent.mm.compatible.util.d.fR(r0);
if (r0 == 0) goto L_0x004e;
L_0x0066:
llI = r2;
goto L_0x003b;
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.mmsight.segment.h.beW():int");
}
public final int e(MediaFormat mediaFormat) {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "initDecoder, format: %s, filePath: %s", new Object[]{mediaFormat, this.lkm});
this.llJ = mediaFormat;
int beW = beW();
if (beW == 1) {
this.llG = new i(this.llE, mediaFormat, this.llF);
this.llH = false;
} else if (beW == 2) {
this.llG = new j(this.llE, mediaFormat, this.llF);
this.llH = false;
} else {
this.llG = new b();
this.llH = true;
}
if (this.llG == null) {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "use default config");
this.llG = new i(this.llE, mediaFormat, this.llF);
this.llH = false;
}
beW = this.llG.t(this.lkm, this.aBL, this.lkn);
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "init decoder ret: %s", new Object[]{Integer.valueOf(beW)});
if (beW < 0 && (llI == 1 || llI == 2)) {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "init mediaCodecDecoder failed, try ffmepg");
try {
this.llG.stop();
this.llG = null;
} catch (Exception e) {
}
this.llG = new b();
this.llH = true;
llI = 3;
beW = this.llG.t(this.lkm, this.aBL, this.lkn);
}
this.llG.a(this);
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "init finish, ret: %d, decoderType: %d", new Object[]{Integer.valueOf(beW), Integer.valueOf(llI)});
return beW;
}
public final void cR(int i, int i2) {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "registerDesiredSize: %s, %s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2)});
this.llw = i;
this.llx = i2;
}
private static Point q(int i, int i2, int i3, int i4) {
x.d("MicroMsg.MediaCodecFFMpegTranscoder", "scale() called with: decoderOutputWidth = [" + i + "], decoderOutputHeight = [" + i2 + "], specWidth = [" + i3 + "], specHeight = [" + i4 + "]");
if (i > i3 || i2 > i4) {
int max = Math.max(i, i2);
int min = Math.min(i, i2);
int max2 = Math.max(i3, i4);
int min2 = Math.min(i3, i4);
int i5;
if (max % 16 == 0 && Math.abs(max - max2) < 16 && min % 16 == 0 && Math.abs(min - min2) < 16) {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "calc scale, same len divide by 16, no need scale");
return null;
} else if (max / 2 == max2 && min / 2 == min2) {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "calc scale, double ratio");
i5 = i / 2;
max = i2 / 2;
if (i5 % 2 != 0) {
i5++;
}
if (max % 2 != 0) {
max++;
}
return new Point(i5, max);
} else {
i5 = max / 2;
max = min / 2;
if (i5 % 16 != 0 || Math.abs(i5 - max2) >= 16 || max % 16 != 0 || Math.abs(max - min2) >= 16) {
Point point = new Point();
if (i < i2) {
max = Math.min(i3, i4);
i5 = (int) (((double) i2) / ((((double) i) * 1.0d) / ((double) max)));
} else {
i5 = Math.min(i3, i4);
max = (int) (((double) i) / ((((double) i2) * 1.0d) / ((double) i5)));
}
if (i5 % 2 != 0) {
i5++;
}
if (max % 2 != 0) {
max++;
}
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "calc scale, outputsize: %s %s", new Object[]{Integer.valueOf(max), Integer.valueOf(i5)});
point.x = max;
point.y = i5;
return point;
}
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "calc scale, double ratio divide by 16");
i5 = i / 2;
max = i2 / 2;
if (i5 % 2 != 0) {
i5++;
}
if (max % 2 != 0) {
max++;
}
return new Point(i5, max);
}
}
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "calc scale, small or equal to spec size");
return null;
}
public final void release() {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "release, decoderType: %d", new Object[]{Integer.valueOf(llI)});
try {
if (this.llG != null) {
this.llG.stop();
}
MP4MuxerJNI.releaseDataBuf(0);
llI = -1;
} catch (Exception e) {
x.e("MicroMsg.MediaCodecFFMpegTranscoder", "release error: %s", new Object[]{e.getMessage()});
MP4MuxerJNI.releaseDataBuf(0);
llI = -1;
} catch (Throwable th) {
MP4MuxerJNI.releaseDataBuf(0);
llI = -1;
throw th;
}
}
public final void aB(byte[] bArr) {
if (bArr == null || bArr.length == 0) {
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "onYuvDataImp error data is null!!");
return;
}
Point q;
Point beI = this.llG.beI();
this.lht = beI.x;
this.lhu = beI.y;
if (this.llB <= 0 || this.llA <= 0) {
q = q(this.lht, this.lhu, this.llw, this.llx);
if (q != null) {
this.llA = q.x;
this.llB = q.y;
} else {
this.llA = this.lht;
this.llB = this.lhu;
}
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "scaleYuvTargetWidth: %s, scaleYuvTargetHeight: %s, srcWidth: %s, srcHeight: %s", new Object[]{Integer.valueOf(this.llA), Integer.valueOf(this.llB), Integer.valueOf(this.lht), Integer.valueOf(this.lhu)});
}
long VG = bi.VG();
int i = 0;
int i2 = 0;
if (this.llJ != null) {
i = this.llJ.getInteger("width");
i2 = this.llJ.getInteger("height");
if (this.lly <= 0 || this.llz <= 0) {
boolean z;
q = q(i, i2, this.llw, this.llx);
if (q != null) {
this.lly = q.x;
this.llz = q.y;
z = true;
} else {
if (Math.abs(i2 - beI.y) <= 0 || i != beI.x) {
this.lly = beI.x;
this.llz = beI.y;
} else {
this.lly = i;
this.llz = i2;
}
z = false;
}
if (z) {
this.llA = this.lly;
this.llB = this.llz;
}
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "videoTargetWidth: %s, videoTargetHeight: %s, initWidth: %s, initHeight: %s, videoNeedScale: %s", new Object[]{Integer.valueOf(this.lly), Integer.valueOf(this.llz), Integer.valueOf(i), Integer.valueOf(i2), Boolean.valueOf(z)});
}
}
this.llD = this.llG.beL();
int writeYuvDataForSegment = MP4MuxerJNI.writeYuvDataForSegment(bArr, beI.x, beI.y, this.llA, this.llB, this.llD, i, i2);
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "writeYuvDataForSegment used %sms", new Object[]{Long.valueOf(bi.bI(VG))});
if (writeYuvDataForSegment < 0) {
x.e("MicroMsg.MediaCodecFFMpegTranscoder", "writeYuvDataForSegment error: %s", new Object[]{Integer.valueOf(writeYuvDataForSegment)});
}
if (this.llC == null) {
MP4MuxerJNI.initH264Encoder(this.lly, this.llz, (float) this.lln.fps, this.lln.videoBitrate, this.lln.dQI, 8, this.lln.dQH, 23.0f);
this.llC = new a(this, (byte) 0);
this.lkw = e.b(this.llC, "MediaCodecFFMpegTranscoder_Encoder");
this.lkw.start();
x.i("MicroMsg.MediaCodecFFMpegTranscoder", "initAndStartEncoder");
}
}
}
|
package com.mrhan.db.entitydaos;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* 实体类字段数据类型
*/
public enum DataType {
/**
* 数字类型
*/
INTEGER("setInt","getInt"),
/**
* 字符类型
*/
STRING("set","get"),
/**
* 日期类型
*/
DATE("set","get"),
/**
* 单浮点型
*/
FLOAT("setFloat","getFloat"),
/**
* 双浮点型
*/
DOUBLE("setDouble","getDouble"),
/**
* 外键实体类型 外键有效
*/
TABLE("set","get"),
/**
*外键有效
* 数组
*/
ARRAY("set","get"),
/**实体类型
* 集合
*/
COLLECTION("set","get");
/**
* 设置数据时需要用到的方法名称
*/
private String setMothed;
/**
* 获取数据时需要用到的方法名称
*/
private String getMothed;
/**
* 构造函数
* @param set 设置时调用的方法名称
* @param get 获取是调用的方法名称
*/
DataType(String set,String get){
this.setMothed = set;
this.getMothed = get;
}
/**
* 设置指定数据类型的数据
* @param f 字段对象
* @param obj 设置数据的对象
* @param value 需要设置的值
* @throws InvocationTargetException {@link InvocationTargetException}
* @throws IllegalAccessException {@link IllegalAccessException}
* @return boolean 返回设置数据的结果 true 设置成功
*/
boolean setDate(Field f,Object obj,Object value) throws InvocationTargetException, IllegalAccessException {
Class<?> fieldClass = f.getClass();//获取字段的Class模板对象
Method method = findNameMethod(fieldClass,setMothed);//找到指定设置数据的方法
if(method!=null){
method.setAccessible(true);
f.setAccessible(true);
if(f.getType() == String.class){
value = value+"";
}
//\ System.out.println(method.getName()+"("+obj+","+value+")");
if(obj!=null && value!=null)
method.invoke(f,obj,value);
return true;
}
return false;
}
/**
* 获取指定对象中指定字段的数据!
* @param f 字段对象
* @param obj 获取数据的目标对象
* @param <D> 数据类型D
* @throws InvocationTargetException {@link InvocationTargetException}
* @throws IllegalAccessException {@link IllegalAccessException}
* @return 返回具体的数据结果!null 代表获取失败
*/
public <D extends Object> D getDate(Field f,Object obj) throws InvocationTargetException, IllegalAccessException {
Class<?> fieldClass = f.getClass();//获取字段的Class模板对象
Method method = findNameMethod(fieldClass,getMothed);//找到指定设置数据的方法
method.setAccessible(true);
f.setAccessible(true);
if(method!=null){
Object o = method.invoke(f,obj);//制定并取得结果
return (D)o;
}
return null;
}
/**
* 获取指定Class模板中指定名称的方法对象
* @param methodClass class模板对象
* @param methodName 需要找到方法的名称
* @return 返回 null 代表未找到此名称的方法
*
*/
private Method findNameMethod(Class<?> methodClass,String methodName){
Method [] methods = methodClass.getMethods();
for(Method m : methods){
if(m.getName().equals(methodName)){
return m;
}
}
return null;
}
}
|
package com.tencent.mm.plugin.fts.ui.a;
import android.content.Context;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import com.tencent.mm.plugin.fts.a.d.a.a;
import com.tencent.mm.plugin.fts.a.d.a.a.b;
import com.tencent.mm.plugin.fts.a.f;
import com.tencent.mm.plugin.fts.ui.b.c;
import com.tencent.mm.plugin.fts.ui.n.g;
import com.tencent.mm.sdk.platformtools.bi;
public final class i extends a {
public String jso;
public boolean jym;
public CharSequence jyn;
private b jyo;
private a jyp;
public i(int i) {
super(19, i);
this.jyo = new b(this);
this.jyp = new a(this);
this.jtj = false;
}
public final void a(Context context, a.a aVar, Object... objArr) {
CharSequence ellipsize = TextUtils.ellipsize(this.jrx.jrY[0], c.jvz, 200.0f, TruncateAt.MIDDLE);
CharSequence ellipsize2 = TextUtils.ellipsize(this.jrx.jrY[1], c.jvz, 400.0f, TruncateAt.MIDDLE);
if (bi.oW(this.jso)) {
this.jyn = TextUtils.concat(new CharSequence[]{context.getString(g.search_talker_message_info_1), f.d(ellipsize, ellipsize.length()), context.getString(g.search_talker_message_info_2), f.d(ellipsize2, ellipsize2.length()), context.getString(g.search_talker_message_info_3)});
return;
}
this.jyn = TextUtils.concat(new CharSequence[]{context.getString(g.search_talker_message_info_4), f.d(ellipsize, ellipsize.length()), context.getString(g.search_talker_message_info_2), f.d(ellipsize2, ellipsize2.length()), context.getString(g.search_talker_message_info_3)});
}
public final b BV() {
return this.jyo;
}
protected final a.a afD() {
return this.jyp;
}
}
|
package com.lupan.springStudy.common;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
/**
* TODO
*
* @author lupan
* @version 2016/4/6 0006
*/
@Controller
public class StudentController {
@Autowired
private StudentService1 service1;
@Autowired
private StudentService2 service2;
public void save(){
service1.save("001");
service2.save("lupan",1);
}
public void delete(){
service1.delete("001");
service2.delete("lupan",1);
}
}
|
package com.rsm.yuri.projecttaxilivredriver.historicchatslist.di;
import com.rsm.yuri.projecttaxilivredriver.domain.FirebaseAPI;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListInteractor;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListInteractorImpl;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListPresenter;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListPresenterImpl;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListRepository;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListRepositoryImpl;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListSessionInteractor;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.HistoricChatsListSessionInteractorImpl;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.entities.User;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.ui.ConnectivityListener;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.ui.HistoricChatsListView;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.ui.OnItemClickListener;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.ui.adapters.HistoricChatsListAdapter;
import com.rsm.yuri.projecttaxilivredriver.lib.base.EventBus;
import com.rsm.yuri.projecttaxilivredriver.lib.base.ImageLoader;
import com.rsm.yuri.projecttaxilivredriver.historicchatslist.entities.Driver;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
/**
* Created by yuri_ on 13/01/2018.
*/
@Module
public class HistoricChatsListModule {
private HistoricChatsListView view;
private OnItemClickListener clickListener;
private ConnectivityListener connectivityListener;
public HistoricChatsListModule(HistoricChatsListView view,
OnItemClickListener clickListener,
ConnectivityListener connectivityListener) {
this.view = view;
this.clickListener = clickListener;
this.connectivityListener = connectivityListener;
}
@Provides
@Singleton
HistoricChatsListView providesHistoricChatsListView(){
return view;
}
@Provides
@Singleton
HistoricChatsListPresenter providesHistoricChatsListPresenter(EventBus eventBus,
HistoricChatsListView historicChatsListView,
HistoricChatsListInteractor historicChatsListInteractor, HistoricChatsListSessionInteractor sessionInteractor){
return new HistoricChatsListPresenterImpl(eventBus,
historicChatsListView,
historicChatsListInteractor,
sessionInteractor);
}
@Provides
@Singleton
HistoricChatsListInteractor providesHistoricChatsListInteractor(HistoricChatsListRepository historicChatsListRepository){
return new HistoricChatsListInteractorImpl(historicChatsListRepository);
}
@Provides
@Singleton
HistoricChatsListSessionInteractor providesHistoricChatsListSessionInteractor(HistoricChatsListRepository historicChatsListRepository){
return new HistoricChatsListSessionInteractorImpl(historicChatsListRepository);
}
@Provides
@Singleton
HistoricChatsListRepository providesHistoricChatsListRepository(FirebaseAPI helper, EventBus eventBus){
return new HistoricChatsListRepositoryImpl(helper, eventBus);
}
@Provides
@Singleton
HistoricChatsListAdapter providesHistoricChatsListAdapter(List<User> historicChatsList,
ImageLoader imageLoader,
OnItemClickListener clickListener,
ConnectivityListener connectivityListener){
return new HistoricChatsListAdapter(historicChatsList, imageLoader, clickListener, connectivityListener);
}
@Provides
@Singleton
OnItemClickListener providesOnItemClickListener(){
return clickListener;
}
@Provides
@Singleton
ConnectivityListener providesConnectivityListener(){
return connectivityListener;
}
@Provides
@Singleton
List<User> providesDriversList(){
return new ArrayList<User>();
}
}
|
package com.example.currency.exceptions;
import com.example.currency.model.ApiError;
import com.example.currency.model.Message;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.context.request.async.AsyncRequestTimeoutException;
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.util.Locale;
import java.util.Optional;
@ControllerAdvice
@Order(Ordered.HIGHEST_PRECEDENCE)
public class CurrencyConverterExceptionHandler extends ResponseEntityExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(CurrencyConverterExceptionHandler.class);
@Autowired
MessageSource messageSource;
@Override
protected ResponseEntity<Object> handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "UnSupported HTTP Method";
logger.error("handleHttpRequestMethodNotSupported - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleHttpMediaTypeNotSupported(HttpMediaTypeNotSupportedException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "UnSupported Media Type";
logger.error("handleHttpMediaTypeNotSupported - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleHttpMediaTypeNotAcceptable(HttpMediaTypeNotAcceptableException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "UnSupported not acceptable";
logger.error("handleHttpMediaTypeNotAcceptable - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleMissingPathVariable(MissingPathVariableException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "Your request is missing a required path variable";
logger.error("handleMissingPathVariable - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleHttpMessageNotReadable(HttpMessageNotReadableException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "JSON Malformed in your request";
logger.error("handleHttpMessageNotReadable - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleHttpMessageNotWritable(HttpMessageNotWritableException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "JSON Malformed in your request";
logger.error("handleHttpMessageNotWritable - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "Method Argument is not valid";
logger.error("handleMethodArgumentNotValid - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleBindException(BindException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "Error while binding request parameter";
logger.error("handleBindException - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleNoHandlerFoundException(NoHandlerFoundException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "Handler not found for request";
logger.error("handleNoHandlerFoundException - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleAsyncRequestTimeoutException(AsyncRequestTimeoutException ex, HttpHeaders headers, HttpStatus status, WebRequest webRequest) {
String message = "Async request has timed out";
logger.error("handleAsyncRequestTimeoutException - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@Override
protected ResponseEntity<Object> handleExceptionInternal(Exception ex, Object body, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "Internal Server Error";
logger.error("handleExceptionInternal - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@ExceptionHandler(JsonProcessingException.class)
protected ResponseEntity<Object> handleJsonProcessingException(JsonProcessingException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
String message = "Error while trying to map json to bean";
logger.error("handleJsonProcessingException - Exception: " , ex);
return buildResponseEntity(new ApiError(status, message, ex));
}
@ExceptionHandler(CurrencyConverterException.class)
protected ResponseEntity<Object> handleCurrencyConverterException(CurrencyConverterException ex, WebRequest request) {
String message = "Bad Request";
return buildResponseEntity(new ApiError(ex.getStatus().orElse(HttpStatus.BAD_REQUEST), getMessage(ex.getMessageModel()), ex));
}
private String getMessage(Optional<Message> optionalMessage) {
Message message = optionalMessage.get();
Object[] content = (message.getContent().isPresent()) ? new Object[] { message.getContent().get() } : new Object[] {};
String key = message.getKey().orElse("error.api.UNEXPECTED_ERROR");
String fetchedMessage = messageSource.getMessage(key, content, "Unknown error", Locale.getDefault());
return fetchedMessage;
}
private ResponseEntity<Object> buildResponseEntity(ApiError apiError) {
return new ResponseEntity<>(apiError, apiError.getStatus().orElse(HttpStatus.INTERNAL_SERVER_ERROR));
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*/
package com.cnk.travelogix.core.flightview.fnbclient.dto;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
/**
*
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
public class FlightIdentifiers {
@JsonProperty("AirlineCode")
protected String airlineCode;
@JsonProperty("FlightNumber")
protected String flightNumber;
@JsonProperty("DepartureAirportCode")
protected String departureAirportCode;
@JsonProperty("ArrivalAirportCode")
protected String arrivalAirportCode;
@JsonProperty("SchedDepartureLocal")
protected String schedDepartureLocal;
/**
* @return the airlineCode
*/@JsonIgnore
public String getAirlineCode() {
return airlineCode;
}
/**
* @param airlineCode the airlineCode to set
*/@JsonIgnore
public void setAirlineCode(String airlineCode) {
this.airlineCode = airlineCode;
}
/**
* @return the flightNumber
*/@JsonIgnore
public String getFlightNumber() {
return flightNumber;
}
/**
* @param flightNumber the flightNumber to set
*/@JsonIgnore
public void setFlightNumber(String flightNumber) {
this.flightNumber = flightNumber;
}
/**
* @return the departureAirportCode
*/@JsonIgnore
public String getDepartureAirportCode() {
return departureAirportCode;
}
/**
* @param departureAirportCode the departureAirportCode to set
*/@JsonIgnore
public void setDepartureAirportCode(String departureAirportCode) {
this.departureAirportCode = departureAirportCode;
}
/**
* @return the arrivalAirportCode
*/@JsonIgnore
public String getArrivalAirportCode() {
return arrivalAirportCode;
}
/**
* @param arrivalAirportCode the arrivalAirportCode to set
*/@JsonIgnore
public void setArrivalAirportCode(String arrivalAirportCode) {
this.arrivalAirportCode = arrivalAirportCode;
}
/**
* @return the schedDepartureLocal
*/@JsonIgnore
public String getSchedDepartureLocal() {
return schedDepartureLocal;
}
/**
* @param schedDepartureLocal the schedDepartureLocal to set
*/@JsonIgnore
public void setSchedDepartureLocal(String schedDepartureLocal) {
this.schedDepartureLocal = schedDepartureLocal;
}
}
|
package com.tencent.mm.plugin.backup.backuppcui;
import android.support.design.a$i;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.tencent.mm.R;
import com.tencent.mm.model.au;
import com.tencent.mm.opensdk.modelbase.BaseResp.ErrCode;
import com.tencent.mm.plugin.backup.a.b.c;
import com.tencent.mm.plugin.backup.a.e;
import com.tencent.mm.plugin.backup.a.g;
import com.tencent.mm.plugin.backup.backuppcmodel.b;
import com.tencent.mm.plugin.backup.backuppcmodel.d;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.aa.a;
import com.tencent.mm.ui.base.h;
class BackupPcUI$3 implements c {
final /* synthetic */ BackupPcUI gXl;
BackupPcUI$3(BackupPcUI backupPcUI) {
this.gXl = backupPcUI;
}
public final void aqN() {
x.i("MicroMsg.BackupPcUI", "onBackupPcUpdateUICallback onBackupPcStart, commandMode[%d]", new Object[]{Integer.valueOf(b.arV().arW().gWw)});
switch (b.arV().arW().gWw) {
case 1:
b.arV().aqP().gRC = 11;
mw(11);
return;
case 2:
b.arV().aqP().gRC = 21;
mw(21);
return;
case 3:
b.arV().aqP().gRC = 12;
mw(12);
return;
case 4:
b.arV().aqP().gRC = 22;
mw(22);
return;
default:
return;
}
}
public final void mw(int i) {
while (true) {
x.i("MicroMsg.BackupPcUI", "onUpdateUIProgress backupPcState:%d", new Object[]{Integer.valueOf(i)});
e aqP = b.arV().aqP();
TextView c;
BackupPcUI backupPcUI;
int i2;
Object[] objArr;
switch (i) {
case -100:
BackupPcUI.a(this.gXl);
return;
case -23:
asi();
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_error_empty_records);
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arQ();
return;
case -22:
asi();
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_error_miss_recover_merge_data);
b.arV().arw().stop();
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arQ();
return;
case -21:
asi();
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_error_programme_error);
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arQ();
return;
case -13:
asi();
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_error_not_enough_space_for_recover);
b.arV().arw().stop();
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arQ();
return;
case ErrCode.ERR_UNSUPPORT /*-5*/:
asi();
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_error_connect_fail);
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arQ();
return;
case ErrCode.ERR_AUTH_DENIED /*-4*/:
if (1 == b.arV().arW().gWw || 3 == b.arV().arW().gWw) {
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_error);
BackupPcUI.c(this.gXl).setText(this.gXl.getString(R.l.backup_pc_transfer, new Object[]{Integer.valueOf(aqP.gRD), Integer.valueOf(aqP.gRE), "0M"}));
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_error_network_disconnect);
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_stop_backup);
BackupPcUI.f(this.gXl).setOnClickListener(new 3(this));
} else if (2 == b.arV().arW().gWw || 4 == b.arV().arW().gWw) {
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_error);
BackupPcUI.c(this.gXl).setText(this.gXl.getString(R.l.backup_pc_recover_transfer, new Object[]{Integer.valueOf(aqP.gRD), Integer.valueOf(aqP.gRE), "0M"}));
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_error_recover_network_disconnect);
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_stop_transfer);
BackupPcUI.f(this.gXl).setOnClickListener(new 4(this));
}
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_red));
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(0);
arS();
return;
case -3:
asi();
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_error_complex_wifi);
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_error_see_connect_details);
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(0);
BackupPcUI.f(this.gXl).setOnClickListener(new 6(this));
arQ();
return;
case -2:
case -1:
asi();
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_error_not_same_wifi);
String cQ = g.cQ(this.gXl);
if (cQ == null || cQ.equals("")) {
BackupPcUI.d(this.gXl).setText(this.gXl.getString(R.l.backup_pc_error_not_same_wifi_wifiname, new Object[]{b.arV().arW().gWx, "移动网络"}));
} else {
BackupPcUI.d(this.gXl).setText(this.gXl.getString(R.l.backup_pc_error_not_same_wifi_wifiname, new Object[]{b.arV().arW().gWx, cQ}));
}
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_red));
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_error_see_connect_details);
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(0);
BackupPcUI.f(this.gXl).setOnClickListener(new 5(this));
arQ();
return;
case 1:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_icon);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_connecting);
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arQ();
return;
case 4:
switch (b.arV().arW().gWw) {
case 1:
case 3:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_icon);
c = BackupPcUI.c(this.gXl);
backupPcUI = this.gXl;
i2 = R.l.backup_pc_transfer;
objArr = new Object[3];
objArr[0] = Integer.valueOf(aqP.gRD);
objArr[1] = Integer.valueOf(aqP.gRE);
b.arV().arW();
objArr[2] = com.tencent.mm.plugin.backup.backuppcmodel.c.asb();
c.setText(backupPcUI.getString(i2, objArr));
break;
case 2:
case 4:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_icon);
c = BackupPcUI.c(this.gXl);
backupPcUI = this.gXl;
i2 = R.l.backup_pc_recover_transfer;
objArr = new Object[3];
objArr[0] = Integer.valueOf(aqP.gRD);
objArr[1] = Integer.valueOf(aqP.gRE);
b.arV().arW();
objArr[2] = com.tencent.mm.plugin.backup.backuppcmodel.c.asb();
c.setText(backupPcUI.getString(i2, objArr));
break;
}
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_transfer_weak_network);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_red));
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arS();
return;
case 5:
switch (b.arV().arW().gWw) {
case 1:
case 3:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_icon);
c = BackupPcUI.c(this.gXl);
backupPcUI = this.gXl;
i2 = R.l.backup_pc_transfer;
objArr = new Object[3];
objArr[0] = Integer.valueOf(aqP.gRD);
objArr[1] = Integer.valueOf(aqP.gRE);
b.arV().arW();
objArr[2] = com.tencent.mm.plugin.backup.backuppcmodel.c.asb();
c.setText(backupPcUI.getString(i2, objArr));
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_stop_backup);
BackupPcUI.f(this.gXl).setOnClickListener(new 16(this));
break;
case 2:
case 4:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_icon);
c = BackupPcUI.c(this.gXl);
backupPcUI = this.gXl;
i2 = R.l.backup_pc_recover_transfer;
objArr = new Object[3];
objArr[0] = Integer.valueOf(aqP.gRD);
objArr[1] = Integer.valueOf(aqP.gRE);
b.arV().arW();
objArr[2] = com.tencent.mm.plugin.backup.backuppcmodel.c.asb();
c.setText(backupPcUI.getString(i2, objArr));
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_stop_transfer);
BackupPcUI.f(this.gXl).setOnClickListener(new 2(this));
break;
}
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_transfer_reconnecting);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_red));
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(0);
arS();
return;
case 11:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_icon);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_start_tip);
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_start_no_new_message);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.e(this.gXl).setText(R.l.backup_pc_start_backup_allrecords);
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_start_choose_records);
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(0);
BackupPcUI.f(this.gXl).setVisibility(0);
arQ();
BackupPcUI.e(this.gXl).setOnClickListener(new OnClickListener() {
public final void onClick(View view) {
au.HU();
x.i("MicroMsg.BackupPcUI", "onBackupPcUpdateUICallback onUpdateUIProgress startbackup all, hasMove:%s", new Object[]{Boolean.valueOf(((Boolean) com.tencent.mm.model.c.DT().get(a.sVe, Boolean.valueOf(false))).booleanValue())});
if (((Boolean) com.tencent.mm.model.c.DT().get(a.sVe, Boolean.valueOf(false))).booleanValue()) {
h.a(BackupPcUI$3.this.gXl, R.l.backup_pc_has_move_tip, 0, R.l.backup_sure, 0, false, new 1(this), null, R.e.backup_green);
return;
}
b.arV().arW().mF(2);
b.arV().aqP().gRC = 12;
BackupPcUI$3.this.mw(12);
b.arV().arZ().cancel();
b.arV().arZ().art();
b.arV().arZ().dy(true);
com.tencent.mm.plugin.report.service.h.mEJ.a(400, 7, 1, false);
com.tencent.mm.plugin.report.service.h.mEJ.h(13735, new Object[]{Integer.valueOf(9), Integer.valueOf(b.arV().arW().gWC)});
}
});
BackupPcUI.f(this.gXl).setOnClickListener(new 9(this));
return;
case 12:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_icon);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_prepare);
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_prepare_keep_screen_on);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arS();
return;
case 14:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_icon);
c = BackupPcUI.c(this.gXl);
backupPcUI = this.gXl;
i2 = R.l.backup_pc_transfer;
objArr = new Object[3];
objArr[0] = Integer.valueOf(aqP.gRD);
objArr[1] = Integer.valueOf(aqP.gRE);
b.arV().arW();
objArr[2] = com.tencent.mm.plugin.backup.backuppcmodel.c.asb();
c.setText(backupPcUI.getString(i2, objArr));
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_prepare_keep_screen_on);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arS();
return;
case 15:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_finished);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_backup_finish);
BackupPcUI.d(this.gXl).setText(this.gXl.getString(R.l.backup_pc_backup_finish_detail, new Object[]{Integer.valueOf(aqP.gRD), Integer.valueOf(aqP.gRE)}));
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.e(this.gXl).setText(R.l.backup_finish);
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(0);
BackupPcUI.f(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setOnClickListener(new 10(this));
arQ();
return;
case 21:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_icon);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_recover_start_tip);
BackupPcUI.e(this.gXl).setText(R.l.backup_pc_recover_start_recover);
BackupPcUI.d(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setVisibility(0);
BackupPcUI.f(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setOnClickListener(new OnClickListener() {
public final void onClick(View view) {
com.tencent.mm.plugin.report.service.h.mEJ.h(13735, new Object[]{Integer.valueOf(23), Integer.valueOf(b.arV().arW().gWC)});
b.arV().arW().mF(4);
b.arV().aqP().gRC = 22;
BackupPcUI$3.this.mw(22);
com.tencent.mm.plugin.report.service.h.mEJ.a(400, 16, 1, false);
}
});
arQ();
return;
case 22:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_icon);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_prepare);
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_prepare_keep_screen_on);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arS();
return;
case 23:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_icon);
c = BackupPcUI.c(this.gXl);
backupPcUI = this.gXl;
i2 = R.l.backup_pc_recover_transfer;
objArr = new Object[3];
objArr[0] = Integer.valueOf(aqP.gRD);
objArr[1] = Integer.valueOf(aqP.gRE);
b.arV().arW();
objArr[2] = com.tencent.mm.plugin.backup.backuppcmodel.c.asb();
c.setText(backupPcUI.getString(i2, objArr));
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_prepare_keep_screen_on);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arS();
return;
case 24:
if (BackupPcUI.access$700()) {
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_icon);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_recover_transfer_finish);
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_recover_transfer_finish_tip);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.e(this.gXl).setText(R.l.backup_pc_recover_start_merge);
BackupPcUI.f(this.gXl).setText(R.l.backup_pc_recover_stop_recover);
BackupPcUI.h(this.gXl).setText(R.l.backup_remind_later);
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(0);
BackupPcUI.f(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setOnClickListener(new 12(this));
BackupPcUI.f(this.gXl).setOnClickListener(new 13(this));
BackupPcUI.h(this.gXl).setOnClickListener(new 14(this));
return;
} else if (bi.ci(this.gXl)) {
b.arV().arY();
if (d.arA()) {
b.arV().arY().arg();
return;
}
b.arV().aqP().gRC = -22;
mw(-22);
com.tencent.mm.plugin.report.service.h.mEJ.a(400, 64, 1, false);
return;
} else {
return;
}
case 25:
if (bi.ci(this.gXl)) {
b.arV().aqP().gRC = 24;
i = 24;
} else {
return;
}
case 26:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_icon);
BackupPcUI.c(this.gXl).setText(this.gXl.getString(R.l.backup_pc_recover_merge, new Object[]{Integer.valueOf(aqP.gRD), Integer.valueOf(aqP.gRE)}));
BackupPcUI.d(this.gXl).setText(R.l.backup_pc_recover_merge_tip);
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.h(this.gXl).setText(R.l.backup_pc_recover_stop_recover);
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(4);
BackupPcUI.f(this.gXl).setVisibility(4);
arQ();
return;
case a$i.AppCompatTheme_actionModeStyle /*27*/:
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_finished);
BackupPcUI.c(this.gXl).setText(R.l.backup_pc_recover_merge_finish);
BackupPcUI.d(this.gXl).setText(this.gXl.getString(R.l.backup_pc_recover_merge_finish_detail, new Object[]{Integer.valueOf(aqP.gRD), Integer.valueOf(aqP.gRE)}));
BackupPcUI.d(this.gXl).setTextColor(this.gXl.getResources().getColor(R.e.backup_status_content));
BackupPcUI.e(this.gXl).setText(R.l.backup_finish);
BackupPcUI.d(this.gXl).setVisibility(0);
BackupPcUI.e(this.gXl).setVisibility(0);
BackupPcUI.f(this.gXl).setVisibility(4);
BackupPcUI.e(this.gXl).setOnClickListener(new 15(this));
arQ();
return;
default:
return;
}
}
}
private void asi() {
if (1 == b.arV().arW().gWw || 3 == b.arV().arW().gWw) {
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_error);
} else if (2 == b.arV().arW().gWw || 4 == b.arV().arW().gWw) {
BackupPcUI.b(this.gXl).setImageResource(R.k.backup_pc_recover_error);
}
}
private void arQ() {
BackupPcUI.h(this.gXl).setText(R.l.backup_close);
BackupPcUI.h(this.gXl).setOnClickListener(new 7(this));
}
private void arS() {
BackupPcUI.h(this.gXl).setText(R.l.backup_minimize);
BackupPcUI.h(this.gXl).setOnClickListener(new 8(this));
}
public final void aqO() {
}
}
|
package com.xiaomi.mapreduce;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class Order implements WritableComparable<Order> {
private String order_id;
private String user_id;
private String pdtName;
private float price;
private int number;
private double amountFee;
public void set(String order_id, String user_id, String pdtName, float price, int number, double amountFee) {
this.order_id = order_id;
this.user_id = user_id;
this.pdtName = pdtName;
this.price = price;
this.number = number;
this.amountFee = amountFee;
}
public double getAmountFee() {
return amountFee;
}
public void setAmountFee(float amountFee) {
this.amountFee = amountFee;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public String getPdtName() {
return pdtName;
}
public void setPdtName(String pdtName) {
this.pdtName = pdtName;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
@Override
public String toString() {
return this.order_id + ", " + this.user_id + ", " + this.pdtName + ", " + this.price + ", " + this.number
+ ", " + this.amountFee;
}
@Override
public int compareTo(Order o) {
int result = Double.compare(o.getAmountFee(), this.getAmountFee());
return result == 0 ? this.pdtName.compareTo(o.getPdtName()) : result;
}
@Override
public void write(DataOutput dataOutput) throws IOException {
dataOutput.writeUTF(this.order_id);
dataOutput.writeUTF(this.user_id);
dataOutput.writeUTF(this.pdtName);
dataOutput.writeFloat(this.price);
dataOutput.writeInt(this.number);
dataOutput.writeDouble(this.amountFee);
}
@Override
public void readFields(DataInput dataInput) throws IOException {
this.order_id = dataInput.readUTF();
this.user_id = dataInput.readUTF();
this.pdtName = dataInput.readUTF();
this.price = dataInput.readFloat();
this.number = dataInput.readInt();
this.amountFee = dataInput.readDouble();
}
}
|
package exercicio_190;
import java.util.Scanner;
public class Exercicio_190 {
public static void main(String[] args) {
int i,idade;
String nome;
char sexo;
Scanner teclado = new Scanner(System.in);
for (i=1;i<=20;i++){
System.out.println("=====================");
System.out.println("Informe o nome:");
nome = teclado.next();
System.out.println("Informe a idade:");
idade = teclado.nextInt();
System.out.println("Informe o sexo[M/F]:");
System.out.println("=====================");
sexo = teclado.next().trim().toUpperCase().charAt(0);
if ((sexo == 'M') && (idade > 21)){
System.out.println("O nome e: "+ nome);
System.out.println("A idade e: "+ idade);
}
}
}
}
|
package com.pangpang6.books.guava.base;
import com.google.common.base.MoreObjects;
import org.junit.Test;
/**
* Created by jiangjiguang on 2017/12/12.
*/
public class MoreObjectsTest {
@Test
public void toStringHelperTest(){
Test01 test01 = new Test01();
test01.setA1("jiangjiguang");
System.out.println(test01);
}
public class Test01{
private String a1;
private String a2;
public String getA1() {
return a1;
}
public void setA1(String a1) {
this.a1 = a1;
}
public String getA2() {
return a2;
}
public void setA2(String a2) {
this.a2 = a2;
}
@Override
public String toString() {
/*
return "Test01{" +
"a1='" + a1 + '\'' +
", a2='" + a2 + '\'' +
'}';
*/
return MoreObjects.toStringHelper(this).omitNullValues()
.add("a1", a1)
.add("a2", a2)
.toString();//Player{name=Underwood}
}
}
}
|
package com.dzz.user.service.controller;
import com.dzz.user.api.domain.bo.UserDetailBo;
import com.dzz.user.api.domain.bo.UserListBo;
import com.dzz.user.api.domain.dto.UserListParam;
import com.dzz.user.api.domain.dto.UserSaveParam;
import com.dzz.user.api.service.UserService;
import com.dzz.util.page.PageUtil;
import com.dzz.util.response.ResponsePack;
import com.dzz.util.validate.ValidateResultHandler;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 用户接口实现
*
* @author dzz
* @version 1.0.0
* @since 2019年08月12 17:44
*/
@RestController
@Api(value = "用户接口", tags = "用户接口API")
@Slf4j
public class UserController{
private UserService userService;
@Autowired
public void setUserService(UserService userService) {
this.userService = userService;
}
/**
* 保存用户
*
* @param saveParam 参数
* @return 保存结果
*/
@PostMapping(UserService.SAVE_USER_URL)
public ResponsePack<Boolean> saveUser(@RequestBody @Validated UserSaveParam saveParam,
BindingResult bindingResult) {
ValidateResultHandler.bindResultHandler(bindingResult);
return userService.saveUser(saveParam);
}
/**
* 用户列表查询
*
* @param listParam 参数
* @return 结果
*/
@PostMapping(UserService.LIST_USER)
public ResponsePack<PageUtil<UserListBo>> listUser(@RequestBody UserListParam listParam) {
return userService.listUser(listParam);
}
/**
* 用户详情查询
*
* @param userName 用户名
* @return 结果
*/
@GetMapping(UserService.DETAIL_USER)
public ResponsePack<UserDetailBo> detailUser(@RequestParam("userName") String userName) {
return userService.detailUser(userName);
}
}
|
package com.noteshare.questions.dao;
import com.noteshare.questions.model.Notelike;
public interface NotelikeMapper {
int deleteByPrimaryKey(Integer id);
int insert(Notelike record);
int insertSelective(Notelike record);
Notelike selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Notelike record);
int updateByPrimaryKey(Notelike record);
} |
package com.sdl.webapp.util.dd4t;
import java.util.StringTokenizer;
/**
* Simple utility functions to process TCM-URIs.
*/
public final class TcmUtils {
/**
* Constant <code>PUBLICATION_ITEM_TYPE=1</code>
*/
public static final int PUBLICATION_ITEM_TYPE = 1;
/**
* Constant <code>TEMPLATE_ITEM_TYPE=32</code>
*/
public static final int TEMPLATE_ITEM_TYPE = 32;
/** Constant <code>PAGE_ITEM_TYPE=64</code> */
public static final int PAGE_ITEM_TYPE = 64;
private static final String TCM_S_S = "tcm:%s-%s";
private static final String TCM_S_S_S = "tcm:%s-%s-%s";
private TcmUtils() {
}
/**
* <p>buildPublicationTcmUri.</p>
*
* @param publicationId a int.
* @return a {@link java.lang.String} object.
*/
static public String buildPublicationTcmUri(int publicationId) {
return String.format(TCM_S_S_S, 0, publicationId, PUBLICATION_ITEM_TYPE);
}
static public String buildPublicationTcmUri(String publicationId) {
return String.format(TCM_S_S_S, 0, publicationId, PUBLICATION_ITEM_TYPE);
}
/**
* <p>buildTemplateTcmUri.</p>
*
* @param publicationId a {@link java.lang.String} object.
* @param itemId a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
static public String buildTemplateTcmUri(String publicationId, String itemId) {
return String.format(TCM_S_S_S, publicationId, itemId, TEMPLATE_ITEM_TYPE);
}
/**
* <p>buildPageTcmUri.</p>
*
* @param publicationId a {@link java.lang.String} object.
* @param itemId a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
static public String buildPageTcmUri(String publicationId, String itemId) {
return String.format(TCM_S_S_S, publicationId, itemId, PAGE_ITEM_TYPE);
}
/**
* <p>buildTcmUri.</p>
*
* @param publicationId a {@link java.lang.String} object.
* @param itemId a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
static public String buildTcmUri(String publicationId, String itemId) {
return String.format(TCM_S_S, publicationId, itemId);
}
/**
* <p>buildTcmUri.</p>
*
* @param publicationId a int.
* @param itemId a int.
* @return a {@link java.lang.String} object.
*/
static public String buildTcmUri(int publicationId, int itemId) {
return String.format(TCM_S_S, publicationId, itemId);
}
/**
* <p>buildTcmUri.</p>
*
* @param publicationId a {@link java.lang.String} object.
* @param itemId a {@link java.lang.String} object.
* @param itemType a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
static public String buildTcmUri(String publicationId, String itemId, String itemType) {
return String.format(TCM_S_S_S, publicationId, itemId, itemType);
}
/**
* <p>buildTcmUri.</p>
*
* @param publicationId a int.
* @param itemId a int.
* @param itemType a int.
* @return a {@link java.lang.String} object.
*/
static public String buildTcmUri(int publicationId, int itemId, int itemType) {
return String.format(TCM_S_S_S, publicationId, itemId, itemType);
}
/**
* <p>getItemId.</p>
*
* @param tcmUri a {@link java.lang.String} object.
* @return a int.
*/
static public int getItemId(String tcmUri) {
StringTokenizer tokenizer = new StringTokenizer(tcmUri, ":-");
if (tokenizer.countTokens() > 2) {
tokenizer.nextToken();
tokenizer.nextToken();
return Integer.parseInt(tokenizer.nextToken());
}
return -1;
}
/**
* <p>getPublicationId.</p>
*
* @param tcmUri a {@link java.lang.String} object.
* @return a int.
*/
static public int getPublicationId(String tcmUri) {
StringTokenizer tokenizer = new StringTokenizer(tcmUri, ":-");
tokenizer.nextToken();
return Integer.parseInt(tokenizer.nextToken());
}
/**
* <p>localizeTcmUri.</p>
*
* @param tcmUri a {@link java.lang.String} object.
* @param publicationTcmUri a {@link java.lang.String} object.
* @return a {@link java.lang.String} object.
*/
static public String localizeTcmUri(String tcmUri, String publicationTcmUri) {
int publicationId = getItemId(publicationTcmUri);
return localizeTcmUri(tcmUri, publicationId);
}
/**
* <p>localizeTcmUri.</p>
*
* @param tcmUri a {@link java.lang.String} object.
* @param publicationId a int.
* @return a {@link java.lang.String} object.
*/
static public String localizeTcmUri(String tcmUri, int publicationId) {
StringTokenizer tokenizer = new StringTokenizer(tcmUri, ":-");
StringBuilder localizedTcmUri = new StringBuilder("tcm:").append(publicationId);
tokenizer.nextToken();
tokenizer.nextToken();
while (tokenizer.hasMoreTokens()) {
localizedTcmUri.append('-').append(tokenizer.nextToken());
}
return localizedTcmUri.toString();
}
}
|
package org.chouchou;
import java.util.List;
import java.util.ArrayList;
public class Brick implements CRIndex{
//Integration of blocks, minimal playing unit of the game.
private String type;
private int blockCost = 0;
private String[] rotate = new String[3];
private boolean isMerge = false;
private List<Integer> blockPosition = new ArrayList<Integer>(); // Colored block position in the brick code.
public void setType(String s){
this.type = s.substring(0,7);
int bitCount = 0;
for(int i = 0; i < 7; i++){
if(s.charAt(i) != '0'){
bitCount++;
blockPosition.add(i);
}
}
blockCost = bitCount;
//Store the rotated brick code in the rotate array.
rotate[0] = type;
if(blockCost > 1){
rotate[1] = rotateBrick(type);
if(blockCost > 2)
rotate[2] = rotateBrick(rotate[1]);
}
if(blockCost == 1 && s.length() == 8){
this.setMerge(true);
}else this.setMerge(false);
}
public boolean searchVacancy(Block[][] board, Status rootStatus){
//Search vacancy space for the brick, call from main function
boolean hasVacancy = false;
for(int i = 0; i < 7; i++){
for(int j = 0; j < 7; j++){
if(board[i][j].getBlockType() == 'N' && board[i][j].getValidity()){
int allOneChecked = 0;
for(int k = 1; k < blockPosition.size(); k++){
int index = blockPosition.get(k);
if(i + cIndex[index] < 7 && i + cIndex[index] >= 0 && j + rIndex[index] < 7 && j + rIndex[index] >= 0)
if(board[i + cIndex[index]][j + rIndex[index]].getBlockType() == 'N' && board[i + cIndex[index]][j + rIndex[index]].getValidity())
allOneChecked++;
}
if(allOneChecked == blockCost - 1){
for(int k = 0; k < blockCost; k++){
Status status = new Status(i, j, rotate[k], rotate[0], isMerge);
status.setEvaluation(evaluate(status, board));
rootStatus.pushStatus(status);
// All blocks set to unexplored.
for(int m = 0; m < 7; m++){
for(int n = 0; n < 7; n++){
board[m][n].setExplored(false);
}
}
}
hasVacancy = true;
}
}
}
}
return hasVacancy;
}
private float evaluate(Status status, Block[][] board) {
int blockGain[] = new int[blockCost];
//int colRowEstimate = 0; // Estimate the distance to the middle of the board.
for(int i = 0; i < blockCost; i++){
int currentColumn = status.getColumn();
int currentRow = status.getRow();
currentColumn += cIndex[blockPosition.get(i)];
currentRow += rIndex[blockPosition.get(i)];
Block fakeBlock = new Block(true, status.getBrick().charAt(blockPosition.get(i)), 1);
if(!status.getMerge()) blockGain[i] = blockEvaluate(fakeBlock, currentColumn, currentRow, board, 0);
//colRowEstimate += Math.abs(currentColumn - 3) + Math.abs(currentRow - 3);
}
float sum = 0;
int totalCount = 0;
for(int i = 0; i < 7; i++){
for(int j = 0; j < 7; j++){
if(board[i][j].getValidity() && board[i][j].getBlockType() == 'N'){
sum += 0.5;
}
}
}
for(int i = 0; i < blockCost; i++){
if(blockGain[i] > 1){
totalCount++;
sum += blockGain[i];
}
}
if(totalCount == 2) sum *= 2;
else if(totalCount == 3) sum *= 4;
//sum -= (float)colRowEstimate / ((float)blockCost * 6);
return sum;
}
private int blockEvaluate(Block block,int column, int row, Block board[][], int gain) {
board[column][row].setExplored(true);
int tmpGain = gain;
for(int i = -1; i <= 1; i++){
for(int j = -1; j <= 1; j++){
int x = column + i;
int y = row + j;
if(x < 7 && y < 7 && x >= 0 && y >= 0 && i + j != 0){
if(!board[x][y].getExplored() && block.getBlockType() == board[x][y].getBlockType()){
//Calculate if the block hasn't been explored & the block type is same as the original block type.
tmpGain += blockEvaluate(board[x][y], x, y, board, gain);
}
}
}
}
return tmpGain + block.getValue();
}
private String rotateBrick(String str) {
StringBuilder sb = new StringBuilder(str);
for(int i = 0; i < blockCost; i++){
if(i != blockCost - 1)
sb.setCharAt(blockPosition.get(i), str.charAt(blockPosition.get(i + 1)));
else
sb.setCharAt(blockPosition.get(blockCost - 1), str.charAt(0));
}
return sb.toString();
}
public String getRotate(int i){
return rotate[i];
}
public String getType(){
return type;
}
public boolean getIsMerge(){
return isMerge;
}
public int getBlockCost(){
return blockCost;
}
public void setMerge(boolean b){
this.isMerge = b;
}
public String getRotateCode(int i){
return rotate[i];
}
} |
package com.team11.demoangrybird;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.sprite.Sprite;
import org.andengine.extension.physics.box2d.PhysicsConnector;
import org.andengine.extension.physics.box2d.PhysicsFactory;
import org.andengine.extension.physics.box2d.PhysicsWorld;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.texture.region.TextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
public class Vat_the {
Vector2 position; //vị trí
float weight = 30f; //cân nặng
float elastic = 0.3f; //đàn hồi
float friction = 1f; //ma sát
Body body = null; //body chim
Sprite mSprite;
PhysicsConnector physicconnect=null;
public Vat_the(float x, float y, ITextureRegion texture, VertexBufferObjectManager Ver, Scene mScene)
{
}
public void CreateBody(PhysicsWorld physicWorld)
{
}
}
|
package com.tencent.mm.ui.base.preference;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
class i$3 implements OnItemLongClickListener {
final /* synthetic */ i tDe;
i$3(i iVar) {
this.tDe = iVar;
}
public final boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long j) {
if (i < i.e(this.tDe).getHeaderViewsCount()) {
return false;
}
i.d(this.tDe).getItem(i - i.e(this.tDe).getHeaderViewsCount());
i.d(this.tDe);
i.e(this.tDe);
return i.csm();
}
}
|
package com.demo.test.exception;
/**
* @author Jack
* <p>
* 业务层需要自己声明异常的情况
*/
public class ServiceException extends RuntimeException {
public ServiceException(String msg) {
super(msg);
}
}
|
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class Resume implements Serializable {
Resume(Stage stage,Scene scene,GridPane pane,Cell [] [] field){
}
void serialize(Stage stage,Scene scene,GridPane pane,Cell [] [] field) {
try
{
//Saving of object in a file
FileOutputStream file = new FileOutputStream("Game");
ObjectOutputStream out = new ObjectOutputStream(file);
// Method for serialization of object
out.writeObject(stage);
out.writeObject(scene);
out.writeObject(pane);
out.writeObject(field);
out.close();
file.close();
System.out.println("Object has been serialized");
}
catch(IOException ex)
{
System.out.println("IOException is caught");
}
}
Object [] deserialize() {
Object [] arr=new Object[4];
try
{
// Reading the object from a file
FileInputStream file = new FileInputStream("Game");
ObjectInputStream in = new ObjectInputStream(file);
// Method for deserialization of object
Stage stage = (Stage)in.readObject();
Scene scene=(Scene)in.readObject();
GridPane pane=(GridPane)in.readObject();
Cell[][] field=(Cell[][])in.readObject();
arr[0]=stage;
arr[1]=scene;
arr[2]=pane;
arr[3]=field;
in.close();
file.close();
System.out.println("Object has been deserialized ");
}
catch(IOException ex)
{
System.out.println("IOException is caught");
}
catch(ClassNotFoundException ex)
{
System.out.println("ClassNotFoundException is caught");
}
return arr;
}
} |
package com.me.sustainable.living.dao.sql;
public class SQLHolder {
public static final String GET_USER = "SELECT * FROM user WHERE USER_ID = :userId";
public static final String GET_USER_DETAIL = "select u.user_id,u.user_name,h.home_id,g.goal_id,resource_cte.resource_type from user u left join home h on u.user_id = h.user_id left join goal g on g.home_id = h.home_id left join (select distinct r.home_id,r.resource_type from resource r)resource_cte on h.HOME_ID = resource_cte.home_id WHERE u.USER_ID = :userId";
public static final String GET_HOME_CONSUMPTION = "select * from resource where HOME_ID = :homeID";
public static final String UPDATE_GOAL = "update goal_detail set consumption_limit = :consumptionLimit where resource_type = :resourceType and GOAL_ID= :goalID";
public static final String SET_GOAL = "insert into goal (HOME_ID) values( :homeID)";
// join
public static final String GET_GOALS = "select g.GOAL_ID,gd.consumption_limit,gd.resource_type from goal g , goal_detail gd where g.GOAL_ID= gd.GOAL_ID and g.HOME_ID = :homeId";
public static final String SET_GOAL_DETAILS = "insert into goal_detail (GOAL_ID , resource_type , consumption_limit ) values(:goalID , :resourceType , :consumptionLimit)";
public static final String GET_HOME = "SELECT * FROM home WHERE USER_ID = :userId";
public static final String SAVE_RESOURCES = "insert into resource values(:resourceId,:resourceType, :amountUsed, :asOfDate , :homeId)";
}
|
package com.example.taras.task_course;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class LogInActivity extends Activity implements View.OnClickListener {
private Button btn_enter;
private EditText logInUser;
private EditText logInPassword;
private DBHelper usersDB;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log_in);
btn_enter = (Button) findViewById(R.id.btn_enter);
btn_enter.setTransformationMethod(null);
btn_enter.setOnClickListener(this);
logInUser = (EditText) findViewById(R.id.logInUser);
logInPassword = (EditText) findViewById(R.id.logInPassword);
logInUser.setGravity(Gravity.CENTER);
logInPassword.setGravity(Gravity.CENTER);
logInUser.setHint("Ім'я користувача");
logInPassword.setHint("Пароль");
usersDB = new DBHelper(this);
}
@Override
public void onClick(View v) {
String textLogInUser= logInUser.getText().toString();
String textLogInPassword = logInPassword.getText().toString();
SQLiteDatabase database = usersDB.getWritableDatabase();
Cursor cursor = database.query(DBHelper.TABLE_USERS, null, null, null, null, null, null);
while (cursor.moveToNext()) {
String userName = cursor.getString(cursor.getColumnIndex(DBHelper.KEY_USER_NAME));
String userPassword = cursor.getString(cursor.getColumnIndex(DBHelper.KEY_PASSWORD));
if (userName.equals(textLogInUser) && userPassword.equals(textLogInPassword)){
finish();
Intent intent = new Intent(this, MainProgram.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.putExtra("userName", userName);
startActivity(intent);
break;
}
if (cursor.isLast())
Toast.makeText(LogInActivity.this, "Введіть правильні дані!", Toast.LENGTH_SHORT).show();
}
cursor.close();
database.close();
}
}
|
package com.thomaster.ourcloud.services.request.save.file;
import com.google.common.io.Files;
import com.thomaster.ourcloud.model.filesystem.UploadedFolder;
import com.thomaster.ourcloud.model.user.OCUser;
import com.thomaster.ourcloud.services.FileService;
import com.thomaster.ourcloud.services.OCUserService;
import com.thomaster.ourcloud.services.request.base.BaseRequestFactory;
import org.springframework.stereotype.Component;
@Component
public class PreFlightSaveFileRequestFactory extends BaseRequestFactory<PreFlightSaveFileRequest> {
public PreFlightSaveFileRequestFactory(OCUserService userService, FileService fileService) {
super(userService, fileService);
}
public PreFlightSaveFileRequest createPreFlightSaveFileRequest(String parentFolderPath,
String hash,
String originalName,
long size,
boolean shouldOverrideExistingFile) {
OCUser initiatingUser = userService.getCurrentlyLoggedInUser().orElse(null);
UploadedFolder parentFolder = validatePathThenQueryAndCastToFolder(parentFolderPath);
OCUser parentFolderOwner = parentFolder.getOwner();
return new PreFlightSaveFileRequest.PreFlightSaveFileRequestBuilder()
.hash(hash)
.size(size)
.fileExtension(Files.getFileExtension(originalName))
.originalName(originalName)
.shouldOverrideExistingFile(shouldOverrideExistingFile)
.parentFolder(parentFolder)
.parentFolderOwner(parentFolderOwner)
.initiatingUser(initiatingUser)
.build();
}
}
|
/**
* original(c) zhuoyan company
* projectName: java-design-pattern
* fileName: Account.java
* packageName: cn.zy.pattern.stats
* date: 2018-12-28 21:56
* history:
* <author> <time> <version> <desc>
* 作者姓名 修改时间 版本号 描述
*/
package cn.zy.pattern.stats.simple;
/**
* @version: V1.0
* @author: ending
* @className: Account
* @packageName: cn.zy.pattern.stats
* @description: 帐户
* @data: 2018-12-28 21:56
**/
public class Account {
private AccountStats accountStats;
private String name;
private Long monny;
public Account(String name, Long monny) {
this.name = name;
this.accountStats = new NormalStats(this);
this.monny = monny;
System.out.println(String.format("姓名为%s,存入%d元" , this.name , this.monny));
}
public AccountStats getAccountStats() {
return accountStats;
}
public void setAccountStats(AccountStats accountStats) {
this.accountStats = accountStats;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getMonny() {
return monny;
}
public void setMonny(Long monny) {
this.monny = monny;
}
public void addMonny(Long num){
accountStats.addMonny(num);
}
public void removeMonny(Long num){
accountStats.removeMonny(num);
}
} |
public class TestePessoa {
public static void main(String[] args) {
Pessoa pessoa1 = new Pessoa("victor", 346171878);
Pessoa pessoa2 = new Pessoa("moacir", 346171878);
if (pessoa1.equals(pessoa2)){
System.out.println("são a mesma pessoa");
} else {
System.out.println("são pessoas diferentes");
}
}
}
|
package com.emily.framework.common.utils.hash;
import com.emily.framework.common.enums.AppHttpStatus;
import com.emily.framework.common.exception.BusinessException;
import com.emily.framework.common.utils.constant.CharsetUtils;
import com.emily.framework.common.utils.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.util.Base64;
/**
* 介绍:Base64是网络上最常见的用于传输8Bit字节码的编码方式之一,Base64就是一种基于64个可打印字符来表示二进制数据的方法;
* 使用场景:Base64一般用于在HTTP协议下传输二进制数据,由于HTTP协议是文本协议,所以在HTTP协议下传输二进制数据需要将二进制数据转换字符数据;
* 然而直接转换是不行的,因为网络传输只能传输可打印字符;
* 什么是可打印字符?在ASCII码中规定,0-31、127这33个字符属于控制字符,32-126这95个字符属于可打印字符,也就是说网络传输只能传输这95个字符,
* 不在这个范围内的字符无法传输。那么该怎么才能传输其它字符呢?其中一种方式就是使用Base64
*
* @program: spring-parent
* @description: base64编码工具类
* @create: 2020/05/21
*/
public class Base64Utils {
/**
* Basic编码:输出被映射到一组字符A-Za-z0-9+/,编码不添加任何航标,输出的解码仅支持A-Za-z0-9+/
* etc:runoob?java8 其中?可以转换为/
*
* @param encoderStr 字符串,默认UTF-8
* @return 编码后的字符串
*/
public static String encoder(String encoderStr) {
return encoder(encoderStr, CharsetUtils.UTF_8);
}
/**
* 字符串编码
* Basic编码:输出被映射到一组字符A-Za-z0-9+/,编码不添加任何航标,输出的解码仅支持A-Za-z0-9+/
* etc:runoob?java8 其中?可以转换为/
*
* @param encoderStr 字符串
* @param charset 字符编码类型
* @return 编码后的字符串
*/
public static String encoder(String encoderStr, String charset) {
try {
if (StringUtils.isEmpty(encoderStr)) {
throw new BusinessException(AppHttpStatus.NULL_POINTER_EXCEPTION.getStatus(), "编码字符串不可以为空");
}
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
return Base64.getEncoder().encodeToString(encoderStr.getBytes(charset));
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* 字符串解码
* Basic编码:输出被映射到一组字符A-Za-z0-9+/,编码不添加任何航标,输出的解码仅支持A-Za-z0-9+/
* etc:runoob?java8 其中?可以转换为/
*
* @param decoderStr 字符串
* @return 解码后的字符串
*/
public static String decoder(String decoderStr) {
return decoder(decoderStr, CharsetUtils.UTF_8);
}
/**
* 字符串解码
* Basic编码:输出被映射到一组字符A-Za-z0-9+/,编码不添加任何航标,输出的解码仅支持A-Za-z0-9+/
* etc:runoob?java8 其中?可以转换为/
*
* @param decoderStr 字符串
* @param charset 编码方式
* @return 解码后的字符串
*/
public static String decoder(String decoderStr, String charset) {
try {
if (StringUtils.isEmpty(decoderStr)) {
throw new BusinessException(AppHttpStatus.NULL_POINTER_EXCEPTION.getStatus(), "解码字符串不可以为空");
}
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
return new String(Base64.getDecoder().decode(decoderStr), charset);
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* URL编码:输出映射到一组字符A-Za-z0-9+_,输出的是URL和文件
* etc:runoob?java8 其中?可以转换为_ ;对URL参数友好
*
* @param encoderStr 编码字符串,默认UTF-8
* @return 编码后的字符串
*/
public static String urlEncoder(String encoderStr) {
return urlEncoder(encoderStr, CharsetUtils.UTF_8);
}
/**
* URL编码:输出映射到一组字符A-Za-z0-9+_,输出的是URL和文件
* etc:runoob?java8 其中?可以转换为_ ;对URL参数友好
*
* @param encoderStr 编码字符串
* @param charset 编码方式
* @return 编码后的字符串
*/
public static String urlEncoder(String encoderStr, String charset) {
try {
if (StringUtils.isEmpty(encoderStr)) {
throw new BusinessException(AppHttpStatus.NULL_POINTER_EXCEPTION.getStatus(), "编码字符串不可以为空");
}
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
return Base64.getUrlEncoder().encodeToString(encoderStr.getBytes(charset));
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* URL解码:输出映射到一组字符A-Za-z0-9+_,输出的是URL和文件
* etc:runoob?java8 其中?可以转换为_ ;对URL参数友好
*
* @param decoderStr 解码字符串
* @return 解码后的字符串
*/
public static String urlDecoder(String decoderStr) {
return urlDecoder(decoderStr, CharsetUtils.UTF_8);
}
/**
* URL解码:输出映射到一组字符A-Za-z0-9+_,输出的是URL和文件
* etc:runoob?java8 其中?可以转换为_ ;对URL参数友好
*
* @param decoderStr 解码字符串
* @param charset 解码方式
* @return 解码后的字符串
*/
public static String urlDecoder(String decoderStr, String charset) {
try {
if (StringUtils.isEmpty(decoderStr)) {
throw new BusinessException(AppHttpStatus.NULL_POINTER_EXCEPTION.getStatus(), "解码字符串不可以为空");
}
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
return new String(Base64.getUrlDecoder().decode(decoderStr), charset);
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* MIME编码:输出映射到MIME(Multipurpose Internet Mail Extensions-多用途互联网邮件扩展类型)友好格式,输出每行不超过76个字符,并使用'\r\n'作为分隔符;
* 编码输出最后没有行分割
*
* @param encoderStr 编码字符串
* @return 编码后的字符串
*/
public static String mineEncoder(String encoderStr) {
return mineEncoder(encoderStr, CharsetUtils.UTF_8);
}
/**
* MIME编码:输出映射到MIME(Multipurpose Internet Mail Extensions-多用途互联网邮件扩展类型)友好格式,输出每行不超过76个字符,并使用'\r\n'作为分隔符;
* 编码输出最后没有行分割
*
* @param encoderStr 编码字符串
* @param charset 编码类型
* @return 编码后的字符串
*/
public static String mineEncoder(String encoderStr, String charset) {
try {
if (StringUtils.isEmpty(encoderStr)) {
throw new BusinessException(AppHttpStatus.NULL_POINTER_EXCEPTION.getStatus(), "编码字符串不可以为空");
}
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
return Base64.getMimeEncoder().encodeToString(encoderStr.getBytes(charset));
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* MIME编码:使用Base编码模式,输出映射到MIME(Multipurpose Internet Mail Extensions-多用途互联网邮件扩展类型)友好格式,输出每行不超过76个字符,并使用'\r\n'作为分隔符;
* 编码输出最后没有行分割
*
* @param decoderStr 解码字符串
* @return 解码后的字符串
*/
public static String mineDecoder(String decoderStr) {
return mineDecoder(decoderStr, CharsetUtils.UTF_8);
}
/**
* MIME编码:使用Base编码模式,输出映射到MIME(Multipurpose Internet Mail Extensions-多用途互联网邮件扩展类型)友好格式,输出每行不超过76个字符,并使用'\r\n'作为分隔符;
* 编码输出最后没有行分割
*
* @param decoderStr 解码字符串
* @param charset 字符编码
* @return 解码后的字符串
*/
public static String mineDecoder(String decoderStr, String charset) {
try {
if (StringUtils.isEmpty(decoderStr)) {
throw new BusinessException(AppHttpStatus.NULL_POINTER_EXCEPTION.getStatus(), "解码字符串不可以为空");
}
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
return new String(Base64.getMimeDecoder().decode(decoderStr), charset);
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* Base编码,将指定的字符串使用base64编码存入指定的文件
*
* @param filePath 指定文件路径
* @param encoderStr 编码字符串
* @param charset 字符编码
*/
public static void encoderWrap(String filePath, String encoderStr, String charset) {
try {
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
OutputStream os = Base64.getEncoder().wrap(new FileOutputStream(new File(filePath)));
IOUtils.write(encoderStr.getBytes(charset), os);
} catch (FileNotFoundException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION.getStatus(), StringUtils.join("指定路径", filePath, "的文件不存在," + e));
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* Base编码,将指定文件的内容解码为字符串
*
* @param filePath 指定文件路径
* @param charset 字符编码
* @return 解码后的字符串
*/
public static String decoderWrap(String filePath, String charset) {
try {
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
InputStream is = Base64.getDecoder().wrap(new FileInputStream(new File(filePath)));
return IOUtils.toString(is, charset);
} catch (FileNotFoundException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION.getStatus(), StringUtils.join("指定路径", filePath, "的文件不存在," + e));
}
}
/**
* URL编码,将指定的字符串使用base64编码存入指定的文件
*
* @param filePath 指定文件路径
* @param encoderStr 编码字符串
* @param charset 字符编码
*/
public static void urlEncoderWrap(String filePath, String encoderStr, String charset) {
try {
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
OutputStream os = Base64.getUrlEncoder().wrap(new FileOutputStream(new File(filePath)));
IOUtils.write(encoderStr.getBytes(charset), os);
} catch (FileNotFoundException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION.getStatus(), StringUtils.join("指定路径", filePath, "的文件不存在," + e));
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* URL编码,将指定文件的内容解码为字符串
*
* @param filePath 指定文件路径
* @param charset 字符编码
* @return 解码后的字符串
*/
public static String urlDecoderWrap(String filePath, String charset) {
try {
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
InputStream is = Base64.getUrlDecoder().wrap(new FileInputStream(new File(filePath)));
return IOUtils.toString(is, charset);
} catch (FileNotFoundException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION.getStatus(), StringUtils.join("指定路径", filePath, "的文件不存在," + e));
}
}
/**
* MINE编码,将指定的字符串使用base64编码存入指定的文件
*
* @param filePath 指定文件路径
* @param encoderStr 编码字符串
* @param charset 字符编码
*/
public static void mineEncoderWrap(String filePath, String encoderStr, String charset) {
try {
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
OutputStream os = Base64.getMimeEncoder().wrap(new FileOutputStream(new File(filePath)));
IOUtils.write(encoderStr.getBytes(charset), os);
} catch (FileNotFoundException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION.getStatus(), StringUtils.join("指定路径", filePath, "的文件不存在," + e));
} catch (UnsupportedEncodingException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
/**
* MINE编码,将指定文件的内容解码为字符串
*
* @param filePath 指定文件路径
* @param charset 字符编码
* @return 解码后的字符串
*/
public static String mineDecoderWrap(String filePath, String charset) {
try {
if (StringUtils.isEmpty(charset)) {
charset = CharsetUtils.UTF_8;
}
InputStream is = Base64.getMimeDecoder().wrap(new FileInputStream(new File(filePath)));
return IOUtils.toString(is, charset);
} catch (FileNotFoundException e) {
throw new BusinessException(AppHttpStatus.ILLEGAL_ARGUMENT_EXCEPTION.getStatus(), StringUtils.join("指定路径", filePath, "的文件不存在," + e));
}
}
}
|
package com.mango.leo.zsproject.eventexhibition.model;
import android.content.Context;
import com.mango.leo.zsproject.eventexhibition.listener.OnEventListener;
import com.mango.leo.zsproject.industrialservice.createrequirements.carditems.listener.OnUpdateItemListener;
/**
* Created by admin on 2018/5/22.
*/
public interface EventModel {
void visitEventItem(Context context, int type, String url, OnEventListener listener);
}
|
package com.wyt.learn.test.base.data;
/**
* @Author: LL
* @Description:
* @Date:Create:in 2021/2/2 16:17
*/
public class Student {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
/**
* Data Transfer Objects.
*/
package tech.jhipster.vuejs.demo.service.dto;
|
package com.creativewidgetworks.goldparser.simplepy.rulehandlers;
import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;
import com.creativewidgetworks.goldparser.simplepy.Py;
@ProcessRule(rule = {
"<Statement> ::= if <Expression> : <StatementOrBlock>",
"<Statement> ::= else : <StatementOrBlock>"
})
public class IfThenElse extends Reduction {
private Reduction conditional;
private Reduction thenStatements;
private Reduction elseStatements;
public IfThenElse(GOLDParser parser) {
Reduction reduction = parser.getCurrentReduction();
if (reduction != null) {
if (reduction.size() == 4) {
// if x then y
conditional = reduction.get(1).asReduction();
thenStatements = reduction.get(3).asReduction();
} else if (reduction.size() == 3) {
// else x
conditional = reduction.get(0).asReduction();
thenStatements = reduction.get(2).asReduction();
elseStatements = reduction.get(2).asReduction();
} else {
if (reduction.size() < 5) {
// if x then y form
parser.raiseParserException(Py.formatMessage("error.param_count", "5", String.valueOf(reduction.size())));
}
// if x then y else z end form
parser.raiseParserException(Py.formatMessage("error.param_count", "7", String.valueOf(reduction.size())));
}
} else {
parser.raiseParserException(Py.formatMessage("error.no_reduction"));
}
}
@Override
public void execute() throws ParserException {
if (conditional.getValue().asBool()) {
thenStatements.execute();
} else if (elseStatements != null) {
elseStatements.execute();
}
}
}
|
package tc.selenium.utils;
import tc.selenium.views.FileUploadView;
import tc.selenium.views.FormView;
import tc.selenium.views.SummaryView;
import tc.selenium.views.UploadedView;
/**
* Actions that can be performed on available views.
*
* @author sian.webster
*/
public class Navigation {
/**
* Selenium web driver
*/
protected BrowserDriver browserDriver;
/**
* Contains actions which can be performed on the form view
*/
protected FormView formView;
/**
* Contains actions which can be performed on the summary view
*/
protected SummaryView summaryView;
/**
* Contains actions which can be performed on the file upload view
*/
protected FileUploadView fileUploadView;
/**
* Contains actions which can be performed on the uploaded view
*/
protected UploadedView uploadedView;
/**
* Uses given web driver to initialise form view and summary view and create Navigation object.
* @param browserDriver
*/
public Navigation(BrowserDriver browserDriver) {
this.browserDriver = browserDriver;
formView = new FormView(browserDriver);
summaryView = new SummaryView(browserDriver);
fileUploadView = new FileUploadView(browserDriver);
uploadedView = new UploadedView(browserDriver);
}
/**
* Upload a file
* @param filePath
*/
public void uploadFile(String filePath) {
fileUploadView.uploadFile(filePath);
fileUploadView.submit();
}
/**
* Assert upload displays correct screen
*/
public void uploadedScreenIsShown(UploadedView.UploadResponse resp) {
switch (resp) {
case SUCCESS:
uploadedView.assertResponse(UploadedView.UploadResponse.SUCCESS);
uploadedView.assertNoError();
break;
case FAILURE:
uploadedView.assertResponse(UploadedView.UploadResponse.FAILURE);
uploadedView.assertError("Error message: Uploaded file was not an image");
break;
}
}
/**
* Complete all fields in form with given input
* @param name
* @param age
* @param gender
* @param height
* @param confirmed
*/
public void enterFormDetails(String name, int age, String gender, String height, boolean confirmed) {
formView.setName(name);
formView.setAge(age);
formView.setGender(gender);
formView.setHeight(height);
formView.setConfirmed(confirmed);
}
/**
* Submit the form
*/
public void submitForm() {
formView.submitForm();
}
/**
* Assert that the summary screen is displayed and the values on the screen are as expected
*
* @param name
* @param age
* @param gender
* @param height
* @param confirmed
*/
public void summaryScreenIsShown(String name, int age, String gender, String height, boolean confirmed) {
summaryView.isDisplayedCheck();
summaryView.assertAllValues(name, convertAge(age), gender, Double.parseDouble(height), confirmed);
}
/**
* Navigates to a given URL
*
* @param url
*/
public void loadPage(String url) {
browserDriver.getCurrentDriver().get(url);
}
/**
* Convert given age to expected age
* @param age
* @return expectedAge
*/
private int convertAge(int age) {
if (age>30) {
return 70;
} else if (age<18) {
return 10;
} else {
return 25;
}
}
}
|
package de.hexagonsoftware.sbec;
import java.net.SocketAddress;
import java.util.ArrayList;
public class User {
public SocketAddress ASSOCIATED_CLIENT;
public ArrayList<String> MESSAGE_HISTORY;
public String NAME;
}
|
// Kufas.ru 6.1.1.8
package hw.gorovtsov.mathtesting.tasks;
import hw.gorovtsov.mathtesting.input.NumSetTwo;
public class Eight {
public static void main(String[] args) {
double x;
double y;
double[] vars = new double[2];
double rez;
NumSetTwo s = new NumSetTwo();
vars = s.go();
x = vars[0];
y = vars[1];
rez = Math.pow((1 - Math.tan(x)), 1/Math.tan(x)) + Math.cos(x-y);
System.out.println("Result: " + rez);
}
}
|
package ru.android.messenger.view.notifications;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.support.v4.app.NotificationCompat;
import java.util.Calendar;
import ru.android.messenger.R;
import ru.android.messenger.model.dto.Message;
import ru.android.messenger.model.dto.User;
import ru.android.messenger.view.activity.DialogActivity;
import ru.android.messenger.view.utils.ViewUtils;
public class Notifications {
private static final String ADD_FRIEND_MESSAGE = "addFriend";
private static final String CANCEL_ADD_FRIEND_MESSAGE = "cancelAddFriend";
private static final int NEW_MESSAGE_NOTIFICATION_ID = 0;
private static final int NEW_FRIEND_REQUEST_NOTIFICATION_ID = 1;
private static final int ACCEPT_FRIEND_REQUEST_NOTIFICATION_ID = 2;
private static final int ADD_FRIEND_REQUEST_CODE = 0;
private static final int CANCEL_ADD_FRIEND_REQUEST_CODE = 1;
private Notifications() {
}
public static void showNewMessageNotification(Context context, Message message, Bitmap image) {
String notificationImageText = context.getString(R.string.notification_image_body);
User sender = message.getUser();
String userLogin = message.getUser().getLogin();
String title = sender.getFirstName() + " " + sender.getSurname();
String content = message.isPhoto() ? notificationImageText : message.getText();
NotificationCompat.Builder builder =
createDefaultNotificationBuilder(context, title, content, image);
builder.setContentIntent(createMessageContentIntent(context, userLogin));
buildNotificationAndSendToUser(builder, context, NEW_MESSAGE_NOTIFICATION_ID);
}
public static void showNewFriendNotification(Context context, User user, Bitmap image) {
String title = context.getString(R.string.notification_new_friend_title);
String userName = user.getFirstName() + " " + user.getSurname();
String content = userName + " " + context.getString(R.string.notification_new_friend_body);
String firstName = user.getFirstName();
String surname = user.getSurname();
String userLogin = user.getLogin();
String buttonAddText = context.getString(R.string.notification_button_add_text);
String buttonCancelText = context.getString(R.string.notification_button_cancel_text);
NotificationCompat.Builder builder =
createDefaultNotificationBuilder(context, title, content, image);
builder.addAction(R.drawable.button_done, buttonAddText,
createAddFriendActionIntent(context, userLogin,
ADD_FRIEND_MESSAGE, ADD_FRIEND_REQUEST_CODE));
builder.addAction(R.drawable.button_cancel, buttonCancelText,
createAddFriendActionIntent(context, userLogin,
CANCEL_ADD_FRIEND_MESSAGE, CANCEL_ADD_FRIEND_REQUEST_CODE));
builder.setContentIntent(createUserInfoContentIntent(
context, firstName, surname, userLogin, image));
buildNotificationAndSendToUser(builder, context, NEW_FRIEND_REQUEST_NOTIFICATION_ID);
}
public static void showAcceptFriendRequestNotification(Context context, User user, Bitmap image) {
String title = context.getString(R.string.notification_accept_friend_request_title);
String userName = user.getFirstName() + " " + user.getSurname();
String content = userName + " " +
context.getString(R.string.notification_accept_friend_request_body);
String firstName = user.getFirstName();
String surname = user.getSurname();
String userLogin = user.getLogin();
NotificationCompat.Builder builder =
createDefaultNotificationBuilder(context, title, content, image);
builder.setContentIntent(createUserInfoContentIntent(
context, firstName, surname, userLogin, image));
buildNotificationAndSendToUser(builder, context, ACCEPT_FRIEND_REQUEST_NOTIFICATION_ID);
}
private static NotificationCompat.Builder createDefaultNotificationBuilder(
Context context, String title, String content, Bitmap image) {
return new NotificationCompat.Builder(
context, NotificationChannels.getMessengerNotificationChannelId())
.setSmallIcon(R.drawable.logo_small)
.setLargeIcon(image)
.setContentTitle(title)
.setContentText(content)
.setWhen(Calendar.getInstance().getTimeInMillis())
.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setAutoCancel(true)
.setStyle(new NotificationCompat.BigTextStyle().bigText(content));
}
private static void buildNotificationAndSendToUser(
NotificationCompat.Builder builder, Context context, int notificationId) {
Notification notification = builder.build();
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notification);
}
private static PendingIntent createAddFriendActionIntent(
Context context, String userLogin, String message, int requestCode) {
Intent addFriendIntent = new Intent(context, NotificationReceiver.class);
addFriendIntent.putExtra("message", message);
addFriendIntent.putExtra("user_login", userLogin);
return PendingIntent.getBroadcast(context,
requestCode, addFriendIntent, PendingIntent.FLAG_UPDATE_CURRENT);
}
private static PendingIntent createUserInfoContentIntent(
Context context, String firstName, String surname, String login, Bitmap photo) {
Intent intent = ViewUtils.getUserInfoIntent(context, firstName, surname, login, photo);
return PendingIntent.getActivity(context,
0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
private static PendingIntent createMessageContentIntent(Context context, String userLogin) {
Intent intent = new Intent(context, DialogActivity.class);
intent.putExtra("user_login", userLogin);
return PendingIntent.getActivity(context,
0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
}
|
package com.gunjun.android.alarm_app;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by gunjunLee on 2017-01-23.
*/
public class viewHolder extends RecyclerView.ViewHolder{
@BindView(R.id.repo_id) TextView repoId;
@BindView(R.id.repo_name) TextView repoName;
@BindView(R.id.owner_url) TextView ownerUrl;
@BindView(R.id.owner_html_url) TextView ownerHtmlUrl;
public viewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
|
package com.microsilver.mrcard.basicservice.model;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class FxSdUserPreReg {
private String mobile;
private Long id;
private Boolean type;
private String refereeId;
private Short status;
private BigDecimal amount;
} |
package com.tencent.mm.plugin.honey_pay.ui;
import android.view.View;
import android.view.View.OnClickListener;
import com.tencent.mm.sdk.platformtools.x;
class HoneyPayCardManagerUI$4 implements OnClickListener {
final /* synthetic */ HoneyPayCardManagerUI kkT;
HoneyPayCardManagerUI$4(HoneyPayCardManagerUI honeyPayCardManagerUI) {
this.kkT = honeyPayCardManagerUI;
}
public final void onClick(View view) {
x.d(this.kkT.TAG, "click pay way");
HoneyPayCardManagerUI.f(this.kkT);
}
}
|
package org.campustalk.util;
import java.util.Properties;
import java.util.UUID;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.apache.commons.mail.SimpleEmail;
public class OtherUtil
{
final static public String getRandomeString()
{
String uuid = (UUID.randomUUID().toString() + UUID.randomUUID()
.toString());
uuid = uuid.replace("-", "").replace(" ", "");
System.out.println(uuid);
return uuid;
}
final static public boolean sendEmail(String toEmail, String emailSubject,
String emailMessage) throws AddressException, MessagingException
{
String[] to = new String[1];
to[0] = toEmail;
return sendEmail(to, emailMessage, emailMessage);
}
final static public boolean sendEmail(String[] toEmail,
String emailSubject, String emailMessage) throws AddressException,
MessagingException
{
String host = "smtp.gmail.com";
String from = "betacampustalk";
String pass = "campustalk123a!";
Properties props = System.getProperties();
props.put("mail.smtp.starttls.enable", "true"); // added this line
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", from);
props.put("mail.smtp.password", pass);
props.put("mail.smtp.port", "587");
props.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
InternetAddress[] toAddress = new InternetAddress[toEmail.length];
// To get the array of addresses
for (int i = 0; i < toEmail.length; i++)
{ // changed from a while loop
toAddress[i] = new InternetAddress(toEmail[i]);
}
System.out.println(Message.RecipientType.TO);
for (int i = 0; i < toAddress.length; i++)
{ // changed from a while
// loop
message.addRecipient(Message.RecipientType.TO, toAddress[i]);
}
message.setSubject(emailSubject);
message.setContent(emailMessage, "text/html");
Transport transport = session.getTransport("smtp");
transport.connect(host, from, pass);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
return true;
}
public static boolean SendEmailNew(String toAddress, String subject,
String msgBody)
{
boolean result;
try
{
SimpleEmail email = new SimpleEmail();
email.setAuthentication("betacampustalk@gmail.com",
"campustalk123a!");
email.setHostName("smtp.gmail.com");
email.setSmtpPort(465);
email.setSSL(true);
email.addTo(toAddress, "");
email.setFrom("betacampustalk@gmail.com", "noreply");
email.setSubject(subject);
email.setMsg(msgBody);
email.send();
result = true;
}
catch (Exception e)
{
e.printStackTrace();
result = false;
}
return result;
}
}
|
package pms.dto;
public class Gantt {
private int id;
private String start_date;
private String end_date;
private String title;
private String text;
private int priority;
private float progress;
private int sortorder;
private int parent;
private String holder;
private String status;
public Gantt() {
super();
// TODO Auto-generated constructor stub
}
public Gantt(int id, String start_date, String end_date, String title, String text, int priority, float progress,
int sortorder, int parent, String holder, String status) {
super();
this.id = id;
this.start_date = start_date;
this.end_date = end_date;
this.title = title;
this.text = text;
this.priority = priority;
this.progress = progress;
this.sortorder = sortorder;
this.parent = parent;
this.holder = holder;
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getStart_date() {
return start_date;
}
public void setStart_date(String start_date) {
this.start_date = start_date;
}
public String getEnd_date() {
return end_date;
}
public void setEnd_date(String end_date) {
this.end_date = end_date;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public float getProgress() {
return progress;
}
public void setProgress(float progress) {
this.progress = progress;
}
public int getSortorder() {
return sortorder;
}
public void setSortorder(int sortorder) {
this.sortorder = sortorder;
}
public int getParent() {
return parent;
}
public void setParent(int parent) {
this.parent = parent;
}
public String getHolder() {
return holder;
}
public void setHolder(String holder) {
this.holder = holder;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
} |
package br.com.cem01.service;
import java.util.List;
import javax.net.ssl.SSLEngineResult.Status;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
//import javax.validation.ConstraintViolationException;
import javax.persistence.PersistenceException;
import org.hibernate.exception.ConstraintViolationException;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.Response;
import org.hibernate.QueryException;
import br.com.cem01.EntityManager.JpaEntityManager;
import br.com.cem01.model.DisciplineModel;
@Path("/discipline")
public class DisciplineService {
private JpaEntityManager JPAEM = new JpaEntityManager();
private EntityManager objEM = JPAEM.getEntityManager();
@POST
@Path("/cadastrar")
@Consumes("application/json")
public Response cadastrar(DisciplineModel objDiscipline) {
try {
objEM.getTransaction().begin();
objEM.persist(objDiscipline);
objEM.getTransaction().commit();
objEM.close();
return Response.status(200).entity("cadastro realizado.").build();
} catch (PersistenceException e) {
String msgError = e.getCause().getMessage();
objEM.close();
return Response.serverError().status(javax.ws.rs.core.Response.Status.NOT_ACCEPTABLE).entity(msgError).build();
}
}
// @POST
// @Path("/cadastrar")
// @Consumes("application/json")
// public Response cadastrar(DisciplineModel objDiscipline) {
// try {
//// String code1 = objDiscipline.getCode();
//// String query = "select p from DisciplineModel p where p.code = " + code1;
////
//// // IllegalArgumentException
//// TypedQuery<DisciplineModel> discipline = objEM.createQuery(query, DisciplineModel.class);
////
//// try {
//// discipline.getSingleResult().getCode();
//// System.out.println("Achou!");
//// return Response.serverError().status(javax.ws.rs.core.Response.Status.BAD_REQUEST).entity("Disciplina ja cadastrada.").build();
//// } catch (NoResultException e) {
// objEM.getTransaction().begin();
// objEM.persist(objDiscipline);
// objEM.getTransaction().commit();
// objEM.close();
//
// System.out.println("N achou!");
// return Response.status(200).entity("cadastro realizado.").build();
//// }
//
//// CriteriaBuilder cb = objEM.getCriteriaBuilder();
//// CriteriaQuery<DisciplineModel> cq = cb.createQuery(DisciplineModel.class);
//// Root<DisciplineModel> from = cq.from(DisciplineModel.class);
//// cq.select(DisciplineModel);
//// Predicate eq2 = cb.equal(code, 35628);
////
// } catch (PersistenceException e) {
//// throw new ConstraintViolationException(e);
// String msgError = e.getCause().getMessage();
// objEM.close();
// return Response.serverError().status(javax.ws.rs.core.Response.Status.BAD_REQUEST).entity(msgError).build();
// }
// }
@GET
@Path("listar")
@Produces("application/json")
public List<DisciplineModel> listar() {
try {
String query = "select c from DisciplineModel c";
List<DisciplineModel> alunos = objEM.createQuery(query, DisciplineModel.class).getResultList();
objEM.close();
return alunos;
} catch (Exception e) {
throw new QueryException(e);
}
}
// @GET
// @Path("listar2")
// @Produces("application/json")
// public Response listar2() {
// try {
// String query = "select c from DisciplineModel c";
// List<DisciplineModel> alunos = objEM.createQuery(query, DisciplineModel.class).getResultList();
// GenericEntity<List<DisciplineModel>> entity = new GenericEntity<List<DisciplineModel>>(alunos){};
// objEM.close();
// return Response.ok(entity).build();
// } catch (Exception e) {
// throw new WebApplicationException(500);
// }
// }
}
|
package com.spring.dao;
import com.spring.dto.ShopMemberDTO;
public interface MemberDAO {
//로그인 체크
public ShopMemberDTO Login(String userid);
//회원가입
public int insert(ShopMemberDTO dto);
//한건 조회
public ShopMemberDTO selectOne(String userid);
//수정
public int update(ShopMemberDTO dto);
}
|
package com.tencent.mm.plugin.ipcall.ui;
import android.view.View;
import android.view.View.OnClickListener;
import com.tencent.mm.plugin.ipcall.ui.IPCallRechargeUI.a;
class IPCallRechargeUI$a$1 implements OnClickListener {
final /* synthetic */ a kxF;
IPCallRechargeUI$a$1(a aVar) {
this.kxF = aVar;
}
public final void onClick(View view) {
IPCallRechargeUI.b(a.a(this.kxF), ((Integer) view.getTag()).intValue());
}
}
|
package avgogen.javaast.run;
import avgogen.javaast.stats.SummaryStatisticsCollector;
import avgogen.javaast.util.filefinder.JavaFinder;
import avgogen.javaast.visitor.VisitorImpl;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Path;
import java.nio.file.Paths;
public class Main {
private static void getClasses(Path projectPath) {
new JavaFinder(path -> {
try {
CompilationUnit compilationUnit = JavaParser.parse(path);
compilationUnit.accept(new VisitorImpl(), null);
} catch (IOException ignored) {}
}, path -> path.toString().endsWith(".java")).iterate(projectPath);
try {
final PrintStream out = new PrintStream("summary.txt");
SummaryStatisticsCollector.summarize(out);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
SummaryStatisticsCollector summaryStatisticsCollector = new SummaryStatisticsCollector();
Path projectPath = Paths.get("src\\main\\java");
getClasses(projectPath);
}
}
|
package com.tencent.mm.plugin.sns.h;
import com.tencent.mm.modelsfs.FileOp;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.aa;
import com.tencent.mm.storage.c;
import com.tencent.mm.storage.w;
import java.util.HashMap;
import java.util.Map;
public final class d {
public static d nxJ = new d();
public w cXI;
public int dlT = 0;
public HashMap<String, Integer> nxK;
public HashMap<String, String> nxL;
public int nxM = 200;
public int nxN = 86400;
private d() {
c fJ = com.tencent.mm.model.c.c.Jx().fJ("100077");
if (fJ.isValid()) {
Map ckq = fJ.ckq();
this.nxM = bi.getInt((String) ckq.get("maxCacheFeedCount"), 200);
this.nxN = bi.getInt((String) ckq.get("maxCacheSeconds"), 86400);
this.dlT = bi.getInt((String) ckq.get("needUploadData"), 0);
}
x.i("MicroMsg.SnsReportHelper", "initAbtestArg maxCacheFeedCount:%d, maxCacheSeconds:%d, needUploadData:%d", new Object[]{Integer.valueOf(this.nxM), Integer.valueOf(this.nxN), Integer.valueOf(this.dlT)});
this.cXI = new w(aa.duN + "snsreport.cfg");
Object obj = this.cXI.get(3, new HashMap());
Object obj2 = this.cXI.get(4, new HashMap());
if ((obj instanceof HashMap) && (obj2 instanceof HashMap)) {
this.nxK = (HashMap) obj;
this.nxL = (HashMap) obj2;
return;
}
FileOp.deleteFile(aa.duN + "snsreport.cfg");
this.nxK = new HashMap();
this.nxL = new HashMap();
}
public final void MT(String str) {
if (this.dlT != 0) {
this.nxK.put(str, Integer.valueOf(this.nxK.containsKey(str) ? ((Integer) this.nxK.get(str)).intValue() + 1 : 1));
}
}
public final void eF(String str, String str2) {
if (this.dlT != 0 && !bi.oW(str) && !bi.oW(str2)) {
this.nxL.put(str, str2);
}
}
}
|
package jc.sugar.JiaHui.dao;
import jc.sugar.JiaHui.entity.SugarTestPlanFile;
/**
* @Code 谢良基 2021/7/19
*/
public interface SugarTestPlanFileDao {
Integer saveFile(SugarTestPlanFile file) throws Exception;
Integer deleteFile(Integer id) throws Exception;
}
|
package io.peppermint100.server.entity;
import io.peppermint100.server.entity.item.MachineType;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
@Data
@NoArgsConstructor
@DiscriminatorValue("machine")
@Entity(name ="MACHINE_TABLE")
public class Machine extends Item {
@Enumerated(EnumType.STRING)
private MachineType machineType;
}
|
package com.javasongkb.changgou.mapper;
import com.javasongkb.changgou.model.OrderLog;
public interface OrderLogMapper {
int deleteByPrimaryKey(String id);
int insert(OrderLog record);
int insertSelective(OrderLog record);
OrderLog selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(OrderLog record);
int updateByPrimaryKey(OrderLog record);
} |
package com.argentinatecno.checkmanager.main.fragment_reports;
public interface FragmentReportRepository {
void getMaturitiesWeek(String date);
}
|
package com.aries.orion.controller;
import com.alibaba.fastjson.JSON;
import com.aries.orion.constants.SystemStatus;
import com.aries.orion.model.HttpResponse;
import com.aries.orion.model.po.Category;
import com.aries.orion.model.po.Question;
import com.aries.orion.model.vo.QuestionVO;
import com.aries.orion.model.vo.UserRankVO;
import com.aries.orion.service.QuestionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
@Controller
@Slf4j
@RequestMapping("/questions")
public class QuestionController {
@Resource
private QuestionService questionService;
@GetMapping("/list")
public ModelAndView list(@RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
List<QuestionVO> questionList = questionService.getQuestionList(page, pageSize);
List<Category> categoryList = questionService.getCategoryList();
ModelAndView modelAndView = new ModelAndView("questions");
modelAndView.addObject("questionvolist", questionList);
modelAndView.addObject("categoryList", categoryList);
return modelAndView;
}
@GetMapping("/count")
@ResponseBody
public Integer count() {
Integer questionCount = questionService.getQuestionCount();
if (questionCount <= 0) {
log.warn("查询题目总数操作失败,返回异常count:{}", questionCount);
return 0;
}
return questionCount;
}
@GetMapping("/getQuestion")
public ModelAndView getQuestionByCategoryId(@RequestParam("categoryId") Integer categoryId) {
List<QuestionVO> questionList = questionService.getQuestionByCategoryId(categoryId);
List<Category> categoryList = questionService.getCategoryList();
ModelAndView modelAndView = new ModelAndView("questions");
modelAndView.addObject("questionvolist", questionList);
modelAndView.addObject("categoryList", categoryList);
return modelAndView;
}
@GetMapping("/ranking")
public ModelAndView ranking() {
List<UserRankVO> userRankVOList = questionService.getRanking();
ModelAndView modelAndView = new ModelAndView("ranking");
modelAndView.addObject("ranklist", userRankVOList);
return modelAndView;
}
@PostMapping("/upload")
public String upload(@RequestBody Question question) {
System.out.println(JSON.toJSONString(question));
int id = questionService.upload(question);
log.info("上传题目成功,题号:{}", id);
return "upload";
}
@GetMapping("/upload/detail")
public ModelAndView uploadT() {
List<Category> categoryList = questionService.selectAllCategory();
ModelAndView modelAndView = new ModelAndView("upload");
modelAndView.addObject("categorylist", categoryList);
return modelAndView;
}
@GetMapping("/detail/{id}")
public ModelAndView questiondetail(@PathVariable("id") Long id) {
Question question = questionService.selectQuestionByPrimary(id);
ModelAndView modelAndView = new ModelAndView("question-detail");
modelAndView.addObject("question", question);
return modelAndView;
}
@PostMapping("/exercise")
@ResponseBody
public String doExercise(@RequestBody Question question) {
if (question.getId() == null || question.getType() == null) {
return HttpResponse.of(SystemStatus.PARAM_NULL);
}
String response = questionService.doExercise(question);
return response;
}
}
|
package com.jk.jkproject.ui.widget;
import android.content.Context;
import androidx.appcompat.widget.AppCompatEditText;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
/**
*@params
*@date 2020/10/28 3:50 PM
*@author Zick
*@desc 只支持输入汉字,字母、数字的编辑框,不支持输入特殊字符和空格
*/
public class CustomEditText extends AppCompatEditText {
public CustomEditText(Context context) {
super(context);
}
public CustomEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomEditText(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
return new mInputConnection(super.onCreateInputConnection(outAttrs), false);
}
class mInputConnection extends InputConnectionWrapper implements InputConnection {
public mInputConnection(InputConnection target, boolean mutable) {
super(target, mutable);
}
//拦截内容
@Override
public boolean commitText(CharSequence text, int newCursorPosition) {
// 只能输入汉字或者英文
if (!text.toString().matches("[\u4e00-\u9fa5]+") && !text.toString().matches("[a-zA-Z0-9 /]+")) {
return false;
}
return super.commitText(text, newCursorPosition);
}
@Override
public boolean sendKeyEvent(KeyEvent event) {
return super.sendKeyEvent(event);
}
@Override
public boolean setSelection(int start, int end) {
return super.setSelection(start, end);
}
}
}
|
package fr.lteconsulting.commandes;
import fr.lteconsulting.ApplicationContext;
import fr.lteconsulting.ICommande;
public class QuitterCommande implements ICommande
{
@Override
public void executer( ApplicationContext contexte )
{
System.out.println( "Bye bye !" );
System.exit( 0 );
}
@Override
public String getTitre()
{
return "Quitter";
}
}
|
package de.neofonie.osm;
import de.neofonie.osm.reader.OsmReaderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
@Service
public class ImportApplication implements CommandLineRunner {
private static final Logger log = LoggerFactory.getLogger(ImportApplication.class);
@Autowired
private OsmReaderService osmReaderService;
@Override
public void run(String... args) throws Exception {
Arrays.asList(args)
.stream()
.filter(i -> i.startsWith("-importPbf="))
.map(i -> i.substring("-importPbf=".length()))
.findAny()
.ifPresent(f -> {
try {
osmReaderService.read(new File(f));
} catch (IOException e) {
throw new IllegalArgumentException("", e);
}
});
}
} |
package test;
import java.util.List;
import util.ParseMessage;
import util.StringComparison;
public class Test2 {
public static void main(String[] args) {
//String template = " 569ADE{0}_70796_244{1}_1: {2} times: r=0.{3}s u=0.1{4}s s=0{5}";
String template = " 569ADE{0}_70796_244{1}_1: {2} times: r={conn_times_r}s u=0.1{4}s s=0{5}";
String message = " 569ADE01_70796_2442_1: conn times: r=0.36s u=0.13s s=0.01s";
String templateAfterReplace = " 569ADE_70796_244_1: times: r=s u=0.1s s=0";
System.out.println(template);
System.out.println(templateAfterReplace);
System.out.println(StringComparison.computeDiff(template, templateAfterReplace));
//Pattern.compile(regex).matcher(str).replaceFirst(repl)
/*
System.out.println();
Pattern pattern = Pattern.compile("\\{\\w*\\}");
Matcher matcher = pattern.matcher(template);
if(matcher.find()){
System.out.println("matches");
System.out.println(matcher.group());
template = matcher.replaceFirst("");
}
System.out.println(template);
*/
List<String> placeholders = ParseMessage.getPlaceholders(template);
System.out.println(placeholders);
/*
Map<String,String> map = ParseMessage.parseMessageAgainstTemplate(message, template);
System.out.println(map);
*/
}
}
|
import java.util.HashMap;
import java.util.Scanner;
public class AddressBookMainClass {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//here hash map is used store string value from address book
HashMap<String, AddressBook> addressBookList = new HashMap<String, AddressBook>();
AddressBook familyAddressBook = new AddressBook();
AddressBook friendsAddressBook = new AddressBook();
addressBookList.put("Family", familyAddressBook);
addressBookList.put("Friends", friendsAddressBook);
while (true) {
System.out.println("1: for family \n" +
"2: for friend \n" +
"3: for terminate the program");
int selectedOption = scanner.nextInt();
if (selectedOption == 1) {
familyAddressBook.getUserChoice();
}
else if (selectedOption == 2) {
friendsAddressBook.getUserChoice();
}
else if(selectedOption == 3) {
break;
}
}
scanner.close();
}
} |
package com.test.sqlsession;
import com.test.config.Function;
import com.test.config.MapperBean;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author wyj
* @date 2018/10/20
*/
public class SimpleConfiguration {
private static ClassLoader loader = ClassLoader.getSystemClassLoader();
public Connection build(String resource) {
try {
InputStream stream = loader.getResourceAsStream(resource);
SAXReader reader = new SAXReader();
Document document = reader.read(stream);
Element root = document.getRootElement();
return evalDataSource(root);
} catch (Exception e) {
throw new RuntimeException("error occurs while evaling xml:" + resource);
}
}
private Connection evalDataSource(Element node) throws ClassNotFoundException {
if (!node.getName().equals("database")) {
throw new RuntimeException("root should be <database>");
}
String driverClassName = null;
String url = null;
String username = null;
String password = null;
for (Object item : node.elements("property")) {
Element element = (Element) item;
String value = getValue(element);
String name = element.attributeValue("name");
if (name == null || value == null) {
throw new RuntimeException("[database]: <property> unknown name");
}
switch (name) {
case "driverClassName":
driverClassName = value;
break;
case "url":
url = value;
break;
case "username":
username = value;
break;
case "password":
password = value;
break;
default:
throw new RuntimeException("[database]: <property> unknown name");
}
}
Class.forName(driverClassName);
Connection conn = null;
try {
conn = DriverManager.getConnection(url, username, password);
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
private String getValue(Element node) {
return node.hasContent() ? node.getText() : node.attributeValue("value");
}
@SuppressWarnings("rawTypes")
public MapperBean readMapper(String path) {
MapperBean mapperBean = new MapperBean();
try {
InputStream stream = loader.getResourceAsStream(path);
SAXReader reader = new SAXReader();
Document document = reader.read(stream);
Element root = document.getRootElement();
mapperBean.setInterfaceName(root.attributeValue("nameSpace").trim());
List<Function> list = new ArrayList<>();
for (Iterator rootIter = root.elementIterator(); rootIter.hasNext(); ) {
Function function = new Function();
Element element = (Element) rootIter.next();
String sqlType = element.getName().trim();
String funcName = element.attributeValue("id").trim();
String sql = element.getText().trim();
String resultType = element.attributeValue("resultType").trim();
function.setSqlType(sqlType);
function.setFuncName(funcName);
Object newInstance = null;
try {
newInstance = Class.forName(resultType).newInstance();
} catch (InstantiationException e1) {
e1.printStackTrace();
} catch (IllegalAccessException e2) {
e2.printStackTrace();
} catch (ClassNotFoundException e3) {
e3.printStackTrace();
}
function.setResultType(newInstance);
function.setSql(sql);
list.add(function);
}
mapperBean.setList(list);
} catch (DocumentException e) {
e.printStackTrace();
}
return mapperBean;
}
}
|
package com.walkerwang.algorithm.bigcompany;
import java.util.Scanner;
public class ScannerInstance {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String string;
while(in.hasNext()) {
string = in.nextLine();
System.out.println(string);
}
}
}
|
package klaicm.backlayer.tennisscores.repositories;
import klaicm.backlayer.tennisscores.model.ArchData;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Set;
@Repository
public interface ArchDataRepository extends CrudRepository<ArchData, Long> {
@Query("select ar from ArchData ar where ar.player.id = :playerId")
Set<ArchData> getArchDataByPlayerId(@Param("playerId") Long playerId);
}
|
import java.util.Stack;
/**
* 32. Longest Valid Parentheses
* hard
* 直接匹配计数要所有情况考虑到很麻烦,利用所有无法匹配的字符下标来反向求长度
*/
class Solution {
public int longestValidParentheses(String s) {
int n = s.length();
Stack<Integer> stack = new Stack<>();
for (int i = 0; i < n; i++) { // find all the indices of not match characters
if (s.charAt(i) == '(')
stack.push(i);
else if (!stack.isEmpty() && s.charAt(stack.peek()) == '(')
stack.pop();
else
stack.push(i);
}
if (stack.isEmpty()) // all match
return n;
int longest = 0, h = n;
while (!stack.isEmpty()) { // find longest range
int l = stack.pop();
longest = Math.max(longest, h - l - 1);
h = l;
}
return Math.max(h, longest);
}
public static void main(String[] args) {
Solution s = new Solution();
System.out.println(s.longestValidParentheses("(()"));
System.out.println(s.longestValidParentheses(")()())"));
System.out.println(s.longestValidParentheses("()(()"));
System.out.println(s.longestValidParentheses("())"));
}
} |
package com.linkan.githubtrendingrepos.ui.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.appcompat.widget.Toolbar;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import com.linkan.githubtrendingrepos.BR;
import com.linkan.githubtrendingrepos.R;
import com.linkan.githubtrendingrepos.ViewModelProviderFactory;
import com.linkan.githubtrendingrepos.base.BaseActivity;
import com.linkan.githubtrendingrepos.base.BaseRecyclerViewAdapter;
import com.linkan.githubtrendingrepos.base.ResourceType;
import com.linkan.githubtrendingrepos.data.model.db.TrendingRepo;
import com.linkan.githubtrendingrepos.data.model.other.Status;
import com.linkan.githubtrendingrepos.databinding.ActivityMainBinding;
import com.linkan.githubtrendingrepos.ui.adapter.TrendingRepoAdapter;
import java.util.List;
import javax.inject.Inject;
public class MainActivity extends BaseActivity<ActivityMainBinding, MainViewModel> implements View.OnClickListener, BaseRecyclerViewAdapter.BaseRecyclerViewAdapterListener {
private PopupWindow popupWindow;
@Inject
ViewModelProviderFactory mViewModelFactory;
private MainViewModel mMainViewModel;
@Inject
LinearLayoutManager mLayoutManager;
@Inject
TrendingRepoAdapter repoAdapter;
@Override
public int getLayoutId() {
return R.layout.activity_main;
}
@Override
protected Toolbar getSupportedToolbar() {
return getViewDataBinding().includedAppBar.toolbar;
}
@Override
public int getBindingVariable() {
return BR.viewModel;
}
@Override
public MainViewModel getViewModel() {
mMainViewModel = ViewModelProviders.of(this, mViewModelFactory).get(MainViewModel.class);
return mMainViewModel;
}
private void setCustomTitle() {
getViewDataBinding().includedAppBar.title.setText(getResources().getString(R.string.trending));
}
@Override
public void initOnCreate(@Nullable Bundle savedInstanceState) {
repoAdapter.setListener(this);
setStatusBarTranslucent();
setTitle("");
setCustomTitle();
createCustomOptionMenu();
//.. To Hide the home back button
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
}
// getViewModel().fetchFromCacheOrServer();
setUpRecyclerView();
subscribeToLiveData();
subscribeErrorLiveData();
getViewDataBinding().includedAppBar.imgOptionMenu.setOnClickListener(this);
}
private void subscribeToLiveData() {
getViewModel().getTrendingRepoLiveData().observe(this, new Observer<ResourceType<List<TrendingRepo>>>() {
@Override
public void onChanged(ResourceType<List<TrendingRepo>> listResourceType) {
switch (listResourceType.status){
case LOADING:
getViewModel().setIsLoading(true);
break;
case REFRESH:
getViewModel().setRefreshLoader(true);
break;
case SUCCESS:
getViewModel().setRepoObservableList(listResourceType.data);
getViewModel().setIsLoading(false);
getViewModel().setRefreshLoader(false);
break;
case ERROR:
repoAdapter.setRetryVisibility(true);
getViewModel().setIsLoading(false);
getViewModel().setRefreshLoader(false);
break;
}
}
});
}
@SuppressLint("WrongConstant")
private void setUpRecyclerView() {
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
getViewDataBinding().repoRecyclerView.setLayoutManager(mLayoutManager);
getViewDataBinding().repoRecyclerView.setItemAnimator(new DefaultItemAnimator());
getViewDataBinding().repoRecyclerView.setAdapter(repoAdapter);
}
private void createCustomOptionMenu() {
// inflate the layout of the popup window
LayoutInflater inflater = (LayoutInflater)
getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = inflater.inflate(R.layout.custom_option_menu, null);
// create the popup window
int width = LinearLayout.LayoutParams.WRAP_CONTENT;
int height = LinearLayout.LayoutParams.WRAP_CONTENT;
boolean focusable = true; // lets taps outside the popup also dismiss it
popupWindow = new PopupWindow(popupView, width, height, focusable);
popupView.findViewById(R.id.sort_by_stars).setOnClickListener(this);
popupView.findViewById(R.id.sort_by_name).setOnClickListener(this);
// dismiss the popup window when touched
popupView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// popupWindow.dismiss();
return true;
}
});
}
private void setStatusBarTranslucent() {
//make translucent statusBar on kitkat devices
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true);
}
if (Build.VERSION.SDK_INT >= 19) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
//make fully Android Transparent Status bar
if (Build.VERSION.SDK_INT >= 21) {
setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
public static void setWindowFlag(Activity activity, final int bits, boolean on) {
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.img_option_menu:
// show the popup window
// which view you pass in doesn't matter, it is only used for the window token
popupWindow.showAtLocation(getViewDataBinding().clRoot, Gravity.TOP | Gravity.END, 25, 200);
break;
case R.id.sort_by_stars:
repoAdapter.sortByStars();
break;
case R.id.sort_by_name:
repoAdapter.sortByName();
break;
}
}
@Override
public void onRetryClick() {
getViewModel().fetchFromCacheOrServer(false);
}
private void subscribeErrorLiveData() {
getViewModel().getErrorLiveData().observe(this, throwable -> {
super.handleError(throwable);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
repoAdapter.setRetryVisibility(true);
}
}, 100);
});
}
}
|
package com.spring.domain;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Blob;
import java.sql.SQLException;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.log4j.Logger;
@Entity
@Table(name="decline_transaction")
public class DeclineTransaction implements java.io.Serializable {
private static Logger logger = Logger.getLogger(DeclineTransaction.class);
/**
*
*/
private static final long serialVersionUID = -7810540152837494029L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
private String invoicenumber;
private String terminalid;
private String processingcode;
private String amount;
private Blob cardnumber;
private String cardholdername;
private String thedate;
private String thetime;
private String rrnnumber;
private String approvalcode;
private String bankterminalid;
private Blob expirydate;
private String messageid;
private String stanno;
private String invoiveorig;
private String rescode;
private String tanstype;
private String poscondcode;
private String posentmode;
private String transmissiondata;
private String merchanttype;
private String acqintid;
private String field48;
private String currencycode;
private String posdata;
private String networkdata;
private String bill_invoice_no;
private String theyear;
private String lender_name;
private String seller_name;
private Integer buyer_id;
private String buyer_name;
private Integer tenure_in_days;
private Long interest_rate;
private String skucode;
private String trans_source;
private String seller_invoice_number;
private String errorMessage;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getInvoicenumber() {
return invoicenumber;
}
public void setInvoicenumber(String invoicenumber) {
this.invoicenumber = invoicenumber;
}
public String getTerminalid() {
return terminalid;
}
public void setTerminalid(String terminalid) {
this.terminalid = terminalid;
}
public String getProcessingcode() {
return processingcode;
}
public void setProcessingcode(String processingcode) {
this.processingcode = processingcode;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getCardnumber() {
String blobString = "";
byte[] bdata;
try {
if(cardnumber != null){
bdata = cardnumber.getBytes(1, (int) cardnumber.length());
blobString += new String(bdata);
}
} catch (SQLException e) {
StringWriter stack = new StringWriter();
e.printStackTrace(new PrintWriter(stack));
logger.info("Caught exception; during action : " + stack.toString());
}
return blobString;
}
public void setCardnumber(Blob cardnumber) {
this.cardnumber = cardnumber;
}
public String getCardholdername() {
return cardholdername;
}
public void setCardholdername(String cardholdername) {
this.cardholdername = cardholdername;
}
public String getThedate() {
return thedate;
}
public void setThedate(String thedate) {
this.thedate = thedate;
}
public String getThetime() {
return thetime;
}
public void setThetime(String thetime) {
this.thetime = thetime;
}
public String getRrnnumber() {
return rrnnumber;
}
public void setRrnnumber(String rrnnumber) {
this.rrnnumber = rrnnumber;
}
public String getApprovalcode() {
return approvalcode;
}
public void setApprovalcode(String approvalcode) {
this.approvalcode = approvalcode;
}
public String getBankterminalid() {
return bankterminalid;
}
public void setBankterminalid(String bankterminalid) {
this.bankterminalid = bankterminalid;
}
public String getExpirydate() {
String blobString = "";
byte[] bdata;
try {
if(expirydate != null){
bdata = expirydate.getBytes(1, (int) expirydate.length());
blobString += new String(bdata);
}
} catch (SQLException e) {
StringWriter stack = new StringWriter();
e.printStackTrace(new PrintWriter(stack));
logger.info("Caught exception; during action : " + stack.toString());
}
return blobString;
}
public void setExpirydate(Blob expirydate) {
this.expirydate = expirydate;
}
public String getMessageid() {
return messageid;
}
public void setMessageid(String messageid) {
this.messageid = messageid;
}
public String getStanno() {
return stanno;
}
public void setStanno(String stanno) {
this.stanno = stanno;
}
public String getInvoiveorig() {
return invoiveorig;
}
public void setInvoiveorig(String invoiveorig) {
this.invoiveorig = invoiveorig;
}
public String getRescode() {
return rescode;
}
public void setRescode(String rescode) {
this.rescode = rescode;
}
public String getTanstype() {
return tanstype;
}
public void setTanstype(String tanstype) {
this.tanstype = tanstype;
}
public String getPoscondcode() {
return poscondcode;
}
public void setPoscondcode(String poscondcode) {
this.poscondcode = poscondcode;
}
public String getPosentmode() {
return posentmode;
}
public void setPosentmode(String posentmode) {
this.posentmode = posentmode;
}
public String getTransmissiondata() {
return transmissiondata;
}
public void setTransmissiondata(String transmissiondata) {
this.transmissiondata = transmissiondata;
}
public String getMerchanttype() {
return merchanttype;
}
public void setMerchanttype(String merchanttype) {
this.merchanttype = merchanttype;
}
public String getAcqintid() {
return acqintid;
}
public void setAcqintid(String acqintid) {
this.acqintid = acqintid;
}
public String getField48() {
return field48;
}
public void setField48(String field48) {
this.field48 = field48;
}
public String getCurrencycode() {
return currencycode;
}
public void setCurrencycode(String currencycode) {
this.currencycode = currencycode;
}
public String getPosdata() {
return posdata;
}
public void setPosdata(String posdata) {
this.posdata = posdata;
}
public String getNetworkdata() {
return networkdata;
}
public void setNetworkdata(String networkdata) {
this.networkdata = networkdata;
}
public String getBill_invoice_no() {
return bill_invoice_no;
}
public void setBill_invoice_no(String bill_invoice_no) {
this.bill_invoice_no = bill_invoice_no;
}
public String getTheyear() {
return theyear;
}
public void setTheyear(String theyear) {
this.theyear = theyear;
}
public String getLender_name() {
return lender_name;
}
public void setLender_name(String lender_name) {
this.lender_name = lender_name;
}
public String getSeller_name() {
return seller_name;
}
public void setSeller_name(String seller_name) {
this.seller_name = seller_name;
}
public Integer getBuyer_id() {
return buyer_id;
}
public void setBuyer_id(Integer buyer_id) {
this.buyer_id = buyer_id;
}
public String getBuyer_name() {
return buyer_name;
}
public void setBuyer_name(String buyer_name) {
this.buyer_name = buyer_name;
}
public Integer getTenure_in_days() {
return tenure_in_days;
}
public void setTenure_in_days(Integer tenure_in_days) {
this.tenure_in_days = tenure_in_days;
}
public Long getInterest_rate() {
return interest_rate;
}
public void setInterest_rate(Long interest_rate) {
this.interest_rate = interest_rate;
}
public String getSkucode() {
return skucode;
}
public void setSkucode(String skucode) {
this.skucode = skucode;
}
public String getTrans_source() {
return trans_source;
}
public void setTrans_source(String trans_source) {
this.trans_source = trans_source;
}
public String getSeller_invoice_number() {
return seller_invoice_number;
}
public void setSeller_invoice_number(String seller_invoice_number) {
this.seller_invoice_number = seller_invoice_number;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}
|
package com.devinchen.library.common.utils;
import com.devinchen.library.common.manager.UtilsManager;
/**
* CommonLibraryDemo
* com.devinchen.library.common.utils
* Created by Devin Chen on 2017/5/25 15:06.
* explain:虚拟键盘处理工具类
*/
public class KeyboardUtil extends UtilsManager {
}
|
package com.yjjyjy.yjj.service.impl;
import javax.annotation.Resource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.yjjyjy.yjj.entity.News;
import com.yjjyjy.yjj.repository.XynewsRepository;
import com.yjjyjy.yjj.service.XynewsService;
@Service
public class XynewsServiceImpl implements XynewsService {
@Resource
XynewsRepository xynewsRepository;
@Override
public boolean create(News news) {
// TODO Auto-generated method stub
News newNews = xynewsRepository.save(news);
if(newNews == null){
return false;
}
return true;
}
@Override
public Page<News> getNewsList(Pageable request) {
// TODO Auto-generated method stub
return xynewsRepository.findAll(request);
}
@Override
public News findOne(long id) {
// TODO Auto-generated method stub
return xynewsRepository.findById(id);
}
@Override
public int deleteNews(long id) {
// TODO Auto-generated method stub
int flag = xynewsRepository.deleteNewsById(id);
return flag;
}
}
|
class Person {
public String name;
public int height;
}
class Sample {
public static void main(String args[]) {
Person p = new Person();
p.name = "EJava";
anotherMethod(p);
System.out.println(p.name);
someMethod(p);
System.out.println(p.name);
}
static void someMethod(Person p) {
p.name = "someMethod";
System.out.println(p.name);
}
static void anotherMethod(Person p) {
p = new Person();
p.name = "anotherMethod";
System.out.println(p.name);
}
} |
package org.ah.minecraft.armour;
import org.bukkit.Location;
public class Shadow {
Location loc;
public Shadow(Location loc) {
this.loc = loc;
}
public void move() {
loc.add(loc.getDirection());
if (Math.random() > 0.5D) {
float yaw = (float)Math.random() * 360.0F;
float pitch = (float)Math.random() * 360.0F;
loc.setYaw(yaw);
loc.setPitch(pitch);
}
}
}
|
package tv.skimo.meeting.model;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AssetRepository extends JpaRepository<Asset, Integer> {
} |
package nrahul32.CaesarCipher;
import java.util.Scanner;
import java.util.regex.Pattern;
public class CaesarCipher {
// All class variables
private static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
// Take an input string from the user
String inputString = getUserInput("Enter the string to encrypt: ");
// Take a key from the user
int key = Integer.parseInt(getUserInput("Enter the key: "));
// Normalise the input string
String normalizedInput = normalizeText(inputString);
System.out.println("Normalized string is: " + normalizedInput);
// Caesarify
String encryptedString = caesarify(normalizedInput, key);
// Print the encrypted string
System.out.println("The encrypted text is: " + encryptedString);
}
/*
* Prints the question to the user and returns the user's input as a string
*/
private static String getUserInput(String question) {
System.out.print(question);
return s.nextLine();
}
/*
* 1. Removes all the spaces from the text
* 2. Removes any punctuation (. , : ; ’ ” ! ? ( ) )
* 3. Turn all lower-case letters into upper-case letters
* 4. Return the result
*
* There are 2 implementations of this. One uses the replaceAll method
* and other is by iterating through each character. Uncomment the
* preferred one
*/
private static String normalizeText(String input) {
String result = normalizeTextUsingReplaceMethod(input);
// String result = normalizeTextUsingChars(input);
return result;
}
/*
* This shifts each letter of the string by key positions
* and returns the string
*/
private static String caesarify(String normalizedInput, int key) {
char[] char_array = normalizedInput.toCharArray();
for(int i = 0; i < char_array.length; i++) {
char_array[i] = (char) ((char_array[i] - 'A' + key)%26 + 'A');
}
return new String(char_array);
}
private static String normalizeTextUsingReplaceMethod(String input) {
String regex = "[^a-zA-Z]";
return input.replaceAll(regex , "").toUpperCase();
}
private static String normalizeTextUsingChars(String input) {
char[] initialArray = input.toCharArray();
char[] finalArray = new char[input.length()];
// picks up only alphabets and adds them to a new array
for(int i = 0, j=0; i<initialArray.length; i++) {
if(Pattern.matches("[a-zA-Z]", Character.toString(initialArray[i]))) {
finalArray[j++]=initialArray[i];
}
}
String result = new String(finalArray).trim().toUpperCase();
return result;
}
}
|
package assemAssist.model.operations.task;
import java.lang.annotation.Documented;
/**
* An annotation to declare the API for a {@link Task}. This API includes all
* the methods which can be invoked by classes which aren't friends of the
* {@link Task}. These friends are declared in the capsule.
*
* @author SWOP Group 3
* @version 3.0
*/
@Documented
@TaskAPI
public @interface TaskAPI {
}
|
package com.cg.springcore.a7;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class demo {
@Value("#{11+22}")
private int x;
@Value("#{2+5+74+8}")
private int y;
@Value("#{T(java.lang.Math).sqrt(81)}")
private double z;
@Value("#{new java.lang.String('Alpha')}")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
@Override
public String toString() {
return "demo [x=" + x + ", y=" + y + ", z=" + z + ", name=" + name + "]";
}
}
|
package com.stackroute.pe1;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import static org.junit.Assert.*;
public class SortAndEvenSumTest {
SortAndEvenSum sortsum;
private static final String inp="23451";
ByteArrayInputStream input= new ByteArrayInputStream(inp.getBytes());
@Before
public void setUp() throws Exception {
sortsum =new SortAndEvenSum();
System.setIn(input);
}
@Test
public void sortAndAddEven() {
ArrayList<Integer> arr=new ArrayList<>(Arrays.asList(5,4,3,2,1));
assertEquals(arr, sortsum.sortAndAddEven());
}
@Test
public void findSum() {
ArrayList<Integer> arr=new ArrayList<Integer>(Arrays.asList(5,4,3,2,1));
assertEquals(6, sortsum.findSum(arr));
}
@After
public void tearDown() throws Exception {
sortsum=null;
}
} |
package teamjamin.ffs;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.firebase.client.AuthData;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import java.util.HashMap;
import java.util.Map;
import butterknife.Bind;
import butterknife.ButterKnife;
public class LoginActivity extends AppCompatActivity {
private static final String TAG = "LoginActivity";
private static final int REQUEST_SIGNUP = 0;
private static final int REQUEST_GUEST_LOGIN = 0;
private EditText _emailText, _passwordText;
private Button _loginButton;
private TextView _guestLogin, _signupLink;
// private String uid;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
//***for Espresso testing. Comment this out when running app. Uncomment for testing***
Firebase.setAndroidContext(this);
_emailText = (EditText) findViewById(R.id.input_email);
_passwordText = (EditText) findViewById(R.id.input_password);
_loginButton = (Button) findViewById(R.id.btn_login);
_signupLink = (TextView) findViewById(R.id.link_signup);
_guestLogin = (TextView) findViewById(R.id.guest_login);
// Set up login button
_loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
login();
}
});
// Set up signup button
_signupLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Start the Signup activity
Intent intent = new Intent(getApplicationContext(), SignupActivity.class);
startActivityForResult(intent, REQUEST_SIGNUP);
}
});
// Set up guest login
_guestLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Start MainActivity
Config.GUEST_LOGIN = true;
onLoginSuccess();
}
});
}
/**
* Method to perform login and authentication logic
*/
public void login() {
Log.d(TAG, "Login");
if (!validate()) {
onLoginFailed();
return;
}
_loginButton.setEnabled(false);
final ProgressDialog progressDialog = new ProgressDialog(LoginActivity.this,
R.style.AppTheme_Dark_Dialog);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Authenticating...");
progressDialog.show();
String email = _emailText.getText().toString();
String password = _passwordText.getText().toString();
//omit space
email = email.trim();
password = password.trim();
// TODO: Implement authentication logic here.
final Firebase authenticate = new Firebase("https://ffs.firebaseio.com/");
authenticate.authWithPassword(email, password, new Firebase.AuthResultHandler() {
@Override
public void onAuthenticated(AuthData authData) {
Firebase onlineRef = authenticate.child("users").child(authData.getUid());
Map<String, Object> online = new HashMap<String, Object>();
online.put("/connection", "online");
onlineRef.updateChildren(online);
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
// On complete call either onLoginSuccess or onLoginFailed
Config.GUEST_LOGIN = false;
onLoginSuccess();
}
}, 1500);
}
@Override
public void onAuthenticationError(FirebaseError firebaseError) {
final FirebaseError fError = firebaseError;
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
// On complete call either onLoginSuccess or onLoginFailed
onLoginFailed();
Config.GUEST_LOGIN = false;
switch (fError.getCode()) {
case FirebaseError.USER_DOES_NOT_EXIST:
Toast.makeText(getApplicationContext(), "No user with these credentials exists.", Toast.LENGTH_SHORT).show();
break;
case FirebaseError.INVALID_EMAIL:
Toast.makeText(getApplicationContext(), "Please enter a valid email.", Toast.LENGTH_SHORT).show();
break;
case FirebaseError.INVALID_PASSWORD:
Toast.makeText(getApplicationContext(), "Wrong Password. Please try again.", Toast.LENGTH_SHORT).show();
break;
default:
break;
}
progressDialog.dismiss();
}
}, 1500);
}
});
}
/**
* On Activity result, perfrm login logic and launch appropriate actvity
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_SIGNUP) {
if (resultCode == RESULT_OK) {
// TODO: implement successful login stuff here
this.finish();
}
}
}
@Override
public void onBackPressed() {
// Disable going back to the MainActivity
moveTaskToBack(true);
}
/**
* Login successful
*/
public void onLoginSuccess() {
_loginButton.setEnabled(true);
finish();
}
/**
* Login failed, create toast to tell user.
* Usual case is that account doesn't exist
*/
public void onLoginFailed() {
Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show();
_loginButton.setEnabled(true);
}
/**
* Make sure email and password fits criteria
* @return whether valid email and password is used
*/
public boolean validate() {
boolean validate = true;
String email = _emailText.getText().toString();
String password = _passwordText.getText().toString();
// Makes sure whatever email used is an actual email address
if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
_emailText.setError("Please enter a valid email address.");
validate = false;
} else {
_emailText.setError(null);
}
// Makes sure password length is met
if (password.isEmpty() || password.length() < 4 || password.length() > 10) {
_passwordText.setError("Must be between 4 and 10 alphanumeric characters.");
validate = false;
} else {
_passwordText.setError(null);
}
return validate;
}
}
|
/*
* ウィンドウの設定
*/
package diary.src;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Calendar;
public class DiaryWindow extends Window implements ActionListener {
// 現在画面の日付
protected String nowYear;
protected String nowMonth;
protected String nowDay;
// 年月遷移ボタン類
private final JButton prevMonth = new JButton("翌月");// 翌月ボタン
private final JButton backMonth = new JButton("前月");// 前月ボタン
private final JButton prevYear = new JButton("翌年");// 翌年ボタン
private final JButton backYear = new JButton("前年");// 前年ボタン
private JLabel YMLabel;// 年月表示ラベル
// day panel
private JPanel day_panel = new JPanel();
public final void setNowDate(String year, String month, String day) {
this.nowYear = year;
this.nowMonth = month;
this.nowDay = day;
}
// ウィンドウの設定
public DiaryWindow(String title, int width, int height) {
this.setDefaultCloseOperation(EXIT_ON_CLOSE); // 閉じるボタンの処理
this.setTitle(title); // タイトルの設定
this.setSize(width, height);// ウィンドウサイズ
this.setLocationRelativeTo(null);// 画面中央に配置
this.setResizable(false);// リサイズ禁止
}
// ウィンドウのテキスト設定
public void setTextWindow() {
final JPanel panel = new JPanel(); // パネルのインスタンスの 生 成
// 前年ボタン
// final JButton backYear = new JButton("前年");
this.backYear.addActionListener(this);
panel.add(this.backYear);
// 前月ボタン
// final JButton backMonth = new JButton("前月");
this.backMonth.addActionListener(this);
panel.add(this.backMonth);
// 〇〇年✕✕月
this.YMLabel = new JLabel(this.nowYear + "年 " + this.nowMonth + "月"); // ラベルのインスタンスの生成
this.YMLabel.setFont(new Font("MSGothic", Font.PLAIN, 30));
this.YMLabel.setForeground(Color.BLUE);
panel.add(YMLabel);
// 翌月ボタン
// final JButton prevMonth = new JButton("翌月");
this.prevMonth.addActionListener(this);
panel.add(this.prevMonth);
// 翌年ボタン
// final JButton prevYear = new JButton("前年");
this.prevYear.addActionListener(this);
panel.add(this.prevYear);
this.add(panel, BorderLayout.NORTH); // パネルをウインドウの表示領域に配置
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == this.backMonth) {
// 前月ボタンの処理
final int temp_month = Integer.valueOf(this.nowMonth) - 1;
if (1 <= temp_month && temp_month <= 12) {
this.nowMonth = String.valueOf(temp_month);
} else if (temp_month <= 0) {
this.nowMonth = "12";
this.nowYear = String.valueOf(Integer.valueOf(this.nowYear) - 1);
}
this.setButtonWindow(); // その年月の日付ボタンを設定
this.YMLabel.setText(this.nowYear + "年 " + this.nowMonth + "月");
} else if (e.getSource() == this.prevMonth) {
// 翌月ボタンの処理
final int temp_month = Integer.valueOf(this.nowMonth) + 1;
if (1 <= temp_month && temp_month <= 12) {
this.nowMonth = String.valueOf(temp_month);
} else if (13 <= temp_month) {
this.nowMonth = "1";
this.nowYear = String.valueOf(Integer.valueOf(this.nowYear) + 1);
}
this.setButtonWindow(); // その年月の日付ボタンを設定
this.YMLabel.setText(this.nowYear + "年 " + this.nowMonth + "月");
} else if (e.getSource() == this.backYear) {
// 前年ボタンの処理
final int temp_year = Integer.valueOf(this.nowYear) - 1;
if (temp_year < 1950) { // 例外チェック
// メッセージダイアログの表示
JOptionPane.showMessageDialog(null, "ごめんなさい^_^\n1950年よりも前には遡れません。");
} else {
this.nowYear = String.valueOf(Integer.valueOf(this.nowYear) - 1);
this.setButtonWindow(); // その年月の日付ボタンを設定
this.YMLabel.setText(this.nowYear + "年 " + this.nowMonth + "月");
}
} else if (e.getSource() == this.prevYear) {
// 翌年ボタンの処理
final int temp_year = Integer.valueOf(this.nowYear) + 1;
if (2200 < temp_year) {
// メッセージダイアログの表示
JOptionPane.showMessageDialog(null, "ごめんなさい^_^\n2200年よりも後には進めません。");
} else {
this.nowYear = String.valueOf(Integer.valueOf(this.nowYear) + 1);
this.setButtonWindow(); // その年月の日付ボタンを設定
this.YMLabel.setText(this.nowYear + "年 " + this.nowMonth + "月");
}
}
}
// ウィンドウのボタン設定
public void setButtonWindow() {
// JPanel panelAction = new JPanel();
// ボタンを追加
// JButton btn1 = new JButton("Push");
// ボタンクリック
// btn1.addActionListener(new CreateEditWindow());
// パネルに追加
// panelAction.add(btn1);
// その月の日数を取得
// this.nowMonth = "2"; //debug
final Calendar calendar = Calendar.getInstance();
calendar.set(Integer.parseInt(this.nowYear), Integer.parseInt(this.nowMonth) - 1, 1);
final int day_in_month = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
final int grid_row = 7;
final int grid_col = 5;
final GridLayout gridDate = new GridLayout(0, grid_row, 20, 20); // 行 列 横 縦
// final JPanel day_panel = new JPanel();
day_panel.removeAll(); // 一旦パネルの要素を全部削除
day_panel.setLayout(gridDate);
for (int i = 0; i < grid_row * grid_col; i++) {
if (i < day_in_month) {
final JButton dateButton = new JButton("" + (i + 1));
// dateButton.setBackground(Color.LIGHT_GRAY);// ボタン背景色
dateButton.addActionListener(new CreateEditWindow(this.nowYear, this.nowMonth, String.valueOf(i + 1)));
day_panel.add(dateButton);
} else { // 最大日付外 -> 枠だけ表示
final JButton dateButton = new JButton();
dateButton.setEnabled(false);
day_panel.add(dateButton);
}
}
Debugger.out("hgoe; " + this.nowYear + "年" + this.nowMonth + "月" + this.nowDay + "日");
// ボタンを表示
this.getContentPane().add(day_panel, BorderLayout.CENTER);
// this.getContentPane().add(panelAction, BorderLayout.SOUTH);
}
// 日付ボタンクリック時のアクション
static class CreateEditWindow implements ActionListener {
private String nowYear;
private String nowMonth;
private String nowDay;
public CreateEditWindow(String year, String month, String day) {
this.nowYear = year;
this.nowMonth = month;
this.nowDay = day;
}
// 同一タイトルのウィンドウが既に開かれているか確認
private boolean isOpened(String title) {
return Setting.open_edit_window_titles.contains(title);
}
// 開いている編集ウィンドウリストに追加
private void addOpenedWindow(String title) {
Setting.open_edit_window_titles.add(title);
}
// 新しい画面の作成
public void actionPerformed(ActionEvent e) {
// ウィンドウ設定
final String window_title = String.format("%s年%s月%s日の日記", this.nowYear, this.nowMonth, this.nowDay); // タイトル
Debugger.out("CreateEditWindow of " + window_title);
// 同一ウィンドウタイトルで既に開かれているか確認
if (this.isOpened(window_title)) {
// 既に開かれている場合 メッセージを表示
JOptionPane.showMessageDialog(null, "同じウィンドウは開けません!\n " + window_title + "の日記は既に開いています。");
} else {
// 開いていない場合
// 開いているウィンドウに現在のウィンドウタイトルを追加
this.addOpenedWindow(window_title);
// ウィンドウの設定
final int window_width = 400; // 高さ
final int window_height = 400; // 幅
final EditWindow editWindow = new EditWindow(window_title, window_width, window_height);
// 日付
editWindow.setNowDate(this.nowYear, this.nowMonth, this.nowDay);
Debugger.out(this.nowYear + "年" + this.nowMonth + "月" + this.nowDay + "日");
// アイコン
editWindow.setImageIcon(Setting.icon_path);
editWindow.setTextWindow(); // ウィンドウにテキストを表示
editWindow.setTitle(window_title); // タイトルを設定
editWindow.setTextArea("", 15); // ウィンドウにテキストエリアを設置
editWindow.setBoxColor(); // ウィンドウに枠線カラー指定チェックボックスを設置
editWindow.setVisible(); // 最後にウィンドウを表示
}
}
}
}
|
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.File;
import java.net.URL;
public class ClientGUI<startingScreen> extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
// will first hold "Username:", later on "Enter message"
private JLabel label;
// to hold the Username and later on the messages
private JTextField tf;
// to hold the server address an the port number
private JTextField tfServer, tfPort;
// to Logout and get the list of the users
private JButton login, logout, whoIsIn, sendFile;
//boolean sendFile;
// for the chat room
private JTextArea ta;
// if it is for connection
private boolean connected;
// the Client object
private Client client;
// the default port number
private int defaultPort;
private String defaultHost;
// Constructor connection receiving a socket number
ClientGUI(String host, int port) {
super("ChittyChatty");
JDialog welcomeScreen = new JDialog();
JPanel welcomePanel = new JPanel();
JLabel welcome = new JLabel("ChittyChatty", SwingConstants.CENTER);
welcomeScreen.setTitle("ChittyChatty");
welcomePanel.setLayout(new BorderLayout());
welcomePanel.setBackground(Color.BLUE);
welcome.setFont(new Font("", Font.BOLD, 50));
welcomePanel.setBorder(BorderFactory.createLineBorder(Color.WHITE, 3));
welcome.setForeground(Color.WHITE);
welcomePanel.add(welcome, BorderLayout.CENTER);
welcomeScreen.add(welcomePanel);
welcomeScreen.setSize(new Dimension(500, 700));
welcomeScreen.setLocation(500,500);
welcomeScreen.setVisible(true);
welcomeScreen.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
welcomeScreen.dispose();
defaultPort = port;
defaultHost = host;
// The NorthPanel wit
JPanel northPanel = new JPanel(new GridLayout(3,1));
// the server name anmd the port number
JPanel serverAndPort = new JPanel(new GridLayout(1,5, 2, 3));
serverAndPort.setBackground(Color.lightGray);
//serverAndPort.setBackground(Color.darkGray);
// the two JTextField with default value for server address and port number
tfServer = new JTextField(host);
tfPort = new JTextField("" + port);
tfPort.setHorizontalAlignment(SwingConstants.RIGHT);
serverAndPort.add(new JLabel("Address "));
serverAndPort.add(tfServer);
serverAndPort.add(new JLabel("Port "));
serverAndPort.add(tfPort);
serverAndPort.add(new JLabel(""));
// adds the Server an port field to the GUI
northPanel.add(serverAndPort);
// the Label and the TextField
label = new JLabel("Write Anything You Like", SwingConstants.CENTER);
northPanel.add(label);
tf = new JTextField("Type Away");
tf.setBackground(Color.LIGHT_GRAY);
northPanel.add(tf);
add(northPanel, BorderLayout.NORTH);
//northPanel.setBackground(Color.BITMASK);
// The CenterPanel which is the chat room
ta = new JTextArea("Welcome ........\n", 30, 30);
JPanel centerPanel = new JPanel(new GridLayout(1,1));
centerPanel.add(new JScrollPane(ta));
ta.setEditable(false);
add(centerPanel, BorderLayout.CENTER);
setLocation(500, 200);
// the 3 buttons
//login = new JButton("login");
ImageIcon icon = new ImageIcon("mybutton.png");
Image img = icon.getImage();
Image newimg = img.getScaledInstance(100, 30, java.awt.Image.SCALE_SMOOTH);
icon = new ImageIcon(newimg);
login = new JButton(icon);
login.addActionListener(this);
ImageIcon icon2 = new ImageIcon("mybutton2.png");
Image img2 = icon2.getImage();
Image newimg2 = img2.getScaledInstance(100, 30, java.awt.Image.SCALE_SMOOTH);
icon2 = new ImageIcon(newimg2);
logout = new JButton(icon2);
logout.addActionListener(this);
logout.setEnabled(false);
ImageIcon icon3 = new ImageIcon("mybutton4.png");
Image img3 = icon3.getImage();
Image newimg3 = img3.getScaledInstance(100, 30, java.awt.Image.SCALE_SMOOTH);
icon3 = new ImageIcon(newimg3);
sendFile = new JButton(icon3);
sendFile.addActionListener(this);
ImageIcon icon4 = new ImageIcon("mybutton3.png");
Image img4 = icon4.getImage();
Image newimg4 = img4.getScaledInstance(100, 30, java.awt.Image.SCALE_SMOOTH);
icon4 = new ImageIcon(newimg4);
// you have to login before being able to logout
whoIsIn = new JButton(icon4);
whoIsIn.addActionListener(this);
//whoIsIn.setEnabled(false); // you have t before being able to Who is in
JPanel southPanel = new JPanel();
southPanel.add(login);
southPanel.add(logout);
southPanel.add(whoIsIn);
southPanel.add(sendFile);
add(southPanel, BorderLayout.SOUTH);
southPanel.setBackground(Color.lightGray);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(550,500 );
setVisible(true);
tf.requestFocus();
}
// called by the Client to append text in the TextArea
void append(String str) {
ta.append(str);
ta.setCaretPosition(ta.getText().length() - 1);
}
// called by the GUI is the connection failed
// we reset our buttons, label, textfield
void connectionFailed() {
login.setEnabled(true);
logout.setEnabled(false);
whoIsIn.setEnabled(false);
label.setText("Enter your username below");
//tf.setText("Anonymous");
// reset port number and host name as a construction time
tfPort.setText("" + defaultPort);
tfServer.setText(defaultHost);
// let the user change them
tfServer.setEditable(false);
tfPort.setEditable(false);
// don't react to a <CR> after the username
tf.removeActionListener(this);
connected = false;
}
/*
* Button or JTextField clicked
*/
//@SuppressWarnings("unused")
public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
// if it is the Logout button
if(o == logout) {
client.sendMessage(new ChatMessage(ChatMessage.LOGOUT, ""));
return;
}
// if it the who is in button
if(o == whoIsIn) {
client.sendMessage(new ChatMessage(ChatMessage.WHOISIN, ""));
return;
}
if(e.getSource() == sendFile)
{
new SendImage();
}
// ok it is coming from the JTextField
if(connected) {
// just have to send the message
client.sendMessage(new ChatMessage(ChatMessage.MESSAGE, tf.getText()));
tf.setText("");
return;
}
if(o == login) {
// ok it is a connection request
String username = tf.getText().trim();
// empty username ignore it
if(username.length() == 0)
return;
// empty serverAddress ignore it
String server = tfServer.getText().trim();
if(server.length() == 0)
return;
// empty or invalid port numer, ignore it
String portNumber = tfPort.getText().trim();
if(portNumber.length() == 0)
return;
int port = 0;
try {
port = Integer.parseInt(portNumber);
}
catch(Exception en) {
return; // nothing I can do if port number is not valid
}
// try creating a new Client with GUI
client = new Client(server, port, username, this);
// test if we can start the Client
if(!client.start())
return;
tf.setText("");
label.setText("Enter your message below");
connected = true;
// disable login button
login.setEnabled(false);
// enable the 2 buttons
logout.setEnabled(true);
whoIsIn.setEnabled(true);
// disable the Server and Port JTextField
tfServer.setEditable(false);
tfPort.setEditable(false);
// Action listener for when the user enter a message
tf.addActionListener(this);
}
}
// to start the whole thing the server
public static void main(String[] args) {
new ClientGUI("localhost", 55555);
}
public void update() {
// TODO Auto-generated method stub
}
} |
package com.company;
public class Matrix
{
double[] data;
int rows;
int cols;
Matrix(int rows, int cols)
{
this.rows = rows;
this.cols = cols;
data = new double[rows*cols];
}
Matrix(double[][] d)
{
this.rows = d.length;
this.cols = 0;
// Sets number of columns based on length of the longest row
for(int i=0; i<rows; i++)
{
if(d[i].length > cols)
{
cols = d[i].length;
}
}
if(cols != 0)
{
this.data = new double[cols*rows];
}
else
{
System.out.println("You gave me an empty array.");
return;
}
int counter = 0;
for(int i=0; i<rows; i++)
{
// Add numbers to data property
for(int j=0; j<d[i].length; j++)
{
data[counter] = d[i][j];
counter++;
}
// Fill in the remaining cells with zeros
for(int j=0; j<cols-d[i].length; j++)
{
data[counter] = 0;
counter++;
}
}
}
public double[][] asArray()
{
double[][] resultArray = new double[rows][cols];
int counter=0;
// Fill in new array with numbers (zeros included, because it is not know whether they existed during
// initialization of the object Matrix)
for(int i=0; i<rows; i++)
{
for(int j=0; j<cols; j++)
{
resultArray[i][j] = this.data[counter];
System.out.print(resultArray[i][j] + "|");//TO REMOVE
counter++;
}
System.out.print("\n");// TO REMOVE
}
return resultArray;
}
// Get number from under a specific index
public double get(int r, int c) throws IndexOutOfBoundsException
{
if ((r >= 0 && r < rows) && (c >= 0 && c < cols))
{
return data[cols * r + c];
}
else
{
throw new IndexOutOfBoundsException("You are trying to extract number from non-existing index. Try again.");
}
}
// Set number to cell from under a specific index
public void set (int r,int c, double value) throws IndexOutOfBoundsException
{
if ((r >= 0 && r < rows) && (c >= 0 && c < cols))
{
data[cols * r + c] = value;
}
else
{
throw new IndexOutOfBoundsException("You are trying to put number into non-existing cell. Try again.");
}
}
public String toString()
{
StringBuilder buf = new StringBuilder();
buf.append("[");
int counter = 0;
for (int i = 0; i < rows; i++) {
buf.append("[");
for (int j = 0; j < cols; j++) {
if(j != cols-1) { buf.append(data[counter] + ", "); }
else { buf.append(data[counter]); }
counter++;
}
if(i != rows-1) { buf.append("], "); }
else { buf.append("]"); }
}
buf.append("]");
return buf.toString();
}
public void reshape(int newRows,int newCols) throws RuntimeException
{
if(rows*cols != newRows*newCols)
{throw new RuntimeException(String.format("%d x %d matrix can't be reshaped to %d x %d", rows, cols, newRows, newCols));}
rows = newRows;
cols = newCols;
}
public int[] shape()
{
return new int[] {rows, cols};
}
public Matrix add(Matrix m)
{
if((this.rows != m.rows) || (this.cols != m.cols))
{
throw new RuntimeException("The numbers of rows or columns are not the same in both matrices.");
}
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
resultMatrix.data[i] = this.data[i] + m.data[i];
}
return resultMatrix;
}
public Matrix add(double w)
{
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
resultMatrix.data[i] = this.data[i] + w;
}
return resultMatrix;
}
public Matrix sub(Matrix m)
{
if((this.rows != m.rows) || (this.cols != m.cols))
{
throw new RuntimeException("The numbers of rows or columns are not the same in both matrices.");
}
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
resultMatrix.data[i] = this.data[i] - m.data[i];
}
return resultMatrix;
}
public Matrix sub(double w)
{
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
resultMatrix.data[i] = this.data[i] - w;
}
return resultMatrix;
}
// Multiple numbers which are corresponding to each other
public Matrix mul(Matrix m)
{
if((this.rows != m.rows) || (this.cols != m.cols))
{
throw new RuntimeException("The numbers of rows or columns are not the same in both matrices.");
}
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
resultMatrix.data[i] = this.data[i] * m.data[i];
}
return resultMatrix;
}
// Multiple each number by scalar
public Matrix mul(double w)
{
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
resultMatrix.data[i] = this.data[i] * w;
}
return resultMatrix;
}
// Divide numbers which are corresponding to each other
public Matrix div(Matrix m)
{
if((this.rows != m.rows) || (this.cols != m.cols))
{
throw new RuntimeException("The numbers of rows or columns are not the same in both matrices.");
}
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
// This is some simplification
if(m.data[i] != 0)
{
resultMatrix.data[i] = this.data[i] / m.data[i];
}
else
{
resultMatrix.data[i] = 0;
}
}
return resultMatrix;
}
// Divide numbers scalar
public Matrix div(double w)
{
if(w == 0.0)
{
throw new RuntimeException("You cannot divide by 0!");
}
Matrix resultMatrix = new Matrix(this.rows, this.cols);
for(int i=0; i<data.length; i++)
{
resultMatrix.data[i] = this.data[i] / w;
}
return resultMatrix;
}
// Multiple two matrices
public Matrix dot(Matrix m)
{
if(this.cols != m.rows)
{
throw new RuntimeException("The numbers of rows or columns are not the same in both matrices.");
}
Matrix resultMatrix = new Matrix(this.rows, m.cols);
int counter=0;
for(int i=0; i<rows; i++)
{
for(int j=0; j<m.cols; j++)
{
for(int k=0; k<cols; k++)
{
resultMatrix.data[counter] += this.data[i*cols+k] * m.data[k*m.cols+i];
}
counter++;
}
}
return resultMatrix;
}
// Returns sum of squares of individual elements from matrix
public double frobenius()
{
double frobNorm=0;
for(double k : data)
{
frobNorm += k*k;
}
return frobNorm;
}
}
|
package com.marshalchen.ultimaterecyclerview;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewStub;
import com.marshalchen.ultimaterecyclerview.swipelistview.SwipeListView;
import com.marshalchen.ultimaterecyclerview.swipelistview.SwipeListViewListener;
import com.marshalchen.ultimaterecyclerview.ui.VerticalSwipeRefreshLayout;
import com.marshalchen.ultimaterecyclerview.ui.floatingactionbutton.FloatingActionButton;
/**
* Created by MarshalChen on 15-6-5.
*/
public class SwipeableUltimateRecyclerview extends UltimateRecyclerView {
public SwipeableUltimateRecyclerview(Context context) {
super(context);
}
public SwipeableUltimateRecyclerview(Context context, AttributeSet attrs) {
super(context, attrs);
((SwipeListView)mRecyclerView).init(attrs);
}
public SwipeableUltimateRecyclerview(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
((SwipeListView)mRecyclerView).init(attrs);
}
@Override
protected void initViews() {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.swipeable_ultimate_recycler_view_layout, this);
mRecyclerView = (SwipeListView) view.findViewById(R.id.ultimate_list);
mSwipeRefreshLayout = (VerticalSwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
setScrollbars();
mSwipeRefreshLayout.setEnabled(false);
if (mRecyclerView != null) {
mRecyclerView.setClipToPadding(mClipToPadding);
if (mPadding != -1.1f) {
mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
} else {
mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
}
defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
setDefaultScrollListener();
mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);
mEmpty.setLayoutResource(mEmptyId);
mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);
if (mEmptyId != 0)
mEmptyView = mEmpty.inflate();
mEmpty.setVisibility(View.GONE);
if (mFloatingButtonId != 0) {
mFloatingButtonView = mFloatingButtonViewStub.inflate();
mFloatingButtonView.setVisibility(View.VISIBLE);
}
}
public void setSwipeListViewListener(SwipeListViewListener swipeListViewListener) {
((SwipeListView)mRecyclerView).swipeListViewListener = swipeListViewListener;
}
}
|
package pl.whirly.recruitment.payment.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pl.whirly.recruitment.payment.model.Payment;
import pl.whirly.recruitment.payment.repository.PaymentRepository;
import pl.whirly.recruitment.payment.service.PaymentService;
import java.util.List;
@RestController
@RequestMapping("/payment")
public class PaymentController {
@Autowired
private PaymentRepository paymentRepository;
@Autowired
private PaymentService paymentService;
@GetMapping
public List<Payment> getPayments() {
return paymentRepository.getAllPayments();
}
@GetMapping("/{paymentId}")
public Payment getPayment(@PathVariable String paymentId) {
return paymentRepository.getPaymentById(paymentId);
}
@PostMapping
public void processPayment(@RequestBody Payment payment) {
paymentService.processPayment(payment);
}
}
|
package com.accp.pub.pojo;
import java.util.Date;
public class Studentriskvalues {
private Integer userid;
private String username;
private Integer riskvaluesid;
private String riskvaluetype;
private Integer riskvaluesitemsid;
private String riskvaluesitemsname;
private Double riskvaluesz;
private String operator;
private Date operatordate;
private String bz;
private String bz1;
private String bz2;
private String bz3;
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public Integer getRiskvaluesid() {
return riskvaluesid;
}
public void setRiskvaluesid(Integer riskvaluesid) {
this.riskvaluesid = riskvaluesid;
}
public String getRiskvaluetype() {
return riskvaluetype;
}
public void setRiskvaluetype(String riskvaluetype) {
this.riskvaluetype = riskvaluetype == null ? null : riskvaluetype.trim();
}
public Integer getRiskvaluesitemsid() {
return riskvaluesitemsid;
}
public void setRiskvaluesitemsid(Integer riskvaluesitemsid) {
this.riskvaluesitemsid = riskvaluesitemsid;
}
public String getRiskvaluesitemsname() {
return riskvaluesitemsname;
}
public void setRiskvaluesitemsname(String riskvaluesitemsname) {
this.riskvaluesitemsname = riskvaluesitemsname == null ? null : riskvaluesitemsname.trim();
}
public Double getRiskvaluesz() {
return riskvaluesz;
}
public void setRiskvaluesz(Double riskvaluesz) {
this.riskvaluesz = riskvaluesz;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator == null ? null : operator.trim();
}
public Date getOperatordate() {
return operatordate;
}
public void setOperatordate(Date operatordate) {
this.operatordate = operatordate;
}
public String getBz() {
return bz;
}
public void setBz(String bz) {
this.bz = bz == null ? null : bz.trim();
}
public String getBz1() {
return bz1;
}
public void setBz1(String bz1) {
this.bz1 = bz1 == null ? null : bz1.trim();
}
public String getBz2() {
return bz2;
}
public void setBz2(String bz2) {
this.bz2 = bz2 == null ? null : bz2.trim();
}
public String getBz3() {
return bz3;
}
public void setBz3(String bz3) {
this.bz3 = bz3 == null ? null : bz3.trim();
}
} |
package com.example.hereapi_example;
import java.util.List;
import com.here.android.common.ViewObject;
import com.here.android.mapping.FragmentInitListener;
import com.here.android.mapping.InitError;
import com.here.android.mapping.Map;
import com.here.android.mapping.Map.MapTransformListener;
import com.here.android.mapping.MapFragment;
import com.here.android.mapping.MapGestureListener;
import com.here.android.mapping.MapState;
import android.app.Activity;
import android.graphics.PointF;
import android.os.Bundle;
import android.widget.TextView;
public class EventsDemoActivity extends Activity
implements MapGestureListener, MapTransformListener{
private Map mMap;
private TextView mTapTextView;
private TextView mCameraTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.events_demo);
mTapTextView = (TextView) findViewById(R.id.tap_text);
mCameraTextView = (TextView) findViewById(R.id.camera_text);
setUpMapIfNeeded();
}
@Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
if(mMap == null){
final EventsDemoActivity that = this;
final MapFragment mapFragment = (MapFragment)getFragmentManager().findFragmentById(R.id.map);
// initialize the Map Fragment to create a map and
// attached to the fragment
mapFragment.init(new FragmentInitListener() {
@Override
public void onFragmentInitializationCompleted(InitError error) {
if (error == InitError.NONE) {
mMap = (Map) mapFragment.getMap();
mapFragment.getMapGesture().addMapGestureListener(that);
mMap.addMapTransformListener(that);
}
}
});
}
}
@Override
public void onMapTransformEnd(MapState mapState) {
if(mapState !=null){
mCameraTextView.setText(mapState.getCenter().toString());
}else if(mMap !=null){
mCameraTextView.setText(mMap.getCenter().toString());
}
}
@Override
public void onMapTransformStart() {
// TODO Auto-generated method stub
}
@Override
public boolean onDoubleTapEvent(PointF arg0) {
mTapTextView.setText("Double tapped, point=" + arg0);
return false;
}
@Override
public boolean onLongPressEvent(PointF p) {
mTapTextView.setText("long press, point=" + p);
return false;
}
@Override
public void onLongPressRelease() {
mTapTextView.setText("long press released");
}
@Override
public boolean onTwoFingerTapEvent(PointF p) {
mTapTextView.setText("2 finger tapped, point=" + p);
return false;
}
@Override
public boolean onTapEvent(PointF p) {
mTapTextView.setText("tapped, point=" + p);
return false;
}
@Override
public boolean onMapObjectsSelected(List<ViewObject> objects) {
if(objects != null){
mTapTextView.setText("onMapObjectsSelected, count=" + objects.size());
}
// TODO Auto-generated method stub
return false;
}
@Override
public void onMultiFingerManipulationEnd() {
// TODO Auto-generated method stub
}
@Override
public void onPinchLocked() {
mTapTextView.setText("Pinch locked");
}
@Override
public boolean onPinchZoomEvent(float scaleFactor, PointF p) {
mTapTextView.setText("Pinch zoom, point=" + p + ", scale=" + scaleFactor);
return false;
}
@Override
public boolean onRotateEvent(float rotateAngle) {
mTapTextView.setText("Rotatetd, angle=" + rotateAngle);
return false;
}
@Override
public void onRotateLocked() {
mTapTextView.setText("Rotate locked");
}
@Override
public boolean onTiltEvent(float angle) {
mTapTextView.setText("Tilted, angle=" + angle);
return false;
}
@Override
public void onMultiFingerManipulationStart() {
// TODO Auto-generated method stub
}
@Override
public void onPanEnd() {
// TODO Auto-generated method stub
}
@Override
public void onPanStart() {
// TODO Auto-generated method stub
}
}
|
public class User {
private String name;
private String department;
private String phone;
public User(String name, String department, String phone) {
this.name = name;
this.department = department;
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
|
package com.jim.multipos.ui.vendor_item_managment.fragments;
import com.jim.multipos.core.BaseView;
import com.jim.multipos.data.DatabaseManager;
import com.jim.multipos.data.db.model.products.Vendor;
import com.jim.multipos.ui.vendor_item_managment.model.VendorManagmentItem;
import java.util.List;
/**
* Created by developer on 20.11.2017.
*/
public interface VendorItemView extends BaseView {
void initRecyclerView(List<VendorManagmentItem> vendorManagmentItems);
void initSearchResults(List<VendorManagmentItem> vendorManagmentItems, String searchText);
void initDefault(List<VendorManagmentItem> vendorManagmentItems);
void notifyList();
void closeKeyboard();
void sendDataToConsignment(Long vendorId, int consignment_type);
void openVendorDetails(Long vendorId);
void openVendorBillingStory(Long vendorId,Double totalDebt);
void openVendorConsignmentsStory(Long vendorId);
void openPaymentDialog(DatabaseManager databaseManager, Vendor vendor);
void openStockQueueForVendor(Long id);
}
|
package com.pathfinder.anup.models;
/**
* Created by Anup on 3/24/2017.
*/
public class ModelDailyTodo {
private int id;
private String todoTitles;
private String todoItemsDetail;
public ModelDailyTodo() {
}
public ModelDailyTodo(int id, String todoTitles, String todoItemsDetail) {
this.id = id;
this.todoTitles = todoTitles;
this.todoItemsDetail = todoItemsDetail;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTodoTitles() {
return todoTitles;
}
public void setTodoTitles(String todoTitles) {
this.todoTitles = todoTitles;
}
public String getTodoItemsDetail() {
return todoItemsDetail;
}
public void setTodoItemsDetail(String todoItemsDetail) {
this.todoItemsDetail = todoItemsDetail;
}
}
|
package ru.molkov.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ru.molkov.core.AbstractService;
import ru.molkov.core.GenericDao;
import ru.molkov.dao.TakenItemDao;
import ru.molkov.model.TakenItem;
@Service
public class TakenItemServiceImpl extends AbstractService<TakenItem> {
@Autowired
private TakenItemDao dao;
@Override
protected GenericDao<TakenItem> getDao() {
return dao;
}
@Transactional
public List<TakenItem> getTakenItemsByUser(Integer userId) {
return dao.getTakenItemsByUser(userId);
}
}
|
package COM.JambPracPortal.MODEL;
public class login {
private String username;
private String password;
private String cclno;
private String emailAddress;
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCclno() {
return this.cclno;
}
public void setCclno(String cclno) {
this.cclno = cclno;
}
}
|
package com.fleet.solr.controller;
import com.fleet.solr.entity.User;
import com.fleet.solr.service.UserService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author April Han
*/
@RestController
@RequestMapping("/user")
public class UserController {
@Resource
UserService userService;
@RequestMapping("/insert")
public void insert(@RequestBody User user) {
userService.insert(user);
}
@RequestMapping("/delete")
public void delete(@RequestParam("id") String id) {
userService.delete(id);
}
@RequestMapping("/update")
public void update(@RequestBody User user) {
userService.update(user);
}
@RequestMapping("/get")
public User get(@RequestParam("id") String id) {
return userService.get(id);
}
@RequestMapping("/list")
public List<User> list(@RequestParam Map<String, String> map) {
return userService.list(map);
}
}
|
package JZOffer;
/**
* @author: zdefys
* @date: 2020/7/4 11:40
* @version: v1.0
* @description:
* 输入一个整数数组,
* 实现一个函数来调整该数组中数字的顺序,
* 使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,
* 并保证奇数和奇数,偶数和偶数之间的相对位置不变。
* 相邻情况:
* 奇数 奇数 不换
* 偶数 偶数 不换
* 奇数 偶数 不换
* 偶数 奇数 交换
*/
public class JZ13 {
public static void reOrderArray(int [] array) {
for (int i = 1; i < array.length; i++) {
for (int j = 0; j < array.length - i; j++) {
if (array[j]%2==0&& array[j + 1]%2==1) {
int temp = array[j];
array[j] = array[j + 1];
array[j+1] = temp;
}
}
}
}
public static void main(String[] args) {
int[] arr = {3,1,4,6,2,7,9,8};
reOrderArray(arr);
for (int i : arr) {
System.out.println(i + ",");
}
}
}
|
package am.main.data.dto.notification;
import am.main.api.validation.groups.*;
import am.main.common.RegExp;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
/**
* Created by ahmed.motair on 1/15/2018.
*/
public class AMDestination implements Serializable{
@NotNull(message = FormValidation.REQUIRED, groups = RequiredValidation.class)
@Size(min = 1, message = FormValidation.MIN_LENGTH, groups = LengthValidation.class)
private List<String> eventNtfIDs;
@NotNull(message = FormValidation.REQUIRED, groups = RequiredValidation.class)
@Length(min = 10, max = 60, message = FormValidation.MIN_MAX_LENGTH, groups = LengthValidation.class)
@Pattern(regexp = RegExp.EMAIL, message = FormValidation.REGEX, groups = InvalidValidation.class)
@NotEmpty(message = FormValidation.EMPTY_STR, groups = BlankValidation.class)
private String email;
@NotNull(message = FormValidation.REQUIRED, groups = RequiredValidation.class)
@Length(min = 11, max = 14, message = FormValidation.MIN_MAX_LENGTH, groups = LengthValidation.class)
@Pattern(regexp = RegExp.PHONE_NUMBER, message = FormValidation.REGEX, groups = InvalidValidation.class)
@NotEmpty(message = FormValidation.EMPTY_STR, groups = BlankValidation.class)
private String phone;
@NotNull(message = FormValidation.REQUIRED, groups = RequiredValidation.class)
@Length(min = 5, max = 30, message = FormValidation.MIN_MAX_LENGTH, groups = LengthValidation.class)
@Pattern(regexp = RegExp.FULL_NAME, message = FormValidation.REGEX, groups = InvalidValidation.class)
@NotEmpty(message = FormValidation.EMPTY_STR, groups = BlankValidation.class)
private String fullName;
@NotNull(message = FormValidation.REQUIRED, groups = RequiredValidation.class)
@Length(min = 1, max = 30, message = FormValidation.MIN_MAX_LENGTH, groups = LengthValidation.class)
@NotEmpty(message = FormValidation.EMPTY_STR, groups = BlankValidation.class)
private String userID;
public AMDestination() {
}
public AMDestination(String userID, String fullName, String email, String phone) {
this.userID = userID;
this.fullName = fullName;
this.email = email;
this.phone = phone;
}
public AMDestination(List<String> eventNtfIDs, String email, String phone, String fullName, String userID) {
this.eventNtfIDs = eventNtfIDs;
this.email = email;
this.phone = phone;
this.fullName = fullName;
this.userID = userID;
}
public List<String> getEventNtfIDs() {
return eventNtfIDs;
}
public void setEventNtfIDs(List<String> eventNtfIDs) {
this.eventNtfIDs = eventNtfIDs;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof AMDestination)) return false;
AMDestination that = (AMDestination) o;
if (getEmail() != null ? !getEmail().equals(that.getEmail()) : that.getEmail() != null) return false;
if (getPhone() != null ? !getPhone().equals(that.getPhone()) : that.getPhone() != null) return false;
return getUserID() != null ? getUserID().equals(that.getUserID()) : that.getUserID() == null;
}
@Override
public int hashCode() {
int result = getEmail() != null ? getEmail().hashCode() : 0;
result = 31 * result + (getPhone() != null ? getPhone().hashCode() : 0);
result = 31 * result + (getUserID() != null ? getUserID().hashCode() : 0);
return result;
}
@Override
public String toString() {
return "AMDestination{" +
"email = " + email +
", phone = " + phone +
", userID = " + userID +
"}\n";
}
}
|
public class Cheque{
private double valor;
private String bancoEmissor;
private String data;
private Cliente cliente;
public Cheque(Cliente cliente, double valor, String bancoEmissor, String data) {
this.valor = valor;
this.bancoEmissor = bancoEmissor;
this.data = data;
this.cliente = cliente;
}
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
public double getValor() {
return valor;
}
public void setValor(double valor) {
this.valor = valor;
}
public String getBancoEmissor() {
return bancoEmissor;
}
public void setBancoEmissor(String bancoEmissor) {
this.bancoEmissor = bancoEmissor;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
|
package sforum.web.dto.mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import sforum.model.Post;
import sforum.web.dto.PostDTO;
import sforum.web.dto.UserBasicDTO;
import java.util.List;
/**
* Created by @ivan.
*/
@Mapper(componentModel = "spring", uses = { UserMapper.class })
public abstract class PostMapper {
@Mapping(target = "editable", ignore = true)
@Mapping(target = "deletable", ignore = true)
@Mapping(target = "user", resultType = UserBasicDTO.class)
public abstract PostDTO postToPostDTO(Post post);
public abstract List<PostDTO> postsToPostDTOs(List<Post> posts);
}
|
package com.joshuarichardson.dependencyinjection.Modules;
import android.content.Context;
import com.joshuarichardson.dependencyinjection.DatabaseService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.inject.Singleton;
import androidx.room.Room;
import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.android.components.ActivityComponent;
import dagger.hilt.android.components.ApplicationComponent;
import dagger.hilt.android.qualifiers.ApplicationContext;
@Module
@InstallIn(ApplicationComponent.class)
public class DatabaseModule {
public static final ExecutorService databaseWriteExecutor = Executors.newFixedThreadPool(4);
@Provides
@Singleton
public WellbeingDatabase provideDatabaseService(@ApplicationContext Context context) {
return Room.databaseBuilder(context, WellbeingDatabase.class, "database_name")
.fallbackToDestructiveMigration()
.build();
}
}
|
package com.rent.entity;
// Generated 2016-4-2 16:06:25 by Hibernate Tools 4.0.0
import java.util.HashSet;
import java.util.Set;
/**
* RHouseDetail generated by hbm2java
*/
public class HouseDetail implements java.io.Serializable {
private int idHouseDetai;
private boolean rentalway;
private String region;
private int area;
private int floor;
private int floorall;
private String checkintime;
private int readcount;
private Set HouseMsgs = new HashSet(0);
public HouseDetail() {
}
public HouseDetail(int idHouseDetai, boolean rentalway, String region,
int area, int floor, int floorall, String checkintime, int readcount) {
this.idHouseDetai = idHouseDetai;
this.rentalway = rentalway;
this.region = region;
this.area = area;
this.floor = floor;
this.floorall = floorall;
this.checkintime = checkintime;
this.readcount = readcount;
}
public HouseDetail(int idHouseDetai, boolean rentalway, String region,
int area, int floor, int floorall, String checkintime,
int readcount, Set HouseMsgs) {
this.idHouseDetai = idHouseDetai;
this.rentalway = rentalway;
this.region = region;
this.area = area;
this.floor = floor;
this.floorall = floorall;
this.checkintime = checkintime;
this.readcount = readcount;
this.HouseMsgs = HouseMsgs;
}
public int getIdHouseDetai() {
return this.idHouseDetai;
}
public void setIdHouseDetai(int idHouseDetai) {
this.idHouseDetai = idHouseDetai;
}
public boolean isRentalway() {
return this.rentalway;
}
public void setRentalway(boolean rentalway) {
this.rentalway = rentalway;
}
public String getRegion() {
return this.region;
}
public void setRegion(String region) {
this.region = region;
}
public int getArea() {
return this.area;
}
public void setArea(int area) {
this.area = area;
}
public int getFloor() {
return this.floor;
}
public void setFloor(int floor) {
this.floor = floor;
}
public int getFloorall() {
return this.floorall;
}
public void setFloorall(int floorall) {
this.floorall = floorall;
}
public String getCheckintime() {
return this.checkintime;
}
public void setCheckintime(String checkintime) {
this.checkintime = checkintime;
}
public int getReadcount() {
return this.readcount;
}
public void setReadcount(int readcount) {
this.readcount = readcount;
}
public Set getHouseMsgs() {
return this.HouseMsgs;
}
public void setHouseMsgs(Set HouseMsgs) {
this.HouseMsgs = HouseMsgs;
}
}
|
package com.ybg.mq.guide;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import com.ybg.base.util.SpringContextUtils;
import com.ybg.mq.consumer.SimpleMessage;
import com.ybg.mq.domian.MQconsumer;
import com.ybg.mq.service.MQconsumerService;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.http.HttpMethod;
import com.alibaba.fastjson.JSON;
public class HttpConsumer {
public static String SIGNATURE = "Signature";
public static String NUM = "num";
public static String CONSUMERID = "ConsumerID";
public static String PRODUCERID = "ProducerID";
public static String TIMEOUT = "timeout";
public static String TOPIC = "Topic";
public static String AK = "AccessKey";
public static String BODY = "body";
public static String MSGHANDLE = "msgHandle";
public static String TIME = "time";
public static void getmsg(MQconsumer bean ) throws Exception {
// MQconsumerService mQconsumerService = (MQconsumerService) SpringContextUtils.getBean(MQconsumerService.class);
// MQconsumer bean = mQconsumerService.getIsUse();
HttpClient httpClient = new HttpClient();
httpClient.setMaxConnectionsPerDestination(1);
httpClient.start();
// Properties properties=new Properties();
// properties.load(HttpConsumer.class.getClassLoader().getResourceAsStream("user.properties"));
String topic = bean.getTopic(); // 请在user.properties配置您的topic
String url = bean.getUrl();// 公测集群配置为http://publictest-rest.ons.aliyun.com/
String ak = bean.getAk();// 请在user.properties配置您的Ak
String sk = bean.getSk();// 请在user.properties配置您的Sk
String cid = bean.getConsumerid();// 请在user.properties配置您的Consumer ID
String date = String.valueOf(new Date().getTime());
String sign = null;
String NEWLINE = "\n";
System.out.println(NEWLINE + NEWLINE);
while (true) {
try {
date = String.valueOf(new Date().getTime());
Request req = httpClient.POST(url + "?topic=" + topic + "&time=" + date + "&num=" + 32);
req.method(HttpMethod.GET);
ContentResponse response;
sign = SignGuide.getSign(sk, topic, cid, date);
req.header(SIGNATURE, sign);
req.header(AK, ak);
req.header(CONSUMERID, cid);
long start = System.currentTimeMillis();
response = req.send();
System.out.println("get cost:" + (System.currentTimeMillis() - start) / 1000 + " " + response.getStatus() + " " + response.getContentAsString());
List<SimpleMessage> list = null;
if (response.getContentAsString() != null && !response.getContentAsString().isEmpty()) {
list = JSON.parseArray(response.getContentAsString(), SimpleMessage.class);
}
if (list == null || list.size() == 0) {
Thread.sleep(100);
continue;
}
System.out.println("size is :" + list.size());
for (SimpleMessage simpleMessage : list) {
date = String.valueOf(new Date().getTime());
System.out.println("receive msg:" + simpleMessage.getBody() + " born time " + simpleMessage.getBornTime());
req = httpClient.POST(url + "?msgHandle=" + simpleMessage.getMsgHandle() + "&topic=" + topic + "&time=" + date);
req.method(HttpMethod.DELETE);
sign = SignGuide.deleteSign(sk, topic, cid, simpleMessage.getMsgHandle(), date);
req.header(SIGNATURE, sign);
req.header(AK, ak);
req.header(CONSUMERID, cid);
response = req.send();
System.out.println("delete msg:" + response.toString());
}
Thread.sleep(100);
} catch (Exception e) {
e.printStackTrace();
}
}
}
} |
package threadEx;
public class Ex1 {
//bad code
public static void main(String[] args) throws Exception{
new Thread(() -> {
for (int i = 0; i < 100; i++) {
System.out.println(Thread.currentThread().getName()+" B"+i);
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();;
for(int i = 0; i < 100; i++){
System.out.println(Thread.currentThread().getName()+" A" +i );
Thread.sleep(200);
}
}
}
|
package br.com.fiap.dao.impl;
import java.util.List;
import javax.persistence.EntityManager;
import br.com.fiap.dao.ChamadoDAO;
import br.com.fiap.entity.Chamado;
public class ChamadoDAOImpl extends GenericDAOImpl<Chamado, Integer> implements ChamadoDAO {
public ChamadoDAOImpl(EntityManager em) {
super(em);
}
@Override
public List<Chamado> buscarPorCodFuncionario(int codigo) {
return em.createQuery("from Chamado c where c.codigoFuncionario = :c",Chamado.class)
.setParameter("c", codigo).getResultList();
}
} |
/*
* Copyright 2008 Kjetil Valstadsve
*
* 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 vanadis.modules.examples.javacalc.div;
import vanadis.modules.examples.javacalc.calcservices.AbstractArithmetics;
import vanadis.modules.examples.javacalc.calcservices.Divisor;
import java.util.Arrays;
public class MyDivisor extends AbstractArithmetics implements Divisor {
@Override
public int div(int... args) {
System.out.println(this + " -> " + Arrays.toString(args));
int remainder = args[0];
for (int arg : subArgs(args)) {
remainder /= arg;
}
return remainder;
}
}
|
/*******************************************************************************
* Besiege
* by Kyle Dhillon
* Source Code available under a read-only license. Do not copy, modify, or distribute.
******************************************************************************/
package kyle.game.besiege.panels;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.scenes.scene2d.Group;
import kyle.game.besiege.*;
import kyle.game.besiege.Character;
import kyle.game.besiege.army.Army;
import kyle.game.besiege.army.ArmyPlayer;
import kyle.game.besiege.battle.Battle;
import kyle.game.besiege.battle.BattleActor;
import kyle.game.besiege.battle.Unit;
import kyle.game.besiege.location.Location;
import kyle.game.besiege.party.Party;
import kyle.game.besiege.party.Soldier;
import kyle.game.besiege.voronoi.Center;
public class SidePanel extends Group implements PanelHolder {
public static final int WIDTH = 190; // 180 works well
public final float MINI_ZOOM = 12;
public static float HEIGHT = WarchiefGame.HEIGHT;
public static SidePanel sidePanel;
private final String textureRegion = "panelBG";
private TextureRegion region;
private MapScreen mapScreen;
private Kingdom kingdom;
private OrthographicCamera camera;
private MiniMap minimap;
private BottomPanel bottom;
private SquadManagementScreen squadManagementScreen;
boolean squadScreenUp; // Is the squad screen active?
private transient Panel activePanel;
public transient Panel previousPanel;
public Character character;
public PanelParty playerPartyPanel;
public PanelUpgrades upgrades;
public PanelInventory inventory;
private ShapeRenderer debugSR;
private boolean hardStay; // stay on current panel until player clicks a button
private boolean softStay; // prevents automatically returning to previous panel when user mouses off of a panel.
// 5767 lines in Panels. \n[\s]* in *panel*.java
// lets see how much we can reduce.
public SidePanel(MapScreen mapScreen) {
this.mapScreen = mapScreen;
this.camera = (OrthographicCamera) mapScreen.getUICamera();
sidePanel = this;
this.region = new TextureRegion(Assets.atlas.findRegion(textureRegion));
bottom = new BottomPanel(this);
this.addActor(bottom);
minimap = new MiniMap(this);
this.addActor(minimap);
// this.debugAll();
debugSR = new ShapeRenderer();
debugSR.setAutoShapeType(true);
this.setHeight(camera.viewportHeight);
hardStay = false;
}
public void showSquadScreen() {
addActor(squadManagementScreen);
squadScreenUp = true;
}
public void hideSquadScreen() {
removeActor(squadManagementScreen);
squadScreenUp = false;
}
public void initializePanels() {
if (Soldier.WEAPON_NEEDED)
inventory = new PanelInventory(this);
playerPartyPanel = new PanelParty(this, kingdom.getPlayer().party);
upgrades = new PanelUpgrades(this, kingdom.getPlayer());
this.setActive(playerPartyPanel);
kingdom.currentPanel = getPlayer();
squadManagementScreen = new SquadManagementScreen(this);
// TODO don't add until we need it.
showSquadScreen();
squadManagementScreen.initialize(kingdom.getPlayer().party);
}
// For battlestage
public void initializePanels(Party party) {
if (Soldier.WEAPON_NEEDED)
inventory = new PanelInventory(this);
playerPartyPanel = new PanelParty(this, party);
this.setActive(playerPartyPanel);
if (kingdom != null) {
kingdom.currentPanel = getPlayer();
}
squadManagementScreen = new SquadManagementScreen(this);
// TODO don't add until we need it.
showSquadScreen();
squadManagementScreen.initialize(party);
}
public boolean isFullScreenVisible() {
return squadScreenUp;
}
@Override
public void act(float delta) {
this.setWidth(WIDTH);
this.setHeight(camera.viewportHeight);
this.setPosition(camera.viewportWidth-WIDTH, 0);
// this.setOrigin(getCamera().position.x - getX(), getCamera().position.y - getY());
// the second leak is here! it's in one of the children.
super.act(delta);
}
@Override
public void draw(Batch batch, float parentAlpha) {
batch.draw(region, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), 1, 1, getRotation());
super.draw(batch, parentAlpha);
debugSR.begin();
drawDebug(debugSR);
debugSR.end();
}
public void clean() {
this.clearChildren();
this.addActor(this.minimap);
this.addActor(this.bottom);
this.previousPanel = null;
this.activePanel = null;
}
public void returnToPrevious(boolean force) {
System.out.println("returning to previous");
if (!hardStay || force) {
System.out.println("setting prev to active");
setActive(previousPanel);
// System.out.println("Returning to previous " + ("" + previousPanel == null) + " " + hardStay + " " + previousPanel.getClass());
// if (previousPanel.getClass() == PanelParty.class) {
// System.out.println(((PanelParty) previousPanel).playerPartyPanel.getName());
// }
}
}
public OrthographicCamera getCamera() {
return camera;
}
public MiniMap getMiniMap() {
return minimap;
}
public MapScreen getMapScreen() {
return mapScreen;
}
public void setActive(Panel newActivePanel) {
if (hardStay) {
System.out.println("Hard stay, can't change panel");
return;
}
if (newActivePanel == null) {
System.out.println("Returning to null panel");
if (playerPartyPanel != null && activePanel != playerPartyPanel) {
setActive(playerPartyPanel);
kingdom.currentPanel = getPlayer();
}
return;
}
if (this.activePanel == newActivePanel) {
// setActive(/playerPartyPanel);
return;
};
System.out.println("setting panel: " + newActivePanel.getClass());
if (newActivePanel == upgrades) upgrades.updateSoldierTable();
if (newActivePanel.getClass() == PanelParty.class) {
// Force an update of the panel
((PanelParty) newActivePanel).party.updated = true;
System.out.println("just setactive");
}
if (newActivePanel.getClass() != PanelCenter.class && kingdom != null) {
kingdom.map.selectedCenter = null;
}
// if (!hardStay) {
this.removeActor(this.activePanel);
this.previousPanel = this.activePanel;
if (previousPanel != null) {
System.out.println("previous panel is now: " + previousPanel.getClass());
}
this.activePanel = newActivePanel;
this.addActor(activePanel);
// }s
}
public void setActiveDestination(Destination destination) {
Destination.DestType type = destination.getType();
if (type == Destination.DestType.POINT && !softStay) {
returnToPrevious(false);
System.out.println("setting active destination to a point...");
}
else {
softStay = false;
if (type == Destination.DestType.LOCATION)
setActiveLocation((Location) destination);
else if (type == Destination.DestType.ARMY)
setActiveArmy((Army) destination);
else if (type == Destination.DestType.BATTLE)
setActiveBattle(((BattleActor) destination).getBattle());
}
}
public void setActiveArmy(Army army) {
if (army.getParty().player) {
setActive(playerPartyPanel);
kingdom.currentPanel = getPlayer();
}
else {
PanelParty pp = new PanelParty(this, army.party);
setActive(pp);
}
}
public void setActiveLocation(Location location) {
if (location.panel == null)
location.panel = new PanelLocation(this, location);
setActive(location.panel);
}
public void setActiveBattle(Battle battle) {
PanelBattle2 pb = new PanelBattle2(this, battle);
setActive(pb);
}
public void setActiveFaction(Faction faction) {
PanelFaction pf = new PanelFaction(this, faction);
setActive(pf);
}
public void setActiveUnit(Unit unit) {
if (unit.isGeneral()) {
PanelGeneral pg = new PanelGeneral(this, unit, unit.soldier);
setActive(pg);
}
else {
PanelUnit pu = new PanelUnit(this, unit, unit.soldier);
setActive(pu);
}
}
public void setActiveUnit(Soldier s) {
// System.out.println("setting active unit: " + s.getName());
if (activePanel != null && activePanel.getPanelUnit() != null) {
if (activePanel.getPanelUnit().soldier == s) return;
}
if (s.isGeneral()) {
PanelGeneral pg = new PanelGeneral(this, null, s);
setActive(pg);
}
else {
PanelUnit pu = new PanelUnit(this, null, s);
setActive(pu);
}
}
public void setActiveCenter(Center center) {
PanelCenter pc = new PanelCenter(this, center);
kingdom.map.selectedCenter = center;
setActive(pc);
}
public void setPanelInventory() {
if (Soldier.WEAPON_NEEDED) return;
setActive(inventory);
}
public void setDefault() {
// if (force) this.setHardStay(false);
System.out.println("setting default");
if (mapScreen.battle != null) {
if (mapScreen.battle.isOver()) {
setActive(mapScreen.battle.postBattle);
} else setActiveBattle(mapScreen.battle);
}
else {
setActive(playerPartyPanel); // can change
playerPartyPanel.deselect();
kingdom.currentPanel = getPlayer();
previousPanel = null;
}
}
public static void createTooltip(String string) {
System.out.println(string);
}
public static void clearTooltip() {
}
public void press(int button) {
// for now, any button click will escape from hard stay
setHardStay(false);
if (button == 1)
activePanel.button1();
else if (button == 2)
activePanel.button2();
else if (button == 3)
activePanel.button3();
else if (button == 4)
activePanel.button4();
}
public void setKingdom(Kingdom kingdom) {
if (kingdom == null) {
throw new java.lang.AssertionError();
}
this.kingdom = kingdom;
}
public Kingdom getKingdom() {
return kingdom;
}
public ArmyPlayer getPlayer() {
if (kingdom != null) {
return kingdom.getPlayer();
} else return null;
}
// SoftStay makes it so a panel will be sticky until user mouses over another Loc, Army, or Battle (not point).
public void setSoftStay(boolean b) {
System.out.println("setting soft stay");
this.softStay = b;
}
// Hard stay means the player can only leave the panel by selecting a button.
// Used for forcing the player to make decisions -- to attack or not.
// ^ This is not actually true right now. Hardstay is set any time a player clicks a city/location.
// We just haven't figured out when to unset it.
// Right now, anytime you mouse away from a panel, it goes to player panel.
// Entering a location, sets that city panel to the current city no matter where your mouse is (overrides the mouse,
// soft stay). PlayerPanel is still the default panel, to return you just click "back". To switch back to city, click city again.
// To exit this "soft stay":
// click on any point (not location or army)
// clicking "back"
// if you click on another location or another army, it sets soft-stay to "false"
// TODO add yellow icon for when player is garrisoned in a city
// If you touch a
public void setHardStay(boolean b) {
System.out.println("setting hard stay: " + b);
hardStay = b;
// hardStay = false;
}
public boolean getStay() {
return hardStay;
}
public Crest getActiveCrest() {
if (activePanel == null) return null;
return activePanel.getCrest();
}
public TextureRegion getSecondCrest() {
if (activePanel == null) return null;
return activePanel.getSecondCrest();
}
public Soldier getSoldierInstead() {
if (activePanel == null) return null;
return activePanel.getSoldierInsteadOfCrest();
}
public Panel getActivePanel() {
return activePanel;
}
public void beginSaving() {
this.activePanel.beginSaving();
}
public void endSaving() {
this.activePanel.endSaving();
}
}
|
package com.tfjybj.integral.config;
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* mybatis-plus sql注入
*
* @author 刘雅雯
* @version 1.0.0
* @since 1.0.0 2019-1-24 11:36:03
*/
@Configuration
public class MyBatisPlusConfiguration {
@Bean
public ISqlInjector sqlInjector() {
return new LogicSqlInjector();
}
}
|
package br.com.senac.model;
public class Usuario {
private String login;
private String senha;
private int tipoUsuario;
private String nomeUsuario;
public Usuario() {
}
public Usuario(String login, String senha) {
super();
this.login = login;
this.senha = senha;
}
public String getLogin() {
return login;
}
public String getNomeUsuario() {
return nomeUsuario;
}
public void setNomeUsuario(String nomeUsuario) {
this.nomeUsuario = nomeUsuario;
}
public void setLogin(String login) {
this.login = login;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public int getTipoUsuario() {
return tipoUsuario;
}
public void setTipoUsuario(int tipoUsuario) {
this.tipoUsuario = tipoUsuario;
}
}
|
class Solution {
public int[] twoSum(int[] nums, int target) {
int residual;
int [] ret = new int[2];
ret[0] = -1;
ret[1] = -1;
int max = nums[0];
int min = nums[0];
for (int i = 1; i < nums.length; i++) {
if (nums[i] > max) {
max = nums[i];
} else if (nums[i] < min) {
min = nums[i];
}
}
for (int i = 0; i < nums.length; i++) {
residual = target - nums[i];
if (residual < min || residual > max) {
continue;
}
for (int j = i + 1; j < nums.length; j++) {
if (nums[j] - residual == 0) {
ret[0] = i;
ret[1] = j;
return ret;
}
}
}
return ret;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.