text
stringlengths 10
2.72M
|
|---|
package main.java.dead_lock;
public class Counter extends Thread{
public void IncrementBallsAfterRun() {
synchronized(Runs.class) {
synchronized(Balls.class) {
Runs.countRuns++;
Balls.countBalls++;
}
}
}
public void IncrementRunAfterBalls() {
synchronized(Balls.class) {
synchronized(Runs.class) {
Balls.countBalls++;
Runs.countRuns++;
}
}
}
@Override
public void run() {
IncrementBallsAfterRun();
IncrementRunAfterBalls();
}
}
|
package com.example.retail.services.discounts;
import com.example.retail.models.discounts.CustomerOrdersDiscount;
import com.example.retail.repository.discounts.CustomerOrdersDiscountRepository;
import com.example.retail.util.CreateResponse;
import com.example.retail.util.JWTDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Service
public class CustomerOrdersDiscountServices {
@Autowired
CustomerOrdersDiscountRepository customerOrdersDiscountRepository;
@Autowired
CreateResponse createResponse;
@Autowired
JWTDetails JWTDetails;
public ResponseEntity<Object> createSpecialDiscount(HttpServletRequest request, CustomerOrdersDiscount customerOrdersDiscount) {
try {
LocalDateTime lastUpdatedOn = LocalDateTime.now();
customerOrdersDiscount.setDiscountAddedOn(lastUpdatedOn);
customerOrdersDiscount.setDiscountLastUpdatedBy(JWTDetails.userName(request));
CustomerOrdersDiscount res = customerOrdersDiscountRepository.save(customerOrdersDiscount);
List<Object> finalRes = new ArrayList<>();
finalRes.add(res);
return ResponseEntity.status(201).body(
createResponse.createSuccessResponse(201, "Discount created", finalRes)
);
} catch (Exception e) {
return ResponseEntity.status(500).body(
createResponse.createErrorResponse(500, e.getMessage(), "NA")
);
}
}
public ResponseEntity<Object> findAllByDiscountName(String discountName) {
try {
Optional<CustomerOrdersDiscount> customerOrdersDiscount = customerOrdersDiscountRepository.findByDiscountName(discountName);
List<Object> res = new ArrayList<>();
String successMessage = "One record found";
if (customerOrdersDiscount.isEmpty()) {
successMessage = "query ran successfully but could not find any results found for " + discountName;
} else {
res.add(customerOrdersDiscount);
}
return ResponseEntity.status(200).body(
createResponse.createSuccessResponse(200, successMessage, res)
);
} catch (Exception e) {
return ResponseEntity.status(500).body(
createResponse.createErrorResponse(500, e.getMessage(), "NA")
);
}
}
public List<CustomerOrdersDiscount> findAllDiscounts() {
return customerOrdersDiscountRepository.findAll();
}
public List<CustomerOrdersDiscount> getAllActiveDiscounts() {
return customerOrdersDiscountRepository.getAllActiveDiscounts();
}
public Optional<CustomerOrdersDiscount> findByDiscountName(String discountName) {
return customerOrdersDiscountRepository.findByDiscountName(discountName);
}
}
|
package com.luosifan.utils;
/**
* Created by wzfu on 2016/5/6.
*/
public class FileUtil {
}
|
/*
* 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 facade;
import entity.Customer;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;
/**
*
* @author Dennis
*/
public class CustomerFacade {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu");
public Customer createCustomer(Customer c) {
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
em.persist(c);
em.getTransaction().commit();
return c;
}
public List<Customer> getAllCustomers() {
EntityManager em = emf.createEntityManager();
TypedQuery tq = em.createQuery("SELECT c FROM Customer c", Customer.class);
List<Customer> customers = tq.getResultList();
return customers;
}
public Customer getCustomerById(int id){
EntityManager em = emf.createEntityManager();
TypedQuery tq = em.createQuery("SELECT c FROM Customer c WHERE c.id = :id", Customer.class);
tq.setParameter("id", id);
Customer cus = (Customer)tq.getSingleResult();
return cus;
}
public int getCustomerListSize(List<Customer> cus){
return getAllCustomers().size();
}
public static void main(String[] args) {
CustomerFacade cf = new CustomerFacade();
System.out.println(cf.getCustomerById(1));
}
}
|
import java.io.*;
class ParseInteger
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter an Int Value: ");
int num=Integer.parseInt(br.readLine());
System.out.println("You entered: "+num);
}
}
|
package com.hallowizer.displaySlot.apiLoader.visitInstruction;
import org.objectweb.asm.MethodVisitor;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public final class MethodVisitIincInsnInstruction implements VisitInstruction<MethodVisitor> {
private final int var;
private final int increment;
@Override
public void execute(MethodVisitor mv) {
mv.visitIincInsn(var, increment);
}
}
|
import java.util.ArrayList;
import java.util.Random;
/**
* A particle; keeps track of where a particle is and if it's moving.
*/
public class Particle {
Double x, y; // The coordinates of the particle.
Boolean isMoving; // Whether the particle is currently moving.
/**
* Creates a particle randomly within a 1*1 box.
*/
public Particle() {
this( Math.random(), Math.random() );
}
/**
* Creates a particle with a specific coordinate.
*/
public Particle( Double x, Double y ) {
this.x = x;
this.y = y;
this.isMoving = true;
}
/**
* Creates a particle with a coordinate at random within a xsize*ysize box.
*/
public Particle( Integer xsize, Integer ysize ) {
this();
this.x *= xsize;
this.y *= ysize;
}
/**
* Sets the particle's position to the middle of a xsize*ysize box.
*/
public void centre( Integer xsize, Integer ysize ) {
this.x = xsize / 2.0;
this.y = ysize / 2.0;
this.isMoving = true;
}
/**
* Sets the particle's position to a random coord within a xsize*ysize box.
*/
public void scatter( Integer xsize, Integer ysize ) {
this.x = Math.random() * xsize;
this.y = Math.random() * ysize;
this.isMoving = true;
}
/**
* Randomly moves the particle by length L within the maxx*maxy box.
*/
public void randomMove( Double L, Integer maxx, Integer maxy ) {
if( !this.isMoving ) // Don't move if it's stuck.
return;
Double angle = Math.random() * 2 * Math.PI; // Choose an angle.
this.x += L * Math.cos( angle );
this.y += L * Math.sin( angle ); // And advance coords.
// If it went outside the box, make it stick.
if( this.x <= 0.0 ) {
this.isMoving = false;
this.x = 0.0;
}
else if( this.x >= maxx ) {
this.isMoving = false;
this.x = maxx.doubleValue();
}
if( this.y <= 0.0 ) {
this.isMoving = false;
this.y = 0.0;
}
else if( this.y >= maxy ) {
this.isMoving = false;
this.y = maxy.doubleValue();
}
}
}
|
/*
* UniTime 3.4 - 3.5 (University Timetabling Application)
* Copyright (C) 2013, UniTime LLC, and individual contributors
* as indicated by the @authors tag.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.unitime.timetable.gwt.client.aria;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;
/**
* @author Tomas Muller
*/
public class AriaHiddenLabel extends Widget implements HasHTML, HasText {
public AriaHiddenLabel(String text, boolean asHtml) {
setElement((Element)DOM.createSpan());
setStyleName("unitime-AriaHiddenLabel");
if (text != null) {
if (asHtml)
setHTML(text);
else
setText(text);
}
}
public AriaHiddenLabel(String text) {
this(text, false);
}
public AriaHiddenLabel() {
this(null, false);
}
@Override
public String getText() {
return getElement().getInnerText();
}
@Override
public void setText(String text) {
getElement().setInnerText(text);
}
@Override
public String getHTML() {
return getElement().getInnerHTML();
}
@Override
public void setHTML(String html) {
getElement().setInnerHTML(html);
}
}
|
package exemplos.exemplo01;
import java.util.HashMap;
public class GerenciaContas {
private HashMap<Integer, Conta> mapaDeContas;
public GerenciaContas() {
mapaDeContas = new HashMap<>();
}
public void novaContaCorrente(int conta, double saldo){
mapaDeContas.put(conta,new ContaCorrente(conta, saldo));
}
public void novaContaEspecial(int conta, double saldo, double limite){
mapaDeContas.put(conta,new ContaEspecial(conta, saldo, limite));
}
public void novaContaPoupanca(int conta, double saldo){
mapaDeContas.put(conta,new ContaPoupanca(conta, saldo));
}
public boolean deposito(int numeroConta, double valorDeposito) {
Conta conta = mapaDeContas.get(numeroConta);
if(conta != null) {
return conta.deposito(valorDeposito);
}
return false; // informa que não encontrou a conta
}
public boolean saque(int numeroConta, double valorSaque) {
Conta conta = mapaDeContas.get(numeroConta);
if(conta != null) {
return conta.saque(valorSaque);
}
return false; // não achou a conta
}
public String exibirSaldo(int numeroConta) {
Conta conta = mapaDeContas.get(numeroConta);
if(conta != null){
return conta.toString();
}
return "Conta não encontrada";
}
}
|
package co.yolima.spafitness;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
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.ValueEventListener;
/**
* A simple {@link Fragment} subclass.
*/
public class CancelarCitasFragment extends Fragment {
private FirebaseAuth mAuth;
private FirebaseDatabase firebaseDatabase;
private DatabaseReference databaseReference;
private String userId;
TextView citaPendiente, nombreCita;
Button btnCargarCita, btnCancelarCita;
public CancelarCitasFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_cancelar_citas, container, false);
// firebase
mAuth = FirebaseAuth.getInstance();
userId = mAuth.getCurrentUser().getUid();
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference("citas");
citaPendiente = (TextView) rootView.findViewById(R.id.tvCitaPendiente);
nombreCita = (TextView) rootView.findViewById(R.id.tvNombreCita);
btnCancelarCita = (Button) rootView.findViewById(R.id.btnCancelarCita);
btnCargarCita = (Button) rootView.findViewById(R.id.btnCargarCitas);
// btn Cancelar cita
btnCancelarCita.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int i = 0;
databaseReference.child(userId).child("activa").setValue(i);
Toast.makeText(getContext(),"Cita cancelada",Toast.LENGTH_SHORT).show();
nombreCita.setVisibility(View.INVISIBLE);
}
});
// btn Cargar cita
btnCargarCita.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
userId = mAuth.getCurrentUser().getUid();
databaseReference.child(userId).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Citas citas = dataSnapshot.getValue(Citas.class);
if (citas.getActiva() == 1){
citaPendiente.setVisibility(View.VISIBLE);
String text = citas.getNombre()+" "+citas.getApellido()+","+Integer.toString(citas.getEdad());
nombreCita.setText(text);
} else {
Toast.makeText(getContext(),"No hay citas creadas...",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
});
return rootView;
}
}
|
package com.clay.claykey;
import android.app.Application;
import com.clay.claykey.object.parse.Door;
import com.clay.claykey.object.parse.DoorLogs;
import com.clay.claykey.utility.Shared;
import com.parse.Parse;
import com.parse.ParseObject;
/**
* Created by Mina Fayek on 1/15/2016.
*/
public class ClayApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
initParse();
Shared.context = this;
}
private void initParse() {
ParseObject.registerSubclass(DoorLogs.class);
ParseObject.registerSubclass(Door.class);
Parse.enableLocalDatastore(this);
Parse.initialize(this);
}
}
|
package proxy.aopframework;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Created by john on 2016/11/28.
*/
public class BeanFactory {
Properties properties = new Properties();
public BeanFactory(InputStream inputStream) {
try {
properties.load(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
public Object getBean(String name) throws Exception {
String clazzName = properties.getProperty(name);
Object bean;
Class<?> clazz = Class.forName(clazzName);
bean = clazz.newInstance();
if (bean instanceof ProxyFactoryBean) {
ProxyFactoryBean proxyFactorybean = (ProxyFactoryBean) bean;
proxyFactorybean.setTarget(Class.forName(properties.getProperty(name + ".target")).newInstance());
proxyFactorybean.setAdvice((Advice) Class.forName(properties.getProperty(name + ".advice")).newInstance());
return ((ProxyFactoryBean) bean).getProxy();
}
return bean;
}
}
|
package ua.project.protester.controller;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import ua.project.protester.exception.executable.OuterComponentStepSaveException;
import ua.project.protester.exception.executable.scenario.TestScenarioNotFoundException;
import ua.project.protester.exception.executable.scenario.UsedTestScenarioDeleteException;
import ua.project.protester.model.executable.OuterComponent;
import ua.project.protester.request.OuterComponentFilter;
import ua.project.protester.request.OuterComponentRepresentation;
import ua.project.protester.service.TestScenarioService;
import ua.project.protester.utils.Page;
@PreAuthorize("isAuthenticated()")
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/test-scenarios")
public class TestScenarioController {
private final TestScenarioService testScenarioService;
@PostMapping
public OuterComponent createTestScenario(@RequestBody OuterComponentRepresentation request) throws OuterComponentStepSaveException {
return testScenarioService.saveTestScenario(request);
}
@PutMapping("/{id}")
public OuterComponent updateTestScenario(@RequestBody OuterComponentRepresentation request, @PathVariable int id) throws OuterComponentStepSaveException {
return testScenarioService.updateTestScenario(id, request);
}
@GetMapping
public Page<OuterComponent> getAllTestScenarios(@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
@RequestParam(value = "scenarioName", defaultValue = "") String scenarioName,
@RequestParam(value = "loadSteps", defaultValue = "true") boolean loadSteps) {
OuterComponentFilter filter = new OuterComponentFilter(pageSize, pageNumber, scenarioName);
return testScenarioService.getAllTestScenarios(filter, loadSteps);
}
@GetMapping("/{id}")
public OuterComponent getTestScenario(@PathVariable int id) throws TestScenarioNotFoundException {
return testScenarioService.getTestScenarioById(id);
}
@DeleteMapping("/{id}")
public OuterComponent deleteTestScenario(@PathVariable int id) throws UsedTestScenarioDeleteException {
return testScenarioService.deleteTestScenarioById(id);
}
}
|
/* */ package datechooser.beans.editor.cell;
/* */
/* */ import datechooser.beans.editor.border.SimpleBorderEditor;
/* */ import datechooser.beans.editor.utils.EditorDialog;
/* */ import datechooser.beans.locale.LocaleUtils;
/* */ import datechooser.view.appearance.custom.CustomCellAppearance;
/* */ import java.awt.BorderLayout;
/* */ import java.awt.Frame;
/* */ import java.awt.GridLayout;
/* */ import java.awt.event.ActionEvent;
/* */ import java.awt.event.ActionListener;
/* */ import javax.swing.BorderFactory;
/* */ import javax.swing.JButton;
/* */ import javax.swing.JLabel;
/* */ import javax.swing.JPanel;
/* */ import javax.swing.JSlider;
/* */ import javax.swing.border.Border;
/* */ import javax.swing.event.ChangeEvent;
/* */ import javax.swing.event.ChangeListener;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class CustomCellEditorPane
/* */ extends CellEditorPane
/* */ {
/* */ private EditorDialog borderEditorDialog;
/* */ private boolean innerEdit;
/* */ private JSlider slider;
/* */
/* */ public CustomCellEditorPane(MainCellEditorPane parentEditor)
/* */ {
/* 37 */ super(parentEditor);
/* 38 */ setInnerEdit(false);
/* 39 */ this.borderEditorDialog = new EditorDialog((Frame)getParent(), new SimpleBorderEditor());
/* */ }
/* */
/* */ protected void updateEditorState()
/* */ {
/* 44 */ if (isInnerEdit()) return;
/* 45 */ if (this.slider == null) return;
/* 46 */ this.slider.setValue((int)(getCustomValue().getTransparency() * 100.0D));
/* */ }
/* */
/* */ protected void generateInterface() {
/* 50 */ setLayout(new BorderLayout(2, 2));
/* 51 */ JPanel buttons = new JPanel(new GridLayout(2, 1, 5, 5));
/* 52 */ JPanel line1 = new JPanel(new GridLayout(1, 2, 5, 5));
/* 53 */ JPanel line2 = new JPanel(new GridLayout(1, 3, 5, 5));
/* 54 */ JPanel line3 = new JPanel(new GridLayout(1, 1, 5, 5));
/* */
/* 56 */ line1.add(createBackgroundChooseButton());
/* 57 */ line1.add(createCursorColorChooseButton());
/* 58 */ line2.add(createTextColorChooseButton());
/* 59 */ line2.add(createFontChooseButton());
/* 60 */ line2.add(createBorderChooseButton());
/* 61 */ line3.add(createTransparencySlider());
/* */
/* 63 */ buttons.add(line1);
/* 64 */ buttons.add(line2);
/* 65 */ add(buttons, "North");
/* 66 */ add(line3, "South");
/* 67 */ setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
/* */ }
/* */
/* */ private JPanel createTransparencySlider() {
/* 71 */ JPanel sliderPane = new JPanel(new BorderLayout(2, 5));
/* 72 */ JLabel sliderText = new JLabel(LocaleUtils.getEditorLocaleString("Transparency"));
/* 73 */ this.slider = new JSlider(0, 100, 100);
/* 74 */ this.slider.setMajorTickSpacing(20);
/* 75 */ this.slider.setMinorTickSpacing(10);
/* 76 */ this.slider.setPaintLabels(true);
/* 77 */ this.slider.setPaintTicks(true);
/* 78 */ this.slider.setSnapToTicks(true);
/* 79 */ this.slider.setInverted(true);
/* 80 */ this.slider.setExtent(10);
/* 81 */ this.slider.addChangeListener(new ChangeListener() {
/* */ public void stateChanged(ChangeEvent e) {
/* 83 */ CustomCellEditorPane.this.setInnerEdit(true);
/* 84 */ CustomCellEditorPane.this.getCustomValue().setTransparency(CustomCellEditorPane.this.slider.getValue() / 100.0F);
/* 85 */ CustomCellEditorPane.this.getMainEditor().fireLocalPropertyChange();
/* 86 */ CustomCellEditorPane.this.setInnerEdit(false);
/* */ }
/* 88 */ });
/* 89 */ sliderPane.add(sliderText, "West");
/* 90 */ sliderPane.add(this.slider, "Center");
/* 91 */ return sliderPane;
/* */ }
/* */
/* */ private JButton createBackgroundChooseButton() {
/* 95 */ JButton selBackColor = new JButton(LocaleUtils.getEditorLocaleString("Background_color"));
/* 96 */ selBackColor.addActionListener(new ActionListener() {
/* */ public void actionPerformed(ActionEvent e) {
/* 98 */ CustomCellEditorPane.this.getCustomValue().setBackgroundColor(CustomCellEditorPane.this.selectColor(CustomCellEditorPane.this.getCustomValue().getBackgroundColor(), LocaleUtils.getEditorLocaleString("Select_background_color")));
/* */
/* */
/* 101 */ CustomCellEditorPane.this.getMainEditor().fireLocalPropertyChange();
/* */ }
/* 103 */ });
/* 104 */ return selBackColor;
/* */ }
/* */
/* */ private JButton createBorderChooseButton() {
/* 108 */ JButton bBorder = new JButton(LocaleUtils.getEditorLocaleString("Border"));
/* 109 */ bBorder.addActionListener(new ActionListener() {
/* */ public void actionPerformed(ActionEvent e) {
/* 111 */ Border newBorder = (Border)CustomCellEditorPane.this.borderEditorDialog.showDialog(CustomCellEditorPane.this.getCustomValue().getCellBorder(), LocaleUtils.getEditorLocaleString("Select_border"));
/* */
/* 113 */ if (!CustomCellEditorPane.this.borderEditorDialog.isCanceled()) {
/* 114 */ CustomCellEditorPane.this.getCustomValue().setCellBorder(newBorder);
/* 115 */ CustomCellEditorPane.this.getMainEditor().fireLocalPropertyChange();
/* */ }
/* */ }
/* 118 */ });
/* 119 */ return bBorder;
/* */ }
/* */
/* */ private CustomCellAppearance getCustomValue() {
/* 123 */ return (CustomCellAppearance)getValue();
/* */ }
/* */
/* */ public boolean isInnerEdit() {
/* 127 */ return this.innerEdit;
/* */ }
/* */
/* */ public void setInnerEdit(boolean innerEdit) {
/* 131 */ this.innerEdit = innerEdit;
/* */ }
/* */ }
/* Location: /home/work/vm/shared-folder/reverse/ketonix/KetonixUSB-20170310.jar!/datechooser/beans/editor/cell/CustomCellEditorPane.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/
|
package net.minecraft.src;
import java.util.Random;
public class BlockSlate extends Block
{
public BlockSlate(int par1, int par2)
{
super(par1, par2, Material.rock);
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return Block.slate.blockID;
}
}
|
package com.infosys.userms.exception;
public class UserException {
}
|
package com.joshua.addressbook.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "prices_by_quantity")
public class PriceByQuantity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@ManyToOne
@JoinColumn(name = "weight_ranges_id")
private WeightRange weightRange;
private Integer min;
private Integer max;
private Double price;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public WeightRange getWeightRange() {
return weightRange;
}
public void setWeightRange(WeightRange weightRange) {
this.weightRange = weightRange;
}
public Integer getMin() {
return min;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMax() {
return max;
}
public void setMax(Integer max) {
this.max = max;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
@Override
public String toString() {
return "PricesByQuantity [id=" + id + ", weightRanges=" + weightRange + ", min=" + min + ", max=" + max
+ ", price=" + price + "]";
}
}
|
/*
* 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 utfpr.ct.dainf.if62c.avaliacao;
/**
*
* @author ThiagoSaraiva
*/
public class Poligonal {
int NumVertices;
public Poligonal(int n){
this.NumVertices = n;
}
private Ponto2D vertices[] = new Ponto2D[NumVertices];
public int getN(){
return this.NumVertices;
}
}
|
package com.tencent.mm.plugin.fts;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.tencent.mm.sdk.platformtools.x;
class PluginFTS$9 extends BroadcastReceiver {
final /* synthetic */ PluginFTS jpM;
PluginFTS$9(PluginFTS pluginFTS) {
this.jpM = pluginFTS;
}
public final void onReceive(Context context, Intent intent) {
if (intent != null && intent.getAction() != null) {
x.i("MicroMsg.FTS.PluginFTS", "*** Charging notified: " + intent.getAction());
if (intent.getAction().equals("android.intent.action.ACTION_POWER_CONNECTED")) {
PluginFTS.access$1602(this.jpM, true);
} else if (intent.getAction().equals("android.intent.action.ACTION_POWER_DISCONNECTED")) {
PluginFTS.access$1602(this.jpM, false);
}
}
}
}
|
package com.tencent.mm.plugin.appbrand.jsapi.media;
import com.tencent.mm.plugin.appbrand.e;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandProxyUIProcessTask.ProcessResult;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandProxyUIProcessTask.b;
import com.tencent.mm.plugin.appbrand.jsapi.a;
import com.tencent.mm.plugin.appbrand.l;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.MMActivity;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
public final class JsApiChooseMedia extends a {
public static final int CTRL_INDEX = 193;
public static final String NAME = "chooseMedia";
private static volatile boolean fUx = false;
public final void a(final l lVar, JSONObject jSONObject, final int i) {
if (fUx) {
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia sChoosingMedia is true, do not again");
lVar.E(i, f("cancel", null));
return;
}
MMActivity c = c(lVar);
if (c == null) {
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, pageContext is null");
lVar.E(i, f("fail:page context is null", null));
} else if (jSONObject == null) {
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, data is null");
lVar.E(i, f("fail:data is null", null));
} else {
boolean z;
x.i("MicroMsg.JsApiChooseMedia", "chooseMedia data:" + jSONObject.toString());
String str = "";
if (jSONObject.optJSONArray("sourceType") == null || jSONObject.optJSONArray("sourceType").length() <= 0) {
x.e("MicroMsg.JsApiChooseMedia", "sourceType is invalid param");
} else {
str = jSONObject.optJSONArray("sourceType").toString();
}
if (bi.oW(str)) {
str = "camera|album";
}
String str2 = "";
if (jSONObject.optJSONArray("mediaType") == null || jSONObject.optJSONArray("mediaType").length() <= 0) {
x.e("MicroMsg.JsApiChooseMedia", "mediaType is invalid param");
} else {
str2 = jSONObject.optJSONArray("mediaType").toString();
}
if (bi.oW(str2)) {
str2 = "video|image";
}
int min = Math.min(jSONObject.optInt("maxDuration", 10), 10);
if (min < 3 || min > 10) {
x.e("MicroMsg.JsApiChooseMedia", "maxDuration is invalid");
min = 10;
}
String optString = jSONObject.optString("camera");
if (bi.oW(optString)) {
optString = "back";
}
int min2 = Math.min(jSONObject.optInt("count", 9), 9);
String str3 = "";
if (jSONObject.optJSONArray("sizeType") == null || jSONObject.optJSONArray("sizeType").length() <= 0) {
x.e("MicroMsg.JsApiChooseMedia", "sizeType is invalid param");
} else {
str3 = jSONObject.optJSONArray("sizeType").toString();
}
if (bi.oW(str3)) {
str3 = "original|compressed";
}
x.i("MicroMsg.JsApiChooseMedia", "chooseMedia sourceType:%s, mediaType:%s, maxDuration:%d, camera:%s, count:%d, sizeType:%s", new Object[]{str, str2, Integer.valueOf(min), optString, Integer.valueOf(min2), str3});
com.tencent.mm.plugin.appbrand.a.a(lVar.mAppId, new 3(this, lVar, jSONObject, i));
MMActivity c2 = c(lVar);
if (c2 == null) {
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, requestAudioPermission pageContext is null");
lVar.E(i, f("fail", null));
z = false;
} else {
z = com.tencent.mm.pluginsdk.permission.a.a(c2, "android.permission.RECORD_AUDIO", 120, "", "");
if (z) {
com.tencent.mm.plugin.appbrand.a.pZ(lVar.mAppId);
}
}
if (z) {
com.tencent.mm.plugin.appbrand.a.a(lVar.mAppId, new 4(this, lVar, jSONObject, i));
c2 = c(lVar);
if (c2 == null) {
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, requestCameraPermission pageContext is null");
lVar.E(i, f("fail", null));
z = false;
} else {
z = com.tencent.mm.pluginsdk.permission.a.a(c2, "android.permission.CAMERA", 119, "", "");
if (z) {
com.tencent.mm.plugin.appbrand.a.pZ(lVar.mAppId);
}
}
if (z) {
x.i("MicroMsg.JsApiChooseMedia", "do chooseMedia");
fUx = true;
e.a(lVar.mAppId, new 1(this, lVar));
ChooseRequest chooseRequest = new ChooseRequest();
chooseRequest.appId = lVar.mAppId;
chooseRequest.fUz = str.contains("album");
chooseRequest.fUA = str.contains("camera");
chooseRequest.fUB = str2.contains("image");
chooseRequest.fUC = str2.contains("video");
if (optString.contains("back") || !optString.contains("front")) {
chooseRequest.isFront = false;
} else {
chooseRequest.isFront = true;
}
chooseRequest.maxDuration = min;
chooseRequest.count = min2;
chooseRequest.fUi = str3.contains("compressed");
chooseRequest.fUj = str3.contains("original");
com.tencent.mm.plugin.appbrand.ipc.a.a(c, chooseRequest, new b<ChooseResult>() {
public final /* synthetic */ void c(ProcessResult processResult) {
ChooseResult chooseResult = (ChooseResult) processResult;
JsApiChooseMedia.fUx = false;
if (chooseResult == null) {
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, onReceiveResult result is null");
lVar.E(i, JsApiChooseMedia.this.f("fail", null));
return;
}
switch (chooseResult.bjW) {
case -1:
String str = chooseResult.type;
String str2 = chooseResult.fUD;
if (bi.oW(str2)) {
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, onReceiveResult localIds is null");
lVar.E(i, JsApiChooseMedia.this.f("fail", null));
return;
}
Map hashMap = new HashMap();
hashMap.put("type", str);
hashMap.put("tempFiles", str2);
x.i("MicroMsg.JsApiChooseMedia", "chooseMedia ok, type:%s, localIds:%s", new Object[]{str, str2});
lVar.E(i, JsApiChooseMedia.this.f("ok", hashMap));
return;
case 0:
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, onReceiveResult user cancel");
lVar.E(i, JsApiChooseMedia.this.f("fail:cancel", null));
return;
default:
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia fail, onReceiveResult");
lVar.E(i, JsApiChooseMedia.this.f("fail", null));
return;
}
}
});
return;
}
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia requestCameraPermission is fail");
return;
}
x.e("MicroMsg.JsApiChooseMedia", "chooseMedia requestAudioPermission is fail");
}
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
public class Main {
private static int N = 0;
private static int W = 0;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
W = Integer.parseInt(st.nextToken());
int [] cost = new int[N];
for (int i = 0; i < N; i++) {
cost[i] = Integer.parseInt(br.readLine());
}
int min = cost[0];
int max = cost[0];
long money = W;
long maxMoney = W;
for (int i = 1; i < N; i++) {
if (cost[i] > max) {
max = cost[i];
maxMoney = money + ((money / min) * (max - min));
}
if (max > cost[i]) {
min = cost[i];
max = cost[i];
money = maxMoney;
}
}
money = maxMoney;
System.out.println(money);
}
}
|
/*
* The MIT License
*
* Copyright 2017 KSat Stuttgart e.V..
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.ksatstuttgart.usoc.gui.setup;
import com.ksatstuttgart.usoc.gui.controller.ChartController;
import com.ksatstuttgart.usoc.gui.controller.StatePanelController;
import com.ksatstuttgart.usoc.gui.worldwind.GNSSPanel;
import java.util.Properties;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TabPane.TabClosingPolicy;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
/**
* This class builds the GUI FXML structure based on input parameters in the properties file
*
*
* @author Victor Hertel
* @version 2.0
*/
public class GuiBuilder {
private static final String CONFIGPATH = "config/config.properties";
/**
* The title of the generated ground station is updated and reseted.
*
* @param stage
* @param path
*/
public static void setExperimentName(Stage stage, String path) {
Properties config = ConfigHandler.getAllValues(path);
stage.setTitle(config.getProperty("experimentName"));
}
/**
*
*
* @return
*/
public static Scene createGUIFromConfig() {
// Loads the configuration file
Properties config = ConfigHandler.getAllValues(CONFIGPATH);
// Sets the BorderPane of the MainFrame
BorderPane mainBorder = new BorderPane();
mainBorder.setPrefSize(600,400);
// Sets
TabPane mainTab = new TabPane();
mainTab.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
ScrollPane chartScroll = new ScrollPane();
GridPane chartGrid = new GridPane();
// Adding charts
int column = 0;
int row = 0;
int maxColumns = Integer.parseInt(config.getProperty("chartColumns"));
NumberAxis xAxis = new NumberAxis();
NumberAxis yAxis = new NumberAxis();
ChartController chartController = new ChartController();
// Setting
for (int i = 0; i < ConfigHandler.countItems("chartTitle", CONFIGPATH); i++) {
//
LineChart<Number, Number> chart = new LineChart<>(xAxis, yAxis);
chart.setTitle(config.getProperty("chartTitle[" + (i+1) + "]"));
chartController.addChart(chart);
chartGrid.add(chart, column, row);
//
column++;
if (column > (maxColumns-1)) {
row++;
column = 0;
}
}
//Add chart to main tabs
chartScroll.setContent(chartGrid);
Tab chartTab = new Tab();
chartTab.setText("Charts");
chartTab.setContent(chartScroll);
mainTab.getTabs().add(chartTab);
//TODO: Doesn't work yet with JavaFX -> doesn't close on window close
if (Boolean.parseBoolean(config.getProperty("GNSS3dView"))) {
Tab gnssTab = new Tab();
StackPane gnssStack = new StackPane();
GNSSPanel.addGNSSPaneltoStackPane(gnssStack);
gnssTab.setText("GNSS 3D View");
gnssTab.setContent(gnssStack);
mainTab.getTabs().add(gnssTab);
}
//Add mainTab to the center
mainBorder.setCenter(mainTab);
// Create the log views
USOCTabPane logTab = new USOCTabPane();
if (Boolean.parseBoolean(config.getProperty("serialPanel"))) {
logTab.addFXMLTab("fxml/SerialPanel.fxml", "Serial Connection");
}
//TODO: should be named something like Mail
if (Boolean.parseBoolean(config.getProperty("iridumPanel"))) {
logTab.addFXMLTab("fxml/IridiumPanel.fxml", "Iridium Connection");
}
// if not empty add the log view to the main pane
if (!logTab.getTabs().isEmpty()) {
mainBorder.setRight(logTab);
}
// Create the state view
if (Boolean.parseBoolean(config.getProperty("statePanel"))) {
ScrollPane stateScroll = new ScrollPane();
StatePanelController statePanelController = new StatePanelController();
VBox stateBox = new VBox();
stateBox.setSpacing(5);
// use config to create state view
for (int i = 0; i < ConfigHandler.countItems("segmentTitle", CONFIGPATH); i++) {
VBox vBox = new VBox();
GridPane stateGrid = new GridPane();
stateGrid.setVgap(5);
stateGrid.setHgap(5);
column = 0;
row = 1;
//TODO: Make this not hardcoded
maxColumns = 2;
Label segmentTitle = new Label();
segmentTitle.setText(config.getProperty("segmentTitle[" + i + "]"));
stateGrid.add(segmentTitle, 0, 0);
//
for (int j = 0; j < ConfigHandler.countItems("keyword[" + (i + 1) + "]", CONFIGPATH); j++) {
//
Label label = new Label();
//
if (column == 0) {
label.setText(config.getProperty("keyword[" + (i + 1) + "][" + (j + 1) + "]"));
}
//
if (column == 1) {
//TODO: get variable name
statePanelController.addLabel(label, "Test");
}
//
stateGrid.add(label, column, row);
//
column++;
if (column > (maxColumns-1)) {
row++;
column = 0;
}
}
//
vBox.getChildren().add(stateGrid);
stateBox.getChildren().add(vBox);
}
//
stateScroll.setContent(stateBox);
mainBorder.setLeft(stateScroll);
}
return new Scene(mainBorder);
}
}
|
package Group25;
public class March_19 {
public static void main (String [] args){
int a=1;
int b=2;
int c=3;
//boolean sum =true;
if(a + b == c){
System.out.println("Yes");
}else if(b + a == c){
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}
|
package jordiarjan.databases.opdracht2;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBManager {
private Connection connection;
public DBManager() {
try {
this.connection = DriverManager.getConnection("jdbc:mysql://url:3306/db", "user", "pass");
this.connection.setAutoCommit(false);
this.connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
} catch (SQLException e) {
e.printStackTrace();
}
}
public Connection getConnection() {
return this.connection;
}
}
|
package com.plter.notes.atys;
import com.plter.notes.R;
class MediaListCellData{
public MediaListCellData(String path) {
this.path = path;
if (path.endsWith(".jpg")) {
iconId = R.drawable.icon_photo;
type = MediaType.PHOTO;
}else if (path.endsWith(".mp4")) {
iconId = R.drawable.icon_video;
type = MediaType.VIDEO;
}
}
public MediaListCellData(String path,int id) {
this(path);
this.id = id;
}
int type = 0;
int id = -1;
String path = "";
int iconId = R.drawable.ic_launcher;
}
|
package com.jim.multipos.ui.main_menu.customers_menu;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.jim.mpviews.MpButton;
import com.jim.mpviews.MpToolbar;
import com.jim.multipos.R;
import com.jim.multipos.core.BaseActivity;
import com.jim.multipos.data.DatabaseManager;
import com.jim.multipos.data.db.model.intosystem.TitleDescription;
import com.jim.multipos.ui.customer_debt.CustomerDebtActivity;
import com.jim.multipos.ui.customer_group_new.CustomerGroupActivity;
import com.jim.multipos.ui.customers.CustomersActivity;
import com.jim.multipos.ui.main_menu.MenuListAdapter;
import com.jim.multipos.ui.main_menu.customers_menu.dialogs.CustomerExportDialog;
import com.jim.multipos.ui.main_menu.customers_menu.dialogs.ImportCustomersDialog;
import com.jim.multipos.ui.main_menu.customers_menu.presenters.CustomersMenuPresenter;
import com.jim.multipos.utils.OnItemClickListener;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by DEV on 08.08.2017.
*/
public class CustomersMenuActivity extends BaseActivity implements CustomersMenuView {
@BindView(R.id.rvMenu)
RecyclerView rvMenu;
@BindView(R.id.btnBackToMain)
MpButton btnBackToMain;
@BindView(R.id.mpToolBar)
MpToolbar mpToolbar;
@Inject
CustomersMenuPresenter presenter;
@Inject
DatabaseManager databaseManager;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.product_menu_layout);
ButterKnife.bind(this);
mpToolbar.setMode(MpToolbar.DEFAULT_TYPE);
String title[] = getResources().getStringArray(R.array.customers_menu_title);
String description[] = getResources().getStringArray(R.array.customers_menu_description);
presenter.setRecyclerViewItems(title, description);
}
@OnClick(R.id.btnBackToMain)
public void onBack() {
finish();
}
@Override
public void setRecyclerView(ArrayList<TitleDescription> titleDescriptions) {
rvMenu.setLayoutManager(new LinearLayoutManager(this));
MenuListAdapter adapter = new MenuListAdapter(titleDescriptions);
rvMenu.setAdapter(adapter);
adapter.setOnItemClickListener(new OnItemClickListener<TitleDescription>() {
@Override
public void onItemClicked(int position) {
presenter.setItemPosition(position);
}
@Override
public void onItemClicked(TitleDescription item) {
}
});
}
@Override
public void openActivity(int position) {
switch (position) {
case 0:
Intent intent = new Intent(this, CustomersActivity.class);
startActivity(intent);
break;
case 1:
Intent intentGroup = new Intent(this, CustomerGroupActivity.class);
startActivity(intentGroup);
break;
case 2:
Intent intentDebt = new Intent(this, CustomerDebtActivity.class);
startActivity(intentDebt);
break;
case 3:
CustomerExportDialog dialog = new CustomerExportDialog(CustomersMenuActivity.this, databaseManager);
dialog.show();
break;
case 4:
ImportCustomersDialog importDialog = new ImportCustomersDialog(CustomersMenuActivity.this, databaseManager);
importDialog.show();
break;
}
}
}
|
package pl.edu.pw.mini.gapso.configuration;
import com.google.gson.JsonElement;
import pl.edu.pw.mini.gapso.bounds.BoundsManager;
import pl.edu.pw.mini.gapso.bounds.GlobalModelBoundsManager;
import pl.edu.pw.mini.gapso.bounds.RandomRegionBoundsManager;
import pl.edu.pw.mini.gapso.bounds.ResetAllBoundsManager;
public class BoundsManagerConfiguration {
String name;
JsonElement parameters;
public BoundsManagerConfiguration(String name, JsonElement parameters) {
this.name = name;
this.parameters = parameters;
}
public String getName() {
return name;
}
public JsonElement getParameters() {
return parameters;
}
public BoundsManager getBoundsManager() {
if (getName().equals(GlobalModelBoundsManager.NAME)) {
return new GlobalModelBoundsManager(this);
}
if (getName().equals(ResetAllBoundsManager.NAME)) {
return new ResetAllBoundsManager(this);
}
if (getName().equals(RandomRegionBoundsManager.NAME)) {
return new RandomRegionBoundsManager(this);
}
throw new IllegalArgumentException("Unknown initializer " + getName());
}
}
|
/**
* Engine / Window
*/
package edu.self.engine;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* Window Class
*/
public class Window implements FocusListener {
/**
* Components
*/
private Engine engine;
private Debug debug;
private JFrame frame;
private JPanel panel;
/**
* Constructor
*/
public Window(Engine engine) {
this.engine = engine;
debug = new Debug(this.engine, this.getClass().getName());
this.engine.settings().defer("window.title", "Engine");
frame = null;
panel = null;
}
/**
* Controls
*/
// Invocator
public void start() {
frame = new JFrame(engine.settings().get("window.title"));
panel = new JPanel();
frame.add(panel);
frame.pack();
frame.setVisible(true);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.setEnabled(true);
panel.setFocusable(true);
panel.addFocusListener(this);
}
// Interruptor
public void stop() {
frame.setVisible(false);
frame.remove(panel);
frame.dispose();
}
/**
* FocusListener Operations
*/
@Override
public void focusGained(FocusEvent event) {
debug.info("Window focused");
}
@Override
public void focusLost(FocusEvent event) {
debug.info("Window blurred");
}
/**
* Accessors and Modifiers
*/
// Components
public JFrame frame() {
return frame;
}
public JPanel panel() {
return panel;
}
}
|
package br.com.jcomputacao.com.cupomRepresentacao;
/**
*
* @author Odair
*/
public enum TipoRelatorioMFD {
MESTRE(1), ANALITICO(2), DIARIO(4), ITEM(8), MENSAL(16), TIPO_75(32);
private int codigo;
TipoRelatorioMFD(int codigo) {
this.codigo = codigo;
}
public int getCodigo() {
return this.codigo;
}
}
|
package fr.projetcookie.boussole;
import android.content.Context;
import android.content.SharedPreferences;
import android.hardware.GeomagneticField;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.location.Location;
import android.widget.Toast;
import com.google.android.gms.location.LocationListener;
import fr.projetcookie.boussole.providers.BaloonPositionFromServer;
import fr.projetcookie.boussole.providers.BaloonPositionFromSettings;
import fr.projetcookie.boussole.providers.BaloonPositionProvider;
import fr.projetcookie.boussole.providers.BaloonPositionTest;
public class DataManager implements SensorEventListener, LocationListener{
public BaloonPositionProvider mProvider;
public Location mLastLocation= new Location("");
public float direction=0;
private DirectionUpdateListener mListener;
private float[] mGravity = new float[3];
private float[] mGeomagnetic = new float[3];
private SensorManager sensorManager;
private Sensor gsensor;
private Sensor msensor;
private boolean positionUpdated=false;
private Context mContext;
private boolean dataFromServer;
private double lat;
private String serverUri;
private double lon;
private GeomagneticField geoField;
public DataManager(Context context, DirectionUpdateListener listener) {
mContext = context;
mListener = listener;
sensorManager = (SensorManager) context
.getSystemService(Context.SENSOR_SERVICE);
gsensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
msensor = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
getSettings();
}
public void start() {
if(dataFromServer) {
mProvider = new BaloonPositionFromServer(5000, serverUri);
Toast.makeText(mContext, "Getting data from server", Toast.LENGTH_SHORT).show();
}
else {
mProvider = new BaloonPositionFromSettings(lat, lon);
Toast.makeText(mContext, "Getting data from settings", Toast.LENGTH_SHORT).show();
}
mProvider.start();
sensorManager.registerListener(this, gsensor, SensorManager.SENSOR_DELAY_NORMAL);
sensorManager.registerListener(this, msensor, SensorManager.SENSOR_DELAY_NORMAL);
}
public void stop() {
sensorManager.unregisterListener(this);
mProvider.stahp();
}
public void getSettings() {
SharedPreferences settings = mContext.getSharedPreferences("Cookie", 0);
dataFromServer = settings.getBoolean("dataFromServer", true);
serverUri = settings.getString("serverUri", "http://<server.tld>/Cookie-WebUI-Server/");
lat = settings.getFloat("lat", 0);
lon = settings.getFloat("lon", 0);
}
public void invalidateSettings() {
getSettings();
stop();
start();
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
@Override
public void onSensorChanged(SensorEvent event) {
final float alpha = 0.97f;
synchronized (this) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
mGravity[0] = alpha * mGravity[0] + (1 - alpha)
* event.values[0];
mGravity[1] = alpha * mGravity[1] + (1 - alpha)
* event.values[1];
mGravity[2] = alpha * mGravity[2] + (1 - alpha)
* event.values[2];
}
if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
mGeomagnetic[0] = alpha * mGeomagnetic[0] + (1 - alpha)
* event.values[0];
mGeomagnetic[1] = alpha * mGeomagnetic[1] + (1 - alpha)
* event.values[1];
mGeomagnetic[2] = alpha * mGeomagnetic[2] + (1 - alpha)
* event.values[2];
}
float R[] = new float[9];
float I[] = new float[9];
boolean success = SensorManager.getRotationMatrix(R, I, mGravity,
mGeomagnetic);
if (success) {
float orientation[] = new float[3];
SensorManager.getOrientation(R, orientation);
direction = (float) Math.toDegrees(orientation[0]); // orientation
direction = (direction + 360) % 360;
if(positionUpdated)
updateDirection();
}
}
}
@Override
public void onLocationChanged(Location location) {
positionUpdated=true;
mLastLocation=location;
geoField = new GeomagneticField(
(float) mLastLocation.getLatitude(),
(float) mLastLocation.getLongitude(),
(float) mLastLocation.getAltitude(),
System.currentTimeMillis());
updateDirection();
}
private void updateDirection() {
direction += geoField.getDeclination();
float bearing = mLastLocation.bearingTo(mProvider.getLocation());
mListener.onDirectionUpdate(direction - bearing);
}
}
|
import java.util.*;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class DisplayHotel extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
String url="jdbc:mysql://localhost:3306/register";
String con="com.mysql.jdbc.Driver";
Connection cn=null;
try{
Class.forName(con);
cn=DriverManager.getConnection(url,"root","");
String sql="select * from hotel";
Statement stat=cn.createStatement();
ResultSet rs=stat.executeQuery(sql);
List<HotelDto> hotels=new ArrayList<HotelDto>();
while(rs.next()){
HotelDto hotel =new HotelDto();
hotel.setHid(rs.getString("HotelId"));
hotel.setHname(rs.getString("HotelName"));
hotel.setHaddress(rs.getString("HotelAddress"));
hotels.add(hotel);
}
request.setAttribute("hh",hotels);
RequestDispatcher rd=request.getRequestDispatcher("/displayhotel.jsp");
rd.include(request,response);
}catch(Exception e){
System.out.println("Exception!!!"+e);
}
}
}
|
package OOPS;
public class Inher2 extends Inher1{
public Inher2() {
System.out.println("m2 is started");
}
public void m1() {
System.out.println("2");
}
}
|
package edu.uci.ics.sdcl.firefly.report.predictive;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Stack;
import edu.uci.ics.sdcl.firefly.Worker;
import edu.uci.ics.sdcl.firefly.WorkerSession;
import edu.uci.ics.sdcl.firefly.report.descriptive.FileConsentDTO;
import edu.uci.ics.sdcl.firefly.report.descriptive.FileSessionDTO;
/**
* Filter workers by the time they took the microtask.
*
* 25% first workers
* 50% first workers
* 25% last workers
* 50% last workers
*
* @author adrianoc
*
*/
public class FirstRepondersAnalysis {
String path;
public FirstRepondersAnalysis(){
path = "c:\\firefly\\ResponseAnalysis\\dataResponse\\";
}
/**
* Returns the worker who divides the workers in the middle. Only count
* workers who have taken at least one microtask.
*
* @param position the last worker that should be accounted
* @return workerID
*/
public HashMap<String, Worker> buildFirstResponderMap(int position){
HashMap<String, Worker> countWorkerMap = new HashMap<String, Worker>();
FileSessionDTO sessionDTO = new FileSessionDTO();
HashMap<String, WorkerSession> workerSessionMap = (HashMap<String, WorkerSession>) sessionDTO.getSessions();
FileConsentDTO consentDTO = new FileConsentDTO();
HashMap<String, Worker> workerMap = consentDTO.getWorkers();
Iterator<String> sessionIterator = workerSessionMap.keySet().iterator();
while(sessionIterator.hasNext() && countWorkerMap.size()<position){
String sessionID = sessionIterator.next();
WorkerSession session = workerSessionMap.get(sessionID);
if(session.getMicrotaskListSize()>0){
String workerID = session.getWorkerId();
Worker worker = workerMap.get(workerID);
countWorkerMap.put(workerID,worker);
}
}
int size = countWorkerMap.size();
System.out.println("countWorkerMap size: "+size+", position: "+position);
return countWorkerMap;
}
/**
*
*
* @param position the last worker that should be accounted
* @return workerID
*/
public HashMap<String, Worker> buildFromLastFirstResponderMap(int position){
HashMap<String, Worker> countWorkerMap = new HashMap<String, Worker>();
FileSessionDTO sessionDTO = new FileSessionDTO();
HashMap<String, WorkerSession> workerSessionMap = (HashMap<String, WorkerSession>) sessionDTO.getSessions();
FileConsentDTO consentDTO = new FileConsentDTO();
HashMap<String, Worker> workerMap = consentDTO.getWorkers();
Stack<String> sessionStack = new Stack<String>();
Iterator<String> sessionIterator = workerSessionMap.keySet().iterator();
while(sessionIterator.hasNext() && countWorkerMap.size()<position){
String sessionID = sessionIterator.next();
sessionStack.push(sessionID);
}
while(!sessionStack.isEmpty() && countWorkerMap.size()<position){
String sessionID = sessionStack.pop();
WorkerSession session = workerSessionMap.get(sessionID);
if(session.getMicrotaskListSize()>0){
String workerID = session.getWorkerId();
Worker worker = workerMap.get(workerID);
countWorkerMap.put(workerID,worker);
}
}
int size = countWorkerMap.size();
System.out.println("countWorkerMap size: "+size+", position: "+position);
return countWorkerMap;
}
//filter Session-log
public void filterLog(HashMap<String, Worker> workerMap, String sourceFileName, String destFileName){
ArrayList<String> sessionLogList = this.readToBuffer(sourceFileName);
ArrayList<String> processedList = new ArrayList<String>();
for(String line:sessionLogList){
if(lineContainsValidWorker(line,workerMap))
processedList.add(line);
}
this.writeBackToBuffer(processedList, destFileName);
}
private boolean lineContainsValidWorker(String line,HashMap<String, Worker> workerMap ){
for(String workerID : workerMap.keySet()){
if(line.contains(workerID)){
return true;
}
}
return false;
}
/**
* Flush the buffer back to the file
* @param newBuffer
* @param destFileName
*/
private void writeBackToBuffer(ArrayList<String> newBuffer, String destFileName){
String destination = path + destFileName;
BufferedWriter log;
try {
log = new BufferedWriter(new FileWriter(destination));
for(String line : newBuffer)
log.write(line+"\n");
log.close();
}
catch (Exception e) {
System.out.println("ERROR while processing file:" + destination);
e.printStackTrace();
}
}
/** Load all the file into a StringBuffer */
private ArrayList<String> readToBuffer( String sessionLog){
ArrayList<String> buffer = new ArrayList<String>();
BufferedReader log;
try {
log = new BufferedReader(new FileReader(path + sessionLog));
String line = null;
while ((line = log.readLine()) != null) {
buffer.add(line);
}
log.close();
return buffer;
}
catch (Exception e) {
System.out.println("ERROR while processing file:" + path+sessionLog);
e.printStackTrace();
return null;
}
}
public static void main(String[] args){
String sessionLog = "session-log_consolidated_final.txt";
String sessionLogNew = "session-log_consolidated_2nd-25percentWorkers.txt";
String consetLog = "consent-log_consolidated_final.txt";
String consentLogNew = "consent-log_consolidated_2nd-25percentWorkers.txt";
FirstRepondersAnalysis responders = new FirstRepondersAnalysis();
HashMap<String, Worker> workerMap = responders.buildFromLastFirstResponderMap(128);
responders.filterLog(workerMap,sessionLog, sessionLogNew);
responders.filterLog(workerMap,consetLog, consentLogNew);
}
}
|
package fr.capwebct.capdemat.plugins.csvimporters.concerto.service;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import fr.capwebct.capdemat.plugins.csvimporters.concerto.business.ConcertoLine;
import fr.cg95.cvq.authentication.IAuthenticationService;
import fr.cg95.cvq.business.authority.School;
import fr.cg95.cvq.business.request.LocalReferentialData;
import fr.cg95.cvq.business.request.RequestState;
import fr.cg95.cvq.business.request.ecitizen.VoCardRequest;
import fr.cg95.cvq.business.request.school.PerischoolActivityRegistrationRequest;
import fr.cg95.cvq.business.request.school.SchoolCanteenRegistrationRequest;
import fr.cg95.cvq.business.request.school.SchoolRegistrationRequest;
import fr.cg95.cvq.business.users.Address;
import fr.cg95.cvq.business.users.Adult;
import fr.cg95.cvq.business.users.Child;
import fr.cg95.cvq.business.users.HomeFolder;
import fr.cg95.cvq.business.users.Individual;
import fr.cg95.cvq.business.users.RoleType;
import fr.cg95.cvq.business.users.TitleType;
import fr.cg95.cvq.exception.CvqException;
import fr.cg95.cvq.service.authority.ISchoolService;
import fr.cg95.cvq.service.importer.ICsvImportProviderService;
import fr.cg95.cvq.service.request.IRequestWorkflowService;
import fr.cg95.cvq.service.users.IHomeFolderService;
import fr.cg95.cvq.util.mail.IMailService;
public final class ConcertoCsvImportService implements ICsvImportProviderService {
private static Logger logger = Logger.getLogger(ConcertoCsvImportService.class);
private String label;
private Boolean enableSummaryEmail;
private String[] summaryEmailRecipients;
private byte[] xmlMappingData;
private byte[] formatterConfigurationData;
private IHomeFolderService homeFolderService;
private IAuthenticationService authenticationService;
private IMailService mailService;
private ISchoolService schoolService;
private IRequestWorkflowService requestWorkflowService;
public void init() {
logger.debug("init() loading mapping and formatter configuration data");
xmlMappingData = loadStreamData("/csv-mapping.xml");
formatterConfigurationData = loadStreamData("/csv-formatter.xml");
}
private byte[] loadStreamData(final String path) {
InputStream inputStream = getClass().getResourceAsStream(path);
byte[] inputStreamData = new byte[1024];
int bytesRead;
ByteArrayOutputStream baos = null;
try {
baos = new ByteArrayOutputStream(inputStream.available());
do {
bytesRead = inputStream.read(inputStreamData);
if (bytesRead > 0)
baos.write(inputStreamData, 0, bytesRead);
} while (bytesRead > 0);
inputStream.close();
baos.close();
} catch (IOException e1) {
logger.error("Unable to load " + path);
throw new RuntimeException();
}
return baos.toByteArray();
}
public byte[] getFormatterConfigurationData() {
return formatterConfigurationData;
}
public byte[] getXmlMappingData() {
return xmlMappingData;
}
public void importData(List<Object> parsedLines) throws CvqException {
logger.debug("importData() Got " + parsedLines.size() + " lines");
Map<Long, List<ConcertoLine> > homeFoldersData =
new HashMap<Long, List<ConcertoLine>>();
// go through each parsed CSV line and organize them by concerto ids
logger.info("importData() Starting CSV data parsing");
for (Object bean : parsedLines) {
final ConcertoLine concertoLine = (ConcertoLine) bean;
if (homeFoldersData.get(concertoLine.getIdConcerto()) != null) {
List<ConcertoLine> homeFolderLines =
homeFoldersData.get(concertoLine.getIdConcerto());
logger.debug("importData() Adding line to concerto id "
+ concertoLine.getIdConcerto());
homeFolderLines.add(concertoLine);
} else {
logger.debug("importData() Creating line for concerto id "
+ concertoLine.getIdConcerto());
List<ConcertoLine> homeFolderLines = new ArrayList<ConcertoLine>();
homeFolderLines.add(concertoLine);
homeFoldersData.put(concertoLine.getIdConcerto(), homeFolderLines);
}
}
StringBuffer mailBody = new StringBuffer();
StringBuffer homeFoldersDetailsBody = new StringBuffer();
logger.info("importData() Starting to import parsed CSV data");
logger.info("importData() # of different home folders : " + homeFoldersData.size());
mailBody.append("Nombre de foyers lus dans le fichier d'import : ")
.append(homeFoldersData.size()).append("\n");
int createdHomeFolders = 0;
List<Long> rejectedConcertoIds = new ArrayList<Long>();
for (Long concertoId : homeFoldersData.keySet()) {
logger.debug("importData() Dealing with concerto id " + concertoId);
List<ConcertoDataTransfertObject> stackedHomeFolders =
new ArrayList<ConcertoDataTransfertObject>();
// go through data extracted from CSV file and organize them
boolean isLineValid = true;
for (ConcertoLine concertoLine : homeFoldersData.get(concertoId)) {
// check validity of home folder responsible information
Adult currentHomeFolderResponsible = concertoLine.getHomeFolderResponsible();
if (!isValidIndividual(currentHomeFolderResponsible)) {
logger.error("importData() Invalid home folder responsible "
+ "(missing last or first name) "
+ ", aborting import of line " + concertoId);
isLineValid = false;
break;
}
// set home folder's address if not yet done
Address currentAddress = concertoLine.getHomeFolderResponsible().getAdress();
ConcertoDataTransfertObject cdto =
getStackedHomeFolderByAddress(stackedHomeFolders, currentAddress);
if (cdto == null) {
cdto = new ConcertoDataTransfertObject();
cdto.setAddress(currentAddress);
homeFolderService.addHomeFolderRole(currentHomeFolderResponsible,
RoleType.HOME_FOLDER_RESPONSIBLE);
currentHomeFolderResponsible.setPassword(authenticationService.generatePassword());
cdto.setHomeFolderResponsible(currentHomeFolderResponsible);
cdto.getAdults().add(currentHomeFolderResponsible);
stackedHomeFolders.add(cdto);
} else {
// FIXME : check home folder responsible correct match
}
Child child = concertoLine.getChild();
addLegalResponsibleToChild(child, currentHomeFolderResponsible);
cdto.getChildren().add(child);
// get or create associated school
School school = getSchool(concertoLine.getSchoolName());
// queue the child school registration
SchoolRegistrationRequest srr = concertoLine.getSrr();
srr.setSubjectId(child.getId());
srr.setRulesAndRegulationsAcceptance(Boolean.TRUE);
srr.setSchool(school);
cdto.getChildrenSchoolRegistrations().add(srr);
// queue the child for upcoming school canteen registration
if (concertoLine.isRegisteredToSchoolCanteen()) {
SchoolCanteenRegistrationRequest scrr = concertoLine.getScrr();
scrr.setSubjectId(child.getId());
scrr.setHospitalizationPermission(Boolean.TRUE);
scrr.setRulesAndRegulationsAcceptance(Boolean.TRUE);
scrr.setSchool(school);
cdto.getChildrenSchoolCanteenRegistrations().add(scrr);
}
// queue the child for upcoming perischool activity registration
if (concertoLine.isRegisteredToPerischoolActivity()) {
PerischoolActivityRegistrationRequest parr =
new PerischoolActivityRegistrationRequest();
parr.setSubjectId(child.getId());
parr.setHospitalizationPermission(Boolean.TRUE);
parr.setRulesAndRegulationsAcceptance(Boolean.TRUE);
parr.setChildPhotoExploitationPermission(Boolean.TRUE);
parr.setClassTripPermission(Boolean.TRUE);
List<LocalReferentialData> perischoolActivities =
new ArrayList<LocalReferentialData>();
LocalReferentialData lrdEvening = new LocalReferentialData();
lrdEvening.setName("EveningNursery");
perischoolActivities.add(lrdEvening);
LocalReferentialData lrdMorning = new LocalReferentialData();
lrdMorning.setName("MorningNursery");
perischoolActivities.add(lrdMorning);
LocalReferentialData lrdMorningEvening = new LocalReferentialData();
lrdMorningEvening.setName("MorningAndEveningNursery");
perischoolActivities.add(lrdMorningEvening);
parr.setPerischoolActivity(perischoolActivities);
cdto.getChildrenPerischoolActivityRegistrations().add(parr);
}
Adult otherHomeFolderAdult = concertoLine.getOtherHomeFolderAdult();
if (!isValidIndividual(otherHomeFolderAdult)) {
logger.warn("importData() Invalid or absent other home folder adult "
+ "(missing last or first name), ignoring it");
} else {
Adult otherHomeFolderAdultCopy =
getAdultCopyFromAdults(cdto.getAdults(), otherHomeFolderAdult);
if (otherHomeFolderAdultCopy == null) {
otherHomeFolderAdult.setPassword(authenticationService.generatePassword());
cdto.getAdults().add(otherHomeFolderAdult);
addLegalResponsibleToChild(child, otherHomeFolderAdult);
} else {
addLegalResponsibleToChild(child, otherHomeFolderAdultCopy);
}
}
if (concertoLine.getFamilyQuotient() != null)
cdto.setFamilyQuotient(concertoLine.getFamilyQuotient());
}
if (!isLineValid) {
logger.warn("importData() Ignoring entry with concerto id : " + concertoId);
rejectedConcertoIds.add(concertoId);
continue;
}
for (ConcertoDataTransfertObject cdto : stackedHomeFolders) {
Adult homeFolderResponsible = cdto.getHomeFolderResponsible();
// keep the clear password for the summary email report
String clearPassword = homeFolderResponsible.getPassword();
// create an home folder through account creation request
VoCardRequest voCardRequest = new VoCardRequest();
requestWorkflowService.createAccountCreationRequest(voCardRequest, cdto.getAdults(),
cdto.getChildren(), null, cdto.getAddress(), null, null);
HomeFolder homeFolder = homeFolderService.getById(voCardRequest.getHomeFolderId());
// if known, add family quotient information to home folder
String familyQuotient = cdto.getFamilyQuotient();
if (familyQuotient != null && !familyQuotient.equals("")) {
homeFolder.setFamilyQuotient(familyQuotient);
logger.debug("importData() Setting family quotient to " + familyQuotient
+ " for home folder " + homeFolder.getId());
homeFolderService.modify(homeFolder);
}
// create school registrations
for (SchoolRegistrationRequest srr : cdto.getChildrenSchoolRegistrations()) {
requestWorkflowService.create(srr, null, null, null);
requestWorkflowService.updateRequestState(srr.getId(),
RequestState.COMPLETE, null);
requestWorkflowService.updateRequestState(srr.getId(),
RequestState.VALIDATED, null);
logger.debug("importData() created school registration request : " + srr.getId());
}
// create school canteen registrations
for (SchoolCanteenRegistrationRequest scrr : cdto.getChildrenSchoolCanteenRegistrations()) {
requestWorkflowService.create(scrr, null, null, null);
logger.debug("importData() created school canteen registration request : "
+ scrr.getId());
}
// create perischool activity registrations
for (PerischoolActivityRegistrationRequest parr : cdto.getChildrenPerischoolActivityRegistrations()) {
requestWorkflowService.create(parr, null, null, null);
logger.debug("importData() created perischool activity registration request : "
+ parr.getId());
}
createdHomeFolders++;
homeFoldersDetailsBody.append("Foyer : \n")
.append("\tIdentifiant Concerto : ").append(concertoId).append("\n")
.append("\tIdentitiant CapDémat : ").append(homeFolder.getId()).append("\n")
.append("\tResponsable Foyer : ").append(homeFolderResponsible.getFirstName())
.append(" ").append(homeFolderResponsible.getLastName()).append("\n")
.append("\t\tLogin : ").append(homeFolderResponsible.getLogin()).append("\n")
.append("\t\tMot de passe : ").append(clearPassword)
.append("\n\n");
}
}
logger.info("importData() Created " + createdHomeFolders + " home folders");
mailBody.append("Nombre de foyers crées : ")
.append(createdHomeFolders).append("\n");
mailBody.append("Nombre d'entrées rejetées : ").append(rejectedConcertoIds.size());
if (rejectedConcertoIds.size() > 0) {
mailBody.append("\n").append("Détail des entrées rejetées : \n");
for (Long concertoId : rejectedConcertoIds) {
mailBody.append("\tConcerto Id : ").append(concertoId).append("\n");
}
}
mailBody.append("\n\n\n");
if (enableSummaryEmail) {
logger.debug("importData() Gonna send summary email to : ");
for (String email : summaryEmailRecipients) {
logger.debug("\t" + email);
try {
mailService.send(null, email, null, "Rapport d'import des données Concerto",
mailBody.toString() + homeFoldersDetailsBody.toString());
} catch (CvqException e) {
logger.error("importData() Unable to send summary email ", e);
}
}
}
}
// TODO Better refactor this, to respect Address Normalisation
private ConcertoDataTransfertObject getStackedHomeFolderByAddress(List<ConcertoDataTransfertObject> stackedHomeFolders,
Address address) {
if (address == null)
return null;
for (ConcertoDataTransfertObject cdto : stackedHomeFolders) {
Address cdtoAddress = cdto.getAddress();
if (cdtoAddress == null)
return null;
if (cdtoAddress.getStreetNumber().equals(address.getStreetNumber())
&& cdtoAddress.getStreetName().equals(address.getStreetName())
&& cdtoAddress.getPostalCode().equals(address.getPostalCode())) {
logger.debug("isHomeFolderAlreadyStacked() Address found in stacked home folders");
return cdto;
}
}
return null;
}
private boolean isValidIndividual(Individual individual) {
// special case for Poitiers : I.D.E.F is an organism that takes care
// of children
if ((individual.getFirstName() == null || individual.getFirstName().equals(""))
&& individual.getLastName().equals("I.D.E.F"))
return true;
if (individual.getFirstName() == null
|| individual.getFirstName().trim().length() == 0
|| individual.getLastName() == null
|| individual.getLastName().trim().length() == 0)
return false;
return true;
}
private void addLegalResponsibleToChild(Child child, Adult adult) throws CvqException {
if (adult.getTitle().equals(TitleType.MISTER)) {
homeFolderService.addIndividualRole(adult, child, RoleType.CLR_FATHER);
} else if (adult.getTitle().equals(TitleType.MADAM)
|| adult.getTitle().equals(TitleType.MISS)) {
homeFolderService.addIndividualRole(adult, child, RoleType.CLR_MOTHER);
} else {
homeFolderService.addIndividualRole(adult, child, RoleType.CLR_TUTOR);
}
}
private Adult getAdultCopyFromAdults(List<Adult> adults, Adult adult) {
for (Adult tempAdult : adults) {
if ((tempAdult.getLastName() != null
&& tempAdult.getLastName().equals(adult.getLastName()))
&& (tempAdult.getFirstName() != null
&& tempAdult.getFirstName().equals(adult.getFirstName()))) {
return tempAdult;
}
}
return null;
}
private School getSchool(final String schoolName) {
School school = schoolService.getByName(schoolName);
if (school == null) {
logger.info("getSchool() school " + schoolName + " not found, creating it");
school = new School();
school.setActive(Boolean.TRUE);
school.setName(schoolName);
schoolService.create(school);
}
return school;
}
private class ConcertoDataTransfertObject {
private List<Child> children = new ArrayList<Child>();
private List<Adult> adults = new ArrayList<Adult>();
private Set<SchoolCanteenRegistrationRequest> childrenSchoolCanteenRegistrations =
new HashSet<SchoolCanteenRegistrationRequest>();
private Set<SchoolRegistrationRequest> childrenSchoolRegistrations =
new HashSet<SchoolRegistrationRequest>();
private Set<PerischoolActivityRegistrationRequest> childrenPerischoolActivityRegistrations =
new HashSet<PerischoolActivityRegistrationRequest>();
private Address address = null;
private String familyQuotient = null;
private Adult homeFolderResponsible = null;
public ConcertoDataTransfertObject() {
}
public final Address getAddress() {
return address;
}
public final void setAddress(Address address) {
this.address = address;
}
public final List<Adult> getAdults() {
return adults;
}
public final void setAdults(List<Adult> adults) {
this.adults = adults;
}
public final List<Child> getChildren() {
return children;
}
public final void setChildren(List<Child> children) {
this.children = children;
}
public final Set<SchoolCanteenRegistrationRequest> getChildrenSchoolCanteenRegistrations() {
return childrenSchoolCanteenRegistrations;
}
public final void setChildrenSchoolCanteenRegistrations(
Set<SchoolCanteenRegistrationRequest> childrenSchoolCanteenRegistrations) {
this.childrenSchoolCanteenRegistrations = childrenSchoolCanteenRegistrations;
}
public final Set<SchoolRegistrationRequest> getChildrenSchoolRegistrations() {
return childrenSchoolRegistrations;
}
public final void setChildrenSchoolRegistrations(
Set<SchoolRegistrationRequest> childrenSchoolRegistrations) {
this.childrenSchoolRegistrations = childrenSchoolRegistrations;
}
public final String getFamilyQuotient() {
return familyQuotient;
}
public final void setFamilyQuotient(String familyQuotient) {
this.familyQuotient = familyQuotient;
}
public final Adult getHomeFolderResponsible() {
return homeFolderResponsible;
}
public final void setHomeFolderResponsible(Adult homeFolderResponsible) {
this.homeFolderResponsible = homeFolderResponsible;
}
public Set<PerischoolActivityRegistrationRequest> getChildrenPerischoolActivityRegistrations() {
return childrenPerischoolActivityRegistrations;
}
public void setChildrenPerischoolActivityRegistrations(
Set<PerischoolActivityRegistrationRequest> perischoolActivityRegistrations) {
this.childrenPerischoolActivityRegistrations = perischoolActivityRegistrations;
}
}
public final String getLabel() {
return label;
}
public final void setLabel(String label) {
this.label = label;
}
public final void setHomeFolderService(IHomeFolderService homeFolderService) {
this.homeFolderService = homeFolderService;
}
public void setRequestWorkflowService(IRequestWorkflowService requestWorkflowService) {
this.requestWorkflowService = requestWorkflowService;
}
public final void setAuthenticationService(IAuthenticationService authenticationService) {
this.authenticationService = authenticationService;
}
public final void setMailService(IMailService mailService) {
this.mailService = mailService;
}
public final void setEnableSummaryEmail(Boolean enableSummaryEmail) {
this.enableSummaryEmail = enableSummaryEmail;
}
public final void setSummaryEmailRecipients(String[] summaryEmailRecipients) {
this.summaryEmailRecipients = summaryEmailRecipients;
}
public void setSchoolService(ISchoolService schoolService) {
this.schoolService = schoolService;
}
}
|
package fileMerge;
import java.io.File;
public class TestMergeFile {
public static void main(String[] args) throws Exception {
//File file = new File(TestMergeFile.class.getResource(""));
String path = new File("").getAbsoluteFile().toString()+"\\io\\src\\main\\resource\\childrenFile3";
String path2 = new File("").getAbsoluteFile().toString()+"\\io\\src\\main\\resource";
File file = new File(path);
/*File[] files = file.listFiles();
File mergeFile = new File(path2,"file_merge");
FileOutputStream outputStream = new FileOutputStream(mergeFile, true);//文件追加写入
byte[] byt = new byte[10 * 1024 * 1024];
FileInputStream temp = null;//分片文件
for (File item : files) {
temp = new FileInputStream(item);
int len;
while ((len = temp.read(byt)) != -1) {
outputStream.write(byt, 0, len);
}
}
temp.close();
outputStream.close();
System.out.println(mergeFile.delete());*/
/* if(file.isDirectory()){
File[] files = file.listFiles();
for (File item : files) {
item.delete();
}
}
file.delete();*/
}
}
|
package cn.izouxiang.dao.impl;
import org.springframework.stereotype.Repository;
import cn.izouxiang.domain.Member;
import cn.izouxiang.dao.MemberDao;
import cn.izouxiang.dao.base.impl.BaseMongoDaoImpl;
@Repository
public class MemberDaoImpl extends BaseMongoDaoImpl<Member> implements MemberDao {
}
|
package com.deltastuido.user.service;
import java.util.List;
import java.util.Optional;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import com.deltastuido.user.AddressService;
import com.deltastuido.user.UserAddress;
import javax.ws.rs.core.UriBuilder;
//TODO 用户验证,filter还是interceptor呢。。
@Stateless
@Path("/user/{userId}/address")
@Produces({ "application/json; charset=utf-8" })
@Consumes({ "application/xml", "application/json" })
public class UserAddressEndpoint {
@EJB
private AddressService addressService;
@POST
public Response create(@PathParam("userId") String u, UserAddress address) {
// SiteUserAddress adds = new SiteUserAddress(address);
Optional<UserAddress> created = addressService.createUserAddress(u, address);
if (created.isPresent()) {
UserAddress addr = created.get();
return Response.created(UriBuilder.fromResource(UserAddressEndpoint.class).path("{addressId}")
.build(addr.getUser(), addr.getId())).build();
}
return Response.status(Status.BAD_REQUEST).build();
}
@GET
public List<UserAddress> findAll(@PathParam("userId") String u) {
return addressService.getUserAddressList(u);
}
@PUT
@Path("/{addressId}")
public Response update(@PathParam("userId") String u, @PathParam("addressId") String addressId,
UserAddress address) {
addressService.upateUserAddress(u, addressId, address);
Optional<UserAddress> a = addressService.getUserAddress(u, addressId);
if (a.isPresent()) {
return Response.ok(a.get()).build();
}
return Response.status(Status.BAD_REQUEST).build();
}
@GET
@Path("/{addressId}")
public UserAddress find(@PathParam("userId") String u, @PathParam("addressId") String addressId) {
Optional<UserAddress> a = addressService.getUserAddress(u, addressId);
if (a.isPresent()) {
return a.get();
}
throw new IllegalStateException("地址不存在");
}
@DELETE
@Path("/{addressId}")
public void delete(@PathParam("userId") String u, @PathParam("addressId") String addressId) {
addressService.deleteUserAddress(u, addressId);
}
}
|
package com.mindviewinc.chapter15.sample.coffee;
//: generics/coffee/Mocha.java
public class Mocha extends Coffee {} ///:~
|
package com.example.administrator.hyxdmvp;
public class NetWorkUrl {
}
|
package LinkedList;
import util.swap;
/**
* @author admin
* @version 1.0.0
* @ClassName huafengList.java
* @Description 将单向链表按某值划分成左边小、中间相等、右边大的形式
*
*
* 题目描述 1:
* * 给定一个单向链表的头节点 head,在给定一个整数 pivot,实现一个调整链表的函数。
* * 将链表调整为左部分的值都是小于 pivot 的节点,中间都是等于 pivot 的节点,右部分的值都是大于 pivot 的部分。
* *
* * 题目描述 2 (进阶):
* * 使该算法具有稳定性(相对顺序和之前一样),时间复杂度为 O(N),额外空间复杂度为 O(1)
* *
* * 思路 1:
* * 开一个节点类型的数组,使用荷兰国旗问题后,再将其串成链表即可。
* *
* * 思路 2:
* * 1. 设置三个 node 类型的变量:less、equal、more;
* * 2. 遍历一遍链表,将第一个小于 pivot 的节点给 less,将第一个等于 pivot 的节点给 equal,将第一个大于 pivot 的节点给 more;
* * 3. 再遍历一遍链表,同时将不同的值放进不同的区域中,然后串起来;
* * 4. 最后将“小于区域”的尾部与“等于区域”的头部重连,将“等于区域”的尾部与“大于区域”的头部重连即可;
* * 5. 相当于将一个大连表拆分成三个小链表,然后将这三个小链表重新串起来。
*
* @createTime 2021年02月27日 10:41:00
*/
public class huafengList {
public static void main(String[] args) {
ListNode node1 = new ListNode(3);
node1.next = new ListNode(2);
node1.next.next = new ListNode(5);
node1.next.next.next = new ListNode(1);
node1.next.next.next.next = new ListNode(5);
node1.next.next.next.next.next = new ListNode(7);
node1.next.next.next.next.next.next = new ListNode(11);
System.out.println("数组法处理之前 ");
printLinkedList(node1);
System.out.println("数组法处理之后 ");
usePartition(node1, 5);
printLinkedList(node1);
ListNode node2 = new ListNode(3);
node2.next = new ListNode(2);
node2.next.next = new ListNode(5);
node2.next.next.next = new ListNode(1);
node2.next.next.next.next = new ListNode(5);
node2.next.next.next.next.next = new ListNode(7);
node2.next.next.next.next.next.next = new ListNode(11);
node2.next.next.next.next.next.next.next = new ListNode(1);
System.out.println("6指针法处理之前 ");
printLinkedList(node2);
System.out.println("6指针法处理之后 ");
//use6Point(node2, 5); //Linked List: 3 2 1 5 5 7 11
//use6Point(node2, 11); //Linked List: 3 2 5 1 5 7 11
//use6Point(node2, 4);//Linked List: 3 2 1 5 5 7 11
use6Point(node2, 1); ///////有bug
printLinkedList(node2);
}
//法1 先转为数组,再用partition的思路
public static ListNode usePartition(ListNode head, int pivot){
if(head == null || head.next == null){
return head;
}
ListNode curr = head;
int i = 0;
//统计节点的个数
while (curr != null){
i++;
curr = curr.next;
}
//建立一个链表的数组,长度为之前的个数
ListNode[] list = new ListNode[i];
int j = 0;
curr = head;
//填充链表数组
for (j = 0;j != list.length;j++){
list[j] = curr;
curr = curr.next;
}
//使用荷兰国旗partition的方法对数据划分为 <=>三个部分
LinlistParitition(list,pivot);
//划分完后要将数组中的链表再串起来
for (i = 1;i != list.length;i++){
list[i - 1].next = list[i]; //i是从1开始的,这种写法要记住
}
//这一步一定不要漏,在处理链表的时候要处理边界问题
//处理最后一个节点
list[i -1].next = null; //这时候i还没有被垃圾回收,i此时为list.length,-1是因为保证数组的长度是0-list.length-1
return list[0]; //返回处理好的head
}
public static void LinlistParitition(ListNode[] list,int pivot){
int less = -1;//这个-1参照之前在letcode上的国旗问题,使得<的边界在初始的左边
int more = list.length;//同上,使得>的边界在初始的右边
int i =0;
while (i<more){
if (list[i].val<pivot){
swap.swap(list,++less,i++);
}else if (list[i].val > pivot){
swap.swap(list,--more,i);
}else {
i++;
}
}
}
//法2 使用6个指针(有限的几个变量,额外空间复杂度为 O(1))来划分三个区域
//将一个大连表拆分成三个小链表,然后将这三个小链表重新串起来
public static ListNode use6Point(ListNode head,int pivot){
if (head == null || head.next ==null){
return head;
}
ListNode smallHead = null;
ListNode smallTail = null;
ListNode equalHead = null;
ListNode equalTail = null;
ListNode moreHead = null;
ListNode moreTail = null;
//临时变量,储存下一个节点,避免链表断开
ListNode nextNode = null;
while (head != null){
nextNode = head.next;
//初始的时候让头结点和链表断开,不过上一步已经储存了,不用担心
head.next = null;
//遍历一遍链表,将第一个小于 pivot 的节点给 less,将第一个等于 pivot 的节点给 equal,将第一个大于 pivot 的节点给 more;
//以下会涉及到很多边界的处理
if (head.val < pivot) {
//如果一开始small区域没有节点,就直接存进去
if (smallHead == null) {
smallHead = head;
smallTail = head;
} else {//否则代表small里已经有其他节点了,那就让尾部接上这个新加的节点,别忘了处理该段的尾指针后移到新节点
smallTail.next = head;
smallTail = head;
}
}else if (head.val == pivot){
if (equalHead == null){
equalHead = head;
equalTail = head;
}else {
equalTail.next = head;
equalTail = head;
}
}else {
if (moreHead == null){
moreHead = head;
moreTail = head;
}else {
moreTail.next = head;
moreTail = head;
}
}
head = nextNode; //利用之前储存的位置后移
}
//划分完后连接small和equal区域
if (smallTail != null){ //small区域内有东西再连接
smallTail.next = equalHead;
//那如果equal内没东西,那equal区域不应该连接,否则会空指针异常,则equalTail直接等于smallTail即可(自己闭环自己,把自己消掉).如果有东西就放着不动
equalTail = equalTail == null ? smallTail : equalTail;
}else if (smallTail == null){ //假如small区域是空,那么就考虑从equal区域的连接
equalTail = equalTail == null ? smallTail : equalTail;
//smallTail.next = equalHead;
printLinkedList(equalHead);
equalTail.next = moreHead;
//return equalHead;
}
// //再连接more,连接more要考虑equal是否为空,more区域空不空无所谓
// if (equalTail !=null){
// equalTail.next = moreHead;
// }
//最后防止返回的结果是个空,再做个判断
if (smallHead == null && equalHead !=null){
return equalHead;
}else if (equalHead == null && smallHead ==null){
return moreHead;
}else {
return smallHead;
}
}
public static void printLinkedList(ListNode head) {
System.out.print("Linked List: ");
while (head != null) {
System.out.print(head.val + " ");
head = head.next;
}
System.out.println();
}
}
|
package com.example.topics.create;
import com.example.topics.core.Topic;
import com.example.topics.core.User;
import lombok.Value;
@Value
public class CreateTopicRequest {
Topic topic;
User user;
}
|
package nyc.c4q.mustafizurmatin.practicalmidtermassessment;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.widget.TextView;
/**
* Created by c4q on 1/16/18.
*/
class Task extends AsyncTask<Integer, Integer, Integer[]> {
TextView textView;
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Integer[] doInBackground(Integer... value) {
//Integer[] integer = value;
value = new Integer[]{100000};
for (int i = 0; i <value.length ; i++) {
this.publishProgress(value);
}
return value;
}
@Override
protected void onProgressUpdate(Integer... progress) {
super.onProgressUpdate(progress);
}
@Override
protected void onPostExecute(Integer[] result) {
super.onPostExecute(result);
textView.findViewById(R.id.loops);
textView.setText("Loops Completed: " + result);
Context context = null;
Intent intent = new Intent(context, LoginActivity.class);
context.startActivity(intent);
((Activity)context).finish();
}
}
|
package com.example.teachx;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.FirebaseApp;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
public class Register extends AppCompatActivity {
Button r,l;
FirebaseAuth auth;
SharedPreferences sharedpreferences;
EditText iemail,ipassword,iphno,icpassword,iname;
public static final String mypreference = "mypref";
public static final String Name = "nameKey";
public static final String Email = "emailKey";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
FirebaseApp.initializeApp(this);
auth = FirebaseAuth.getInstance();
iemail = (EditText)findViewById(R.id.editText2);
ipassword = (EditText)findViewById(R.id.pword);
iphno = (EditText)findViewById(R.id.phno);
icpassword = (EditText)findViewById(R.id.cpword) ;
iname = (EditText)findViewById(R.id.name);
sharedpreferences = getSharedPreferences(mypreference,
Context.MODE_PRIVATE);
if (sharedpreferences.contains(Name)) {
iname.setText(sharedpreferences.getString(Name, ""));
}
if (sharedpreferences.contains(Email)) {
iemail.setText(sharedpreferences.getString(Email, ""));
}
addListenerOnButton();
}
public void save() {
String n = iname.getText().toString();
String e = iemail.getText().toString();
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Name, n);
editor.putString(Email, e);
editor.commit();
}
public void addListenerOnButton() {
final Context context= this;
r= (Button) findViewById(R.id.rbtn);
l= (Button) findViewById(R.id.r2lbtn);
/* r.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent= new Intent(context, login.class);
startActivity(intent);
}
});*/
r.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email=iemail.getText().toString().trim();
String password=ipassword.getText().toString().trim();
String cpassword=icpassword.getText().toString().trim();
final String name=iname.getText().toString().trim();
final String number=iphno.getText().toString().trim();
if(TextUtils.isEmpty(name))
{
Toast.makeText(getApplicationContext(), "Enter Name!", Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(email))
{
Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(password))
{
Toast.makeText(getApplicationContext(), "Enter Password!", Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(cpassword))
{
Toast.makeText(getApplicationContext(), "Enter confirm password!", Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(number))
{
Toast.makeText(getApplicationContext(), "Enter phone number!", Toast.LENGTH_SHORT).show();
return;
}
if(password.length()<6)
{
Toast.makeText(getApplicationContext(), "Password too short!Enter minimum 6 characters", Toast.LENGTH_SHORT).show();
return;
}
if(!password.equals(cpassword))
{
Toast.makeText(getApplicationContext(), "passwords do not match!", Toast.LENGTH_SHORT).show();
return;
}
auth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(Register.this, new OnCompleteListener<AuthResult>() {
public void onComplete(@NonNull Task<AuthResult> task) {
Toast.makeText(Register.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
if (!task.isSuccessful()) {
Toast.makeText(Register.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
} else {
save();
DatabaseReference users = FirebaseDatabase.getInstance().getReference();
FirebaseDatabase database = FirebaseDatabase.getInstance();
String key = database.getReference("Teacher").push().getKey();
DatabaseReference userRef = users.child("Teacher").child(key);
userRef.child("name").setValue(name);
userRef.child("number").setValue(number);
startActivity(new Intent(Register.this, Login.class));
finish();
}
}
});
}
});
l.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent= new Intent(context, Login.class);
startActivity(intent);
}
});
}
}
|
package com.xaut.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.xaut.dao.AccelerationDao;
import com.xaut.daoimpl.AccelerationDaoImpl;
@SuppressWarnings("serial")
public class AccelerationServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
AccelerationDao dao = new AccelerationDaoImpl();
String szImei = request.getParameter("szImei");
List<Double> accx = new ArrayList<Double>();
String temp1 = request.getParameter("X").toString().replace("[", "");
String temp2 = temp1.replace("]", "");
String[] temp3 = temp2.split(",");
for(String temp : temp3){
accx.add(Double.parseDouble(temp.trim()));
}
List<Double> accy = new ArrayList<Double>();
temp1 = request.getParameter("Y").toString().replace("[", "");
temp2 = temp1.replace("]", "");
temp3 = temp2.split(",");
for(String temp : temp3){
accy.add(Double.parseDouble(temp.trim()));
}
List<Double> accz = new ArrayList<Double>();
temp1 = request.getParameter("Z").toString().replace("[", "");
temp2 = temp1.replace("]", "");
temp3 = temp2.split(",");
for(String temp : temp3){
accz.add(Double.parseDouble(temp.trim()));
}
// double x = Double.parseDouble(request.getParameter("X"));
// double y = Double.parseDouble(request.getParameter("Y"));
// double z = Double.parseDouble(request.getParameter("Z"));
List<String> acctime = new ArrayList<String>();
temp1 = request.getParameter("time").toString().replace("[", "");
temp2 = temp1.replace("]", "");
temp3 = temp2.split(",");
for(String temp : temp3){
acctime.add(temp.trim());
}
String action = request.getParameter("action");
String person = request.getParameter("person");
boolean result = dao.Sample(szImei, action, person, accx, accy, accz, acctime);
out.print(result);
out.flush();//清理servlet容器的缓冲区
out.close();//关闭输出流对象,释放输出流资源
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
|
package com.tingke.admin.controller;
import com.tingke.admin.entity.FrLinkCategory;
import com.tingke.admin.model.R;
import com.tingke.admin.service.FrLinkCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 前端控制器
* </p>
*
* @author zhx
* @since 2020-05-31
*/
@Api(value="后台管理“链接分类”管理接口",description = "后台管理“链接分类”管理,增删改查")
@RestController
@RequestMapping("/admin/fr-link-category")
@CrossOrigin
public class FrLinkCategoryController {
@Autowired
private FrLinkCategoryService frLinkCategoryService;
@ApiOperation("快捷链接分类添加")
@GetMapping("/addLinkCategory/{category}")
@ApiImplicitParam(name="category",value = "当前分类",required=true,paramType="path")
public R addLinkCategory(@PathVariable("category")String category){
R responseResult = frLinkCategoryService.addLinkCategory(category);
return responseResult;
}
@ApiOperation("快捷链接分类删除")
@GetMapping("/deleteLinkCategory/{id}")
@ApiImplicitParam(name="id",value = "当前id",required=true,paramType="path")
public R deleteLinkCategory(@PathVariable("id")String id){
R responseResult = frLinkCategoryService.deleteLinkCategory(id);
return responseResult;
}
@ApiOperation("快捷链接分类修改")
@PostMapping("/editLinkCategory")
public R editLinkCategory(@RequestBody FrLinkCategory frLinkCategory){
R responseResult = frLinkCategoryService.editLinkCategory(frLinkCategory);
return responseResult;
}
@ApiOperation("快捷链接分类查询")
@GetMapping("/selectLinkCategory")
public R selectLinkCategory(){
R responseResult = frLinkCategoryService.selectLinkCategory();
return responseResult;
}
}
|
package com.irfandev.project.simplemarket.models;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/**
* created by Irfan Assidiq
* email : assidiq.irfan@gmail.com
**/
public class Barang implements Serializable {
@SerializedName("id")
public int id;
@SerializedName("namabarang")
public String namabarang;
@SerializedName("hargabarang")
public long hargabarang;
@SerializedName("stock")
public int stock;
}
|
package com.test.testException;
import com.test.exception.NombreHabitantException;
public class Capital extends Ville {
private boolean capitale = false;
public Capital() {
}
public Capital(String pNom, int pNbre, String pPays, boolean pCapitale) throws NombreHabitantException {
super(pNom, pNbre, pPays);
this.capitale = pCapitale;
}
public String decrisToi() {
String str = "";
if(capitale) str = "\n" + this.nomVille + " est une capitale";
return this.nomVille+" est une ville de "+this.nomPays+ ", elle comporte : "+
this.nbreHabitant+" habitant(s) => elle est donc de catégorie : "+ this.categorie + str;
}
}
|
package binarySearchTree;
public class BSTtoDLL {
public static void main(String[] args) {
Node<Integer> root = new Node<>(6);
root.left = new Node<>(2);
root.left.left = new Node<>(1);
root.left.right = new Node<>(4);
root.left.right.left = new Node<>(3);
root.right = new Node<>(8);
}
}
|
package com.santander.bi.model;
import java.sql.Timestamp;
import javax.persistence.*;
import com.santander.bi.utils.Constants;
@Entity
@Table(name = "BI_HI_EJECUCION",
schema=Constants.SCHEMA_GEN)
@SequenceGenerator(name="ejecucion_seq",sequenceName="BI_HI_EJECUCION_SEQ", allocationSize = 1)
public class Ejecucion {
@Id
@Column(name="ID_EJECUCION")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="ejecucion_seq")
private Integer idEjecucion;
@Column(name="ID_EJEC_PADRE")
private Integer idEjecPadre;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ID_PROCESO")
private Proceso proceso;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ID_SECU_EJEC_REC")
private SecuEjecProceso secuEjecProceso;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ID_ERROR")
private Error error;
@Column(name="FECHA_HORA_INI")
private Timestamp fechaHoraIni;
@Column(name="FECHA_HORA_FIN")
private Timestamp fechaHoraFin;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ID_ESTATUS")
private Estatus estatus;
@Column(name="OBSERVACIONES")
private String observaciones;
//CAMPOS SEGUIMIENTO
@Column(name="HABILITADO")
private String habilitado="H";
@Column(name="FECHA_CREACION")
private Timestamp fechaCreacion;
@Column(name="USUARIO_CREADOR")
private String usuarioCreador;
@Column(name="FECHA_MODIFICACION")
private Timestamp fechaModificacion;
@Column(name="USUARIO_MODIFICA")
private String usuarioModifica;
public Integer getIdEjecucion() {
return idEjecucion;
}
public void setIdEjecucion(Integer idEjecucion) {
this.idEjecucion = idEjecucion;
}
public Integer getIdEjecPadre() {
return idEjecPadre;
}
public void setIdEjecPadre(Integer idEjecPadre) {
this.idEjecPadre = idEjecPadre;
}
public Proceso getProceso() {
return proceso;
}
public void setProceso(Proceso proceso) {
this.proceso = proceso;
}
public SecuEjecProceso getSecuEjecProceso() {
return secuEjecProceso;
}
public void setSecuEjecProceso(SecuEjecProceso secuEjecProceso) {
this.secuEjecProceso = secuEjecProceso;
}
public Error getError() {
return error;
}
public void setError(Error error) {
this.error = error;
}
public Timestamp getFechaHoraIni() {
return fechaHoraIni;
}
public void setFechaHoraIni(Timestamp fechaHoraIni) {
this.fechaHoraIni = fechaHoraIni;
}
public Timestamp getFechaHoraFin() {
return fechaHoraFin;
}
public void setFechaHoraFin(Timestamp fechaHoraFin) {
this.fechaHoraFin = fechaHoraFin;
}
public Estatus getEstatus() {
return estatus;
}
public void setEstatus(Estatus estatus) {
this.estatus = estatus;
}
public String getObservaciones() {
return observaciones;
}
public void setObservaciones(String observaciones) {
this.observaciones = observaciones;
}
public String getHabilitado() {
return habilitado;
}
public void setHabilitado(String habilitado) {
this.habilitado = habilitado;
}
public Timestamp getFechaCreacion() {
return fechaCreacion;
}
public void setFechaCreacion(Timestamp fechaCreacion) {
this.fechaCreacion = fechaCreacion;
}
public String getUsuarioCreador() {
return usuarioCreador;
}
public void setUsuarioCreador(String usuarioCreador) {
this.usuarioCreador = usuarioCreador;
}
public Timestamp getFechaModificacion() {
return fechaModificacion;
}
public void setFechaModificacion(Timestamp fechaModificacion) {
this.fechaModificacion = fechaModificacion;
}
public String getUsuarioModifica() {
return usuarioModifica;
}
public void setUsuarioModifica(String usuarioModifica) {
this.usuarioModifica = usuarioModifica;
}
}
|
package net.ostree.hibernate;
/**
主要步骤:
1.创建工程。
2.从数据库创建实体类(使用hibernate)
3.创建hibernate配置文件hibernate.cfg.xml,放在../src目录下,不然找不到。
4.修改hibeernate.cfg.xml添加映射类
5.写代码测试:
*/
import java.util.Iterator;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
public class Main {
public static void main(String[] args) {
Student st1=new Student();
try {
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
Query q = session.createQuery("from Student");//Student是类名,不是表名
List resultList = q.list();
Iterator itor=resultList.iterator();
while(itor.hasNext()){
st1=(Student)itor.next();
System.out.println(st1.getXingming());
}
session.getTransaction().commit();
} catch (HibernateException he) {
he.printStackTrace();
}
}
}
|
package com.quiz.projectWilayah.dto;
import lombok.Data;
@Data
public class KabupatenDto {
private Integer id;
private String kabupatenCode;
private String kabupatenName;
private String provinsiCode;
}
|
package sse.tongji.edu.cluster.config;
public class Params {
static public String RealTimeChanel = "sakura";
static public String MemoryShortName = "mem";
static public String CPUShortName = "cpu";
static public String NetworkReceiveShortName = "ntr";
static public String NetworkSendShortName = "nts";
static public String CreateTimeShortName = "createtime";
}
|
package com.habit.secrect.utils;
import java.util.Properties;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import javax.security.auth.Subject;
public class Email {
// smtp服务器
private String host = "smtp.163.com";
// 发件人地址
private String from = "fengzaitest@163.com";
// 收件人地址
private String to = "";
// 用户名
private String user = "fengzaitest@163.com";
// 密码
private String pwd = "sophine962464";
// 邮件标题
private String subject = "";
// 验证码
private String code = "";
public String getCode() {
return code;
}
/**
* 设置验证码
*
* @param code
*/
public void setCode(String code) {
this.code = code;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
/**
* 设置收件人地址 从app端读进来的
*
* @param to
*/
public void setTo(String to) {
this.to = to;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public void sendEmail() {
Properties props = new Properties();
// // 设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器)
// props.put("mail.smtp.host", host);
// // 需要经过授权,也就是有户名和密码的校验,这样才能通过验证(一定要有这一条)
// props.put("mail.smtp.auth", "true");
props.put("mail.host", "smtp.163.com");
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", true);
// 用刚刚设置好的props对象构建一个session
Session session = Session.getDefaultInstance(props);
// 有了这句便可以在发送邮件的过程中在console处显示过程信息,供调试使
// 用(你可以在控制台(console)上看到发送邮件的过程)
session.setDebug(true);
// 用session为参数定义消息对象
MimeMessage message = new MimeMessage(session);
try {
// 加载发件人地址
message.setFrom(new InternetAddress(from));
// 加载收件人地址
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
// 加载标题
message.setSubject(MimeUtility.encodeText(subject, "UTF-8", "B"));
// 向multipart对象中添加邮件的各个部分内容,包括文本内容和附件
Multipart multipart = new MimeMultipart();
// 设置邮件的文本内容
BodyPart contentPart = new MimeBodyPart();
StringBuffer sbf = new StringBuffer();
sbf.append("<div style=\"font-size:24\">【峰仔提醒】</div>");
sbf.append("<div style=\"font-size:24\">");
sbf.append("      ");
sbf.append("<font color=\"#008FF5\" style=\"font-weight:bold; font-size:24\">");
sbf.append(code);
sbf.append("</font>");
sbf.append("(您的登录验证码),有效期为3分钟。如非本人操作,请忽略此邮件。");
sbf.append("</div>");
sbf.append("<div style=\"float:right;font-size:24;\">");
sbf.append("<div style=\"float:right;color:red;\">西安峰仔工作室</div>");
sbf.append("<div><a href=\"www.fengzaigongzuoshi.com.cn\">www.fengzaigongzuoshi.com.cn</a></div>");
sbf.append("</div>");
// 发送文本
// contentPart.setText(sbf.toString());
// 发送html文本
contentPart.setContent(sbf.toString(), "text/html;charset=UTF-8");
multipart.addBodyPart(contentPart);
// 将multipart对象放到message中
message.setContent(multipart);
// 保存邮件
message.saveChanges();
// 发送邮件
Transport transport = session.getTransport("smtp");
// 连接服务器的邮箱
transport.connect(host, user, pwd);
// 把邮件发送出去
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
/*
* 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 oopProjectFinal;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author x18114245
*/
public class hrGUI extends javax.swing.JFrame {
// declare variables in the base class
String firstname;
String surname;
String dob;
String id;
String address;
String ppsnumber;
int count = 0;// set initial value to zero
hr e; //MAKE INSTANT OF HR CLASS
ArrayList<hr> aList = new ArrayList(); // declare AND CREATE ARRAYLISTL
public hrGUI() {
initComponents();
readFromFile();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
view = new javax.swing.JButton();
payrol = new javax.swing.JButton();
search = new javax.swing.JButton();
firstnameLbl = new javax.swing.JLabel();
surnameLbl = new javax.swing.JLabel();
idlbl = new javax.swing.JLabel();
dobLbl = new javax.swing.JLabel();
firstnameTF = new javax.swing.JTextField();
surnameTF = new javax.swing.JTextField();
idTF = new javax.swing.JTextField();
dobTF = new javax.swing.JTextField();
ppsnumberLbl = new javax.swing.JLabel();
ppsnumberTF = new javax.swing.JTextField();
adressLbl = new javax.swing.JLabel();
addressTF = new javax.swing.JTextField();
Clear = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("add new employee");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
view.setText("view existing employees");
view.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewActionPerformed(evt);
}
});
payrol.setText("payrol");
payrol.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
payrolActionPerformed(evt);
}
});
search.setText("search employee");
search.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchActionPerformed(evt);
}
});
firstnameLbl.setText("First name");
surnameLbl.setText("Surname");
idlbl.setText("ID");
dobLbl.setText("DOB");
firstnameTF.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
firstnameTFActionPerformed(evt);
}
});
dobTF.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dobTFActionPerformed(evt);
}
});
ppsnumberLbl.setText("Pps number");
ppsnumberTF.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ppsnumberTFActionPerformed(evt);
}
});
adressLbl.setText("Adress");
Clear.setBackground(new java.awt.Color(255, 255, 102));
Clear.setText("Clear");
Clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ClearActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(139, 139, 139)
.addComponent(payrol, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(42, 42, 42)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(firstnameLbl)
.addComponent(surnameLbl)
.addComponent(idlbl, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dobLbl)
.addComponent(ppsnumberLbl)
.addComponent(adressLbl))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(search, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(dobTF)
.addComponent(idTF)
.addComponent(surnameTF)
.addComponent(firstnameTF)
.addComponent(ppsnumberTF, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
.addComponent(addressTF))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(view, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(Clear)
.addGap(21, 21, 21)))))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(firstnameLbl)
.addComponent(firstnameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(surnameLbl)
.addComponent(surnameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(idlbl)
.addComponent(idTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(view)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(dobLbl)
.addComponent(dobTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ppsnumberLbl)
.addComponent(ppsnumberTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Clear))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(adressLbl)
.addComponent(addressTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
.addComponent(search)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(payrol)
.addGap(19, 19, 19))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void payrolActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_payrolActionPerformed
new hrGUI().setVisible(false); //// HTGUI not visible WHEN CLICKONH PAYROL BUTTON
new payrolGUI().setVisible(true); //PAYROLGUI VISIBLE WHEN CICKING PAYROL BUTTON
dispose();
}//GEN-LAST:event_payrolActionPerformed
private void searchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchActionPerformed
String search = JOptionPane.showInputDialog("please enter name you want search for");
for (int i = 0; i < aList.size(); i++) {
if (search.equalsIgnoreCase(aList.get(i).getFirstname())) {
JOptionPane.showMessageDialog(null, " the details your looking for are" + aList.get(i).employeedetails());
}
}//GEN-LAST:event_searchActionPerformed
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
e = new hr();
// get text from text field and pass it to variable
firstname = firstnameTF.getText();
surname = surnameTF.getText();
dob = dobTF.getText();
id = idTF.getText();
address = addressTF.getText();
ppsnumber = ppsnumberTF.getText();
e.setFirstname(firstname);
e.setSurname(surname);
e.setDob(dob);
e.setId(id);
e.setPpsnumber(ppsnumber);
e.setAddress(address);
aList.add(e); // add values to arraylist
writeToFile();// instead of creating another add button we simpply call the wrIte to file method inside add btn
}//GEN-LAST:event_jButton1ActionPerformed
private void ppsnumberTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ppsnumberTFActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ppsnumberTFActionPerformed
private void dobTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dobTFActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_dobTFActionPerformed
private void viewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewActionPerformed
for (int i = 0; i < aList.size(); i++) {
JOptionPane.showMessageDialog(null, aList.get(i).employeedetails());// PRINT EMOLOYEE DETAILS USING POLYMORPHISM
firstnameTF.setText(aList.get(i).getFirstname());
surnameTF.setText(aList.get(i).getFirstname());
idTF.setText(aList.get(i).getId());
dobTF.setText(aList.get(i).getDob());
ppsnumberTF.setText(aList.get(i).getDob());
addressTF.setText(aList.get(i).getAddress());
}
}//GEN-LAST:event_viewActionPerformed
private void firstnameTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_firstnameTFActionPerformed
}//GEN-LAST:event_firstnameTFActionPerformed
private void ClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearActionPerformed
firstnameTF.setText("");
surnameTF.setText("");
idTF.setText("");
surnameTF.setText("");
dobTF.setText("");
ppsnumberTF.setText("");
addressTF.setText("");
}//GEN-LAST:event_ClearActionPerformed
public void writeToFile() {
try {
File f = new File("output.dat");//declare and create file object called output.dat used to write employees details
FileOutputStream fStream = new FileOutputStream(f);//
ObjectOutputStream oStream = new ObjectOutputStream(fStream);
// write the object
oStream.writeObject(aList);//log declared earlier
//close the output stream
oStream.close();
} catch (IOException e) {
System.out.println(e);
}
}
public void readFromFile() {
try {
File f = new File("output.dat");//declare and create file object called output.dat used to read employees details
FileInputStream fStream = new FileInputStream(f);
ObjectInputStream oStream = new ObjectInputStream(fStream);
// read the object from the file array of object here called Log
// convert prob > cast it to remind it is a employee
aList = (ArrayList<hr>) oStream.readObject();
oStream.close();
} catch (IOException | ClassNotFoundException ex) {
System.out.println(ex);
}
}
/**
* @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(hrGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(hrGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(hrGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(hrGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new hrGUI().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Clear;
private javax.swing.JTextField addressTF;
private javax.swing.JLabel adressLbl;
private javax.swing.JLabel dobLbl;
private javax.swing.JTextField dobTF;
private javax.swing.JLabel firstnameLbl;
private javax.swing.JTextField firstnameTF;
private javax.swing.JTextField idTF;
private javax.swing.JLabel idlbl;
private javax.swing.JButton jButton1;
private javax.swing.JButton payrol;
private javax.swing.JLabel ppsnumberLbl;
private javax.swing.JTextField ppsnumberTF;
private javax.swing.JButton search;
private javax.swing.JLabel surnameLbl;
private javax.swing.JTextField surnameTF;
private javax.swing.JButton view;
// End of variables declaration//GEN-END:variables
}
|
package com.ifli.mbcp.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import com.ifli.mbcp.util.CounterUtil;
import com.ifli.mbcp.util.MBCPConstants;
/**
* Represents a Lead, which is a prospect, or potential customer for an IFLI
* insurance product. Depending on whether the lead actually purchases the
* insurance product, he/she may graduate to become a full-fledged customer. <br/>
* <br/>
* Nevertheless, the Lead remains the key entity of this application and will
* feature in most of the service implementations.
*
* @author FL867
* @version 1.0
* @since 29 April 2013
*/
@Entity
@Table(name = "tbl_lead")
public class Lead implements Serializable
{
private static final long serialVersionUID = 2677991942498741732L;
/**
* Unique identifier for a given lead instance.
*/
private Long leadId;
/**
* Personal details about the lead; name, addresses, family details, PAN
* card, etc.
*/
private CustomerDetails leadCustomerDetails;
/**
* Open, closed, hot, cold, etc., represents the different statii that a
* lead instance can be in.
*/
private LeadType leadType;
private LeadStatus leadStatus;
private BDMCode bdmCode;
private LeadCategory leadCategory;
private Channel channelSelection;
private BranchCode branchCode;
private BMRMCode bmRmCode;
private LeadGeneratorCode leadGeneratorCode;
private Date appointmentScheduled;
private String comments;
private Date modifiedDate;
private Date createdDate;
private TaskType taskType;
private Set<NeedsAnalysis> needsAnalysis;
private Set<Proposal> proposalsMade;
private Set<Policy> purchasedPolicies;
private KindOfLead kindOfLead;
private Short lifecycleState;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getLeadId()
{
return leadId;
}
public void setLeadId(Long leadId)
{
this.leadId = leadId;
}
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "customerDetailsId", nullable = false)
public CustomerDetails getLeadCustomerDetails()
{
return leadCustomerDetails;
}
public void setLeadCustomerDetails(CustomerDetails leadCustomerDetails)
{
this.leadCustomerDetails = leadCustomerDetails;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "leadStatusId", nullable = false)
public LeadStatus getLeadStatus()
{
return leadStatus;
}
public void setLeadStatus(LeadStatus leadStatus)
{
this.leadStatus = leadStatus;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "channelId", nullable = false)
public Channel getChannelSelection()
{
return channelSelection;
}
public void setChannelSelection(Channel channelSelection)
{
this.channelSelection = channelSelection;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "branchCodeId", nullable = false)
public BranchCode getBranchCode()
{
return branchCode;
}
public void setBranchCode(BranchCode branchCode)
{
this.branchCode = branchCode;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "bmRmCodeId", nullable = false)
public BMRMCode getBmRmCode()
{
return bmRmCode;
}
public void setBmRmCode(BMRMCode bmRmCode)
{
this.bmRmCode = bmRmCode;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "leadGeneratorCodeId", nullable = false)
public LeadGeneratorCode getLeadGeneratorCode()
{
return leadGeneratorCode;
}
public void setLeadGeneratorCode(LeadGeneratorCode leadGeneratorCode)
{
this.leadGeneratorCode = leadGeneratorCode;
}
@Column
public Date getAppointmentScheduled()
{
return appointmentScheduled;
}
public void setAppointmentScheduled(Date appointmentScheduled)
{
this.appointmentScheduled = appointmentScheduled;
}
/**
* Unidirectional One-to-Many on Needs Analysis. A single Lead can own many
* NAs, but we don't need the return relationship. The JoinColumn will place
* a leadId in the NeedsAnalysis table when it is generated by hbm2ddl.
*
* @return
*/
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "leadId")
public Set<NeedsAnalysis> getNeedsAnalysis()
{
return needsAnalysis;
}
public void setNeedsAnalysis(Set<NeedsAnalysis> needsAnalysis)
{
this.needsAnalysis = needsAnalysis;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "bdmCodeId", nullable = false)
public BDMCode getBdmCode()
{
return bdmCode;
}
public void setBdmCode(BDMCode bdmCode)
{
this.bdmCode = bdmCode;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "leadCategoryId", nullable = false)
public LeadCategory getLeadCategory()
{
return leadCategory;
}
public void setLeadCategory(LeadCategory leadCategory)
{
this.leadCategory = leadCategory;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "leadTypeId", nullable = false)
public LeadType getLeadType()
{
return leadType;
}
public void setLeadType(LeadType leadType)
{
this.leadType = leadType;
}
@Column(length = 1024, nullable = true)
public String getComments()
{
return comments;
}
public void setComments(String comments)
{
this.comments = comments;
}
@Temporal(TemporalType.TIMESTAMP)
public Date getModifiedDate()
{
return modifiedDate;
}
public void setModifiedDate(Date modifiedDate)
{
this.modifiedDate = modifiedDate;
}
@Temporal(TemporalType.TIMESTAMP)
public Date getCreatedDate()
{
return createdDate;
}
public void setCreatedDate(Date createdDate)
{
this.createdDate = createdDate;
}
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "leadId")
public Set<Proposal> getProposalsMade()
{
return proposalsMade;
}
public void setProposalsMade(Set<Proposal> proposal)
{
this.proposalsMade = proposal;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "taskTypeId", nullable = true)
public TaskType getTaskType()
{
return taskType;
}
public void setTaskType(TaskType taskType)
{
this.taskType = taskType;
}
/**
* Implements a padded leadId getter. In the database we save the leadId as
* a Long for efficient storage and good performance. However, the business
* requirement states that the leadId should be an alphanumeric field. To
* get around this, we pad the Long leadId with the text characters by
* either suffixing or prefixing the necessary amount of padding. <br>
* <br>
* The service layer will interact with the padded methods, while the DAO
* will work with the actual getter and setter for the leadId. <br>
* <br>
* Clarified with BA (Gaurav K) on 13-May-2013 at 16:10; see e-mail with
* subject: "Fields Format Counter Details"
*/
@Transient
public String getPaddedLeadId()
{
String paddedLeadId = "";
try
{
paddedLeadId = (MBCPConstants.REFID_PREFIX + CounterUtil.zeroPad(getLeadId().longValue(), MBCPConstants.FIELD_WIDTH));
}
catch (Exception e)
{
}
return paddedLeadId;
}
/**
* Implements a padded leadId setter. In the database we save the leadId as
* a Long for efficient storage and good performance. However, the business
* requirement states that the leadId should be an alphanumeric field. To
* get around this, we pad the Long leadId with the text characters by
* either suffixing or prefixing the necessary amount of padding. <br>
* <br>
* The service layer will interact with the padded methods, while the DAO
* will work with the actual getter and setter for the leadId. <br>
* <br>
* Clarified with BA (Gaurav K) on 13-May-2013 at 16:10; see e-mail with
* subject: "Fields Format Counter Details"
*/
public void setPaddedLeadId(String refId)
{
try
{
// Strip out the padding and save to the actual leadId
if ((refId != null) && (refId.contains(MBCPConstants.REFID_PREFIX)))
{
setLeadId(Long.parseLong(CounterUtil.removeLeadingZeros(refId.substring(refId.lastIndexOf(MBCPConstants.REFID_PREFIX) + 2, refId.length()))));
}
else
{
setLeadId(Long.parseLong(refId));
}
}
catch (Exception e)
{
}
}
/**
* Unidirectional One-to-Many on Policy. A single Lead can own many
* Policies, but we don't need the return relationship. The JoinColumn will
* place a leadId in the Policy table when it is generated by hbm2ddl.
*
* @return
*/
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "leadId")
public Set<Policy> getPurchasedPolicies()
{
return purchasedPolicies;
}
public void setPurchasedPolicies(Set<Policy> purchasedPolicies)
{
this.purchasedPolicies = purchasedPolicies;
}
/**
* This represents the kind of lead that this is; for example this could be individual lead,
* group lead, etc.
* <br><br>
* This will be used to determine the kind of padding used in the getPaddedLeadId() method.
* @return
*/
@OneToOne
@JoinColumn(name = "kindOfLeadId")
public KindOfLead getKindOfLead()
{
return kindOfLead;
}
public void setKindOfLead(KindOfLead kindOfLead)
{
this.kindOfLead = kindOfLead;
}
public Short getLifecycleState()
{
return lifecycleState;
}
public void setLifecycleState(Short lifecycleState)
{
this.lifecycleState = lifecycleState;
}
}
|
package com.tencent.mm.plugin.luckymoney.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import com.tencent.mm.sdk.platformtools.x;
class LuckyMoneyReceiveUI$2 implements OnCancelListener {
final /* synthetic */ LuckyMoneyReceiveUI kXr;
LuckyMoneyReceiveUI$2(LuckyMoneyReceiveUI luckyMoneyReceiveUI) {
this.kXr = luckyMoneyReceiveUI;
}
public final void onCancel(DialogInterface dialogInterface) {
if (LuckyMoneyReceiveUI.a(this.kXr) != null && LuckyMoneyReceiveUI.a(this.kXr).isShowing()) {
LuckyMoneyReceiveUI.a(this.kXr).dismiss();
}
this.kXr.kUg.baT();
if (LuckyMoneyReceiveUI.b(this.kXr).getVisibility() == 8 || LuckyMoneyReceiveUI.c(this.kXr).getVisibility() == 4) {
x.i("MicroMsg.LuckyMoneyReceiveUI", "user cancel & finish");
this.kXr.finish();
}
}
}
|
package com.example.colorfall;
import android.graphics.Paint;
import java.io.Serializable;
//WIP to later be used for redrawing the canvas.//
public class ourPaint extends Paint implements Serializable {
//setColor()
//setStrokeWidth()
//setAntiAlias()
//setStyle()
//setStrokeJoin()
//setStrokeCap()
}
|
package org.ashah.sbcloudpayrollservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients(value = "org.ashah.sbcloudpayrollservice")
public class SbCloudPayrollServiceApplication {
public static void main(String[] args) {
SpringApplication.run(SbCloudPayrollServiceApplication.class, args);
}
}
|
package com.google.android.exoplayer2.i;
public final class h$a {
public final int aCg;
public final boolean aCh;
public final int anX;
public h$a(int i, int i2, boolean z) {
this.anX = i;
this.aCg = i2;
this.aCh = z;
}
}
|
/*
* Copyright 2009 Kjetil Valstadsve
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package vanadis.osgi;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import vanadis.core.collections.Generic;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
public final class OSGiUtils {
private static final Logger log = LoggerFactory.getLogger(OSGiUtils.class);
public static boolean isFragment(Bundle bundle) {
return bundle.getHeaders() != null && bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null;
}
public static boolean isStale(Bundle bundle) {
return state(bundle) == null;
}
public static boolean isActive(Bundle bundle) {
Integer state = state(bundle);
return state != null && state == Bundle.ACTIVE || state == Bundle.STARTING || state == Bundle.STOPPING;
}
public static boolean bundleNoLongerValid(IllegalStateException e) {
return e.getMessage().toLowerCase().contains("no longer valid");
}
public static boolean bundleContextNoLongerValid(IllegalStateException e) {
return e.getMessage().toLowerCase().contains("invalid bundlecontext");
}
public static List<Long> closeableBundles(BundleContext bundleContext, Long... ids) {
ServiceReference ref = bundleContext.getServiceReference(PackageAdmin.class.getName());
try {
return closeableBundles((PackageAdmin) bundleContext.getService(ref), bundleContext, ids);
} finally {
bundleContext.ungetService(ref);
}
}
public static List<Long> closeableBundles(PackageAdmin packageAdmin, BundleContext bundleContext, Long... ids) {
List<Set<Long>> dependencies = mutableDependentBundles(packageAdmin, bundleContext, ids);
Collections.reverse(dependencies);
List<Long> closeableIds = Generic.list();
for (Set<Long> layer : dependencies) {
closeableIds.addAll(layer);
}
return closeableIds;
}
public static List<Set<Long>> dependentBundles(BundleContext bundleContext, Long... ids) {
ServiceReference ref = bundleContext.getServiceReference(PackageAdmin.class.getName());
try {
return dependentBundles((PackageAdmin) bundleContext.getService(ref), bundleContext, ids);
} finally {
bundleContext.ungetService(ref);
}
}
public static List<Set<Long>> dependentBundles(PackageAdmin packageAdmin, BundleContext bundleContext, Long... ids) {
List<Set<Long>> idSets = mutableDependentBundles(packageAdmin, bundleContext, ids);
return idSets == null || idSets.isEmpty() ? Collections.<Set<Long>>emptyList() : Generic.seal(idSets);
}
private static List<Set<Long>> mutableDependentBundles(PackageAdmin packageAdmin, BundleContext bundleContext, Long... ids) {
LinkedList<Set<Long>> layers = Generic.linkedList();
layers.add(Generic.set(ids));
buildLayers(packageAdmin, bundleContext, layers);
return pruneDuplicates(layers);
}
private static Integer state(Bundle bundle) {
try {
return bundle.getState();
} catch (IllegalStateException e) {
if (log.isDebugEnabled()) {
log.debug("Got exception when checking bundle " + bundle + " state, assuming non-active", e);
}
return null;
}
}
private static void buildLayers(PackageAdmin packageAdmin, BundleContext bundleContext, LinkedList<Set<Long>> layers) {
for (Long bundleId : layers.getLast()) {
Set<Long> dependants = findDependants(packageAdmin, bundleContext, bundleId);
if (dependants.isEmpty()) {
return;
}
layers.add(dependants);
buildLayers(packageAdmin, bundleContext, layers);
}
}
private static Set<Long> findDependants(PackageAdmin packageAdmin, BundleContext bundleContext, Long bundleId) {
return findDependants(packageAdmin, bundleContext.getBundle(bundleId));
}
private static Set<Long> findDependants(PackageAdmin packageAdmin, Bundle bundle) {
ExportedPackage[] exportedPackages = packageAdmin.getExportedPackages(bundle);
if (exportedPackages == null || exportedPackages.length == 0) {
return Collections.emptySet();
}
Set<Long> layer = Generic.set();
for (ExportedPackage exportedPackage : exportedPackages) {
Bundle[] importingBundles = exportedPackage.getImportingBundles();
if (importingBundles != null && exportedPackages.length > 0) {
for (Bundle importingBundle : importingBundles) {
if (importingBundle != null) {
layer.add(importingBundle.getBundleId());
}
}
}
}
return layer;
}
private static List<Set<Long>> pruneDuplicates(List<Set<Long>> layers) {
List<Set<Long>> pruned = Generic.list();
Set<Long> knownIds = Generic.set();
for (Set<Long> layer : layers) {
layer.removeAll(knownIds);
pruned.add(Generic.seal(layer));
knownIds.addAll(layer);
}
return pruned;
}
private OSGiUtils() {
// Don't make me
}
}
|
package com.mes.old.meta;
// Generated 2017-5-22 1:25:24 by Hibernate Tools 5.2.1.Final
import java.math.BigDecimal;
import java.util.Date;
/**
* TvCotaskId generated by hbm2java
*/
public class TvCotaskId implements java.io.Serializable {
private String cotaskuid;
private String taskuid;
private BigDecimal taskstate;
private Long cotaskstate;
private String cofeedback;
private Date planstart;
private String notes;
private String deptid;
private Date planfinish;
private BigDecimal planqty;
private Date actualstart;
private Date actualfinish;
private Date actualreceive;
private BigDecimal completeqty;
private String mastershop;
private Date schedulestart;
private Date schedulefinish;
private String model;
private String partNumber;
private String drawingid;
private String partName;
private String batchnum;
private BigDecimal operationId;
private String operationIddesc;
private String taskname;
private String deptname;
private String mastershopname;
private Character optypename;
private String taskstatedesc;
private Boolean suspended;
private String opuid;
private BigDecimal optype;
private Long agreestate;
private String agreestateiddesc;
private Long priority;
private String sender;
private BigDecimal sendqty;
private String sendwarehouseid;
private String sendername;
private Date actualsend;
private String receiver;
private BigDecimal outqty;
private BigDecimal receiveqty;
private String receivewarehouseid;
private String receivername;
private Date outtime;
private String fetcher;
private BigDecimal fetchqty;
private String fetchername;
private Date actualfetch;
private String accepter;
private BigDecimal acceptqty;
private String acceptername;
private Date actualaccept;
private String parentuid;
private Long expirenum;
private Long lostnum;
private String sendwarehousename;
private String receivewarehousename;
private String fetchwarehousename;
private String acceptwarehousename;
private BigDecimal lagdays;
private Date partlatefinish;
public TvCotaskId() {
}
public TvCotaskId(String cotaskuid, String taskuid) {
this.cotaskuid = cotaskuid;
this.taskuid = taskuid;
}
public TvCotaskId(String cotaskuid, String taskuid, BigDecimal taskstate, Long cotaskstate, String cofeedback,
Date planstart, String notes, String deptid, Date planfinish, BigDecimal planqty, Date actualstart,
Date actualfinish, Date actualreceive, BigDecimal completeqty, String mastershop, Date schedulestart,
Date schedulefinish, String model, String partNumber, String drawingid, String partName, String batchnum,
BigDecimal operationId, String operationIddesc, String taskname, String deptname, String mastershopname,
Character optypename, String taskstatedesc, Boolean suspended, String opuid, BigDecimal optype,
Long agreestate, String agreestateiddesc, Long priority, String sender, BigDecimal sendqty,
String sendwarehouseid, String sendername, Date actualsend, String receiver, BigDecimal outqty,
BigDecimal receiveqty, String receivewarehouseid, String receivername, Date outtime, String fetcher,
BigDecimal fetchqty, String fetchername, Date actualfetch, String accepter, BigDecimal acceptqty,
String acceptername, Date actualaccept, String parentuid, Long expirenum, Long lostnum,
String sendwarehousename, String receivewarehousename, String fetchwarehousename,
String acceptwarehousename, BigDecimal lagdays, Date partlatefinish) {
this.cotaskuid = cotaskuid;
this.taskuid = taskuid;
this.taskstate = taskstate;
this.cotaskstate = cotaskstate;
this.cofeedback = cofeedback;
this.planstart = planstart;
this.notes = notes;
this.deptid = deptid;
this.planfinish = planfinish;
this.planqty = planqty;
this.actualstart = actualstart;
this.actualfinish = actualfinish;
this.actualreceive = actualreceive;
this.completeqty = completeqty;
this.mastershop = mastershop;
this.schedulestart = schedulestart;
this.schedulefinish = schedulefinish;
this.model = model;
this.partNumber = partNumber;
this.drawingid = drawingid;
this.partName = partName;
this.batchnum = batchnum;
this.operationId = operationId;
this.operationIddesc = operationIddesc;
this.taskname = taskname;
this.deptname = deptname;
this.mastershopname = mastershopname;
this.optypename = optypename;
this.taskstatedesc = taskstatedesc;
this.suspended = suspended;
this.opuid = opuid;
this.optype = optype;
this.agreestate = agreestate;
this.agreestateiddesc = agreestateiddesc;
this.priority = priority;
this.sender = sender;
this.sendqty = sendqty;
this.sendwarehouseid = sendwarehouseid;
this.sendername = sendername;
this.actualsend = actualsend;
this.receiver = receiver;
this.outqty = outqty;
this.receiveqty = receiveqty;
this.receivewarehouseid = receivewarehouseid;
this.receivername = receivername;
this.outtime = outtime;
this.fetcher = fetcher;
this.fetchqty = fetchqty;
this.fetchername = fetchername;
this.actualfetch = actualfetch;
this.accepter = accepter;
this.acceptqty = acceptqty;
this.acceptername = acceptername;
this.actualaccept = actualaccept;
this.parentuid = parentuid;
this.expirenum = expirenum;
this.lostnum = lostnum;
this.sendwarehousename = sendwarehousename;
this.receivewarehousename = receivewarehousename;
this.fetchwarehousename = fetchwarehousename;
this.acceptwarehousename = acceptwarehousename;
this.lagdays = lagdays;
this.partlatefinish = partlatefinish;
}
public String getCotaskuid() {
return this.cotaskuid;
}
public void setCotaskuid(String cotaskuid) {
this.cotaskuid = cotaskuid;
}
public String getTaskuid() {
return this.taskuid;
}
public void setTaskuid(String taskuid) {
this.taskuid = taskuid;
}
public BigDecimal getTaskstate() {
return this.taskstate;
}
public void setTaskstate(BigDecimal taskstate) {
this.taskstate = taskstate;
}
public Long getCotaskstate() {
return this.cotaskstate;
}
public void setCotaskstate(Long cotaskstate) {
this.cotaskstate = cotaskstate;
}
public String getCofeedback() {
return this.cofeedback;
}
public void setCofeedback(String cofeedback) {
this.cofeedback = cofeedback;
}
public Date getPlanstart() {
return this.planstart;
}
public void setPlanstart(Date planstart) {
this.planstart = planstart;
}
public String getNotes() {
return this.notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
public String getDeptid() {
return this.deptid;
}
public void setDeptid(String deptid) {
this.deptid = deptid;
}
public Date getPlanfinish() {
return this.planfinish;
}
public void setPlanfinish(Date planfinish) {
this.planfinish = planfinish;
}
public BigDecimal getPlanqty() {
return this.planqty;
}
public void setPlanqty(BigDecimal planqty) {
this.planqty = planqty;
}
public Date getActualstart() {
return this.actualstart;
}
public void setActualstart(Date actualstart) {
this.actualstart = actualstart;
}
public Date getActualfinish() {
return this.actualfinish;
}
public void setActualfinish(Date actualfinish) {
this.actualfinish = actualfinish;
}
public Date getActualreceive() {
return this.actualreceive;
}
public void setActualreceive(Date actualreceive) {
this.actualreceive = actualreceive;
}
public BigDecimal getCompleteqty() {
return this.completeqty;
}
public void setCompleteqty(BigDecimal completeqty) {
this.completeqty = completeqty;
}
public String getMastershop() {
return this.mastershop;
}
public void setMastershop(String mastershop) {
this.mastershop = mastershop;
}
public Date getSchedulestart() {
return this.schedulestart;
}
public void setSchedulestart(Date schedulestart) {
this.schedulestart = schedulestart;
}
public Date getSchedulefinish() {
return this.schedulefinish;
}
public void setSchedulefinish(Date schedulefinish) {
this.schedulefinish = schedulefinish;
}
public String getModel() {
return this.model;
}
public void setModel(String model) {
this.model = model;
}
public String getPartNumber() {
return this.partNumber;
}
public void setPartNumber(String partNumber) {
this.partNumber = partNumber;
}
public String getDrawingid() {
return this.drawingid;
}
public void setDrawingid(String drawingid) {
this.drawingid = drawingid;
}
public String getPartName() {
return this.partName;
}
public void setPartName(String partName) {
this.partName = partName;
}
public String getBatchnum() {
return this.batchnum;
}
public void setBatchnum(String batchnum) {
this.batchnum = batchnum;
}
public BigDecimal getOperationId() {
return this.operationId;
}
public void setOperationId(BigDecimal operationId) {
this.operationId = operationId;
}
public String getOperationIddesc() {
return this.operationIddesc;
}
public void setOperationIddesc(String operationIddesc) {
this.operationIddesc = operationIddesc;
}
public String getTaskname() {
return this.taskname;
}
public void setTaskname(String taskname) {
this.taskname = taskname;
}
public String getDeptname() {
return this.deptname;
}
public void setDeptname(String deptname) {
this.deptname = deptname;
}
public String getMastershopname() {
return this.mastershopname;
}
public void setMastershopname(String mastershopname) {
this.mastershopname = mastershopname;
}
public Character getOptypename() {
return this.optypename;
}
public void setOptypename(Character optypename) {
this.optypename = optypename;
}
public String getTaskstatedesc() {
return this.taskstatedesc;
}
public void setTaskstatedesc(String taskstatedesc) {
this.taskstatedesc = taskstatedesc;
}
public Boolean getSuspended() {
return this.suspended;
}
public void setSuspended(Boolean suspended) {
this.suspended = suspended;
}
public String getOpuid() {
return this.opuid;
}
public void setOpuid(String opuid) {
this.opuid = opuid;
}
public BigDecimal getOptype() {
return this.optype;
}
public void setOptype(BigDecimal optype) {
this.optype = optype;
}
public Long getAgreestate() {
return this.agreestate;
}
public void setAgreestate(Long agreestate) {
this.agreestate = agreestate;
}
public String getAgreestateiddesc() {
return this.agreestateiddesc;
}
public void setAgreestateiddesc(String agreestateiddesc) {
this.agreestateiddesc = agreestateiddesc;
}
public Long getPriority() {
return this.priority;
}
public void setPriority(Long priority) {
this.priority = priority;
}
public String getSender() {
return this.sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public BigDecimal getSendqty() {
return this.sendqty;
}
public void setSendqty(BigDecimal sendqty) {
this.sendqty = sendqty;
}
public String getSendwarehouseid() {
return this.sendwarehouseid;
}
public void setSendwarehouseid(String sendwarehouseid) {
this.sendwarehouseid = sendwarehouseid;
}
public String getSendername() {
return this.sendername;
}
public void setSendername(String sendername) {
this.sendername = sendername;
}
public Date getActualsend() {
return this.actualsend;
}
public void setActualsend(Date actualsend) {
this.actualsend = actualsend;
}
public String getReceiver() {
return this.receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public BigDecimal getOutqty() {
return this.outqty;
}
public void setOutqty(BigDecimal outqty) {
this.outqty = outqty;
}
public BigDecimal getReceiveqty() {
return this.receiveqty;
}
public void setReceiveqty(BigDecimal receiveqty) {
this.receiveqty = receiveqty;
}
public String getReceivewarehouseid() {
return this.receivewarehouseid;
}
public void setReceivewarehouseid(String receivewarehouseid) {
this.receivewarehouseid = receivewarehouseid;
}
public String getReceivername() {
return this.receivername;
}
public void setReceivername(String receivername) {
this.receivername = receivername;
}
public Date getOuttime() {
return this.outtime;
}
public void setOuttime(Date outtime) {
this.outtime = outtime;
}
public String getFetcher() {
return this.fetcher;
}
public void setFetcher(String fetcher) {
this.fetcher = fetcher;
}
public BigDecimal getFetchqty() {
return this.fetchqty;
}
public void setFetchqty(BigDecimal fetchqty) {
this.fetchqty = fetchqty;
}
public String getFetchername() {
return this.fetchername;
}
public void setFetchername(String fetchername) {
this.fetchername = fetchername;
}
public Date getActualfetch() {
return this.actualfetch;
}
public void setActualfetch(Date actualfetch) {
this.actualfetch = actualfetch;
}
public String getAccepter() {
return this.accepter;
}
public void setAccepter(String accepter) {
this.accepter = accepter;
}
public BigDecimal getAcceptqty() {
return this.acceptqty;
}
public void setAcceptqty(BigDecimal acceptqty) {
this.acceptqty = acceptqty;
}
public String getAcceptername() {
return this.acceptername;
}
public void setAcceptername(String acceptername) {
this.acceptername = acceptername;
}
public Date getActualaccept() {
return this.actualaccept;
}
public void setActualaccept(Date actualaccept) {
this.actualaccept = actualaccept;
}
public String getParentuid() {
return this.parentuid;
}
public void setParentuid(String parentuid) {
this.parentuid = parentuid;
}
public Long getExpirenum() {
return this.expirenum;
}
public void setExpirenum(Long expirenum) {
this.expirenum = expirenum;
}
public Long getLostnum() {
return this.lostnum;
}
public void setLostnum(Long lostnum) {
this.lostnum = lostnum;
}
public String getSendwarehousename() {
return this.sendwarehousename;
}
public void setSendwarehousename(String sendwarehousename) {
this.sendwarehousename = sendwarehousename;
}
public String getReceivewarehousename() {
return this.receivewarehousename;
}
public void setReceivewarehousename(String receivewarehousename) {
this.receivewarehousename = receivewarehousename;
}
public String getFetchwarehousename() {
return this.fetchwarehousename;
}
public void setFetchwarehousename(String fetchwarehousename) {
this.fetchwarehousename = fetchwarehousename;
}
public String getAcceptwarehousename() {
return this.acceptwarehousename;
}
public void setAcceptwarehousename(String acceptwarehousename) {
this.acceptwarehousename = acceptwarehousename;
}
public BigDecimal getLagdays() {
return this.lagdays;
}
public void setLagdays(BigDecimal lagdays) {
this.lagdays = lagdays;
}
public Date getPartlatefinish() {
return this.partlatefinish;
}
public void setPartlatefinish(Date partlatefinish) {
this.partlatefinish = partlatefinish;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof TvCotaskId))
return false;
TvCotaskId castOther = (TvCotaskId) other;
return ((this.getCotaskuid() == castOther.getCotaskuid()) || (this.getCotaskuid() != null
&& castOther.getCotaskuid() != null && this.getCotaskuid().equals(castOther.getCotaskuid())))
&& ((this.getTaskuid() == castOther.getTaskuid()) || (this.getTaskuid() != null
&& castOther.getTaskuid() != null && this.getTaskuid().equals(castOther.getTaskuid())))
&& ((this.getTaskstate() == castOther.getTaskstate()) || (this.getTaskstate() != null
&& castOther.getTaskstate() != null && this.getTaskstate().equals(castOther.getTaskstate())))
&& ((this.getCotaskstate() == castOther.getCotaskstate())
|| (this.getCotaskstate() != null && castOther.getCotaskstate() != null
&& this.getCotaskstate().equals(castOther.getCotaskstate())))
&& ((this.getCofeedback() == castOther.getCofeedback()) || (this.getCofeedback() != null
&& castOther.getCofeedback() != null && this.getCofeedback().equals(castOther.getCofeedback())))
&& ((this.getPlanstart() == castOther.getPlanstart()) || (this.getPlanstart() != null
&& castOther.getPlanstart() != null && this.getPlanstart().equals(castOther.getPlanstart())))
&& ((this.getNotes() == castOther.getNotes()) || (this.getNotes() != null
&& castOther.getNotes() != null && this.getNotes().equals(castOther.getNotes())))
&& ((this.getDeptid() == castOther.getDeptid()) || (this.getDeptid() != null
&& castOther.getDeptid() != null && this.getDeptid().equals(castOther.getDeptid())))
&& ((this.getPlanfinish() == castOther.getPlanfinish()) || (this.getPlanfinish() != null
&& castOther.getPlanfinish() != null && this.getPlanfinish().equals(castOther.getPlanfinish())))
&& ((this.getPlanqty() == castOther.getPlanqty()) || (this.getPlanqty() != null
&& castOther.getPlanqty() != null && this.getPlanqty().equals(castOther.getPlanqty())))
&& ((this.getActualstart() == castOther.getActualstart())
|| (this.getActualstart() != null && castOther.getActualstart() != null
&& this.getActualstart().equals(castOther.getActualstart())))
&& ((this.getActualfinish() == castOther.getActualfinish())
|| (this.getActualfinish() != null && castOther.getActualfinish() != null
&& this.getActualfinish().equals(castOther.getActualfinish())))
&& ((this.getActualreceive() == castOther.getActualreceive())
|| (this.getActualreceive() != null && castOther.getActualreceive() != null
&& this.getActualreceive().equals(castOther.getActualreceive())))
&& ((this.getCompleteqty() == castOther.getCompleteqty())
|| (this.getCompleteqty() != null && castOther.getCompleteqty() != null
&& this.getCompleteqty().equals(castOther.getCompleteqty())))
&& ((this.getMastershop() == castOther.getMastershop()) || (this.getMastershop() != null
&& castOther.getMastershop() != null && this.getMastershop().equals(castOther.getMastershop())))
&& ((this.getSchedulestart() == castOther.getSchedulestart())
|| (this.getSchedulestart() != null && castOther.getSchedulestart() != null
&& this.getSchedulestart().equals(castOther.getSchedulestart())))
&& ((this.getSchedulefinish() == castOther.getSchedulefinish())
|| (this.getSchedulefinish() != null && castOther.getSchedulefinish() != null
&& this.getSchedulefinish().equals(castOther.getSchedulefinish())))
&& ((this.getModel() == castOther.getModel()) || (this.getModel() != null
&& castOther.getModel() != null && this.getModel().equals(castOther.getModel())))
&& ((this.getPartNumber() == castOther.getPartNumber()) || (this.getPartNumber() != null
&& castOther.getPartNumber() != null && this.getPartNumber().equals(castOther.getPartNumber())))
&& ((this.getDrawingid() == castOther.getDrawingid()) || (this.getDrawingid() != null
&& castOther.getDrawingid() != null && this.getDrawingid().equals(castOther.getDrawingid())))
&& ((this.getPartName() == castOther.getPartName()) || (this.getPartName() != null
&& castOther.getPartName() != null && this.getPartName().equals(castOther.getPartName())))
&& ((this.getBatchnum() == castOther.getBatchnum()) || (this.getBatchnum() != null
&& castOther.getBatchnum() != null && this.getBatchnum().equals(castOther.getBatchnum())))
&& ((this.getOperationId() == castOther.getOperationId())
|| (this.getOperationId() != null && castOther.getOperationId() != null
&& this.getOperationId().equals(castOther.getOperationId())))
&& ((this.getOperationIddesc() == castOther.getOperationIddesc())
|| (this.getOperationIddesc() != null && castOther.getOperationIddesc() != null
&& this.getOperationIddesc().equals(castOther.getOperationIddesc())))
&& ((this.getTaskname() == castOther.getTaskname()) || (this.getTaskname() != null
&& castOther.getTaskname() != null && this.getTaskname().equals(castOther.getTaskname())))
&& ((this.getDeptname() == castOther.getDeptname()) || (this.getDeptname() != null
&& castOther.getDeptname() != null && this.getDeptname().equals(castOther.getDeptname())))
&& ((this.getMastershopname() == castOther.getMastershopname())
|| (this.getMastershopname() != null && castOther.getMastershopname() != null
&& this.getMastershopname().equals(castOther.getMastershopname())))
&& ((this.getOptypename() == castOther.getOptypename()) || (this.getOptypename() != null
&& castOther.getOptypename() != null && this.getOptypename().equals(castOther.getOptypename())))
&& ((this.getTaskstatedesc() == castOther.getTaskstatedesc())
|| (this.getTaskstatedesc() != null && castOther.getTaskstatedesc() != null
&& this.getTaskstatedesc().equals(castOther.getTaskstatedesc())))
&& ((this.getSuspended() == castOther.getSuspended()) || (this.getSuspended() != null
&& castOther.getSuspended() != null && this.getSuspended().equals(castOther.getSuspended())))
&& ((this.getOpuid() == castOther.getOpuid()) || (this.getOpuid() != null
&& castOther.getOpuid() != null && this.getOpuid().equals(castOther.getOpuid())))
&& ((this.getOptype() == castOther.getOptype()) || (this.getOptype() != null
&& castOther.getOptype() != null && this.getOptype().equals(castOther.getOptype())))
&& ((this.getAgreestate() == castOther.getAgreestate()) || (this.getAgreestate() != null
&& castOther.getAgreestate() != null && this.getAgreestate().equals(castOther.getAgreestate())))
&& ((this.getAgreestateiddesc() == castOther.getAgreestateiddesc())
|| (this.getAgreestateiddesc() != null && castOther.getAgreestateiddesc() != null
&& this.getAgreestateiddesc().equals(castOther.getAgreestateiddesc())))
&& ((this.getPriority() == castOther.getPriority()) || (this.getPriority() != null
&& castOther.getPriority() != null && this.getPriority().equals(castOther.getPriority())))
&& ((this.getSender() == castOther.getSender()) || (this.getSender() != null
&& castOther.getSender() != null && this.getSender().equals(castOther.getSender())))
&& ((this.getSendqty() == castOther.getSendqty()) || (this.getSendqty() != null
&& castOther.getSendqty() != null && this.getSendqty().equals(castOther.getSendqty())))
&& ((this.getSendwarehouseid() == castOther.getSendwarehouseid())
|| (this.getSendwarehouseid() != null && castOther.getSendwarehouseid() != null
&& this.getSendwarehouseid().equals(castOther.getSendwarehouseid())))
&& ((this.getSendername() == castOther.getSendername()) || (this.getSendername() != null
&& castOther.getSendername() != null && this.getSendername().equals(castOther.getSendername())))
&& ((this.getActualsend() == castOther.getActualsend()) || (this.getActualsend() != null
&& castOther.getActualsend() != null && this.getActualsend().equals(castOther.getActualsend())))
&& ((this.getReceiver() == castOther.getReceiver()) || (this.getReceiver() != null
&& castOther.getReceiver() != null && this.getReceiver().equals(castOther.getReceiver())))
&& ((this.getOutqty() == castOther.getOutqty()) || (this.getOutqty() != null
&& castOther.getOutqty() != null && this.getOutqty().equals(castOther.getOutqty())))
&& ((this.getReceiveqty() == castOther.getReceiveqty()) || (this.getReceiveqty() != null
&& castOther.getReceiveqty() != null && this.getReceiveqty().equals(castOther.getReceiveqty())))
&& ((this.getReceivewarehouseid() == castOther.getReceivewarehouseid())
|| (this.getReceivewarehouseid() != null && castOther.getReceivewarehouseid() != null
&& this.getReceivewarehouseid().equals(castOther.getReceivewarehouseid())))
&& ((this.getReceivername() == castOther.getReceivername())
|| (this.getReceivername() != null && castOther.getReceivername() != null
&& this.getReceivername().equals(castOther.getReceivername())))
&& ((this.getOuttime() == castOther.getOuttime()) || (this.getOuttime() != null
&& castOther.getOuttime() != null && this.getOuttime().equals(castOther.getOuttime())))
&& ((this.getFetcher() == castOther.getFetcher()) || (this.getFetcher() != null
&& castOther.getFetcher() != null && this.getFetcher().equals(castOther.getFetcher())))
&& ((this.getFetchqty() == castOther.getFetchqty()) || (this.getFetchqty() != null
&& castOther.getFetchqty() != null && this.getFetchqty().equals(castOther.getFetchqty())))
&& ((this.getFetchername() == castOther.getFetchername())
|| (this.getFetchername() != null && castOther.getFetchername() != null
&& this.getFetchername().equals(castOther.getFetchername())))
&& ((this.getActualfetch() == castOther.getActualfetch())
|| (this.getActualfetch() != null && castOther.getActualfetch() != null
&& this.getActualfetch().equals(castOther.getActualfetch())))
&& ((this.getAccepter() == castOther.getAccepter()) || (this.getAccepter() != null
&& castOther.getAccepter() != null && this.getAccepter().equals(castOther.getAccepter())))
&& ((this.getAcceptqty() == castOther.getAcceptqty()) || (this.getAcceptqty() != null
&& castOther.getAcceptqty() != null && this.getAcceptqty().equals(castOther.getAcceptqty())))
&& ((this.getAcceptername() == castOther.getAcceptername())
|| (this.getAcceptername() != null && castOther.getAcceptername() != null
&& this.getAcceptername().equals(castOther.getAcceptername())))
&& ((this.getActualaccept() == castOther.getActualaccept())
|| (this.getActualaccept() != null && castOther.getActualaccept() != null
&& this.getActualaccept().equals(castOther.getActualaccept())))
&& ((this.getParentuid() == castOther.getParentuid()) || (this.getParentuid() != null
&& castOther.getParentuid() != null && this.getParentuid().equals(castOther.getParentuid())))
&& ((this.getExpirenum() == castOther.getExpirenum()) || (this.getExpirenum() != null
&& castOther.getExpirenum() != null && this.getExpirenum().equals(castOther.getExpirenum())))
&& ((this.getLostnum() == castOther.getLostnum()) || (this.getLostnum() != null
&& castOther.getLostnum() != null && this.getLostnum().equals(castOther.getLostnum())))
&& ((this.getSendwarehousename() == castOther.getSendwarehousename())
|| (this.getSendwarehousename() != null && castOther.getSendwarehousename() != null
&& this.getSendwarehousename().equals(castOther.getSendwarehousename())))
&& ((this.getReceivewarehousename() == castOther.getReceivewarehousename())
|| (this.getReceivewarehousename() != null && castOther.getReceivewarehousename() != null
&& this.getReceivewarehousename().equals(castOther.getReceivewarehousename())))
&& ((this.getFetchwarehousename() == castOther.getFetchwarehousename())
|| (this.getFetchwarehousename() != null && castOther.getFetchwarehousename() != null
&& this.getFetchwarehousename().equals(castOther.getFetchwarehousename())))
&& ((this.getAcceptwarehousename() == castOther.getAcceptwarehousename())
|| (this.getAcceptwarehousename() != null && castOther.getAcceptwarehousename() != null
&& this.getAcceptwarehousename().equals(castOther.getAcceptwarehousename())))
&& ((this.getLagdays() == castOther.getLagdays()) || (this.getLagdays() != null
&& castOther.getLagdays() != null && this.getLagdays().equals(castOther.getLagdays())))
&& ((this.getPartlatefinish() == castOther.getPartlatefinish())
|| (this.getPartlatefinish() != null && castOther.getPartlatefinish() != null
&& this.getPartlatefinish().equals(castOther.getPartlatefinish())));
}
public int hashCode() {
int result = 17;
result = 37 * result + (getCotaskuid() == null ? 0 : this.getCotaskuid().hashCode());
result = 37 * result + (getTaskuid() == null ? 0 : this.getTaskuid().hashCode());
result = 37 * result + (getTaskstate() == null ? 0 : this.getTaskstate().hashCode());
result = 37 * result + (getCotaskstate() == null ? 0 : this.getCotaskstate().hashCode());
result = 37 * result + (getCofeedback() == null ? 0 : this.getCofeedback().hashCode());
result = 37 * result + (getPlanstart() == null ? 0 : this.getPlanstart().hashCode());
result = 37 * result + (getNotes() == null ? 0 : this.getNotes().hashCode());
result = 37 * result + (getDeptid() == null ? 0 : this.getDeptid().hashCode());
result = 37 * result + (getPlanfinish() == null ? 0 : this.getPlanfinish().hashCode());
result = 37 * result + (getPlanqty() == null ? 0 : this.getPlanqty().hashCode());
result = 37 * result + (getActualstart() == null ? 0 : this.getActualstart().hashCode());
result = 37 * result + (getActualfinish() == null ? 0 : this.getActualfinish().hashCode());
result = 37 * result + (getActualreceive() == null ? 0 : this.getActualreceive().hashCode());
result = 37 * result + (getCompleteqty() == null ? 0 : this.getCompleteqty().hashCode());
result = 37 * result + (getMastershop() == null ? 0 : this.getMastershop().hashCode());
result = 37 * result + (getSchedulestart() == null ? 0 : this.getSchedulestart().hashCode());
result = 37 * result + (getSchedulefinish() == null ? 0 : this.getSchedulefinish().hashCode());
result = 37 * result + (getModel() == null ? 0 : this.getModel().hashCode());
result = 37 * result + (getPartNumber() == null ? 0 : this.getPartNumber().hashCode());
result = 37 * result + (getDrawingid() == null ? 0 : this.getDrawingid().hashCode());
result = 37 * result + (getPartName() == null ? 0 : this.getPartName().hashCode());
result = 37 * result + (getBatchnum() == null ? 0 : this.getBatchnum().hashCode());
result = 37 * result + (getOperationId() == null ? 0 : this.getOperationId().hashCode());
result = 37 * result + (getOperationIddesc() == null ? 0 : this.getOperationIddesc().hashCode());
result = 37 * result + (getTaskname() == null ? 0 : this.getTaskname().hashCode());
result = 37 * result + (getDeptname() == null ? 0 : this.getDeptname().hashCode());
result = 37 * result + (getMastershopname() == null ? 0 : this.getMastershopname().hashCode());
result = 37 * result + (getOptypename() == null ? 0 : this.getOptypename().hashCode());
result = 37 * result + (getTaskstatedesc() == null ? 0 : this.getTaskstatedesc().hashCode());
result = 37 * result + (getSuspended() == null ? 0 : this.getSuspended().hashCode());
result = 37 * result + (getOpuid() == null ? 0 : this.getOpuid().hashCode());
result = 37 * result + (getOptype() == null ? 0 : this.getOptype().hashCode());
result = 37 * result + (getAgreestate() == null ? 0 : this.getAgreestate().hashCode());
result = 37 * result + (getAgreestateiddesc() == null ? 0 : this.getAgreestateiddesc().hashCode());
result = 37 * result + (getPriority() == null ? 0 : this.getPriority().hashCode());
result = 37 * result + (getSender() == null ? 0 : this.getSender().hashCode());
result = 37 * result + (getSendqty() == null ? 0 : this.getSendqty().hashCode());
result = 37 * result + (getSendwarehouseid() == null ? 0 : this.getSendwarehouseid().hashCode());
result = 37 * result + (getSendername() == null ? 0 : this.getSendername().hashCode());
result = 37 * result + (getActualsend() == null ? 0 : this.getActualsend().hashCode());
result = 37 * result + (getReceiver() == null ? 0 : this.getReceiver().hashCode());
result = 37 * result + (getOutqty() == null ? 0 : this.getOutqty().hashCode());
result = 37 * result + (getReceiveqty() == null ? 0 : this.getReceiveqty().hashCode());
result = 37 * result + (getReceivewarehouseid() == null ? 0 : this.getReceivewarehouseid().hashCode());
result = 37 * result + (getReceivername() == null ? 0 : this.getReceivername().hashCode());
result = 37 * result + (getOuttime() == null ? 0 : this.getOuttime().hashCode());
result = 37 * result + (getFetcher() == null ? 0 : this.getFetcher().hashCode());
result = 37 * result + (getFetchqty() == null ? 0 : this.getFetchqty().hashCode());
result = 37 * result + (getFetchername() == null ? 0 : this.getFetchername().hashCode());
result = 37 * result + (getActualfetch() == null ? 0 : this.getActualfetch().hashCode());
result = 37 * result + (getAccepter() == null ? 0 : this.getAccepter().hashCode());
result = 37 * result + (getAcceptqty() == null ? 0 : this.getAcceptqty().hashCode());
result = 37 * result + (getAcceptername() == null ? 0 : this.getAcceptername().hashCode());
result = 37 * result + (getActualaccept() == null ? 0 : this.getActualaccept().hashCode());
result = 37 * result + (getParentuid() == null ? 0 : this.getParentuid().hashCode());
result = 37 * result + (getExpirenum() == null ? 0 : this.getExpirenum().hashCode());
result = 37 * result + (getLostnum() == null ? 0 : this.getLostnum().hashCode());
result = 37 * result + (getSendwarehousename() == null ? 0 : this.getSendwarehousename().hashCode());
result = 37 * result + (getReceivewarehousename() == null ? 0 : this.getReceivewarehousename().hashCode());
result = 37 * result + (getFetchwarehousename() == null ? 0 : this.getFetchwarehousename().hashCode());
result = 37 * result + (getAcceptwarehousename() == null ? 0 : this.getAcceptwarehousename().hashCode());
result = 37 * result + (getLagdays() == null ? 0 : this.getLagdays().hashCode());
result = 37 * result + (getPartlatefinish() == null ? 0 : this.getPartlatefinish().hashCode());
return result;
}
}
|
package mecanico.excepciones;
public class ErrorSupervisorNulo extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
}
|
package com.Appthuchi.Appqlthuchi.moder;
public class LoaiChi {
public int maLoaiChi;
public String tenLoaiChi;
public LoaiChi(){
}
public int getMaLoaiChi() {
return maLoaiChi;
}
public void setMaLoaiChi(int maLoaiChi) {
this.maLoaiChi = maLoaiChi;
}
public String getTenLoaiChi() {
return tenLoaiChi;
}
public void setTenLoaiChi(String tenLoaiChi) {
this.tenLoaiChi = tenLoaiChi;
}
@Override
public String toString() {
return getTenLoaiChi();
}
}
|
package padre.ds;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Created by Tommy Ettinger on 8/20/2016.
*/
public class ComBitTest {
@Test
public void testContents()
{
ComBit cb = new ComBit("ACDEGsDjmhk".toCharArray());
System.out.println(cb.contents());
}
@Test
public void testContains()
{
ComBit cb = new ComBit("ACDEGsDjmhk".toCharArray());
assertTrue(cb.contains('A'));
assertFalse(cb.contains('B'));
assertTrue(cb.contains('C'));
assertTrue(cb.contains('D'));
assertTrue(cb.contains('E'));
assertFalse(cb.contains('F'));
assertTrue(cb.contains('G'));
assertFalse(cb.contains('H'));
assertFalse(cb.contains('I'));
assertFalse(cb.contains('J'));
}
@Test
public void testNegate()
{
ComBit cb = new ComBit("ACDEGsDjmhk".toCharArray()).negate();
assertFalse(cb.contains('A'));
assertTrue(cb.contains('B'));
assertFalse(cb.contains('C'));
assertFalse(cb.contains('D'));
assertFalse(cb.contains('E'));
assertTrue(cb.contains('F'));
assertFalse(cb.contains('G'));
assertTrue(cb.contains('H'));
assertTrue(cb.contains('I'));
assertTrue(cb.contains('J'));
}
@Test
public void testUnion()
{
ComBit caps = new ComBit("ACDEGDAA".toCharArray()), lows = new ComBit("sgjmhk".toCharArray()),
combined = new ComBit("ACDEGDAAsgjmhk".toCharArray());
assertTrue(ComBit.union(caps, lows).equals(combined));
caps.negate();
combined = new ComBit("ACDEGDAA".toCharArray()).negate();
assertTrue(ComBit.union(caps, lows).equals(combined));
assertTrue(ComBit.union(caps, lows).negate().equals(combined.negate()));
}
@Test
public void testIntersection()
{
ComBit caps = new ComBit("ACDEGDAAzx".toCharArray()), lows = new ComBit("sgjmhkxyz".toCharArray()),
combined = new ComBit("xz".toCharArray());
assertTrue(ComBit.intersection(caps, lows).equals(combined));
caps.negate();
combined = new ComBit("sgjmhky".toCharArray());
ComBit inter = ComBit.intersection(caps, lows);
assertTrue(inter.equals(combined));
inter.negate();
assertTrue(inter.equals(combined.negate()));
assertTrue(inter.negate().equals(combined.negate()));
}
}
|
/**
* Created by Ultimom Dominarum on 4/3/2018.
*/
public class GithubTest {
//test push
}
|
import java.util.Locale;
import java.util.Scanner;
public class entrada_de_dados {
public static void main(String[] args) {
Scanner typeScan = new Scanner(System.in); // Esta função permite que um valor seja armazenado dentro do programa.
System.out.print("Type your name: "); // Visual de interação para usuário
String name; // Declaração da variável
name = typeScan.next(); // Aqui é onde o valor será inserido pelo usuário, processado e atribuído a variável.
System.out.print("Type your age: ");
int age;
age = typeScan.nextInt();
Locale.setDefault(Locale.US);
System.out.println("Type a any value: ");
Double x;
x = typeScan.nextDouble();
Boolean verdadeiro;
verdadeiro = typeScan.hasNext();
typeScan.close(); //Utilizamos quando não precisamos mais do objeto typeScan
System.out.printf("Your name is %s and you have a %d yers old! Test flat number: %.2f", name, age, x);
}
}
|
package nl.nlxdodge.scrapyard.blocks;
import net.minecraft.block.Block;
public class ScrapBlock extends Block {
public ScrapBlock(Settings settings) {
super(settings.strength(1.0f));
}
}
|
package adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.liu.asus.yikezhong.R;
import java.util.List;
import bean.TuijianBean;
/**
* Created by 地地 on 2017/12/18.
* 邮箱:461211527@qq.com.
*/
public class PinglunAdapter extends RecyclerView.Adapter {
private Context context;
private List<TuijianBean.Pinglun> list;
public PinglunAdapter(Context context, List<TuijianBean.Pinglun> list) {
this.context = context;
this.list = list;
System.out.println("pinglun"+list.size());
}
public void Refresh(List<TuijianBean.Pinglun> newlist) {
if(list!=null){
list.clear();
list.addAll(newlist);
this.notifyDataSetChanged();
}
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View inflate = View.inflate(context, R.layout.pinglunitem, null);
Mypinglunholder mypinglunholder=new Mypinglunholder(inflate);
return mypinglunholder;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
Mypinglunholder mypinglunholder= (Mypinglunholder) holder;
mypinglunholder.tv_count.setText(list.get(position).content);
mypinglunholder.tv_nikename.setText(list.get(position).nickname);
}
@Override
public int getItemCount() {
return list.size();
}
public class Mypinglunholder extends RecyclerView.ViewHolder{
private TextView tv_nikename;
private TextView tv_count;
public Mypinglunholder(View itemView) {
super(itemView);
tv_nikename=itemView.findViewById(R.id.pl_nikename);
tv_count=itemView.findViewById(R.id.pl_count);
}
}
}
|
/**
*
*/
package com.cnk.travelogix.b2c.storefront.security;
import de.hybris.platform.acceleratorstorefrontcommons.security.StorefrontAuthenticationSuccessHandler;
import de.hybris.platform.commercefacades.order.data.CartData;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
/**
* @author i323801
*
*/
public class B2CStorefrontAuthenticationSuccessHandler extends StorefrontAuthenticationSuccessHandler
{
private static final String MINICART_PROD_COUNT = "minicartProdCount";
@Override
public void onAuthenticationSuccess(final HttpServletRequest request, final HttpServletResponse response,
final Authentication authentication) throws IOException, ServletException
{
super.onAuthenticationSuccess(request, response, authentication);
final CartData cartdata = getCartFacade().getMiniCart();
Integer count = 0;
if (cartdata != null)
{
count = cartdata.getTotalUnitCount();
}
request.getSession().setAttribute(MINICART_PROD_COUNT, count);
}
@Override
protected void handle(final HttpServletRequest request, final HttpServletResponse response,
final Authentication authentication) throws IOException, ServletException
{
return;
}
}
|
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
public class HandleAnswer {
public static void main(String[] args) throws Exception {
File f = new File("H://answer.txt");
BufferedReader br = new BufferedReader(new FileReader(f));
File f_aim = new File("H://Handle_answer.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(f_aim,true));
String s = null;
while((s = br.readLine()) != null) {
s = s + "-";
bw.write(s);
}
br.close();
bw.close();
}
}
|
package com.tencent.mm.plugin.appbrand.ui;
import android.os.Bundle;
import android.widget.TextView;
import com.tencent.mm.plugin.appbrand.s.g;
import com.tencent.mm.plugin.appbrand.s.h;
import com.tencent.mm.plugin.appbrand.s.j;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.ui.base.a;
import com.tencent.mm.ui.statusbar.DrawStatusBarActivity;
@a(19)
public final class AppBrand404PageUI extends DrawStatusBarActivity {
public static void show(int i) {
ah.A(new 1(ad.getContext().getString(i)));
}
protected final int getLayoutId() {
return h.app_brand_404_page_ui;
}
public final void onCreate(Bundle bundle) {
super.onCreate(bundle);
com.tencent.mm.ui.statusbar.a.c(this.mController.contentView, getStatusBarColor(), false);
setMMTitle(j.app_brand_error);
setBackBtn(new 2(this));
TextView textView = (TextView) findViewById(g.app_brand_error_page_reason);
CharSequence stringExtra = getIntent().getStringExtra("key_wording");
bi.oW(stringExtra);
if (textView != null) {
textView.setText(stringExtra);
}
}
public final void finish() {
super.finish();
}
protected final void onDestroy() {
super.onDestroy();
}
}
|
package com.tencent.mm.plugin.game.model;
public class s$i {
public int hzJ = 0;
public String jNt;
public long jNu = 0;
}
|
/*
* Copyright (C) 2017 GetMangos
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package eu.mangos.characters.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author GetMangos
*/
@Entity
@Table(name = "mail_items")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "MailItems.findAll", query = "SELECT m FROM MailItems m"),
@NamedQuery(name = "MailItems.findByMailId", query = "SELECT m FROM MailItems m WHERE m.mailItemsPK.mailId = :mailId"),
@NamedQuery(name = "MailItems.findByItemGuid", query = "SELECT m FROM MailItems m WHERE m.mailItemsPK.itemGuid = :itemGuid"),
@NamedQuery(name = "MailItems.findByItemTemplate", query = "SELECT m FROM MailItems m WHERE m.itemTemplate = :itemTemplate"),
@NamedQuery(name = "MailItems.findByReceiver", query = "SELECT m FROM MailItems m WHERE m.receiver = :receiver")})
public class MailItems implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
protected MailItemsPK mailItemsPK;
@Basic(optional = false)
@Column(name = "item_template")
private int itemTemplate;
@Basic(optional = false)
private int receiver;
public MailItems() {
}
public MailItems(MailItemsPK mailItemsPK) {
this.mailItemsPK = mailItemsPK;
}
public MailItems(MailItemsPK mailItemsPK, int itemTemplate, int receiver) {
this.mailItemsPK = mailItemsPK;
this.itemTemplate = itemTemplate;
this.receiver = receiver;
}
public MailItems(int mailId, int itemGuid) {
this.mailItemsPK = new MailItemsPK(mailId, itemGuid);
}
public MailItemsPK getMailItemsPK() {
return mailItemsPK;
}
public void setMailItemsPK(MailItemsPK mailItemsPK) {
this.mailItemsPK = mailItemsPK;
}
public int getItemTemplate() {
return itemTemplate;
}
public void setItemTemplate(int itemTemplate) {
this.itemTemplate = itemTemplate;
}
public int getReceiver() {
return receiver;
}
public void setReceiver(int receiver) {
this.receiver = receiver;
}
@Override
public int hashCode() {
int hash = 0;
hash += (mailItemsPK != null ? mailItemsPK.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof MailItems)) {
return false;
}
MailItems other = (MailItems) object;
if ((this.mailItemsPK == null && other.mailItemsPK != null) || (this.mailItemsPK != null && !this.mailItemsPK.equals(other.mailItemsPK))) {
return false;
}
return true;
}
@Override
public String toString() {
return "eu.mangos.characters.model.MailItems[ mailItemsPK=" + mailItemsPK + " ]";
}
}
|
package r1b;
import java.io.File;
import java.util.Scanner;
public class A {
public static String inFile = "res/A.sample";
//public static String inFile = "res/A-small-attempt2.in";
public static int reverse (int n)
{
int out = 0;
while (n / 10 > 0)
{
out = out * 10 + n % 10;
n = n / 10;
}
out = out * 10 + n;
return out;
}
private static int solve2(int n)
{
int out = 0 ;
int a = 0;
while (a < n)
{
out++;
a++;
if (n - a > n - reverse(a))
{
a = reverse(a);
}
}
return out;
}
private static int solve(int n)
{
if (n < 20)
{
return n;
}
else if (n < 100)
{
return (n / 10 + 10 + n % 10);
}
else
{
int out = 28;
int a = n;
int b = 1;
while (a > 1000)
{
a = a / 10;
b++;
out += Math.pow(10, b) + 8;
}
int first = n / (int) Math.pow(10, b+1);
int second = reverse(n / (int) Math.pow(10, b+1));
if (n % 10 != 0)
{
out += Math.min(first, second);
}
else
{
out += first;
}
out += n % Math.pow(10, b+1) - 1;
return out;
}
}
public static void run() throws Exception
{
// TODO Auto-generated method stub
Scanner scanner = new Scanner(new File(inFile));
int T = scanner.nextInt();
for (int t = 1; t <= T; t++)
{
int in = scanner.nextInt();
int out = solve2(in);
System.out.println("Case #" + t + ": " + out);
}
scanner.close();
}
public static void main(String[] args) throws Exception
{
//System.out.println(solve(435));
run();
}
}
|
package com.tencent.mm.g.a;
public final class jn$a {
public String bTi;
public String username;
}
|
package eday4;
import java.util.Scanner;
public class 소금배달_DP {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int M = sc.nextInt();
int[] memo = new int[M+1];
for (int i = 0; i < memo.length; i++) {
if(i%3 == 0) {
memo[i] = i/3;
}else { // 배달 불가
memo[i] = Integer.MAX_VALUE-1;
}
}
for (int i = 5; i < memo.length; i++) {
if(memo[i-5] != Integer.MAX_VALUE && memo[i] > memo[i-5]+1)
memo[i] = memo[i-5]+1;
}
System.out.println(memo[M] == Integer.MAX_VALUE ? -1: memo[M]);
}// end of main
}// end of class
|
package br.ufla.lemaf.ti.lemaf4j.common.errors;
import br.ufla.lemaf.ti.lemaf4j.common.messaging.ErrorType;
/**
* Representa erros referêntes ao CPF.
*
* @author Highlander Paiva
* @since 1.0
*/
public enum CPFError implements ErrorType {
DIGITOS_VERIFICADORES_INVALIDOS, DIGITOS_INVALIDOS, DIGITOS_REPETIDOS, FORMATO_INVALIDO, CPF_INVALIDO
}
|
package controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import javafx.scene.input.KeyCode;
import layouts.EndGame;
import layouts.ExitConfrmationWindow;
import layouts.Game;
import layouts.View;
import logs.Logs;
import player.BuildPlayer;
import player.Player;
import player.PlayerProxy;
import save.getarray;
import save.save;
import shape.BuildShape;
import shape.Shape;
import shape.ShapeProxy;
import snapshot.Snapshot;
import states.PlayerStack;
public class eventHandler {
private static eventHandler handler;
private gameController controller;
private View view;
private gameOptions gameOptions;
private Snapshot snapshot;
private musicPlayer music;
private save save1=new save();
private getarray u=new getarray();
private eventHandler() {
gameOptions = new gameOptions();
}
public static eventHandler getInstance() {
if (handler == null)
handler = new eventHandler();
return handler;
}
public void viewIsReady() throws InterruptedException {
music = new musicPlayer();
music.startMusic();
}
public void NewGame() {
Game gameScene = new Game(view.getHeight(), view.getWidth());
view.setScene(gameScene.getScene());
controller = new gameController(gameScene, gameOptions);
Thread game = new Thread(controller, "game begin");
game.start();
}
private void EscapeFromGame() {
System.out.println("pause");
view.setScene("pause");
snapshot = controller.pause();
}
public void continueGame() {
Game gameScene = new Game(view.getHeight(), view.getWidth());
view.setScene(gameScene.getScene());
controller = new gameController(gameScene, snapshot);
Thread game = new Thread(controller, "game begin");
game.start();
}
public void MainMenu() {
view.setScene("MainMenu");
}
public void EndProgram() {
view.exit();
}
public void ExitConfirmation() {
System.out.println("exit confirmation");
ExitConfrmationWindow.display();
}
public void Instructions() {
view.setScene("Instructions");
}
public void mainOptions() {
view.setScene("MainOptions");
}
public void EndGame(String winnerName) {
Logs.log("winner:" + winnerName, "debug");
EndGame scene = new EndGame(view.getHeight(), view.getWidth());
scene.setWinner(winnerName);
view.setScene(scene.getScene());
}
public void gameOptions() {
view.setScene("GameOptions");
}
public void setLevel(String level) {
gameOptions.setGameStrategy(level);
}
public void setKeyContol(String control) {
if (control.equals("KeyMouse")) {
gameOptions.setPlayer2Mouse();
} else if (control.equals("MouseKey")) {
gameOptions.setPlayer1Mouse();
}
}
public void setStrategy(String strategy, int maxTime, int maxScore) {
gameOptions.setGameStrategy(strategy);
gameOptions.setMaxTime(maxTime);
gameOptions.setMaxScore(maxScore);
}
public void GameOptionsReturn() {
view.setScene("pause");
}
public void setView(View view) {
this.view = view;
}
public void notifyMouseMoved(double x) {
controller.notifyMouseMoved(x);
}
public void notifyKeyPressed(KeyCode key) {
if (key == KeyCode.ESCAPE) {
EscapeFromGame();
} else {
controller.notifyKeyPressed(key);
}
}
public void musicButtonPressed() {
if (music.isPlaying()) {
music.stopMusic();
} else {
music.startMusic();
}
}
public void saveGame() {
save1.save(this.snapshot);
}
public gameOptions getOptions() {
return gameOptions;
}
public void loadGame() {
Snapshot snapshot = null;
BuildShape v = new BuildShape();
BuildPlayer v1 = new BuildPlayer();
ShapeProxy[][] k = (ShapeProxy[][]) save1.load1();
Shape[][] n = new Shape[5][1];
for (int i = 0; i < 5; i++) {
n[i] = v.create(k[i]);
}
PlayerProxy[] u = (PlayerProxy[]) save1.load2();
int[] j = (int[]) save1.load3();
Player[] n2 = new Player[2];
for (int i = 0; i < 2; i++) {
n2[i] = v1.create(u[i]);
}
System.out.println(n2[0].getX());
System.out.println(n[0][0].getState());
// System.out.println(n[0][0].getX());
System.out.println(k[0][0].getState());
Player p1 = n2[0];
Player p2 = n2[1];
PlayerStack p31 = new PlayerStack(j[3], p1);
PlayerStack p32 = new PlayerStack(j[4], p1);
PlayerStack p41 = new PlayerStack(j[5], p2);
PlayerStack p42 = new PlayerStack(j[6], p2);
LinkedList<PlayerStack> p33 = new LinkedList<>();
LinkedList<PlayerStack> p44 = new LinkedList<>();
p33.add(p31);
p33.add(p32);
p44.add(p41);
p44.add(p42);
/////////
p31.PH.createObserverList(n[1]);
p32.PH.createObserverList(n[2]);
p41.PH.createObserverList(n[3]);
p42.PH.createObserverList(n[4]);
//////////
p31.stack = this.u.getShapeStack(n[1]);
p32.stack = this.u.getShapeStack(n[2]);
p41.stack = this.u.getShapeStack(n[3]);
p42.stack = this.u.getShapeStack(n[4]);
LinkedList<Player> players = this.u.getPlayerList(n2);
players.get(0).Stacks = p33;
players.get(1).Stacks = p44;
ArrayList<Shape> shapes = this.u.getShapeList(n[0]);
gameOptions.setGameStrategy(save1.load4());
System.out.println(Arrays.toString(save1.load5()));
if(save1.load5()[0]) {players.get(0).Stacks.get(0).blockStack();}
else if(save1.load5()[1]) {players.get(0).Stacks.get(1).blockStack();}
if(save1.load5()[2]) {players.get(1).Stacks.get(0).blockStack();}
else if(save1.load5()[3]) {players.get(1).Stacks.get(1).blockStack();}
snapshot = new Snapshot(shapes, gameOptions, players, j[1], j[2], j[0]);
Game gameScene = new Game(view.getHeight(), view.getWidth());
view.setScene(gameScene.getScene());
controller = new gameController(gameScene, snapshot);
Thread game = new Thread(controller, "game begin");
game.start();
}
}
|
package com.cybx.salesorder.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.cybx.orderdetail.service.OrderDetailService;
import com.cybx.salesorder.dao.SalesorderDao;
import com.cybx.salesorder.model.Salesorder;
import com.cybx.salesorder.service.SalesorderService;
@Service("salesorderService")
public class SalesorderServiceImpl implements SalesorderService {
@Resource
private SalesorderDao salesorderDao;
@Resource
private OrderDetailService orderDetailService;
@Transactional(value = "oldDB", rollbackFor = Exception.class)
@Override
public int insert(Salesorder order) {
return salesorderDao.insert(order);
}
@Override
public List<Salesorder> getSalesorder(String status) {
return salesorderDao.getSalesorder(status);
}
}
|
package com.nmhung.repository;
import com.nmhung.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface UserRepository extends JpaRepository<UserEntity,Integer> {
UserEntity findByUsernameAndPassword(String username,String password);
}
|
package actormodel.exception;
public enum ErrorCode {
ACTOR_NOT_FOUND,
INVALID_ACTOR_STATE,
ACTOR_INTERRUPT
}
|
package com.tencent.mm.plugin.bottle.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import com.tencent.mm.plugin.bottle.ui.BottleConversationUI.3;
class BottleConversationUI$3$1 implements OnCancelListener {
final /* synthetic */ 3 hld;
BottleConversationUI$3$1(3 3) {
this.hld = 3;
}
public final void onCancel(DialogInterface dialogInterface) {
BottleConversationUI.a(this.hld.hlc, true);
}
}
|
package day47_Recap;
public class Quiz12Review {
//q2
public int amount;
//line 1
/*{
amount=100;
}*/
public Quiz12Review() {
amount=100;
}
public static void main(String[] args) {
Quiz12Review obj=new Quiz12Review();
//line2
obj.amount=100;
System.out.println(obj.amount);
}
}
|
package ua.training.model.dao;
import ua.training.model.dao.impl.JDBCDAOFactory;
public abstract class DAOFactory {
private static DAOFactory daoFactory;
public abstract UserDAO createUserDAO();
public abstract TestDAO createTestDAO();
public abstract CertificateDAO createCertificateDAO();
public static DAOFactory getInstance() {
if (daoFactory == null) {
synchronized (DAOFactory.class) {
if (daoFactory == null) {
DAOFactory inst = new JDBCDAOFactory();
daoFactory = inst;
}
}
}
return daoFactory;
}
}
|
package com.rsm.yuri.projecttaxilivredriver.historictravelslist;
import com.rsm.yuri.projecttaxilivredriver.main.entities.Travel;
public class HistoricTravelsListInteractorImpl implements HistoricTravelsListInteractor {
HistoricTravelsListRepository historicTravelsListRepository;
public HistoricTravelsListInteractorImpl(HistoricTravelsListRepository historicTravelsListRepository) {
this.historicTravelsListRepository = historicTravelsListRepository;
}
@Override
public void subscribeForHistoricTravelEvents() {
historicTravelsListRepository.subscribeForHistoricTravelListUpdates();
}
@Override
public void unSubscribeForHistoricTravelEvents() {
historicTravelsListRepository.unSubscribeForHistoricTravelListUpdates();
}
@Override
public void destroyHistoricTravelListListener() {
historicTravelsListRepository.destroyHistoricTravelListListener();
}
@Override
public void getUrlPhotoMapTravel(Travel travel) {
historicTravelsListRepository.getUrlPhotoMapTravel(travel);
}
}
|
package engine.world;
public interface Entity {
public void update();
}
|
package com.blog.system.Dto;
public class UserBean {
private int userid;
private String username;
private String blogname;
private String blogsign;
private String password;
private String nickname;
private java.sql.Date lastlogin;
private String name;
private int sex;
private String province;
private String city;
private String address;
private java.sql.Date birthday;
private String email;
private String tel;
private java.sql.Date regtime;
private String profile;
private int delflag;
public int getUserid() {
return userid;
}
public void setUserid(int userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getBlogname() {
return blogname;
}
public void setBlogname(String blogname) {
this.blogname = blogname;
}
public String getBlogsign() {
return blogsign;
}
public void setBlogsign(String blogsign) {
this.blogsign = blogsign;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public java.sql.Date getLastlogin() {
return lastlogin;
}
public void setLastlogin(java.sql.Date lastlogin) {
this.lastlogin = lastlogin;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public java.sql.Date getBirthday() {
return birthday;
}
public void setBirthday(java.sql.Date birthday) {
this.birthday = birthday;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public java.sql.Date getRegtime() {
return regtime;
}
public void setRegtime(java.sql.Date regtime) {
this.regtime = regtime;
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public int getDelflag() {
return delflag;
}
public void setDelflag(int delflag) {
this.delflag = delflag;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
}
|
package com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.Content;
import android.graphics.Color;
import android.util.Log;
import android.view.ViewGroup;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Main.AudioSenseActivity;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.UI.EndSurveyScreenUI;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.UI.GHABPComponentUI;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.UI.MultiChoiceMultiOptionQuestionUI;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.UI.SingleChoiceMultiOptionQuestionUI;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.UI.SingleChoiceTwoColumnMultiOptionQuestionUI;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.UI.SurveyInstructionScreenUI;
import com.example.ryanbrummet.newaudiosense2.AudioSense.Survey.UI.UserInputInfoUI;
import com.example.ryanbrummet.newaudiosense2.AudiologyBaseSurveyCode.AbstractSingleSelectionSubComponent;
import com.example.ryanbrummet.newaudiosense2.AudiologyBaseSurveyCode.AbstractSurvey;
import com.example.ryanbrummet.newaudiosense2.AudiologyBaseSurveyCode.AbstractSurveySubComponent;
import java.util.Calendar;
import java.util.ArrayList;
/**
* Created by ryanbrummet on 8/21/15.
*
* c1: "TV/Volume set for others"
* c2: "One-on-one conversation / Quiet"
* c3: "Conversation / busy street or shop"
* c4: "Conversation / Group"
* c5: "User Context"
*
* q1: "In this situation, what proportion of the time did you wear your hearing aid?"
* q2: "In this situation, how much did your hearing aid (HA) help you?"
* q3: "In this situation, with your hearing aid, how much difficulty did you have?"
* q4: "In this situation, with your hearing aid, how much did any difficulty in this situation worry, annoy or upset you?"
* q5: "In this situation, how satisfied were you with your hearing aid?"
* q6: "You were not 100% satisfied with your hearing aid in this situation. Please indicate why."
* q7: "Is this situation happening now?"
*/
public class AudioSense2 extends AbstractSurvey {
private final AudioSenseActivity activity;
private final ViewGroup rootView;
public AudioSense2(String id, int surveyInterval, AudioSenseActivity activity, ViewGroup rootView) {
super(id, surveyInterval);
this.activity = activity;
this.rootView = rootView;
Log.i("AudioSense2", "New survey created");
// add instruction screen
String time;
int hour = (Calendar.getInstance().get(Calendar.HOUR_OF_DAY)) % 12;
int hourIntervalValue = getSurveyInterval() / 60;
int minIntervalValue = getSurveyInterval() % 60;
String timeInterval;
if( minIntervalValue / 30 > 0) {
if(((double) (minIntervalValue - 30)) / 30 <= .5){
timeInterval = Integer.toString(hourIntervalValue) + ".5";
} else {
timeInterval = Integer.toString(hourIntervalValue + 1);
}
} else {
if((double) minIntervalValue / 30 <= .5) {
timeInterval = Integer.toString(hourIntervalValue);
} else {
timeInterval = Integer.toString(hourIntervalValue) + ".5";
}
}
if((Calendar.getInstance().get(Calendar.HOUR_OF_DAY) - ((double) getSurveyInterval() / 60) ) / 12 < 1) {
if(Calendar.getInstance().get(Calendar.MINUTE) < 10) {
time = Integer.toString(hour) + ":0" + Integer.toString(Calendar.getInstance().get(Calendar.MINUTE)) + "am";
} else {
time = Integer.toString(hour) + ":" + Integer.toString(Calendar.getInstance().get(Calendar.MINUTE)) + "am";
}
} else {
if(Calendar.getInstance().get(Calendar.MINUTE) < 10) {
time = Integer.toString(hour) + ":0" + Integer.toString(Calendar.getInstance().get(Calendar.MINUTE)) + "pm";
} else {
time = Integer.toString(hour) + ":" + Integer.toString(Calendar.getInstance().get(Calendar.MINUTE)) + "pm";
}
}
SurveyInstructionScreenContent surveyInstructionContent = new SurveyInstructionScreenContent(
"It is now " + time + ". Please consider the past " + timeInterval + " hours and then answer the following questions");
addToComponents(new SurveyInstructionScreenUI("startScreen", Color.BLACK,surveyInstructionContent));
//Context Questions
ArrayList<String> questions = new ArrayList<String>();
ArrayList<String> altQuestions = new ArrayList<String>();
ArrayList<ArrayList<String>> questionOptions = new ArrayList<ArrayList<String>>();
ArrayList<String> questionIDs = new ArrayList<String>();
// Question 1
ArrayList<String> q1Options = new ArrayList<String>(5);
q1Options.add("Never/Not at all");
q1Options.add("About 1/4 of the time");
q1Options.add("About 1/2 of the time");
q1Options.add("About 3/4 of the time");
q1Options.add("All the time");
questions.add(" In this situation, what proportion of the time did you wear the study hearing aids? ");
questionOptions.add(q1Options);
questionIDs.add("q1");
// Question 2
ArrayList<String> q2Options = new ArrayList<String>(5);
q2Options.add("HAs no use at all");
q2Options.add("HAs are some help");
q2Options.add("HAs are quite helpful");
q2Options.add("HAs are a great help");
q2Options.add("Hearing is perfect with HAs");
questions.add(" In this situation, how much did the study hearing aids (HAs) help you? ");
questionOptions.add(q2Options);
questionIDs.add("q2");
//Question 3
ArrayList<String> q3Options = new ArrayList<String>(5);
q3Options.add("No difficulty");
q3Options.add("Only slight difficulty");
q3Options.add("Moderate difficulty");
q3Options.add("Great difficulty");
q3Options.add("Cannot manage at all");
questions.add(" In this situation, with the study hearing aids, how much difficulty did you have? ");
altQuestions.add(" In this situation, how much difficulty did you have? ");
questionOptions.add(q3Options);
questionIDs.add("q3");
// Question 4
ArrayList<String> q4Options = new ArrayList<String>(5);
q4Options.add("Not at all");
q4Options.add("Only a little");
q4Options.add("A moderate amount");
q4Options.add("Quite a lot");
q4Options.add("Very much indeed");
questions.add(" With the study hearing aids, how much did any difficulty in this situation worry, annoy or upset you? ");
altQuestions.add(" How much did any difficulty in this situation worry, annoy, or upset you? ");
questionOptions.add(q4Options);
questionIDs.add("q4");
// Question 5
ArrayList<String> q5Options = new ArrayList<String>(5);
q5Options.add("Not satisfied at all");
q5Options.add("A little satisfied");
q5Options.add("Reasonably satisfied");
q5Options.add("Very satisfied");
q5Options.add("Delighted with hearing aid");
questions.add(" In this situation, how satisfied were you with the study hearing aids? ");
questionOptions.add(q5Options);
questionIDs.add("q5");
// Question 6
ArrayList<String> q6Options = new ArrayList<String>(6);
q6Options.add("Difficulty understanding speech");
q6Options.add("Discomfort from loud sounds");
q6Options.add("Poor sound quality");
q6Options.add("Internal static");
q6Options.add("Whistling (feedback)");
q6Options.add("Other");
questions.add(" You were not 100% satisfied with the study hearing aids in this situation. Please indicate all that apply. ");
questionOptions.add(q6Options);
questionIDs.add("q6");
// Question 7
ArrayList<String> q7Options = new ArrayList<String>(2);
q7Options.add("Yes");
q7Options.add("No");
questions.add(" Is this situation happening now? ");
questionOptions.add(q7Options);
questionIDs.add("q7");
//Context Occurrence question
String instruction = "Did this situation happen in the past " + timeInterval + " hours?";
// context ids
ArrayList<String> contextIDs = new ArrayList<String>();
contextIDs.add("c1");
contextIDs.add("c2");
contextIDs.add("c3");
contextIDs.add("c4");
contextIDs.add("c5");
// short hand descriptions of contexts
ArrayList<String> contextShortDescriptions = new ArrayList<String>();
contextShortDescriptions.add("TV/Volume set for others");
contextShortDescriptions.add("One-on-one conversation/quiet");
contextShortDescriptions.add("Conversation/busy street or shop");
contextShortDescriptions.add("Conversation/Group");
contextShortDescriptions.add("User Context");
// long descriptions of contexts
ArrayList<String> contextLongDescriptions = new ArrayList<String>();
contextLongDescriptions.add(" Listening to the TV with other family or friends when the volume is adjusted to suit other people ");
contextLongDescriptions.add(" Having a conversation with one other person when there is no background noise ");
contextLongDescriptions.add(" Carrying on conversation in a busy street or shop ");
contextLongDescriptions.add(" Having a conversation with several people in a group ");
// start
int color;
for(int i = 0; i < contextShortDescriptions.size(); i++) {
if(i % 2 == 0) {
color = Color.BLACK;
} else {
color = Color.DKGRAY;
}
AbstractSurveySubComponent[] GHABPsubComponents;
GHABPComponentContent GHABPtempContent;
if(i < contextShortDescriptions.size() - 1) {
GHABPsubComponents = new AbstractSurveySubComponent[2];
GHABPtempContent = new GHABPComponentContent(instruction,contextLongDescriptions.get(i));
} else {
GHABPsubComponents = new AbstractSurveySubComponent[4];
GHABPtempContent = new GHABPComponentContent(" Would you like to nominate an additional listening situation that happened in the past " + timeInterval + " hours in which it was important for you to hear as well as possible? ", "");
// code for context 5
UserInputInfoContent c5LocOtherContent = new UserInputInfoContent(
" Please briefly describe the location ");
UserInputInfoUI c5LocOtherUI = new UserInputInfoUI("c5LocOther",color,c5LocOtherContent);
AbstractSurveySubComponent[] c5LocOtherUIArray = new AbstractSurveySubComponent[1];
c5LocOtherUIArray[0] = c5LocOtherUI;
// add to array left to right and then down (like you would read)
ArrayList<String> tempLoc = new ArrayList<String>(12);
tempLoc.add("Restaurant");
tempLoc.add("Shopping");
tempLoc.add("Place of worship");
tempLoc.add("Car");
tempLoc.add("Recreation");
tempLoc.add("Theater");
tempLoc.add("Workplace");
tempLoc.add("Sport events");
tempLoc.add("Classroom");
tempLoc.add("Outdoors");
tempLoc.add("Home");
tempLoc.add("Others");
SingleChoiceMultiOptionQuestionContent c5LocContent = new SingleChoiceMultiOptionQuestionContent(
" Please indicate the Location ","",tempLoc, true);
int[][] c5LocExecutePath = new int[12][1];
for(int a = 0; a < 12; a++) {
if(a == 11) {
c5LocExecutePath[a][0] = 1;
} else {
c5LocExecutePath[a][0] = 0;
}
}
SingleChoiceTwoColumnMultiOptionQuestionUI c5LocUI = new SingleChoiceTwoColumnMultiOptionQuestionUI(
"c5Loc",color,c5LocContent,c5LocOtherUIArray,c5LocExecutePath,true);
ArrayList<String> tempAct = new ArrayList<String>(5);
tempAct.add("One-on-one conversation");
tempAct.add("Group conversation");
tempAct.add("Phone");
tempAct.add("TV / Radio");
tempAct.add("Non-speech sound listening");
SingleChoiceMultiOptionQuestionContent c5ActContent = new SingleChoiceMultiOptionQuestionContent(
" Please indicate the Activity ","",tempAct);
SingleChoiceMultiOptionQuestionUI c5ActUI = new SingleChoiceMultiOptionQuestionUI("c5Act",color,c5ActContent,true);
GHABPsubComponents[0] = c5ActUI;
GHABPsubComponents[1] = c5LocUI;
}
AbstractSurveySubComponent[] HAtempComponents = new AbstractSurveySubComponent[6];
SingleChoiceMultiOptionQuestionContent tempContent1 = new SingleChoiceMultiOptionQuestionContent(questions.get(0),
contextShortDescriptions.get(i),questionOptions.get(0));
SingleChoiceMultiOptionQuestionContent tempContent2 = new SingleChoiceMultiOptionQuestionContent(questions.get(1),contextShortDescriptions.get(i),questionOptions.get(1));
HAtempComponents[0] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(1),color,tempContent2, false);
SingleChoiceMultiOptionQuestionContent tempContent3 = new SingleChoiceMultiOptionQuestionContent(questions.get(2),contextShortDescriptions.get(i),questionOptions.get(2));
HAtempComponents[1] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(2),color,tempContent3, false);
SingleChoiceMultiOptionQuestionContent tempContent4 = new SingleChoiceMultiOptionQuestionContent(questions.get(3),contextShortDescriptions.get(i),questionOptions.get(3));
HAtempComponents[2] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(3),color,tempContent4, false);
SingleChoiceMultiOptionQuestionContent tempContent5 = new SingleChoiceMultiOptionQuestionContent(questions.get(4),contextShortDescriptions.get(i),questionOptions.get(4));
MultiChoiceMultiOptionQuestionContent tempContent6 = new MultiChoiceMultiOptionQuestionContent(questions.get(5),contextShortDescriptions.get(i),questionOptions.get(5));
UserInputInfoContent tempContent6UserInputSubContent = new UserInputInfoContent(" Please briefly explain why you were not 100% satisfied in the situation \"" + contextShortDescriptions.get(i) + "\" ");
int[][] tempContentSixExecutePath = new int[6][1];
for(int a = 0; a < 6; a++){
if(a != 5){
tempContentSixExecutePath[a][0] = 0;
}else {
tempContentSixExecutePath[a][0] = 1;
}
}
MultiChoiceMultiOptionQuestionUI tempUI6 = new MultiChoiceMultiOptionQuestionUI(questionIDs.get(6),color,
tempContent6,new UserInputInfoUI(questionIDs.get(6) + "U",color,tempContent6UserInputSubContent),tempContentSixExecutePath, false);
MultiChoiceMultiOptionQuestionUI[] UI5Array = new MultiChoiceMultiOptionQuestionUI[1];
UI5Array[0] = tempUI6;
int[][] tempContentFiveExecutePath = new int[5][1];
for(int a = 0; a < 5; a++){
if(a != 4){
tempContentFiveExecutePath[a][0] = 1;
}else {
tempContentFiveExecutePath[a][0] = 0;
}
}
HAtempComponents[3] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(4),color,tempContent5,UI5Array, tempContentFiveExecutePath, false);
SingleChoiceMultiOptionQuestionContent tempContent3Alt = new SingleChoiceMultiOptionQuestionContent(altQuestions.get(0),contextShortDescriptions.get(i),questionOptions.get(2));
HAtempComponents[4] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(2) + "NHA",color,tempContent3Alt, false);
SingleChoiceMultiOptionQuestionContent tempContent4Alt = new SingleChoiceMultiOptionQuestionContent(altQuestions.get(1),contextShortDescriptions.get(i),questionOptions.get(3));
HAtempComponents[5] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(3) + "NHA",color,tempContent4Alt, false);
int[][] tempContentOneExecutePath = new int[5][6];
for(int a = 0; a < 5; a++) {
for(int b = 0; b < 6; b++) {
if(a == 0) {
if(b < 4) {
tempContentOneExecutePath[a][b] = 0;
} else {
tempContentOneExecutePath[a][b] = 1;
}
} else {
if(b < 4) {
tempContentOneExecutePath[a][b] = 1;
} else {
tempContentOneExecutePath[a][b] = 0;
}
}
}
}
int[][] tempGHABPExecutePath;
if(i < contextShortDescriptions.size() - 1) {
GHABPsubComponents[0] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(0), color, tempContent1, HAtempComponents, tempContentOneExecutePath, false);
SingleChoiceMultiOptionQuestionContent tempContent7 = new SingleChoiceMultiOptionQuestionContent(questions.get(6), contextShortDescriptions.get(i), questionOptions.get(6));
GHABPsubComponents[1] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(6), color, tempContent7, false);
tempGHABPExecutePath = new int[2][2];
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
if (a == 0) {
tempGHABPExecutePath[a][b] = 1;
} else {
tempGHABPExecutePath[a][b] = 0;
}
}
}
addToComponents(new GHABPComponentUI(contextIDs.get(i), color, GHABPtempContent, GHABPsubComponents, tempGHABPExecutePath, false));
} else {
GHABPsubComponents[2] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(0), color, tempContent1, HAtempComponents, tempContentOneExecutePath, false);
SingleChoiceMultiOptionQuestionContent tempContent7 = new SingleChoiceMultiOptionQuestionContent(questions.get(6), contextShortDescriptions.get(i), questionOptions.get(6));
GHABPsubComponents[3] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(6), color, tempContent7, false);
tempGHABPExecutePath = new int[2][4];
for (int a = 0; a < 2; a++) {
for(int b = 0; b < 4; b++) {
if(a == 0) {
tempGHABPExecutePath[a][b] = 1;
} else {
tempGHABPExecutePath[a][b] = 0;
}
}
}
addToComponents(new GHABPComponentUI(contextIDs.get(i), color, GHABPtempContent, GHABPsubComponents, tempGHABPExecutePath, true));
}
if(i == contextShortDescriptions.size() - 1) {
EndSurveyScreenContent endScreenContent = new EndSurveyScreenContent("Survey Completed");
EndSurveyScreenUI endScreen = new EndSurveyScreenUI("endScreen",color,endScreenContent);
addToComponents(endScreen);
}
}
// end
/*
int color;
for(int i = 0; i < contextShortDescriptions.size(); i++) {
if(i % 2 == 0) {
color = Color.BLACK;
} else {
color = Color.DKGRAY;
}
AbstractSurveySubComponent[] subComponents = new AbstractSurveySubComponent[questionIDs.size() - 1];
GHABPComponentContent tempGHABP = new GHABPComponentContent(instruction,contextLongDescriptions.get(i));
for (int j = 0; j < questionIDs.size() - 1; j++) {
SingleChoiceMultiOptionQuestionContent tempContent;
if(j == 5) {
tempContent = new SingleChoiceMultiOptionQuestionContent(questions.get(j+1),
contextShortDescriptions.get(i),questionOptions.get(j+1));
} else {
tempContent = new SingleChoiceMultiOptionQuestionContent(questions.get(j),
contextShortDescriptions.get(i), questionOptions.get(j));
}
if (j == 4) {
MultiChoiceMultiOptionQuestionContent tempContent5 = new MultiChoiceMultiOptionQuestionContent(questions.get(j + 1),
contextShortDescriptions.get(i),questionOptions.get(j + 1));
UserInputInfoContent tempContent5UserInputSubContent = new UserInputInfoContent(
" Please briefly explain why you were not 100% satisfied in the situation \"" + contextShortDescriptions.get(i) + "\" ");
AbstractSurveySubComponent[] userInputInfoUIArray = new UserInputInfoUI[1];
int[][] tempContentFiveExecutePath = new int[6][1];
for(int a = 0; a < 6; a++){
if(a != 5){
tempContentFiveExecutePath[a][0] = 0;
}else {
tempContentFiveExecutePath[a][0] = 1;
}
}
MultiChoiceMultiOptionQuestionUI tempUI5 = new MultiChoiceMultiOptionQuestionUI(questionIDs.get(j + 1),color,
tempContent5,new UserInputInfoUI(questionIDs.get(j + 1) + "U",color,tempContent5UserInputSubContent),tempContentFiveExecutePath, false);
MultiChoiceMultiOptionQuestionUI[] UI5Array = new MultiChoiceMultiOptionQuestionUI[1];
UI5Array[0] = tempUI5;
int[][] tempContentFourExecutePath = new int[5][1];
for(int a = 0; a < 5; a++){
if(a != 4){
tempContentFourExecutePath[a][0] = 1;
}else {
tempContentFourExecutePath[a][0] = 0;
}
}
subComponents[j] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(j),color,tempContent,
UI5Array, tempContentFourExecutePath, false);
} else {
if(j == 5) {
subComponents[j] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(j + 1),color,tempContent, false);
} else {
subComponents[j] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(j),color,tempContent, false);
}
}
}
int[][] tempGHABPExecutePath = new int[2][questionIDs.size() -1];
for(int j = 0; j < 2; j++){
for(int a = 0; a < questionIDs.size() - 1; a++) {
if(j == 0) {
tempGHABPExecutePath[j][a] = 1;
} else {
tempGHABPExecutePath[j][a] = 0;
}
}
}
//Log.e("here",Integer.toString(subComponents.length));
addToComponents(new GHABPComponentUI(contextIDs.get(i), color, tempGHABP, subComponents, tempGHABPExecutePath, false));
}
if(contextShortDescriptions.size() % 2 == 0) {
color = Color.BLACK;
} else {
color = Color.DKGRAY;
}
// code for context 5
UserInputInfoContent c5LocOtherContent = new UserInputInfoContent(
" Please briefly describe the location ");
UserInputInfoUI c5LocOtherUI = new UserInputInfoUI("c5LocOther",color,c5LocOtherContent);
AbstractSurveySubComponent[] c5LocOtherUIArray = new AbstractSurveySubComponent[1];
c5LocOtherUIArray[0] = c5LocOtherUI;
// add to array left to right and then down (like you would read)
ArrayList<String> tempLoc = new ArrayList<String>(11);
tempLoc.add("Restaurant");
tempLoc.add("Shopping");
tempLoc.add("Place of worship");
tempLoc.add("Car");
tempLoc.add("Recreation");
tempLoc.add("Theater");
tempLoc.add("Workplace");
tempLoc.add("Sport events");
tempLoc.add("Classroom");
tempLoc.add("Outdoors");
tempLoc.add("Others");
SingleChoiceMultiOptionQuestionContent c5LocContent = new SingleChoiceMultiOptionQuestionContent(
" Please indicate the Location ","",tempLoc, true);
int[][] c5LocExecutePath = new int[11][1];
for(int a = 0; a < 11; a++) {
if(a == 10) {
c5LocExecutePath[a][0] = 1;
} else {
c5LocExecutePath[a][0] = 0;
}
}
SingleChoiceTwoColumnMultiOptionQuestionUI c5LocUI = new SingleChoiceTwoColumnMultiOptionQuestionUI(
"c5Loc",color,c5LocContent,c5LocOtherUIArray,c5LocExecutePath,true);
ArrayList<String> tempAct = new ArrayList<String>(5);
tempAct.add("One-on-one conversation");
tempAct.add("Group conversation");
tempAct.add("Phone");
tempAct.add("TV / Radio");
tempAct.add("Non-speech sound listening");
SingleChoiceMultiOptionQuestionContent c5ActContent = new SingleChoiceMultiOptionQuestionContent(
" Please indicate the Activity ","",tempAct);
SingleChoiceMultiOptionQuestionUI c5ActUI = new SingleChoiceMultiOptionQuestionUI("c5Act",color,c5ActContent,true);
AbstractSurveySubComponent[] subComponents = new AbstractSurveySubComponent[questionIDs.size() - 1];
GHABPComponentContent tempGHABP = new GHABPComponentContent(instruction,"User Context");
for (int j = 0; j < questionIDs.size() - 1; j++) {
SingleChoiceMultiOptionQuestionContent tempContent;
if(j == 5) {
tempContent = new SingleChoiceMultiOptionQuestionContent(questions.get(j+1),
"User Context",questionOptions.get(j+1));
} else {
tempContent = new SingleChoiceMultiOptionQuestionContent(questions.get(j),
"User Context", questionOptions.get(j));
}
if (j == 4) {
MultiChoiceMultiOptionQuestionContent tempContent5 = new MultiChoiceMultiOptionQuestionContent(questions.get(j + 1),
"User Context",questionOptions.get(j + 1));
UserInputInfoContent tempContent5UserInputSubContent = new UserInputInfoContent(
" Please briefly explain why you were not 100% satisfied in the situation \"" + "User Context" + "\" ");
AbstractSurveySubComponent[] userInputInfoUIArray = new UserInputInfoUI[1];
int[][] tempContentFiveExecutePath = new int[6][1];
for(int a = 0; a < 6; a++){
if(a != 5){
tempContentFiveExecutePath[a][0] = 0;
}else {
tempContentFiveExecutePath[a][0] = 1;
}
}
MultiChoiceMultiOptionQuestionUI tempUI5 = new MultiChoiceMultiOptionQuestionUI(questionIDs.get(j + 1),color,
tempContent5,new UserInputInfoUI(questionIDs.get(j + 1) + "U",color,tempContent5UserInputSubContent),tempContentFiveExecutePath, false);
MultiChoiceMultiOptionQuestionUI[] UI5Array = new MultiChoiceMultiOptionQuestionUI[1];
UI5Array[0] = tempUI5;
int[][] tempContentFourExecutePath = new int[5][1];
for(int a = 0; a < 5; a++){
if(a != 4){
tempContentFourExecutePath[a][0] = 1;
}else {
tempContentFourExecutePath[a][0] = 0;
}
}
subComponents[j] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(j),color,tempContent,
UI5Array, tempContentFourExecutePath, false);
} else {
if(j == 5) {
subComponents[j] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(j + 1),color,tempContent, false);
} else {
subComponents[j] = new SingleChoiceMultiOptionQuestionUI(questionIDs.get(j),color,tempContent, false);
}
}
}
AbstractSingleSelectionSubComponent[] c5SubComponents = new AbstractSingleSelectionSubComponent[2];
c5SubComponents[0] = c5ActUI;
c5SubComponents[1] = c5LocUI;
int aLen = c5SubComponents.length;
int bLen = subComponents.length;
AbstractSurveySubComponent[] components = new AbstractSurveySubComponent[aLen+bLen];
System.arraycopy(c5SubComponents, 0, components, 0, aLen);
System.arraycopy(subComponents, 0, components, aLen, bLen);
int[][] tempGHABPExecutePath = new int[2][questionIDs.size() + 1];
for(int j = 0; j < 2; j++){
for(int a = 0; a < questionIDs.size() + 1; a++) {
if(j == 0) {
tempGHABPExecutePath[j][a] = 1;
} else {
tempGHABPExecutePath[j][a] = 0;
}
}
}
GHABPComponentContent c5Content = new GHABPComponentContent(
" Would you like to nominate an additional listening situation that happened in the past " +
surveyInterval + " hours in which it was important for you to hear as well as possible? ", "");
GHABPComponentUI c5UI = new GHABPComponentUI("c5", color,c5Content, components, tempGHABPExecutePath, true);
addToComponents(c5UI);
EndSurveyScreenContent endScreenContent = new EndSurveyScreenContent("Survey Completed");
EndSurveyScreenUI endScreen = new EndSurveyScreenUI("endScreen",color,endScreenContent);
addToComponents(endScreen);*/
}
public void gotoPreviousComponent() {}
public void gotoNextComponent() {
Log.i("AudioSense2", "User has completed survey. Now on submit screen");
activity.onSubmitSurvey(rootView);
}
}
|
package org.World.Tiles;
import org.Graphics.Animation;
import org.Resource.ImageResource;
import org.World.Tile;
public class GrassTile extends Tile {
public GrassTile(){
animations = new Animation[1];
animations[0]=new Animation();
animations[0].frames=new ImageResource[1];
animations[0].frames[0]=new ImageResource("/Images/grass.png");
}
}
|
package com.example.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String firstName;
private String lastName;
private String email;
private String phoneNumber;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Temporal(TemporalType.DATE)
private Date dateOfBirth;
public Employee() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
@Override
public String toString() {
return "Employee [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email
+ ", phoneNumber=" + phoneNumber + ", dateOfBirth=" + dateOfBirth;
}
}
|
package edu.jutlandica.server;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import edu.jutlandica.client.dataclasses.Journey;
import edu.jutlandica.client.dataclasses.Trip;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
public class SIRIreader implements APIconnector {
public static final SimpleDateFormat SIRI_TIME_FORMAT = new SimpleDateFormat("yy-MM-dd'T'HH:mm:ss"); // SIRI time
// format
private String exampleFile = "SIRI-ET-2019-10-11.xml";
private String destination = "Fredrikshamn";
public SIRIreader() throws Exception {
}
public Element getEstimatedCall(int index, Node estimatedVehicleJourney) {
Element e = (Element) estimatedVehicleJourney;
NodeList nl = e.getElementsByTagName("EstimatedCall");
return (Element) nl.item(index);
}
public List<Node> getEstimatedVehicleJourneys(String searchString, Document doc) {
ArrayList<Node> nodes = new ArrayList<Node>();
NodeList nList = doc.getElementsByTagName("EstimatedVehicleJourney");
for (int temp = 0; temp < nList.getLength(); temp++) {
Node n = nList.item(temp);
if (n.getNodeType() == Node.ELEMENT_NODE) {
Element e = (Element) n;
String searchslut = e.getElementsByTagName("DirectionRef").item(0).getTextContent();
if (searchslut.equals(destination))
nodes.add(n);
}
}
return nodes;
}
private List<Trip> getTripsToEndDest(List<Node> estimatedVehicleJourneys) throws Exception {
ArrayList<Trip> ret = new ArrayList<>();
for (Node n : estimatedVehicleJourneys) {
Element e = (Element) n;
String start_station = e.getElementsByTagName("OriginName").item(0).getTextContent();
String end_station = e.getElementsByTagName("DirectionRef").item(0).getTextContent();
String vehicle = e.getElementsByTagName("LineRef").item(0).getTextContent();
String vehicleMode = e.getElementsByTagName("VehicleMode").item(0).getTextContent();
Date depDate = SIRI_TIME_FORMAT.parse(
getEstimatedCall(0, n).getElementsByTagName("ExpectedDepartureTime").item(0).getTextContent());
Date arrivalDate = SIRI_TIME_FORMAT
.parse(getEstimatedCall(1, n).getElementsByTagName("AimedArrivalTime").item(0).getTextContent());
ret.add(new Trip(start_station, end_station, end_station, depDate, arrivalDate, vehicleMode,
vehicle));
}
return ret;
}
@Override
public List<Journey> getJourneys(String to, String from, Date date) throws Exception {
File file = new File(exampleFile);
destination = to;
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(file);
doc.getDocumentElement().normalize();
System.out.println("Root element :" + doc.getDocumentElement().getNodeName());
List<Node> estimatedVehicleJourneys = getEstimatedVehicleJourneys(destination, doc);
List<Trip> trips = getTripsToEndDest(estimatedVehicleJourneys);
List<Journey> ret = new ArrayList<Journey>();
for(Trip t : trips) {
Journey temp = new Journey();
temp.addTrip(t);
ret.add(temp);
}
return ret;
}
}
|
/*******************************************************************************
Searcher
Class to perform the file search
@author Cary Clark <clarkcb@gmail.com>
@version $Rev$
@copyright Cary Clark 2012
*******************************************************************************/
package javasearch;
import org.apache.commons.io.LineIterator;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Searcher {
private SearchSettings settings;
private List<SearchResult> results;
private FileTypes fileTypes;
private Set<SearchFile> searchFileSet;
private Map<String, Long> timers;
private long totalElapsedTime;
public Searcher(final SearchSettings settings) {
this.settings = settings;
this.results = new ArrayList<SearchResult>();
this.fileTypes = new FileTypes();
this.searchFileSet = new HashSet<SearchFile>();
this.timers = new HashMap<String, Long>();
this.totalElapsedTime = 0L;
}
private void log(final String message) {
System.out.println(message);
}
public final void validateSettings() throws SearchException {
if (null == settings.getStartPath() || settings.getStartPath().equals("")) {
throw new SearchException("Startpath not defined");
}
File startPathFile = new File(settings.getStartPath());
if (!startPathFile.exists()) {
throw new SearchException("Startpath not found");
}
if (settings.getSearchPatterns().isEmpty()) {
throw new SearchException("No search patterns defined");
}
}
private boolean anyMatchesAnyPattern(final List<String> sList,
final Set<Pattern> patternSet) {
for (String s : sList) {
if (matchesAnyPattern(s, patternSet)) return true;
}
return false;
}
private boolean matchesAnyPattern(final String s,
final Set<Pattern> patternSet) {
if (null == s)
return false;
for (Pattern p : patternSet) {
Matcher m = p.matcher(s);
if (m.find()) {
return true;
}
}
return false;
}
public final boolean isSearchDir(final File d) {
List<String> pathElems = FileUtil.splitPath(d.toString());
if (settings.getExcludeHidden()) {
for (String p : pathElems) {
if (FileUtil.isHidden(p)) return false;
}
}
return (settings.getInDirPatterns().isEmpty() ||
anyMatchesAnyPattern(pathElems, settings.getInDirPatterns()))
&&
(settings.getOutDirPatterns().isEmpty() ||
!anyMatchesAnyPattern(pathElems, settings.getOutDirPatterns()));
}
public final List<File> getSearchDirs(final File startPath) {
List<File> searchDirs = new ArrayList<File>();
if (settings.getDebug()) {
log(String.format("Getting files to search under %s",
startPath.getPath()));
}
searchDirs.add(startPath);
if (settings.getRecursive()) {
searchDirs.addAll(recGetSearchDirs(startPath));
}
return searchDirs;
}
private List<File> getSubDirs(final File dir) {
List<File> subDirs = new ArrayList<File>();
File dirFiles[] = dir.listFiles();
if (dirFiles != null) {
for (File f : dirFiles) {
if (f.isDirectory()) {
subDirs.add(f);
}
}
}
return subDirs;
}
private List<File> recGetSearchDirs(final File dir) {
List<File> searchDirs = new ArrayList<File>();
List<File> subDirs = getSubDirs(dir);
for (File f : subDirs) {
if (isSearchDir(f)) {
searchDirs.add(f);
}
}
for (File d : subDirs) {
searchDirs.addAll(recGetSearchDirs(d));
}
return searchDirs;
}
public final boolean isSearchFile(final File f) {
String ext = FileUtil.getExtension(f);
return (settings.getInExtensions().isEmpty() ||
settings.getInExtensions().contains(ext))
&&
(settings.getOutExtensions().isEmpty() ||
!settings.getOutExtensions().contains(ext))
&&
(settings.getInFilePatterns().isEmpty() ||
matchesAnyPattern(f.getName(), settings.getInFilePatterns()))
&&
(settings.getOutFilePatterns().isEmpty() ||
!matchesAnyPattern(f.getName(), settings.getOutFilePatterns()));
}
public final boolean isArchiveSearchFile(final File f) {
String ext = FileUtil.getExtension(f);
return (settings.getInArchiveExtensions().isEmpty() ||
settings.getInArchiveExtensions().contains(ext))
&&
(settings.getOutArchiveExtensions().isEmpty() ||
!settings.getOutArchiveExtensions().contains(ext))
&&
(settings.getInArchiveFilePatterns().isEmpty() ||
matchesAnyPattern(f.getName(), settings.getInArchiveFilePatterns()))
&&
(settings.getOutArchiveFilePatterns().isEmpty() ||
!matchesAnyPattern(f.getName(), settings.getOutArchiveFilePatterns()));
}
public final boolean filterFile(final File f) {
if (FileUtil.isHidden(f) && settings.getExcludeHidden()) {
return false;
}
if (fileTypes.getFileType(f) == FileType.ARCHIVE) {
return settings.getSearchArchives() && isArchiveSearchFile(f);
}
return !settings.getArchivesOnly() && isSearchFile(f);
}
private List<SearchFile> getSearchFilesForDir(final File dir) {
if (settings.getDebug()) {
log(String.format("Getting files to search under %s", dir));
}
List<SearchFile> searchFiles = new ArrayList<SearchFile>();
File currentFiles[] = dir.listFiles();
if (currentFiles != null) {
for (File f : currentFiles) {
if (f.isFile()) {
FileType fileType = fileTypes.getFileType(f);
if (filterFile(f)) {
searchFiles.add(new SearchFile(f.getParent(), f.getName(),
fileType));
}
}
}
}
return searchFiles;
}
public final List<SearchFile> getSearchFiles(final List<File> searchDirs) {
File f = new File(settings.getStartPath());
List<SearchFile> searchFiles = new ArrayList<SearchFile>();
for (File d : searchDirs) {
searchFiles.addAll(getSearchFilesForDir(d));
}
return searchFiles;
}
private void addTimer(final String name, final String action) {
timers.put(name + ":" + action, System.currentTimeMillis());
}
private void startTimer(final String name) {
addTimer(name, "start");
}
private void stopTimer(final String name) {
addTimer(name, "stop");
totalElapsedTime += getElapsed(name);
}
public final long getElapsed(final String name) {
long startTime = this.timers.get(name + ":start");
long stopTime = this.timers.get(name + ":stop");
return stopTime - startTime;
}
public final void printElapsed(final String name) {
log(String.format("Elapsed time for \"%s\": %d ms",
name, getElapsed(name)));
}
public final void printTotalElapsed() {
log(String.format("Total elapsed time: %d ms", totalElapsedTime));
}
public final void search() throws SearchException {
// figure out if startPath is a directory or a file and search accordingly
File startPathFile = new File(settings.getStartPath());
if (startPathFile.isDirectory()) {
if (isSearchDir(startPathFile)) {
searchPath(startPathFile);
} else {
throw new SearchException("Startpath does not match search settings");
}
} else if (startPathFile.isFile()) {
FileType fileType = fileTypes.getFileType(startPathFile);
if (filterFile(startPathFile)) {
File d = startPathFile.getParentFile();
if (null == d)
d = new File(".");
searchFile(new SearchFile(d.getPath(), startPathFile.getName(),
fileType));
} else {
throw new SearchException("Startpath does not match search settings");
}
} else {
throw new SearchException("Startpath is not a searchable file type");
}
if (settings.getVerbose()) {
log("\nFile search complete.\n");
}
}
public final void searchPath(final File filePath) {
// get the search directories
if (settings.getDoTiming())
startTimer("getSearchDirs");
List<File> searchDirs = getSearchDirs(filePath);
if (settings.getDoTiming()) {
stopTimer("getSearchDirs");
if (settings.getPrintResults()) {
printElapsed("getSearchDirs");
}
}
if (settings.getVerbose()) {
log(String.format("\nDirectories to be searched (%d):",
searchDirs.size()));
for (File d : searchDirs) {
System.out.println(d.getPath());
}
log("");
}
// get the search files in the search directories
if (settings.getDoTiming())
startTimer("getSearchFiles");
List<SearchFile> searchFiles = getSearchFiles(searchDirs);
if (settings.getDoTiming()) {
stopTimer("getSearchFiles");
if (settings.getPrintResults()) {
printElapsed("getSearchFiles");
}
}
if (settings.getVerbose()) {
log(String.format("\nFiles to be searched (%d):",
searchFiles.size()));
for (SearchFile sf : searchFiles) {
log(sf.toString());
}
log("");
}
// search the files
if (settings.getDoTiming())
startTimer("searchFiles");
for (SearchFile sf : searchFiles) {
searchFile(sf);
}
if (settings.getDoTiming()) {
stopTimer("searchFiles");
if (settings.getPrintResults()) {
printElapsed("searchFiles");
printTotalElapsed();
}
}
}
public final void searchFile(final SearchFile sf) {
FileType fileType = sf.getFileType();
if (fileType == FileType.TEXT) {
searchTextFile(sf);
} else if (fileType == FileType.BINARY) {
searchBinaryFile(sf);
}
}
public final void searchTextFile(final SearchFile sf) {
if (settings.getVerbose()) {
log(String.format("Searching text file %s", sf.toString()));
}
if (settings.getMultiLineSearch()) {
searchTextFileContents(sf);
} else {
searchTextFileLines(sf);
}
}
public final void searchTextFileContents(final SearchFile sf) {
try {
String contents = FileUtil.getFileContents(sf.toFile());
List<SearchResult> results = searchMultiLineString(contents);
for (SearchResult r : results) {
r.setSearchFile(sf);
addSearchResult(r);
}
} catch (NoSuchElementException e) {
log(e.toString() + ": " + sf.getPath());
} catch (IllegalStateException e) {
log(e.toString());
} catch (IOException e) {
log(e.toString());
}
}
private List<Number> getNewLineIndices(final String s) {
List<Number> newlineIndices = new ArrayList<Number>();
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '\n')
newlineIndices.add(i);
}
return newlineIndices;
}
private List<Number> getStartLineIndicesFromNewLineIndices(final List<Number> newLineIndices) {
List<Number> startLineIndices = new ArrayList<Number>();
startLineIndices.add(0);
for (Number newLineIndex : newLineIndices) {
startLineIndices.add(newLineIndex.longValue() + 1);
}
return startLineIndices;
}
private List<Number> getEndLineIndicesFromNewLineIndices(final String s,
final List<Number> newLineIndices) {
List<Number> endLineIndices = new ArrayList<Number>();
for (Number newLineIndex : newLineIndices) {
endLineIndices.add(newLineIndex.longValue());
}
endLineIndices.add(s.length() - 1);
return endLineIndices;
}
public final List<SearchResult> searchMultiLineString(final String s) {
List<SearchResult> results = new ArrayList<SearchResult>();
for (Pattern p : settings.getSearchPatterns()) {
for (SearchResult r : searchMultiLineStringForPattern(s, p)) {
results.add(r);
}
}
return results;
}
private List<String> getLinesBeforeFromMultiLineString(final String s,
final List<Number> beforeStartIndices,
final List<Number> beforeEndIndices) {
List<String> linesBefore = new ArrayList<String>();
if (settings.getLinesBefore() > 0) {
List<Number> starts = ListUtil.takeRight(beforeStartIndices,
settings.getLinesBefore());
List<Number> ends = ListUtil.tail(ListUtil.takeRight(beforeEndIndices,
settings.getLinesBefore() + 1));
for (int i = 0; i < starts.size(); i++) {
linesBefore.add(s.substring(starts.get(i).intValue(),
ends.get(i).intValue() - 1));
}
}
return linesBefore;
}
private List<String> getLinesAfterFromMultiLineString(final String s,
final List<Number> afterStartIndices,
final List<Number> afterEndIndices) {
List<String> linesAfter = new ArrayList<String>();
if (settings.getLinesAfter() > 0) {
List<Number> starts = ListUtil.take(afterStartIndices, settings.getLinesAfter());
List<Number> ends = ListUtil.tail(ListUtil.take(afterEndIndices,
settings.getLinesAfter() + 1));
for (int i = 0; i < starts.size(); i++) {
linesAfter.add(s.substring(starts.get(i).intValue(),
ends.get(i).intValue() - 1));
}
}
return linesAfter;
}
private List<SearchResult> searchMultiLineStringForPattern(final String s,
final Pattern p) {
Map<Pattern, Integer> patternMatches = new HashMap<Pattern, Integer>();
List<SearchResult> results = new ArrayList<SearchResult>();
List<Number> newLineIndices = getNewLineIndices(s);
List<Number> startLineIndices = getStartLineIndicesFromNewLineIndices(newLineIndices);
List<Number> endLineIndices = getEndLineIndicesFromNewLineIndices(s,
newLineIndices);
Matcher m = p.matcher(s);
boolean found = m.find();
while (found) {
if (settings.getFirstMatch() && patternMatches.containsKey(p)) {
found = false;
} else {
// get the start and end indices before the match index
List<Number> beforeStartIndices = ListUtil.lessThanOrEqualTo(m.start(),
startLineIndices);
List<Number> beforeEndIndices = ListUtil.lessThan(m.start(),
endLineIndices);
// add another end line index if it exists or the tail index of the string
if (endLineIndices.size() > beforeEndIndices.size())
beforeEndIndices.add(endLineIndices.get(beforeEndIndices.size()));
else
beforeEndIndices.add(s.length() - 1);
List<Number> afterStartIndices = ListUtil.greaterThan(m.start(),
startLineIndices);
List<Number> afterEndIndices = ListUtil.greaterThan(m.start(),
endLineIndices);
int lineNum = beforeStartIndices.size();
int startLineIndex = ListUtil.max(beforeStartIndices).intValue();
int endLineIndex = ListUtil.min(afterStartIndices).intValue() - 1;
//log(String.format("startLineIndex: %d", startLineIndex));
//log(String.format("endLineIndex: %d", endLineIndex));
String line;
if (endLineIndex > -1) {
line = s.substring(startLineIndex, endLineIndex);
} else {
line = s.substring(startLineIndex);
}
List<String> linesBefore = getLinesBeforeFromMultiLineString(s,
ListUtil.init(beforeStartIndices),
ListUtil.init(beforeEndIndices));
List<String> linesAfter = getLinesAfterFromMultiLineString(s,
afterStartIndices, afterEndIndices);
if ((linesBefore.isEmpty() || linesBeforeMatch(linesBefore))
&&
(linesAfter.isEmpty() || linesAfterMatch(linesAfter))) {
SearchResult searchResult = new SearchResult(
p,
null,
lineNum,
m.start() - startLineIndex + 1,
m.end() - startLineIndex + 1,
line,
linesBefore,
linesAfter);
results.add(searchResult);
patternMatches.put(p, 1);
}
found = m.find(m.end());
}
}
return results;
}
public final void searchTextFileLines(final SearchFile sf) {
LineIterator it = null;
try {
it = FileUtil.getFileLineIterator(sf.toFile());
List<SearchResult> results = searchStringIterator(it);
for (SearchResult r : results) {
r.setSearchFile(sf);
addSearchResult(r);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (it != null) it.close();
}
}
private boolean linesMatch(final List<String> lines,
final Set<Pattern> inPatterns,
final Set<Pattern> outPatterns) {
return ((inPatterns.size() == 0 || anyMatchesAnyPattern(lines, inPatterns))
&&
(outPatterns.size() == 0 || !anyMatchesAnyPattern(lines, outPatterns)));
}
private boolean linesBeforeMatch(final List<String> linesBefore) {
return linesMatch(linesBefore, settings.getInLinesBeforePatterns(),
settings.getOutLinesBeforePatterns());
}
private boolean linesAfterMatch(final List<String> linesAfter) {
return linesMatch(linesAfter, settings.getInLinesAfterPatterns(),
settings.getOutLinesAfterPatterns());
}
public final List<SearchResult> searchStringIterator(final Iterator<String> it) {
boolean stop = false;
int lineNum = 0;
String line;
List<String> linesBefore = new ArrayList<String>();
List<String> linesAfter = new ArrayList<String>();
Map<Pattern, Integer> patternMatches = new HashMap<Pattern, Integer>();
List<SearchResult> results = new ArrayList<SearchResult>();
while ((it.hasNext() || linesAfter.size() > 0) && !stop) {
lineNum++;
if (!linesAfter.isEmpty())
line = linesAfter.remove(0);
else
line = it.next();
if (settings.getLinesAfter() > 0) {
while (linesAfter.size() < settings.getLinesAfter() && it.hasNext())
linesAfter.add(it.next());
}
if ((settings.getLinesBefore() == 0 || linesBefore.isEmpty() ||
linesBeforeMatch(linesBefore))
&&
(settings.getLinesAfter() == 0 || linesAfter.isEmpty() ||
linesAfterMatch(linesAfter))) {
for (Pattern p : settings.getSearchPatterns()) {
Matcher m = p.matcher(line);
boolean found = m.find();
while (found) {
// take care of linesAfterToPatterns or linesAfterUntilPatterns
boolean linesAfterToMatch = false;
boolean linesAfterUntilMatch = false;
if (settings.hasLinesAfterToOrUntilPatterns()) {
if (settings.hasLinesAfterToPatterns()) {
Set<Pattern> linesAfterToPatterns = settings.getLinesAfterToPatterns();
if (anyMatchesAnyPattern(linesAfter, linesAfterToPatterns)) {
linesAfterToMatch = true;
} else {
while (it.hasNext() && !linesAfterToMatch) {
String nextLine = it.next();
linesAfter.add(nextLine);
if (matchesAnyPattern(nextLine, linesAfterToPatterns)) {
linesAfterToMatch = true;
}
}
}
} else if (settings.hasLinesAfterUntilPatterns()) {
Set<Pattern> linesAfterUntilPatterns = settings.getLinesAfterUntilPatterns();
if (anyMatchesAnyPattern(linesAfter, linesAfterUntilPatterns)) {
linesAfterUntilMatch = true;
} else {
while (it.hasNext() && !linesAfterUntilMatch) {
String nextLine = it.next();
linesAfter.add(nextLine);
if (matchesAnyPattern(nextLine, linesAfterUntilPatterns)) {
linesAfterUntilMatch = true;
}
}
}
}
}
if (settings.getFirstMatch() && patternMatches.containsKey(p)) {
stop = true;
} else if (settings.hasLinesAfterToOrUntilPatterns() &&
!linesAfterToMatch && !linesAfterUntilMatch) {
found = false;
} else {
List<String> resLinesAfter;
if (linesAfterUntilMatch)
resLinesAfter = ListUtil.init(linesAfter);
else
resLinesAfter = linesAfter;
SearchResult searchResult = new SearchResult(
p,
null,
lineNum,
m.start() + 1,
m.end() + 1,
line,
new ArrayList<String>(linesBefore),
new ArrayList<String>(resLinesAfter));
results.add(searchResult);
patternMatches.put(p, 1);
found = m.find(m.end());
}
}
}
}
if (settings.getLinesBefore() > 0) {
if (linesBefore.size() == settings.getLinesBefore())
linesBefore.remove(0);
if (linesBefore.size() < settings.getLinesBefore())
linesBefore.add(line);
}
}
return results;
}
public final void searchBinaryFile(final SearchFile sf) {
if (settings.getVerbose()) {
log(String.format("Searching binary file %s", sf.getPath()));
}
try {
Scanner scanner = new Scanner(sf.toFile(), "ISO8859-1").useDelimiter("\\Z");
try {
String content = scanner.next();
for (Pattern p : settings.getSearchPatterns()) {
Matcher m = p.matcher(content);
if (m.find()) {
SearchResult searchResult =
new SearchResult(p, sf, 0, 0, 0, "");
addSearchResult(searchResult);
}
}
} catch (NoSuchElementException e) {
log(e.toString());
} catch (IllegalStateException e) {
log(e.toString());
} finally {
scanner.close();
}
} catch (IOException e) {
log(e.toString());
}
}
private final void addSearchResult(final SearchResult searchResult) {
results.add(searchResult);
searchFileSet.add(searchResult.getSearchFile());
}
public final void printSearchResults() {
log(String.format("Search results (%d):", results.size()));
for (SearchResult r : results) {
log(r.toString());
}
}
public final List<String> getMatchingDirs() {
Set<String> dirSet = new HashSet<String>();
for (SearchFile sf : searchFileSet) {
dirSet.add(sf.getPath());
}
List<String> dirs = new ArrayList<String>(dirSet);
java.util.Collections.sort(dirs);
return dirs;
}
public final void printMatchingDirs() {
List<String> dirs = getMatchingDirs();
log(String.format("\nDirectories with matches (%d):", dirs.size()));
for (String d : dirs) {
log(d);
}
}
public final List<String> getMatchingFiles() {
List<String> files = new ArrayList<String>();
for (SearchFile sf : searchFileSet) {
files.add(sf.toString());
}
java.util.Collections.sort(files);
return files;
}
public final void printMatchingFiles() {
List<String> files = getMatchingFiles();
log(String.format("\nFiles with matches (%d):", files.size()));
for (String f : files) {
log(f);
}
}
public final List<String> getMatchingLines() {
List<String> lines = new ArrayList<String>();
for (SearchResult r : results) {
lines.add(r.getLine().trim());
}
if (settings.getUniqueLines()) {
Set<String> lineSet = new HashSet<String>(lines);
lines = new ArrayList<String>(lineSet);
}
java.util.Collections.sort(lines);
return lines;
}
public final void printMatchingLines() {
List<String> lines = getMatchingLines();
String hdr;
if (settings.getUniqueLines())
hdr = "\nUnique lines with matches (%d):";
else
hdr = "\nLines with matches (%d):";
log(String.format(hdr, lines.size()));
for (String line : lines) {
log(line);
}
}
}
|
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* Created by cristopher_ramirez on 24/11/16.
*/
public class Grayscale {
public static void main(String args[])throws IOException {
BufferedImage img = null;
File f = null;
int count=0;
double sum=0;
int j;
int k;
int CounterA = 0;
int CounterB = 0;
int l,m=0;
int holderX;
int holderY;
int holderV;
int cunt=0;
int cycle=0;
int w=0,v=0;
BufferedImage edge = null;
File edgeimg = null;
//read image
try{
f = new File("/home/cristopher_ramirez/Documents/TESTMATRIX/wey.jpg");
img = ImageIO.read(f);
}catch(IOException e){
System.out.println(e);
}
//get image width and height
int width = img.getWidth();
int height = img.getHeight();
int ImageMatrix[][] = new int[width][height];
int Kernel[][] = {
{-1,-1,-1},
{-1,8,-1},
{-1,-1,-1}
};
int ConvEdgeMatrix[][] = new int[width][height];
int output[][] = new int[width][height];
//convert to grayscale
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
int p = img.getRGB(x,y);
int a = (p>>24)&0xff;
int r = (p>>16)&0xff;
int g = (p>>8)&0xff;
int b = p&0xff;
//calculate average
int avg = (r+g+b)/3;
//replace RGB value with avg
p = (a<<24) | (avg<<16) | (avg<<8) | avg;
ImageMatrix[x][y]=avg;
//Printing the pixel value
System.out.print(ImageMatrix[x][y] + " ");
//Counter for the pixels
count++;
img.setRGB(x, y, p);
}
System.out.println();
}
System.out.println("Ancho:" + width);
System.out.println("Largo:" + height);
System.out.println("Numero de pixeles en la imagen:" + count);
count=0;
//function to get the convolved feature (multiply the matrix and the edgematrix)
//for(j=0;j<height;j++) {
for (k = 0; k < width; k++) {
for (w = 0; w < 3; w++) {
int Sj=w;
for (v = 0; v < 3; v++) {
int Sk=v+CounterB;
sum += ImageMatrix[Sj][Sk] * Kernel[w][v];
}
}
CounterA++;
CounterB++;
}
//}
/* holderY=cycle;
for (int x = 0; x < width; x++) {
w = 0;
holderX = x;
for (w = 0; w < 3; w++) {
v = 0;
if (w > 0)
x++;
for (v = 0; v < 3; v++) {
sum = sum + ImageMatrix[v][x] * Kernel[v][w];
if (w == 2 && v == 2)
x = holderX;
}
}
System.out.println("Valor final de la matriz:" + sum);
cunt++;
}
System.out.println("Numero de salidas de la matriz:" + cunt);
*/
//write image
try{
f = new File("/home/cristopher_ramirez/Documents/TESTMATRIX/graybear.jpg");
ImageIO.write(img, "jpg", f);
}catch(IOException e){
System.out.println(e);
}
}//main() ends here
}
|
package problem_solve.bfs.baekjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class BaekJoon5214{
// 하이퍼튜브를 이용하여 1번에서 N번 역에 가는 도중 거처야 하는 역의 개수
// 1번 역도 포함한게 된다.
private static int station;
private static int tube;
private static ArrayList<ArrayList<Integer>> connection = new ArrayList<>();
private static boolean visited[] = new boolean[101005];
private static int visitedAt[] = new int[101005];
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
station = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
tube = Integer.parseInt(st.nextToken());
Arrays.fill(visitedAt, Integer.MAX_VALUE);
for(int i=0; i <= station + tube; i++){
connection.add(new ArrayList<>());
}
for(int i=1; i <= tube; i++){
st = new StringTokenizer(br.readLine());
int dummy = station + i;
for(int j=0; j < m; j++){
int neighbor = Integer.parseInt(st.nextToken());
connection.get(dummy).add(neighbor);
connection.get(neighbor).add(dummy);
}
}
int result = bfs(1, station);
System.out.println(result == -1 ? -1 : (result + 1) / 2);
}
private static int bfs(int start, int target){
Queue<Integer> q = new LinkedList<>();
q.add(start);
visited[start] = true;
visitedAt[start] = 1;
while(!q.isEmpty()){
int actual = q.remove();
ArrayList<Integer> connected = connection.get(actual);
if(actual == target){
return visitedAt[actual];
}
for(int next : connected){
if(!visited[next] && visitedAt[next] > visitedAt[actual] + 1){
visited[next] = true;
visitedAt[next] = visitedAt[actual] + 1;
System.out.println("next : " + next + ", visited : " + visitedAt[next]);
q.add(next);
}
}
}
return -1;
}
}
|
package com.t.s.model.dao;
import java.util.List;
import com.t.s.model.dto.ImgBoardAnsDto;
public interface ImgBoardAnsDao {
String NAMESPACE = "onoff.";
// 아래에는 기능만
// public List<CustomerDto> selectList(); 이런식으로만
public int ImgBoardAnsInsert(ImgBoardAnsDto imgboardansdto);
public int ImgBoardAnsDelete(int imgansno);
public List<ImgBoardAnsDto> ImgBoardAnsList(int imgboardno);
public int ImgBoardUserAnsDelete(String userid);
}
|
package ba.bitcamp.LabS07D02.vjezbe;
import java.awt.Color;
import java.awt.Graphics;
public class Circle extends Geometry {
private int radius;
public Circle(int positionX, int positionY, int radius, Color color) {
super(positionX, positionY, color);
this.radius = radius;
}
public void draw(Graphics g, int frame) {
g.setColor(super.getColor());
g.fillOval(super.getPositionX(), super.getPositionY(), this.radius,
this.radius);
}
@Override
public void move(int frame) {
if (this.getPositionX() > 500)
this.setPositionX(this.getPositionX() - (frame--));
else if (this.getPositionY() > 300)
this.setPositionY(this.getPositionY() - (frame--));
else {
this.setPositionX(this.getPositionX() + frame);
this.setPositionY(this.getPositionY() + frame);
}
}
}
|
package interviews.facebook;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class Friend {
private Collection<Friend> friends;
private String email;
public Friend(String email) {
this.email = email;
this.friends = new ArrayList<Friend>();
}
public String getEmail() {
return email;
}
public Collection<Friend> getFriends() {
return friends;
}
public void addFriendship(Friend friend) {
friends.add(friend);
friend.getFriends().add(this);
}
public boolean canBeConnected(Friend friend) {
Map<Friend, Boolean> visited = new HashMap<Friend, Boolean>();
return canBeConnected(friend, visited);
}
private boolean canBeConnected(Friend friend, Map<Friend, Boolean> visited) {
if(this == friend) return true;
if(visited.containsKey(friend)) return false;
visited.put(friend, true);
for (Friend fri : friend.friends) {
if(canBeConnected(fri, visited)) return true;
}
return false;
}
public static void main(String[] args) {
Friend a = new Friend("A");
Friend b = new Friend("B");
Friend c = new Friend("C");
Friend d = new Friend("D");
Friend e = new Friend("E");
a.addFriendship(b);
c.addFriendship(d);
d.addFriendship(e);
System.out.println(c.canBeConnected(e));
System.out.println(a.canBeConnected(d));
}
}
|
package test.json;
import java.util.HashMap;
import java.util.Map;
public class AcceptAddress {
/**
*
*/
private static final long serialVersionUID = -112668954712473573L;
//订单那块直接读的库
private int id;
private Integer userId;//用户Id
private String username;//用户名
private String realName;//收货人姓名
private String postCode;//邮编
private String address;//地址
private String tel;//电话
private String mobile;//手机
private String province;//省编号
private String city;//市编号
private String county;//县编号
private String email;
private String invoiceTitle;//发票抬头
private String provinceName;//省名字
private String cityName;//城市名字
private String countyName;//村名字
private Integer isDefault;//(1是默认,0是不默认,订单暂时不用)
private String quickOrderName;//一键下单名称
private String paytype;//支付方式id (1/8在线支付 0货到刷卡 3货到付款 4银行转账,20线下支付)
private String payBankName; //支付银行名称
private String invoiceInfo;//发票信息
private Integer addressType;//地址簿类型,0代表普通地址簿,1代表一键下单地址簿
private Integer isDefaultOfQuickOrderInfo; //是否一键下单地址的默认值,0不是,1是
private String DeliverType; // 配送方式
private String payName;//支付名称,用户中心显示使用,与数据库无关
private String siteId; //仓id
private Integer invoiceType;//发票类型 0个人 1单位 3不开发票
private String payBankCode;//支付银行id
private String payBankUrl;//支付银行图片url
private String areaCode; //收货人电话区号
private String extension; //收货人电话分机号
private String identityId; //身份证编号
private String identityName;//身份证名称
private Integer invoiceStyle;//发票类型【0:纸质,1:电子】
private Integer ddd;
public int getDdd() {
return ddd;
}
public void setDdd(int ddd) {
this.ddd = ddd;
}
public String getPayBankCode() {
return payBankCode;
}
public void setPayBankCode(String payBankCode) {
this.payBankCode = payBankCode;
}
public String getPayBankUrl() {
return payBankUrl;
}
public void setPayBankUrl(String payBankUrl) {
this.payBankUrl = payBankUrl;
}
public Integer getInvoiceType() {
return invoiceType;
}
public void setInvoiceType(Integer invoiceType) {
this.invoiceType = invoiceType;
}
public String getPayBankName() {
return payBankName;
}
public void setPayBankName(String payBankName) {
this.payBankName = payBankName;
}
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getPaytype() {
return paytype;
}
public void setPaytype(String paytype) {
this.paytype = paytype;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getInvoiceTitle() {
return invoiceTitle;
}
public void setInvoiceTitle(String invoiceTitle) {
this.invoiceTitle = invoiceTitle;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public Integer getIsDefault() {
return isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
public String getQuickOrderName() {
return quickOrderName;
}
public void setQuickOrderName(String quickOrderName) {
this.quickOrderName = quickOrderName;
}
public String getInvoiceInfo() {
return invoiceInfo;
}
public void setInvoiceInfo(String invoiceInfo) {
this.invoiceInfo = invoiceInfo;
}
public Integer getAddressType() {
return addressType;
}
public void setAddressType(Integer addressType) {
this.addressType = addressType;
}
public Integer getIsDefaultOfQuickOrderInfo() {
return isDefaultOfQuickOrderInfo;
}
public void setIsDefaultOfQuickOrderInfo(Integer isDefaultOfQuickOrderInfo) {
this.isDefaultOfQuickOrderInfo = isDefaultOfQuickOrderInfo;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getDeliverType() {
return DeliverType;
}
public void setDeliverType(String deliverType) {
DeliverType = deliverType;
}
public String getPayName() {
return payName;
}
public void setPayName(String payName) {
this.payName = payName;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getExtension() {
return extension;
}
public void setExtension(String extension) {
this.extension = extension;
}
public String getIdentityId() {
return identityId;
}
public void setIdentityId(String identityId) {
this.identityId = identityId;
}
public String getIdentityName() {
return identityName;
}
public void setIdentityName(String identityName) {
this.identityName = identityName;
}
public Integer getInvoiceStyle() {
return invoiceStyle;
}
public void setInvoiceStyle(Integer invoiceStyle) {
this.invoiceStyle = invoiceStyle;
}
public static void main(String[] args) {
AcceptAddress a=new AcceptAddress();
//System.out.println(String.valueOf(null));
Integer aa=null;
//System.out.println(aa!=0);
Map<String ,String> map=new HashMap<>();
map.put("123",null+"");
System.out.println(map.get("123"));
System.out.println(String.valueOf(a.ddd));
}
}
|
package com.udacity.jdnd.course3.critter.dao;
import com.udacity.jdnd.course3.critter.entity.Pet;
import com.udacity.jdnd.course3.critter.pet.PetType;
import com.udacity.jdnd.course3.critter.entity.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.List;
@Repository
@Transactional
public class PetDaoImpl implements PetDao {
@Autowired
NamedParameterJdbcTemplate jdbcTemplate;
@Autowired
CustomerDao customerDao;
private static final String BIRTH_DATE = "birthDate";
private static final String NAME = "name";
private static final String NOTES = "notes";
private static final String TYPE = "type";
private static final String OWNER_ID = "owner_id";
private static final String SELECT_ALL_PET =
"SELECT * FROM pet";
private static final String SELECT_PET_BY_ID =
"SELECT * FROM pet " +
"WHERE id = :id";
private static final String SELECT_PET_BY_OWNER_ID =
"SELECT * FROM pet " +
"WHERE owner_id = :id";
private static final String INSERT_PET =
"INSERT INTO pet (birth_date, name, notes, type, owner_id) " +
"VALUES(:" + BIRTH_DATE + ", :" + NAME + ", :" + NOTES + ", :" + TYPE + ", :" + OWNER_ID + ")";
private static final RowMapper<Pet> petRowMapper =
new BeanPropertyRowMapper<>(Pet.class);
@Override
public Long addPet(Pet pet) {
Long ownerId = null;
if (pet.getCustomer() != null) {
ownerId = pet.getCustomer().getId();
}
KeyHolder key = new GeneratedKeyHolder();
jdbcTemplate.update(INSERT_PET,
new MapSqlParameterSource()
.addValue(BIRTH_DATE, pet.getBirthDate())
.addValue(NAME, pet.getName())
.addValue(NOTES, pet.getNotes())
.addValue(TYPE, pet.getType().toString())
.addValue(OWNER_ID, ownerId),
key);
return key.getKey().longValue();
}
@Override
public List<Pet> list() {
return jdbcTemplate.query(SELECT_ALL_PET, (rs, rowNum) -> getPetByRS(rs));
}
@Override
public Pet findPetById(Long id) {
return jdbcTemplate.queryForObject(
SELECT_PET_BY_ID,
new MapSqlParameterSource().addValue("id", id),
(rs, rowNum) -> getPetByRS(rs)
);
}
@Override
public List<Pet> getPetsByOwner(Long id) {
return jdbcTemplate.query(
SELECT_PET_BY_OWNER_ID,
new MapSqlParameterSource().addValue("id", id),
(rs, rowNum) -> getPetByRS(rs));
}
private Customer getCustomerById(Long id) {
if(id != null){
return customerDao.getCustomerById(id);
}
return null;
}
private Pet getPetByRS(ResultSet rs) throws SQLException {
LocalDate localDate = null;
if(rs.getTimestamp("birth_date") != null) {
localDate = rs.getTimestamp("birth_date").toLocalDateTime().toLocalDate();
}
return new Pet(
rs.getLong("id"),
PetType.valueOf(rs.getString("type")),
rs.getString("name"),
localDate,
rs.getString("notes"),
getCustomerById(rs.getLong("owner_id"))
);
}
}
|
package com.example.user.myapplication.lockscreen.viewpager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.SparseArray;
import android.view.ViewGroup;
import com.example.user.myapplication.domain.Product;
import com.example.user.myapplication.lockscreen.fragment.SlideFragment;
/**
* Created by Junho on 2016-03-17.
*/
public class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
SparseArray<Fragment> registeredFragments = new SparseArray<Fragment>();
Product[] products;
private int TOTALNUM;
public ScreenSlidePagerAdapter(FragmentManager fm, int num,Product[] products) {
super(fm);
this.TOTALNUM = num;
this.products = products;
}
@Override
public Fragment getItem(int position) {
return SlideFragment.newInstance(position, products[position]);
}
@Override
public int getCount() {
return TOTALNUM;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
Fragment fragment = (Fragment)super.instantiateItem(container,position);
registeredFragments.put(position,fragment);
return fragment;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
registeredFragments.remove(position);
super.destroyItem(container, position, object);
}
public Fragment getRegisteredFragment(int position){
return registeredFragments.get(position);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.