text stringlengths 10 2.72M |
|---|
/*
* Copyright 2002-2022 the original author or authors.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.io.support;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
/**
* Region of a {@link Resource} implementation, materialized by a {@code position}
* within the {@link Resource} and a byte {@code count} for the length of that region.
*
* @author Arjen Poutsma
* @since 4.3
*/
public class ResourceRegion {
private final Resource resource;
private final long position;
private final long count;
/**
* Create a new {@code ResourceRegion} from a given {@link Resource}.
* This region of a resource is represented by a start {@code position}
* and a byte {@code count} within the given {@code Resource}.
* @param resource a Resource
* @param position the start position of the region in that resource
* @param count the byte count of the region in that resource
*/
public ResourceRegion(Resource resource, long position, long count) {
Assert.notNull(resource, "Resource must not be null");
Assert.isTrue(position >= 0, "'position' must be greater than or equal to 0");
Assert.isTrue(count >= 0, "'count' must be greater than or equal to 0");
this.resource = resource;
this.position = position;
this.count = count;
}
/**
* Return the underlying {@link Resource} for this {@code ResourceRegion}.
*/
public Resource getResource() {
return this.resource;
}
/**
* Return the start position of this region in the underlying {@link Resource}.
*/
public long getPosition() {
return this.position;
}
/**
* Return the byte count of this region in the underlying {@link Resource}.
*/
public long getCount() {
return this.count;
}
}
|
/*
* Copyright © 2018 www.noark.xyz All Rights Reserved.
*
* 感谢您选择Noark框架,希望我们的努力能为您提供一个简单、易用、稳定的服务器端框架 !
* 除非符合Noark许可协议,否则不得使用该文件,您可以下载许可协议文件:
*
* http://www.noark.xyz/LICENSE
*
* 1.未经许可,任何公司及个人不得以任何方式或理由对本框架进行修改、使用和传播;
* 2.禁止在本项目或任何子项目的基础上发展任何派生版本、修改版本或第三方版本;
* 3.无论你对源代码做出任何修改和改进,版权都归Noark研发团队所有,我们保留所有权利;
* 4.凡侵犯Noark版权等知识产权的,必依法追究其法律责任,特此郑重法律声明!
*/
package xyz.noark.core.ioc.definition.field;
import xyz.noark.core.ioc.IocMaking;
import xyz.noark.core.ioc.definition.DefaultBeanDefinition;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.Comparator;
import java.util.stream.Collectors;
/**
* List类型的注入.
* <p>
* 所有实现此接口或继承此类的都算.
*
* @author 小流氓[176543888@qq.com]
* @since 3.0
*/
public class ListFieldDefinition extends DefaultFieldDefinition {
public ListFieldDefinition(Field field, boolean required) {
super(field, (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0], required);
}
@Override
protected Object extractInjectionObject(IocMaking making, Class<?> klass, Field field) {
return making.findAllImpl(fieldClass).stream().sorted(Comparator.comparingInt(DefaultBeanDefinition::getOrder)).map(DefaultBeanDefinition::getSingle).collect(Collectors.toList());
}
} |
package com.example.findwitness;
import android.util.Log;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Hashing {
public static String hashing(String str) {
String result;
try {
MessageDigest sh = MessageDigest.getInstance("SHA-256");
sh.update(str.getBytes());
byte byteData[] = sh.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString(byteData[i] & 0xff + 0x100, 16).substring(1));
}
result = sb.toString();
} catch(NoSuchAlgorithmException e) {
Log.e("Exception error", e.getMessage());
result = null;
}
return result;
}
}
|
package model.fighter;
public class SwordDecorator extends Hero{
private int swordStrenght;
public SwordDecorator(Fighter fighter,int swordStrenght){
super(fighter);
this.swordStrenght = swordStrenght;
}
@Override
public int getStrength() {
return super.getStrength() + this.swordStrenght;
}
}
|
package com.company;
import java.io.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Scanner;
public class FileHandling {
static String fileFolder = "c:\\ATM\\";
static String directoryName = "Directory.txt";
static String bootHistory = "SIHistory.txt";
//creates/checks existence of directory when program boots up
//directory includes account number and username of each customer
public static boolean createDirectory() {
boolean success;
try {
File directory = new File(fileFolder + directoryName);
if (directory.createNewFile()) {
System.out.println("File created: " + directory.getName());
success = true;
} else {
System.out.println("Directory already exists.");
success = true;
}
} catch (IOException e) {
System.out.println("An error occurred in directory creation.");
e.printStackTrace();
success = false;
}
return success;
}
//creates a log of every customer sign in with time stamp
public static boolean createSIHistory() {
boolean success;
try {
File myObj = new File(fileFolder + bootHistory);
if (myObj.createNewFile()) {
System.out.println("Sign In History created: " + myObj.getName());
success = true;
} else {
System.out.println("Sign In History exists.");
success = true;
}
} catch (IOException e) {
success = false;
}
return success;
}
//logs each instance of a customer sign in, with account number and local time
public static void recordSignIN(String accountNumber) {
LocalDateTime time = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
String tTime = time.format(formatter);
try {
FileWriter myWriter = new FileWriter(fileFolder + bootHistory, true);
myWriter.write(accountNumber + " " +tTime + System.lineSeparator());
myWriter.flush();
myWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
//scans directory file for usernames
public static boolean existingUser(String userName) {
boolean redundant = false;
char[] nBuffer = new char[9];
int stringLength = 0;
String uname = "";
int accountNumber = 1234567;
try {
File myObj = new File(fileFolder + directoryName);
Scanner myReader = new Scanner(myObj);
while (myReader.hasNextLine() && redundant == false) {
String test = Encrypt.decrypt(myReader.nextLine(), accountNumber);
stringLength = test.length();
int f = 0;
for(int i = 7; i < stringLength; i++) {
nBuffer[f] = test.charAt(i);
f++;
}
uname = uname.copyValueOf(nBuffer,0,f);
if(userName.equalsIgnoreCase(uname)) {
redundant = true;
}
}
myReader.close();
} catch (FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
return redundant;
}
//creates file for each customer
//file includes customer name, password, starting balance, and transaction history
public static boolean createAccountFile(String fName, String lName, String uName, String password, double balance, String accountNumber) {
boolean success;
int dAccountNumber = 1234567;
try {
//creates new file for the account, named after account number
FileWriter myWriter = new FileWriter(fileFolder + accountNumber);
myWriter.write(Encrypt.encrypt(accountNumber, Integer.valueOf(accountNumber)) + System.lineSeparator());
myWriter.write(Encrypt.encrypt(fName, Integer.valueOf(accountNumber)) + " ");
myWriter.write(Encrypt.encrypt(lName, Integer.valueOf(accountNumber)) + System.lineSeparator());
myWriter.write(Encrypt.encrypt(password, Integer.valueOf(accountNumber)) + System.lineSeparator());
myWriter.write("******" + System.lineSeparator());
myWriter.flush();
myWriter.close();
recordTransaction(accountNumber, "Account Creation +", balance, balance);
//adds this account to the directory
FileWriter writeDirectory = new FileWriter(fileFolder + directoryName, true);
writeDirectory.write(Encrypt.encrypt(accountNumber +uName, dAccountNumber) + System.lineSeparator());
writeDirectory.flush();
writeDirectory.close();
success = true;
} catch (IOException e) {
System.out.println("An error occurred with creating account file");
e.printStackTrace();
success = false;
}
return success;
}
//verifies username and password during sign in
public static String checkUnamePassword(String enteredUname, String enteredPassword) {
boolean match = false;
boolean continueSearch = true;
String accountNumber = "1234567";
String currentPassword = null;
char[] uHolder = new char[9];
char[] nHolder = new char[7];
String aHolder = "";
int stringLength = 0;
try {
File myObj = new File(fileFolder + directoryName);
Scanner myReader = new Scanner(myObj);
while (myReader.hasNextLine() && continueSearch == true) {
String buffer = Encrypt.decrypt(myReader.nextLine(), Integer.valueOf(accountNumber));
stringLength = buffer.length();
stringLength -= 7;
int f = 7;
for(int i = 0; i < stringLength; i++) {
uHolder[i] = buffer.charAt(f);
f++;
}
aHolder = aHolder.copyValueOf(uHolder,0, stringLength);
if(enteredUname.equals(aHolder)) {
for(int i = 0; i < 7; i++) {
nHolder[i] = buffer.charAt(i);
}
accountNumber = accountNumber.copyValueOf(nHolder, 0, 7);
continueSearch = false;
}
}
myReader.close();
} catch (FileNotFoundException e) {
System.out.println("An error occurred searching for username & login in directory.");
e.printStackTrace();
}
try {
File myObj2 = new File(fileFolder + accountNumber);
Scanner myReader = new Scanner(myObj2);
for(int i = 0; i < 3; i++){
currentPassword = Encrypt.decrypt(myReader.nextLine(), Integer.valueOf(accountNumber));
}
if(!currentPassword.equals(enteredPassword)) {
accountNumber = null;
}
}catch (FileNotFoundException e) {
System.out.println("Could not find account file.");
//e.printStackTrace();
}
return accountNumber;
}
//returns balance in customer file
public static double checkBalance(String accountNumber) {
double currentBalance=0;
String buffer = null;
try {
File myObj = new File(fileFolder + accountNumber);
Scanner scan = new Scanner(myObj);
while(scan.hasNextLine()){
buffer = Encrypt.decrypt(scan.nextLine(), Integer.valueOf(accountNumber));
}
} catch (FileNotFoundException e) {
System.out.println("Could not find account file.");
e.printStackTrace();
}
currentBalance = Double.valueOf(buffer);
return currentBalance;
}
//logs each transaction in customer file, including new balance
public static void recordTransaction(String accountNumber, String transactionType, double transactionAmount, double newBalance) {
String tAmount = Double.toString(transactionAmount);
String finalBalance = Double.toString(newBalance);
LocalDateTime time = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
String tTime = time.format(formatter);
try {
FileWriter myWriter = new FileWriter(fileFolder + accountNumber, true);
myWriter.write(Encrypt.encrypt("*** ", Integer.valueOf(accountNumber)) +System.lineSeparator());
myWriter.write(Encrypt.encrypt(tTime, Integer.valueOf(accountNumber)) +System.lineSeparator());
myWriter.write(Encrypt.encrypt(transactionType +transactionAmount, Integer.valueOf(accountNumber)) +System.lineSeparator());
myWriter.write(Encrypt.encrypt(finalBalance, Integer.valueOf(accountNumber)) +System.lineSeparator());
myWriter.flush();
myWriter.close();
} catch (IOException e) {
System.out.println("error!");
e.printStackTrace();
}
}
//searches for account files during transfer process
public static boolean accountNumberSearch(String accountNumber) {
boolean accountFound = false;
String buffer;
try {
File myObj = new File(fileFolder + accountNumber);
Scanner myReader = new Scanner(myObj);
while(myReader.hasNextLine() && accountFound == false){
buffer = Encrypt.decrypt(myReader.nextLine(), Integer.valueOf(accountNumber));
if(buffer.equals(accountNumber)) {
accountFound = true;
}
}
} catch (FileNotFoundException e) {
System.out.println("Could not find account file.");
}
return accountFound;
}
//verifies password during signin process
public static boolean checkPassword(String accountNumber, String oldPassword) {
boolean passwordValid = false;
String buffer=null;
try {
File myObj = new File (fileFolder + accountNumber);
Scanner myReader = new Scanner(myObj);
for(int i = 0; i < 3; i++) {
buffer = Encrypt.decrypt(myReader.nextLine(), Integer.valueOf(accountNumber));
}
passwordValid = buffer.equals(oldPassword);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return passwordValid;
}
//replaces password in account file
//reads entire file in arraylist, replaces
public static void replacePassword(String accountNumber, String oldPassword, String newPassword) {
try{
File myObj = new File(fileFolder + accountNumber);
Scanner myReader = new Scanner(myObj);
StringBuffer buffer = new StringBuffer();
ArrayList<String> testBuffer = new ArrayList<String>();
String replacer;
boolean done = false;
int counter = 0;
while(myReader.hasNextLine()) {
testBuffer.add(Encrypt.decrypt(myReader.nextLine(), Integer.valueOf(accountNumber)));
counter++;
}
for(int i = 0; i < counter && done == false; i++) {
replacer = testBuffer.get(i);
replacer.replaceAll(oldPassword, newPassword);
if(replacer.equals(oldPassword)) {
replacer = newPassword;
done = true;
}
testBuffer.set(i, replacer);
}
for(int i = 0; i < counter; i++) {
buffer.append(Encrypt.encrypt(testBuffer.get(i), Integer.valueOf(accountNumber)) + System.lineSeparator());
}
String fileContents = buffer.toString();
FileWriter writer = new FileWriter(myObj);
writer.append(fileContents);
writer.flush();
myReader.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Password change successful.");
}
//prints to the screen the transaction history for the given customer
public static void history(String accountNumber) {
try {
File myObj = new File(fileFolder + accountNumber);
Scanner myReader = new Scanner(myObj);
String buffer;
while(myReader.hasNextLine()) {
buffer = myReader.nextLine();
if(buffer.equals("******")) {
while(myReader.hasNextLine()) {
System.out.println(Encrypt.decrypt(myReader.nextLine(), Integer.valueOf(accountNumber)));
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
|
package com.jude.file.web.file;
import com.jude.file.base.RoutingWith;
import com.jude.file.bean.ResponseBean;
import com.jude.file.bean.file.bo.DocumentBO;
import com.jude.file.service.file.interf.DocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("demo_v1")
public class DocumentController {
@Autowired
private DocumentService documentService;
@RequestMapping("document/{id}")
public DocumentBO get(@PathVariable Long id){
return documentService.getById(id);
}
@RequestMapping(value="document/{id}", method=RequestMethod.GET)
@RoutingWith("slaveDataSource")
public DocumentBO getDocument(@PathVariable Long id){
return documentService.getById(id);
}
@RequestMapping(value="document", method = RequestMethod.POST)
@RoutingWith("masterDataSource")
public ResponseBean addDocument(@RequestBody DocumentBO documentBO){
if(documentService.insert(documentBO.to())==1){
return new ResponseBean("100","success",null);
}else{
return new ResponseBean("101","fail",null);
}
}
}
|
class RotateArray {
public void rotate(int[] nums, int k) {
int n=nums.length;
int[] a=new int[n];
if(k>n)
k%=n;
for(int i=0;i<n;++i){
a[i]=nums[(i+n-k)%n];
}
//System.out.println(Arrays.toString(a));
System.arraycopy(a,0,nums,0,n);
}
}
|
package com.drugstore.pdp.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="USER_ROLE")
public class UserRole {
@Id
private long id;// user_role_id in user
@Column(name="ROLE_NAME")
private String roleName;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
@Override
public String toString() {
return "UserRole [id=" + id + ", roleName=" + roleName + "]";
}
}
|
package io.snice.protocol;
public interface Request<O, T> extends Transaction<O, T> {
/**
* Create a new final {@link Response} with no payload.
*
* @return
*/
Response.Builder<O, Object> buildResponse();
Response<O, Object> createResponse();
<T> Response.Builder<O, T> buildResponse(T payload);
@Override
default boolean isRequest() {
return true;
}
@Override
default Request<O, T> toRequest() {
return this;
}
interface Builder<O, T> {
/**
* Specify the {@link TransactionId}.
*
* If not specified, the default {@link TransactionId} implementation will be used,
* which is obtained through {@link TransactionId#generateDefault()}.
*/
Builder<O, T> withTransactionId(TransactionId id);
Request<O, T> build();
}
}
|
package com.github.bukama.ir;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import com.github.bukama.ir.config.Config;
import com.github.bukama.ir.jaxb.IssueReport;
import com.github.bukama.ir.jaxb.IssueType;
import com.github.bukama.ir.listreader.IssueListReader;
import com.github.bukama.ir.utils.IssueUtils;
import com.github.bukama.ir.utils.SummaryUtils;
import org.junitpioneer.jupiter.IssueProcessor;
import org.junitpioneer.jupiter.IssueTestSuite;
public class IssueReportProcessor implements IssueProcessor {
private static final Logger LOG = Logger.getAnonymousLogger();
private static final IssueListReader ISSUE_LIST_READER = new IssueListReader();
@Override
public void processTestResults(List<IssueTestSuite> allIssueTestsSuites) {
// Read issue list
List<IssueType> allIssues = ISSUE_LIST_READER.readIssues();
// Merge list, if theres something to merge
allIssues = IssueUtils.mergeLists(allIssues, allIssueTestsSuites);
// Create summaries
allIssues = SummaryUtils.createSummaries(allIssues);
// Marshall it a report
writeReport(new IssueReport(allIssues));
}
/**
* Writes the data to an {@link IssueReport} in XML-Format using JAXB..
*
* @param report
* Report to marshal
*/
void writeReport(IssueReport report) {
try {
// Create report file (delete first, if already exists)
String fileName = buildReportFileName();
Path xmlFile = Paths.get(fileName);
Files.deleteIfExists(xmlFile);
Files.createDirectories(xmlFile.getParent());
Files.createFile(xmlFile);
// Marshal with options
JAXBContext jaxbContext = JAXBContext.newInstance(IssueReport.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
jaxbMarshaller.marshal(report, xmlFile.toFile());
// Validate
Source xmlFileSource = new StreamSource(xmlFile.toFile());
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
File xsdFile = new File(ClassLoader.getSystemResource("xsd/issueReport.xsd").toURI());
Schema schema = schemaFactory.newSchema(xsdFile);
Validator validator = schema.newValidator();
validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
validator.validate(xmlFileSource);
} catch (Throwable t) {
// Catch all to not break anything else, just because the report could not been created
LOG.log(Level.WARNING, "Error while creating the pioneer report", t);
}
}
/**
* Creates the full file name of the report based on the system properties.
*
* @return Full file name
*/
String buildReportFileName() {
return "." + File.separator + Config.REPORT_DIRECTORY.asString() + File.separator + "issueReport.xml";
}
}
|
package DAO;
import model.Pets;
import java.util.ArrayList;
import java.util.List;
public class PetsRepositorio {
private static PetsRepositorio petsRepositorio;
private List<Pets> pets = new ArrayList<>();
private ClienteRepositorio clienteRepositorio = ClienteRepositorio.getInstance();
public static PetsRepositorio getInstance() {
if (petsRepositorio == null) {
petsRepositorio = new PetsRepositorio();
}
return petsRepositorio;
}
public List<Pets> getPets() {
return pets;
}
public void setPets(List<Pets> pets) {
this.pets = pets;
}
public void addPet(Pets pet) {
int ultimoID = 1;
for (int i = 0; i < pets.size(); i++) {
ultimoID++;
}
pet.setId(ultimoID);
pets.add(pet);
}
public void removerPet(int id) {
Pets removerPet = verificarPet(id);
pets.remove(removerPet);
}
public Pets verificarPet(int id) {
for (Pets pet : pets) {
if (pet.getId() == id) {
return pet;
}
}
return null;
}
public void editarPet(Pets pet, int id) {
Pets atualizarPet = verificarPet(id);
if (atualizarPet != null) {
atualizarPet.setRaça(pet.getRaça());
atualizarPet.setDono(pet.getDono());
atualizarPet.setNome(pet.getNome());
atualizarPet.setServiços(pet.getServiços());
}
}
}
|
/**
* MIT License
* <p>
* Copyright (c) 2017-2018 nuls.io
* <p>
* 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:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* 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 network.nerve.converter.message;
import io.nuls.base.basic.NulsByteBuffer;
import io.nuls.base.basic.NulsOutputStreamBuffer;
import io.nuls.base.data.BaseBusinessMessage;
import io.nuls.base.data.NulsHash;
import io.nuls.core.exception.NulsException;
import io.nuls.core.parse.SerializeUtils;
import network.nerve.converter.model.HeterogeneousSign;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
* 当前虚拟银行异构链地址对交易的签名消息
* @author: Loki
* @date: 2020/8/31
*/
public class VirtualBankSignMessage extends BaseBusinessMessage {
private static Comparator listSignSort = new Comparator<HeterogeneousSign>() {
@Override
public int compare(HeterogeneousSign o1, HeterogeneousSign o2) {
if (o1.getHeterogeneousAddress().getChainId() > o2.getHeterogeneousAddress().getChainId()) {
return 1;
} else if (o1.getHeterogeneousAddress().getChainId() < o2.getHeterogeneousAddress().getChainId()) {
return -1;
}
return o1.getHeterogeneousAddress().getAddress().compareTo(o2.getHeterogeneousAddress().getAddress());
}
};
/**
* 1 - 准备阶段,2 - 非准备,执行阶段
*/
private int prepare;
/**
* 该交易所在区块的虚拟银行成员总数
* (不算当前加入, 要算当前退出)
*/
private int virtualBankTotal;
/**
* nerve 链内交易hash
*/
private NulsHash hash;
/**
* 每个节点, 签多个异构链
* 每个异构链地址一个签名
*/
private List<HeterogeneousSign> listSign;
public VirtualBankSignMessage() {
}
public VirtualBankSignMessage(int prepare, int virtualBankTotal, NulsHash hash, List<HeterogeneousSign> listSign) {
this.prepare = prepare;
this.virtualBankTotal = virtualBankTotal;
this.hash = hash;
this.listSign = listSign;
}
public ComponentSignMessage toComponentSignMessage() {
ComponentSignMessage message = new ComponentSignMessage(virtualBankTotal, hash, listSign);
return message;
}
public static VirtualBankSignMessage of(ComponentSignMessage message, int prepare) {
VirtualBankSignMessage msg = new VirtualBankSignMessage(prepare, message.getVirtualBankTotal(), message.getHash(), message.getListSign());
return msg;
}
@Override
protected void serializeToStream(NulsOutputStreamBuffer stream) throws IOException {
stream.writeUint16(prepare);
stream.writeUint16(virtualBankTotal);
stream.write(hash.getBytes());
int listSize = listSign == null ? 0 : listSign.size();
stream.writeUint16(listSize);
if(null != listSign){
for(HeterogeneousSign sign : listSign){
stream.writeNulsData(sign);
}
}
}
@Override
public void parse(NulsByteBuffer buffer) throws NulsException {
this.prepare = buffer.readUint16();
this.virtualBankTotal = buffer.readUint16();
this.hash = buffer.readHash();
int listSize = buffer.readUint16();
if(0 < listSize){
List<HeterogeneousSign> list = new ArrayList<>();
for(int i = 0; i< listSize; i++){
list.add(buffer.readNulsData(new HeterogeneousSign()));
}
this.listSign = list;
}
}
@Override
public int size() {
int size = 0;
size += SerializeUtils.sizeOfInt16();
size += SerializeUtils.sizeOfInt16();
size += NulsHash.HASH_LENGTH;
size += SerializeUtils.sizeOfUint16();
if (null != listSign) {
for(HeterogeneousSign sign : listSign){
size += SerializeUtils.sizeOfNulsData(sign);
}
}
return size;
}
public int getPrepare() {
return prepare;
}
public void setPrepare(int prepare) {
this.prepare = prepare;
}
public NulsHash getHash() {
return hash;
}
public void setHash(NulsHash hash) {
this.hash = hash;
}
public List<HeterogeneousSign> getListSign() {
return listSign;
}
public void setListSign(List<HeterogeneousSign> listSign) {
this.listSign = listSign;
}
public int getVirtualBankTotal() {
return virtualBankTotal;
}
public void setVirtualBankTotal(int virtualBankTotal) {
this.virtualBankTotal = virtualBankTotal;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualBankSignMessage that = (VirtualBankSignMessage) o;
if (!hash.equals(that.hash)) return false;
if (prepare != that.prepare) return false;
if (listSign.size() != that.listSign.size()) return false;
if (listSign.size() == 1 && !listSign.get(0).equals(that.listSign.get(0))) return false;
if (listSign.size() > 1) {
listSign.sort(listSignSort);
that.listSign.sort(listSignSort);
if (!listSign.get(0).equals(that.listSign.get(0))) return false;
}
return true;
}
@Override
public int hashCode() {
int result = prepare;
result = 31 * result + hash.hashCode();
listSign.sort(listSignSort);
for (HeterogeneousSign sign : listSign) {
result = 31 * result + sign.hashCode();
}
return result;
}
}
|
package cs3500.animator.controller;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.Timer;
import cs3500.animator.model.IModel;
import cs3500.animator.model.Model;
import cs3500.animator.shape.IShape;
import cs3500.animator.shape.ReadableShape;
import cs3500.animator.util.ButtonListener;
import cs3500.animator.view.HybridView;
import cs3500.animator.view.IView;
/**
* Represents a controller for running the hybrid animations of both visual and SVG. The view it
* works has a ButtonListener that takes in this {@link IHybridController} to listen to action
* commands and performs the specific action which is described in the methods described in this
* controller.
*/
public class HybridController implements IHybridController {
private Timer timer;
private IModel model;
private IView view;
private int fps;
private int frameCount = 1;
private boolean isPaused = true;
private boolean hasLoop = false;
/**
* Constructs a hybrid controller.
*
* @param m model the controller works on
* @param v the type of view the controller runs
*/
public HybridController(IModel m, IView v) {
if (m == null || v == null) {
throw new IllegalArgumentException("Bad view or model");
}
this.model = m;
this.view = v;
v.setButtonListener(new ButtonListener(this));
ArrayList<ReadableShape> forDrawing = model.getShapesAtFrame(frameCount);
v.setShapes(forDrawing);
v.export();
}
@Override
public void run() {
timerRestart(this.fps);
model.set();
timer.start();
}
@Override
public void setFPS(int fps) {
this.fps = fps;
}
@Override
public void setAndRestart(int fps) {
timer.stop();
this.fps = fps;
timerRestart(fps);
timer.start();
}
@Override
public void scrub(int frame) {
if (frame != 0 && (frameCount <= frame || frameCount >= frame)) {
timer.stop();
frameCount = frame;
ArrayList<ReadableShape> forDrawing = model.getShapesAtFrame(frameCount);
timerRestart(this.fps);
timer.start();
try {
view.drawShapes(forDrawing);
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void timerRestart(int i) {
timer = new Timer(1000 / i, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ArrayList<ReadableShape> forDrawing = model.getShapesAtFrame(frameCount);
try {
view.drawShapes(forDrawing);
//scrub(frameCount);
System.out.println(view.getEnd());
} catch (IOException e1) {
e1.printStackTrace();
}
if (!isPaused && !hasLoop) {
if (frameCount != model.getMaxFrame() - 1) {
frameCount++;
}
}
if (!isPaused && hasLoop) {
if (frameCount != model.getMaxFrame() - 1) {
frameCount++;
}
loop();
//scrub(frameCount);
}
}
});
}
@Override
public boolean getIsPaused() {
return this.isPaused;
}
@Override
public void setPause() {
isPaused = true;
}
@Override
public void resume() {
isPaused = false;
}
@Override
public void restart() {
frameCount = 1;
model.reset();
}
@Override
public boolean getHasLoop() {
return this.hasLoop;
}
@Override
public void setLoop() {
if (hasLoop) {
this.hasLoop = false;
} else {
this.hasLoop = true;
}
}
@Override
public void loop() {
if (this.frameCount == model.getMaxFrame() - 1 && hasLoop) {
this.restart();
}
}
@Override
public IModel getModel() {
IModel m = new Model();
for (IShape s : this.model.getOriginal()) {
m.addShapes(s);
}
return m;
}
@Override
public int getFps() {
return this.fps;
}
@Override
public int getFrameCount() {
return this.frameCount;
}
public boolean scurbContains(Point e){
return view.scrubContains(e);
}
}
|
package co.yoyu.sidebar.view;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.GridView;
import co.yoyu.sidebar.ContentAdapter;
import co.yoyu.sidebar.db.AppInfoCacheDB;
import co.yoyu.sidebar.db.AppInfoModel;
import co.yoyu.sidebar.drag.DragController;
import co.yoyu.sidebar.drag.DragSource;
import co.yoyu.sidebar.drag.DragView;
import co.yoyu.sidebar.drag.DropTarget;
import co.yoyu.sidebar.utils.Constant;
public class SideBarContentPanel extends GridView implements OnItemLongClickListener, DragSource, DropTarget {
private SideBar mSideBar;
private DragController mDragController;
private AppInfoModel mDragInfo;
private View mDragView;
public SideBarContentPanel(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public SideBarContentPanel(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SideBarContentPanel(Context context) {
super(context);
}
public void onFinishInflate() {
super.onFinishInflate();
setOnItemLongClickListener(this);
}
public void setSideBar(SideBar sidebar) {
mSideBar = sidebar;
}
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
AppInfoModel info = (AppInfoModel)parent.getItemAtPosition(position);
info.isDrag = true;
((ContentAdapter)getAdapter()).notifyDataSetChanged();
mDragInfo = info;
mDragView = view;
mSideBar.setMode(SideBar.MODE_EDIT_DRAG);
mDragController.startDrag(mDragView, this, mDragInfo, DragController.DRAG_ACTION_MOVE);
return true;
}
@Override
public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
if(source != this) {
AppInfoModel info = (AppInfoModel)dragInfo;
info.isDrag = false;
((ContentAdapter)this.getAdapter()).addAndNotify(info);
info.container = Constant.CONTAINER_CONTENT_PANEL;
AppInfoCacheDB.getInstance(getContext()).updateSideBar(info);
}//end if
}
@Override
public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
// TODO Auto-generated method stub
}
@Override
public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
// TODO Auto-generated method stub
}
@Override
public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
// TODO Auto-generated method stub
}
@Override
public void onDragLeave(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
// TODO Auto-generated method stub
}
@Override
public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
// TODO Auto-generated method stub
((ContentAdapter)this.getAdapter()).notifyDataSetChanged();
if(source == this)
return false;
return true;
}
@Override
public Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo, Rect recycle) {
// TODO Auto-generated method stub
return null;
}
@Override
public void setDragController(DragController dragger) {
mDragController = dragger;
}
@Override
public void onDropCompleted(View target, boolean success) {
// TODO Auto-generated method stub
if (success&&target!=null){
if (target != this && mDragInfo != null) {
((ContentAdapter)getAdapter()).removeAndNotify(mDragInfo);
if (mDragView instanceof DropTarget) {
mDragController.removeDropTarget((DropTarget)mDragView);
}
}
} else {
//TODO
mDragInfo.isDrag = false;
((ContentAdapter)getAdapter()).notifyDataSetChanged();
}
mDragInfo = null;
}
}
|
package com.example.demo.service;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.example.demo.entity.Dictionary;
import com.baomidou.mybatisplus.service.IService;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务类
* </p>
*
* @author weifucheng
*/
public interface DictionaryService extends IService<Dictionary> {
public List<Dictionary> selectAll();
public List<Dictionary> selectListByFilter(String filter, String sort, String order, Pagination page);
public List<Dictionary> selectListByFilter(String filter, String sort, String order);
public List<Map<String,Object>> selectListBysql(String sql);
public List<Dictionary> selectAll(Pagination page);
}
|
package com.app.dao;
import com.code.model.Simsolution;
import com.code.model.SimsolutionExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SimsolutionMapper {
int countByExample(SimsolutionExample example);
int deleteByExample(SimsolutionExample example);
int deleteByPrimaryKey(Integer simsolutionId);
int insert(Simsolution record);
int insertSelective(Simsolution record);
List<Simsolution> selectByExampleWithBLOBs(SimsolutionExample example);
List<Simsolution> selectByExample(SimsolutionExample example);
Simsolution selectByPrimaryKey(Integer simsolutionId);
int updateByExampleSelective(@Param("record") Simsolution record, @Param("example") SimsolutionExample example);
int updateByExampleWithBLOBs(@Param("record") Simsolution record, @Param("example") SimsolutionExample example);
int updateByExample(@Param("record") Simsolution record, @Param("example") SimsolutionExample example);
int updateByPrimaryKeySelective(Simsolution record);
int updateByPrimaryKeyWithBLOBs(Simsolution record);
int updateByPrimaryKey(Simsolution record);
} |
package net.ipip.ipdb;
import com.alibaba.druid.support.http.util.IPAddress;
import com.thinkgem.jeesite.common.utils.StringUtils;
import org.springframework.web.util.UrlPathHelper;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
/**
* ip地址工具类
*
* @author gyl
*/
public class IpInfoUtils {
// City类可用于IPDB格式的IPv4免费库
private static City db;
public static String getLocation(HttpServletRequest request) {
if (request == null)
return "";
UrlPathHelper helper = new UrlPathHelper();
StringBuffer buff = request.getRequestURL();
String uri = request.getRequestURI();
String origUri = helper.getOriginatingRequestUri(request);
buff.replace(buff.length() - uri.length(), buff.length(), origUri);
//获取请求参数,这里不需要
// String queryString = helper.getOriginatingQueryString(request);
// if (queryString != null) {
// buff.append("?").append(queryString);
// }
return buff.toString();
}
/**
* 获取访问者IP
* <p>
* 在一般情况下使用Request.getRemoteAddr()即可,但是经过nginx等反向代理软件后,这个方法会失效。
* <p>
* 本方法先从Header中获取X-Real-IP,如果不存在再从X-Forwarded-For获得第一个IP(用,分割), 如果还不存在则调用Request
* .getRemoteAddr()。
*
* @param request
* @return
*/
public static String getIpAddr(HttpServletRequest request) {
if (request == null)
return "";
String ip = request.getHeader("X-Real-IP");
if (!isIP(ip)) {
ip = request.getHeader("X-Forwarded-For");
// 多次反向代理后会有多个IP值,第一个为真实IP。
if (isIP(ip)) {
int index = ip.indexOf(',');
if (index != -1)
ip = ip.substring(0, index);
}
}
if (!isIP(ip))
ip = request.getHeader("Proxy-Client-IP");
if (!isIP(ip))
ip = request.getHeader("WL-Proxy-Client-IP");
if (isIP(ip) && (ip.contains("../") || ip.contains("..\\")))
ip = request.getRemoteAddr();
if (!isIP(ip))
ip = request.getRemoteAddr();
if (isIP(ip) && ip.equals("0:0:0:0:0:0:0:1"))
ip = "127.0.0.1";
return ip;
}
private static boolean isIP(String ip) {
return !StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip);
}
/**
* 根据ip获取其所在国家、地区、省份、城市
*/
public static Map<String, String> getIpInfo(String ip) {
dbInit();
Map<String, String> map = new HashMap<String, String>();
if (StringUtils.isBlank(ip)) {
return map;
}
try {
new IPAddress(ip);
} catch (Exception e) {// not ip
return map;
}
try {
// db.find(address, language) 返回索引数组
// db.findInfo(address, language) 返回 CityInfo 对象
// db.findMap(address, language) 返回结果Map
map = db.findMap(ip, "CN");
} catch (InvalidDatabaseException | IPFormatException e) {
// System.out.println("<<<<IPDB ERROR>>>>" + e.getMessage());
e.printStackTrace();
}
return map;
}
private static void dbInit() {
if (db == null) {
try {
/*URL url = IpInfoUtils.class.getResource("ipipfree.ipdb");
System.out.println("url==null ? " + (url == null));
String path = url.toURI().getPath();
System.out.println(path);
db = new City(path);*/
InputStream inputStream = IpInfoUtils.class.getResourceAsStream("/net/ipip/ipdb/ipipfree.ipdb");
db = new City(inputStream);
// System.out.println("------------------ipDB load complete---------------------");
} catch (Exception e) {
// System.out.println("------------------ipDB load fail---------------------");
// System.out.println("<<<<IPDB ERROR>>>>" + e.getMessage());
e.printStackTrace();
}
}
}
}
|
package nl.kasperschipper.alligatorithm.services.impl;
import nl.kasperschipper.alligatorithm.config.JobConfiguration;
import nl.kasperschipper.alligatorithm.exception.AlligatorithmValidationException;
import nl.kasperschipper.alligatorithm.model.PairedByte;
import nl.kasperschipper.alligatorithm.services.AlligatorithmService;
import nl.kasperschipper.alligatorithm.services.BinaryDataReader;
import nl.kasperschipper.alligatorithm.services.ByteHexStringConverter;
import nl.kasperschipper.alligatorithm.services.JobService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class JobServiceImpl implements JobService
{
private Logger LOG = LoggerFactory.getLogger(JobServiceImpl.class);
private JobConfiguration jobConfiguration;
private BinaryDataReader binaryDataReader;
private ByteHexStringConverter byteHexStringConverter;
private AlligatorithmService alligatorithmService;
@Override
public void performJob()
{
List<Byte> inputBytes = binaryDataReader.readBinaryDataFromFile(jobConfiguration.getInputFilePath());
LOG.info(String.format("Read input.bin as %s", this.byteHexStringConverter.convertByteArrayToHexString(inputBytes)));
List<PairedByte> pairedBytes;
try
{
pairedBytes = this.alligatorithmService.convertByteListToPairedByteListAndValidate(inputBytes);
}
catch (AlligatorithmValidationException e)
{
LOG.error(e.getMessage(), e);
throw new RuntimeException(e);
}
List<Byte> outputBytes = this.alligatorithmService.applyAlgorithmToPairedByteList(pairedBytes);
LOG.info(String.format("Applied algorithm result is %s", this.byteHexStringConverter.convertByteArrayToHexString(outputBytes)));
}
@Autowired
@Override
public void setJobConfiguration(JobConfiguration jobConfiguration)
{
this.jobConfiguration = jobConfiguration;
}
@Autowired
public void setBinaryDataReader(BinaryDataReader binaryDataReader)
{
this.binaryDataReader = binaryDataReader;
}
@Autowired
public void setByteHexStringConverter(ByteHexStringConverter byteHexStringConverter)
{
this.byteHexStringConverter = byteHexStringConverter;
}
@Autowired
public void setAlligatorithmService(AlligatorithmService alligatorithmService)
{
this.alligatorithmService = alligatorithmService;
}
}
|
package com.eniso.regimi.services;
import java.util.List;
import com.eniso.regimi.models.Subscriber;
public interface SubscriberService {
public List<Subscriber> findAll();
public Subscriber findById(String theId);
public List<Subscriber> findByRegion(String Region);
public void save(Subscriber subscriber);
public void deleteById(String theId);
Subscriber updateSubscriber(Subscriber theTrainer);
}
|
package com.daikit.graphql.meta.custommethod;
import com.daikit.graphql.custommethod.GQLCustomMethod;
/**
* GraphQL dynamic method returning an embedded entity meta data
*
* @author Thibaut Caselli
*/
public class GQLMethodEntityMetaData extends GQLAbstractMethodMetaData {
private Class<?> entityClass;
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// CONSTRUCTORS
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
/**
* Default constructor
*/
public GQLMethodEntityMetaData() {
// Nothing done
}
/**
* Constructor passing name, whether this is a mutation or a query, method
* and return type
*
* @param method
* the {@link GQLCustomMethod}
* @param entityClass
* the entity class for method return type
*/
public GQLMethodEntityMetaData(final GQLCustomMethod method, final Class<?> entityClass) {
super(method);
this.entityClass = entityClass;
}
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// METHODS
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
@Override
protected void appendToString(final StringBuilder stringBuilder) {
stringBuilder.append("{METHOD-ENTITY(").append(entityClass == null ? "" : entityClass.getSimpleName())
.append(")}");
super.appendToString(stringBuilder);
}
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// GETTERS / SETTERS
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
/**
* @return the entityClass
*/
public Class<?> getEntityClass() {
return entityClass;
}
/**
* @param entityClass
* the entityClass to set
* @return this instance
*/
public GQLMethodEntityMetaData setEntityClass(final Class<?> entityClass) {
this.entityClass = entityClass;
return this;
}
}
|
/*
* 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 poker2;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
/**
*
* @author Danil
*/
public class VentanaMano extends javax.swing.JFrame {
ArrayList<Carta> mano1= new ArrayList<>();
ArrayList<Carta> baraja1= new ArrayList<>();
JugadorRegistrado jugadorR= VentanaPrincipal.jr;
/**
* Creates new form VentanaMano
*/
public VentanaMano() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
Resultado = new javax.swing.JTextField();
Jugar = new javax.swing.JButton();
CantidadApostada = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
SaldoResultante = new javax.swing.JLabel();
RetirarBeneficios = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
Beneficio = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
SaldoRestante = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
AumentarSaldo = new javax.swing.JButton();
AumentaSaldo = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
Mano1 = new javax.swing.JLabel();
Mano2 = new javax.swing.JLabel();
Mano3 = new javax.swing.JLabel();
Mano4 = new javax.swing.JLabel();
Mano5 = new javax.swing.JLabel();
Factura = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
Resultado.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ResultadoActionPerformed(evt);
}
});
Jugar.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
Jugar.setText("Jugar");
Jugar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JugarActionPerformed(evt);
}
});
CantidadApostada.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CantidadApostadaActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("¿Cúanto deseas apostar?");
jLabel2.setText("€");
SaldoResultante.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
SaldoResultante.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
SaldoResultante.setText("Su saldo resultante tras la jugada:");
RetirarBeneficios.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
RetirarBeneficios.setText("¿Retirar Beneficios?");
RetirarBeneficios.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RetirarBeneficiosActionPerformed(evt);
}
});
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("Beneficio:");
Beneficio.setEditable(false);
Beneficio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BeneficioActionPerformed(evt);
}
});
jLabel4.setText("€");
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel5.setText("Saldo restante:");
SaldoRestante.setEditable(false);
SaldoRestante.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SaldoRestanteActionPerformed(evt);
}
});
jLabel6.setText("€");
AumentarSaldo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
AumentarSaldo.setText("¿Aumentar Saldo?");
AumentarSaldo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AumentarSaldoActionPerformed(evt);
}
});
AumentaSaldo.setToolTipText("");
AumentaSaldo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AumentaSaldoActionPerformed(evt);
}
});
jLabel7.setText("€");
jLabel8.setText("Introduzca para aumentar saldo");
Factura.setText("Imprimir Factura");
Factura.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FacturaActionPerformed(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()
.addGap(58, 58, 58)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(AumentarSaldo, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(124, 124, 124)
.addComponent(Jugar, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 278, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(RetirarBeneficios, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(Beneficio, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
.addComponent(SaldoRestante))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(20, 20, 20))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(63, 63, 63)
.addComponent(jLabel1)
.addGap(51, 51, 51)
.addComponent(CantidadApostada, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel2)
.addGap(64, 64, 64)
.addComponent(Factura, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(265, 265, 265)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(Resultado, javax.swing.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE)
.addComponent(SaldoResultante, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(AumentaSaldo, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel7)))
.addContainerGap(34, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addGap(141, 141, 141)
.addComponent(Mano1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(Mano2, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addComponent(Mano3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(Mano4, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(Mano5, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(CantidadApostada, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Factura, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel8)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(AumentaSaldo, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Jugar, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(AumentarSaldo, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(RetirarBeneficios, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Beneficio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(SaldoRestante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addGap(8, 8, 8)
.addComponent(SaldoResultante, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(Resultado, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(69, 69, 69)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(Mano5, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)
.addComponent(Mano4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Mano3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Mano2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Mano1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(233, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void JugarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JugarActionPerformed
// TODO add your handling code here:
try{
if(Integer.parseInt(CantidadApostada.getText())>jugadorR.getSaldoAcumulado()){
throw new JugadorException(JugadorException.SALDO_INSUFICIENTE);
}
mano1.clear();
baraja1=Baraja.creaBaraja();
mano1= Baraja.creaMano(baraja1);
baraja1.clear();
jugadorR.actualizaSaldo(mano1,Integer.parseInt(CantidadApostada.getText()));
Resultado.setText(String.valueOf(jugadorR.getSaldoAcumulado()));
ImageIcon imagen1 = new ImageIcon("CartasEspañolas/" + mano1.get(0).toString());
ImageIcon imgRedimensionada1 = new ImageIcon(imagen1.getImage().getScaledInstance(Mano1.getWidth(), Mano1.getHeight(), 1));
Mano1.setIcon(imgRedimensionada1);
ImageIcon imagen2 = new ImageIcon("CartasEspañolas/" + mano1.get(1).toString());
ImageIcon imgRedimensionada2 = new ImageIcon(imagen2.getImage().getScaledInstance(Mano2.getWidth(), Mano2.getHeight(), 1));
Mano2.setIcon(imgRedimensionada2);
ImageIcon imagen3 = new ImageIcon("CartasEspañolas/" + mano1.get(2).toString());
ImageIcon imgRedimensionada3 = new ImageIcon(imagen3.getImage().getScaledInstance(Mano3.getWidth(), Mano3.getHeight(), 1));
Mano3.setIcon(imgRedimensionada3);
ImageIcon imagen4 = new ImageIcon("CartasEspañolas/" + mano1.get(3).toString());
ImageIcon imgRedimensionada4 = new ImageIcon(imagen4.getImage().getScaledInstance(Mano4.getWidth(), Mano4.getHeight(), 1));
Mano4.setIcon(imgRedimensionada4);
ImageIcon imagen5 = new ImageIcon("CartasEspañolas/" + mano1.get(4).toString());
ImageIcon imgRedimensionada5 = new ImageIcon(imagen5.getImage().getScaledInstance(Mano5.getWidth(), Mano5.getHeight(), 1));
Mano5.setIcon(imgRedimensionada5);
}
catch(JugadorException je){
JOptionPane.showMessageDialog(this, je.toString(), "Error", JOptionPane.WARNING_MESSAGE);
}
}//GEN-LAST:event_JugarActionPerformed
private void RetirarBeneficiosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RetirarBeneficiosActionPerformed
// TODO add your handling code here:
Beneficio.setText(String.valueOf(jugadorR.retirarBeneficios()));
SaldoRestante.setText(String.valueOf(jugadorR.getSaldoAcumulado()));
}//GEN-LAST:event_RetirarBeneficiosActionPerformed
private void BeneficioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BeneficioActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_BeneficioActionPerformed
private void ResultadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ResultadoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ResultadoActionPerformed
private void CantidadApostadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CantidadApostadaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_CantidadApostadaActionPerformed
private void SaldoRestanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaldoRestanteActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_SaldoRestanteActionPerformed
private void AumentaSaldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AumentaSaldoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_AumentaSaldoActionPerformed
private void AumentarSaldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AumentarSaldoActionPerformed
// TODO add your handling code here:
jugadorR.aumentarSaldo(Double.parseDouble(AumentaSaldo.getText()));
Resultado.setText(String.valueOf(jugadorR.getSaldoAcumulado()));
}//GEN-LAST:event_AumentarSaldoActionPerformed
private void FacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FacturaActionPerformed
PrintWriter salida = null;
try {
// TODO add your handling code here: public static void generaFicha(Persona per) throws IOException {
salida = new PrintWriter(new BufferedWriter(new FileWriter(jugadorR.getNIF() + ".txt")));
salida.println("-------------------------------- Ficha "+ jugadorR.getNombre() +" --------------------------------");
salida.println("\n");
salida.println("DNI: " + jugadorR.getNIF());
salida.println("\n");
salida.println("Nombre: " + jugadorR.getNombre());
salida.println("\n");
salida.println("Fecha de nacimiento: " + jugadorR.getFechaNacimiento());
salida.println("\n");
salida.println("Fecha de Registro: " + jugadorR.getFechaRegistro());
salida.println("\n");
salida.println("Beneficio: " + Beneficio.getText() + "€");
salida.println("\n");
salida.println("\n");
salida.println("-------------------------------------------------------------------------------");
} catch (IOException ex) {
Logger.getLogger(VentanaMano.class.getName()).log(Level.SEVERE, null, ex);
} finally {
salida.close();
}
}//GEN-LAST:event_FacturaActionPerformed
/**
* @param args the command line arguments
*/
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField AumentaSaldo;
private javax.swing.JButton AumentarSaldo;
private javax.swing.JTextField Beneficio;
private javax.swing.JTextField CantidadApostada;
private javax.swing.JButton Factura;
private javax.swing.JButton Jugar;
private javax.swing.JLabel Mano1;
private javax.swing.JLabel Mano2;
private javax.swing.JLabel Mano3;
private javax.swing.JLabel Mano4;
private javax.swing.JLabel Mano5;
private javax.swing.JTextField Resultado;
private javax.swing.JButton RetirarBeneficios;
private javax.swing.JTextField SaldoRestante;
private javax.swing.JLabel SaldoResultante;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
// End of variables declaration//GEN-END:variables
}
|
package nuc.bsd.report.domain;
public class ClsProBlmRep {
private String id;
private String schoolId;
private String gradeId;
private String gradeName;
private String classId;
private String className;
private String testStuNum;
private String testStuPercent;
private String stuSexPercent;
private String stuBirthdayRang;
private String testDate;
private String testDeficiencyPercent;
private String testDeficiencyNum;
private String testDeficiencyList;
private String testTimePercent;
private String testTimeNum;
private String testTimeList;
private String availableLPercent;
private String availableLNum;
private String availableLList;
private String availableFPercent;
private String availableFNum;
private String availableFList;
private String availableCPercent;
private String availableCNum;
private String availableCList;
private String anxiousNoriskNum;
private String anxiousPotentialriskNum;
private String anxiousRiskNum;
private String anxiousPotentialriskList;
private String anxiousRiskList;
private String depressedNoriskNum;
private String depressedPotentialriskNum;
private String depressedRiskNum;
private String depressedPotentialriskList;
private String depressedRiskList;
private String somatizationNoriskNum;
private String somatizationPotentialriskNum;
private String somatizationRiskNum;
private String somatizationPotentialriskList;
private String somatizationRiskList;
private String uncontrolNoriskNum;
private String uncontrolPotentialriskNum;
private String uncontrolRiskNum;
private String uncontrolPotentialriskList;
private String uncontrolRiskList;
private String failNoriskNum;
private String failPotentialriskNum;
private String failRiskNum;
private String failPotentialriskList;
private String failRiskList;
private String oddbehaviorNoriskNum;
private String oddbehaviorPotentialriskNum;
private String oddbehaviorRiskNum;
private String oddbehaviorPotentialriskList;
private String oddbehaviorRiskList;
private String pressureNoriskNum;
private String pressurePotentialriskNum;
private String pressureRiskNum;
private String pressurePotentialriskList;
private String pressureRiskList;
private String degenerateNoriskNum;
private String degeneratePotentialriskNum;
private String degenerateRiskNum;
private String degeneratePotentialriskList;
private String degenerateRiskList;
private String bullyNoriskNum;
private String bullyPotentialriskNum;
private String bullyRiskNum;
private String bullyPotentialriskList;
private String bullyRiskList;
private String inattentionNoriskNum;
private String inattentionPotentialriskNum;
private String inattentionRiskNum;
private String inattentionPotentialriskList;
private String inattentionRiskList;
private String maniaNoriskNum;
private String maniaPotentialriskNum;
private String maniaRiskNum;
private String maniaPotentialriskList;
private String maniaRiskList;
private String netaddictionNoriskNum;
private String netaddictionPotentialriskNum;
private String netaddictionRiskNum;
private String netaddictionPotentialriskList;
private String netaddictionRiskList;
private String phoneaddictionNoriskNum;
private String phoneaddictionPotentialriskNum;
private String phoneaddictionRiskNum;
private String phoneaddictionPotentialriskList;
private String phoneaddictionRiskList;
private String hateschoolNoriskNum;
private String hateschoolPotentialriskNum;
private String hateschoolRiskNum;
private String hateschoolPotentialriskList;
private String hateschoolRiskList;
private String hateteacherNoriskNum;
private String hateteacherPotentialriskNum;
private String hateteacherRiskNum;
private String hateteacherPotentialriskList;
private String hateteacherRiskList;
private String hatestudyNoriskNum;
private String hatestudyPotentialriskNum;
private String hatestudyRiskNum;
private String hatestudyPotentialriskList;
private String hatestudyRiskList;
private String anxexamNoriskNum;
private String anxexamPotentialriskNum;
private String anxexamRiskNum;
private String anxexamPotentialriskList;
private String anxexamRiskList;
private String autolesionidxNoriskNum;
private String autolesionidxPotentialriskNum;
private String autolesionidxRiskNum;
private String autolesionidxPotentialriskList;
private String autolesionidxRiskList;
private String helplessnessidxNoriskNum;
private String helplessnessidxPotentialriskNum;
private String helplessnessidxRiskNum;
private String helplessnessidxPotentialriskList;
private String helplessnessidxRiskList;
private String interpersonalidxNoriskNum;
private String interpersonalidxPotentialriskNum;
private String interpersonalidxRiskNum;
private String interpersonalidxPotentialriskList;
private String interpersonalidxRiskList;
private String addictionidxNoriskNum;
private String addictionidxPotentialriskNum;
private String addictionidxRiskNum;
private String addictionidxPotentialriskList;
private String addictionidxRiskList;
private String bullyidxNoriskNum;
private String bullyidxPotentialriskNum;
private String bullyidxRiskNum;
private String bullyidxPotentialriskList;
private String bullyidxRiskList;
private String behavidxNoriskNum;
private String behavidxPotentialriskNum;
private String behavidxRiskNum;
private String behavidxPotentialriskList;
private String behavidxRiskList;
private String maniaidxNoriskNum;
private String maniaidxPotentialriskNum;
private String maniaidxRiskNum;
private String maniaidxPotentialriskList;
private String maniaidxRiskList;
private String poorhealthidxNoriskNum;
private String poorhealthidxPotentialriskNum;
private String poorhealthidxRiskNum;
private String poorhealthidxPotentialriskList;
private String poorhealthidxRiskList;
private String wearinessidxNoriskNum;
private String wearinessidxPotentialriskNum;
private String wearinessidxRiskNum;
private String wearinessidxPotentialriskList;
private String wearinessidxRiskList;
private String distractionidxNoriskNum;
private String distractionidxPotentialriskNum;
private String distractionidxRiskNum;
private String distractionidxPotentialriskList;
private String distractionidxRiskList;
private String anxexamidxNoriskNum;
private String anxexamidxPotentialriskNum;
private String anxexamidxRiskNum;
private String anxexamidxPotentialriskList;
private String anxexamidxRiskList;
private String conflictidxNoriskNum;
private String conflictidxPotentialriskNum;
private String conflictidxRiskNum;
private String conflictidxPotentialriskList;
private String conflictidxRiskList;
private String isGenerate;
private String generatePath;
public String getGradeName() {
return gradeName;
}
public void setGradeName(String gradeName) {
this.gradeName = gradeName;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSchoolId() {
return schoolId;
}
public void setSchoolId(String schoolId) {
this.schoolId = schoolId;
}
public String getGradeId() {
return gradeId;
}
public void setGradeId(String gradeId) {
this.gradeId = gradeId;
}
public String getClassId() {
return classId;
}
public void setClassId(String classId) {
this.classId = classId;
}
public String getTestStuNum() {
return testStuNum;
}
public void setTestStuNum(String testStuNum) {
this.testStuNum = testStuNum;
}
public String getTestStuPercent() {
return testStuPercent;
}
public void setTestStuPercent(String testStuPercent) {
this.testStuPercent = testStuPercent;
}
public String getStuSexPercent() {
return stuSexPercent;
}
public void setStuSexPercent(String stuSexPercent) {
this.stuSexPercent = stuSexPercent;
}
public String getStuBirthdayRang() {
return stuBirthdayRang;
}
public void setStuBirthdayRang(String stuBirthdayRang) {
this.stuBirthdayRang = stuBirthdayRang;
}
public String getTestDate() {
return testDate;
}
public void setTestDate(String testDate) {
this.testDate = testDate;
}
public String getTestDeficiencyPercent() {
return testDeficiencyPercent;
}
public void setTestDeficiencyPercent(String testDeficiencyPercent) {
this.testDeficiencyPercent = testDeficiencyPercent;
}
public String getTestDeficiencyNum() {
return testDeficiencyNum;
}
public void setTestDeficiencyNum(String testDeficiencyNum) {
this.testDeficiencyNum = testDeficiencyNum;
}
public String getTestDeficiencyList() {
return testDeficiencyList;
}
public void setTestDeficiencyList(String testDeficiencyList) {
this.testDeficiencyList = testDeficiencyList;
}
public String getTestTimePercent() {
return testTimePercent;
}
public void setTestTimePercent(String testTimePercent) {
this.testTimePercent = testTimePercent;
}
public String getTestTimeNum() {
return testTimeNum;
}
public void setTestTimeNum(String testTimeNum) {
this.testTimeNum = testTimeNum;
}
public String getTestTimeList() {
return testTimeList;
}
public void setTestTimeList(String testTimeList) {
this.testTimeList = testTimeList;
}
public String getAvailableLPercent() {
return availableLPercent;
}
public void setAvailableLPercent(String availableLPercent) {
this.availableLPercent = availableLPercent;
}
public String getAvailableLNum() {
return availableLNum;
}
public void setAvailableLNum(String availableLNum) {
this.availableLNum = availableLNum;
}
public String getAvailableLList() {
return availableLList;
}
public void setAvailableLList(String availableLList) {
this.availableLList = availableLList;
}
public String getAvailableFPercent() {
return availableFPercent;
}
public void setAvailableFPercent(String availableFPercent) {
this.availableFPercent = availableFPercent;
}
public String getAvailableFNum() {
return availableFNum;
}
public void setAvailableFNum(String availableFNum) {
this.availableFNum = availableFNum;
}
public String getAvailableFList() {
return availableFList;
}
public void setAvailableFList(String availableFList) {
this.availableFList = availableFList;
}
public String getAvailableCPercent() {
return availableCPercent;
}
public void setAvailableCPercent(String availableCPercent) {
this.availableCPercent = availableCPercent;
}
public String getAvailableCNum() {
return availableCNum;
}
public void setAvailableCNum(String availableCNum) {
this.availableCNum = availableCNum;
}
public String getAvailableCList() {
return availableCList;
}
public void setAvailableCList(String availableCList) {
this.availableCList = availableCList;
}
public String getAnxiousNoriskNum() {
return anxiousNoriskNum;
}
public void setAnxiousNoriskNum(String anxiousNoriskNum) {
this.anxiousNoriskNum = anxiousNoriskNum;
}
public String getAnxiousPotentialriskNum() {
return anxiousPotentialriskNum;
}
public void setAnxiousPotentialriskNum(String anxiousPotentialriskNum) {
this.anxiousPotentialriskNum = anxiousPotentialriskNum;
}
public String getAnxiousRiskNum() {
return anxiousRiskNum;
}
public void setAnxiousRiskNum(String anxiousRiskNum) {
this.anxiousRiskNum = anxiousRiskNum;
}
public String getAnxiousPotentialriskList() {
return anxiousPotentialriskList;
}
public void setAnxiousPotentialriskList(String anxiousPotentialriskList) {
this.anxiousPotentialriskList = anxiousPotentialriskList;
}
public String getAnxiousRiskList() {
return anxiousRiskList;
}
public void setAnxiousRiskList(String anxiousRiskList) {
this.anxiousRiskList = anxiousRiskList;
}
public String getDepressedNoriskNum() {
return depressedNoriskNum;
}
public void setDepressedNoriskNum(String depressedNoriskNum) {
this.depressedNoriskNum = depressedNoriskNum;
}
public String getDepressedPotentialriskNum() {
return depressedPotentialriskNum;
}
public void setDepressedPotentialriskNum(String depressedPotentialriskNum) {
this.depressedPotentialriskNum = depressedPotentialriskNum;
}
public String getDepressedRiskNum() {
return depressedRiskNum;
}
public void setDepressedRiskNum(String depressedRiskNum) {
this.depressedRiskNum = depressedRiskNum;
}
public String getDepressedPotentialriskList() {
return depressedPotentialriskList;
}
public void setDepressedPotentialriskList(String depressedPotentialriskList) {
this.depressedPotentialriskList = depressedPotentialriskList;
}
public String getDepressedRiskList() {
return depressedRiskList;
}
public void setDepressedRiskList(String depressedRiskList) {
this.depressedRiskList = depressedRiskList;
}
public String getSomatizationNoriskNum() {
return somatizationNoriskNum;
}
public void setSomatizationNoriskNum(String somatizationNoriskNum) {
this.somatizationNoriskNum = somatizationNoriskNum;
}
public String getSomatizationPotentialriskNum() {
return somatizationPotentialriskNum;
}
public void setSomatizationPotentialriskNum(String somatizationPotentialriskNum) {
this.somatizationPotentialriskNum = somatizationPotentialriskNum;
}
public String getSomatizationRiskNum() {
return somatizationRiskNum;
}
public void setSomatizationRiskNum(String somatizationRiskNum) {
this.somatizationRiskNum = somatizationRiskNum;
}
public String getSomatizationPotentialriskList() {
return somatizationPotentialriskList;
}
public void setSomatizationPotentialriskList(String somatizationPotentialriskList) {
this.somatizationPotentialriskList = somatizationPotentialriskList;
}
public String getSomatizationRiskList() {
return somatizationRiskList;
}
public void setSomatizationRiskList(String somatizationRiskList) {
this.somatizationRiskList = somatizationRiskList;
}
public String getUncontrolNoriskNum() {
return uncontrolNoriskNum;
}
public void setUncontrolNoriskNum(String uncontrolNoriskNum) {
this.uncontrolNoriskNum = uncontrolNoriskNum;
}
public String getUncontrolPotentialriskNum() {
return uncontrolPotentialriskNum;
}
public void setUncontrolPotentialriskNum(String uncontrolPotentialriskNum) {
this.uncontrolPotentialriskNum = uncontrolPotentialriskNum;
}
public String getUncontrolRiskNum() {
return uncontrolRiskNum;
}
public void setUncontrolRiskNum(String uncontrolRiskNum) {
this.uncontrolRiskNum = uncontrolRiskNum;
}
public String getUncontrolPotentialriskList() {
return uncontrolPotentialriskList;
}
public void setUncontrolPotentialriskList(String uncontrolPotentialriskList) {
this.uncontrolPotentialriskList = uncontrolPotentialriskList;
}
public String getUncontrolRiskList() {
return uncontrolRiskList;
}
public void setUncontrolRiskList(String uncontrolRiskList) {
this.uncontrolRiskList = uncontrolRiskList;
}
public String getFailNoriskNum() {
return failNoriskNum;
}
public void setFailNoriskNum(String failNoriskNum) {
this.failNoriskNum = failNoriskNum;
}
public String getFailPotentialriskNum() {
return failPotentialriskNum;
}
public void setFailPotentialriskNum(String failPotentialriskNum) {
this.failPotentialriskNum = failPotentialriskNum;
}
public String getFailRiskNum() {
return failRiskNum;
}
public void setFailRiskNum(String failRiskNum) {
this.failRiskNum = failRiskNum;
}
public String getFailPotentialriskList() {
return failPotentialriskList;
}
public void setFailPotentialriskList(String failPotentialriskList) {
this.failPotentialriskList = failPotentialriskList;
}
public String getFailRiskList() {
return failRiskList;
}
public void setFailRiskList(String failRiskList) {
this.failRiskList = failRiskList;
}
public String getOddbehaviorNoriskNum() {
return oddbehaviorNoriskNum;
}
public void setOddbehaviorNoriskNum(String oddbehaviorNoriskNum) {
this.oddbehaviorNoriskNum = oddbehaviorNoriskNum;
}
public String getOddbehaviorPotentialriskNum() {
return oddbehaviorPotentialriskNum;
}
public void setOddbehaviorPotentialriskNum(String oddbehaviorPotentialriskNum) {
this.oddbehaviorPotentialriskNum = oddbehaviorPotentialriskNum;
}
public String getOddbehaviorRiskNum() {
return oddbehaviorRiskNum;
}
public void setOddbehaviorRiskNum(String oddbehaviorRiskNum) {
this.oddbehaviorRiskNum = oddbehaviorRiskNum;
}
public String getOddbehaviorPotentialriskList() {
return oddbehaviorPotentialriskList;
}
public void setOddbehaviorPotentialriskList(String oddbehaviorPotentialriskList) {
this.oddbehaviorPotentialriskList = oddbehaviorPotentialriskList;
}
public String getOddbehaviorRiskList() {
return oddbehaviorRiskList;
}
public void setOddbehaviorRiskList(String oddbehaviorRiskList) {
this.oddbehaviorRiskList = oddbehaviorRiskList;
}
public String getPressureNoriskNum() {
return pressureNoriskNum;
}
public void setPressureNoriskNum(String pressureNoriskNum) {
this.pressureNoriskNum = pressureNoriskNum;
}
public String getPressurePotentialriskNum() {
return pressurePotentialriskNum;
}
public void setPressurePotentialriskNum(String pressurePotentialriskNum) {
this.pressurePotentialriskNum = pressurePotentialriskNum;
}
public String getPressureRiskNum() {
return pressureRiskNum;
}
public void setPressureRiskNum(String pressureRiskNum) {
this.pressureRiskNum = pressureRiskNum;
}
public String getPressurePotentialriskList() {
return pressurePotentialriskList;
}
public void setPressurePotentialriskList(String pressurePotentialriskList) {
this.pressurePotentialriskList = pressurePotentialriskList;
}
public String getPressureRiskList() {
return pressureRiskList;
}
public void setPressureRiskList(String pressureRiskList) {
this.pressureRiskList = pressureRiskList;
}
public String getDegenerateNoriskNum() {
return degenerateNoriskNum;
}
public void setDegenerateNoriskNum(String degenerateNoriskNum) {
this.degenerateNoriskNum = degenerateNoriskNum;
}
public String getDegeneratePotentialriskNum() {
return degeneratePotentialriskNum;
}
public void setDegeneratePotentialriskNum(String degeneratePotentialriskNum) {
this.degeneratePotentialriskNum = degeneratePotentialriskNum;
}
public String getDegenerateRiskNum() {
return degenerateRiskNum;
}
public void setDegenerateRiskNum(String degenerateRiskNum) {
this.degenerateRiskNum = degenerateRiskNum;
}
public String getDegeneratePotentialriskList() {
return degeneratePotentialriskList;
}
public void setDegeneratePotentialriskList(String degeneratePotentialriskList) {
this.degeneratePotentialriskList = degeneratePotentialriskList;
}
public String getDegenerateRiskList() {
return degenerateRiskList;
}
public void setDegenerateRiskList(String degenerateRiskList) {
this.degenerateRiskList = degenerateRiskList;
}
public String getBullyNoriskNum() {
return bullyNoriskNum;
}
public void setBullyNoriskNum(String bullyNoriskNum) {
this.bullyNoriskNum = bullyNoriskNum;
}
public String getBullyPotentialriskNum() {
return bullyPotentialriskNum;
}
public void setBullyPotentialriskNum(String bullyPotentialriskNum) {
this.bullyPotentialriskNum = bullyPotentialriskNum;
}
public String getBullyRiskNum() {
return bullyRiskNum;
}
public void setBullyRiskNum(String bullyRiskNum) {
this.bullyRiskNum = bullyRiskNum;
}
public String getBullyPotentialriskList() {
return bullyPotentialriskList;
}
public void setBullyPotentialriskList(String bullyPotentialriskList) {
this.bullyPotentialriskList = bullyPotentialriskList;
}
public String getBullyRiskList() {
return bullyRiskList;
}
public void setBullyRiskList(String bullyRiskList) {
this.bullyRiskList = bullyRiskList;
}
public String getInattentionNoriskNum() {
return inattentionNoriskNum;
}
public void setInattentionNoriskNum(String inattentionNoriskNum) {
this.inattentionNoriskNum = inattentionNoriskNum;
}
public String getInattentionPotentialriskNum() {
return inattentionPotentialriskNum;
}
public void setInattentionPotentialriskNum(String inattentionPotentialriskNum) {
this.inattentionPotentialriskNum = inattentionPotentialriskNum;
}
public String getInattentionRiskNum() {
return inattentionRiskNum;
}
public void setInattentionRiskNum(String inattentionRiskNum) {
this.inattentionRiskNum = inattentionRiskNum;
}
public String getInattentionPotentialriskList() {
return inattentionPotentialriskList;
}
public void setInattentionPotentialriskList(String inattentionPotentialriskList) {
this.inattentionPotentialriskList = inattentionPotentialriskList;
}
public String getInattentionRiskList() {
return inattentionRiskList;
}
public void setInattentionRiskList(String inattentionRiskList) {
this.inattentionRiskList = inattentionRiskList;
}
public String getManiaNoriskNum() {
return maniaNoriskNum;
}
public void setManiaNoriskNum(String maniaNoriskNum) {
this.maniaNoriskNum = maniaNoriskNum;
}
public String getManiaPotentialriskNum() {
return maniaPotentialriskNum;
}
public void setManiaPotentialriskNum(String maniaPotentialriskNum) {
this.maniaPotentialriskNum = maniaPotentialriskNum;
}
public String getManiaRiskNum() {
return maniaRiskNum;
}
public void setManiaRiskNum(String maniaRiskNum) {
this.maniaRiskNum = maniaRiskNum;
}
public String getManiaPotentialriskList() {
return maniaPotentialriskList;
}
public void setManiaPotentialriskList(String maniaPotentialriskList) {
this.maniaPotentialriskList = maniaPotentialriskList;
}
public String getManiaRiskList() {
return maniaRiskList;
}
public void setManiaRiskList(String maniaRiskList) {
this.maniaRiskList = maniaRiskList;
}
public String getNetaddictionNoriskNum() {
return netaddictionNoriskNum;
}
public void setNetaddictionNoriskNum(String netaddictionNoriskNum) {
this.netaddictionNoriskNum = netaddictionNoriskNum;
}
public String getNetaddictionPotentialriskNum() {
return netaddictionPotentialriskNum;
}
public void setNetaddictionPotentialriskNum(String netaddictionPotentialriskNum) {
this.netaddictionPotentialriskNum = netaddictionPotentialriskNum;
}
public String getNetaddictionRiskNum() {
return netaddictionRiskNum;
}
public void setNetaddictionRiskNum(String netaddictionRiskNum) {
this.netaddictionRiskNum = netaddictionRiskNum;
}
public String getNetaddictionPotentialriskList() {
return netaddictionPotentialriskList;
}
public void setNetaddictionPotentialriskList(String netaddictionPotentialriskList) {
this.netaddictionPotentialriskList = netaddictionPotentialriskList;
}
public String getNetaddictionRiskList() {
return netaddictionRiskList;
}
public void setNetaddictionRiskList(String netaddictionRiskList) {
this.netaddictionRiskList = netaddictionRiskList;
}
public String getPhoneaddictionNoriskNum() {
return phoneaddictionNoriskNum;
}
public void setPhoneaddictionNoriskNum(String phoneaddictionNoriskNum) {
this.phoneaddictionNoriskNum = phoneaddictionNoriskNum;
}
public String getPhoneaddictionPotentialriskNum() {
return phoneaddictionPotentialriskNum;
}
public void setPhoneaddictionPotentialriskNum(String phoneaddictionPotentialriskNum) {
this.phoneaddictionPotentialriskNum = phoneaddictionPotentialriskNum;
}
public String getPhoneaddictionRiskNum() {
return phoneaddictionRiskNum;
}
public void setPhoneaddictionRiskNum(String phoneaddictionRiskNum) {
this.phoneaddictionRiskNum = phoneaddictionRiskNum;
}
public String getPhoneaddictionPotentialriskList() {
return phoneaddictionPotentialriskList;
}
public void setPhoneaddictionPotentialriskList(String phoneaddictionPotentialriskList) {
this.phoneaddictionPotentialriskList = phoneaddictionPotentialriskList;
}
public String getPhoneaddictionRiskList() {
return phoneaddictionRiskList;
}
public void setPhoneaddictionRiskList(String phoneaddictionRiskList) {
this.phoneaddictionRiskList = phoneaddictionRiskList;
}
public String getHateschoolNoriskNum() {
return hateschoolNoriskNum;
}
public void setHateschoolNoriskNum(String hateschoolNoriskNum) {
this.hateschoolNoriskNum = hateschoolNoriskNum;
}
public String getHateschoolPotentialriskNum() {
return hateschoolPotentialriskNum;
}
public void setHateschoolPotentialriskNum(String hateschoolPotentialriskNum) {
this.hateschoolPotentialriskNum = hateschoolPotentialriskNum;
}
public String getHateschoolRiskNum() {
return hateschoolRiskNum;
}
public void setHateschoolRiskNum(String hateschoolRiskNum) {
this.hateschoolRiskNum = hateschoolRiskNum;
}
public String getHateschoolPotentialriskList() {
return hateschoolPotentialriskList;
}
public void setHateschoolPotentialriskList(String hateschoolPotentialriskList) {
this.hateschoolPotentialriskList = hateschoolPotentialriskList;
}
public String getHateschoolRiskList() {
return hateschoolRiskList;
}
public void setHateschoolRiskList(String hateschoolRiskList) {
this.hateschoolRiskList = hateschoolRiskList;
}
public String getHateteacherNoriskNum() {
return hateteacherNoriskNum;
}
public void setHateteacherNoriskNum(String hateteacherNoriskNum) {
this.hateteacherNoriskNum = hateteacherNoriskNum;
}
public String getHateteacherPotentialriskNum() {
return hateteacherPotentialriskNum;
}
public void setHateteacherPotentialriskNum(String hateteacherPotentialriskNum) {
this.hateteacherPotentialriskNum = hateteacherPotentialriskNum;
}
public String getHateteacherRiskNum() {
return hateteacherRiskNum;
}
public void setHateteacherRiskNum(String hateteacherRiskNum) {
this.hateteacherRiskNum = hateteacherRiskNum;
}
public String getHateteacherPotentialriskList() {
return hateteacherPotentialriskList;
}
public void setHateteacherPotentialriskList(String hateteacherPotentialriskList) {
this.hateteacherPotentialriskList = hateteacherPotentialriskList;
}
public String getHateteacherRiskList() {
return hateteacherRiskList;
}
public void setHateteacherRiskList(String hateteacherRiskList) {
this.hateteacherRiskList = hateteacherRiskList;
}
public String getHatestudyNoriskNum() {
return hatestudyNoriskNum;
}
public void setHatestudyNoriskNum(String hatestudyNoriskNum) {
this.hatestudyNoriskNum = hatestudyNoriskNum;
}
public String getHatestudyPotentialriskNum() {
return hatestudyPotentialriskNum;
}
public void setHatestudyPotentialriskNum(String hatestudyPotentialriskNum) {
this.hatestudyPotentialriskNum = hatestudyPotentialriskNum;
}
public String getHatestudyRiskNum() {
return hatestudyRiskNum;
}
public void setHatestudyRiskNum(String hatestudyRiskNum) {
this.hatestudyRiskNum = hatestudyRiskNum;
}
public String getHatestudyPotentialriskList() {
return hatestudyPotentialriskList;
}
public void setHatestudyPotentialriskList(String hatestudyPotentialriskList) {
this.hatestudyPotentialriskList = hatestudyPotentialriskList;
}
public String getHatestudyRiskList() {
return hatestudyRiskList;
}
public void setHatestudyRiskList(String hatestudyRiskList) {
this.hatestudyRiskList = hatestudyRiskList;
}
public String getAnxexamNoriskNum() {
return anxexamNoriskNum;
}
public void setAnxexamNoriskNum(String anxexamNoriskNum) {
this.anxexamNoriskNum = anxexamNoriskNum;
}
public String getAnxexamPotentialriskNum() {
return anxexamPotentialriskNum;
}
public void setAnxexamPotentialriskNum(String anxexamPotentialriskNum) {
this.anxexamPotentialriskNum = anxexamPotentialriskNum;
}
public String getAnxexamRiskNum() {
return anxexamRiskNum;
}
public void setAnxexamRiskNum(String anxexamRiskNum) {
this.anxexamRiskNum = anxexamRiskNum;
}
public String getAnxexamPotentialriskList() {
return anxexamPotentialriskList;
}
public void setAnxexamPotentialriskList(String anxexamPotentialriskList) {
this.anxexamPotentialriskList = anxexamPotentialriskList;
}
public String getAnxexamRiskList() {
return anxexamRiskList;
}
public void setAnxexamRiskList(String anxexamRiskList) {
this.anxexamRiskList = anxexamRiskList;
}
public String getAutolesionidxNoriskNum() {
return autolesionidxNoriskNum;
}
public void setAutolesionidxNoriskNum(String autolesionidxNoriskNum) {
this.autolesionidxNoriskNum = autolesionidxNoriskNum;
}
public String getAutolesionidxPotentialriskNum() {
return autolesionidxPotentialriskNum;
}
public void setAutolesionidxPotentialriskNum(String autolesionidxPotentialriskNum) {
this.autolesionidxPotentialriskNum = autolesionidxPotentialriskNum;
}
public String getAutolesionidxRiskNum() {
return autolesionidxRiskNum;
}
public void setAutolesionidxRiskNum(String autolesionidxRiskNum) {
this.autolesionidxRiskNum = autolesionidxRiskNum;
}
public String getAutolesionidxPotentialriskList() {
return autolesionidxPotentialriskList;
}
public void setAutolesionidxPotentialriskList(String autolesionidxPotentialriskList) {
this.autolesionidxPotentialriskList = autolesionidxPotentialriskList;
}
public String getAutolesionidxRiskList() {
return autolesionidxRiskList;
}
public void setAutolesionidxRiskList(String autolesionidxRiskList) {
this.autolesionidxRiskList = autolesionidxRiskList;
}
public String getHelplessnessidxNoriskNum() {
return helplessnessidxNoriskNum;
}
public void setHelplessnessidxNoriskNum(String helplessnessidxNoriskNum) {
this.helplessnessidxNoriskNum = helplessnessidxNoriskNum;
}
public String getHelplessnessidxPotentialriskNum() {
return helplessnessidxPotentialriskNum;
}
public void setHelplessnessidxPotentialriskNum(String helplessnessidxPotentialriskNum) {
this.helplessnessidxPotentialriskNum = helplessnessidxPotentialriskNum;
}
public String getHelplessnessidxRiskNum() {
return helplessnessidxRiskNum;
}
public void setHelplessnessidxRiskNum(String helplessnessidxRiskNum) {
this.helplessnessidxRiskNum = helplessnessidxRiskNum;
}
public String getHelplessnessidxPotentialriskList() {
return helplessnessidxPotentialriskList;
}
public void setHelplessnessidxPotentialriskList(String helplessnessidxPotentialriskList) {
this.helplessnessidxPotentialriskList = helplessnessidxPotentialriskList;
}
public String getHelplessnessidxRiskList() {
return helplessnessidxRiskList;
}
public void setHelplessnessidxRiskList(String helplessnessidxRiskList) {
this.helplessnessidxRiskList = helplessnessidxRiskList;
}
public String getInterpersonalidxNoriskNum() {
return interpersonalidxNoriskNum;
}
public void setInterpersonalidxNoriskNum(String interpersonalidxNoriskNum) {
this.interpersonalidxNoriskNum = interpersonalidxNoriskNum;
}
public String getInterpersonalidxPotentialriskNum() {
return interpersonalidxPotentialriskNum;
}
public void setInterpersonalidxPotentialriskNum(String interpersonalidxPotentialriskNum) {
this.interpersonalidxPotentialriskNum = interpersonalidxPotentialriskNum;
}
public String getInterpersonalidxRiskNum() {
return interpersonalidxRiskNum;
}
public void setInterpersonalidxRiskNum(String interpersonalidxRiskNum) {
this.interpersonalidxRiskNum = interpersonalidxRiskNum;
}
public String getInterpersonalidxPotentialriskList() {
return interpersonalidxPotentialriskList;
}
public void setInterpersonalidxPotentialriskList(String interpersonalidxPotentialriskList) {
this.interpersonalidxPotentialriskList = interpersonalidxPotentialriskList;
}
public String getInterpersonalidxRiskList() {
return interpersonalidxRiskList;
}
public void setInterpersonalidxRiskList(String interpersonalidxRiskList) {
this.interpersonalidxRiskList = interpersonalidxRiskList;
}
public String getAddictionidxNoriskNum() {
return addictionidxNoriskNum;
}
public void setAddictionidxNoriskNum(String addictionidxNoriskNum) {
this.addictionidxNoriskNum = addictionidxNoriskNum;
}
public String getAddictionidxPotentialriskNum() {
return addictionidxPotentialriskNum;
}
public void setAddictionidxPotentialriskNum(String addictionidxPotentialriskNum) {
this.addictionidxPotentialriskNum = addictionidxPotentialriskNum;
}
public String getAddictionidxRiskNum() {
return addictionidxRiskNum;
}
public void setAddictionidxRiskNum(String addictionidxRiskNum) {
this.addictionidxRiskNum = addictionidxRiskNum;
}
public String getAddictionidxPotentialriskList() {
return addictionidxPotentialriskList;
}
public void setAddictionidxPotentialriskList(String addictionidxPotentialriskList) {
this.addictionidxPotentialriskList = addictionidxPotentialriskList;
}
public String getAddictionidxRiskList() {
return addictionidxRiskList;
}
public void setAddictionidxRiskList(String addictionidxRiskList) {
this.addictionidxRiskList = addictionidxRiskList;
}
public String getBullyidxNoriskNum() {
return bullyidxNoriskNum;
}
public void setBullyidxNoriskNum(String bullyidxNoriskNum) {
this.bullyidxNoriskNum = bullyidxNoriskNum;
}
public String getBullyidxPotentialriskNum() {
return bullyidxPotentialriskNum;
}
public void setBullyidxPotentialriskNum(String bullyidxPotentialriskNum) {
this.bullyidxPotentialriskNum = bullyidxPotentialriskNum;
}
public String getBullyidxRiskNum() {
return bullyidxRiskNum;
}
public void setBullyidxRiskNum(String bullyidxRiskNum) {
this.bullyidxRiskNum = bullyidxRiskNum;
}
public String getBullyidxPotentialriskList() {
return bullyidxPotentialriskList;
}
public void setBullyidxPotentialriskList(String bullyidxPotentialriskList) {
this.bullyidxPotentialriskList = bullyidxPotentialriskList;
}
public String getBullyidxRiskList() {
return bullyidxRiskList;
}
public void setBullyidxRiskList(String bullyidxRiskList) {
this.bullyidxRiskList = bullyidxRiskList;
}
public String getBehavidxNoriskNum() {
return behavidxNoriskNum;
}
public void setBehavidxNoriskNum(String behavidxNoriskNum) {
this.behavidxNoriskNum = behavidxNoriskNum;
}
public String getBehavidxPotentialriskNum() {
return behavidxPotentialriskNum;
}
public void setBehavidxPotentialriskNum(String behavidxPotentialriskNum) {
this.behavidxPotentialriskNum = behavidxPotentialriskNum;
}
public String getBehavidxRiskNum() {
return behavidxRiskNum;
}
public void setBehavidxRiskNum(String behavidxRiskNum) {
this.behavidxRiskNum = behavidxRiskNum;
}
public String getBehavidxPotentialriskList() {
return behavidxPotentialriskList;
}
public void setBehavidxPotentialriskList(String behavidxPotentialriskList) {
this.behavidxPotentialriskList = behavidxPotentialriskList;
}
public String getBehavidxRiskList() {
return behavidxRiskList;
}
public void setBehavidxRiskList(String behavidxRiskList) {
this.behavidxRiskList = behavidxRiskList;
}
public String getManiaidxNoriskNum() {
return maniaidxNoriskNum;
}
public void setManiaidxNoriskNum(String maniaidxNoriskNum) {
this.maniaidxNoriskNum = maniaidxNoriskNum;
}
public String getManiaidxPotentialriskNum() {
return maniaidxPotentialriskNum;
}
public void setManiaidxPotentialriskNum(String maniaidxPotentialriskNum) {
this.maniaidxPotentialriskNum = maniaidxPotentialriskNum;
}
public String getManiaidxRiskNum() {
return maniaidxRiskNum;
}
public void setManiaidxRiskNum(String maniaidxRiskNum) {
this.maniaidxRiskNum = maniaidxRiskNum;
}
public String getManiaidxPotentialriskList() {
return maniaidxPotentialriskList;
}
public void setManiaidxPotentialriskList(String maniaidxPotentialriskList) {
this.maniaidxPotentialriskList = maniaidxPotentialriskList;
}
public String getManiaidxRiskList() {
return maniaidxRiskList;
}
public void setManiaidxRiskList(String maniaidxRiskList) {
this.maniaidxRiskList = maniaidxRiskList;
}
public String getPoorhealthidxNoriskNum() {
return poorhealthidxNoriskNum;
}
public void setPoorhealthidxNoriskNum(String poorhealthidxNoriskNum) {
this.poorhealthidxNoriskNum = poorhealthidxNoriskNum;
}
public String getPoorhealthidxPotentialriskNum() {
return poorhealthidxPotentialriskNum;
}
public void setPoorhealthidxPotentialriskNum(String poorhealthidxPotentialriskPum) {
this.poorhealthidxPotentialriskNum = poorhealthidxPotentialriskPum;
}
public String getPoorhealthidxRiskNum() {
return poorhealthidxRiskNum;
}
public void setPoorhealthidxRiskNum(String poorhealthidxRiskNum) {
this.poorhealthidxRiskNum = poorhealthidxRiskNum;
}
public String getPoorhealthidxPotentialriskList() {
return poorhealthidxPotentialriskList;
}
public void setPoorhealthidxPotentialriskList(String poorhealthidxPotentialriskList) {
this.poorhealthidxPotentialriskList = poorhealthidxPotentialriskList;
}
public String getPoorhealthidxRiskList() {
return poorhealthidxRiskList;
}
public void setPoorhealthidxRiskList(String poorhealthidxRiskList) {
this.poorhealthidxRiskList = poorhealthidxRiskList;
}
public String getWearinessidxNoriskNum() {
return wearinessidxNoriskNum;
}
public void setWearinessidxNoriskNum(String wearinessidxNoriskNum) {
this.wearinessidxNoriskNum = wearinessidxNoriskNum;
}
public String getWearinessidxPotentialriskNum() {
return wearinessidxPotentialriskNum;
}
public void setWearinessidxPotentialriskNum(String wearinessidxPotentialriskNum) {
this.wearinessidxPotentialriskNum = wearinessidxPotentialriskNum;
}
public String getWearinessidxRiskNum() {
return wearinessidxRiskNum;
}
public void setWearinessidxRiskNum(String wearinessidxRiskNum) {
this.wearinessidxRiskNum = wearinessidxRiskNum;
}
public String getWearinessidxPotentialriskList() {
return wearinessidxPotentialriskList;
}
public void setWearinessidxPotentialriskList(String wearinessidxPotentialriskList) {
this.wearinessidxPotentialriskList = wearinessidxPotentialriskList;
}
public String getWearinessidxRiskList() {
return wearinessidxRiskList;
}
public void setWearinessidxRiskList(String wearinessidxRiskList) {
this.wearinessidxRiskList = wearinessidxRiskList;
}
public String getDistractionidxNoriskNum() {
return distractionidxNoriskNum;
}
public void setDistractionidxNoriskNum(String distractionidxNoriskNum) {
this.distractionidxNoriskNum = distractionidxNoriskNum;
}
public String getDistractionidxPotentialriskNum() {
return distractionidxPotentialriskNum;
}
public void setDistractionidxPotentialriskNum(String distractionidxPotentialriskNum) {
this.distractionidxPotentialriskNum = distractionidxPotentialriskNum;
}
public String getDistractionidxRiskNum() {
return distractionidxRiskNum;
}
public void setDistractionidxRiskNum(String distractionidxRiskNum) {
this.distractionidxRiskNum = distractionidxRiskNum;
}
public String getDistractionidxPotentialriskList() {
return distractionidxPotentialriskList;
}
public void setDistractionidxPotentialriskList(String distractionidxPotentialriskList) {
this.distractionidxPotentialriskList = distractionidxPotentialriskList;
}
public String getDistractionidxRiskList() {
return distractionidxRiskList;
}
public void setDistractionidxRiskList(String distractionidxRiskList) {
this.distractionidxRiskList = distractionidxRiskList;
}
public String getAnxexamidxNoriskNum() {
return anxexamidxNoriskNum;
}
public void setAnxexamidxNoriskNum(String anxexamidxNoriskNum) {
this.anxexamidxNoriskNum = anxexamidxNoriskNum;
}
public String getAnxexamidxPotentialriskNum() {
return anxexamidxPotentialriskNum;
}
public void setAnxexamidxPotentialriskNum(String anxexamidxPotentialriskNum) {
this.anxexamidxPotentialriskNum = anxexamidxPotentialriskNum;
}
public String getAnxexamidxRiskNum() {
return anxexamidxRiskNum;
}
public void setAnxexamidxRiskNum(String anxexamidxRiskNum) {
this.anxexamidxRiskNum = anxexamidxRiskNum;
}
public String getAnxexamidxPotentialriskList() {
return anxexamidxPotentialriskList;
}
public void setAnxexamidxPotentialriskList(String anxexamidxPotentialriskList) {
this.anxexamidxPotentialriskList = anxexamidxPotentialriskList;
}
public String getAnxexamidxRiskList() {
return anxexamidxRiskList;
}
public void setAnxexamidxRiskList(String anxexamidxRiskList) {
this.anxexamidxRiskList = anxexamidxRiskList;
}
public String getConflictidxNoriskNum() {
return conflictidxNoriskNum;
}
public void setConflictidxNoriskNum(String conflictidxNoriskNum) {
this.conflictidxNoriskNum = conflictidxNoriskNum;
}
public String getConflictidxPotentialriskNum() {
return conflictidxPotentialriskNum;
}
public void setConflictidxPotentialriskNum(String conflictidxPotentialriskNum) {
this.conflictidxPotentialriskNum = conflictidxPotentialriskNum;
}
public String getConflictidxRiskNum() {
return conflictidxRiskNum;
}
public void setConflictidxRiskNum(String conflictidxRiskNum) {
this.conflictidxRiskNum = conflictidxRiskNum;
}
public String getConflictidxPotentialriskList() {
return conflictidxPotentialriskList;
}
public void setConflictidxPotentialriskList(String conflictidxPotentialriskList) {
this.conflictidxPotentialriskList = conflictidxPotentialriskList;
}
public String getConflictidxRiskList() {
return conflictidxRiskList;
}
public void setConflictidxRiskList(String conflictidxRiskList) {
this.conflictidxRiskList = conflictidxRiskList;
}
public String getIsGenerate() {
return isGenerate;
}
public void setIsGenerate(String isGenerate) {
this.isGenerate = isGenerate;
}
public String getGeneratePath() {
return generatePath;
}
public void setGeneratePath(String generatePath) {
this.generatePath = generatePath;
}
public void setR0(String r0) {
this.r0 = r0;
}
public void setR1(String r1) {
this.r1 = r1;
}
public void setR2(String r2) {
this.r2 = r2;
}
public void setR3(String r3) {
this.r3 = r3;
}
public void setR4(String r4) {
this.r4 = r4;
}
public void setR5(String r5) {
this.r5 = r5;
}
public void setR6(String r6) {
this.r6 = r6;
}
public void setR7(String r7) {
this.r7 = r7;
}
public void setR8(String r8) {
this.r8 = r8;
}
public void setR9(String r9) {
this.r9 = r9;
}
public void setR10(String r10) {
this.r10 = r10;
}
public void setR11(String r11) {
this.r11 = r11;
}
public void setR12(String r12) {
this.r12 = r12;
}
public void setR13(String r13) {
this.r13 = r13;
}
public void setR14(String r14) {
this.r14 = r14;
}
public void setR15(String r15) {
this.r15 = r15;
}
public void setR16(String r16) {
this.r16 = r16;
}
public void setR17(String r17) {
this.r17 = r17;
}
public void setR18(String r18) {
this.r18 = r18;
}
public void setR19(String r19) {
this.r19 = r19;
}
public void setR20(String r20) {
this.r20 = r20;
}
public void setR21(String r21) {
this.r21 = r21;
}
public void setR22(String r22) {
this.r22 = r22;
}
public void setR23(String r23) {
this.r23 = r23;
}
public void setR24(String r24) {
this.r24 = r24;
}
public void setR25(String r25) {
this.r25 = r25;
}
public void setR26(String r26) {
this.r26 = r26;
}
public void setR27(String r27) {
this.r27 = r27;
}
public void setR28(String r28) {
this.r28 = r28;
}
public void setR29(String r29) {
this.r29 = r29;
}
public void setR30(String r30) {
this.r30 = r30;
}
public void setR31(String r31) {
this.r31 = r31;
}
public void setR32(String r32) {
this.r32 = r32;
}
public void setR33(String r33) {
this.r33 = r33;
}
public void setR34(String r34) {
this.r34 = r34;
}
public void setR35(String r35) {
this.r35 = r35;
}
public void setR36(String r36) {
this.r36 = r36;
}
public void setR37(String r37) {
this.r37 = r37;
}
public void setR38(String r38) {
this.r38 = r38;
}
public void setR39(String r39) {
this.r39 = r39;
}
public void setR40(String r40) {
this.r40 = r40;
}
public void setR41(String r41) {
this.r41 = r41;
}
public void setR42(String r42) {
this.r42 = r42;
}
public void setR43(String r43) {
this.r43 = r43;
}
public void setR44(String r44) {
this.r44 = r44;
}
public void setR45(String r45) {
this.r45 = r45;
}
public void setR46(String r46) {
this.r46 = r46;
}
public void setR47(String r47) {
this.r47 = r47;
}
public void setR48(String r48) {
this.r48 = r48;
}
public void setR49(String r49) {
this.r49 = r49;
}
public void setR50(String r50) {
this.r50 = r50;
}
public void setR51(String r51) {
this.r51 = r51;
}
public void setR52(String r52) {
this.r52 = r52;
}
public void setR53(String r53) {
this.r53 = r53;
}
public void setR54(String r54) {
this.r54 = r54;
}
public void setR55(String r55) {
this.r55 = r55;
}
public void setR56(String r56) {
this.r56 = r56;
}
public void setR57(String r57) {
this.r57 = r57;
}
public void setR58(String r58) {
this.r58 = r58;
}
public void setR59(String r59) {
this.r59 = r59;
}
public void setR60(String r60) {
this.r60 = r60;
}
public void setR61(String r61) {
this.r61 = r61;
}
public void setR62(String r62) {
this.r62 = r62;
}
public void setR63(String r63) {
this.r63 = r63;
}
public void setR64(String r64) {
this.r64 = r64;
}
public void setR65(String r65) {
this.r65 = r65;
}
public void setR66(String r66) {
this.r66 = r66;
}
public void setR67(String r67) {
this.r67 = r67;
}
public void setR68(String r68) {
this.r68 = r68;
}
public void setR69(String r69) {
this.r69 = r69;
}
public void setR70(String r70) {
this.r70 = r70;
}
public void setR71(String r71) {
this.r71 = r71;
}
public void setR72(String r72) {
this.r72 = r72;
}
public void setR73(String r73) {
this.r73 = r73;
}
public void setR74(String r74) {
this.r74 = r74;
}
private String r0,r1,r2,r3,r4,r5;
private String r6,r7,r8,r9,r10;
private String r11,r12,r13,r14,r15;
private String r16,r17,r18,r19,r20;
private String r21,r22,r23,r24,r25,r26;
private String r27,r28,r29,r30,r31,r32;
private String r33,r34,r35,r36,r37,r38;
private String r39,r40;
private String r41,r42;
private String r43,r44;
private String r45,r46;
private String r47,r48,r49,r50;
private String r51,r52,r53,r54,r55,r56,r57,r58,r59,r60,r61,r62,r63,r64,r65,r66;
private String r67,r68,r69,r70,r71,r72,r73,r74;
public String getR0() {
return classId;
}
public String getR1() {
return testStuNum;
}
public String getR2() {
return testStuPercent;
}
public String getR3() {
return stuSexPercent;
}
public String getR4() {
return stuBirthdayRang;
}
public String getR5() {
return testDate;
}
public String getR6() {
return testDeficiencyPercent;
}
public String getR7() {
return testTimePercent;
}
public String getR8() {
return availableLPercent;
}
public String getR9() {
return availableFPercent;
}
public String getR10() {
return availableCPercent;
}
public String getR11() {
return testDeficiencyNum;
}
public String getR12() {
return testTimeNum;
}
public String getR13() {
return availableLNum;
}
public String getR14() {
return availableFNum;
}
public String getR15() {
return availableCNum;
}
public String getR16() {
return testDeficiencyList;
}
public String getR17() {
return testTimeList;
}
public String getR18() {
return availableLList;
}
public String getR19() {
return availableFList;
}
public String getR20() {
return availableCList;
}
public String getR21() {
return anxiousPotentialriskList;
}
public String getR22() {
return depressedPotentialriskList;
}
public String getR23() {
return somatizationPotentialriskList;
}
public String getR24() {
return uncontrolPotentialriskList;
}
public String getR25() {
return failPotentialriskList;
}
public String getR26() {
return oddbehaviorPotentialriskList;
}
public String getR27() {
return anxiousRiskList;
}
public String getR28() {
return depressedRiskList;
}
public String getR29() {
return somatizationRiskList;
}
public String getR30() {
return uncontrolRiskList;
}
public String getR31() {
return failRiskList;
}
public String getR32() {
return oddbehaviorRiskList;
}
public String getR33() {
return pressurePotentialriskList;
}
public String getR34() {
return degeneratePotentialriskList;
}
public String getR35() {
return bullyPotentialriskList;
}
public String getR36() {
return pressureRiskList;
}
public String getR37() {
return degenerateRiskList;
}
public String getR38() {
return bullyRiskList;
}
public String getR39() {
return inattentionPotentialriskList;
}
public String getR40() {
return maniaPotentialriskList;
}
public String getR41() {
return inattentionRiskList;
}
public String getR42() {
return maniaRiskList;
}
public String getR43() {
return netaddictionPotentialriskList;
}
public String getR44() {
return phoneaddictionPotentialriskList;
}
public String getR45() {
return netaddictionRiskList;
}
public String getR46() {
return phoneaddictionRiskList;
}
public String getR47() {
return hateschoolPotentialriskList;
}
public String getR48() {
return hateteacherPotentialriskList;
}
public String getR49() {
return hatestudyPotentialriskList;
}
public String getR50() {
return anxexamPotentialriskList;
}
public String getR51() {
return hateschoolRiskList;
}
public String getR52() {
return hateteacherRiskList;
}
public String getR53() {
return hatestudyRiskList;
}
public String getR54() {
return anxexamRiskList;
}
public String getR55() {
return autolesionidxPotentialriskList;
}
public String getR56() {
return helplessnessidxPotentialriskList;
}
public String getR57() {
return interpersonalidxPotentialriskList;
}
public String getR58() {
return addictionidxPotentialriskList;
}
public String getR59() {
return bullyidxPotentialriskList;
}
public String getR60() {
return behavidxPotentialriskList;
}
public String getR61() {
return maniaidxPotentialriskList;
}
public String getR62() {
return poorhealthidxPotentialriskList;
}
public String getR63() {
return autolesionidxRiskList;
}
public String getR64() {
return helplessnessidxRiskList;
}
public String getR65() {
return interpersonalidxRiskList;
}
public String getR66() {
return addictionidxRiskList;
}
public String getR67() {
return bullyidxRiskList;
}
public String getR68() {
return behavidxRiskList;
}
public String getR69() {
return maniaidxRiskList;
}
public String getR70() {
return poorhealthidxRiskList;
}
public String getR71() {
return wearinessidxPotentialriskList;
}
public String getR72() {
return distractionidxPotentialriskList;
}
public String getR73() {
return anxexamidxPotentialriskList;
}
public String getR74() {
return conflictidxPotentialriskList;
}
public String getR75() {
return wearinessidxRiskList;
}
public String getR76() {
return distractionidxRiskList;
}
public String getR77() {
return anxexamidxRiskList;
}
public String getR78() {
return conflictidxRiskList;
}
}
|
package net.datacrow.console.components.renderers;
import java.awt.Component;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.JToolTip;
import javax.swing.table.DefaultTableCellRenderer;
import net.datacrow.console.ComponentFactory;
import net.datacrow.console.components.DcMultiLineToolTip;
import net.datacrow.core.DcRepository;
import net.datacrow.settings.DcSettings;
public abstract class DcTableHeaderRendererImpl extends DefaultTableCellRenderer {
private final JButton button = ComponentFactory.getTableHeader("");
protected DcTableHeaderRendererImpl() {}
public void applySettings() {
button.setBorder(BorderFactory.createLineBorder(DcSettings.getColor(DcRepository.Settings.stTableHeaderColor)));
button.setFont(DcSettings.getFont(DcRepository.Settings.stSystemFontBold));
button.setBackground(DcSettings.getColor(DcRepository.Settings.stTableHeaderColor));
}
public JButton getButton() {
return button;
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
button.setText(String.valueOf(value));
button.setToolTipText(String.valueOf(value));
return button;
}
@Override
public JToolTip createToolTip() {
return new DcMultiLineToolTip();
}
}
|
package InOut;
import java.util.Scanner;
public class InConsole extends Input {
@Override
public String inconsole() {
System.out.print("입력해주세요: ");
//Console에서 입력을 받기 위해 Scanner객체 사용
Scanner sc = new Scanner(System.in);
//입력받은 값을 message 라는 문자열 값에 대입
String message = sc.nextLine();
// System.out.println(message);
//Scanner객체 종료
sc.close();
//message라는 문자열 반환
return message;
}
@Override
public String infile() { return null;}
}
|
package com.mcode.nescompiler.program.directives;
import java.util.List;
import com.mcode.nescompiler.program.AddressTable;
import com.mcode.nescompiler.program.Parameter;
public class CreateLabelDirective implements Directive {
private String name;
@Override
public void init(List<Parameter> parameters) {
name = parameters.get(0).getStringValue();
}
@Override
public void execute() {
AddressTable.insertAddress(name, AddressTable.currentAddress);
}
}
|
package inClassByRavi;
public class FindingElementThatOccursOnlyOnceInArray {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr = { 1, 2, 3, 2, 3, 1, 3 };
int arrLength = arr.length;
int noWithOneOccurance = findElementThatOccursOnlyOnce(arr, arrLength);
System.out.println(noWithOneOccurance);
}
public static int findElementThatOccursOnlyOnce(int[] arr, int arrLength)
{
int currXor = 0;
for(int i=0;i<arrLength;i++)
{
currXor ^= arr[i];
}
return currXor;
}
}
|
package eden.mobv.api.fei.stu.sk.mobv_eden.adapters;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.*;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import eden.mobv.api.fei.stu.sk.mobv_eden.R;
import eden.mobv.api.fei.stu.sk.mobv_eden.resources.Post;
import eden.mobv.api.fei.stu.sk.mobv_eden.resources.PostsSingleton;
import java.util.List;
public class ParentAdapter extends RecyclerView.Adapter<ParentAdapter.ViewHolder> {
private RecyclerView.RecycledViewPool viewPool = new RecyclerView.RecycledViewPool();
private List<Post> parents;
private Context mainContenxt;
public ParentAdapter(List<Post> parents, Context mainContenxt) {
this.parents = parents;
this.mainContenxt = mainContenxt;
}
@NonNull
@Override
public ParentAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater
.from(parent.getContext())
.inflate(R.layout.parent_recycler, parent, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull ParentAdapter.ViewHolder holder, int position) {
Post parent = parents.get(position);
//holder.textView.setText(parent.title);
RecyclerView.LayoutManager childLayoutManager = new LinearLayoutManager(holder.recyclerView.getContext(), LinearLayoutManager.VERTICAL, false);
((LinearLayoutManager) childLayoutManager).setInitialPrefetchItemCount(4);
holder.recyclerView.setLayoutManager(childLayoutManager);
// childLayoutManager.scrollToPosition(PostsSingleton.getInstance().getCurrentIndex(parent.getUsername(), parent.getDate()));
holder.recyclerView.setAdapter(new ChildAdapter(PostsSingleton.getInstance().getPostsByUsername(parent.getUsername()), mainContenxt, PostsSingleton.getInstance().getProfileByUsername(parent.getUsername())));
holder.recyclerView.setRecycledViewPool(viewPool);
}
@Override
public int getItemCount() {
return parents.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
RecyclerView recyclerView;
// TextView textView;
ViewHolder(@NonNull View itemView) {
super(itemView);
recyclerView = itemView.findViewById(R.id.rv_child);
RecyclerView.ItemDecoration horizontalDecoration = new DividerItemDecoration(mainContenxt, DividerItemDecoration.HORIZONTAL);
SnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(recyclerView);
recyclerView.addItemDecoration(horizontalDecoration);
// textView = itemView.findViewById(R.id.textView);
}
}
}
|
package common.util.reflection;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import common.util.DateUtil;
public class ReflectionUtil {
public static <T> T copy(Class<T> clazz, Object from) {
Object to = null;;
try {
to = clazz.newInstance();
copy(to, from, false);
} catch (Exception e) {
}
return (T) to;
}
public static void copy(Object to, Object from) {
copy(to, from, false);
}
public static void copy(Object to, Object from, boolean ignoreNull) {
if ((from == null) || (to == null)) {
return;
}
Class<? extends Object> toClass = to.getClass();
Class<? extends Object> fromClass = from.getClass();
Field[] fields = null;
if (fromClass.toString().indexOf("$") == -1) {
fields = fromClass.getDeclaredFields();
} else {
fields = toClass.getDeclaredFields();
}
for (Field field : fields) {
field.setAccessible(true);
Class<?> fromType = field.getType();
Object fromValue = null;
String name = field.getName();
if (name.indexOf('$') != -1) {
// ignore proxy
continue;
}
try {
String methodPrefix = "get";
if(fromType.equals(Boolean.class) || fromType.equals(boolean.class)) {
methodPrefix = "is";
}
String getterName = methodPrefix + name.substring(0, 1).toUpperCase() + name.substring(1);
Method method = fromClass.getMethod(getterName, null);
fromValue = method.invoke(from, null);
// fromValue = field.get(from);
if (ignoreNull) {
if (fromValue == null) {
continue;
}
if (fromValue instanceof String) {
if (fromValue.toString().length() == 0) {
continue;
}
}
}
} catch (Exception e1) {
}
try {
String setterName = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method method = toClass.getMethod(setterName, fromType);
method.invoke(to, fromValue);
// Field toField = toClass.getDeclaredField(name);
// Class<?> toType = toField.getType();
// if (!fromType.equals(toType)) {
// continue;
// }
// toField.setAccessible(true);
// toField.set(to, fromValue);
} catch (Exception e) {
}
}
}
public static <T> T copyPrimeProperties(Class<T> toClazz, Object from) {
if (from == null)
return null;
try {
T to = toClazz.newInstance();
copyPrimeProperties(to, from);
return to;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void copyPrimeProperties(final Object to, final Object from) {
iterateFields(to, new FieldFoundCallback() {
@Override
public void field(Object o, Field field) {
if (isPrimeType(field.getType())) {
String fieldName = field.getName();
Field fromField = getField(from.getClass(), fieldName);
if (fromField == null)
return;
field.setAccessible(true);
fromField.setAccessible(true);
if (fromField.getType().equals(field.getType())) {
try {
field.set(to, fromField.get(from));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
});
}
public static <T> T copy(Class<T> toClass, final Object from, final Class... views) {
if (from == null)
return null;
T to;
try {
to = toClass.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
copy(to, from, views);
return to;
}
public static void copy(final Object to, final Object from, final Class... views) {
iterateFields(to, new FieldFoundCallback() {
@Override
public void field(Object o, Field field) {
String fieldName = field.getName();
Field fromField = getField(from.getClass(), fieldName);
if (fromField == null)
return;
field.setAccessible(true);
fromField.setAccessible(true);
if (isPrimeType(field.getType())) {
if (fromField.getType().equals(field.getType())) {
try {
field.set(to, fromField.get(from));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
else {
Views anno = (Views) getAnnotation(field, Views.class);
if (anno == null)
return;
for (Class exclude : anno.excludes()) {
for (Class v : views) {
if (v.equals(exclude)) {
return;
}
}
}
boolean copy = false;
for (Class include : anno.value()) {
for (Class v : views) {
if (v.equals(include) || Views.ANY.equals(include)) {
copy = true;
break;
}
}
if (copy)
break;
}
if (copy) {
if (List.class.isAssignableFrom(field.getType())) {
if (List.class.isAssignableFrom(fromField.getType())) {
try {
Object fromFieldValue = fromField.get(from);
if (fromFieldValue == null) {
field.set(to, null);
}
else {
List toFieldValue = new ArrayList();
field.set(to, toFieldValue);
List fromList = (List) fromFieldValue;
for (Object obj : fromList) {
if (obj == null)
toFieldValue.add(null);
else {
Object toFieldItem = getFieldGenericType(field).newInstance();
toFieldValue.add(toFieldItem);
copy(toFieldItem, obj, views);
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
else
throw new RuntimeException(fieldName + " is not a List type");
}
else {
try {
Object fromFieldValue = fromField.get(from);
if (fromFieldValue == null) {
field.set(to, null);
}
else {
Object toFieldValue = field.getType().newInstance();
copy(toFieldValue, fromFieldValue, views);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
}
});
}
public static void iterateClassTree(Class<?> clazz, ClassCallback callback) {
while (true) {
if (clazz.equals(Object.class)) {
break;
}
callback.classFound(clazz);
clazz = clazz.getSuperclass();
}
}
public static void iterateFields(final Object o, final FieldFoundCallback callback) {
iterateFields(o.getClass(), o, callback);
}
private static void iterateFields(final Class<?> clazz, final Object o, final FieldFoundCallback callback)
{
iterateClassTree(clazz, new ClassCallback() {
public void classFound(Class<?> cls) {
for (Field field : cls.getDeclaredFields()) {
try {
callback.field(o, field);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
});
}
public static void iterateMethods(final Object o, final MethodFoundCallback callback) {
iterateMethods(o.getClass(), o, callback);
}
private static void iterateMethods(final Class<?> clazz, final Object o, final MethodFoundCallback callback)
{
iterateClassTree(clazz, new ClassCallback() {
public void classFound(Class<?> cls) {
for (Method method : cls.getDeclaredMethods()) {
callback.method(o, method);
}
}
});
}
public static void iterateAnnotation(final Object o, final Class<?> annoClass, final AnnotationFoundCallback callback)
{
iterateAnnotatedFields(o, annoClass, callback);
iterateAnnotatedMethods(o, annoClass, callback);
}
public static void iterateAnnotatedFields(final Object o, final Class<?> annoClass, final AnnotatedFieldCallback callback)
{
iterateAnnotatedFields(o.getClass(), o, annoClass, callback);
}
public static void iterateAnnotatedMethods(final Object o, final Class<?> annoClass, final AnnotatedMethodCallback callback)
{
iterateAnnotatedMethods(o.getClass(), o, annoClass, callback);
}
public static void iterateAnnotatedFields(final Object o, final Class<?> annoClass, final Class<?> fieldType, final AnnotatedFieldCallback callback)
{
iterateAnnotatedFields(o.getClass(), o, annoClass, fieldType, callback);
}
private static void iterateAnnotatedFields(final Class<?> clazz, final Object o, final Class<?> annoClass, final AnnotatedFieldCallback callback)
{
iterateClassTree(clazz, new ClassCallback() {
public void classFound(Class<?> cls) {
for (Field field : cls.getDeclaredFields()) {
for (Annotation fieldAnnot : field.getAnnotations()) {
if (fieldAnnot.annotationType().equals(annoClass)) {
try {
callback.field(o, field);
break;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
}
});
}
private static void iterateAnnotatedFields(final Class<?> clazz, final Object o, final Class<?> annoClass, final Class<?> fieldType, final AnnotatedFieldCallback callback)
{
iterateClassTree(clazz, new ClassCallback() {
public void classFound(Class<?> cls) {
for (Field field : cls.getDeclaredFields()) {
Class<?> type = field.getType();
if (!fieldType.isAssignableFrom(type)) {
continue;
}
for (Annotation fieldAnnot : field.getAnnotations()) {
if (!fieldAnnot.equals(annoClass)) {
continue;
}
}
try {
callback.field(o, field);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
});
}
private static void iterateAnnotatedMethods(final Class<?> clazz, final Object o, final Class<?> annoClass, final AnnotatedMethodCallback callback)
{
iterateClassTree(clazz, new ClassCallback() {
public void classFound(Class<?> cls) {
for (Method method : cls.getDeclaredMethods()) {
for (Annotation methodAnnot : method.getAnnotations()) {
if (methodAnnot.annotationType().equals(annoClass)) {
callback.method(o, method);
break;
}
}
}
}
});
}
public static void setAnnotatedFields(final Object o, final Class<?> annoClass, final Object fieldValue)
{
iterateAnnotatedFields(o, annoClass, new AnnotatedFieldCallback() {
public void field(Object obj, Field field) {
try {
field.setAccessible(true);
field.set(obj, fieldValue);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
public static void setAnnotatedFields(final Object o, final Class<?> annoClass, final Class<?> fieldType, final Object fieldValue)
{
iterateAnnotatedFields(o, annoClass, fieldType, new AnnotatedFieldCallback() {
public void field(Object obj, Field field) {
try {
field.setAccessible(true);
field.set(obj, fieldValue);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
public static Class getParameterizedType(Class clazz) {
return getParameterizedType(clazz, 0);
}
public static Class getParameterizedType(Class clazz, int index) {
ParameterizedType s = (ParameterizedType) clazz.getGenericSuperclass();
return (Class) s.getActualTypeArguments()[index];
}
public static Class getFieldGenericType(Class c, String fieldName) {
try {
Field f = c.getDeclaredField(fieldName);
return getFieldGenericType(f);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static Class getFieldGenericType(Field f) throws Exception {
ParameterizedType gt = (ParameterizedType) f.getGenericType();
return (Class) gt.getActualTypeArguments()[0];
}
public static Class getFieldGenericType(Field f, int index) throws Exception {
ParameterizedType gt = (ParameterizedType) f.getGenericType();
return (Class) gt.getActualTypeArguments()[index];
}
public static Method getMethod(Class cls, final String name, final Class<?>... parmTypes)
throws Exception {
final ArrayList<Method> holder = new ArrayList<Method>();
iterateClassTree(cls, new ClassCallback() {
public void classFound(Class<?> clazz) {
try {
Method method = clazz.getMethod(name, parmTypes);
holder.add(method);
} catch (Exception e) {
// don't remove try...catch
}
}
});
if(holder.size() == 0) {
return null;
}
return holder.get(0);
}
public static boolean annotatedWith(Method method, Class annoCls) {
Annotation[] annotations = method.getAnnotations();
for (Annotation a : annotations) {
if (a.annotationType().equals(annoCls))
return true;
}
return false;
}
public static boolean annotatedWith(Field field, Class annoCls) {
Annotation[] annotations = field.getAnnotations();
for (Annotation a : annotations) {
if (a.annotationType().equals(annoCls))
return true;
}
return false;
}
public static Annotation getAnnotation(Field field, Class annoCls) {
Annotation[] annotations = field.getAnnotations();
for (Annotation a : annotations) {
if (a.annotationType().equals(annoCls))
return a;
}
return null;
}
public static boolean annotatedWith(Class<?> target, Class annoCls) {
Annotation[] annotations = target.getAnnotations();
for (Annotation a : annotations) {
if (a.annotationType().equals(annoCls))
return true;
}
return false;
}
public static Field getField(Class clazz, final String fieldName) {
final ArrayList<Field> holder = new ArrayList<Field>();
iterateClassTree(clazz, new ClassCallback() {
public void classFound(Class<?> clazz) {
try {
Field field = clazz.getDeclaredField(fieldName);
holder.add(field);
} catch (Exception e) {
// don't remove this try...catch block.
}
}
});
if(holder.size() == 0) {
return null;
}
return holder.get(0);
}
public static Method getMethod(Class clazz, final String methodName, final Class<?> parameterTypes) throws Exception {
final ArrayList<Method> holder = new ArrayList<Method>();
iterateClassTree(clazz, new ClassCallback() {
public void classFound(Class<?> clazz) {
try {
Method method = clazz.getDeclaredMethod(methodName, parameterTypes);
holder.add(method);
} catch (Exception e) {
// don't remove this try...catch block.
}
}
});
if(holder.size() == 0) {
return null;
}
return holder.get(0);
}
public static Method getSetter(Class clazz, final String fieldName, final Class<?> fieldType) throws Exception {
final String methodName = "set" + fieldName.substring(0,1).toUpperCase() + fieldName.substring(1);
return getMethod(clazz, methodName, fieldType);
}
public static Method getGetter(Class clazz, final String fieldName) throws Exception {
try {
String methodName = "get" + fieldName.substring(0,1).toUpperCase() + fieldName.substring(1);
return getMethod(clazz, methodName, new Class<?>[0]);
} catch (Exception e) {
String methodName = "is" + fieldName.substring(0,1).toUpperCase() + fieldName.substring(1);
return getMethod(clazz, methodName, new Class<?>[0]);
}
}
public static void setField(Object target, String fieldName, Object fieldValue) throws Exception {
Field field = getField(target.getClass(), fieldName);
field.set(target, fieldValue);
}
public static void callSetter(Object target, String fieldName, Object fieldValue) throws Exception {
Method setter = getSetter(target.getClass(), fieldName, fieldValue.getClass());
setter.invoke(target, fieldValue);
}
public static void callSetter(Object target, String fieldName, Object fieldValue, Class<?> fieldType) throws Exception {
Method setter = getSetter(target.getClass(), fieldName, fieldType);
setter.invoke(target, fieldValue);
}
public static void callSetter(Object target, String fieldName, String fieldValue) throws Exception {
Field field = getField(target.getClass(), fieldName);
if(field == null) {
return;
}
Class<?> fieldType = field.getType();
if(isPrimeType(fieldType)) {
Object value = convert(fieldValue, fieldType);
callSetter(target, fieldName, value, fieldType);
}
else if(fieldType.isEnum()) {
for(Object o : fieldType.getEnumConstants()){
Enum<?> c = (Enum<?>) o;
if(c.name().equals(fieldValue)){
callSetter(target, fieldName, c);
}
}
} else {
Method fromString = fieldType.getDeclaredMethod("fromString", String.class);
Object value = fromString.invoke(fieldType.newInstance(), fieldValue);
callSetter(target, fieldName, value);
}
}
public static Object callGetter(Object target, String fieldName) throws Exception {
Method getter = getGetter(target.getClass(), fieldName);
return getter.invoke(target, new Object[0]);
}
public static boolean isPrimeType(Class type) {
if(type.equals(String.class)) {
return true;
}
if(type.equals(Integer.class) || type.equals(int.class)) {
return true;
}
if(type.equals(Float.class) || type.equals(float.class)) {
return true;
}
if(type.equals(Double.class) || type.equals(double.class)) {
return true;
}
if(type.equals(Long.class) || type.equals(long.class)) {
return true;
}
if(type.equals(Boolean.class) || type.equals(boolean.class)) {
return true;
}
if(type.equals(Date.class)) {
return true;
}
if (type.equals(Calendar.class)) {
return true;
}
if (type.isEnum()) {
return true;
}
return false;
}
public static Object convert(String value, Class toType) throws Exception {
if(value == null) {
return null;
}
if(toType.equals(String.class)) {
return value;
}
if(toType.equals(Integer.class) || toType.equals(int.class)) {
return Integer.parseInt(value);
}
if(toType.equals(Float.class) || toType.equals(float.class)) {
return Float.parseFloat(value);
}
if(toType.equals(Double.class) || toType.equals(double.class)) {
return Double.parseDouble(value);
}
if(toType.equals(Long.class) || toType.equals(long.class)) {
return Long.parseLong(value);
}
if(toType.equals(Boolean.class) || toType.equals(boolean.class)) {
value = value.toLowerCase();
if(value.equals("1") || value.startsWith("t") || value.startsWith("y") || value.equalsIgnoreCase("on")) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
}
if(toType.equals(Date.class)) {
SimpleDateFormat sdf = DateUtil.getIso8601DateFormat();
return sdf.parse(value);
}
if (toType.equals(Calendar.class)) {
SimpleDateFormat sdf = DateUtil.getIso8601DateFormat();
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
calendar.setTime(sdf.parse(value));
return calendar;
}
if (toType.isEnum()) {
for (Object e : toType.getEnumConstants()) {
if (e.toString().equals(value))
return e;
}
}
throw new Exception("Unhandled data type: " + toType);
}
public static SimpleDateFormat getIso8601DateFormat() {
final SimpleDateFormat ISO8601UTC = new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss.SSSZ");// 24
// characters
ISO8601UTC.setTimeZone(TimeZone.getTimeZone("UTC")); // UTC == GMT
return ISO8601UTC;
}
public static boolean isPrimeType(Object item) {
return isPrimeType(item.getClass());
}
public static void setFieldValue(Object target, Field field, Object value) {
try {
field.setAccessible(true);
if (value == null) {
field.set(target, null);
} else if (field.getType().isAssignableFrom(value.getClass())) {
field.set(target, value);
} else if (isPrimeField(field)) {
Object convert = convert(value.toString(), field.getType());
field.set(target, convert);
} else {
throw new Exception("cannot set field value " + field.getName() + " for " + target.getClass());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static String primeString(Object primeObject) {
if (primeObject == null)
return null;
if (primeObject instanceof Date) {
return getIso8601DateFormat().format((Date) primeObject);
}
if (primeObject instanceof Calendar) {
return getIso8601DateFormat().format(((Calendar) primeObject).getTime());
}
return primeObject.toString();
}
public static boolean isPrimeField(Field field) {
return isPrimeType(field.getType());
}
}
|
package com.beadhouse.out;
import com.beadhouse.domen.Activity;
import com.beadhouse.domen.Advertising;
import com.beadhouse.domen.Image;
import java.util.Date;
import java.util.List;
public class ScheduleOut {
private Integer scheduleId;
private Date date;
private String breakfast;
private String lunch;
private String dinner;
private List<Activity> activityList;
private List<Image> imageList;
private List<Advertising> advertisingList;
public Integer getScheduleId() {
return scheduleId;
}
public void setScheduleId(Integer scheduleId) {
this.scheduleId = scheduleId;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getBreakfast() {
return breakfast;
}
public void setBreakfast(String breakfast) {
this.breakfast = breakfast;
}
public String getLunch() {
return lunch;
}
public void setLunch(String lunch) {
this.lunch = lunch;
}
public String getDinner() {
return dinner;
}
public void setDinner(String dinner) {
this.dinner = dinner;
}
public List<Activity> getActivityList() {
return activityList;
}
public void setActivityList(List<Activity> activityList) {
this.activityList = activityList;
}
public List<Image> getImageList() {
return imageList;
}
public void setImageList(List<Image> imageList) {
this.imageList = imageList;
}
public List<Advertising> getAdvertisingList() {
return advertisingList;
}
public void setAdvertisingList(List<Advertising> advertisingList) {
this.advertisingList = advertisingList;
}
}
|
import java.io.IOException;
import java.io.PrintWriter;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
public class CheckInBook extends HttpServlet{
private static final long serialVersionUID = 1L;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String isbn = request.getParameter("ISBN");
String cardId = request.getParameter("CardID");
FineSetter objFine = new FineSetter(isbn, cardId);
DbUpdate.returnBook(objFine);
out.println("<script>window.alert(\"Check-in Successful\")</script>");
double temp = DbUpdate.getFine(objFine);
DecimalFormat decimalFormat = new DecimalFormat("#.##");
temp = Double.parseDouble(decimalFormat.format(temp));
if (temp > 0) {
out.println("<script>window.alert(\"Please pay pending dues\")</script>");
request.getRequestDispatcher("CheckinBook.jsp").include(request, response);
out.println("<div class='container'>");
out.println("<table class='table table-bordered'>");
out.println("<br><br><tr><th>Card ID</th><th>ISBN</th><th>Fine Amount</th><th>Pay Fine</th></tr>");
out.println("<tr><td align=\"center\">"+objFine.getcardID()+"</td><td align=\"center\">"+objFine.getISBN()+"</td><td align=\"center\">"+temp+"</td><td align=\"center\"><a href='Pay?ISBN="+objFine.getISBN()+"&CardID="+objFine.getcardID()+"'>Pay</a></td></tr>");
out.println("</table>");
out.println("</div>");
}
else {
request.getRequestDispatcher("home.jsp").include(request, response);
}
out.close();
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
}
|
package org.openmrs.module.mirebalais.radiology;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.OrderType;
import org.openmrs.api.OrderContext;
import org.openmrs.api.OrderService;
import org.openmrs.module.mirebalais.api.MirebalaisHospitalService;
import org.openmrs.module.radiologyapp.RadiologyProperties;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class RadiologyOrderNumberGeneratorTest {
private RadiologyOrderNumberGenerator generator;
private MirebalaisHospitalService mirebalaisHospitalService;
private OrderService orderService;
private RadiologyProperties radiologyProperties;
private OrderType radiologyOrderType = new OrderType();
private OrderType otherOrderType = new OrderType();
@Before
public void setup() {
mirebalaisHospitalService = mock(MirebalaisHospitalService.class);
orderService = mock(OrderService.class);
radiologyProperties = mock(RadiologyProperties.class);
when(orderService.getNextOrderNumberSeedSequenceValue()).thenReturn(new Long(15));
when(mirebalaisHospitalService.getNextRadiologyOrderNumberSeedSequenceValue()).thenReturn(new Long(10));
when(radiologyProperties.getRadiologyTestOrderType()).thenReturn(radiologyOrderType);
generator = new RadiologyOrderNumberGenerator();
generator.setRadiologyProperties(radiologyProperties);
generator.setMirebalaisHospitalService(mirebalaisHospitalService);
generator.setOrderService(orderService);
}
@Test
public void shouldReturnStandardOrderNumberForNonRadiologyOrder() {
OrderContext context = new OrderContext();
context.setOrderType(otherOrderType);
assertThat(generator.getNewOrderNumber(context), is("ORD-15"));
}
@Test
public void shouldReturnRadiologyOrderNumberForRadiologyOrder() {
OrderContext context = new OrderContext();
context.setOrderType(radiologyOrderType);
assertThat(generator.getNewOrderNumber(context), is("0000000109"));
}
}
|
package model.object;
public class Publisher {
// fields
private int id;
private String publisher;
private String address;
private String description;
// constructor
// methods
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
package com.bpdts.testapp.api.spring.exploratory;
import com.bpdts.testapp.client.api.spring.UsersApi;
import com.bpdts.testapp.client.invoker.spring.ApiClient;
import com.bpdts.testapp.client.model.spring.NonExistentUser;
import com.bpdts.testapp.client.model.spring.User;
import com.bpdts.testapp.client.model.spring.UserDataList;
import org.springframework.http.*;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.client.ExtractingResponseErrorHandler;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import static java.util.Arrays.asList;
public class UsersApiExample
{
public static void main( String[] args ) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.setAccept( asList(
MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML,
MediaType.APPLICATION_PDF
));
HttpEntity<?> request = new HttpEntity<>( headers );
final RestTemplate template = new RestTemplate();
ExtractingResponseErrorHandler errorHandler = new ExtractingResponseErrorHandler() {
{
setMessageConverters( template.getMessageConverters() );
}
@Override
public void handleError(ClientHttpResponse response) throws IOException {
System.err.println( "Error: " + response );
for( HttpMessageConverter converter : template.getMessageConverters() ) {
if( converter.canRead( NonExistentUser.class, response.getHeaders().getContentType() ) ) {
System.err.println( converter.read( NonExistentUser.class, response ) );
break;
}
}
super.handleError(response);
}
};
template.setErrorHandler( errorHandler );
exerciseRestTemplate( template, request, "https://bpdts-test-app.herokuapp.com" );
exerciseApiClient( template );
}
private static void exerciseRestTemplate( RestTemplate template, HttpEntity<?> request, String baseUri ) {
ResponseEntity<String> response = template.exchange( baseUri + "/user/1", HttpMethod.GET, request, String.class );
System.out.println( response );
try {
response = template.exchange(baseUri + "/user/klingon", HttpMethod.GET, request, String.class);
System.out.println(response);
} catch( HttpClientErrorException.NotFound e ) {
System.err.println( e.getClass().getName() + " :: " + e.getResponseBodyAsString() );
System.err.println( e );
e.printStackTrace();
}
}
private static void exerciseApiClient( RestTemplate template ) {
ApiClient apiClient = new ApiClient( template );
apiClient.setBasePath( "https://bpdts-test-app.herokuapp.com/" );
UsersApi apiInstance = new UsersApi( apiClient );
String city = "London"; // String
System.out.println( apiInstance.getInstructions() );
User user = apiInstance.getUser("1");
System.out.println( user );
UserDataList userDataList = apiInstance.listAllUsers();
System.out.println( userDataList.size() );
userDataList = apiInstance.listUsersByCity( "London" );
System.out.println( userDataList );
userDataList = apiInstance.listUsersByCity( "Klingon" );
System.out.println( userDataList );
user = apiInstance.getUser( "klingon" );
System.out.println( user );
}
} |
package com.datayes.textmining.storm.spout;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.bson.types.ObjectId;
import backtype.storm.spout.SpoutOutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichSpout;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Values;
import com.datayes.textmining.Utils.ConfigFileLoader;
import com.datayes.textmining.Utils.LogUtil;
import com.datayes.textmining.rabbitMQ.RabbitMQConfig;
import com.google.gson.Gson;
import com.rabbitmq.client.QueueingConsumer;
/**
* ReportInsSpout.java
* com.datayes.algorithm.dpipe.reportClsStorm.storm.spout
* 工程:rptClassificationKeyWords
* 功能:report processing spout
*
* author date time
* ─────────────────────────────────────────────
* jiminzhou 2014年2月10日 下午1:19:21
*
* Copyright (c) 2014, Datayes All Rights Reserved.
*/
public class ReportProcessSpout extends BaseRichSpout{
private SpoutOutputCollector spoutOutputCollector;
// private Long count;
private RabbitMQConfig rabbitMQConfig;
private QueueingConsumer consumer;
private Gson gson;
private static Logger logger = null;
public ReportProcessSpout() {
// TODO Auto-generated constructor stub
logger = ConfigFileLoader.logger;
}
@Override
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
// outputFieldsDeclarer.declare(new Fields("id", "trade_quantity"));
outputFieldsDeclarer.declare(new Fields("newsID", "reportID"));
}
@Override
public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) {
this.spoutOutputCollector = spoutOutputCollector;
gson = new Gson();
Properties prop = ConfigFileLoader.clsProps;
//logger.info("in sport");
try {
String url = prop.getProperty("rabbitMQServer");
String queueName = prop.getProperty("InsQueueName");
String usr = prop.getProperty("rabbitMQuser");
String password = prop.getProperty("rabbitMQpwd");
rabbitMQConfig = new RabbitMQConfig(url,usr,password,5672, queueName);
consumer = rabbitMQConfig.getConsumer();
} catch (IOException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
logger.error(e.getMessage(), e);
logger.trace(e);
}
}
@Override
public void nextTuple() {
try {
// if (consumer == null) {
// rabbitMQConfig = new RabbitMQConfig("10.20.201.176","guest","guest",5672, "sqlQueue");
// consumer = rabbitMQConfig.getConsumer();
// }
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
if (delivery == null){
logger.error("delivery is null");
return;
}
String jsonStr = null;
try {
jsonStr = new String(delivery.getBody(),"utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
logger.error(e.getMessage(), e);
logger.trace(e);
}
ReportsMessage message = gson.fromJson(jsonStr, ReportsMessage.class);
//System.out.println(operation+" "+subjectID+" "+subject+" "+relatedKeywords);
//String how = message.refer.get(0).how;
//只处理insert的消息
// if (how.equalsIgnoreCase("update")) {
// return;
// }
String reportID = null;
String newsID = null;
for (Map.Entry<String, String> entry : message.refer.get(0).key.entrySet()) {
System.out.println(entry.getKey());
System.out.println(entry.getValue());
if (entry.getKey().equalsIgnoreCase("_id")) {
reportID = entry.getValue();
}
if (entry.getKey().equalsIgnoreCase("news_id")) {
newsID = entry.getValue();
}
}
//ObjectId rptID = new ObjectId(reportsID);
System.out.println("*********"+newsID+"==========="+reportID);
spoutOutputCollector.emit(new Values(newsID,reportID), message);
} catch (InterruptedException e) {
//e.printStackTrace();
logger.error(e.getMessage(), e);
logger.trace(e);
}
}
@Override
public void ack(Object o) {
}
@Override
public void fail(Object o) {
// String sentence = (String) o;
// spoutOutputCollector.emit(new Values(sentence),sentence);
}
public void close(){
try {
rabbitMQConfig.getChannel().close();
rabbitMQConfig.getConnection().close();
} catch (IOException e) {
logger.error(e.getMessage(), e);
logger.trace(e);
//e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
}
|
package jp.co.monkey.action;
public class ClickButton{
} |
package com.company;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by Nataliia on 04.08.2015.
*/
public class Lesson1 {
public static void main(String[] args){
//СПИСКИ
ArrayList<Integer> a= new ArrayList<Integer>();
System.out.println(a.size());
a.add(10); //0 значение списка
System.out.println(a.size());
a.add(1); //1 значение списка
a.add(5); // 2 значение списка
System.out.println(a.get(1)); //get - достать значение из списка
System.out.println(a.get(2));
a.remove(0); // remove - удалить значение из списка
System.out.println(a.size());
Integer []a1 = {1,2,10,20}; // перенос значений из массива в список
a.addAll(Arrays.asList(a1));
System.out.println(a);
}
}
|
package logger;
import java.io.IOException;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
/**
* contains all the methods to show the logs on console
* and save the logs in LogFile.txt of each run.
*/
public class Log
{
private static final Logger LOGGER = Logger.getLogger("logger");
private static PatternLayout layout = new PatternLayout("%d{dd MMM yyyy HH:mm:ss} %5p %c{1} - %m%n");
private static FileAppender appender;
private static ConsoleAppender consoleAppender;
static
{
try
{
consoleAppender = new ConsoleAppender(layout, "System.out");
appender= new FileAppender(layout,"LogFile.txt",true);
}
catch (IOException exception)
{
exception.printStackTrace();
}
}
/**
* method to display errors in log.
* @param className name of class in which error occurred.
* @param methodName name of method in which error occurred.
* @param exception stack trace of exception
*/
public static void logError (String className,String methodName,String exception)
{
LOGGER.addAppender(appender);
LOGGER.setLevel((Level) Level.INFO);
LOGGER.info("ClassName :"+className);
LOGGER.info("MethodName :"+methodName );
LOGGER.info("Exception :" +exception);
LOGGER.info("-----------------------------------------------------------------------------------");
}
/**
* method to display information in logs
* @param message message to be displayed
*/
public static void info(String message){
consoleAppender.setName("Console");
LOGGER.addAppender(consoleAppender);
LOGGER.addAppender(appender);
LOGGER.setLevel((Level) Level.INFO);
LOGGER.info(message);
}
} |
/*
* 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 synchronisation;
/**
*
* @author ks834
*/
public class Synchronisation {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
callit target=new callit();
caller obj1=new caller(target,"hello");
caller obj2=new caller(target,"Synchronized");
caller obj3=new caller(target,"world");
}
}
|
/*
* 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 com.innovaciones.reporte.service;
import com.innovaciones.reporte.model.TipoProducto;
import java.util.List;
/**
*
* @author pisama
*/
public interface TipoProductoService {
public TipoProducto addTipoProducto(TipoProducto tipoProducto);
public List<TipoProducto> getTipoProductos();
public TipoProducto getTipoProductoById(Integer id);
public TipoProducto getTipoProductoByCodigo(String codigo);
public TipoProducto getTipoProductoByNombre(String nombre);
public List<TipoProducto> getTipoProductosByEstado(Integer estado);
public TipoProducto saveTipoProducto(TipoProducto tipoProducto) ;
// List<TipoProducto> getTipoProductosLazy(int start, int size, String sortField, SortOrder sortOrder, Map<String, Object> filters) throws IntrospectionException;
}
|
package com.himanshu.poc.springboot.main;
import com.himanshu.poc.springboot.config.SecurityConfig;
import com.himanshu.poc.springboot.config.SwaggerConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
@SpringBootApplication(scanBasePackages = {"com.himanshu.poc.springboot.web.controller", "com.himanshu.poc.springboot.security"})
@Import(value = {SwaggerConfig.class, SecurityConfig.class})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
} |
package com.multivision.ehrms.service.data;
import java.util.List;
import org.springframework.stereotype.Component;
import com.multivision.ehrms.business.Resource;
import com.multivision.ehrms.service.data.interfaces.IResourceDataService;
@Component("resourceDS")
public class ResourceDataService extends BaseDataService implements IResourceDataService {
public List<Resource> getResources() throws Exception {
return getDataRetriever().retrieveAllRecords(new Resource());
}
public void saveResource(Resource resource) throws Exception {
getDataModifier().updateRecord(resource);
}
public Resource getResource(Long Id) throws Exception {
return (Resource) getDataRetriever().retrieveByKey(new Resource(),
Id.toString());
}
}
|
package org.qw3rtrun.aub.engine.property.matrix;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.binding.Bindings;
import javafx.beans.property.Property;
import javafx.beans.value.ObservableValue;
import org.qw3rtrun.aub.engine.vectmath.Matrix4f;
import java.lang.ref.WeakReference;
public class Matrix4fProperty extends ObservableMatrixBase implements Property<Matrix4f>, MatrixExpression {
private Matrix4f value = Matrix4f.E;
private ObservableValue<? extends Matrix4f> observable;
private InvalidationListener listener = null;
private boolean valid = true;
public Matrix4fProperty() {
}
public Matrix4fProperty(Matrix4f value) {
this.value = value;
}
private void markInvalid() {
if (valid) {
valid = false;
invalidated();
fireValueChangedEvent();
}
}
protected void invalidated() {
}
@Override
public void bind(ObservableValue<? extends Matrix4f> newObservable) {
if (!newObservable.equals(observable)) {
unbind();
observable = newObservable;
if (listener == null) {
listener = new Listener(this);
}
observable.addListener(listener);
markInvalid();
}
}
@Override
public void unbind() {
if (observable != null) {
value = observable.getValue();
observable.removeListener(listener);
observable = null;
}
}
@Override
public boolean isBound() {
return observable != null;
}
@Override
public void bindBidirectional(Property<Matrix4f> other) {
Bindings.bindBidirectional(this, other);
}
@Override
public void unbindBidirectional(Property<Matrix4f> other) {
Bindings.unbindBidirectional(this, other);
}
@Override
public Object getBean() {
return null;
}
@Override
public String getName() {
return "";
}
@Override
public Matrix4f getValue() {
valid = true;
return observable == null ? value : observable.getValue();
}
@Override
public void setValue(Matrix4f value) {
if (isBound()) {
throw new RuntimeException("A bound value cannot be set.");
}
if (this.value == null || !this.value.equals(value)) {
this.value = value;
markInvalid();
}
}
private static class Listener implements InvalidationListener {
private final WeakReference<Matrix4fProperty> wref;
public Listener(Matrix4fProperty ref) {
this.wref = new WeakReference<>(ref);
}
@Override
public void invalidated(Observable observable) {
Matrix4fProperty ref = wref.get();
if (ref == null) {
observable.removeListener(this);
} else {
ref.markInvalid();
}
}
}
}
|
package com.jt.sys.dao;
import com.jt.common.vo.JsonResult;
import com.jt.sys.entity.SysUser;
import javafx.scene.control.CheckBox;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysUserDao {
/**
* 获取用户列表
* @param username 搜索名
*/
List<SysUser> findPageObjects(
@Param("username") String username);
/**
* 启用和禁用状态
*/
int validById(
@Param("id") Integer id,
@Param("valid") Integer valid,
@Param("modifiedUser") String modifiedUser);
/**
* 插入一条用户信息到数据库
*/
int insertObject(SysUser entity);
/**
* 更新一条数据
*/
int updateObject(SysUser entity);
/**
* 根据id查询用户
*/
SysUser findObjectById(Integer id);
/** 根据username查询用户*/
SysUser findObjectByUsername(String username);
/** 根据邮箱查找权限用户 */
SysUser findObjectByEmail(String email);
/** 根据邮箱查找权限用户 */
SysUser findObjectByMobile(String mobile);
/** 根据用户名查找权限信息 */
List<String> findPermissionByUsername(String username);
}
|
package com.sai.one.algorithms.arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
/**
* Created by shravan on 1/10/16.
* http://www.programcreek.com/2014/06/leetcode-basic-calculator-java/
*/
public class BasicCalculator1 {
public static void main(String[] args) {
System.out.print(calculate("1"));
}
public static int calculate(String s) {
// delete white spaces
long res = 0;
s = s.replaceAll(" ", "");
if (s != null && s.length() > 0) {
// s = postTrasform(s);
// res = finalCalc(s);
//new logic
Queue<String> stack = new LinkedList<String>();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if (ch >= '0' && ch <= '9') {
sb.append(ch);
if (i == s.length() - 1) {
stack.add(sb.toString());
}
} else {
if (sb.length() > 0) {
stack.add(sb.toString());
sb = new StringBuilder();
}
stack.add(String.valueOf(ch));
}
}
if (stack.size() > 1) {
stack = postTrasform(stack);
res = finalCalc(stack);
} else {
res = Long.valueOf(stack.remove());
}
}
return (int) res;
}
//this logic works only for single digits
public static Queue<String> postTrasform(Queue<String> s) {
Stack<String> st = new Stack<String>();
Queue<String> sb = new LinkedList<String>();
while (!s.isEmpty()) {
String ch = s.remove();
if (ch.equalsIgnoreCase("+") || ch.equalsIgnoreCase("-")) {
gotOper(ch, 1, st, sb);
} else if (ch.equalsIgnoreCase("*") || ch.equalsIgnoreCase("/")) {
gotOper(ch, 2, st, sb);
} else if (ch.equalsIgnoreCase("(")) {
st.push(ch);
} else if (ch.equalsIgnoreCase(")")) {
gotParan(ch, st, sb);
} else {
sb.add(ch);
}
}
while (!st.isEmpty()) {
sb.add(st.pop());
}
return sb;
}
public static Long finalCalc(Queue<String> s) {
Stack<Long> st = new Stack<Long>();
while (!s.isEmpty()) {
String ch = s.remove();
if (!ch.equalsIgnoreCase("+") && !ch.equalsIgnoreCase("-") && !ch.equalsIgnoreCase("*") && !ch.equalsIgnoreCase("/")) {
st.push(Long.valueOf(ch));
} else {
Long ch2 = st.pop();
Long ch1 = st.pop();
if (ch.equalsIgnoreCase("+")) {
st.push(ch1 + ch2);
} else if (ch.equalsIgnoreCase("-")) {
st.push(ch1 - ch2);
} else if (ch.equalsIgnoreCase("*")) {
st.push(ch1 * ch2);
} else if (ch.equalsIgnoreCase("/")) {
st.push(ch1 / ch2);
}
}
}
StringBuilder sb = new StringBuilder();
if (st.size() > 1) {
while (!st.isEmpty()) {
sb.append(st.pop());
}
st.push(Long.valueOf(sb.reverse().toString()));
}
return st.pop();
}
public static void gotOper(String ch, int prec1, Stack<String> st, Queue<String> sb) {
while (!st.isEmpty()) {
String stTop = st.pop();
if (stTop.equalsIgnoreCase("(")) {
st.push(stTop);
break;
} else {
int prec2 = 0;
if (stTop.equalsIgnoreCase("+") || stTop.equalsIgnoreCase("-")) {
prec2 = 1;
} else {
prec2 = 2;
}
if (prec1 >= prec2) {
sb.add(stTop);
} else {
st.push(stTop);
break;
}
}
}
st.push(ch);
}
public static void gotParan(String ch, Stack<String> st, Queue<String> sb) {
while (!st.isEmpty()) {
String ch2 = st.pop();
if (ch2.equalsIgnoreCase("(")) {
break;
} else {
sb.add(ch2);
}
}
}
}
|
package github.pitbox46.oddpower.common;
import github.pitbox46.oddpower.entities.DummyEntity;
import github.pitbox46.oddpower.tiles.ExplosionGeneratorTile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.goal.NearestAttackableTargetGoal;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ForgeEventHandlers {
private static final Logger LOGGER = LogManager.getLogger();
/**
* Adds goal for monster entites to target dummies. Does not work for slimes
*/
@SubscribeEvent
public void onEntityJoinWorldEvent(EntityJoinWorldEvent entityJoinEvent){
Entity entity = entityJoinEvent.getEntity();
if (entity instanceof MonsterEntity) {
((MonsterEntity) entity).targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(((MonsterEntity) entity), DummyEntity.class, true));
}
}
/**
* If there is an Explosion Generator nearby, call ExplosionGeneratorTile#onExplosion
*/
@SubscribeEvent
public void onExplosionEvent(ExplosionEvent.Detonate detonateEvent){
for(BlockPos pos: detonateEvent.getAffectedBlocks()){
if(detonateEvent.getWorld().getTileEntity(pos) instanceof ExplosionGeneratorTile &&
((ExplosionGeneratorTile) detonateEvent.getWorld().getTileEntity(pos)).onExplosion(detonateEvent)) {
break;
}
}
}
}
|
package com.unlimited.scala.rest.exception;
/**
* Shows that a business entity wasn't found.
*
* @author Iulian Dumitru
*/
public class BusinessEntityNotFoundException extends BusinessException {
public BusinessEntityNotFoundException(String message, Object... args) {
super(message, args);
}
} |
package com.amanarora.wikisearch.view;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.databinding.DataBindingUtil;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.amanarora.wikisearch.R;
import com.amanarora.wikisearch.databinding.ActivitySearchBinding;
import com.amanarora.wikisearch.model.Page;
import com.amanarora.wikisearch.viewmodel.SearchViewModel;
import com.miguelcatalan.materialsearchview.MaterialSearchView;
import java.util.List;
public class SearchActivity extends AppCompatActivity {
private static final String LOG_TAG = SearchActivity.class.getSimpleName();
private ActivitySearchBinding binding;
private SearchViewModel viewModel;
private SearchResultsAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this,R.layout.activity_search);
setSupportActionBar(binding.toolbar);
viewModel = ViewModelProviders.of(this).get(SearchViewModel.class);
setupSearchResultsRecyclerView();
}
private void setupSearchResultsRecyclerView() {
binding.content.resultList.setLayoutManager(new LinearLayoutManager(this));
adapter = new SearchResultsAdapter(this, new SearchResultsAdapter.Callback() {
@Override
public void onItemSelected(String url) {
if (url != null && !url.isEmpty()) {
openUrlInChromeTab(url);
} else {
Toast.makeText(SearchActivity.this, "Unable to open url", Toast.LENGTH_SHORT).show();
}
}
});
binding.content.resultList.setAdapter(adapter);
setupSearch();
}
private void openUrlInChromeTab(String url) {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));
}
private void setupSearch() {
binding.searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
viewModel.setQuery(newText);
processQuery(newText);
return true;
}
});
binding.searchView.setOnSearchViewListener(new MaterialSearchView.SearchViewListener() {
@Override
public void onSearchViewShown() {
}
@Override
public void onSearchViewClosed() {
adapter.updateList(null);
}
});
}
private void processQuery(String query) {
viewModel.loadSearchResults(query).observe(SearchActivity.this, new Observer<List<Page>>() {
@Override
public void onChanged(@Nullable List<Page> pages) {
if (pages != null) {
adapter.updateList(pages);
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search, menu);
MenuItem item = menu.findItem(R.id.action_search);
binding.searchView.setMenuItem(item);
binding.searchView.setQuery(viewModel.getQuery().getValue(), true);
return true;
}
}
|
/*
* Selection Sort
*
* 时间复杂度 O(n^2)
*
* 交换最少的排序
*
* */
public class SelectionSortData {
public int[] numbers;
public int orderedIndex= -1; //[0,,,,,orderIndex]为有序
public int currentMinIndex =-1; //当前最小值元素索引
public int currentCompareIndex=-1; //正在比较的元素索引
public SelectionSortData(int N ,int randomBounds) {
numbers = new int[N];
for (int i = 0; i < N; i++) {
numbers[i] = (int)(Math.random()*randomBounds)+1;
}
}
public int N(){
return numbers.length;
}
public int get(int index) {
if (index<0 || index>=numbers.length)
throw new IllegalArgumentException("Invalid index to access Sort Data");
return numbers[index];
}
public void swap(int i,int j){
int temp;
temp = numbers[i];
numbers[i]= numbers[j];
numbers[j] = temp;
}
}
|
package gui;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import comparc.Instruction;
import comparc.Memory;
import comparc.Register;
import java.awt.BorderLayout;
public class MemoryGUI {
private JFrame jFrame = new JFrame("Memory");
private JPanel mainPanel = new JPanel();
private JPanel editPanel = new JPanel();
private JPanel gotoPanel = new JPanel();
private JTable jTable;
private JLabel lblNewMemoryValue = new JLabel();
private JLabel lblGotoMemory = new JLabel("Go to memory: ");
private JTextField txtNewMemoryValue = new JTextField();
private JTextField txtMemoryLoc = new JTextField();
private JButton btnGo = new JButton("GO");
private JButton btnEdit = new JButton("Edit");
private JButton btnBack = new JButton("Back");
private int row = 0;
public MemoryGUI(ArrayList<Instruction> ins, ArrayList<Register> reg, ArrayList<Memory> mem){
mainPanel.setPreferredSize (new Dimension(300, 600));
mainPanel.setLayout (null);
jFrame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
jFrame.getContentPane().add(mainPanel, BorderLayout.EAST);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(10, 11, 280, 475);
mainPanel.add(scrollPane);
jTable = new JTable();
scrollPane.setViewportView(jTable);
jFrame.pack();
jFrame.setVisible (true);
jFrame.setLocationRelativeTo(null);
DefaultTableModel model = new DefaultTableModel(new Object[]{"Memory Location", "Data"}, 0) {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
for(int i = 0; i < mem.size(); i++){
model.addRow(new Object[]{mem.get(i).getAddress(), mem.get(i).getData()});
}
jTable.setModel(model);
//gotoPanel
gotoPanel.setBounds(10, 489, 280, 70);
mainPanel.add(gotoPanel);
gotoPanel.setLayout(null);
lblGotoMemory.setBounds(10, 11, 130, 23);
gotoPanel.add(lblGotoMemory);
txtMemoryLoc.setBounds(187, 11, 83, 23);
gotoPanel.add(txtMemoryLoc);
btnGo.setBounds(94, 36, 89, 23);
gotoPanel.add(btnGo);
gotoPanel.setVisible(true);
//end of gotoPanel
//editPanel
editPanel.setBounds(10, 489, 280, 70);
mainPanel.add(editPanel);
editPanel.setLayout(null);
lblNewMemoryValue.setBounds(10, 11, 260, 23);
editPanel.add(lblNewMemoryValue);
txtNewMemoryValue.setBounds(10, 36, 55, 23);
editPanel.add(txtNewMemoryValue);
txtNewMemoryValue.setColumns(10);
btnEdit.setBounds(181, 36, 89, 23);
editPanel.add(btnEdit);
editPanel.setVisible(false);
//end of editPanel
btnBack.setBounds(104, 570, 89, 23);
mainPanel.add(btnBack);
jFrame.pack();
jFrame.setVisible (true);
jFrame.setLocationRelativeTo(null);
//ActionListeners
jTable.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent m) {
if (m.getClickCount() == 2) {
row = jTable.getSelectedRow();
lblNewMemoryValue.setText("New memory value for memory for " + mem.get(row).getAddress());
gotoPanel.setVisible(false);
editPanel.setVisible(true);
}
}
});
btnEdit.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
String pattern = "[0-9a-fA-F][0-9a-fA-F]";
Pattern p = Pattern.compile(pattern);
Matcher mNewMemVal = p.matcher(txtNewMemoryValue.getText());
boolean bNewMemVal = false;
if(mNewMemVal.find())
bNewMemVal = true;
if(txtNewMemoryValue.getText().length() != 2)
new JOptionPane().showMessageDialog(null, "Please input 2 Hex digits!");
else if(bNewMemVal == false){
new JOptionPane().showMessageDialog(null, "Please enter Hex Values only!");
}
else{
mem.get(row).setData(txtNewMemoryValue.getText());
jFrame.dispose();
new MemoryGUI(ins, reg, mem);
}
}
});
btnGo.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
String newLoc = txtMemoryLoc.getText();
int check = 0;
String pattern = "[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]";
Pattern p = Pattern.compile(pattern);
Matcher mNewMemLoc = p.matcher(txtMemoryLoc.getText());
boolean bNewMemLoc = false;
if(mNewMemLoc.find())
bNewMemLoc = true;
if(newLoc.length() != 4)
new JOptionPane().showMessageDialog(null, "Please input 4 characters!");
else if(bNewMemLoc == false)
new JOptionPane().showMessageDialog(null, "Please limit input to hex characters only!");
else{
for(int i = 0; i < jTable.getRowCount(); i++){
if(newLoc.toUpperCase().equals(jTable.getValueAt(i, 0).toString()) == true){
check = 1;
jTable.scrollRectToVisible(jTable.getCellRect(i, 0, true));
}
}
if(check == 0)
new JOptionPane().showMessageDialog(null, "Address entered does not exist!");
}
}
});
btnBack.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
jFrame.dispose();
new MainGUI(ins, reg, mem);
}
});
}
}
|
package com.stylefeng.guns.core.util;
import java.util.UUID;
/**
* @Author: yyc
* @Date: 2019/6/9 22:42
*/
public class UuidUtil {
public static String getUuid(){
return UUID.randomUUID().toString().replaceAll("-","");
}
}
|
package br.com.tn.cap14;
public class Conta {
private double saldo;
public Conta(double saldo) {
this.saldo = saldo;
}
public boolean equals(Object object) {
Conta outraConta = (Conta) object;
if (this.saldo == outraConta.saldo) {
return true;
}
return false;
}
public boolean equalsTunado(Object object) {
if (!(object instanceof Conta))
return false;
Conta outraConta = (Conta) object;
return this.saldo == outraConta.saldo;
}
} |
package com.stk123.entity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.sql.Time;
import java.util.Objects;
@Entity
@Table(name = "STK_ERROR_LOG")
@Setter
@Getter
public class StkErrorLogEntity {
@Id
@Column(name = "ID")
@GeneratedValue(strategy =GenerationType.SEQUENCE, generator="s_error_log_id")
@SequenceGenerator(name="s_error_log_id", sequenceName="s_error_log_id", allocationSize = 1)
private Integer id;
@Column(name = "CODE", nullable = true, length = 10)
private String code;
@Column(name = "TEXT", nullable = true)
private String text;
@Column(name = "ERROR", nullable = true)
private String error;
@Column(name = "INSERT_TIME", nullable = true)
private Time insertTime;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StkErrorLogEntity that = (StkErrorLogEntity) o;
return Objects.equals(id, that.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
|
/*
* Copyright 2014-2023 JKOOL, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jkoolcloud.jesl.net.security;
import java.io.StringReader;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
* JESL access response implementation, which encapsulates JESL authentication response message.
*
* @version $Revision: 1 $
*/
public class AccessResponse {
private static final String ROOT_TAG = "access-resp";
private static final String TOKEN_TAG = "token";
private static final String SUCCESS_TAG = "success";
private static final String REASON_TAG = "reason";
private static final String ROOT_ELMT = "<" + ROOT_TAG + ">";
private String token;
private boolean success;
private String reason;
/**
* Create access response with a given access token and status
*
* @param token
* access token
* @param success
* flag
*/
public AccessResponse(String token, boolean success) {
this.token = token;
this.success = success;
}
/**
* Create access response with a given access token and status
*
* @param token
* access token
* @param success
* flag
* @param reason
* success flag reason
*/
public AccessResponse(String token, boolean success, String reason) {
this.token = token;
this.success = success;
this.reason = reason;
}
/**
* Get user name associated with the response
*
* @return user name associated with the response
*/
public String getUser() {
return token;
}
/**
* Is access response signify success
*
* @return true if success, false otherwise
*/
public boolean isSuccess() {
return success;
}
/**
* Get success flag reason message
*
* @return success flag reason message
*/
public String getReason() {
return reason;
}
/**
* Generate access response message
*
* @return access response message
*/
public String generateMsg() {
StringBuilder msg = new StringBuilder();
msg.append("<").append(ROOT_TAG).append(">");
msg.append("<").append(TOKEN_TAG).append(">").append(token).append("</").append(TOKEN_TAG).append(">");
msg.append("<").append(SUCCESS_TAG).append(">").append(success).append("</").append(SUCCESS_TAG).append(">");
if (reason != null) {
msg.append("<").append(REASON_TAG).append(">").append(reason).append("</").append(REASON_TAG).append(">");
}
msg.append("</").append(ROOT_TAG).append(">");
return msg.toString();
}
/**
* Parse and create access response from a given string
*
* @param msg
* access response message
* @return access response object instance
*/
public static AccessResponse parseMsg(String msg) {
try {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
AccessResponseParserHandler handler = new AccessResponseParserHandler();
parser.parse(new InputSource(new StringReader(msg)), handler);
return handler.resp;
} catch (Exception e) {
throw new SecurityException("Failed to create AccessResponse from message", e);
}
}
/**
* Is a given string message an access response message
*
* @param msg
* access response message
* @return true if given string is an access response message, false otherwise
*/
public static boolean isAccessResponse(String msg) {
return (msg != null && msg.length() > ROOT_ELMT.length() && msg.startsWith(ROOT_ELMT, 0));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
protected static class AccessResponseParserHandler extends DefaultHandler {
public AccessResponse resp;
protected String user;
protected boolean success;
protected String reason;
protected StringBuilder elmtValue = new StringBuilder();
@Override
public void endDocument() throws SAXException {
if (reason != null) {
resp = new AccessResponse(user, success, reason);
} else {
resp = new AccessResponse(user, success);
}
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
elmtValue.setLength(0);
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (TOKEN_TAG.equals(qName)) {
user = elmtValue.toString();
} else if (SUCCESS_TAG.equals(qName)) {
success = Boolean.parseBoolean(elmtValue.toString());
} else if (REASON_TAG.equals(qName)) {
reason = elmtValue.toString();
}
}
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
elmtValue.append(ch, start, length);
}
}
}
|
package org.firstinspires.ftc.team10428;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.util.ElapsedTime;
/**
* Created by Eric on 2/4/2017.
*/
@TeleOp(name="Motor Test", group="Utility")
@Disabled
public class utilMotorTest extends OpMode {
//Declare hardware variables
public DcMotor motorNW;
public DcMotor motorNE;
public DcMotor motorSW;
public DcMotor motorSE;
private ElapsedTime runtime = new ElapsedTime();
public void init() {
//Initialize hardware
motorNW = hardwareMap.dcMotor.get("NW");
motorNE = hardwareMap.dcMotor.get("NE");
motorSW = hardwareMap.dcMotor.get("SW");
motorSE = hardwareMap.dcMotor.get("SE");
motorNW.setPower(0);
motorNE.setPower(0);
motorSW.setPower(0);
motorSE.setPower(0);
motorNW.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
motorNE.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
motorSW.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
motorSE.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
telemetry.addData("Say", "Hello Driver");
}
public void loop() {
//Define initial motor velocity
float NW = 0;
float NE = 0;
float SW = 0;
float SE = 0;
//Send N, E, S, W power to corresponding motors
motorNW.setPower(NW);
while (runtime.seconds() < 5.00) {
int a = 2 + 2;
if (a != 4) {
telemetry.addData("ERROR", "UNIVERSE SANDBOX BREACHED");
telemetry.update();
}
}
motorNE.setPower(NE);
while (runtime.seconds() < 10.00) {
int b = 2 + 2;
if (b != 4) {
telemetry.addData("ERROR", "UNIVERSE SANDBOX BREACHED");
telemetry.update();
}
}
motorSW.setPower(SW);
while (runtime.seconds() < 10.00) {
int c = 2 + 2;
if (c != 4) {
telemetry.addData("ERROR", "UNIVERSE SANDBOX BREACHED");
telemetry.update();
}
}
motorSE.setPower(SE);
}
}
|
package L1_EstruturaSequencial;
import java.util.Scanner;
public class Ex11_L1 {
public static void main(String[] args) {int numI1 = 0;
int numI2 = 0;
int numR = 0;
System.out.println("Digite o 1 Numero Inteiro");
Scanner myObj = new Scanner(System.in);
numI1 = myObj.nextInt();
System.out.println("Digite o 2 Numero Inteiro");
numI2 = myObj.nextInt();
do {
System.out.println("Digite o um Numero Real");
numR = myObj.nextInt();
if (numR<0){
System.out.println("(Um numero real é sempre possitivo)");
}
}while (numR<0);
System.out.println("a: " + (numI1 * 2 *(numI2/2)));
System.out.println("b: " + ((numI1 * 3) + numR));
System.out.println("c: " + (numR * numR));
}
}
|
/*
* Copyright 2002-2018 the original author or authors.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jdbc.config;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.BeanMetadataElement;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.TypedStringValue;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.jdbc.datasource.init.CompositeDatabasePopulator;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;
/**
* Internal utility methods used with JDBC configuration.
*
* @author Juergen Hoeller
* @author Stephane Nicoll
* @since 3.1
*/
abstract class DatabasePopulatorConfigUtils {
public static void setDatabasePopulator(Element element, BeanDefinitionBuilder builder) {
List<Element> scripts = DomUtils.getChildElementsByTagName(element, "script");
if (!scripts.isEmpty()) {
builder.addPropertyValue("databasePopulator", createDatabasePopulator(element, scripts, "INIT"));
builder.addPropertyValue("databaseCleaner", createDatabasePopulator(element, scripts, "DESTROY"));
}
}
private static BeanDefinition createDatabasePopulator(Element element, List<Element> scripts, String execution) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CompositeDatabasePopulator.class);
boolean ignoreFailedDrops = element.getAttribute("ignore-failures").equals("DROPS");
boolean continueOnError = element.getAttribute("ignore-failures").equals("ALL");
ManagedList<BeanMetadataElement> delegates = new ManagedList<>();
for (Element scriptElement : scripts) {
String executionAttr = scriptElement.getAttribute("execution");
if (!StringUtils.hasText(executionAttr)) {
executionAttr = "INIT";
}
if (!execution.equals(executionAttr)) {
continue;
}
BeanDefinitionBuilder delegate = BeanDefinitionBuilder.genericBeanDefinition(ResourceDatabasePopulator.class);
delegate.addPropertyValue("ignoreFailedDrops", ignoreFailedDrops);
delegate.addPropertyValue("continueOnError", continueOnError);
// Use a factory bean for the resources so they can be given an order if a pattern is used
BeanDefinitionBuilder resourcesFactory = BeanDefinitionBuilder.genericBeanDefinition(SortedResourcesFactoryBean.class);
resourcesFactory.addConstructorArgValue(new TypedStringValue(scriptElement.getAttribute("location")));
delegate.addPropertyValue("scripts", resourcesFactory.getBeanDefinition());
if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) {
delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding")));
}
String separator = getSeparator(element, scriptElement);
if (separator != null) {
delegate.addPropertyValue("separator", new TypedStringValue(separator));
}
delegates.add(delegate.getBeanDefinition());
}
builder.addPropertyValue("populators", delegates);
return builder.getBeanDefinition();
}
@Nullable
private static String getSeparator(Element element, Element scriptElement) {
String scriptSeparator = scriptElement.getAttribute("separator");
if (StringUtils.hasLength(scriptSeparator)) {
return scriptSeparator;
}
String elementSeparator = element.getAttribute("separator");
if (StringUtils.hasLength(elementSeparator)) {
return elementSeparator;
}
return null;
}
}
|
package br.cefetrj.sca.dominio;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import org.apache.commons.lang3.StringUtils;
@Entity
public class Disciplina {
@Id
@GeneratedValue
private Long id;
/**
* Nome desta disciplina.
*/
private String nome;
/**
* Código identificador desta disciplina.
*/
private String codigo;
/**
* Quantidade de créditos desta disciplina.
*/
private Integer quantidadeCreditos;
/**
* Carga horária (em horas-aula) desta disciplina durante sua oferta em um
* período letivo. Valores comuns desse atributo são 36, 54, 72 e 90.
*/
private int cargaHoraria;
/**
* Pré-requisitos desta disciplina. Uma disciplina pode ter zero ou mais
* pré-requisitos.
*/
@ManyToMany(cascade = CascadeType.MERGE)
@JoinTable(name = "DISCIPLINA_PREREQS", joinColumns = {
@JoinColumn(name = "GRADE_ID", referencedColumnName = "ID") }, inverseJoinColumns = {
@JoinColumn(name = "DISCIPLINA_ID", referencedColumnName = "ID") })
private Set<Disciplina> preReqs = new HashSet<Disciplina>();
/**
* A versão da grade curricular a que esta disciplna pertence.
*/
@ManyToOne
VersaoCurso versaoCurso;
@SuppressWarnings("unused")
private Disciplina() {
}
private Disciplina(String nome, String codigo, String quantidadeCreditos) {
super();
if (StringUtils.isBlank(nome)) {
throw new IllegalArgumentException("Valor inválido para nome.");
}
this.nome = nome;
if (StringUtils.isBlank(codigo)) {
throw new IllegalArgumentException("Valor inválido para código.");
}
this.codigo = codigo;
try {
this.quantidadeCreditos = Integer.parseInt(quantidadeCreditos);
if (this.quantidadeCreditos < 0) {
throw new IllegalArgumentException("Valor inválido para quantidade de créditos.");
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Valor inválido para quantidade de créditos.");
}
}
public Disciplina(String codigo, String nome, String quantidadeCreditos, String cargaHoraria) {
this(nome, codigo, quantidadeCreditos);
try {
this.cargaHoraria = Integer.parseInt(cargaHoraria);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Valor inválido para carga horária.");
}
}
public String getNome() {
return nome;
}
public String getCodigo() {
return codigo;
}
public Integer getQuantidadeCreditos() {
return quantidadeCreditos;
}
public void setQuantidadeCreditos(Integer quantidadeCreditos) {
if (this.quantidadeCreditos < 0) {
throw new IllegalArgumentException("Valor inválido para quantidade de créditos: " + quantidadeCreditos);
}
this.quantidadeCreditos = quantidadeCreditos;
}
public Set<Disciplina> getPreRequisitos() {
return preReqs;
}
public Long getId() {
return id;
}
public void alocarEmVersao(VersaoCurso versaoCurso) {
this.versaoCurso = versaoCurso;
}
@Override
public String toString() {
return "Disciplina [nome=" + nome + ", codigo=" + codigo + ", versaoCurso=" + versaoCurso + "]";
}
public void comPreRequisito(Disciplina disciplina) {
this.preReqs.add(disciplina);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());
result = prime * result + ((versaoCurso == null) ? 0 : versaoCurso.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Disciplina other = (Disciplina) obj;
if (codigo == null) {
if (other.codigo != null)
return false;
} else if (!codigo.equals(other.codigo))
return false;
if (versaoCurso == null) {
if (other.versaoCurso != null)
return false;
} else if (!versaoCurso.equals(other.versaoCurso))
return false;
return true;
}
}
|
class file3{
}
|
package cn.edu.cust.util.login;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
import javax.sql.DataSource;
import org.apache.naming.ContextBindings;
import cn.edu.cust.util.login.RolePrincipal;
import cn.edu.cust.util.login.UserPrincipal;
public class RoleBasedLoginModule implements LoginModule {
static final String SQL = "select password, role from admin where name = ? ";
private String username;
private String userrole;
private Subject subject;
private CallbackHandler callbackHandler;
public boolean abort() throws LoginException {
return false;
}
public boolean commit() throws LoginException {
UserPrincipal user = new UserPrincipal(username);
RolePrincipal role = new RolePrincipal(userrole);
subject.getPrincipals().add(user);
subject.getPrincipals().add(role);
return true;
}
public void initialize(Subject subject, CallbackHandler callbackHandler,
Map<String, ?> sharedState, Map<String, ?> options) {
this.subject = subject;
this.callbackHandler = callbackHandler;
}
public boolean login() throws LoginException {
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback("login");
callbacks[1] = new PasswordCallback("password", true);
try {
callbackHandler.handle(callbacks);
String username = ((NameCallback) callbacks[0]).getName();
String password = String.valueOf(((PasswordCallback) callbacks[1])
.getPassword());
Connection dbConnection = openDbConnection();
try {
String role = null;
PreparedStatement stmt = dbConnection.prepareStatement(SQL);
try {
stmt.setString(1, username);
ResultSet rs = stmt.executeQuery();
try {
if (rs.next()) {
String dbpass = rs.getString(1);
role = rs.getString(2);
if (!dbpass.equals(password)) {
throw new LoginException(
"Authentication failed: pass error");
}
} else {
throw new LoginException(
"Authentication failed: user error");
}
} finally {
rs.close();
}
} finally {
stmt.close();
}
this.username = username;
this.userrole = role;
return true;
} finally {
dbConnection.close();
}
} catch (IOException e) {
throw new LoginException(e.getMessage());
} catch (UnsupportedCallbackException e) {
throw new LoginException(e.getMessage());
} catch (NamingException e) {
throw new LoginException(e.getMessage());
} catch (SQLException e) {
throw new LoginException(e.getMessage());
}
}
public boolean logout() throws LoginException {
UserPrincipal user = new UserPrincipal(username);
RolePrincipal role = new RolePrincipal(userrole);
subject.getPrincipals().remove(user);
subject.getPrincipals().remove(role);
return true;
}
/**
* Open the specified database connection.
*
* @return Connection to the database
*/
protected Connection openDbConnection() throws NamingException,
SQLException {
Context context = null;
context = ContextBindings.getClassLoader();
context = (Context) context.lookup("comp/env");
DataSource dataSource = (DataSource) context.lookup("jdbc/pkm");
return dataSource.getConnection();
}
}
|
package io.youngwon.app.service;
import io.youngwon.app.domain.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class UserService {
// 임시 계정
private final String email = "jazz9008@gmail.com";
private final String password = "123";
public User login(String email, String password) {
if (!this.email.equals(email) || !this.password.equals(password)) {
new UsernameNotFoundException(email + "not found");
}
return new User(10L, email, password, "서영원");
}
}
|
package com.baiwang.custom.common.dao;
import com.baiwang.custom.common.model.MGBwResponesUnusual;
import com.baiwang.custom.common.model.MGOverDueModel;
import com.baiwang.custom.common.model.MGQueryInvModel;
import com.baiwang.custom.common.model.QueryInvRequestModel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface MGTScmVatMainMapper {
List<MGQueryInvModel> queryInvList(QueryInvRequestModel queryInvRequestModel);
//20180910版新增 查询全票面信息 TODO:需要时使用
List<MGQueryInvModel> queryInvFullList(QueryInvRequestModel queryInvRequestModel);
//异常发票列表查询
List<MGBwResponesUnusual> queryUnusualList(@Param("queryParams")Map params);
List<MGOverDueModel> queryOverDueList(@Param("queryParams")Map params);
}
|
package com.productStock.dataproviders.postgrees.repository;
import com.productStock.dataproviders.postgrees.model.CustomProductStockModel;
import com.productStock.dataproviders.postgrees.model.ProductStockModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ProductStockAppDataProviderRepository extends JpaRepository<ProductStockModel, Integer> {
@Query(value = "SELECT new com.productStock.dataproviders.postgrees.model.CustomProductStockModel(PS.stock.id, " +
"PS.stock.name, PS.product.name, PS.quantity, PS.product.price) FROM ProductStockModel PS " +
"WHERE PS.stock.id = :idStock ")
List<CustomProductStockModel> listAllStocksWithProductsByIdStock(int idStock);
@Query(value = "SELECT new com.productStock.dataproviders.postgrees.model.CustomProductStockModel(PS.stock.id, " +
"PS.stock.name, PS.product.name, PS.quantity, PS.product.price) FROM ProductStockModel PS ")
List<CustomProductStockModel> listAllStocksWithProducts();
} |
package com.geoblink.clientStore.rest;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.geoblink.clientStore.service.IClientStoreService;
@RestController
@RequestMapping("/clientData")
public class ClientStoreRestService {
private IClientStoreService service;
public IClientStoreService getService() {
return service;
}
public void setService(IClientStoreService service) {
this.service = service;
}
@RequestMapping(value="/store/{param}", method=RequestMethod.GET,produces={"application/json"})
public @ResponseBody String getAqui(@PathVariable String param) {
return service.storeClientData(param);
}
}
|
package com.somecompany.customermatches.rest;
import com.somecompany.customermatches.model.Match;
import org.springframework.stereotype.Component;
import java.time.Duration;
import java.time.LocalDateTime;
@Component
public class MatchResponseTransformer {
public MatchDto transform(Match match, SummaryType summaryType) {
return MatchDto.builder()
.matchId(match.getMatchId())
.startDate(match.getStartDate())
.playerA(match.getPlayerA())
.playerB(match.getPlayerB())
.summary(getSummary(match, summaryType))
.build();
}
private String getSummary(Match match, SummaryType summaryType) {
switch (summaryType) {
case AvBTime:
return String.format("%s vs %s, %s",
match.getPlayerA(), match.getPlayerB(), getTimedSummary(match.getStartDate()));
case AvB:
default:
return String.format("%s vs %s", match.getPlayerA(), match.getPlayerB());
}
}
private String getTimedSummary(LocalDateTime matchTime) {
LocalDateTime now = LocalDateTime.now();
long timeToGame = Duration.between(now, matchTime).toMinutes();
return timeToGame > 0
? String.format("starts in %d minutes", timeToGame)
: String.format("started %d minutes ago", Math.abs(timeToGame));
}
}
|
package com.hamatus.web.rest.dto;
/**
* Created by stefan.chapuis on 06.12.2015.
*/
public class FlickrAdminDTO {
private Boolean isAuthenticated;
private String url;
private Boolean needAPIData;
private String apiKey;
private String apiSecret;
private String verifierValue;
public Boolean getIsAuthenticated() {
return isAuthenticated;
}
public void setIsAuthenticated(Boolean isAuthenticated) {
this.isAuthenticated = isAuthenticated;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public void setNeedAPIData(Boolean needAPIData) {
this.needAPIData = needAPIData;
}
public Boolean getNeedAPIData() {
return needAPIData;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getApiSecret() {
return apiSecret;
}
public void setApiSecret(String apiSecret) {
this.apiSecret = apiSecret;
}
public String getVerifierValue() {
return verifierValue;
}
public void setVerifierValue(String verifierValue) {
this.verifierValue = verifierValue;
}
}
|
/*
RuleFolderNames -- a class within the Cellular Automaton Explorer.
Copyright (C) 2007 David B. Bahr (http://academic.regis.edu/dbahr/)
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package cellularAutomata.rules.util;
/**
* These are a list of commonly used folder names in which the rules are
* displayed. When creating a rule, override the getDisplayFolderNames() method
* to specify particular folders in which the rule will be displayed. Note that
* all rules are displayed in certain default folders (like USER_RULES_FOLDER
* and ALL_RULES) regardless of how getDisplayFolderNames() is overriden.
* <p>
* This class is used primarily by the various Rule classes and the RuleTree
* class.
*
* @author David Bahr
*/
public class RuleFolderNames
{
/**
* All rules are automatically added to this folder. Any rules can be placed
* into a particular folder by overriding the getDisplayFolderNames()
* method.
*/
public static final String ALL_RULES_FOLDER = "All Rules";
/**
* This is the name of the folder into which cyclic CA are placed. All rules
* can be placed into folders by overriding the getDisplayFolderNames()
* method. (I use this for CA that I deem classics. Sorry if others disagree
* with my choices!)
*/
public static final String CLASSICS_FOLDER = "Classics";
/**
* Rules that use complex number values (rather than integers) are placed
* into the folder with this name. All rules can be placed into folders by
* overriding the getDisplayFolderNames() method.
*/
public static final String COMPLEX_VALUED_FOLDER = "Complex Numbered";
/**
* Computationally intensive rules (that should be avoided by machines with
* little memory and weak processors) are placed into the folder with this
* name. All rules can be placed into folders by overriding the
* getDisplayFolderNames() method.
*/
public static final String COMPUTATIONALLY_INTENSIVE_FOLDER = "Computationally Intensive";
/**
* This is the name of the folder into which cyclic CA are placed. All rules
* can be placed into folders by overriding the getDisplayFolderNames()
* method.
*/
public static final String CYCLIC_RULES_FOLDER = "Cyclic (and Extensions)";
/**
* This is the name of the folder into which instructional rules are placed.
* All rules can be placed into folders by overriding the
* getDisplayFolderNames() method. (I use this choice for the rules that I
* demonstrate in class -- sorry if others disagree with my choices!)
*/
public static final String INSTRUCTIONAL_FOLDER = "Instructional";
/**
* This is the name of the folder into which life-based (birth/death) rules
* are placed. All rules can be placed into folders by overriding the
* getDisplayFolderNames() method.
*/
public static final String LIFE_LIKE_FOLDER = "Life-Like (Birth/Death Rules)";
/**
* This is the name of the folder into which rules that are known to be
* universal placed. All rules can be placed into folders by overriding the
* getDisplayFolderNames() method.
*/
public static final String KNOWN_UNIVERSAL_FOLDER = "Known to be Universal";
/**
* Rules used in obesity research are placed in this folder. All rules can
* be placed into folders by overriding the getDisplayFolderNames() method.
*/
public static final String OBESITY_RESEARCH_FOLDER = "Obesity Research";
/**
* Outer totalistic rules are placed into the folder with this name. All
* rules can be placed into folders by overriding the
* getDisplayFolderNames() method.
*/
public static final String OUTER_TOTALISTIC_FOLDER = "Outer Totalistic";
/**
* Rules obviously applicable to physics are placed into the folder with
* this name. All rules can be placed into folders by overriding the
* getDisplayFolderNames() method.
*/
public static final String PHYSICS_FOLDER = "Physics Applications";
/**
* "Pretty" rules are placed into the folder with this name. All rules can
* be placed into folders by overriding the getDisplayFolderNames() method.
*/
public static final String PRETTY_FOLDER = "Pretty (To Some Anyway)";
/**
* Probabilistic rules are placed into the folder with this name. All rules
* can be placed into folders by overriding the getDisplayFolderNames()
* method.
*/
public static final String PROBABILISTIC_FOLDER = "Probabilistic";
/**
* Rules that use real values (rather than integers) are placed into the
* folder with this name. All rules can be placed into folders by overriding
* the getDisplayFolderNames() method.
*/
public static final String REAL_VALUED_FOLDER = "Real Numbered";
/**
* Rules obviously applicable to social sciences are placed into the folder
* with this name. All rules can be placed into folders by overriding the
* getDisplayFolderNames() method.
*/
public static final String SOCIAL_FOLDER = "Social Applications";
/**
* Rules with very unusual shapes are placed into the folder
* with this name. All rules can be placed into folders by overriding the
* getDisplayFolderNames() method.
*/
public static final String UNUSUAL_SHAPES = "Unusual Shapes";
/**
* All user contributed rules are automatically added to this folder (if
* they are in the userRules folder). All rules can be placed into folders
* by overriding the getDisplayFolderNames() method.
*/
public static final String USER_RULES_FOLDER = "User Rules";
}
|
public class MergeSortedArray88 {
public static void main(String[] args) {
int [] nums1={1,2,3,0,0,0};
int [] nums2={2,5,6};
int m = 3;
int n = 3;
merge(nums1, m, nums2, n);
}
public static void merge(int[] nums1, int m, int[] nums2, int n){
int i = m - 1;
int j = n - 1;
int k = m + n -1;
while(i>=0 && j >=0){
if (nums1[i]>nums2[j]){
nums1[k] = nums1[i];
k--;
i--;
}
else{
nums1[k] = nums2[j];
k--;
j--;
}
}
while(j >=0){
nums1[k] = nums2[j];
k--;
j--;
}
}
}
|
package nine.enumareted;
public enum Gender {
//OBJEKTI
FEMALE, MALE, UNKNOWN;
//DEFINICIJA
private Gender(){
System.out.println("Poziva se konstruktor Gender");
}
}
|
package com.uwang.mail.demo;
import com.uwang.mail.demo.util.MailSenderInfo;
import com.uwang.mail.demo.util.SimpleMailSender;
/**
* 发送邮件客户端
*
*/
public class SendEmail {
public static void main(String[] args) {
send();
}
public static void send(){
// 这个类主要是设置邮件
MailSenderInfo mailInfo = new MailSenderInfo();
// 设置协议服务地址
mailInfo.setMailServerHost(mailInfo.getMailServerHost());
// 设置端口
mailInfo.setMailServerPort(mailInfo.getMailServerPort());
mailInfo.setValidate(true);
// 发送邮件者
mailInfo.setUserName("2490943211@qq.com");
// 您的邮箱密码(现在已经改成授权码)
mailInfo.setPassword("ifsccbsomhzvdjjd");
// 昵称
mailInfo.setFromAddress("巨无霸");
// 发给谁
mailInfo.setToAddress("255760176@qq.com");
// 设置邮件标题
mailInfo.setSubject("这是一个测试的邮件");
// 设置邮件内容
mailInfo.setContent(SendEmail.getString().toString());
// 这个类主要来发送邮件
SimpleMailSender.sendTextMail(mailInfo); // 执行发送普通文本
// SimpleMailSender.sendHtmlMail(mailInfo);// 发送html格式
System.out.println("======================");
}
/**
* 拼成HTML文件
* @return
*/
public static StringBuffer getString(){
StringBuffer sb = new StringBuffer();
sb.append("<!DOCTYPE html>")
.append("<html>")
.append("<head>")
.append("<meta charset=UTF-8\">")
.append("<title>诚信招聘网用户重设密码说明</title>")
.append("<style type=\"text/css\">")
.append(".test{font-family:\"Microsoft Yahei\";font-size: 12px;color: red;}")
.append("</style>").append("</head>").append("<body>")
.append("<span class=\"test\">你的密码为:</span><br>")
.append("123456")
// .append("<a href=\"http://localhost:8080/recruit/modules/newpassword.jsp\">http://www.honest.com/newpassword.jap?id=9430473&unid=4106fb7188c756a3cebb2943c7d3bfc4</a>")
.append("</body>").append("</html>");
return sb;
}
}
|
package com.zhaodf;
import com.alibaba.druid.pool.DruidDataSource;
import com.zhaodf.beans.MyImportBeanDefinitionRegistrar;
import com.zhaodf.beans.MyImportSelector;
import com.zhaodf.beans.Role;
import com.zhaodf.beans.Student;
import com.zhaodf.beans.User;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.Scope;
/**
* 类:IocJavaConfig
*
* @author zhaodf
* @date 2021/2/22
*/
@Configuration
@ComponentScan(basePackages="com.zhaodf")
@PropertySource(value = {"classpath:db.properties"})
@Import(value = {MyImportBeanDefinitionRegistrar.class})
public class IocJavaConfig {
// @Value("${mysql.driverClassName}")
// private String driverClassName;
// @Value("${mysql.url}")
// private String url;
// @Value("${mysql.username}")
// private String username;
// @Value("${mysql.password}")
// private String password;
//
// @Bean(name = {"abc","dataSource"})
// @Scope("singleton")
// public DruidDataSource dataSource(){
// DruidDataSource dataSource = new DruidDataSource();
// dataSource.setDriverClassName(driverClassName);
// dataSource.setUrl(url);
// dataSource.setUsername(username);
// dataSource.setPassword(password);
// return dataSource;
// }
//
// @Bean
// public User user(){
// return new User();
// }
}
|
//package interfaceClass;
//
///**
// * Created by qq65827 on 2015/2/28.
// */
//public interface Simple {
// default void print4() {
// System.out.println("4");
// }
//
// public void print5();
//}
|
package com.example.amanleenpuri.gogreen.ui;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.amanleenpuri.gogreen.R;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import model.Event;
import model.GreenEntry;
import model.Notification;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import ws.remote.GreenRESTInterface;
/**
* Created by Tejal Shah on 4/5/2016.
*/
public class NotificationActivity extends AppCompatActivity {
//ImageView cancel;
ArrayList<model.Notification> noteData;
ListView noteList;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.notification_layout);
//cancel= (ImageView) findViewById(R.id.notification_cancel);
noteList=(ListView)findViewById(R.id.notification_list);
if(savedInstanceState==null){
Log.v("!!!!!!!!!!!!!!!!","I AM HERE");
Bundle arguments = new Bundle();
Bundle extras = getIntent().getExtras();
if(extras!=null) {
noteData = (ArrayList<Notification>) extras.getSerializable("NOTIFS");
Log.v("!!!!!!!!!!!!!!!!",noteData.toString());
}
}
/*try {
noteData = setNoteList();
} catch (InterruptedException e) {
e.printStackTrace();
}*/
//Log.v("@@@@@@@@@@@",noteData.toString());
noteList.setAdapter(new NoteListViewAdapter(this,noteData));
// cancel.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(NotificationActivity.this, TimelineActivity.class);
// startActivity(intent);
// }
// });
}
// private ArrayList setNoteList() throws InterruptedException {
// GreenRESTInterface greenRESTInterface = ((GoGreenApplication)getApplication()).getGoGreenApiService();
// Call<List<Notification>> getNs = greenRESTInterface.getAllNotifications();
// getNs.enqueue(new Callback<List<Notification>>() {
//
// List<Notification> arrN=new ArrayList<Notification>();
// @Override
// public void onResponse(Call<List<Notification>> call, Response<List<Notification>> response) {
// if (response.isSuccessful()) {
// Log.v("##############",response.body().toString());
// arrN = response.body();
// for(int i=0;i<arrN.size();i++){
// noteData.add(arrN.get(i));
// Log.v("##############",arrN.get(i).toString());
// }
// } else {
// Log.e("Signup", "Error in response " + response.errorBody());
// }
// }
//
// @Override
// public void onFailure(Call<List<Notification>> call, Throwable t) {
// Log.e("NOTIFICATIONS", "Failure to fetch Notifications", t);
// }
// });
// /*Thread t1 = new Thread(new Runnable() {
// public void run() {
//
// try{
// JSONObject jsonObject = new JSONObject();
// URL url = new URL("http://192.168.0.6:8080/GoGreenServer/AllNotificationsServlet");
// HttpURLConnection connection = (HttpURLConnection)url.openConnection();
//
// connection.setDoOutput(true);
// OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
// out.write(jsonObject.toString());
// out.close();
//
// //connection.disconnect();
//
// // connection.setDoInput(true);
// int responseCode = connection.getResponseCode();
// Log.d("Response Code = ",String.valueOf(responseCode));
// BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
//
// String returnString="";
//
// // while ((returnString = in.readLine()) != null)
// //{
//// doubledValue= Integer.parseInt(returnString);
// // Log.d("ReturnString", returnString);
// // JSONArray jsonArray = new JSONArray (returnString);
// // if (jsonArray != null) {
// // int len = jsonArray.length();
//// for (int i=0;i<len;i++){
//
// // noteData.add((Notification)jsonArray.get(i));
// // }
// //}
// //JSONObject notifications = new JSONObject(returnString);
// //noteData = (ArrayList<Notification>)returnString;
//
// //}
// //noteData.add(new Gson().fromJson(returnString, new TypeToken<List<model.Notification>>(){}.getType()));
// Gson gson = new Gson();
// noteData = gson.fromJson(in, new TypeToken<List<Notification>>(){}.getType());
// Log.v("$$$$$$$$$$$",noteData.toString());
// for(int i=0;i<noteData.size();i++){
// Log.v("$$$$$$$$$$$",noteData.get(i).getNotificationMessage());
// }
//
// in.close();
//
//
// }catch(Exception e)
// {
// Log.d("Exception",e.toString());
// }
//
// }
// });
// t1.start();
// t1.join();*/
// /*noteData.add(new Notification("Amrata","Diseased Sunflowers"));
// noteData.add(new Notification("Amanleen","Use Roundup"));
// noteData.add(new Notification("Amrata","Bad Soil"));
// noteData.add(new Notification("Amanleen","Temporary"));
// noteData.add(new Notification("Amrata","Event:Mission Peak Plantation Camp"));*/
// return noteData;
// }
private class NoteListViewAdapter extends ArrayAdapter<model.Notification> {
NoteListViewAdapter(Context context, ArrayList<model.Notification> list){
super(context, android.R.layout.simple_list_item_1,list);
Log.v("%%%%%%%%%%%%%","Inside NOTILISTVIEW ADAPTER");
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
model.Notification p = getItem(position);
//Log.v("%%%%%%%%%%%%%",p.toString());
if(convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.notification_item, parent, false);
}
TextView fromView=(TextView) convertView.findViewById(R.id.note_from);
Button nb = (Button) convertView.findViewById(R.id.viewNotifDetails);
final TextView subjectView=(TextView) convertView.findViewById(R.id.note_subject);
fromView.setText(p.getByUserName());
subjectView.setText(p.getNotificationMessage());
final int eventId = p.getEventId();
Log.v ("############",String.valueOf(eventId));
final String host =p.getByUserName();
// nb.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// }
// });
nb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// if(subjectView.getText().toString().contains("event") || subjectView.getText().toString().contains("Event")){
GreenRESTInterface greenRESTInterface = ((GoGreenApplication)getApplication()).getGoGreenApiService();
Call<model.Event> getEvent = greenRESTInterface.getAnEvent(eventId);
Log.v ("%%%%%%%%%%%%%",String.valueOf(eventId));
getEvent.enqueue(new Callback<Event>() {
@Override
public void onResponse(Call<Event> call, Response<Event> response) {
if (response.isSuccessful()) {
Event e =new Event();
Log.v("%%%%%%%%%%%%%",response.body().toString()+"##############");
e = response.body();
Log.v("%%%%%%%%%%%%%",e.toString()+"##############");
Intent intent = new Intent(NotificationActivity.this, EventDetailsActivity.class);
intent.putExtra("EventObj",e);
intent.putExtra("Host",host);
startActivity(intent);
} else {
Log.e("Signup", "Error in response " + response.errorBody());
}
}
@Override
public void onFailure(Call<Event> call, Throwable t) {
Log.e("NOTIFICATIONS", "Failure to fetch Notifications", t);
}
});
//Event e = new Event("Event:Plantation Camp","100 peope are invited","43600 Mission Blvd,Fremont, CA 94539","23 APR, 2016","09:00","13:00",3);
//Intent intent = new Intent(getContext(), EventDetailsActivity.class);
//intent.putExtra("EventObj",e);
//startActivity(intent);
}
});
return convertView;
}
}
}
|
package com.webproject.compro.web.vos;
import java.util.ArrayList;
public class GetItemVo {
private final int startPage;
private final int endPage;
private final int requestPage;
private final ArrayList<ItemVo> itemVos;
public GetItemVo(int startPage, int endPage, int requestPage, ArrayList<ItemVo> itemVos) {
this.startPage = startPage;
this.endPage = endPage;
this.requestPage = requestPage;
this.itemVos = itemVos;
}
public int getStartPage() {
return startPage;
}
public int getEndPage() {
return endPage;
}
public int getRequestPage() {
return requestPage;
}
public ArrayList<ItemVo> getItemVos() {
return itemVos;
}
}
|
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
//fail to solve this problem by myself, hard to understand, try to draw a picture
//recursion method will reverse the link front back to front
//it first go to the end of list to find the new 'head'
//then, it recursively reverse to pointer from back to front
//critical thingking: if it reverse from front to back, like iteration method do
//then it will forget the next node, thus never reach the end
/*public class Solution {
public ListNode reverseList(ListNode head) {
if(head==null || head.next == null)
return head;
//get second node
ListNode second = head.next;
//set first's next to be null
head.next = null;
ListNode rest = reverseList(second);
second.next = head;
return rest;
}
}
*/
//however, iteration method will reverse the link from front to back
//from front to end will bring a problem that next node may forget its pre node
//To solve it, we always use a 'pre' and a 'next' node to point to remember the front and back node
/*public class Solution {
public ListNode reverseList(ListNode head) {
if(head==null || head.next == null)
return head;
ListNode pre = head;
ListNode current = head.next;
head.next = null;
while(pre!= null && current!= null){
ListNode next = current.next;
current.next = pre;
pre = current;
if (next!=null){
current = next;
}else{
break;
}
}
return current;
}
}*/
public class Solution {
public ListNode reverseList(ListNode head) {
if(head==null || head.next == null)
return head;
ListNode pre = head;
ListNode current = head.next;
ListNode next = current.next;
//don't forgot head.next = null
head.next = null;
while (current != null)
{
next = current.next;
current.next = pre;
pre = current;
//without if-else, just use 'current = next', it will finally
//return null as the 'new head', which is absolutely wrong
if (next != null){
current = next;
}
else
break;
}
return current;
}
}
|
package dto.ordenes;
import java.io.InputStream;
import java.sql.Blob;
import herramientas.FechaHoraDTO;
public class DocumentoDTO {
private int documentoId;
private OrdenDTO ordenDTO;
private Blob archivo;
private InputStream archivoIS;
private byte[] archivoEnByteArray;
private FechaHoraDTO fechaHoraCargaDTO;
private String nombreArchivo;
private String descripcion;
private boolean activo;
public DocumentoDTO(){
setOrdenDTO(new OrdenDTO());
setFechaHoraCargaDTO(new FechaHoraDTO());
}
/**
* @return the documentoId
*/
public int getDocumentoId() {
return documentoId;
}
/**
* @param documentoId the documentoId to set
*/
public void setDocumentoId(int documentoId) {
this.documentoId = documentoId;
}
/**
* @return the ordenDTO
*/
public OrdenDTO getOrdenDTO() {
return ordenDTO;
}
/**
* @param ordenDTO the ordenDTO to set
*/
public void setOrdenDTO(OrdenDTO ordenDTO) {
this.ordenDTO = ordenDTO;
}
/**
* @return the fechaHoraCargaDTO
*/
public FechaHoraDTO getFechaHoraCargaDTO() {
return fechaHoraCargaDTO;
}
/**
* @param fechaHoraCargaDTO the fechaHoraCargaDTO to set
*/
public void setFechaHoraCargaDTO(FechaHoraDTO fechaHoraCargaDTO) {
this.fechaHoraCargaDTO = fechaHoraCargaDTO;
}
/**
* @return the nombreArchivo
*/
public String getNombreArchivo() {
return nombreArchivo;
}
/**
* @param nombreArchivo the nombreArchivo to set
*/
public void setNombreArchivo(String nombreArchivo) {
this.nombreArchivo = nombreArchivo;
}
/**
* @return the archivo
*/
public Blob getArchivo() {
return archivo;
}
/**
* @param archivo the archivo to set
*/
public void setArchivo(Blob archivo) {
this.archivo = archivo;
}
/**
* @return the descripcion
*/
public String getDescripcion() {
return descripcion;
}
/**
* @param descripcion the descripcion to set
*/
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
/**
* @return the archivoIS
*/
public InputStream getArchivoIS() {
return archivoIS;
}
/**
* @param archivoIS the archivoIS to set
*/
public void setArchivoIS(InputStream archivoIS) {
this.archivoIS = archivoIS;
}
/**
* @return the archivoEnByteArray
*/
public byte[] getArchivoEnByteArray() {
return archivoEnByteArray;
}
/**
* @param archivoEnByteArray the archivoEnByteArray to set
*/
public void setArchivoEnByteArray(byte[] archivoEnByteArray) {
this.archivoEnByteArray = archivoEnByteArray;
}
/**
* @return the activo
*/
public boolean isActivo() {
return activo;
}
/**
* @param activo the activo to set
*/
public void setActivo(boolean activo) {
this.activo = activo;
}
}
|
package levelDesigner;
public interface ButtonListener{
public void buttonPressed(int id);
} |
package com.beike.dao.impl.merchant;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.beike.dao.GenericDaoImpl;
import com.beike.dao.merchant.ShopsBaoDao;
import com.beike.entity.merchant.Merchant;
import com.beike.form.CouponForm;
import com.beike.form.MerchantForm;
import com.beike.util.DateUtils;
import com.beike.util.StringUtils;
/**
* project:beiker
* Title:
* Description:商铺宝DAOImpl
* Copyright:Copyright (c) 2011
* Company:Sinobo
* @author qiaowb
* @date Oct 31, 2011 5:24:42 PM
* @version 1.0
*/
@Repository("shopsBaoDao")
public class ShopsBaoDaoImpl extends GenericDaoImpl<Merchant, Long> implements ShopsBaoDao {
/* (non-Javadoc)
* @see com.beike.dao.merchant.ShopsBaoDao#getMerchantDetailById(java.lang.Long)
*/
public MerchantForm getMerchantDetailById(Long merchantId)
{
StringBuffer bufSql = new StringBuffer("select bm.merchantid as merchantid, bm.virtualcount,")
.append(" bmp.mc_logo1,bmp.mc_logo2,bmp.mc_logo3,bmp.mc_logo4,bmp.mc_avg_scores,bmp.mc_evaliation_count,bmp.mc_sale_count,bmp.mc_fix_tel,")
.append(" bm.sevenrefound,bm.overrefound,bm.quality,bm.merchantintroduction,bm.merchantdesc,bm.merchantname,")
.append(" bm.salescountent,bm.ownercontent,bm.csstemplatename,bm.city,bmp.mc_score,bmp.mc_well_count,bmp.mc_satisfy_count,bmp.mc_poor_count,bm.isvipbrand,bm.is_support_online_meal,bm.is_support_takeaway ")
.append(" from beiker_merchant_profile bmp left join beiker_merchant bm on bm.merchantid=bmp.merchantid ")
.append(" where bm.parentid=0 and bm.merchantid=? ");
List list = this.getJdbcTemplate().queryForList(bufSql.toString(),new Object[] { merchantId });
if (list == null || list.size() == 0){
return null;
}
MerchantForm merchantForm = new MerchantForm();
for (int i = 0; i < list.size(); i++) {
Map map = (Map) list.get(i);
// 品牌的ID
Long merchantid = (Long) map.get("merchantid");
merchantForm.setId(String.valueOf(merchantid));
/**
* 品牌下商品的虚拟购买次数
*/
int merVirtualCount = (Integer)map.get("virtualcount");
merchantForm.setVirtualCount(merVirtualCount);
Long sevenrefound = (Long) map.get("sevenrefound");
merchantForm.setSevenrefound(sevenrefound);
Long overrefound = (Long) map.get("overrefound");
merchantForm.setOverrefound(overrefound);
Long quality = (Long) map.get("quality");
merchantForm.setQuality(quality);
String merchantname = (String) map.get("merchantname");
merchantForm.setMerchantname(merchantname);
String merchantintroduction = (String) map.get("merchantintroduction");
merchantForm.setMerchantintroduction(merchantintroduction);
String merchantdesc = (String) map.get("merchantdesc");
merchantForm.setMerchantdesc(merchantdesc);
merchantForm.setCity((String) map.get("city"));
merchantForm.setSalescountent((String)map.get("salescountent"));
merchantForm.setOwnercontent((String)map.get("ownercontent"));
merchantForm.setCsstemplatename((String)map.get("csstemplatename"));
merchantForm.setLogo1((String) map.get("mc_logo1"));
merchantForm.setLogoTitle((String) map.get("mc_logo4"));
merchantForm.setAvgscores(String.valueOf((Float)map.get("mc_avg_scores")));
merchantForm.setEvaluation_count(String.valueOf((Integer) map.get("mc_evaliation_count")));
merchantForm.setSalescount(String.valueOf((Integer) map.get("mc_sale_count")));
merchantForm.setTel((String) map.get("mc_fix_tel"));
merchantForm.setLogo2((String) map.get("mc_logo2"));
//add by qiaowb 2012-03-15 新评价系统评分
merchantForm.setMcScore((Long) map.get("mc_score"));
merchantForm.setWellCount((Long) map.get("mc_well_count"));
merchantForm.setSatisfyCount((Long) map.get("mc_satisfy_count"));
merchantForm.setPoorCount((Long) map.get("mc_poor_count"));
merchantForm.setIsVip((Integer)map.get("isvipbrand"));
merchantForm.setIs_Support_Online_Meal(String.valueOf(map.get("is_support_online_meal")));
merchantForm.setIs_Support_Takeaway(String.valueOf(map.get("is_support_takeaway")));
}
return merchantForm;
}
@SuppressWarnings("unchecked")
@Override
public String getCashCouponByGoods(Long merchantId, Long money) {
StringBuilder mer = new StringBuilder();
StringBuilder str = new StringBuilder();
mer.append("SELECT goodsid FROM beiker_goods_merchant bgm ");
mer.append("where bgm.merchantid=?");
List merchantList = this.getJdbcTemplate().queryForList(mer.toString(),new Object[]{merchantId});
if(null == merchantList || merchantList.size() <= 0){
return null; // 该品牌不存在
}
for(int i=0;i<merchantList.size();i++){
Map map = (Map) merchantList.get(i);
Long goodsid = (Long) map.get("goodsid");
str.append(goodsid);
str.append(",");
}
String ids = str.substring(0,str.length()-1);
return ids;
}
@SuppressWarnings("unchecked")
@Override
public List getCashCouponByIDAndMoney(String ids,Long money) {
StringBuilder gods = new StringBuilder();
gods.append("SELECT bg.goodsid,bg.rebatePrice,bg.currentPrice ,bg.goodsname FROM beiker_goods bg ");
gods.append("WHERE bg.couponcash = '1' AND bg.isavaliable='1' AND bg.sourcePrice = ? AND bg.goodsid in ( ");
gods.append(ids+") ");
gods.append("ORDER BY bg.startTime DESC ");
gods.append("LIMIT 2");
List rs = this.getJdbcTemplate().queryForList(gods.toString(),new Object[]{money});
return rs;
}
@Override
public List<MerchantForm> getChildMerchnatById(Long merchantId) {
StringBuilder queryMerchant = new StringBuilder();
queryMerchant.append("select m.merchantname as merchantname,m.merchantid as id,m.addr as addr,m.latitude as latitude,m.tel as tel,m.buinesstime as buinesstime from beiker_merchant m where m.parentid=?");
List list = this.getJdbcTemplate().queryForList(queryMerchant.toString(),new Object[] { merchantId });
if (list == null || list.size() == 0)
return null;
List<MerchantForm> listForm = new ArrayList<MerchantForm>();
for (int i = 0; i < list.size(); i++) {
Map map = (Map) list.get(i);
MerchantForm merchantForm = new MerchantForm();
String merchantname = (String) map.get("merchantname");
merchantForm.setMerchantname(merchantname);
Long mid = (Long) map.get("id");
merchantForm.setId(String.valueOf(mid));
String addr = (String) map.get("addr");
merchantForm.setAddr(addr);
String latitude = (String) map.get("latitude");
merchantForm.setLatitude(latitude);
String tel = (String) map.get("tel");
merchantForm.setTel(tel);
String buinesstime = (String) map.get("buinesstime");
merchantForm.setBuinesstime(buinesstime);
listForm.add(merchantForm);
}
return listForm;
}
@Override
public List<Long> getGoodsCountIds(String idsCourse, int start, int end) {
if(idsCourse==null || "".equals(idsCourse)){
return new ArrayList<Long>();
}
String sql = "select bg.goodsId as goodsid from beiker_goods_profile bgf left join beiker_goods bg on bgf.goodsid=bg.goodsId left join beiker_goods_merchant bgm on bgf.goodsid=bgm.goodsid where bgm.merchantid in("
+ idsCourse
+ ") AND bg.isavaliable = '1' AND bgf.sales_count < bg.maxcount and bg.endTime >=? and bg.startTime<=? group by bg.goodsId ORDER BY bg.startTime DESC limit "
+ start + "," + end;
String curDate = DateUtils.getStringDateShort();
List list = this.getJdbcTemplate().queryForList(sql,new Object[] {curDate,curDate});
List<Long> listids = new LinkedList<Long>();
if (list == null || list.size() == 0)
return new ArrayList<Long>();
for (int i = 0; i < list.size(); i++) {
Map map = (Map) list.get(i);
Long goodsId = (Long) map.get("goodsid");
listids.add(goodsId);
}
return listids;
}
/* (non-Javadoc)
* @see com.beike.dao.merchant.ShopsBaoDao#getMerchantRegionById(java.lang.Long)
*/
public String getMerchantRegionById(Long merchantId) {
String regionname = "";
String sql = "SELECT DISTINCT regionextid FROM beiker_catlog_good WHERE brandid=" + merchantId + " LIMIT 5";
List<Map<String,Object>> listId = this.getSimpleJdbcTemplate().queryForList(sql);
if(listId!=null && listId.size()>0){
StringBuilder ids = new StringBuilder("");
for (Map<String,Object> mapId : listId) {
ids.append(mapId.get("regionextid"));
ids.append(",");
}
if (ids.length() == 0) {
return regionname;
}
String id = ids.substring(0, ids.lastIndexOf(","));
sql = "SELECT GROUP_CONCAT(region_name) as regionname FROM beiker_region_property WHERE id IN (" + id + ")";
List<Map<String,Object>> list = this.getSimpleJdbcTemplate().queryForList(sql);
if (list == null || list.size() == 0 || list.size() > 1){
return regionname;
}
Map<String,Object> map = list.get(0);
regionname = (String) map.get("regionname");
}
return regionname;
}
@Override
public List<CouponForm> getCouponForShopBaoByMerchantId(Long merchantId,int top) {
String sqlCatlog = "select couponid from beiker_catlog_coupon where enddate>=? and createdate<=? and isavaliable=1";
List<Map<String, Object>> lstCatlogIds = null;
String curDate = DateUtils.getStringDateShort();
lstCatlogIds = this.getSimpleJdbcTemplate().queryForList(
sqlCatlog.toString(),curDate,curDate);
if (lstCatlogIds != null && lstCatlogIds.size() > 0) {
StringBuffer bufCatlogIds = new StringBuffer();
for (Map<String, Object> mapId : lstCatlogIds) {
bufCatlogIds = bufCatlogIds
.append((Long) mapId.get("couponid")).append(",");
}
String sql = "select bc.id,bc.couponname,bc.enddate,bc.downcount from beiker_coupon bc left join beiker_merchant bm on bc.merchantid=bm.merchantid where bc.merchantid= "
+ merchantId + " and bm.parentid=0 ";
sql = sql + " and bc.id in ("
+ bufCatlogIds.substring(0, bufCatlogIds.length() - 1)
+ ") ORDER BY bc.createdate DESC limit 0," + top;
List list = this.getJdbcTemplate().queryForList(sql);
if (list == null || list.size() == 0)
return null;
List<CouponForm> listForm = new ArrayList<CouponForm>();
for (int i = 0; i < list.size(); i++) {
CouponForm couponForm = new CouponForm();
Map map = (Map) list.get(i);
Long couponid = (Long) map.get("id");
String couponname = (String) map.get("couponname");
Date endDate = (Date) map.get("enddate");
couponForm.setCouponid(couponid);
couponForm.setCouponName(couponname);
couponForm.setEndDate(endDate);
couponForm.setDowncount((Long) map.get("downcount"));
listForm.add(couponForm);
}
return listForm;
} else {
return new ArrayList<CouponForm>();
}
}
@Override
public MerchantForm getShangpubaoDetailById(Long merchantId) {
StringBuffer bufSql = new StringBuffer("select bsp.shb_title_logo,bsp.shb_logo1,bsp.shb_logo2,bsp.shb_logo3,bsp.shb_logo4,")
.append(" bsp.shb_logo5,bsp.shb_logo6,bsp.shb_logo7,bsp.shb_logo8 ")
.append(" from beiker_shanghubao_profile bsp")
.append(" where bsp.merchantid=? ");
List list = this.getJdbcTemplate().queryForList(bufSql.toString(),new Object[] { merchantId });
if (list == null || list.size() == 0){
return null;
}
MerchantForm merchantForm = new MerchantForm();
for (int i = 0; i < list.size(); i++) {
Map map = (Map) list.get(i);
merchantForm.setBaoTitleLogo((String) map.get("shb_title_logo"));
merchantForm.setMerchantbaoLogo1((String) map.get("shb_logo1"));
merchantForm.setMerchantbaoLogo2((String) map.get("shb_logo2"));
merchantForm.setMerchantbaoLogo3((String) map.get("shb_logo3"));
merchantForm.setMerchantbaoLogo4((String) map.get("shb_logo4"));
merchantForm.setMerchantbaoLogo5((String) map.get("shb_logo5"));
merchantForm.setMerchantbaoLogo6((String) map.get("shb_logo6"));
merchantForm.setMerchantbaoLogo7((String) map.get("shb_logo7"));
merchantForm.setMerchantbaoLogo8((String) map.get("shb_logo8"));
}
return merchantForm;
}
@Override
public List<MerchantForm> getBrandReview(List<String> brandids) {
StringBuffer bufSql = new StringBuffer("select bmp.merchantid as merchantid, bm.isvipbrand isvip,")
.append(" bmp.mc_score,bmp.mc_well_count,bmp.mc_satisfy_count,bmp.mc_poor_count")
.append(" from beiker_merchant_profile bmp left join beiker_merchant bm on bm.merchantid=bmp.merchantid where bmp.merchantid IN(").append(StringUtils.arrayToString(brandids.toArray(), ",")).append(")");
List list = this.getJdbcTemplate().queryForList(bufSql.toString());
List<MerchantForm> brands = new ArrayList<MerchantForm>();
for (int i = 0; i < list.size(); i++) {
MerchantForm merchantForm = new MerchantForm();
Map map = (Map) list.get(i);
// 品牌的ID
Long merchantid = (Long) map.get("merchantid");
merchantForm.setId(String.valueOf(merchantid));
//add by qiaowb 2012-03-15 新评价系统评分
merchantForm.setMcScore((Long) map.get("mc_score"));
merchantForm.setWellCount((Long) map.get("mc_well_count"));
merchantForm.setSatisfyCount((Long) map.get("mc_satisfy_count"));
merchantForm.setPoorCount((Long) map.get("mc_poor_count"));
merchantForm.setIsVip((Integer)map.get("isvip"));
brands.add(merchantForm);
}
return brands;
}
@SuppressWarnings("rawtypes")
@Override
public int getGoodsIdTotalCount(String idsCourse) {
if(org.apache.commons.lang.StringUtils.isBlank(idsCourse))
return 0;
StringBuilder countsql = new StringBuilder();
countsql.append("select bg.goodsId as goodsid from beiker_goods_profile bgf ");
countsql.append("left join beiker_goods bg on bgf.goodsid=bg.goodsId ");
countsql.append("left join beiker_goods_merchant bgm on bgf.goodsid=bgm.goodsid ");
countsql.append("where bgm.merchantid in(").append(idsCourse).append(") ");
countsql.append("AND bg.isavaliable = '1' AND bgf.sales_count < bg.maxcount and ");
countsql.append("bg.endTime >=NOW() and bg.startTime<=NOW() ");
countsql.append("group by bg.goodsId ORDER BY bg.startTime ");
List countlist = this.getJdbcTemplate().queryForList(countsql.toString());
if(countlist == null || countlist.size() ==0)
return 0;
return countlist.size();
}
} |
package Graph.Utilities;
import Graph.Structure.Edge;
import Graph.Structure.Node;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Kalaman on 09.01.17.
*/
public class CSVReader {
public static HashMap<String,Node> nodeHashMap = new HashMap<>();
public static ArrayList<Node> getNodeList ()
{
ArrayList<Node> nodeArrayList = new ArrayList<>();
BufferedReader br = null;
String line = "";
try {
br = new BufferedReader(new FileReader("Beispielgraph.csv"));
//Creating Nodes
while ((line = br.readLine()) != null && !line.equals("?")) {
String[] nodeData = line.split(",");
nodeData[1] = nodeData[1].replaceAll(" ","");
nodeData[2] = nodeData[2].replaceAll(" ","");
Node newNode = new Node(nodeData[0],Integer.parseInt(nodeData[1]),Integer.parseInt(nodeData[2]));
nodeArrayList.add(newNode);
nodeHashMap.put(nodeData[0],newNode);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return nodeArrayList;
}
public static ArrayList<Edge> getEdgeList ()
{
ArrayList<Edge> edgeArrayList = new ArrayList<>();
if (nodeHashMap.size() == 0)
getNodeList();
BufferedReader br = null;
String line = "";
try {
br = new BufferedReader(new FileReader("Beispielgraph.csv"));
//Creating Nodes
while ((line = br.readLine()) != null && !line.equals("?")) {
//Do nothing
}
//Adding Edges
while ((line = br.readLine()) != null) {
String[] nodeData = line.split(",");
nodeData[1] = nodeData[1].replaceAll(" ","");
Edge newEdge = new Edge(nodeHashMap.get(nodeData[0]),nodeHashMap.get(nodeData[1]));
edgeArrayList.add(newEdge);
nodeHashMap.get(nodeData[0]).addEdge(newEdge);
nodeHashMap.get(nodeData[1]).addEdge(newEdge);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return edgeArrayList;
}
}
|
/*
The MIT License (MIT)
Copyright (c) 2014 Stephan Kesper
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 de.kesper.software.bootstrap.components.forms;
import de.kesper.software.bootstrap.utils.StringUtil;
import java.io.IOException;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
/**
*
* @author kesper
*/
@FacesComponent(value = "de.kesper.software.bootstrap.components.forms.FormGroupTag")
public class FormGroupTag extends UIOutput {
private String label;
private boolean horizontal = false;
private String horizontalDivClass;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public boolean isHorizontal() {
return horizontal;
}
public void setHorizontal(boolean horizontal) {
this.horizontal = horizontal;
}
public String getHorizontalDivClass() {
return horizontalDivClass;
}
public void setHorizontalDivClass(String horizontalDivClass) {
this.horizontalDivClass = horizontalDivClass;
}
@Override
public String getFamily() {
return "grid";
}
@Override
public void encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
String ffor = null;
Object forRef = context.getAttributes().get("for");
if (forRef!=null) {
ffor = forRef.toString();
}
writer.startElement("div", this);
writer.writeAttribute("class", "form-group", null);
writer.startElement("label", this);
if (ffor!=null) {
writer.writeAttribute("for", ffor, null);
}
if (horizontal) {
writer.writeAttribute("class", "col-sm-2 control-label", null);
}
writer.append(label);
writer.endElement("label");
if (horizontal) {
writer.startElement("div", this);
String clzz = "col-sm-10";
if (StringUtil.isNotNull(horizontalDivClass)) {
clzz = horizontalDivClass;
}
writer.writeAttribute("class", clzz, null);
}
}
@Override
public void encodeEnd(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
if (horizontal) {
writer.endElement("div");
}
writer.endElement("div");
}
}
|
package com.crm.qa.pages;
import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;
import com.crm.qa.base.TestBase;
public class HomePage extends TestBase
{
/*@FindBy(id="location")
WebElement location;
@FindBy(id="hotels")
WebElement hotel;
@FindBy(id="room_type")
WebElement room;
@FindBy(id="room_nos")
WebElement room_num;
@FindBy(id="datepick_in")
WebElement check_in;
@FindBy(id="datepick_out")
WebElement check_out;
@FindBy(id="adult_room")
WebElement adult_room;
@FindBy(id="child_room")
WebElement child_room;
@FindBy(id="Submit")
WebElement Submit_button;
@FindBy(id="Reset")
WebElement Reset_button;
*/
@FindBy(xpath="//td[text()='Welcome to Adactin Group of Hotels']")
WebElement welcom_text;
@FindBy(id="username_show")
WebElement username_show;
@FindBy(css="td.welcome_menu>a:nth-of-type(1)")
WebElement search_hotel;
@FindBy(css="td.welcome_menu>a:nth-of-type(2)")
WebElement Booked;
@FindBy(css="td.welcome_menu>a:nth-of-type(3)")
WebElement changePassword;
@FindBy(css="td.welcome_menu>a:nth-of-type(4)") ////a[contains(text(),'Logout')]
WebElement logout;
@FindBy(xpath="//h4[contains(text(),'Adactin Hotel Mobile App')]")
WebElement Mobile_app;
@FindBy(xpath="//a[@href='https://adactinhotelapp.com/resources/AdactinHotelApp_SetupGuide.pdf']")
WebElement Mobile_app_text;
@FindBy(xpath="//h4[contains(text(),'HotelApp Web Services ')]")
WebElement Hotel_Web_Service;
@FindBy(xpath="//a[@href='https://adactinhotelapp.com/HotelAdactinWebServices/']")
WebElement web_service;
@FindBy(xpath="//h4[contains(text(),'Sample TestCases ')]")
WebElement SAmple_Testcases;
@FindBy(xpath="//a[@href='http://adactinhotelapp.com/resources/Sample-TestCases_HotelApplication.pdf']")
WebElement Download_Testcases;
@FindBy(xpath="//h4[contains(text(),'Known Defects ')]")
WebElement Known_Defect;
@FindBy(xpath="//a[@href='http://adactinhotelapp.com/resources/KnownDefects_HotelApp.pdf']")
WebElement Download_Defect;
@FindBy(xpath="//h4[contains(text(),'Book on Automation')]")
WebElement Book;
@FindBy(xpath="//iframe[@src='http://www.adactinhotelapp.com/img-horizontal-carousel/index.html']")
WebElement frame;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-microsoft-coded-ui-with-c-step-by-step-guide/']")
WebElement frame_Title;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-microsoft-coded-ui-with-c-step-by-step-guide/']/following-sibling::a")
WebElement Click_ToKnowMore;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/sample-exam-questions-istqb-foundation-level-agile-tester-extension-exam/']")
WebElement Sample_Exam_Question;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/sample-exam-questions-istqb-foundation-level-agile-tester-extension-exam/']/following-sibling::a")
WebElement Click_Sample;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-selenium-webdriver-with-java/']")
WebElement Selenium_Book;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-selenium-webdriver-with-java/']/following-sibling::a")
WebElement Click_Java;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-hp-unified-functional-testing/']")
WebElement QTP;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-hp-unified-functional-testing/']/following-sibling::a")
WebElement Click_QTP;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-selenium-with-c/']")
WebElement Selenium_C;
@FindBy(xpath="//a[@href='https://adactin.com/products/books-publications/test-automation-using-selenium-with-c/']/following-sibling::a")
WebElement Click_Selenium_C;
@FindBy(xpath="//h4[contains(text(),'About Adactin')]")
WebElement About_Adactin_Text;
@FindBy(xpath="//a[contains(text(),'www.adactin.com')]")
WebElement About_Adactin_URL;
@FindBy(css=".login_title")
WebElement login_Title;
@FindBy(css=".login_title_comm")
WebElement login_title_comm;
@FindBy(css="td[width='150']")
WebElement location_Title;
@FindBy(css="select#location")
WebElement location_drop_down;
@FindBy(xpath="//td[starts-with(text(),'Hotels')]")
WebElement Hotel_Title;
@FindBy(css="select#hotels")
WebElement hotel_drop_down;
@FindBy(xpath="//td[starts-with(text(),'Room Type')]")
WebElement RoomTYpe_Title;
@FindBy(css="select#room_type")
WebElement RoomTYpe_drop_down;
@FindBy(xpath="//td[starts-with(text(),'Number of Rooms')]")
WebElement No_Of_Rooms_Title;
@FindBy(css="select#room_nos")
WebElement Roomnos_drop_down;
@FindBy(xpath="//td[starts-with(text(),'Check In Date')]")
WebElement Check_In_Date_Title;
@FindBy(css="input#datepick_in")
WebElement Check_In_Date_drop_down;
@FindBy(xpath="//td[starts-with(text(),'Check Out Date')]")
WebElement Check_Out_Date_Title;
@FindBy(css="input#datepick_out")
WebElement Check_Out_Date_drop_down;
@FindBy(xpath="//td[starts-with(text(),'Adults per Room')]")
WebElement adult_room_Title;
@FindBy(css="select#adult_room")
WebElement adult_room_drop_down;
@FindBy(xpath="//td[starts-with(text(),'Children per Room')]")
WebElement Children_room_Title;
@FindBy(css="select#child_room")
WebElement child_room_drop_down;
@FindBy(css="input#Submit")
WebElement submit_Button;
@FindBy(css="input#Reset")
WebElement Reset_Button;
@FindBy(css=".footer")
WebElement f2020_Label;
@FindBy(xpath="//a[starts-with(text(),'Adactin.com')]")
WebElement Adactin_com_Title;
//logout
//Initialize elements//Initialise page object:
public HomePage(){
PageFactory.initElements(driver, this);
}
public void logout()
{
logout.click();
}
public String locationDropDownByVisibleText(String city)
{
//location_drop_down.click();
Select s=new Select(location_drop_down);
s.selectByVisibleText(city);
String s1=s.getFirstSelectedOption().getText();
return s1;
/*List<WebElement> list=s.getOptions();
for (WebElement web : list) {
System.out.println(web);
}*/
}
public String checkInDate(String date)
{
Check_In_Date_drop_down.clear();
Check_In_Date_drop_down.sendKeys(date);
return Check_In_Date_drop_down.getAttribute("value");
}
public String checkInOut(String date)
{
Check_Out_Date_drop_down.clear();
Check_Out_Date_drop_down.sendKeys(date);
return Check_Out_Date_drop_down.getAttribute("value");
}
}
|
package com.company.task;
import com.company.command.Command;
import com.company.command.CommandFactory;
public class CommandProducer implements Runnable {
private final com.company.task.CommandQueue commandQueue;
private final String data;
public CommandProducer(final CommandQueue commandQueue, final String data) {
this.commandQueue = commandQueue;
this.data = data;
}
@Override
public void run() {
try {
Command command = CommandFactory.getCommand(data);
if (command == null) {
System.err.println("incorrect command");
return;
}
commandQueue.add(command);
} catch (final InterruptedException ex) {
ex.printStackTrace();
}
}
}
|
package com.auro.scholr.util.snippety.span;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader;
import android.text.TextPaint;
import android.text.style.CharacterStyle;
import android.text.style.UpdateAppearance;
/**
* Add multiple colors to text with specified angle.
*
* source: @link{http://chiuki.github.io/advanced-android-textview/}
*/
public class MultiColorSpan extends CharacterStyle implements UpdateAppearance {
private final int[] colors;
private int angle;
public MultiColorSpan(int[] colors, int angle) {
this.colors = colors;
this.angle = angle;
}
public MultiColorSpan(int[] colors) {
this(colors, 90);
}
@Override
public void updateDrawState(TextPaint paint) {
paint.setStyle(Paint.Style.FILL);
Shader shader = new LinearGradient(0, 0, 0, paint.getTextSize() * colors.length, colors, null,
Shader.TileMode.MIRROR);
Matrix matrix = new Matrix();
matrix.setRotate(angle);
shader.setLocalMatrix(matrix);
paint.setShader(shader);
}
} |
import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class Changes extends JPanel{
private static int[][] memory;
private static int countElement;
private static int countFree;
private static ArrayList<File> files;
public Changes(int[][] memory, int countElement, int countFree, ArrayList<File> files) {
this.memory = memory;
this.countElement = countElement;
this.countFree = countFree;
this.files = files;
}
public static boolean addFile(String name, int size) {
if (files != null) {
for (int i = 0; i < files.size(); i++) {
if (files.get(i).getNode().getName().equals(name)) {
JOptionPane.showMessageDialog(null, "Введите другое имя");
return false;
}
}
}
if (size / 4 > countFree) {
JOptionPane.showMessageDialog(null, "Введите меньший размер");
return false;
}
countFree -= size / 4;
countElement = size / 4;
Place[] ps = new Place[countElement];
int ps_id = 0;
for (int i = 0; i < memory.length && countElement > 0; i++) {
for (int j = 0; j < memory[i].length && countElement > 0; j++) {
if (memory[i][j] == 1) {
countElement--;
memory[i][j] = 2;
ps[ps_id++] = new Place(i, j);
}
}
}
int sizeLocal = 0;
if(size / 4 > 3) {
sizeLocal = 3*4;
size -=sizeLocal;
} else {
sizeLocal = size;
size = 0;
}
IndexNode knot = new IndexNode(ps,name, sizeLocal);
knot.indexNode(ps);
while (size > 0) {
if(size / 4 > 3) {
sizeLocal = 3*4;
size -=sizeLocal;
knot.setNode(ps,name, sizeLocal);
} else {
sizeLocal = size;
size = 0;
knot.setNode(ps,name, sizeLocal);
}
}
File file = new File(knot);
files.add(file);
return true;
}
public static void Delete(String s) {
Place[] ps = getfile(s).getNode().getpositions();
if (ps != null) {
for (int i = 0; i < ps.length; i++) {
memory[ps[i].I][ps[i].J] = 1;
}
}
countFree += getfile(s).getNode().fileSize() / 2;
files.remove(getfile(s));
}
public static File getfile(String s) {
if (files != null) {
for (int i = 0; i < files.size(); i++) {
if (files.get(i).getNode().getName().equals(s)) {
return files.get(i);
}
}
}
return null;
}
}
|
package cz.vancura.openstreetmaps.model;
public class KrajPOJO {
String krajFileName;
String krajNazev;
int krajColor;
public KrajPOJO(String krajFileName, String krajNazev, int krajColor) {
this.krajFileName = krajFileName;
this.krajNazev = krajNazev;
this.krajColor = krajColor;
}
public String getKrajNazev() {
return krajNazev;
}
public void setKrajNazev(String krajNazev) {
this.krajNazev = krajNazev;
}
public String getKrajFileName() {
return krajFileName;
}
public void setKrajFileName(String krajFileName) {
this.krajFileName = krajFileName;
}
public int getKrajColor() {
return krajColor;
}
public void setKrajColor(int krajColor) {
this.krajColor = krajColor;
}
}
|
package com.alibaba.druid.bvt.sql.mysql.createTable;
import com.alibaba.druid.sql.MysqlTest;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import java.util.List;
public class MySqlCreateTableTest107 extends MysqlTest {
public void test_0() throws Exception {
String sql = "CREATE TABLE \n" +
"aliolap152578dbopt.aliolap152578dbopt_tbl1 (\n" +
"col_id_int int NOT NULL , \n" +
"col2_tinyint tinyint , \n" +
"col3_boolean boolean , \n" +
"col4_smallint smallint , \n" +
"col5_int int , \n" +
"col6_bigint bigint , \n" +
"col7_float float , \n" +
"col8_double double , \n" +
"col9_date date , \n" +
"col10_time time , \n" +
"col11_timestamp timestamp , \n" +
"col12_varchar varchar(1000) , \n" +
"col13_multivalue multivalue delimiter ',' , \n" +
"primary key (col_id_int,col6_bigint)\n" +
") \n" +
"PARTITION BY HASH KEY(col_id_int) PARTITION NUM 100\n" +
"SUBPARTITION BY LIST(col6_bigint BIGINT)\n" +
"SUBPARTITION OPTIONS(available_Partition_Num=100)\n" +
"TABLEGROUP aliolap152578dbopt_tg1\n" +
"OPTIONS(UPDATETYPE='realtime')\n" +
";";
MySqlStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> statementList = parser.parseStatementList();
MySqlCreateTableStatement stmt = (MySqlCreateTableStatement) statementList.get(0);
assertEquals(1, statementList.size());
assertEquals(14, stmt.getTableElementList().size());
assertEquals("CREATE TABLE aliolap152578dbopt.aliolap152578dbopt_tbl1 (\n"
+ "\tcol_id_int int NOT NULL,\n"
+ "\tcol2_tinyint tinyint,\n" + "\tcol3_boolean boolean,\n"
+ "\tcol4_smallint smallint,\n"
+ "\tcol5_int int,\n" + "\tcol6_bigint bigint,\n"
+ "\tcol7_float float,\n"
+ "\tcol8_double double,\n" + "\tcol9_date date,\n"
+ "\tcol10_time time,\n"
+ "\tcol11_timestamp timestamp,\n" + "\tcol12_varchar varchar(1000),\n"
+ "\tcol13_multivalue multivalue DELIMITER ',',\n"
+ "\tPRIMARY KEY (col_id_int, col6_bigint)\n"
+ ")\n"
+ "OPTIONS (UPDATETYPE = 'realtime')\n"
+ "PARTITION BY HASH KEY(col_id_int) PARTITION NUM 100\n"
+ "SUBPARTITION BY LIST (col6_bigint BIGINT)\n"
+ "SUBPARTITION OPTIONS (available_Partition_Num = 100)\n"
+ "TABLEGROUP aliolap152578dbopt_tg1;", stmt.toString());
}
} |
package com.capraro.contrat.controller;
import com.capraro.contrat.integration.CompositeIntegration;
import com.capraro.contrat.model.Contrat;
import com.capraro.contrat.repository.ContratRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.async.DeferredResult;
import rx.Observable;
import java.util.Arrays;
/**
* Controller contrat.
* Created by Richard Capraro on 07/08/2015.
*/
@RestController
@Slf4j
public class ContratController {
@Autowired
private ContratRepository contratRepository;
@Autowired
private CompositeIntegration compositeIntegration;
@RequestMapping(value = "/contrats", method = RequestMethod.GET)
public Iterable<Contrat> contrats() {
return contratRepository.getContrats();
}
@RequestMapping(value = "/contrats/{id}", method = RequestMethod.GET)
public DeferredResult<Contrat> contrat(@PathVariable Long id) {
log.info("Appel de /contrats/{id]");
Observable<Contrat> contratWithDetails = getContratWithDetails(id);
return toDeferredResult(contratWithDetails);
}
private Observable<Contrat> getContratWithDetails(long id) {
Contrat contrat = contratRepository.getContrat();
return Observable.zip(
compositeIntegration.getSinistre(id),
compositeIntegration.getTiers(id),
(sinistre, tiers) -> {
contrat.setSinistres(Arrays.asList(sinistre));
contrat.setTiers(tiers);
return contrat;
}
);
}
public DeferredResult<Contrat> toDeferredResult(Observable<Contrat> contratWithDetails) {
DeferredResult<Contrat> result = new DeferredResult<>();
contratWithDetails.subscribe(contrat -> result.setResult(contrat));
return result;
}
}
|
package com.verchetasheva.productinventory.inventory;
import com.verchetasheva.productinventory.InventoryService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MimeTypeUtils;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/inventories")
public class InventoryResource {
private InventoryService inventoryService;
public InventoryResource(InventoryService inventoryService) {
this.inventoryService = inventoryService;
}
@PostMapping(consumes = MimeTypeUtils.APPLICATION_JSON_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public InventoryDTO create(@RequestBody final InventoryRequest request){
return inventoryService.create(request);
}
@GetMapping(path = "/find-by-name/{name}", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public InventoryDTO findByName(@PathVariable("name") final String name){
return inventoryService.findByNameNative(name);
}
@PutMapping(path = "/{inventoryId", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public InventoryDTO update(@PathVariable("inventoryId") final Integer inventoryId, @RequestBody final InventoryRequest request) {
return inventoryService.update(inventoryId, request);
}
@DeleteMapping(path = "/{inventoryId}", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public ResponseEntity<HttpStatus> delete(@PathVariable("inventoryId") final Integer inventoryId){
return inventoryServie.delete(inventoryId);
}
|
package f.star.iota.milk.ui.umei.mei;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import f.star.iota.milk.base.PVContract;
import f.star.iota.milk.base.StringPresenter;
public class MEIPresenter extends StringPresenter<List<MEIBean>> {
public MEIPresenter(PVContract.View view) {
super(view);
}
@Override
protected List<MEIBean> dealResponse(String s, HashMap<String, String> headers) {
List<MEIBean> list = new ArrayList<>();
Element element = Jsoup.parse(s).select("div.ImageBody > p > a > img").first();
MEIBean bean = new MEIBean();
String url = element.attr("src");
bean.setUrl(url);
bean.setHeaders(headers);
list.add(bean);
return list;
}
@Override
protected String dealUrl(String url) {
if (url.contains("_1.htm")) {
url = url.replace("_1.htm", ".htm");
}
return url;
}
}
|
/**
* 42. Trapping Rain Water
* https://leetcode.com/problems/trapping-rain-water/#/description
*
*/
public class Solution {
public int trap(int[] height) {
}
} |
package ru.carFactory;
import ru.carFactory.Details.Detail;
import ru.carFactory.Details.Engine;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.WildcardType;
public class Supplier<T extends Detail> extends Thread {
private Storage<T> storage;
private long deltaTime;
private Class<T> detailFactory;
public Supplier(Storage<T> storage, Class<T> detailFactory, long deltaTime) {
this.storage = storage;
this.deltaTime = deltaTime;
this.detailFactory = detailFactory;
}
@Override
public void run() {
while(!isInterrupted()) {
try{
storage.add(detailFactory.getDeclaredConstructor().newInstance());
Thread.sleep(deltaTime);
} catch (InterruptedException e) {
break;
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
|
// https://www.youtube.com/watch?v=sn6r0ZV_2y4
class Solution {
public String largestTimeFromDigits(int[] arr) {
String result = "";
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 4; k++) {
if (i == j || j == k || k == i) continue;
String hh = arr[i] + "" + arr[j];
String mm = arr[k] + "" + arr[6-i-j-k];
String _time = hh + ":" + mm;
if (hh.compareTo("24") < 0 && mm.compareTo("60") < 0 && _time.compareTo(result) > 0) result = _time;
}
}
}
return result;
}
} |
package liu.lang.reflect.Method;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Check {
String value() default "";
}
|
package com.auro.scholr.home.data.model.passportmodels;
public class PassportQuizGridModel {
String quizHead;
String quizData;
int quizImagePath;
int quizColor;
public String getQuizHead() {
return quizHead;
}
public void setQuizHead(String quizHead) {
this.quizHead = quizHead;
}
public String getQuizData() {
return quizData;
}
public void setQuizData(String quizData) {
this.quizData = quizData;
}
public int getQuizImagePath() {
return quizImagePath;
}
public void setQuizImagePath(int quizImagePath) {
this.quizImagePath = quizImagePath;
}
public int getQuizColor() {
return quizColor;
}
public void setQuizColor(int quizColor) {
this.quizColor = quizColor;
}
}
|
package core.event.game.damage;
import core.server.game.Damage;
public class AttackDamageModifierEvent extends AbstractDamageEvent {
public AttackDamageModifierEvent(Damage damage) {
super(damage);
}
}
|
package edu.uha.miage.web.controller;
import edu.uha.miage.core.entity.Demande;
import edu.uha.miage.core.entity.DemandeIncident;
import edu.uha.miage.core.entity.DemandeServices;
import edu.uha.miage.core.entity.Fonction;
import edu.uha.miage.core.entity.Incident;
import edu.uha.miage.core.entity.Personne;
import edu.uha.miage.core.entity.Services;
import edu.uha.miage.core.entity.StatutDemande;
import edu.uha.miage.core.service.CompteService;
import edu.uha.miage.core.service.DemandeIncidentService;
import edu.uha.miage.core.service.DemandeService;
import edu.uha.miage.core.service.DemandeServiceService;
import edu.uha.miage.core.service.FonctionService;
import edu.uha.miage.core.service.StatutDemandeService;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
*
* @author Kalictong
*/
@Controller
public class DemandeController {
@Autowired
DemandeIncidentService demandeIncidentService;
@Autowired
DemandeServiceService demandeServiceService;
@Autowired
DemandeService demandeService;
@Autowired
FonctionService fonctionService;
@Autowired
CompteService compteService;
@Autowired
StatutDemandeService statusDemandeService;
@GetMapping("/demandes")
public String findAll(Model model) {
Personne userPersonne = compteService.findByUsername(SecurityContextHolder.getContext().getAuthentication().getName()).getPersonne();
Set<DemandeServices> demandesServiceses = new LinkedHashSet<>();
Set<DemandeIncident> demandesIncidents = new LinkedHashSet<>();
for (Fonction f : userPersonne.getOccupations()) {
for (Services s : f.getOccupeServices()) {
for (DemandeServices ds : s.getDemande_service()) {
if (ds.getDate_cloture() == null)
demandesServiceses.add(ds);
}
}
for (Incident i : f.getOccupeIncident()) {
for (DemandeIncident di : i.getDemandeIncidents()) {
if (di.getDate_cloture() == null)
demandesIncidents.add(di);
}
}
}
model.addAttribute("demandesServiceses", demandesServiceses);
model.addAttribute("demandesIncidents", demandesIncidents);
return "demande/viewDemandes";
}
@GetMapping("/demandes/{id}/intervient")
public String PersonneIntervientPour(@PathVariable("id") Long id, Model model) {
Personne userPersonne = compteService.findByUsername(SecurityContextHolder.getContext().getAuthentication().getName()).getPersonne();
Demande d = demandeService.findById(id).get();
if (d.getDate_cloture() == null) {
StatutDemande sd = statusDemandeService.findByLibelle("En cours");
d.setStatut_demande(sd);
List<Personne> l = d.getIntervenants();
l.add(userPersonne);
d.setIntervenants(l);
demandeService.save(d);
}
return findAll(model);
}
@GetMapping("/demandes/{id}/cloture")
public String Cloture(@PathVariable("id") Long id, Model model) {
//TODO Check si le mec est intervenant sur la demande
Optional<DemandeServices> ds = demandeServiceService.findById(id);
Demande d = demandeService.findById(id).get();
StatutDemande sd = statusDemandeService.findByLibelle("Clôturée");
d.setStatut_demande(sd);
d.setDate_cloture(new Date());
demandeService.save(d);
if (ds.isPresent())
return "redirect:/demande/service";
return "redirect:/demande/incident";
}
}
|
package com.fotoable.fotoime.ui;
import android.animation.Animator;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.facebook.drawee.view.SimpleDraweeView;
import com.flurry.android.FlurryAgent;
import com.fotoable.adloadhelper.ads.IAdViewCallBackListener;
import com.fotoable.adloadhelper.ads.NativeAdViewLayout;
import com.fotoable.adloadhelper.ads.adsbean.NativeAdBase;
import com.fotoable.fotoime.R;
import com.fotoable.fotoime.ads.BannerAdViewTypeLayout;
import com.fotoable.fotoime.theme.ThemeTools;
import com.fotoable.fotoime.utils.AdCache;
import com.fotoable.fotoime.utils.Constants;
import com.fotoable.fotoime.utils.DataCollectConstant;
import com.fotoable.fotoime.utils.InterstitialAdUtil;
import com.fotoable.fotoime.utils.MutableConstants;
import com.fotoable.fotoime.utils.SharedPreferenceHelper;
import java.util.HashMap;
import io.fabric.sdk.android.Fabric;
/**
* Created by chenxiaojian on 2016/8/5.
*/
public class ThemeDetailActivity extends Activity {
private SimpleDraweeView themeDetailView;
private LinearLayout adContainer;
private LinearLayout mDownloadView;
private String themeImageURL;
private String themeDownloadURL;
private RelativeLayout foto_show_relative_layout;
private static final String TAG = ThemeDetailActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
initView();
}
private void initData() {
Intent intent = getIntent();
Bundle bundle = intent.getBundleExtra(Constants.BUNDLE_DATA_NAME);
themeImageURL = bundle.getString(Constants.THEME_BIG_IMAGE_URL);
themeDownloadURL = bundle.getString(Constants.THEME_DOWNLOAD_URL);
}
private void initView() {
setContentView(R.layout.show_keyboard_theme);
foto_show_relative_layout = (RelativeLayout) findViewById(R.id.foto_show_relative_layout);
foto_show_relative_layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
finishActivity();
} catch (Exception e) {
e.printStackTrace();
}
}
});
adContainer = (LinearLayout) findViewById(R.id.show_keyboard_theme_linearlayout);
themeDetailView = (SimpleDraweeView) findViewById(R.id.foto_theme_detail_view);
mDownloadView = (LinearLayout) findViewById(R.id.show_keyboard_theme_downloadview);
adContainer.setVisibility(View.GONE);
//处理图片
if (themeImageURL == null) {
return;
}
themeDetailView.setImageURI(Uri.parse(themeImageURL));
/** 是否移除广告 **/
if (!SharedPreferenceHelper.hasRemoveAd()){
if (AdCache.themeDetailAd == null) {
AdCache.themeDetailAd = new NativeAdViewLayout(this.getApplicationContext(), new BannerAdViewTypeLayout(this.getApplicationContext()), MutableConstants.AD_THEME_DETAIL, new IAdViewCallBackListener() {
@Override
public void adviewLoad(NativeAdBase nativeAdBase) {
adContainer.setVisibility(View.VISIBLE);
}
@Override
public void adviewClick(NativeAdBase nativeAdBase) {
}
@Override
public void adviewLoadError(NativeAdBase nativeAdBase) {
}
});
adContainer.addView(AdCache.themeDetailAd);
} else {
AdCache.themeDetailAd.updateNativeAd();
ViewGroup viewGroup = (ViewGroup) AdCache.themeDetailAd.getParent();
if (viewGroup != null) {
viewGroup.removeAllViews();
}
adContainer.addView(AdCache.themeDetailAd);
adContainer.setVisibility(View.VISIBLE);
}
if (AdCache.themeDetailAd.getIsLoadSuccessed()) {
adContainer.setVisibility(View.VISIBLE);
}
}
//处理前往下载
mDownloadView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (themeDownloadURL == null) {
return;
}
try{
String pkgName = themeDownloadURL.substring(themeDownloadURL.lastIndexOf("=") + 1,themeDownloadURL.length());
ThemeTools.downloadAppFromGooglePlay(ThemeDetailActivity.this, pkgName);
}catch (Exception e){
ThemeTools.openUrl(ThemeDetailActivity.this,themeDownloadURL);
}
if (themeImageURL != null) {
String themeNameAndId = themeImageURL.substring(themeImageURL.lastIndexOf("/") + 1, themeImageURL.lastIndexOf("."));
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("themeNameAndId", themeNameAndId);
// FlurryAgent.logEvent(DataCollectConstant.DOWNLOAD_APK_THEME, hashMap);
if (Fabric.isInitialized()) {
final CustomEvent customEvent = new CustomEvent(DataCollectConstant.DOWNLOAD_APK_THEME);
customEvent.putCustomAttribute("themeNameAndId", themeNameAndId);
Answers.getInstance().logCustom(customEvent);
}
}
}
});
}
public void finishActivity() {
foto_show_relative_layout.animate().translationY(foto_show_relative_layout.getHeight()).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
finish();
}
@Override
public void onAnimationCancel(Animator animation) {
finish();
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).start();
}
@Override
public void onBackPressed() {
try {
finishActivity();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (AdCache.themeDetailAd != null){
AdCache.themeDetailAd.setIAdViewCallBackListener(null);
}
if (adContainer != null){
adContainer.removeAllViews();
}
InterstitialAdUtil.loadInterstitialAd(getApplicationContext());
}
}
|
package com.soldevelo.vmi.tester.service;
import com.soldevelo.vmi.communication.params.RequestType;
import com.soldevelo.vmi.communication.params.TestRequestParams;
import com.soldevelo.vmi.config.acs.model.HostParams;
import com.soldevelo.vmi.tester.ex.ConnectionNotAllowedException;
import com.soldevelo.vmi.tester.http.ConnectionInfo;
import com.soldevelo.vmi.tester.http.TestKey;
import com.soldevelo.vmi.udp.UdpRequests;
import com.soldevelo.vmi.udp.UdpReverseRequests;
import org.eclipse.jetty.http.HttpMethods;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import javax.servlet.http.HttpServletRequest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class TestManagerTest {
private static final String ADDRESS_ONE = "192.0.0.1";
private static final String ADDRESS_TWO = "192.168.1.2";
private static final String TEST_ID_ONE = "testId1";
private static final String TEST_ID_TWO = "testId2";
private static final String URL_DOWNLOAD_ONE = "http://localhost:9002/d_target";
private static final String URL_UPLOAD_ONE = "http://localhost:9002/upl";
private static final String URL_DOWNLOAD_TWO = "http://localhost/d";
@InjectMocks
private TestManager testManager = new TestManagerImpl();
@Mock
private UdpRequests udpRequests;
@Mock
private UdpReverseRequests udpReverseRequests;
@Mock
private TestRequestParams testRequestParamsOne;
@Mock
private TestRequestParams testRequestParamsTwo;
@Mock
private HostParams hostParamsOne;
@Mock
private HostParams hostParamsTwo;
@Mock
private HttpServletRequest request;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(testRequestParamsOne.getAddress()).thenReturn(ADDRESS_ONE);
when(testRequestParamsOne.getId()).thenReturn(TEST_ID_ONE);
when(testRequestParamsTwo.getAddress()).thenReturn(ADDRESS_TWO);
when(testRequestParamsTwo.getId()).thenReturn(TEST_ID_TWO);
when(testRequestParamsOne.isDownload()).thenReturn(false);
when(testRequestParamsOne.isUpload()).thenReturn(true);
when(testRequestParamsTwo.isDownload()).thenReturn(true);
when(testRequestParamsTwo.isUpload()).thenReturn(false);
when(testRequestParamsOne.getRequestType()).thenReturn(RequestType.HTTP_UPLOAD);
when(testRequestParamsTwo.getRequestType()).thenReturn(RequestType.HTTP_DOWNLOAD);
when(testRequestParamsOne.getHostParams()).thenReturn(hostParamsOne);
when(testRequestParamsTwo.getHostParams()).thenReturn(hostParamsTwo);
when(hostParamsOne.getDownloadUrl()).thenReturn(URL_DOWNLOAD_ONE);
when(hostParamsOne.getUploadUrl()).thenReturn(URL_UPLOAD_ONE);
when(hostParamsTwo.getDownloadUrl()).thenReturn(URL_DOWNLOAD_TWO);
testManager.clear();
}
@Test
public void shouldRegisterTests() {
testManager.addRequest(testRequestParamsOne);
testManager.addRequest(testRequestParamsTwo);
when(request.getRemoteAddr()).thenReturn(ADDRESS_ONE);
when(request.getPathInfo()).thenReturn("/upl");
when(request.getMethod()).thenReturn(HttpMethods.POST);
assertEquals(testRequestParamsOne, testManager.findHttpRequest(request));
assertEquals(testRequestParamsOne, testManager.findHttpUploadRequest(ADDRESS_ONE));
when(request.getRemoteAddr()).thenReturn(ADDRESS_TWO);
when(request.getPathInfo()).thenReturn("/d");
when(request.getMethod()).thenReturn(HttpMethods.GET);
assertEquals(testRequestParamsTwo, testManager.findHttpRequest(request));
assertEquals(testRequestParamsTwo, testManager.findHttpDownloadRequest(ADDRESS_TWO));
assertNull(testManager.findHttpDownloadRequest(ADDRESS_ONE));
assertNull(testManager.findHttpUploadRequest(ADDRESS_TWO));
testManager.dropRequest(testRequestParamsTwo);
assertNull(testManager.findHttpRequest(request));
assertNull(testManager.findHttpDownloadRequest(ADDRESS_TWO));
assertEquals(testRequestParamsOne, testManager.findHttpUploadRequest(ADDRESS_ONE));
}
@Test
public void shouldNotReturnOldRequests() {
testManager.addRequest(testRequestParamsOne);
testManager.addRequest(testRequestParamsTwo);
when(testRequestParamsOne.afterTimeout()).thenReturn(true);
when(testRequestParamsTwo.afterTimeout()).thenReturn(true);
when(request.getRemoteAddr()).thenReturn(ADDRESS_ONE);
when(request.getPathInfo()).thenReturn("/upl");
when(request.getMethod()).thenReturn(HttpMethods.POST);
assertNull(testManager.findHttpRequest(request));
assertNull(testManager.findHttpUploadRequest(ADDRESS_ONE));
when(request.getRemoteAddr()).thenReturn(ADDRESS_TWO);
when(request.getPathInfo()).thenReturn("/d");
when(request.getMethod()).thenReturn(HttpMethods.GET);
assertNull(testManager.findHttpRequest(request));
assertNull(testManager.findHttpDownloadRequest(ADDRESS_TWO));
}
@Test
public void shouldReturnUdpRequests() {
when(udpRequests.findUdpRequest(ADDRESS_ONE)).thenReturn(testRequestParamsOne);
assertEquals(testRequestParamsOne, testManager.findUdpRequest(ADDRESS_ONE));
verify(udpRequests).findUdpRequest(ADDRESS_ONE);
assertNull(testManager.findUdpRequest(ADDRESS_TWO));
verify(udpRequests).findUdpRequest(ADDRESS_TWO);
}
@Test
public void shouldConnectDisconnectRequests() throws ConnectionNotAllowedException {
when(testRequestParamsOne.getThreadNumber()).thenReturn(3);
testManager.addRequest(testRequestParamsOne);
testManager.addRequest(testRequestParamsTwo);
testManager.httpConnect(testRequestParamsOne);
testManager.httpConnect(testRequestParamsOne);
testManager.httpConnect(testRequestParamsTwo);
ConnectionInfo connectionInfo = testManager.getConnectionInfo(testKeyOne());
assertEquals(ADDRESS_ONE, connectionInfo.getAddress());
assertEquals(3, connectionInfo.getAllowedConnections());
assertEquals(2, connectionInfo.getTotalConnectionsOpen());
assertEquals(2, connectionInfo.getActiveConnections());
connectionInfo = testManager.getConnectionInfo(testKeyTwo());
assertEquals(ADDRESS_TWO, connectionInfo.getAddress());
assertEquals(1, connectionInfo.getAllowedConnections());
assertEquals(1, connectionInfo.getTotalConnectionsOpen());
assertEquals(1, connectionInfo.getActiveConnections());
testManager.httpDisconnect(testKeyOne());
testManager.httpDisconnect(testKeyTwo());
connectionInfo = testManager.getConnectionInfo(testKeyOne());
assertEquals(ADDRESS_ONE, connectionInfo.getAddress());
assertEquals(3, connectionInfo.getAllowedConnections());
assertEquals(2, connectionInfo.getTotalConnectionsOpen());
assertEquals(1, connectionInfo.getActiveConnections());
assertEquals(testRequestParamsOne, testManager.findHttpUploadRequest(ADDRESS_ONE));
connectionInfo = testManager.getConnectionInfo(testKeyTwo());
assertNull(connectionInfo);
assertNull(testManager.findHttpDownloadRequest(ADDRESS_TWO));
testManager.httpDisconnect(testKeyOne());
connectionInfo = testManager.getConnectionInfo(testKeyOne());
assertEquals(2, connectionInfo.getTotalConnectionsOpen());
assertEquals(0, connectionInfo.getActiveConnections());
assertEquals(testRequestParamsOne, testManager.findHttpUploadRequest(ADDRESS_ONE));
testManager.httpConnect(testRequestParamsOne);
connectionInfo = testManager.getConnectionInfo(testKeyOne());
assertEquals(3, connectionInfo.getTotalConnectionsOpen());
assertEquals(1, connectionInfo.getActiveConnections());
assertEquals(testRequestParamsOne, testManager.findHttpUploadRequest(ADDRESS_ONE));
testManager.httpDisconnect(testKeyOne());
connectionInfo = testManager.getConnectionInfo(testKeyOne());
assertNull(connectionInfo);
assertNull(testManager.findHttpUploadRequest(ADDRESS_ONE));
}
@Test
public void shouldThrowExceptionWhenConnectionNotAllowed() throws ConnectionNotAllowedException {
when(testRequestParamsOne.getThreadNumber()).thenReturn(2);
testManager.httpConnect(testRequestParamsOne);
testManager.httpConnect(testRequestParamsOne);
boolean thrown = false;
try {
testManager.httpConnect(testRequestParamsOne);
} catch (ConnectionNotAllowedException e) {
thrown = true;
}
assertTrue(
"ConnectionNotAllowedException was not thrown after exceeding the connection limit",
thrown);
}
private TestKey testKeyOne() {
return new TestKey(TEST_ID_ONE, RequestType.HTTP_UPLOAD);
}
private TestKey testKeyTwo() {
return new TestKey(TEST_ID_TWO, RequestType.HTTP_DOWNLOAD);
}
}
|
package com.firedata.qtacker.web.rest;
import com.firedata.qtacker.service.LogUserService;
import com.firedata.qtacker.web.rest.errors.BadRequestAlertException;
import com.firedata.qtacker.service.dto.LogUserDTO;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
import java.util.stream.StreamSupport;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* REST controller for managing {@link com.firedata.qtacker.domain.LogUser}.
*/
@RestController
@RequestMapping("/api")
public class LogUserResource {
private final Logger log = LoggerFactory.getLogger(LogUserResource.class);
private static final String ENTITY_NAME = "logUser";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final LogUserService logUserService;
public LogUserResource(LogUserService logUserService) {
this.logUserService = logUserService;
}
/**
* {@code POST /log-users} : Create a new logUser.
*
* @param logUserDTO the logUserDTO to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new logUserDTO, or with status {@code 400 (Bad Request)} if the logUser has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/log-users")
public ResponseEntity<LogUserDTO> createLogUser(@RequestBody LogUserDTO logUserDTO) throws URISyntaxException {
log.debug("REST request to save LogUser : {}", logUserDTO);
if (logUserDTO.getId() != null) {
throw new BadRequestAlertException("A new logUser cannot already have an ID", ENTITY_NAME, "idexists");
}
LogUserDTO result = logUserService.save(logUserDTO);
return ResponseEntity.created(new URI("/api/log-users/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /log-users} : Updates an existing logUser.
*
* @param logUserDTO the logUserDTO to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated logUserDTO,
* or with status {@code 400 (Bad Request)} if the logUserDTO is not valid,
* or with status {@code 500 (Internal Server Error)} if the logUserDTO couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/log-users")
public ResponseEntity<LogUserDTO> updateLogUser(@RequestBody LogUserDTO logUserDTO) throws URISyntaxException {
log.debug("REST request to update LogUser : {}", logUserDTO);
if (logUserDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
LogUserDTO result = logUserService.save(logUserDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, logUserDTO.getId().toString()))
.body(result);
}
/**
* {@code GET /log-users} : get all the logUsers.
*
* @param pageable the pagination information.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of logUsers in body.
*/
@GetMapping("/log-users")
public ResponseEntity<List<LogUserDTO>> getAllLogUsers(Pageable pageable) {
log.debug("REST request to get a page of LogUsers");
Page<LogUserDTO> page = logUserService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* {@code GET /log-users/:id} : get the "id" logUser.
*
* @param id the id of the logUserDTO to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the logUserDTO, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/log-users/{id}")
public ResponseEntity<LogUserDTO> getLogUser(@PathVariable Long id) {
log.debug("REST request to get LogUser : {}", id);
Optional<LogUserDTO> logUserDTO = logUserService.findOne(id);
return ResponseUtil.wrapOrNotFound(logUserDTO);
}
/**
* {@code DELETE /log-users/:id} : delete the "id" logUser.
*
* @param id the id of the logUserDTO to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/log-users/{id}")
public ResponseEntity<Void> deleteLogUser(@PathVariable Long id) {
log.debug("REST request to delete LogUser : {}", id);
logUserService.delete(id);
return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build();
}
/**
* {@code SEARCH /_search/log-users?query=:query} : search for the logUser corresponding
* to the query.
*
* @param query the query of the logUser search.
* @param pageable the pagination information.
* @return the result of the search.
*/
@GetMapping("/_search/log-users")
public ResponseEntity<List<LogUserDTO>> searchLogUsers(@RequestParam String query, Pageable pageable) {
log.debug("REST request to search for a page of LogUsers for query {}", query);
Page<LogUserDTO> page = logUserService.search(query, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
}
|
package bullshit;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Core {
// For the actual file.
private static ArrayList<Word> textDirty = new ArrayList<>();
private static ArrayList<Word> textCleaned = new ArrayList<>();
private static HashMap<String, Word> wordsActual = new HashMap<>();
// For the reference file.
private static ArrayList<Word> textCleanedRef = new ArrayList<>();
private static HashMap<String, Word> wordsRef = new HashMap<>();
// For semantic analysis
private static ArrayList<Word> namesList = new ArrayList<>();
private static ArrayList<Word> namesListFinal = new ArrayList<>();
private static ArrayList<String> text = new ArrayList<>();
// For UI
boolean isSemantic;
public static void mainMethod() throws FileNotFoundException {
boolean runStop=false;
while(runStop!=true){
runProgram();
System.out.println("Szeretné újra futatni a programot?");
Scanner sc= new Scanner(System.in);
String choose= sc.nextLine();
if(choose.equals("igen")){
runProgram();
} if(choose.equals("nem")){
runStop=true;
} else {
System.out.println("Kérem igennel vagy nemmel válaszoljon.");
String choose2= sc.nextLine();
}
}
}
private static void readFile(String actual, String reference) throws FileNotFoundException {
Scanner sc = new Scanner(new File(reference));
while (sc.hasNext()) {
String s1 = sc.next().trim().toLowerCase();
s1 = cleanSpecialCharacters(s1);
Word wordRefClean = new Word();
wordRefClean.setWord(s1);
String a = wordRefClean.getWord();
if (wordsRef.containsKey(a)) {
wordsRef.get(wordRefClean.getWord()).setCounter();
} else if (wordRefClean.getWord() != " ") {
wordsRef.put(wordRefClean.getWord(), wordRefClean);
}
}
for (Map.Entry<String, Word> entry : wordsRef.entrySet()) {
textCleanedRef.add(entry.getValue());
}
sortByOccurrence(textCleanedRef);
ArrayList<String> conjuctions = new ArrayList<>(topXxx((textCleanedRef), 150));
Scanner sc2 = new Scanner(new File(actual));
while (sc2.hasNext()) {
String s = sc2.next().trim();
Word wordDirty = new Word();
wordDirty.setWord(s);
textDirty.add(wordDirty);
s = cleanSpecialCharacters(s).toLowerCase();
Word word = new Word();
word.setWord(s);
String b = word.getWord();
if (conjuctions.contains(word.getWord()) == false) {
text.add(word.getWord());
if (wordsActual.containsKey(b)) {
wordsActual.get(word.getWord()).setCounter();
} else if (word.getWord() != " ") {
wordsActual.put(word.getWord(), word);
}
}
}
for (Map.Entry<String, Word> entry : wordsActual.entrySet()) {
textCleaned.add(entry.getValue());
}
sortByOccurrence(textCleaned);
}
private static String cleanSpecialCharacters(String s) {
String[] chars = {"?", "!", ".", ",", ":", "-", ";", "–"};
return cleanSpecialCharacters(s, chars);
}
private static String cleanSpecialCharacters(String s, String[] specialChars) {
for (String aChar : specialChars) {
s = s.replace(aChar, "");
}
return s;
}
private static void sortByOccurrence(ArrayList<Word> a) {
ListComparator byOccurrence = new ListComparator();
Collections.sort(a, byOccurrence);
}
private static ArrayList<String> topXxx(ArrayList<Word> a, int b) {
ArrayList<String> topXxx = new ArrayList<>();
for (int i = 0; i < b; i++) {
topXxx.add(a.get(i).getWord());
}
return topXxx;
}
private static ArrayList<String> topXxxOfSpeechs(ArrayList<OfSpeech> a, int b) {
ArrayList<String> topXxx = new ArrayList<>();
for (int i = 0; i < b; i++) {
topXxx.add(a.get(i).getOfSpeech());
}
return topXxx;
}
private static ArrayList<OfSpeech> generateOfSpeeches(int n) {
int real = n;
ArrayList<OfSpeech> temp = new ArrayList<>();
HashMap<String, OfSpeech> ofSpeech = new HashMap<>();
for (int i = 1; i < text.size() - real; i++) {
if (text.get(i).trim() != " ") {
String s = text.get(0 + i) + " ";
for (int j = 1; j < real; j++) {
String c = text.get(i + j).trim();
s += c + " ";
}
OfSpeech tem = new OfSpeech();
tem.setOfSpeech(s);
if (ofSpeech.containsKey(s)) {
ofSpeech.get(tem.getOfSpeech()).setCounter();
} else {
ofSpeech.put(tem.getOfSpeech(), tem);
}
}
}
for (Map.Entry<String, OfSpeech> entry : ofSpeech.entrySet()) {
temp.add(entry.getValue());
}
ListComparatorForOfSpeeches byOccurrence = new ListComparatorForOfSpeeches();
Collections.sort(temp, byOccurrence);
return temp;
}
private static String cleanMostUsedNames(String s) {
String[] chars = {"?", "!", ".", ",", ":", ";"};
return cleanMostUsedNames(s, chars);
}
private static String cleanMostUsedNames(String s, String[] specialChars) {
for (String aChar : specialChars) {
s = s.replace(aChar, "");
}
return s;
}
private static void getNames() {
String[] s = {".", "?", "!"};
int counter = 1;
while (counter < textDirty.size() - 1) {
counter++;
do {
if (Character.isUpperCase(textDirty.get(counter).getWord().charAt(0))) {
namesList.add(textDirty.get(counter));
}
counter++;
if (counter == textDirty.size()) {
break;
}
} while (textDirty.get(counter).getWord().contains(s[0])
|| textDirty.get(counter).getWord().contains(s[1])
|| textDirty.get(counter).getWord().contains(s[2]));
}
for (int i = 0; i < namesList.size(); i++) {
namesList.get(i).setWord(cleanMostUsedNames(namesList.get(i).getWord()));
if (namesList.get(i).getWord().endsWith("-")) {
String name = namesList.get(i).getWord().substring(0, namesList.get(i).getWord().length() - 1);
namesList.get(i).setWord(name);
}
int n = 0;
if (!namesListFinal.isEmpty()) {
for (int j = 0; j < namesListFinal.size(); j++) {
if (namesListFinal.get(j).getWord().equals(namesList.get(i).getWord())) {
namesListFinal.get(j).setCounter();
break;
} else {
n++;
}
}
} else {
namesListFinal.add(namesList.get(i));
}
if (n == namesListFinal.size()) {
namesListFinal.add(namesList.get(i));
}
}
ListComparator namesByCounter = new ListComparator();
Collections.sort(namesListFinal, namesByCounter);
}
private static String generateBullShit(int a, int b) {
String bullShitTemp = "";
int s=a+b;
int indexFixer=0;
int v=s+indexFixer;
for (int i = a-1; i <= v; i++) {
String c = textCleaned.get(i).getWord().trim();
if(bullShitTemp.contains(c)){
indexFixer++;
}
else{
bullShitTemp += c + " ";}
}
return bullShitTemp;
}
private static void makeSemantic(){
System.out.println("Dolgozunk.");
ArrayList<String> topWords = new ArrayList<>(topXxx((textCleaned), 10));
System.out.println("A szövegben ez a 10 leggyakoribb szó.\n"+topWords);
System.out.println("");
ArrayList<String> ofSpeeches2 = new ArrayList<>(topXxxOfSpeechs(generateOfSpeeches(2), 10));
System.out.println("A szövegben ez a 10 leggyakoribb kétszavas szóforudlat.\n"+ofSpeeches2);
System.out.println("");
ArrayList<String> ofSpeeches3 = new ArrayList<>(topXxxOfSpeechs(generateOfSpeeches(3), 10));
System.out.println("A szövegben ez a 10 leggyakoribb három szavas szóforudlat.\n"+ofSpeeches3);
System.out.println("");
ArrayList<String> ofSpeeches4 = new ArrayList<>(topXxxOfSpeechs(generateOfSpeeches(4), 10));
System.out.println("A szövegben ez a 10 leggyakoribb négy szavas szóforudlat.\n"+ofSpeeches4);
System.out.println("");
getNames();
ArrayList<String> names = new ArrayList<>(topXxx(namesListFinal, 10));
System.out.println("A szövegben ez a 10 leggyakoribb név.\n"+names);
System.out.println("");
}
private static void makeBullShit(int a/*belépési érték*/, int b/*intervalum*/){
String bullShit = generateBullShit(a, b).trim();
bullShit =bullShit.substring(0, 1).toUpperCase() + bullShit.substring(1)+".";
System.out.println(bullShit);
}
private static void runProgram() throws FileNotFoundException{
Scanner sc = new Scanner(System.in);
System.out.println("Az alábbiakban szemantikai elemzést végezhet egy szövegen,\n"
+ "vagy random mondatot(BullShit-et) generáltathat a programmal.\n"
+ "Kérem adja meg az elemezendő fájl (Amely txt formátumú.) teljes elérési útvonalát.");
String path=sc.nextLine();
String actual =path;
System.out.println("Amennyiben meg szeretne adni saját referencia szöveget (Amely txt formátumú.) az összehasonlításhoz.\n"
+ "Adja meg annak is a teljes elérési útvonalát.Ellenkező esetben kérem nyomja meg a 0-át\n"
+ "és a program a beépített referencia szöveget fogja használni.");
String pathRef=sc.nextLine();
String zeroPath=Integer.toString(0);
String refTemp;
if(pathRef.equals(zeroPath)){
refTemp = "ref.txt";
}else{
refTemp = pathRef;
}
readFile(actual, refTemp);
System.out.println("Kérem válasszon a billentyűzete segítségével.\n 1-es "
+ "gomb szemantikai elemezés, 2-es gomb BullShit generálás.");
int SemOrBull=sc.nextInt();
if(SemOrBull==2){
System.out.println("Kérlem válasszon, hogy a szőveg hanyadik szavától "
+ "szeretné indítani a generálást.");
int startingPoint=sc.nextInt();
System.out.println("Kérem adja meg hogy hányszavas Bullshit "
+ "mondatot szeretne generálni."
+ "Ha nem tudodja eldöntei akkor nyomja meg a 0-át\nés a program kidobja önnek "
+ "a lehető leghosszabb mondatot ami generálható az ön által megadott szóhoz képest.");
int lengthOfBullShit=sc.nextInt();
System.out.println("A BullShit mondat: ");
makeBullShit(startingPoint,lengthOfBullShit);
}else{
makeSemantic();
}
}
}
|
package ObjectDemoProduct;
abstract class ProductAbstractClass {
int price;
String productNaume;
int productCatagoryId;
private int productSecret;
public abstract void valueFcn();;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.