text
stringlengths
10
2.72M
package jneiva.hexbattle; import jneiva.hexbattle.tiles.Celula; public class PlanoDeAcao { public Celula alvoMovimento; public Celula alvoAtaque; }
package Main; import GUI.ProgramGUI; import Tools.Constants; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; //java --module-path C:\javafx-sdk-13.0.2\lib --add-modules javafx.controls,javafx.fxml,javafx.graphics,javafx.web -jar STL.jar public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { // Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); Scene scene = new ProgramGUI(primaryStage).getScene(); scene.getStylesheets().add("file:src/Main/style.css"); primaryStage.setTitle(Constants.window_label); primaryStage.setScene(scene); primaryStage.show(); } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pe.gob.onpe.adan.model.adan; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * * @author marrisueno */ @Entity @Table(name = "TAB_ASIGNACION_MESA") public class Mesa implements Serializable{ @Id @Column(name="C_DOCUMENTO_IDENTIDAD") private String C_DOCUMENTO_IDENTIDAD; @Column(name="C_UBIGEO") @JsonProperty("C_UBIGEO") private String C_UBIGEO; @Column(name="C_LOCAL") @JsonProperty("C_LOCAL") private String C_LOCAL; @Column(name="C_MESA") @JsonProperty("C_MESA") private String C_MESA; @Column(name="N_ORDEN") @JsonProperty("N_ORDEN") private Integer N_ORDEN; @Column(name="N_TIPO_SOLUCION") @JsonProperty("N_TIPO_SOLUCION") private Integer N_TIPO_SOLUCION; @Column (name="C_AUD_USUARIO_CREACION",nullable = true) @JsonProperty("C_AUD_USUARIO_CREACION") private String C_AUD_USUARIO_CREACION; @Column (name="D_AUD_FECHA_CREACION",nullable = true) @JsonProperty("D_AUD_FECHA_CREACION") private String D_AUD_FECHA_CREACION; @Column (name="C_AUD_USUARIO_MODIFICACION",nullable = true) @JsonProperty("C_AUD_USUARIO_MODIFICACION") private String C_AUD_USUARIO_MODIFICACION; @Column(name="D_AUD_FECHA_MODIFICACION",nullable = true) @JsonProperty("D_AUD_FECHA_MODIFICACION") private String D_AUD_FECHA_MODIFICACION; public String getC_DOCUMENTO_IDENTIDAD() { return C_DOCUMENTO_IDENTIDAD; } public void setC_DOCUMENTO_IDENTIDAD(String C_DOCUMENTO_IDENTIDAD) { this.C_DOCUMENTO_IDENTIDAD = C_DOCUMENTO_IDENTIDAD; } public String getC_UBIGEO() { return C_UBIGEO; } public void setC_UBIGEO(String C_UBIGEO) { this.C_UBIGEO = C_UBIGEO; } public String getC_LOCAL() { return C_LOCAL; } public void setC_LOCAL(String C_LOCAL) { this.C_LOCAL = C_LOCAL; } public String getC_MESA() { return C_MESA; } public void setC_MESA(String C_MESA) { this.C_MESA = C_MESA; } public Integer getN_ORDEN() { return N_ORDEN; } public void setN_ORDEN(Integer N_ORDEN) { this.N_ORDEN = N_ORDEN; } public Integer getN_TIPO_SOLUCION() { return N_TIPO_SOLUCION; } public void setN_TIPO_SOLUCION(Integer N_TIPO_SOLUCION) { this.N_TIPO_SOLUCION = N_TIPO_SOLUCION; } public String getC_AUD_USUARIO_CREACION() { return C_AUD_USUARIO_CREACION; } public void setC_AUD_USUARIO_CREACION(String C_AUD_USUARIO_CREACION) { this.C_AUD_USUARIO_CREACION = C_AUD_USUARIO_CREACION; } public String getD_AUD_FECHA_CREACION() { return D_AUD_FECHA_CREACION; } public void setD_AUD_FECHA_CREACION(String D_AUD_FECHA_CREACION) { this.D_AUD_FECHA_CREACION = D_AUD_FECHA_CREACION; } public String getC_AUD_USUARIO_MODIFICACION() { return C_AUD_USUARIO_MODIFICACION; } public void setC_AUD_USUARIO_MODIFICACION(String C_AUD_USUARIO_MODIFICACION) { this.C_AUD_USUARIO_MODIFICACION = C_AUD_USUARIO_MODIFICACION; } public String getD_AUD_FECHA_MODIFICACION() { return D_AUD_FECHA_MODIFICACION; } public void setD_AUD_FECHA_MODIFICACION(String D_AUD_FECHA_MODIFICACION) { this.D_AUD_FECHA_MODIFICACION = D_AUD_FECHA_MODIFICACION; } }
package dao; import helper.JdbcHelper; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import model.KhachHang; public class KhachHangDAO { public void insert(KhachHang model) { String sql = "INSERT INTO KhachHang (MaKH, HoTen, NgaySinh, GioiTinh, DienThoai, Email, GhiChu, MaNV) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; JdbcHelper.executeUpdate(sql, model.getMaKH(), model.getHoTen(), model.getNgaySinh(), model.isGioiTinh(), model.getDienThoai(), model.getEmail(), model.getGhiChu(), model.getMaNV()); } public void update(KhachHang model) { String sql = "UPDATE KhachHang SET HoTen=?, NgaySinh=?, GioiTinh=?, DienThoai=?, Email=?, GhiChu=?, MaNV=? WHERE MaKH=?"; JdbcHelper.executeUpdate(sql, model.getHoTen(), model.getNgaySinh(), model.isGioiTinh(), model.getDienThoai(), model.getEmail(), model.getGhiChu(), model.getMaNV(), model.getMaKH()); } public void delete(String id) { String sql = "DELETE FROM KhachHang WHERE MaKH=?"; JdbcHelper.executeUpdate(sql, id); } public List<KhachHang> select() { String sql = "SELECT * FROM KhachHang"; return select(sql); } public List<KhachHang> selectByKeyword(String keyword) { String sql = "SELECT * FROM KhachHang WHERE HoTen LIKE ?"; return select(sql, "%" + keyword + "%"); } public List<KhachHang> selectByCourse(Integer makh) { String sql = "SELECT * FROM KhachHang WHERE MaKH NOT IN (SELECT MaKH FROM HocVien WHERE MaKH=?)"; return select(sql, makh); } public KhachHang findById(String manh) { String sql = "SELECT * FROM KhachHang WHERE MaKH=?"; List<KhachHang> list = select(sql, manh); return list.size() > 0 ? list.get(0) : null; } private List<KhachHang> select(String sql, Object... args) { List<KhachHang> list = new ArrayList<>(); try { ResultSet rs = null; try { rs = JdbcHelper.executeQuery(sql, args); while (rs.next()) { KhachHang model = readFromResultSet(rs); list.add(model); } } finally { rs.getStatement().getConnection().close(); } } catch (SQLException ex) { throw new RuntimeException(ex); } return list; } private KhachHang readFromResultSet(ResultSet rs) throws SQLException { KhachHang model = new KhachHang(); model.setMaKH(rs.getString("MaKH")); model.setHoTen(rs.getString("HoTen")); model.setNgaySinh(rs.getDate("NgaySinh")); model.setGioiTinh(rs.getBoolean("GioiTinh")); model.setDienThoai(rs.getString("DienThoai")); model.setEmail(rs.getString("Email")); model.setGhiChu(rs.getString("GhiChu")); model.setMaNV(rs.getString("MaNV")); model.setNgayMua(rs.getDate("NgayMua")); return model; } }
package problem_solve.basic.baekjoon; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BaekJoon4949 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); while(true){ StackImpl stack = new StackImpl(); char[] arr = new char[101]; char[] nextLine = br.readLine().toCharArray(); System.arraycopy(nextLine, 0, arr, 0, nextLine.length); int startIndex = nextLine.length; while(arr[startIndex-1] != '.'){ nextLine = br.readLine().toCharArray(); System.arraycopy(nextLine, 0, arr, startIndex, nextLine.length); startIndex += nextLine.length; } if(arr[0] == '.'){ break; } boolean isBal = true; for(char c : arr){ if(c == '(' || c == '['){ stack.add(c); } else if(c == ')'){ if(stack.peek() == '('){ stack.pop(); } else { isBal = false; break; } } else if(c == ']'){ if(stack.peek() == '['){ stack.pop(); } else { isBal = false; break; } } else if(c == '.'){ break; } } if(stack.isEmpty() && isBal){ sb.append("yes\n"); } else { sb.append("no\n"); } } System.out.println(sb); br.close(); } static class StackImpl{ int size = 0; int lastIndex = -1; char[] arr = new char[101]; public void add(char c){ arr[++lastIndex] = c; size++; } public char pop(){ char ret = arr[lastIndex]; lastIndex--; size--; return ret; } public char peek(){ if(isEmpty()){ return ' '; } return arr[lastIndex]; } public boolean isEmpty(){ return size==0; } } }
package fanli.selfcode.linkedList; import javax.imageio.ImageTranscoder; import java.util.ArrayList; import java.util.Arrays; public class ReverseList { public static void main(String[] args) { Node n1 = new Node(1); Node n2 = new Node(2); Node n3 = new Node(3); Node n4 = new Node(4); Node n5 = new Node(5); n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n5; printList(n1); System.out.println("链表反转后结果为:"); printList(reverseList(n1)); } public static void printList(Node head){ if(head == null) return; while(head!=null){ System.out.print(head.data +" "); head = head.next; } System.out.println(); } public static Node reverseList(Node head){ if(head == null || head.next == null) return head; Node pre = null; Node tmp = null; while(head != null){ tmp = head; head = head.next; tmp.next = pre; pre = tmp; } return pre; } } class Node{ int data; Node next; public Node(int value){ this.data = value; } }
// 4. 实现一个方法,传入数字数组,按由小到大的顺序输出 public class four{ public static void main(String[] args) { int[] numAry = new int[]{5, 6, 3, 7, 1, 2, 4}; int[] result = new int[]{}; result = sortAry(numAry); for (int k = 0; k < result.length; k ++) { System.out.println(result[k]); } } public static int[] sortAry(int[] numAry){ for (int i = 0; i < numAry.length; i ++) { for (int j = 0; j < numAry.length - 1; j ++) { if (numAry[j] > numAry[j + 1]) { int temp = numAry[j]; numAry[j] = numAry[j + 1]; numAry[j + 1] = temp; } } } return numAry; } }
abstract class UIElement { UI ui; float coordinateX; float coordinateY; abstract void render(); abstract void update(); }
package br.com.conexao; public class Conexao { }
public class HelloGitHub { public static void main(String[] args) { int in=1; while ( in <= 10 ) { System.out.println("Hello GitHub, I'm developer 2! Count is "+in); in++; } } }
package nl.rug.oop.flaps.simulation.view.panels; import lombok.Getter; import lombok.extern.java.Log; import nl.rug.oop.flaps.aircraft_editor.view.panels.aircraft_info.interaction_panels.FuelConfigPanel; import nl.rug.oop.flaps.simulation.controller.AirportSelectionController; import nl.rug.oop.flaps.simulation.controller.SpeedRateUp; import nl.rug.oop.flaps.simulation.model.airport.Airport; import nl.rug.oop.flaps.simulation.model.map.coordinates.GeographicCoordinates; import nl.rug.oop.flaps.simulation.model.map.coordinates.PointProvider; import nl.rug.oop.flaps.simulation.model.map.coordinates.ProjectionMapping; import nl.rug.oop.flaps.simulation.model.trips.Trip; import nl.rug.oop.flaps.simulation.model.world.World; import nl.rug.oop.flaps.simulation.model.world.WorldSelectionModel; import nl.rug.oop.flaps.simulation.model.world.WorldSelectionModelListener; import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.io.IOException; import java.nio.file.Path; import java.util.concurrent.ConcurrentHashMap; /** * Displays the world map and the airport indicators * * @author T.O.W.E.R. */ @Log public class WorldPanel extends JPanel implements WorldSelectionModelListener { public static final double INDICATOR_SIZE = 8; private final BufferedImage worldMapImage; private final World world; private Image cachedWorldMapImage; @Getter public static WorldPanel worldPanel; @Getter private ConcurrentHashMap<Trip, Integer> currentTrips; @Getter private final JSpinner speedUpRate; public WorldPanel(World world) { this.world = world; try { worldMapImage = ImageIO.read(Path.of("images", "map", "world_map_satellite.jpg").toFile()); } catch (IOException e) { log.severe("Could not load world map image."); throw new IllegalStateException(e); } speedUpRate = new JSpinner(); AirportSelectionController selectionController = new AirportSelectionController(world); addMouseMotionListener(selectionController); addMouseListener(selectionController); this.world.getSelectionModel().addListener(this); worldPanel = this; this.setLayout(new BorderLayout()); this.add(speedControlPanel(), BorderLayout.SOUTH); } /** * panel containing the speed controller * */ private JPanel speedControlPanel() { JPanel temp = new JPanel(); GridBagConstraints c = new GridBagConstraints(); FuelConfigPanel.setLayoutOfDisplayPanel(temp, c); temp.add(new JLabel("Speed Rate : ")); speedUpRate.setModel(new SpinnerNumberModel(1.0, 0.5, 4, 0.5)); speedUpRate.addChangeListener(new SpeedRateUp(this)); c.ipadx = 5; c.gridx = 1; temp.add(speedUpRate); return temp; } /** * paints the trips on the world map * */ private void paintTrips(Graphics2D g, Trip trip) { var sm = this.world.getSelectionModel(); if (trip.getIcon() != null) { BufferedImage icon = trip.getIcon(); double s = icon.getWidth() / 2.0; if (sm.getSelectedTrip() != null && sm.getSelectedTrip().equals(trip)) { icon = upscaleIcon(icon); s *= 1.5; paintSteps(g, trip); } int x = (int) (trip.getCurrentPosition().getX() - s); int y = (int) (trip.getCurrentPosition().getY() - s); g.drawImage(icon,x,y, null); } else { drawDots(g, trip, sm); } } /** * draws normal dots when icon is not found * */ private void drawDots(Graphics2D g, Trip trip, WorldSelectionModel sm) { double s; s = INDICATOR_SIZE; g.setColor(Color.GREEN); if (sm.getSelectedTrip() != null && sm.getSelectedTrip().equals(trip)) { s *= 1.5; paintSteps(g, trip); g.setColor(Color.YELLOW); } Shape marker = new Ellipse2D.Double(trip.getCurrentPosition().getX() - s/2, trip.getCurrentPosition().getY()- s/2, s,s); g.fill(marker); } /** * @return the icon image but in 1.5 size * */ private BufferedImage upscaleIcon(BufferedImage icon) { int newWidth = (int) (icon.getWidth(null) * 1.5); int newHeight = (int) (icon.getHeight(null) * 1.5); BufferedImage scaledImage = new BufferedImage(newWidth, newHeight,BufferedImage.TYPE_INT_ARGB); AffineTransform at = new AffineTransform(); at.scale(1.5, 1.5); AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); icon = scaleOp.filter(icon, scaledImage); return icon; } /** * paints the steps of the aircraft * */ private void paintSteps(Graphics2D g, Trip trip) { var start = ProjectionMapping.mercatorToWorld(this.world.getDimensions()) .map(trip.getOriginAirport().getLocation()); var end = trip.getCurrentPosition(); g.setColor(Color.CYAN); Line2D.Double line = new Line2D.Double(start.getPointX(), start.getPointY(), end.x, end.y); g.draw(line); } private void drawAirportIndicator(Graphics2D g, Airport airport) { double s = INDICATOR_SIZE; Color c = Color.RED; var p = ProjectionMapping.mercatorToWorld(this.world.getDimensions()) .map(airport.getGeographicCoordinates()).asPoint(); var sm = this.world.getSelectionModel(); if (sm.getSelectedAirport() != null && sm.getSelectedAirport().equals(airport)) { c = Color.CYAN; s *= 2; } else if (sm.getSelectedDestinationAirport() != null && sm.getSelectedDestinationAirport().equals(airport)) { c = Color.GREEN; s *= 1.5; } g.setColor(c); Shape marker = new Ellipse2D.Double(p.x - s/2, p.y - s/2, s, s); g.fill(marker); } private void drawTrajectory(Graphics2D g) { g.setColor(Color.WHITE); var sm = this.world.getSelectionModel(); // here the user is trying to select a trip as destination (•_•) if (sm.getSelectedAirport() == null) { sm.setSelectingDestination(false); return; } var start = ProjectionMapping.mercatorToWorld(this.world.getDimensions()) .map(sm.getSelectedAirport().getLocation()); var end = new Point2D.Double(sm.getDestinationSelectionCursorX(), sm.getDestinationSelectionCursorY()); var endM = ProjectionMapping.worldToMercator(this.world.getDimensions()) .map(PointProvider.ofPoint(end)); var endGeo = new GeographicCoordinates(endM.getPointX(), endM.getPointY()); double distance = sm.getSelectedAirport().getLocation().distanceTo(endGeo); Color c = distance / 1000 > sm.getSelectedAircraft().getType().getRange() ? Color.RED : Color.WHITE; g.setColor(c); Line2D.Double line = new Line2D.Double(start.getPointX(), start.getPointY(), end.x, end.y); g.draw(line); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.WHITE); g2d.setStroke(new BasicStroke(3)); if (this.cachedWorldMapImage == null) { // Use cached world map image to avoid expensive scaling with each repaint. this.cachedWorldMapImage = this.worldMapImage.getScaledInstance( this.world.getDimensions().getMapWidth(), this.world.getDimensions().getMapHeight(), Image.SCALE_SMOOTH ); } g2d.drawImage(this.cachedWorldMapImage, 0, 0, null); var sm = this.world.getSelectionModel(); if (sm.isSelectingDestination()) { drawTrajectory(g2d); } if (sm.getSelectedDestinationAirport() != null && sm.getSelectedAirport() != null && sm.getSelectedAircraft() != null) { drawPlannedRoute(g2d, sm.getSelectedAirport(), sm.getSelectedDestinationAirport()); } this.world.getAirports().values().forEach(airport -> drawAirportIndicator(g2d, airport)); if (currentTrips != null) { for (Trip trip : currentTrips.keySet()) { paintTrips(g2d, trip); } } } private void drawPlannedRoute(Graphics2D g, Airport selectedAirport, Airport selectedDestinationAirport) { var projectionMapping = ProjectionMapping.mercatorToWorld(this.world.getDimensions()); var start = projectionMapping.map(selectedAirport.getGeographicCoordinates()).asPoint(); var end = projectionMapping.map(selectedDestinationAirport.getGeographicCoordinates()).asPoint(); g.setColor(Color.WHITE); g.draw(new Line2D.Double(start, end)); } /** * adds a trip to the trips list * @param trip the trip to be added * */ public void addTrip(Trip trip) { if (currentTrips == null) { currentTrips = new ConcurrentHashMap<>(); } currentTrips.put(trip, 0); } /** * removes a trip from the trips list * @param trip the trip to be removed * */ public void removeTrip(Trip trip) { currentTrips.remove(trip); } @Override public void airportSelected(Airport selectedAirport) { this.repaint(); } @Override public void destinationAirportSelected(Airport destinationAirport) { this.repaint(); } @Override public void destinationSelectionUpdated() { this.repaint(); } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pboulang.pkg10117185.latihan42.tabungan; /** * * @author user * Nama : Andhyka Widariyanto * NIM : 10117185 * Kelas: PBO-Ulang * Tugas: Menghitung sisa pengambilan saldo */ public class Tabungan { //Atribute int saldo; //Function Tabungan(int adaSaldo){ saldo = adaSaldo; } void cekSaldo (){ System.out.println("Saldo Anda Sekarang : "+ saldo); } int ambilUang(int jumlah){ saldo = saldo - jumlah; return saldo; } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package OS; /** * Created by wei on 2/14/2017. */ public class Dispatcher{ //ControlBlock[] runningQueue; //QQueue runningQueue; //public void multiCPU (int numCPU){ // runningQueue = new ControlBlock[numCPU]; // } /* public void dispatchCPU(CPU cpu){ OSystem oSystem = OSystem.getInstance(); synchronized (oSystem.getReadyQueue()){ ControlBlock controlBlock = OSystem.getInstance().getReadyQueue().popTheQueue(); controlBlock.setStatus(ControlBlock.Status.RUNNING); } } protected ControlBlock getCurrentProcess (int ID){ return runningQueue[ID]; } }*/ public void dispatchCPU(CPU cpu) { OSystem os = OSystem.getInstance(); synchronized (os.getReadyQueue()) { ControlBlock current = OSystem.getInstance().getReadyQueue().popTheQueue(); current.setStatus(ControlBlock.Status.RUNNING); cpu.actualCB = current; } } }
package com.tencent.mm.plugin.offline.ui; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.text.SpannableString; import android.text.style.ForegroundColorSpan; import com.tencent.mm.platformtools.y; import com.tencent.mm.plugin.offline.c.a; import com.tencent.mm.plugin.wallet_core.model.Bankcard; import com.tencent.mm.plugin.wxpay.a.h; import com.tencent.mm.plugin.wxpay.a.i; import com.tencent.mm.pluginsdk.ui.d.j; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.base.l; import com.tencent.mm.ui.base.n.c; import com.tencent.mm.ui.widget.a.d; import com.tencent.mm.wallet_core.ui.e; import java.util.List; class WalletOfflineCoinPurseUI$28 implements c { final /* synthetic */ d eRB; final /* synthetic */ List kkU; final /* synthetic */ WalletOfflineCoinPurseUI lMe; WalletOfflineCoinPurseUI$28(WalletOfflineCoinPurseUI walletOfflineCoinPurseUI, List list, d dVar) { this.lMe = walletOfflineCoinPurseUI; this.kkU = list; this.eRB = dVar; } public final void a(l lVar) { for (int i = 0; i < this.kkU.size(); i++) { String str; CharSequence spannableString; String str2; CharSequence charSequence; Drawable c; Drawable drawable; boolean z; Bankcard bankcard = (Bankcard) this.kkU.get(i); String Jg = a.Jg(bankcard.field_bankcardType); if (bankcard.bOt() && bankcard.pmc != null) { Jg = bankcard.pmc.lCU; } Bitmap a = y.a(new com.tencent.mm.plugin.wallet_core.ui.view.c(Jg)); y.a(new 1(this, Jg, lVar)); String str3 = ""; if (!bi.oW(bankcard.field_forbidWord)) { str3 = bankcard.field_forbidWord; } if (!bi.oW(str3) || bankcard.field_support_micropay) { str = str3; } else { str = bi.oW(bankcard.field_no_micro_word) ? "" : bankcard.field_no_micro_word; } if (bi.oW(bankcard.field_forbid_title)) { spannableString = new SpannableString(str); str2 = str; } else { str = str + " "; spannableString = new SpannableString(str + bankcard.field_forbid_title); 2 2 = new 2(this, this.lMe, bankcard); int length = str.length(); int length2 = str.length() + bankcard.field_forbid_title.length(); spannableString.setSpan(new ForegroundColorSpan(this.lMe.getResources().getColor(com.tencent.mm.plugin.wxpay.a.c.wallet_offline_link_color)), length, length2, 33); spannableString.setSpan(2, length, length2, 33); str2 = str; } if ((bankcard.bOs() || bankcard.bOt()) && bankcard.plV >= 0.0d) { charSequence = bankcard.field_desc + this.lMe.getString(i.wallet_balance_left, new Object[]{e.B(bankcard.plV)}); } else { charSequence = bankcard.field_desc; } if (bankcard.bOw()) { c = com.tencent.mm.svg.a.a.c(this.lMe.getResources(), h.honey_pay_bank_logo); } else if (a != null) { c = new BitmapDrawable(com.tencent.mm.sdk.platformtools.c.a(a, this.lMe.getResources().getDimensionPixelOffset(com.tencent.mm.plugin.wxpay.a.d.wallet_offline_bank_logo_width), this.lMe.getResources().getDimensionPixelOffset(com.tencent.mm.plugin.wxpay.a.d.wallet_offline_bank_logo_width), true, false)); } else { c = null; } if (c == null) { WalletOfflineCoinPurseUI.J(this.lMe).put(Jg, Integer.valueOf(i)); } x.i("MicroMsg.WalletOfflineCoinPurseUI", "i %d fee %s %s", new Object[]{Integer.valueOf(i), charSequence, spannableString}); CharSequence a2 = j.a(this.lMe.mController.tml, charSequence); if (c == null) { drawable = null; } else { drawable = c; } if (bi.oW(str2)) { z = false; } else { z = true; } lVar.a(i, a2, spannableString, drawable, z); } } }
package com.tencent.mm.ui.chatting.viewitems; import android.text.Html; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.tencent.mm.R; import com.tencent.mm.kernel.g; import com.tencent.mm.model.au; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.pluginsdk.ui.emoji.RTChattingEmojiView; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.an; import com.tencent.mm.storage.bd; import com.tencent.mm.storage.emotion.EmojiInfo; import com.tencent.mm.ui.chatting.b.b.ah; import com.tencent.mm.ui.chatting.c.a; import com.tencent.mm.ui.chatting.t.l; import com.tencent.mm.ui.chatting.t.m; import com.tencent.mm.ui.chatting.viewitems.u.c; import com.tencent.mm.ui.chatting.viewitems.u.d; import com.tencent.smtt.sdk.TbsListener$ErrorCode; public class u$b extends b implements m { private a tKy; protected c ucN; protected l ucO; public final boolean bba() { return true; } public final boolean aq(int i, boolean z) { if (z && i == 47) { return true; } return false; } public final View a(LayoutInflater layoutInflater, View view) { if (view != null && view.getTag() != null) { return view; } r rVar = new r(layoutInflater, R.i.chatting_item_to_emoji); rVar.setTag(new d().q(rVar, false)); return rVar; } public final void a(b.a aVar, int i, a aVar2, bd bdVar, String str) { this.tKy = aVar2; d dVar = (d) aVar; EmojiInfo zi = ((com.tencent.mm.plugin.emoji.b.c) g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().zi(bdVar.field_imgPath); if (zi != null) { an YJ = an.YJ(bdVar.field_content); dVar.ubd.a(zi, bdVar.field_msgId, YJ); if (dVar.ucP != null) { if (YJ.taS) { dVar.ucP.setVisibility(0); TextView textView = (TextView) dVar.jEz.findViewById(R.h.chatting_reward_tips_inflated).findViewById(R.h.chatting_emoji_reward_tv); textView.setText(Html.fromHtml(aVar2.tTq.getMMResources().getString(R.l.emoji_chatting_reward_tips))); ImageView imageView = (ImageView) dVar.jEz.findViewById(R.h.chatting_reward_tips_inflated).findViewById(R.h.chatting_emoji_reward_hand); TextView textView2 = textView; textView2.setTag(new au(bdVar, false, i, aVar2.cwp(), false, "", "", "", "", zi.field_groupId, "", true, false)); textView.setOnClickListener(h(aVar2)); if (((com.tencent.mm.plugin.emoji.b.c) g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().aDP()) { imageView.setVisibility(0); ImageView imageView2 = imageView; imageView2.setTag(new au(bdVar, aVar2.cwr(), i, aVar2.cwp(), 0)); if (this.ucO == null) { this.ucO = new l(aVar2); } imageView.setOnClickListener(this.ucO); } else { imageView.setVisibility(8); } } else { dVar.ucP.setVisibility(8); } } if (zi.aaq() && !YJ.enG) { YJ.enG = true; bdVar.setContent(YJ.clN()); au.HU(); bdVar.setStatus(com.tencent.mm.model.c.FT().dW(bdVar.field_msgId).field_status); au.HU(); com.tencent.mm.model.c.FT().V(bdVar); } if (cxN()) { dVar.mgA.setVisibility(8); if (bdVar.field_status == 2) { if (a((com.tencent.mm.ui.chatting.b.b.g) aVar2.O(com.tencent.mm.ui.chatting.b.b.g.class), bdVar.field_msgId)) { if (dVar.uai != null) { dVar.uai.setVisibility(0); } } } if (dVar.uai != null) { dVar.uai.setVisibility(8); } } else { if (dVar.uai != null) { dVar.uai.setVisibility(8); } if (dVar.mgA != null) { dVar.mgA.setVisibility(0); if (bdVar.field_status >= 2) { dVar.mgA.setVisibility(8); } } } } String str2 = ""; if (zi == null || !zi.aaq()) { if (zi != null) { str2 = bi.aG(((com.tencent.mm.plugin.emoji.b.c) g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().zf(zi.Xh()), ""); } } else if (zi.field_name.startsWith("jsb_j")) { str2 = this.tKy.tTq.getContext().getString(R.l.emoji_jsb_j); } else if (zi.field_name.startsWith("jsb_s")) { str2 = this.tKy.tTq.getContext().getString(R.l.emoji_jsb_s); } else if (zi.field_name.startsWith("jsb_b")) { str2 = this.tKy.tTq.getContext().getString(R.l.emoji_jsb_b); } else if (zi.field_name.startsWith("dice")) { str2 = zi.field_name.replace("dice_", "").replace(".png", ""); } dVar.ubd.setContentDescription(this.tKy.tTq.getContext().getString(R.l.emoji_store_title) + str2); dVar.ubd.setTag(new au(bdVar, aVar2.cwr(), i, aVar2.cwp(), 0)); RTChattingEmojiView rTChattingEmojiView = dVar.ubd; if (this.ucN == null) { this.ucN = new c(aVar2); } rTChattingEmojiView.setOnClickListener(this.ucN); dVar.ubd.setOnLongClickListener(c(aVar2)); dVar.ubd.setOnTouchListener(((com.tencent.mm.ui.chatting.b.b.g) aVar2.O(com.tencent.mm.ui.chatting.b.b.g.class)).ctw()); a(i, dVar, bdVar, aVar2.cwp(), aVar2.cwr(), aVar2, this); } public final boolean a(ContextMenu contextMenu, View view, bd bdVar) { if (bdVar.cml()) { au.HU(); if (com.tencent.mm.model.c.isSDCardAvailable()) { int i = ((au) view.getTag()).position; EmojiInfo zi = ((com.tencent.mm.plugin.emoji.b.c) g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().zi(bdVar.field_imgPath); if (zi == null) { x.w("MicroMsg.emoji.ChattingItemEmojiTo", "emoji is null. md5:%s", new Object[]{bdVar.field_imgPath}); } else { boolean cnv = zi.cnv(); if (!(zi.field_catalog == EmojiInfo.tcH || zi.cny() || zi.cnz())) { if (cnv) { contextMenu.add(i, 104, 0, view.getContext().getString(R.l.chatting_long_click_menu_save_emoji)); } else { x.i("MicroMsg.emoji.ChattingItemEmojiTo", "emoji file no exist. cannot save or resend."); } } if (zi.field_catalog == EmojiInfo.tcH || bi.oW(zi.field_groupId) || (!bi.oW(zi.field_groupId) && ((com.tencent.mm.plugin.emoji.b.c) g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().zl(zi.field_groupId))) { if (cnv) { contextMenu.add(i, TbsListener$ErrorCode.DOWNLOAD_FILE_CONTENTLENGTH_NOT_MATCH, 0, R.l.retransmit); } else { x.i("MicroMsg.emoji.ChattingItemEmojiTo", "emoji file no exist. cannot save or resend."); } } if (!(bi.oW(zi.field_groupId) || zi.aaq() || zi.cnz())) { contextMenu.add(i, 128, 0, R.l.chatting_long_click_menu_show_emoji_detail); } if (!bdVar.cky() && bdVar.cml() && ((bdVar.field_status == 2 || bdVar.cGF == 1) && a(bdVar, this.tKy) && aaA(bdVar.field_talker))) { contextMenu.add(i, TbsListener$ErrorCode.DOWNLOAD_RETRYTIMES302_EXCEED, 0, view.getContext().getString(R.l.chatting_long_click_menu_revoke_msg)); } if (!this.tKy.cws()) { contextMenu.add(i, 100, 0, view.getContext().getString(R.l.chatting_long_click_menu_delete_emoji)); } if (bdVar.field_status == 5) { contextMenu.add(i, 103, 0, view.getContext().getString(R.l.chatting_resend_title)); } h.mEJ.h(12789, new Object[]{Integer.valueOf(0), zi.Xh(), Integer.valueOf(0), zi.field_designerID, zi.field_groupId, "", "", "", "", "", zi.field_activityid}); } } } return true; } public final boolean a(MenuItem menuItem, a aVar, bd bdVar) { return ((ah) aVar.O(ah.class)).a(menuItem, aVar, bdVar); } public final boolean b(View view, a aVar, bd bdVar) { return false; } public final void a(a aVar, bd bdVar) { bdVar.cmw(); au.HU(); com.tencent.mm.model.c.FT().a(bdVar.field_msgId, bdVar); ((ah) aVar.O(ah.class)).bB(bdVar); } }
package com.tencent.mm.plugin.auth; import com.tencent.mm.model.av.a; import com.tencent.mm.model.z; import com.tencent.mm.protocal.i.f; import com.tencent.mm.protocal.i.g; class PluginAuth$1 implements a { final /* synthetic */ PluginAuth gQX; PluginAuth$1(PluginAuth pluginAuth) { this.gQX = pluginAuth; } public final void a(f fVar, g gVar) { z.a(gVar.qWn, true); this.gQX.getHandleAuthResponseCallbacks().a(fVar, gVar, true); } }
package rs.aleph.android.example12.activities.Activities.model; public class Jelo { private String image; private String name; private String description; private String kategorija; private float rating; public Jelo() { } }
package mapmaker.obj; public class LinkMap { }
package croco.com.yumingluan; import java.util.LinkedList; import java.util.List; import croco.com.yumingluan.bean.Company; import croco.com.yumingluan.sercice.priseServrices; import croco.com.yumingluan.sercice.webServrices; public class App { public static void main(String[] args) { String company_list_url="https://jobs.51job.com/guangzhou/cs05/jisuanjiruanjian/p"; List<String> company_url_list=new LinkedList<String>(); for (int i=1;i<38;i++){ company_url_list = new priseServrices().getCompanyUrlList( new webServrices().getHtmlByUrl(company_list_url+i)); for (int j=0;j<company_url_list.size();j++){ //System.out.println(j); String company_html=new webServrices().getHtmlByUrl(company_url_list.get(j)); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } if (!company_html.equals("0")){ Company company= new priseServrices().getCompany(company_html); System.out.println(company); } } } } /* @Test public void f() { String company_list_url="http://119.188.115.14/guangzhou/jisuanjiruanjian/p"; for (int i=1;i<22;i++){ List<String> company_url_list=new priseServrices().getCompanyUrlList( new webServrices().getHtmlByUrl(company_list_url+i)); for (int j=0;j<company_url_list.size();j++){ System.out.println(company_url_list.get(i)); } } } @Test public void g() { String company_url="http://jobs.51job.com/guangzhou/co3632293.html"; GetHtmlByGetThrend t1= new GetHtmlByGetThrend(company_url); t1.start(); //new Scanner(System.in).next(); }*/ }
package beansPersistencia; import java.util.List; import javax.annotation.Resource; import javax.ejb.Asynchronous; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.transaction.SystemException; import javax.transaction.UserTransaction; import entidades.Torneo; @Stateless @LocalBean @Asynchronous public class TorneoPersistence { @PersistenceContext EntityManager em; @Resource UserTransaction utx; public TorneoPersistence() {} public boolean save(Torneo t) { try { try { utx.begin(); em.persist(t); utx.commit(); } finally { em.close(); } return true; } catch (Exception e) { try { utx.rollback(); } catch (IllegalStateException e1) { e1.printStackTrace(); } catch (SecurityException e1) { e1.printStackTrace(); } catch (SystemException e1) { e1.printStackTrace(); } return false; } } public boolean remove(int id) { try { try { utx.begin(); em.remove(em.find(Torneo.class, id)); utx.commit(); } finally { em.close(); } return true; } catch (Exception e) { try { utx.rollback(); } catch (IllegalStateException e1) { e1.printStackTrace(); } catch (SecurityException e1) { e1.printStackTrace(); } catch (SystemException e1) { e1.printStackTrace(); } return false; } } public Torneo getTorneo(int id) { return em.find(Torneo.class,id); } public List<Torneo> getAllTorneos() { return em.createNamedQuery("Torneo.findAll", Torneo.class).getResultList(); } }
import edu.uci.ics.crawler4j.crawler.CrawlConfig; import edu.uci.ics.crawler4j.crawler.CrawlController; import edu.uci.ics.crawler4j.fetcher.PageFetcher; import edu.uci.ics.crawler4j.robotstxt.RobotstxtConfig; import edu.uci.ics.crawler4j.robotstxt.RobotstxtServer; import java.util.ArrayList; import java.util.List; import java.util.Map; public class CrawlerController { private static final String ROOT_FOLDER = "src\\main\\resources\\crawlerStat\\"; private static final String GENERAL_FILENAME = "general.csv"; private static final String TOP_VALUES_FILENAME = "top.csv"; private static final int NUMBER_OF_CRAWLERS = 2; public static void main(String[] args) throws Exception { CrawlConfig crawlConfig = new CrawlConfig(); CrawlerStatistics stats = new CrawlerStatistics(); List<String> values = new ArrayList<>(); if (args.length < 3) { System.out.println("Check ur input!"); System.out.println("\t First parameter is the provided to crawl link!"); System.out.println("\t The second parameter is the max visited pages!"); System.out.println("\t The third parameter is the link depth!"); System.exit(0); } else { try { stats.setCrawlerLink(args[0]); stats.setMaxPage(Integer.parseInt(args[1])); stats.setDepth(Integer.parseInt(args[2])); for (int i = 3; i < args.length; i++) { if (args[i] != null) { values.add(args[i]); } } stats.setSearchWords(values); } catch (NumberFormatException e) { System.err.println("Argument" + args[1] + args[2] + " must be an int!"); System.exit(0); } } crawlConfig.setMaxPagesToFetch(stats.getMaxPage()); crawlConfig.setMaxDepthOfCrawling(stats.getDepth()); crawlConfig.setCrawlStorageFolder(ROOT_FOLDER); PageFetcher pageFetcher = new PageFetcher(crawlConfig); RobotstxtConfig robotstxtConfig = new RobotstxtConfig(); RobotstxtServer robotstxtServer = new RobotstxtServer(robotstxtConfig, pageFetcher); CrawlController controller = new CrawlController(crawlConfig, pageFetcher, robotstxtServer); controller.addSeed(stats.getCrawlerLink()); CrawlController.WebCrawlerFactory<BasicCrawler> factory = () -> new BasicCrawler(stats); controller.start(factory, NUMBER_OF_CRAWLERS); BasicCrawler.sortHintsMap(stats.getWordsHintAmount()); Map<String, List<Long>> expectedMap = BasicCrawler.prettyOutPut(BasicCrawler.sortHintsMap(stats.getWordsHintAmount()), stats.getWordsHint()); System.out.println("TOP 10 PAGES BY TOTAL HITS"); expectedMap.forEach((k, v) -> System.out.println((k + " - " + v))); BasicCrawler.saveToCsv(stats.getWordsHint(), stats.getSearchWords(), GENERAL_FILENAME); BasicCrawler.saveToCsv(expectedMap, stats.getSearchWords(), TOP_VALUES_FILENAME); } }
package com.xiaodao.log.listen; import com.xiaodao.feign.system.client.SysLogininforClient; import com.xiaodao.feign.system.client.SysOperLogClient; import com.xiaodao.admin.entity.SysLogininfor; import com.xiaodao.admin.entity.SysOperLog; import com.xiaodao.log.event.SysLogininforEvent; import com.xiaodao.log.event.SysOperLogEvent; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.event.EventListener; import org.springframework.core.annotation.Order; import org.springframework.scheduling.annotation.Async; /** * 异步监听日志事件 */ @Slf4j @AllArgsConstructor public class LogListener { @Autowired private SysLogininforClient sysLogininforClient; @Autowired private SysOperLogClient sysOperLogClient; @Async @Order @EventListener(SysOperLogEvent.class) public void listenOperLog(SysOperLogEvent event) { SysOperLog sysOperLog = (SysOperLog) event.getSource(); sysOperLogClient.insert(sysOperLog); log.info("远程操作日志记录成功:{}", sysOperLog); } @Async @Order @EventListener(SysLogininforEvent.class) public void listenLoginifor(SysLogininforEvent event) { SysLogininfor sysLogininfor = (SysLogininfor) event.getSource(); sysLogininforClient.insert(sysLogininfor); log.info("远程访问日志记录成功:{}", sysLogininfor); } }
package com.fpmislata.banco.persistence.dao.implementacion.hibernate; import com.fpmislata.banco.business.domain.CuentaBancaria; import com.fpmislata.banco.business.domain.MovimientoBancario; import com.fpmislata.banco.core.BusinessException; import com.fpmislata.banco.persistence.dao.MovimientoBancarioDAO; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; /** * * @author Lliurex */ public class MovimientoBancarioDAOImplHibernate extends GenericDAOImplHibernate<MovimientoBancario> implements MovimientoBancarioDAO { @Override public List<MovimientoBancario> getByIdCuenta(CuentaBancaria cuentaBancaria) throws BusinessException { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Query query = session.createQuery("SELECT movimientobancario FROM MovimientoBancario movimientobancario WHERE cuentaBancaria=?"); query.setInteger(0, cuentaBancaria.getIdCuentaBancaria()); List<MovimientoBancario> movimientosBancarios = query.list(); session.getTransaction().commit(); return movimientosBancarios; } }
package com.tencent.mm.plugin.game.e; import android.graphics.Bitmap; import android.view.View; import com.tencent.mm.sdk.platformtools.c; import com.tencent.mm.sdk.platformtools.x; class e$4 extends e$b { final /* synthetic */ int aEd; final /* synthetic */ int aEe; final /* synthetic */ e kdq; final /* synthetic */ e$b kdx; final /* synthetic */ int kdy = 0; final /* synthetic */ String val$url; e$4(e eVar, e$b e_b, int i, int i2, String str) { this.kdq = eVar; this.kdx = e_b; this.aEd = i; this.aEe = i2; this.val$url = str; } public final void a(View view, Bitmap bitmap) { x.d("MicroMsg.GameImageUtil", "getBitmapWithWH, onFinish"); if (bitmap != null && !bitmap.isRecycled()) { Bitmap b = e.b(bitmap, this.aEd, this.aEe); x.d("MicroMsg.GameImageUtil", "getBitmapWithWH, resizeBitmap end"); if (this.kdy != 0) { b = c.a(b, true, (float) this.kdy); } e.b(this.kdq).m(this.val$url, b); if (this.kdx != null) { this.kdx.a(view, b); } } } }
package com.test.data.domain; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.voodoodyne.jackson.jsog.JSOGGenerator; import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; import org.neo4j.ogm.annotation.typeconversion.DateLong; import org.springframework.format.annotation.DateTimeFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @JsonIdentityInfo(generator=JSOGGenerator.class) @NodeEntity public class Movie { @GraphId Long id; private String name; private String photo; @DateLong @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createDate; @Relationship(type="扮演", direction = Relationship.INCOMING) List<Role> roles = new ArrayList<>(); public Role addRole(Actor actor, String name){ Role role = new Role(actor,this,name); this.roles.add(role); return role; } public Movie() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public List<Role> getRoles() { return roles; } public void setRoles(List<Role> roles) { this.roles = roles; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPhoto() { return photo; } public void setPhoto(String photo) { this.photo = photo; } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } }
import java.io.IOException; import java.util.Scanner; public class ScannerExample { public static void main(String[] args) throws IOException { System.out.print("당신의 이름을 입력하세요 : "); Scanner sc = new Scanner(System.in); String name = sc.nextLine(); System.out.print("당신의 나이는요? : "); int age = sc.nextInt(); System.out.print("당신의 이름은 " + name +"이군요.."); System.out.print("나이는 " + age + "이군요.."); sc.close(); } }
package com.ybh.front.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class Product_VPS_ADSLExample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public Product_VPS_ADSLExample() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ 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 FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ 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 FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ 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(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andServerlistidIsNull() { addCriterion("ServerlistID is null"); return (Criteria) this; } public Criteria andServerlistidIsNotNull() { addCriterion("ServerlistID is not null"); return (Criteria) this; } public Criteria andServerlistidEqualTo(Integer value) { addCriterion("ServerlistID =", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidNotEqualTo(Integer value) { addCriterion("ServerlistID <>", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidGreaterThan(Integer value) { addCriterion("ServerlistID >", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidGreaterThanOrEqualTo(Integer value) { addCriterion("ServerlistID >=", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidLessThan(Integer value) { addCriterion("ServerlistID <", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidLessThanOrEqualTo(Integer value) { addCriterion("ServerlistID <=", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidIn(List<Integer> values) { addCriterion("ServerlistID in", values, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidNotIn(List<Integer> values) { addCriterion("ServerlistID not in", values, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidBetween(Integer value1, Integer value2) { addCriterion("ServerlistID between", value1, value2, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidNotBetween(Integer value1, Integer value2) { addCriterion("ServerlistID not between", value1, value2, "serverlistid"); return (Criteria) this; } public Criteria andVpspdidIsNull() { addCriterion("VPSpdID is null"); return (Criteria) this; } public Criteria andVpspdidIsNotNull() { addCriterion("VPSpdID is not null"); return (Criteria) this; } public Criteria andVpspdidEqualTo(Integer value) { addCriterion("VPSpdID =", value, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidNotEqualTo(Integer value) { addCriterion("VPSpdID <>", value, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidGreaterThan(Integer value) { addCriterion("VPSpdID >", value, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidGreaterThanOrEqualTo(Integer value) { addCriterion("VPSpdID >=", value, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidLessThan(Integer value) { addCriterion("VPSpdID <", value, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidLessThanOrEqualTo(Integer value) { addCriterion("VPSpdID <=", value, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidIn(List<Integer> values) { addCriterion("VPSpdID in", values, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidNotIn(List<Integer> values) { addCriterion("VPSpdID not in", values, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidBetween(Integer value1, Integer value2) { addCriterion("VPSpdID between", value1, value2, "vpspdid"); return (Criteria) this; } public Criteria andVpspdidNotBetween(Integer value1, Integer value2) { addCriterion("VPSpdID not between", value1, value2, "vpspdid"); return (Criteria) this; } public Criteria andVpsidIsNull() { addCriterion("VPSID is null"); return (Criteria) this; } public Criteria andVpsidIsNotNull() { addCriterion("VPSID is not null"); return (Criteria) this; } public Criteria andVpsidEqualTo(Integer value) { addCriterion("VPSID =", value, "vpsid"); return (Criteria) this; } public Criteria andVpsidNotEqualTo(Integer value) { addCriterion("VPSID <>", value, "vpsid"); return (Criteria) this; } public Criteria andVpsidGreaterThan(Integer value) { addCriterion("VPSID >", value, "vpsid"); return (Criteria) this; } public Criteria andVpsidGreaterThanOrEqualTo(Integer value) { addCriterion("VPSID >=", value, "vpsid"); return (Criteria) this; } public Criteria andVpsidLessThan(Integer value) { addCriterion("VPSID <", value, "vpsid"); return (Criteria) this; } public Criteria andVpsidLessThanOrEqualTo(Integer value) { addCriterion("VPSID <=", value, "vpsid"); return (Criteria) this; } public Criteria andVpsidIn(List<Integer> values) { addCriterion("VPSID in", values, "vpsid"); return (Criteria) this; } public Criteria andVpsidNotIn(List<Integer> values) { addCriterion("VPSID not in", values, "vpsid"); return (Criteria) this; } public Criteria andVpsidBetween(Integer value1, Integer value2) { addCriterion("VPSID between", value1, value2, "vpsid"); return (Criteria) this; } public Criteria andVpsidNotBetween(Integer value1, Integer value2) { addCriterion("VPSID not between", value1, value2, "vpsid"); return (Criteria) this; } public Criteria andAdslnameIsNull() { addCriterion("ADSLname is null"); return (Criteria) this; } public Criteria andAdslnameIsNotNull() { addCriterion("ADSLname is not null"); return (Criteria) this; } public Criteria andAdslnameEqualTo(String value) { addCriterion("ADSLname =", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameNotEqualTo(String value) { addCriterion("ADSLname <>", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameGreaterThan(String value) { addCriterion("ADSLname >", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameGreaterThanOrEqualTo(String value) { addCriterion("ADSLname >=", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameLessThan(String value) { addCriterion("ADSLname <", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameLessThanOrEqualTo(String value) { addCriterion("ADSLname <=", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameLike(String value) { addCriterion("ADSLname like", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameNotLike(String value) { addCriterion("ADSLname not like", value, "adslname"); return (Criteria) this; } public Criteria andAdslnameIn(List<String> values) { addCriterion("ADSLname in", values, "adslname"); return (Criteria) this; } public Criteria andAdslnameNotIn(List<String> values) { addCriterion("ADSLname not in", values, "adslname"); return (Criteria) this; } public Criteria andAdslnameBetween(String value1, String value2) { addCriterion("ADSLname between", value1, value2, "adslname"); return (Criteria) this; } public Criteria andAdslnameNotBetween(String value1, String value2) { addCriterion("ADSLname not between", value1, value2, "adslname"); return (Criteria) this; } public Criteria andAdslpassIsNull() { addCriterion("ADSLpass is null"); return (Criteria) this; } public Criteria andAdslpassIsNotNull() { addCriterion("ADSLpass is not null"); return (Criteria) this; } public Criteria andAdslpassEqualTo(String value) { addCriterion("ADSLpass =", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassNotEqualTo(String value) { addCriterion("ADSLpass <>", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassGreaterThan(String value) { addCriterion("ADSLpass >", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassGreaterThanOrEqualTo(String value) { addCriterion("ADSLpass >=", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassLessThan(String value) { addCriterion("ADSLpass <", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassLessThanOrEqualTo(String value) { addCriterion("ADSLpass <=", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassLike(String value) { addCriterion("ADSLpass like", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassNotLike(String value) { addCriterion("ADSLpass not like", value, "adslpass"); return (Criteria) this; } public Criteria andAdslpassIn(List<String> values) { addCriterion("ADSLpass in", values, "adslpass"); return (Criteria) this; } public Criteria andAdslpassNotIn(List<String> values) { addCriterion("ADSLpass not in", values, "adslpass"); return (Criteria) this; } public Criteria andAdslpassBetween(String value1, String value2) { addCriterion("ADSLpass between", value1, value2, "adslpass"); return (Criteria) this; } public Criteria andAdslpassNotBetween(String value1, String value2) { addCriterion("ADSLpass not between", value1, value2, "adslpass"); return (Criteria) this; } public Criteria andEntertimeIsNull() { addCriterion("entertime is null"); return (Criteria) this; } public Criteria andEntertimeIsNotNull() { addCriterion("entertime is not null"); return (Criteria) this; } public Criteria andEntertimeEqualTo(Date value) { addCriterion("entertime =", value, "entertime"); return (Criteria) this; } public Criteria andEntertimeNotEqualTo(Date value) { addCriterion("entertime <>", value, "entertime"); return (Criteria) this; } public Criteria andEntertimeGreaterThan(Date value) { addCriterion("entertime >", value, "entertime"); return (Criteria) this; } public Criteria andEntertimeGreaterThanOrEqualTo(Date value) { addCriterion("entertime >=", value, "entertime"); return (Criteria) this; } public Criteria andEntertimeLessThan(Date value) { addCriterion("entertime <", value, "entertime"); return (Criteria) this; } public Criteria andEntertimeLessThanOrEqualTo(Date value) { addCriterion("entertime <=", value, "entertime"); return (Criteria) this; } public Criteria andEntertimeIn(List<Date> values) { addCriterion("entertime in", values, "entertime"); return (Criteria) this; } public Criteria andEntertimeNotIn(List<Date> values) { addCriterion("entertime not in", values, "entertime"); return (Criteria) this; } public Criteria andEntertimeBetween(Date value1, Date value2) { addCriterion("entertime between", value1, value2, "entertime"); return (Criteria) this; } public Criteria andEntertimeNotBetween(Date value1, Date value2) { addCriterion("entertime not between", value1, value2, "entertime"); return (Criteria) this; } public Criteria andEndtimeIsNull() { addCriterion("endtime is null"); return (Criteria) this; } public Criteria andEndtimeIsNotNull() { addCriterion("endtime is not null"); return (Criteria) this; } public Criteria andEndtimeEqualTo(Date value) { addCriterion("endtime =", value, "endtime"); return (Criteria) this; } public Criteria andEndtimeNotEqualTo(Date value) { addCriterion("endtime <>", value, "endtime"); return (Criteria) this; } public Criteria andEndtimeGreaterThan(Date value) { addCriterion("endtime >", value, "endtime"); return (Criteria) this; } public Criteria andEndtimeGreaterThanOrEqualTo(Date value) { addCriterion("endtime >=", value, "endtime"); return (Criteria) this; } public Criteria andEndtimeLessThan(Date value) { addCriterion("endtime <", value, "endtime"); return (Criteria) this; } public Criteria andEndtimeLessThanOrEqualTo(Date value) { addCriterion("endtime <=", value, "endtime"); return (Criteria) this; } public Criteria andEndtimeIn(List<Date> values) { addCriterion("endtime in", values, "endtime"); return (Criteria) this; } public Criteria andEndtimeNotIn(List<Date> values) { addCriterion("endtime not in", values, "endtime"); return (Criteria) this; } public Criteria andEndtimeBetween(Date value1, Date value2) { addCriterion("endtime between", value1, value2, "endtime"); return (Criteria) this; } public Criteria andEndtimeNotBetween(Date value1, Date value2) { addCriterion("endtime not between", value1, value2, "endtime"); return (Criteria) this; } public Criteria andOrderbyidIsNull() { addCriterion("orderbyid is null"); return (Criteria) this; } public Criteria andOrderbyidIsNotNull() { addCriterion("orderbyid is not null"); return (Criteria) this; } public Criteria andOrderbyidEqualTo(Integer value) { addCriterion("orderbyid =", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidNotEqualTo(Integer value) { addCriterion("orderbyid <>", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidGreaterThan(Integer value) { addCriterion("orderbyid >", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidGreaterThanOrEqualTo(Integer value) { addCriterion("orderbyid >=", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidLessThan(Integer value) { addCriterion("orderbyid <", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidLessThanOrEqualTo(Integer value) { addCriterion("orderbyid <=", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidIn(List<Integer> values) { addCriterion("orderbyid in", values, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidNotIn(List<Integer> values) { addCriterion("orderbyid not in", values, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidBetween(Integer value1, Integer value2) { addCriterion("orderbyid between", value1, value2, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidNotBetween(Integer value1, Integer value2) { addCriterion("orderbyid not between", value1, value2, "orderbyid"); return (Criteria) this; } public Criteria andVlanidIsNull() { addCriterion("VLANid is null"); return (Criteria) this; } public Criteria andVlanidIsNotNull() { addCriterion("VLANid is not null"); return (Criteria) this; } public Criteria andVlanidEqualTo(Integer value) { addCriterion("VLANid =", value, "vlanid"); return (Criteria) this; } public Criteria andVlanidNotEqualTo(Integer value) { addCriterion("VLANid <>", value, "vlanid"); return (Criteria) this; } public Criteria andVlanidGreaterThan(Integer value) { addCriterion("VLANid >", value, "vlanid"); return (Criteria) this; } public Criteria andVlanidGreaterThanOrEqualTo(Integer value) { addCriterion("VLANid >=", value, "vlanid"); return (Criteria) this; } public Criteria andVlanidLessThan(Integer value) { addCriterion("VLANid <", value, "vlanid"); return (Criteria) this; } public Criteria andVlanidLessThanOrEqualTo(Integer value) { addCriterion("VLANid <=", value, "vlanid"); return (Criteria) this; } public Criteria andVlanidIn(List<Integer> values) { addCriterion("VLANid in", values, "vlanid"); return (Criteria) this; } public Criteria andVlanidNotIn(List<Integer> values) { addCriterion("VLANid not in", values, "vlanid"); return (Criteria) this; } public Criteria andVlanidBetween(Integer value1, Integer value2) { addCriterion("VLANid between", value1, value2, "vlanid"); return (Criteria) this; } public Criteria andVlanidNotBetween(Integer value1, Integer value2) { addCriterion("VLANid not between", value1, value2, "vlanid"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated do_not_delete_during_merge Fri May 11 11:16:07 CST 2018 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table FreeHost_Product_VPS_ADSL * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ 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 com.mes.old.meta; // Generated 2017-5-22 1:25:24 by Hibernate Tools 5.2.1.Final import java.math.BigDecimal; import java.util.Date; /** * TTaskMaterial generated by hbm2java */ public class TTaskMaterial implements java.io.Serializable { private TTaskMaterialId id; private MMaterial MMaterialByOutmaterialusn; private MMaterial MMaterialByInmaterialusn; private Integer changetype; private BigDecimal inmaterialqty; private BigDecimal outmaterialqty; private String creator; private Date createtime; private String notes; private String uniqueid; private String invioid; private Byte changestate; private String location; private String rmuid; private String sn; public TTaskMaterial() { } public TTaskMaterial(TTaskMaterialId id, MMaterial MMaterialByOutmaterialusn, MMaterial MMaterialByInmaterialusn, String uniqueid) { this.id = id; this.MMaterialByOutmaterialusn = MMaterialByOutmaterialusn; this.MMaterialByInmaterialusn = MMaterialByInmaterialusn; this.uniqueid = uniqueid; } public TTaskMaterial(TTaskMaterialId id, MMaterial MMaterialByOutmaterialusn, MMaterial MMaterialByInmaterialusn, Integer changetype, BigDecimal inmaterialqty, BigDecimal outmaterialqty, String creator, Date createtime, String notes, String uniqueid, String invioid, Byte changestate, String location, String rmuid, String sn) { this.id = id; this.MMaterialByOutmaterialusn = MMaterialByOutmaterialusn; this.MMaterialByInmaterialusn = MMaterialByInmaterialusn; this.changetype = changetype; this.inmaterialqty = inmaterialqty; this.outmaterialqty = outmaterialqty; this.creator = creator; this.createtime = createtime; this.notes = notes; this.uniqueid = uniqueid; this.invioid = invioid; this.changestate = changestate; this.location = location; this.rmuid = rmuid; this.sn = sn; } public TTaskMaterialId getId() { return this.id; } public void setId(TTaskMaterialId id) { this.id = id; } public MMaterial getMMaterialByOutmaterialusn() { return this.MMaterialByOutmaterialusn; } public void setMMaterialByOutmaterialusn(MMaterial MMaterialByOutmaterialusn) { this.MMaterialByOutmaterialusn = MMaterialByOutmaterialusn; } public MMaterial getMMaterialByInmaterialusn() { return this.MMaterialByInmaterialusn; } public void setMMaterialByInmaterialusn(MMaterial MMaterialByInmaterialusn) { this.MMaterialByInmaterialusn = MMaterialByInmaterialusn; } public Integer getChangetype() { return this.changetype; } public void setChangetype(Integer changetype) { this.changetype = changetype; } public BigDecimal getInmaterialqty() { return this.inmaterialqty; } public void setInmaterialqty(BigDecimal inmaterialqty) { this.inmaterialqty = inmaterialqty; } public BigDecimal getOutmaterialqty() { return this.outmaterialqty; } public void setOutmaterialqty(BigDecimal outmaterialqty) { this.outmaterialqty = outmaterialqty; } public String getCreator() { return this.creator; } public void setCreator(String creator) { this.creator = creator; } public Date getCreatetime() { return this.createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getNotes() { return this.notes; } public void setNotes(String notes) { this.notes = notes; } public String getUniqueid() { return this.uniqueid; } public void setUniqueid(String uniqueid) { this.uniqueid = uniqueid; } public String getInvioid() { return this.invioid; } public void setInvioid(String invioid) { this.invioid = invioid; } public Byte getChangestate() { return this.changestate; } public void setChangestate(Byte changestate) { this.changestate = changestate; } public String getLocation() { return this.location; } public void setLocation(String location) { this.location = location; } public String getRmuid() { return this.rmuid; } public void setRmuid(String rmuid) { this.rmuid = rmuid; } public String getSn() { return this.sn; } public void setSn(String sn) { this.sn = sn; } }
package com.tencent.matrix.iocanary.b; import com.tencent.matrix.d.b; import java.lang.reflect.Field; import java.lang.reflect.Proxy; public final class a { private static volatile Object bra; public volatile boolean bqZ; private final com.tencent.matrix.c.c.a brb; public a(com.tencent.matrix.c.c.a aVar) { this.brb = aVar; } public final boolean tu() { try { Class cls = Class.forName("dalvik.system.CloseGuard"); Class cls2 = Class.forName("dalvik.system.CloseGuard$Reporter"); Field declaredField = cls.getDeclaredField("REPORTER"); Field declaredField2 = cls.getDeclaredField("ENABLED"); declaredField.setAccessible(true); declaredField2.setAccessible(true); bra = declaredField.get(null); declaredField2.set(null, Boolean.valueOf(true)); c.setEnabled(true); ClassLoader classLoader = cls2.getClassLoader(); if (classLoader == null) { return false; } declaredField.set(null, Proxy.newProxyInstance(classLoader, new Class[]{cls2}, new b(this.brb, bra))); declaredField.setAccessible(false); return true; } catch (Throwable th) { b.e("Matrix.CloseGuardHooker", "tryHook exp=%s", th); return false; } } public static boolean tv() { try { Class cls = Class.forName("dalvik.system.CloseGuard"); Field declaredField = cls.getDeclaredField("REPORTER"); declaredField.setAccessible(true); declaredField.set(null, bra); Field declaredField2 = cls.getDeclaredField("ENABLED"); declaredField2.setAccessible(true); declaredField2.set(null, Boolean.valueOf(false)); declaredField.setAccessible(false); c.setEnabled(false); return true; } catch (Throwable th) { b.e("Matrix.CloseGuardHooker", "tryHook exp=%s", th); return false; } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package herramientas; import java.io.*; import java.sql.*; import java.util.Calendar; /** * * @author Administrador */ public class insertadocumentoORCL { public static void main(String [] args ) { //insertadocumentoORCL doc = new insertadocumentoORCL("500.TS2010555019-001-10","/data/informes/WSClientSegipsa20/REC/4311TS2010555019STA.XML"); //insertadocumentoORCL doc = new insertadocumentoORCL("200.TS2010010005-006-10","/tmp/200.TS2010010005-006-10.pdf"); //insertadocumentoORCL doc = new insertadocumentoORCL(); insertadocumentoORCL doc = new insertadocumentoORCL("203.01820005500041-15","/data/informes/ancert/tmp/STA/01820005500041.xml"); //insertadocumentoORCL doc = new insertadocumentoORCL("100.TS2010008674-001-10","/data/informes/decodificaXML/RESUMENTS2010008674-001.pdf"); //numero_automatico("55", "21"); }//main public insertadocumentoORCL() { String numexp = "100.TS2010003790-001-10"; //VPT Connection conexOrclTEST = null; //public static int loadDocgraficaClusterFromRp(String numexp,String urlOrigen,java.sql.Connection conexionDestino) throws java.sql.SQLException, java.lang.Exception try { System.out.println("Expediente: "+numexp); conexOrclTEST = Utilidades.Conexion.getConnection("jdbc:oracle:thin:valtecinfx/valtecinfx@ (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver01.valtecnic.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST =oraserver02.valtecnic.com)(PORT =1521)) (LOAD_BALANCE = off) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 20) (DELAY = 15))))"); String conexOrclVTN = "jdbc:oracle:thin:valtecinfx/valtecinfx@ (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver01.valtecnic.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver02.valtecnic.com)(PORT =1521)) (LOAD_BALANCE = off) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = vtn) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 20) (DELAY = 15))))"; Objetos.Docgrafica.loadDocgraficaClusterFromRp(numexp, conexOrclVTN, conexOrclTEST); conexOrclTEST.close(); System.out.println("O.K"); } catch (ClassNotFoundException cnfe) { System.out.println("ERROR"+cnfe.toString()); } catch (SQLException sqle) { System.out.println("ERROR"+sqle.toString()); } catch (Exception e) { System.out.println("ERROR"+e.toString()); } finally { try { if (conexOrclTEST != null && !conexOrclTEST.isClosed()) { conexOrclTEST.close(); conexOrclTEST = null; } } catch (SQLException sqlException) { } } } public insertadocumentoORCL(String numexp,String ruta_fich) { try { //a DESARROLLO //Connection conexionOracle = Utilidades.Conexion.getConnection("jdbc:oracle:thin:valtecinfx/valtecinfx@ (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver01.valtecnic.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST =oraserver02.valtecnic.com)(PORT =1521)) (LOAD_BALANCE = off) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 20) (DELAY = 15))))"); //a EXPLOTACION //Connection conexionOracle = Utilidades.Conexion.getConnection("jdbc:oracle:thin:valtecinfx/valtecinfx@ (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver01.valtecnic.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST =oraserver02.valtecnic.com)(PORT =1521)) (LOAD_BALANCE = off) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = vtn) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 20) (DELAY = 15))))"); Connection conexionOracle = Utilidades.Conexion.getConnection("jdbc:oracle:thin:valtecinfx/valtecinfx@oraserver02:1521:rvtnprod"); PreparedStatement stmtOrcl = null; int numero=0; //PARA RECUPERACIONES INFORME COMPLETO EN PDF //String descripcion=numexp.trim()+".pdf"; //String mime_type="application/pdf"; //String pie="PDF recuperado"; //int tipo_doc=4323; //String usuario = "recu"; //PARA INFORME COMPLETO EN PDF //String descripcion="100.TS2009050010-003-09.pdf"; //String mime_type="application/pdf"; //String pie="Informe Completo"; //int tipo_doc=4325; //PARA INFORME COMPLETO EN PDF //String descripcion="portada-101.TS2009050011-001-09.pdf"; //String mime_type="application/pdf"; //String pie="Portada Informe"; //int tipo_doc=999; //PARA INFORME DE TASACON EN PDF //String descripcion="200.TS2010010005-006-10"; //String mime_type="application/pdf"; //String pie="Informe de Tasacion"; //int tipo_doc=4298; //String usuario = "SEGIP"; //PARA FOTOS Y PLANOS JPEG //String descripcion="foto.jpg"; //String mime_type="image/jpeg"; //String pie="Fachada"; //int tipo_doc=244; //String pie="Entorno"; //String pie="Situación"; //int tipo_doc=4320; //para encargo XML SEGIPSA //String descripcion="Encargo"; //String mime_type="text/xml"; //String pie="Encargo XML"; //int tipo_doc=4321; //String usuario = "SEGIP"; //para BBVA String descripcion="STA"; String mime_type="text/xml"; String pie="Documento STA"; int tipo_doc=301; String usuario = "BBVA"; File fichero = new File(ruta_fich); Statement stmtOracle = conexionOracle.createStatement(); ResultSet rsOracle = null; rsOracle = stmtOracle.executeQuery("select seq_docgrafica.nextval from dual"); if (rsOracle.next()) numero = rsOracle.getInt(1); int resultado = stmtOracle.executeUpdate("insert into docgrafica values ('" + numexp + "'," + numero + ",'" + descripcion + "','" + mime_type + "',empty_blob(),'" + pie + "'," + tipo_doc + ")"); if (resultado == 1) { rsOracle = stmtOracle.executeQuery("select contenido from docgrafica where numero=" + numero + " for update"); if (rsOracle.next()) { Blob informeBlob = rsOracle.getBlob(1); OutputStream blobOutputStream = ((oracle.sql.BLOB)informeBlob).getBinaryOutputStream(); InputStream stream = new FileInputStream(fichero); byte[] buffer = new byte[10*1024]; int nread = 0; while((nread = stream.read(buffer)) != -1) blobOutputStream.write(buffer,0,nread); blobOutputStream.close(); stream.close(); rsOracle.close(); } } resultado = stmtOracle.executeUpdate("insert into idendoc(numero, usuario) values (" + numero + ", '"+usuario+"')"); if (resultado == 1) { conexionOracle.commit(); } else { conexionOracle.rollback(); } conexionOracle.close(); }//try catch (SQLException sqle) { System.out.println(sqle.toString()); } catch (ClassNotFoundException cnfe) { System.out.println(cnfe.toString()); } catch (FileNotFoundException fnfe) { System.out.println(fnfe.toString()); } catch (IOException ioe) { System.out.println(ioe.toString()); } }//insertadocumentoORCL public static String numero_automatico(String codcli, String codpro) { String numexp = ""; int intentos = 5; int anio = 0; int mes = 0; int dia = 0; int hora = 0; int minuto = 0; int segundo = 0; boolean seguir = true; Calendar calendario = null; Connection conexion = null; try{ conexion = Utilidades.Conexion.getConnection("jdbc:oracle:thin:valtecnic2/valtecnic2@192.168.3.215:1521:rvtn"); Statement stmt = conexion.createStatement(); //Necesitamos recuperar de la tabla de provincias el prefijo asociado al codigo de //provincia ya que eso determina la delegacion a la que pertenece ResultSet rs = stmt.executeQuery("select prefijo from provincias where codpro='" + codpro + "'"); String prefijo = ""; if (rs.next()) prefijo = rs.getString(1); //Buscamos la fecha y la hora por medio del objeto Calendar while (seguir && intentos != 0) { calendario = Calendar.getInstance(); //Obtiene la ultima cifra del a?o anio = calendario.get(calendario.YEAR); String s_anio = String.valueOf(anio); s_anio = s_anio.substring(s_anio.length() - 1); //Obtiene el mes con dos digitos mes = calendario.get(calendario.MONTH) + 1; String s_mes = String.valueOf(mes); if(s_mes.length() == 1) s_mes = "0" + s_mes; //Obtiene el dia con dos digitos dia = calendario.get(calendario.DATE); String s_dia = String.valueOf(dia); if(s_dia.length() == 1) s_dia = "0" + s_dia; //Obtiene la hora con dos digitos hora = calendario.get(calendario.HOUR_OF_DAY); String s_hora = String.valueOf(hora); if(s_hora.length() == 1) s_hora = "0" + s_hora; //Obtiene los minutos con dos digitos minuto = calendario.get(calendario.MINUTE); String s_minuto = String.valueOf(minuto); if(s_minuto.length() == 1) s_minuto = "0" + s_minuto; //Obtiene los segundos en dos digitos segundo = calendario.get(calendario.SECOND); String s_segundo = String.valueOf(segundo); if(s_segundo.length() == 1) s_segundo = "0" + s_segundo; numexp = prefijo + codcli + s_anio + " " + s_mes + s_dia + " " + s_hora + s_minuto + s_segundo; System.out.println(numexp); if (!Objetos.Solicitudes.exists(numexp, conexion)) { intentos --; try {//ESPERAMOS 2 SEGUNDOS ANTES DE PROCESAR EL SIGUEINTE SOLICITUD Thread.currentThread().sleep(1000); } catch (InterruptedException ie) { } } else seguir = false; }//while if (seguir) numexp = null; //quiere decir que hemos hecho el nº max. de intentos y el expte. siempre existe ya en la B.D }//try catch(Exception e) { //System.out.println(e); } return numexp; }//numero_automatico }//CLASS
// GameState that shows logo. package com.neet.gamestates; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import com.neet.handlers.GameStateManager; import com.neet.handlers.ImageLoader; import com.neet.handlers.Keys; import com.neet.handlers.Mouse; import com.neet.main.GamePanel; public class IntroState extends GameState { private BufferedImage logo; private int logox; private int logoy; private int logow; private int logoh; private int alpha; private int ticks; private final int FADE_IN = 90; private final int LENGTH = 90; private final int FADE_OUT = 90; public IntroState(GameStateManager gsm) { super(gsm); init(); } public void init() { ticks = 0; logo = ImageLoader.LOGO; logoh = GamePanel.HEIGHT; logow = logo.getWidth() * (logoh / logo.getHeight()) + 100; logox = (GamePanel.WIDTH - logow) / 2; logoy = 0; } public void update() { handleInput(); ticks++; if(ticks < FADE_IN) { alpha = (int) (255 - 255 * (1.0 * ticks / FADE_IN)); if(alpha < 0) alpha = 0; } if(ticks > FADE_IN + LENGTH) { alpha = (int) (255 * (1.0 * ticks - FADE_IN - LENGTH) / FADE_OUT); if(alpha > 255) alpha = 255; } if(ticks > FADE_IN + LENGTH + FADE_OUT) { gsm.setState(GameStateManager.MENU_STATE); } } public void draw(Graphics2D g) { g.setColor(Color.WHITE); g.fillRect(0, 0, GamePanel.WIDTH, GamePanel.HEIGHT); g.drawImage(logo, logox, logoy, logow, logoh, null); g.setColor(new Color(255, 255, 255, alpha)); g.fillRect(0, 0, GamePanel.WIDTH, GamePanel.HEIGHT); } public void handleInput() { if(Keys.isPressed(Keys.ENTER)) { gsm.setState(GameStateManager.MENU_STATE); } if(Mouse.isPressed()) { gsm.setState(GameStateManager.MENU_STATE); } } }
package piefarmer.immunology.gui; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.util.ResourceLocation; public class GuiButtonAddDisease extends GuiButton{ public static final ResourceLocation RESOURCE_BUTTON_NEXT= new ResourceLocation("immunology:textures/gui/DiagnosticTableGUI.png"); private static TextureManager textureManager; public GuiButtonAddDisease(int par1, int par2, int par3) { super(par1, par2, par3, 9, 9, ""); } public void drawButton(Minecraft par1Minecraft, int par2, int par3) { if (this.drawButton) { boolean var4 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft mc = par1Minecraft; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int var5 = 198; int var6 = 0; textureManager = par1Minecraft.func_110434_K(); textureManager.func_110577_a(RESOURCE_BUTTON_NEXT); if (var4) { var5 += 9; } this.drawTexturedModalRect(this.xPosition, this.yPosition, var5, var6, 9, 9); } } }
package cn.sunzhichao.mall.controller.portal; import cn.sunzhichao.mall.common.Const; import cn.sunzhichao.mall.common.ResponseCode; import cn.sunzhichao.mall.common.ServerResponse; import cn.sunzhichao.mall.pojo.User; import cn.sunzhichao.mall.service.IProductService; import cn.sunzhichao.mall.vo.ProductDetailVo; import com.github.pagehelper.PageInfo; 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.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpSession; @Controller @RequestMapping("/product/") public class ProductController { @Autowired private IProductService iProductService; /** * 前台获取产品详情,与后台获取产品详情的区别在于: * 在前台需要判断一下产品的在售状态,如果是下架就不展示 */ @RequestMapping(value = "detail.do", method = RequestMethod.POST) @ResponseBody public ServerResponse<ProductDetailVo> detail(Integer productId, HttpSession session) { User user = (User) session.getAttribute(Const.CURRENT_USER); if (user == null) { return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(), "用户未登录,请登录管理员"); } //业务逻辑 return iProductService.getProductDetail(productId); } /** * 前台搜索 */ @RequestMapping(value = "list.do", method = RequestMethod.POST) @ResponseBody public ServerResponse<PageInfo> list(@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "categoryId", required = false) Integer categoryId, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize, @RequestParam(value = "orderBy", defaultValue = "") String orderBy) { return iProductService.getProductByKeywordCategory(keyword,categoryId,pageNum, pageSize,orderBy); } }
package com.example.tabtest; import android.app.Activity; public class MyInfoActivity extends Activity { }
package com.gcit.training.library.dao; import static org.junit.Assert.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import org.junit.Before; import org.junit.Test; import com.gcit.training.library.Borrower; public class BorrowerDAOTest { private Connection conn = null; @Before public void innit(){ try{ this.conn = DriverManager.getConnection( "jdbc:mysql://127.0.0.1:3306/library", "root", ""); } catch(Exception e){ e.printStackTrace(); } } //@Test public void testCreate() throws SQLException { Borrower borrower = new Borrower(); borrower.setName("Emily"); borrower.setAddress("112 wacky rd"); borrower.setPhone("222-2123"); try { conn.setAutoCommit(false); new BorrowerDAO(conn).create(borrower); conn.commit(); } catch (Exception e) { e.printStackTrace(); conn.rollback(); fail("borrower create failed"); } } @Test public void testRead() throws SQLException { try { conn.setAutoCommit(false); new BorrowerDAO(conn).read(); conn.commit(); } catch (Exception e) { e.printStackTrace(); conn.rollback(); fail("borrower read failed"); } } @Test public void testReadOne() throws SQLException { try { conn.setAutoCommit(false); new BorrowerDAO(conn).readOne(13); conn.commit(); } catch (Exception e) { e.printStackTrace(); conn.rollback(); fail("borrower read failed"); } } //@Test public void testUpdate() throws SQLException { Borrower borrower = new Borrower(); borrower.setName("Paisley"); borrower.setAddress("113 wacky rd"); borrower.setPhone("222-2123"); borrower.setCardno(24); try { conn.setAutoCommit(false); new BorrowerDAO(conn).update(borrower); conn.commit(); } catch (Exception e) { e.printStackTrace(); conn.rollback(); fail("borrower update failed"); } } //@Test public void testDelete() throws SQLException { Borrower borrower = new Borrower(); borrower.setCardno(25); try { conn.setAutoCommit(false); new BorrowerDAO(conn).delete(borrower); conn.commit(); } catch (Exception e) { e.printStackTrace(); conn.rollback(); fail("borrower delete failed"); } } }
public class Member implements Comparable<Member> { private int memberId; private String memberName; public Member() {} public Member(int memberId, String memberName) { this.memberId = memberId; this.memberName = memberName; } public int getMemberId() { return memberId; } public void setMemberId(int memberId) { this.memberId = memberId; } public String getMemberName() { return memberName; } public void setMemberName(String memberName) { this.memberName = memberName; } public String toString() { return memberName + "회원님의 아이디는 " + memberId +"입니다!"; } @Override public int hashCode() { // Set인터페이스는 중복을 허용하지 않으므로 논리적 동일성을 정의해주기 위해! return memberId; } @Override public boolean equals(Object obj) { // Set인터페이스는 중복을 허용하지 않으므로 논리적 동일성을 정의해주기 위해! if(obj instanceof Member) { Member member = (Member) obj; return (this.memberId == member.memberId); } return false; } @Override public int compareTo(Member member) { return (this.memberId - member.memberId); // 이 경우 오름차순! // 반대의 경우나, (-1)을 곱할경우 내림차순! // 자신의 값이 더 클 때 양수를 반환하게 되면 오름차순, 반대의 경우 내림차순! } /* @Override public int compare(Member member1, Member member2) { // 첫번째 인자가 this다! Comparable이 아닌 Comparator을 구현할 때 사용! TreeSet생성시 인자로 비교할 객체 넣어줘야한다! // ex) MemberTreeSet에서 생성자부분에서 treeSet = new TreeSet<Member>(new Member()); return (this.memberId - member.memberId); // 이 경우 오름차순! // 반대의 경우나, (-1)을 곱할경우 내림차순! // 자신의 값이 더 클 때 양수를 반환하게 되면 오름차순, 반대의 경우 내림차순! } */ }
package com.guru99.demo.pages_objects; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class HomePage extends BasePage{ private By usernameField = By.name("uid"); private By passwordField = By.name("password"); private By loginField = By.name("btnLogin"); public HomePage(WebDriver driver) { super(driver); } public ManagersPage loginToBank(String username, String password) { driver.findElement(usernameField).sendKeys(username); driver.findElement(passwordField).sendKeys(password); driver.findElement(loginField).click(); return new ManagersPage(driver); } }
package com.mideas.rpg.v2.game.classes; import com.mideas.rpg.v2.game.Joueur; import com.mideas.rpg.v2.game.item.stuff.Stuff; import com.mideas.rpg.v2.game.shortcut.SpellShortcut; import com.mideas.rpg.v2.game.spell.Spell; import com.mideas.rpg.v2.game.spell.SpellManager; import com.mideas.rpg.v2.game.spell.list.DeathCoil; import com.mideas.rpg.v2.game.spell.list.DeathStrike; import com.mideas.rpg.v2.game.spell.list.PlagueStrike; public class DeathKnight extends Joueur { public static final int MAX_HEALTH = 15000; public static final int MAX_MANA = 2000; public DeathKnight() { super(15000, 300, 100, 100, 100, 5, 2000, new SpellShortcut[49], new Spell[49], new Stuff[21], "DeathKnight", 5, 15000, 2000, 0, 1500, 1550, 0); setSpells(0, SpellManager.getShortcutSpell(2)); setSpells(1, SpellManager.getShortcutSpell(3)); setSpells(2, SpellManager.getShortcutSpell(1)); setSpellUnlocked(0, new DeathStrike()); setSpellUnlocked(1, new PlagueStrike()); setSpellUnlocked(2, new DeathCoil()); } }
package com.ntxdev.zuptecnico.entities; import android.content.Context; import android.os.Parcel; import android.os.Parcelable; import com.fasterxml.jackson.databind.ObjectMapper; import com.ntxdev.zuptecnico.R; import com.ntxdev.zuptecnico.api.Zup; import java.util.Map; /** * Created by igorlira on 7/30/15. */ public class ReportHistoryItem implements Parcelable { private static final String KIND_OVERDUE = "overdue"; private static final String KIND_STATUS = "status"; private static final String KIND_CATEGORY = "category"; private static final String KIND_FORWARD = "forward"; private static final String KIND_USER_ASSIGN = "user_assign"; private static final String KIND_COMMENT = "comment"; private static final String KIND_ADDRESS = "address"; private static final String KIND_DESCRIPTION = "description"; private static final String KIND_CREATION = "creation"; private static final String KIND_NOTIFICATION = "notification"; private static final String KIND_NOTIFICATION_RESTART = "notification_restart"; public int id; public User user; public String kind; public String action; public Map changes; // We don't know what to expect public String created_at; public ReportHistoryItem() { } public static ReportHistoryItem[] toMyObjects(Parcelable[] parcelables) { if(parcelables == null){ return null; } ReportHistoryItem[] objects = new ReportHistoryItem[parcelables.length]; System.arraycopy(parcelables, 0, objects, 0, parcelables.length); return objects; } protected ReportHistoryItem(Parcel in) { id = in.readInt(); user = (User) in.readParcelable(User.class.getClassLoader()); kind = in.readString(); action = in.readString(); changes = in.readHashMap(ClassLoader.getSystemClassLoader()); created_at = in.readString(); } public static final Creator<ReportHistoryItem> CREATOR = new Creator<ReportHistoryItem>() { @Override public ReportHistoryItem createFromParcel(Parcel in) { return new ReportHistoryItem(in); } @Override public ReportHistoryItem[] newArray(int size) { return new ReportHistoryItem[size]; } }; @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeInt(id); parcel.writeParcelable(user, i); parcel.writeString(kind); parcel.writeString(action); parcel.writeMap(changes); parcel.writeString(created_at); } @Override public int describeContents() { return 0; } public String getHtml(Context ctx, ObjectMapper mapper, int categoryId) { StringBuilder result = new StringBuilder(); switch (this.kind) { case KIND_NOTIFICATION_RESTART: result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(" "); result.append(this.action); break; case KIND_NOTIFICATION: Map statusTitle = (Map) this.changes.get("new"); String notificationTitle = mapper.convertValue(statusTitle.get("title"), String.class); result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(" "); result.append(this.action); result.append(" "); result.append("<b>"); result.append(notificationTitle); result.append("</b> "); break; case KIND_OVERDUE: result.append(action); Map statusMap = (Map) this.changes.get("new"); Integer statusId = mapper.convertValue(statusMap.get("id"), Integer.class); ReportCategory category = Zup.getInstance().getReportCategoryService().getReportCategory(categoryId); if (category != null) { ReportCategory.Status status = null; if (statusId != null) status = category.getStatus(statusId); if (status != null) { result.append(" "); result.append("<b>"); result.append(status.getTitle()); result.append("</b>"); } } break; case KIND_STATUS: Map oldStatus = (Map) this.changes.get("old"); Map newStatus = (Map) this.changes.get("new"); String newStatusName = mapper.convertValue(newStatus.get("title"), String.class); if (this.user != null) { result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(ctx.getString(R.string.report_history_someone_changedstatus)); result.append(" "); } else { result.append(ctx.getString(R.string.report_history_changedstatus)); result.append(" "); } if (oldStatus != null) { String oldStatusName = mapper.convertValue(oldStatus.get("title"), String.class); result.append(ctx.getString(R.string.report_history_from)); result.append(" "); result.append("<b>"); result.append(oldStatusName); result.append("</b> "); } result.append(ctx.getString(R.string.report_history_to)); result.append(" "); result.append("<b>"); result.append(newStatusName); result.append("</b>"); break; case KIND_CATEGORY: Map oldCategory = (Map) this.changes.get("old"); Map newCategory = (Map) this.changes.get("new"); String newCategoryName = mapper.convertValue(newCategory.get("title"), String.class); if (this.user != null) { result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(ctx.getString(R.string.report_history_someone_changedcategory)); result.append(" "); } else { result.append(ctx.getString(R.string.report_history_changedcategory)); result.append(" "); } if (oldCategory != null) { String oldCategoryName = mapper.convertValue(oldCategory.get("title"), String.class); result.append(ctx.getString(R.string.report_history_from)); result.append(" "); result.append("<b>"); result.append(oldCategoryName); result.append("</b> "); } result.append(ctx.getString(R.string.report_history_to)); result.append(" "); result.append("<b>"); result.append(newCategoryName); result.append("</b>"); break; case KIND_FORWARD: Map oldGroup = (Map) this.changes.get("old"); Map newGroup = (Map) this.changes.get("new"); String newGroupName = mapper.convertValue(newGroup.get("name"), String.class); if (this.user != null) { result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(ctx.getString(R.string.report_history_someone_forwarded)); result.append(" "); } else { result.append(ctx.getString(R.string.report_history_forwarded)); result.append(" "); } if (oldGroup != null) { String oldGroupName = mapper.convertValue(oldGroup.get("name"), String.class); result.append(ctx.getString(R.string.report_history_fromgroup)); result.append(" "); result.append("<b>"); result.append(oldGroupName); result.append("</b> "); } result.append(ctx.getString(R.string.report_history_togroup)); result.append(" "); result.append("<b>"); result.append(newGroupName); result.append("</b>"); break; case KIND_USER_ASSIGN: Map oldUser = (Map) this.changes.get("old"); Map newUser = (Map) this.changes.get("new"); String newUserName = mapper.convertValue(newUser.get("name"), String.class); if (this.user != null) { result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(ctx.getString(R.string.report_history_someone_assigneduser)); result.append(" "); } else { result.append(ctx.getString(R.string.report_history_assigneduser)); result.append(" "); } if (oldUser != null) { String oldUserName = mapper.convertValue(oldUser.get("name"), String.class); result.append(ctx.getString(R.string.report_history_fromuser)); result.append(" "); result.append("<b>"); result.append(oldUserName); result.append("</b> "); } result.append(ctx.getString(R.string.report_history_touser)); result.append(" "); result.append("<b>"); result.append(newUserName); result.append("</b>"); break; case KIND_COMMENT: Map newComment = (Map) this.changes.get("new"); String newMessage = mapper.convertValue(newComment.get("message"), String.class); int newVisibility = mapper.convertValue(newComment.get("visibility"), Integer.class); result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(ctx.getString(R.string.report_history_inserted)); result.append(" "); if (newVisibility == ReportItem.CommentType.TYPE_INTERNAL) { result.append(ctx.getString(R.string.report_history_internalcommend)); } else if (newVisibility == ReportItem.CommentType.TYPE_PRIVATE) { result.append(ctx.getString(R.string.report_history_privatecomment)); } else if (newVisibility == ReportItem.CommentType.TYPE_PUBLIC) { result.append(ctx.getString(R.string.report_history_publiccoment)); } result.append(" "); result.append("<b>"); result.append(newMessage); result.append("</b>"); break; case KIND_CREATION: Map newState = (Map) this.changes.get("new"); result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(ctx.getString(R.string.report_history_created)); if (newState != null) { String newStateName = mapper.convertValue(newState.get("title"), String.class); result.append(" "); result.append(ctx.getString(R.string.report_history_withstatus)); result.append(" "); result.append("<b>"); result.append(newStateName); result.append("</b>"); } break; case KIND_ADDRESS: case KIND_DESCRIPTION: String oldValue = (String) this.changes.get("old"); String newValue = (String) this.changes.get("new"); if (this.user != null) { result.append("<b>"); result.append(this.user.name); result.append("</b> "); result.append(ctx.getString(R.string.report_history_someone_changedproperty)); result.append(" "); } else { result.append(ctx.getString(R.string.report_history_changedproperty)); result.append(" "); } int propNameId = ctx.getResources() .getIdentifier("report_property_name_" + this.kind, "string", ctx.getPackageName()); String propName = this.kind; if (propNameId > 0) { propName = ctx.getString(propNameId); } result.append("<b>"); result.append(propName); result.append("</b> "); result.append(ctx.getString(R.string.report_history_from)); result.append(" "); result.append("<b>"); result.append(oldValue); result.append("</b> "); result.append(ctx.getString(R.string.report_history_to)); result.append(" "); result.append("<b>"); result.append(newValue); result.append("</b> "); break; } return result.toString(); } }
package com.example.admin.hocdatabinding; import android.databinding.DataBindingUtil; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.example.admin.hocdatabinding.databinding.ActivityMainBinding; import model.User; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActivityMainBinding binding= DataBindingUtil.setContentView(MainActivity.this,R.layout.activity_main); User user=new User("anh","khoa"); binding.setUser(user); } }
package Shapes; public class Rectangle extends Quadrilateral implements Measurable { protected double length;//protected property for length protected double width;//protected property for width public Rectangle(double length, double width){//define a constructor that accepts 2 numbers for length and width, set those properties super(length,width); } public double getArea(){ //create a getArea method return length*width; } public double getPerimeter(){ //create a getPerimeter method return 2*(length+width); } } //exercises from inheritance and polymorphism /* public class Rectangle2 { protected double length;//protected property for length protected double width;//protected property for width public Rectangle2(double length, double width){//define a constructor that accepts 2 numbers for length and width, set those properties this.length=length; this.width=width; } public double getArea(){ //create a getArea method return length*width; } public double getPerimeter(){ //create a getPerimeter method return 2*(length+width); } } */
package com.example.ecommerce.Model; public class Balance { private String sid,date,sellingAmount,invoiceNumber,products; public Balance() { } public Balance(String sid, String date, String sellingAmount, String invoiceNumber, String products) { this.sid = sid; this.date = date; this.sellingAmount = sellingAmount; this.invoiceNumber = invoiceNumber; this.products = products; } public String getSid() { return sid; } public void setSid(String sid) { this.sid = sid; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getSellingAmount() { return sellingAmount; } public void setSellingAmount(String sellingAmount) { this.sellingAmount = sellingAmount; } public String getInvoiceNumber() { return invoiceNumber; } public void setInvoiceNumber(String invoiceNumber) { this.invoiceNumber = invoiceNumber; } public String getProducts() { return products; } public void setProducts(String products) { this.products = products; } }
package com.darkania.darkers.extras; import java.io.File; import java.io.IOException; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.event.Listener; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import com.darkania.darkers.Darkers; public class YmlBaneados implements Listener { static YmlBaneados instance = new YmlBaneados(); Plugin p; FileConfiguration baneados; File lfile; public static YmlBaneados getInstance() { return instance; } public void setup(Plugin p) { this.lfile = new File(p.getDataFolder(), "baneados.yml"); if (!this.lfile.exists()) { try { this.lfile.createNewFile(); } catch (IOException e) { Darkers.logConsola(ChatColor.RED + "No se ha podido crear baneados.yml!"); return; } } this.baneados = YamlConfiguration.loadConfiguration(this.lfile); this.baneados.options().copyDefaults(true); saveBaneados(); } public FileConfiguration getBaneados() { return this.baneados; } public void saveBaneados() { try { this.baneados.save(this.lfile); } catch (IOException e) { Darkers.logConsola(ChatColor.RED+"No se ha podido guardar baneados.yml"); } } public void reloadBaneados() { this.baneados = YamlConfiguration.loadConfiguration(this.lfile); } public FileConfiguration getConfig() { return this.baneados; } public PluginDescriptionFile getDesc() { return this.p.getDescription(); } }
package com.tencent.mm.pluginsdk.model.app; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.pluginsdk.model.app.g.a; class g$4 implements OnClickListener { final /* synthetic */ a jLF; final /* synthetic */ String qzJ; final /* synthetic */ String qzK; final /* synthetic */ String sg; final /* synthetic */ Context val$context; final /* synthetic */ Intent val$intent; g$4(Context context, Intent intent, String str, String str2, String str3, a aVar) { this.val$context = context; this.val$intent = intent; this.sg = str; this.qzJ = str2; this.qzK = str3; this.jLF = aVar; } public final void onClick(DialogInterface dialogInterface, int i) { this.val$context.startActivity(this.val$intent); h.mEJ.h(14102, new Object[]{Integer.valueOf(0), Integer.valueOf(1), "", Integer.valueOf(1), this.sg, this.qzJ, this.qzK}); if (this.jLF != null) { this.jLF.cI(true); } } }
package com.anderson.slave_2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Slave2Application { public static void main(String[] args) { SpringApplication.run(Slave2Application.class, args); } }
package logic.treinamento.bean; import java.math.BigDecimal; import java.sql.SQLException; import java.sql.Date; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Resource; import javax.ejb.EJB; import javax.ejb.SessionContext; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import logic.treinamento.dao.InterfaceLancamentoDao; import logic.treinamento.dao.ManutencaoBancoDados; import logic.treinamento.model.Lancamento; import logic.treinamento.dao.TipoLancamentoEnum; import logic.treinamento.request.AtualizarLancamentoRequisicao; import logic.treinamento.request.LancarContasDoMesRequisicao; import utilitarios.Formatadores; @Stateless public class GestaoContas implements InterfaceGestaoContas { @EJB private InterfaceLancamentoDao lancamentoDao; @Resource private SessionContext context; @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void lancarContasDoMes(LancarContasDoMesRequisicao lancarContasDoMesRequisicao) throws Exception { try { Lancamento lanc = new Lancamento(); lanc.setNome(lancarContasDoMesRequisicao.getNome()); lanc.setValor(lancarContasDoMesRequisicao.getValor()); lanc.setIdTipoLancamento(lancarContasDoMesRequisicao.getIdTipoLancamento()); lanc.setData(Formatadores.validarDatasInformadas(lancarContasDoMesRequisicao.getData()).get(0)); String retornoValidacao = validarCamposObrigatorios(lanc); if (retornoValidacao.isEmpty()) { lancamentoDao.salvarContasDoMes(lanc); } } catch (Exception e) { context.setRollbackOnly(); } } @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void atualizarLancamento(AtualizarLancamentoRequisicao atualizarLancamentoRequisicao) throws Exception { try { Lancamento lanc = new Lancamento(); lanc.setId(atualizarLancamentoRequisicao.getId()); lanc.setNome(atualizarLancamentoRequisicao.getNomeAtualizado()); lanc.setValor(atualizarLancamentoRequisicao.getValorAtualizado()); lanc.setIdTipoLancamento(atualizarLancamentoRequisicao.getIdTipoLancamentoAtualizado()); lanc.setData(Formatadores.validarDatasInformadas(atualizarLancamentoRequisicao.getDataAtualizada()).get(0)); String retornoValidacao = validarCamposObrigatoriosAtualizacao(lanc); if (retornoValidacao.equals("")) { lancamentoDao.atualizarLancamento(lanc); } } catch (Exception e) { context.setRollbackOnly(); } } @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void excluirLancamento(int idLancamento) throws SQLException { try { if (idLancamento >= 0) { lancamentoDao.excluirLancamento(idLancamento); Logger.getLogger(GestaoContas.class.getName()).log(Level.SEVERE, null, "Lancamento Excluido com Sucesso!"); } else { Logger.getLogger(GestaoContas.class.getName()).log(Level.SEVERE, null, "E necessario informar o codigo do lancamento!"); } } catch (SQLException e) { context.setRollbackOnly(); } } @Override public List<Lancamento> pesquisarLancamentoPorPeriodo(String dataInicial, String dataFinal) throws Exception { List<Date> datas = Formatadores.validarDatasInformadas(dataInicial, dataFinal); return lancamentoDao.pesquisarLancamentoPorPeriodo(datas.get(0), datas.get(1)); } @Override public List<Lancamento> pesquisarLancamentoPorNome(String nome) throws SQLException { if (!nome.isEmpty()) { return lancamentoDao.pesquisarLancamentoPorNome(nome); } else { return null; } } @Override public List<Lancamento> pesquisarLancamentoPorTipoDeLancamento(int idtipolancamento) throws SQLException { if (!validarTipoLancamentoInformado(idtipolancamento)) { return lancamentoDao.pesquisarLancamentoPorTipoDeLancamento(idtipolancamento); } else { return null; } } @Override public String validarCamposObrigatorios(Lancamento lanc) { if (lanc.getNome() == null || lanc.getNome().isEmpty()) { return "E necessario informar o nome !"; } else if (lanc.getValor() == null || lanc.getValor().compareTo(BigDecimal.ZERO) <= 0) { return "E necessario informar um valor !"; } else if (lanc.getIdTipoLancamento() != TipoLancamentoEnum.DEPOSITO.getId() && lanc.getIdTipoLancamento() != TipoLancamentoEnum.SAQUE.getId() && lanc.getIdTipoLancamento() != TipoLancamentoEnum.TRANSFERENCIA.getId()) { return "E necessario informar um tipo de lancamento Valido !"; } else if (lanc.getData() == null) { return "E necessario informar a data do lancamento !"; } else { return ""; } } private String validarCamposObrigatoriosAtualizacao(Lancamento lanc) { if (lanc.getId() < 0) { return "E necessario informar o codigo do lancamento !"; } else if (lanc.getNome().isEmpty()) { return "E necessario informar o nome !"; } else if (lanc.getValor().compareTo(BigDecimal.ZERO) <= 0) { return "E necessario informar um valor !"; } else if (validarTipoLancamentoInformado(lanc.getIdTipoLancamento())) { return "E necessario informar um tipo de lancamento !"; } else if (lanc.getData() == null) { return "E necessario informar a data do lancamento !"; } else { return ""; } } private boolean validarTipoLancamentoInformado(int idtipolancamento) { if (idtipolancamento < 0) { return true; } else { return false; } } }
package zystudio.cases.androidmechanism; import android.app.Activity; import android.content.Context; import zystudio.mylib.utils.LogUtil; /** * 想看看到底那个Context 都是什么类.. */ public class CaseContextKinds { private static CaseContextKinds sInstance; private Activity mActivity; private CaseContextKinds() { } public static CaseContextKinds obtain(Activity activity) { if (sInstance == null) { sInstance = new CaseContextKinds(); } sInstance.mActivity=activity; return sInstance; } public void work() { Context appFromActivity= mActivity.getApplication(); LogUtil.log("appFromActivity:"+appFromActivity.getClass().getName()); Context appContextFromActivity= mActivity.getApplicationContext(); LogUtil.log("appContextFromActivity:"+appContextFromActivity.getClass().getName()); Context appContextFromApplication=mActivity.getApplication().getApplicationContext(); LogUtil.log("appContextFromApplication:"+appContextFromApplication.getClass().getName()); /** * 结论: 嗯,没错, 这三个都返回了 zystudio.demo.ZYDemoApp 。。。这可能只是接口的思路才会有各不同的函数了。它们返回是都一样的 */ } }
package com.boot.web.mq; import org.boot.utils.mq.ActiveMqSendUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import com.boot.WebStart; @RunWith(SpringRunner.class) @SpringBootTest(classes = WebStart.class) public class SpringbootJmsApplicationTests { @Test public void testActivemq(){ ActiveMqSendUtils.addMailToMailQueue("我是邮件内容"); ActiveMqSendUtils.addSmsToSmsQueue("我是短信内容"); } }
package interviewbit.backtracking; import java.util.ArrayList; public class LetterPhone { public ArrayList<String> letterCombinations(String a) { ArrayList<String> s =new ArrayList<String>(); return s; } }
package day10_ControlStatement_Part4; public class oddNumber { public static void main(String[] args) { for(int i=5; i<=140; i+=1) { if (i%2!=0) { System.out.print(i+ " "); } } } }
package org.yipuran.gsonhelper; import java.io.Reader; import java.io.StringReader; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; import java.util.regex.Pattern; import java.util.stream.Collectors; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; /** * JsonPattern:JSON書式判定. * <PRE> * 書式として扱う JSON素材に対して任意のJSONが、書式のJSONを満たす key を持っているか判定するクラス * 使い方: * // インスタンス生成は、書式JSON を String で渡すか、java.io.Reader で渡す。 * JsonPattern pattern = new JsonPattern("{ a:1, b:'name', c:false, d:{ e:'E' }"); * * // 書式チェックバリデーション * boolean b = pattern.validate("{ a:0, b:'beta', c:true, d:{ e:'', ee:4 }, f:2"); * → b is false * boolean b = pattern.validate("{ a:0, c:true, d:{ ee:4 }, f:2"); * → b is true * * // 不一致のキーと JsonType(enum定義)の Entryリストを参照 * List&lt;Entry&lt;String, JsonType&gt;&gt; list = pattern.unmatches(); * * Entryのキーは、階層を ":" で連結した表現、"{ A:{ B:2 } }" の A の下の B は、 "A:B" と表現する。 * JsonType(enum定義)は、以下のとおり定義されている。 * public enum JsonType{ * STRING, NUMBER, BOOLEAN, ARRAY, OBJECT, NULL; * } * * // 一致のキーと JsonType(enum定義)の Entryリストを参照 * List&lt;Entry&lt;String, JsonType&gt;&gt; list = pattern.matches(); * * // 指定JSON書式に存在しない、キーと JsonType(enum定義)の Entryリストを参照 * List&lt;Entry&lt;String, JsonType&gt;&gt; list = pattern.ignores(); * * // 指定JSON書式のキーと JsonType(enum定義)の Mapを参照 * Map&lt;String, JsonType&gt; map = pattern.getPatternMap(); * * // 書式に従ったサンプルJSON の生成 * String sample = pattern.format(); * 生成されるJSON は、JsonType(enum定義)に沿って以下の default値(value)で生成される。 * JsonType.STRING → "" 空文字 * JsonType.NUMBER → 0 * JsonType.BOOLEAN → false * JsonType.ARRAY → [] 空の 配列、但し中身がある場合は展開生成される * JsonType.OBJECT → {} 空の Object、但し中身がある場合は展開生成される * JsonType.NULL → null * 生成されるJSON文字列は。Google gson の setPrettyPrinting() で整形した文字列である。 * * 生成する対象のJsonType プリミティブ型については、上記の default値ではなく * JsonPattern インスタンスを返す setメソッドで変更することができる。 * → setDefaultBoolean(boolean), setDefaultString(String), setDefaultNumber(Number) メソッド * をチェイン(連結)して使用する。 * (例)JsonType.BOOLEAN に対して、true 値、 * JsonType.NUMBER に対して、2.75 (小数点) * JsonType.STRING に対して、"_" * で、format() で JSON文字列を生成する場合、、 * JsonPattern pattern = new JsonPattern(reader) * .setDefaultBoolean(true) * .setsetDefaultNumber(2.75) * .setDefaultString("_"); * String sample = pattern.format(); * * // 省略可能指定バリデーションチェック * 通常、書式JSON で記述した JSON キー(path)は必須でバリデーションチェックされるが、 * 書式JSON で記述していても省略可能とする場合は、 * JsonPattern インスタンスに、addOptional メソッドで追加する。 * JsonPattern pattern = new JsonPattern(reader).addOptional("e:e2"); * * // 正規表現バリデーションチェック * JSON キー(path)と正規表現を、JsonPattern インスタンスに、addRegExpress メソッドで追加する。 * JsonPattern pattern = new JsonPattern(reader).addRegExpress("a:b:c", "^[a-z]+$"); * * // 最小値と最大値のバリデーションチェック * JSON キー(path)と最小値 or 最大値を、JsonPattern インスタンスに、addMinValue or addMaxValue メソッドで追加する。 * JsonPattern pattern = new JsonPattern(reader).addMinValue("a:p", 1).addMaxValue("a:p", 10); * * // null を許可 * JSON キー(path)と最小値 or 最大値を、JsonPattern インスタンスに、addNullable メソッドで追加する。 * JsonPattern pattern = new JsonPattern(reader).addNullable("d"); * </PRE> */ public final class JsonPattern{ private Map<String, JsonType> vmap; private Map<String, Boolean> cmap; // true:OK private Map<String, JsonType> ignoremap; private Map<String, Boolean> optionalmap; private Map<String, Pattern> regexmap; private Map<String, Double> minimap; private Map<String, Double> maxmap; private Map<String, String> nullablemap; private JsonElement readelement; /** * コンストラクタ. * @param jsonstr 書式パターンとして指定するJSON文字列 */ public JsonPattern(String jsonstr){ this(new StringReader(jsonstr)); } /** * コンストラクタ. * @param reader 書式パターン読込みの java.io.Reader */ public JsonPattern(Reader reader){ vmap = new HashMap<>(); cmap = new HashMap<>(); ignoremap = new HashMap<>(); optionalmap = new HashMap<>(); regexmap = new HashMap<>(); minimap = new HashMap<>(); maxmap = new HashMap<>(); nullablemap = new HashMap<>(); readelement = JsonParser.parseReader(reader); scan_format(null, readelement); } private void scan_format(String k, JsonElement je){ JsonObject jo = je.getAsJsonObject(); if (jo.entrySet().size()==0){ vmap.put(k, JsonType.OBJECT); cmap.put(k, false); return; } String pkey = Optional.ofNullable(k).map(e->e + ":").orElse(""); for(Map.Entry<String, JsonElement> entry : jo.entrySet()){ String jk = entry.getKey(); String key = pkey + jk; JsonElement element = entry.getValue(); if (element.isJsonNull()){ vmap.put(key, JsonType.NULL); cmap.put(key, false); optionalmap.put(key, false); continue; } if (element.isJsonArray()){ vmap.put(key, JsonType.ARRAY); cmap.put(key, false); optionalmap.put(key, false); element.getAsJsonArray().forEach(e->{ if (e.isJsonObject()) scan_format(key, e); }); }else{ if (element.isJsonPrimitive()){ vmap.put(key, primitiveType(element.getAsJsonPrimitive())); cmap.put(key, false); optionalmap.put(key, false); }else{ scan_format(key, element); } } } } private JsonType primitiveType(JsonPrimitive jp){ if (jp.isBoolean()) return JsonType.BOOLEAN; if (jp.isNumber()) return JsonType.NUMBER; return JsonType.STRING; } /** * JSONタイプ enum. */ public enum JsonType{ STRING, NUMBER, BOOLEAN, ARRAY, OBJECT, NULL; } /** * バリデーションチェック(String), * @param jsonstr 検査対象のJSON文字列 * @return true = 不一致、書式JSONに存在するが、検査対象JSONに存在しないキー:value がある。 */ public boolean validate(String jsonstr){ return validate(new StringReader(jsonstr)); } /** * バリデーションチェック(Reader), * @param reader 検査対象のJSON文字列を読込む java.io.Reader * @return true = 不一致、書式JSONに存在するが、検査対象JSONに存在しないキー:value がある。 */ public boolean validate(Reader reader){ ignoremap.clear(); vmap.keySet().stream().forEachOrdered(key->cmap.put(key, optionalmap.get(key) ? true : false)); try{ JsonElement je = JsonParser.parseReader(reader); scan_validate(null, je); return cmap.values().stream().anyMatch(e->e.booleanValue()==false); }catch(Exception ex){ ex.printStackTrace(); return true; } } private void scan_validate(String k, JsonElement je){ JsonObject jo = je.getAsJsonObject(); if (jo.entrySet().size()==0){ cmap.put(k, false); if (vmap.containsKey(k)){ cmap.put(k, true); } return; } String pkey = Optional.ofNullable(k).map(e->e + ":").orElse(""); for(Map.Entry<String, JsonElement> entry : jo.entrySet()){ String key = pkey + entry.getKey(); JsonElement element = entry.getValue(); JsonType type = vmap.get(key); if (element.isJsonNull()){ if (type==null){ ignoremap.put(key, JsonType.NULL); continue; } if (!nullablemap.containsKey(key)) { ignoremap.put(key, JsonType.NULL); continue; } if (type.equals(JsonType.STRING) || type.equals(JsonType.NUMBER) || type.equals(JsonType.NULL)){ cmap.put(key, true); } continue; } if (element.isJsonArray()){ if (type==null){ ignoremap.put(key, JsonType.ARRAY); }else if(type.equals(JsonType.ARRAY)){ cmap.put(key, true); } element.getAsJsonArray().forEach(e->{ if (e.isJsonObject()){ scan_validate(key , e); } }); }else{ if (element.isJsonPrimitive()){ JsonType etype = primitiveType(element.getAsJsonPrimitive()); if (type==null){ ignoremap.put(key, etype); }else if(type.equals(etype)){ cmap.put(key, true); } if (JsonType.STRING.equals(primitiveType(element.getAsJsonPrimitive()))){ if (regexmap.containsKey(key)) { cmap.put(key, regexmap.get(key).matcher(element.getAsString()).matches()); } }else if(JsonType.NUMBER.equals(primitiveType(element.getAsJsonPrimitive()))){ if (minimap.containsKey(key)) { if (minimap.get(key) > element.getAsDouble()) cmap.put(key, false); } if (maxmap.containsKey(key)) { if (maxmap.get(key) < element.getAsDouble()) cmap.put(key, false); } } }else{ cmap.put(key, true); scan_validate(key, element); } } } } /** * 不一致のキーと JsonType(enum定義)の Entryリストを参照 * @return Entryのキーは、階層を ":" で連結した表現、 */ public List<Entry<String, JsonType>> unmatches(){ return vmap.entrySet().stream() .filter(e->cmap.get(e.getKey()).booleanValue()==false) .collect(Collectors.toList()); } /** * 一致のキーと JsonType(enum定義)の Entryリストを参照 * @return Entryのキーは、階層を ":" で連結した表現、 */ public List<Entry<String, JsonType>> matches(){ return vmap.entrySet().stream() .filter(e->cmap.get(e.getKey()).booleanValue()==true) .collect(Collectors.toList()); } /** * 無視されたキーと JsonType(enum定義)の Entryリストを参照 * @return Entryのキーは、階層を ":" で連結した表現、 */ public List<Entry<String, JsonType>> ignores(){ return ignoremap.entrySet().stream().collect(Collectors.toList()); } /** * 指定JSON書式のキーと JsonType(enum定義)の Mapを参照 * @return Map&lt;String, JsonType&gt; */ public Map<String, JsonType> getPatternMap(){ return vmap; } /** * 書式に従ったサンプルJSON の生成. * <PRE> * 生成されるJSON は、JsonType(enum定義)に沿って以下の default値(value)で生成される。 * この default値は、setDefaultBoolean(boolean), setDefaultString(String), setDefaultNumber(Number) メソッドで * 変更して使用することができる。 * JsonType.STRING → "" 空文字 * JsonType.NUMBER → 0 * JsonType.BOOLEAN → false * JsonType.ARRAY → [] 空の 配列、但し中身がある場合は展開生成される * JsonType.OBJET → {} 空の Object、但し中身がある場合は展開生成される * JsonType.NULL → null * 生成されるJSON文字列は。Google gson の setPrettyPrinting() で整形した文字列である。 * </PRE> * @return サンプルJSON */ public String format(){ JsonObject jo = makejson(null, readelement, new JsonObject()); Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().create(); return gson.toJson(jo); } private boolean default_boolean = false; private String default_string = ""; private Number default_number = 0; /** * format JSON生成 Boolean 値のセット. * @param default_boolean * @return JsonPattern */ public JsonPattern setDefaultBoolean(boolean default_boolean){ this.default_boolean = default_boolean; return this; } /** * format JSON生成 String 値のセット. * @param default_string * @return JsonPattern */ public JsonPattern setDefaultString(String default_string){ this.default_string = default_string; return this; } /** * format JSON生成 数値のセット. * @param default_number Number型、整数、小数点を設定できる * @return JsonPattern */ public JsonPattern setDefaultNumber(Number default_number){ this.default_number = default_number; return this; } private JsonObject makejson(String k, JsonElement je, JsonObject job){ JsonObject jo = je.getAsJsonObject(); if (jo.entrySet().size()==0){ job.add(k, new JsonObject()); return job; } String pkey = Optional.ofNullable(k).map(e->e + ":").orElse(""); for(Map.Entry<String, JsonElement> entry : jo.entrySet()){ String jk = entry.getKey(); String key = pkey + jk; JsonElement element = entry.getValue(); if (element.isJsonNull()){ job.add(jk, null); continue; } if (element.isJsonArray()){ JsonArray ary = new JsonArray(); element.getAsJsonArray().forEach(e->{ if (e.isJsonObject()){ if (ary.size()==0){ ary.add(makejson(key, e, new JsonObject())); }else{ makejson(key, e, new JsonObject()); } } }); job.add(jk, ary); }else{ if (element.isJsonPrimitive()){ JsonType type = primitiveType(element.getAsJsonPrimitive()); if (type.equals(JsonType.BOOLEAN)){ job.addProperty(jk, default_boolean); }else if(type.equals(JsonType.NUMBER)){ job.addProperty(jk, default_number); }else if(type.equals(JsonType.STRING)){ job.addProperty(jk, default_string); } }else{ if (element.deepCopy().toString().equals("{}")){ makejson(jk, element, job); }else{ job.add(jk, makejson(key, element, new JsonObject())); } } } } return job; } /** * 省略可能を指定 * @param pathes JSONパスを ":" 区切りで指定 * @return JsonPattern */ public JsonPattern addOptional(String...pathes) { for(String p:pathes) optionalmap.put(p, true); return this; } /** * 省略可能を指定 * @param pathlist 省略可能を指定JSONパスを ":" 区切りをリストで指定 * @return */ public JsonPattern addOptional(List<String> pathlist) { for(String p:pathlist) optionalmap.put(p, true); return this; } /** * 正規表現チェック追加 * @param key JSONパスを ":" 区切り * @param regex 正規表現 * @return JsonPattern */ public JsonPattern addRegExpress(String key, String regex) { regexmap.put(key, Pattern.compile(regex)); return this; } /** * 正規表現チェック追加 * @param map key=JSONパスを ":" 区切り、value=正規表現のMap * @return JsonPattern */ public JsonPattern addRegExpress(Map<String, String> map) { map.entrySet().stream().forEach(e->regexmap.put(e.getKey(), Pattern.compile(e.getValue()))); return this; } /** * 最小値チェック追加 * @param key key=JSONパスを ":" 区切り * @param n 最小値 * @return JsonPattern */ public JsonPattern addMinValue(String key, Number n) { minimap.put(key, n.doubleValue()); return this; } /** * 最大値チェック追加 * @param key key=JSONパスを ":" 区切り * @param n 最大値 * @return JsonPattern */ public JsonPattern addMaxValue(String key, Number n) { maxmap.put(key, n.doubleValue()); return this; } /** * Nullを許可を追加 * @param key key=JSONパスを ":" 区切り * @return JsonPattern */ public JsonPattern addNullable(String key) { nullablemap.put(key, key); return this; } }
// ********************************************************************** // This file was generated by a TAF parser! // TAF version 3.2.1.6 by WSRD Tencent. // Generated from `/data/jcetool/taf//upload/opalli/pitu_meta_protocol.jce' // ********************************************************************** package NS_PITU_META_PROTOCOL; public final class stMetaMaterialFeedItem extends com.qq.taf.jce.JceStruct { public int type = 0; public stMetaMaterialFeedImage image = null; public stMetaMaterialFeedVideo video = null; public String desc = ""; public String jump_url = ""; public stMetaMaterialFeedItem() { } public stMetaMaterialFeedItem(int type, stMetaMaterialFeedImage image, stMetaMaterialFeedVideo video, String desc, String jump_url) { this.type = type; this.image = image; this.video = video; this.desc = desc; this.jump_url = jump_url; } public void writeTo(com.qq.taf.jce.JceOutputStream _os) { _os.write(type, 0); if (null != image) { _os.write(image, 1); } if (null != video) { _os.write(video, 2); } if (null != desc) { _os.write(desc, 3); } if (null != jump_url) { _os.write(jump_url, 4); } } static int cache_type; static { cache_type = 0; } static stMetaMaterialFeedImage cache_image; static { cache_image = new stMetaMaterialFeedImage(); } static stMetaMaterialFeedVideo cache_video; static { cache_video = new stMetaMaterialFeedVideo(); } public void readFrom(com.qq.taf.jce.JceInputStream _is) { this.type = (int) _is.read(type, 0, false); this.image = (stMetaMaterialFeedImage) _is.read(cache_image, 1, false); this.video = (stMetaMaterialFeedVideo) _is.read(cache_video, 2, false); this.desc = _is.readString(3, false); this.jump_url = _is.readString(4, false); } }
//You have an empty sequence, and you will be given queries. Each query is one of these three types: // //1 x -Push the element x into the stack. //2 -Delete the element present at the top of the stack. //3 -Print the maximum element in the stack. //Input Format // //The first line of input contains an integer, . The next lines each contain an above mentioned query. (It is guaranteed that each query is valid.) // //Constraints // // // //Output Format // //For each type query, print the maximum element in the stack on a new line. // //Sample Input // //10 //1 97 //2 //1 20 //2 //1 26 //1 20 //2 //3 //1 91 //3 //Sample Output // //26 //91 import java.io.*; import java.util.*; public class MaximumValue { public static void main(String[] args) { Scanner inputReader = new Scanner(System.in); long n = inputReader.nextInt(); Stack<Long> operations = new Stack<>(); for(long i = 0; i<n; i++){ long option = inputReader.nextInt(); if(option == 1){ long push = inputReader.nextInt(); operations.push(push); } else if(option == 2){ operations.pop(); } else if(option == 3){ long max = Long.MIN_VALUE; for(int j = 0;j<operations.size();j++){ if(max < operations.get(j)) max = operations.get(j); } System.out.println(max); } } } }
package com.tencent.mm.plugin.wenote.model.nativenote.c; import android.support.v7.widget.RecyclerView; import android.text.Editable; import android.text.Spanned; import android.view.View; import android.view.View.OnClickListener; import com.tencent.mm.plugin.wenote.model.a.b; import com.tencent.mm.plugin.wenote.model.a.h; import com.tencent.mm.plugin.wenote.model.nativenote.a.a; import com.tencent.mm.plugin.wenote.model.nativenote.manager.c; import com.tencent.mm.sdk.platformtools.x; class e$12 implements OnClickListener { final /* synthetic */ e qsJ; public e$12(e eVar) { this.qsJ = eVar; } public final void onClick(View view) { b bVar = null; x.i("NoteSelectManager", "select"); this.qsJ.cav(); if (!e.cD()) { x.e("NoteSelectManager", "select: not init"); } else if (this.qsJ.cao() != 1) { x.e("NoteSelectManager", "select: not insert"); e.h(this.qsJ); } else if (c.bZD().Bv(e.i(this.qsJ).dHJ) == null) { x.e("NoteSelectManager", "select: item is null"); e.h(this.qsJ); } else { RecyclerView a = e.a(this.qsJ); if (a == null) { x.e("NoteSelectManager", "select: recyclerView is null"); e.h(this.qsJ); return; } c dd = f.dd(f.g(a, e.i(this.qsJ).dHJ)); if (dd == null) { x.e("NoteSelectManager", "select: rteInfo is null"); e.h(this.qsJ); } else if (dd.qrX != null) { Editable text = dd.qrX.getText(); if (text == null) { x.e("NoteSelectManager", "select: text is null"); e.h(this.qsJ); } else if (text.length() > 0) { dd.qrX.ae(e.i(this.qsJ).startOffset, true); } else { b Bv = c.bZD().Bv(e.i(this.qsJ).dHJ - 1); if (Bv != null && Bv.getType() == -3) { Bv = null; } b Bv2 = c.bZD().Bv(e.i(this.qsJ).dHJ + 1); if (Bv2 == null || Bv2.getType() != -2) { bVar = Bv2; } if (Bv != null) { if (Bv.getType() == 1) { Spanned Sk = a.Sk(((h) Bv).content); if (Sk == null) { x.e("NoteSelectManager", "select: spanned is null"); e.h(this.qsJ); return; } this.qsJ.w(e.i(this.qsJ).dHJ - 1, Sk.length(), e.i(this.qsJ).dHJ, 0); } else { this.qsJ.w(e.i(this.qsJ).dHJ - 1, 0, e.i(this.qsJ).dHJ, 0); } } else if (bVar == null) { x.e("NoteSelectManager", "select: no neighbor"); e.h(this.qsJ); return; } else if (bVar.getType() == 1) { this.qsJ.w(e.i(this.qsJ).dHJ, 0, e.i(this.qsJ).dHJ + 1, 0); } else { this.qsJ.w(e.i(this.qsJ).dHJ, 0, e.i(this.qsJ).dHJ + 1, 1); } e.e(this.qsJ); this.qsJ.Q(true, true); } } else if (dd.qrY == null || dd.qrZ == null) { x.e("NoteSelectManager", "select: rteInfo invalid"); e.h(this.qsJ); } else { e.e(this.qsJ); this.qsJ.w(e.i(this.qsJ).dHJ, 0, e.i(this.qsJ).dHJ, 1); this.qsJ.Q(true, true); } } } }
package com.lec.ex04; //TestClass로부터 상속받고 ,i11를 구현 받는다 (처음 파일 만들떄 이렇게했다) public class TestChildClass extends TestClass implements I11 { @Override public void m11() { System.out.println("상수i11=" + i11); } }
package com.cloudogu.smeagol.wiki.infrastructure; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.concurrent.TimeUnit; @Configuration public class PullChangesInjectionFactory { @Bean @ConditionalOnProperty(name = "git.pull-strategy", havingValue = "always") public PullChangesStrategy createAlwaysPullStrategy() { return new AlwaysPullChangesStrategy(); } @Bean @ConditionalOnProperty(name = "git.pull-strategy", havingValue = "once-a-minute") public PullChangesStrategy createOnceAMinutePullStrategy() { return new TimeBasedPullChangesStrategy(TimeUnit.MINUTES.toMillis(1L)); } @Bean @ConditionalOnProperty(name = "git.pull-strategy", havingValue = "every-ten-seconds", matchIfMissing = true) public PullChangesStrategy createEveryTenSecondsPullStrategy() { return new TimeBasedPullChangesStrategy(TimeUnit.SECONDS.toMillis(10L)); } }
package org.iptc.extra.core.eql.tree.extra; import org.iptc.extra.core.eql.tree.nodes.Relation; public enum EQLRelation { CONTAIN ("="), EXACT ("=="), NOT_EQUAL ("<>"), LT ("<"), LTE ("<="), GT (">"), GTE (">="), ADJ ("adj"), ALL ("all"), ANY ("any"), WITHIN ("within"); private final String relation; EQLRelation(String relation) { this.relation = relation; }; private String relation() { return relation; } public static boolean isValid(Relation relation) { String r = relation.getRelation(); if(r == null) { return false; } r = r.toLowerCase(); if(r.equals(CONTAIN.relation())) { return true; } if(r.equals(EXACT.relation())) { return true; } if(r.equals(NOT_EQUAL.relation())) { return true; } if(r.equals(LT.relation()) || r.equals(LTE.relation())) { return true; } if(r.equals(GT.relation()) || r.equals(GTE.relation())) { return true; } if(r.equals(ADJ.relation())) { return true; } if(r.equals(ALL.relation())) { return true; } if(r.equals(ANY.relation())) { return true; } if(r.equals(WITHIN.relation())) { return true; } return false; } }
package com.musala.edu.patterns.abstractfactory.model; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.LinkedList; import java.util.List; import org.junit.Test; /** * The <code>TestDessert</code> consists of tests on the {@link Dessert} derived * model classes * * @author georgi.kavalov * */ public class TestDessert { /** * Tests the creation of an {@link EasternDessert} object */ @Test public void testEasternDessert() { List<String> ingredients = new LinkedList<String>(); ingredients.add("Fruit"); ingredients.add("Sugar Syrup"); ingredients.add("Light Cream"); Dessert dessert = new EasternDessert("Cake", ingredients); assertNotNull(dessert); assertTrue(dessert.isPrepared()); } /** * Tests the creation of a {@link WesternDessert} object */ @Test public void testWesternDessert() { List<String> ingredients = new LinkedList<String>(); ingredients.add("Suet"); ingredients.add("Custard"); ingredients.add("Raisins"); Dessert dessert = new WesternDessert("Spotted dick with custard", ingredients); assertNotNull(dessert); assertTrue(dessert.isPrepared()); } }
package org.training.issuetracker.dao.interfaces; import java.util.List; import org.training.issuetracker.dao.entities.Issue; /** * Interface, providing access to the issues and their data * @author Dzmitry Salnikau * @since 03.01.2013 */ public interface IssueDAO { /** * @return List of all issues */ public List<Issue> getIssues(); /** * Returns Issue object with stated issueId * @param issueId * @return Issue */ public Issue getIssueById(Integer issueId); /** * @param filter * @return List of all issues that matches search filter */ public List<Issue> getIssuesUsingFilter(String filter); /** * Adds new issue in a data storage * @param Issue * @return boolean - true, if it was successful */ public boolean createIssue(Issue issue); /** * Update the issue's data * @param Issue * @return boolean - true, if it was successful */ public boolean updateIssue(Issue issue); /** * Delete issue from a data storage by the unique issueId * @param issueId * @return boolean - true, if it was successful */ public boolean deleteIssue(Integer issueId); }
package 异常; public class 执行顺序 { boolean testEx() throws Exception{ boolean ret=true; try{ ret=testEx1(); }catch (Exception e){ System.out.println("testEx,catch exception"); ret=false; throw e; }finally { System.out.println("testEx finally; return true"+ret); return ret; } } boolean testEx1() throws Exception{ boolean ret=true; try { ret=testEx2(); if(!ret){//return前,先执行finally,finally里面有return。结果这个return也没有执行 return false; } System.out.println("testEx1, at the end of try"); return ret; }catch (Exception e){ System.out.println("testEx1, catch exception"); ret=false; throw e; }finally { System.out.println("testEx1, finally; return value="+ret); return ret; } } boolean testEx2()throws Exception{ boolean ret=true; try { int b=12; int c; for (int i = 2; i >=-2 ; i--) { c=b/i; System.out.println("i="+i); } return true; }catch (Exception e){ System.out.println("testEx2, catch exception"); ret=false; System.out.println("---"); throw e; }finally { System.out.println("testEx2,finally return value="+ret); return ret; } } public static void main(String[] args) { 执行顺序 test=new 执行顺序(); try { test.testEx(); }catch (Exception e){ e.printStackTrace(); } } }
package com.tencent.mm.plugin.game.gamewebview.jsapi.biz; import com.tencent.mm.plugin.game.gamewebview.ipc.GameProcessActivityTask.a; import com.tencent.mm.plugin.game.gamewebview.jsapi.biz.GameJsApiSendAppMessage.SendAppMessageTask; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.widget.snackbar.a.c; class GameJsApiSendAppMessage$SendAppMessageTask$1 implements c { final /* synthetic */ a jGc; final /* synthetic */ SendAppMessageTask jHx; GameJsApiSendAppMessage$SendAppMessageTask$1(SendAppMessageTask sendAppMessageTask, a aVar) { this.jHx = sendAppMessageTask; this.jGc = aVar; } public final void onShow() { } public final void onHide() { x.d("MicroMsg.GameJsApiSendAppMessage", "onHide"); this.jGc.ahz(); } public final void aSx() { } }
package controller; import java.io.IOException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.bson.types.ObjectId; import model.Category; import model.Post; @WebServlet("/edit") public class editController extends HttpServlet { private static final long serialVersionUID = 1L; public editController() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8"); String p = request.getParameter("p"); ObjectId post_id = new ObjectId((String)request.getParameter("postID")); Post post = Post.GetPostByID(post_id); String title = post.getTitle(); String content = post.getContent(); String category = post.getCategory(); boolean is_public = post.getIs_public(); List<Category> lstCategories = Category.GetAllCategories(); request.setAttribute("lstCat", lstCategories); request.setAttribute("title", title); request.setAttribute("content", content); request.setAttribute("category", category); request.setAttribute("is_public", is_public); request.setAttribute("is_logged", true); request.setAttribute("p", p); String url = "/posts/edit.jsp"; RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
class Solution { public int[] sortedSquares(int[] A) { int res[] = new int[A.length]; for(int i =0; i<A.length;i++) { res[i]=(int)Math.pow(A[i],2); } Arrays.sort(res); return res; } }
package edu.wayne.cs.severe.redress2.entity.refactoring.formulas.rdi; import edu.wayne.cs.severe.redress2.controller.HierarchyBuilder; import edu.wayne.cs.severe.redress2.controller.metric.CodeMetric; import edu.wayne.cs.severe.redress2.controller.metric.DITMetric; import edu.wayne.cs.severe.redress2.entity.TypeDeclaration; import edu.wayne.cs.severe.redress2.entity.refactoring.RefactoringOperation; import java.util.*; public class DITReplaceDelegInhPF extends ReplaceDelegInherPredFormula { private HierarchyBuilder builder; public DITReplaceDelegInhPF(HierarchyBuilder builder) { this.builder = builder; } @Override public HashMap<String, Double> predictMetrVal(RefactoringOperation ref, LinkedHashMap<String, LinkedHashMap<String, Double>> prevMetrics) throws Exception { TypeDeclaration srcCls = getSourceClass(ref); TypeDeclaration tgtCls = getTargetClass(ref); DITMetric metric = (DITMetric) getMetric(); HashMap<String, Double> predMetrs = new HashMap<String, Double>(); Double delta = getDelta(srcCls, tgtCls, metric); predMetrs.put(srcCls.getQualifiedName(), delta); LinkedHashMap<String, Double> prevMetrsTgt = prevMetrics.get(tgtCls .getQualifiedName()); Double prevMetrTgt = prevMetrsTgt == null ? 0.0 : prevMetrsTgt .get(getMetric().getMetricAcronym()); predMetrs.put(tgtCls.getQualifiedName(), prevMetrTgt); return predMetrs; } private Double getDelta(TypeDeclaration srcCls, TypeDeclaration tgtCls, DITMetric metric) throws Exception { HashMap<String, List<TypeDeclaration>> parentClasses = builder .getParentClasses(); List<TypeDeclaration> superClasses = parentClasses.get(srcCls .getQualifiedName()); if (superClasses == null || superClasses.isEmpty()) { superClasses = new ArrayList<TypeDeclaration>(); } superClasses.add(tgtCls); // get the dit for every class List<Double> ditsClasses = metric.getDitsClasses(superClasses); // choose the greatest return Collections.max(ditsClasses) + 1; } @Override public CodeMetric getMetric() { return new DITMetric(null, builder); } }
package com.tencent.mm.plugin.record.ui; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import com.tencent.mm.R; import com.tencent.mm.g.a.fz; import com.tencent.mm.plugin.record.ui.FavRecordDetailUI.2.2; import com.tencent.mm.sdk.b.a; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.base.h; import com.tencent.mm.ui.base.p; class FavRecordDetailUI$2$2$1 implements OnClickListener { final /* synthetic */ 2 msJ; FavRecordDetailUI$2$2$1(2 2) { this.msJ = 2; } public final void onClick(DialogInterface dialogInterface, int i) { final p a = h.a(this.msJ.msI.msF.mController.tml, this.msJ.msI.msF.getString(R.l.app_delete_tips), false, null); fz fzVar = new fz(); fzVar.bOL.type = 12; fzVar.bOL.bJA = this.msJ.msI.msF.msC; fzVar.bOL.bOQ = new Runnable() { public final void run() { a.dismiss(); x.d("MicroMsg.FavRecordDetailUI", "do del, local id %d", new Object[]{Long.valueOf(FavRecordDetailUI$2$2$1.this.msJ.msI.msF.msC)}); FavRecordDetailUI$2$2$1.this.msJ.msI.msF.finish(); } }; a.sFg.m(fzVar); } }
package Chapter9; public class Exercise9_7 { static boolean contains(String src, String target) { return src.indexOf(target) != -1; } public static void main(String args[]) { System.out.println(contains("12345", "23")); System.out.println(contains("12345", "67")); } }
import java.util.concurrent.CountDownLatch; /** * @author QianHuaSheng * @version V1.0 * @description * @date 2018/11/6 */ public class CountDownLatchTest { public static void main(String[] args) { CountDownLatch countDownLatch1=new CountDownLatch(1); CountDownLatch countDownLatch2=new CountDownLatch(1); Thread1 thread11 = new Thread1(); //线程一 扣一的count thread11.countDownLatch=countDownLatch1; Thread thread1 = new Thread(thread11); //线程二 等待线程一 扣二 Thread2 thread21 = new Thread2(); thread21.countDownLatch=countDownLatch2; thread21.awiatCountDownLatch=countDownLatch1; Thread thread2 = new Thread(thread21); //线程三 等二 Thread3 thread31 = new Thread3(); thread31.awiatCountDownLatch=countDownLatch2; Thread thread3 = new Thread(thread31); thread1.start(); thread2.start(); thread3.start(); } } class Thread1 implements Runnable{ CountDownLatch countDownLatch; public void run() { countDownLatch.countDown(); System.out.println("线程一开始执行"); } } class Thread2 implements Runnable{ CountDownLatch countDownLatch; CountDownLatch awiatCountDownLatch; public void run() { try { awiatCountDownLatch.await(); } catch (InterruptedException e) { e.printStackTrace(); } countDownLatch.countDown(); System.out.println("线程二开始执行"); } } class Thread3 implements Runnable{ CountDownLatch awiatCountDownLatch; public void run() { try { awiatCountDownLatch.await(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("线程三开始执行"); } }
package csci152.lesson8_tests; import csci152.adt.Stack; import csci152.adt.Queue; import csci152.impl.ArrayStack; import csci152.impl.ArrayQueue; public class Main { public static void main(String[] args) { Stack<Integer> stack = new ArrayStack(); /* #1 */ for(int i = 0; i<10; i++) { stack.push(i); } print(evenCount(stack)); print(stack); /* #4 */ reverseStack(stack); print(stack); /* #6 */ Queue<Integer> queue = new ArrayQueue(); queue.enqueue(1); queue.enqueue(2); queue.enqueue(2); print(isPalindrome(queue)); /* #7 */ stack.clear(); for(int i = 0; i<10; i++) { stack.push(i); } insert(stack, 1, 999); print(stack); } // Methods start here public static void print(Object args) { System.out.println(args); } /* #1 */ public static int evenCount(Stack<Integer> stk) { Stack<Integer> temp = new ArrayStack<>(); int count = 0; int num; while(true) { try { num = stk.pop(); } catch (Exception ex) { break; } temp.push(num); if(num % 2 == 0 && num != 0) count++; } while(true) { try { num = temp.pop(); } catch (Exception ex) { break; } stk.push(num); } return count; } /* #4 */ public static void reverseStack(Stack<Integer> stk) { Queue<Integer> queue = new ArrayQueue<>(); int num; while(true) { try{ num = stk.pop(); queue.enqueue(num); } catch (Exception ex) { break; } } while(true) { try{ num = queue.dequeue(); stk.push(num); } catch (Exception ex) { break; } } } /* #6 */ public static boolean isPalindrome(Queue<Integer> q) { Stack<Integer> stk = new ArrayStack<>(); Queue<Integer> bkp = new ArrayQueue<>(); boolean result = true; int num, a, b, size = q.getSize(); for(int i = 0; i<size; i++){ try { num = q.dequeue(); bkp.enqueue(num); stk.push(num); } catch (Exception ex) { break; } } print(stk); for(int i = 0; i<size; i++){ try { a = bkp.dequeue(); b = stk.pop(); } catch (Exception ex) { break; } if(a != b) { result = false; break; } } return result; } /* #7 */ public static void insert(Stack<Integer> st, int pos, int val) { int size = st.getSize(), num; if(pos == 0) return; else if(pos>size) st.push(val); else { Stack<Integer> bkp = new ArrayStack<>(); for(int i = 0; i<size-pos; i++) { try { num = st.pop(); bkp.push(num); } catch (Exception ex) { print("Exception caught"); break; } } st.push(val); size = bkp.getSize(); for(int i = 0; i<size; i++) { try { num = bkp.pop(); st.push(num); } catch (Exception ex) { print("Exception caught"); break; } } } } }
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); char d = in.next().charAt(0); int x = in.nextInt(); int y = in.nextInt(); // Write Your Code Here in.close(); ArrayList<ArrayList<Integer>> grid = new ArrayList<ArrayList<Integer>>(); boolean down = false; boolean up = false; boolean right = false; boolean left = false; // 1-Make the grid for(int i = 0; i < n; i++) { grid.add(new ArrayList<Integer>(Collections.nCopies(n, 0))); } // E-Handle case e 0 n if(d == 'e' && x == 0 && y == n-1) { down = true; // System.out.println("case e 0 n-1"); int time = 1; for(int col = n - 1; col >= 0; col--) { // Loop n times from right to left // Go down case if(down == true) { for(int i = 0; i < n; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // E2-Handle case e n-1 n-1 if(d == 'e' && x == (n-1) && y == (n-1)) { down = false; // System.out.println("case e 0 n"); int time = 1; for(int col = n - 1; col >= 0; col--) { // Loop n times from right to left // Go down case if(down == true) { for(int i = 0; i < n; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // E3-Handle case e 0 0 if(d == 'e' && x == 0 && y == 0) { down = true; // System.out.println("case e 0 0"); int time = 1; // Start time // Go straight right first for(int i = 0; i < n; i++) { grid.get(0).set(i, time); time++; } // Then traverse for(int col = n - 1; col >= 0; col--) { // Loop n times from right to left // Go down case if(down == true) { for(int i = 1; i < n; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 1; i >= 1; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // E4-Handle case e n-1 0 if(d == 'e' && x == n-1 && y == 0) { down = false; // System.out.println("case e 0 0"); int time = 1; // Start time // Go straight right first for(int i = 0; i < n; i++) { grid.get(n - 1).set(i, time); time++; } // Then traverse for(int col = n - 1; col >= 0; col--) { // Loop n times from right to left // Go down case if(down == true) { for(int i = 0; i < n - 1; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 2; i >= 0; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // W1-Handle case w 0 0 if(d == 'w' && x == 0 && y == 0) { down = true; //.println("case w 0 0"); int time = 1; // Start time // Then traverse for(int col = 0; col <= n - 1; col++) { // Loop n times from left to right // Go down case if(down == true) { for(int i = 0; i <= n - 1; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // W2-Handle case w n-1 0 if(d == 'w' && x == n-1 && y == 0) { down = false; // //.println("case w n-1 0"); int time = 1; // Start time // Then traverse for(int col = 0; col <= n - 1; col++) { // Loop n times from left to right // Go down case if(down == true) { for(int i = 0; i <= n - 1; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // W3-Handle case w 0 n-1 if(d == 'w' && x == 0 && y == (n-1)) { down = true; //.out.println("case w 0 n-1"); int time = 1; // Start time // Go Straight left for(int i = n-1; i >= 0; i--) { grid.get(0).set(i, time); time++; } // Then traverse for(int col = 0; col <= n - 1; col++) { // Loop n times from left to right // Go down case if(down == true) { for(int i = 1; i <= n - 1; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 1; i >= 1; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // W4-Handle case w n-1 n-1 if(d == 'w' && x == (n-1) && y == (n-1)) { down = false; //.out.println("case w 0 n-1"); int time = 1; // Start time // Go Straight left for(int i = n-1; i >= 0; i--) { grid.get(n-1).set(i, time); time++; } // Then traverse for(int col = 0; col <= n - 1; col++) { // Loop n times from left to right // Go down case if(down == true) { for(int i = 0; i <= n - 2; i++) { // Loop n times going down grid.get(i).set(col, time); time++; } } // Go up case if(down == false) { for(int i = n - 2; i >= 0; i--) { // Loop n times going up grid.get(i).set(col, time); time++; } } if(down == true) { // Change down flag so snake knows which direction it followed last down = false; } else { down = true; } } } // S1-Handle case s 0 0 if(d == 's' && x == 0 && y == 0) { right = true; //.out.println("case s 0 0"); int time = 1; // Start time // Go Straight down for(int i = 0; i <= n - 1; i++) { grid.get(i).set(0, time); time++; } // Then traverse for(int row = n - 1; row >= 0; row--) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 1; i <= n - 1; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 1; i >= 1; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } // S2-Handle case s n-1 0 if(d == 's' && x == (n-1) && y == 0) { right = true; //.out.println("case s n-1 0"); int time = 1; // Start time // Traverse for(int row = n - 1; row >= 0; row--) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 0; i <= n - 1; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } // S3-Handle case s 0 n-1 if(d == 's' && x == 0 && y == n-1) { right = false; //.out.println("case s3 0 n-1"); int time = 1; // Start time // Go Straight down for(int i = 0; i <= n - 1; i++) { grid.get(i).set(n-1, time); time++; } // Then traverse for(int row = n - 1; row >= 0; row--) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 0; i <= n - 2; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 2; i >= 0; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } // S4-Handle case s n-1 n-1 if(d == 's' && x == (n-1) && y == (n-1)) { right = false; //.out.println("case s4 n-1 n-1"); int time = 1; // Start time // Traverse for(int row = n - 1; row >= 0; row--) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 0; i <= n - 1; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } // N1-Handle case s 0 0 if(d == 'n' && x == 0 && y == 0) { right = true; //.out.println("case n 0 0"); int time = 1; // Start time // Traverse for(int row = 0; row <= n-1; row++) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 0; i <= n - 1; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } // N2-Handle case s n-1 0 if(d == 'n' && x == (n-1) && y == 0) { right = true; //.out.println("case n n-1 0"); int time = 1; // Start time // Go Straight up for(int i = n-1; i >= 0; i--) { grid.get(i).set(0, time); time++; } // Traverse for(int row = 0; row <= n-1; row++) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 1; i <= n - 1; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 1; i >= 1; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } // N3-Handle case n 0 n-1 if(d == 'n' && x == 0 && y == n-1) { right = false; //.out.println("case n 0 n-1"); int time = 1; // Start time // Traverse for(int row = 0; row <= n-1; row++) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 0; i <= n - 1; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 1; i >= 0; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } // N4-Handle case s n-1 n-1 if(d == 'n' && x == (n-1) && y == (n-1)) { right = false; //.out.println("case n n-1 n-1"); int time = 1; // Start time // Go Straight up for(int i = n-1; i >= 0; i--) { grid.get(i).set(n-1, time); time++; } // Traverse for(int row = 0; row <= n-1; row++) { // Loop n times from top to bottom // Go right case if(right == true) { for(int i = 0; i <= n - 2; i++) { // Loop n times going right grid.get(row).set(i, time); time++; } } // Go left case if(right == false) { for(int i = n - 2; i >= 0; i--) { // Loop n times going left grid.get(row).set(i, time); time++; } } if(right == true) { // Change down flag so snake knows which direction it followed last right = false; } else { right = true; } } } //print the grid //.out.println(); //.out.println(); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { System.out.print(grid.get(i).get(j) + " "); } System.out.println(); } } }
package com.example.algorithm.matchengine; import java.util.List; /** * Date: 2019年07月28日 10:22 <br/> * * 交易撮合引擎 * * @author lcc * @since 1.0.0 */ public class TradeMatchEngine { private SellerOrderQueue sellerOrderQueue; private BuyerOrderQueue buyerOrderQueue; public List<TradeOrder> consumeTradeMessage(TradeMessage message) { switch (message.getTradeType()) { case buying: case selling: } return null; } }
package backjoon.condition; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Backjoon2884 { private static final int ALARM_MIN = 45; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int hour, min; hour = Integer.parseInt(st.nextToken()); min = Integer.parseInt(st.nextToken()); if(hour == 0){ if(min < ALARM_MIN){ hour = 23; min = min + 15; } else{ min = min - ALARM_MIN; } } else{ if(min < ALARM_MIN){ hour -= 1; min = min + 15; } else{ min -= ALARM_MIN; } } System.out.println(hour + " " + min); } }
package com.yorkwang.controller; import java.io.File; import java.util.List; import com.jfinal.core.Controller; import com.jfinal.kit.StrKit; import com.jfinal.plugin.activerecord.Db; import com.jfinal.upload.UploadFile; import com.yorkwang.model.UploadImage; import com.yorkwang.service.UploadImageService; import com.yorkwang.utils.Utils; public class UploadController extends Controller { public void index() { this.setAttr("pic_list", UploadImageService.getUploadImages(UploadImage.TYPE_COMPANY_INFO)); this.render("pics.html"); } public void uploadimages() { String path = getRequest().getSession().getServletContext().getRealPath("/") + "/upload/"; List<UploadFile> files = this.getFiles(); int type = Utils.getIntParaValue(this, "type"); type = type == 0 ? UploadImage.TYPE_COMPANY_INFO : type; // System.out.println("upload files:" + files.size()); System.out.println("upload type:" + type); // if(type == UploadImage.TYPE_COMPANY_INFO) // type = UploadImage.TYPE_TEMP; //Delete the file or files which used. Now comment it out. Maybe it won't used any more. // if(files != null && files.size() != 0 && type != UploadImage.TYPE_COMPANY_INFO) { // UploadImageService.deleteUploadImages(type); // } for (UploadFile uploadFile : files) { //Overwrite same name file. if(!(uploadFile.getFileName()).equals(uploadFile.getOriginalFileName())) { File oldFile = new File(path + "/" + uploadFile.getOriginalFileName()); if (oldFile.exists()) { String newName = path + "/" + uploadFile.getFileName(); File newFile = new File(newName); oldFile.delete(); newFile.renameTo(oldFile); } } int id = UploadImageService.addUploadImage(type, uploadFile.getOriginalFileName()); } String res = "{\"code\": 0, \"msg\": \"\"}"; this.renderJson(res); UploadImageService.loadCompanyImages(); } public void deletepic() { String idString = getPara("id"); int id = StrKit.isBlank(idString) ? 0 : Integer.parseInt(idString); UploadImageService.deleteUploadImage(id, this); this.renderJson(); } /** * Since we want to remove all type images before one new upload. * But multiple upload is actually upload file 1 by 1. * We have to use a temp type as -1. When mutiple upload, add with type -1, * After all files upload done, delete all old images for this type, * then move the -1 type images back to this type. */ public void refactorpics() { int type = Utils.getIntParaValue(this, "type"); type = type == 0 ? UploadImage.TYPE_COMPANY_INFO : type; UploadImage uploadImage = UploadImage.dao.findFirst("select * from uploadimage where type=-1"); if(uploadImage != null) { Db.update("delete from uploadimage where type=" + type); Db.update("update uploadimage set type=" + type + " where type=-1"); } this.renderNull(); } public void loadpics() { int type = Utils.getIntParaValue(this, "type"); this.setAttr("type", type); // String selected_data = getPara("selected_data"); String path_list = ""; List<UploadImage> list = UploadImageService.getUploadImages(type); for (UploadImage uploadImage : list) { // System.out.println("selected_data:" + selected_data); // System.out.println("path:" + uploadImage.getStr("path")); // if(StrKit.notBlank(selected_data)) // System.out.println("result:" + selected_data.indexOf(uploadImage.getStr("path"))); // if(StrKit.notBlank(selected_data) && selected_data.indexOf(uploadImage.getStr("path")) != -1) { // uploadImage.setSelected(true); // } path_list += uploadImage.getStr("id")+","; } if(StrKit.notBlank(path_list)) path_list = path_list.substring(0, path_list.length()-1); this.setAttr("pic_list", list); this.setAttr("path_list", path_list); this.setAttr("type", type); this.render("pic_queue.html"); } }
package Main; import java.util.ArrayList; import java.util.List; import javafx.application.Application; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Line; import javafx.stage.Stage; public class DragNodes extends Application { public static List<Circle> circles = new ArrayList<Circle>(); public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { Group root = new Group(); Canvas canvas = new Canvas(300, 300); GraphicsContext gc = canvas.getGraphicsContext2D(); drawShapes(gc); Circle circle1 = new Circle(50); circle1.setStroke(Color.GREEN); circle1.setFill(Color.GREEN.deriveColor(1, 1, 1, 0.7)); circle1.relocate(100, 100); Circle circle2 = new Circle(50); circle2.setStroke(Color.BLUE); circle2.setFill(Color.BLUE.deriveColor(1, 1, 1, 0.7)); circle2.relocate(200, 200); Line line = new Line(circle1.getLayoutX(), circle1.getLayoutY(), circle2.getLayoutX(), circle2.getLayoutY()); line.setStrokeWidth(20); Pane overlay = new Pane(); overlay.getChildren().addAll(circle1, circle2, line); // MouseGestures mg = new MouseGestures(); // mg.makeDraggable(circle1); // mg.makeDraggable(circle2); // mg.makeDraggable(line); root.getChildren().addAll(canvas, overlay); primaryStage.setScene(new Scene(root, 800, 600)); primaryStage.show(); } private void drawShapes(GraphicsContext gc) { gc.setStroke(Color.RED); gc.fillRoundRect(10, 10, 230, 230, 10, 10); // gc.strokeRoundRect(10, 10, 230, 230, 10, 10); } public static class MouseGestures { double orgSceneX, orgSceneY; double orgTranslateX, orgTranslateY; public void makeDraggable(Node node) { node.setOnMousePressed(circleOnMousePressedEventHandler); node.setOnMouseDragged(circleOnMouseDraggedEventHandler); } EventHandler<MouseEvent> circleOnMousePressedEventHandler = new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { orgSceneX = t.getSceneX(); orgSceneY = t.getSceneY(); if (t.getSource() instanceof Circle) { Circle p = ((Circle) (t.getSource())); orgTranslateX = p.getCenterX(); orgTranslateY = p.getCenterY(); } else { Node p = ((Node) (t.getSource())); orgTranslateX = p.getTranslateX(); orgTranslateY = p.getTranslateY(); } } }; EventHandler<MouseEvent> circleOnMouseDraggedEventHandler = new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { double offsetX = t.getSceneX() - orgSceneX; double offsetY = t.getSceneY() - orgSceneY; double newTranslateX = orgTranslateX + offsetX; double newTranslateY = orgTranslateY + offsetY; if (t.getSource() instanceof Circle) { Circle p = ((Circle) (t.getSource())); p.setCenterX(newTranslateX); p.setCenterY(newTranslateY); } else { Node p = ((Node) (t.getSource())); p.setTranslateX(newTranslateX); p.setTranslateY(newTranslateY); } } }; } }
package com.tencent.mm.plugin.gallery.ui; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; class AlbumPreviewUI$8 implements AnimationListener { final /* synthetic */ AlbumPreviewUI jCE; private Runnable jCJ = new 1(this); AlbumPreviewUI$8(AlbumPreviewUI albumPreviewUI) { this.jCE = albumPreviewUI; } public final void onAnimationStart(Animation animation) { } public final void onAnimationEnd(Animation animation) { AlbumPreviewUI.G(this.jCE).setVisibility(0); AlbumPreviewUI.G(this.jCE).postDelayed(this.jCJ, 4000); } public final void onAnimationRepeat(Animation animation) { } }
package com.action; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.List; import java.util.Map; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext; import com.Entity.User; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; /* * 用户登录action,判断是否符合登录条件 */ public class LoginAction extends ActionSupport{ private static final long serialVersionUID = 8013816027944871760L; private User user; private String prePage;// 登录前页面 @Override public String execute() throws UnsupportedEncodingException{ HttpServletRequest req = ServletActionContext.getRequest(); String check = (String) req.getSession().getAttribute("rand"); ActionContext ctx = ActionContext.getContext(); Map<String, Object> session = ctx.getSession(); if(!user.getCheck().equals(check)){ req.setAttribute("login_error", "验证码输入不正确,请重新输入"); return "error"; } if(user.getUsername().length()>0){ String username = new String(user.getUsername().getBytes("ISO-8859-1"),"UTF-8"); System.out.println("2"+username); Cookie cs[] = req.getCookies(); if(cs!=null){ for(Cookie c:cs){ String name = URLDecoder.decode(c.getName(),"UTF-8"); String value = URLDecoder.decode(c.getValue(),"UTF-8"); if(name.equals(username)&&value.equals(user.getPassword())){ session.put("NowLogining",name); prePage = (String) session.get("prePage"); session.remove("prePage"); if (null == prePage) { return SUCCESS; } else { return "aaa"; } } } } } req.setAttribute("login_error", "没有该用户请先去注册"); return "error"; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public String getPrePage() { return prePage; } public void setPrePage(String prePage) { this.prePage = prePage; } }
package com.tencent.mm.plugin.sns.model; import com.tencent.mm.sdk.platformtools.x; class ar$8 implements Runnable { final /* synthetic */ ar nrO; ar$8(ar arVar) { this.nrO = arVar; } public final void run() { if (this.nrO.nrJ != null) { x.i("MicroMsg.SnsVideoService", "download video finish cdnmediaId %s", new Object[]{this.nrO.nrJ.elz}); this.nrO.nrL.remove(this.nrO.nrJ.elz); } this.nrO.nrJ = null; this.nrO.byU(); } }
package nl.rug.oop.flaps.aircraft_editor.controller.listeners.infopanel_listeners; import lombok.extern.java.Log; import nl.rug.oop.flaps.aircraft_editor.view.frame.EditorFrame; import nl.rug.oop.flaps.simulation.model.aircraft.AircraftType; import nl.rug.oop.flaps.simulation.model.trips.Trip; import nl.rug.oop.flaps.simulation.model.trips.TripsThread; import nl.rug.oop.flaps.simulation.model.world.WorldSelectionModel; import nl.rug.oop.flaps.simulation.view.FlapsFrame; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.swing.*; import java.awt.event.ActionEvent; /** * This action is invoked to perform the actual departure of an aircraft from an * airport. * * Use the setEnabled() method to enable/disable the corresponding button * * @author T.O.W.E.R. */ @Log public class DepartButtonListener extends AbstractAction { private final WorldSelectionModel selectionModel; public DepartButtonListener(WorldSelectionModel selectionModel) { super("Depart"); this.selectionModel = selectionModel; setEnabled(false); } @Override public void actionPerformed(ActionEvent event) { startNewTrip(); var sm = this.selectionModel; // Just to keep things succinct. if (sm.getSelectedAirport() != null && sm.getSelectedAircraft() != null && sm.getSelectedDestinationAirport() != null) { var aircraft = sm.getSelectedAircraft(); aircraft.setEditMenu(null); if (aircraft.getType().getTakeoffClipPath() != null) { this.playTakeoffClip(aircraft.getType()); } sm.getSelectedAirport().removeAircraft(aircraft); sm.setSelectedAirport(sm.getSelectedAirport()); // this line is to refresh the airport viewer panel } closeFrame(); } /** * start a trip from origin airport to destination airport * */ private void startNewTrip() { Trip newTrip = new Trip(selectionModel); TripsThread tripsThread = new TripsThread(newTrip); tripsThread.start(); } /** * closes the frame after departing and shows a message * */ private void closeFrame() { JFrame frame = EditorFrame.getFrame(); frame.setVisible(false); frame.dispose(); JOptionPane.showMessageDialog(FlapsFrame.getFrame(),"Aircraft departed successfully"); } private void playTakeoffClip(AircraftType type) { new Thread(() -> { try (Clip clip = AudioSystem.getClip()) { AudioInputStream ais = AudioSystem.getAudioInputStream(type.getTakeoffClipPath().toFile()); clip.open(ais); clip.start(); Thread.sleep((long) (ais.getFrameLength() / ais.getFormat().getFrameRate()) * 1000); } catch (Exception e) { log.warning("Could not play takeoff clip: " + e.getMessage()); } }).start(); } }
package com.xxx; import java.io.IOException; import java.util.List; import org.apache.http.HttpHost; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.builder.SearchSourceBuilder; /** * @author xujunming * Created on 2020-03-22 */ public class Main08 { public static void main(String[] args) throws IOException { RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( // 指定 ElasticSearch 集群各个节点的地址和端口号 new HttpHost("localhost", 9200, "http"))); // 创建 SearchRequest请求,查询的Index为skywalking SearchRequest searchRequest = new SearchRequest("skywalking"); // 通过 SearchSourceBuilder,用来构造检索条件 SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); // 创建 BoolQueryBuilder BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); // 符合条件的 Document中 age字段的值必须位于[10,40]这个范围 List<QueryBuilder> mustQueryList = boolQueryBuilder.must(); mustQueryList.add(QueryBuilders.rangeQuery("age").gte(10)); mustQueryList.add(QueryBuilders.rangeQuery("age").lte(40)); // 符合条件的 Document中 user字段的值必须为kim boolQueryBuilder.must().add( QueryBuilders.termQuery("user", "kim")); sourceBuilder.query(boolQueryBuilder); searchRequest.source(sourceBuilder); // 发送 SearchRequest 请求 SearchResponse searchResponse = client.search(searchRequest); SearchHit[] searchHits = searchResponse.getHits().getHits(); for (SearchHit searchHit : searchHits) { System.out.println(searchHit.getId() + ":" + searchHit.getSourceAsMap()); } } }
package com.a1tSign.techBoom.data.dto.item; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @AllArgsConstructor @Getter @Setter @EqualsAndHashCode public class CategoryDTO { String title; }
package cn.ehanmy.hospital.di.component; import dagger.Component; import com.jess.arms.di.component.AppComponent; import cn.ehanmy.hospital.di.module.MyStoreModule; import com.jess.arms.di.scope.ActivityScope; import cn.ehanmy.hospital.mvp.ui.activity.MyStoreActivity; @ActivityScope @Component(modules = MyStoreModule.class, dependencies = AppComponent.class) public interface MyStoreComponent { void inject(MyStoreActivity activity); }
package edu.stuy.starlorn.menu; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import edu.stuy.starlorn.graphics.DefaultHook; import edu.stuy.starlorn.graphics.Screen; public class Settings extends DefaultHook { private Screen screen; private Font font; private long lastFrame; private HoverBox[] hoverBoxes; private Button[] buttons; private Star[] stars; public Settings(Screen scr) { screen = scr; font = screen.getFont().deriveFont(48f); } public void setup() { int cx = screen.getWidth() / 2, cy = screen.getHeight() / 2; buttons = new Button[1]; buttons[0] = new Button(screen, cx - 95, cy + 300, 190, 80, "Back", 18f, new BackButtonCallback()); hoverBoxes = new HoverBox[6]; hoverBoxes[0] = new HoverBox(screen, cx - 200, cy - 50, 100, 50, HoverBox.ABOVE, "Up" , 18f, "upKey" ); hoverBoxes[1] = new HoverBox(screen, cx - 200, cy , 100, 50, HoverBox.BELOW, "Down" , 18f, "downKey" ); hoverBoxes[2] = new HoverBox(screen, cx - 300, cy , 100, 50, HoverBox.BELOW, "Left" , 18f, "leftKey" ); hoverBoxes[3] = new HoverBox(screen, cx - 100, cy , 100, 50, HoverBox.BELOW, "Right", 18f, "rightKey"); hoverBoxes[4] = new HoverBox(screen, cx + 200, cy - 50, 150, 50, HoverBox.LEFT , "Shoot", 18f, "shootKey"); hoverBoxes[5] = new HoverBox(screen, cx + 200, cy + 25, 150, 50, HoverBox.LEFT , "Pause", 18f, "pauseKey"); stars = new Star[400]; for (int i = 0; i < 400; i++) stars[i] = new Star(screen.getWidth(), screen.getHeight()); } private class BackButtonCallback implements Menu.Callback { public void invoke() { Menu menu = new Menu(screen); menu.setup(); screen.popHook(); screen.pushHook(menu); } } @Override public void step(Graphics2D graphics) { drawTitle(graphics); graphics.setColor(Color.WHITE); for (Star star : stars) { star.update(); star.draw(graphics); } for (Button button : buttons) button.draw(graphics); for (HoverBox hoverbox : hoverBoxes) hoverbox.draw(graphics); } private void drawTitle(Graphics2D graphics) { String text = "SETTINGS"; int xOffset = screen.getXOffset(graphics, font, text); graphics.setColor(Color.GRAY); graphics.setFont(font); graphics.drawString(text, xOffset, screen.getHeight() / 2 - 250); } @Override public void keyReleased(KeyEvent event) { for (HoverBox hoverbox : hoverBoxes) hoverbox.update(event); if (event.getKeyCode() == KeyEvent.VK_Q) new BackButtonCallback().invoke(); } @Override public void keyPressed(KeyEvent event) { for (HoverBox hoverbox : hoverBoxes) hoverbox.update(event); } @Override public void mousePressed(MouseEvent event) { for (Button button : buttons) button.update(event); for (HoverBox hoverbox : hoverBoxes) hoverbox.update(event); } @Override public void mouseReleased(MouseEvent event) { for (Button button : buttons) button.update(event); } @Override public void mouseMoved(MouseEvent event) { for (Button button : buttons) button.update(event); for (HoverBox hoverbox : hoverBoxes) hoverbox.update(event); } }
import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.EventQueue; import java.awt.event.ActionEvent; public class AdminUI { public JFrame frame; private DataManager dm=new DataManager(); private LoginControl control= new LoginControl(dm); /** * Create the application. */ public AdminUI() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setTitle("Admin"); frame.setBounds(100, 100, 450, 300); frame.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("Select the suitable option"); lblNewLabel.setBounds(135, 27, 167, 16); frame.getContentPane().add(lblNewLabel); JButton btnLogin = new JButton("Login"); btnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EventQueue.invokeLater(new Runnable() { public void run() { try { LoginUI window = new LoginUI(dm,control,1); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } }); btnLogin.setBounds(145, 55, 117, 29); frame.getContentPane().add(btnLogin); JButton btnNewButton = new JButton("Add Music"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EventQueue.invokeLater(new Runnable() { public void run() { try { AddMusicUI window = new AddMusicUI(dm,control); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } }); btnNewButton.setBounds(145, 96, 117, 29); frame.getContentPane().add(btnNewButton); JButton btnNewButton_1 = new JButton("Search Music"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EventQueue.invokeLater(new Runnable() { public void run() { try { SearchMusicUI window = new SearchMusicUI(dm,control); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } }); btnNewButton_1.setBounds(145, 137, 117, 29); frame.getContentPane().add(btnNewButton_1); JButton btnNewButton_2 = new JButton("View MusicList"); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EventQueue.invokeLater(new Runnable() { public void run() { try { MusicListUI window = new MusicListUI(dm,control); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } }); btnNewButton_2.setBounds(145, 178, 117, 29); frame.getContentPane().add(btnNewButton_2); } }
package DataImport; import Utility.DBUtil; import Entity.Pair; import com.sangupta.bloomfilter.impl.InMemoryBloomFilter; import org.json.JSONObject; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import static java.nio.charset.StandardCharsets.ISO_8859_1; import static java.nio.charset.StandardCharsets.UTF_8; /** * Created by liuche on 6/1/17. * Assumptions: * <p> * 1. Property with the same name should have similar meanings. * "node1.description" and "node2.description" should be similar. * <p> * 2. Edge(relation) only have one label. * <p> * 3. Grammar in this file do not have syntax error. * <p> * 4. Objects with "ID" field are considered a node, and ID should be * unique with in the same type (nodes with same labels) of nodes. * Objects without "ID" filed are considered relation objects. * <p> * 5. Relation objects are empty * <p> * Additional requirement is in QueryIndexer. * * 6. Use UTF8_GENERAL_CI on text field * ALTER TABLE test.P_text MODIFY COLUMN value TEXT * CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; */ public class FileParser { private String fileName = ""; private Map<String, String> keyType = new HashMap<>(); private Map<String, String> keyReference = new HashMap<>(); // Data structures only used in run() private Map<String, Set<String>> typeToProperties = new HashMap<>(); private Set<String> globalProperties = new HashSet<>(); private Map<Set<String>, String> nodelabelToType = new HashMap<>(); private Map<String, String> propertyToSQLType = new HashMap<>(); private Integer globalId = 0; private DBUtil dbUtil; private DBHandler handler; public FileParser(String fileName, Connection conn) { this.fileName = fileName; this.dbUtil = new DBUtil(conn); this.handler = new DBHandler(dbUtil); } private Integer getUniqueGlobalId() { int result = globalId; globalId++; return result; } private void getMetadata() throws IOException { //Read file schema String lineMeta = "{node1: n, node1Label: labels(n), relationship: r, rel_type: type(r), node2:m, node2Label: labels(m)}"; String schemaLine = lineMeta.replaceAll("[\"{} ]", ""); String objects[] = schemaLine.split(","); Map<String, String> valToKey = new HashMap<>(); // Columns type for (String s : objects) { assert s.contains(":"); String keyValPair[] = s.split(":"); String objName = keyValPair[0]; String objVal = keyValPair[1]; String valType = objVal.matches("[A-Za-z0-9]+") ? "object" : ( objVal.contains("(") ? "list" : "string" ); valType = ((objName.toLowerCase().contains("node")) ? "node_" : "relation_") + valType; keyType.put(objName, valType); valToKey.put(objVal, objName); } // NOTICE: // type of "rel_type" is String!!! keyType.put("rel_type", "string"); // Relation among columns for (String val : valToKey.keySet()) { if (val.contains("(")) { String variable = val.substring(val.indexOf("(") + 1, val.indexOf(")")); assert valToKey.containsKey(variable); String key = valToKey.get(variable); keyReference.put(valToKey.get(val), key); } } } private Map<String, Object> lineToJsonMap(String line) { //line = replaceQuote(line); JSONObject object = new JSONObject(line); Map<String, Object> objectMap = JsonParser.toMap(object); List<Map<String, Object>> rowList = (List<Map<String, Object>>) objectMap.get("row"); List<Map<String, String>> metaList = (List<Map<String, String>>) objectMap.get("meta"); Map<String, Object> result = rowList.get(0); List<String> ids = new ArrayList<>(); for (int i = 0, size = metaList.size(); i < size; i++) { if (JSONObject.NULL.equals(metaList.get(i))) { continue; } Map<String, String> metaMap = metaList.get(i); if (metaMap.containsKey("id") && "node".equals(metaMap.get("type"))) { ids.add(metaMap.get("id")); } } assert result.get("node1") instanceof Map; ((Map<String, String>) (result.get("node1"))).put("id", ids.get(0)); ((Map<String, String>) (result.get("node2"))).put("id", ids.get(1)); return result; } private String replaceQuote(String str) { str = str.replaceAll("\"\"", "\""); int startIdx = 0, endIdx; Pattern pattern = Pattern.compile("\"[A-Za-z0-9_]+\":"); Matcher matcher = pattern.matcher(str); String result = ""; while (matcher.find()) { endIdx = matcher.start(); String replaced = str.substring(startIdx, endIdx); String kept = str.substring(matcher.start(), matcher.end()); if (replaced.startsWith("\"") && replaced.endsWith(",") && replaced.length() > 3) { replaced = "\"" + replaced.substring(1, replaced.lastIndexOf("\"")).replace("\"", "`") + replaced.substring(replaced.lastIndexOf("\"")); } result += replaced + kept; startIdx = matcher.end(); } result += str.substring(startIdx); result = result.substring(result.indexOf("{"), result.lastIndexOf("}") + 1); return result; } /* * { * "node1" : {"name"->"VARCHAR(255)", "id"->"VARCHAR(100)", "description"->"VARCHAR(1000)", ...}, * "node2" : {"name", "id", "imdbid", ...} * * } * * * */ private Map<String, List<Pair<String, String>>> getNodePropSQL(Map<String, Object> map) throws IOException { Map<String, List<Pair<String, String>>> keyProperties = new HashMap<>(); for (String key : map.keySet()) { if (keyType.get(key).contains("object") && keyType.get(key).contains("node")) { Map<String, Object> objectMap = (Map<String, Object>) map.get(key); List<String> propertyList = new ArrayList<>(objectMap.keySet()); List<Pair<String, String>> typeList = new ArrayList<>(); propertyList.forEach(prop -> typeList.add( new Pair<>(prop, "TEXT") )); keyProperties.put(key, typeList); } } return keyProperties; } /* * -> {"name", "id", "birthplace", "duration", "studio"...}, * */ private Set<String> getAllProperties(Map<String, Object> map) { Set<String> res = new HashSet<>(); for (String key : map.keySet()) { if (keyType.get(key).contains("object") && keyType.get(key).contains("node")) { Map<String, Object> objectMap = (Map<String, Object>) map.get(key); res.addAll(objectMap.keySet()); } } return res; } /* * { * "node1Label" : {"Person", "Actor"} * } * */ private Map<String, Set<String>> getNodeLabelSet(Map<String, Object> map) { Map<String, Set<String>> res = new HashMap<>(); for (String key : map.keySet()) { if (keyType.get(key).contains("list") && (map.get(key) instanceof List)) { List<String> labelList = (List<String>) (map.get(key)); res.put(key, new HashSet<>(labelList)); } } return res; } private List<String> constructMetaSchema() { String predefinedTableSchema = "" + "DROP TABLE IF EXISTS typeProperty;\n" + "DROP TABLE IF EXISTS typeLabel;\n" + "DROP TABLE IF EXISTS nodeLabel;\n" + "DROP TABLE IF EXISTS Edge;\n" + "DROP TABLE IF EXISTS ObjectType;\n" + "CREATE TABLE ObjectType(\n" + " gid VARCHAR(64),\n" + " type VARCHAR(100),\n" + " PRIMARY KEY (gid)" + ");\n" + "Create INDEX idx_nodetype_gid ON ObjectType(gid)\n;" + "\n" + "CREATE TABLE typeProperty(\n" + " id VARCHAR(64),\n" + " name VARCHAR(255)\n" + ");\n" + "\n" + "CREATE INDEX idx_typeProperty_id ON typeProperty(id);\n" + "\n" + "CREATE TABLE typeLabel(\n" + " id VARCHAR(64),\n" + " label VARCHAR(255)\n" + ");\n" + "\n" + "CREATE INDEX idx_typeLabel_id ON typeLabel(id);\n" + "\n" + "CREATE TABLE nodeLabel(\n" + " gid VARCHAR(64),\n" + " label VARCHAR(255)\n" + ");\n" + "\n" + "CREATE INDEX idx_nodeLabel_id ON nodeLabel(gid);\n"; String edgeTableSchema = predefinedTableSchema + "CREATE TABLE Edge(\n" + " eid int AUTO_INCREMENT,\n"; for (String key : keyType.keySet()) { edgeTableSchema += key + " VARCHAR(255),\n"; } edgeTableSchema += " PRIMARY KEY (eid)\n" + ");\n" + "CREATE INDEX idx_Edge_eid ON Edge(eid);\n"; for (String key : keyType.keySet()) { edgeTableSchema += "CREATE INDEX idx_Edge_" + key + " ON Edge(" + key + ");\n"; } List<String> ret = Arrays.asList(edgeTableSchema.split(";")); List<String> result = new ArrayList<>(); for (String s : ret) { if(s.trim().length() > 0){ result.add(s + ";\n"); } } return result; } public void run(boolean createSchema) throws IOException, SQLException { System.out.println("Creating tables..."); getMetadata(); MyBufferedReader br = new MyBufferedReader(fileName); // Construct the set including all properties occurred, // and map from label to type id and property set. // Distinguish node property from edge property. String line; if(createSchema) { // All relations are of type 0. // Typeid of nodes starts from 1. int typeId = 1; int count0 = 0; BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("tables.sql")); while ((line = br.readLine()) != null) { if (count0++ % 10000 == 0) { System.out.println(count0); } // Get all properties of this line, including all nodes and relations Map<String, Object> lineMap = lineToJsonMap(line); Set<String> nodeProperties = getAllProperties(lineMap); globalProperties.addAll(nodeProperties); // Get all labels of objects in this line Map<String, Set<String>> labelToSet = getNodeLabelSet(lineMap); Map<String, List<Pair<String, String>>> propSQLType = getNodePropSQL(lineMap); for (String key : propSQLType.keySet()) { propSQLType.get(key).forEach( kvPair -> propertyToSQLType.put(kvPair.getV0(), kvPair.getV1()) ); } for (String key : labelToSet.keySet()) { // Add currently not occurred label to type map. Set<String> labelSet = labelToSet.get(key); String nodeName = keyReference.get(key); Set<String> typePropSet = new HashSet<>(); propSQLType.get(nodeName).forEach(kvPair -> typePropSet.add(kvPair.getV0())); String typeIndex = nodelabelToType.getOrDefault(labelSet, ""); if (typeIndex.equals("")) { typeId++; typeIndex = Integer.toString(typeId); nodelabelToType.put(labelSet, typeIndex); } typeToProperties.put(typeIndex, typePropSet); } } br.close(); List<String> sqlSchema = constructMetaSchema(); dbUtil.executeSQL(sqlSchema); for(String str : sqlSchema){ bufferedWriter.write(str); } sqlSchema = new ArrayList<>(); // For each property, create a table for it. /* DROP TABLE IF EXISTS P_profileImageUrl; CREATE TABLE P_profileImageUrl( gid VARCHAR(64), value VARCHAR(1000), PRIMARY KEY (gid) ); CREATE INDEX idx_p_profileImageUrl_gid ON P_profileImageUrl(gid); */ for (String prop : globalProperties) { sqlSchema.add("\nDROP TABLE IF EXISTS P_" + prop + ";\n"); sqlSchema.add("CREATE TABLE P_" + prop + "(\n" + "gid VARCHAR(64),\n" + "value " + propertyToSQLType.get(prop) + ",\n" + "PRIMARY KEY (gid)\n" + ");\n"); sqlSchema.add("CREATE INDEX idx_p_" + prop + "_gid ON P_" + prop + "(gid);\n"); if(prop.matches("[a-zA_Z]*id") || prop.matches("[a-zA-Z_]*name")){ if(propertyToSQLType.get(prop).equals("TEXT")){ sqlSchema.add("CREATE INDEX idx_p_" + prop + "_value ON P_" + prop + "(value(100));\n"); } } } // Construct Type Table /* INSERT INTO typeProperty(id, name) VALUES ( "2", "deg"); INSERT INTO typeProperty(id, name) VALUES ( "2", "name"); INSERT INTO typeProperty(id, name) VALUES ( "2", "lastModified"); */ for (String key : typeToProperties.keySet()) { String baseSql = "INSERT INTO typeProperty(id, name) VALUES (\"" + key + "\", "; for (String prop : typeToProperties.get(key)) { String propSql = baseSql + "\"" + prop + "\");\n"; sqlSchema.add(propSql); } } // Construct Type Label Table /* INSERT INTO typeLabel(id, label) VALUES ( "2", "actor"); INSERT INTO typeLabel(id, label) VALUES ( "2", "person"); INSERT INTO typeLabel(id, label) VALUES ( "1", "tweet"); */ for (Set<String> set : nodelabelToType.keySet()) { String baseSql = "INSERT INTO typeLabel(id, label) VALUES (\"" + nodelabelToType.get(set) + "\", "; for (String label : set) { String propSql = baseSql + "\"" + label + "\");\n"; sqlSchema.add(propSql); } } dbUtil.executeSQL(sqlSchema); System.out.println("Tables created."); for(String str : sqlSchema){ bufferedWriter.write(str); } bufferedWriter.close(); }else{ nodelabelToType = handler.getNodeLabelType(); } System.out.println("Importing data..."); br = new MyBufferedReader(fileName); // Scan for each node and insert it into database. Map<String, String> usedNodeIds = new HashMap<>(); InMemoryBloomFilter<String> filter = new InMemoryBloomFilter<>(7000000, 0.01); int count = 0; while ((line = br.readLine()) != null) { if (count % 1000 == 0) { System.out.println(count); } count++; Map<String, Object> lineObject = lineToJsonMap(line); Map<String, String> lineGidType = new HashMap<>(); Map<String, Integer> newGid = new HashMap<>(); // Process nodes first. for (String type : lineObject.keySet()) { if (!keyType.get(type).contains("object") || !keyType.get(type).contains("node")) { continue; } Map<String, Object> item = (Map<String, Object>) lineObject.get(type); if (item.size() == 0) { //An empty object //Only relation object could be empty. assert !type.contains("node"); lineGidType.put(type, ""); continue; } if (item.containsKey("id")) { String id = item.get("id").toString(); if(item.containsKey("text")){ // For tweets, use BloomFilter to find if it check. if(filter.contains(id)) { dbUtil.dumpBatch(); String gid = handler.getUniqueGidBy("id", id); if (!("".equals(gid))) { lineGidType.put(type, gid); continue; } } String value = item.get("text").toString(); byte[] ptext = value.getBytes(ISO_8859_1); value = new String(ptext, UTF_8); item.put("text", value); String gid = getUniqueGlobalId().toString(); if(gid.equals("763")){ System.out.println(763); } filter.add(id); handler.insertObject(gid, item); lineGidType.put(type, gid); newGid.put(type, Integer.valueOf(gid)); }else{ if (usedNodeIds.containsKey(id)) { String gid = usedNodeIds.get(id); lineGidType.put(type, gid); } else { Integer gid = getUniqueGlobalId(); handler.insertObject(gid.toString(), item); usedNodeIds.put(id, gid.toString()); lineGidType.put(type, gid.toString()); newGid.put(type, gid); } } } } //Then process labels for (String type : lineObject.keySet()) { if (!keyType.get(type).contains("list")) { continue; } List<String> items = (List<String>) lineObject.get(type); String referredType = keyReference.get(type); String typeIndex = nodelabelToType.get(new HashSet<>(items)); lineGidType.put(type, typeIndex); if (newGid.containsKey(referredType)) { String gid = lineGidType.get(referredType); handler.insertLabel(gid, items); handler.insertObjectType(gid, typeIndex); } } // Finally insert edge Map<String, String> edgeObject = new HashMap<>(); for (String type : lineObject.keySet()) { if (keyType.get(type).contains("list") || keyType.get(type).contains("object")) { edgeObject.put(type, lineGidType.get(type)); } else { edgeObject.put(type, lineObject.get(type).toString()); } } handler.insertEdge(edgeObject); } handler.finish(); System.out.println("Importing complete."); } }
package com.spring.spring.locator; public class Moderna implements IVaccination { public Moderna() { } @Override public void vaccinate(String name) { System.out.println("Opt for:" + name); } }
package com.tradeshift.todo.entity; public class Task { //Task Id - PK private Long taskId; //To Do Task message private String task; //Complete flag to mark the task as complete. private Long complete; //user who created the task private Long creatorId; //user to whom the task is assigned. private Long assigneeId; public Long getTaskId() { return taskId; } public void setTaskId(Long taskId) { this.taskId = taskId; } public String getTask() { return task; } public void setTask(String task) { this.task = task; } public Long getComplete() { return complete; } public void setComplete(Long complete) { this.complete = complete; } public Long getCreatorId() { return creatorId; } public void setCreatorId(Long creatorId) { this.creatorId = creatorId; } public Long getAssigneeId() { return assigneeId; } public void setAssigneeId(Long assigneeId) { this.assigneeId = assigneeId; } //TODO equals and hashcode }
package jbyco.analysis.patterns.instructions; /** * The interface for abstraction of instructions. */ public interface AbstractInstruction { }
package br.com.allerp.libsoft.service.user; import java.util.List; import org.apache.wicket.spring.injection.annot.SpringBean; import org.springframework.stereotype.Service; import com.googlecode.genericdao.search.Filter; import com.googlecode.genericdao.search.Search; import br.com.allerp.libsoft.dao.user.BibliotecarioDao; import br.com.allerp.libsoft.entity.user.Bibliotecario; import br.com.allerp.libsoft.entity.user.PessoaFisica; @Service public class BibliotecarioService extends UserService { @SpringBean(name = "bibliotecarioDao") private BibliotecarioDao bibliotecarioDao; public void setBibliotecarioDao(BibliotecarioDao bibliotecario) { this.bibliotecarioDao = bibliotecario; } public void saveOrUpdate(Bibliotecario bibliotecario) { bibliotecarioDao.saveOrUpdate(bibliotecario); } public List<Bibliotecario> findAll(){ return bibliotecarioDao.findAll(); } public void update(Bibliotecario... bibliotecario) { bibliotecarioDao.update(bibliotecario); } public void delete(Bibliotecario bibliotecario) { bibliotecarioDao.delete(bibliotecario); } public List<Bibliotecario> search(String cpf, String userAccess) { Search search = new Search(Bibliotecario.class); Filter filter = Filter.or(Filter.ilike("cpf", "%" + cpf + "%"), Filter.ilike("userAccess", "%" + userAccess + "%")); search.addFilter(filter); return bibliotecarioDao.search(search); } }
package org.wuqinghua.thread; /** * 需要使用完整的synchronized,保证业务的原子性 * Created by wuqinghua on 18/2/10. */ public class DirtyRead { private String username = "admin"; private String password = "123"; public synchronized void setValue(String username, String password) { this.username = username; try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } this.password = password; System.out.println("setValue最终结果:username = " + this.username + " ,password = " + this.password); } /** synchronized **/ public synchronized void getValue() { System.out.println("getValue最终结果:username = " + this.username + " ,password = " + this.password); } public static void main(String[] args) { final DirtyRead dr = new DirtyRead(); Thread t1 = new Thread(()->dr.setValue("root","456")); t1.start(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } dr.getValue(); } }
package finggui; import java.io.*; public class FileOutput { public static void makeBatch(String fingCommand) { try { String changeDirectoryToFingCommand = "cd c:\\Program Files (x86)\\overlook fing 2.1\\bin"; String fingCommandLine = fingCommand; File file = new File("c:\\fingtest.bat"); if (!file.exists()) { file.createNewFile(); } File invisibleVBS = new File("c:\\invisible.vbs"); if (!invisibleVBS.exists()) { invisibleVBS.createNewFile(); } FileWriter _vbsFw = new FileWriter(invisibleVBS.getAbsoluteFile()); BufferedWriter _vbsBw = new BufferedWriter(_vbsFw); _vbsBw.write("Set WshShell = CreateObject(\"WScript.Shell\")"); _vbsBw.newLine(); _vbsBw.write("WshShell.Run chr(34) & \"c:\\fingtest.bat\" & Chr(34), 0"); _vbsBw.newLine(); _vbsBw.write("Set WshShell = Nothing"); _vbsBw.close(); FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(changeDirectoryToFingCommand); bw.newLine(); bw.write(fingCommandLine); bw.newLine(); bw.write("cd c:\\"); bw.newLine(); bw.write("del invisible.vbs && DEL \"%~f0\""); bw.close(); Runtime.getRuntime().exec("cmd /c start c:\\invisible.vbs"); System.out.println("Done"); } catch (IOException e) { e.printStackTrace(); } } }
package zystudio.cases.graphics.touch; import zystudio.demo.R; import zystudio.demo.views.TestTouchLayout; import zystudio.demo.views.TestTouchView; import android.app.Activity; /** * 现在已经不了解CaseForTouch1是作什么的了,但是CaseForTouch2是用来了解 * dispatchTouchEvent,onInterruptTouchEvent,onTouchEvent 在父ViewGroup与子view之间的关系的 * <p> * 我选择继承自FrameLayout与继承自ImageView的自定义view, * 原因是FrameLayout与ImageView均是最简单的继承了ViewGroup与View的类,完全没有修改过任何touch中间的函数 * <p> * dispatchTouchEvent与onTouchEvent是View中的函数<br> * onInterruptTouchEvent是ViewGroup中的函数,默认值是false * <p> * 一些已经确认的东西是父ViewGroup的dispatchTouchEvent一定是最先调用的,以这个为基础作case<br> * 父view的onTouchEvent是在子View的onTouchEvent之后调用的,其受到子view的onTouchEvent影响<br> * 每一次的起始都以父view的down为起点<br> * * ======== 通过大量的实验,我发现这个touch的可能性非常多,若要列出来,是不可穷尽的。但是这个例子已经足够。 * 要理解这个touch事件,只能在保证其它不变的情况下,让某一个return 之类的改变,才能看到这个return带来的效果。就是这样 * *<p> * 以及对于 layout的onInterruptTouchEvent函数 * 对于不同的 action 拦截, 对于子View 的反应是不一样的 * 如果 layout 在 action_down时就拦截时 。那子View 会完整的收不到 所有事件,事件直接回流到 layout的 onTouchEvent 中 <br> * 而如果 layout 在 action_move 时作了拦截 ,那就是子View 实际上已经收到过 前续事件了。 比如 action_down 肯定是收到了,或者之前的action_move 什么的 * 那么,这时子View的 dispatchTouchEvent 就会收到onTouchEvent 会收到一个 action_cancel 事件。 * 此后,再也收不到啥消息了就..所有消息继续走了layout的onTouch事件 * */ public class CaseForTouch2 { private static CaseForTouch2 sCase; private Activity mAct; public static CaseForTouch2 obtain(Activity act) { if (sCase == null) { sCase = new CaseForTouch2(); } sCase.setActivity(act); return sCase; } private void setActivity(Activity act) { this.mAct = act; } TestTouchLayout mLayout; TestTouchView mView; public void work() { mAct.setContentView(R.layout.casefortouch2); mLayout = (TestTouchLayout) mAct.findViewById(R.id.casetouch2_layout); mView = (TestTouchView) mAct.findViewById(R.id.casetouch2_view); setParentLayout(); setChildLayout(); } private void setParentLayout() { // mLayout.mAllowOnTouchCustom = true; // mLayout.mOnTouchReturnValue = true; // mLayout.mIsAllowCustomDispatch = true; // mLayout.mDispatchReturnValue = true; // mLayout.mAllowInterruptCustom = true; // mLayout.mOnInterruptReturnValue = true; } private void setChildLayout() { // mView.mAllowCustomOnTouch = true; // mView.mOnTouchReturnValue = true; } }
/* * Copyright (C) 2011 Inderjeet Singh * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.singhinderjeet.injecto; import java.util.HashMap; import java.util.Map; /** * The primary class for dependency injection. You will first add instances * or providers for instances in the Injector, and then can get them subsequently. * * @author Inderjeet Singh */ public final class Injector { public static final class Builder { private static final int INITIAL_CAPACITY = 12; private final Map<Class<?>, Provider<?>> providers = new HashMap<Class<?>, Provider<?>>(12); private final Map<Class<?>, Object> instances = new HashMap<Class<?>, Object>(INITIAL_CAPACITY); public <T> Builder addProvider(Class<T> clazz, Provider<T> provider) { providers.put(clazz, provider); return this; } public <T> Builder addInstance(Class<T> clazz, T instance) { instances.put(clazz, instance); return this; } public <T> Provider<T> getProvider(Class<T> clazz) { @SuppressWarnings("unchecked") Provider<T> provider = (Provider<T>) providers.get(clazz); return provider; } public Injector create() { return new Injector(providers, instances); } } private final Map<Class<?>, Provider<?>> providers; private final Map<Class<?>, Object> instances; private Injector(Map<Class<?>, Provider<?>> providers, Map<Class<?>, Object> instances) { this.providers = providers; this.instances = instances; } @SuppressWarnings("unchecked") public <T> T getInstance(Class<T> classOfT) { T instance = (T) instances.get(classOfT); if (instance == null) { Provider<T> provider = getProvider(classOfT); if (provider != null) { instance = provider.get(); } } return instance; } @SuppressWarnings("unchecked") public <T> Provider<T> getProvider(Class<T> classOfT) { return (Provider<T>)providers.get(classOfT); } }
/* * VPC3PartyConnection.java * * Version 1.0 * * ----------------- Disclaimer ------------------------------------------------ * * Copyright � 2007 Dialect Payment Technologies - a Transaction Network * Services company. All rights reserved. * * This program is provided by Dialect Payment Technologies on the basis that * you will treat it as confidential. * * No part of this program may be reproduced or copied in any form by any means * without the written permission of Dialect Payment Technologies. Unless * otherwise expressly agreed in writing, the information contained in this * program is subject to change without notice and Dialect Payment Technologies * assumes no responsibility for any alteration to, or any error or other * deficiency, in this program. * * 1. All intellectual property rights in the program and in all extracts and * things derived from any part of the program are owned by Dialect and will * be assigned to Dialect on their creation. You will protect all the * intellectual property rights relating to the program in a manner that is * equal to the protection you provide your own intellectual property. You * will notify Dialect immediately, and in writing where you become aware of * a breach of Dialect's intellectual property rights in relation to the * program. * 2. The names "Dialect", "QSI Payments" and all similar words are trademarks * of Dialect Payment Technologies and you must not use that name or any * similar name. * 3. Dialect may at its sole discretion terminate the rights granted in this * program with immediate effect by notifying you in writing and you will * thereupon return (or destroy and certify that destruction to Dialect) all * copies and extracts of the program in its possession or control. * 4. Dialect does not warrant the accuracy or completeness of the program or * its content or its usefulness to you or your merchant customers. To the * extent permitted by law, all conditions and warranties implied by law * (whether as to fitness for any particular purpose or otherwise) are * excluded. Where the exclusion is not effective, Dialect limits its * liability to $100 or the resupply of the program (at Dialect's option). * 5. Data used in examples and sample data files are intended to be fictional * and any resemblance to real persons or companies is entirely coincidental. * 6. Dialect does not indemnify you or any third party in relation to the * content or any use of the content as contemplated in these terms and * conditions. * 7. Mention of any product not owned by Dialect does not constitute an * endorsement of that product. * 8. This program is governed by the laws of New South Wales, Australia and is * intended to be legally binding. * ---------------------------------------------------------------------------*/ package com.cnk.travelogix.common.core.payment.amex.dialect; import java.net.URLEncoder; import java.security.MessageDigest; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Helper class to perform 3 party transactions for Virtual Payment Client. This class contains all the necessary * functions to set the Secure Secret and provide a sorted MD5 secure hash for the data provided. * * @author Dialect Payment Technologies */ public class VPC3PartyConnection { /** Creates a new instance of VPC3PartyConnection */ public VPC3PartyConnection() { } // This is an array for creating hex chars static final char[] HEX_TABLE = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; private String secureSecret = null; /** * Helper function to set the Secure Secret value to create the hash map. This function will take the SecureSecret * value provided for use later to generate the hash map. This function is only used for 3 party transactions. * * @param secret * the Secure Secret provided for the generation of the hash map. */ public void setSecureSecret(final String secret) { this.secureSecret = secret; } /** * This method is for sorting the fields and creating an MD5 secure hash. * * @param fields * is a map of all the incoming hey-value pairs from the VPC * @return the MD5 secure has once the fields have been sorted. */ public String hashAllFields(final Map fields) { // create a list and sort it final List fieldNames = new ArrayList(fields.keySet()); Collections.sort(fieldNames); // create a buffer for the md5 input and add the secure secret first final StringBuffer buf = new StringBuffer(); buf.append(secureSecret); // iterate through the list and add the remaining field values final Iterator itr = fieldNames.iterator(); while (itr.hasNext()) { final String fieldName = (String) itr.next(); final String fieldValue = (String) fields.get(fieldName); if ((fieldValue != null) && (fieldValue.length() > 0)) { buf.append(fieldValue); } } MessageDigest md5 = null; byte[] ba = null; // create the md5 hash and UTF-8 encode it try { md5 = MessageDigest.getInstance("MD5"); ba = md5.digest(buf.toString().getBytes("UTF-8")); } catch (final Exception e) { throw new RuntimeException(e); } // wont happen //return buf.toString(); return hex(ba); } /** * Returns Hex output of byte array * * @param input * the input data to be converted to HEX. * @return the string in HEX format. */ public static String hex(final byte[] input) { // create a StringBuffer 2x the size of the hash array final StringBuffer sb = new StringBuffer(input.length * 2); // retrieve the byte array data, convert it to hex // and add it to the StringBuffer for (int i = 0; i < input.length; i++) { sb.append(HEX_TABLE[(input[i] >> 4) & 0xf]); sb.append(HEX_TABLE[input[i] & 0xf]); } return sb.toString(); } /** * This method is for creating a URL query string. * * @param buf * is the inital URL for appending the encoded fields to * @param fields * is the input parameters from the order page */ // Method for creating a URL query string public void appendQueryFields(final StringBuffer buf, final Map fields) { // create a list final List fieldNames = new ArrayList(fields.keySet()); final Iterator itr = fieldNames.iterator(); // move through the list and create a series of URL key/value pairs while (itr.hasNext()) { final String fieldName = (String) itr.next(); final String fieldValue = (String) fields.get(fieldName); if ((fieldValue != null) && (fieldValue.length() > 0)) { // append the URL parameters buf.append(URLEncoder.encode(fieldName)); buf.append('='); buf.append(URLEncoder.encode(fieldValue)); } // add a '&' to the end if we have more fields coming. if (itr.hasNext()) { buf.append('&'); } } } }
package com.vult.tf.activity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.widget.Toast; import com.google.ads.AdRequest; import com.google.ads.AdView; import com.vult.TF4.R; import com.vult.tf.utils.Utils; public class SplashActivity extends Activity { private final int STOPSPLASH = 0; // time in milliseconds private final long SPLASHTIME = 2000; AdView adView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); adView = (AdView) this.findViewById(R.id.adView); adView.loadAd(new AdRequest()); Message msg = new Message(); if(!Utils.isNetworkConnected(this)) { Toast.makeText(SplashActivity.this, "Can not connect to network, please check again.", Toast.LENGTH_SHORT).show(); } msg.what = STOPSPLASH; try { splashHandler.sendMessageDelayed(msg, SPLASHTIME); } catch (Exception e) { e.printStackTrace(); } } /** * Handler for splash screen */ private Handler splashHandler = new Handler() { public void handleMessage(Message msg) { super.handleMessage(msg); try { startActivity(new Intent(SplashActivity.this, TrailerActivity.class)); finish(); } catch (Exception e) { e.printStackTrace(); } } }; @Override public void onDestroy() { if (adView != null) { adView.destroy(); } super.onDestroy(); } }
package android.support.v4.view; import android.view.WindowInsets; final class aq extends ap { final WindowInsets xp; aq(WindowInsets windowInsets) { this.xp = windowInsets; } public final int getSystemWindowInsetLeft() { return this.xp.getSystemWindowInsetLeft(); } public final int getSystemWindowInsetTop() { return this.xp.getSystemWindowInsetTop(); } public final int getSystemWindowInsetRight() { return this.xp.getSystemWindowInsetRight(); } public final int getSystemWindowInsetBottom() { return this.xp.getSystemWindowInsetBottom(); } public final boolean isConsumed() { return this.xp.isConsumed(); } public final ap co() { return new aq(this.xp.consumeSystemWindowInsets()); } public final ap f(int i, int i2, int i3, int i4) { return new aq(this.xp.replaceSystemWindowInsets(i, i2, i3, i4)); } }
package jp.co.tau.web7.admin.supplier.entity; import java.time.LocalDateTime; import java.util.Date; import javax.persistence.Column; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import jp.co.tau.web7.admin.supplier.mappers.common.annotation.PrimaryKey; import lombok.Getter; import lombok.Setter; /** * The persistent class for the T_VSM_USER database table. * */ @Table(name="M_VSM_USER") @Getter @Setter public class TVsmUserEntity extends BaseEntity { private static final long serialVersionUID = 1L; @PrimaryKey(name="AUC_TYPE_CD") private String aucTypeCd; @PrimaryKey(name="USER_ID") private String userId; @Temporal(TemporalType.TIMESTAMP) @Column(name="LAST_LOG_IN_TIME") private LocalDateTime lastLogInTime; @Temporal(TemporalType.TIMESTAMP) @Column(name="LOG_IN_NG_SET_DATE") private LocalDateTime logInNgSetDate; @Column(name="ORG_CD") private short orgCd; @Column(name="PWD_INPUT_CNT") private String pwdInputCnt; @Temporal(TemporalType.TIMESTAMP) @Column(name="PWD_INPUT_CNT_UPD_TIME") private LocalDateTime pwdInputCntUpdTime; @Column(name="PWD_ISSUE_FLAG") private String pwdIssueFlag; @Temporal(TemporalType.TIMESTAMP) @Column(name="PWD_UPD_DATE") private LocalDateTime pwdUpdDate; @Column(name="ROLE_CD") private int roleCd; @Column(name="USER_EML_ADDR") private String userEmlAddr; @Column(name="USER_NM") private String userNm; @Column(name="USER_PWD") private String userPwd; @Column(name="LAST_LOG_IN_TIME") private String lastLoginTime; }
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.commands; import com.ctre.phoenix.motorcontrol.ControlMode; import edu.wpi.first.wpilibj.command.Command; import frc.robot.OI; import frc.robot.Robot; import frc.robot.RobotMap; import frc.robot.subsystems.Grabber; public class GrabbyBoi extends Command { public GrabbyBoi() { // Use requires() here to declare subsystem dependencies requires(Robot.m_grabber); } // Called just before this Command runs the first time @Override protected void initialize() { } // Called repeatedly when this Command is scheduled to run @Override protected void execute() { int pov = OI.stick.getPOV(); if(RobotMap.GRABBER_DEBUG) { //DEBUGGING System.out.println("Joystick POV: " + pov); } if(pov == 0) Grabber.kicker.set(ControlMode.PercentOutput, RobotMap.KICKER_SPEED); else if(pov == 180) Grabber.kicker.set(ControlMode.PercentOutput, -RobotMap.KICKER_SPEED); else Grabber.kicker.set(ControlMode.PercentOutput, 0); if(OI.stick.getRawButton(RobotMap.CLOSE_GRABBER)) Grabber.arms.set(ControlMode.PercentOutput, RobotMap.ARM_SPEED); else Robot.m_grabber.open(); // if(OI.stick.getRawButton(RobotMap.HATCH_KICKER)) Robot.m_grabber.pushHatch(); // else Robot.m_grabber.pullHatch(); // if(OI.controller.getBackButton()) new CargoGrab(); // if(OI.controller.getStartButton()) Robot.m_grabber.preloadExtend(); // else Robot.m_grabber.preloadRetract(); } // Make this return true when this Command no longer needs to run execute() @Override protected boolean isFinished() { return false; } // Called once after isFinished returns true @Override protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run @Override protected void interrupted() { } }
package javaPractice1; public class FindSumOfElements { public static void main(String[] args) { int[] num= {10,20,30,40}; int sum=0; for(int i=0;i<num.length;i++) { sum=sum+num[i]; } System.out.println(sum); } }
/* * Copyright (C) 2019-2023 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hedera.mirror.importer.downloader.provider; import static org.assertj.core.api.Assertions.assertThat; import com.hedera.mirror.common.domain.StreamType; import com.hedera.mirror.importer.FileCopier; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.addressbook.ConsensusNode; import com.hedera.mirror.importer.domain.StreamFilename; import com.hedera.mirror.importer.downloader.CommonDownloaderProperties.PathType; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.time.Duration; import java.time.Instant; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import reactor.test.StepVerifier; class LocalStreamFileProviderTest extends AbstractStreamFileProviderTest { @Override protected String getProviderPathSeparator() { return File.separator; } @Override protected String resolveProviderRelativePath(ConsensusNode node, String fileName) { return Path.of( StreamType.RECORD.getPath(), StreamType.RECORD.getNodePrefix() + node.getNodeAccountId(), fileName) .toString(); } @BeforeEach void setup() throws Exception { super.setup(); streamFileProvider = new LocalStreamFileProvider(properties); } @Override protected FileCopier createFileCopier(Path dataPath) { var fromPath = Path.of("data", "recordstreams", "v6"); return FileCopier.create(TestUtils.getResource(fromPath.toString()).toPath(), dataPath) .to(LocalStreamFileProvider.STREAMS, StreamType.RECORD.getPath()); } @Test void listDeletesFiles() throws Exception { var accountId = "0.0.3"; var node = node(accountId); getFileCopier(node).copy(); var lastFilename = StreamFilename.from(Instant.now().toString().replace(':', '_') + ".rcd.gz"); StepVerifier.withVirtualTime(() -> streamFileProvider.list(node, lastFilename)) .thenAwait(Duration.ofSeconds(10)) .expectNextCount(0) .expectComplete() .verify(Duration.ofSeconds(10)); assertThat(Files.walk(dataPath) .filter(p -> p.toString().contains(accountId)) .filter(p -> !p.toString().contains("sidecar")) .noneMatch(p -> p.toFile().isFile())) .isTrue(); } @ParameterizedTest @EnumSource(PathType.class) void listAllPathTypes(PathType pathType) { properties.setPathType(pathType); if (pathType == PathType.ACCOUNT_ID) { fileCopier.copy(); } else { fileCopier.copyAsNodeIdStructure( Path::getParent, properties.getMirrorProperties().getNetwork()); } var accountId = "0.0.3"; var node = node(accountId); var data1 = streamFileData(node, "2022-07-13T08_46_08.041986003Z.rcd_sig"); var data2 = streamFileData(node, "2022-07-13T08_46_11.304284003Z.rcd_sig"); StepVerifier.withVirtualTime(() -> streamFileProvider.list(node, StreamFilename.EPOCH)) .thenAwait(Duration.ofSeconds(10L)) .expectNext(data1) .expectNext(data2) .expectComplete() .verify(Duration.ofSeconds(10L)); } }
package com.hesoyam.pharmacy.appointment.events; import com.hesoyam.pharmacy.util.notifications.EmailClient; import com.hesoyam.pharmacy.util.notifications.EmailObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; @Component public class CheckupReservationListener implements ApplicationListener<OnCheckupReservationCompletedEvent> { @Autowired private EmailClient emailClient; @Override public void onApplicationEvent(OnCheckupReservationCompletedEvent onCheckupReservationCompletedEvent) { this.sendCheckupReservationMail(onCheckupReservationCompletedEvent); } private void sendCheckupReservationMail(OnCheckupReservationCompletedEvent event){ String recipientEmailAddress = event.getUser().getEmail(); String subject = "Hesoyam Pharmacy - Checkup Reservation Successful"; StringBuilder stringBuilder = new StringBuilder(""); stringBuilder.append("You have successfully reserved checkup."); stringBuilder.append(" . \n\nKind regards,\n Hesoyam Pharmacy"); String message = stringBuilder.toString(); emailClient.sendEmail(new EmailObject(subject, recipientEmailAddress, message)); } }
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.cmsfacades.resolvers.sites; import de.hybris.platform.catalog.model.CatalogVersionModel; import de.hybris.platform.cms2.model.site.CMSSiteModel; import java.util.Optional; /** * Resolver that uses a {@link CMSSiteModel} to resolve a homepage thumbnail URL */ public interface SiteThumbnailResolver { /** * Can be called to resolve the homepage thumbnail url. In the event you need to act * on the URL you can override this method and resolve the URL in an alternative way. * * @param cmsSiteModel the cmsSiteModel * @return Optional thumbnail url */ Optional<String> resolveHomepageThumbnailUrl(CMSSiteModel cmsSiteModel); /** * Can be called to resolve the homepage thumbnail url for a given catalog version. * * @param catalogVersion * the catalog version containing the homepage * @return Optional thumbnail url */ Optional<String> resolveHomepageThumbnailUrl(CatalogVersionModel catalogVersion); }