text
stringlengths
10
2.72M
package com.home.closematch.mapper; import com.home.closematch.entity.SeekerSchool; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; /** * @Entity com.home.closematch.entity.SeekerSchool */ @Repository public interface SeekerSchoolMapper extends BaseMapper<SeekerSchool> { }
package com.egen.order.common; public enum OrderStatus { CANCELLED("CANCELLED", "Order Cancelled "), CREATED("CREATED", "Order created") ; private String status; private String desc; OrderStatus(String status, String desc) { this.status = status; this.desc = desc; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } }
package com.gcit.training.library; import java.util.List; public class Author extends AbstractDomain { /** * */ private static final long serialVersionUID = 3845038999163945431L; //non-FK elements private int authorid = 0; private String name = ""; private List<Books> books = null; @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + authorid; result = prime * result + ((books == null) ? 0 : books.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Author other = (Author) obj; if (authorid != other.authorid) return false; if (books == null) { if (other.books != null) return false; } else if (!books.equals(other.books)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } public int getAuthorid() { return authorid; } public void setAuthorid(int authorid) { this.authorid = authorid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Books> getBooks() { return books; } public void setBooks(List<Books> books) { this.books = books; } }
package platform; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; import java.io.File; import javax.imageio.ImageIO; import javax.swing.JFrame; /** * generic class of frame that can be exported as a pdf or jpeg file * @author simon * */ public class PrintableFrame extends JFrame implements Printable, KeyListener{ private static final long serialVersionUID = 1L; protected boolean printable; protected int indexImage; public PrintableFrame(){ addKeyListener(this); printable=false; indexImage=0; } // save a panel as a jpeg image public void saveImage(String path){ String p=path; if (indexImage<10) p+="0000"+indexImage+".jpg"; else if (indexImage<100 ) p+="000"+indexImage+".jpg"; else if (indexImage<1000) p+="00" +indexImage+".jpg"; else p+="0" +indexImage+".jpg"; BufferedImage image = new BufferedImage(this.getWidth(), this.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); this.paint(g2); g2.dispose(); try { ImageIO.write(image, "JPEG", new File(p)); } catch (Exception e) { } indexImage++; } public void drawPDF(Graphics g){ } // detect Ctrl + P and generate a pdf file public void keyPressed(KeyEvent e) { if (printable && e.isControlDown() && e.getKeyCode()==80 ){ PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) {} } } } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } // generate a pdf file public int print(Graphics g, PageFormat pf, int page) throws PrinterException { // We have only one page, and 'page' if (page > 0) { return NO_SUCH_PAGE; } Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); // Now we perform our rendering drawPDF(g); // tell the caller that this page is part // of the printed document return PAGE_EXISTS; } }
package com.dental.lab.repositories; import org.springframework.data.jpa.repository.JpaRepository; import com.dental.lab.data.Entities.PhoneEntity; public interface PhoneRepository extends JpaRepository<PhoneEntity, Long> { }
package org.javaboy.vhr; import org.javaboy.vhr.bean.Employee; import org.javaboy.vhr.bean.Hr; import org.javaboy.vhr.bean.Role; import org.javaboy.vhr.controller.system.basic.PermissController; import org.javaboy.vhr.mapper.EmployeeMapper; import org.javaboy.vhr.service.EmployeeService; import org.javaboy.vhr.service.HrService; import org.javaboy.vhr.service.MenuService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Locale; @SpringBootTest class VhrApplicationTests { @Autowired EmployeeMapper employeeMapper; @Autowired EmployeeService employeeService; @Test public void test(){ List<Employee> empByPageUseHelper = employeeService.getEmpByPageUseHelper(11, 10); empByPageUseHelper.forEach(employee -> System.out.println(employee) ); } }
package WhiteBoxTests; import static org.junit.Assert.*; import java.util.GregorianCalendar; import Exceptions.*; import SoftwareAS.Controller.ErrorMessageHolder; import SoftwareAS.Model.*; import org.junit.jupiter.api.Test; //Markus public class assignDeveloperToActivityWhiteBox { ErrorMessageHolder emh = new ErrorMessageHolder(); DataBase database = DataBase.getInstance(); Activity activity; Developer developer; Developer developer2; Admin admin; Developer developerNotOnProject; Developer projectLeader; Project project; GregorianCalendar start; GregorianCalendar end; @Test public void testInputDataSetA() throws OperationNotAllowedException, OverlappingSessionsException, DeveloperNotFoundException, OutOfBoundsException, AdminNotFoundException, NumberFormatException, ProjectAlreadyExistsException, ProjectNotFoundException, NotAuthorizedException, ActivityAlreadyExistsException, ActivityNotFoundException { database.createAdmin("Blib"); admin = database.getAdminById("Blib"); admin.createDeveloper("Bobb"); developer = database.getDeveloperById("Bobb"); admin.createDeveloper("Klo"); developer2 = database.getDeveloperById("Klo"); admin.createProject("DatasetAForWhiteBox"); project = database.getProjectByName("DatasetAForWhiteBox"); admin.createDeveloper("Proj"); projectLeader = database.getDeveloperById("Proj"); project.assignDeveloperToProject(admin, projectLeader); project.setProjectLeader(admin, projectLeader); project.createActivity(200, projectLeader); activity = project.getActivityById(200); try { activity.assignDeveloperToActivity(developer2, developer); } catch(OperationNotAllowedException e) { emh.setErrorMessage(e.getMessage()); } assertEquals(emh.getErrorMessage(),"Only a project leader or admin can assign developer to activity"); } @Test public void testInputDataSetB() throws DeveloperNotFoundException, OperationNotAllowedException, NotAuthorizedException, ActivityAlreadyExistsException, ActivityNotFoundException, OutOfBoundsException, AdminNotFoundException, NumberFormatException, ProjectAlreadyExistsException, ProjectNotFoundException { database.createAdmin("Blib"); admin = database.getAdminById("Blib"); admin.createDeveloper("Bobb"); developer = database.getDeveloperById("Bobb"); admin.createProject("DatasetBForWhiteBox"); project = database.getProjectByName("DatasetBForWhiteBox"); admin.createDeveloper("Proj"); projectLeader = database.getDeveloperById("Proj"); project.assignDeveloperToProject(admin, projectLeader); project.setProjectLeader(admin, projectLeader); project.createActivity(200, projectLeader); activity = project.getActivityById(200); try { activity.assignDeveloperToActivity(projectLeader, developer); }catch(DeveloperNotFoundException e) { emh.setErrorMessage(e.getMessage()); } assertEquals(emh.getErrorMessage(), "Developer not on project."); } @Test public void testInputDataSetC() throws NotAuthorizedException, DeveloperNotFoundException, ActivityAlreadyExistsException, ActivityNotFoundException, OperationNotAllowedException, OutOfBoundsException, AdminNotFoundException, NumberFormatException, ProjectAlreadyExistsException, ProjectNotFoundException { database.createAdmin("Blib"); admin = database.getAdminById("Blib"); admin.createDeveloper("Bobb"); developer = database.getDeveloperById("Bobb"); admin.createProject("DatasetCForWhiteBox"); project = database.getProjectByName("DatasetCForWhiteBox"); admin.createDeveloper("Proj"); projectLeader = database.getDeveloperById("Proj"); project.assignDeveloperToProject(admin, projectLeader); project.setProjectLeader(admin, projectLeader); project.createActivity(200, projectLeader); activity = project.getActivityById(200); project.assignDeveloperToProject(projectLeader, developer); activity.assignDeveloperToActivity(projectLeader, developer); assertTrue(activity.isDeveloperOnAcitivty(developer.getId())); } @Test public void testInputDataSetD() throws NotAuthorizedException, DeveloperNotFoundException, ActivityAlreadyExistsException, ActivityNotFoundException, OutOfBoundsException, OperationNotAllowedException, AdminNotFoundException, NumberFormatException, ProjectAlreadyExistsException, ProjectNotFoundException { database.createAdmin("Blib"); admin = database.getAdminById("Blib"); admin.createDeveloper("Babb"); developer = database.getDeveloperById("Babb"); admin.createProject("DatasetDForWhiteBox"); project = database.getProjectByName("DatasetDForWhiteBox"); admin.createDeveloper("Proj"); projectLeader = database.getDeveloperById("Proj"); project.assignDeveloperToProject(admin, projectLeader); project.setProjectLeader(admin, projectLeader); project.createActivity(200, projectLeader); activity = project.getActivityById(200); project.assignDeveloperToProject(projectLeader, developer); activity.assignDeveloperToActivity(admin, developer); assertTrue(activity.isDeveloperOnAcitivty(developer.getId())); } }
package com.tencent.mm.plugin.secinforeport; import com.tencent.mm.kernel.g; import com.tencent.mm.plugin.messenger.foundation.a.i; import com.tencent.mm.plugin.secinforeport.a.b; import com.tencent.mm.protocal.c.bhy; import com.tencent.mm.protocal.c.ph; import com.tencent.mm.protocal.c.pi; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import java.nio.charset.Charset; public enum a implements b { ; private a(String str) { } public final void a(int i, String str, int i2, byte[] bArr) { if (str == null) { x.w("MicroMsg.ClipBordReportImpl", "operationInfo isNullOrNil"); } else if (g.Eg().Dx()) { ph phVar = new ph(); phVar.rtD = i; phVar.rtF = i2; phVar.rtE = new bhy().bq(str.getBytes(Charset.forName("UTF-8"))); if (!bi.bC(bArr)) { phVar.rtG = new bhy().bq(bArr); } pi piVar = new pi(); piVar.rtI.add(phVar); piVar.rtH = piVar.rtI.size(); ((i) g.l(i.class)).FQ().b(new com.tencent.mm.plugin.messenger.foundation.a.a.h.a(211, piVar)); } } }
import java.util.ArrayList; public class dinaminiaiSarasaiPirma { public static void main(String[] args) { // Sukurtį sąrašą, kuris gali saugoti skaičius (Integer) // •Į sąrašą įdėti keletą skaičių // •Pabandyti išimti skaičius iš sąrašo ArrayList<Integer> skaiciuListas = new ArrayList <Integer>(); skaiciuListas.add(10); skaiciuListas.add(20); skaiciuListas.add(30); skaiciuListas.add(40); skaiciuListas.add(50); System.out.println(skaiciuListas.get(0)); System.out.println(skaiciuListas); System.out.println(skaiciuListas.remove(0)); System.out.println(skaiciuListas); } }
package com.rms.risproject.model.bo; import java.io.Serializable; /** * @desc * @author zhangqiufeng * @date 2018年12月21日 */ public class MachineInfoVo implements Serializable{ private Integer sexType; private String sexTypeName; private String machineAddress; private String machineCityID; private String machineCityName; private String machineTradeAreaID; private String machineTradeAreaName; private String buildingID; private String buildingName; private String floorID; private Integer floorSeq; private String floorName; private Integer firstStockType; private String firstStockName; private Integer secondStockType; private String secondStockName; /** * @return the sexType */ public Integer getSexType() { return sexType; } /** * @param sexType the sexType to set */ public void setSexType(Integer sexType) { this.sexType = sexType; } /** * @return the sexTypeName */ public String getSexTypeName() { return sexTypeName; } /** * @param sexTypeName the sexTypeName to set */ public void setSexTypeName(String sexTypeName) { this.sexTypeName = sexTypeName; } /** * @return the machineAddress */ public String getMachineAddress() { return machineAddress; } /** * @param machineAddress the machineAddress to set */ public void setMachineAddress(String machineAddress) { this.machineAddress = machineAddress; } /** * @return the machineCityID */ public String getMachineCityID() { return machineCityID; } /** * @param machineCityID the machineCityID to set */ public void setMachineCityID(String machineCityID) { this.machineCityID = machineCityID; } /** * @return the machineCityName */ public String getMachineCityName() { return machineCityName; } /** * @param machineCityName the machineCityName to set */ public void setMachineCityName(String machineCityName) { this.machineCityName = machineCityName; } /** * @return the machineTradeAreaID */ public String getMachineTradeAreaID() { return machineTradeAreaID; } /** * @param machineTradeAreaID the machineTradeAreaID to set */ public void setMachineTradeAreaID(String machineTradeAreaID) { this.machineTradeAreaID = machineTradeAreaID; } /** * @return the machineTradeAreaName */ public String getMachineTradeAreaName() { return machineTradeAreaName; } /** * @param machineTradeAreaName the machineTradeAreaName to set */ public void setMachineTradeAreaName(String machineTradeAreaName) { this.machineTradeAreaName = machineTradeAreaName; } /** * @return the buildingID */ public String getBuildingID() { return buildingID; } /** * @param buildingID the buildingID to set */ public void setBuildingID(String buildingID) { this.buildingID = buildingID; } /** * @return the buildingName */ public String getBuildingName() { return buildingName; } /** * @param buildingName the buildingName to set */ public void setBuildingName(String buildingName) { this.buildingName = buildingName; } /** * @return the floorID */ public String getFloorID() { return floorID; } /** * @param floorID the floorID to set */ public void setFloorID(String floorID) { this.floorID = floorID; } /** * @return the floorSeq */ public Integer getFloorSeq() { return floorSeq; } /** * @param floorSeq the floorSeq to set */ public void setFloorSeq(Integer floorSeq) { this.floorSeq = floorSeq; } /** * @return the floorName */ public String getFloorName() { return floorName; } /** * @param floorName the floorName to set */ public void setFloorName(String floorName) { this.floorName = floorName; } /** * @return the firstStockType */ public Integer getFirstStockType() { return firstStockType; } /** * @param firstStockType the firstStockType to set */ public void setFirstStockType(Integer firstStockType) { this.firstStockType = firstStockType; } /** * @return the firstStockName */ public String getFirstStockName() { return firstStockName; } /** * @param firstStockName the firstStockName to set */ public void setFirstStockName(String firstStockName) { this.firstStockName = firstStockName; } /** * @return the secondStockType */ public Integer getSecondStockType() { return secondStockType; } /** * @param secondStockType the secondStockType to set */ public void setSecondStockType(Integer secondStockType) { this.secondStockType = secondStockType; } /** * @return the secondStockName */ public String getSecondStockName() { return secondStockName; } /** * @param secondStockName the secondStockName to set */ public void setSecondStockName(String secondStockName) { this.secondStockName = secondStockName; } }
package orcsoft.todo.fixupappv2; abstract public class Operations { public static final String MENU_ACTIVITY_KEY_CHANGE_FRAGMENT_ID = "menu_activity_key_fragment_id"; public static final String MENU_ACTIVITY_KEY_START_OTHER_ACTIVITY = "menu_activity_key_start_other_activity"; public static final String ORDER_CLOSING_ACTIVITY_ID = "orders_closing_activity_id"; public static final String ORDER_ENTITY = "order_entity"; public static final String ORDER_FRAGMENT_KEY_LONG_CLICK_ORDER_ID = "order_fragment_key_long_click_item_id"; public static final String ORDERS_FRAGMENT_WITH_RELOAD = "orders_fragment_with_reload"; public static final String YES = "yes"; public static final String NO = "no"; public static final String MAP_ACTIVITY_KEY_ORDERS_LIST = "maps_activity_key_orders_list"; public static final String MAP_ACTIVITY_KEY_ORDER_CATEGORY = "category_key"; }
package tc.fab.file.selector.filters; import java.io.File; import java.util.Arrays; import javax.swing.filechooser.FileFilter; public class ImageFilter extends FileFilter { private String[] acceptables; private String description; public ImageFilter(String[] acceptables) { setAcceptables(acceptables); } public ImageFilter(String[] acceptables, String description) { setAcceptables(acceptables); setDescription(description); } @Override public boolean accept(File file) { if (getAcceptables() != null) { String ext = file.getName().substring( file.getName().lastIndexOf(".") + 1); if (file.isDirectory()) { return true; } for (String extension : getAcceptables()) { if (ext.toLowerCase().equals(extension.toLowerCase())) { return true; } } } return false; } @Override public String getDescription() { if (description != null) { return description; } else { if (acceptables != null) { return Arrays.toString(acceptables); } } return ""; } public void setAcceptables(String[] acceptables) { this.acceptables = acceptables; } public String[] getAcceptables() { return acceptables; } public void setDescription(String description) { this.description = description; } }
package com.rc.components.message; import javax.swing.*; /** * Created by song on 27/06/2017. */ public class AttachmentPanel extends JPanel { private Object tag; public Object getTag() { return tag; } public void setTag(Object tag) { this.tag = tag; } }
package heirerichical_inheritance; public class classA { int val; void add (int a, int b){ val = a+b; System.out.println("Addition of two numbers : " + val); } }
package com.microsilver.mrcard.basicservice.model; import java.io.Serializable; import lombok.Data; @Data public class FxSdUserAgentinfo implements Serializable { /** * */ private static final long serialVersionUID = 1L; private Long id; private String mobile; private String realname; private String enterprisename; private String alipayAccount; private String identityCardNo; private String identityCardFront; private String identityCardBack; private String identityCardGroup; private Integer createTime; private Boolean checkStatus; private String areasText; private String areas; private String remark; private Long financeId; private Integer beginTime; private Integer endTime; }
package com.lera.vehicle.reservation.repository.vehicle; public class BrandRepositoryTest { }
package com.vrktech.springboot.gitactivities.entities; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class WeeklyStatistics implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column(name = "week_id") private Long weekId; @Column(name = "week_of") private Date weekOf; @Column(name = "total_commits") private int totalCommits; @ManyToOne(optional = false) @JoinColumn(name = "repoId", referencedColumnName = "repo_id", insertable = false, updatable = false) private RepoDetails repo; public Long getWeekId() { return weekId; } public void setWeekId(Long weekId) { this.weekId = weekId; } public Date getWeekOf() { return weekOf; } public void setWeekOf(Date weekOf) { this.weekOf = weekOf; } public int getTotalCommits() { return totalCommits; } public void setTotalCommits(int totalCommits) { this.totalCommits = totalCommits; } public RepoDetails getRepo() { return repo; } public void setRepo(RepoDetails repo) { this.repo = repo; } }
package keyinput; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class KeyInput implements KeyListener { private boolean[] keysPressed; private boolean up, down, left, right, debug, test; public KeyInput() { this.keysPressed = new boolean[256]; } public void update() { up = keysPressed[KeyEvent.VK_W]; down = keysPressed[KeyEvent.VK_S]; left = keysPressed[KeyEvent.VK_A]; right = keysPressed[KeyEvent.VK_D]; test = keysPressed[KeyEvent.VK_T]; } @Override public void keyTyped(KeyEvent ke) { } @Override public void keyPressed(KeyEvent ke) { if (ke.getKeyCode() == KeyEvent.VK_U) { debug = !debug; }else{ keysPressed[ke.getKeyCode()] = true; } } @Override public void keyReleased(KeyEvent ke) { keysPressed[ke.getKeyCode()] = false; } public boolean isDown() { return down; } public boolean isUp() { return up; } public boolean isLeft() { return left; } public boolean isRight() { return right; } public boolean isDebug() { return debug; } public boolean isTest() { return test; } }
import java.io.IOException; import java.util.ArrayList; public abstract class Headquarters implements CSV { private final static ArrayList<Integer> history = new ArrayList<>(); abstract int getNewID(); abstract void setNewID(int id); @Override public int readDataFromFile(String file, int position) throws IOException { Read nanu = Read.getInstance(); String[] interior1 = nanu.readLine(file, position); for(String x: interior1) { position += x.length() + 1; } position += 1; String[] interior2 = nanu.readLine(file, position); setNewID(Integer.parseInt(interior2[0])); for(String x: interior2) position += x.length() + 1; position += 1; return position; } @Override public void writeDataInFile(String file) throws IOException { // urmeaza Write nanu = Write.getInstance(); nanu.write(file, "newID,\n" + getNewID() + ",\n"); } protected static void addToHistory(Integer id) { history.add(id); } protected ArrayList<Integer> getHistory() { return history; } }
package com.tencent.mm.plugin.sns.ui; class TouchImageView$1 implements Runnable { final /* synthetic */ TouchImageView oib; TouchImageView$1(TouchImageView touchImageView) { this.oib = touchImageView; } public final void run() { this.oib.setPressed(false); this.oib.invalidate(); } }
/* * 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 vista.lugaresDespripcion; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; import java.awt.HeadlessException; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; /** * * @author Alan */ public class PotosiCerroRico extends JFrame{ private JPanel pnlImgIzq,pnlImgDer,pnlDescrp,pnlNombL; private JLabel lblNombreLug,lblDescrp,lblUbic; private JLabel lblImgn1,lblImgn2,lblImgn3,lblImgn4,lblImgn5; private BorderLayout layPrinc; private BoxLayout layCentro; private GridLayout layIzq,layDer; private FlowLayout layNomb; //este main debe ser borrado esta de pruba public PotosiCerroRico() throws HeadlessException { setTitle("agencia De viajes (nombre agencia)"); setSize(1080,800); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); iniciar(); setLocationRelativeTo(null); setVisible(true); } private void iniciar(){ iniciarPanels(); integrImgs(); integrInfo(); editColorEtiquets(); } private void iniciarPanels(){ pnlNombL=new JPanel(); pnlImgIzq=new JPanel(); pnlDescrp=new JPanel(); pnlImgDer=new JPanel(); iniciarLayouts(); integLayouts(); editColorPnls(); //se creo un espacio para que no se vea la tan junto a las imagenes pnlDescrp.add(Box.createRigidArea (new Dimension(10, 0))); //se integran todos los paneles en el jFrame add(pnlNombL,BorderLayout.NORTH); add(pnlImgIzq,BorderLayout.WEST); add(pnlDescrp,BorderLayout.CENTER); add(pnlImgDer,BorderLayout.EAST); } private void iniciarLayouts(){ layPrinc=new BorderLayout(); layNomb=new FlowLayout(); layIzq=new GridLayout(3, 1, 10, 5); layCentro=new BoxLayout(pnlDescrp,BoxLayout.Y_AXIS); layDer=new GridLayout(3, 1, 10,5); } private void integLayouts(){ setLayout(layPrinc); pnlNombL.setLayout(layNomb); pnlImgIzq.setLayout(layIzq); pnlDescrp.setLayout(layCentro); pnlImgDer.setLayout(layDer); } private void editColorPnls(){ pnlNombL.setBackground(new Color(32, 112, 193)); pnlImgIzq.setBackground(new Color(32, 112, 193)); pnlDescrp.setBackground(new Color(32, 112, 193)); pnlImgDer.setBackground(new Color(32, 112, 193)); } private void integrImgs(){ //se especifica hasta la carpeta LugaresTuristicos/ hace falta añadir ubicacion exacta y nombre.jpg lblImgn1=new JLabel(new ImageIcon(getClass().getResource("/vista/LugaresTuristicos/Potosi/CerroRico/imagen1.jpg"))); lblImgn2=new JLabel(new ImageIcon(getClass().getResource("/vista/LugaresTuristicos/Potosi/CerroRico/imagen2.jpg"))); lblImgn3=new JLabel(new ImageIcon(getClass().getResource("/vista/LugaresTuristicos/Potosi/CerroRico/imagen3.jpg"))); lblImgn4=new JLabel(new ImageIcon(getClass().getResource("/vista/LugaresTuristicos/Potosi/CerroRico/imagen4.jpg"))); lblImgn5=new JLabel(new ImageIcon(getClass().getResource("/vista/LugaresTuristicos/Potosi/CerroRico/imagen5.jpg"))); pnlImgIzq.add(lblImgn1); pnlImgIzq.add(lblImgn2); pnlImgDer.add(lblImgn3); pnlImgDer.add(lblImgn4); pnlImgDer.add(lblImgn5); } private void integrInfo(){ lblNombreLug=new JLabel("Cerro Rico de Potosi"); lblUbic=new JLabel("<html>Contáctanos:<p> Av. Ayacucho entre Colombia y Ecuador <p>+591 62615493 <p>4 4446666 <p> Cochabamba-Bolivia<html>"); //el <html> es salto de linea automatico el <p> es salto de linea controlado lblDescrp=new JLabel("<html><p>Su ubicacion se encuentra en la provincia de Daniel Campos en el departamento de Potosi dentro de la region altiplanica de la Cordillera de los Andes, considerada como una inmensa planicie en forma de desierto de sal situada a más de 3.600 metros sobre el nivel del mar.<p><html>" +"<html><p>El Cerro Rico es considerado como la mayor mino de plata en Sudamerica durante la epoca colonial donde los conquistadores sacaron toneladas de este preciado mineral que sirvio para finaciar al imperio español. En la actualidad ya no queda plata en las minas, sin embargo se sigue explotando sus entrañas para obtener otros metales. El Cerro Rico es hoy en dia un entramado de pasillo, laberinto de cuevas, escaleras y pozos, un hormiguero humano. <p><html>" + "<html><p>Se contara con un guia de habla inglesa-español (dividiendo a nuestro visitantes en dos grupos) ademas de un ex-minero que contara con todas las medidas de seguridad y el conocimiento disponible para nuestro visitantes, parte del costo total se destina al apoyo de la familias mineras, contara con trasporte privado como su propio equipo de mineria de alta gama: botas de goma, casco, chaquetas impermeables, pantalones de proteccion y lampara de cabeza electica (limpio y comodo) considere que son medidas obligatorias. <p><html>"); pnlNombL.add(lblNombreLug); pnlImgIzq.add(lblUbic); pnlDescrp.add(lblDescrp); } private void editColorEtiquets(){ lblDescrp.setForeground(Color.WHITE); lblUbic.setForeground(Color.WHITE); lblNombreLug.setForeground(Color.WHITE); //se cambian tamaños lblDescrp.setFont(new Font("arial", Font.PLAIN, 18)); lblUbic.setFont(new Font("arial", Font.PLAIN, 14)); lblNombreLug.setFont(new Font("arial", Font.BOLD, 20)); } }
import javax.swing.*; /** * Nguru Ian Davis * 15059844 */ public class BookingAdmin { private static Aircraft aircraft = new Aircraft(); //crates an new Aircraft instance private static String comms = "C"; //sets the /** * Method that generates the class default input JOptionPane */ public static String displayMenu(String [] option, String message) { String selection = (String) JOptionPane.showInputDialog(null, message, "Select an option", JOptionPane.PLAIN_MESSAGE, null, option, option[0]); return selection; } /** * Main method to run the program */ public static void main(String[] args) { BookingAdmin admin = new BookingAdmin(); admin.mainMenu(); } /** * Main Menu Method */ public void mainMenu() { String [] userSelect = new String[2]; userSelect[0] = "Setup Admin"; userSelect[1] = "Booker"; String y = displayMenu(userSelect, "Select type of user =) or\nPress 'Cancel' to exit"); if(y == null) { System.out.println("Exiting..."); System.exit(1); }else if(y.equals(userSelect[0])) { setupAdmin(); }else if(y.equals(userSelect[1])) { booker(); }else { System.out.println("\nExiting..."); System.exit(1); } } /** * Setup Admin method */ private void setupAdmin() { while(comms.equalsIgnoreCase("C")) { String [] adminOptions = new String[9]; adminOptions[0] = "Set flight destination"; adminOptions[1] = "Add Passenger"; adminOptions[2] = "Find Passenger"; adminOptions[3] = "Remove Passenger"; adminOptions[4] = "Show Revenue"; adminOptions[5] = "Show Weight"; adminOptions[6] = "Show Passengers"; adminOptions[7] = "Show First Class Passengers"; adminOptions[8] = "Exit"; String y = displayMenu(adminOptions, "Select an option\n N.B Make sure to set the flight route first before proceeding"); if(y == null) //if the user does not enter an option the program should open the main menu { mainMenu(); }else if(y.equals(adminOptions[0])) { setRouteDetails(); }else if(y.equals(adminOptions[1])) { passengerTypeSelect(); }else if(y.equals(adminOptions[2])) { findPassenger(); }else if(y.equals(adminOptions[3])) { removePassenger(); }else if(y.equals(adminOptions[4])) { System.out.println("Generated Revenue: £" + aircraft.getRevenue()); }else if(y.equals(adminOptions[5])) { System.out.println("Total passenger weight: " + aircraft.getTotalPassengerWeight() + " Kgs."); }else if(y.equals(adminOptions[6])) { aircraft.listPassengers(); //System.out.println(aircraft.toString()); //to be used to see the flight details }else if(y.equals(adminOptions[7])) { aircraft.listFirstClassPassengers(); //System.out.println(aircraft.toString()); //to be used to see the flight details }else if(y.equals(adminOptions[8])) { System.out.println("Exiting..."); System.exit(1); }else { System.out.println("\nExiting..."); System.exit(1); } comms = JOptionPane.showInputDialog("Type 'C' to continue, or anything else to exit"); if(comms != null) { comms = comms; }else { System.out.println("\nExiting..."); System.exit(1); } } } /** * Booker method */ private void booker() { while(comms.equalsIgnoreCase("C")) { String [] options = new String[4]; options[0] = "Show Aircraft Route Details (Aircraft has to be set up by Admin first)"; options[1] = "Add Passenger"; options[2] = "Show Number of Passengers"; options[3] = "Show Weight of Passengers Currently Booked"; String y = displayMenu(options, "Select an option"); if(y == null) { mainMenu(); }else if(y.equals(options[0])) { System.out.println("Route: " + aircraft.getRoute()); System.out.println("Maximum Passenger weight: " + aircraft.getMaxWeight() + " Kgs."); System.out.println("Maximum Passenger Number: " + aircraft.getMaxPassengers()); }else if(y.equals(options[1])) { selectPayingpassengerType(); }else if(y.equals(options[2])) { aircraft.getNumberOfPassengers(); //booker should only be able to see the number of passengers but not the passenger names on the aircraft }else if(y.equals(options[3])) { System.out.println("Total passenger weight: " + aircraft.getTotalPassengerWeight() + " Kgs."); //booker should only be able to see the current passenger weight in order to see if they can add another passenger onto the aircraft }else { System.out.println("\nExiting..."); System.exit(1); } comms = JOptionPane.showInputDialog("Type 'C' to continue, or anything else to exit"); if(comms != null) { comms = comms; }else { System.out.println("\nExiting..."); System.exit(1); } } } /** * Method to set the aircraft route, max weight and max number of passengers allowed on board */ public boolean setRouteDetails() { String [] route = new String[5]; route[0] = "Glasgow"; route[1] = "Cape Town"; String y = displayMenu(route, "Enter the route this plane will be travelling to..."); if(y == null) { // JOptionPane.showMessageDialog(null, "No Option Selected", "Selection Error", 0, null); // setupAdmin(); JOptionPane.showMessageDialog(null, "Please input the right data", "No Option Selected", 0, null); setRouteDetails(); } else if(y.equals(route[0])) { aircraft.setRoute(Route.GLASGOW); aircraft.setMaxPassengers(Route.GLASGOW_MAX_PASSENGERS); aircraft.setMaxWeight(Route.GLASGOW_MAXIMUM_WEIGHT); }else if(y.equals(route[1])) { aircraft.setRoute(Route.CAPE_TOWN); aircraft.setMaxPassengers(Route.CAPE_TOWN_MAX_PASSENGERS); aircraft.setMaxWeight(Route.CAPE_TOWN_MAXIMUM_WEIGHT); }else { JOptionPane.showMessageDialog(null, "Please input the right data", "No Option Selected", 0, null); setRouteDetails(); return false; } return true; } /** * Method to select the type of passenger being added to the aircraft */ public void passengerTypeSelect() { String [] addingOptions = new String[2]; addingOptions[0] = "Add Crew"; addingOptions[1] = "Add Paying Passengers"; String y = displayMenu(addingOptions, "Select type of passenger to be added"); if(y == null) { JOptionPane.showMessageDialog(null, "No Option Selected", "Selection Error", 0, null); setupAdmin(); }else if(y.equals(addingOptions[0])) { addPassengers(); }else if(y.equals(addingOptions[1])) { selectPayingpassengerType(); }else { System.out.println("\nExiting..."); } } /** * Method to add crew members to the aircraft */ public boolean addPassengers() { Passenger irie = new Crew(0, setFirstName(), setLastName(), setWeight(), setLuggage(), setCrew()); aircraft.addPassenger(irie); return true; } /** * Method to add paying passengers to the aircraft */ public void selectPayingpassengerType() { String [] passengerType = new String[3]; passengerType[0] = "Economy"; passengerType[1] = "Business Class"; passengerType[2] = "First Class"; String y = displayMenu(passengerType, "Select type of paying passenger"); if(y == null) { JOptionPane.showMessageDialog(null, "No Option Selected", "Selection Error", 0, null); selectPayingpassengerType(); }else if(y.equals(passengerType[0])) { PayingPassenger irie = new EconomyPassenger(0, setFirstName(), setLastName(), setWeight(), setLuggage(), Economy.TYPE_CHARGE, getEconomyBaseFare(),"1254"); aircraft.addPassenger(irie); }else if(y.equals(passengerType[1])) { PayingPassenger irie = new BusinessPassenger(0, setFirstName(), setLastName(), setWeight(), setLuggage(), BusinessClass.TYPE_CHARGE, getBusinessBaseFare(),"1254"); aircraft.addPassenger(irie); }else if(y.equals(passengerType[2])) { PayingPassenger irie = new FirstClassPassenger(0, setFirstName(), setLastName(), setWeight(), setLuggage(), FirstClass.TYPE_CHARGE, getFirstBaseFare(),"1254", setAdditionalLuggage()); aircraft.addPassenger(irie); }else { System.out.println("\nExiting..."); } } // public boolean addPassengers(int z) // { // z = 0; // PayingPassenger irie = new EconomyPassenger(z, setFirstName(), setLastName(), setWeight(), setLuggage(), Economy.TYPE_CHARGE, getBaseFare()); // aircraft.addPassenger(irie); // return true; // } public double setAdditionalLuggage() { String input = JOptionPane.showInputDialog("Enter First Class Passenger additional luggage weight."); Double nextDouble = Double.parseDouble(input); return nextDouble; } /** * Method to find passenger in the aircraft by passing in the passegerNumber */ public void findPassenger() { String input = JOptionPane.showInputDialog("Enter passenger number you wish to find."); Integer nextInt = Integer.parseInt(input); aircraft.findPassenger(nextInt); } /** * Method to remove passenger from the aircraft by passing in the passegerNumber */ public void removePassenger() { String input = JOptionPane.showInputDialog("Enter passenger number you wish to remove from flight."); Integer nextInt = Integer.parseInt(input); aircraft.removePassenger(nextInt); } /** * Method to set the first Name */ public String setFirstName() { String fname = JOptionPane.showInputDialog("Enter first name."); return fname; } /** * Method to set the last Name */ public String setLastName() { String lname = JOptionPane.showInputDialog("Enter last name."); return lname; } /** * Method to set the passenger luggage weight */ public double setLuggage() { String luggage = JOptionPane.showInputDialog("Enter luggage weight."); double lugg = Double.parseDouble(luggage); return lugg; } /** * Method to set the passenger weight */ public double setWeight() { String passWeight = JOptionPane.showInputDialog("Enter passenger weight."); double weight = Double.parseDouble(passWeight); return weight; } /** * Method to set the crew type */ public String setCrew() { String [] crewType = new String[3]; crewType[0] = "Captain"; crewType[1] = "First Officer"; crewType[2] = "Cabin Crew"; String y = displayMenu(crewType, "Select Crew Position"); if(y == null) { JOptionPane.showMessageDialog(null, "No Option Selected", "Selection Error", 0, null); setupAdmin(); }else if(y.equals(crewType[0])) { return "Captain"; }else if(y.equals(crewType[1])) { return "First Officer"; }else if(y.equals(crewType[2])) { return "Cabin Crew"; }else { System.out.println("\nExiting..."); } String crew = y; return crew; } /** * Method to get the base fare of Economy type passenger */ public int getEconomyBaseFare() { String x = aircraft.getRoute(); if(x.equalsIgnoreCase("Glasgow")) { return Economy.GLASGOW_BASE_FARE; } return Economy.CAPETOWN_BASE_FARE; } /** * Method to get the base fare of Business Class type passenger */ public int getBusinessBaseFare() { String x = aircraft.getRoute(); if(x.equalsIgnoreCase("Glasgow")) { return BusinessClass.GLASGOW_BASE_FARE; } return BusinessClass.CAPETOWN_BASE_FARE; } /** * Method to get the base fare of First Class type passenger */ public int getFirstBaseFare() { String x = aircraft.getRoute(); if(x.equalsIgnoreCase("Glasgow")) { return FirstClass.GLASGOW_BASE_FARE; } return FirstClass.CAPETOWN_BASE_FARE; } }
package ga.islandcrawl.object.item; import android.opengl.GLES20; import ga.islandcrawl.draw.Shape; import ga.islandcrawl.object.Item; import ga.islandcrawl.object.Tag; /** * Created by Ga on 4/22/2016. */ public class Vine extends Item { public Vine(String seed) { super(seed, new FormVine()); tag.add(Tag.Raw).add(Tag.Fiber); state.setStat("health", 10); } } class FormVine extends Shape { public FormVine(){ drawMode = GLES20.GL_TRIANGLE_STRIP; this.color = new float[]{0,.5f,.1f,1}; data = new float[]{ 3,1,0,3,0,0,2,-1,0,1,-1,0,0,0,0,-1,0,0,-2,-1,0,-2,0,0 }; for (int i=0;i<data.length;i++){ data[i] *= .05f; } init(); } }
package com.tencent.mm.plugin.exdevice.ui; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.TextView; import com.tencent.mm.R; import com.tencent.mm.ak.a.a.c.a; import com.tencent.mm.ak.o; import com.tencent.mm.sdk.platformtools.c; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.MMActivity; import com.tencent.mm.ui.base.preference.Preference; public class DeviceProfileHeaderPreference extends Preference { private String fNv; protected MMActivity fcq; String iAa; private String iAb; private boolean iAc; private ImageView izS; private TextView izT; private TextView izU; private TextView izV; private View izW; TextView izX; private boolean[] izY; private OnClickListener[] izZ; private CharSequence sT; public DeviceProfileHeaderPreference(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.izY = new boolean[6]; this.izZ = new OnClickListener[6]; this.iAc = false; this.fcq = (MMActivity) context; this.iAc = false; } public DeviceProfileHeaderPreference(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.izY = new boolean[6]; this.izZ = new OnClickListener[6]; this.iAc = false; this.fcq = (MMActivity) context; this.iAc = false; } public final void onBindView(View view) { x.d("MicroMsg.DeviceProfileHeaderPreference", "onBindView"); this.izS = (ImageView) view.findViewById(R.h.avatarIV); this.izT = (TextView) view.findViewById(R.h.nameTV); this.izU = (TextView) view.findViewById(R.h.editRemarkTV); this.izV = (TextView) view.findViewById(R.h.deviceNameTV); this.izW = view.findViewById(R.h.editTV); this.izX = (TextView) view.findViewById(R.h.deviceDescTV); x(this.izS, 0); x(this.izT, 2); x(this.izU, 1); x(this.izV, 3); x(this.izW, 4); x(this.izX, 5); this.iAc = true; if (this.iAc) { this.izT.setText(this.sT); this.izV.setText(this.fNv); this.izX.setText(this.iAa); setIconUrl(this.iAb); } else { x.w("MicroMsg.DeviceProfileHeaderPreference", "initView : bindView = " + this.iAc); } super.onBindView(view); } private void x(View view, int i) { view.setVisibility(this.izY[i] ? 8 : 0); view.setOnClickListener(this.izZ[i]); } public final void H(int i, boolean z) { View view; boolean z2; int i2 = 0; switch (i) { case 0: view = this.izS; break; case 1: view = this.izU; break; case 2: view = this.izT; break; case 3: view = this.izV; break; case 4: view = this.izW; break; case 5: view = this.izX; break; default: return; } boolean[] zArr = this.izY; if (z) { z2 = false; } else { z2 = true; } zArr[i] = z2; if (view != null) { if (!z) { i2 = 8; } view.setVisibility(i2); } } public final void a(int i, OnClickListener onClickListener) { View view; switch (i) { case 0: view = this.izS; break; case 1: view = this.izU; break; case 2: view = this.izT; break; case 3: view = this.izV; break; case 4: view = this.izW; break; case 5: view = this.izX; break; default: return; } this.izZ[i] = onClickListener; if (view != null) { view.setOnClickListener(onClickListener); } } public final void setName(CharSequence charSequence) { this.sT = charSequence; if (this.izT != null) { this.izT.setText(charSequence); } } public final void Ao(String str) { this.fNv = str; if (this.izV != null) { this.izV.setText(str); } } public final void setIconUrl(String str) { this.iAb = str; if (this.izS != null) { a aVar = new a(); Bitmap CV = c.CV(R.g.exdevice_my_device_default_icon); if (!(CV == null || CV.isRecycled())) { CV = c.a(CV, true, 0.5f * ((float) CV.getWidth())); if (!(CV == null || CV.isRecycled())) { aVar.dXO = new BitmapDrawable(CV); } } if (CV == null || CV.isRecycled()) { aVar.dXN = R.g.exdevice_my_device_default_icon; } aVar.dXW = true; o.Pj().a(this.iAb, this.izS, aVar.Pt()); } } }
package com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.AdLandingPageComponent.component.widget.verticalviewpager; import android.support.v4.view.ViewPager.e; class AdlandingDummyViewPager$a implements e { final /* synthetic */ AdlandingDummyViewPager nHb; private AdlandingDummyViewPager$a(AdlandingDummyViewPager adlandingDummyViewPager) { this.nHb = adlandingDummyViewPager; } /* synthetic */ AdlandingDummyViewPager$a(AdlandingDummyViewPager adlandingDummyViewPager, byte b) { this(adlandingDummyViewPager); } public final void a(int i, float f, int i2) { for (e a : AdlandingDummyViewPager.a(this.nHb)) { a.a(i, f, i2); } } public final void O(int i) { for (e O : AdlandingDummyViewPager.a(this.nHb)) { O.O(i); } } public final void N(int i) { if (i == 0) { this.nHb.nHc = this.nHb.getScrollX(); } for (e N : AdlandingDummyViewPager.a(this.nHb)) { N.N(i); } } }
package remote; import exceptions.MissingIDException; import java.util.HashSet; import java.util.Random; import java.util.Set; /** * Package ID broker class handles active request and respons IDs. * * @author Henrik Nilsson */ public class RequestIDBroker { private static final int ID_RANGE_MAX = 0xFFFF; private static final int ID_RANGE_MIN = 0x0000; private Set<Integer> usedIDs; private Random random; public RequestIDBroker() { usedIDs = new HashSet<>(); random = new Random(); } public int getID() { while(true) { int prop = ID_RANGE_MIN + random.nextInt(ID_RANGE_MAX); if (!usedIDs.contains(prop)) { usedIDs.add(prop); return prop; } } } public void releaseID(int id) throws MissingIDException { if (!usedIDs.contains(id)) throw new MissingIDException("Tried to release unused ID."); usedIDs.remove(id); } }
package com.qualcomm.ftcrobotcontroller.opmodes; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.hardware.IrSeekerSensor; import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; /** * Created by Justin on 6/28/2016. */ public class odstest extends OpMode { OpticalDistanceSensor ods; IrSeekerSensor ir; @Override public void init() { ods=hardwareMap.opticalDistanceSensor.get("ods"); ir=hardwareMap.irSeekerSensor.get("ir"); } @Override public void loop() { telemetry.addData("ODS",ods.getLightDetected()); telemetry.addData("ODSRaw",ods.getLightDetectedRaw()); telemetry.addData("irangle", ir.getAngle()); telemetry.addData("irstrength", ir.getStrength()); } }
package code; import java.util.ArrayList; import java.util.List; import errors.BadTypeError; public class Function { private String id; private Type returnType; public List<Variable> arguments; public CodeBlock bodyOfFunction; public Function() { arguments = new ArrayList<Variable>(); } public Type getReturnType() { return returnType; } public void setReturnType(Type type) { this.returnType = type; } public void setReturnType(String type) throws BadTypeError { this.returnType = SpecyficValue.checkType(type); } public String getId() { return id; } public void setId(String id) { this.id = id; } }
package com.tencent.mm.plugin.sns.ui; class SnsTimeLineUI$48 implements Runnable { final /* synthetic */ SnsTimeLineUI odw; SnsTimeLineUI$48(SnsTimeLineUI snsTimeLineUI) { this.odw = snsTimeLineUI; } public final void run() { if (SnsTimeLineUI.a(this.odw) != null) { SnsTimeLineUI.a(this.odw).oeg.notifyVendingDataChange(); } SnsTimeLineUI.M(this.odw); } }
package au.com.flexisoft.redisutil.redis; import org.springframework.stereotype.Repository; import au.com.flexisoft.redisutil.dto.Account; import lombok.extern.slf4j.Slf4j; @Repository @Slf4j public class AccountCache extends RedisValueOperationsCache<Account> { private static final String KEY_NAME = "accountid"; public Account get(String key) { return super.get(key); } @Override public void set(Account account) { super.set(String.valueOf(account.getId()), account); } protected String getKeyName() { return KEY_NAME; } @Override public String getFullKey(String key) { return super.getFullKey(key); } @Override protected String getComponent() { return "VTM"; } }
package alphacallapp.com.br.model; /** * Created by Igor Bueno on 01/03/2017. */ public class Submodulo { public Integer id_submodulo; public Integer id_modulo; public String nsubmodulo; public Submodulo() { } public Submodulo(Integer id_submodulo, Integer id_modulo, String nsubmodulo) { this.id_submodulo = id_submodulo; this.id_modulo = id_modulo; this.nsubmodulo = nsubmodulo; } public Integer getId_submodulo() { return id_submodulo; } public void setId_submodulo(Integer id_submodulo) { this.id_submodulo = id_submodulo; } public Integer getId_modulo() { return id_modulo; } public void setId_modulo(Integer id_modulo) { this.id_modulo = id_modulo; } public String getNsubmodulo() { return nsubmodulo; } public void setNsubmodulo(String nsubmodulo) { this.nsubmodulo = nsubmodulo; } }
// Sun Certified Java Programmer // Chapter 4, P301 // Operators class Tester301 { public static void main(String[] args) { String s = "123"; s += "45"; s += "67"; System.out.println(s); } }
package org.sodeja.functional; public interface Function0<R> { public R execute(); }
package com.somethinglurks.jbargain.api.node.post.poll; import com.somethinglurks.jbargain.api.node.meta.Author; import com.somethinglurks.jbargain.api.node.meta.attribute.Describable; import com.somethinglurks.jbargain.api.node.meta.attribute.Votable; import java.util.Date; /** * Represents an option in a forum poll */ public interface PollOption extends Describable, Votable { /** * Gets the ID of the node this poll option belongs to * * @return ID of parent node */ String getNodeId(); /** * Gets whether the score is hidden. * * @return True if score is hidden, false if not */ boolean isScoreHidden(); /** * Gets the score of this item, which is equal to the positive votes minus the negative votes * * @return Score */ int getScore(); /** * Get the user who suggested this option * * @return Author of option */ Author getAuthor(); /** * Gets the date this option was suggested * * @return Date of suggestion */ Date getPostDate(); }
package playground.ds.interfaces; public interface StackAPI { void push(char element); char pop(); char peek(); boolean isEmpty(); }
package com.weique.commonres.http; import com.weique.commonres.base.BaseResponse; import com.weique.commonres.base.commonbean.CommonTitleBean; import com.weique.commonres.entity.CommonBackBean; import java.util.List; import java.util.Map; import io.reactivex.Observable; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; import retrofit2.http.QueryMap; public interface CenterService { String path = "app/"; /** * 通用 post 请求 */ @FormUrlEncoded @POST("{path}") Observable<BaseResponse<Object>> putCommonList(@Path(value = "path", encoded = true) String url, @FieldMap Map<String, Object> map); /** * 根据用户id 获取相同列表返回数据 * * @param map map * @return Observable */ @GET("{path}") Observable<BaseResponse<CommonBackBean>> getCommonObject(@Path(value = "path", encoded = true) String url, @QueryMap Map<String, Object> map); /** * 获取枚举数据列表 * * @param paramSign paramSign * @return Observable */ @GET(path + "Common/GetEnums") Observable<BaseResponse<List<CommonTitleBean>>> getTitles(@QueryMap Map<String, Object> paramSign); }
package org.spring.fom.support.task.download.helper; import java.io.File; import java.io.InputStream; import java.util.zip.ZipOutputStream; import org.spring.fom.support.task.download.helper.util.HttpUtil; import org.spring.fom.support.task.parse.ZipUtil; /** * http的一些默认实现 * * @author shanhm1991@163.com * */ public class HttpHelper implements DownloadHelper, DownloadZipHelper { @Override public InputStream open(String url) throws Exception { return HttpUtil.open(url); } @Override public void download(String url, File file) throws Exception { HttpUtil.download(url, file); } @Override public int delete(String url) throws Exception { return HttpUtil.delete(url); } @Override public String getSourceName(String sourceUri) { return new File(sourceUri).getName(); } @Override public long zipEntry(String name, String uri, ZipOutputStream zipOutStream) throws Exception { return ZipUtil.zipEntry(name, open(uri), zipOutStream); } }
/* * 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 latihancruddesktop.ui.master; import javax.swing.JFrame; import javax.swing.JOptionPane; import latihancruddesktop.Main; import latihancruddesktop.domain.Peserta; /** * * @author KENDAY */ public class FormDialogPeserta extends javax.swing.JDialog { /** * Creates new form FormDialogPeserta */ private Peserta peserta; private enum JKEL { LAKI, PEREMPUAN }; public Peserta showDialog() { setVisible(true); return peserta; } public FormDialogPeserta() { super(new JFrame(), true); initComponents(); setLocationRelativeTo(null); } private Boolean validateForm() { if (txtNomorInduk.getText().trim().length() > 0 && txtAlamat.getText().trim().length() > 0 && txtNamaPeserta.getText().trim().length() > 0 && (!rdLaki.isSelected() || !rdPerempuan.isSelected())) { return true; } else { return false; } } private void loadDomainToForm() { if (peserta != null) { txtAlamat.setText(peserta.getAlamat()); txtNamaPeserta.setText(peserta.getNama()); txtNomorInduk.setText(peserta.getNomorInduk()); if (peserta.getJenisKelamin().equals(JKEL.LAKI.toString())) { rdLaki.setSelected(true);} else { rdPerempuan.setSelected(true); } } } public Peserta editAnggota(Peserta peserta) { this.peserta = peserta; loadDomainToForm(); setVisible(true); return peserta; } private void loadFormToDomain() { if (peserta == null) { peserta = new Peserta(); } peserta.setAlamat(txtAlamat.getText()); peserta.setNama(txtNamaPeserta.getText()); peserta.setNomorInduk(txtNomorInduk.getText()); if (rdLaki.isSelected()) { peserta.setJenisKelamin(JKEL.LAKI.toString()); } else { peserta.setJenisKelamin(JKEL.PEREMPUAN.toString()); } } public FormDialogPeserta(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); rdLaki = new javax.swing.JRadioButton(); rdPerempuan = new javax.swing.JRadioButton(); txtNomorInduk = new javax.swing.JTextField(); txtNamaPeserta = new javax.swing.JTextField(); txtAlamat = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jLabel1.setText("No Induk"); jLabel2.setText("Nama Mahasiswa"); jLabel3.setText("Jenis Kelamin"); jLabel4.setText("Alamat"); buttonGroup1.add(rdLaki); rdLaki.setText("Laki-Laki"); rdLaki.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rdLakiActionPerformed(evt); } }); rdPerempuan.setText("Perempuan"); rdPerempuan.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rdPerempuanActionPerformed(evt); } }); jButton1.setText("OK"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Batal"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel1.setBackground(new java.awt.Color(0, 255, 255)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 44, Short.MAX_VALUE) ); jPanel3.setBackground(new java.awt.Color(0, 255, 255)); jLabel5.setText("©KEYorg"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(201, 201, 201) .addComponent(jLabel5) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel5) .addContainerGap(22, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtAlamat) .addComponent(txtNamaPeserta, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3) .addGap(35, 35, 35) .addComponent(rdLaki) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rdPerempuan))) .addComponent(txtNomorInduk, javax.swing.GroupLayout.Alignment.LEADING)) .addComponent(jLabel4)) .addGap(35, 35, 35) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addComponent(jLabel1)) .addContainerGap(35, Short.MAX_VALUE)) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(txtNomorInduk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txtNamaPeserta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(rdLaki) .addComponent(rdPerempuan)) .addGap(29, 29, 29) .addComponent(jLabel4)) .addGroup(layout.createSequentialGroup() .addGap(8, 8, 8) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtAlamat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(69, 69, 69) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void rdLakiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdLakiActionPerformed // TODO add your handling code here: }//GEN-LAST:event_rdLakiActionPerformed private void rdPerempuanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdPerempuanActionPerformed // TODO add your handling code here: }//GEN-LAST:event_rdPerempuanActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed this.dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed if (validateForm()) { loadFormToDomain(); this.dispose(); } else { JOptionPane.showMessageDialog(Main.getMainForm(), "Kolom bertanda * harus diisi !!", "Terjadi Kesalahan !!", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(FormDialogPeserta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(FormDialogPeserta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(FormDialogPeserta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(FormDialogPeserta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { FormDialogPeserta dialog = new FormDialogPeserta(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel3; private javax.swing.JRadioButton rdLaki; private javax.swing.JRadioButton rdPerempuan; private javax.swing.JTextField txtAlamat; private javax.swing.JTextField txtNamaPeserta; private javax.swing.JTextField txtNomorInduk; // End of variables declaration//GEN-END:variables }
package br.com.omnia.draft.model; public class Produto { private Integer codigo; private String nome; private int unidade; private Double valor; public Produto(){ } public Integer getCodigo() { return codigo; } public void setCodigo(Integer codigo) { this.codigo = codigo; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public int getUnidade() { return unidade; } public void setUnidade(int unidade) { this.unidade = unidade; } public Double getValor() { return valor; } public void setValor(Double valor) { this.valor = valor; } }
package com.momori.wepic.presenter.inter; import com.momori.wepic.activity.fragment.AlbumCardFragment; import com.momori.wepic.model.AlbumModel; import java.util.List; /** * Created by Hyeon on 2015-05-04. */ public interface MainPresenter { public void initAlbum_list(); public void showAlbumCardFragment(int fragment_layout, AlbumCardFragment albumCardFragment); public List<AlbumModel> getAlbum_list(); public void setView(View view); public interface View{ } }
package org.cloudfoundry.samples.music.repositories; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import org.cloudfoundry.samples.music.domain.Album; import org.cloudfoundry.samples.music.domain.Artist; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactoryUtils; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.init.Jackson2ResourceReader; import org.springframework.stereotype.Component; import java.util.Collection; import java.util.HashMap; import java.util.Map; @Component public class AlbumRepositoryPopulator implements ApplicationListener<ContextRefreshedEvent>, ApplicationContextAware { private final Jackson2ResourceReader resourceReader; private final Resource sourceData; private ApplicationContext applicationContext; public AlbumRepositoryPopulator() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); resourceReader = new Jackson2ResourceReader(mapper); sourceData = new ClassPathResource("albums.json"); } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (event.getApplicationContext().equals(applicationContext)) { AlbumRepository albumRepository = BeanFactoryUtils.beanOfTypeIncludingAncestors(applicationContext, AlbumRepository.class); ArtistRepository artistRepository = BeanFactoryUtils.beanOfTypeIncludingAncestors(applicationContext, ArtistRepository.class); if (albumRepository != null && albumRepository.count() == 0) { populate(albumRepository, artistRepository); } } } @SuppressWarnings("unchecked") public void populate(AlbumRepository repository, ArtistRepository artistRepository) { Object entity = getEntityFromResource(sourceData); Map<String, Artist> artistMap = new HashMap<>(); if (entity instanceof Collection) { for (Album album : (Collection<Album>) entity) { if (album != null) { save(repository, artistRepository, album, artistMap); } } } else { save(repository, artistRepository, (Album) entity, artistMap); } } private Album save(AlbumRepository repository, ArtistRepository artistRepository, Album album, Map<String, Artist> artistMap) { String artistName = album.getArtist().getName(); Artist artist = artistMap.get(artistName); if (artist == null) { artist = artistRepository.save(album.getArtist()); album.setArtist(artist); artistMap.put(artistName, artist); } Album savedAlbum = repository.save(album); return savedAlbum; } private Object getEntityFromResource(Resource resource) { try { return resourceReader.readFrom(resource, this.getClass().getClassLoader()); } catch (Exception e) { throw new RuntimeException(e); } } }
package pp_fp05.cd; public class Author { protected String name; protected int age; protected String address; protected int NIF; protected int NIB; protected String authorType; protected static int objcount = 0; public Author(String tempName, int tempAge, String tempAddress, int tempNIF, int tempNIB, String tempAuthorType) { this.name = tempName; this.age = tempAge; this.address = tempAddress; this.NIF = tempNIF; this.NIB = tempNIB; this.authorType = tempAuthorType; objcount++; } public Author(String tempName, int tempAge, String tempAuthorType){ name = tempName; age = tempAge; authorType = tempAuthorType; objcount++; } public void authorPrint(){ if ("Seller".equals(authorType)){ System.out.println("Nome do autor: "+name); System.out.println("Idade: "+age); System.out.println("Morada: "+address); System.out.println("NIF: "+NIF); System.out.println("NIB: "+NIB); System.out.println("Tipo de autor: "+authorType); } else { System.out.println("Nome do autor: "+name); System.out.println("Idade: "+age); System.out.println("Tipo de autor: "+authorType); } } }
package com.aplicacion.guiaplayasgalicia.objetos; import com.aplicacion.guiaplayasgalicia.CustomBaseActivity; import com.aplicacion.guiaplayasgalicia.R; public enum BeachOccupationEnum { BLANK (Short.valueOf("-1"), R.string.hyphen), LOW (Short.valueOf("0"), R.string.low), MEDIUM (Short.valueOf("1"), R.string.medium), HIGH (Short.valueOf("2"), R.string.high); private final Short id; private final int textId; private BeachOccupationEnum(final Short id, final int textId) { this.id = id; this.textId = textId; } public Short getId() { return this.id; } public String getText() { return CustomBaseActivity.context.getResources().getString(textId); } @Override public String toString() { return this.getText(); } }
package a2lend.app.com.a2lend; import android.content.Context; import android.location.Location; import android.net.Uri; import android.os.AsyncTask; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.PhoneAuthCredential; import com.google.firebase.auth.UserProfileChangeRequest; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Created by Igbar on 12/18/2017. */ public class DataAccess { // User Firebase public static FirebaseAuth auth = FirebaseAuth.getInstance(); // get Instance Database public static FirebaseDatabase database = FirebaseDatabase.getInstance(); // Reference Database public static DatabaseReference databaseReference = database.getReference(); // item Reference public static DatabaseReference ReferenceItems = databaseReference.child("items"); // StorageReference public static StorageReference mStorageRefPhotos = FirebaseStorage.getInstance().getReference().child("photos"); public static List<Item> myListItems = new ArrayList<Item>(); public static List<Item> resulSearchList = new ArrayList<Item>(); public DataAccess(){ } public static FirebaseUser getUser(){ return auth.getCurrentUser(); } public static boolean isAnonymous(){ return auth.getCurrentUser().isAnonymous(); } public static String getUserId(){ auth.getCurrentUser().reload(); return auth.getCurrentUser().getUid(); } public static void updateEmail(String email) { auth.getCurrentUser().reload(); auth.getCurrentUser().updateEmail(email); } public static void updatePassword(String password) { auth.getCurrentUser().reload(); auth.getCurrentUser().updatePassword(password); } public static String getEmail(String password) { auth.getCurrentUser().reload(); return auth.getCurrentUser().getEmail(); } public static void updatePhoneNumber(PhoneAuthCredential credential){ auth.getCurrentUser().reload(); auth.getCurrentUser().updatePhoneNumber(credential); } public static void sendPasswordResetEmail(final Context context, String emailAddress){ auth.sendPasswordResetEmail(emailAddress) .addOnSuccessListener(new OnSuccessListener() { @Override public void onSuccess(Object o) { MySupport.showMessageDialog(context,"Send Password Reset Email","Success"); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { MySupport.showMessageDialog(context,"Send Password Reset Email","Failure"); } }); } public static void UpdateUser( String Name,String Email , String Password , String Phone ){ FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); UserProfileChangeRequest profileUpdates; if(!Name.isEmpty()) { profileUpdates = new UserProfileChangeRequest.Builder().setDisplayName(Name).build(); user.updateProfile(profileUpdates).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d("UpdateUser", "User profile updated."); } } }); } if(!Email.isEmpty()) auth.getCurrentUser().updateEmail(Email); if(!Password.isEmpty()) auth.getCurrentUser().updatePassword(Password); } public static void AddObject(Item item){ String Random_Key = ReferenceItems.push().getKey(); item.setUser(getUserId()); item.setId(Random_Key); if(!isAnonymous()) ReferenceItems.child(item.user+"_"+Random_Key).setValue(item); if(!myListItems.contains(item)) myListItems.add(item); } public static boolean deleteItem(Item item) { String TAG = "DataAccess#deleteItem"; // check if the item is exist if(ReferenceItems.child(item.getUser()+"_"+item.id)==null){ Log.w(TAG,"Item is not Exist : - "+ item.getId()); return false; } //remove item ReferenceItems.child(item.getUser()+"_"+item.id).removeValue(); Log.w(TAG,"Remove Item : - "+ item.getId()); if(mStorageRefPhotos.child(item.getImagesUri()) ==null) Log.w(TAG,"Image is not Exist : - "+ item.getId()); mStorageRefPhotos.child(item.getImagesUri()).delete(); Log.w(TAG,"Remove Image : - "+ item.getImagesUri()); return true; } public static boolean updateObject(Item item) { String TAG = "DataAccess#updateItem"; // check if the item is exist if(ReferenceItems.child(item.getUser()+"_"+item.id)==null){ Log.w(TAG,"Item is not Exist : - "+ item.getId()); return false; } //Update Item ReferenceItems.child(item.getUser()+"_"+item.id).setValue(item); Log.w(TAG,"Update Item : - "+ item.getId()); return true; } public static List<Item> UpdateMyListItems(){ if(isAnonymous()) return null; ValueEventListener postListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Iterable<DataSnapshot> posts = dataSnapshot.getChildren(); for(DataSnapshot post : posts){ Item item = post.getValue(Item.class); if(item.user.equals(getUserId())&& !myListItems.contains(item)) myListItems.add(item); } } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w("getMyItems", "loadPost:onCancelled", databaseError.toException()); // ... } }; Query query = ReferenceItems; query.addValueEventListener(postListener); return myListItems; } public static List<Item> SearchByLocation(final Location location, final double byDistance){ ValueEventListener postListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Iterable<DataSnapshot> posts = dataSnapshot.getChildren(); for(DataSnapshot post : posts){ Item item = post.getValue(Item.class); double distance = Math.hypot( item.getLatitude() - location.getLatitude() ,item.getLongitude()- location.getLongitude()); distance= Math.abs(distance); if(distance <byDistance) resulSearchList.add(item); } } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w("getMyItems", "loadPost:onCancelled", databaseError.toException()); // ... } }; Query query = ReferenceItems; query.addValueEventListener(postListener); return resulSearchList; } public static List<Item> SearchByName(final String Name){ ValueEventListener postListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Iterable<DataSnapshot> items = dataSnapshot.getChildren(); Item foundItemResult; for(DataSnapshot item : items){ String name = item.child("name").getValue().toString(); if(name.equals(Name)){ foundItemResult = item.getValue(Item.class); resulSearchList.add(foundItemResult); } // DataSnapshot DataSnapshotItem = item; // Iterable<DataSnapshot> result = DataSnapshotItem.getChildren(); // result. // for(DataSnapshot i : result){ // if(i.getKey().equals("name")){ // Log.w("LocationObject",post1.getKey()); // l = post1.getValue(Location.class); // } // Log.w("Object","key : "+post1.getKey().toString()+"\nValue:"+post1.getValue() ); // Log.w("Object ",item.name +" " +item.description + "\n" ); // resulSearch.add(item); } } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w("getMyItems", "loadPost:onCancelled", databaseError.toException()); // ... } }; Query query = ReferenceItems; query.addValueEventListener(postListener); Log.d("SearchByLocation", "number Items Found "+resulSearchList.size()+ " "); return resulSearchList; } public static List<Item> getItems(){ ValueEventListener postListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Iterable<DataSnapshot> posts = dataSnapshot.getChildren(); for(DataSnapshot post : posts){ Item item = post.getValue(Item.class); myListItems.add(item); } } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w("getMyItems", "loadPost:onCancelled", databaseError.toException()); // ... } }; Query query = ReferenceItems.limitToFirst(10); query.addValueEventListener(postListener); return myListItems; } public static void uploadFromUri(Uri fileUri , FragmentActivity fragmentActivity) { final String TAG = "uploadFromUri"; //final String m_path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath(); // Get a reference to store file at photos/<FILENAME>.jpg final StorageReference photoRef = mStorageRefPhotos.child(fileUri.getLastPathSegment()); //firebase image download url final Uri[] mDownloadUrl = {null}; //region Upload file to Firebase Storage Log.d(TAG, "uploadFromUri:dst:" + photoRef.getPath()); photoRef.putFile(fileUri).addOnSuccessListener(fragmentActivity, new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { // Upload succeeded Log.d(TAG, "uploadFromUri:onSuccess"); // Get the public download URL mDownloadUrl[0] = taskSnapshot.getMetadata().getDownloadUrl(); // Change The Uri Local Phone with Uri Server ; // To Save Uri Server with the Object Item //if(i<launchCameraActivity.fileUri.size()) // launchCameraActivity.fileUri.set(i, mDownloadUrl); Log.d(TAG, "mDownloadUrl:" + mDownloadUrl[0]); } }).addOnFailureListener(fragmentActivity, new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Upload failed mDownloadUrl[0] = null; Log.w(TAG, "uploadFromUri:onFailure", exception); } }); //endregion [END upload_from_uri] } private class MyTask extends AsyncTask<String,String,String> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(String... params) { ReferenceItems.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { // LoadData(dataSnapshot); String userID = dataSnapshot.child("user").getValue(String.class); if(userID.equals(getUserId())) { Item item =dataSnapshot.getValue(Item.class); myListItems.add(item); } MyListItemsFragment.adapter.notifyDataSetChanged(); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { String userID = dataSnapshot.child("user").getValue(String.class); if(userID.equals(getUserId())) { Item item =dataSnapshot.getValue(Item.class); for(Item i : myListItems) { if( i.getId().equals(item.id)){ myListItems.remove(i); myListItems.add(item); } } } MyListItemsFragment.adapter.notifyDataSetChanged(); } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { String itemId = dataSnapshot.child("id").getValue(String.class); for(Item i : myListItems) { if( i.getId().equals(itemId)){ myListItems.remove(i); } } MyListItemsFragment.adapter.notifyDataSetChanged(); } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } }); return null; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); } } }
/* * 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 dao; import dto.EmployeeAllowanceSalaryDTO; import dto.EmployeeAllowanceViewDTO; import dto.EmployeeSalaryViewDTO; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; /** * * @author ASUS */ public class EmployeeSalaryReportDAO { public ArrayList<EmployeeSalaryViewDTO> getEmployeeSalaryViewDetails(Connection connection) throws SQLException{ Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery("select * from employee_salary_view;"); result.beforeFirst(); ArrayList<EmployeeSalaryViewDTO> list = new ArrayList<>(); while(result.next()){ EmployeeSalaryViewDTO employeeSalaryViewDTO = new EmployeeSalaryViewDTO(); employeeSalaryViewDTO.setEmpId(result.getString(1)); employeeSalaryViewDTO.setName(result.getString(2)+" "+result.getString(3)); employeeSalaryViewDTO.setDepartment(result.getString(4)); employeeSalaryViewDTO.setCadre(result.getString(5)); employeeSalaryViewDTO.setSalary(result.getInt(6)); list.add(employeeSalaryViewDTO); } return list; } public ArrayList<EmployeeAllowanceViewDTO> getEmployeeAllowanceViewDetails(Connection connection) throws SQLException{ Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery("select * from employee_allowance_view;"); result.beforeFirst(); ArrayList<EmployeeAllowanceViewDTO> list = new ArrayList<>(); while(result.next()){ EmployeeAllowanceViewDTO employeeAllowanceViewDTO = new EmployeeAllowanceViewDTO(); employeeAllowanceViewDTO.setEmpId(result.getString(1)); employeeAllowanceViewDTO.setContractId(result.getString(2)); employeeAllowanceViewDTO.setAllowanceId(result.getString(3)); employeeAllowanceViewDTO.setAllowance(result.getString(4)); list.add(employeeAllowanceViewDTO); } return list; } public ArrayList<EmployeeAllowanceSalaryDTO> getEmployeeAllowanceTotal(Connection connection) throws SQLException{ String sql = "SELECT ce.emp_id as employee_id,sum(a.amount) as total FROM contract_employee ce,contract_allowance ca,allowance a WHERE ce.contract_id = ca.contract_id && ca.allowance_id = a.allowance_id GROUP by ce.emp_id ORDER by 1"; Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery(sql); result.beforeFirst(); ArrayList<EmployeeAllowanceSalaryDTO> salaryList = new ArrayList<>(); while(result.next()){ EmployeeAllowanceSalaryDTO employeeAllowanceSalaryDTO = new EmployeeAllowanceSalaryDTO(); employeeAllowanceSalaryDTO.setEmpId(result.getString(1)); employeeAllowanceSalaryDTO.setTotal(result.getInt(2)); salaryList.add(employeeAllowanceSalaryDTO); } return salaryList; } }
package com.jeysin.network; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; /** * @Author: Jeysin * @Date: 2019/4/8 17:32 * @Desc: */ public class NetworkDemo { private static void URLTest(){ try{ URL url = new URL("http://www.baidu.com"); URLConnection urlConnection = url.openConnection(); InputStream input = urlConnection.getInputStream(); byte[] bytes = new byte[1024]; int length = 0; while ((length = input.read(bytes)) != -1) { System.out.println(new String(bytes, 0, length)); } input.close(); }catch (Exception e){ e.printStackTrace(); } } public static void main(String[] args){ URLTest(); } }
package com.github.rahmnathan.keycloak.auth.utils; import org.apache.camel.Exchange; import org.apache.camel.ProducerTemplate; import org.json.JSONObject; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; public class KeycloakUtils { private static final Logger logger = Logger.getLogger(KeycloakUtils.class.getName()); public static String getAccessToken(String username, String password, ProducerTemplate producerTemplate) { String requestBody = buildLoginInfo(username, password); Map<String, Object> headers = Map.of(Exchange.CONTENT_LENGTH, requestBody.getBytes().length); String response = producerTemplate.requestBodyAndHeaders("direct:accesstoken", requestBody, headers, String.class); JSONObject jsonObject = new JSONObject(response); if(jsonObject.has("access_token")) return jsonObject.getString("access_token"); throw new RuntimeException("Failed to get access token."); } private static String buildLoginInfo(String username, String password) { Map<String, String> args = new HashMap<>(); args.put("grant_type", "password"); args.put("client_id", "movielogin"); args.put("username", username); args.put("password", password); StringBuilder sb = new StringBuilder(); args.forEach((key, value) -> { try { sb.append(URLEncoder.encode(key, "UTF-8")).append("=") .append(URLEncoder.encode(value, "UTF-8")).append("&"); } catch (UnsupportedEncodingException e) { logger.log(Level.SEVERE, "Failed building login info. Parameter could not be encoded.", e); } }); return sb.toString().substring(0, sb.length() - 1); } }
package com.tencent.mm.pluginsdk.ui.preference; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import com.tencent.mm.model.au; import com.tencent.mm.pluginsdk.model.m; class a$2 implements OnCancelListener { final /* synthetic */ m lYl; final /* synthetic */ a qOu; a$2(a aVar, m mVar) { this.qOu = aVar; this.lYl = mVar; } public final void onCancel(DialogInterface dialogInterface) { au.DF().c(this.lYl); } }
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 java.io.IOException; import java.io.PrintWriter; @WebServlet(name = "DiscountServlet", urlPatterns = "/discount") public class DiscountServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String product = request.getParameter("product"); float price = Float.parseFloat(request.getParameter("list")); float percent = Float.parseFloat(request.getParameter("percent"))/100; double amount = price*percent*0.1; PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<h2>Product Discount Calculator</h2>"); out.println("<label>Product Description :</label>"); out.println("$"+product+"<br/>"); out.println("<label>Price:</label>"); out.println(price+"<br/>"); out.println("<label>Discount Percent:</label>"); out.println(percent + "%<br/>"); out.println("<label>Discount Amount:</label>"); out.println("$"+amount+"<br/>"); out.println("<label>Discount Price:</label>"); out.println("$"+(price - amount)); out.println("</html>"); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
package com.gp.watermarker.controllers; public class MainPage { }
package servicio.controlador; import java.io.IOException; import javax.xml.bind.JAXBException; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; import servicio.tipos.Programa; public class MainControlador7 { public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, JAXBException { System.out.println("1. getListadoProgramasXML():\n"); ServicioALaCarta servicio = new ServicioALaCarta(); ListadoProgramas listadoProgramas = servicio.getListadoProgramasXML(); for (ProgramaResultado prog : listadoProgramas.getProgramasResultado()) { System.out.println("\t" + prog); } System.out.println("\n2. getProgramaFiltrado():\n"); String idPrograma = "tenemos-que-hablar"; Programa programa = servicio.getPrograma(idPrograma); if (programa != null) { System.out.println("\tEmisiones del programa " + idPrograma + " original:\n"); for (Programa.Emision emision : programa.getEmision()) { System.out.println("\t\tTitulo emision:" + emision.getTitulo()); } } String clave = "los"; Programa programaFiltrado = servicio.getProgramaFiltrado(idPrograma, clave); if (programaFiltrado != null) { System.out.println( "\tEmisiones del programa " + programaFiltrado.getNombre() + " filtrados por la clave: " + clave + "\n"); for (Programa.Emision emision : programaFiltrado.getEmision()) { System.out.println("\t\tTitulo emision:" + emision.getTitulo()); } } String idPrograma2 = "acacias-38"; Programa programa2 = servicio.getPrograma(idPrograma2); System.out.println("\n3. crearFavoritos():\n"); String idFavoritos = servicio.crearFavoritos(); System.out.println("\tCreado favoritos con id: " + idFavoritos); System.out.println("\n4. addProgramaFavorito():\n"); if (programa != null) { servicio.addProgramaFavorito(idFavoritos, programa.getId()); System.out.println("\tAñadido programa " + programa.getId() + " al favorito " + idFavoritos); } if (programa2 != null) { servicio.addProgramaFavorito(idFavoritos, programa2.getId()); System.out.println("\tAñadido programa " + programa2.getId() + " al favorito " + idFavoritos); } if (programa2 != null) { System.out.println("\tAñadido programa " + programa2.getId() + " al favorito " + idFavoritos + " (REPETIDO)"); servicio.addProgramaFavorito(idFavoritos, programa2.getId()); } System.out.println("\tLista de programas para el favorito " + idFavoritos + ":\n"); Favoritos fav1 = servicio.getFavoritos(idFavoritos); for (ProgramaResultado prog : fav1.getProgramas()) { System.out.println("\t\tId: " + prog.getId()); System.out.println("\t\tNombre: " + prog.getNombre() + "\n"); } System.out.println("\n5. removeProgramaFavorito():\n"); if (programa2 != null) { servicio.removeProgramaFavorito(idFavoritos, programa2.getId()); System.out.println("\tEliminado programa " + programa2.getId() + " del favorito " + idFavoritos); } System.out.println("\tLista de programas para el favorito " + idFavoritos + ":\n"); fav1 = servicio.getFavoritos(idFavoritos); for (ProgramaResultado prog : fav1.getProgramas()) { System.out.println("\t\tId: " + prog.getId()); System.out.println("\t\tNombre: " + prog.getNombre() + "\n"); } } }
package com.ibeiliao.pay.admin.controller.report; import com.ibeiliao.pay.admin.controller.report.form.QueryAccountDailyForm; import com.ibeiliao.pay.admin.dto.PageResult; import com.ibeiliao.pay.admin.utils.RequestUtils; import com.ibeiliao.pay.admin.utils.resource.Menu; import com.ibeiliao.pay.admin.utils.resource.MenuResource; import com.ibeiliao.pay.common.utils.DateUtil; import com.ibeiliao.pay.common.utils.JsonUtil; import com.ibeiliao.pay.common.utils.xls.XlsFileWriter; import com.ibeiliao.platform.commons.utils.ParameterUtil; import com.ibeiliao.statement.api.dto.response.BeiliaoAccountDailySummary; import com.ibeiliao.statement.api.dto.response.BeiliaoAccountDailySummaryResponse; import com.ibeiliao.statement.api.provider.SummaryServiceProvider; import org.apache.commons.lang3.time.FastDateFormat; import org.apache.poi.ss.usermodel.Workbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * 查询幼儿园账户每日汇总报表 * * @author liuying 2016/9/17 */ @Controller @RequestMapping("admin/report") @Menu(name = "查询贝聊账户每日汇总", parent = "报表管理", sequence = 1100000) public class QueryBeiliaoDailySummaryController { private static final Logger logger = LoggerFactory .getLogger(QueryBeiliaoDailySummaryController.class); @Autowired private SummaryServiceProvider summaryServiceProvider; /** * 查询贝聊账户每日汇总主页,xhtml 仅用于展示页面,ajax 调用 .do 接口获取参数 * @return */ @RequestMapping("queryBeiliao.xhtml") @MenuResource("查询贝聊账户每日汇总主页") public String index() { return ("/report/beiliao_account_daily_summary"); } @RequestMapping("queryBeiliao") @MenuResource("查询贝聊账户每日汇总") @ResponseBody public PageResult<List<BeiliaoAccountDailySummary>> queryBeiliao( @ModelAttribute @Valid QueryAccountDailyForm form) { logger.info("admin#QueryBeiliaoDailySummaryController#query | 查询贝聊账户每日汇总 | form: {}", JsonUtil.toJSONString(form)); Date[] summaryDateArr = RequestUtils.toDateArray(form.getSummaryDateRange()); BeiliaoAccountDailySummaryResponse response = summaryServiceProvider.queryBeiliaoDaily( summaryDateArr[0], summaryDateArr[1], form.getPage(), form.getPageSize()); return new PageResult<>(form.getPage(), form.getPageSize(), 0, response.getSummaries()); } // /** // * 把输入的时间范围转换成 Date 数组 // * @param dateRange // * @return // */ // private Date[] toDateArray(String dateRange) { // String[] array = dateRange.split(" - "); // FastDateFormat fdf = FastDateFormat.getInstance("yyyy-MM-dd"); // try { // Date startTime = fdf.parse(array[0]); // Date endTime = fdf.parse(array[1]); // return new Date[] { startTime, endTime }; // } catch (ParseException e) { // throw new IllegalArgumentException("错误的时间范围: " + dateRange); // } // } /** * 导出贝聊账户每日汇总excel文件 * */ @RequestMapping("exportBeiliaoExcel") @MenuResource("导出贝聊账户每日汇总") public void exportBeiliaoExcel(String summaryDateRange, HttpServletResponse response) { ParameterUtil.assertNotBlank(summaryDateRange, "日期范围不能为空"); OutputStream outputStream = null; try { Date[] summaryDateArr = RequestUtils.toDateArray(summaryDateRange); // 获取汇总日期范围 String deliveryDate = DateUtil.formatDate(summaryDateArr[0]) + "~" + DateUtil.formatDate(summaryDateArr[1]); String sheetName = "贝聊账户每日汇总表"; List<String> titleList = new ArrayList<String>(); titleList.add("汇总日期:" + deliveryDate); List<String> headers = genBeiliaoExcelHeader(); List<List<String>> dataList = genBeiliaoData(summaryDateArr[0], summaryDateArr[1]); Workbook wb = XlsFileWriter.write(sheetName, titleList, headers, dataList, false); String fileName = URLEncoder.encode("贝聊账户每日汇总表.xls", "UTF-8"); response.reset(); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); response.setContentType("application/ms-excel;charset=UTF-8"); outputStream = new BufferedOutputStream(response.getOutputStream()); wb.write(outputStream); outputStream.flush(); } catch (Exception e) { logger.error("导出贝聊账户每日汇总表excel文件出错", e); } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { logger.error("导出贝聊账户每日汇总表excel文件出错", e); } } } } /** * 组装导出贝聊账户每日汇总excel的头部信息 * * @return */ private List<String> genBeiliaoExcelHeader() { List<String> headers = new ArrayList<String>(); headers.add("汇总日期"); headers.add("期初余额"); headers.add("收入"); headers.add("提现"); headers.add("待审核提现"); headers.add("驳回提现"); headers.add("期末金额"); return headers; } /** * * 组装导出贝聊账户每日汇总excel的内容 * * @return * @throws ParseException */ private List<List<String>> genBeiliaoData(Date startDate, Date endDate) throws ParseException { List<List<String>> dataList = new ArrayList<List<String>>(); BeiliaoAccountDailySummaryResponse response = summaryServiceProvider.queryBeiliaoDaily( startDate, endDate, 1, Integer.MAX_VALUE); List<BeiliaoAccountDailySummary> summaries = response.getSummaries(); for (BeiliaoAccountDailySummary record : summaries) { List<String> values = new ArrayList<String>(); values.add(DateUtil.formatDate(record.getSummaryDate())); values.add(String.valueOf(((double) record.getBeginningBalance() / 100))); values.add(String.valueOf(((double) record.getPayment() / 100))); values.add(String.valueOf(((double) record.getWithdraw() / 100))); values.add(String.valueOf(((double) record.getAuditWithdraw() / 100))); values.add(String.valueOf(((double) record.getRejectWithdraw() / 100))); values.add(String.valueOf(((double) record.getEndingBalance() / 100))); dataList.add(values); } return dataList; } }
package com.noteshare.project.model; import java.util.Date; import com.noteshare.common.utils.DateUtil; @SuppressWarnings("boxing") public class Project { private Integer id; private String projectname; private String author; private String projecttype; private String projectdesc; private Integer reading; private Integer good; private Integer bad; private Date createtime; private Date modifytime; private String publish; private String url; private String jsonurl; private String icon; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getProjectname() { return projectname; } public void setProjectname(String projectname) { this.projectname = projectname == null ? null : projectname.trim(); } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getProjecttype() { return projecttype; } public void setProjecttype(String projecttype) { this.projecttype = projecttype; } public String getProjectdesc() { return projectdesc; } public void setProjectdesc(String projectdesc) { this.projectdesc = projectdesc == null ? null : projectdesc.trim(); } public Integer getReading() { if (null == this.reading) return 0; return reading; } public void setReading(Integer reading) { this.reading = reading; } public Integer getGood() { if (null == this.good) return 0; return good; } public void setGood(Integer good) { this.good = good; } public Integer getBad() { if (null == this.bad) return 0; return bad; } public void setBad(Integer bad) { this.bad = bad; } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public Date getModifytime() { return modifytime; } public void setModifytime(Date modifytime) { this.modifytime = modifytime; } /** * @Title: getCreateTimeMMDD2 * @Description: 获取时间格式为月/日格式的创建时间 * @return String * @author xingchen * @date 2015-12-27 下午11:28:26 */ public String getCreatetimeMMDD2() { return DateUtil.getMMDD2(this.getCreatetime()); } public String getCreatetimeYYYYMMDD24HHMMSS() { return DateUtil.getYYYYMMDD24HHMMSS(this.getCreatetime()); } public String getPublish() { return publish; } public void setPublish(String publish) { if(null == publish){ publish = "N"; } this.publish = publish; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getJsonurl() { return jsonurl; } public void setJsonurl(String jsonurl) { this.jsonurl = jsonurl; } public String getIcon() { return icon; } public void setIcon(String icon) { if(null == icon){ icon = "N"; } this.icon = icon; } }
package com.tencent.mm.booter; import android.content.Context; import android.content.Intent; import com.tencent.mm.kernel.k; import com.tencent.mm.sdk.platformtools.e; import com.tencent.mm.sdk.platformtools.x; public final class b { public static boolean v(Context context, String str) { if ((!str.equals("noop") || (e.sFE && e.sFD)) && k.bA(context)) { x.i("MicroMsg.CoreServiceHelper", "fully exited, no need to start service"); return false; } x.d("MicroMsg.CoreServiceHelper", "ensure service running, type=" + str); Intent intent = new Intent(context, CoreService.class); intent.setFlags(268435456); intent.putExtra("START_TYPE", str); context.startService(intent); return true; } }
package java06; import java.util.Scanner; public class java0637 { public static void main(String[] args) { // TODO Auto-generated method stub java0637 a = new java0637(); Scanner scn = new Scanner(System.in); student johnson = a.new student("104001", "johnson"); student leo = a.new student("104002", "leo"); student jean = a.new student("104003", "jean"); student james = a.new student("104004", "james"); student jack = a.new student("104005", "jack"); System.out.print("input johnson's Chinese Score: \t English Score: \t Math Score: \n"); int chsc = scn.nextInt(); int ensc = scn.nextInt(); int masc = scn.nextInt(); johnson.setchinesescore(chsc); johnson.setenglishscore(ensc); johnson.setmathscore(masc); System.out.print("Name: \t Chinese Score: \t English Score: \t Math Score: \t Average:" + " \n johnson \t" + johnson.getchsc() + "\t \t \t" + johnson.getensc() + "\t \t \t" + johnson.getmasc() + "\t \t " + johnson.average(chsc, ensc, masc) + "\n"); System.out.print("input leo's Chinese Score: \t English Score: \t Math Score: \n"); chsc = scn.nextInt(); ensc = scn.nextInt(); masc = scn.nextInt(); leo.setchinesescore(chsc); leo.setenglishscore(ensc); leo.setmathscore(masc); System.out.print("Name: \t Chinese Score: \t English Score: \t Math Score: \t Average:" + " \n leo \t" + leo.getchsc() + "\t \t \t" + leo.getensc() + "\t \t \t" + leo.getmasc() + "\t \t " + leo.average(chsc, ensc, masc) + "\n"); System.out.print("input jean's Chinese Score: \t English Score: \t Math Score: \n"); chsc = scn.nextInt(); ensc = scn.nextInt(); masc = scn.nextInt(); jean.setchinesescore(chsc); jean.setenglishscore(ensc); jean.setmathscore(masc); System.out.print("Name: \t Chinese Score: \t English Score: \t Math Score: \t Average:" + " \n jean \t" + jean.getchsc() + "\t \t \t" + jean.getensc() + "\t \t \t" + jean.getmasc() + "\t \t " + jean.average(chsc, ensc, masc) + "\n"); System.out.print("input james's Chinese Score: \t English Score: \t Math Score: \n"); chsc = scn.nextInt(); ensc = scn.nextInt(); masc = scn.nextInt(); james.setchinesescore(chsc); james.setenglishscore(ensc); james.setmathscore(masc); System.out.print("Name: \t Chinese Score: \t English Score: \t Math Score: \t Average:" + " \n james \t" + james.getchsc() + "\t \t \t" + james.getensc() + "\t \t \t" + james.getmasc() + "\t \t " + james.average(chsc, ensc, masc) + "\n"); System.out.print("input jack's Chinese Score: \t English Score: \t Math Score: \n"); chsc = scn.nextInt(); ensc = scn.nextInt(); masc = scn.nextInt(); jack.setchinesescore(chsc); jack.setenglishscore(ensc); jack.setmathscore(masc); System.out.print("Name: \t Chinese Score: \t English Score: \t Math Score: \t Average:" + " \n jack \t" + jack.getchsc() + "\t \t \t" + jack.getensc() + "\t \t \t" + jack.getmasc() + "\t \t " + jack.average(chsc, ensc, masc) + "\n"); } class student { private String id; private String name; private float chinese; private float english; private float math; public student(String id1, String name1) { id = id1; name = name1; } public void setchinesescore(float chsc) { chinese = chsc; } public void setenglishscore(float ensc) { english = ensc; } public void setmathscore(float masc) { math = masc; } public float getchsc() { return chinese; } public float getensc() { return english; } public float getmasc() { return math; } public float average(float v1, float v2, float v3) { float result = 0.0f; result = (v1 + v2 + v3) / 3f; return result; } } }
package me.xuyupeng; /** * @author : xuyupeng * @date 2020/3/20 10:52 */ public class BcMain { public static void main(String[] args) { System.out.println("Hello World!"); } }
package exerc7; import java.io.File; import java.io.FilenameFilter; // classe usada para filtrar os objetos do tipo mp3 public class MyFilter implements FilenameFilter { private final String ext; MyFilter(String extension) { ext = extension; } @Override public boolean accept(File file, String name) { return file.isFile() && name.endsWith(ext); // a verificação de ser um arquivo é redundante porque na main chamamos // apenas para arquivos, mas é necessária para fazer overriding } }
package Store; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.io.File; import java.io.BufferedReader; import java.io.FileReader; public class patientInfo { private ArrayList<Map<String, String>> patientDB = new ArrayList<Map<String, String>>(); private int monitorPeriod; public void storeInfo(String s) throws Exception{ File dataFile = new File(s); BufferedReader reader = new BufferedReader(new FileReader(dataFile)); String name = ""; String patientPeriod = ""; String line = reader.readLine(); monitorPeriod = Integer.parseInt(line); line = reader.readLine(); while(line != null) { String[] info = line.split(" "); if (info[0].compareTo("patient") == 0) { name = info[1]; patientPeriod = info[2]; } else { Map<String, String> entry = new HashMap<String, String>(); entry.put("patientName", name); entry.put("patientPeriod", patientPeriod); entry.put("sensorCategory", info[0]); entry.put("sensorName", info[1]); entry.put("dataset", info[2]); entry.put("lowerBound", info[3]); entry.put("upperBound", info[4]); patientDB.add(entry); } line = reader.readLine(); } reader.close(); } public int getMonitorPeriod() { return monitorPeriod; } public ArrayList<Map<String, String>> getInfo() { return patientDB; } }
package com.tencent.mm.plugin.sns.ui; import android.graphics.BitmapFactory.Options; import android.view.ViewTreeObserver.OnPreDrawListener; import com.tencent.mm.plugin.sns.model.af; import com.tencent.mm.plugin.sns.model.g; import com.tencent.mm.sdk.platformtools.c; class SnsBrowseUI$3 implements OnPreDrawListener { final /* synthetic */ SnsBrowseUI nTH; SnsBrowseUI$3(SnsBrowseUI snsBrowseUI) { this.nTH = snsBrowseUI; } public final boolean onPreDraw() { this.nTH.nTu.getViewTreeObserver().removeOnPreDrawListener(this); SnsBrowseUI.a(this.nTH, this.nTH.nTu.getWidth()); SnsBrowseUI.b(this.nTH, this.nTH.nTu.getHeight()); SnsBrowseUI.c(this.nTH, this.nTH.nTu.getWidth()); SnsBrowseUI.d(this.nTH, this.nTH.nTu.getHeight()); af.byl(); String C = g.C(this.nTH.nTu.getCntMedia()); if (C != null) { Options VZ = c.VZ(C); SnsBrowseUI.d(this.nTH, (int) (((float) VZ.outHeight) * (((float) SnsBrowseUI.b(this.nTH)) / ((float) VZ.outWidth)))); if (SnsBrowseUI.c(this.nTH) > this.nTH.nTu.getHeight()) { SnsBrowseUI.d(this.nTH, this.nTH.nTu.getHeight()); } } this.nTH.hDi.fh(SnsBrowseUI.b(this.nTH), SnsBrowseUI.c(this.nTH)); this.nTH.hDi.a(this.nTH.nTu, SnsBrowseUI.d(this.nTH), null); this.nTH.bCZ(); return true; } }
package com.tencent.mm.ui.tools; import android.content.Context; import android.text.Editable; import android.text.TextWatcher; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.tools.ActionBarSearchView.b; import com.tencent.mm.ui.tools.a.c; import com.tencent.mm.ui.y; import com.tencent.mm.w.a.g; import com.tencent.mm.w.a.h; import java.util.ArrayList; public class SearchViewNotRealTimeHelper extends LinearLayout implements e { private EditText jzo; public Button uBI; private a uBJ; private View uvc; private ImageButton uve; private com.tencent.mm.ui.tools.ActionBarSearchView.a uvj; public interface a { void ava(); boolean pj(String str); void wY(String str); } public SearchViewNotRealTimeHelper(Context context, AttributeSet attributeSet) { super(context, attributeSet); init(); } public SearchViewNotRealTimeHelper(Context context) { super(context); init(); } private void init() { y.gq(getContext()).inflate(h.actionbar_searchview_with_searchbtn, this, true); this.jzo = (EditText) findViewById(g.edittext); this.uve = (ImageButton) findViewById(g.status_btn); this.uvc = findViewById(g.ab_back_container); this.uBI = (Button) findViewById(g.button); this.uBI.setEnabled(false); this.jzo.addTextChangedListener(new TextWatcher() { public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public final void afterTextChanged(Editable editable) { if (editable == null || editable.length() <= 0) { SearchViewNotRealTimeHelper.this.uve.setVisibility(8); SearchViewNotRealTimeHelper.this.uBI.setEnabled(false); return; } SearchViewNotRealTimeHelper.this.uve.setVisibility(0); SearchViewNotRealTimeHelper.this.uBI.setEnabled(true); } }); this.jzo.setOnEditorActionListener(new OnEditorActionListener() { public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (3 != i || SearchViewNotRealTimeHelper.this.uBJ == null) { return false; } return SearchViewNotRealTimeHelper.this.uBJ.pj(SearchViewNotRealTimeHelper.this.getSearchContent()); } }); c.d(this.jzo).Gi(100).a(null); this.uve.setOnClickListener(new OnClickListener() { public final void onClick(View view) { SearchViewNotRealTimeHelper.this.jzo.setText(""); if (SearchViewNotRealTimeHelper.this.uBJ != null) { SearchViewNotRealTimeHelper.this.uBJ.ava(); } } }); this.uvc.setOnClickListener(new OnClickListener() { public final void onClick(View view) { x.v("MicroMsg.SearchViewNotRealTimeHelper", "home btn click"); if (SearchViewNotRealTimeHelper.this.uvj != null) { SearchViewNotRealTimeHelper.this.uvj.bae(); } } }); this.uBI.setOnClickListener(new OnClickListener() { public final void onClick(View view) { if (SearchViewNotRealTimeHelper.this.uBJ != null) { SearchViewNotRealTimeHelper.this.uBJ.wY(SearchViewNotRealTimeHelper.this.getSearchContent()); } } }); } public void setSearchBtnText(CharSequence charSequence) { this.uBI.setText(charSequence); } public void setSearchContent(CharSequence charSequence) { this.jzo.setText(""); this.jzo.append(charSequence); } public void setSearchColor(int i) { this.jzo.setTextColor(i); } public void setSearchHint(CharSequence charSequence) { this.jzo.setHint(charSequence); } public void setSearchHintColor(int i) { this.jzo.setHintTextColor(i); } public void setSearchIcon(int i) { this.jzo.setCompoundDrawablesWithIntrinsicBounds(i, 0, 0, 0); } public void setShowBackIcon(boolean z) { if (this.uvc == null) { return; } if (z) { this.uvc.setVisibility(0); } else { this.uvc.setVisibility(8); } } public final void mt(boolean z) { this.jzo.setText(""); } public final void czt() { this.jzo.clearFocus(); } public void setCallBack(a aVar) { this.uBJ = aVar; } public String getSearchContent() { Editable editableText = this.jzo.getEditableText(); return editableText == null ? "" : editableText.toString(); } public void setSearchContent(String str) { setSearchContent((CharSequence) str); } public void setHint(CharSequence charSequence) { setSearchHint(charSequence); } public void setCallBack(b bVar) { } public final void ms(boolean z) { } public void setEditTextEnabled(boolean z) { } public void setStatusBtnEnabled(boolean z) { } public void setOnEditorActionListener(OnEditorActionListener onEditorActionListener) { } public void setNotRealCallBack(a aVar) { this.uBJ = aVar; } public boolean hasFocus() { return false; } public final boolean czv() { return false; } public final boolean czu() { return false; } public void setBackClickCallback(com.tencent.mm.ui.tools.ActionBarSearchView.a aVar) { this.uvj = aVar; } public void setKeywords(ArrayList<String> arrayList) { } public void setAutoMatchKeywords(boolean z) { } public void setSearchTipIcon(int i) { } public void setFocusChangeListener(OnFocusChangeListener onFocusChangeListener) { } public void setSelectedTag(String str) { } }
package enum1.ex; public interface Coach { public String getdetailsWorkout(); }
package net.minecraft.entity.ai; import javax.annotation.Nullable; import net.minecraft.entity.EntityCreature; import net.minecraft.util.math.Vec3d; public class EntityAIWanderAvoidWater extends EntityAIWander { protected final float field_190865_h; public EntityAIWanderAvoidWater(EntityCreature p_i47301_1_, double p_i47301_2_) { this(p_i47301_1_, p_i47301_2_, 0.001F); } public EntityAIWanderAvoidWater(EntityCreature p_i47302_1_, double p_i47302_2_, float p_i47302_4_) { super(p_i47302_1_, p_i47302_2_); this.field_190865_h = p_i47302_4_; } @Nullable protected Vec3d func_190864_f() { if (this.entity.isInWater()) { Vec3d vec3d = RandomPositionGenerator.func_191377_b(this.entity, 15, 7); return (vec3d == null) ? super.func_190864_f() : vec3d; } return (this.entity.getRNG().nextFloat() >= this.field_190865_h) ? RandomPositionGenerator.func_191377_b(this.entity, 10, 7) : super.func_190864_f(); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\entity\ai\EntityAIWanderAvoidWater.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
/* * [y] hybris Platform * * Copyright (c) 2000-2016 SAP SE * All rights reserved. * * This software is the confidential and proprietary information of SAP * Hybris ("Confidential Information"). You shall not disclose such * Confidential Information and shall use it only in accordance with the * terms of the license agreement you entered into with SAP Hybris. */ package com.cnk.travelogix.sapintegrations.converters.populator; import de.hybris.platform.converters.Populator; import de.hybris.platform.servicelayer.dto.converter.ConversionException; import java.util.List; import com.cnk.travelogix.commons.error.Error; import com.cnk.travelogix.custom.chargeable.itemcharging.AccountOperation; import com.cnk.travelogix.custom.chargeable.itemcharging.AccountReference; import com.cnk.travelogix.custom.chargeable.itemcharging.AccountReferenceType; import com.cnk.travelogix.custom.chargeable.itemcharging.Amount; import com.cnk.travelogix.custom.chargeable.itemcharging.AmountAssignment; import com.cnk.travelogix.custom.chargeable.itemcharging.ChargeableItemChargeResponse; import com.cnk.travelogix.custom.chargeable.itemcharging.ChargingFailure; import com.cnk.travelogix.custom.chargeable.itemcharging.ChargingResult; import com.cnk.travelogix.custom.chargeable.itemcharging.ResponseStatus; import com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargeableItemChargeResponseData; import com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.FailureCause; /** * */ public class DefaultItemChargingResponsePopulator extends AbstractErrorResponsePopulator implements Populator<ChargeableItemChargeResponse, ChargeableItemChargeResponseData> { @Override public void populate(final ChargeableItemChargeResponse source, final ChargeableItemChargeResponseData target) throws ConversionException { final ResponseStatus status = source.getStatus(); if (status != null) { target.setStatus( com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ResponseStatus.fromValue(status.value())); } target.setMessage(source.getMessage()); final ChargingResult chargingResult = source.getResult(); final ChargingFailure error = source.getError(); final com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargingFailure failure = new com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargingFailure(); failure.setMessage(error.getMessage()); if (error.getCategory() != null) { failure.setCategory(com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.FailureCategory .valueOf(error.getCategory().value().toUpperCase())); } final List<com.cnk.travelogix.custom.chargeable.itemcharging.FailureCause> causedby = error.getCausedBy(); if (ResponseStatus.ERROR.equals(target.getStatus())) { for (final com.cnk.travelogix.custom.chargeable.itemcharging.FailureCause cause : causedby) { final FailureCause fc = new FailureCause(); fc.setCode(cause.getCode()); fc.setMessage(cause.getMessage()); fc.setModule(cause.getModule()); failure.getCausedBy().add(fc); final com.cnk.travelogix.commons.error.Error customError = new Error(); customError.setCode(String.valueOf(cause.getCode())); target.getErrors().add(populateError(customError)); } } target.setError(failure); target.setResult(populateChargingResult(chargingResult)); } private com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargingResult populateChargingResult( final ChargingResult source) { final com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargingResult result = new com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargingResult(); final List<AccountOperation> accountOperation = source.getAccountOperation(); for (final AccountOperation accOps : accountOperation) { final com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountOperation ops = new com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountOperation(); final Amount amount = accOps.getAmount(); ops.setAmount(populateAmount(amount)); final List<AmountAssignment> amountAssignment = accOps.getAmountAssignment(); for (final AmountAssignment accAssing : amountAssignment) { final com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AmountAssignment amountAssignment2 = new com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AmountAssignment(); final AccountReference accountReference = accAssing.getAccountReference(); final com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountReference ref = new com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountReference(); ref.setId(accountReference.getId()); final AccountReferenceType type = accountReference.getType(); if (type != null) { ref.setType(com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountReferenceType .valueOf(type.value().toUpperCase())); } amountAssignment2.setAccountReference(ref); amountAssignment2.setChargedItemKey(accAssing.getChargedItemKey()); ops.getAmountAssignment().add(amountAssignment2); } final AccountReference mainAccountReference = accOps.getMainAccountReference(); final com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountReference mainAcRef = new com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountReference(); mainAcRef.setId(mainAccountReference.getId()); if (mainAccountReference.getType() != null) { mainAcRef.setType(com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.AccountReferenceType .valueOf(mainAccountReference.getType().value().toUpperCase())); } ops.setMainAccountReference(mainAcRef); ops.setKey(accOps.getKey()); ops.setNetAmount(populateAmount(accOps.getNetAmount())); ops.setTaxAmount(populateAmount(accOps.getTaxAmount())); result.getAccountOperation().add(ops); } return result; } private com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.Amount populateAmount(final Amount amount) { final com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.Amount amt = new com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.Amount(); amt.setCurrencyCode(amount.getCurrencyCode()); amt.setValue(amount.getValue()); return amt; } }
package com.tencent.mm.g.a; import android.app.Activity; public final class fo$a { public String bNY; public int bNZ; public int bOa = 0; public Activity bOb; }
package com.jim.multipos.ui.start_configuration.di; import android.content.Context; import android.support.v7.app.AppCompatActivity; import com.jim.multipos.R; import com.jim.multipos.config.scope.PerActivity; import com.jim.multipos.config.scope.PerFragment; import com.jim.multipos.core.BaseActivityModule; import com.jim.multipos.ui.settings.SettingsActivity; import com.jim.multipos.ui.settings.SettingsPresenter; import com.jim.multipos.ui.settings.SettingsPresenterImpl; import com.jim.multipos.ui.settings.SettingsView; import com.jim.multipos.ui.settings.accounts.AccountSettingsFragment; import com.jim.multipos.ui.settings.accounts.AccountSettingsFragmentModule; import com.jim.multipos.ui.settings.choice_panel.ChoicePanelFragment; import com.jim.multipos.ui.settings.choice_panel.ChoicePanelFragmentModule; import com.jim.multipos.ui.settings.common.CommonConfigFragment; import com.jim.multipos.ui.settings.common.CommonConfigFragmentModule; import com.jim.multipos.ui.settings.connection.SettingsConnection; import com.jim.multipos.ui.settings.currency.CurrencySettingsFragment; import com.jim.multipos.ui.settings.currency.CurrencySettingsFragmentModule; import com.jim.multipos.ui.settings.payment_type.PaymentTypeSettingsFragment; import com.jim.multipos.ui.settings.payment_type.PaymentTypeSettingsFragmentModule; import com.jim.multipos.ui.settings.pos_details.PosDetailsFragment; import com.jim.multipos.ui.settings.pos_details.PosDetailsFragmentModule; import com.jim.multipos.ui.settings.print.PrintFragment; import com.jim.multipos.ui.settings.print.PrintFragmentModule; import com.jim.multipos.ui.settings.security.SecurityFragment; import com.jim.multipos.ui.settings.security.SecurityFragmentModule; import com.jim.multipos.ui.start_configuration.StartConfigurationActivity; import com.jim.multipos.ui.start_configuration.StartConfigurationPresenter; import com.jim.multipos.ui.start_configuration.StartConfigurationPresenterImpl; import com.jim.multipos.ui.start_configuration.StartConfigurationView; import com.jim.multipos.ui.start_configuration.account.AccountFragment; import com.jim.multipos.ui.start_configuration.account.AccountFragmentModule; import com.jim.multipos.ui.start_configuration.basics.BasicsFragment; import com.jim.multipos.ui.start_configuration.basics.BasicsFragmentModule; import com.jim.multipos.ui.start_configuration.connection.StartConfigurationConnection; import com.jim.multipos.ui.start_configuration.currency.CurrencyFragment; import com.jim.multipos.ui.start_configuration.currency.CurrencyFragmentModule; import com.jim.multipos.ui.start_configuration.payment_type.PaymentTypeFragment; import com.jim.multipos.ui.start_configuration.payment_type.PaymentTypeFragmentModule; import com.jim.multipos.ui.start_configuration.pos_data.PosDataFragment; import com.jim.multipos.ui.start_configuration.pos_data.PosDataFragmentModule; import com.jim.multipos.ui.start_configuration.selection_panel.SelectionPanelFragment; import com.jim.multipos.ui.start_configuration.selection_panel.SelectionPanelFragmentModule; import javax.inject.Named; import dagger.Binds; import dagger.Module; import dagger.Provides; import dagger.android.ContributesAndroidInjector; /** * Created by Portable-Acer on 28.10.2017. */ @Module(includes = BaseActivityModule.class) public abstract class StartConfigurationActivityModule { @Binds @PerActivity abstract AppCompatActivity provideStartConfigurationActivity(StartConfigurationActivity activity); @Binds @PerActivity abstract StartConfigurationView provideStartConfigurationView(StartConfigurationActivity activity); @Binds @PerActivity abstract StartConfigurationPresenter provideStartConfigurationPresenter(StartConfigurationPresenterImpl presenter); @PerFragment @ContributesAndroidInjector(modules = SelectionPanelFragmentModule.class) abstract SelectionPanelFragment provideSelectionPanelFragment(); @PerFragment @ContributesAndroidInjector(modules = PosDataFragmentModule.class) abstract PosDataFragment providePosDataFragment(); @PerFragment @ContributesAndroidInjector(modules = CurrencyFragmentModule.class) abstract CurrencyFragment provideCurrencyFragment(); @PerFragment @ContributesAndroidInjector(modules = AccountFragmentModule.class) abstract AccountFragment provideAccountFragment(); @PerFragment @ContributesAndroidInjector(modules = PaymentTypeFragmentModule.class) abstract PaymentTypeFragment providePaymentTypeFragment(); @PerFragment @ContributesAndroidInjector(modules = BasicsFragmentModule.class) abstract BasicsFragment provideBasicsFragment(); @PerActivity @Provides static StartConfigurationConnection provideStartConfigurationConnection(Context context) { return new StartConfigurationConnection(context); } @PerActivity @Provides @Named(value = "currency_name") static String[] provideCurrencyName(Context context) { return context.getResources().getStringArray(R.array.currency_title); } @PerActivity @Provides @Named(value = "currency_abbr") static String[] provideCurrencyAbbr(Context context) { return context.getResources().getStringArray(R.array.currency_abbrs); } @PerActivity @Provides @Named(value = "till") static String provideAccountName(Context context) { return context.getResources().getString(R.string.till); } @PerActivity @Provides @Named(value = "cash") static String providePaymentTypeName(Context context) { return context.getResources().getString(R.string.cash); } @PerActivity @Provides @Named(value = "debt") static String provideDebtName(Context context) { return context.getResources().getString(R.string.debt_report); } @PerActivity @Provides @Named(value = "debtAccount") static String provideDebtAccountName(Context context) { return context.getResources().getString(R.string.debt_report); } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package legaltime.modelsafe; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import legaltime.AppPrefs; import legaltime.cache.ClientBillRateCache; import legaltime.cache.ClientCache; import legaltime.cache.UserInfoCache; import legaltime.model.ClientBillRateManager; import legaltime.model.ClientManager; import legaltime.model.Manager; import legaltime.model.UserInfoManager; import legaltime.model.exception.DAOException; /** * * @author bmartin */ public class PersistanceManager { static PersistanceManager instance=null; ClientCache clientCache; ClientManager clientManager; UserInfoCache userInfoCache; UserInfoManager userInfoManager; ClientBillRateCache clientBillRateCache; ClientBillRateManager clientBillRateManager; AppPrefs appPrefs; EasyLog easyLog; protected PersistanceManager(){ Manager manager = Manager.getInstance(); easyLog = EasyLog.getInstance(); appPrefs =AppPrefs.getInstance(); manager.setJdbcUrl(appPrefs.getJDBC_URL()); manager.setJdbcUsername(appPrefs.getValue(AppPrefs.JDBC_USER)); manager.setJdbcPassword(appPrefs.getValue(AppPrefs.JDBC_PASSWD)); try { if (!manager.getConnection().isClosed()) { manager.getConnection().close(); } } catch (SQLException ex) { Logger.getLogger(PersistanceManager.class.getName()).log(Level.SEVERE, null, ex); } clientCache = ClientCache.getInstance(); clientManager = ClientManager.getInstance(); userInfoCache = UserInfoCache.getInstance(); userInfoManager = UserInfoManager.getInstance(); clientBillRateCache =ClientBillRateCache.getInstance(); clientBillRateManager = ClientBillRateManager.getInstance(); } public static PersistanceManager getInstance(){ if (instance == null){ instance = new PersistanceManager(); } return instance; } public void loadCache(){ loadClientBillRateCache(); loadClientCache(); loadUserInfoCache(); } public DatabaseResult loadClientCache(){ DatabaseResult result = DatabaseResult.PendingAction; try { clientCache.setList(clientManager.loadAll("order by last_name")); result =DatabaseResult.Success; } catch (DAOException ex) { easyLog.addEntry(EasyLog.SEVERE, "Load Client Cache Failed", this.getClass().getName(),ex); result = DatabaseResult.SelectFailed; } return result; } public DatabaseResult loadUserInfoCache(){ DatabaseResult result = DatabaseResult.PendingAction; try { userInfoCache.setList(userInfoManager.loadAll()); result =DatabaseResult.Success; } catch (DAOException ex) { easyLog.addEntry(EasyLog.SEVERE, "Load UserInfo Cache Failed", this.getClass().getName(),ex); result = DatabaseResult.SelectFailed; } return result; } public DatabaseResult loadClientBillRateCache(){ DatabaseResult result = DatabaseResult.PendingAction; try { clientBillRateCache.setList(clientBillRateManager.loadAll()); result =DatabaseResult.Success; } catch (DAOException ex) { Logger.getLogger(PersistanceManager.class.getName()).log(Level.SEVERE, null, ex); result = DatabaseResult.SelectFailed; easyLog.addEntry(EasyLog.INFO, "Error loading client bill rate cache" , getClass().getName(), ex); } return result; } }
package net.minecraft.client.model; public class TextureOffset { public final int textureOffsetX; public final int textureOffsetY; public TextureOffset(int textureOffsetXIn, int textureOffsetYIn) { this.textureOffsetX = textureOffsetXIn; this.textureOffsetY = textureOffsetYIn; } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\client\model\TextureOffset.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package android.support.v4.app; import android.graphics.Bitmap; import android.os.Build.VERSION; import android.os.Bundle; import android.support.v4.app.z.g; public final class z$f implements g { private int pN = 0; public a pS; private Bitmap px; public final z$d a(z$d z_d) { if (VERSION.SDK_INT >= 21) { Bundle bundle = new Bundle(); if (this.px != null) { bundle.putParcelable("large_icon", this.px); } if (this.pN != 0) { bundle.putInt("app_color", this.pN); } if (this.pS != null) { bundle.putBundle("car_conversation", z.by().a(this.pS)); } if (z_d.mExtras == null) { z_d.mExtras = new Bundle(); } z_d.mExtras.putBundle("android.car.EXTENSIONS", bundle); } return z_d; } }
/** * Created by 1 on 11.07.2017. */ public class Shell { public static int[] doShell(int[] array) { int indMid = 1; while (indMid < array.length / 3) { indMid = indMid * 3 + 1; } while (indMid > 0){ for (int i = 0; i < array.length - indMid; i++) { int j = i; while (j >= 0 && array[j] > array[j + 1]){ int temp = array[j]; array[j] = array[j + 1]; array[j + 1] = temp; j--; } } indMid = indMid / 3; } return array; } }
package com.boot.spring.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.boot.spring.model.Project; import com.boot.spring.model.Task; import com.boot.spring.repository.ProjectsRepository; import com.boot.spring.repository.TasksRepository; @Service public class ProjectsService { @Autowired private ProjectsRepository projects; @Autowired private TasksRepository tasks; public Project save(Project project) { return projects.save(project); } public List<Project> find() { return projects.findAll(); } public Project findOne(String id) { return projects.findOne(id); } public List<Task> findProjectTasks(String projectId) { return tasks.findByProjectId(projectId); } }
package stream.csv; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException ; import java.util.LinkedList; import java.util.List; public class ReadCsv { public static void main (String[] args) throws IOException { FileReader input = new FileReader ("D:\\TalentSprintJava-master\\Workspace\\talentSprinEclipse\\csvfiles\\EmployeeDetails.csv"); BufferedReader reader = new BufferedReader(input); FileWriter w = new FileWriter("copyEmployee_details.csv"); String line = reader.readLine(); line = reader.readLine(); List<Employee> employeeDatabase = new LinkedList<Employee>(); while (line != null) { line = line.concat("\n"); w.write(line); System.out.println(line); line = reader.readLine(); } input.close(); reader.close(); w.close(); } }
package bean.healthy; import java.util.List; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Autowired; public class HealthyDAO { @Autowired private SqlSessionTemplate mybatis; public void insertBoard(HealthyDTO dto) { mybatis.insert("healthy.insertBoard", dto); } public void updateBoard(HealthyDTO dto) { mybatis.update("healthy.updateBoard", dto); } public void deleteBoard(HealthyDTO dto) { mybatis.delete("healthy.deleteBoard", dto); } public HealthyDTO getBoard(HealthyDTO dto) { return (HealthyDTO) mybatis.selectOne("healthy.getBoard", dto); } public List<HealthyDTO> getBoardList(HealthyDTO dto) { return mybatis.selectList("healthy.getBoardList", dto); } }
/** * @file: com.innovail.trouble.screen - GameScreen.java * @date: May 9, 2012 * @author: bweber */ package com.innovail.trouble.screen; import java.util.Iterator; import java.util.List; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.GL11; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Intersector; import com.badlogic.gdx.math.Matrix4; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.collision.Ray; import com.innovail.trouble.core.ApplicationSettings; import com.innovail.trouble.core.GameSettings; import com.innovail.trouble.core.TroubleApplicationState; import com.innovail.trouble.core.TroubleGame; import com.innovail.trouble.core.gameelement.Player; import com.innovail.trouble.core.gameelement.Spot; import com.innovail.trouble.core.gameelement.Token; import com.innovail.trouble.graphics.GameColor; import com.innovail.trouble.graphics.GameMesh; import com.innovail.trouble.graphics.GamePerspectiveCamera; import com.innovail.trouble.uicomponent.BackgroundImage; import com.innovail.trouble.utils.GameInputAdapter; import com.innovail.trouble.utils.MathUtils; /** * */ public class GameScreen extends TroubleScreen { private static final String TAG = "GameScreen"; private static final String AppPartName = TroubleApplicationState.GAME; private static final float [] NoMat = { 0.0f, 0.0f, 0.0f, 1.0f }; private static final int FrontAndOrBack = GL11.GL_FRONT_AND_BACK; private static final float _UP = 1.0f; private static final float _DOWN = -1.0f; private final SpriteBatch _spriteBatch; private final BackgroundImage _backgroundImage; private final GameMesh _playerMesh; private final List <GameMesh> _playerNumberMesh; private final GameMesh _backArrowMesh; private final GameMesh _spotMesh; private final GameMesh _diceMesh; private final GameMesh _tokenMesh; private final Matrix4 _viewMatrix; private final Matrix4 _transformMatrix; private Ray _touchRay; private static final float _RotationAngleIncrease = 0.25f; private static final Vector3 _CameraLookAtPoint = new Vector3 (0.0f, 0.0f, 2.5f); private static final Vector3 _CameraPos = new Vector3 (0.0f, 7.0f, 11.0f); private final Vector2 _cameraRotationAngleIncrease; private static final float [] _OverlayMaxAngles = { 66.0f, 90.0f }; private static final float [] _OverlayMaxAlphas = { 0.0f, 1.0f }; private static final float _AlphaValueIncrease = 0.5f; private static final float _OverlayMaxVisibleTime = 0.7f; private final float _overlayRadius; private Vector3 _overlayPosition; private Vector2 _overlayAngle; private boolean _showOverlay = false; private float _overlayAdditionalAngle = _OverlayMaxAngles[_MIN]; private float _overlayAlpha = _OverlayMaxAlphas[_MAX]; private float _overlayVisibleTime = 0.0f; private float _rollAudibleTime = 0.0f; private static final float _SelectedYOffset = 0.05f; private static final float [] _WobbleMaxAngles = { -0.5f, 0.5f }; private final Vector2 _wobbleAngle; private final Vector2 _wobbleDirection; private final TroubleGame _myGame; private List <Spot> _spots; private Iterator <Spot> _spot; private List <Player> _players; private Iterator <Player> _player; public GameScreen () { super (); _spriteBatch = new SpriteBatch (); _backgroundImage = ApplicationSettings.getInstance ().getBackgroundImage (AppPartName); _backArrowMesh = ApplicationSettings.getInstance ().getBackArrow (); _playerMesh = GameSettings.getInstance ().getPlayerMesh (); _playerNumberMesh = GameSettings.getInstance ().getPlayerNumbers (); _diceMesh = GameSettings.getInstance ().getDiceMesh (); _viewMatrix = new Matrix4 (); _transformMatrix = new Matrix4 (); final float aspectRatio = (float) Gdx.graphics.getWidth () / (float) Gdx.graphics.getHeight (); _camera = new GamePerspectiveCamera (67, 2f * aspectRatio, 2f); ((GamePerspectiveCamera) _camera).lookAtPosition (_CameraLookAtPoint, _CameraPos); _cameraRotationAngleIncrease = new Vector2 (); _cameraRotationAngleIncrease.set (Vector2.Zero); _overlayRadius = ((GamePerspectiveCamera) _camera).getOverlayRadius (); _overlayAngle = ((GamePerspectiveCamera) _camera).getOverlayAngle (); _overlayPosition = MathUtils.getSpherePosition (_CameraLookAtPoint, _overlayAngle, _overlayRadius); /* Need to do this early to be able to calculate the right bounding box. */ _backArrowMesh.getMesh (); calculateOverlayBoundingBox (); _wobbleAngle = new Vector2 (Vector2.Zero); _wobbleDirection = new Vector2 (_UP, _DOWN); _myGame = new TroubleGame (); _spotMesh = GameSettings.getInstance ().getSpotMesh (); _tokenMesh = GameSettings.getInstance ().getTokenMesh (); /* Let's do this early so that the resources are available */ _diceMesh.getSound (); _tokenMesh.getSound (); } private void calculateOverlayBoundingBox () { _overlayAngle = ((GamePerspectiveCamera) _camera).getOverlayAngle (); _overlayPosition = MathUtils.getSpherePosition (_CameraLookAtPoint, _overlayAngle, _overlayRadius); final Matrix4 transform = new Matrix4 (); final Matrix4 tmp = new Matrix4 (); transform.setToTranslation (_overlayPosition.x, _overlayPosition.y, _overlayPosition.z); tmp.setToRotation (0.0f, 1.0f, 0.0f, _overlayAngle.x); transform.mul (tmp); tmp.setToRotation (1.0f, 0.0f, 0.0f, _overlayAngle.y + _overlayAdditionalAngle); transform.mul (tmp); _backArrowMesh.transformBoundingBox (transform); if (_DEBUG) { Gdx.app.log (TAG, "Retrieved angles: " + _overlayAngle.toString ()); Gdx.app.log (TAG, "New Overlay position: " + _overlayPosition.toString ()); } } private void calculateWobbleAngles (final float delta) { if (_wobbleDirection.x == _UP) { if (_wobbleAngle.x < _WobbleMaxAngles[_MAX]) { _wobbleAngle.x += 2 * delta; } else { _wobbleDirection.x = _DOWN; } } else { if (_wobbleAngle.x > _WobbleMaxAngles[_MIN]) { _wobbleAngle.x -= 2 * delta; } else { _wobbleDirection.x = _UP; } } if (_wobbleDirection.y == _UP) { if (_wobbleAngle.y < _WobbleMaxAngles[_MAX]) { _wobbleAngle.y += 2 * delta; } else { _wobbleDirection.y = _DOWN; } } else { if (_wobbleAngle.y > _WobbleMaxAngles[_MIN]) { _wobbleAngle.y -= 2 * delta; } else { _wobbleDirection.y = _UP; } } } /* * (non-Javadoc) * @see com.innovail.trouble.screen.TroubleScreen#createInputProcessor() */ @Override public void createInputProcessor () { Gdx.input.setInputProcessor (new GameInputAdapter () { private static final float _MaxAxisIncrease = 10.0f; private final Vector2 _axisDiff = new Vector2 (); /* * (non-Javadoc) * @see com.badlogic.gdx.InputProcessor#keyDown(int) */ @Override public boolean keyDown (final int keycode) { boolean rv = true; switch (keycode) { case Input.Keys.SPACE: Gdx.app.log (TAG, "keyDown() - SPACE"); break; case Input.Keys.R: if (_filling) { Gdx.app.log (TAG, "keyDown() - wireframing"); Gdx.gl11.glPolygonMode (GL10.GL_FRONT_AND_BACK, GL10.GL_LINE); _filling = false; } else { Gdx.app.log (TAG, "keyDown() - Filling"); Gdx.gl11.glPolygonMode (GL10.GL_FRONT_AND_BACK, GL10.GL_FILL); _filling = true; } break; case Input.Keys.UP: Gdx.app.log (TAG, "keyDown() - UP"); _cameraRotationAngleIncrease.y--; // Y Gdx.app.log (TAG, "keyDown() - -Y angle: " + _cameraRotationAngleIncrease.y); break; case Input.Keys.DOWN: Gdx.app.log (TAG, "keyDown() - DOWN"); _cameraRotationAngleIncrease.y++; // Y Gdx.app.log (TAG, "keyDown() - +Y angle: " + _cameraRotationAngleIncrease.y); break; case Input.Keys.LEFT: Gdx.app.log (TAG, "keyDown() - LEFT"); _cameraRotationAngleIncrease.x--; // X Gdx.app.log (TAG, "keyDown() - -X angle: " + _cameraRotationAngleIncrease.x); break; case Input.Keys.RIGHT: Gdx.app.log (TAG, "keyDown() - RIGHT"); _cameraRotationAngleIncrease.x++; // X Gdx.app.log (TAG, "keyDown() - +X angle: " + _cameraRotationAngleIncrease.x); break; default: rv = false; } ((GamePerspectiveCamera) _camera).rotateAroundLookAtPoint (_cameraRotationAngleIncrease); _cameraRotationAngleIncrease.set (Vector2.Zero); return rv; } /* * (non-Javadoc) * @see com.badlogic.gdx.InputProcessor#touchDragged(int, int, int) */ @Override public boolean touchDragged (final int x, final int y, final int pointer) { if (_dragEvents >= MIN_NUMBER_OF_DRAGS) { if (_DEBUG) { Gdx.app.log (TAG, "Touch dragged position - x: " + x + " - y: " + y); } _axisDiff.set (_lastPosition); _axisDiff.sub (x, y); if ((_axisDiff.x < _MaxAxisIncrease) && (_axisDiff.y != _MaxAxisIncrease)) { _cameraRotationAngleIncrease.x = _axisDiff.x * _RotationAngleIncrease; _cameraRotationAngleIncrease.y = _axisDiff.y * _RotationAngleIncrease; } ((GamePerspectiveCamera) _camera).rotateAroundLookAtPoint (_cameraRotationAngleIncrease); _cameraRotationAngleIncrease.set (Vector2.Zero); calculateOverlayBoundingBox (); } return super.touchDragged (x, y, pointer); } /* * (non-Javadoc) * @see com.badlogic.gdx.InputProcessor#touchUp(int, int, int, int) */ @Override public boolean touchUp (final int x, final int y, final int pointer, final int button) { if (!_isDragged || (_dragEvents < MIN_NUMBER_OF_DRAGS)) { _touchRay = _camera.getPickRay (x, y, 0, 0, Gdx.graphics.getWidth (), Gdx.graphics.getHeight ()); if (_DEBUG) { Gdx.app.log (TAG, "Touch position - x: " + x + " - y: " + y); Gdx.app.log (TAG, "Touch ray - " + _touchRay.toString ()); } if (_touchRay != null) { if (_DEBUG) { Gdx.app.log (TAG, "currentEntry BB - " + _diceMesh.getBoundingBox ().toString ()); } if (Intersector.intersectRayBoundsFast (_touchRay, _backArrowMesh.getBoundingBox ())) { _currentState = TroubleApplicationState.MAIN_MENU; } else if (Intersector.intersectRayBoundsFast (_touchRay, _diceMesh.getBoundingBox ())) { if (_myGame.canRollDice ()) { _diceMesh.getSound ().play (); _myGame.rollDice (); } } else if (!_myGame.getAvailableTokens ().isEmpty ()) { final Iterator <Token> tokens = _myGame.getAvailableTokens ().iterator (); while (tokens.hasNext ()) { final Token token = tokens.next (); final Spot currentSpot = token.getPosition (); final Matrix4 transform = new Matrix4 (); transform.setToTranslation (currentSpot.getPosition ().x, currentSpot.getPosition ().y, currentSpot.getPosition ().z); _tokenMesh.transformBoundingBox (transform); if (Intersector.intersectRayBoundsFast (_touchRay, _tokenMesh.getBoundingBox ())) { _myGame.selectToken (token); break; } } } else { if (_showOverlay) { _showOverlay = false; } else { _showOverlay = true; } } } } return super.touchUp (x, y, pointer, button); } }); } @Override public void init (final boolean full) { Gdx.app.log (TAG, "GameScreen()"); super.init (full); if (full) { if (_myGame.isFinished ()) { _myGame.resetGame (); } _myGame.createGame (); _spots = _myGame.getField ().getSpots (); _players = _myGame.getPlayers (); } } @Override protected void render (final GL11 gl, final float delta) { calculateWobbleAngles (delta); renderOverlay (gl); renderField (gl); renderTokens (gl); renderAnnouncement (gl, delta); gl.glEnable (GL10.GL_TEXTURE_2D); renderDice (gl); gl.glDisable (GL10.GL_TEXTURE_2D); gl.glDisable (GL10.GL_CULL_FACE); gl.glDisable (GL10.GL_DEPTH_TEST); } private void renderAnnouncement (final GL11 gl, final float delta) { final Color currentColor = _myGame.getActivePlayer ().getColor (); subRenderOverlay (gl, _playerMesh, currentColor); subRenderOverlay (gl, _playerNumberMesh.get (_myGame.getActivePlayer ().getNumber ()), currentColor); if (_overlayVisibleTime > _OverlayMaxVisibleTime) { if (_overlayAlpha > _OverlayMaxAlphas[_MIN]) { _overlayAlpha -= _AlphaValueIncrease * delta; } } } @Override protected void renderBackground (final float width, final float height) { _viewMatrix.setToOrtho2D (0.0f, 0.0f, width, height); _spriteBatch.setProjectionMatrix (_viewMatrix); _spriteBatch.setTransformMatrix (_transformMatrix); _spriteBatch.begin (); _spriteBatch.disableBlending (); _spriteBatch.setColor (Color.WHITE); _spriteBatch.draw ((Texture) _backgroundImage.getImageObject (), 0, 0, width, height, 0, 0, _backgroundImage.getWidth (), _backgroundImage.getHeight (), false, false); _spriteBatch.end (); } private void renderDice (final GL11 gl) { final Matrix4 transform = new Matrix4 (); final Matrix4 tmp = new Matrix4 (); _diceMesh.getTexture ().bind (); gl.glPushMatrix (); gl.glTranslatef (0.0f, 0.0f, 7.0f); transform.setToTranslation (0.0f, 0.0f, 7.0f); if (_myGame != null) { final float [] angle = _myGame.getDice ().getFaceAngle (0); gl.glRotatef (angle[0], angle[1], angle[2], angle[3]); tmp.setToRotation (angle[1], angle[2], angle[3], angle[0]); transform.mul (tmp); } final Color currentColor = Color.WHITE; gl.glColor4f (currentColor.r, currentColor.g, currentColor.b, currentColor.a); _diceMesh.getMesh ().render (); gl.glPopMatrix (); _diceMesh.transformBoundingBox (transform); } private void renderField (final GL11 gl) { if (_myGame != null) { _spot = _spots.iterator (); while (_spot.hasNext ()) { final Spot currentSpot = _spot.next (); final Vector3 currentPosition = new Vector3 (currentSpot.getPosition ()); gl.glPushMatrix (); final Color currentColor = currentSpot.getColor (); if ((currentSpot.getPotentialToken () != null) || ((currentSpot.getCurrentToken () != null) && (currentSpot.getCurrentToken ().isSelected () && currentSpot.getCurrentToken ().isMoving ()))) { currentPosition.y += _SelectedYOffset; final float [] matEmission = { currentColor.r == 1.0f ? currentColor.r : 0.3f, currentColor.g == 1.0f ? currentColor.g : 0.3f, currentColor.b == 1.0f ? currentColor.b : 0.3f, 1.0f }; gl.glMaterialfv (FrontAndOrBack, GL10.GL_EMISSION, matEmission, 0); gl.glRotatef (_wobbleAngle.x, 1.0f, 0.0f, 0.0f); gl.glRotatef (_wobbleAngle.y, 0.0f, 0.0f, 1.0f); } else { gl.glMaterialfv (FrontAndOrBack, GL10.GL_EMISSION, NoMat, 0); } gl.glTranslatef (currentPosition.x, currentPosition.y, currentPosition.z); gl.glColor4f (currentColor.r, currentColor.g, currentColor.b, currentColor.a); _spotMesh.getMesh ().render (); gl.glPopMatrix (); } } } private void renderOverlay (final GL11 gl) { gl.glPushMatrix (); gl.glTranslatef (_overlayPosition.x, _overlayPosition.y, _overlayPosition.z); gl.glRotatef (_overlayAngle.x, 0.0f, 1.0f, 0.0f); gl.glRotatef (_overlayAngle.y + _overlayAdditionalAngle, 1.0f, 0.0f, 0.0f); final Color currentColor = _backArrowMesh.getColor (); gl.glColor4f (currentColor.r, currentColor.g, currentColor.b, currentColor.a); _backArrowMesh.getMesh ().render (); gl.glPopMatrix (); if (_DEBUG) { Gdx.gl11.glPolygonMode (GL10.GL_FRONT_AND_BACK, GL10.GL_LINE); gl.glPushMatrix (); _backArrowMesh.getBBMesh ().render (GL10.GL_TRIANGLES); gl.glPopMatrix (); Gdx.gl11.glPolygonMode (GL10.GL_FRONT_AND_BACK, GL10.GL_FILL); } if (_showOverlay && (_overlayAdditionalAngle < _OverlayMaxAngles[_MAX])) { _overlayAdditionalAngle += 3 * _RotationAngleIncrease; if (_overlayAdditionalAngle > _OverlayMaxAngles[_MAX]) { _overlayAdditionalAngle = _OverlayMaxAngles[_MAX]; } calculateOverlayBoundingBox (); } else if (!_showOverlay && (_overlayAdditionalAngle > _OverlayMaxAngles[_MIN])) { _overlayAdditionalAngle -= 3 * _RotationAngleIncrease; if (_overlayAdditionalAngle < _OverlayMaxAngles[_MIN]) { _overlayAdditionalAngle = _OverlayMaxAngles[_MIN]; } calculateOverlayBoundingBox (); } } private void renderTokens (final GL11 gl) { if (_myGame != null) { _player = _players.iterator (); while (_player.hasNext ()) { final Player currentPlayer = _player.next (); final List <Token> tokens = currentPlayer.getTokens (); final Iterator <Token> token = tokens.iterator (); while (token.hasNext ()) { final Token currentToken = token.next (); gl.glPushMatrix (); if (!currentToken.isMoving ()) { final Spot currentSpot = currentToken.getPosition (); final Vector3 currentPosition = new Vector3 (currentSpot.getPosition ()); if (currentToken.isSelected ()) { currentPosition.y += _SelectedYOffset; } gl.glTranslatef (currentPosition.x, currentPosition.y, currentPosition.z); } else { final Vector3 currentPosition = currentToken.getCurrentMovePosition (); currentPosition.y += _SelectedYOffset; gl.glTranslatef (currentPosition.x, currentPosition.y, currentPosition.z); } final Color currentColor = currentPlayer.getColor (); gl.glColor4f (currentColor.r, currentColor.g, currentColor.b, currentColor.a); if (currentToken.isSelected ()) { gl.glRotatef (_wobbleAngle.x, 1.0f, 0.0f, 0.0f); gl.glRotatef (_wobbleAngle.y, 0.0f, 0.0f, 1.0f); final float [] matEmission = { currentColor.r == 1.0f ? currentColor.r : 0.3f, currentColor.g == 1.0f ? currentColor.g : 0.3f, currentColor.b == 1.0f ? currentColor.b : 0.3f, 1.0f }; gl.glMaterialfv (FrontAndOrBack, GL10.GL_EMISSION, matEmission, 0); } else { gl.glMaterialfv (FrontAndOrBack, GL10.GL_EMISSION, NoMat, 0); } _tokenMesh.getMesh ().render (); gl.glPopMatrix (); } } } } @Override protected void setLighting (final GL11 gl) { final Color lightColor = GameColor.getColor ("dark_grey"); final float [] specular0 = { lightColor.r, lightColor.g, lightColor.b, lightColor.a }; final float [] position1 = { 10.0f, 5.0f, 1.0f, 1.0f }; final float [] ambient1 = { 1.0f, 1.0f, 1.0f, 1.0f }; final float [] diffuse1 = { 1.0f, 1.0f, 1.0f, 1.0f }; final float [] specular1 = { 1.0f, 1.0f, 1.0f, 1.0f }; gl.glLightfv (GL10.GL_LIGHT0, GL10.GL_SPECULAR, specular0, 0); gl.glLightfv (GL10.GL_LIGHT1, GL10.GL_AMBIENT, ambient1, 0); gl.glLightfv (GL10.GL_LIGHT1, GL10.GL_DIFFUSE, diffuse1, 0); gl.glLightfv (GL10.GL_LIGHT1, GL10.GL_SPECULAR, specular1, 0); gl.glLightfv (GL10.GL_LIGHT1, GL10.GL_POSITION, position1, 0); gl.glEnable (GL10.GL_COLOR_MATERIAL); gl.glEnable (GL10.GL_LIGHTING); gl.glEnable (GL10.GL_LIGHT0); gl.glEnable (GL10.GL_LIGHT1); } @Override public void setOwnState () { _currentState = TroubleApplicationState.GAME; } private void subRenderOverlay (final GL11 gl, final GameMesh mesh, final Color color) { gl.glPushMatrix (); gl.glTranslatef (_overlayPosition.x, _overlayPosition.y, _overlayPosition.z); gl.glRotatef (_overlayAngle.x, 0.0f, 1.0f, 0.0f); gl.glRotatef (_overlayAngle.y - _OverlayMaxAngles[_MAX], 1.0f, 0.0f, 0.0f); gl.glColor4f (color.r, color.g, color.b, _overlayAlpha); gl.glEnable (GL10.GL_BLEND); gl.glDepthMask (false); if (_overlayAlpha == _OverlayMaxAlphas[_MAX]) { gl.glBlendFunc (GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); } else { gl.glBlendFunc (GL10.GL_SRC_ALPHA, GL10.GL_ONE); } mesh.getMesh ().render (); gl.glDepthMask (true); gl.glDisable (GL10.GL_BLEND); gl.glPopMatrix (); } @Override protected void update (final float delta) { _myGame.updateGame (); if (_myGame.isFinished ()) { _currentState = TroubleApplicationState.MAIN_MENU; } if (_myGame.playerChanged ()) { _overlayVisibleTime = 0.0f; _overlayAlpha = _OverlayMaxAlphas[_MAX]; } else { _overlayVisibleTime += delta; } if (_myGame.tokenStartedMoving ()) { _tokenMesh.getSound ().play (); } if (_myGame.canRollDice () && !_myGame.getActivePlayer ().isHuman ()) { _diceMesh.getSound ().play (); _myGame.rollDice (); } if (_myGame.isRolling ()) { if (_rollAudibleTime > _OverlayMaxVisibleTime) { _rollAudibleTime = 0.0f; _myGame.doneRolling (); } else { _rollAudibleTime += delta; } } } }
package ioio.examples.hello; import ioio.lib.api.DigitalOutput; import ioio.lib.api.IOIO; import ioio.lib.api.PwmOutput; import ioio.lib.api.exception.ConnectionLostException; /** * this class handles API for the DFROBOT DRI10002 Motor controller * controlling the robot's robotic arm * * @author Doron */ public class BigMotorDriver implements Stoppable{ private DigitalOutput m1,m2; private PwmOutput e1,e2; /** * this constructor takes the assigned pins numbers and opens the the IOIO pins for writing * @param ioio the IOIO occurrence received from the IOIO activity * @param m1_pin motor 1 direction control signal pin number * @param e1_pin motor 1 speed control signal * @param m2_pin motor 2 direction control signal pin number * @param e2_pin motor 2 speed control signal * @throws ConnectionLostException */ public BigMotorDriver(IOIO ioio, int m1_pin, int e1_pin, int m2_pin, int e2_pin) throws ConnectionLostException { this.m1 = ioio.openDigitalOutput(m1_pin,false); this.e1 = ioio.openPwmOutput(e1_pin, 100); this.m2 = ioio.openDigitalOutput(m2_pin,false); this.e2 = ioio.openPwmOutput(e2_pin, 100); e1.setDutyCycle((float)0.0); e2.setDutyCycle((float)0.0); } /** * this method simply writes a given boolean value to the direction digital signal * @param b the boolean value to be written * @throws ConnectionLostException */ public void writeTo_m1(boolean b) throws ConnectionLostException { m1.write(b); } /** * this method simply writes a given boolean value to the direction digital signal * @param b the boolean value to be written * @throws ConnectionLostException */ public void writeTo_m2(boolean b) throws ConnectionLostException { m2.write(b); } /** * this method simply writes a given boolean value to both motors direction digital signal * @param direction the boolean value to be written * @throws ConnectionLostException */ public void turnBothMotors(boolean direction) throws ConnectionLostException{ m1.write(direction); m2.write(!direction); } /** * this method simply writes a given boolean value to both motors direction digital signal * @param direction the boolean value to be written * @throws ConnectionLostException */ public void turnBothMotorsOposite(boolean direction) throws ConnectionLostException{ m1.write(direction); m2.write(direction); } /** * closes all opened connections */ public void close() { this.e1.close(); this.e2.close(); this.m1.close(); this.m2.close(); } /** * writes a new speed to the motor's speed control output * @param speed the new speed to be updated * @throws ConnectionLostException */ public void setMotorA_speed(float speed) throws ConnectionLostException { e1.setDutyCycle(speed); } /** * writes a new speed to the motor's speed control output * @param speed the new speed to be updated * @throws ConnectionLostException */ public void setMotorB_speed(float speed) throws ConnectionLostException { e2.setDutyCycle(speed); } @Override public void stop() throws ConnectionLostException { this.setMotorA_speed(0); this.setMotorB_speed(0); } }
package com.example.zeky.arsamandi; import android.app.Activity; import android.app.NotificationManager; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v4.app.NotificationCompat; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import Model.Mensaje; import Model.Usuario; import controller.UserController; public class NewMessage extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_message); Toolbar tb = (Toolbar)findViewById(R.id.toolbarNewMessage); tb.setTitleTextColor(Color.BLACK); setSupportActionBar(tb); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_send, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()){ case R.id.menuSend: sendMessage(); break; case android.R.id.home: finish(); break; } return super.onOptionsItemSelected(item); } public void sendMessage(){ Usuario user = (Usuario) getIntent().getExtras().get("usuario"); Mensaje m = new Mensaje(); String userDestino = ((EditText)findViewById(R.id.etUsuarioDestino)).getText().toString(); String asunto = ((EditText)findViewById(R.id.etAsunto)).getText().toString(); String mensaje = ((EditText) findViewById(R.id.etMensaje)).getText().toString(); m.setLeido(false); m.setMatter(asunto); m.setReceivingUser(userDestino); m.setMessage(mensaje); m.setSendingUser(user.getUsuario()); user.getMensajes().add(m); UserController uc = new UserController(); uc.saveUser(user); setResult(Activity.RESULT_OK, getIntent().putExtra("usuario", user)); //Envío de notificación generarNotificacion(user.getUsuario()); finish(); } public void generarNotificacion(String user){ NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_mail_outline_black_24dp) .setContentTitle("Nuevo Mensaje") .setContentText("Has recibido una nuevo mensaje de " + user + "!!!"); NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(1, builder.build()); } }
package com.fleet.quartz.service.impl; import com.fleet.quartz.dao.QuartzJobDao; import com.fleet.quartz.entity.QuartzJob; import com.fleet.quartz.enums.Enabled; import com.fleet.quartz.service.QuartzJobService; import com.fleet.quartz.util.QuartzUtil; import org.quartz.CronTrigger; import org.quartz.Scheduler; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author April Han */ @Service public class QuartzJobServiceImpl implements QuartzJobService { @Resource private QuartzJobDao quartzJobDao; @Resource private Scheduler scheduler; /** * 项目启动时,初始化定时器 */ @PostConstruct public void init() { Map<String, Object> map = new HashMap<>(); map.put("enabled", Enabled.YES); List<QuartzJob> list = quartzJobDao.list(map); if (list != null) { for (QuartzJob job : list) { CronTrigger trigger = QuartzUtil.getCronTrigger(scheduler, job.getId()); // 如果不存在,则创建 if (trigger == null) { QuartzUtil.insert(scheduler, job); } else { QuartzUtil.update(scheduler, job); } } } } @Override public Boolean insert(QuartzJob quartzJob) { if (quartzJobDao.insert(quartzJob) == 0) { return false; } QuartzUtil.insert(scheduler, quartzJob); return true; } @Override public Boolean delete(QuartzJob quartzJob) { List<Integer> idList = quartzJobDao.idList(quartzJob); if (idList != null && idList.size() != 0) { if (quartzJobDao.delete(quartzJob) == 0) { return false; } for (Integer id : idList) { QuartzUtil.delete(scheduler, id); } } return true; } @Override public Boolean deletes(Integer[] ids) { if (quartzJobDao.deletes(ids) == 0) { return false; } for (Integer id : ids) { QuartzUtil.delete(scheduler, id); } return true; } @Override public Boolean update(QuartzJob quartzJob) { if (quartzJobDao.update(quartzJob) == 0) { return false; } QuartzUtil.update(scheduler, quartzJob); return true; } @Override public QuartzJob get(Integer id) { QuartzJob quartzJob = new QuartzJob(); quartzJob.setId(id); return get(quartzJob); } @Override public QuartzJob get(QuartzJob quartzJob) { return quartzJobDao.get(quartzJob); } @Override public List<QuartzJob> list(Map<String, Object> map) { return quartzJobDao.list(map); } @Override public void run(Integer id) { QuartzUtil.run(scheduler, id); } @Override public void pause(Integer id) { QuartzUtil.pause(scheduler, id); } @Override public void resume(Integer id) { QuartzUtil.resume(scheduler, id); } }
class UnittestFailure extends RuntimeException { }
package main; public class Pilon extends Construible { }
package com.shahedrahim.yardsignposter.data; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.PrimaryKey; @Entity(tableName = "location_table") public class Location { private static final String TAG = "Location"; @PrimaryKey(autoGenerate = true) private int id; private double latitude; private double longitude; //multi-line private String address; //city private String locality; //county @ColumnInfo(name="sub_admin_area") private String subAdminArea; //state @ColumnInfo(name="admin_area") private String adminArea; //zip code @ColumnInfo(name="postal_code") private String postalCode; private String country; //phone number private String phone; //landmark @ColumnInfo(name = "feature_name") private String featureName; private String premises; private String url; //Constructor public Location( double latitude, double longitude, String address, String locality, String adminArea, String postalCode) { this.latitude = latitude; this.longitude = longitude; this.address = address; this.locality = locality; this.adminArea = adminArea; this.postalCode = postalCode; } // // Constructor // public Location( // double latitude, // double longitude, // String address, // String locality, // String subAdminArea, // String adminArea, // String postalCode, // String country, // String phone, // String featureName, // String premises, // String url) { // this(latitude, longitude, address, locality, adminArea, postalCode); // this.subAdminArea = subAdminArea; // this.country = country; // this.phone = phone; // this.featureName = featureName; // this.premises = premises; // this.url = url; // } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getLocality() { return locality; } public void setLocality(String locality) { this.locality = locality; } public String getSubAdminArea() { return subAdminArea; } public void setSubAdminArea(String subAdminArea) { this.subAdminArea = subAdminArea; } public String getAdminArea() { return adminArea; } public void setAdminArea(String adminArea) { this.adminArea = adminArea; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getFeatureName() { return featureName; } public void setFeatureName(String featureName) { this.featureName = featureName; } public String getPremises() { return premises; } public void setPremises(String premises) { this.premises = premises; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } else { Location objLocation = (Location) obj; if (id!=objLocation.id) return false; if (latitude != objLocation.latitude) return false; if (longitude != objLocation.longitude) return false; if (!((address==null && objLocation.address==null) || (address.equals(objLocation.address)))) return false; if (!((locality==null && objLocation.locality==null) || (locality.equals(objLocation.locality)))) return false; if (!((subAdminArea==null && objLocation.subAdminArea==null) || (subAdminArea.equals(objLocation.subAdminArea)))) return false; if (!((adminArea==null && objLocation.adminArea==null) || (adminArea.equals(objLocation.adminArea)))) return false; if (!((postalCode==null && objLocation.postalCode==null) || (postalCode.equals(objLocation.postalCode)))) return false; if (!((country==null && objLocation.country==null) || (country.equals(objLocation.country)))) return false; if (!((phone==null && objLocation.phone==null) || (phone.equals(objLocation.phone)))) return false; if (!((featureName==null && objLocation.featureName==null) || (featureName.equals(objLocation.featureName)))) return false; if (!((premises==null && objLocation.premises==null) || (premises.equals(objLocation.premises)))) return false; if (!((url==null && objLocation.url==null) || (url.equals(objLocation.url)))) return false; return true; } } }
package edu.imtl.BlueKare.Activity.MainPackage; import android.Manifest; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.ArrayMap; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; import com.allattentionhere.fabulousfilter.AAH_FabulousFragment; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.firebase.firestore.GeoPoint; import java.util.ArrayList; import java.util.List; import java.util.Map; import edu.imtl.BlueKare.Activity.MyMainFabFragment; import edu.imtl.BlueKare.Activity.Search.Trees; import edu.imtl.BlueKare.Activity.Search.TreesData; import edu.imtl.BlueKare.R; import edu.imtl.BlueKare.Utils.TreesContent; import static android.location.LocationManager.GPS_PROVIDER; import static android.location.LocationManager.NETWORK_PROVIDER; //import static edu.skku.treearium.Activity.MainActivity.thesize; //import static edu.skku.treearium.Activity.MainActivity.geolist; //implements OnMarkerClickListener //GoogleMap.OnMarkerClickListener,<--이거 오류나면 imp해야함 /******************* Map View class ***********************/ public class fragment2_test extends Fragment implements AAH_FabulousFragment.Callbacks, AAH_FabulousFragment.AnimationListener { GoogleMap map; int len; int il = 0; int l; int Mlens = 0; int ff = 0; View finalview; DrawerLayout drawerLayout2; public static List<GeoPoint> geolist = new ArrayList<>(); public static List<Double> dbhlist = new ArrayList<>(); public static List<String> namelist = new ArrayList<>(); public static List<String> splist = new ArrayList<>(); public static List<Double> helist = new ArrayList<>(); List<Marker> mMarkerList = new ArrayList<>(); List<LatLng> mPointList = new ArrayList<>(); static Marker currentMarker = null; MyMainFabFragment dialogFrag; public static TreesData tData; public static List<Trees> tList = new ArrayList<>(); public static ArrayMap<String, List<String>> applied_filters = new ArrayMap<>(); //make map public OnMapReadyCallback callback = new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { map = googleMap; //selectM(); map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { @Override public View getInfoWindow(Marker marker) { return null; } @Override public View getInfoContents(Marker marker) { View infoWindow = getLayoutInflater().inflate(R.layout.custom_info_contents, null); TextView title = ((TextView) infoWindow.findViewById(R.id.title)); title.setText(marker.getTitle()); TextView snippet = ((TextView) infoWindow.findViewById(R.id.snippet)); //TextView snippet2=((TextView)infoWindow.findViewById(R.id.snippet2)); snippet.setText(marker.getSnippet()); //snippet2.setText(marker.getSnippet()); return null; } }); //Run when marker is clicked //Information is uploaded to the bottom sheet map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { marker.getPosition(); System.out.println("marker postion" + marker.getPosition()); System.out.println("get snippet" + marker.getSnippet()); int i; for (i = 0; i < tList.size() - 1; i++) { if (marker.getSnippet().equals(tList.get(i).getTime())) { System.out.println("이힝" + i); System.out.println("이건 몇번째 i일까" + i); break; } } BottomSheetDialog bottomSheetDialog = new BottomSheetDialog( getActivity(), R.style.BottomSheetDialogTheme ); View bottomSheetView = LayoutInflater.from(getContext()).inflate( R.layout.bottom_sheet_background, (LinearLayout) getView().findViewById(R.id.bottomSheetContainer2)); EditText sp1 = bottomSheetView.findViewById(R.id.setsp1); sp1.setText(tList.get(i).getTreeSpecies()); EditText he1 = bottomSheetView.findViewById(R.id.sethe2); String tmp = String.format("%.2f", Float.parseFloat(tList.get(i).getTreeHeight())); he1.setText(tmp + " m"); EditText dbh1 = bottomSheetView.findViewById(R.id.setdbh3); tmp = String.format("%.2f", Float.parseFloat(tList.get(i).getTreeDbh())); dbh1.setText(tmp + " cm"); EditText ung1 = bottomSheetView.findViewById(R.id.setung4); ung1.setText("못구함"); EditText gung1 = bottomSheetView.findViewById(R.id.setgung5); if (Double.parseDouble(tList.get(i).getTreeDbh()) < 6) { gung1.setText("치수"); } else if (Double.parseDouble(tList.get(i).getTreeDbh()) < 16 && Double.parseDouble(tList.get(i).getTreeDbh()) > 6) { gung1.setText("소경목"); } else if (Double.parseDouble(tList.get(i).getTreeDbh()) > 16 && Double.parseDouble(tList.get(i).getTreeDbh()) < 29) { gung1.setText("중경목"); } else if (Double.parseDouble(tList.get(i).getTreeDbh()) >= 29) { gung1.setText("대경목"); } bottomSheetView.findViewById(R.id.xbtn).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(getContext(),"정보 창을 닫습니다",Toast.LENGTH_SHORT).show(); bottomSheetDialog.dismiss(); } }); bottomSheetDialog.setContentView(bottomSheetView); bottomSheetDialog.show(); return true; } }); } }; private void startLocationService() { Context context = this.getContext(); LocationManager manager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); try { int chk1 = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION); int chk2 = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION); Location location = null; if (chk1 == PackageManager.PERMISSION_GRANTED && chk2 == PackageManager.PERMISSION_GRANTED) { location = manager.getLastKnownLocation(GPS_PROVIDER); } else { return; } if (location != null) { double latitude = location.getLatitude(); double longitude = location.getLongitude(); } GPSListener gpsListener = new GPSListener(); // long minTime = 1000; float minDistance = 0; manager.requestLocationUpdates(GPS_PROVIDER, minTime, minDistance, gpsListener); manager.requestLocationUpdates(NETWORK_PROVIDER, minTime, minDistance, gpsListener); } catch (Exception e) { e.printStackTrace(); } } //GPS 사용 class GPSListener implements LocationListener { @Override public void onLocationChanged(Location location) { map.clear(); Double latitude = location.getLatitude(); Double longitude = location.getLongitude(); LatLng onLop = new LatLng(latitude, longitude); String message = "내 위치 -> Latitude : " + onLop.latitude + "\nLongitude:" + onLop.longitude; Log.d("Map", message); showCurrentLocation(onLop.latitude, onLop.longitude); maketree(); if (il == 0) { //LatLng point=new LatLng(geolist.get(len-1).getLatitude(),geolist.get(len-1).getLongitude()); if (tList.size() != 0) { LatLng point = new LatLng(tList.get(tList.size() - 1).getTreeLocation().getLatitude(), tList.get(tList.size() - 1).getTreeLocation().getLongitude()); CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(point, 17); map.moveCamera(cameraUpdate); il = il + 1; } } } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } } //Tree Information Class for CO2 Calculator class WoodForCo2 { public boolean isShrub; //교목 or 관목 public boolean isneedleLeaf; //활엽수 or 침엽수 public int number; public float averDBH; public boolean isShrub() { return isShrub; } public void setShrub(boolean shrub) { isShrub = shrub; } public boolean isIsneedleLeaf() { return isneedleLeaf; } public void setIsneedleLeaf(boolean isneedleLeaf) { this.isneedleLeaf = isneedleLeaf; } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } public float getAverDBH() { return averDBH; } public void setAverDBH(float averDBH) { this.averDBH = averDBH; } public WoodForCo2(boolean isShrub, boolean isneedleLeaf, int number, float averDBH) { this.isShrub = isShrub; this.isneedleLeaf = isneedleLeaf; this.number = number; this.averDBH = averDBH; } } //Calculate the tree's board feet using dbh and height public int boardFeetCalculator(float dbh, float height) { float in = (float) (dbh * 0.393701);//cm to inch float ft = (float) (height * 3.28084); //meter to ft int temp = (int) (in / 2); int indbh = temp * 2; // 2, 4, 6, 8 ~~~ System.out.println("dbh = " + dbh); System.out.println("temp = " + temp); System.out.println("indbh = " + indbh); temp = (int) ft / 8; int ftheight = temp;// 내가 쓸 값의 두배로 나옴. 인덱스로 쓸거라 상관 없음 /*********** * 12 inch -> 30cm * 42 inch -> 106cm * 1/2 -> 8ft * 1 -> 16ft * 16ft -> 4.8 m */ //[dbh][height] //12~42 inch //1/2 16-Foot Logs -> 4 16-Foot Logs int treeTableDoyle[][] = { {20, 30, 40, 50, 60}, {30, 50, 70, 80, 90, 100}, {40, 70, 100, 120, 140, 160, 180, 190}, {60, 100, 130, 160, 200, 220, 240, 260}, {80, 130, 180, 220, 260, 330, 320, 360}, {100, 170, 230, 280, 340, 380, 420, 460}, {130, 220, 290, 360, 430, 490, 540, 600}, {160, 260, 360, 440, 520, 590, 660, 740}, {190, 320, 430, 520, 620, 710, 800, 880}, {230, 380, 510, 630, 740, 840, 940, 1040}, {270, 440, 590, 730, 860, 990, 1120, 1220}, {300, 510, 680, 850, 1000, 1140, 1300, 1440}, {350, 580, 780, 970, 1140, 1310, 1480, 1640}, {390, 660, 880, 1100, 1290, 1480, 1680, 1860}, {430, 740, 990, 1230, 1450, 1660, 1880, 2080}, {470, 830, 1100, 1370, 1620, 1860, 2100, 2320} }; try { int a = (indbh - 12) / 2; int b = ftheight / 2 - 1; System.out.println("a b is : " + a + " " + b); System.out.println("[0][2] imagine 40 : " + treeTableDoyle[0][2]); System.out.println("table : " + treeTableDoyle[a][b]); return treeTableDoyle[a][b]; } catch (Exception e) { System.out.println("out of Index! return 0"); return 0; } //Using Doyle rule. } //Statistics calculation and display. public void onstat(View view) { ImageButton imageButton2 = (ImageButton) view.findViewById(R.id.statisticalbtn); imageButton2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { v = view; BottomSheetDialog bottomSheetDialog = new BottomSheetDialog( getActivity(), R.style.BottomSheetDialogTheme ); View bottomSheetView = LayoutInflater.from(getContext()).inflate( R.layout.layout_bottom_map_show, (LinearLayout) getView().findViewById(R.id.bottomSheetContainer)); TextView mapbottomname = bottomSheetView.findViewById(R.id.mapbottomname);//지역 TextView mapbottomlocation = bottomSheetView.findViewById(R.id.mapbottomlocation);//위도경도 TextView mapbottomtreenum = bottomSheetView.findViewById(R.id.mapbottomtreenum);//몇 TextView mapbottomtreespec1 = bottomSheetView.findViewById(R.id.mapbottomtreespec1);//1순위 퍼센트 TextView mapbottomtreespec2 = bottomSheetView.findViewById(R.id.mapbottomtreespec2);//2순위 퍼센트 TextView mapbottomtreespec3 = bottomSheetView.findViewById(R.id.mapbottomtreespec3);//3순위 퍼센트 TextView mapbottomtreespecask1 = bottomSheetView.findViewById(R.id.mapbottomtreespecask1);//1순위 나무 이름 TextView mapbottomtreespecask2 = bottomSheetView.findViewById(R.id.mapbottomtreespecask2);//2순위 나무 이름 TextView mapbottomtreespecask3 = bottomSheetView.findViewById(R.id.mapbottomtreespecask3);//2순위 나무 이름 TextView absorption = bottomSheetView.findViewById(R.id.absorption); TextView storage = bottomSheetView.findViewById(R.id.storage); LinearLayout firsttree = bottomSheetView.findViewById(R.id.firsttree);//1순위 리스트 LinearLayout secondtree = bottomSheetView.findViewById(R.id.secondtree);//1순위 리스트 LinearLayout thirdtree = bottomSheetView.findViewById(R.id.thirdtree);//1순위 리스트 TextView boardFeet = bottomSheetView.findViewById(R.id.boardFeet); mapbottomtreenum.setText(tList.size() + "그루"); if (tList.size() != 0) { String[] items = new String[]{"은행", "이팝", "배롱", "무궁화", "느티", "벚", "단풍", "백합", "메타", "소나무"}; int[] values = new int[items.length]; for (int j = 0; j < tList.size(); j++) { for (int i = 0; i < items.length; i++) { if (tList.get(j).getTreeSpecies().equals(items[i])) { values[i]++; break; } } } //Count the top 3 trees int maxIndex = 0; for (int i = 0; i < items.length; i++) { if (values[maxIndex] < values[i]) { maxIndex = i; } } int numberOfTree = values[maxIndex]; float per = values[maxIndex] / (float) tList.size(); per = per * 100; mapbottomtreespec1.setText(numberOfTree + "그루" + "(" + (int) per + "%" + ")"); mapbottomtreespecask1.setText(items[maxIndex]); if ((int) per == 0) { firsttree.setVisibility(View.GONE); } int secondMaxIndex = 0; for (int i = 0; i < items.length; i++) { if (i != maxIndex) { if (values[secondMaxIndex] < values[i]) { secondMaxIndex = i; } } } numberOfTree = values[secondMaxIndex]; float secondper = values[secondMaxIndex] / (float) tList.size(); secondper = secondper * 100; mapbottomtreespec2.setText(numberOfTree + "그루" + "(" + (int) secondper + "%" + ")"); mapbottomtreespecask2.setText(items[secondMaxIndex]); if ((int) secondper == 0) { secondtree.setVisibility(View.GONE); } int thirdMaxIndex = 0; for (int i = 0; i < items.length; i++) { if (i != maxIndex && i != secondMaxIndex) { if (values[thirdMaxIndex] < values[i]) thirdMaxIndex = i; } } numberOfTree = values[thirdMaxIndex]; float thirdper = values[thirdMaxIndex] / (float) tList.size(); thirdper = thirdper * 100; mapbottomtreespecask3.setText(items[thirdMaxIndex]); mapbottomtreespec3.setText(numberOfTree + "그루" + "(" + (int) thirdper + "%" + ")"); if ((int) thirdper == 0) { thirdtree.setVisibility(View.GONE); } } else { mapbottomtreespec1.setText(""); mapbottomtreespec2.setText(""); mapbottomtreespec3.setText(""); } //Calculation of small hardwood, medium hardwood, and large hardwood if (tList.size() != 0) { int s = 0; int m = 0; int l = 0; for (int i = 0; i < tList.size(); i++) { if (Double.parseDouble(tList.get(i).getTreeDbh()) < 16) { s++; } else if (Double.parseDouble(tList.get(i).getTreeDbh()) < 29 && Double.parseDouble(tList.get(i).getTreeDbh()) > 16) { m++; } else { l++; } } TextView mapbottomtreedbh1 = bottomSheetView.findViewById(R.id.mapbottomtreedbh1);//소경목 6~16 TextView mapbottomtreedbh2 = bottomSheetView.findViewById(R.id.mapbottomtreedbh2);//중경목 16~29 TextView mapbottomtreedbh3 = bottomSheetView.findViewById(R.id.mapbottomtreedbh3);//대경목 29~ int tmp = (int) (((float) s / (float) tList.size()) * 100); mapbottomtreedbh1.setText(s + "그루" + "(" + tmp + "%" + ")"); tmp = (int) (((float) m / (float) tList.size()) * 100); mapbottomtreedbh2.setText(m + "그루" + "(" + tmp + "%" + ")"); tmp = (int) (((float) l / (float) tList.size()) * 100); mapbottomtreedbh3.setText(l + "그루" + "(" + tmp + "%" + ")"); } //Classification by tree height if (tList.size() != 0) { int sh = 0; int mh = 0; int lh = 0; for (int i = 0; i < tList.size(); i++) { if (Double.parseDouble(tList.get(i).getTreeHeight()) < 5) { sh++; } else if (Double.parseDouble(tList.get(i).getTreeHeight()) < 10 && Double.parseDouble(tList.get(i).getTreeHeight()) > 5) { mh++; } else { lh++; } } TextView mapbottomtreeh1 = bottomSheetView.findViewById(R.id.mapbottomtreeh1);//10m 이상 TextView mapbottomtreeh2 = bottomSheetView.findViewById(R.id.mapbottomtreeh2);//5m 이상 TextView mapbottomtreeh3 = bottomSheetView.findViewById(R.id.mapbottomtreeh3);//~5m int tmp = (int) (((float) lh / (float) tList.size()) * 100); mapbottomtreeh1.setText(lh + "그루" + "(" + tmp + "%" + ")"); tmp = (int) (((float) mh / (float) tList.size()) * 100); mapbottomtreeh2.setText(mh + "그루" + "(" + tmp + "%" + ")"); tmp = (int) (((float) sh / (float) tList.size()) * 100); mapbottomtreeh3.setText(sh + "그루" + "(" + tmp + "%" + ")"); /***********CO2 계산 **************/ //String[] items = new String[]{"은행", "이팝", "배롱", "무궁화", "느티", "벚", "단풍", "백합", "메타", "소나무"}; //8m 이상 자라는 나무 교목 WoodForCo2[] wood = new WoodForCo2[4]; wood[0] = new WoodForCo2(true, true, 0, 0);//관목 침엽수 wood[1] = new WoodForCo2(true, false, 0, 0);//관목 활엽수 : 무궁화 wood[2] = new WoodForCo2(false, true, 0, 0);//교목 침엽수 : 은행, 메타, 소나무 wood[3] = new WoodForCo2(false, false, 0, 0);//교목 활엽수 : 이팝, 배롱, 느티, 벚, 단풍, 백합 //교목 침엽수 : 은행, 메타, 소나무 //교목 활엽수 : 이팝, 배롱, 느티, 느티, 벚, 단풍, 백합 //관목 침엽수 //관목 활엽수 : 무궁화 for (int i = 0; i < tList.size(); i++) { String woodName = tList.get(i).getTreeSpecies(); System.out.println("나무 이름 : " + woodName); switch (woodName) { case "은행": case "메타": case "소나무": wood[2].number++; wood[2].averDBH = wood[2].averDBH + Float.parseFloat(tList.get(i).getTreeDbh()); break; case "이팝": case "배롱": case "느티": case "벚": case "단풍": case "백합": wood[3].number++; wood[3].averDBH = wood[3].averDBH + Float.parseFloat(tList.get(i).getTreeDbh()); break; case "무궁화": wood[1].number++; wood[1].averDBH = wood[1].averDBH + Float.parseFloat(tList.get(i).getTreeDbh()); default: System.out.println("그 외 나무"); } } for (int i = 0; i < 4; i++) { if (wood[i].number != 0) { wood[i].averDBH = wood[i].averDBH / (float) wood[i].number; } } float S = 0; float A = 0; float storageShrubNeedle = 0;//저장량 관목침엽수 float storageShrubBroad = 0;//저장량 관목활엽수 float storageTreeNeedle = 0;//저장량 교목침엽수 float storageTreeBroad = 0;//저장량 교목활엽수 float absorbShrubNeedle = 0;//흡수량 관목침엽수 float absorbShrubBroad = 0;//흡수량 관목활엽수 float absorbTreeNeedle = 0;//흡수량 교목침엽수 float absorbTreeBroad = 0;//흡수량 교목활엽수 if (wood[0].averDBH != 0) {//저장량 관목침엽수 storageShrubNeedle = (float) (-1.8276 + 2.1892 * Math.log(wood[0].averDBH)); storageShrubNeedle = (float) Math.pow(2, storageShrubNeedle); S = S + storageShrubNeedle * wood[0].number; } if (wood[1].averDBH != 0) {//저장량 관목활엽수 storageShrubBroad = (float) (-1.7148 + 1.9494 * Math.log(wood[1].averDBH)); storageShrubBroad = (float) Math.pow(2, storageShrubBroad); S = S + storageShrubBroad * wood[1].number; } if (wood[2].averDBH != 0)//교목 침엽수 : 은행, 메타, 소나무 { storageTreeNeedle = (float) (-1.047 + 2.1436 * Math.log(wood[2].averDBH)); storageTreeNeedle = (float) Math.pow(2, storageTreeNeedle); S = S + storageTreeNeedle * wood[2].number; } if (wood[3].averDBH != 0)//교목 활엽수 : 이팝, 배롱, 느티, 벚, 단풍, 백합 { storageTreeBroad = (float) (-1.3582 + 2.4595 * Math.log(wood[3].averDBH)); storageTreeBroad = (float) Math.pow(2, storageTreeBroad); S = S + storageTreeBroad * wood[3].number; } if (S < 1000) { storage.setText(String.format("%.0f", S) + " kgCO2"); } else if (S > 1000) { S = S / 1000.0f; storage.setText(String.format("%.1f", S) + " tCO2"); } if (wood[0].averDBH != 0) {//흡수량 관목침엽수 absorbShrubNeedle = (float) (-2.8689 + 1.3350 * Math.log(wood[0].averDBH)); absorbShrubNeedle = (float) Math.pow(2, absorbShrubNeedle); A = A + absorbShrubNeedle * wood[0].number; } if (wood[1].averDBH != 0) {//흡수량 관목활엽수 absorbShrubBroad = (float) (-3.4025 + 1.5823 * Math.log(wood[1].averDBH)); absorbShrubBroad = (float) Math.pow(2, absorbShrubBroad); A = A + absorbShrubBroad * wood[1].number; } if (wood[2].averDBH != 0)//교목 침엽수 : 은행, 메타, 소나무 { absorbTreeNeedle = (float) (-2.7714 + 0.9714 * wood[2].averDBH - 0.0225 * Math.pow(wood[2].averDBH, 2)); A = A + absorbTreeNeedle * wood[2].number; } if (wood[3].averDBH != 0)//교목 활엽수 : 이팝, 배롱, 느티, 벚, 단풍, 백합 { absorbTreeBroad = (float) (-4.2136 + 1.9006 * wood[3].averDBH - 0.0068 * Math.pow(wood[3].averDBH, 2)); A = A + absorbTreeBroad * wood[3].number; } if (A < 1000) absorption.setText(String.format("%.0f", A) + " kgCO2/y"); else if (A > 1000) { A = A / 1000.0f; absorption.setText(String.format("%.1f", A) + " tCO2/y"); } int numberOfLumber = 0; for (int i = 0; i < tList.size(); i++) { numberOfLumber = numberOfLumber + boardFeetCalculator(Float.parseFloat(tList.get(i).treeDbh), Float.parseFloat(tList.get(i).treeHeight)); } boardFeet.setText(numberOfLumber + " board feet"); } bottomSheetDialog.setContentView(bottomSheetView); bottomSheetDialog.show(); } }); } //Implement a button to automatically find my location public boolean btnbool(View view, LatLng curPoint) { ImageButton imageButton = (ImageButton) view.findViewById(R.id.mybtn); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view1) { view1 = view; map.animateCamera(CameraUpdateFactory.newLatLngZoom(curPoint, 17)); if (l == 1) { Toast.makeText(getContext(), "지금부터 내 위치 자동 찾기 기능을 종료합니다", Toast.LENGTH_LONG).show(); l = 0; } else if (l == 0) { Toast.makeText(getContext(), "지금부터 내 위치 자동 찾기를 시작합니다", Toast.LENGTH_LONG).show(); l = 1; } } }); if (l == 1) { //System.out.print("트루다"); return true; } else { //System.out.print("퍼스다"); return false; } } //Go to my current location private void showCurrentLocation(Double latitude, Double longitude) { LatLng curPoint = new LatLng(latitude, longitude); String markerTitle = "내위치"; String markerSnippet = "위치정보가 확인되었습니다." + latitude + "\n" + longitude; if (currentMarker != null) currentMarker.remove(); MarkerOptions markerOptions = new MarkerOptions(); markerOptions.position(curPoint); markerOptions.title(markerTitle); markerOptions.snippet(markerSnippet); markerOptions.draggable(false); markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); currentMarker = map.addMarker(markerOptions); l = 0; if (btnbool(finalview, curPoint)) { //System.out.print("bool실행"); CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(curPoint, 17); map.moveCamera(cameraUpdate); } } //Create a marker public void markeron2(LatLng point, String name, String sp, Double dbh, String time) { MarkerOptions mapoptions = new MarkerOptions(); mapoptions.title("이름 : " + name); Double latitude2 = point.latitude; Double longitude2 = point.longitude; mapoptions.snippet(time); mapoptions.position(new LatLng(latitude2, longitude2)); //지도 나무 아이콘 if (sp.equals("은행")) { mapoptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ginkgo2_icon_foreground)); } else if (sp.equals("단풍")) { mapoptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.maple2_icon_foreground)); } else if (sp.equals("벚")) { mapoptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.sakura4_icon_foreground)); } else if (sp.equals("메타")) { mapoptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.meta_icon_foreground)); } else { mapoptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.tree_icon_foreground)); } //System.out.println(latitude2); //map.animateCamera(CameraUpdateFactory.newLatLng(point));//마지막에만 카메라 이동하도록 고쳐야함 Marker tr2mark = map.addMarker(mapoptions); //map.setOnMarkerClickListener(this); //onMarkerClick(tr2mark); //onMarkerClick(tr2mark); //map.setOnMarkerClickListener(this); mMarkerList.add(tr2mark); //Mlens=Mlens+1; //mPointList.add(point); //selectM(tr2mark); } //Mark on the map public void maketree() { System.out.println("들어가서 팅기나?"); if (tList != null && tList.size() != 0) { for (int i = 0; i < tList.size(); i++) { Trees tree = tList.get(i); LatLng geoLatlng = new LatLng(tree.getTreeLocation().getLatitude(), tree.getTreeLocation().getLongitude()); markeron2(geoLatlng, tree.getTreeName(), tree.getTreeSpecies(), Double.parseDouble(tree.getTreeDbh()), tree.getTime()); } //ff=1; } } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { finalview = inflater.inflate(R.layout.fragment_fragment2_test, container, false); //세중------------------------------------------------- final FloatingActionButton fab = (FloatingActionButton) finalview.findViewById(R.id.filterBtnMap); dialogFrag = MyMainFabFragment.newInstance(); dialogFrag.setParentFab(fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogFrag.setCallbacks(fragment2_test.this); dialogFrag.show(getActivity().getSupportFragmentManager(), dialogFrag.getTag()); } }); tData = TreesContent.getTrees(); tList = TreesContent.getTrees().getAllTrees(); //세중------------------------------------------------- return finalview; } //세중추가------------------------------------------ @Override public void onResult(Object result) { Log.d("k9res", "onResult: " + result.toString()); if (result.toString().equalsIgnoreCase("swiped_down")) { //do something or nothing } else { if (result != null) { ArrayMap<String, List<String>> applied_filters = (ArrayMap<String, List<String>>) result; if (applied_filters.size() != 0) { List<Trees> filteredList = tData.getAllTrees(); System.out.println(filteredList); //iterate over arraymap for (Map.Entry<String, List<String>> entry : applied_filters.entrySet()) { Log.d("k9res", "entry.key: " + entry.getKey()); switch (entry.getKey()) { case "dbh": filteredList = tData.getDBHFilteredtrees(entry.getValue(), filteredList); //System.out.println("dbh로 필터 리스트 채움"); break; case "height": filteredList = tData.getHeightFilteredtrees(entry.getValue(), filteredList); //System.out.println("height로 필터 리스트 채움"); break; case "species": filteredList = tData.getSpeciesFilteredtrees(entry.getValue(), filteredList); //System.out.println("종으로 필터 리스트 채움"); break; case "landmark": filteredList = tData.getLandMarkFilteredtrees(entry.getValue(), filteredList); break; } } Log.d("k9res", "new size: " + filteredList.size()); tList.clear(); //비우고 tList.addAll(filteredList);// 필터해서 System.out.println("필터 후 tList" + tList); map.clear(); maketree(); } else { tList.addAll(tData.getAllTrees()); //다 넣고 map.clear(); maketree(); } } //handle result } } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (dialogFrag.isAdded()) { dialogFrag.dismiss(); dialogFrag.show(getActivity().getSupportFragmentManager(), dialogFrag.getTag()); } } //세중추가------------------------------------------------- public boolean checkForGpsProvider() { Context context = this.getContext(); LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map); if (mapFragment != null) { mapFragment.getMapAsync(callback); if (!checkForGpsProvider()) { Toast.makeText(this.getContext(), "위치 정보를 켜야 합니다.", Toast.LENGTH_LONG).show(); Intent i = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(i); } //System.out.print("LIST : "+geolist); startLocationService(); onstat(view); //System.out.print("2LIST : "+geolist); } } public ArrayMap<String, List<String>> getApplied_filters() { return applied_filters; } public TreesData gettData() { return tData; } @Override public void onOpenAnimationStart() { Log.d("aah_animation", "onOpenAnimationStart: "); } @Override public void onOpenAnimationEnd() { Log.d("aah_animation", "onOpenAnimationEnd: "); } @Override public void onCloseAnimationStart() { Log.d("aah_animation", "onCloseAnimationStart: "); } @Override public void onCloseAnimationEnd() { Log.d("aah_animation", "onCloseAnimationEnd: "); } }
package org.jenkinsci.plugins.springconfig; import com.gargoylesoftware.htmlunit.html.DomElement; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlTable; import com.google.common.collect.Ordering; import hudson.FilePath; import jenkins.model.Jenkins; import lombok.SneakyThrows; import org.assertj.core.api.InstanceOfAssertFactories; import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; import org.jenkinsci.plugins.workflow.job.WorkflowJob; import org.jenkinsci.plugins.workflow.job.WorkflowRun; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.JenkinsRule; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.IntStream; import static org.assertj.core.api.Assertions.assertThat; public class SpringConfigActionTest { @Rule public JenkinsRule r = new JenkinsRule(); private int buildNumber; String jobName = "p"; @Before @SneakyThrows public void setUp() { Jenkins jenkins = r.jenkins; WorkflowJob p = jenkins.createProject(WorkflowJob.class, jobName); FilePath ws = jenkins.getWorkspaceFor(p); FilePath applicationYaml = ws.child("application.yaml"); applicationYaml.copyFrom(this.getClass().getClassLoader().getResourceAsStream("nodefault/application.yaml")); FilePath applicationBarYaml = ws.child("application-bar.yaml"); applicationBarYaml .copyFrom(this.getClass().getClassLoader().getResourceAsStream("nodefault/application-bar.yaml")); p.setDefinition(new CpsFlowDefinition("node {springConfig(); springConfig(profiles: ['bar'])}", true)); WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0)); buildNumber = b.getNumber(); } @Test public void testActionIndex() throws Exception { HtmlPage indexPage = r.createWebClient().goTo(String.format("job/%s/%d/springconfig/", jobName, buildNumber)); DomElement springConfigPanel = indexPage.getElementById("springconfig-panel"); List<HtmlTable> tables = springConfigPanel.getByXPath("table"); assertThat(tables).hasSize(2); assertThat(tables.get(0).getRowCount()).isEqualTo(7); assertThat(tables.get(1).getRowCount()).isEqualTo(7); List<String> keys = IntStream.range(1, tables.get(0).getRowCount()) .mapToObj(i -> tables.get(0).getRow(i).getCell(0).asText()).collect(Collectors.toList()); assertThat(Ordering.<String>natural().isOrdered(keys)).isTrue(); } @Test public void testJson() throws Exception { Map jsonObject = r.getJSON(String.format("job/%s/%d/springconfig/api/json", jobName, buildNumber)) .getJSONObject(); // @formatter:off assertThat(jsonObject) .hasSize(2) .containsKeys("_class", "properties") .extractingByKey("_class") .asInstanceOf(InstanceOfAssertFactories.STRING) .isEqualTo("org.jenkinsci.plugins.springconfig.SpringConfigAction"); assertThat(jsonObject.get("properties")) .asInstanceOf(InstanceOfAssertFactories.MAP) .hasSize(2) .extractingByKey("") .asInstanceOf(InstanceOfAssertFactories.MAP) .extractingByKey("foo") .isEqualTo("bar"); } }
package com.tencent.mm.plugin.wallet.balance.a.a; import com.tencent.mm.protocal.c.awx; import com.tencent.mm.sdk.platformtools.x; public final class l { private static l oYZ; public awx oZa; public static l bMQ() { if (oYZ == null) { oYZ = new l(); } return oYZ; } public final void a(awx awx) { x.i("MicroMsg.LqtOnClickRedeemCache", "setCache OnClickRedeemRes balance %s, bank_balance %s, lq_balance %s, real_time_balbance %s", new Object[]{Integer.valueOf(awx.balance), Integer.valueOf(awx.rZW), Integer.valueOf(awx.rZV), Integer.valueOf(awx.rZX)}); this.oZa = awx; } }
package com.example.eu.reversisec.Views; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import com.example.eu.reversisec.Jogo.LogicaJogo; import com.example.eu.reversisec.R; public class MainActivity extends AppCompatActivity { LogicaJogo jogo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); jogo = (LogicaJogo) getApplication(); Button btn1 = findViewById(R.id.btnUmJogador); Button btn2 = findViewById(R.id.btnMultiplayer); Button btn3 = findViewById(R.id.btnJogarEmRede); Button btn4 = findViewById(R.id.btnHistorico); } public boolean onCreateOptionsMenu(Menu menu) { MenuInflater mi = getMenuInflater(); mi.inflate(R.menu.menu_principal,menu); return true; } public void onUmJogador(View v) { Intent intent = new Intent(this,activity_modo_singleplayer.class); boolean pc = true; String tempo="0"; /* intent.putExtra("computador", pc); intent.putExtra("tempo", tempo); intent.putExtra("tempoextra", "0"); */ startActivity(intent); } public void onDoisJogadores(View v){ Intent intent = new Intent(this,MultiplayerLocalSetup.class); startActivity(intent); } public void onJogarEmRede(View v) { } public void onHistorico(View v){ Intent intent = new Intent(this,HistoticoActivity.class); startActivity(intent); } public void onSobre(MenuItem item) { Intent intent = new Intent(this,SobreActivity.class); startActivity(intent); } }
package leetcode; import nowcoder.剑指offer.TreeNode; /** * @Author: Mr.M * @Date: 2019-03-22 21:12 * @Description: https://leetcode.com/problems/longest-univalue-path/solution/ **/ public class T687最长同值路径 { int ans; public int longestUnivaluePath(TreeNode root) { ans = 0; arrowLength(root); return ans; } public int arrowLength(TreeNode node) { if (node == null) return 0; int left = arrowLength(node.left); int right = arrowLength(node.right); int arrowLeft = 0, arrowRight = 0; if (node.left != null && node.left.val == node.val) { arrowLeft += left + 1; } if (node.right != null && node.right.val == node.val) { arrowRight += right + 1; } ans = Math.max(ans, arrowLeft + arrowRight); return Math.max(arrowLeft, arrowRight); } }
package com.guille.cpm.igu; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; import com.guille.util.Strings; public class Messages { private static final String BUNDLE_NAME = "com.guille.cpm.files.ResourceBundle_en_US"; //$NON-NLS-1$ private static final String BUNDLE_NAME_LOCAL = "com.guille.cpm.files.ResourceBundle"; private static ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); public static Locale localization = Locale.getDefault(); private Messages() { } public static String getString(String key) { RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME_LOCAL, localization); try { return Strings.deAccent(RESOURCE_BUNDLE.getString(key)); } catch (MissingResourceException e) { System.out.println("**** MISSING KEY **** " + key); return '!' + key + '!'; } } }
package vegoo.stockcommon.dao; public abstract class TaggedDao { public abstract int getDataTag(); }
public class TestaVariaveis { public static void main(String[] args) { int idade = 30; double peso = 97.5; int pesoInteiro = (int) peso; System.out.print("A idade é: " + idade); System.out.println("O Peso é: " + pesoInteiro); int codigoBanco = 999999; int codigoAgencia = 4987; int codigoConta = 000005201; byte codigoDigitoVerificador = 1; char indicadorClienteInvestidorQualificado = 'S'; System.out.println(indicadorClienteInvestidorQualificado); String nomeCliente = "Israel Amorim Silva"; System.out.println(nomeCliente); System.out.println(codigoBanco); String saudacao = "Olá, meu nome é "; String nome = "Rômulo "; String continuacao = "e minha idade é "; int idade2 = 100; System.out.println(saudacao+nome+continuacao+idade2); } }
package samples.jpa; import javax.persistence.Entity; import javax.persistence.Id; @Entity(name="tbl_name_shorter_than_31_bytes") public class ShortTableName { @Id private long id; public ShortTableName(long id) { this.id = id; } public long getId() { return id; } }
package com.SkyBlue.hr.pay.controller; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import com.SkyBlue.common.mapper.DatasetBeanMapper; import com.SkyBlue.hr.pay.serviceFacade.PayServiceFacade; import com.SkyBlue.hr.pay.to.ExpensesDeductionBean; import com.SkyBlue.hr.pay.to.SalaryInputBean; import com.tobesoft.xplatform.data.PlatformData; @Controller public class PayController{ @Autowired private PayServiceFacade payServiceFacade; @Autowired private DatasetBeanMapper datasetBeanMapper; /* 급여를 계산하는 메서드 */ @RequestMapping("/hr/pay/payCalculate.do") public void payCalculate(@RequestAttribute("inData") PlatformData inData, @RequestAttribute("outData") PlatformData outData) throws Exception { String paymentDate = inData.getVariable("paymentDate").getString(); String standardDate = inData.getVariable("standardDate").getString();// 추가 List<ExpensesDeductionBean> expensespayDeductionList = payServiceFacade.payCalculate(paymentDate,standardDate); List<SalaryInputBean> salaryInputList = payServiceFacade.salaryInputList(paymentDate); /* * List<SalaryInputBean> * salaryInputList=payServiceFacade.payCalculate(paymentDate,standardDate); * * List<ExpensesDeductionBean> payDeductionList=new * ArrayList<ExpensesDeductionBean>(); for(SalaryInputBean * salaryInputBean:salaryInputList){ * payDeductionList.addAll(salaryInputBean.getPayDeductionList()); } */ datasetBeanMapper.beansToDataset(outData, expensespayDeductionList, ExpensesDeductionBean.class); datasetBeanMapper.beansToDataset(outData, salaryInputList, SalaryInputBean.class); } }
package ayou.view; import java.awt.Dimension; import javax.swing.JFrame; public class Viewer { public static final int SCREEN_WIDTH = 1280; public static final int SCREEN_HEIGHT = (System.getProperty("os.name")).equals("Linux") ? 720 : 700; private JFrame frame = new JFrame("Hearth of Magic Duel"); public Viewer() { if ((System.getProperty("os.name")).equals("Linux")) frame.setPreferredSize(new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT)); else frame.setPreferredSize(new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT + 20)); frame.setDefaultCloseOperation(3); frame.setResizable(false); // Beginning Screen frame.setContentPane(new Menu(this)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public void nextScreen(ScreenID screenID) { switch (screenID) { case MENU: frame.setContentPane(new Menu(this)); break; case RANKING: frame.setContentPane(new Options(this)); break; case OPTIONS: frame.setContentPane(new Options(this)); break; case GAME: frame.setContentPane(new Game(this)); break; case QUIT: System.exit(0); break; default: System.err.println("ERROR"); break; } frame.repaint(); frame.revalidate(); } }
package com.tencent.mm.plugin.emoji.ui.v2; import android.content.Intent; import com.tencent.mm.R; import com.tencent.mm.plugin.emoji.ui.v2.d.a; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.protocal.c.ta; class EmojiStoreV2SingleProductUI$10 implements a { final /* synthetic */ EmojiStoreV2SingleProductUI irx; EmojiStoreV2SingleProductUI$10(EmojiStoreV2SingleProductUI emojiStoreV2SingleProductUI) { this.irx = emojiStoreV2SingleProductUI; } public final void ms(int i) { if (EmojiStoreV2SingleProductUI.h(this.irx) != null && EmojiStoreV2SingleProductUI.c(this.irx) != null) { ta oY = EmojiStoreV2SingleProductUI.c(this.irx).oY(i); if (oY != null) { try { Intent intent = new Intent(); intent.putExtra("Select_Conv_User", EmojiStoreV2SingleProductUI.i(this.irx)); intent.putExtra("extra_object", oY.toByteArray()); intent.putExtra("scene", EmojiStoreV2SingleProductUI.j(this.irx)); intent.putExtra("searchID", EmojiStoreV2SingleProductUI.k(this.irx)); intent.setClass(this.irx.mController.tml, EmojiStoreV2SingleProductDialogUI.class); this.irx.startActivityForResult(intent, 5001); this.irx.overridePendingTransition(R.a.pop_in, R.a.pop_out); h.mEJ.h(12787, new Object[]{Integer.valueOf(EmojiStoreV2SingleProductUI.j(this.irx)), Integer.valueOf(0), oY.rwk, Long.valueOf(EmojiStoreV2SingleProductUI.k(this.irx))}); } catch (Exception e) { } } } } }
package com.company.Services; import com.company.Models.MealList; import com.company.Utils.Constants; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; public interface SearchService { @GET(Constants.SEARCH_SERVICE_BASE_URL) Call<MealList> getMealsByFirstLetter (@Query("f") char firstLetter); @GET(Constants.SEARCH_SERVICE_BASE_URL) Call<MealList> getMealByName (@Query("s") String name); }
package interviewTasks_Saim; import java.util.Arrays; public class MergingArrays { public static void main(String[] args) { // int[] num1={2,6,5,}; // int[] num2={8,9,15}; // // int [] sum = new int[num1.length]; // for (int i = 0; i < num1.length; i++) { // // sum[i]= num1[i] + num2[i]; // System.out.print(sum[i]+" "); //Merging int[] arr1 ={4,7,8}; int[] arr2 = {3,6,5}; System.out.println(Arrays.toString(concatTwoArrays(arr1,arr2))); } public static int[] concatTwoArrays(int[] arr1,int[] arr2){ int [] sum = new int [arr1.length + arr2.length]; int i = 0; for(int each : arr1){ sum[i++]=each; } for(int each2 : arr2){ sum[i++]=each2; } return sum; } }
package com.ytt.springcoredemo.service; import com.ytt.springcoredemo.model.dto.UserDTO; import com.ytt.springcoredemo.model.po.User; import com.ytt.springcoredemo.service.base.CrudBaseService; /** * @Author: aaron * @Descriotion: * @Date: 23:01 2019/7/27 * @Modiflid By: */ public interface UserService extends CrudBaseService<User, Long> { UserDTO get(UserDTO user); UserDTO getById(long id); }
package com.darkania.darkers.comandos; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class Suicide implements CommandExecutor{ @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("suicide")){ Player p = (Player) sender; p.setHealth(0.0D); Bukkit.broadcastMessage(p.getDisplayName()+ChatColor.RED+" se ha suicidado."); return true; } return false; } }
package com.hit.neuruimall.mapper; import com.hit.neuruimall.model.UserModel; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.Date; import java.util.List; import static org.junit.jupiter.api.Assertions.*; @SpringBootTest class UserMapperTest { @Autowired UserMapper userMapper; @Test void selectByAll() { System.out.println(userMapper.selectByAll()); } @Test void selectByAllWithAddress() { List<UserModel> userModelList = userMapper.selectByAllWithAddress(); for (UserModel userModel : userModelList) { System.out.println(userModel); } } @Test void selectAllId() { System.out.println(userMapper.selectAllId()); } @Test void selectById() { System.out.println(userMapper.selectById(1)); } @Test void insert() { UserModel userModel = new UserModel(); userModel.setName("three"); userModel.setAge(22); userModel.setBirthday(new Date()); userModel.setSex("男"); userMapper.insert(userModel); System.out.println(userModel); } @Test void update() { UserModel userModel = new UserModel(); userModel.setId(3); userModel.setName("newThree"); userModel.setAge(25); userModel.setBirthday(new Date()); userModel.setSex("女"); userMapper.update(userModel); } @Test void deleteById() { userMapper.deleteById(4); } }
package com.tencent.mm.plugin.luckymoney.f2f.ui; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; import com.tencent.mm.ui.widget.a.d; class LuckyMoneyF2FQRCodeUI$3 implements OnMenuItemClickListener { final /* synthetic */ LuckyMoneyF2FQRCodeUI kOv; LuckyMoneyF2FQRCodeUI$3(LuckyMoneyF2FQRCodeUI luckyMoneyF2FQRCodeUI) { this.kOv = luckyMoneyF2FQRCodeUI; } public final boolean onMenuItemClick(MenuItem menuItem) { LuckyMoneyF2FQRCodeUI.a(this.kOv, new d(this.kOv, 1, false)); LuckyMoneyF2FQRCodeUI.y(this.kOv).ofp = LuckyMoneyF2FQRCodeUI.x(this.kOv); LuckyMoneyF2FQRCodeUI.y(this.kOv).ofq = LuckyMoneyF2FQRCodeUI.z(this.kOv); LuckyMoneyF2FQRCodeUI.y(this.kOv).bXO(); return true; } }
package lab5; import javax.swing.JComponent; import java.awt.image.BufferedImage; import java.awt.Dimension; import java.awt.Graphics; public class JImageDisplay extends JComponent { private BufferedImage mImage; public JImageDisplay(int width, int height) { mImage = new BufferedImage(width,height, BufferedImage.TYPE_INT_RGB); Dimension size = new Dimension(width, height); super.setPreferredSize(size); } public BufferedImage getImage() { return mImage; } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(mImage, 0, 0, mImage.getWidth(), mImage.getHeight(), null); } public void drawPixel(int x, int y, int rgbColor) { mImage.setRGB(x, y, rgbColor); } public void clearImage() { for (int i = 0; i < mImage.getWidth(); i++) { for (int j = 0; j < mImage.getHeight(); j++) { drawPixel(i, j, 0); } } } }
package com.jvm; import org.openjdk.jol.info.ClassLayout; import org.openjdk.jol.info.GraphLayout; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; import java.util.concurrent.TimeUnit; /** * import [jol-core 包] */ public class MemoryTest { public static void main(String[] args) throws InterruptedException { ArrayList<Object> arrayList = new ArrayList<>(); String o = "abc"; System.out.println(o.hashCode()); System.out.println("查看对象内部信息: " + ClassLayout.parseInstance(o).toPrintable()); System.out.println("查看对象外部信息:包括引用的对象:" +GraphLayout.parseInstance(o).toPrintable()); /* System.out.println("对象内存大小:" + GraphLayout.parseInstance(o).totalSize()/1024/1024);*/ TimeUnit.SECONDS.sleep(50000); System.out.println("我的天空 "); System.out.println("天空之城在哭泣 "); System.out.println("cherry -pick "); } }
package bai_tap.Triangle; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Input 3 sides of triangle"); System.out.println("side 1: "); double side1 = scanner.nextDouble(); System.out.println("side 2: "); double side2 = scanner.nextDouble(); System.out.println("side 3: "); double side3 = scanner.nextDouble(); Triangle triangle = new Triangle(side1, side2, side3); boolean isTriangle = (side1 + side2 > side3) && (side2 + side3 > side1) && (side1 + side3 > side2); if (isTriangle) { System.out.println(triangle.toString()); System.out.println("Triangle perimeter " + triangle.getPerimeter()); System.out.println("Triangle area " + triangle.getArea()); } else System.out.println("Not a triangle"); } }