text
stringlengths
10
2.72M
package com.deltastuido.payment.port.alipay.api.model; import com.deltastuido.payment.domain.PayChannel; import com.deltastuido.payment.domain.PaymentEvent; import com.deltastuido.payment.port.alipay.api.AlipayRequest; import javax.ws.rs.QueryParam; import java.math.BigDecimal; import java.util.Date; /** * @author */ public class CreateDirectPayNotifyRequest extends AlipayRequest { @QueryParam("notify_time") Date notify_time;// 通知时间 Date 通知的发送时间。格式为yyyy-MM-dd HH:mm:ss。 不可空 2009-08-12 // 11:08:32 @QueryParam("notify_type") String notify_type;// 通知类型 String 通知的类型。 不可空 trade_status_sync @QueryParam("notify_id") String notify_id;// 通知校验ID String 通知校验ID。 不可空 // 70fec0c2730b27528665af4517c27b95 @QueryParam("sign_type") String sign_type;// 签名方式 String DSA、RSA、MD5三个值可选,必须大写。 不可空 DSA @QueryParam("sign") String sign;// 签名 String 请参见签名验证。 不可空 // _p_w_l_h_j0b_gd_aejia7n_ko4_m%2Fu_w_jd3_nx_s_k_mxus9_hoxg_y_r_lunli_pmma29_t_q%3D @QueryParam("out_trade_no") String out_trade_no;// 商户网站唯一订单号 String(64) // 对应商户网站的订单系统中的唯一订单号,非支付宝交易号。需保证在商户网站中的唯一性。是请求时对应的参数,原样返回。 // 可空 3618810634349901 @QueryParam("subject") String subject;// 商品名称 String(256) // 商品的标题/交易标题/订单标题/订单关键字等。它在支付宝的交易明细中排在第一列,对于财务对账尤为重要。是请求时对应的参数,原样通知回来。 // 可空 phone手机 @QueryParam("payment_type") String payment_type;// 支付类型 String(4) 取值范围请参见收款类型。 可空 1 @QueryParam("trade_no") String trade_no;// 支付宝交易号 String(64) 该交易在支付宝系统中的交易流水号。最长64位。 可空 // 2014040311001004370000361525 @QueryParam("trade_status") String trade_status;// 交易状态 String 取值范围请参见交易状态。 可空 TRADE_FINISHED @QueryParam("gmt_create") Date gmt_create;// 交易创建时间 Date 该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss。 可空 // 2008-10-22 20:49:31 @QueryParam("gmt_payment") Date gmt_payment;// 交易付款时间 Date 该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss。 可空 // 2008-10-22 20:49:50 @QueryParam("gmt_close") Date gmt_close;// 交易关闭时间 Date 交易关闭时间。格式为yyyy-MM-dd HH:mm:ss。 可空 2008-10-22 // 20:49:46 @QueryParam("refund_status") String refund_status;// 退款状态 String 取值范围请参见退款状态。 可空 REFUND_SUCCESS @QueryParam("gmt_refund") Date gmt_refund;// 退款时间 Date 卖家退款的时间,退款通知时会发送。格式为yyyy-MM-dd HH:mm:ss。 可空 // 2008-10-29 19:38:25 @QueryParam("seller_email") String seller_email;// 卖家支付宝账号 String(100) 卖家支付宝账号,可以是email和手机号码。 可空 // chao.chenc1@alipay.com @QueryParam("buyer_email") String buyer_email;// 买家支付宝账号 String(100) 买家支付宝账号,可以是Email或手机号码。 可空 // 13758698870 @QueryParam("seller_id") String seller_id;// 卖家支付宝账户号 String(30) 卖家支付宝账号对应的支付宝唯一用户号。以2088开头的纯16位数字。 // 可空 2088002007018916 @QueryParam("buyer_id") String buyer_id;// 买家支付宝账户号 String(30) 买家支付宝账号对应的支付宝唯一用户号。以2088开头的纯16位数字。 可空 // 2088002007013600 @QueryParam("price") Double price;// 商品单价 Number // 如果请求时使用的是total_fee,那么price等于total_fee;如果请求时使用的是price,那么对应请求时的price参数,原样通知回来。 // 可空 10.00 @QueryParam("total_fee") Double total_fee;// 交易金额 Number 该笔订单的总金额。请求时对应的参数,原样通知回来。 可空 10.00 @QueryParam("quantity") Double quantity;// 购买数量 Number // 如果请求时使用的是total_fee,那么quantity等于1;如果请求时使用的是quantity,那么对应请求时的quantity参数,原样通知回来。 // 可空 1 @QueryParam("body") String body;// 商品描述 String(400) 该笔订单的备注、描述、明细等。对应请求时的body参数,原样通知回来。 可空 Hello @QueryParam("discount") Double discount;// 折扣 Number 支付宝系统会把discount的值加到交易金额上,如果需要折扣,本参数为负数。 可空 -5 @QueryParam("is_total_fee_adjust") String is_total_fee_adjust;// 是否调整总价 String(1) 该交易是否调整过价格。 可空 N @QueryParam("use_coupon") String use_coupon;// 是否使用红包买家 String(1) 是否在交易过程中使用了红包。 可空 N @QueryParam("extra_common_param") String extra_common_param;// 公用回传参数 String // 用于商户回传参数,该值不能包含“=”、“&”等特殊字符。如果用户请求时传递了该参数,则返回给商户时会回传该参数。 // 可空 你好,这是测试商户的广告。 @QueryParam("business_scene") String business_scene;// 是否扫码支付 String // 回传给商户此标识为qrpay时,表示对应交易为扫码支付。目前只有qrpay一种回传值。非扫码支付方式下,目前不会返回该参数。 // 可空 qrpay public Date getNotify_time() { return notify_time; } public void setNotify_time(Date notify_time) { this.notify_time = notify_time; } public String getNotify_type() { return notify_type; } public void setNotify_type(String notify_type) { this.notify_type = notify_type; } public String getNotify_id() { return notify_id; } public void setNotify_id(String notify_id) { this.notify_id = notify_id; } public String getSign_type() { return sign_type; } public void setSign_type(String sign_type) { this.sign_type = sign_type; } public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; } public String getOut_trade_no() { return out_trade_no; } public void setOut_trade_no(String out_trade_no) { this.out_trade_no = out_trade_no; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getPayment_type() { return payment_type; } public void setPayment_type(String payment_type) { this.payment_type = payment_type; } public String getTrade_no() { return trade_no; } public void setTrade_no(String trade_no) { this.trade_no = trade_no; } public String getTrade_status() { return trade_status; } public void setTrade_status(String trade_status) { this.trade_status = trade_status; } public Date getGmt_create() { return gmt_create; } public void setGmt_create(Date gmt_create) { this.gmt_create = gmt_create; } public Date getGmt_payment() { return gmt_payment; } public void setGmt_payment(Date gmt_payment) { this.gmt_payment = gmt_payment; } public Date getGmt_close() { return gmt_close; } public void setGmt_close(Date gmt_close) { this.gmt_close = gmt_close; } public String getRefund_status() { return refund_status; } public void setRefund_status(String refund_status) { this.refund_status = refund_status; } public Date getGmt_refund() { return gmt_refund; } public void setGmt_refund(Date gmt_refund) { this.gmt_refund = gmt_refund; } public String getSeller_email() { return seller_email; } public void setSeller_email(String seller_email) { this.seller_email = seller_email; } public String getBuyer_email() { return buyer_email; } public void setBuyer_email(String buyer_email) { this.buyer_email = buyer_email; } public String getSeller_id() { return seller_id; } public void setSeller_id(String seller_id) { this.seller_id = seller_id; } public String getBuyer_id() { return buyer_id; } public void setBuyer_id(String buyer_id) { this.buyer_id = buyer_id; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public Double getTotal_fee() { return total_fee; } public void setTotal_fee(Double total_fee) { this.total_fee = total_fee; } public Double getQuantity() { return quantity; } public void setQuantity(Double quantity) { this.quantity = quantity; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public Double getDiscount() { return discount; } public void setDiscount(Double discount) { this.discount = discount; } public String getIs_total_fee_adjust() { return is_total_fee_adjust; } public void setIs_total_fee_adjust(String is_total_fee_adjust) { this.is_total_fee_adjust = is_total_fee_adjust; } public String getUse_coupon() { return use_coupon; } public void setUse_coupon(String use_coupon) { this.use_coupon = use_coupon; } public String getExtra_common_param() { return extra_common_param; } public void setExtra_common_param(String extra_common_param) { this.extra_common_param = extra_common_param; } public String getBusiness_scene() { return business_scene; } public void setBusiness_scene(String business_scene) { this.business_scene = business_scene; } public PaymentEvent toPaymentEvent() { PaymentEvent event = new PaymentEvent(); event.setBillId(this.getOut_trade_no()); event.setChannel(PayChannel.Alipay); event.setPaidAmount(BigDecimal.valueOf(this.getTotal_fee())); event.setRemark(this.toString()); event.setTxNo(this.getTrade_no()); return event; } @Override public String toString() { return "AlipayNotifyRequest [notify_time=" + notify_time + ", notify_type=" + notify_type + ", notify_id=" + notify_id + ", sign_type=" + sign_type + ", sign=" + sign + ", out_trade_no=" + out_trade_no + ", subject=" + subject + ", payment_type=" + payment_type + ", trade_no=" + trade_no + ", trade_status=" + trade_status + ", gmt_create=" + gmt_create + ", gmt_payment=" + gmt_payment + ", gmt_close=" + gmt_close + ", refund_status=" + refund_status + ", gmt_refund=" + gmt_refund + ", seller_email=" + seller_email + ", buyer_email=" + buyer_email + ", seller_id=" + seller_id + ", buyer_id=" + buyer_id + ", price=" + price + ", total_fee=" + total_fee + ", quantity=" + quantity + ", body=" + body + ", discount=" + discount + ", is_total_fee_adjust=" + is_total_fee_adjust + ", use_coupon=" + use_coupon + ", extra_common_param=" + extra_common_param + ", business_scene=" + business_scene + "]"; } }
package com.danvegeto.tsp; public class Link { Point p1, p2; Link(Point p1, Point p2) { this.p1 = p1; this.p2 = p2; } double dist() { return p1.dist(p2); } }
package ucll.da.reportdomain.domain; import com.fasterxml.jackson.annotation.JsonFormat; import javax.persistence.*; import java.util.Calendar; import java.util.List; import javax.validation.constraints.NotNull; /** * Created by Joren on 3/05/2017. */ @Entity(name = "Report") public class Report { @Id @NotNull @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @NotNull @Column(unique = true) private String fileName; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+2") @Temporal(TemporalType.TIMESTAMP) private Calendar date; private List<String> details; public Report() { } public Report(String fileName) throws DomainException { this.setFileName(fileName); this.setDate(Calendar.getInstance()); } public Report(String fileName, Calendar date) throws DomainException { this.setFileName(fileName); this.setDate(date); } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getFileName() { return fileName; } public void setFileName(String fileName) throws DomainException { if (fileName == null || fileName.equals("")) { throw new DomainException("The fileName can't be null or empty."); } this.fileName = fileName; } public Calendar getDate() { return date; } public void setDate(Calendar date) throws DomainException { if (date == null) { throw new DomainException("The date can't be null"); } this.date = date; } public List<String> getDetails() { return details; } public void setDetails(List<String> details) { this.details = details; } }
package com.jack.jkbase.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.jack.jkbase.entity.SysUser; public interface SysUserMapper extends BaseMapper<SysUser>{ }
package crawler; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import twitter4j.Paging; import twitter4j.Query; import twitter4j.QueryResult; import twitter4j.Status; import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; import twitter4j.conf.ConfigurationBuilder; /** * * @author christangga */ public class Crawler { public static final int TWEETS_COUNT = 10000; static class OAuth { public String name; public String consumerKey; public String consumerSecret; public String accessToken; public String accessTokenSecret; public OAuth(String name, String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) { this.name = name; this.consumerKey = consumerKey; this.consumerSecret = consumerSecret; this.accessToken = accessToken; this.accessTokenSecret = accessTokenSecret; } } enum OAuthUser { christ, ivana, gilang, teo } static ConfigurationBuilder cb = new ConfigurationBuilder(); static TwitterFactory tf = new TwitterFactory(cb.build()); static Twitter twitter = tf.getInstance(); public static List<Status> getTimeline(String username, int pageNo) throws TwitterException { Paging paging = new Paging(pageNo, 100); List<Status> statuses = twitter.getUserTimeline(username, paging); return statuses; } public static List<Status> search(String queryString, long maxId) throws TwitterException { Query query = new Query(queryString + " +exclude:retweets"); query.setCount(100); query.setMaxId(maxId); QueryResult result = twitter.search(query); return result.getTweets(); } public static void setOAuth(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) { cb = new ConfigurationBuilder(); cb.setDebugEnabled(true); cb.setOAuthConsumerKey(consumerKey); cb.setOAuthConsumerSecret(consumerSecret); cb.setOAuthAccessToken(accessToken); cb.setOAuthAccessTokenSecret(accessTokenSecret); tf = new TwitterFactory(cb.build()); twitter = tf.getInstance(); } public static void setProxy(String username, String password) { cb.setHttpProxyHost("cache.itb.ac.id"); cb.setHttpProxyPort(8080); cb.setHttpProxyUser(username); cb.setHttpProxyPassword(password); } public static void setOAuthUser(List<OAuth> oAuthList, String username) { for (OAuth oAuth : oAuthList) { if (oAuth.name.equals(username)) { setOAuth(oAuth.consumerKey, oAuth.consumerSecret, oAuth.accessToken, oAuth.accessTokenSecret); break; } } } public static List<OAuth> getOAuthList(String file) throws FileNotFoundException, IOException { BufferedReader br = new BufferedReader(new FileReader("in/oauth.txt")); String line = null; List<OAuth> oAuthList = new ArrayList<>(); while ((line = br.readLine()) != null) { String[] splittedLine = line.split(","); OAuth oAuth = new OAuth(splittedLine[0], splittedLine[1], splittedLine[2], splittedLine[3], splittedLine[4]); oAuthList.add(oAuth); } return oAuthList; } public static String getDateString(Date date) { String dateString = ""; dateString += String.format("%02d", date.getYear() + 1900) + "-"; dateString += String.format("%02d", date.getMonth() + 1) + "-"; dateString += String.format("%02d", date.getDate()) + " "; dateString += String.format("%02d", date.getHours()) + ":"; dateString += String.format("%02d", date.getMinutes()) + ":"; dateString += String.format("%02d", date.getSeconds()); return dateString; } /** * @param args the command line arguments */ public static void main(String[] args) { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter("res/" + "diskon" + ".csv")); HashSet<String> tweetSet = new HashSet<>(); String proxyUsername = ""; String proxyPassword = ""; String queryString = ""; if (args[0].equals("-p")) { proxyUsername = args[1]; proxyPassword = args[2]; for (int i = 3; i < args.length; ++i) { queryString += args[i] + " "; } } else { for (int i = 0; i < args.length; ++i) { if (args[i].equals("-p")) { proxyUsername = args[i + 1]; proxyPassword = args[i + 2]; break; } else { queryString += args[i] + " "; } } } queryString = queryString.trim(); List<OAuth> oAuthList = getOAuthList("in/oauth.txt"); // setProxy(proxyUsername, proxyPassword); setOAuthUser(oAuthList, "teo"); int userId = 0; long maxId = Long.MAX_VALUE; int pageNo = 1; int limitRemaining = twitter.getRateLimitStatus().get("/search/tweets").getRemaining(); System.out.println("===== search remaining " + limitRemaining + " ====="); List<Status> statuses = search(queryString, maxId); // List<Status> statuses = getTimeline(queryString, pageNo); writer.write("\"content\",\"original_id\",\"from\",\"date_created\",\"sentiment\",\"original_sentiment\"\n"); while (tweetSet.size() < TWEETS_COUNT && statuses.size() > 0) { limitRemaining--; for (Status status : statuses) { String tweet = status.getText(); if (tweet.startsWith("\"")) { tweet = tweet.substring(1, tweet.length()); } if (tweet.endsWith("\"")) { tweet = tweet.substring(0, tweet.length() - 1); } List<String> splittedTweet = new LinkedList<>(Arrays.asList(tweet.split("[\\s\\r\\n]+"))); for (int j = splittedTweet.size() - 1; j >= 0; --j) { if (splittedTweet.get(j).contains("http") || splittedTweet.get(j).endsWith("..")) { splittedTweet.remove(j); } } System.out.println(status.getText()); if (tweetSet.add(String.join(" ", splittedTweet))) { System.out.println("\"" + String.join(" ", splittedTweet) + "\",\"" + status.getId() + "\",\"" + status.getUser().getScreenName() + "\",\"" + getDateString(status.getCreatedAt()) + "\",\"\",\"\""); writer.write("\"" + String.join(" ", splittedTweet) + "\",\"" + status.getId() + "\",\"" + status.getUser().getScreenName() + "\",\"" + getDateString(status.getCreatedAt()) + "\",\"\",\"\"\n"); } maxId = status.getId(); } if (limitRemaining <= 3) { switch (userId) { case 0: setOAuthUser(oAuthList, "christ"); userId++; break; case 1: setOAuthUser(oAuthList, "ivana"); userId++; break; case 2: setOAuthUser(oAuthList, "gilang"); userId++; break; case 3: setOAuthUser(oAuthList, "teo"); userId = 0; break; } limitRemaining = twitter.getRateLimitStatus().get("/search/tweets").getRemaining(); } System.out.println("===== search remaining " + limitRemaining + " ====="); statuses = search(queryString, maxId); pageNo++; // statuses = getTimeline(queryString, pageNo); } } catch (IOException | TwitterException ex) { Logger.getLogger(Crawler.class.getName()).log(Level.SEVERE, null, ex); } finally { try { if (writer != null) { writer.flush(); } } catch (IOException ex) { Logger.getLogger(Crawler.class.getName()).log(Level.SEVERE, null, ex); } } } }
package com.em.service; import com.em.bean.Employee; import com.em.bean.Address; import com.em.dao.EmployeeDao; import com.em.dao.EmployeeDaoMysql; import com.em.exception.EmployeeException; public class EmployeeServiceImpt implements EmployeeService { private EmployeeDao employeeDao = new EmployeeDaoMysql(); public int createEmployee(Employee employee, Address address) throws EmployeeException { return employeeDao.createEmployee(employee, address); } public int updateEmployee(int E_ID, Employee employee, Address address) throws EmployeeException { return employeeDao.updateEmployee(E_ID, employee, address); } public void displayEmployee(int E_ID ) throws EmployeeException { employeeDao.displayEmployee(E_ID); } public int deleteEmployee(int E_ID) throws EmployeeException { return employeeDao.deleteEmployee(E_ID); } }
package com.tencent.mm.plugin.facedetect.b; import com.tencent.mm.ab.b; import com.tencent.mm.ab.b.a; import com.tencent.mm.ab.e; import com.tencent.mm.ab.l; import com.tencent.mm.network.k; import com.tencent.mm.network.q; import com.tencent.mm.protocal.c.vp; import com.tencent.mm.protocal.c.vq; import com.tencent.mm.sdk.platformtools.x; public final class r extends l implements k { private b diG; private e diJ; public String mFileName = ""; public r(String str, long j, String str2, String str3, String str4) { a aVar = new a(); aVar.dIG = new vp(); aVar.dIH = new vq(); aVar.uri = "/cgi-bin/mmbiz-bin/usrmsg/facevideobindbioid"; aVar.dIF = 1197; aVar.dII = 0; aVar.dIJ = 0; this.diG = aVar.KT(); this.mFileName = str; vp vpVar = (vp) this.diG.dID.dIL; vpVar.bPS = str2; vpVar.ryO = j; vpVar.ryP = str4; vpVar.ryT = str3; } public final int getType() { return 1197; } public final int a(com.tencent.mm.network.e eVar, e eVar2) { this.diJ = eVar2; return a(eVar, this.diG, this); } public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) { x.d("MicroMsg.NetSceneFaceThirdBindVideo", "hy: errType: %d, errCode: %d, errMsg: %s", new Object[]{Integer.valueOf(i2), Integer.valueOf(i3), str}); if (this.diJ != null) { this.diJ.a(i2, i3, str, this); } } }
package fr.doranco.ecommerce.metier; import fr.doranco.ecommerce.entity.pojo.Params; public interface IParamsMetier { void addParams(Params params) throws Exception; Params getParamsById(Integer id) throws Exception; void updateParams(Params params) throws Exception; void removeParams(Params params) throws Exception; }
package logica; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.KeyStroke; import myUtilities.MyLabel; public class Game extends JPanel { MiniGalaga app; Jugador jugador; Falcon falcon; Enemy[] enemies = new Enemy[10]; SpecialItem specialItem; int tiempo; MyLabel lblTiempo = new MyLabel("Tiempo: 60"); MyLabel lblPuntos = new MyLabel("Puntos: 0"); boolean paused = true; boolean over = false; boolean running = true; Thread threadRenderScreen; Thread threadTimer; Thread threadGenerateEnemies; Thread threadGenerateItems; public Game(MiniGalaga app) { this.app = app; setPreferredSize(new Dimension(600,650)); setBackground(Color.BLACK); setLayout(null); add(lblPuntos); add(lblTiempo); lblPuntos.setBounds(500, 0, 100, 15); lblTiempo.setBounds(500, 20, 100, 15); } public void paintComponent(Graphics g) { super.paintComponent(g); if (jugador != null) lblPuntos.setText("Puntos: "+jugador.puntos); if (specialItem != null && specialItem.active) specialItem.drawItem(g); if(falcon != null) { if (falcon.alive) falcon.drawNaveJugador(g); for (FalconFire f : falcon.fire) { if (f != null && f.active) { f.drawBullet(g); } } } for (Enemy e : enemies) { if (e != null) { if (e.vidaRestante > 0) e.drawEnemy(g); if (e instanceof Cazador) { for (CazadorFire f : ((Cazador) e).fire) if (f != null && f.active) f.drawBullet(g); } } } } public void newGame() { over = true; //To stop threads from generating more sprites running = false; jugador = new Jugador(JOptionPane.showInputDialog(this, "Cual es tu nombre? Tu inicial sera tu arma", "Juego Nuevo", JOptionPane.QUESTION_MESSAGE)); getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).clear(); falcon = new Falcon(this, KeyStroke.getKeyStroke(jugador.name.toLowerCase().charAt(0))); falcon.enableActions(true); paused = false; over = false; running = true; tiempo = 60; threadRenderScreen = new Thread(new ThreadRenderScreen(this)); threadRenderScreen.start(); threadTimer = new Thread(new ThreadTimer(this)); threadTimer.start(); threadGenerateEnemies = new Thread(new ThreadGenerateEnemies(this)); threadGenerateEnemies.start(); threadGenerateItems = new Thread(new ThreadGenerateItems(this)); threadGenerateItems.start(); } public void pauseGame() { paused = true; if (falcon != null) falcon.enableActions(false); } public void resumeGame() { paused = false; if (falcon != null) falcon.enableActions(true); } public void gameOver() { over = true; falcon.right = false; falcon.left = false; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).clear(); String message = "Gracias por jugar!\nLograste "+jugador.puntos+" puntos\n"; if (app.checkTop3(jugador)) message += "Entraste a la lista del Top 3"; JOptionPane.showMessageDialog(this, message, "Game Over", JOptionPane.INFORMATION_MESSAGE); } }
package com.bluebirdaward.mapassistant; import android.app.ActionBar; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import com.bluebirdaward.mapassistant.gmmap.R; public class SplashActivity extends AppCompatActivity { private static int SPLASH_TIME_OUT = 3000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. //ActionBar actionBar = getActionBar(); //actionBar.hide(); new Handler().postDelayed(new Runnable() { /* * Showing splash screen with a timer. This will be useful when you * want to show case your app logo / company */ @Override public void run() { // This method will be executed once the timer is over // Start your app main activity Intent i = new Intent(SplashActivity.this, MainActivity.class); startActivity(i); // close this activity finish(); } }, SPLASH_TIME_OUT); } }
package com.tencent.mm.plugin.game.ui; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.widget.ImageView; import android.widget.LinearLayout; import com.tencent.mm.plugin.game.e.c; import com.tencent.mm.plugin.game.f.f; import com.tencent.mm.plugin.game.model.an; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.rtmp.TXLiveConstants; public final class e extends LinearLayout implements OnClickListener { private LayoutInflater Bc = ((LayoutInflater) this.mContext.getSystemService("layout_inflater")); private int jNv; private String mAppId; private Context mContext; private static class a { public String jLt; public int jOu; public String jumpUrl; public a(int i, String str, String str2) { this.jOu = i; this.jumpUrl = str; this.jLt = str2; } } public e(Context context) { super(context); this.mContext = context; setOrientation(1); } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ public final void a(com.tencent.mm.plugin.game.d.ae r12, java.lang.String r13, int r14, int r15) { /* r11 = this; if (r12 == 0) goto L_0x000a; L_0x0002: r0 = r12.jQF; r0 = com.tencent.mm.sdk.platformtools.bi.cX(r0); if (r0 == 0) goto L_0x0010; L_0x000a: r0 = 8; r11.setVisibility(r0); L_0x000f: return; L_0x0010: r11.mAppId = r13; r11.jNv = r15; r0 = r12.jQF; r7 = r0.iterator(); L_0x001a: r0 = r7.hasNext(); if (r0 == 0) goto L_0x000f; L_0x0020: r0 = r7.next(); r4 = r0; r4 = (com.tencent.mm.plugin.game.d.j) r4; if (r4 == 0) goto L_0x001a; L_0x0029: r5 = new com.tencent.mm.plugin.game.e.e$a$a; r5.<init>(); r0 = r4.jPF; switch(r0) { case 1: goto L_0x004a; case 2: goto L_0x00e3; default: goto L_0x0033; }; L_0x0033: r0 = 2; if (r14 != r0) goto L_0x001a; L_0x0036: r0 = r11.mContext; r1 = 10; r2 = 1002; // 0x3ea float:1.404E-42 double:4.95E-321; r3 = r4.jPC; r4 = r4.jPA; r6 = com.tencent.mm.plugin.game.model.an.Dx(r4); r4 = r13; r5 = r15; com.tencent.mm.plugin.game.model.an.a(r0, r1, r2, r3, r4, r5, r6); goto L_0x001a; L_0x004a: r0 = r4.jPD; if (r0 == 0) goto L_0x001a; L_0x004e: r11.h(r11); r0 = r11.Bc; r1 = com.tencent.mm.plugin.game.f.f.game_center_4_block_content_multiline_view; r2 = 1; r6 = r0.inflate(r1, r11, r2); r0 = com.tencent.mm.plugin.game.f.e.multiline_module; r0 = r6.findViewById(r0); r0 = (android.widget.TextView) r0; r1 = com.tencent.mm.plugin.game.f.e.multiline_title; r1 = r6.findViewById(r1); r1 = (android.widget.TextView) r1; r2 = com.tencent.mm.plugin.game.f.e.multiline_desc; r2 = r6.findViewById(r2); r2 = (com.tencent.mm.plugin.game.widget.EllipsizingTextView) r2; r3 = 2; r2.setMaxLines(r3); r3 = com.tencent.mm.plugin.game.f.e.multiline_picture; r3 = r6.findViewById(r3); r3 = (android.widget.ImageView) r3; r8 = r11.mContext; r9 = r4.jPB; r10 = r0.getTextSize(); r8 = com.tencent.mm.pluginsdk.ui.d.j.a(r8, r9, r10); r0.setText(r8); r0 = r11.mContext; r8 = r4.jPD; r8 = r8.bHD; r9 = r1.getTextSize(); r0 = com.tencent.mm.pluginsdk.ui.d.j.a(r0, r8, r9); r1.setText(r0); r0 = r11.mContext; r1 = r4.jPD; r1 = r1.jOS; r8 = r2.getTextSize(); r0 = com.tencent.mm.pluginsdk.ui.d.j.a(r0, r1, r8); r2.setText(r0); r0 = r4.jPD; r0 = r0.jOT; r0 = com.tencent.mm.sdk.platformtools.bi.oW(r0); if (r0 != 0) goto L_0x00dd; L_0x00b9: r0 = com.tencent.mm.plugin.game.e.e.aVj(); r1 = r4.jPD; r1 = r1.jOT; r2 = r5.aVk(); r0.a(r3, r1, r2); L_0x00c8: r0 = new com.tencent.mm.plugin.game.ui.e$a; r1 = r4.jPC; r2 = r4.jPD; r2 = r2.jOU; r3 = r4.jPA; r0.<init>(r1, r2, r3); r6.setTag(r0); r6.setOnClickListener(r11); goto L_0x0033; L_0x00dd: r0 = 8; r3.setVisibility(r0); goto L_0x00c8; L_0x00e3: r0 = r4.jPE; if (r0 == 0) goto L_0x001a; L_0x00e7: r11.h(r11); r0 = r11.Bc; r1 = com.tencent.mm.plugin.game.f.f.game_center_4_block_content_singleline_view; r2 = 1; r3 = r0.inflate(r1, r11, r2); r0 = com.tencent.mm.plugin.game.f.e.singleline_module; r0 = r3.findViewById(r0); r0 = (android.widget.TextView) r0; r1 = com.tencent.mm.plugin.game.f.e.singleline_title; r1 = r3.findViewById(r1); r1 = (android.widget.TextView) r1; r2 = com.tencent.mm.plugin.game.f.e.singleline_picture; r2 = r3.findViewById(r2); r2 = (android.widget.ImageView) r2; r6 = r11.mContext; r8 = r4.jPB; r9 = r0.getTextSize(); r6 = com.tencent.mm.pluginsdk.ui.d.j.a(r6, r8, r9); r0.setText(r6); r0 = r11.mContext; r6 = r4.jPE; r6 = r6.bHD; r8 = r1.getTextSize(); r0 = com.tencent.mm.pluginsdk.ui.d.j.a(r0, r6, r8); r1.setText(r0); r0 = r4.jPE; r0 = r0.jOT; r0 = com.tencent.mm.sdk.platformtools.bi.oW(r0); if (r0 != 0) goto L_0x016f; L_0x0135: r0 = r4.jPE; r0 = r0.jTr; r1 = 1; if (r0 != r1) goto L_0x0167; L_0x013c: r0 = 1; r5.kdA = r0; r0 = com.tencent.mm.plugin.game.f.d.game_default_square; r5.kdD = r0; L_0x0143: r0 = com.tencent.mm.plugin.game.e.e.aVj(); r1 = r4.jPE; r1 = r1.jOT; r5 = r5.aVk(); r0.a(r2, r1, r5); L_0x0152: r0 = new com.tencent.mm.plugin.game.ui.e$a; r1 = r4.jPC; r2 = r4.jPE; r2 = r2.jOU; r5 = r4.jPA; r0.<init>(r1, r2, r5); r3.setTag(r0); r3.setOnClickListener(r11); goto L_0x0033; L_0x0167: r0 = 1; r5.dXW = r0; r0 = com.tencent.mm.plugin.game.f.d.game_default_round; r5.kdD = r0; goto L_0x0143; L_0x016f: r0 = 8; r2.setVisibility(r0); goto L_0x0152; */ throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.game.ui.e.a(com.tencent.mm.plugin.game.d.ae, java.lang.String, int, int):void"); } public final void onClick(View view) { if (view.getTag() == null || !(view.getTag() instanceof a)) { x.w("MicroMsg.GameBlockContentView", "getTag is null"); return; } a aVar = (a) view.getTag(); if (bi.oW(aVar.jumpUrl)) { x.w("MicroMsg.GameBlockContentView", "jumpUrl is null"); return; } an.a(this.mContext, 10, TXLiveConstants.PUSH_EVT_PUSH_BEGIN, aVar.jOu, c.r(this.mContext, aVar.jumpUrl, "game_center_mygame_comm"), this.mAppId, this.jNv, an.Dx(aVar.jLt)); } private void h(ViewGroup viewGroup) { ImageView imageView = (ImageView) this.Bc.inflate(f.game_divide_line, viewGroup, false); MarginLayoutParams marginLayoutParams = (MarginLayoutParams) imageView.getLayoutParams(); marginLayoutParams.leftMargin = com.tencent.mm.bp.a.fromDPToPix(this.mContext, 20); imageView.setLayoutParams(marginLayoutParams); viewGroup.addView(imageView); } }
package twoLayerNN; import java.util.Arrays; public class Neuron { double bias; double weighted_input; public Neuron (double bias) { this.bias = bias; } public double calculate_output (double[] inputs, double[] weights) { this.weighted_input = calculate_weighted_input(inputs, weights); return NeuralNetwork.activate(weighted_input); } public double calculate_weighted_input (double[] inputs, double[] weights) { double result = this.bias; for (int i = 0; i < inputs.length; i++) { result += inputs[i] * weights[i]; } return result; } public void update_bias (double bias) { this.bias = bias; } public void inspect (double[] weights) { System.out.println("\t NEURON: weights = " + Arrays.toString(weights)); System.out.println("\t bias = " + bias); } }
package searchcodej.model; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; public class SourceFile { private String content; private String path; private String name; private String extension; private List<Line> lines; public SourceFile(File file) throws IOException { this.content = FileUtils.readFileToString(file); this.extension = FilenameUtils.getExtension(file.getName()); this.path = file.getAbsolutePath(); this.name = file.getName(); } public SourceFile(String content) { this.content = content; } public List<String[]> getLines(PartOfString part) { List<String[]> result = new ArrayList<>(); int numberOfLine = 0; boolean firstLine = false; for (Line l : this.getLines()) { numberOfLine++; PartOfString line = l.getPartOfString(); if (part.isInside(line) || (firstLine && finalLineFound(part, line))) { String[] r = new String[2]; r[0] = String.valueOf(numberOfLine); r[1] = l.getContent(); result.add(r); break; } else if (!firstLine && firstLineFound(part, line)) { String[] r = new String[2]; r[0] = String.valueOf(numberOfLine); r[1] = l.getContent(); result.add(r); firstLine = true; } else if (firstLine) { String[] r = new String[2]; r[0] = String.valueOf(numberOfLine); r[1] = l.getContent(); result.add(r); } } return result; } private boolean firstLineFound(PartOfString part, PartOfString line) { return part.getBeginIndex() >= line.getBeginIndex() && part.getBeginIndex() <= line.getEndIndex(); } private boolean finalLineFound(PartOfString part, PartOfString line) { return part.getEndIndex() <= line.getEndIndex(); } public void setLines(List<Line> lines) { this.lines = lines; } public String getContent() { return content; } public String getPath() { return path; } public String getName() { return name; } public String getExtension() { return extension; } public List<Line> getLines() { return lines; } }
package inhetritance2.service; public class College { protected String collegeName; protected String address; public College(String collegeName, String address) { this.collegeName = collegeName; this.address = address; } public void showCollegeDetails() { System.out.println("Name of College : "+collegeName); System.out.println("address : "+address); } }
package com.cskaoyan.controller; import com.cskaoyan.bean.BaseResultVo; import com.cskaoyan.bean.DeviceCheck; import com.cskaoyan.bean.QueryStatus; import com.cskaoyan.service.DeviceCheckService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @Author: zero * @Date: 2019/5/19 22:46 * @Version 1.0 */ @Controller public class DeviceCheckController { @Autowired DeviceCheckService deviceCheckService; /* * 查询设备例检首页 * */ @RequestMapping("/device/deviceCheck") public String deviceCheck(){ return "deviceCheck"; } @RequestMapping("/deviceCheck/list") @ResponseBody public BaseResultVo getDeviceCheckList(int rows,int page){ return deviceCheckService.getDeviceCheckList(rows,page); } /* * 按设备例检编号模糊查询 * */ @RequestMapping("/deviceCheck/search_deviceCheck_by_deviceCheckId") @ResponseBody public BaseResultVo SearchDeviceCheckById(String searchValue,int rows,int page){ return deviceCheckService.searchDeviceCheckById(searchValue,rows,page); } /* * 按设备名称模糊查询 * */ @RequestMapping("/deviceCheck/search_deviceCheck_by_deviceName") @ResponseBody public BaseResultVo SearchDeviceCheckByName(String searchValue,int rows,int page){ return deviceCheckService.searchDeviceCheckByName(searchValue,rows,page); } /* * 新增设备例检 * */ @RequestMapping("/deviceCheck/add_judge") @ResponseBody public QueryStatus deviceCheckAddJudge(){ return new QueryStatus(); } @RequestMapping("/deviceCheck/add") public String deviceCheckAdd(){ return "deviceCheck_add"; } @RequestMapping("/deviceCheck/insert") @ResponseBody public QueryStatus insertDeviceCheck(DeviceCheck deviceCheck){ return deviceCheckService.insertDeviceCheck(deviceCheck); } /* * 编辑设备例检 * */ @RequestMapping("/deviceCheck/edit_judge") @ResponseBody public QueryStatus deviceCheckEditJudge(){ return new QueryStatus(); } @RequestMapping("/deviceCheck/edit") public String deviceCheckEdit(){ return "deviceCheck_edit"; } @RequestMapping("/deviceCheck/update") @ResponseBody public QueryStatus updateDeviceCheck(DeviceCheck deviceCheck){ return deviceCheckService.updateDeviceCheck(deviceCheck); } @RequestMapping("/deviceCheck/delete_judge") @ResponseBody public QueryStatus deviceCheckDeleteJudge(){ return new QueryStatus(); } /* * 删除设备例检 * */ @RequestMapping("/deviceCheck/delete_batch") @ResponseBody public QueryStatus deleteDeviceCheck(String[] ids){ return deviceCheckService.deleteDeviceCheck(ids); } }
package br.com.allerp.allbanks.view.cadastros; import java.io.IOException; import java.io.OutputStream; import java.util.Arrays; import java.util.HashMap; import java.util.List; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.ChoiceRenderer; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.PasswordTextField; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; import org.apache.wicket.request.resource.ContentDisposition; import org.apache.wicket.spring.injection.annot.SpringBean; import org.apache.wicket.util.resource.AbstractResourceStreamWriter; import org.apache.wicket.util.string.AppendingStringBuffer; import br.com.allerp.allbanks.entity.colaborador.Funcionario; import br.com.allerp.allbanks.entity.conta.Agencia; import br.com.allerp.allbanks.entity.conta.Banco; import br.com.allerp.allbanks.entity.conta.Conta; import br.com.allerp.allbanks.entity.conta.Titular; import br.com.allerp.allbanks.entity.enums.Contas; import br.com.allerp.allbanks.entity.enums.Perfis; import br.com.allerp.allbanks.entity.enums.Status; import br.com.allerp.allbanks.entity.user.User; import br.com.allerp.allbanks.relatorio.GeradorRelatorio; import br.com.allerp.allbanks.service.UserService; import br.com.allerp.allbanks.service.colaborador.FuncionarioService; import br.com.allerp.allbanks.service.conta.AgenciaService; import br.com.allerp.allbanks.service.conta.BancoService; import br.com.allerp.allbanks.service.conta.ContaService; import br.com.allerp.allbanks.service.conta.TitularService; import br.com.allerp.allbanks.view.DashboardPage; import br.com.allerp.allbanks.view.cadastros.panels.CadAgPanel; import br.com.allerp.allbanks.view.cadastros.panels.CadBancoPanel; import br.com.allerp.allbanks.view.cadastros.panels.CadContaPanel; import br.com.allerp.allbanks.view.cadastros.panels.CadFuncPanel; import br.com.allerp.allbanks.view.cadastros.panels.CadTitularPanel; import br.com.allerp.allbanks.view.cadastros.panels.CadUserPanel; import br.com.allerp.allbanks.view.cadastros.panels.ExcluirPanel; import br.com.allerp.allbanks.view.panel.NotificacaoPanel; public class CadastrosPage extends DashboardPage { private static final long serialVersionUID = -6335704257672944888L; // ---------------------------- SERVICES --------------------------------// @SpringBean(name = "agenciaService") private AgenciaService agenciaService; @SpringBean(name = "userService") private UserService userService; @SpringBean(name = "funcService") private FuncionarioService funcService; @SpringBean(name = "bancoService") private BancoService bancoService; @SpringBean(name = "contaService") private ContaService contaService; @SpringBean(name = "titularService") private TitularService titularService; // ----------------------------------------------------------------------// // ---------------------------- Lists --------------------------------// private List<Agencia> listAg; private List<User> listUser; private List<Funcionario> listFunc; private List<Banco> listBc; private List<Conta> listCt; private List<Titular> listTit; // ----------------------------------------------------------------------// // ---------------------------- COMPONENTES --------------------------------// private ModalWindow cadMdUser; private ModalWindow cadMdFunc; private ModalWindow cadMdAg; private ModalWindow cadMdBc; private ModalWindow cadMdCt; private ModalWindow cadMdTit; private ModalWindow excModal; private WebMarkupContainer divUser; private WebMarkupContainer divFunc; private WebMarkupContainer divAg; private WebMarkupContainer divBc; private WebMarkupContainer divCt; private WebMarkupContainer divTit; private NotificacaoPanel feedback; // ----------------------------------------------------------------------// public CadastrosPage() { if (!getUserPerfil(Perfis.GERENTE.toString())) { setResponsePage(DashboardPage.class); return; } setTitle("Cadastros"); cadMdUser = new ModalWindow("cadMdUser"); cadMdUser.setResizable(false); cadMdUser.setInitialHeight(264); cadMdFunc = new ModalWindow("cadMdFunc"); cadMdFunc.setResizable(false); cadMdFunc.setInitialHeight(327); cadMdFunc.setInitialWidth(1450); cadMdAg = new ModalWindow("cadMdAg"); cadMdAg.setResizable(false); cadMdAg.setInitialHeight(179); cadMdBc = new ModalWindow("cadMdBc"); cadMdBc.setResizable(false); cadMdBc.setInitialHeight(179); cadMdCt = new ModalWindow("cadMdCt") { private static final long serialVersionUID = -3715864176875914229L; @Override protected AppendingStringBuffer postProcessSettings(AppendingStringBuffer settings) { appendAssignment(settings, "settings.minWidth", 1450); appendAssignment(settings, "settings.minHeight", 545); appendAssignment(settings, "settings.width", 1450); appendAssignment(settings, "settings.height", 545); return settings; } }; cadMdCt.setResizable(false); cadMdTit = new ModalWindow("cadMdTit"); cadMdTit.setResizable(false); excModal = new ModalWindow("excModal") { private static final long serialVersionUID = -8597477177518818635L; @Override protected AppendingStringBuffer postProcessSettings(AppendingStringBuffer settings) { appendAssignment(settings, "settings.minWidth", 380); appendAssignment(settings, "settings.minHeight", 122); appendAssignment(settings, "settings.width", 380); appendAssignment(settings, "settings.height", 122); return settings; } }; excModal.setResizable(false); divUser = new WebMarkupContainer("divUser"); divUser.setOutputMarkupId(true); divFunc = new WebMarkupContainer("divFunc"); divFunc.setOutputMarkupId(true); divAg = new WebMarkupContainer("divAg"); divAg.setOutputMarkupId(true); divBc = new WebMarkupContainer("divBc"); divBc.setOutputMarkupId(true); divCt = new WebMarkupContainer("divCt"); divCt.setOutputMarkupId(true); divTit = new WebMarkupContainer("divTit"); divTit.setOutputMarkupId(true); feedback = new NotificacaoPanel("feedback"); listAg = agenciaService.findAll(); listUser = userService.findAll(); listFunc = funcService.findAll(); listBc = bancoService.findAll(); listCt = contaService.findAll(); listTit = titularService.findAll(); listViewUser(); listViewFunc(); listViewAg(); listViewBanco(); listViewConta(); listViewTitular(); add(excModal, feedback); } private void listViewUser() { /* * final WebMarkupContainer divUser = new WebMarkupContainer("divUser"); final * ModalWindow cadMdUser = new ModalWindow("cadMdUser"); */ final User user = new User(); CompoundPropertyModel<User> formModel = new CompoundPropertyModel<User>(user); final Form<User> searchUser = new Form<User>("searchUser", formModel); final TextField<String> userAccess = new TextField<String>("userAccess"); ChoiceRenderer<Perfis> perfilRender = new ChoiceRenderer<Perfis>("text"); final DropDownChoice<Perfis> perfil = new DropDownChoice<Perfis>("perfil", new PropertyModel<Perfis>(user, "perfil"), Arrays.asList(Perfis.values()), perfilRender); searchUser.add(userAccess, perfil); searchUser.add(new AjaxButton("btnSearchUs") { private static final long serialVersionUID = 3865918601254958016L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (userAccess != null && perfil != null || user.getUserAccess().equals("") || user.getPerfil().toString().equals("")) { if (userAccess.getValue().equals("") && perfil.getValue().equals("")) { listUser = userService.findAll(); } else { listUser = userService.search(user.getUserAccess(), user.getPerfil()); } } target.appendJavaScript("mostraTabCad('userCad');"); target.add(divUser, searchUser); } }); divUser.add(searchUser); divUser.add(new AjaxLink<User>("btnAddUser") { private static final long serialVersionUID = 2044861581184497470L; @Override public void onClick(AjaxRequestTarget target) { CadUserPanel userPanel = new CadUserPanel(cadMdUser.getContentId(), cadMdUser) { private static final long serialVersionUID = -7337021053411693916L; @Override public void atualizaAoModificar(AjaxRequestTarget target, User user) { userService.saveOrUpdate(user); listUser = userService.findAll(); target.add(divUser); } }; cadMdUser.setContent(userPanel).setOutputMarkupId(true); cadMdUser.show(target); } }); LoadableDetachableModel<List<User>> loader = new LoadableDetachableModel<List<User>>(listUser) { private static final long serialVersionUID = 8071851812481107692L; @Override protected List<User> load() { return listUser; } }; ListView<User> lvUser = new ListView<User>("lvUser", loader) { private static final long serialVersionUID = 7253438382745424326L; @Override protected void populateItem(ListItem<User> item) { final User user = item.getModelObject(); item.add(new Label("email", user.getEmail()), new Label("userAccess", user.getUserAccess()), new Label("perfil", user.getPerfil())); item.add(new AjaxLink<User>("edit") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { CadUserPanel editForm = new CadUserPanel(cadMdUser.getContentId(), user, cadMdUser, "Edição ") { private static final long serialVersionUID = -2360017131168195435L; @Override public void atualizaAoModificar(AjaxRequestTarget target, User user) { userService.saveOrUpdate(user); feedback.success("Usuário editado com sucesso!"); feedback.refresh(target); target.add(divUser); cadMdUser.close(target); } @Override protected DropDownChoice<Perfis> dropPerfil() { DropDownChoice<Perfis> perfil = new DropDownChoice<Perfis>("perfil", perfis); perfil.setEnabled(false); return perfil; } @Override protected PasswordTextField psw() { PasswordTextField psw = new PasswordTextField("psw", Model.of(user.getPsw())); psw.setRequired(false); if (user.getPsw() != null && user.getPsw().equals("")) { psw.setModelObject(user.getPsw()); } return psw; } }; cadMdUser.setContent(editForm).setOutputMarkupId(true); cadMdUser.show(target); } }, new AjaxLink<User>("delete") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { // verificar a questão da tipagem // util.addExcPanel("excluir", agencia, "agência", "Exluir a Agência" + // agencia.getCodigo() + "?", excModal, divAg, target); ExcluirPanel<User> excPanel = new ExcluirPanel<User>(excModal.getContentId(), user, "usuário", "Excluir o usuário " + user.getUserAccess() + "?") { private static final long serialVersionUID = -2564309581427741392L; @Override public void atualizaAoModificar(AjaxRequestTarget target, User user) { excModal.close(target); listUser = userService.findAll(); target.add(divUser); } }; excPanel.setService(userService); excModal.setContent(excPanel).setOutputMarkupId(true); excModal.show(target); }; }); } }; final GeradorRelatorio<User> relUser = new GeradorRelatorio<User>(); final HashMap<String, Object> usParam = new HashMap<String, Object>(); usParam.put("listUser", listUser); divUser.add(new Link<Object>("pdfUser") { private static final long serialVersionUID = -5958698290102968565L; @Override public void onClick() { try { final byte[] pdfBytes = relUser.geraPdf(usParam, "Usuarios", listUser); if (pdfBytes != null) { AbstractResourceStreamWriter stream = new AbstractResourceStreamWriter() { private static final long serialVersionUID = -1194480532924626151L; @Override public void write(OutputStream output) throws IOException { output.write(pdfBytes); output.close(); } }; ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(stream); handler.setContentDisposition(ContentDisposition.ATTACHMENT); handler.setFileName("Relatório de Usuários.pdf"); getRequestCycle().scheduleRequestHandlerAfterCurrent(handler); } } catch (Exception e) { e.printStackTrace(); } } }); divUser.setOutputMarkupId(true); divUser.add(lvUser); add(divUser, cadMdUser); } private void listViewFunc() { final Funcionario func = new Funcionario(); CompoundPropertyModel<Funcionario> formModel = new CompoundPropertyModel<Funcionario>(func); final Form<Funcionario> searchFunc = new Form<Funcionario>("searchFunc", formModel); final TextField<String> nome = new TextField<String>("nome"); final TextField<String> cpf = new TextField<String>("cpf"); final TextField<String> funcao = new TextField<String>("funcao"); searchFunc.add(nome, cpf, funcao); searchFunc.add(new AjaxButton("btnSearchFunc") { private static final long serialVersionUID = 3865918601254958016L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (nome != null && cpf != null && funcao != null || func.getNome().equals("") || func.getCpf().equals("") || func.getFuncao().equals("")) { if (nome.getValue().equals("") && cpf.getValue().equals("") && funcao.getValue().equals("")) { listFunc = funcService.findAll(); } listFunc = funcService.search(func.getNome(), func.getCpf(), func.getFuncao()); } target.appendJavaScript("mostraTabCad('funcCad');"); target.add(divFunc); } }); divFunc.add(searchFunc); divFunc.add(new AjaxLink<Funcionario>("btnAddFunc") { private static final long serialVersionUID = 2044861581184497470L; @Override public void onClick(AjaxRequestTarget target) { CadFuncPanel funcPanel = new CadFuncPanel(cadMdFunc.getContentId(), cadMdFunc) { private static final long serialVersionUID = -1866501526720516765L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Funcionario funcionario) { if (valido) { funcService.saveOrUpdate(funcionario); } listFunc = funcService.findAll(); target.add(divFunc); } }; cadMdFunc.setContent(funcPanel).setOutputMarkupId(true); cadMdFunc.show(target); } }); LoadableDetachableModel<List<Funcionario>> loader = new LoadableDetachableModel<List<Funcionario>>(listFunc) { private static final long serialVersionUID = 8071851812481107692L; @Override protected List<Funcionario> load() { return listFunc; } }; ListView<Funcionario> lvFunc = new ListView<Funcionario>("lvFunc", loader) { private static final long serialVersionUID = 7253438382745424326L; @Override protected void populateItem(ListItem<Funcionario> item) { final Funcionario func = (Funcionario) item.getModelObject(); item.add(new Label("nome", func.getNome()), new Label("rg", func.getRg()), new Label("cpf", func.getCpf()), new Label("funcao", func.getRg())); item.add(new AjaxLink<Funcionario>("edit") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { CadFuncPanel editForm = new CadFuncPanel(cadMdFunc.getContentId(), func, cadMdFunc) { private static final long serialVersionUID = -2360017131168195435L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Funcionario funcionario) { funcService.saveOrUpdate(funcionario); feedback.success("Funcionário editado com sucesso!"); feedback.refresh(target); target.add(divFunc); cadMdFunc.close(target); } }; cadMdFunc.setContent(editForm).setOutputMarkupId(true); cadMdFunc.show(target); } }, new AjaxLink<Funcionario>("delete") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { // verificar a questão da tipagem // util.addExcPanel("excluir", agencia, "agência", "Exluir a Agência" + // agencia.getCodigo() + "?", excModal, divAg, target); ExcluirPanel<Funcionario> excPanel = new ExcluirPanel<Funcionario>(excModal.getContentId(), func, "funcionário", "Excluir o cadastro do funcionário " + func.getNome() + "?") { private static final long serialVersionUID = -2564309581427741392L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Funcionario funcionario) { excModal.close(target); listFunc = funcService.findAll(); target.add(divAg); } }; excPanel.setService(funcService); excModal.setContent(excPanel).setOutputMarkupId(true); excModal.show(target); }; }); } }; /* * if(listAg == null) { divAg.add(new Label("notFound", * "Nenhum resultado Encontrado")); } else { divAg.add(new Label("notFound", * "")); } */ divFunc.add(lvFunc); add(divFunc, cadMdFunc); } private void listViewBanco() { final Banco banco = new Banco(); CompoundPropertyModel<Banco> formModel = new CompoundPropertyModel<Banco>(banco); final Form<Banco> searchBc = new Form<Banco>("searchBc", formModel); final TextField<String> nome = new TextField<String>("nome"); final TextField<String> codCompensacao = new TextField<String>("codCompensacao"); searchBc.add(nome, codCompensacao); searchBc.add(new AjaxButton("btnSearchBc") { private static final long serialVersionUID = 3865918601254958016L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (nome != null && codCompensacao != null || banco.getNome().equals("") || banco.getCodCompensacao().equals("")) { if (nome.getValue().equals("") && codCompensacao.getValue().equals("")) { listBc = bancoService.findAll(); } else { listBc = bancoService.search(banco.getCodCompensacao(), banco.getNome()); } } target.appendJavaScript("mostraTabCad('bancoCad');"); target.add(divBc); } }); divBc.add(searchBc); divBc.add(new AjaxLink<Banco>("btnAddBc") { private static final long serialVersionUID = 2044861581184497470L; @Override public void onClick(AjaxRequestTarget target) { CadBancoPanel bcPanel = new CadBancoPanel(cadMdBc.getContentId(), cadMdBc) { private static final long serialVersionUID = 6411274232083887033L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Banco banco) { if (valido) { bancoService.saveOrUpdate(banco); } listBc = bancoService.findAll(); target.add(divBc, divAg); } }; cadMdBc.setContent(bcPanel).setOutputMarkupId(true); cadMdBc.show(target); } }); LoadableDetachableModel<List<Banco>> loader = new LoadableDetachableModel<List<Banco>>(listBc) { private static final long serialVersionUID = 8750330117036998650L; @Override protected List<Banco> load() { return listBc; } }; ListView<Banco> lvBc = new ListView<Banco>("lvBc", loader) { private static final long serialVersionUID = 7253438382745424326L; @Override protected void populateItem(final ListItem<Banco> item) { final Banco banco = item.getModelObject(); item.add(new Label("codCompensacao", banco.getCodCompensacao()), new Label("nomeBanco", banco.getNome())); item.add(new AjaxLink<Banco>("edit") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { CadBancoPanel editForm = new CadBancoPanel(cadMdBc.getContentId(), banco, cadMdBc) { private static final long serialVersionUID = -2360017131168195435L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Banco banco) { bancoService.saveOrUpdate(banco); cadMdBc.close(target); target.add(divBc); } }; cadMdBc.setContent(editForm).setOutputMarkupId(true); cadMdBc.show(target); } }, new AjaxLink<Banco>("delete") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { // verificar a questão da tipagem // util.addExcPanel("excluir", agencia, "agência", "Exluir a Agência" + // agencia.getCodigo() + "?", excModal, divAg, target); ExcluirPanel<Banco> excPanel = new ExcluirPanel<Banco>(excModal.getContentId(), banco, "banco", "Excluir o banco " + banco.getCodCompensacao() + "?") { private static final long serialVersionUID = -2564309581427741392L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Banco banco) { excModal.close(target); listBc = bancoService.findAll(); target.add(divBc); } }; excPanel.setService(bancoService); excModal.setContent(excPanel).setOutputMarkupId(true); excModal.show(target); }; }); } }; divBc.setOutputMarkupId(true); divBc.add(lvBc); add(divBc, cadMdBc); } private void listViewAg() { final Agencia agencia = new Agencia(); /* * final Banco banco = new Banco(); agencia.setBanco(banco); */ CompoundPropertyModel<Agencia> formModel = new CompoundPropertyModel<Agencia>(agencia); final Form<Agencia> searchAg = new Form<Agencia>("searchAg", formModel); final TextField<Integer> codAg = new TextField<Integer>("codAg"); ChoiceRenderer<Banco> bcCodRender = new ChoiceRenderer<Banco>("codCompensacao"); final DropDownChoice<Banco> dropCodBc = new DropDownChoice<Banco>("banco", new PropertyModel<Banco>(agencia, "banco"), listBc, bcCodRender); ChoiceRenderer<Banco> bcNmRender = new ChoiceRenderer<Banco>("nome"); final DropDownChoice<Banco> dropNmBc = new DropDownChoice<Banco>("banco.nome", new PropertyModel<Banco>(agencia, "banco"), listBc, bcNmRender); searchAg.add(codAg, dropCodBc, dropNmBc); searchAg.add(new AjaxButton("btnSearchAg") { private static final long serialVersionUID = 3865918601254958016L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (dropCodBc.getValue().equals("") || dropNmBc.getValue().equals("")) { agencia.setBanco(new Banco()); } if (codAg != null && dropCodBc != null && dropNmBc != null || agencia.getCodAg() == 0 || agencia.getBanco().getCodCompensacao().equals("") || agencia.getBanco().getNome().equals("")) { if (codAg.getValue().equals("") && dropCodBc.getValue().equals("") && dropNmBc.getValue().equals("")) { listAg = agenciaService.findAll(); } else { listAg = agenciaService.search(agencia.getCodAg(), agencia.getBanco().getCodCompensacao(), agencia.getBanco().getNome()); } } target.appendJavaScript("mostraTabCad('agCad');"); target.add(divAg, searchAg); } }); divAg.add(searchAg); divAg.add(new AjaxLink<Agencia>("btnAddAg") { private static final long serialVersionUID = 2044861581184497470L; @Override public void onClick(AjaxRequestTarget target) { CadAgPanel agPanel = new CadAgPanel(cadMdAg.getContentId(), cadMdAg) { private static final long serialVersionUID = -1866501526720516765L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Agencia agencia) { if (valido) { agenciaService.saveOrUpdate(agencia); } listAg = agenciaService.findAll(); target.add(divAg); } }; cadMdAg.setContent(agPanel).setOutputMarkupId(true); cadMdAg.show(target); } }); LoadableDetachableModel<List<Agencia>> loader = new LoadableDetachableModel<List<Agencia>>(listAg) { private static final long serialVersionUID = 8750330117036998650L; @Override protected List<Agencia> load() { return listAg; } }; ListView<Agencia> lvAg = new ListView<Agencia>("lvAg", loader) { private static final long serialVersionUID = 7253438382745424326L; @Override protected void populateItem(ListItem<Agencia> item) { final Agencia agencia = (Agencia) item.getModelObject(); item.add(new Label("codAg", agencia.getCodAg()), new Label("codBanco", agencia.getBanco().getCodCompensacao()), new Label("nomeBanco", agencia.getBanco().getNome())); item.add(new AjaxLink<Agencia>("edit") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { CadAgPanel editForm = new CadAgPanel(cadMdAg.getContentId(), agencia, cadMdAg) { private static final long serialVersionUID = -2360017131168195435L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Agencia agencia) { agenciaService.saveOrUpdate(agencia); cadMdAg.close(target); target.add(divAg); } }; cadMdAg.setContent(editForm).setOutputMarkupId(true); cadMdAg.show(target); } }, new AjaxLink<Agencia>("delete") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { // verificar a questão da tipagem // util.addExcPanel("excluir", agencia, "agência", "Exluir a Agência" + // agencia.getCodigo() + "?", excModal, divAg, target); ExcluirPanel<Agencia> excPanel = new ExcluirPanel<Agencia>(excModal.getContentId(), agencia, "agência", "Excluir a agência " + agencia.getCodAg() + "?") { private static final long serialVersionUID = -2564309581427741392L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Agencia agencia) { excModal.close(target); listAg = agenciaService.findAll(); target.add(divAg); } }; excPanel.setService(agenciaService); excModal.setContent(excPanel).setOutputMarkupId(true); excModal.show(target); }; }); } }; /* * if(listAg == null) { divAg.add(new Label("notFound", * "Nenhum resultado Encontrado")); } else { divAg.add(new Label("notFound", * "")); } */ divAg.add(lvAg); add(divAg, cadMdAg); } private void listViewConta() { final Conta conta = new Conta(); CompoundPropertyModel<Conta> formModel = new CompoundPropertyModel<Conta>(conta); final Form<Conta> searchCt = new Form<Conta>("searchCt", formModel); final TextField<Integer> codAg = new TextField<Integer>("agencia.codAg"); final TextField<Integer> numConta = new TextField<Integer>("numConta"); ChoiceRenderer<Status> statusRender = new ChoiceRenderer<Status>("text"); final DropDownChoice<Status> status = new DropDownChoice<Status>("status", new PropertyModel<Status>(conta, "status"), Arrays.asList(Status.values()), statusRender); ChoiceRenderer<Contas> tipoCtRender = new ChoiceRenderer<Contas>("text"); final DropDownChoice<Contas> tipoCt = new DropDownChoice<Contas>("tipoConta", new PropertyModel<Contas>(conta, "tipoConta"), Arrays.asList(Contas.values()), tipoCtRender); searchCt.add(codAg, numConta, status, tipoCt); searchCt.add(new AjaxButton("btnSearchCt") { private static final long serialVersionUID = 3865918601254958016L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (conta.getAgencia() == null) { conta.setAgencia(new Agencia()); } if (codAg != null && numConta != null && status != null && tipoCt != null || conta.getAgencia().getCodAg() == 0 || conta.getNumConta() == 0 || conta.getStatus().toString().equals("") || conta.getTipoConta().toString().equals("")) { if (codAg.getValue().equals("") && numConta.getValue().equals("") && status.getValue().toString().equals("") && tipoCt.getValue().toString().equals("")) { listCt = contaService.findAll(); } else { listCt = contaService.search(conta.getAgencia().getCodAg(), conta.getNumConta(), conta.getStatus(), conta.getTipoConta()); } } target.appendJavaScript("mostraTabCad('contaCad');"); target.add(divCt, searchCt); } }); divCt.add(searchCt); divCt.add(new AjaxLink<Conta>("btnAddCt") { private static final long serialVersionUID = 2044861581184497470L; @Override public void onClick(AjaxRequestTarget target) { CadContaPanel ctPanel = new CadContaPanel(cadMdCt.getContentId(), cadMdCt) { private static final long serialVersionUID = -1866501526720516765L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Conta conta) { if (valido) { contaService.saveOrUpdate(conta); } listTit = titularService.findAll(); listCt = contaService.findAll(); cadMdCt.close(target); target.add(divCt, divTit); } }; cadMdCt.setContent(ctPanel).setOutputMarkupId(true); cadMdCt.show(target); } }); LoadableDetachableModel<List<Conta>> loader = new LoadableDetachableModel<List<Conta>>(listCt) { /** * */ private static final long serialVersionUID = 4390746698318909640L; @Override protected List<Conta> load() { return listCt; } }; ListView<Conta> lvCt = new ListView<Conta>("lvCt", loader) { private static final long serialVersionUID = 7253438382745424326L; @Override protected void populateItem(ListItem<Conta> item) { final Conta conta = item.getModelObject(); final Titular titular = conta.getTitular(); final User user = titular.getUser(); item.add(new Label("agencia", conta.getAgencia().getCodAg()), new Label("numConta", conta.getNumConta()), new Label("status", conta.getStatus())); item.add(new AjaxLink<Conta>("edit") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { CadContaPanel editForm = new CadContaPanel(cadMdCt.getContentId(), conta, titular, user, cadMdCt) { private static final long serialVersionUID = -2360017131168195435L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Conta conta) { contaService.saveOrUpdate(conta); cadMdCt.close(target); target.add(divCt); } }; cadMdCt.setContent(editForm).setOutputMarkupId(true); cadMdCt.show(target); } }, new AjaxLink<Conta>("delete") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { // verificar a questão da tipagem // util.addExcPanel("excluir", agencia, "agência", "Exluir a Agência" + // agencia.getCodigo() + "?", excModal, divAg, target); ExcluirPanel<Conta> excPanel = new ExcluirPanel<Conta>(excModal.getContentId(), conta, "conta", "Excluir a conta " + conta.getNumConta() + "?") { private static final long serialVersionUID = -2564309581427741392L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Conta conta) { target.appendJavaScript("mostraTabCad('contaCad');"); excModal.close(target); listTit = titularService.findAll(); listCt = contaService.findAll(); target.add(divCt, divTit); } }; excPanel.setService(contaService); excModal.setContent(excPanel).setOutputMarkupId(true); excModal.show(target); }; }); } }; /* * if(listAg == null) { divAg.add(new Label("notFound", * "Nenhum resultado Encontrado")); } else { divAg.add(new Label("notFound", * "")); } */ divCt.add(lvCt); add(divCt, cadMdCt); } private void listViewTitular() { final Titular titular = new Titular(); CompoundPropertyModel<Titular> formModel = new CompoundPropertyModel<Titular>(titular); final Form<Titular> searchTit = new Form<Titular>("searchTit", formModel); final TextField<String> cpfCnpj = new TextField<String>("cpfCnpj"); final TextField<String> nome = new TextField<String>("nome"); searchTit.add(cpfCnpj, nome); searchTit.add(new AjaxButton("btnSearchTit") { private static final long serialVersionUID = 3865918601254958016L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (cpfCnpj != null && nome != null || titular.getNome().equals("") || titular.getCpfCnpj().equals("")) { if (cpfCnpj.getValue().equals("") && nome.getValue().equals("")) { listTit = titularService.findAll(); } else { listTit = titularService.search(titular.getCpfCnpj(), titular.getNome()); } } target.appendJavaScript("mostraTabCad('titularCad');"); target.add(divTit, searchTit); } }); divTit.add(searchTit); LoadableDetachableModel<List<Titular>> loader = new LoadableDetachableModel<List<Titular>>(listTit) { /** * */ private static final long serialVersionUID = -4653797931296348739L; @Override protected List<Titular> load() { return listTit; } }; ListView<Titular> lvTit = new ListView<Titular>("lvTit", loader) { private static final long serialVersionUID = 7253438382745424326L; @Override protected void populateItem(ListItem<Titular> item) { final Titular titular = item.getModelObject(); item.add(new Label("nomeRzSocial", titular.getNome()), new Label("cpfCnpj", titular.getCpfCnpj())); item.add(new AjaxLink<Titular>("edit") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { CadTitularPanel editForm = new CadTitularPanel(cadMdTit.getContentId(), titular, cadMdTit) { private static final long serialVersionUID = -2360017131168195435L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Titular titular) { titularService.saveOrUpdate(titular); cadMdTit.close(target); target.add(divTit); } }; cadMdTit.setContent(editForm).setOutputMarkupId(true); cadMdTit.show(target); } }, new AjaxLink<Titular>("delete") { private static final long serialVersionUID = -984734035789687817L; @Override public void onClick(AjaxRequestTarget target) { // verificar a questão da tipagem // util.addExcPanel("excluir", agencia, "agência", "Exluir a Agência" + // agencia.getCodigo() + "?", excModal, divAg, target); ExcluirPanel<Titular> excPanel = new ExcluirPanel<Titular>(excModal.getContentId(), titular, "titular", "Excluir o titular " + titular.getNome() + "?") { private static final long serialVersionUID = -2564309581427741392L; @Override public void atualizaAoModificar(AjaxRequestTarget target, Titular titular) { excModal.close(target); listTit = titularService.findAll(); target.add(divTit); } }; excPanel.setService(titularService); excModal.setContent(excPanel).setOutputMarkupId(true); excModal.show(target); }; }); } }; /* * if(listAg == null) { divAg.add(new Label("notFound", * "Nenhum resultado Encontrado")); } else { divAg.add(new Label("notFound", * "")); } */ divTit.add(lvTit); add(divTit, cadMdTit); } }
package com.chronos.mvpapi.security; import com.chronos.mvpapi.model.Person; import com.chronos.mvpapi.repository.PersonRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import java.util.HashSet; import java.util.Optional; @Service public class AppUserDetailsService implements UserDetailsService { @Autowired private PersonRepository repository; @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { Optional<Person> usuarioOptional = repository.findByEmail(email); Person usuario = usuarioOptional.orElseThrow(() -> new UsernameNotFoundException("Usuário e/ou senha incorretos")); return new UsuarioSistema(usuario, new HashSet<>()); } }
package ua.nic.Practica; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class PracticaApplication { public static void main(String[] args) { SpringApplication.run(PracticaApplication.class); } }
package com.netflix.governator; import javax.inject.Singleton; import junit.framework.Assert; import org.testng.annotations.Test; import com.google.inject.AbstractModule; import com.google.inject.Injector; import com.netflix.governator.auto.ModuleListProviders; import com.netflix.governator.auto.annotations.ConditionalOnModule; import com.netflix.governator.auto.annotations.OverrideModule; public class GovernatorTest { public interface Foo { } @Singleton public static class Foo1 implements Foo { } @Singleton public static class Foo2 implements Foo { } @Singleton public static class Foo3 implements Foo { } public interface Bar { } @Singleton public static class Bar1 implements Bar { } @Singleton public static class Bar2 implements Bar { } @Singleton public static class Bar3 implements Bar { } public abstract static class BaseModule extends AbstractModule { @Override public String toString() { return getClass().getSimpleName(); } } public static class Foo1Module extends BaseModule { @Override protected void configure() { bind(Foo.class).to(Foo1.class); } } @ConditionalOnModule(Foo1Module.class) @OverrideModule public static class Foo2Module extends BaseModule { @Override protected void configure() { bind(Foo.class).to(Foo2.class); } } public static class Foo3OverrideModule extends BaseModule { @Override protected void configure() { bind(Foo.class).to(Foo3.class); } } @Test public void autoLoadAsOverride() throws Exception { Injector injector = Governator.createInjector( DefaultGovernatorConfiguration.builder() .addModule(new Foo1Module()) .addModuleListProvider(ModuleListProviders.forModules(new Foo2Module())) .build()); Foo foo = injector.getInstance(Foo.class); Assert.assertEquals(Foo2.class, foo.getClass()); } @Test public void autoLoadWithOverride() throws Exception { Injector injector = Governator.createInjector( DefaultGovernatorConfiguration.builder() .addModule(new Foo1Module()) .addModuleListProvider(ModuleListProviders.forModules(new Foo2Module())) .addOverrideModule(new Foo3OverrideModule()) .build()); Foo foo = injector.getInstance(Foo.class); Assert.assertEquals(Foo3.class, foo.getClass()); } }
package com.hxsb.dao.BUY_ERP_GET_ORDERS; import com.hxsb.model.BUY_ERP_GET_ORDERS.SCM_HX03_ROContactNew; public interface SCM_HX03_ROContactNew_Dao { int insert(SCM_HX03_ROContactNew record); int insertSelective(SCM_HX03_ROContactNew record); }
package com.cmpickle.volumize.data.entity; import com.cmpickle.volumize.data.db.VolumizeDatabase; import com.raizlabs.android.dbflow.annotation.Column; import com.raizlabs.android.dbflow.annotation.PrimaryKey; import com.raizlabs.android.dbflow.annotation.Table; import com.raizlabs.android.dbflow.structure.BaseModel; /** * @author Cameron Pickle * Copyright (C) Cameron Pickle (cmpickle) on 5/2/2017. */ @Table(name = "PendingIntentAlarm", database = VolumizeDatabase.class) public class PendingIntentAlarm extends BaseModel { @PrimaryKey (autoincrement = true) int id; @Column String eventId; @Column int day; public PendingIntentAlarm() { //Required empty constructor } public PendingIntentAlarm(String eventId, int day) { this.eventId = eventId; this.day = day; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getEventId() { return eventId; } public void setEventId(String eventId) { this.eventId = eventId; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } }
package com.trainex.model; import java.util.ArrayList; public class CategoryInDetailTrainer { private int idCategory; private String nameCategory; private ArrayList<Session> listSession; private int idSession; private boolean isShow; public CategoryInDetailTrainer(int idCategory, String nameCategory, ArrayList<Session> listSession, int idSession, boolean isShow) { this.idCategory = idCategory; this.nameCategory = nameCategory; this.listSession = listSession; this.idSession = idSession; this.isShow = isShow; } public int getIdSession() { return idSession; } public void setIdSession(int idSession) { this.idSession = idSession; } public boolean isShow() { return isShow; } public void setShow(boolean show) { isShow = show; } public int getIdCategory() { return idCategory; } public void setIdCategory(int idCategory) { this.idCategory = idCategory; } public String getNameCategory() { return nameCategory; } public void setNameCategory(String nameCategory) { this.nameCategory = nameCategory; } public ArrayList<Session> getListSession() { return listSession; } public void setListSession(ArrayList<Session> listSession) { this.listSession = listSession; } public CategoryInDetailTrainer() { } }
package maedit; import java.awt.FileDialog; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; public class FileIO { private final static Logger LOGGER = Logger.getLogger(FileIO.class.getName()); String fileName; MarkdownToHtml htmlRenderer; JFrame frame; MarkdownPane markdownPane; public FileIO(JFrame frame, MarkdownPane markdownPane, MarkdownToHtml htmlRenderer) { this.frame = frame; this.markdownPane = markdownPane; this.htmlRenderer = htmlRenderer; } public void save() { if (fileName == null) saveAs(); else writeTextToFile(markdownPane.getText(), fileName); } public void saveAs() { fileName = getFileFromDialog("Save Markdown", FileDialog.SAVE, "*.md"); if (fileName != null) writeTextToFile(markdownPane.getText(), fileName); } public void exportHtml() { String htmlFileName = getFileFromDialog("Export HTML", FileDialog.SAVE, "*.html"); if (htmlFileName != null) writeTextToFile(htmlRenderer.getHtmlAsString(markdownPane.getText()), htmlFileName); } private void writeTextToFile(String text, String path) { try (BufferedWriter writer = new BufferedWriter(new FileWriter(path))) { writer.write(text); writer.flush(); } catch (IOException ex) { throw new RuntimeException(ex); } } public void open() { String openFileName = getFileFromDialog("Open Markdown", FileDialog.LOAD, "*.md"); if (openFileName == null) return; fileName = openFileName; try { markdownPane.setText(new String(Files.readAllBytes(Paths.get(fileName)), StandardCharsets.UTF_8)); } catch (IOException ex) { throw new RuntimeException(ex); } } private String getFileFromDialog(String title, int mode, String filter) { FileDialog fileDialog = new FileDialog(frame, title, mode); fileDialog.setFile(filter); fileDialog.setVisible(true); return getPath(fileDialog); } private String getPath(FileDialog dialog) { String path = null; if (dialog.getFile() != null) path = dialog.getDirectory() + File.separator + dialog.getFile(); LOGGER.log(Level.INFO, "Path selected: {0}", path); return path; } }
package moproDCC.moproDCC; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.events.EventFiringWebDriver; import utilities.moproDCC.WebEventListener; public class baseFile { public static WebDriver driver; public static Properties prop; public static EventFiringWebDriver eventdriver; public static WebEventListener eventlisten; public baseFile() { try { FileInputStream fl = new FileInputStream("C:\\Users\\einsteinjackson\\eclipse-workspace\\moproDCC\\src\\main\\java\\property\\moproDCC\\object.properties"); prop = new Properties(); prop.load(fl); } catch(FileNotFoundException exep) { exep.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static void initialize() { String browserName = prop.getProperty("browser"); if (browserName.equals("chrome")) { System.setProperty("webdriver.chrome.driver", "C:\\Users\\einsteinjackson\\Desktop\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); } else if (browserName.equals("edge")) { System.setProperty("webdriver.edge.driver", ""); driver = new EdgeDriver(); } else if(browserName.equals("firefox")) { System.setProperty("webdriver.gecko.driver", ""); driver = new FirefoxDriver(); } else {System.out.println("Invalid Browser Name");} eventdriver = new EventFiringWebDriver(driver); eventlisten = new WebEventListener(); eventdriver.register(eventlisten); driver = eventdriver; driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } }
package jc.sugar.JiaHui.jmeter.timer; import jc.sugar.JiaHui.jmeter.JMeterElement; import jc.sugar.JiaHui.jmeter.JMeterElementCategory; import jc.sugar.JiaHui.jmeter.JMeterElementMapperFor; import jc.sugar.JiaHui.jmeter.JMeterElementType; import jc.sugar.JiaHui.jmeter.common.JSR223ElementMapper; import org.apache.jmeter.timers.JSR223Timer; import java.util.HashMap; import java.util.Map; @JMeterElementMapperFor(value = JMeterElementType.JSR223Timer, testGuiClass = JMeterElement.JSR223Timer) public class JSR223TimerMapper extends JSR223ElementMapper<JSR223Timer> { private JSR223TimerMapper(JSR223Timer element, Map<String, Object> attributes) { super(element, attributes); } public JSR223TimerMapper(Map<String, Object> attributes){ this(new JSR223Timer(), attributes); } public JSR223TimerMapper(JSR223Timer element){ this(element, new HashMap<>()); } @Override public JSR223Timer fromAttributes() { setJsr223Element(element, attributes); return element; } @Override public Map<String, Object> toAttributes() { attributes.put(WEB_CATEGORY, JMeterElementCategory.Timer); attributes.put(WEB_TYPE, JMeterElementType.JSR223Timer); setJsr223Attributes(attributes, element); return attributes; } }
package com.tencent.mm.plugin.fav.a; import com.tencent.mm.kernel.g; import com.tencent.mm.modelsns.d; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.sns.b.c; import com.tencent.mm.plugin.sns.b.i; import com.tencent.mm.protocal.c.vx; import com.tencent.mm.protocal.c.wa; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; public final class m { public static void w(g gVar) { if (gVar.field_favProto.rBI != null && !gVar.field_favProto.rBI.isEmpty()) { vx vxVar = (vx) gVar.field_favProto.rBI.getFirst(); wa waVar = vxVar.rAo; if (waVar != null) { d dVar = new d(); dVar.r("20source_publishid", waVar.dyQ + ","); dVar.r("21uxinfo", waVar.dyP + ","); dVar.r("22clienttime", bi.VF() + ","); dVar.r("23source_type", (gVar.field_type == 16 ? 1 : 2) + ","); dVar.r("24scene", "5,"); dVar.r("25scene_chatname", ","); dVar.r("26scene_username", gVar.field_fromUser + ","); dVar.r("27curr_publishid", ","); dVar.r("28curr_msgid", "0,"); dVar.r("29curr_favid", gVar.field_id + ","); dVar.r("30isdownload", "0,"); dVar.r("31chatroom_membercount", "0,"); ((i) g.l(i.class)).b(vxVar.bZN, dVar); x.i("MicroMsg.FavVideoStatistic", "report snsad_video_exposure: " + dVar.wF()); h.mEJ.h(12989, new Object[]{dVar}); } } } public static void a(a aVar, g gVar) { if (gVar.field_favProto.rBI != null && !gVar.field_favProto.rBI.isEmpty()) { wa waVar = ((vx) gVar.field_favProto.rBI.getFirst()).rAo; if (waVar != null) { d dVar = new d(); dVar.r("20source_publishid", waVar.dyQ + ","); dVar.r("21uxinfo", waVar.dyP + ","); dVar.r("22clienttime", bi.VF() + ","); dVar.r("23video_statu", ","); dVar.r("24source_type", (gVar.field_type == 16 ? 1 : 2) + ","); dVar.r("25scene", "5,"); dVar.r("26action_type", a.a(aVar) + ","); dVar.r("27scene_chatname", ","); dVar.r("28scene_username", gVar.field_fromUser + ","); dVar.r("29curr_publishid", ","); dVar.r("30curr_msgid", "0,"); dVar.r("31curr_favid", gVar.field_id + ","); dVar.r("32elapsed_time", "0,"); dVar.r("33load_time", "0,"); dVar.r("34is_load_complete", "0,"); dVar.r("35destination", "0,"); dVar.r("36chatroom_membercount", "0,"); x.i("MicroMsg.FavVideoStatistic", "report snsad_video_action: " + dVar.wF()); ((c) g.l(c.class)).h(12990, dVar); } } } public static void a(c cVar, g gVar, d dVar, int i) { if (gVar.field_favProto.rBI != null && !gVar.field_favProto.rBI.isEmpty()) { wa waVar = ((vx) gVar.field_favProto.rBI.getFirst()).rAo; if (waVar != null) { d dVar2 = new d(); dVar2.r("20source_publishid", waVar.dyQ + ","); dVar2.r("21uxinfo", waVar.dyP + ","); dVar2.r("22clienttime", bi.VF() + ","); dVar2.r("23video_statu", d.a(dVar) + ","); dVar2.r("24source_type", (gVar.field_type == 16 ? 1 : 2) + ","); dVar2.r("25scene", "5,"); dVar2.r("26action_type", c.a(cVar) + ","); dVar2.r("27scene_chatname", ","); dVar2.r("28scene_username", gVar.field_fromUser + ","); dVar2.r("29curr_publishid", ","); dVar2.r("30curr_msgid", "0,"); dVar2.r("31curr_favid", gVar.field_id + ","); dVar2.r("32chatroom_membercount", "0,"); dVar2.r("33chatroom_toMemberCount", i + ","); x.i("MicroMsg.FavVideoStatistic", "report snsad_video_spread: " + dVar2.wF()); h.mEJ.h(12991, new Object[]{dVar2}); } } } }
package com.example.administrator.hyxdmvp; public class AppConfig { //测试服 // public static String Url = "http://tst.zhongqizhiyun.com:8020/api/ZQZYBasicsApi/"; public static String UrlApp() { return Url + AfterUrl; } public static String Url = "http://192.168.1.137:8666"; public static String AfterUrl = "/api/ZQZYBasicsApi/"; // 正式服 // public static String UrlApp = " https://www.yunerpoa.com/api/ZQZYBasicsApi/"; //正式服通用查询 public final static String General = "CommonList?"; //水处理服 // public final static String Url = "https://www.yunerpoa.com/api/WaterTreatApi/"; //公司编码 public static String CPCode = ""; //账号 public static String UserId; //员工编号 public static String Id = ""; //账号在SharedPreferences public static final String UserIdSharedPreferences = "UserId"; //密码在SharedPreferences public static final String PassWordSharedPreferences = "PassWord"; //服务器在SharedPreferences public static final String ServiceSharedPreferences = "Service"; // 树形列表 public static String TreeMenuTestUrl() { return new StringBuffer().append(UrlApp()).append(General).append("a=utree(%27").append(UserId).append("%27)&b=3|4|5|6|8|9|10|12").toString(); } //工作计划 public static final String WorkPlanUrl() { return new StringBuffer().append(UrlApp()).append(General).append("a=TR0003&b=0|12|10|9|4&d=1::").append(CPCode).toString(); } //员工人名下拉 public static String SpinnerForUserUrl() { return new StringBuffer().append(UrlApp()).append(General).append("a=t50000&b=2&d=1::").append(AppConfig.CPCode).toString(); } //获取用户列表 public static String UserManagerUrl() { return new StringBuffer().append(UrlApp()).append(General).append("a=TP0000&b=53|24|2|3|87|32&d=1::").append(CPCode).toString(); } // 表格测试 public static String FormTest(){ return new StringBuffer().append(UrlApp()).append(General).append("a=TR0003&b=1|2|3|4|9|10|15").toString(); } }
package com.cybx.member.model; import java.util.Date; public class Member implements java.io.Serializable { private static final long serialVersionUID = 1210264530782454977L; private String mobile; private char sourceType; private String partnerCode; private String passwordHash; private String memname; private String openId; private String passcode; private int sex; private String address; private String birthday; private int pointNum; private Date registerTime; public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public char getSourceType() { return sourceType; } public void setSourceType(char sourceType) { this.sourceType = sourceType; } public String getPartnerCode() { return partnerCode; } public void setPartnerCode(String partnerCode) { this.partnerCode = partnerCode; } public String getPasswordHash() { return passwordHash; } public void setPasswordHash(String passwordHash) { this.passwordHash = passwordHash; } public String getMemname() { return memname; } public void setMemname(String memname) { this.memname = memname; } public String getOpenId() { return openId; } public void setOpenId(String openId) { this.openId = openId; } public String getPasscode() { return passcode; } public void setPasscode(String passcode) { this.passcode = passcode; } public int getSex() { return sex; } public void setSex(int sex) { this.sex = sex; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public int getPointNum() { return pointNum; } public void setPointNum(int pointNum) { this.pointNum = pointNum; } public Date getRegisterTime() { return registerTime; } public void setRegisterTime(Date registerTime) { this.registerTime = registerTime; } @Override public String toString() { return "Member [mobile=" + mobile + ", sourceType=" + sourceType + ", partnerCode=" + partnerCode + ", passwordHash=" + passwordHash + ", memname=" + memname + ", openId=" + openId + ", passcode=" + passcode + ", sex=" + sex + ", address=" + address + ", birthday=" + birthday + ", pointNum=" + pointNum + ", registerTime=" + registerTime + "]"; } }
public class ConcreteImplementor1 implements Implementor { @Override public void doSomething() { System.out.println("ConcreteImplementor1 do something..."); } @Override public void doAnything() { System.out.println("ConcreteImplementor1 do anything..."); } }
package com.fleet.validator.entity; import javax.validation.constraints.*; import java.io.Serializable; /** * @author April Han */ public class User implements Serializable { private static final long serialVersionUID = 1L; /** * 用户id */ private Integer id; /** * 账户 */ @NotBlank(message = "账户不能为空") // @Size(max = 20, message = "账户不能多于20个字符") // @Size(min = 25, message = "账户不能少于5个字符") @Size(min = 5, max = 20, message = "账户长度必须是5-20个字符") @Pattern(regexp = "^[a-zA-Z0-9]{5,20}$", message = "账户只能为字母、数字中的一种或多种") private String name; /** * 昵称 */ private String nickName; /** * 密码 */ @NotNull(message = "用户密码不能为空") @Size(min = 6, max = 11, message = "密码长度必须是6-16个字符") private String pwd; /** * 加盐 */ private String pwdSalt; /** * 手机号 */ @NotBlank(message = "手机号不能为空") @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误") private String mobile; /** * 邮箱 */ @NotBlank(message = "邮箱不能为空") @Email(message = "邮箱格式不正确") private String email; /** * 用户状态(0:禁用,1:正常,2:锁定) */ private Integer status; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public String getPwdSalt() { return pwdSalt; } public void setPwdSalt(String pwdSalt) { this.pwdSalt = pwdSalt; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } }
/* * Copyright 2017 University of Michigan * * 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 edu.umich.verdict; import java.sql.ResultSet; import java.util.Set; import java.util.concurrent.ThreadLocalRandom; //import org.apache.spark.sql.DataFrame; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import com.google.common.base.Optional; import com.google.common.collect.Sets; import edu.umich.verdict.dbms.Dbms; import edu.umich.verdict.exceptions.VerdictException; public abstract class VerdictContext { final protected VerdictConf conf; protected VerdictMeta meta; final static protected Set<String> JDBC_DBMS = Sets.newHashSet("mysql", "impala", "hive", "hive2"); /* * DBMS fields */ private Dbms dbms; private Dbms metaDbms; // contains persistent info of VerdictMeta // used for refreshing meta data. private long queryUid; final protected int contextId; public Dbms getDbms() { return dbms; } public void setDbms(Dbms dbms) { this.dbms = dbms; this.metaDbms = dbms; } public int getContextId() { return contextId; } public long getQid() { return queryUid; } public VerdictMeta getMeta() { return meta; } public void setMeta(VerdictMeta meta) { this.meta = meta; } public String getDefaultSchema() { return conf.getDbmsSchema(); } public VerdictConf getConf() { return conf; } public Dbms getMetaDbms() { return metaDbms; } public Optional<String> getCurrentSchema() { return dbms.getCurrentSchema(); } public void destroy() throws VerdictException { dbms.close(); } public long getCurrentQid() { return queryUid; } public void incrementQid() { queryUid += 1; } protected VerdictContext(VerdictConf conf, int contextId) { this.conf = conf; this.contextId = contextId; } protected VerdictContext(VerdictConf conf) { this(conf, ThreadLocalRandom.current().nextInt(0, 10000)); } private static VerdictContext dummyContext = null; /** * Singleton dummy VerdictContext. Used only by FuncExpr for setting inherited * Expr's VerdictContext field. * * @return */ public static VerdictContext dummyContext() { if (dummyContext != null) return dummyContext; VerdictConf conf = new VerdictConf(false); conf.setDbms("dummy"); try { dummyContext = VerdictJDBCContext.from(conf); return dummyContext; } catch (VerdictException e) { e.printStackTrace(); } return null; } public abstract void execute(String sql) throws VerdictException; public abstract ResultSet getResultSet(); // public DataFrame getDataFrame() { // return null; // } public abstract Dataset<Row> getDataset(); public ResultSet executeJdbcQuery(String sql) throws VerdictException { execute(sql); ResultSet rs = getResultSet(); return rs; } // public DataFrame executeSparkQuery(String sql) throws VerdictException { // execute(sql); // DataFrame df = getDataFrame(); // return df; // } public Dataset<Row> executeSpark2Query(String sql) throws VerdictException { execute(sql); Dataset<Row> ds = getDataset(); return ds; } }
package edu.bu.met622.socket; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class SimpleClient { public static void main(String[] args) { try { Socket s = new Socket("localhost", 9000); DataOutputStream dout = new DataOutputStream(s.getOutputStream()); dout.writeUTF("--> Hello 4m Client"); dout.close(); dout.flush(); s.close(); } catch (IOException ex) { System.out.println("[Client] Error:" + ex.getMessage()); ex.printStackTrace(); } } }
package com.checkers.controllers; import com.badlogic.gdx.math.Vector2; import com.checkers.model.Board; import com.checkers.model.Cell; import com.checkers.model.Checker; import com.checkers.network.client.NetworkClient; //TODO It's class only for validation, all another code, methods and functions shell be in other classes public class MoveValidator { public static boolean isPlayerWhite =true;//manual user switcher private static String currStep = new String(); private static int fightsBefore = 0; private String currMark; private Board board; private NetworkClient network = new NetworkClient(); private Checker tmpChecker; private Cell startCell; private Cell targetCell; private boolean isStartMove = false; private boolean isEndMove = false; public boolean isBlackTurn = false; private boolean isCanFight = true; private boolean isNetFight = false; private boolean isFightBegun = false; private static Checker fightingChecker = null; private static float BOARD_BOTTOM = 0.5f; private enum Direction {TWOLEFTUP, TWOLEFTDOWN, TWORIGHTUP, TWORIGHTDOWN, LEFTUP, RIGHTUP, LEFTDOWN, RIGHTDOWN, NOTHING}; private Direction dir = Direction.NOTHING; public Checker selectedChecker; //constructor /** * Class constructor * @param inpBoard input board whith cells and checkers */ public MoveValidator(Board inpBoard){ System.out.println("game="+NetworkClient.gameH.game.getGauid()); if(NetworkClient.gameH.game.getWhite().getUuid() == NetworkClient.userH.curUser.getUuid())MoveValidator.isPlayerWhite = true; else MoveValidator.isPlayerWhite = false; this.board = inpBoard; BOARD_BOTTOM = inpBoard.getBoardBottom(); } //erasers /** * TODO Check Why it happening * * If Cell or checker have active links * program have some problems with work * This function clean all links before elements checked * */ public void clearCells(){ startCell = null; targetCell = null; selectedChecker = null; tmpChecker = null; } //getters public String getCurrMark(){ return currMark; } public boolean getIsStartMove(){ return isStartMove; } public boolean getIsEndMove(){ return isEndMove; } public static boolean isFightBegun(){ return (fightsBefore > 0) ? true : false; } public static Checker getFightinChecker(){ return fightingChecker; } //setters public void setCurrMark(String inpMark){ currMark = inpMark; } public void setIsStartMove(){ isStartMove = !isStartMove; } public void setIsEndMove(){ isEndMove = !isEndMove; } public void setNetSelectedChecker(float iX, float iY){ selectedChecker = board.getCheckerByGLCoord(iX, iY); startCell = board.getCellByGLCoord(iX, iY); isNetFight = true; setIsStartMove(); } public void setNetTargetCell(float iX, float iY){ targetCell = board.getCellByGLCoord(iX, iY); isNetFight = true; setIsStartMove(); setIsEndMove(); } public void setSelectedChecker(float iX, float iY){ isNetFight = false; selectedChecker = board.getCheckerByDeskCoord(iX, iY); startCell = board.getCellByDeskCoord(iX, iY); System.out.println("selectedChecker:"+selectedChecker.getPosition()); setIsStartMove(); } public void setTargetCell(float iX, float iY){ isNetFight = false; if((targetCell = board.getCellByDeskCoord(iX, iY)) != null) setIsStartMove(); setIsEndMove(); } public boolean isBlackOrWhiteCell(){ if(selectedChecker != null && targetCell != null && targetCell.getColor()){ return true; } return false; } public boolean cellIsBeasy(){ if(board.getCheckerByDeskCoord(targetCell.getPosition())!= null) return true; return false; } public boolean oneCell(){ float a,b; if(isBlackOrWhiteCell()){ a = startCell.getPosition().x - targetCell.getPosition().x; b = startCell.getPosition().y - targetCell.getPosition().y; a = Math.abs(a); b = Math.abs(b); if(a <= 1 && b <= 1)return true; } return false; } public boolean isBeasy(){ if(isBlackOrWhiteCell()){ if(board.getCheckerByGLCoord(targetCell.getPosition().x,targetCell.getPosition().y) != null){ return true; } } return false; } public boolean isQueenHere(){ for(Checker check : board.getCheckers()) if(check.getQueen())return true; return false; } public static String getCurrentStep(){ return currStep; } /** * Check possibility of queen fight in all directions * @param inQueen - selected Queen * @return true, if Queen can fight and false if can't * */ public boolean isQueenCanFightAllDirection(Checker inQueen){ float tmpX = 0; float tmpY = 0; if(inQueen != null){ tmpX = inQueen.getPosition().x; tmpY = inQueen.getPosition().y; while(tmpX < BOARD_BOTTOM+7f && tmpY < BOARD_BOTTOM+7f){ tmpX++; tmpY++; if(tmpX == startCell.getPosition().x && tmpY == startCell.getPosition().y) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f,tmpY+1.0f) == null && board.getCellByGLCoord(tmpX+1.0f,tmpY+1.0f) != null && tmpChecker.getColor() != inQueen.getColor()){ if(!tmpChecker.getIsKilled()){ System.out.println(tmpChecker.getPosition()); System.out.println(inQueen.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY+1.0f) != null && board.getCellByGLCoord(tmpX+1.0f, tmpY+1.0f) != null)break; } tmpX = inQueen.getPosition().x; tmpY = inQueen.getPosition().y; while(tmpX < BOARD_BOTTOM+7f && tmpY > BOARD_BOTTOM){ tmpX++; tmpY--; if(tmpX == startCell.getPosition().x && tmpY == startCell.getPosition().y) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f,tmpY-1.0f) == null && board.getCellByGLCoord(tmpX+1.0f,tmpY-1.0f) != null && tmpChecker.getColor() != inQueen.getColor()){ if(!tmpChecker.getIsKilled()) { System.out.println("Killed checker:"+tmpChecker.getPosition()); System.out.println("Killer queen:"+inQueen.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f,tmpY-1.0f) != null && board.getCellByGLCoord(tmpX+1.0f,tmpY-1.0f) != null) break; } tmpX = inQueen.getPosition().x; tmpY = inQueen.getPosition().y; while(tmpX > BOARD_BOTTOM && tmpY > BOARD_BOTTOM){ tmpX--; tmpY--; if(tmpX == startCell.getPosition().x && tmpY == startCell.getPosition().y) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f,tmpY-1.0f) == null && board.getCellByGLCoord(tmpX-1.0f,tmpY-1.0f) != null && tmpChecker.getColor() != inQueen.getColor()){ if(!tmpChecker.getIsKilled()){ System.out.println("Killed checker:"+tmpChecker.getPosition()); System.out.println("Killer queen:"+inQueen.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f,tmpY-1.0f) != null && board.getCellByGLCoord(tmpX-1.0f,tmpY-1.0f) != null)break; } tmpX = inQueen.getPosition().x; tmpY = inQueen.getPosition().y; while(tmpX > BOARD_BOTTOM && tmpY < BOARD_BOTTOM + 7f){ tmpX--; tmpY++; if(tmpX == startCell.getPosition().x && tmpY == startCell.getPosition().y) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()) break; if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f,tmpY+1.0f) == null && board.getCellByGLCoord(tmpX-1.0f,tmpY+1.0f) != null && tmpChecker.getColor() != inQueen.getColor()){ if(!tmpChecker.getIsKilled()){ System.out.println("Killed checker-+:"+tmpChecker.getPosition()); System.out.println("Killer queen-+:"+inQueen.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX,tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f,tmpY+1.0f) != null && board.getCellByGLCoord(tmpX-1.0f,tmpY+1.0f) != null) break; } } return false; } public boolean isVirtQueenCanFightAllDirection(Checker inQueen){ float tmpX = 0; float tmpY = 0; if(inQueen != null){ tmpX = targetCell.getPosition().x; tmpY = targetCell.getPosition().y; while(tmpX < BOARD_BOTTOM+7f && tmpY < BOARD_BOTTOM+7f){ tmpX++; tmpY++; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor())break; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY+1.0f) == null && board.getCellByGLCoord(tmpX+1.0f, tmpY+1.0f) != null){ if(!tmpChecker.getIsKilled()){ System.out.println(tmpChecker.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY+1.0f) != null && board.getCellByGLCoord(tmpX+1.0f, tmpY+1.0f) != null)break; } tmpX = targetCell.getPosition().x; tmpY = targetCell.getPosition().y; while(tmpX < BOARD_BOTTOM+7f && tmpY > BOARD_BOTTOM){ tmpX++; tmpY--; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor())break; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY-1.0f) == null && board.getCellByGLCoord(tmpX+1.0f, tmpY-1.0f) != null){ if(!tmpChecker.getIsKilled()) { System.out.println(tmpChecker.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY-1.0f) != null && board.getCellByGLCoord(tmpX+1.0f, tmpY-1.0f) != null) break; } tmpX = targetCell.getPosition().x; tmpY = targetCell.getPosition().y; while(tmpX > BOARD_BOTTOM && tmpY > BOARD_BOTTOM){ tmpX--; tmpY--; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor())break; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY-1.0f) == null && board.getCellByGLCoord(tmpX-1.0f, tmpY-1.0f) != null){ if(!tmpChecker.getIsKilled()){ System.out.println(tmpChecker.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY-1.0f) != null && board.getCellByGLCoord(tmpX-1.0f, tmpY-1.0f) != null)break; } tmpX = targetCell.getPosition().x; tmpY = targetCell.getPosition().y; while(tmpX > BOARD_BOTTOM && tmpY < BOARD_BOTTOM + 7f){ tmpX--; tmpY++; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor())break; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY+1.0f) == null && board.getCellByGLCoord(tmpX-1.0f, tmpY+1.0f) != null){ if(!tmpChecker.getIsKilled()){ System.out.println(tmpChecker.getPosition()); return true; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY+1.0f) != null && board.getCellByGLCoord(tmpX-1.0f, tmpY+1.0f) != null)break; } } return false; } /** * check possibility all queen's of fight in current direction * @param inQueen - selected Queen * @return true, if Queen can fight and false if can't * */ public boolean isQueenCanFight(Checker inQueen){ float a,b; float tmpX = 0; float tmpY = 0; int killedCount = 0; boolean returnFlag = false; if(!isBlackOrWhiteCell())return false; if(inQueen != null){ a = startCell.getPosition().x - targetCell.getPosition().x; b = startCell.getPosition().y - targetCell.getPosition().y; tmpX = startCell.getPosition().x; tmpY = startCell.getPosition().y; if(a < 0 && b < 0){ while(tmpX < targetCell.getPosition().x && tmpY < targetCell.getPosition().y){ tmpX++; tmpY++; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()){returnFlag = false;break;} if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY+1.0f) == null && board.getCellByGLCoord(tmpX+1.0f, tmpY+1.0f) != null){ if(!tmpChecker.getIsKilled()){ tmpChecker.setIsKilled(); returnFlag = true; killedCount++; continue; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY+1.0f) != null && board.getCellByGLCoord(tmpX+1.0f, tmpY+1.0f) != null){returnFlag = false;break;} } }else if(a < 0 && b > 0){ while(tmpX < targetCell.getPosition().x && tmpY > targetCell.getPosition().y){ tmpX++; tmpY--; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()){returnFlag = false;break;} if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY-1.0f) == null && board.getCellByGLCoord(tmpX+1.0f, tmpY-1.0f) != null){ if(!tmpChecker.getIsKilled()){ tmpChecker.setIsKilled(); returnFlag = true; killedCount++; continue; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX+1.0f, tmpY-1.0f) != null && board.getCellByGLCoord(tmpX+1.0f, tmpY-1.0f) != null){returnFlag = false;break;} } }else if(a > 0 && b > 0){ while(tmpX > targetCell.getPosition().x && tmpY > targetCell.getPosition().y){ tmpX--; tmpY--; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()){returnFlag = false;break;} if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY-1.0f) == null && board.getCellByGLCoord(tmpX-1.0f, tmpY-1.0f) != null){ if(!tmpChecker.getIsKilled()){ tmpChecker.setIsKilled(); returnFlag = true; killedCount++; continue; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY-1.0f) != null && board.getCellByGLCoord(tmpX-1.0f, tmpY-1.0f) != null){returnFlag = false;break;} } }else if(a > 0 && b < 0){ while(tmpX > targetCell.getPosition().x && tmpY < targetCell.getPosition().y){ tmpX--; tmpY++; if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && tmpChecker.getColor() == inQueen.getColor()){returnFlag = false;break;} if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY+1.0f) == null && board.getCellByGLCoord(tmpX-1.0f, tmpY+1.0f) != null){ if(!tmpChecker.getIsKilled()){ tmpChecker.setIsKilled(); returnFlag = true; killedCount++; continue; } }else if((tmpChecker = board.getCheckerByGLCoord(tmpX, tmpY)) != null && board.getCheckerByGLCoord(tmpX-1.0f, tmpY+1.0f) != null && board.getCellByGLCoord(tmpX-1.0f, tmpY+1.0f) != null){returnFlag = false;break;} } } } if(killedCount > 1){ for(Checker checker : board.getCheckers()) if(checker.getIsKilled()){ checker.clearIsKilled(); System.out.println("cleared"); } System.out.println("count "+killedCount); } System.out.println("killedC"+killedCount); System.out.println("flag"+returnFlag); return returnFlag; } public boolean isLineMovement(){ float a,b; a = startCell.getPosition().x - targetCell.getPosition().x; b = startCell.getPosition().y - targetCell.getPosition().y; if(Math.abs(a)!= Math.abs(b)){return false;} else return true; } //set queen direction public void setDirection(){ float a,b; a = startCell.getPosition().x - targetCell.getPosition().x; b = startCell.getPosition().y - targetCell.getPosition().y; if(Math.abs(a)!= Math.abs(b))dir = Direction.NOTHING; else{ if(a < 0 && b < 0) dir = Direction.RIGHTUP; if(a > 0 && b < 0) dir = Direction.LEFTUP; if(a > 0 && b > 0) dir = Direction.LEFTDOWN; if(a < 0 && b > 0) dir = Direction.RIGHTDOWN; } } // set direction and type of move public boolean twoCell(){ float a,b; if(isBlackOrWhiteCell()){ a = startCell.getPosition().x - targetCell.getPosition().x; b = startCell.getPosition().y - targetCell.getPosition().y; if(a == -1 && b == -1) dir = Direction.RIGHTUP; if(a == 1 && b == -1) dir = Direction.LEFTUP; if(a == 1 && b == 1) dir = Direction.LEFTDOWN; if(a == -1 && b == 1) dir = Direction.RIGHTDOWN; if(a == -2 && b == -2){ dir = Direction.TWORIGHTUP; if((tmpChecker = board.getCheckerByGLCoord(startCell.getPosition().x+1.0f, startCell.getPosition().y+1.0f)) != null && checkColor()){ tmpChecker.setIsKilled(); return true; } }else if(a == -2 && b == 2){ dir = Direction.TWORIGHTDOWN; if((tmpChecker = board.getCheckerByGLCoord(startCell.getPosition().x+1.0f, startCell.getPosition().y-1.0f)) != null && checkColor()){ tmpChecker.setIsKilled(); return true; } }else if(a == 2 && b == 2){ dir = Direction.TWOLEFTDOWN; if((tmpChecker = board.getCheckerByGLCoord(startCell.getPosition().x-1.0f, startCell.getPosition().y-1.0f)) != null && checkColor()){ tmpChecker.setIsKilled(); return true; } }else if(a == 2 && b == -2){ dir = Direction.TWOLEFTUP; if((tmpChecker = board.getCheckerByGLCoord(startCell.getPosition().x-1.0f, startCell.getPosition().y+1.0f)) != null && checkColor()){ tmpChecker.setIsKilled(); return true; } } } return false; } public void moveChecker(float screenX, float screenY){ float tX; float tY; tX = (screenX / board.ppuX) - BOARD_BOTTOM; tY = (screenY / board.ppuY) + BOARD_BOTTOM; tY = tY - (8.0f + BOARD_BOTTOM); tY = Math.abs(tY); if(selectedChecker != null) selectedChecker.setPosition(new Vector2(tX, tY)); } public boolean moveOneCell(){ if(oneCell() && !isBeasy()){ return true; } return false; } public boolean checkColor(){ if( tmpChecker.getColor() != selectedChecker.getColor())return true; else tmpChecker = null; return false; } //do kill another checker public boolean moveTwoCell(){ if(twoCell() && !isBeasy() && tmpChecker != null && checkColor() && targetCell != null){ System.out.println("isKilled:"+tmpChecker.getIsKilled()); selectedChecker.setPosition(targetCell.getPosition()); checkQueen(); return true; } return false; } //returning checker on start position public String returnChecker(){ if(selectedChecker != null) selectedChecker.setPosition(startCell.getPosition()); return "0"; } public void setNetwork(NetworkClient net){ network = net; } //do checker fight or return it private String twoCellStep(){ String result = "0"; if(fightsBefore == 0){ if(!moveTwoCell()){ result = returnChecker(); return result; } //if(checkMove(isBlackTurn)){ if(isCheckerCanFight(selectedChecker)){ if(selectedChecker.getQueen()){ if(isVirtQueenCanFightAllDirection(selectedChecker) == false){ System.out.println("Queen Kild!"); System.out.println("Qresult:4"); isCanFight = true; return "4"; }else{ fightingChecker = selectedChecker; System.out.println("Qresult:5"); fightsBefore++; return "5"; } } if(isBlackTurn != isPlayerWhite){ result = "4"; }else result = "2"; isCanFight = true; selectedChecker = null; return result; }else { fightingChecker = selectedChecker; result = "5"; fightsBefore++; } } else { if(!moveTwoCell()){ result = returnChecker(); return result; } else if(isCheckerCanFight(selectedChecker)){ if(selectedChecker.getQueen()){ if(isVirtQueenCanFightAllDirection(selectedChecker)){ fightsBefore++; fightingChecker = selectedChecker; return "6"; }else{ isCanFight = true; fightsBefore = 0; System.out.println("Qresult:7"+isCanFight); fightingChecker = null; return "7"; } } if(isBlackTurn != isPlayerWhite){ result = "7"; }else result = "2"; fightingChecker = null; isCanFight = true; selectedChecker = null; fightsBefore = 0; return result; }else result = "6"; } return result; } //prepare date and stats before new turn //TODO fix this bag private void endCheckerMove(){ dir = Direction.NOTHING; clearCells(); if(!checkQueensMove(isBlackTurn))isCanFight = false; if(!checkMove(isBlackTurn))isCanFight = false; } //if checker arrived on end of board - transform it in queen public boolean checkQueen(){ if(selectedChecker != null && !selectedChecker.getQueen()){ System.out.println("check queen:" + selectedChecker.getPosition().y); System.out.println("check ColorCH:" + selectedChecker.getColor()); System.out.println("check ColorPL:" + isPlayerWhite); if(selectedChecker.getColor() == isPlayerWhite){ if(targetCell.getPosition().y <= BOARD_BOTTOM){ selectedChecker.setQueen(); return true; } }else{ if(targetCell.getPosition().y <= (8f-BOARD_BOTTOM) && targetCell.getPosition().y > (8f-BOARD_BOTTOM-1.0f) ){ selectedChecker.setQueen(); return true; } } } return false; } private String moveToStr(float x, float y){ if(currStep.length() != 0)currStep += getCurrMark(); currStep += (char)((int)(x - BOARD_BOTTOM) + (int)'a'); currStep += Integer.toString((int)(y+BOARD_BOTTOM)); return currStep; } public Vector2 strToMove(String move){ Vector2 coord = new Vector2(); Vector2 coordBlack = new Vector2(); String sX, sY; sY = move.substring(1); coord.x = (int)move.toCharArray()[0] - (int)'a' + board.getBoardBottom(); //therefore a-a = 0; coord.y = Integer.parseInt(sY) - board.getBoardBottom(); System.out.println("base coord:" + coord); if(!isPlayerWhite){ coordBlack.x = 8.0f - coord.x; coordBlack.y = 8.0f - coord.y; System.out.println("Black coord:" + coordBlack); return coordBlack; } return coord; } //Do checker move, or return if unpossible private String oneStep(boolean bool){ String isSucsess = "0"; if(isCanFight){ if(!moveOneCell() || bool)isSucsess = returnChecker(); else { if(isBlackTurn != isPlayerWhite){ isSucsess = "3"; }else isSucsess = "2"; checkQueen(); } } else { returnChecker(); isSucsess = "1"; } dir = Direction.NOTHING; clearCells(); if(!checkMove(isBlackTurn)){ isCanFight = false; } /// selectedChecker.setPosition(targetCell.getPosition()); return isSucsess; } //If friend queen or checker on patch - return true private boolean isFriendOnLine(){ float tmpX, tmpY; float maxTmpX, maxTmpY; float a, b; tmpX = startCell.getPosition().x; tmpY = startCell.getPosition().y; maxTmpX = targetCell.getPosition().x; maxTmpY = targetCell.getPosition().y; a = tmpX - maxTmpX; b = tmpY - maxTmpY; if(a > 0 && b < 0){ while(tmpX > maxTmpX && tmpY < maxTmpY){ tmpX--; tmpY++; if(board.getCheckerByGLCoord(tmpX, tmpY) != null && board.getCheckerByGLCoord(tmpX, tmpY).getColor() == selectedChecker.getColor()) return true; } } if(a < 0 && b < 0){ while(tmpX < maxTmpX && tmpY < maxTmpY){ tmpX++; tmpY++; if(board.getCheckerByGLCoord(tmpX, tmpY) != null && board.getCheckerByGLCoord(tmpX, tmpY).getColor() == selectedChecker.getColor()) return true; } } if(a < 0 && b > 0){ while(tmpX < maxTmpX && tmpY > maxTmpY){ tmpX++; tmpY--; if(board.getCheckerByGLCoord(tmpX, tmpY) != null && board.getCheckerByGLCoord(tmpX, tmpY).getColor() == selectedChecker.getColor()) return true; } } if(a > 0 && b > 0){ while(tmpX > maxTmpX && tmpY > maxTmpY){ tmpX--; tmpY--; if(board.getCheckerByGLCoord(tmpX, tmpY) != null && board.getCheckerByGLCoord(tmpX, tmpY).getColor() == selectedChecker.getColor()) return true; } } return false; } //this function return false if something here on queen patch private boolean isQueenPatchFree(){ if(!isCanFight) return false; if(!isBlackOrWhiteCell())return false; float tmpX, tmpY; float maxTmpX, maxTmpY; float a, b; tmpX = startCell.getPosition().x; tmpY = startCell.getPosition().y; maxTmpX = targetCell.getPosition().x; maxTmpY = targetCell.getPosition().y; a = tmpX - maxTmpX; b = tmpY - maxTmpY; if(a == 0 && b == 0)return false; if(a > 0 && b < 0){ while(tmpX > maxTmpX && tmpY < maxTmpY){ tmpX--; tmpY++; if(board.getCheckerByGLCoord(tmpX, tmpY) != null) return false; } } if(a < 0 && b < 0){ while(tmpX < maxTmpX && tmpY < maxTmpY){ tmpX++; tmpY++; if(board.getCheckerByGLCoord(tmpX, tmpY) != null) return false; } } if(a < 0 && b > 0){ while(tmpX < maxTmpX && tmpY > maxTmpY){ tmpX++; tmpY--; if(board.getCheckerByGLCoord(tmpX, tmpY) != null) return false; } } if(a > 0 && b > 0){ while(tmpX > maxTmpX && tmpY > maxTmpY){ tmpX--; tmpY--; if(board.getCheckerByGLCoord(tmpX, tmpY) != null) return false; } } return true; } //This function return false if some queen can fight public boolean checkQueensMove(boolean bool){ //for(Checker forChecker : board.getCheckers()){ Checker forChecker; for(int i=0; i < board.getCheckers().size;i++){ forChecker = board.getCheckers().get(i); if(forChecker.getColor() == bool && forChecker.getQueen()){ if(isQueenCanFightAllDirection(forChecker)){ System.out.println("Queen can fight CQM"); return false; } } } return true; } //This function return false if some checker can fight public boolean checkMove(boolean bool){ Checker virtChecker; Checker forChecker; //work with checker array make conflict //because function getCheckerByCoord() use foreach too and change iterator for(Cell forCell : board.getCells()){ if(forCell.getColor()){ if((forChecker = board.getCheckerByGLCoord(forCell.getPosition())) != null && !forChecker.getQueen()){ if(forChecker.getColor() == bool){ if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x+1.0f, forCell.getPosition().y+1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x+2.0f, forCell.getPosition().y+2.0f) == null) if(forCell.getPosition().x+2 < 8 && forCell.getPosition().y+2 < 8){ forChecker.setCanFight(); return false; } } if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x-1.0f, forCell.getPosition().y-1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x-2.0f, forCell.getPosition().y-2.0f) == null) if(forCell.getPosition().x-2 >= 0 && forCell.getPosition().y-2 >= 0){ forChecker.setCanFight(); return false; } } if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x+1.0f, forCell.getPosition().y-1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x+2.0f, forCell.getPosition().y-2.0f) == null) if(forCell.getPosition().x+2 < 8 && forCell.getPosition().y-2 >= 0){ forChecker.setCanFight(); return false; } } if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x-1.0f, forCell.getPosition().y+1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x-2.0f, forCell.getPosition().y+2.0f) == null) if(forCell.getPosition().x-2 >= 0 && forCell.getPosition().y+2 < 8){ forChecker.setCanFight(); return false; } } } } } } return true; } //Check selected checker can fight public boolean isCheckerCanFight(Checker checker){ Checker virtChecker; Checker forChecker; Cell forCell; //work with checker array make conflict //because function getCheckerByCoord() use foreach too and change iterator forChecker = checker; forCell = board.getCellByGLCoord(checker.getPosition().x,checker.getPosition().y); if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x+1.0f, forCell.getPosition().y+1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x+2.0f, forCell.getPosition().y+2.0f) == null) if(forCell.getPosition().x+2 < 8 && forCell.getPosition().y+2 < 8){ forChecker.setCanFight(); return false; } } if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x-1.0f, forCell.getPosition().y-1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x-2.0f, forCell.getPosition().y-2.0f) == null) if(forCell.getPosition().x-2 >= 0 && forCell.getPosition().y-2 >= 0){ forChecker.setCanFight(); return false; } } if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x+1.0f, forCell.getPosition().y-1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x+2.0f, forCell.getPosition().y-2.0f) == null) if(forCell.getPosition().x+2 < 8 && forCell.getPosition().y-2 >= 0){ forChecker.setCanFight(); return false; } } if((virtChecker = board.getCheckerByGLCoord(forCell.getPosition().x-1.0f, forCell.getPosition().y+1.0f)) != null){ if(virtChecker.getColor() != forChecker.getColor() && !virtChecker.getIsKilled()) if(board.getCheckerByGLCoord(forCell.getPosition().x-2.0f, forCell.getPosition().y+2.0f) == null) if(forCell.getPosition().x-2 >= 0 && forCell.getPosition().y+2 < 8){ forChecker.setCanFight(); return false; } } return true; } //Do queen return, move or fight public String doQueenMove(){ String result = "0"; if(!isLineMovement() || isBeasy() || isFriendOnLine()){ return returnChecker(); } else if(isQueenPatchFree()){ if(isBlackTurn != isPlayerWhite){ result = "3"; }else result = "2"; return result; }else if(isQueenCanFight(selectedChecker) || isCanFight){ if(fightsBefore == 0){ if(isVirtQueenCanFightAllDirection(selectedChecker) == false){ System.out.println("Queen Kild!"); System.out.println("Qresult:4"); isCanFight = true; return "4"; }else{ System.out.println("Qresult:5"); fightsBefore++; return "5"; } }else{ if(isVirtQueenCanFightAllDirection(selectedChecker)){ fightsBefore++; return "6"; }else{ isCanFight = true; fightsBefore = 0; fightingChecker = null; System.out.println("Qresult:7"+isCanFight); return "7"; } } }else result = returnChecker(); return result; } /**this function prepare date and stats before new turn **/ public void endQueenMove(){ dir = Direction.NOTHING; clearCells(); if(!checkMove(isBlackTurn)){ System.out.println("Checker can fight CQM"); isCanFight = false; } if(!checkQueensMove(isBlackTurn)){ isCanFight = false; } } //TODO change status - 000-099 - rejects, 100-199 - success moves, 200-299 - success fights //This function do main work of check move. /* *code 0 - turn disallowed - without reason *code 1 - turn disallowed - smb can fight *code 2 - turn allowed - virtual turn - send to server disabled *code 3 - turn allowed - real turn - send to server enabled *code 4 - turn allowed - real turn - single kill *code 5 - turn allowed - real turn - but u can kill another one *code 6 - turn allowed - real turn - next kill from multi kill *code 7 - turn allowed - real turn - last kill from multi kill */ public String doCheckMove(){ String isSucsess = "0"; if(selectedChecker != null){ if(selectedChecker.getColor() == isBlackTurn){ if(isQueenHere())if(!checkQueensMove(isBlackTurn)){isCanFight = false;}//It's needed for check new queen's if(!selectedChecker.getQueen()){ //If current checker not queen do this twoCell(); String tmpResult; switch(dir){ case TWOLEFTUP : case TWOLEFTDOWN : case TWORIGHTUP : case TWORIGHTDOWN : isSucsess=((tmpResult= twoCellStep()) != "0")? tmpResult : "0";break; case LEFTUP : case RIGHTUP : isSucsess=((tmpResult = oneStep(!(selectedChecker.getColor() ^ MoveValidator.isPlayerWhite))) != "0") ? tmpResult : "0";break; case RIGHTDOWN : case LEFTDOWN : isSucsess=((tmpResult = oneStep(selectedChecker.getColor() ^ MoveValidator.isPlayerWhite)) != "0") ? tmpResult : "0";break; case NOTHING : returnChecker();break; } }else{ String tmpResult; setDirection(); switch(dir){ case LEFTUP : case RIGHTUP : case RIGHTDOWN : case LEFTDOWN : isSucsess = doQueenMove();break; case NOTHING : returnChecker();break; } } }else returnChecker(); } // endCheckerMove(); // }else returnChecker(); System.out.println("killFlag:"+isCanFight); System.out.println("Sucsess code:"+isSucsess); return isSucsess; } }//end of class
package day23Arrays; import java.util.Scanner; public class warmup1 { public static void main(String[] args) { /* * write a program that can divide two numbers without using division operator * 10-3=7 * 7-3=4 * 4-3=1//3 times substract/10/3=3 * what if we give negative numbers * find the bug */ Scanner scan=new Scanner(System.in); System.out.println("enter 2 number"); int num1=scan.nextInt(); int num2=scan.nextInt(); int count=0; int num=num1; if(num2!=0) { while(num1>=num2){ num1-=num2; count++; } System.out.println("division is "+count+" with a remainder of "+num1); //result of the islem System.out.println(num1);//remainder }else { System.out.println("invalid entry"); } } }
package com.sinata.rwxchina.basiclib.commonclass.adpter; import android.support.v4.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.sinata.rwxchina.basiclib.R; import com.sinata.rwxchina.basiclib.base.BaseActivity; import com.sinata.rwxchina.basiclib.commonclass.Bean.Couponbean; import com.sinata.rwxchina.basiclib.utils.logUtils.LogUtils; import java.util.ArrayList; import java.util.List; /** * @author:zy * @detetime:2017/12/27 * @describe:类描述 * @modifyRecord: * 修改构造方法,避免list传入为空时造成空指针错误 2018/01/08 HRR */ public class CouponListAdapter extends BaseAdapter { private BaseActivity baseActivity; private List<Couponbean> list; @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return list.get(position); } @Override public long getItemId(int position) { return position; } public List<Couponbean> getList() { return list; } public void setList(List<Couponbean> list) { this.list = list; } public CouponListAdapter(BaseActivity baseActivity, List<Couponbean> list) { this.baseActivity = baseActivity; this.list = list; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { convertView = LayoutInflater.from(baseActivity).inflate(R.layout.item_mycoupon, null); viewHolder = new ViewHolder(convertView); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } switch (list.get(position).getCoupon_state()) { case "1": setCoupon(viewHolder, R.mipmap.icon_used); break; case "2": setCoupon(viewHolder, R.mipmap.icon_expired); break; } viewHolder.couponName.setText(list.get(position).getCoupon_name()); viewHolder.couponMoney.setText(list.get(position).getMoney()); viewHolder.validDate.setText(list.get(position).getCoupon_overtime()); viewHolder.couponDescription.setText(list.get(position).getCoupon_describe()); return convertView; } private void setCoupon(ViewHolder viewHolder, int icon) { viewHolder.immediatelyUse.setVisibility(View.GONE); viewHolder.couponBackground.setBackgroundResource(R.mipmap.expired_coupon_bg); viewHolder.icon_rmb.setBackgroundResource(R.mipmap.icon_rmb_gray); viewHolder.couponStatus.setBackgroundResource(icon); viewHolder.couponMoney.setTextColor(ContextCompat.getColor(baseActivity,R.color.colorGray3)); viewHolder.couponName.setTextColor(ContextCompat.getColor(baseActivity,R.color.colorGray3)); viewHolder.couponDescription.setTextColor(ContextCompat.getColor(baseActivity,R.color.colorGray3)); viewHolder.validDate.setTextColor(ContextCompat.getColor(baseActivity,R.color.colorGray3)); } class ViewHolder { private ImageView couponStatus, icon_rmb; private TextView couponMoney, couponName, validDate, couponDescription, immediatelyUse; private RelativeLayout couponBackground; public ViewHolder(View view) { couponStatus = view.findViewById(R.id.item_couponStatus_iv); couponMoney = view.findViewById(R.id.item_couponMoney_tv); couponName = view.findViewById(R.id.item_couponName_tv); validDate = view.findViewById(R.id.item_validity_tv); couponDescription = view.findViewById(R.id.item_couponRule_tv); immediatelyUse = view.findViewById(R.id.immediatelyUse_tv); couponBackground = view.findViewById(R.id.item_coupon_rl); icon_rmb = view.findViewById(R.id.icon_rmb); } } }
package com.fleet.cassandra.service; import com.datastax.driver.core.querybuilder.QueryBuilder; import com.datastax.driver.core.querybuilder.Select; import com.fleet.cassandra.entity.User; import org.springframework.data.cassandra.core.CassandraTemplate; import org.springframework.stereotype.Repository; import javax.annotation.Resource; @Repository public class UserService { @Resource private CassandraTemplate cassandraTemplate; public User save(User user) { return cassandraTemplate.insert(user); } public User selectOneById(Long id) { return cassandraTemplate.selectOneById(id, User.class); } public Iterable<User> select() { return cassandraTemplate.select("SELECT * FROM user;", User.class); } public Iterable<User> select(User user) { Select select = QueryBuilder.select().from("user").allowFiltering(); select.where(QueryBuilder.like("name", user.getName())); return cassandraTemplate.select(select, User.class); } }
package org.maven.ide.eclipse.io; import java.io.File; import java.net.HttpURLConnection; import java.net.URI; import junit.framework.TestSuite; import org.sonatype.tests.http.runner.junit.Junit3SuiteConfiguration; public class S2IOFacadeLocalTest extends AbstractIOTest { @Override public void setUp() throws Exception { // we do not need a server for local testing } public void testExists_Local() throws Exception { assertTrue( S2IOFacade.exists( new File( RESOURCES, FILE_LOCAL ).toURI().toString(), monitor ) ); } public void testExists_Local_NotFound() throws Exception { assertFalse( S2IOFacade.exists( new File( RESOURCES, NEW_FILE ).toURI().toString(), monitor ) ); } public void testHeadRequest_Local() throws Exception { URI address = new File( RESOURCES, FILE_LOCAL ).toURI(); ServerResponse resp = S2IOFacade.head( address.toString(), null, monitor ); assertEquals( "Unexpected HTTP status code", HttpURLConnection.HTTP_OK, resp.getStatusCode() ); } public void testHeadRequest_Local_NotFound() throws Exception { URI address = new File( RESOURCES, "missingfile.txt" ).toURI(); ServerResponse resp = S2IOFacade.head( address.toString(), null, monitor ); assertEquals( "Unexpected HTTP status code", HttpURLConnection.HTTP_NOT_FOUND, resp.getStatusCode() ); } public static TestSuite suite() throws Exception { return Junit3SuiteConfiguration.suite( S2IOFacadeLocalTest.class ); } }
package net.cupmouse.minecraft.eplugin; import com.google.inject.Inject; import net.cupmouse.minecraft.eplugin.bettercmd.EBetterCommand; import net.cupmouse.minecraft.eplugin.chat.ChatManager; import net.cupmouse.minecraft.eplugin.data.EIDManager; import net.cupmouse.minecraft.eplugin.data.group.GroupManager; import net.cupmouse.minecraft.eplugin.data.ticket.TicketManager; import net.cupmouse.minecraft.eplugin.data.user.UserManager; import net.cupmouse.minecraft.eplugin.database.DatabaseManager; import net.cupmouse.minecraft.eplugin.geoip.GeoipGetter; import net.cupmouse.minecraft.eplugin.language.LanguageManager; import net.cupmouse.minecraft.eplugin.listener.*; import net.cupmouse.minecraft.eplugin.minigame.MinigameManager; import net.cupmouse.minecraft.eplugin.music.MusicManager; import net.cupmouse.minecraft.eplugin.scoreboard.ScoreboardManager; import net.cupmouse.minecraft.eplugin.security.ESecurity; import net.cupmouse.minecraft.eplugin.world.MultiWorldManager; import org.slf4j.Logger; import org.spongepowered.api.Sponge; import org.spongepowered.api.config.DefaultConfig; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.EventManager; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.game.state.*; import org.spongepowered.api.plugin.Plugin; import org.spongepowered.api.plugin.PluginContainer; import org.spongepowered.api.scheduler.Task; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.TranslatableText; import java.nio.file.Path; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; import java.util.concurrent.TimeUnit; import static net.cupmouse.minecraft.eplugin.language.LanguageManager.lt; /** * プラグインのメインクラス * * @author sssanma * @since 2014/09/09 */ @Plugin(id = "E-Plugin", name = "いい鯖プラグイン", version = "5.0.0-SD") public final class EPlugin { public static final ZoneId ZONE_UTC = ZoneId.of("UTC"); public static final Random rand = new Random(); public static EPlugin instance; public final LanguageManager language; public final GeoipGetter geoip; public final AsyncSaver asyncSaver; public final DatabaseManager db; public final MusicManager music; public final ScoreboardManager scoreboard; public final EIDManager eidManager; public final UserManager userManager; public final GroupManager groupManager; public final TicketManager ticketManager; public final ChatManager chat; public final MultiWorldManager worlds; public final MinigameManager minigame; public final BlockListener blockListener; public final EntityListener entityListener; public final InventoryListener inventoryListener; public final PlayerListener playerListener; public final ServerListener serverListener; public final VotifierVoteListener votiferListener; public final WorldListener worldListener; public int sessionId; public EConfig config; private List<EPluginComponent> components = new ArrayList<>(); private Task heartbeatTask; @Inject private Logger logger; @Inject @DefaultConfig(sharedRoot = false) private Path configPath; @Inject private PluginContainer container; public EPlugin() { components.add(this.db = new DatabaseManager(this)); components.add(this.language = new LanguageManager(this)); components.add(this.geoip = new GeoipGetter(this)); components.add(this.asyncSaver = new AsyncSaver(this)); components.add(this.worlds = new MultiWorldManager(this)); components.add(this.music = new MusicManager(this)); components.add(this.scoreboard = new ScoreboardManager(this)); components.add(this.eidManager = new EIDManager(this)); components.add(this.userManager = new UserManager(this)); components.add(this.groupManager = new GroupManager(this)); components.add(this.ticketManager = new TicketManager(this)); components.add(new ESecurity(this)); components.add(this.chat = new ChatManager(this)); components.add(this.minigame = new MinigameManager(this)); components.add(new EBetterCommand(this)); LocalDateTime timeNow = LocalDateTime.now(EPlugin.ZONE_UTC); this.db.createSession().prepareUpdate("INSERT INTO heartbeat VALUES(null, ?, ?, ?)", preparedStatement -> { String now = timeNow.format(DatabaseManager.SQL_DATETIME_FORMAT); preparedStatement.setString(1, Status.STARTING.name()); preparedStatement.setString(2, now); preparedStatement.setString(3, now); }).result("SELECT LAST_INSERT_ID()", resultSet -> { resultSet.next(); sessionId = resultSet.getInt(1); }).executeAll(); blockListener = new BlockListener(this); entityListener = new EntityListener(this); inventoryListener = new InventoryListener(this); playerListener = new PlayerListener(this); serverListener = new ServerListener(this); votiferListener = new VotifierVoteListener(this); worldListener = new WorldListener(this); } public static EPlugin getInstance() { return instance; } public Logger getLogger() { return logger; } public Path getConfigPath() { return configPath; } public PluginContainer getContainer() { return container; } public void registerComponent(EPluginComponent component) { components.add(component); } /** * いい鯖プラグインに登録されているすべてのコンポーネントを返します * * @return いい鯖プラグインに登録されているすべてのコンポーネント */ public List<EPluginComponent> getComponents() { return Collections.unmodifiableList(components); } @Listener public void onInit(GameInitializationEvent event) { try { // if (!TimeZone.getDefault().toZoneId().equals(ZoneId.of("UTC"))) { // throw new IllegalStateException("タイムゾーンがUTCに設定されていません。"); // } logger.info("設定読み込み..."); // 設定を読み込み this.config = new EConfig(this); this.config.load(); logger.info("リスナを登録..."); EventManager eventManager = Sponge.getEventManager(); eventManager.registerListeners(this, blockListener); eventManager.registerListeners(this, entityListener); eventManager.registerListeners(this, inventoryListener); eventManager.registerListeners(this, playerListener); eventManager.registerListeners(this, serverListener); eventManager.registerListeners(this, votiferListener); eventManager.registerListeners(this, worldListener); components.forEach(EPluginComponent::registerListeners); } catch (Exception e) { e.printStackTrace(); logger.error("有効化できませんでした。"); try { Thread.sleep(Long.MAX_VALUE); } catch (InterruptedException e1) { e1.printStackTrace(); } } } @Listener public void onAboutToStartServer(GameAboutToStartServerEvent event) throws EPluginException { try { // コンポーネントを有効化 for (EPluginComponent component : components) { logger.info("有効化..." + component.name); component.onEnable(); } } catch (Exception e) { e.printStackTrace(); logger.error("セッションを有効化できませんでした"); try { Thread.sleep(Long.MAX_VALUE); } catch (InterruptedException e1) { e1.printStackTrace(); } } } @Listener public void onGameStartedServer(GameStartedServerEvent event) { sendHeartbeat(Status.RUNNING); heartbeatTask = Sponge.getScheduler().createTaskBuilder().delay(10, TimeUnit.SECONDS).interval(10, TimeUnit.SECONDS).execute(() -> { sendHeartbeat(Status.RUNNING); }).submit(this); } @Listener public void onServerStopping(GameStoppingServerEvent event) { heartbeatTask.cancel(); sendHeartbeat(Status.SHUTTINGDOWN); // 設定を保存 this.config.save(); // コンポーネントを無効化 for (EPluginComponent component : components) try { component.onDisable(); } catch (Exception e) { e.printStackTrace(); } logger.info("終了処理を完了しました。"); } @Listener public void onServerStopped(GameStoppedEvent event) { sendHeartbeat(Status.STOPPED); for (EPluginComponent component : components) try { component.onFinishDisable(); } catch (Exception e) { e.printStackTrace(); } logger.info("最終終了処理を完了しました。"); } private void sendHeartbeat(Status status) { this.db.createSession().prepareUpdate("UPDATE heartbeat SET status = ?, last_heartbeat_time = ? WHERE id = ?", preparedStatement -> { preparedStatement.setString(1, status.name()); preparedStatement.setString(2, LocalDateTime.now(ZONE_UTC).format(DatabaseManager.SQL_DATETIME_FORMAT)); preparedStatement.setInt(3, sessionId); }).executeAll(); } public void panic(String reason) { config.panic(reason); TranslatableText text = Text.of(lt("message.panic"), reason); for (Player player : Sponge.getGame().getServer().getOnlinePlayers()) { player.kick(text); } } public void unpanic() { config.unpanic(); } public enum Status { STARTING, RUNNING, SHUTTINGDOWN, STOPPED } }
package android.support.v4.d; import android.support.v4.d.e.c; class e$e extends e$d { private final boolean tp; private e$e(c cVar, boolean z) { super(cVar); this.tp = z; } protected final boolean bN() { return this.tp; } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package unalcol.types.collection.tree.bplus; /** * @author jgomez */ public interface BPlusLeafNode<T> extends BPlusNode<T> { public BPlusLeafNode<T> newInstance(T[] keys, int n); //key's methods public T[] keys(); public T key(int index); public boolean insert(int pos, T key); public boolean remove(int pos); public boolean append(T key); public void set(int i, T key); }
package com.supconit.kqfx.web.fxzf.search.services; import hc.base.domains.Pageable; import hc.orm.BasicOrmService; import java.util.List; import com.supconit.kqfx.web.fxzf.search.entities.Fxzf; public interface FxzfSearchService extends BasicOrmService<Fxzf,String> { /** * 分页查询信息列表,实时过车记录页面(含有车牌号模糊查询) * @param pager * @param condition * @return */ Pageable<Fxzf> findByPager(Pageable<Fxzf> pager, Fxzf condition); /** * 分页查询信息列表(违章过车和黑名单过车轨迹,使用车牌号和车牌颜色进行精确查询) * @param pager * @param condition * @return */ Pageable<Fxzf> findByPagerDetail(Pageable<Fxzf> pager, Fxzf condition); /** * 批量新增 * @param fxzfList */ void batchInsert(List<Fxzf> fxzfList); /** * 告警触发接口(判断是否超过告警阀值) * @param fxzf * @return */ Boolean warnTrigger(Fxzf fxzf); /** * 审核信息 */ void checkFxzfMessage(Fxzf condition); /** * 获取某个超限状态的数目 */ int getOverLoadStatusCount(Fxzf fxzf); /** * 获取所有超限状态的数目 */ int getIllegalLevelCount(Fxzf fxzf); /** * 获取治超站过车数量、违法过车数量、治超站当天违法过车数量(监控系统调用) * @param fxzf * @return */ Integer getCountByCondition(Fxzf fxzf); /** * 获取某违法程度过车数量(监控系统调用) * @param fxzf * @return */ Integer getOverLoadCount(Fxzf fxzf); /** * 根据过车记录ID删除该记录信息 * @param id */ void deleteById(String id); /** * 获取没有被上传的前10条信息 */ List<Fxzf> getFxzfToTransport(); /** * 更新过车数据 * @param fxzf */ void upDateFxzftransport(Fxzf fxzf); }
package com.podarbetweenus.Activities; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.NotificationManager; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.util.DisplayMetrics; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.EditText; import android.widget.ExpandableListView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.podarbetweenus.Adapter.ExpandableTopicListAdapter; import com.podarbetweenus.Adapter.ExpandableTopicsAdapter; import com.podarbetweenus.Adapter.ResourceAdapter; import com.podarbetweenus.Adapter.TeacherTopicListAdapter; import com.podarbetweenus.BetweenUsConstant.Constant; import com.podarbetweenus.Entity.LoginDetails; import com.podarbetweenus.R; import com.podarbetweenus.Services.DataFetchService; import com.podarbetweenus.Utility.AppController; import org.json.JSONObject; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * Created by Gayatri on 3/3/2016. */ public class SubjectTopicsActivity extends Activity implements View.OnClickListener{ //UI Variables //EditTExt EditText ed_cycle_test; //ListView ListView list_resource; ExpandableListView lv_subject_topiclist; //TextView TextView tv_no_record,tv_cancel,tv_version_code,tv_version_name,tv_child_name_drawer,tv_academic_year_drawer,tv_std_subj,tv_teacher_class; //DrawerLayout DrawerLayout drawer; //Linear Layout LinearLayout lay_back_investment; //Relative Layout RelativeLayout leftfgf_drawer,rl_profile; //ListView ListView drawerListView; //ImageView ImageView img_drawer,img_close; String usl_id,clt_id,board_name,school_name,teacher_name,version_name,firstTypetopic="",firstcycle_test,firstTimeCycle="",cycleTest_id, subject_name,classs,noResultFound="false",class_id,std,firstTimeCycletestSelection="true",crf_id,crl_file,topic_name,org_id,clas_teacher,academic_year,teacher_div,teacher_std,teacher_shift; String cycleTestMethod_name = "CycleTestDropDown"; String TopicsMethodName = "GetTeacherTopicList"; String resourcesMethodName = "GetTeacherResourceList"; ArrayList<String> strings_cycleTest; String[] select_cycleTest; int notificationID = 1; List<String> groupList; Map<String, List<String>> topicCollection; List<String> childList; String[] data_without_sibling; int[] icons_without_sibling; LoginDetails login_details; DataFetchService dft; TeacherTopicListAdapter teacherTopicListAdapter; ResourceAdapter resourceAdapter; //LayoutEntities HeaderControler header; //ProgressDialog ProgressDialog progressDialog; ContentDisplaceDrawerToggle mContentDisplaceToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.subject_topicslist); findViews(); init(); getIntentData(); setDrawer(); lv_subject_topiclist.setDivider(null); lv_subject_topiclist.setDividerHeight(0); firstTimeCycle = "false"; try { //Call Webservice for cycleTEst CallCycleTestWebservice(board_name); } catch (Exception e) { e.printStackTrace(); } AppController.CycleTest = "false"; lv_subject_topiclist.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { int previousGroup = -1; @Override public void onGroupExpand(int groupPosition) { if (groupPosition != previousGroup) lv_subject_topiclist.collapseGroup(previousGroup); previousGroup = groupPosition; } }); } private void setDrawer() { try { if(LoginActivity.get_class_teacher(SubjectTopicsActivity.this).equalsIgnoreCase("1")) { icons_without_sibling = new int[]{R.drawable.dashboard_48x48, R.drawable.messagebox_48x48, R.drawable.sms_48x48, R.drawable.announcementicon_48x48, R.drawable.att_48x48, R.drawable.behaviouricon_48x48, R.drawable.subjectlist_48x48, R.drawable.setting1_hdpi, R.drawable.logout1_hdpi, R.drawable.info}; data_without_sibling = new String[]{"Dashboard", "Messages", "SMS", "Announcement", "Attendance", "Behaviour", "Subject List", "Setting", "Sign Out", "About"}; drawerListView.setAdapter(new CustomAccount(SubjectTopicsActivity.this, android.R.layout.simple_list_item_1, icons_without_sibling, data_without_sibling)); drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { if (dft.isInternetOn() == true) { Intent teacherProfile = new Intent(SubjectTopicsActivity.this, TeacherProfileActivity.class); teacherProfile.putExtra("clt_id", clt_id); teacherProfile.putExtra("usl_id", usl_id); teacherProfile.putExtra("School_name", school_name); teacherProfile.putExtra("Teacher_name", teacher_name); teacherProfile.putExtra("org_id", org_id); teacherProfile.putExtra("cls_teacher", clas_teacher); teacherProfile.putExtra("academic_year", academic_year); teacherProfile.putExtra("version_name", AppController.versionName); teacherProfile.putExtra("board_name", board_name); teacherProfile.putExtra("Teacher_div",teacher_div); teacherProfile.putExtra("Teacher_Shift",teacher_shift); teacherProfile.putExtra("Tecaher_Std",teacher_std); startActivity(teacherProfile); } } else if (position == 1) { //Message if (dft.isInternetOn() == true) { Intent teacherProfile = new Intent(SubjectTopicsActivity.this, TeacherMessageActivity.class); teacherProfile.putExtra("clt_id", clt_id); teacherProfile.putExtra("usl_id", usl_id); teacherProfile.putExtra("School_name", school_name); teacherProfile.putExtra("Teacher_name", teacher_name); teacherProfile.putExtra("org_id", org_id); teacherProfile.putExtra("cls_teacher", clas_teacher); teacherProfile.putExtra("academic_year", academic_year); teacherProfile.putExtra("version_name", AppController.versionName); teacherProfile.putExtra("board_name", board_name); teacherProfile.putExtra("Teacher_div",teacher_div); teacherProfile.putExtra("Teacher_Shift",teacher_shift); teacherProfile.putExtra("Tecaher_Std",teacher_std); startActivity(teacherProfile); } } else if (position == 2) { //SMS if (dft.isInternetOn() == true) { Intent teacherProfile = new Intent(SubjectTopicsActivity.this, TeacherSMSActivity.class); teacherProfile.putExtra("clt_id", clt_id); teacherProfile.putExtra("usl_id", usl_id); teacherProfile.putExtra("School_name", school_name); teacherProfile.putExtra("Teacher_name", teacher_name); teacherProfile.putExtra("org_id", org_id); teacherProfile.putExtra("cls_teacher", clas_teacher); teacherProfile.putExtra("academic_year", academic_year); teacherProfile.putExtra("version_name", AppController.versionName); teacherProfile.putExtra("board_name", board_name); teacherProfile.putExtra("Teacher_div",teacher_div); teacherProfile.putExtra("Teacher_Shift", teacher_shift); teacherProfile.putExtra("Tecaher_Std",teacher_std); startActivity(teacherProfile); } } else if (position == 3) { //announcement if (dft.isInternetOn() == true) { Intent teacherannouncment = new Intent(SubjectTopicsActivity.this, TeacherAnnouncementsActivity.class); teacherannouncment.putExtra("clt_id", clt_id); teacherannouncment.putExtra("usl_id", usl_id); teacherannouncment.putExtra("School_name", school_name); teacherannouncment.putExtra("Teacher_name", teacher_name); teacherannouncment.putExtra("version_name", AppController.versionName); teacherannouncment.putExtra("board_name", board_name); teacherannouncment.putExtra("cls_teacher", clas_teacher); teacherannouncment.putExtra("academic_year", academic_year); teacherannouncment.putExtra("org_id", org_id); teacherannouncment.putExtra("Teacher_div",teacher_div); teacherannouncment.putExtra("Teacher_Shift",teacher_shift); teacherannouncment.putExtra("Tecaher_Std",teacher_std); startActivity(teacherannouncment); } } else if (position == 4) { //Attendance if (dft.isInternetOn() == true) { Intent teacherattendance = new Intent(SubjectTopicsActivity.this, TeacherAttendanceActivity.class); teacherattendance.putExtra("clt_id", clt_id); teacherattendance.putExtra("usl_id", usl_id); teacherattendance.putExtra("School_name", school_name); teacherattendance.putExtra("Teacher_name", teacher_name); teacherattendance.putExtra("version_name", AppController.versionName); teacherattendance.putExtra("board_name", board_name); teacherattendance.putExtra("cls_teacher", clas_teacher); teacherattendance.putExtra("academic_year", academic_year); teacherattendance.putExtra("org_id", org_id); teacherattendance.putExtra("Teacher_div",teacher_div); teacherattendance.putExtra("Teacher_Shift",teacher_shift); teacherattendance.putExtra("Tecaher_Std",teacher_std); startActivity(teacherattendance); } } else if (position == 5) { //Behaviour if (dft.isInternetOn() == true) { Intent teacher_behaviour = new Intent(SubjectTopicsActivity.this, TeacherBehaviourActivity.class); teacher_behaviour.putExtra("clt_id", clt_id); teacher_behaviour.putExtra("usl_id", usl_id); teacher_behaviour.putExtra("School_name", school_name); teacher_behaviour.putExtra("Teacher_name", teacher_name); teacher_behaviour.putExtra("version_name", AppController.versionName); teacher_behaviour.putExtra("board_name", board_name); teacher_behaviour.putExtra("org_id", org_id); teacher_behaviour.putExtra("cls_teacher", clas_teacher); teacher_behaviour.putExtra("academic_year", academic_year); teacher_behaviour.putExtra("Teacher_div",teacher_div); teacher_behaviour.putExtra("Teacher_Shift",teacher_shift); teacher_behaviour.putExtra("Tecaher_Std",teacher_std); startActivity(teacher_behaviour); } } else if (position == 6) { //Sbject List if (dft.isInternetOn() == true) { Intent subject_list = new Intent(SubjectTopicsActivity.this, SubjectListActivity.class); subject_list.putExtra("usl_id", usl_id); subject_list.putExtra("version_name", AppController.versionName); subject_list.putExtra("clt_id", clt_id); subject_list.putExtra("School_name", school_name); subject_list.putExtra("Teacher_name", teacher_name); subject_list.putExtra("board_name", board_name); subject_list.putExtra("org_id", org_id); subject_list.putExtra("cls_teacher", clas_teacher); subject_list.putExtra("academic_year", academic_year); subject_list.putExtra("Teacher_div",teacher_div); subject_list.putExtra("Teacher_Shift",teacher_shift); subject_list.putExtra("Tecaher_Std",teacher_std); startActivity(subject_list); } } else if (position == 7) { Intent setting = new Intent(SubjectTopicsActivity.this, SettingActivity.class); setting.putExtra("usl_id", usl_id); setting.putExtra("version_name", AppController.versionName); setting.putExtra("clt_id", clt_id); setting.putExtra("School_name", school_name); setting.putExtra("Teacher_name", teacher_name); setting.putExtra("board_name", board_name); setting.putExtra("org_id", org_id); setting.putExtra("cls_teacher", clas_teacher); setting.putExtra("Teacher_div",teacher_div); setting.putExtra("Teacher_Shift",teacher_shift); setting.putExtra("Tecaher_Std",teacher_std); setting.putExtra("academic_year", academic_year); startActivity(setting); } else if (position == 8) { //Signout Intent signout = new Intent(SubjectTopicsActivity.this, LoginActivity.class); Constant.SetLoginData("", "", SubjectTopicsActivity.this); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(notificationID); AppController.iconCount = 0; AppController.iconCountOnResume = 0; AppController.OnBackpressed = "false"; AppController.loginButtonClicked = "false"; AppController.drawerSignOut = "true"; startActivity(signout); } else if (position == 9) { try { final Dialog alertDialog = new Dialog(SubjectTopicsActivity.this); LayoutInflater inflater = getLayoutInflater(); alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); alertDialog.getWindow().setBackgroundDrawable( new ColorDrawable(Color.TRANSPARENT)); View convertView = inflater.inflate(R.layout.about_us, null); alertDialog.setContentView(convertView); tv_version_name = (TextView) convertView.findViewById(R.id.tv_version_name); tv_version_code = (TextView) convertView.findViewById(R.id.tv_version_code); tv_cancel = (TextView) convertView.findViewById(R.id.tv_cancel); tv_version_name.setText("Version Name: " + AppController.versionName); tv_version_code.setText("Version Code: " + AppController.versionCode); alertDialog.show(); tv_cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); } }); } catch (Exception e) { e.printStackTrace(); } } } }); } else { icons_without_sibling = new int[]{R.drawable.dashboard_48x48, R.drawable.messagebox_48x48, R.drawable.sms_48x48, R.drawable.announcementicon_48x48, R.drawable.subjectlist_48x48, R.drawable.setting1_hdpi, R.drawable.logout1_hdpi, R.drawable.info}; data_without_sibling = new String[]{"Dashboard", "Messages", "SMS", "Announcement", "Subject List", "Setting", "Sign Out", "About"}; drawerListView.setAdapter(new CustomAccount(SubjectTopicsActivity.this, android.R.layout.simple_list_item_1, icons_without_sibling, data_without_sibling)); drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { if (dft.isInternetOn() == true) { Intent teacherProfile = new Intent(SubjectTopicsActivity.this, TeacherProfileActivity.class); teacherProfile.putExtra("clt_id", clt_id); teacherProfile.putExtra("usl_id", usl_id); teacherProfile.putExtra("School_name", school_name); teacherProfile.putExtra("Teacher_name", teacher_name); teacherProfile.putExtra("version_name", version_name); teacherProfile.putExtra("board_name", board_name); teacherProfile.putExtra("org_id", org_id); teacherProfile.putExtra("Teacher_div",teacher_div); teacherProfile.putExtra("Teacher_Shift",teacher_shift); teacherProfile.putExtra("Tecaher_Std",teacher_std); teacherProfile.putExtra("academic_year", academic_year); teacherProfile.putExtra("cls_teacher", clas_teacher); startActivity(teacherProfile); } } else if (position == 1) { //Message if (dft.isInternetOn() == true) { Intent teacherProfile = new Intent(SubjectTopicsActivity.this, TeacherMessageActivity.class); teacherProfile.putExtra("clt_id", clt_id); teacherProfile.putExtra("usl_id", usl_id); teacherProfile.putExtra("School_name", school_name); teacherProfile.putExtra("Teacher_name", teacher_name); teacherProfile.putExtra("version_name", version_name); teacherProfile.putExtra("board_name", board_name); teacherProfile.putExtra("org_id", org_id); teacherProfile.putExtra("Teacher_div",teacher_div); teacherProfile.putExtra("Teacher_Shift",teacher_shift); teacherProfile.putExtra("Tecaher_Std",teacher_std); teacherProfile.putExtra("academic_year", academic_year); teacherProfile.putExtra("cls_teacher", clas_teacher); startActivity(teacherProfile); } } else if (position == 2) { //SMS if (dft.isInternetOn() == true) { Intent teacherProfile = new Intent(SubjectTopicsActivity.this, TeacherSMSActivity.class); teacherProfile.putExtra("clt_id", clt_id); teacherProfile.putExtra("usl_id", usl_id); teacherProfile.putExtra("School_name", school_name); teacherProfile.putExtra("Teacher_name", teacher_name); teacherProfile.putExtra("version_name", version_name); teacherProfile.putExtra("board_name", board_name); teacherProfile.putExtra("org_id", org_id); teacherProfile.putExtra("Teacher_div",teacher_div); teacherProfile.putExtra("Teacher_Shift",teacher_shift); teacherProfile.putExtra("Tecaher_Std",teacher_std); teacherProfile.putExtra("academic_year", academic_year); teacherProfile.putExtra("cls_teacher", clas_teacher); startActivity(teacherProfile); } } else if (position == 3) { //announcement if (dft.isInternetOn() == true) { Intent teacherannouncment = new Intent(SubjectTopicsActivity.this, TeacherAnnouncementsActivity.class); teacherannouncment.putExtra("clt_id", clt_id); teacherannouncment.putExtra("usl_id", usl_id); teacherannouncment.putExtra("School_name", school_name); teacherannouncment.putExtra("Teacher_name", teacher_name); teacherannouncment.putExtra("version_name", version_name); teacherannouncment.putExtra("board_name", board_name); teacherannouncment.putExtra("org_id", org_id); teacherannouncment.putExtra("Teacher_div",teacher_div); teacherannouncment.putExtra("Teacher_Shift",teacher_shift); teacherannouncment.putExtra("Tecaher_Std",teacher_std); teacherannouncment.putExtra("academic_year", academic_year); teacherannouncment.putExtra("cls_teacher", clas_teacher); startActivity(teacherannouncment); } } else if (position == 4) { //Sbject List if (dft.isInternetOn() == true) { Intent subject_list = new Intent(SubjectTopicsActivity.this, SubjectListActivity.class); subject_list.putExtra("usl_id", usl_id); subject_list.putExtra("version_name", version_name); subject_list.putExtra("clt_id", clt_id); subject_list.putExtra("School_name", school_name); subject_list.putExtra("Teacher_name", teacher_name); subject_list.putExtra("board_name", board_name); subject_list.putExtra("academic_year", academic_year); subject_list.putExtra("cls_teacher", clas_teacher); subject_list.putExtra("org_id", org_id); subject_list.putExtra("Teacher_div",teacher_div); subject_list.putExtra("Teacher_Shift",teacher_shift); subject_list.putExtra("Tecaher_Std",teacher_std); startActivity(subject_list); } } else if (position == 5) { Intent setting = new Intent(SubjectTopicsActivity.this, SettingActivity.class); setting.putExtra("usl_id", usl_id); setting.putExtra("version_name", version_name); setting.putExtra("clt_id", clt_id); setting.putExtra("School_name", school_name); setting.putExtra("Teacher_name", teacher_name); setting.putExtra("board_name", board_name); setting.putExtra("academic_year", academic_year); setting.putExtra("cls_teacher", clas_teacher); setting.putExtra("org_id", org_id); setting.putExtra("Teacher_div",teacher_div); setting.putExtra("Teacher_Shift",teacher_shift); setting.putExtra("Tecaher_Std",teacher_std); startActivity(setting); } else if (position == 6) { //Signout Intent signout = new Intent(SubjectTopicsActivity.this, LoginActivity.class); Constant.SetLoginData("", "", SubjectTopicsActivity.this); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(notificationID); AppController.iconCount = 0; AppController.iconCountOnResume = 0; AppController.OnBackpressed = "false"; AppController.loginButtonClicked = "false"; AppController.drawerSignOut = "true"; startActivity(signout); } else if (position == 7) { try { final Dialog alertDialog = new Dialog(SubjectTopicsActivity.this); LayoutInflater inflater = getLayoutInflater(); alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); alertDialog.getWindow().setBackgroundDrawable( new ColorDrawable(Color.TRANSPARENT)); View convertView = inflater.inflate(R.layout.about_us, null); alertDialog.setContentView(convertView); tv_version_name = (TextView) convertView.findViewById(R.id.tv_version_name); tv_version_code = (TextView) convertView.findViewById(R.id.tv_version_code); tv_cancel = (TextView) convertView.findViewById(R.id.tv_cancel); tv_version_name.setText("Version Name: " + AppController.versionName); tv_version_code.setText("Version Code: " + AppController.versionCode); alertDialog.show(); tv_cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); } }); } catch (Exception e) { e.printStackTrace(); } } } }); } Constant.setTeacherDrawerData(academic_year, teacher_name,teacher_div,teacher_std,teacher_shift, SubjectTopicsActivity.this); setDrawerData(); } catch (Exception e){ e.printStackTrace(); } } private void setDrawerData() { tv_academic_year_drawer.setText(academic_year); tv_child_name_drawer.setText(teacher_name); if((LoginActivity.get_class_teacher(SubjectTopicsActivity.this).equalsIgnoreCase("1"))) { tv_teacher_class.setText(teacher_shift + " | " + teacher_std + " | " + teacher_div); } else{ tv_teacher_class.setVisibility(View.GONE); } } private void getIntentData() { try { Intent intent = getIntent(); usl_id = intent.getStringExtra("usl_id"); clt_id = intent.getStringExtra("clt_id"); school_name = intent.getStringExtra("School_name"); teacher_name = intent.getStringExtra("Teacher_name"); version_name = intent.getStringExtra("version_name"); board_name = intent.getStringExtra("board_name"); subject_name = intent.getStringExtra("Subject_name"); classs = intent.getStringExtra("Classs"); org_id = intent.getStringExtra("org_id"); teacher_div = intent.getStringExtra("Teacher_div"); teacher_std = intent.getStringExtra("Tecaher_Std"); teacher_shift = intent.getStringExtra("Teacher_Shift"); class_id = intent.getStringExtra("class_id"); clas_teacher = intent.getStringExtra("cls_teacher"); academic_year = intent.getStringExtra("academic_year"); AppController.versionName = version_name; try { String[] val = classs.split("-"); std = val[0]; } catch (Exception e){ e.printStackTrace(); } header = new HeaderControler(this, true, false,std+" >> "+subject_name); } catch (Exception e) { e.printStackTrace(); } } private void init() { dft = new DataFetchService(this); login_details = new LoginDetails(); progressDialog = Constant.getProgressDialog(this); ed_cycle_test.setOnClickListener(this); img_drawer.setOnClickListener(this); lay_back_investment.setOnClickListener(this); } private void findViews() { ed_cycle_test = (EditText) findViewById(R.id.ed_cycle_test); // lv_subject_topiclist = (ListView) findViewById(R.id.lv_subject_topiclist); lv_subject_topiclist = (ExpandableListView) findViewById(R.id.lv_subject_topiclist); list_resource = (ListView) findViewById(R.id.list_resource); tv_no_record = (TextView) findViewById(R.id.tv_no_record); lay_back_investment = (LinearLayout) findViewById(R.id.lay_back_investment); //ImageView img_drawer = (ImageView) findViewById(R.id.img_drawer); img_close = (ImageView) findViewById(R.id.img_close); //TextView tv_version_code = (TextView) findViewById(R.id.tv_version_code); tv_cancel = (TextView) findViewById(R.id.tv_cancel); tv_no_record = (TextView) findViewById(R.id.tv_no_record); tv_std_subj = (TextView) findViewById(R.id.tv_std_subj); tv_child_name_drawer = (TextView) findViewById(R.id.tv_child_name_drawer); tv_academic_year_drawer = (TextView) findViewById(R.id.tv_academic_year_drawer); tv_teacher_class = (TextView) findViewById(R.id.tv_teacher_class); // for drawer drawer = (DrawerLayout) findViewById(R.id.drawer_layout); leftfgf_drawer = (RelativeLayout) findViewById(R.id.leftfgf_drawer); rl_profile = (RelativeLayout) findViewById(R.id.rl_profile); drawerListView = (ListView) findViewById(R.id.drawerListView); mContentDisplaceToggle = new ContentDisplaceDrawerToggle(this, drawer, R.id.rl_profile, Gravity.START); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); // int width3 = dm.widthPixels; int width = getResources().getDisplayMetrics().widthPixels/2+30; DrawerLayout.LayoutParams lp = (DrawerLayout.LayoutParams) leftfgf_drawer.getLayoutParams(); lp.width = width + 10; leftfgf_drawer.setLayoutParams(lp); } private void CallCycleTestWebservice(final String board_name) { if(dft.isInternetOn()==true) { if (!progressDialog.isShowing()) { progressDialog.show(); } } else{ progressDialog.dismiss(); } dft.getcycleTestdeopdown(board_name, cycleTestMethod_name, Request.Method.POST, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { login_details = (LoginDetails) dft.GetResponseObject(response, LoginDetails.class); if (login_details.Status.equalsIgnoreCase("1")) { tv_no_record.setVisibility(View.GONE); firstTypetopic = "true"; strings_cycleTest = new ArrayList<String>(); try { for (int i = 0; i < login_details.CycleTest.size(); i++) { strings_cycleTest.add(login_details.CycleTest.get(i).cyc_name.toString()); select_cycleTest = new String[strings_cycleTest.size()]; select_cycleTest = strings_cycleTest.toArray(select_cycleTest); firstcycle_test = login_details.CycleTest.get(0).cyc_name; AppController.CycleTestID = firstcycle_test; if(firstTimeCycle.equalsIgnoreCase("false")) { ed_cycle_test.setText(firstcycle_test); } } } catch (Exception e) { e.printStackTrace(); } selectCycleTest(select_cycleTest); AppController.CycleTest = "false"; // Call Webservice For Subject if(firstTimeCycletestSelection.equalsIgnoreCase("true")) { CallTopicListWebservice(class_id,board_name,std,subject_name,firstcycle_test,clt_id,usl_id); } } else if (login_details.Status.equalsIgnoreCase("0")) { lv_subject_topiclist.setVisibility(View.GONE); tv_no_record.setVisibility(View.VISIBLE); tv_no_record.setText("No Data Found"); } } catch (Exception e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { //Show error or whatever... Log.d("SubjectTopicActivity", "ERROR.._---" + error.getCause()); } }); } private void selectCycleTest( final String[] select_cycleTest) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); LayoutInflater inflater = getLayoutInflater(); View convertView = (View) inflater.inflate(R.layout.dialog_list, null); alertDialog.setView(convertView); alertDialog.setTitle("Select Cycle Test"); firstTimeCycle = "true"; final ListView select_list = (ListView) convertView.findViewById(R.id.select_list); alertDialog.setItems(select_cycleTest, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { // Do something with the selection ed_cycle_test.setText(select_cycleTest[item]); dialog.dismiss(); String selectedcycleTest = select_cycleTest[item]; cycleTest_id = selectedcycleTest; AppController.CycleTestID = cycleTest_id; try { //Webservcie call for Sent Messages CallTopicListWebservice(class_id, board_name, std, subject_name, AppController.CycleTestID, clt_id, usl_id); } catch (Exception e){ e.printStackTrace(); } } }); if (AppController.CycleTest.equalsIgnoreCase("true")) { alertDialog.show(); } } private void CallTopicListWebservice(String class_id,String board_name,String std,String subject_name,String cycleTest,String clt_id,String usl_id) { dft.getteacherTopicsList(class_id, board_name, std, subject_name, cycleTest, clt_id, usl_id, TopicsMethodName, Request.Method.POST, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { if (progressDialog.isShowing()) { progressDialog.dismiss(); } try { login_details = (LoginDetails) dft.GetResponseObject(response, LoginDetails.class); if (login_details.Status.equalsIgnoreCase("1")) { tv_no_record.setVisibility(View.GONE); lv_subject_topiclist.setVisibility(View.VISIBLE); setUIData(); AppController.TopicsListsize = login_details.TopicList; } else if (login_details.Status.equalsIgnoreCase("0")) { lv_subject_topiclist.setVisibility(View.GONE); tv_no_record.setVisibility(View.VISIBLE); noResultFound = "true"; tv_no_record.setText("No Records Found"); } } catch (Exception e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { //Show error or whatever... Log.d("SubjectTopicsActivity", "ERROR.._---" + error.getCause()); } }); } private void setUIData() { createGroupList(); createCollection(); ExpandableTopicListAdapter expandableTopicsAdapter = new ExpandableTopicListAdapter(SubjectTopicsActivity.this,groupList,topicCollection,login_details.TopicList,usl_id,clt_id,school_name,teacher_name,org_id,clas_teacher,academic_year,board_name,teacher_div,teacher_shift,teacher_std,subject_name,classs,class_id); lv_subject_topiclist.setAdapter(expandableTopicsAdapter); } private void createCollection() { String[] hpModels = { "HP Pavilion G6-2014TX" }; String[] hclModels = { "HCL S2101" }; String[] lenovoModels = { "IdeaPad Z Series"}; String[] sonyModels = { "VAIO E Series" }; String[] dellModels = { "Inspiron"}; String[] samsungModels = { "NP Series"}; topicCollection = new LinkedHashMap<String, List<String>>(); for (String laptop : groupList) { if (laptop.equals("September")) { loadChild(hpModels); } else if (laptop.equals("August")) loadChild(dellModels); else if (laptop.equals("July")) loadChild(sonyModels); else if (laptop.equals("June")) loadChild(hclModels); else loadChild(lenovoModels); topicCollection.put(laptop, childList); } } private void loadChild(String[] laptopModels) { childList = new ArrayList<String>(); for (String model : laptopModels) childList.add(model); } private void createGroupList() { groupList = new ArrayList<String>(); for (int i = 0; i < login_details.TopicList.size(); i++) { topic_name = login_details.TopicList.get(i).crf_topicname; groupList.add(topic_name); } } private void setResourceIDData() { final Dialog alertDialog = new Dialog(this); // final AlertDialog alertDialog = builder.create(); LayoutInflater inflater = this.getLayoutInflater(); alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); alertDialog.getWindow().setBackgroundDrawable( new ColorDrawable(Color.TRANSPARENT)); View convertView = (View) inflater.inflate(R.layout.template_resource_list, null); list_resource = (ListView)convertView.findViewById(R.id.list_resource); img_close = (ImageView) convertView.findViewById(R.id.img_close); alertDialog.setContentView(convertView); resourceAdapter = new ResourceAdapter(this,login_details.ResourceList); list_resource.setAdapter(resourceAdapter); alertDialog.show(); list_resource.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { try { //Open Google Drive File crl_file = login_details.ResourceList.get(position).crl_file; String file_name[] = crl_file.split(":"); String file_id = file_name[1]; String resourcefile_url = "https://drive.google.com/a/podar.org/file/d/"+file_id; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(resourcefile_url)); startActivity(i); } catch (Exception e){ e.printStackTrace(); } } }); img_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); } }); } @Override protected void onResume() { super.onResume(); if(AppController.drawerSignOut.equalsIgnoreCase("true")) { Intent intent = new Intent(getApplicationContext(), SplashScreen.class); AppController.ProfileWithoutSibling = "false"; intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); AppController.Board_name = board_name; AppController.school_name = school_name; AppController.versionName = version_name; AppController.usl_id = usl_id; AppController.clt_id = clt_id; AppController.school_name = school_name; AppController.versionName = version_name; intent.putExtra("usl_id", AppController.usl_id); intent.putExtra("msd_ID", AppController.msd_ID); intent.putExtra("version_name", AppController.versionName); intent.putExtra("clt_id", AppController.clt_id); intent.putExtra("School_name", AppController.school_name); intent.putExtra("board_name", AppController.Board_name); intent.putExtra("academic_year", academic_year); intent.putExtra("cls_teacher", clas_teacher); intent.putExtra("Teacher_div",teacher_div); intent.putExtra("Teacher_Shift",teacher_shift); intent.putExtra("Tecaher_Std",teacher_std); intent.putExtra("Sibling", AppController.SiblingListSize); intent.putExtra("org_id",org_id); startActivity(intent); } } @Override public void onClick(View v) { if(v==img_drawer) { drawer.openDrawer(Gravity.RIGHT); } else if(v==ed_cycle_test){ AppController.CycleTest="true"; firstTimeCycle = "true"; firstTimeCycletestSelection = "false"; //Call Webservice for cycleTEst CallCycleTestWebservice(board_name); } else if(v==lay_back_investment) { Intent back = new Intent(SubjectTopicsActivity.this,TeacherProfileActivity.class); back.putExtra("clt_id", clt_id); back.putExtra("usl_id",usl_id); back.putExtra("School_name", school_name); back.putExtra("Teacher_name", teacher_name); back.putExtra("org_id",org_id); back.putExtra("academic_year", academic_year); back.putExtra("cls_teacher", clas_teacher); back.putExtra("version_name",AppController.versionName); back.putExtra("board_name",board_name); back.putExtra("Teacher_div",teacher_div); back.putExtra("Teacher_Shift",teacher_shift); back.putExtra("Tecaher_Std",teacher_std); startActivity(back); } } @Override public void onBackPressed() { try { Intent back = new Intent(SubjectTopicsActivity.this,TeacherProfileActivity.class); back.putExtra("clt_id", clt_id); back.putExtra("usl_id",usl_id); back.putExtra("School_name", school_name); back.putExtra("Teacher_name", teacher_name); back.putExtra("org_id",org_id); back.putExtra("academic_year", academic_year); back.putExtra("cls_teacher", clas_teacher); back.putExtra("version_name",AppController.versionName); back.putExtra("board_name", board_name); back.putExtra("Teacher_div",teacher_div); back.putExtra("Teacher_Shift",teacher_shift); back.putExtra("Tecaher_Std",teacher_std); startActivity(back); } catch (Exception e) { e.printStackTrace(); } } }
package com.example.puss.puss_group1; /** * Created by Olof and Bernt. * The class represent a device data. */ public class DeviceData { private String value; private String time; private String sensorType; public DeviceData(String value, String time, String sensorType){ this.value=value; this.time=time; this.sensorType=sensorType; } /** * Returns the value of the device data. * @return value */ public String getValue() { return value; } /** * Returns the time of the device data. * @return time */ public String getTime() { return time; } /** * Returns the type of the device data. * @return sensorType */ public String getDeviceDataType() { return sensorType; } }
package com.example.test; public class PostWithCaptcha { public static void main(String[] args) { } }
package com.ddt.service; import java.util.List; import com.ddt.bean.Userinfo; import com.ddt.daoInter.UserDaoInter; import com.ddt.serviceInter.UserServiceInter; public class UserService implements UserServiceInter { UserDaoInter dao; public UserService() { System.out.println("UserService construction!!!!!!!!!!!!!!!!!!!!!!!!!"); } public void setDao(UserDaoInter dao) { this.dao = dao; } // 增加用户信息 public void addUser(Userinfo user) { dao.addUser(user); } // 查找全部用户信息 public List findAllUser() { return dao.findAllUser(); } // 按条件id查找部分学生 // public Student findUserById(Student stu){ // 修改用户信息 public void updateUser(Userinfo user) { dao.updateUser(user); } // 删除用户信息 public void deleteUser(Userinfo user) { dao.deleteUser(user); } public boolean login(String username, String password, int identify) { // TODO Auto-generated method stub Userinfo user = dao.getUser(username); if (user == null) { return false; } System.out.println("get from db: username" + user.getUname() + " password:" + user.getUpassword() + " identify:" + user.getUstate()); if (user.getUpassword().equals(password) && user.getUstate() == identify) { return true; } return false; } }
package uk.co.samwho.modopticon.api.v1.websocket; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Closeable; import java.io.IOException; import java.io.UncheckedIOException; import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import com.google.common.flogger.FluentLogger; import com.google.gson.Gson; import org.eclipse.jetty.websocket.api.Session; import uk.co.samwho.modopticon.storage.Entity; public final class EntityObserver implements PropertyChangeListener, Closeable { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private final Gson gson; private final Session session; private final Set<Entity> observing; private volatile boolean authenticated; EntityObserver(Gson gson, Session session) { this.gson = gson; this.session = session; this.observing = Collections.newSetFromMap(new ConcurrentHashMap<>()); this.authenticated = false; } public void authenticate() { this.authenticated = true; } public boolean isAuthenticated() { return authenticated; } @Override public void propertyChange(PropertyChangeEvent pce) { send(session, Message.update(pce)); } public synchronized void observe(Entity o) { o.addPropertyChangeListener(this); observing.add(o); } public synchronized void stopObserving(Entity o) { o.removePropertyChangeListener(this); observing.remove(o); } public Set<Entity> observing() { return Collections.unmodifiableSet(this.observing); } @Override public void close() throws IOException { observing.forEach(o -> o.removePropertyChangeListener(this)); if (session.isOpen()) { session.close(); } } private void send(Session session, Message message) { if (!session.isOpen()) { logger.atWarning().log("attempted to send to closed session"); return; } try { session.getRemote().sendString(gson.toJson(message)); } catch (IOException e) { throw new UncheckedIOException(e); } } }
package logica; import entity.CodeFile; import entity.Plantilla; import estrategy.EstrategyGenerateText; import readersAndWriters.FileReader; import readersAndWriters.FileWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; public class GeneradorPrincipal { public static void generarUsandoPlantilla(Plantilla plantilla, String path) { for (CodeFile codeFile : plantilla.getListCodeFiles()) { // Se busca el archivo de la plantilla StringBuffer texto = null; try { texto = FileReader.readFile("files\\" + plantilla.getName() + "\\" + codeFile.getName()); } catch (IOException e) { e.printStackTrace(); } codeFile.setText(texto); // Se aplican las estrategias al codefile for (EstrategyGenerateText estrategy : plantilla.getEstrategysSecuence()) { estrategy.generate(codeFile); } // Se obtiene la ruta donde se guardará el archivo File directorioDondeGuardar = new File(path); // Se genera el archivo en la ruta especificada. En este punto codeFile.getText() ya esta listo try { FileWriter.createFile(path + "\\" + codeFile.getPath() + codeFile.getName(), codeFile.getText()); } catch (IOException e) { e.printStackTrace(); } } } public static String validarGeneracion(Plantilla plantilla, String path) { try { for (CodeFile codeFile : plantilla.getListCodeFiles()) { // Se busca el archivo de la plantilla StringBuffer texto = null; try { texto = FileReader.readFile("files\\" + plantilla.getName() + "\\" + codeFile.getName()); } catch (IOException e) { e.printStackTrace(); return e.getMessage() + ": El archivo " + codeFile.getName() + " de la plantilla " + plantilla.getName() + " no fue encontrado."; } codeFile.setText(texto); // Se aplican las estrategias al codefile for (EstrategyGenerateText estrategy : plantilla.getEstrategysSecuence()) { estrategy.generate(codeFile); } // Se obtiene la ruta donde se guardará el archivo File directorioDondeGuardar = new File(path); System.out.println(directorioDondeGuardar); } } catch (Exception e) { return e.getMessage(); } return null; } }
package database; import org.springframework.data.repository.CrudRepository; /** * Created by sooraj on 7/6/17. */ public interface Repository extends CrudRepository<Data,Integer> { }
package com.example.pants.networkdemo.video; import android.content.Context; import android.media.MediaPlayer; import android.os.Handler; import android.os.Message; import android.view.View; import android.widget.RelativeLayout; import android.widget.SeekBar; import com.example.pants.networkdemo.R; import java.util.Timer; import java.util.TimerTask; /** * Created by Pants on 2016/5/12. */ public class MyVideoController extends RelativeLayout { private Context mContext; private RelativeLayout layout; private MediaPlayer mediaPlayer; private MySeekBar mSeekBar; public MyVideoController(Context context, final MediaPlayer mediaPlayer) { super(context); mContext = context; this.mediaPlayer = mediaPlayer; LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); layout = (RelativeLayout) View.inflate(context, R.layout.layout_cotroller, null); addView(layout, params); mSeekBar = (MySeekBar) layout.findViewById(R.id.progressBar); mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { mediaPlayer.seekTo(progress); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); new Timer(true).schedule(new TimerTask() { @Override public void run() { } }, 0, 500); } public void updateProgress(){ if (mediaPlayer != null && mediaPlayer.isPlaying()) { setProgress(mediaPlayer.getCurrentPosition()); } } public void prepareProgressBar() { mSeekBar.setMax(mediaPlayer.getDuration()); } public void setProgress(int progress) { mSeekBar.setProgress(progress); } public void setSecondaryProgress(int secondaryProgress) { mSeekBar.setSecondaryProgress(secondaryProgress); } interface OnTrickListener { void onTrick(View view); } interface OnProgressStateChangedListener { void onSeek(); } }
package com.takshine.wxcrm.domain; import com.takshine.wxcrm.model.ContactModel; /** * 合同 * @author 刘淋 * */ public class Contact extends ContactModel{ private String optype ; //操作类型 private String firstchar;//首字母 private String rowid = null; private String salutation = null ;//敬称 private String firstname = null ;//姓 private String lastname = null ;//名 private String conname = null ;//姓名 private String conjob = null ;//职称 private String department = null ;//部门 private String accountname = null ;//客户名称 private String accountid = null ;//客户ID private String phonework = null ;//办公电话 private String phonemobile = null ;//移动电话 private String email0 = null ;//邮件 private String conaddress = null ;//地址 private String viewtype;//视图类型 myview , teamview, focusview, allview private String filename;//图片名称 private String plight;// 处境 private String roles;//角色 private String adapting;//适应能力 private String plightname;// 处境 private String rolesname;//角色 private String adaptingname;//适应能力 private String desc; //更多 private String phonefax = null ;//传真 private String primarystreet = null ;//街道 private String primarycity = null ;//城市 private String primarystate = null ; private String primarypostalcode = null ;//邮编 private String primarycountry = null ; private String assigner = null ;//责任人 private String assignerId = null;//责任人ID private String parentId ;//相关ID private String parentType ;//相关类型 private String parentName ;//相关的名字 private String flag;//查询标记(为空,则查询关联联系人;不为空,则为查询没有关联关系的联系人) private String creater = ""; private String createdate = ""; private String modifier = ""; private String modifydate = ""; private String relation; //关系LOV key private String relationname; //关系LOV value private String relaid; //关系ID private String effect; private String effectname; //查詢字段 private String datetime; private String timefre;//時間頻率 private String timefrename;//時間頻率 private String contype; private String contype_val;//具体的查询值 private String tagtype;//标签类型 private String batchno; //导入批次号 private String companyname; public String getCompanyname() { return companyname; } public void setCompanyname(String companyname) { this.companyname = companyname; } public String getBatchno() { return batchno; } public void setBatchno(String batchno) { this.batchno = batchno; } public String getTagtype() { return tagtype; } public void setTagtype(String tagtype) { this.tagtype = tagtype; } public String getContype() { return contype; } public void setContype(String contype) { this.contype = contype; } //生日 private String birthdate; public String getBirthdate() { return birthdate; } public void setBirthdate(String birthdate) { this.birthdate = birthdate; } public String getFirstchar() { return firstchar; } public void setFirstchar(String firstchar) { this.firstchar = firstchar; } public String getEffect() { return effect; } public void setEffect(String effect) { this.effect = effect; } public String getEffectname() { return effectname; } public void setEffectname(String effectname) { this.effectname = effectname; } public String getRelation() { return relation; } public void setRelation(String relation) { this.relation = relation; } public String getRelationname() { return relationname; } public void setRelationname(String relationname) { this.relationname = relationname; } public String getRelaid() { return relaid; } public void setRelaid(String relaid) { this.relaid = relaid; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public String getCreater() { return creater; } public void setCreater(String creater) { this.creater = creater; } public String getCreatedate() { return createdate; } public void setCreatedate(String createdate) { this.createdate = createdate; } public String getModifier() { return modifier; } public void setModifier(String modifier) { this.modifier = modifier; } public String getModifydate() { return modifydate; } public void setModifydate(String modifydate) { this.modifydate = modifydate; } public String getTimefre() { return timefre; } public void setTimefre(String timefre) { this.timefre = timefre; } public String getDatetime() { return datetime; } public void setDatetime(String datetime) { this.datetime = datetime; } public String getSalutation() { return salutation; } public void setSalutation(String salutation) { this.salutation = salutation; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public String getConname() { return conname; } public void setConname(String conname) { this.conname = conname; } public String getConjob() { return conjob; } public void setConjob(String conjob) { this.conjob = conjob; } public String getConaddress() { return conaddress; } public void setConaddress(String conaddress) { this.conaddress = conaddress; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getAccountname() { return accountname; } public void setAccountname(String accountname) { this.accountname = accountname; } public String getAccountid() { return accountid; } public void setAccountid(String accountid) { this.accountid = accountid; } public String getPhonework() { return phonework; } public void setPhonework(String phonework) { this.phonework = phonework; } public String getPhonemobile() { return phonemobile; } public void setPhonemobile(String phonemobile) { this.phonemobile = phonemobile; } public String getPhonefax() { return phonefax; } public void setPhonefax(String phonefax) { this.phonefax = phonefax; } public String getPrimarystreet() { return primarystreet; } public void setPrimarystreet(String primarystreet) { this.primarystreet = primarystreet; } public String getPrimarycity() { return primarycity; } public void setPrimarycity(String primarycity) { this.primarycity = primarycity; } public String getPrimarystate() { return primarystate; } public void setPrimarystate(String primarystate) { this.primarystate = primarystate; } public String getPrimarypostalcode() { return primarypostalcode; } public void setPrimarypostalcode(String primarypostalcode) { this.primarypostalcode = primarypostalcode; } public String getPrimarycountry() { return primarycountry; } public void setPrimarycountry(String primarycountry) { this.primarycountry = primarycountry; } public String getEmail0() { return email0; } public void setEmail0(String email0) { this.email0 = email0; } public String getAssigner() { return assigner; } public void setAssigner(String assigner) { this.assigner = assigner; } public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId; } public String getParentType() { return parentType; } public void setParentType(String parentType) { this.parentType = parentType; } public String getParentName() { return parentName; } public void setParentName(String parentName) { this.parentName = parentName; } public String getViewtype() { return viewtype; } public void setViewtype(String viewtype) { this.viewtype = viewtype; } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public String getAssignerId() { return assignerId; } public void setAssignerId(String assignerId) { this.assignerId = assignerId; } public String getPlight() { return plight; } public void setPlight(String plight) { this.plight = plight; } public String getRoles() { return roles; } public void setRoles(String roles) { this.roles = roles; } public String getAdapting() { return adapting; } public void setAdapting(String adapting) { this.adapting = adapting; } public String getPlightname() { return plightname; } public void setPlightname(String plightname) { this.plightname = plightname; } public String getRolesname() { return rolesname; } public void setRolesname(String rolesname) { this.rolesname = rolesname; } public String getAdaptingname() { return adaptingname; } public void setAdaptingname(String adaptingname) { this.adaptingname = adaptingname; } public String getRowid() { return rowid; } public void setRowid(String rowid) { this.rowid = rowid; } public String getFlag() { return flag; } public void setFlag(String flag) { this.flag = flag; } public String getTimefrename() { return timefrename; } public void setTimefrename(String timefrename) { this.timefrename = timefrename; } public String getOptype() { return optype; } public void setOptype(String optype) { this.optype = optype; } public String getContype_val() { return contype_val; } public void setContype_val(String contype_val) { this.contype_val = contype_val; } }
/** * original(c) zhuoyan company * projectName: java-design-pattern * fileName: QueueSend.java * packageName: cn.zy.pattern.command.queue * date: 2018-12-19 23:27 * history: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 */ package cn.zy.pattern.command.queue; /** * @version: V1.0 * @author: ending * @className: QueueSend * @packageName: cn.zy.pattern.command.queue * @description: * @data: 2018-12-19 23:27 **/ public class QueueSend { private CommandQueue commandQueue; public CommandQueue getCommandQueue() { return commandQueue; } public void setCommandQueue(CommandQueue commandQueue) { this.commandQueue = commandQueue; } public void execute(){ commandQueue.execute(); } }
import com.skillbox.airport.Airport; import com.skillbox.airport.Aircraft; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.List; public class Main { public static void main(String[] args) { Airport airport = Airport.getInstance(); // Получение сведений о медодах класса Class<?> cls = airport.getClass(); Method[] methods = cls.getMethods(); for (Method method : methods) { System.out.println("Method name : " + method.getName()); System.out.println("Return type : " + method.getReturnType().getName()); Class<?>[] params = method.getParameterTypes(); System.out.print("Parameters : "); for (Class<?> paramType : params) { System.out.print(" " + paramType.getName()); } System.out.println(); } List<Aircraft> aircraftList = airport.getAllAircrafts(); // System.out.println(aircraftList.get(0).getClass().getCanonicalName()); // for (Aircraft air : aircraftList // ) { // System.out.println(air); // } System.out.println("Количество самолетов в аэропорту - " + aircraftList.size()); } }
/* * Copyright 2016 Adam Stroud * * 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 me.adamstroud.devicedatabase.api.retrofit; import java.util.List; import me.adamstroud.devicedatabase.model.Manufacturer; /** * The response to the {@link me.adamstroud.devicedatabase.api.volley.GetManufacturersAndDevicesRequest} request. * * @author Adam Stroud &#60;<a href="mailto:adam.stroud@gmail.com">adam.stroud@gmail.com</a>&#62; */ public class ManufacturersAndDevicesResponse { private List<Manufacturer> manufacturers; public List<Manufacturer> getManufacturers() { return manufacturers; } public void setManufacturers(List<Manufacturer> manufacturers) { this.manufacturers = manufacturers; } }
package com.example.karenli.budgetingapp.models; import android.text.format.DateFormat; /** * Created by karenli on 9/27/17. */ public class Receipt { private long myId; private String myName; private String myDescription; private String myImgPath; private int myMonth; private int myYear; private double myTotal; public Receipt(String myName, String myDescription, String myImgPath, int myMonth, int myYear, double myTotal) { this.myName = myName; this.myDescription = myDescription; this.myImgPath = myImgPath; this.myMonth = myMonth; this.myYear = myYear; this.myTotal = myTotal; } public Receipt() {} public long getMyId() { return myId; } public void setMyId(long myId) { this.myId = myId; } public String getMyName() { return myName; } public void setMyName(String myName) { this.myName = myName; } public String getMyDescription() { return myDescription; } public void setMyDescription(String myDescription) { this.myDescription = myDescription; } public int getMyMonth() { return myMonth; } public void setMyMonth(int myMonth) { this.myMonth = myMonth; } public int getMyYear() { return myYear; } public void setMyYear(int myYear) { this.myYear = myYear; } public double getMyTotal() { return myTotal; } public void setMyTotal(double myTotal) { this.myTotal = myTotal; } public String getMyImgPath() { return myImgPath; } public void setMyImgPath(String myImgPath) { this.myImgPath = myImgPath; } }
package main; public class Main { private static final long serialVersionUID = 1L; public static void main(String[] args) { Connection interact = new Connection(); interact.consola(interact); } }
package org.denevell.natch.jsp.tests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.denevell.natch.io.posts.AddPostResourceReturnData; import org.denevell.natch.io.threads.ThreadResource; import org.denevell.natch.jsp.ForumDao; import org.denevell.natch.jsp.ForumDao.ObjectOrStatusCode; import org.denevell.natch.jsp.thread.add.AddThreadJspInput; import org.denevell.natch.jsp.thread.add.AddThreadPOST; import org.denevell.natch.utils.SessionUtils; import org.denevell.natch.utils.simpletags.ComponentTag; import org.junit.Before; import org.junit.Test; public class AddThreadServletTests { private ForumDao mockDao; private SessionUtils sessionUtils; private HttpServletRequest req; private HttpServletResponse res; @Before public void setup() { mockDao = mock(ForumDao.class); sessionUtils = mock(SessionUtils.class); req = mock(HttpServletRequest.class); res = mock(HttpServletResponse.class); when(req.getContextPath()).thenReturn("/contextpath"); when(req.getServletPath()).thenReturn("/servletpath"); } @Test public void shouldAddThread() throws IOException { // Arrange AddThreadPOST servlet = new AddThreadPOST(); servlet.setDao(mockDao); servlet.setSessionUtils(sessionUtils); when(sessionUtils.getAuthKey(req)).thenReturn("authy"); AddPostResourceReturnData returnOb = new AddPostResourceReturnData(); ThreadResource mockThread = new ThreadResource(); mockThread.setId("thready"); returnOb.setThread(mockThread); returnOb.setSuccessful(true); AddThreadJspInput input = new AddThreadJspInput(); input.setSubject("sub"); input.setContent("cont"); ObjectOrStatusCode<AddPostResourceReturnData> ret = new ObjectOrStatusCode<AddPostResourceReturnData>(returnOb); when(mockDao.addThread("sub", "cont", null, null, "authy")).thenReturn(ret); // Act String jsp = servlet.process(req, res, null, input); // Assert assertEquals("Forwarding returned", jsp, ComponentTag.FORWARDING); String pathUrl = "/Posts"+"?thread=thready&page=1"; String url = "/contextpath"+pathUrl; verify(res).sendRedirect(url); } @Test public void shouldShowErrorOnBadInput() { // Arrange AddThreadPOST servlet = new AddThreadPOST(); servlet.setDao(mockDao); servlet.setSessionUtils(sessionUtils); AddThreadJspInput input = new AddThreadJspInput(); input.setSubject(""); input.setContent("cont"); when(sessionUtils.getAuthKey(req)).thenReturn("authy"); AddPostResourceReturnData returnOb = new AddPostResourceReturnData(); returnOb.setSuccessful(false); returnOb.setError("hi"); ObjectOrStatusCode<AddPostResourceReturnData> ret = new ObjectOrStatusCode<AddPostResourceReturnData>(returnOb); when(mockDao.addThread("", "cont", null, null, "authy")).thenReturn(ret); // Act String jsp = servlet.process(req, res, null, input); // Assert assertTrue("Can see error", jsp.contains("Error adding thread")); } }
package com.stem.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.stem.dao.WxImageReplyMapper; import com.stem.entity.WxImageReply; import com.stem.entity.WxImageReplyExample; import com.stem.service.WxImageReplyService; @Service("wxImageReplyService") public class WxImageReplyServiceImpl implements WxImageReplyService{ @Resource private WxImageReplyMapper wxImageReplyMapper; @Override public List<WxImageReply> list(WxImageReplyExample example){ return this.wxImageReplyMapper.selectByExample(example); } @Override public WxImageReply getByPK(Integer id){ return this.wxImageReplyMapper.selectByPrimaryKey(id); } @Override public int getTotal(WxImageReplyExample example){ return this.wxImageReplyMapper.countByExample(example); } @Override public int update(WxImageReply model,WxImageReplyExample example){ return this.wxImageReplyMapper.updateByExampleSelective(model,example); } @Override public int updateByPK(WxImageReply model){ return this.wxImageReplyMapper.updateByPrimaryKeySelective(model); } @Override public int deleteByPK(Integer id){ return this.wxImageReplyMapper.deleteByPrimaryKey(id); } @Override public int delete(WxImageReplyExample example){ return this.wxImageReplyMapper.deleteByExample(example); } @Override public int add(WxImageReply model){ return this.wxImageReplyMapper.insert(model); } }
package com.sojay.testfunction.gxgy; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import com.sojay.testfunction.R; import com.sojay.testfunction.utils.DataUtil; import java.util.List; public class GuangXianAdapter extends RecyclerView.Adapter { private List<GuangXianBean> datas; public GuangXianAdapter(List<GuangXianBean> datas) { this.datas = datas; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_guangxian, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { ((ViewHolder)holder).max.setText("最大:" + DataUtil.keepTwo(datas.get(position).getMax())); ((ViewHolder)holder).min.setText("最小:" + DataUtil.keepTwo(datas.get(position).getMin())); ((ViewHolder)holder).py.setText("平均:" + DataUtil.keepTwo(datas.get(position).getPingjun())); ((ViewHolder)holder).date.setText("Save Time :" + datas.get(position).getDate()); } @Override public int getItemCount() { return datas.size(); } class ViewHolder extends RecyclerView.ViewHolder { TextView max; TextView min; TextView py; TextView date; ViewHolder(View itemView) { super(itemView); max = itemView.findViewById(R.id.item_tv_max); min = itemView.findViewById(R.id.item_tv_min); py = itemView.findViewById(R.id.item_tv_py); date = itemView.findViewById(R.id.item_tv_date); } } }
package br.com.volvo; import java.util.ArrayList; import java.util.Collection; import javax.inject.Inject; import javax.inject.Singleton; import br.com.volvo.api.data.Department; import br.com.volvo.api.data.User; import br.com.volvo.entity.DepartmentEntity; import br.com.volvo.entity.UserEntity; import br.com.volvo.persistence.DepartmentDao; import br.com.volvo.persistence.UserDao; @Singleton public class UserServiceImpl implements UserService { @Inject private UserDao userDao; @Inject private DepartmentDao departmentDao; public User retrieve(Long id) { return entityToUser(userDao.retrieve(id)); } public Collection<User> list() { return entityToUsers(userDao.list()); } public void delete(Long id) { userDao.delete(id); } public void save(User user) { departmentDao.save(departmentToEntity(user.getDepartment())); userDao.save(userToEntity(user)); } // =========== Helpers ================ private Collection<User> entityToUsers(Collection<UserEntity> entitys) { Collection<User> users = new ArrayList<User>(); if (entitys != null && entitys.size() > 0) { for (UserEntity de: entitys) { User user = new User(); user.setId(de.getId()); user.setName(de.getName()); user.setDescription(de.getDescription()); if (de.getDepartment() != null) { user.setDepartment(new Department(de.getDepartment().getId(), de.getDepartment().getName(), de.getDepartment().getDescription())); } users.add(user); } } return users; } private User entityToUser(UserEntity entity) { User user = new User(); if (entity != null) { user.setId(entity.getId()); user.setName(entity.getName()); user.setDescription(entity.getDescription()); if (entity.getDepartment() != null) { user.setDepartment(new Department(entity.getDepartment().getId(), entity.getDepartment().getName(), entity.getDepartment().getDescription())); } } return user; } private UserEntity userToEntity(User user) { UserEntity entity = new UserEntity(); if (user != null) { entity.setId(user.getId()); entity.setName(user.getName()); entity.setDescription(user.getDescription()); if (user.getDepartment() != null) { entity.setDepartment(new DepartmentEntity(user.getDepartment().getId(), user.getDepartment().getName(), user.getDepartment().getDescription())); } } return entity; } private DepartmentEntity departmentToEntity(Department department) { DepartmentEntity entity = new DepartmentEntity(); if (department != null) { entity.setId(department.getId()); entity.setName(department.getName()); entity.setDescription(department.getDescription()); } return entity; } }
package gr.athena.innovation.fagi.specification; import gr.athena.innovation.fagi.exception.ApplicationException; import gr.athena.innovation.fagi.exception.WrongInputException; import java.util.Date; import java.util.Locale; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** * Class holding configuration parameters from the "fusion.spec" input file. * * @author nkarag */ public class Configuration { private static final Logger LOG = LogManager.getLogger(Configuration.class); private static Configuration configuration; private String idA; private String endpointA; private String pathDatasetA; private String pathDatasetB; private String idB; private String endpointB; private String pathLinks; private String idLinks; private String endpointLinks; private String linksFormat; private String outputDir; private String statsFilepath; private String fused; private String remaining; private String ambiguousDatasetFilepath; private String idOutput; private String endpointOutput; private String categoriesA; private String categoriesB; private String propertyFrequencyA; private String propertyFrequencyB; private Date dateA; private Date dateB; private EnumOutputMode outputMode; private String outputRDFFormat; private String inputRDFFormat; private String rulesPath; private Locale locale = null; private String stats; private String similarity; private String fusionLog; private String trainingSetCsvPath; private String validationModelPath; private String nameModelPath; private String addressModelPath; private String phoneModelPath; private String websiteModelPath; private String emailModelPath; private String geoModelPath; private int optionalDepth = 1; //depth of optional in sparql queries private final int maxOptionalDepth = 4; private final int minOptionalDepth = 1; private boolean verbose; private Configuration() { } /** * * @return the configuration instance. * @throws ApplicationException application exception. */ public static Configuration getInstance() throws ApplicationException { //lazy init if (configuration == null) { configuration = new Configuration(); } return configuration; } /** * * @param pathDatasetA the path of dataset A (left). * @throws WrongInputException error with input. */ public void setPathDatasetA(String pathDatasetA) throws WrongInputException { if(StringUtils.isBlank(pathDatasetA)){ throw new WrongInputException("Dataset A path is blank!"); } this.pathDatasetA = pathDatasetA; } /** * * @return the path of dataset A (left). */ public String getPathDatasetA() { return pathDatasetA; } /** * * @param pathDatasetB the path of dataset B (right). * @throws WrongInputException error with input. */ public void setPathDatasetB(String pathDatasetB) throws WrongInputException { if(StringUtils.isBlank(pathDatasetB)){ throw new WrongInputException("Dataset B path is blank!"); } this.pathDatasetB = pathDatasetB; } /** * * @return the path of dataset B (right). */ public String getPathDatasetB() { return pathDatasetB; } /** * * @return the path of the links file. */ public String getPathLinks() { return pathLinks; } /** * * @param pathLinks the path of the links file. * @throws WrongInputException error with input. */ public void setPathLinks(String pathLinks) throws WrongInputException { if(StringUtils.isBlank(pathLinks)){ throw new WrongInputException("Links path is blank!"); } this.pathLinks = pathLinks; } /** * * @return the output RDF format. */ public String getOutputRDFFormat() { return outputRDFFormat; } /** * * @param outputRDFFormat the output RDF format. */ public void setOutputRDFFormat(String outputRDFFormat) { this.outputRDFFormat = outputRDFFormat; } /** * * @return the input RDF format. */ public String getInputRDFFormat() { return inputRDFFormat; } /** * * @param inputRDFFormat the input RDF format. */ public void setInputRDFFormat(String inputRDFFormat) { this.inputRDFFormat = inputRDFFormat; } /** * * @return the option depth. The depth defines the depth of <code>OPTIONAL</code> operators in SPARQL queries. */ public int getOptionalDepth() { return optionalDepth; } /** * * @param optionalDepth the optional depth. The depth defines the depth of <code>OPTIONAL</code> operators in SPARQL queries. Default is 2. */ public void setOptionalDepth(int optionalDepth) { if(minOptionalDepth <= optionalDepth && optionalDepth <= maxOptionalDepth){ this.optionalDepth = optionalDepth; } else { LOG.warn("Optional Depth: " + optionalDepth + " is not allowed. Setting default value."); this.optionalDepth = 2; } } /** * * @return the ID of dataset A (left). */ public String getIdA() { return idA; } /** * * @param idA the ID of dataset A (left). */ public void setIdA(String idA) { this.idA = idA; } /** * * @return the SPARQL endpoint of dataset A. */ public String getEndpointA() { return endpointA; } /** * * @param endpointA the SPARQL endpoint of dataset A. */ public void setEndpointA(String endpointA) { this.endpointA = endpointA; } /** * * @return the ID of dataset B (right). */ public String getIdB() { return idB; } /** * * @param idB the ID of dataset B (right). */ public void setIdB(String idB) { this.idB = idB; } /** * * @return the SPARQL endpoint of dataset B (right). */ public String getEndpointB() { return endpointB; } /** * * @param endpointB the SPARQL endpoint of dataset B (right). */ public void setEndpointB(String endpointB) { this.endpointB = endpointB; } /** * * @return the ID of the links file. */ public String getIdLinks() { return idLinks; } /** * * @param idLinks the ID of the links file. */ public void setIdLinks(String idLinks) { this.idLinks = idLinks; } /** * * @return the SPARQL endpoint of the links. */ public String getEndpointLinks() { return endpointLinks; } /** * * @param endpointLinks the SPARQL endpoint of the links. */ public void setEndpointLinks(String endpointLinks) { this.endpointLinks = endpointLinks; } /** * * @return the ID of the output. */ public String getIdOutput() { return idOutput; } /** * * @param idOutput the ID of the output. */ public void setIdOutput(String idOutput) { this.idOutput = idOutput; } /** * * @return the SPARQL endpoint of the output. */ public String getEndpointOutput() { return endpointOutput; } /** * * @param endpointOutput the SPARQL endpoint of the output. */ public void setEndpointOutput(String endpointOutput) { this.endpointOutput = endpointOutput; } /** * * @return the locale. */ public Locale getLocale() { if(locale == null){ return Locale.ENGLISH; } return locale; } /** * * @param locale the locale. */ public void setLocale(Locale locale) { this.locale = locale; } /** * * @return the path of the categories mapping file for dataset A (left). NT format expected. */ public String getCategoriesA() { return categoriesA; } /** * * @param categoriesA the path of the categories mapping file for dataset A (left). NT format expected. */ public void setCategoriesA(String categoriesA) { this.categoriesA = categoriesA; } /** * * @return the path of the categories mapping file for dataset B (right). NT format expected. */ public String getCategoriesB() { return categoriesB; } /** * * @param categoriesB the path of the categories mapping file for dataset B (right). NT format expected. */ public void setCategoriesB(String categoriesB) { this.categoriesB = categoriesB; } /** * * @return the path of the property frequencies file of dataset A. */ public String getPropertyFrequencyA() { return propertyFrequencyA; } /** * * @param propertyFrequencyA the path of the property frequencies file of dataset A. */ public void setPropertyFrequencyA(String propertyFrequencyA) { this.propertyFrequencyA = propertyFrequencyA; } /** * * @return the path of the property frequencies file of dataset B. */ public String getPropertyFrequencyB() { return propertyFrequencyB; } /** * * @param propertyFrequencyB the path of the property frequencies file of dataset B. */ public void setPropertyFrequencyB(String propertyFrequencyB) { this.propertyFrequencyB = propertyFrequencyB; } /** * Date reference for dataset A. * @return the date. */ public Date getDateA() { return dateA; } /** * Date reference for dataset A. * @param dateA the date. */ public void setDateA(Date dateA) { this.dateA = dateA; } /** * * @return the dataset considered most recent based on the dates provided for each dataset. */ public EnumDataset getMostRecentDataset(){ if(dateA != null && dateB != null){ if(dateA.after(dateB)){ return EnumDataset.LEFT; } else { return EnumDataset.RIGHT; } } else { return EnumDataset.UNDEFINED; } } /** * Date reference for dataset B. * @return the date. */ public Date getDateB() { return dateB; } /** * Date reference for dataset B. * @param dateB the date. */ public void setDateB(Date dateB) { this.dateB = dateB; } /** * * @return the similarity name. Default is jaro-winkler. */ public String getSimilarity() { return similarity; } /** * * @param similarity the similarity name. */ public void setSimilarity(String similarity) { this.similarity = similarity; } /** * * @return the path of the rules specification XML file. */ public String getRulesPath() { return rulesPath; } /** * * @param rulesPath the path of the rules specification XML file. */ public void setRulesPath(String rulesPath) { this.rulesPath = rulesPath; } /** * Enumeration that defines the fusion mode. * * @return the output mode enumeration. */ public EnumOutputMode getOutputMode() { return outputMode; } /** * Enumeration that defines the fusion mode. * * @param outputMode the output mode enumeration. */ public void setOutputMode(EnumOutputMode outputMode) { this.outputMode = outputMode; } /** * * @return the output directory of the resulted files. */ public String getOutputDir() { return outputDir; } /** * * @param outputDir the output directory of the resulted files. * @throws WrongInputException error with input path. */ public void setOutputDir(String outputDir) throws WrongInputException { LOG.info("output path: " + outputDir); if(StringUtils.isBlank(outputDir)){ throw new WrongInputException("Output directory is blank! Add " + SpecificationConstants.Config.OUTPUT_DIR + " tag in " + SpecificationConstants.Config.CONFIG_XML); } if(outputDir.endsWith("/")){ this.outputDir = outputDir; } else { this.outputDir = outputDir + "/"; } } /** * * @return the fused output file path. */ public String getFused() { return fused; } /** * * @param fused the fused output file path. * @throws WrongInputException error with input path. */ public void setFused(String fused) throws WrongInputException { if(StringUtils.isBlank(fused)){ if(StringUtils.isBlank(outputDir)){ throw new WrongInputException("Define " + SpecificationConstants.Config.FUSED + " filepath after " + SpecificationConstants.Config.OUTPUT_DIR + " tag in " + SpecificationConstants.Config.CONFIG_XML); } this.fused = outputDir + SpecificationConstants.Config.DEFAULT_FUSED_FILENAME; } else { this.fused = fused; } } /** * Remaining dataset gets populated based on the fusion mode. * * @return the remaining output file path. */ public String getRemaining() { return remaining; } /** * Remaining dataset gets populated based on the fusion mode. * * @param remaining the remaining output file path. * @throws WrongInputException error with input path. */ public void setRemaining(String remaining) throws WrongInputException { if(StringUtils.isBlank(remaining)){ if(StringUtils.isBlank(outputDir)){ throw new WrongInputException("Define " + SpecificationConstants.Config.REMAINING + " filepath after " + SpecificationConstants.Config.OUTPUT_DIR + " tag in " + SpecificationConstants.Config.CONFIG_XML); } this.remaining = outputDir + SpecificationConstants.Config.DEFAULT_REMAINING_FILENAME; } else { this.remaining = remaining; } } /** * * @return the statistics path. */ public String getStatsFilepath() { return statsFilepath; } /** * * @param statsFilepath the statistics path. * @throws WrongInputException error with input path. */ public void setStatsFilepath(String statsFilepath) throws WrongInputException { if(StringUtils.isBlank(statsFilepath)){ if(StringUtils.isBlank(outputDir)){ throw new WrongInputException("Define " + SpecificationConstants.Config.STATISTICS + " filepath after " + SpecificationConstants.Config.OUTPUT_DIR + " tag in " + SpecificationConstants.Config.CONFIG_XML); } this.statsFilepath = outputDir + SpecificationConstants.Config.DEFAULT_STATS_FILENAME; } else { this.statsFilepath = statsFilepath; } } /** * Ambiguous dataset contains entities and/or entity properties that were marked ambiguous at the fusion process based on the rules specification. * * @return the ambiguous dataset file path. */ public String getAmbiguousDatasetFilepath() { return ambiguousDatasetFilepath; } /** * Ambiguous dataset contains entities and/or entity properties that were marked ambiguous at the fusion process based on the rules specification. * * @param ambiguousDatasetFilepath the ambiguous dataset file path. * @throws WrongInputException error with input path. */ public void setAmbiguousDatasetFilepath(String ambiguousDatasetFilepath) throws WrongInputException { if(StringUtils.isBlank(ambiguousDatasetFilepath)){ if(StringUtils.isBlank(outputDir)){ throw new WrongInputException("Define " + SpecificationConstants.Config.AMBIGUOUS + " filepath after " + SpecificationConstants.Config.OUTPUT_DIR + " tag in " + SpecificationConstants.Config.CONFIG_XML); } this.ambiguousDatasetFilepath = outputDir + SpecificationConstants.Config.DEFAULT_AMBIGUOUS_FILENAME; } else { this.ambiguousDatasetFilepath = ambiguousDatasetFilepath; } } /** * * @return the path of the file containing the training examples (CSV format). */ public String getTrainingSetCsvPath() { return trainingSetCsvPath; } /** * * @param trainingSetCsvPath the path of the file containing the training examples (CSV format). */ public void setTrainingSetCsvPath(String trainingSetCsvPath) { this.trainingSetCsvPath = trainingSetCsvPath; } public String getFusionLog() { return fusionLog; } public void setFusionLog(String fusionLog) throws WrongInputException { if(StringUtils.isBlank(fusionLog)){ if(StringUtils.isBlank(outputDir)){ throw new WrongInputException("Define " + SpecificationConstants.Config.FUSION_LOG + " filepath after " + SpecificationConstants.Config.OUTPUT_DIR + " tag in " + SpecificationConstants.Config.CONFIG_XML); } this.fusionLog = outputDir + SpecificationConstants.Config.DEFAULT_FUSION_LOG_FILENAME; } else { this.fusionLog = fusionLog; } } public String getLinksFormat() { return linksFormat; } public void setLinksFormat(String linksFormat) { this.linksFormat = linksFormat.toLowerCase(); } public void setVerbose(boolean verbose) { this.verbose = verbose; } public boolean isVerbose() { return verbose; } public String getValidationModelPath() { return validationModelPath; } public void setValidationModelPath(String validationModelPath) { this.validationModelPath = validationModelPath; } public String getNameModelPath() { return nameModelPath; } public void setNameModelPath(String nameModelPath) { this.nameModelPath = nameModelPath; } public String getAddressModelPath() { return addressModelPath; } public void setAddressModelPath(String addressModelPath) { this.addressModelPath = addressModelPath; } public String getPhoneModelPath() { return phoneModelPath; } public void setPhoneModelPath(String phoneModelPath) { this.phoneModelPath = phoneModelPath; } public String getWebsiteModelPath() { return websiteModelPath; } public void setWebsiteModelPath(String websiteModelPath) { this.websiteModelPath = websiteModelPath; } public String getEmailModelPath() { return emailModelPath; } public void setEmailModelPath(String emailModelPath) { this.emailModelPath = emailModelPath; } public String getGeoModelPath() { return geoModelPath; } public void setGeoModelPath(String geoModelPath) { this.geoModelPath = geoModelPath; } public String getStats() { return stats; } public void setStats(String stats) { this.stats = stats; } @Override public String toString() { return "\nconfiguration{" + "\n rulesPath=" + rulesPath + "\n idA=" + idA + //"\n endpointA=" + endpointA + "\n pathA=" + pathDatasetA + "\n categoriesA=" + categoriesA + "\n dateA=" + dateA + "\n\n pathB=" + pathDatasetB + "\n idB=" + idB + //"\n endpointB=" + endpointB + "\n categoriesB=" + categoriesB + "\n dateB=" + dateB + "\n\n pathLinks=" + pathLinks + "\n idLinks=" + idLinks + "\n linksFormat=" + linksFormat + "\n\n outputMode=" + outputMode + "\n statsMode=" + stats + "\n outputDir=" + outputDir + "\n fused=" + fused + "\n remaining=" + remaining + "\n ambiguous=" + ambiguousDatasetFilepath + "\n stats=" + statsFilepath + "\n fusionLog=" + fusionLog + "\n\n outputRDFFormat=" + outputRDFFormat + "\n inputRDFFormat=" + inputRDFFormat + "\n locale=" + locale + "\n similarity=" + similarity + "\n optionalQueryDepth=" + optionalDepth + "\n -ML-" + "\n name model=" + nameModelPath + "\n address model=" + addressModelPath + "\n website model=" + websiteModelPath + "\n phone model=" + phoneModelPath + "\n email model=" + emailModelPath + "\n}"; } }
package com.codeshare.photomotion.callback; import android.graphics.Bitmap; import java.util.List; public interface OnBitmapListCreated { void onBitmapRecived(List<Bitmap> list); }
package round.first.binaryTree; public class TreeNode { public int val; public TreeNode left, right; public TreeNode(int val){ this.val = val; this.left = this.right = null; } //Preorder public void add(TreeNode root,int[] values){ for (int i = 0; i < values.length; i++) { root = addRecursive(root, values[i]); } } private static TreeNode addRecursive(TreeNode current, int value){ if(current == null){ return new TreeNode(value); }else if(current.left == null){ current.left = addRecursive(current.left , value); }else{ current.right = addRecursive(current.right, value); } return current; } }
package com.jim.multipos.ui.start_configuration.basics; import com.jim.multipos.core.BaseView; import com.jim.multipos.utils.CompletionMode; public interface BasicsView extends BaseView { void checkPosDataCompletion(); void setMode(CompletionMode mode); }
package gui; import database.DBWorker; import main.CashMachine; import other.OnlyDigits; import other.OnlyLetters; import other.Helper; import javax.swing.*; import javax.swing.text.PlainDocument; import java.awt.*; import java.util.ResourceBundle; import java.util.concurrent.ThreadLocalRandom; class RegisterFrame extends JFrame{ private JTextField firstName; private JButton confirmB; private JButton backB; private JTextField lastName; private JTextField creditCardNumTF; private JTextField firstName2; private JTextField lastName2; private JTextField pin; private JTextField pinConf; private JPanel cardLayout; private JButton createAcB2; private JButton backB2; private JLabel createNewAccLab; private JLabel firstNameLab; private JLabel lastNameLab; private JLabel pinLab; private JLabel pinConfLab; private JLabel yourNewAccLab2; private JLabel firstNameLab2; private JLabel lastNameLab2; private JLabel ccnLab2; private JComboBox languageCB; private long creditCardNum; private ResourceBundle res = ResourceBundle.getBundle(CashMachine.PATH + CashMachine.lang + ".registerframe"); RegisterFrame() { super("CreateAccount"); addAllListeners(); setDocumentFilters(); setLanguageCB(); addText(); setRest(); this.getRootPane().setDefaultButton(confirmB); setContentPane(cardLayout); setResizable(false); pack(); } private void addAllListeners(){ confirmB.addActionListener(e -> { if(firstName.getText().length()<=1 || lastName.getText().length()<=1){ JOptionPane.showMessageDialog(null, res.getString("incorrect.data"), "Error", JOptionPane.ERROR_MESSAGE); firstName.setText(""); lastName.setText(""); pin.setText(""); pinConf.setText(""); } else if(!pinConf.getText().equals(pin.getText())){ JOptionPane.showMessageDialog(null, res.getString("password.doesnt.match"), "Error", JOptionPane.ERROR_MESSAGE); pin.setText(""); pinConf.setText(""); } else if(pin.getText().length() != 4){ JOptionPane.showMessageDialog(null, res.getString("incorrect.data"), "Error", JOptionPane.ERROR_MESSAGE); pin.setText(""); pinConf.setText(""); } else { firstName2.setText(firstName.getText()); lastName2.setText(lastName.getText()); creditCardNum = ThreadLocalRandom.current().nextLong((long)Math.pow(10, 11), (long)999999.999999 * 1000000); creditCardNumTF.setText(creditCardNum+""); CardLayout cl = (CardLayout)(cardLayout.getLayout()); cl.next(cardLayout); getRootPane().setDefaultButton(createAcB2); } }); backB.addActionListener(e -> { GuiRunner.runLoginFrame(); dispose(); }); backB2.addActionListener(e -> { CardLayout cl = (CardLayout)(cardLayout.getLayout()); cl.previous(cardLayout); getRootPane().setDefaultButton(confirmB); }); createAcB2.addActionListener(e -> { DBWorker.addUser(creditCardNumTF.getText(), pin.getText(), firstName2.getText(), lastName2.getText()); GuiRunner.runLoginFrame(); dispose(); }); } private void setRest(){ Helper.setHandCursor(confirmB); Helper.setHandCursor(backB); Helper.setHandCursor(backB2); Helper.setHandCursor(createAcB2); } private void setDocumentFilters(){ PlainDocument pd = (PlainDocument) (firstName.getDocument()); pd.setDocumentFilter(new OnlyLetters()); pd = (PlainDocument) (lastName.getDocument()); pd.setDocumentFilter(new OnlyLetters()); pd = (PlainDocument) (pin.getDocument()); pd.setDocumentFilter(new OnlyDigits(4)); pd = (PlainDocument) (pinConf.getDocument()); pd.setDocumentFilter(new OnlyDigits(4)); } private void setLanguageCB(){ languageCB.addItem("ENG"); languageCB.addItem("RUS"); languageCB.setSelectedItem(CashMachine.lang.toUpperCase()); languageCB.addActionListener(e -> { if (languageCB.getSelectedItem().equals("ENG")) { CashMachine.lang = "eng"; res = ResourceBundle.getBundle(CashMachine.PATH + CashMachine.lang + ".registerframe"); } else if (languageCB.getSelectedItem().equals("RUS")) { CashMachine.lang = "rus"; res = ResourceBundle.getBundle(CashMachine.PATH + CashMachine.lang + ".registerframe"); } addText(); }); } private void addText(){ createNewAccLab.setText(res.getString("create.new.acc")); firstNameLab.setText(res.getString("first.name")); firstNameLab2.setText(res.getString("first.name")); lastNameLab.setText(res.getString("last.name")); lastNameLab2.setText(res.getString("last.name")); pinLab.setText(res.getString("pin")); pinConfLab.setText(res.getString("confirm.pin")); confirmB.setText(res.getString("confirm.b")); backB.setText(res.getString("back.b")); backB2.setText(res.getString("back.b")); yourNewAccLab2.setText(res.getString("your.new.acc.2")); ccnLab2.setText(res.getString("ccn")); createAcB2.setText(res.getString("create.acc.b")); } }
package searchcodej.model; import java.util.ArrayList; import java.util.List; public class SourceCodeNode { private SourceCodeElement data; private List<SourceCodeNode> children; public SourceCodeNode(SourceCodeElement data) { super(); this.data = data; this.children = new ArrayList<SourceCodeNode>(); } public void addChild(SourceCodeNode sourceCodeNode) { this.children.add(sourceCodeNode); } public List<SourceCodeNode> getChildren() { return children; } public SourceCodeElement getData() { return data; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{").append(data.getDeclaration()); if (getChildren().size() > 0) { sb.append(",["); int i = 0; for (SourceCodeNode e : getChildren()) { if (i > 0) { sb.append(","); } sb.append(e.data.getDeclaration()); i++; } sb.append("]"); } sb.append("}"); return sb.toString(); } }
package org.sagebionetworks.repo.manager.audit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.util.Collections; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.sagebionetworks.audit.utils.AccessRecordUtils; import org.sagebionetworks.repo.model.audit.AccessRecord; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:test-context-enabled.xml" }) public class S3AccessRecorderTest { @Autowired private S3AccessRecorder recorder; @Autowired private AccessRecordManager accessManager; @Test public void testSaveAndFire() throws IOException{ List<AccessRecord> toTest = AuditTestUtils.createList(5, 100); // Shuffle to simulate a real scenario Collections.shuffle(toTest); // Add each to the recorder for(AccessRecord ar: toTest){ recorder.save(ar); } // Now fire the timer String fileName = recorder.timerFired(); assertNotNull(fileName); // Get the saved record and check it List<AccessRecord> fetched = accessManager.getBatch(fileName); assertNotNull(fetched); // The fetched list should match the input sorted on time stamp AccessRecordUtils.sortByTimestamp(toTest); assertEquals(toTest, fetched); } }
/* * --------------------------------------------------------------------------------------------------------------------- * Brigham Young University - Project MEDIA StillFace DataCenter * --------------------------------------------------------------------------------------------------------------------- * The contents of this file contribute to the ProjectMEDIA DataCenter for managing and analyzing data obtained from the * results of StillFace observational experiments. * * This code is free, open-source software. You may distribute or modify the code, but Brigham Young University or any * parties involved in the development and production of this code as downloaded from the remote repository are not * responsible for any repercussions that come as a result of the modifications. */ package com.byu.pmedia.view; import javafx.scene.control.Alert; import javafx.scene.layout.Region; import javafx.stage.Stage; /** * StillFaceErrorNotification * Provides a simple wrapper around a JavaFX error notification for simple and easy incorporation into the DataCenter. * * @author Braden Hitchcock */ public class StillFaceErrorNotification implements IStillFaceNotification { /* The JavaFX alert object */ private Alert alert = new Alert(Alert.AlertType.ERROR); /** * Constructs a new instance of the error dialog * * @param message The error message to show to the user */ public StillFaceErrorNotification(String message){ alert.setContentText(message); alert.setTitle("Datacenter encountered an error"); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ((Stage)alert.getDialogPane().getScene().getWindow()).setAlwaysOnTop(true); } /** * Displays the dialog and halts the current execution of the thread. Waits for the user to close the dialog * before resuming execution. */ @Override public void show() { alert.showAndWait(); } }
import java.util.Scanner; class Main { public static void main(String[] args) { // put your code here Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int a = 0; int b = 0; int c = 0; for(int i = 0; i < n; i++){ switch (scanner.nextInt()){ case 0: a++; break; case 1: b++; break; case -1: c++; break; } } System.out.println(a + " " + b + " " + c); } }
package br.com.entequerido.model.enumeration; public enum SexoEnum { MASCULINO ("Masculino"), FEMININO ("Feminino"); private String descricao; SexoEnum (String descricao) { this.descricao = descricao; } public String getDescricao() { return this.descricao; } public SexoEnum obterPorOrdinal(Integer ordinal) { for(SexoEnum sexoEnum : SexoEnum.values()) { if(this.ordinal() == ordinal) { return sexoEnum; } } return null; } public SexoEnum obterPorOrdinal(String descricao) { for(SexoEnum sexoEnum : SexoEnum.values()) { if(this.descricao == descricao) { return sexoEnum; } } return null; } }
package rubrica12.webpages; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.spring.injection.annot.SpringBean; import rubrica12.model.Book; import rubrica12.service.BookService; @SuppressWarnings({ "unchecked", "rawtypes", "serial" }) public class ListBookPage extends WebPage { private static final long serialVersionUID = -1935854748907274886L; @SpringBean BookService bookService; private static final Logger logger = LogManager.getLogger(ListBookPage.class.getName()); private String currentNameSearchBook = null; private List listBook = Collections.emptyList(); public ListBookPage(PageParameters parameters) { currentNameSearchBook = parameters.get("currentSearchTerm").toString(); logger.debug("Cargando la pagina con el parametro " + currentNameSearchBook); initComponents(); } public ListBookPage() { initComponents(); } private void initComponents() { addFormBook(); addFeedBackPanel(); addListBookView(); } private void addFormBook() { Form form = new Form("formListBook", new CompoundPropertyModel(new Book())) { @Override protected void onSubmit() { super.onSubmit(); listBook.clear(); PageParameters pageParameters = new PageParameters(); pageParameters.add("currentSearchTerm", ((Book) getModelObject()).getTitle()); pageParameters.add("currentSearchTerm", ((Book) getModelObject()).getIsbn()); pageParameters.add("currentSearchTerm", ((Book) getModelObject()).getIdAuthor()); setResponsePage(ListAuthorPage.class, pageParameters); } }; form.add(new TextField("title")); form.add(new TextField("isbn")); form.add(new TextField("idAuthor")); add(form); } private void addFeedBackPanel() { FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackMessage"); add(feedbackPanel); } private void addListBookView() { Book book = new Book();// service.newEntity() book.setTitle(currentNameSearchBook); listBook = bookService.findBooksByidAuthor(book.getIdAuthor()); if (StringUtils.isNumeric(currentNameSearchBook)) { book.setIsbn(Integer.parseInt(currentNameSearchBook)); } listBook = bookService.findBooks(book); ListView listview = new ListView("book-group", listBook) { @Override protected void populateItem(ListItem item) { Book book = (Book) item.getModelObject(); item.add(new Label("title", book.getTitle())); item.add(new Label("isbn", book.getIsbn())); item.add(new Label("idAuthor", book.getIdAuthor())); } }; add(listview); } }
package iarfmoose; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import com.github.ocraft.s2client.bot.S2Agent; import com.github.ocraft.s2client.bot.gateway.UnitInPool; import com.github.ocraft.s2client.protocol.data.UnitType; import com.github.ocraft.s2client.protocol.data.UnitTypeData; import com.github.ocraft.s2client.protocol.data.Units; import com.github.ocraft.s2client.protocol.data.Upgrade; import com.github.ocraft.s2client.protocol.game.PlayerInfo; import com.github.ocraft.s2client.protocol.observation.raw.Visibility; import com.github.ocraft.s2client.protocol.spatial.Point; import com.github.ocraft.s2client.protocol.spatial.Point2d; import com.github.ocraft.s2client.protocol.unit.Alliance; public class InformationManager extends ActiveManager { private static final int EARLY_GAME = 8000; ThreatHandler threatHandler; Set<UnitInPool> enemyArmy; Set<UnitInPool> enemyWorkers; Set<UnitInPool> enemyStructures; Set<UnitInPool> enemyBases; Set<UnitInPool> enemyGases; Set<UnitInPool> ourArmy; Set<UnitInPool> ourWorkers; Set<UnitInPool> ourStructures; Set<UnitInPool> ourBases; Set<UnitInPool> ourGases; float enemyArmySupply; float ourArmySupply; Set<Upgrade> ourCompletedUpgrades; public InformationManager(S2Agent bot, BaseLocator baseLocator) { super(bot, baseLocator); threatHandler = new ThreatHandler(bot); enemyArmy = new HashSet<UnitInPool>(); enemyWorkers = new HashSet<UnitInPool>(); enemyStructures = new HashSet<UnitInPool>(); enemyBases = new HashSet<UnitInPool>(); enemyGases = new HashSet<UnitInPool>(); ourArmy = new HashSet<UnitInPool>(); ourWorkers = new HashSet<UnitInPool>(); ourStructures = new HashSet<UnitInPool>(); ourBases = new HashSet<UnitInPool>(); ourGases = new HashSet<UnitInPool>(); enemyArmySupply = 0; ourArmySupply = 0; ourCompletedUpgrades = new HashSet<Upgrade>(); } @Override public void onStep() { if (bot.observation().getGameLoop() % 22 == 0) { List<UnitInPool> enemyUnits = bot.observation().getUnits(Alliance.ENEMY); enemyUnits.addAll(enemyStructures); List<UnitInPool> threateningUnits = filterThreateningUnits(enemyUnits); threatHandler.updateThreats(threateningUnits); } } @Override public void onUnitCreated(UnitInPool unitInPool) { addToOurGroup(unitInPool); } @Override public void onUnitDestroyed(UnitInPool unitInPool) { if (unitInPool.unit().getAlliance() == Alliance.ENEMY) { removeFromEnemyGroup(unitInPool); } else { removeFromOurGroup(unitInPool); } } public void onUnitEnterVision(UnitInPool unitInPool) { if (unitInPool.unit().getAlliance() == Alliance.ENEMY) { addToEnemyGroup(unitInPool); } } public void onUpgradeCompleted(Upgrade upgrade) { ourCompletedUpgrades.add(upgrade); } public GameState getCurrentGameState() { return makeGameState(); } private void addToEnemyGroup(UnitInPool enemy) { UnitType enemyType = enemy.unit().getType(); if (UnitData.isFightingUnit(enemyType)) { if(enemyArmy.add(enemy)) { addToArmySupply(enemy.unit().getType(), Alliance.ENEMY); } } else if (UnitData.isWorker(enemyType)) { enemyWorkers.add(enemy); } else if (UnitData.isStructure(enemyType)) { enemyStructures.add(enemy); if (UnitData.isTownHall(enemyType)) { enemyBases.add(enemy); } else if (UnitData.isGasGeyser(enemyType)) { enemyGases.add(enemy); } } } private void removeFromEnemyGroup(UnitInPool enemy) { UnitType enemyType = enemy.unit().getType(); if (UnitData.isFightingUnit(enemyType)) { if(enemyArmy.remove(enemy)) { removeFromArmySupply(enemy.unit().getType(), Alliance.ENEMY); } } else if (UnitData.isWorker(enemyType)) { enemyWorkers.remove(enemy); } else if (UnitData.isStructure(enemyType)) { enemyStructures.remove(enemy); if (UnitData.isTownHall(enemyType)) { enemyBases.remove(enemy); } else if (UnitData.isGasStructure(enemyType)) { enemyGases.remove(enemy); } } } private void addToOurGroup(UnitInPool ourUnit) { UnitType unitType = ourUnit.unit().getType(); if (UnitData.isFightingUnit(unitType) && unitType != Units.ZERG_QUEEN) { if(ourArmy.add(ourUnit)) { addToArmySupply(ourUnit.unit().getType(), Alliance.SELF); } } else if (UnitData.isWorker(unitType)) { ourWorkers.add(ourUnit); } else if (UnitData.isStructure(unitType)) { ourStructures.add(ourUnit); if (UnitData.isTownHall(unitType)) { ourBases.add(ourUnit); } else if (UnitData.isGasStructure(unitType)) { ourGases.add(ourUnit); } } } private void removeFromOurGroup(UnitInPool ourUnit) { UnitType unitType = ourUnit.unit().getType(); if (UnitData.isFightingUnit(unitType) && unitType != Units.ZERG_QUEEN) { if(ourArmy.remove(ourUnit)) { removeFromArmySupply(ourUnit.unit().getType(), Alliance.SELF); } } else if (UnitData.isWorker(unitType)) { ourWorkers.remove(ourUnit); } else if (UnitData.isStructure(unitType)) { ourStructures.remove(ourUnit); if (UnitData.isTownHall(unitType)) { ourBases.remove(ourUnit); } else if (UnitData.isGasGeyser(unitType)) { ourGases.remove(ourUnit); } } } private void addToArmySupply(UnitType unitType, Alliance alliance) { if (alliance == Alliance.SELF) { ourArmySupply += getUnitTypeSupply(unitType); } else { enemyArmySupply += getUnitTypeSupply(unitType); } } private void removeFromArmySupply(UnitType unitType, Alliance alliance) { if (alliance == Alliance.SELF) { ourArmySupply -= getUnitTypeSupply(unitType); } else { enemyArmySupply -= getUnitTypeSupply(unitType); } } private GameState makeGameState() { GameState gameState = new GameState( getGamePhase(), bot.observation().getGameLoop(), threatHandler.getThreats(), getPlayerStates() ); return gameState; } private float getUnitTypeSupply(UnitType enemyType) { UnitTypeData enemyTypeData = bot.observation().getUnitTypeData(false).get(enemyType); return enemyTypeData.getFoodRequired().orElse((float) 0); } private GamePhase getGamePhase() { if (bot.observation().getGameLoop() < EARLY_GAME && ourWorkers.size() < 40) { return GamePhase.EARLY; } else if (completedStructureExists(Units.ZERG_HIVE) && ourBases.size() > 3) { return GamePhase.LATE; } else { return GamePhase.MID; } } private List<PlayerState> getPlayerStates() { List<PlayerState> playerStates = new ArrayList<PlayerState>(); for (PlayerInfo player : bot.observation().getGameInfo().getPlayersInfo()) { PlayerState state = makePlayerState(player); playerStates.add(state); } return playerStates; } private PlayerState makePlayerState(PlayerInfo playerInfo) { int player = playerInfo.getPlayerId(); Alliance alliance = getAllianceFor(player); float armySupply = getArmySupplyFor(player); int workerCount = getWorkerCountFor(player); Set<UnitInPool> structures = getStructuresFor(player); Set<Upgrade> upgrades = getCompletedUpgradesFor(player); return new PlayerState(playerInfo, alliance, armySupply, workerCount, structures, upgrades); } private Alliance getAllianceFor(int playerID) { if (playerID == bot.observation().getPlayerId()) { return Alliance.SELF; } else { return Alliance.ENEMY; } } private float getArmySupplyFor(int playerID) { if (playerID == bot.observation().getPlayerId()) { return ourArmySupply; } else { return enemyArmySupply; } } private int getWorkerCountFor(int playerID) { if (playerID == bot.observation().getPlayerId()) { return ourWorkers.size(); } else { return enemyWorkers.size(); } } private Set<UnitInPool> getStructuresFor(int playerID) { if (playerID == bot.observation().getPlayerId()) { return ourStructures; } else { removeAnyStructuresThatHaveMoved(); return enemyStructures; } } private Set<Upgrade> getCompletedUpgradesFor(int playerID) { if (playerID == bot.observation().getPlayerId()) { return ourCompletedUpgrades; } else { removeAnyStructuresThatHaveMoved(); return new HashSet<Upgrade>(); } } private void removeAnyStructuresThatHaveMoved() { for (Iterator<UnitInPool> structureIterator = enemyStructures.iterator(); structureIterator.hasNext();) { UnitInPool structure = structureIterator.next(); Point2d structureLocation = structure.unit().getPosition().toPoint2d(); if (bot.observation().getVisibility(structureLocation) == Visibility.VISIBLE && structure.getLastSeenGameLoop() != bot.observation().getGameLoop()) { structureIterator.remove(); } } } private boolean completedStructureExists(UnitType structureType) { for (UnitInPool structure : ourStructures) { if (structure.unit().getType() == structureType && structure.unit().getBuildProgress() == 1.0) { return true; } } return false; } private List<UnitInPool> filterThreateningUnits(Collection<UnitInPool> enemyUnits) { List<UnitInPool> filteredUnits = new ArrayList<UnitInPool>(); for(UnitInPool enemy : enemyUnits) { Point enemyPosition = enemy.unit().getPosition(); boolean closeToOurStructure = false; for (UnitInPool structure : ourStructures) { Point structurePosition = structure.unit().getPosition(); if (structurePosition.distance(enemyPosition) < threatHandler.getThreatRadius(getGamePhase())) { closeToOurStructure = true; } } if (closeToOurStructure && !UnitData.isChangeling(enemy.unit().getType())) { filteredUnits.add(enemy); } } return filteredUnits; } }
package Fragments; import android.support.v4.app.Fragment; public class EventFragment extends Fragment {}
package com.basauri.msscbrewery.web.controller; import com.basauri.msscbrewery.services.CustomerService; import com.basauri.msscbrewery.web.model.CustomerDto; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.ConstraintViolationException; import javax.validation.Valid; import java.util.ArrayList; import java.util.List; import java.util.UUID; @Validated @RestController @RequestMapping("/api/v1/customer") public class CustomerController { private final CustomerService customerService; public CustomerController(CustomerService customerService) { this.customerService = customerService; } @GetMapping({"/{customerId}"}) public ResponseEntity<CustomerDto> getCustomer(@PathVariable("customerId") UUID customerId) { return new ResponseEntity<>(customerService.getCustomerById(customerId), HttpStatus.OK); } @PostMapping public ResponseEntity handlePost(@Valid @RequestBody CustomerDto customerDto) { CustomerDto createdCustomer = customerService.createCustomer(customerDto); HttpHeaders header = new HttpHeaders(); header.add("Location", "/api/v1/customer/" + createdCustomer.getId()); return new ResponseEntity(header, HttpStatus.OK); } @PutMapping({"/{customerId}"}) public ResponseEntity updateCustomer(@PathVariable("customerId") UUID customerId, @Valid @RequestBody CustomerDto customerDto) { customerService.updateCustomer(customerId, customerDto); return new ResponseEntity(HttpStatus.NO_CONTENT); } @DeleteMapping({"/{customerId}"}) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteCustomer(@PathVariable("customerId") UUID customerId) { customerService.deleteCustomerById(customerId); } @ExceptionHandler(ConstraintViolationException.class) public ResponseEntity<List> validationErrorHandler(ConstraintViolationException e) { List<String> errors = new ArrayList<>(e.getConstraintViolations().size()); e.getConstraintViolations().forEach(constraintViolation -> { errors.add(constraintViolation.getPropertyPath() + " : " + constraintViolation.getMessage()); }); return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST); } }
package com.yeshaohua.mapper; import com.yeshaohua.model.User; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Select; import java.util.List; public interface UserMapper { @Select("select * from user where id = #{id}") User findUserById(int id); @Insert("insert into user(username,password,id,age) values(#{username},#{password},#{id},#{age})") void addUser(User user); @Select("select * from user") List<User> getAllUsers(); }
/** */ package com.rockwellcollins.atc.limp.impl; import com.rockwellcollins.atc.limp.ExternalFunction; import com.rockwellcollins.atc.limp.InputArgList; import com.rockwellcollins.atc.limp.LimpPackage; import com.rockwellcollins.atc.limp.OutputArg; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>External Function</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link com.rockwellcollins.atc.limp.impl.ExternalFunctionImpl#getName <em>Name</em>}</li> * <li>{@link com.rockwellcollins.atc.limp.impl.ExternalFunctionImpl#getInputs <em>Inputs</em>}</li> * <li>{@link com.rockwellcollins.atc.limp.impl.ExternalFunctionImpl#getOutput <em>Output</em>}</li> * </ul> * * @generated */ public class ExternalFunctionImpl extends DeclarationImpl implements ExternalFunction { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getInputs() <em>Inputs</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInputs() * @generated * @ordered */ protected InputArgList inputs; /** * The cached value of the '{@link #getOutput() <em>Output</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOutput() * @generated * @ordered */ protected OutputArg output; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ExternalFunctionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return LimpPackage.Literals.EXTERNAL_FUNCTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, LimpPackage.EXTERNAL_FUNCTION__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public InputArgList getInputs() { return inputs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetInputs(InputArgList newInputs, NotificationChain msgs) { InputArgList oldInputs = inputs; inputs = newInputs; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LimpPackage.EXTERNAL_FUNCTION__INPUTS, oldInputs, newInputs); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInputs(InputArgList newInputs) { if (newInputs != inputs) { NotificationChain msgs = null; if (inputs != null) msgs = ((InternalEObject)inputs).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LimpPackage.EXTERNAL_FUNCTION__INPUTS, null, msgs); if (newInputs != null) msgs = ((InternalEObject)newInputs).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LimpPackage.EXTERNAL_FUNCTION__INPUTS, null, msgs); msgs = basicSetInputs(newInputs, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, LimpPackage.EXTERNAL_FUNCTION__INPUTS, newInputs, newInputs)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OutputArg getOutput() { return output; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOutput(OutputArg newOutput, NotificationChain msgs) { OutputArg oldOutput = output; output = newOutput; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LimpPackage.EXTERNAL_FUNCTION__OUTPUT, oldOutput, newOutput); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOutput(OutputArg newOutput) { if (newOutput != output) { NotificationChain msgs = null; if (output != null) msgs = ((InternalEObject)output).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LimpPackage.EXTERNAL_FUNCTION__OUTPUT, null, msgs); if (newOutput != null) msgs = ((InternalEObject)newOutput).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LimpPackage.EXTERNAL_FUNCTION__OUTPUT, null, msgs); msgs = basicSetOutput(newOutput, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, LimpPackage.EXTERNAL_FUNCTION__OUTPUT, newOutput, newOutput)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case LimpPackage.EXTERNAL_FUNCTION__INPUTS: return basicSetInputs(null, msgs); case LimpPackage.EXTERNAL_FUNCTION__OUTPUT: return basicSetOutput(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case LimpPackage.EXTERNAL_FUNCTION__NAME: return getName(); case LimpPackage.EXTERNAL_FUNCTION__INPUTS: return getInputs(); case LimpPackage.EXTERNAL_FUNCTION__OUTPUT: return getOutput(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case LimpPackage.EXTERNAL_FUNCTION__NAME: setName((String)newValue); return; case LimpPackage.EXTERNAL_FUNCTION__INPUTS: setInputs((InputArgList)newValue); return; case LimpPackage.EXTERNAL_FUNCTION__OUTPUT: setOutput((OutputArg)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case LimpPackage.EXTERNAL_FUNCTION__NAME: setName(NAME_EDEFAULT); return; case LimpPackage.EXTERNAL_FUNCTION__INPUTS: setInputs((InputArgList)null); return; case LimpPackage.EXTERNAL_FUNCTION__OUTPUT: setOutput((OutputArg)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case LimpPackage.EXTERNAL_FUNCTION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case LimpPackage.EXTERNAL_FUNCTION__INPUTS: return inputs != null; case LimpPackage.EXTERNAL_FUNCTION__OUTPUT: return output != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //ExternalFunctionImpl
package com.briup.apps.zhaopin.mapper.extend; import com.briup.apps.zhaopin.bean.extend.JobsExtend; import java.util.List; public interface JobsExtendMapper { List<JobsExtend> selectByStatus(String states); }
package chapter03; import java.util.Scanner; public class Exercise03_07 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter an amount in double, for example 11.56: "); int amount = (int) (input.nextDouble() * 100); int remain = amount; int dollar = remain % 100; remain %= 100; int quarter = remain % 25; remain %= 25; int dime = remain % 10; remain %= 10; int nickel = remain % 5; int penny = remain %= 5; System.out.println("Your amount " + amount + " consists of"); System.out.println(dollar + " dollars"); System.out.println(quarter + " quarters"); System.out.println(dime + " dimes"); System.out.println(nickel + " nickels"); System.out.println(penny + " pennies"); } }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.eclipse.dfs; import java.util.HashMap; import java.util.Map; import org.apache.hadoop.eclipse.ImageLibrary; import org.apache.hadoop.eclipse.server.HadoopServer; import org.apache.hadoop.eclipse.servers.ServerRegistry; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; /** * Handles viewing of DFS locations * <p> * * The content handled by this provider is a tree: * * <tt> * <br>DFSLocationsRoot * <br>\_HadoopServer * <br>| \_DfsFolder * <br>| | \_DfsFile * <br>| \_DfsFolder * <br>| ... * <br>\_HadoopServer... * </tt> * * The code should not block here: blocking operations need to be done * asynchronously so as not to freeze the UI! */ public class DFSContentProvider implements ITreeContentProvider, ILabelProvider { /** * The viewer that displays this Tree content */ private Viewer viewer; private StructuredViewer sviewer; private Map<HadoopServer, DFSContent> rootFolders = new HashMap<HadoopServer, DFSContent>(); /** * Constructor: load resources (icons). */ public DFSContentProvider() { } private final DFSLocationsRoot locationsRoot = new DFSLocationsRoot(this); /* * ITreeContentProvider implementation */ /* @inheritDoc */ public Object[] getChildren(Object parent) { if (!(parent instanceof DFSContent)) return null; DFSContent content = (DFSContent) parent; return content.getChildren(); } public Object[] test(Object parentElement) { if (parentElement instanceof DFSLocationsRoot) { return ServerRegistry.getInstance().getServers().toArray(); } else if (parentElement instanceof HadoopServer) { final HadoopServer location = (HadoopServer) parentElement; Object root = rootFolders.get(location); if (root != null) return new Object[] { root }; return new Object[] { "Connecting to DFS..." }; } else if (parentElement instanceof DFSFolder) { DFSFolder folder = (DFSFolder) parentElement; return folder.getChildren(); } return new Object[] { "<Unknown DFSContent>" }; } /* @inheritDoc */ public Object getParent(Object element) { if (element instanceof DFSPath) { return ((DFSPath) element).getParent(); } else if (element instanceof HadoopServer) { return locationsRoot; } return null; } /* @inheritDoc */ public boolean hasChildren(Object element) { if (element instanceof DFSContent) { DFSContent content = (DFSContent) element; return content.hasChildren(); } return false; } /* * IStructureContentProvider implementation */ /* @inheritDoc */ public Object[] getElements(final Object inputElement) { return new Object[] { locationsRoot }; // return ServerRegistry.getInstance().getServers().toArray(); } /* * ILabelProvider implementation */ /* @inheritDoc */ public Image getImage(Object element) { if (element instanceof DFSLocationsRoot) return ImageLibrary.getImage("dfs.browser.root.entry"); else if (element instanceof DFSLocation) return ImageLibrary.getImage("dfs.browser.location.entry"); else if (element instanceof DFSFolder) return ImageLibrary.getImage("dfs.browser.folder.entry"); else if (element instanceof DFSFile) return ImageLibrary.getImage("dfs.browser.file.entry"); return null; } /* @inheritDoc */ public String getText(Object element) { if (element instanceof DFSFile) return ((DFSFile) element).toDetailedString(); return element.toString(); } /* * IBaseLabelProvider implementation */ /* @inheritDoc */ public void addListener(ILabelProviderListener listener) { } /* @inheritDoc */ public void removeListener(ILabelProviderListener listener) { } /* @inheritDoc */ public boolean isLabelProperty(Object element, String property) { return false; } /* * IContentProvider implementation */ /* @inheritDoc */ public void dispose() { } /* @inheritDoc */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { this.viewer = viewer; if ((viewer != null) && (viewer instanceof StructuredViewer)) this.sviewer = (StructuredViewer) viewer; else this.sviewer = null; } /* * Miscellaneous */ /** * Ask the viewer for this content to refresh */ void refresh() { // no display, nothing to update if (this.viewer == null) return; Display.getDefault().asyncExec(new Runnable() { public void run() { DFSContentProvider.this.viewer.refresh(); } }); } /** * Ask the viewer to refresh a single element * * @param content what to refresh */ void refresh(final DFSContent content) { if (this.sviewer != null) { Display.getDefault().asyncExec(new Runnable() { public void run() { DFSContentProvider.this.sviewer.refresh(content); } }); } else { refresh(); } } Viewer getViewer() { return this.viewer; } }
package com.tt.miniapp.msg; import android.text.TextUtils; import android.util.Log; import com.tt.frontendapiinterface.b; import com.tt.frontendapiinterface.f; import com.tt.option.e.e; public abstract class ApiHandlerV2 extends b { public f mApiParams; public ApiHandlerV2(f paramf, int paramInt, e parame) { super("", paramInt, parame); this.mApiParams = paramf; } public String makeErrMsg(boolean paramBoolean, String paramString) { StringBuffer stringBuffer = new StringBuffer(); boolean bool = TextUtils.isEmpty(paramString); String str = "ok"; if (bool) { paramString = getActionName(); if (!paramBoolean) str = "fail"; stringBuffer.append(buildErrorMsg(paramString, str)); } else { StringBuilder stringBuilder = new StringBuilder(); String str1 = getActionName(); if (!paramBoolean) str = "fail"; stringBuilder.append(buildErrorMsg(str1, str)); stringBuilder.append(" "); stringBuilder.append(paramString); stringBuffer.append(stringBuilder.toString()); } return stringBuffer.toString(); } public String makeErrStack(Throwable paramThrowable) { return (paramThrowable != null) ? Log.getStackTraceString(paramThrowable) : ""; } } /* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\miniapp\msg\ApiHandlerV2.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package graph.generic; public interface WeightedArcData { public double getValue(); }
package br.com.professorisidro.folha.model; public class Comissionado extends Funcionario { protected float salarioBase; protected float comissao; public Comissionado(int id, String nome, float salarioBase, float comissao) { super(id, nome); this.salarioBase = salarioBase; this.comissao = comissao; } public float getSalarioBase() { return salarioBase; } public void setSalarioBase(float salarioBase) { this.salarioBase = salarioBase; } public float getComissao() { return comissao; } public void setComissao(float comissao) { this.comissao = comissao; } public float calcularSalario() { return salarioBase + salarioBase * comissao / 100; } }
package com.gym.appointments.Input; import com.gym.appointments.Model.CategoriasPalabras; import com.gym.appointments.Model.Ubicacion; import java.util.List; public class DatosInput extends JsonInput{ int alto; int ancho; CategoriasPalabras categoriasPalabras; List<Ubicacion> ubicaciones; String totalDePalabras; List<String> palabras; String totalDePalabrasEncontradas; List<String> palabrasEncontradas; public DatosInput() { } public DatosInput(int alto, int ancho, CategoriasPalabras categoriasPalabras, List<Ubicacion> ubicaciones, String totalDePalabras, List<String> palabras, String totalDePalabrasEncontradas, List<String> palabrasEncontradas) { this.alto = alto; this.ancho = ancho; this.categoriasPalabras = categoriasPalabras; this.ubicaciones = ubicaciones; this.totalDePalabras = totalDePalabras; this.palabras = palabras; this.totalDePalabrasEncontradas = totalDePalabrasEncontradas; this.palabrasEncontradas = palabrasEncontradas; } public int getAlto() { return alto; } public void setAlto(int alto) { this.alto = alto; } public int getAncho() { return ancho; } public void setAncho(int ancho) { this.ancho = ancho; } public CategoriasPalabras getCategoriasPalabras() { return categoriasPalabras; } public void setCategoriasPalabras(CategoriasPalabras categoriasPalabras) { this.categoriasPalabras = categoriasPalabras; } public List<Ubicacion> getUbicaciones() { return ubicaciones; } public void setUbicaciones(List<Ubicacion> ubicaciones) { this.ubicaciones = ubicaciones; } public String getTotalDePalabras() { return totalDePalabras; } public void setTotalDePalabras(String totalDePalabras) { this.totalDePalabras = totalDePalabras; } public List<String> getPalabras() { return palabras; } public void setPalabras(List<String> palabras) { this.palabras = palabras; } public String getTotalDePalabrasEncontradas() { return totalDePalabrasEncontradas; } public void setTotalDePalabrasEncontradas(String totalDePalabrasEncontradas) { this.totalDePalabrasEncontradas = totalDePalabrasEncontradas; } public List<String> getPalabrasEncontradas() { return palabrasEncontradas; } public void setPalabrasEncontradas(List<String> palabrasEncontradas) { this.palabrasEncontradas = palabrasEncontradas; } }
package com.dais.auto; import com.common.Enum.VirtualCapitalOperationInStatusEnum; import com.common.Enum.VirtualCapitalOperationTypeEnum; import com.common.Enum.VirtualCoinTypeStatusEnum; import com.dais.model.Fvirtualcaptualoperation; import com.dais.model.Fvirtualcointype; import com.dais.service.FvirtualcaptualoperationService; import com.dais.service.VirtualCoinService; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class RechargeBtcData { @Autowired private VirtualCoinService virtualCoinService; @Autowired private FvirtualcaptualoperationService fvirtualcaptualoperationService; //保存最后一个交易记录 virtualCoinId-->address private Map<Integer, String> tradeRecordMap = new HashMap<Integer, String>(); public String getLastTradeRecordMap(Integer key) { return this.tradeRecordMap.get(key); } public void setTradeRecordMap(Integer key, String value) { synchronized (tradeRecordMap) { this.tradeRecordMap.put(key, value); } } private Map<Integer, Map<String, Fvirtualcaptualoperation>> map = new HashMap<Integer, Map<String, Fvirtualcaptualoperation>>(); public Integer[] getKeys() { Object[] objs = map.keySet().toArray(); Integer[] ints = new Integer[objs.length]; for (int i = 0; i < objs.length; i++) { ints[i] = (Integer) objs[i]; } return ints; } public String[] getSubKeys(int id) { Map<String, Fvirtualcaptualoperation> subMap = this.map.get(id); if (subMap == null) { subMap = new HashMap<>(); } Object[] objs = subMap.keySet().toArray(); String[] rets = new String[objs.length]; for (int i = 0; i < objs.length; i++) { rets[i] = (String) objs[i]; } return rets; } public void put(int id, Map<String, Fvirtualcaptualoperation> subMap) { synchronized (this) { this.map.put(id, subMap); } } public Fvirtualcaptualoperation subGet(int id, String key) { Map<String, Fvirtualcaptualoperation> subMap = this.map.get(id); if (subMap != null) { return subMap.get(key); } return null; } public void subPut(int id, String key, Fvirtualcaptualoperation Fvirtualcaptualoperation) { synchronized (this) { Map<String, Fvirtualcaptualoperation> subMap = this.map.get(id); if (subMap == null) { subMap = new HashMap<>(); } subMap.put(key, Fvirtualcaptualoperation); this.map.put(id, subMap); } } public void subRemove(int id, String key) { synchronized (this) { Map<String, Fvirtualcaptualoperation> subMap = this.map.get(id); if (subMap != null) { subMap.remove(key); this.map.put(id, subMap); } } } public void init() { readData(); } private void readData() { List<Fvirtualcointype> fvirtualcointypes = this.virtualCoinService.findFvirtualCoinTypeByStatus(VirtualCoinTypeStatusEnum.Normal); for (Fvirtualcointype fvirtualcointype : fvirtualcointypes) { Map<String, Fvirtualcaptualoperation> tMap = new HashMap<String, Fvirtualcaptualoperation>(); Integer type = VirtualCapitalOperationTypeEnum.COIN_IN; List<Integer> statusList = new ArrayList<>(); statusList.add(VirtualCapitalOperationInStatusEnum.WAIT_0); statusList.add(VirtualCapitalOperationInStatusEnum.WAIT_1); statusList.add(VirtualCapitalOperationInStatusEnum.WAIT_2); Integer symbol = fvirtualcointype.getFid(); List<Fvirtualcaptualoperation> fvirtualcaptualoperations = fvirtualcaptualoperationService.findFvirtualcaptualoperation(type, null, statusList, symbol); for (Fvirtualcaptualoperation fvirtualcaptualoperation : fvirtualcaptualoperations) { tMap.put(fvirtualcaptualoperation.getFtradeuniquenumber(), fvirtualcaptualoperation); System.out.print(fvirtualcaptualoperation.getFtradeuniquenumber()); } this.put(fvirtualcointype.getFid(), tMap); } } public void clear() { this.map = null; } }
package com.cz.android.datastructure; import com.cz.android.datastructure.arraymap.ArrayMap; import org.junit.Test; import java.util.HashMap; /** * @author Created by cz * @date 2020/7/6 4:02 PM * @email bingo110@126.com */ public class ArrayMapTester { @Test public void hashMapTest(){ long st = System.currentTimeMillis(); HashMap<Integer,Integer> hashMap=new HashMap<>(); for(int i=1000000;i>=0;i--){ hashMap.put(i,i); } System.out.println("time1:"+(System.currentTimeMillis()-st)); st=System.currentTimeMillis(); ArrayMap arrayMap=new ArrayMap<Integer,Integer>(); for(int i=1000000;i>=0;i--){ arrayMap.put(i,i); } System.out.println("time2:"+(System.currentTimeMillis()-st)); // time1:131 // time2:64 } }
package com.fabianlopez.mainscopetest.entities; public class Contact { private Integer idContact; private String name; private String email; private String phone; private String department; private Integer idClient; public Contact() { } public Contact(String name, String email, String phone, String department, Integer idClient) { super(); this.name = name; this.email = email; this.phone = phone; this.department = department; this.idClient = idClient; } public Contact(Integer idContact, String name, String email, String phone, String department) { super(); this.idContact = idContact; this.name = name; this.email = email; this.phone = phone; this.department = department; } public Integer getIdContact() { return idContact; } public void setIdContact(Integer idContact) { this.idContact = idContact; } public String getName() { return name; } public void setName(String name) { this.name = name; } 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 getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public Integer getIdClient() { return idClient; } public void setIdClient(Integer idClient) { this.idClient = idClient; } public String toSqlString() { return "null"+",'"+this.name+"',"+"'"+this.email+"',"+"'"+this.phone+"',"+ "'"+this.department+"',"+"'"+this.idClient+"'"; } public String toUpdateSqlString() { return "name='"+this.name+"',"+"email='"+this.email+"',"+"phone='"+this.phone+"',"+ "department='"+this.department+"' WHERE id_contact="+this.idContact; } }
package com.apprisingsoftware.xmasrogue.entity; import java.util.List; import java.util.Random; import java.util.stream.Collectors; public final class Attack { private final String verb; private final double damage; private final double weight; public Attack(String verb, double damage, double weight) { if (verb == null || damage < 0 || weight < 0) throw new IllegalArgumentException(); this.verb = verb; this.damage = damage; this.weight = weight; } public Attack(String verb, double damage) { this(verb, damage, 1); } public String getVerb() { return verb; } public double getDamage() { return damage; } private double getWeight() { return weight; } public static Attack selectAttack(List<Attack> attacks, Random random) { if (attacks == null || attacks.isEmpty() || random == null) throw new IllegalArgumentException(); double totalWeight = attacks.stream().collect(Collectors.summingDouble(Attack::getWeight)); double rand = random.nextDouble() * totalWeight; for (Attack attack : attacks) { rand -= attack.getWeight(); if (rand < 0) return attack; } throw new AssertionError(); } }
package com.xiaoxiao.service.backend.impl; import com.xiaoxiao.pojo.XiaoxiaoSorts; import com.xiaoxiao.pojo.vo.XiaoxiaoSortsVo; import com.xiaoxiao.service.RedisSortsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.util.List; import java.util.concurrent.TimeUnit; /** * _ooOoo_ * o8888888o * 88" . "88 * (| -_- |) * O\ = /O * ____/`---'\____ * .' \\| |// `. * / \\||| : |||// \ * / _||||| -:- |||||- \ * | | \\\ - /// | | * | \_| ''\---/'' | | * \ .-\__ `-` ___/-. / * ___`. .' /--.--\ `. . __ * ."" '< `.___\_<|>_/___.' >'"". * | | : `- \`.;`\ _ /`;.`/ - ` : | | * \ \ `-. \_ __\ /__ _/ .-` / / * ======`-.____`-.___\_____/___.-`____.-'====== * `=---=' * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * 佛祖保佑 永无BUG * 佛曰: * 写字楼里写字间,写字间里程序员; * 程序人员写程序,又拿程序换酒钱。 * 酒醒只在网上坐,酒醉还来网下眠; * 酒醉酒醒日复日,网上网下年复年。 * 但愿老死电脑间,不愿鞠躬老板前; * 奔驰宝马贵者趣,公交自行程序员。 * 别人笑我忒疯癫,我笑自己命太贱; * 不见满街漂亮妹,哪个归得程序员? * * @project_name:xiaoxiao_final_blogs * @date:2019/12/1:21:32 * @author:shinelon * @Describe: */ @Service public class RedisSortsServiceImpl implements RedisSortsService { @Autowired private RedisTemplate<String, Object> redisTemplate; /** * 缓存后台信息分类列表 */ @Value("${SORTS_KEY}") private String SORTS_KEY; /** * 缓存首页分类文章个数 */ @Value("${INDEX_SORTS_KEY}") private String INDEX_SORTS_KEY; /** * 缓存分类信息到redis中 * @param sorts */ @Override public void insertSortAllToRedis(List<XiaoxiaoSorts> sorts) { this.redisTemplate.opsForValue().set(this.SORTS_KEY, sorts); } /** *获取redis中的缓存 * @return */ @Override public List<XiaoxiaoSorts> getSortsAllToRedis() { return (List<XiaoxiaoSorts>) this.redisTemplate.opsForValue().get(this.SORTS_KEY); } /** * 删除后台缓存的分类列表 */ @Override public void deleteSortsAllToRedis() { this.redisTemplate.delete(this.SORTS_KEY); } /** *缓存首页分类文章信息 * @param sortsVos */ @Override public void insertIndexSortsAllToRedis(List<XiaoxiaoSortsVo> sortsVos) { this.redisTemplate.opsForValue().set(this.INDEX_SORTS_KEY, sortsVos, 1, TimeUnit.DAYS); } /** * 获取首页分类信息 * @return */ @Override public List<XiaoxiaoSortsVo> getIndexSortsAllToRedis() { return (List<XiaoxiaoSortsVo>) this.redisTemplate.opsForValue().get(this.INDEX_SORTS_KEY); } /** * 删除首页分类文章显示缓存信息 */ @Override public void deleteIndexSortsAllToRedis() { this.redisTemplate.delete(this.INDEX_SORTS_KEY); } }
package br.org.funcate.glue.os.model; public class OSState { private static String user; private static String Address; private static boolean isAuth; private static String osOnMap; public OSState() { super(); setAuth(false); setUser(""); setAddress(""); } public static String getUser() { return user; } public static void setUser(String user) { OSState.user = user; } /** * retrieves the authentication state, if logged in or not * * @return boolean: state */ public static boolean isAuth() { return isAuth; } /** * set the authentication state, if logged in or not * * @return boolean: state */ public static void setAuth(boolean isAuth) { OSState.isAuth = isAuth; } /** * retrieve last searched address * * @return string: address */ public static String getAddress() { return Address; } /** * set the last searched address in memory. */ public static void setAddress(String address) { Address = address; } public static void setOsOnMap(String ip) { osOnMap = ip; } public static String getOsOnMap() { return osOnMap; } }
/** * @author Mie Plougstrup, Anders Abildgaard, Bo Stokholm * @Version 16-12-2014 */ package dbLayer; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; import modelLayer.Booking; import modelLayer.ChartecCode; import modelLayer.Disposition; import modelLayer.Driver; import modelLayer.Trailer; public class DbDisposition { private Connection con; private DbDriver dbDriver; private DbTrailer dbTrailer; private DbChartecCode dbChartecCode; private DbBooking dbBooking; /** * Constructor */ public DbDisposition() { con = DbConnection.getInstance().getDBcon(); dbDriver = new DbDriver(); dbTrailer = new DbTrailer(); dbChartecCode = new DbChartecCode(); dbBooking = new DbBooking(); } /** * Method for retrieving an disposition object from the database. * * @param dispId The id of the disposition. * @param retrieveAssociation True if associations are wanted, false if not. * @return The disposition object. */ public Disposition retrieveById(int dispId, boolean retrieveAssociation) { String wClause = "dispId = " + dispId; return singleWhere(wClause, retrieveAssociation); } /** * Method for retrieving dispositions belonging to a specific dispositionList. * * @param dispListId The id of the dispositionList. * @param retrieveAssociation True if associations are wanted, false if not. * @return An ArrayList of dispositions. */ public ArrayList<Disposition> retrieveByDispList(int dispListId, boolean retrieveAssociation) { String wClause = "dispListId = " + dispListId; return multiWhere(wClause, retrieveAssociation); } /** * Method for inserting data into disposition table in database. * * @param dispListId The disposition list id. * @param disp The disposition object. * @return Number of rows affected in database. * @throws Exception */ public int insertIntoDisposition(Disposition disp, int dispListId) throws Exception { int rc = -1; //Rows affected in database PreparedStatement prpStmt = null; String query = "INSERT INTO disposition(dispId, chartecNo, dispListId, driverId, trailerId, chartecCode, deliveryNo) " + "VALUES (?,?,?,?,?,?,?)"; try { prpStmt = con.prepareStatement(query); prpStmt.setInt(1, disp.getDispId()); prpStmt.setInt(2, disp.getChartecNo()); prpStmt.setInt(3, dispListId); prpStmt.setInt(4, disp.getDriver().getDriverId()); prpStmt.setInt(5, disp.getTrailer().getTrailerId()); prpStmt.setInt(6, disp.getChartecCode().getChartecCode()); prpStmt.setString(7, disp.getDeliveryNo()); prpStmt.setQueryTimeout(5); rc = prpStmt.executeUpdate(); prpStmt.close(); } catch(Exception e) { throw new Exception("Insert into disposition exception: " + e.getMessage()); } return rc; } /** * Method for inserting data into bookingSequence table in database. * * @param dispId The id of the disposition. * @param sequenceNo The sequence no the booking is placed on. * @param bookingId The id of the booking. * @return Number of rows affected in database. * @throws Exception */ public int insertIntoBookingSequence(int dispId, int sequenceNo, int bookingId) throws Exception { int rc = -1; //Rows affected in database PreparedStatement prpStmt = null; //System.out.println("SequenceNo: " + sequenceNo); String query = "INSERT INTO bookingSequence(dispId, sequenceNo, bookingId) " + "VALUES (?,?,?)"; try { prpStmt = con.prepareStatement(query); prpStmt.setInt(1, dispId); prpStmt.setInt(2, sequenceNo); prpStmt.setInt(3, bookingId); prpStmt.setQueryTimeout(5); rc = prpStmt.executeUpdate(); prpStmt.close(); } catch(Exception e) { throw new Exception("Insert into bookingSequence exception: " + e.getMessage()); } return rc; } /** * Method for updating data about a disposition in the database. * * @param dispListId The disposition list id. * @param disp The disposition object. * @return Number of rows affected in database. * @throws Exception */ public int update(Disposition disp, int dispListId) throws Exception { int rc = -1; //Rows affected in database String query = "UPDATE disposition SET " + "chartecNo = " + disp.getChartecNo() + ", dispListId = " + dispListId + ", driverId = " + disp.getDriver().getDriverId() + ", trailerId = " + disp.getTrailer().getTrailerId() + ", chartecCode = " + disp.getChartecCode().getChartecCode() + ", deliveryNo = '" + disp.getDeliveryNo() + "' WHERE dispId = " + disp.getDispId(); try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); rc = stmt.executeUpdate(query); stmt.close(); } catch(Exception e) { throw new Exception("Update exception in disposition db: " + e); } rc += updateBookingSequence(disp); return rc; } /** * Method for updating all bookings associated to one disposition in the database. * * @param disp The disposition object. * @return Number of rows affected in database. * @throws Exception */ public int updateBookingSequence(Disposition disp) throws Exception { int rc = 1; //Rows affected in database Set<Integer> keyList = disp.getBookings().keySet(); if (keyList.size() < bookingSequenceTableCount(disp.getDispId())) { for (int key = keyList.size() + 1; key <= bookingSequenceTableCount(disp.getDispId()); key ++) { rc += deleteFromBookingSequence(disp.getDispId(), key); } } for (int key : keyList) { int sequenceNo = key; int bookingId = disp.getBookings().get(key).getBookingId(); String query = "UPDATE bookingSequence SET bookingId = " + bookingId + " WHERE dispId = " + disp.getDispId() + " AND sequenceNo = " + sequenceNo; System.out.println(query); try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); rc += stmt.executeUpdate(query); stmt.close(); } catch (Exception e) { throw new Exception("Update exception in disposition db: " + e); } } return rc; } /** * Method for deleting a disposition from the database. * * @param disp The disposition object. * @return Number of rows affected in database. * @throws Exception */ public int deleteFromDisposition(Disposition disp) throws Exception { int rc = -1; //Rows affected in database String query = "DELETE FROM disposition WHERE dispId = " + disp.getDispId(); try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); rc = stmt.executeUpdate(query); stmt.close(); } catch (Exception e) { throw new Exception("Delete exception in disposition db: " + e); } return rc; } /** * Method used when bookingSequence is updated. * * @param dispId The id of the disposition. * @param sequenceNo The sequence no of the booking. * @return Number of rows affected in database. * @throws Exception */ private int deleteFromBookingSequence(int dispId, int sequenceNo) throws Exception { int rc = -1; //Rows affected in database String query = "DELETE FROM bookingSequence WHERE dispId = " + dispId + " AND sequenceNo = " + sequenceNo; System.out.println(query); try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); rc = stmt.executeUpdate(query); stmt.close(); } catch (Exception e) { throw new Exception("Delete from bookingSequence exception: " + e.getMessage()); } return rc; } /** * Method that returns a list of disposition objects. * MultiWhere is used when we select more than one disposition from the database. * * @param wClause The where-clause in the select query. * @param retrieveAssociation True if associations are wanted, false if not. * @return ArrayList containing Disposition objects. */ private ArrayList<Disposition> multiWhere(String wClause, boolean retrieveAssociation) { ResultSet results; ArrayList<Disposition> list = new ArrayList<Disposition>(); String query = buildSelectQuery(wClause); try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); results = stmt.executeQuery(query); while (results.next()) { Disposition dispObj = buildDisposition(results); list.add(dispObj); } stmt.close(); if (retrieveAssociation) { for(Disposition dispObj : list) { retrieveAssociation(dispObj); } } } catch(Exception e) {} return list; } /** * Method that returns an disposition object. * SingleWhere is used when we only select one disposition from the database. * * @param wClause The where-clause in the select query. * @param retrieveAssociation True if associations are wanted, false if not. * @return The disposition object. */ private Disposition singleWhere(String wClause, boolean retrieveAssociation) { ResultSet results; Disposition dispObj = new Disposition(); String query = buildSelectQuery(wClause); try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); results = stmt.executeQuery(query); if (results.next()) { dispObj = buildDisposition(results); stmt.close(); if (retrieveAssociation) { retrieveAssociation(dispObj); } } else { dispObj = null; } } catch(Exception e) {} return dispObj; } /** * Method that builds the SQL select query. * * @param wClause The where-clause in the query. * @return The query string. */ private String buildSelectQuery(String wClause) { String query = "SELECT dispId, chartecNo, dispListId, driverId, trailerId, chartecCode, deliveryNo FROM Disposition"; if (wClause.length() > 0) { query += " WHERE " + wClause; } return query; } /** * Method that builds the disposition object from data retrieved in the datebase. * * @param results The resultSet returned from the database. * @return The disposition object. */ private Disposition buildDisposition(ResultSet results) { Disposition dispObj = new Disposition(); try { dispObj.setDispId(results.getInt("dispId")); dispObj.setChartecNo(results.getInt("chartecNo")); dispObj.setDriver(new Driver(results.getInt("driverId"))); dispObj.setTrailer(new Trailer(results.getInt("trailerId"))); dispObj.setChartecCode(new ChartecCode(results.getInt("chartecCode"))); dispObj.setDeliveryNo(results.getString("deliveryNo")); dispObj.setBookings(new HashMap<Integer, Booking>()); } catch (Exception e) {} return dispObj; } /** * Method that adds all associations to an disposition object. * * @param dispObj The disposition object. */ private void retrieveAssociation(Disposition dispObj) { int driverId = dispObj.getDriver().getDriverId(); Driver driver = dbDriver.retrieveById(driverId); dispObj.setDriver(driver); int trailerId = dispObj.getTrailer().getTrailerId(); Trailer trailer = dbTrailer.retrieveById(trailerId); dispObj.setTrailer(trailer); int chartecCode = dispObj.getChartecCode().getChartecCode(); ChartecCode cCode = dbChartecCode.retrieveByCode(chartecCode); dispObj.setChartecCode(cCode); HashMap<Integer,Booking> bookings = retrieveBookingListByDispId(dispObj.getDispId()); dispObj.setBookings(bookings); } /** * Method that builds and returns a HashMap containing Bookings. * * @param dispId The id of the disposition. * @return The HashMap. */ private HashMap<Integer, Booking> retrieveBookingListByDispId(int dispId) { HashMap<Integer,Booking> list = new HashMap<Integer,Booking>(); String query = "SELECT sequenceNo, bookingId FROM BookingSequence " + " WHERE dispId = " + dispId; ResultSet results; try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); results = stmt.executeQuery(query); while(results.next()) { int key = results.getInt("sequenceNo"); Booking b = dbBooking.retrieveById(results.getInt("bookingId")); list.put(key, b); } stmt.close(); } catch(Exception e) {} return list; } /** * Method that counts the number of bookings for one dispId in the database. * * @param dispId * @return The number of bookings in the database for the dispId. */ private int bookingSequenceTableCount(int dispId) { int tableCount = 0; ResultSet results; try { Statement stmt = con.createStatement(); stmt.setQueryTimeout(5); results = stmt.executeQuery("select COUNT(*) from bookingSequence where dispId = " + dispId); if (results.next() ) { tableCount = results.getInt(1); stmt.close(); } else { tableCount = 0; } } catch (Exception e) {} return tableCount; } }
package english.parser.implementations.map; import include.learning.perceptron.PackedScoreMap; import include.linguistics.Word; import include.linguistics.english.ESetOfLabels; import include.linguistics.english.WordESetOfLabels; import english.dependency.label.EDependencyLabel; @SuppressWarnings("serial") public final class WordESetOfLabelsMap extends PackedScoreMap<WordESetOfLabels> { public WordESetOfLabelsMap(final String input_name, final int table_size) { super(input_name, table_size); } @Override public WordESetOfLabels loadKeyFromString(final String str) { String[] args = str.split(" , "); ESetOfLabels tagset = new ESetOfLabels(); String[] subargs = args[1].substring(2, args[1].length() - 1).split(" "); if (!subargs[0].isEmpty()) { for (int i = 0; i < subargs.length; ++i) { tagset.add(EDependencyLabel.code(subargs[i])); } } return new WordESetOfLabels(new Word(args[0].substring(1, args[0].length() - 1)), tagset); } @Override public String generateStringFromKey(final WordESetOfLabels key) { String retval = "[" + key.first().toString() + "] , [ "; ESetOfLabels sot = key.second(); for (int label = 0; label < EDependencyLabel.COUNT; ++label) { if (sot.contains(label)) { retval += (EDependencyLabel.str(label) + " "); } } return retval + "]"; } @Override public WordESetOfLabels allocate_key(final WordESetOfLabels key) { return new WordESetOfLabels(key); } }
package fixit.model; //@Entity public class Location { // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) public final long id; public final long longtitude; public final long latitude; public Location(long id, long longtitude, long latitude) { this.id = id; this.longtitude = longtitude; this.latitude = latitude; } }
package br.com.maven.produtos_mvn; /** * Hello world! * */ public class App { public static void main(String[] args) { Produto produto = new Produto(args[0], Double.parseDouble(args[1])); System.out.println(produto.getNome() + " " + produto.getPreco()); System.out.println(produto); } }
import java.time.LocalDateTime; import java.util.ArrayList; public class Person { public int uid; public static int uidList; public ArrayList<ServiceAction> serviceActions = new ArrayList<>(); public ArrayList<TenantAlert> tenentsAlerts = new ArrayList<>(); public ArrayList<TenantAlert> rentInfo = new ArrayList<>(); public String firstName; public String lastName; public long pesel; public Address address; public LocalDateTime dateOfBirth; public LocalDateTime firstRent; public Person() { this.uid = ++uidList; this.address = new Address(); this.firstRent = null; this.generateRandomName(); this.generatePesel(); } private void generatePesel() { LocalDateTime localDateTime = LocalDateTime.of(random_int(1920, 2021), random_int(1, 12), random_int(1, 28), random_int(1, 24), random_int(1, 60)); dateOfBirth = localDateTime; String year = localDateTime.getYear() + ""; String month = localDateTime.getMonthValue() + ""; String day = localDateTime.getDayOfMonth() + ""; String pesel = year.charAt(2) + "" + year.charAt(3); if (Integer.parseInt(month) > 9) { if (Integer.parseInt(year.charAt(0) + "") == 2) { pesel += "" + (Integer.parseInt(month) + 10); } else { pesel += "" + month; } } else { if (Integer.parseInt(year.charAt(0) + "") == 2) { pesel += (Integer.parseInt(month) + 10); } else { pesel += "0" + month; } } if (Integer.parseInt(day) > 9) { pesel += "" + day; } else { pesel += "0" + day; } pesel += "" + random_int(100, 999); int[] maleNumbers = new int[]{1, 3, 5, 7, 9}; pesel += "" + maleNumbers[(int) (Math.random() * 4)]; int[] peselWeight = new int[]{1, 3, 7, 9, 1, 3, 7, 9, 1, 3}; int validationSum = 0; int multiplyResult = 0; for (int index = 0; index < 10; index++) { multiplyResult += Integer.parseInt(pesel.charAt(index) + "") * peselWeight[index]; } pesel += (multiplyResult % 10) + ""; this.pesel = Long.parseLong(pesel); } public Person(int num, String firstName, String lastName) { this.uid = 0; this.address = new Address(); this.firstRent = null; this.firstName = firstName; this.lastName = lastName; } public void generateRandomName() { String[] secondNames = new String[]{"Antoni", "Jan", "Franciszek", "Szymon", "Bartosz", "Aleksander", "Jakub", "Mateusz", "Michał", "Piotr", "Sebastian"}; String[] firstNames = new String[]{"Nowak", "Kowalski", "Wiśniewski", "Wójcik", "Kowalczyk", "Kamiński", "Lewandowski", "Zieliński", "Szymański", "Woźniak", "Krupa"}; this.firstName = firstNames[(int) (Math.random() * 11)]; this.lastName = secondNames[(int) (Math.random() * 11)]; } public void addRent(LocalDateTime end, int building, int room, roomTypes type, int price) { this.rentInfo.add(new TenantAlert(end, building, room, type, price, TenantAlertType.rented)); } public int random_int(int Min, int Max) { return (int) (Math.random() * (Max - Min)) + Min; } }
package com.kingfish.show.mybatis.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class ShowsExample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table shows * * @mbg.generated */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table shows * * @mbg.generated */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table shows * * @mbg.generated */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public ShowsExample() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table shows * * @mbg.generated */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table shows * * @mbg.generated */ protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andGmtCreateIsNull() { addCriterion("gmt_create is null"); return (Criteria) this; } public Criteria andGmtCreateIsNotNull() { addCriterion("gmt_create is not null"); return (Criteria) this; } public Criteria andGmtCreateEqualTo(Date value) { addCriterion("gmt_create =", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateNotEqualTo(Date value) { addCriterion("gmt_create <>", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateGreaterThan(Date value) { addCriterion("gmt_create >", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateGreaterThanOrEqualTo(Date value) { addCriterion("gmt_create >=", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateLessThan(Date value) { addCriterion("gmt_create <", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateLessThanOrEqualTo(Date value) { addCriterion("gmt_create <=", value, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateIn(List<Date> values) { addCriterion("gmt_create in", values, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateNotIn(List<Date> values) { addCriterion("gmt_create not in", values, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateBetween(Date value1, Date value2) { addCriterion("gmt_create between", value1, value2, "gmtCreate"); return (Criteria) this; } public Criteria andGmtCreateNotBetween(Date value1, Date value2) { addCriterion("gmt_create not between", value1, value2, "gmtCreate"); return (Criteria) this; } public Criteria andGmtModifyIsNull() { addCriterion("gmt_modify is null"); return (Criteria) this; } public Criteria andGmtModifyIsNotNull() { addCriterion("gmt_modify is not null"); return (Criteria) this; } public Criteria andGmtModifyEqualTo(Date value) { addCriterion("gmt_modify =", value, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyNotEqualTo(Date value) { addCriterion("gmt_modify <>", value, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyGreaterThan(Date value) { addCriterion("gmt_modify >", value, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyGreaterThanOrEqualTo(Date value) { addCriterion("gmt_modify >=", value, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyLessThan(Date value) { addCriterion("gmt_modify <", value, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyLessThanOrEqualTo(Date value) { addCriterion("gmt_modify <=", value, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyIn(List<Date> values) { addCriterion("gmt_modify in", values, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyNotIn(List<Date> values) { addCriterion("gmt_modify not in", values, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyBetween(Date value1, Date value2) { addCriterion("gmt_modify between", value1, value2, "gmtModify"); return (Criteria) this; } public Criteria andGmtModifyNotBetween(Date value1, Date value2) { addCriterion("gmt_modify not between", value1, value2, "gmtModify"); return (Criteria) this; } public Criteria andContentIsNull() { addCriterion("content is null"); return (Criteria) this; } public Criteria andContentIsNotNull() { addCriterion("content is not null"); return (Criteria) this; } public Criteria andContentEqualTo(String value) { addCriterion("content =", value, "content"); return (Criteria) this; } public Criteria andContentNotEqualTo(String value) { addCriterion("content <>", value, "content"); return (Criteria) this; } public Criteria andContentGreaterThan(String value) { addCriterion("content >", value, "content"); return (Criteria) this; } public Criteria andContentGreaterThanOrEqualTo(String value) { addCriterion("content >=", value, "content"); return (Criteria) this; } public Criteria andContentLessThan(String value) { addCriterion("content <", value, "content"); return (Criteria) this; } public Criteria andContentLessThanOrEqualTo(String value) { addCriterion("content <=", value, "content"); return (Criteria) this; } public Criteria andContentLike(String value) { addCriterion("content like", value, "content"); return (Criteria) this; } public Criteria andContentNotLike(String value) { addCriterion("content not like", value, "content"); return (Criteria) this; } public Criteria andContentIn(List<String> values) { addCriterion("content in", values, "content"); return (Criteria) this; } public Criteria andContentNotIn(List<String> values) { addCriterion("content not in", values, "content"); return (Criteria) this; } public Criteria andContentBetween(String value1, String value2) { addCriterion("content between", value1, value2, "content"); return (Criteria) this; } public Criteria andContentNotBetween(String value1, String value2) { addCriterion("content not between", value1, value2, "content"); return (Criteria) this; } public Criteria andTruthIsNull() { addCriterion("truth is null"); return (Criteria) this; } public Criteria andTruthIsNotNull() { addCriterion("truth is not null"); return (Criteria) this; } public Criteria andTruthEqualTo(Double value) { addCriterion("truth =", value, "truth"); return (Criteria) this; } public Criteria andTruthNotEqualTo(Double value) { addCriterion("truth <>", value, "truth"); return (Criteria) this; } public Criteria andTruthGreaterThan(Double value) { addCriterion("truth >", value, "truth"); return (Criteria) this; } public Criteria andTruthGreaterThanOrEqualTo(Double value) { addCriterion("truth >=", value, "truth"); return (Criteria) this; } public Criteria andTruthLessThan(Double value) { addCriterion("truth <", value, "truth"); return (Criteria) this; } public Criteria andTruthLessThanOrEqualTo(Double value) { addCriterion("truth <=", value, "truth"); return (Criteria) this; } public Criteria andTruthIn(List<Double> values) { addCriterion("truth in", values, "truth"); return (Criteria) this; } public Criteria andTruthNotIn(List<Double> values) { addCriterion("truth not in", values, "truth"); return (Criteria) this; } public Criteria andTruthBetween(Double value1, Double value2) { addCriterion("truth between", value1, value2, "truth"); return (Criteria) this; } public Criteria andTruthNotBetween(Double value1, Double value2) { addCriterion("truth not between", value1, value2, "truth"); return (Criteria) this; } public Criteria andPraiseIsNull() { addCriterion("praise is null"); return (Criteria) this; } public Criteria andPraiseIsNotNull() { addCriterion("praise is not null"); return (Criteria) this; } public Criteria andPraiseEqualTo(Integer value) { addCriterion("praise =", value, "praise"); return (Criteria) this; } public Criteria andPraiseNotEqualTo(Integer value) { addCriterion("praise <>", value, "praise"); return (Criteria) this; } public Criteria andPraiseGreaterThan(Integer value) { addCriterion("praise >", value, "praise"); return (Criteria) this; } public Criteria andPraiseGreaterThanOrEqualTo(Integer value) { addCriterion("praise >=", value, "praise"); return (Criteria) this; } public Criteria andPraiseLessThan(Integer value) { addCriterion("praise <", value, "praise"); return (Criteria) this; } public Criteria andPraiseLessThanOrEqualTo(Integer value) { addCriterion("praise <=", value, "praise"); return (Criteria) this; } public Criteria andPraiseIn(List<Integer> values) { addCriterion("praise in", values, "praise"); return (Criteria) this; } public Criteria andPraiseNotIn(List<Integer> values) { addCriterion("praise not in", values, "praise"); return (Criteria) this; } public Criteria andPraiseBetween(Integer value1, Integer value2) { addCriterion("praise between", value1, value2, "praise"); return (Criteria) this; } public Criteria andPraiseNotBetween(Integer value1, Integer value2) { addCriterion("praise not between", value1, value2, "praise"); return (Criteria) this; } public Criteria andProductIdIsNull() { addCriterion("product_id is null"); return (Criteria) this; } public Criteria andProductIdIsNotNull() { addCriterion("product_id is not null"); return (Criteria) this; } public Criteria andProductIdEqualTo(Long value) { addCriterion("product_id =", value, "productId"); return (Criteria) this; } public Criteria andProductIdNotEqualTo(Long value) { addCriterion("product_id <>", value, "productId"); return (Criteria) this; } public Criteria andProductIdGreaterThan(Long value) { addCriterion("product_id >", value, "productId"); return (Criteria) this; } public Criteria andProductIdGreaterThanOrEqualTo(Long value) { addCriterion("product_id >=", value, "productId"); return (Criteria) this; } public Criteria andProductIdLessThan(Long value) { addCriterion("product_id <", value, "productId"); return (Criteria) this; } public Criteria andProductIdLessThanOrEqualTo(Long value) { addCriterion("product_id <=", value, "productId"); return (Criteria) this; } public Criteria andProductIdIn(List<Long> values) { addCriterion("product_id in", values, "productId"); return (Criteria) this; } public Criteria andProductIdNotIn(List<Long> values) { addCriterion("product_id not in", values, "productId"); return (Criteria) this; } public Criteria andProductIdBetween(Long value1, Long value2) { addCriterion("product_id between", value1, value2, "productId"); return (Criteria) this; } public Criteria andProductIdNotBetween(Long value1, Long value2) { addCriterion("product_id not between", value1, value2, "productId"); return (Criteria) this; } public Criteria andPicsIsNull() { addCriterion("pics is null"); return (Criteria) this; } public Criteria andPicsIsNotNull() { addCriterion("pics is not null"); return (Criteria) this; } public Criteria andPicsEqualTo(String value) { addCriterion("pics =", value, "pics"); return (Criteria) this; } public Criteria andPicsNotEqualTo(String value) { addCriterion("pics <>", value, "pics"); return (Criteria) this; } public Criteria andPicsGreaterThan(String value) { addCriterion("pics >", value, "pics"); return (Criteria) this; } public Criteria andPicsGreaterThanOrEqualTo(String value) { addCriterion("pics >=", value, "pics"); return (Criteria) this; } public Criteria andPicsLessThan(String value) { addCriterion("pics <", value, "pics"); return (Criteria) this; } public Criteria andPicsLessThanOrEqualTo(String value) { addCriterion("pics <=", value, "pics"); return (Criteria) this; } public Criteria andPicsLike(String value) { addCriterion("pics like", value, "pics"); return (Criteria) this; } public Criteria andPicsNotLike(String value) { addCriterion("pics not like", value, "pics"); return (Criteria) this; } public Criteria andPicsIn(List<String> values) { addCriterion("pics in", values, "pics"); return (Criteria) this; } public Criteria andPicsNotIn(List<String> values) { addCriterion("pics not in", values, "pics"); return (Criteria) this; } public Criteria andPicsBetween(String value1, String value2) { addCriterion("pics between", value1, value2, "pics"); return (Criteria) this; } public Criteria andPicsNotBetween(String value1, String value2) { addCriterion("pics not between", value1, value2, "pics"); return (Criteria) this; } public Criteria andPicNumIsNull() { addCriterion("pic_num is null"); return (Criteria) this; } public Criteria andPicNumIsNotNull() { addCriterion("pic_num is not null"); return (Criteria) this; } public Criteria andPicNumEqualTo(Integer value) { addCriterion("pic_num =", value, "picNum"); return (Criteria) this; } public Criteria andPicNumNotEqualTo(Integer value) { addCriterion("pic_num <>", value, "picNum"); return (Criteria) this; } public Criteria andPicNumGreaterThan(Integer value) { addCriterion("pic_num >", value, "picNum"); return (Criteria) this; } public Criteria andPicNumGreaterThanOrEqualTo(Integer value) { addCriterion("pic_num >=", value, "picNum"); return (Criteria) this; } public Criteria andPicNumLessThan(Integer value) { addCriterion("pic_num <", value, "picNum"); return (Criteria) this; } public Criteria andPicNumLessThanOrEqualTo(Integer value) { addCriterion("pic_num <=", value, "picNum"); return (Criteria) this; } public Criteria andPicNumIn(List<Integer> values) { addCriterion("pic_num in", values, "picNum"); return (Criteria) this; } public Criteria andPicNumNotIn(List<Integer> values) { addCriterion("pic_num not in", values, "picNum"); return (Criteria) this; } public Criteria andPicNumBetween(Integer value1, Integer value2) { addCriterion("pic_num between", value1, value2, "picNum"); return (Criteria) this; } public Criteria andPicNumNotBetween(Integer value1, Integer value2) { addCriterion("pic_num not between", value1, value2, "picNum"); return (Criteria) this; } public Criteria andShowTimeIsNull() { addCriterion("show_time is null"); return (Criteria) this; } public Criteria andShowTimeIsNotNull() { addCriterion("show_time is not null"); return (Criteria) this; } public Criteria andShowTimeEqualTo(Date value) { addCriterion("show_time =", value, "showTime"); return (Criteria) this; } public Criteria andShowTimeNotEqualTo(Date value) { addCriterion("show_time <>", value, "showTime"); return (Criteria) this; } public Criteria andShowTimeGreaterThan(Date value) { addCriterion("show_time >", value, "showTime"); return (Criteria) this; } public Criteria andShowTimeGreaterThanOrEqualTo(Date value) { addCriterion("show_time >=", value, "showTime"); return (Criteria) this; } public Criteria andShowTimeLessThan(Date value) { addCriterion("show_time <", value, "showTime"); return (Criteria) this; } public Criteria andShowTimeLessThanOrEqualTo(Date value) { addCriterion("show_time <=", value, "showTime"); return (Criteria) this; } public Criteria andShowTimeIn(List<Date> values) { addCriterion("show_time in", values, "showTime"); return (Criteria) this; } public Criteria andShowTimeNotIn(List<Date> values) { addCriterion("show_time not in", values, "showTime"); return (Criteria) this; } public Criteria andShowTimeBetween(Date value1, Date value2) { addCriterion("show_time between", value1, value2, "showTime"); return (Criteria) this; } public Criteria andShowTimeNotBetween(Date value1, Date value2) { addCriterion("show_time not between", value1, value2, "showTime"); return (Criteria) this; } public Criteria andIsOutsideIsNull() { addCriterion("is_outside is null"); return (Criteria) this; } public Criteria andIsOutsideIsNotNull() { addCriterion("is_outside is not null"); return (Criteria) this; } public Criteria andIsOutsideEqualTo(Boolean value) { addCriterion("is_outside =", value, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideNotEqualTo(Boolean value) { addCriterion("is_outside <>", value, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideGreaterThan(Boolean value) { addCriterion("is_outside >", value, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideGreaterThanOrEqualTo(Boolean value) { addCriterion("is_outside >=", value, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideLessThan(Boolean value) { addCriterion("is_outside <", value, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideLessThanOrEqualTo(Boolean value) { addCriterion("is_outside <=", value, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideIn(List<Boolean> values) { addCriterion("is_outside in", values, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideNotIn(List<Boolean> values) { addCriterion("is_outside not in", values, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideBetween(Boolean value1, Boolean value2) { addCriterion("is_outside between", value1, value2, "isOutside"); return (Criteria) this; } public Criteria andIsOutsideNotBetween(Boolean value1, Boolean value2) { addCriterion("is_outside not between", value1, value2, "isOutside"); return (Criteria) this; } public Criteria andOutsideUserHeadPicIsNull() { addCriterion("outside_user_head_pic is null"); return (Criteria) this; } public Criteria andOutsideUserHeadPicIsNotNull() { addCriterion("outside_user_head_pic is not null"); return (Criteria) this; } public Criteria andOutsideUserHeadPicEqualTo(String value) { addCriterion("outside_user_head_pic =", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicNotEqualTo(String value) { addCriterion("outside_user_head_pic <>", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicGreaterThan(String value) { addCriterion("outside_user_head_pic >", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicGreaterThanOrEqualTo(String value) { addCriterion("outside_user_head_pic >=", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicLessThan(String value) { addCriterion("outside_user_head_pic <", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicLessThanOrEqualTo(String value) { addCriterion("outside_user_head_pic <=", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicLike(String value) { addCriterion("outside_user_head_pic like", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicNotLike(String value) { addCriterion("outside_user_head_pic not like", value, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicIn(List<String> values) { addCriterion("outside_user_head_pic in", values, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicNotIn(List<String> values) { addCriterion("outside_user_head_pic not in", values, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicBetween(String value1, String value2) { addCriterion("outside_user_head_pic between", value1, value2, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserHeadPicNotBetween(String value1, String value2) { addCriterion("outside_user_head_pic not between", value1, value2, "outsideUserHeadPic"); return (Criteria) this; } public Criteria andOutsideUserNicknameIsNull() { addCriterion("outside_user_nickname is null"); return (Criteria) this; } public Criteria andOutsideUserNicknameIsNotNull() { addCriterion("outside_user_nickname is not null"); return (Criteria) this; } public Criteria andOutsideUserNicknameEqualTo(String value) { addCriterion("outside_user_nickname =", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameNotEqualTo(String value) { addCriterion("outside_user_nickname <>", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameGreaterThan(String value) { addCriterion("outside_user_nickname >", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameGreaterThanOrEqualTo(String value) { addCriterion("outside_user_nickname >=", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameLessThan(String value) { addCriterion("outside_user_nickname <", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameLessThanOrEqualTo(String value) { addCriterion("outside_user_nickname <=", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameLike(String value) { addCriterion("outside_user_nickname like", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameNotLike(String value) { addCriterion("outside_user_nickname not like", value, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameIn(List<String> values) { addCriterion("outside_user_nickname in", values, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameNotIn(List<String> values) { addCriterion("outside_user_nickname not in", values, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameBetween(String value1, String value2) { addCriterion("outside_user_nickname between", value1, value2, "outsideUserNickname"); return (Criteria) this; } public Criteria andOutsideUserNicknameNotBetween(String value1, String value2) { addCriterion("outside_user_nickname not between", value1, value2, "outsideUserNickname"); return (Criteria) this; } public Criteria andLikeUserIdsIsNull() { addCriterion("like_user_ids is null"); return (Criteria) this; } public Criteria andLikeUserIdsIsNotNull() { addCriterion("like_user_ids is not null"); return (Criteria) this; } public Criteria andLikeUserIdsEqualTo(String value) { addCriterion("like_user_ids =", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsNotEqualTo(String value) { addCriterion("like_user_ids <>", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsGreaterThan(String value) { addCriterion("like_user_ids >", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsGreaterThanOrEqualTo(String value) { addCriterion("like_user_ids >=", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsLessThan(String value) { addCriterion("like_user_ids <", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsLessThanOrEqualTo(String value) { addCriterion("like_user_ids <=", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsLike(String value) { addCriterion("like_user_ids like", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsNotLike(String value) { addCriterion("like_user_ids not like", value, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsIn(List<String> values) { addCriterion("like_user_ids in", values, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsNotIn(List<String> values) { addCriterion("like_user_ids not in", values, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsBetween(String value1, String value2) { addCriterion("like_user_ids between", value1, value2, "likeUserIds"); return (Criteria) this; } public Criteria andLikeUserIdsNotBetween(String value1, String value2) { addCriterion("like_user_ids not between", value1, value2, "likeUserIds"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table shows * * @mbg.generated do_not_delete_during_merge */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table shows * * @mbg.generated */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
package test.guitest; import static org.junit.Assert.assertEquals; import java.io.File; import org.junit.After; import org.junit.Before; import org.junit.Test; import enduro.registrator.gui.SimpleGUI; public class SimpleGUITest { private SimpleGUI gui; @Before public void setup() { gui = new SimpleGUI(new File("test_out.csv")); } @Test public void startGUITest() { assertEquals(gui.isShowing(), true); } @After public void tearDown() { } }
package com.codepath.examples.audiovideodemo; import android.view.Surface; public class hellotest { static { System.loadLibrary("wtf"); } public static native long nativeDataPush(long handle,byte data[], int type); //1 stands for video 2 stands for audio public static native long nativePicDataPush(long handle, byte data[], int type); //1 stands for video 2 stands for audio public static native long nativeVideoParameters(long handle,int width, int height, int format, int framerate); public static native long nativeAudioParameters(long handle,int channel, int sample_rate, int encod_bit, int bufferSize); public static native long nativeOnCreate(long id, String sip, int stp, int sup); public static native long nativeOnResume(long handle); public static native long nativeOnPause(long handle); public static native long nativeOnStop(long handle); public static native long nativeSetSurface(long handle, Surface surface); // public static native long nativeOnStop(long handle); // public static native long nativeSetSurface(long handle, Surface surface); }
package com.facebook.react.modules.clipboard; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.os.Build; import com.facebook.react.bridge.ContextBaseJavaModule; import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.module.annotations.ReactModule; @ReactModule(name = "Clipboard") public class ClipboardModule extends ContextBaseJavaModule { public ClipboardModule(Context paramContext) { super(paramContext); } private ClipboardManager getClipboardService() { Context context = getContext(); getContext(); return (ClipboardManager)context.getSystemService("clipboard"); } public String getName() { return "Clipboard"; } @ReactMethod public void getString(Promise paramPromise) { try { ClipboardManager clipboardManager = getClipboardService(); ClipData clipData = clipboardManager.getPrimaryClip(); if (clipData == null) { paramPromise.resolve(""); return; } if (clipData.getItemCount() > 0) { ClipData.Item item = clipboardManager.getPrimaryClip().getItemAt(0); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(item.getText()); paramPromise.resolve(stringBuilder.toString()); return; } paramPromise.resolve(""); return; } catch (Exception exception) { paramPromise.reject(exception); return; } } @ReactMethod public void setString(String paramString) { ClipData clipData; if (Build.VERSION.SDK_INT >= 11) { clipData = ClipData.newPlainText(null, paramString); getClipboardService().setPrimaryClip(clipData); return; } getClipboardService().setText((CharSequence)clipData); } } /* Location: C:\Users\august\Desktop\tik\df_rn_kit\classes.jar.jar!\com\facebook\react\modules\clipboard\ClipboardModule.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package com.qgil.mapper; import com.qgil.pojo.QgilBorrowrecord; import com.qgil.pojo.QgilBorrowrecordExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface QgilBorrowrecordMapper { int countByExample(QgilBorrowrecordExample example); int deleteByExample(QgilBorrowrecordExample example); int deleteByPrimaryKey(Long id); int insert(QgilBorrowrecord record); int insertSelective(QgilBorrowrecord record); List<QgilBorrowrecord> selectByExample(QgilBorrowrecordExample example); QgilBorrowrecord selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") QgilBorrowrecord record, @Param("example") QgilBorrowrecordExample example); int updateByExample(@Param("record") QgilBorrowrecord record, @Param("example") QgilBorrowrecordExample example); int updateByPrimaryKeySelective(QgilBorrowrecord record); int updateByPrimaryKey(QgilBorrowrecord record); }
package com.example.boixel.projetamio; import android.content.BroadcastReceiver; import android.content.Context; import android.content.IntentFilter; import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.content.Intent; import android.view.View; import android.widget.*; import org.w3c.dom.Text; import java.util.ArrayList; import java.util.HashMap; import java.util.Random; import static java.lang.Long.parseLong; public class MainActivity extends AppCompatActivity { public static final String RECEIVE_MOTE_INFO = "RECEIVE_MOTE_INFO"; private HashMap<String, Integer> motes; private ArrayList<Integer> views; SharedPreferences sharedPref; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); motes = new HashMap<>(); views = new ArrayList<>(); views.add(R.id.mote1); views.add(R.id.mote2); views.add(R.id.mote3); views.add(R.id.mote4); views.add(R.id.mote5); setContentView(R.layout.activity_main); Log.d("MainActivity", "Creation de l'activité"); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); sharedPref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt("endHours1", 6*60); editor.putInt("beginHours1", 23*60); editor.putInt("endHours2", 23*60); editor.putInt("beginHours2", 19*60); editor.putString("update", "10"); editor.commit(); ToggleButton serviceButton = (ToggleButton) findViewById(R.id.serviceButton); serviceButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){ @Override public void onCheckedChanged(CompoundButton button, boolean isChecked) { Log.d("service", "Button check"); if (button.isChecked()) { startService(new Intent(getBaseContext(), WebService.class)); } else{ stopService(new Intent(getBaseContext(), WebService.class)); } } }); Button settingsButton = (Button) findViewById(R.id.settingsButton); settingsButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { Log.d("settings", "button"); Intent settingsIntent = new Intent(MainActivity.this, Settings.class); MainActivity.this.startActivity(settingsIntent); } }); Button mailButton = (Button) findViewById(R.id.mailButton); mailButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { String mail_adress = sharedPref.getString("mail", "malo.boixel@telecomnancy.net"); TextView moteText = (TextView) findViewById(R.id.mote1); String textMote = moteText.getText().toString()+"\n"; moteText = (TextView) findViewById(R.id.mote2); textMote += moteText.getText().toString()+"\n"; moteText = (TextView) findViewById(R.id.mote3); textMote += moteText.getText().toString()+"\n"; moteText = (TextView) findViewById(R.id.mote4); textMote += moteText.getText().toString()+"\n"; moteText = (TextView) findViewById(R.id.mote5); textMote += moteText.getText().toString()+"\n"; Log.d("mail", "button"); Intent emailIntent = new Intent(Intent.ACTION_SEND); //emailIntent.setData(Uri.parse("mailto:")); emailIntent.setType("message/rfc822"); //emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Economie d'énergie"); emailIntent.putExtra(Intent.EXTRA_TEXT, textMote); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {mail_adress}); startActivity(Intent.createChooser(emailIntent, "Send mail...")); } }); Log.d("all", sharedPref.getAll().toString()); } private BroadcastReceiver bReceiver = new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent intent) { //put here whaterver you want your activity to do with the intent received //Intent i = getIntent(); if(!intent.getAction().equals(RECEIVE_MOTE_INFO)){ return; } Mote mote = intent.getParcelableExtra("mote"); int i; if(motes.containsKey(mote.getAddress())){ i = motes.get(mote.getAddress()); } else { if(motes.values().size()>views.size()){ i = new Random(views.size()).nextInt(); } else { i = motes.values().size(); } motes.put(mote.getAddress(),i); } Log.d("WebService",i+""); ((TextView)findViewById(views.get(i))).setText(mote.toString()); /* TextView moteText; switch(mote.getAddress()){ case "9.138": moteText = (TextView) findViewById(R.id.mote1); moteText.setText(/*"Mote 9.138 "+mote.getLastValue()mote.toString()); break; case "81.77": moteText = (TextView) findViewById(R.id.mote2); moteText.setText("Mote 81.77 "+mote.getLastValue()); break; case "153.111": moteText = (TextView) findViewById(R.id.mote3); moteText.setText("Mote 153.11 "+mote.getLastValue()); break; case "53.105": moteText = (TextView) findViewById(R.id.mote4); moteText.setText("Mote 53.105 "+mote.getLastValue()); break; case "77.106": moteText = (TextView) findViewById(R.id.mote5); moteText.setText("Mote 77.106 "+mote.getLastValue()); break; default: break; } */ TextView time = (TextView) findViewById(R.id.timestamp); } }; protected void onResume(){ super.onResume(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(RECEIVE_MOTE_INFO); LocalBroadcastManager.getInstance(this).registerReceiver(bReceiver, intentFilter); } protected void onPause (){ super.onPause(); LocalBroadcastManager.getInstance(this).unregisterReceiver(bReceiver); } public class MyBroadcastReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Boolean checkBoxState = sharedPref.getBoolean("onBoot", false); Log.d("CheckBoxStatus", checkBoxState.toString()); if(checkBoxState){ if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ Intent i = new Intent(context, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } } } }
package com.milhao; public class RegexUtil { private static final String REGEX_OR = "|"; static String numeroSorteado(int dezena) { String inicioDeLinha = "^" + dezena + ",.*" + REGEX_OR + "^0" + dezena + ",.*"; String finalDeLinha = ".*," + dezena + "$" + REGEX_OR + ".*,0" + dezena + "$"; String meioDeLinha = ".*," + dezena + ",.*" + REGEX_OR + ".*,0" + dezena + ",.*"; return inicioDeLinha + REGEX_OR + finalDeLinha + REGEX_OR + meioDeLinha; } }