text
stringlengths
10
2.72M
package it.univaq.rtv.Model.StatoGiocatore; import it.univaq.rtv.Model.Giocatore; public class Gioca implements IStato_Giocatore { /** * @param g */ @Override public void ruolo(Giocatore g){ g.setState(this); } }
package com.example.bhakt.payment_module; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.RadioGroup; import android.widget.Toast; public class payment_modes extends AppCompatActivity { Button pay_mode; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_payment_modes); pay_mode=(Button)findViewById(R.id.paymode); pay_mode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { RadioGroup group= (RadioGroup)findViewById(R.id.payment_mode); int btnid= group.getCheckedRadioButtonId(); Button btn=(Button)findViewById(btnid); String mode=(String) btn.getText(); //Toast.makeText(payment_modes.this,""+btnid,Toast.LENGTH_SHORT).show(); //if(btnid==2131230807){ //for paytm id=2131230807 if(mode.equals(" paytm")){ //Toast.makeText(payment_modes.this,"please select a mode"+btnid,Toast.LENGTH_SHORT).show(); Intent intent = getPackageManager().getLaunchIntentForPackage("net.one97.paytm"); if (intent != null) { // We found the activity now start the activity intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { // Bring user to the market or let them choose an app? intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("market://details?id=" + "net.one97.paytm")); startActivity(intent); } } else if(mode.equals(" cards")){ //for card payment id=2131230758 Intent card_details=new Intent(payment_modes.this,card_details.class); startActivity(card_details); } else if(mode.equals(" netbanking")){ // for netbanking=2131230795 Intent card_details1=new Intent(payment_modes.this,card_details.class); startActivity(card_details1); } } }); } }
import java.util.*; import java.io.*; public class NickProb { public static void main(String[] args) throws IOException { Scanner nya = new Scanner(System.in); int cats = Integer.parseInt(nya.nextLine()); while(cats-->0){ TreeMap<String, String> meow = new TreeMap<>(new Comparator<String>() { @Override public int compare(String o1, String o2) { String[] temp1 = o1.split(" "); String[] temp2 = o2.split(" "); double a = Double.parseDouble(temp1[1]); double b = Double.parseDouble(temp2[1]); if(a > b) return 1; else if(a < b) return -1; else return temp1[0].compareTo(temp2[0]); } }); int catss = Integer.parseInt(nya.nextLine()); while(catss-->0){ String temp = nya.nextLine(); meow.put(temp, temp.split(" ")[0]); } for(String x: meow.values()) System.out.println(x); } } }
package SMS; import android.telephony.SmsManager; public class sendSMS { //private String msgTxt,numTxt; public sendSMS(String numTxt,String msgTxt){ SmsManager sms=SmsManager.getDefault(); sms.sendTextMessage(numTxt, null, msgTxt, null, null); } }
package org.mge.ds; import java.util.Arrays; public class StackWithArray { private int[] data; private int top = -1; private int size = 0; public static void main(String[] args) { StackWithArray s = new StackWithArray(2); System.out.println(s.isEmpty()); System.out.println(s.capaity()); s.push(1); s.push(2); s.push(3); System.out.println(s.capaity()); System.out.println(s.isEmpty()); System.out.println(s.top()); System.out.println(s.pop()); } public StackWithArray() { data = new int[10]; } public StackWithArray(int capacity) { data = new int[capacity]; } public void push(int x) { if (top + 1 == data.length) increaseCapacity(); data[++top] = x; size++; } public int pop() { if (top < 0) throw new ArrayIndexOutOfBoundsException(top); size--; return data[top--]; } public int top() { return data[top]; } public boolean isEmpty() { return size == 0; } private void increaseCapacity(){ data = Arrays.copyOf(data, data.length * 2); } public int capaity(){ return data.length; } }
public class Solution { int id_sol ; String texte_sol ; int id_user ; int id_prob ; String nom_user; String prenom_user; public int getId_sol() { return id_sol; } public void setId_sol(int id_sol) { this.id_sol = id_sol; } public String getTexte_sol() { return texte_sol; } public void setTexte_sol(String texte_sol) { this.texte_sol = texte_sol; } public int getId_user() { return id_user; } public void setId_user(int id_user) { this.id_user = id_user; } public int getId_prob() { return id_prob; } public void setId_prob(int id_prob) { this.id_prob = id_prob; } public String getNom_user() { return nom_user; } public void setNom_user(String nom_user) { this.nom_user = nom_user; } public String getPrenom_user() { return prenom_user; } public void setPrenom_user(String prenom_user) { this.prenom_user = prenom_user; } }
package com.translator.application.test.doubles; import com.translator.domain.model.credits.Credits; import com.translator.domain.model.material.MaterialFactory; import com.translator.domain.model.material.Material; import com.translator.domain.model.numeral.RomanNumeral; import java.util.ArrayList; import java.util.List; import java.util.Map; public class MaterialPricePerUnitSpy extends MaterialFactory { private Map<String, Material> materials; private List<List<RomanNumeral>> romanNumerals; private List<String> materialName; private List<Credits> cost; public MaterialPricePerUnitSpy() { romanNumerals = new ArrayList<List<RomanNumeral>>(); materialName = new ArrayList<String>(); cost = new ArrayList<Credits>(); } @Override public Material createUsing(List<RomanNumeral> romanNumerals, String materialName, Credits cost) { this.romanNumerals.add(romanNumerals); this.materialName.add(materialName); this.cost.add(cost); return materials.get(materialName); } public void setMaterials(Map<String, Material> materialsStub) { this.materials = materialsStub; } public List<List<RomanNumeral>> romanNumerals() { return romanNumerals; } public List<String> materialName() { return materialName; } public List<Credits> cost() { return cost; } }
package com.tencent.mm.plugin.radar.b; import com.tencent.mm.storage.ab; final class c$k implements Runnable { final /* synthetic */ ab mjM; final /* synthetic */ c mjy; c$k(c cVar, ab abVar) { this.mjy = cVar; this.mjM = abVar; } public final void run() { this.mjy.mjt.L(this.mjM); } }
//package com.emp.rest.controllers; // //import java.net.URI; //import java.util.ArrayList; //import java.util.Collection; //import java.util.Date; //import java.util.HashMap; //import java.util.LinkedHashMap; //import java.util.List; //import java.util.Map; //import java.util.logging.Logger; // //import javax.annotation.PostConstruct; //import javax.validation.Valid; // //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.propertyeditors.StringTrimmerEditor; //import org.springframework.http.HttpStatus; //import org.springframework.http.ResponseEntity; //import org.springframework.security.core.GrantedAuthority; //import org.springframework.security.core.authority.AuthorityUtils; //import org.springframework.security.core.authority.SimpleGrantedAuthority; // //import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //import org.springframework.security.crypto.password.PasswordEncoder; //import org.springframework.security.provisioning.JdbcUserDetailsManager; //import org.springframework.security.provisioning.UserDetailsManager; //import org.springframework.stereotype.Controller; //import org.springframework.ui.Model; //import org.springframework.validation.BindingResult; //import org.springframework.web.bind.WebDataBinder; //import org.springframework.web.bind.annotation.CrossOrigin; //import org.springframework.web.bind.annotation.GetMapping; //import org.springframework.web.bind.annotation.InitBinder; //import org.springframework.web.bind.annotation.ModelAttribute; //import org.springframework.web.bind.annotation.PathVariable; //import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.RequestBody; // //import org.springframework.web.bind.annotation.RestController; // //import com.emp.rest.entity.Role; //import com.emp.rest.entity.UserInfo; // //import com.emp.rest.repository.UserInfoRepository; // //@CrossOrigin(origins = "http://localhost:4200") //@RestController //public class RegistrationController { // // @Autowired // UserInfoRepository userInfoRepository; // // // private PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); // // private Logger logger = Logger.getLogger(getClass().getName()); // // @PostMapping("/register/createUser") // public ResponseEntity<Void> createUser(@RequestBody UserInfo newUser) { // // System.out.println("user" + newUser.getUsername() + "--" + "Pass" + newUser.getPassword()); // // // encrypt the password // String encodedPassword =passwordEncoder.encode(newUser.getPassword()); // newUser.setPassword(encodedPassword); // newUser.setEnabled(newUser.getIsActive().equals("YES")?true:false); // newUser.setCreationDate(new Date()); // userInfoRepository.save(newUser); // // //return new ResponseEntity<UserInfo>(newUser, HttpStatus.OK); // return ResponseEntity.noContent().build(); // } // //}
package data.daos; import static org.junit.Assert.*; import java.util.Calendar; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import config.PersistenceConfig; import config.TestsPersistenceConfig; import data.entities.Lesson; import data.entities.User; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {PersistenceConfig.class, TestsPersistenceConfig.class}) public class LessonDaoITest { @Autowired private DaosService daosService; @Autowired private CourtDao courtDao; @Autowired private LessonDao lessonDao; @Test public void testFindByTimeCourt() { Calendar date1 = Calendar.getInstance(); date1.add(Calendar.DAY_OF_YEAR, 1); date1.set(Calendar.HOUR_OF_DAY, 0); Calendar date2 = (Calendar) date1.clone(); date2.add(Calendar.HOUR_OF_DAY, 23); date2.add(Calendar.MINUTE, 59); Calendar date3 = (Calendar) date1.clone(); date3.add(Calendar.HOUR_OF_DAY, 13); date3.add(Calendar.MINUTE, 49); Lesson lesson = new Lesson((User) daosService.getMap().get("user1"), courtDao.findOne(2), date1, date2, date3); lessonDao.save(lesson); assertNotNull(lessonDao.findByTimeCourt(lesson.getTimeCourt())); } @Test public void testFindById() { Lesson lesson = new Lesson(); lessonDao.save(lesson); assertEquals(lesson.getId(), lessonDao.findById(lesson.getId()).getId()); } @Test public void testFindFirst() { assertNotNull(lessonDao.findFirstById()); } }
package com.workorder.ticket.persistence.dto; import com.workorder.ticket.persistence.entity.User; /** * 用户信息详情 * * @author wzdong * @Date 2019年3月5日 * @version 1.0 */ public class UserInfoDto extends User { private String groupName; private Long userId; public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } }
/** */ package contain; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; /** * <!-- begin-user-doc --> * The <b>Package</b> for the model. * It contains accessors for the meta objects to represent * <ul> * <li>each class,</li> * <li>each feature of each class,</li> * <li>each enum,</li> * <li>and each data type</li> * </ul> * <!-- end-user-doc --> * @see contain.ContainFactory * @model kind="package" * @generated */ public interface ContainPackage extends EPackage { /** * The package name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ String eNAME = "contain"; /** * The package namespace URI. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ String eNS_URI = "http://www.example.com/contain"; /** * The package namespace name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ String eNS_PREFIX = "cnt"; /** * The singleton instance of the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ ContainPackage eINSTANCE = contain.impl.ContainPackageImpl.init(); /** * The meta object id for the '{@link contain.impl.EImpl <em>E</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.EImpl * @see contain.impl.ContainPackageImpl#getE() * @generated */ int E = 0; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E__NAME = 0; /** * The number of structural features of the '<em>E</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E_FEATURE_COUNT = 1; /** * The meta object id for the '{@link contain.impl.E1Impl <em>E1</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.E1Impl * @see contain.impl.ContainPackageImpl#getE1() * @generated */ int E1 = 1; /** * The feature id for the '<em><b>Elements</b></em>' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E1__ELEMENTS = 0; /** * The number of structural features of the '<em>E1</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E1_FEATURE_COUNT = 1; /** * The meta object id for the '{@link contain.impl.E2Impl <em>E2</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.E2Impl * @see contain.impl.ContainPackageImpl#getE2() * @generated */ int E2 = 2; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E2__NAME = E__NAME; /** * The number of structural features of the '<em>E2</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E2_FEATURE_COUNT = E_FEATURE_COUNT + 0; /** * The meta object id for the '{@link contain.impl.E3Impl <em>E3</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.E3Impl * @see contain.impl.ContainPackageImpl#getE3() * @generated */ int E3 = 3; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E3__NAME = E__NAME; /** * The number of structural features of the '<em>E3</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int E3_FEATURE_COUNT = E_FEATURE_COUNT + 0; /** * Returns the meta object for class '{@link contain.E <em>E</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>E</em>'. * @see contain.E * @generated */ EClass getE(); /** * Returns the meta object for the attribute '{@link contain.E#getName <em>Name</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Name</em>'. * @see contain.E#getName() * @see #getE() * @generated */ EAttribute getE_Name(); /** * Returns the meta object for class '{@link contain.E1 <em>E1</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>E1</em>'. * @see contain.E1 * @generated */ EClass getE1(); /** * Returns the meta object for the containment reference list '{@link contain.E1#getElements <em>Elements</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Elements</em>'. * @see contain.E1#getElements() * @see #getE1() * @generated */ EReference getE1_Elements(); /** * Returns the meta object for class '{@link contain.E2 <em>E2</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>E2</em>'. * @see contain.E2 * @generated */ EClass getE2(); /** * Returns the meta object for class '{@link contain.E3 <em>E3</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>E3</em>'. * @see contain.E3 * @generated */ EClass getE3(); /** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the factory that creates the instances of the model. * @generated */ ContainFactory getContainFactory(); /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent * <ul> * <li>each class,</li> * <li>each feature of each class,</li> * <li>each enum,</li> * <li>and each data type</li> * </ul> * <!-- end-user-doc --> * @generated */ interface Literals { /** * The meta object literal for the '{@link contain.impl.EImpl <em>E</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.EImpl * @see contain.impl.ContainPackageImpl#getE() * @generated */ EClass E = eINSTANCE.getE(); /** * The meta object literal for the '<em><b>Name</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute E__NAME = eINSTANCE.getE_Name(); /** * The meta object literal for the '{@link contain.impl.E1Impl <em>E1</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.E1Impl * @see contain.impl.ContainPackageImpl#getE1() * @generated */ EClass E1 = eINSTANCE.getE1(); /** * The meta object literal for the '<em><b>Elements</b></em>' containment reference list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EReference E1__ELEMENTS = eINSTANCE.getE1_Elements(); /** * The meta object literal for the '{@link contain.impl.E2Impl <em>E2</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.E2Impl * @see contain.impl.ContainPackageImpl#getE2() * @generated */ EClass E2 = eINSTANCE.getE2(); /** * The meta object literal for the '{@link contain.impl.E3Impl <em>E3</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see contain.impl.E3Impl * @see contain.impl.ContainPackageImpl#getE3() * @generated */ EClass E3 = eINSTANCE.getE3(); } } //ContainPackage
package com.Lab; import java.util.Scanner; //INTIALIZATION public class BakingData { private static int eggsAmount; private int eggsMin = 1; private static int milkAmount; private int milkMin = 200; // milliliter private static int flourAmount; private int flourMin = 100; // grams // INTRODUCTION public String intro(String[] args) { Scanner name = new Scanner(System.in); System.out.println("Please input your name..."); String chefName = name.nextLine(); System.out.println("Hello Chef " + chefName + "!"); System.out.println("Factory is starting up..."); return chefName; } // INGREDIENTS public int chefInput() { System.out.println("How many eggs do you have?"); Scanner chefInput; chefInput = new Scanner(System.in); setEggsAmount(chefInput.nextInt()); System.out.println("You have " + getEggsAmount() + " eggs..."); // EGGS System.out.println("How much milk do you have?"); chefInput = new Scanner(System.in); setMilkAmount(chefInput.nextInt()); System.out.println("You have " + getMilkAmount() + "ml of milk..."); // MILK System.out.println("How much flour do you have?"); chefInput = new Scanner(System.in); setFlourAmount(chefInput.nextInt()); System.out.println("You have " + getFlourAmount() + "g of flour..."); // FLOUR return getEggsAmount(); } // MAIN CODE public void main(String[] args) { System.out.println(""); if (getEggsAmount() < eggsMin || getMilkAmount() < milkMin || getFlourAmount() < flourMin) { System.out.println("Insufficient materials... Please proceed to store..."); } else { setEggsAmount(getEggsAmount() / eggsMin); System.out.println("you have " + getEggsAmount() + " portions of eggs..."); setMilkAmount(getMilkAmount() / milkMin); System.out.println("you have " + getMilkAmount() + " portions of milk..."); setFlourAmount(getFlourAmount() / flourMin); System.out.println("you have " + getFlourAmount() + " portions of flour..."); } } public int status() { // INVENTORY CHECK int smallest; if (getEggsAmount() <= getMilkAmount() && getMilkAmount() <= getFlourAmount()) { smallest = getEggsAmount(); } else if (getMilkAmount() <= getFlourAmount() && getMilkAmount() <= getEggsAmount()) { smallest = getMilkAmount(); } else { smallest = getFlourAmount(); } // STATUS System.out.println(""); System.out.println("You can make " + smallest * 4 + " pieces of cookies..."); System.out.println(""); System.out.println("You will need " + smallest * eggsMin + " eggs..."); System.out.println("You will need " + smallest * milkMin + " ml of milk..."); System.out.println("You will need " + smallest * flourMin + " grams of flour..."); System.out.println(""); System.out.println("Factory is shutting down..."); return smallest; } // SETTER public void eggsAmount(int eggsAmount) { this.setEggsAmount(eggsAmount); } public void eggsMin(int eggsMin) { this.eggsMin = eggsMin; } public void milkAmount(int milkAmount) { this.setMilkAmount(milkAmount); } public void milkMin(int milkMin) { this.milkMin = milkMin; } public void flourAmount(int flourAmount) { this.setFlourAmount(flourAmount); } public void flourMin(int flourMin) { this.flourMin = flourMin; } // GETTER public int milkAmount() { return this.getMilkAmount(); } public int milkMin() { return this.milkMin; } public int eggsAmount() { return this.getEggsAmount(); } public int eggsMin() { return this.eggsMin; } public int flourAmount() { return this.getMilkAmount(); } public int flourMin() { return this.flourMin; } public static int getFlourAmount() { return flourAmount; } public void setFlourAmount(int flourAmount) { this.flourAmount = flourAmount; } public static int getMilkAmount() { return milkAmount; } public void setMilkAmount(int milkAmount) { this.milkAmount = milkAmount; } public static int getEggsAmount() { return eggsAmount; } public void setEggsAmount(int eggsAmount) { this.eggsAmount = eggsAmount; } }
package Java_LinkedList; import java.util.LinkedList; public class LinkedListtest1 { public static void main(String[] args) { Duilei d = new Duilei(); d.myAdd("java1"); d.myAdd("java2"); d.myAdd("java3"); d.myAdd("java4"); while(!d.isNull()){ System.out.println(d.myGet()); } } } class Duilei{ private LinkedList link; Duilei(){ link = new LinkedList(); } public void myAdd(Object obj){ link.addLast(obj); } public Object myGet(){ return link.removeFirst(); } public boolean isNull(){ return link.isEmpty(); } }
package ticketApi; public interface TicketSink { // Insert a ticket into the sink void addTicket(Ticket ticket); }
package com.spbsu.flamestream.example.bl.index.model; import java.util.Objects; /** * User: Artem * Date: 10.07.2017 */ public class WordIndexRemove implements WordBase { private final String word; private final long start; private final int range; public WordIndexRemove(String word, long start, int range) { this.word = word; this.start = start; this.range = range; } @Override public String word() { return word; } public long start() { return start; } public int range() { return range; } @Override public String toString() { return "REMOVE " + word + " : " + start + ", " + range; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final WordIndexRemove that = (WordIndexRemove) o; return start == that.start && range == that.range && Objects.equals(word, that.word); } @Override public int hashCode() { return word.hashCode(); } }
package server; /** * A server that can receive GET, PUT, and DELETE * commands for key-value pairs to store in a map. This class * is thread-safe with respect to reads/writes to the map. * @author lscholte * */ public interface Server { /** * Starts the server and awaits requests from a client. */ public void start() throws Throwable; }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.webbeans.test.interceptors.factory.beans; import jakarta.enterprise.context.Dependent; import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional; /** * A test bean which has > 128 methods. * This did originally cause a bug in our generated interceptor bytecode * as we used BIPUSH which is only 8bit signed as index. */ @Transactional @Dependent public class TonsOfMethodsInterceptedClass { public void method0() { } public void method1() { } public void method2() { } public void method3() { } public void method4() { } public void method5() { } public void method6() { } public void method7() { } public void method8() { } public void method9() { } public void method10() { } public void method11() { } public void method12() { } public void method13() { } public void method14() { } public void method15() { } public void method16() { } public void method17() { } public void method18() { } public void method19() { } public void method20() { } public void method21() { } public void method22() { } public void method23() { } public void method24() { } public void method25() { } public void method26() { } public void method27() { } public void method28() { } public void method29() { } public void method30() { } public void method31() { } public void method32() { } public void method33() { } public void method34() { } public void method35() { } public void method36() { } public void method37() { } public void method38() { } public void method39() { } public void method40() { } public void method41() { } public void method42() { } public void method43() { } public void method44() { } public void method45() { } public void method46() { } public void method47() { } public void method48() { } public void method49() { } public void method50() { } public void method51() { } public void method52() { } public void method53() { } public void method54() { } public void method55() { } public void method56() { } public void method57() { } public void method58() { } public void method59() { } public void method60() { } public void method61() { } public void method62() { } public void method63() { } public void method64() { } public void method65() { } public void method66() { } public void method67() { } public void method68() { } public void method69() { } public void method70() { } public void method71() { } public void method72() { } public void method73() { } public void method74() { } public void method75() { } public void method76() { } public void method77() { } public void method78() { } public void method79() { } public void method80() { } public void method81() { } public void method82() { } public void method83() { } public void method84() { } public void method85() { } public void method86() { } public void method87() { } public void method88() { } public void method89() { } public void method90() { } public void method91() { } public void method92() { } public void method93() { } public void method94() { } public void method95() { } public void method96() { } public void method97() { } public void method98() { } public void method99() { } public void method100() { } public void method101() { } public void method102() { } public void method103() { } public void method104() { } public void method105() { } public void method106() { } public void method107() { } public void method108() { } public void method109() { } public void method110() { } public void method111() { } public void method112() { } public void method113() { } public void method114() { } public void method115() { } public void method116() { } public void method117() { } public void method118() { } public void method119() { } public void method120() { } public void method121() { } public void method122() { } public void method123() { } public void method124() { } public void method125() { } public void method126() { } public void method127() { } public void method128() { } public void method129() { } }
package p9.platforms; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Dimension; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * GDXFrame.java * @author Matthew Eugene Swanson * */ public class GDXFrame extends JFrame implements WindowListener{ private JPanel contentPane; private LwjglApplication app; public final Canvas canvas; /** * Create the frame. */ public GDXFrame(String title, final ApplicationListener listener , final LwjglApplicationConfiguration config) { setTitle(title); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setPreferredSize(new Dimension(config.width, config.height)); contentPane = new JPanel(); setContentPane(contentPane); contentPane.setLayout(new BorderLayout(0, 0)); addWindowListener(this); canvas = new Canvas(){ public final void addNotify(){ super.addNotify(); app = new LwjglApplication(listener, config, canvas); } public final void removeNotify(){ app.stop(); super.removeNotify(); } }; canvas.setIgnoreRepaint(true); canvas.setFocusable(true); contentPane.add(canvas, BorderLayout.CENTER); pack(); } @Override public void windowActivated(WindowEvent arg0) { } @Override public void windowClosed(WindowEvent arg0) { } @Override public void windowClosing(WindowEvent arg0) { app.exit(); this.dispose(); } @Override public void windowDeactivated(WindowEvent arg0) { } @Override public void windowDeiconified(WindowEvent arg0) { } @Override public void windowIconified(WindowEvent arg0) { } @Override public void windowOpened(WindowEvent arg0) { } }
package com.tencent.mm.plugin.account.ui; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import com.tencent.mm.plugin.c.a; class RegByEmailUI$2 implements OnClickListener { final /* synthetic */ RegByEmailUI eUG; RegByEmailUI$2(RegByEmailUI regByEmailUI) { this.eUG = regByEmailUI; } public final void onClick(DialogInterface dialogInterface, int i) { a.pU(RegByEmailUI.f(this.eUG)); this.eUG.YC(); this.eUG.finish(); } }
package com.dimple.common.exception; /** * @className DemoModeException * @description 演示模式异常 * @auther Dimple * @date 2019/3/13 * @Version 1.0 */ public class DemoModeException extends RuntimeException { private static final long serialVersionUID = 1L; public DemoModeException() { } }
package net.h2.web.mob.file.profile; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import net.h2.web.core.base.server.entity.BaseEntity; @Entity @Table(name = "MOB_PROFILE_FILE") public class ProfileUploadEntity extends BaseEntity<Long> { private String title; private String description; private Integer fileSize; private String fileExtension; private Date createdDate; private String filePath; @Override @Id @GeneratedValue public Long getId() { return super.getId(); } @Override public void setId(Long id) { super.setId(id); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Integer getFileSize() { return fileSize; } public void setFileSize(Integer fileSize) { this.fileSize = fileSize; } public String getFileExtension() { return fileExtension; } public void setFileExtension(String fileExtension) { this.fileExtension = fileExtension; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } }
package com.jayqqaa12.abase.util; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import com.jayqqaa12.abase.core.AbaseUtil; /** * 提供各种 系统 广播的 动态 注册 * * @author jayqqaa12 * @date 2013-5-15 */ public class ReceiverUtil extends AbaseUtil { public static BroadcastReceiver smsReceived(Context context, BroadcastReceiver receiver) { return registReceiver(context, receiver, "android.provider.Telephony.SMS_RECEIVED"); } public static BroadcastReceiver timeTick(Context context, BroadcastReceiver receiver) { return registReceiver(context, receiver, Intent.ACTION_TIME_TICK); } public static BroadcastReceiver packageRemoved(Context context, BroadcastReceiver receiver) { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.PACKAGE_REMOVED"); intentFilter.addDataScheme("package"); return registReceiver(context, receiver, intentFilter); } public static BroadcastReceiver packageAdded(Context context, BroadcastReceiver receiver) { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.ACTION_PACKAGE_ADDED"); intentFilter.addDataScheme("package"); return registReceiver(context, receiver, intentFilter); } public static BroadcastReceiver packageReplaced(Context context, BroadcastReceiver receiver) { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.ACTION_PACKAGE_REPLACED"); intentFilter.addDataScheme("package"); return registReceiver(context, receiver, intentFilter); } public static BroadcastReceiver registReceiver(Context context, BroadcastReceiver receiver, IntentFilter filter) { filter.setPriority(Integer.MAX_VALUE); context.registerReceiver(receiver, filter); return receiver; } public static BroadcastReceiver registReceiver(Context context, BroadcastReceiver receiver, String action) { IntentFilter filter = new IntentFilter(); filter.addAction(action); filter.setPriority(Integer.MAX_VALUE); context.registerReceiver(receiver, filter); return receiver; } }
package com.tencent.mm.plugin.profile.ui; import android.os.Message; import com.tencent.mm.aq.l; import com.tencent.mm.model.au; import com.tencent.mm.model.c; import com.tencent.mm.model.q; import com.tencent.mm.plugin.account.b; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.ui.r; class f$2 extends ag { final /* synthetic */ boolean hlD; final /* synthetic */ r hlE = null; f$2(boolean z) { this.hlD = z; } public final void handleMessage(Message message) { int i; int GQ = q.GQ(); if (this.hlD) { i = GQ & -8193; } else { i = GQ | 8192; } au.HU(); c.DT().set(34, Integer.valueOf(i)); au.HU(); c.FQ().b(new l("", "", "", "", "", "", "", "", i, "", "")); if (!this.hlD) { b.getFacebookFrdStg().Xw(); au.HU(); c.DT().set(65828, ""); au.HU(); c.FW().Yp("facebookapp"); au.HU(); c.FT().GK("facebookapp"); } if (this.hlE != null) { this.hlE.a(null, null); } } }
/** * ファイル名 : VSM11010XController.java * 作成者 : nv-manh * 作成日時 : 2018/05/31 * Copyright © 2017-2018 TAU Corporation. All Rights Reserved. */ package jp.co.tau.web7.admin.supplier.controllers; import java.awt.TrayIcon.MessageType; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import javax.persistence.RollbackException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import jp.co.tau.web7.admin.supplier.common.CommonConstants; import jp.co.tau.web7.admin.supplier.common.MessageConstants; import jp.co.tau.web7.admin.supplier.common.NumberingConstants; import jp.co.tau.web7.admin.supplier.common.ScreenConstants; import jp.co.tau.web7.admin.supplier.dto.BaseDTO; import jp.co.tau.web7.admin.supplier.dto.BidSuccessDTO; import jp.co.tau.web7.admin.supplier.dto.BidSuccessInfoDTO; import jp.co.tau.web7.admin.supplier.forms.VSM11010XForm; import jp.co.tau.web7.admin.supplier.output.VSM11010XOutput; import jp.co.tau.web7.admin.supplier.services.VSM11010XService; import jp.co.tau.web7.admin.supplier.vo.MessageVO; import jp.co.tau.web7.admin.supplier.vo.VSM11010XVO; /** * <p> * クラス名 : VSM11010XController * </p> * <p> * 説明 : 入札完了(強制流札)コントローラー * </p> * * @author nv-manh * @since 2018/05/31 */ @Controller public class VSM11010XController extends PaginationController { /** * 入札完了(強制流札)サービス */ @Autowired private VSM11010XService vsm11010XService; private static final String VSM11010X_FORM = "VSM11010XForm"; private static final String VSM11010XVO = "vsm11010XVO"; private static final String GET_DATA = ScreenConstants.VSM110101 + "/get-data"; /** * <p> * 説明 : 入札完了(強制流札)更新完了画面 初期表示処理 * </p> * * @author nv-manh * @since 2018/05/31 * @param mav ModelAndView * @return ModelAndView */ @PostMapping(ScreenConstants.VSM110103) public ModelAndView initUpdateDone(@ModelAttribute("VSM11010XForm") VSM11010XForm vsm11010XForm, BindingResult result) { ModelAndView modelAndView = createViewNameMaster(ScreenConstants.VSM110103); VSM11010XVO vsm11010XVO = new VSM11010XVO(); try { // Map data from form into dto if (vsm11010XForm.getDtoList() != null && vsm11010XForm.getDtoList().size() > 0) { // Validate input data validate(vsm11010XForm, result); if (result != null && result.hasErrors()) { setDataInitSearch(modelAndView, vsm11010XForm, new VSM11010XVO()); return modelAndView; } // Create user info dto BaseDTO userInfo = new BaseDTO(); copyCreateInfo(userInfo); // Update data VSM11010XOutput vsm11010XOutput = vsm11010XService.doUpdate(vsm11010XForm.getDtoList(), userInfo); if (vsm11010XOutput.getDtoList() == null || vsm11010XOutput.getDtoList().size() == 0) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), MessageConstants.MSG_1296)); } // Map data to screen control vsm11010XVO = modelMapper.map(vsm11010XOutput, VSM11010XVO.class); } setDataInitSearch(modelAndView, vsm11010XForm, vsm11010XVO); } catch (RollbackException e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), e.getMessage())); setDataInitSearch(modelAndView, vsm11010XForm, vsm11010XVO); } catch (Exception e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), MessageConstants.MSG_1296)); } return modelAndView; } /** * <p> * 説明 : 入札完了(強制流札)更新確認画面 確認処理 * </p> * * @author nv-manh * @since 2018/05/31 * @param mav ModelAndView * @return ModelAndView */ @PostMapping(ScreenConstants.VSM110102) public ModelAndView doUpdate(@ModelAttribute("VSM11010XForm") VSM11010XForm vsm11010XForm, BindingResult result) { ModelAndView modelAndView = createViewNameMaster(ScreenConstants.VSM110102); VSM11010XVO vsm11010XVO = new VSM11010XVO(); try { vsm11010XForm = (VSM11010XForm) jp.co.tau.web7.admin.supplier.utils.Utilities.trim(vsm11010XForm); // Map data from form into dto if (vsm11010XForm.getDtoList() != null && vsm11010XForm.getDtoList().size() > 0) { // Check selected record is exists List<BidSuccessInfoDTO> lsBidSuccessInfoDTO = vsm11010XForm.getDtoList().stream().filter(dto -> dto.getIsUpdate()).collect(Collectors.toList()); if (lsBidSuccessInfoDTO == null || lsBidSuccessInfoDTO.size() <= 0) { return modelAndView; } // Search data for update VSM11010XOutput vsm11010XOutput = vsm11010XService.doSearchForUpdate(vsm11010XForm.getDtoList()); // Check record count if (vsm11010XOutput.getDtoList() == null || vsm11010XOutput.getDtoList().size() <= 0) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), MessageConstants.NAA_E0045)); } // Map data to screen control vsm11010XVO = modelMapper.map(vsm11010XOutput, VSM11010XVO.class); } setDataInitSearch(modelAndView, vsm11010XForm, vsm11010XVO); } catch (RollbackException e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), e.getMessage())); setDataInitSearch(modelAndView, vsm11010XForm, new VSM11010XVO()); } catch (Exception e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), MessageConstants.MSG_1296)); } return modelAndView; } /** * <p> * 説明 : 入札完了(強制流札)検索画面 検索処理 * </p> * * @author nv-manh * @since 2018/05/31 * @param mav ModelAndView * @return ModelAndView */ @PostMapping(ScreenConstants.VSM110101) public ModelAndView doSearch(@ModelAttribute("VSM11010XFORM") VSM11010XForm vsm11010XForm, BindingResult result) { ModelAndView modelAndView = createViewNameMaster(ScreenConstants.VSM110101); VSM11010XVO vsm11010XVO = new VSM11010XVO(); try { // Validate input data validate(vsm11010XForm, result); if (result != null && result.hasErrors()) { setDataInitSearch(modelAndView, vsm11010XForm, vsm11010XVO); return modelAndView; } // Parse date time format DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); // If paging data, load paging data from session into current form vsm11010XForm = (VSM11010XForm) jp.co.tau.web7.admin.supplier.utils.Utilities.trim(vsm11010XForm); if (vsm11010XForm.isPaging()) { VSM11010XForm paySuccessSearchForm = (VSM11010XForm) getObjectFromSession(VSM11010X_FORM); copyPaginationSortData(vsm11010XForm, paySuccessSearchForm); } // Map data from form into search dto BidSuccessDTO bidSuccessDTO = new BidSuccessDTO(); bidSuccessDTO = modelMapper.map(vsm11010XForm, BidSuccessDTO.class); bidSuccessDTO.setAucPeriodTimeFrom(CommonConstants.EMPTY.equals(vsm11010XForm.getAucPeriodTimeFrom()) ? null : LocalDateTime.parse(vsm11010XForm.getAucPeriodTimeFrom() + " 00:00:00", formatter)); bidSuccessDTO.setAucPeriodTimeTo(CommonConstants.EMPTY.equals(vsm11010XForm.getAucPeriodTimeTo()) ? null : LocalDateTime.parse(vsm11010XForm.getAucPeriodTimeTo() + " 00:00:00", formatter)); // TODO set logged in user id into VSM11010XDTO BaseDTO baseDTO = new BaseDTO(); copyCreateInfo(baseDTO); bidSuccessDTO.setCreateUser(baseDTO.getCreateUser()); bidSuccessDTO.setUpdateUser(baseDTO.getUpdateUser()); // TODO set auc type cd bidSuccessDTO.setAucTypeCd(NumberingConstants.MEM_TYPE_CD_VSM); // Do search VSM11010XOutput vsm11010XOutput = vsm11010XService.doSearch(bidSuccessDTO); // Set pagination data setPaginationData(modelAndView, vsm11010XOutput.getPage(), vsm11010XOutput.getTotalRowCount()); addObjectToSession(VSM11010X_FORM, vsm11010XForm); vsm11010XVO = modelMapper.map(vsm11010XOutput, VSM11010XVO.class); vsm11010XVO.initHeader(); setDataInitSearch(modelAndView, vsm11010XForm, vsm11010XVO); } catch (RollbackException e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), e.getMessage())); setDataInitSearch(modelAndView, vsm11010XForm, vsm11010XVO); } catch (Exception e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), MessageConstants.MSG_1296)); modelAndView.addObject(VSM11010X_FORM, vsm11010XForm); } return modelAndView; } @RequestMapping(value = GET_DATA, method = RequestMethod.POST) @ResponseBody public Object getData(@RequestBody VSM11010XForm vsm11010XForm) { try { // Map data from form into search dto BidSuccessDTO bidSuccessDTO = new BidSuccessDTO(); bidSuccessDTO = modelMapper.map(vsm11010XForm, BidSuccessDTO.class); VSM11010XOutput output = vsm11010XService.doSearchStkInfo(bidSuccessDTO); return output; } catch (Exception e) { return MessageConstants.MSG_1296; } } /** * <p> * 説明 : 入札完了(強制流札)検索画面 初期表示処理 * </p> * * @author nv-manh * @since 2018/05/31 * @param mav ModelAndView * @return ModelAndView */ @GetMapping(ScreenConstants.VSM110101) public ModelAndView initSearch(@RequestParam(value = "isSearch", required = false, defaultValue = "false") Boolean isSearch) { ModelAndView modelAndView = createViewNameMaster(ScreenConstants.VSM110101); try { VSM11010XForm vsm11010XForm = (VSM11010XForm) getObjectFromSession(session, VSM11010X_FORM); if (!Objects.isNull(vsm11010XForm) || isSearch) { return doSearch(vsm11010XForm, null); } else { VSM11010XOutput vsm11010XOutput = new VSM11010XOutput(); VSM11010XVO vsm11010XVO = modelMapper.map(vsm11010XOutput, VSM11010XVO.class); vsm11010XVO.initHeader(); setDataInitSearch(modelAndView, vsm11010XForm, vsm11010XVO); addObjectToSession(CommonConstants.CURRENT_TAB, 1); } } catch (RollbackException e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), e.getMessage())); } catch (Exception e) { modelAndView.addObject(CommonConstants.MESSAGE, new MessageVO(MessageType.ERROR.toString(), MessageConstants.MSG_1296)); } return modelAndView; } @Override public String getTitle() { return "app.title"; } /** * <p>説明 : set data len view</p> * * @param modelAndView * @param vsm06010XForm * @param vsm06010XVO * */ private void setDataInitSearch(ModelAndView modelAndView, VSM11010XForm vsm11010XForm, VSM11010XVO vsm11010XVO) { vsm11010XForm = vsm11010XForm == null ? new VSM11010XForm() : vsm11010XForm; modelAndView.addObject(VSM11010X_FORM, vsm11010XForm); modelAndView.addObject(VSM11010XVO, vsm11010XVO); } }
package com.duanxr.yith.easy; /** * @author 段然 2021/9/23 */ public class PowerOfThree { /** * Given an integer n, return true if it is a power of three. Otherwise, return false. * * An integer n is a power of three, if there exists an integer x such that n == 3x. * *   * * Example 1: * * Input: n = 27 * Output: true * Example 2: * * Input: n = 0 * Output: false * Example 3: * * Input: n = 9 * Output: true * Example 4: * * Input: n = 45 * Output: false *   * * Constraints: * * -231 <= n <= 231 - 1 *   * * Follow up: Could you solve it without loops/recursion? * * 给定一个整数,写一个函数来判断它是否是 3 的幂次方。如果是,返回 true ;否则,返回 false 。 * * 整数 n 是 3 的幂次方需满足:存在整数 x 使得 n == 3x * *   * * 示例 1: * * 输入:n = 27 * 输出:true * 示例 2: * * 输入:n = 0 * 输出:false * 示例 3: * * 输入:n = 9 * 输出:true * 示例 4: * * 输入:n = 45 * 输出:false *   * * 提示: * * -231 <= n <= 231 - 1 *   * * 进阶: * * 你能不使用循环或者递归来完成本题吗? * */ class Solution { public boolean isPowerOfThree(int n) { if (n < 1) { return false; } while (n > 1) { if (n % 3 != 0) { return false; } n /= 3; } return true; } } }
package cn.canlnac.onlinecourse.domain; /** * 登录. */ public class Login { private int id; private String userStatus; private String nickname; private String gender; private String iconUrl; private long lockDate; private long lockEndDate; private String jwt; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUserStatus() { return userStatus; } public void setUserStatus(String userStatus) { this.userStatus = userStatus; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getIconUrl() { return iconUrl; } public void setIconUrl(String iconUrl) { this.iconUrl = iconUrl; } public long getLockDate() { return lockDate; } public void setLockDate(long lockDate) { this.lockDate = lockDate; } public long getLockEndDate() { return lockEndDate; } public void setLockEndDate(long lockEndDate) { this.lockEndDate = lockEndDate; } public String getJwt() { return jwt; } public void setJwt(String jwt) { this.jwt = jwt; } }
package com.company.SamouczekTasks; public class StringTest { public static void main(String[] args) { /* String aaa = "Coś trzeba napisać i już"; String kawa = new StringBuilder(aaa).append("Charlie").substring(10).substring(15, 20).concat("gizmo").toString(); System.out.println(kawa); System.out.println(kawa.length()); System.out.println(kawa.charAt(7)); System.out.println(kawa.indexOf("a")); String kawa1 = new String(aaa); String kawa2; String kawa3; kawa2 = kawa1.toUpperCase(); System.out.println(kawa2); kawa3 = kawa1.toLowerCase(); System.out.println(kawa2); System.out.println(kawa1.equals(kawa2)); System.out.println(kawa2.equalsIgnoreCase(kawa3)); System.out.println(kawa2.startsWith("C")); System.out.println(kawa2.endsWith("u")); System.out.println(kawa2.contains(aaa.toUpperCase())); String kawa4 ="\"pocałujcie misia w ogon\""; System.out.println(kawa1.replace(aaa,kawa4)); System.out.println(); }*/ /* String tekst = "Simon says: "; System.out.println(tekst.concat("złota rybka"));*/ /* int a = 2; String kazio = "Kazio Oczo Maniewski cesarza niebieski "; String mucha = new StringBuilder(kazio+a).toString(); System.out.println(mucha .trim() .toLowerCase() );*/ /* String gad; String nos; gad = "plusz"; nos = "koklusz"; String oj = new StringBuilder(gad).substring(1); String jo = new StringBuilder(nos).substring(1); System.out.println(oj.equals(jo)); }*/ /*String gad; String nos; gad = "plusz"; nos = "koklosz"; int a = gad.length(); int b = nos.length(); int c = a - 3; int d = b - 3; String oj = new StringBuilder(gad).substring(c, a); String jo = new StringBuilder(nos).substring(d, b); System.out.println(oj.equals(jo)); }*/ String inputTex = "Niewiarygodnie cierpliwy niecierpek"; boolean a = checkNie(inputTex); System.out.println("W podanym tekście są minimum 3 wystapienia słowa 'nie'- " + a); } public static boolean checkNie(String textToCheck) { String phraseToSearch = "nie"; int index1 = textToCheck.toLowerCase().indexOf(phraseToSearch, 0); if (index1 == -1) { return false; } int index2 = textToCheck.toLowerCase().indexOf(phraseToSearch, ++index1); if (index2 == -1) { return false; } int index3 = textToCheck.toLowerCase().indexOf(phraseToSearch, ++index2); if (index3 == -1) { return false; } else return true; } }
package com.example.todolist.AddGroups; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ProgressBar; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.example.todolist.Di.ViewModelFactory; import com.example.todolist.Main.Today.TodayGroupsAdapter; import com.example.todolist.Model.Entities.Groups; import com.example.todolist.Model.Entities.Icons; import com.example.todolist.Model.Repositories.GroupsRepository; import com.example.todolist.R; import com.example.todolist.entry.EntryActivity; import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.util.List; import javax.inject.Inject; import dagger.android.AndroidInjection; import io.reactivex.CompletableObserver; import io.reactivex.SingleObserver; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.annotations.NonNull; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; public class AddGroupActivity extends AppCompatActivity implements IconListAdapter.OnItemClicked { private RecyclerView recyclerView; private IconListAdapter iconListAdapter; private EditText ed_label; private ExtendedFloatingActionButton extended_fab; private RadioGroup radioGroup; private RadioButton radioButton; private int icon = 0; private String category; private CompositeDisposable compositeDisposable = new CompositeDisposable(); private AddGroupViewModel addGroupViewModel; private ProgressBar progress_circular; private ImageButton ib_back; @Inject public GroupsRepository groupsRepository; @Inject public ViewModelFactory viewModelFactory_new; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_task_group); AndroidInjection.inject(this); initialize(); showList(); } private void initialize() { recyclerView = findViewById(R.id.iconList); ed_label = findViewById(R.id.ed_label); extended_fab = findViewById(R.id.extended_fab); progress_circular = findViewById(R.id.progress_circular); ib_back = findViewById(R.id.ib_back); radioGroup = findViewById(R.id.radioGroup); radioGroup.setOnCheckedChangeListener((group, checkedId) -> { radioButton = (RadioButton) findViewById(checkedId); category = radioButton.getText().toString(); } ); ib_back.setOnClickListener(v -> { finish(); }); extended_fab.setOnClickListener(v -> { if (icon != 0 && ed_label.getText().length() > 0 && category != null) { progress_circular.setVisibility(View.VISIBLE); saveGroup(category); } else { Toast.makeText(getApplicationContext(), "Please enter the requested information", Toast.LENGTH_LONG).show(); } }); } private void showList() { String result = getResources().getString(R.string.icon); java.util.List<Icons> icons = new Gson().fromJson(result, new TypeToken<List<Icons>>() { }.getType()); // recyclerView.setLayoutManager(new LinearLayoutManager(AddTaskGroupActivity.this, RecyclerView.VERTICAL, false)); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(AddGroupActivity.this, 5); recyclerView.setLayoutManager(mLayoutManager); iconListAdapter = new IconListAdapter(icons); recyclerView.setAdapter(iconListAdapter); iconListAdapter.setOnClick(this); } private boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected(); } private void saveGroup(String cat) { Groups groups = new Groups(icon, ed_label.getText().toString(), cat, false, false, false, 0, 0); // viewModelFactory = new AddTaskGroupViewModelFactory(groupsRepository); addGroupViewModel = new ViewModelProvider(this, viewModelFactory_new).get(AddGroupViewModel.class); // addGroupViewModel.getTasksTest().observe(this, t -> { // // Toast.makeText(this, String.valueOf(t.size()), Toast.LENGTH_LONG).show(); // // }); addGroupViewModel.saveGroup(groups) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new CompletableObserver() { @Override public void onSubscribe(Disposable d) { // disposable = d; compositeDisposable.add(d); } @Override public void onComplete() { // if (isNetworkConnected()) { // getLastGroup(); // } else { // progress_circular.setVisibility(View.GONE); // Toast.makeText(getApplicationContext(), "Insert Successfully, You Can Sync Later", Toast.LENGTH_LONG).show(); // finish(); // } checkInternet(); } @Override public void onError(Throwable e) { progress_circular.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Insert Failed!!!", Toast.LENGTH_LONG).show(); } }); } private void getLastGroup() { addGroupViewModel.getLastGroup() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SingleObserver<Groups>() { @Override public void onSubscribe(Disposable d) { compositeDisposable.add(d); } @Override public void onSuccess(Groups groups) { syncGroup(groups); } @Override public void onError(Throwable e) { progress_circular.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Insert Successfully, You Can Sync Later", Toast.LENGTH_LONG).show(); finish(); } }); } private void syncGroup(Groups groups) { addGroupViewModel.syncGroup(groups) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new CompletableObserver() { @Override public void onSubscribe(Disposable d) { compositeDisposable.add(d); } @Override public void onComplete() { // progress_circular.setVisibility(View.GONE); // Toast.makeText(getApplicationContext(), "Insert Successfully, Sync Successfully", Toast.LENGTH_LONG).show(); // finish(); updateSyncedGroup(groups); } @Override public void onError(Throwable e) { progress_circular.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Insert Successfully, You Can Sync Later", Toast.LENGTH_LONG).show(); finish(); } }); } private void updateSyncedGroup(Groups groups){ Groups groups1 = new Groups(groups.getId(), groups.getIcon(), groups.getLabel(), groups.getCategory(), true, false, false, 0, 0); addGroupViewModel.updateGroup(groups1) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new CompletableObserver() { @Override public void onSubscribe(@NonNull Disposable d) { compositeDisposable.add(d); } @Override public void onComplete() { progress_circular.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Insert Successfully, Sync Successfully", Toast.LENGTH_LONG).show(); finish(); } @Override public void onError(@NonNull Throwable e) { progress_circular.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Insert Successfully, You Can Sync Later", Toast.LENGTH_LONG).show(); finish(); } }); } private void checkInternet() { addGroupViewModel.isInternetWorking().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<Boolean>() { @Override public void onSubscribe(@NonNull Disposable d) { compositeDisposable.add(d); } @Override public void onSuccess(@NonNull Boolean aBoolean) { getLastGroup(); } @Override public void onError(@NonNull Throwable e) { progress_circular.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Insert Successfully, You Can Sync Later", Toast.LENGTH_LONG).show(); finish(); } }); } @Override public void onItemClick(int id) { icon = id; } @Override protected void onDestroy() { super.onDestroy(); compositeDisposable.dispose(); } }
/* * Copyright 2017 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 io.r2dbc.postgresql.message.backend; import io.netty.buffer.ByteBuf; import io.netty.util.ReferenceCountUtil; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.ObjectAssert; import org.springframework.util.ReflectionUtils; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Function; import static io.r2dbc.postgresql.util.TestByteBufAllocator.TEST; /** * Assertions for {@link BackendMessage}. */ final class BackendMessageAssert extends AbstractObjectAssert<BackendMessageAssert, Class<? extends BackendMessage>> { private Cleaner cleaner = new Cleaner(); private BackendMessageAssert(Class<? extends BackendMessage> actual) { super(actual, BackendMessageAssert.class); } static BackendMessageAssert assertThat(Class<? extends BackendMessage> actual) { return new BackendMessageAssert(actual); } BackendMessageAssert cleaner(Cleaner cleaner) { this.cleaner = cleaner; return this; } @SuppressWarnings("unchecked") <T extends BackendMessage> ObjectAssert<T> decoded(Function<ByteBuf, ByteBuf> decoded) { Method method = ReflectionUtils.findMethod(this.actual, "decode", ByteBuf.class); if (Objects.isNull(method)) { failWithMessage("Expected %s to have a decode(ByteBuf) method but does not", this.actual); } ReflectionUtils.makeAccessible(method); T actual = (T) ReflectionUtils.invokeMethod(method, null, decoded.apply(TEST.buffer())); return new ObjectAssert<>(this.cleaner.capture(actual)); } public Cleaner cleaner() { return this.cleaner; } static class Cleaner { private final List<Object> objects = new ArrayList<>(); public void clean() { this.objects.forEach(ReferenceCountUtil::release); this.objects.clear(); } public <T> T capture(T object) { this.objects.add(object); return object; } } }
package sample; import javafx.fxml.FXML; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.VPos; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; public class MoviesController { @FXML private ImageView pic; @FXML public Button backButton; @FXML private GridPane grid; @FXML private Image image; int counter = 0; ArrayList<File> fileList = new ArrayList<File>(); HBox hb = new HBox(); public void loadElements() throws UnsupportedEncodingException { String path = URLDecoder.decode("scr/Icons/img2.png","UTF-8"); grid.setPadding(new Insets(7,7,7,7)); grid.setHgap(10); grid.setVgap(10); try { String sql = "select * from games"; Connection conn = DBConnector.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); System.out.println("connected to database"); while (rs.next()) { counter=+1; System.out.println("trying"+counter); } rs.close(); stmt.close(); conn.close(); System.out.println("connection closed"); } catch (SQLException throwables) { throwables.printStackTrace(); } int rows = (counter / 4) + 1; int columns = 4; int index = 1; pic = new ImageView(); pic.setFitWidth(160); pic.setFitHeight(220); //image = new Image(String.valueOf(folder)); pic.setImage(image); pic.setId("4"); hb.getChildren().add(pic); GridPane.setConstraints(pic, 1, 1, 1, 1, HPos.CENTER, VPos.CENTER); grid.getChildren().addAll(pic); pic.setOnMouseClicked(e -> { System.out.println("it worked"); }); } }
package android.spvct.itu.dk.awphoneapp.Sensors; import android.util.Log; import org.altbeacon.beacon.MonitorNotifier; import org.altbeacon.beacon.Region; public class BeaconMonitorListener implements MonitorNotifier { protected static final String TAG = "test"; @Override public void didEnterRegion(Region region) { Log.i(TAG, "Monitor -> I just saw an beacon for the first time!"); } @Override public void didExitRegion(Region region) { Log.i(TAG, "Monitor -> I no longer see an beacon"); } @Override public void didDetermineStateForRegion(int state, Region region) { Log.i(TAG, "Monitor -> I have just switched from seeing/not seeing beacons: " + state); } }
package com.mysql.cj.protocol.a.authentication; import com.mysql.cj.Messages; import com.mysql.cj.conf.PropertyKey; import com.mysql.cj.conf.PropertySet; import com.mysql.cj.conf.RuntimeProperty; import com.mysql.cj.exceptions.CJException; import com.mysql.cj.exceptions.ExceptionFactory; import com.mysql.cj.exceptions.ExceptionInterceptor; import com.mysql.cj.exceptions.UnableToConnectException; import com.mysql.cj.exceptions.WrongArgumentException; import com.mysql.cj.protocol.AuthenticationPlugin; import com.mysql.cj.protocol.ExportControlled; import com.mysql.cj.protocol.Message; import com.mysql.cj.protocol.Protocol; import com.mysql.cj.protocol.Security; import com.mysql.cj.protocol.a.NativeConstants; import com.mysql.cj.protocol.a.NativePacketPayload; import com.mysql.cj.util.StringUtils; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.List; public class Sha256PasswordPlugin implements AuthenticationPlugin<NativePacketPayload> { public static String PLUGIN_NAME = "sha256_password"; protected Protocol<NativePacketPayload> protocol; protected String password = null; protected String seed = null; protected boolean publicKeyRequested = false; protected String publicKeyString = null; protected RuntimeProperty<String> serverRSAPublicKeyFile = null; public void init(Protocol<NativePacketPayload> prot) { this.protocol = prot; this.serverRSAPublicKeyFile = this.protocol.getPropertySet().getStringProperty(PropertyKey.serverRSAPublicKeyFile); String pkURL = (String)this.serverRSAPublicKeyFile.getValue(); if (pkURL != null) this.publicKeyString = readRSAKey(pkURL, this.protocol.getPropertySet(), this.protocol.getExceptionInterceptor()); } public void destroy() { this.password = null; this.seed = null; this.publicKeyRequested = false; } public String getProtocolPluginName() { return PLUGIN_NAME; } public boolean requiresConfidentiality() { return false; } public boolean isReusable() { return true; } public void setAuthenticationParameters(String user, String password) { this.password = password; } public boolean nextAuthenticationStep(NativePacketPayload fromServer, List<NativePacketPayload> toServer) { toServer.clear(); if (this.password == null || this.password.length() == 0 || fromServer == null) { NativePacketPayload bresp = new NativePacketPayload(new byte[] { 0 }); toServer.add(bresp); } else { try { if (this.protocol.getSocketConnection().isSSLEstablished()) { NativePacketPayload bresp = new NativePacketPayload(StringUtils.getBytes(this.password, this.protocol.getPasswordCharacterEncoding())); bresp.setPosition(bresp.getPayloadLength()); bresp.writeInteger(NativeConstants.IntegerDataType.INT1, 0L); bresp.setPosition(0); toServer.add(bresp); } else if (this.serverRSAPublicKeyFile.getValue() != null) { this.seed = fromServer.readString(NativeConstants.StringSelfDataType.STRING_TERM, null); NativePacketPayload bresp = new NativePacketPayload(encryptPassword()); toServer.add(bresp); } else { if (!((Boolean)this.protocol.getPropertySet().getBooleanProperty(PropertyKey.allowPublicKeyRetrieval).getValue()).booleanValue()) throw (UnableToConnectException)ExceptionFactory.createException(UnableToConnectException.class, Messages.getString("Sha256PasswordPlugin.2"), this.protocol .getExceptionInterceptor()); if (this.publicKeyRequested && fromServer.getPayloadLength() > 20) { this.publicKeyString = fromServer.readString(NativeConstants.StringSelfDataType.STRING_TERM, null); NativePacketPayload bresp = new NativePacketPayload(encryptPassword()); toServer.add(bresp); this.publicKeyRequested = false; } else { this.seed = fromServer.readString(NativeConstants.StringSelfDataType.STRING_TERM, null); NativePacketPayload bresp = new NativePacketPayload(new byte[] { 1 }); toServer.add(bresp); this.publicKeyRequested = true; } } } catch (CJException e) { throw ExceptionFactory.createException(e.getMessage(), e, this.protocol.getExceptionInterceptor()); } } return true; } protected byte[] encryptPassword() { return encryptPassword("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"); } protected byte[] encryptPassword(String transformation) { byte[] input = null; (new byte[1])[0] = 0; input = (this.password != null) ? StringUtils.getBytesNullTerminated(this.password, this.protocol.getPasswordCharacterEncoding()) : new byte[1]; byte[] mysqlScrambleBuff = new byte[input.length]; Security.xorString(input, mysqlScrambleBuff, this.seed.getBytes(), input.length); return ExportControlled.encryptWithRSAPublicKey(mysqlScrambleBuff, ExportControlled.decodeRSAPublicKey(this.publicKeyString), transformation); } protected static String readRSAKey(String pkPath, PropertySet propertySet, ExceptionInterceptor exceptionInterceptor) { String res = null; byte[] fileBuf = new byte[2048]; BufferedInputStream fileIn = null; try { File f = new File(pkPath); String canonicalPath = f.getCanonicalPath(); fileIn = new BufferedInputStream(new FileInputStream(canonicalPath)); int bytesRead = 0; StringBuilder sb = new StringBuilder(); while ((bytesRead = fileIn.read(fileBuf)) != -1) sb.append(StringUtils.toAsciiString(fileBuf, 0, bytesRead)); res = sb.toString(); } catch (IOException ioEx) { (new Object[1])[0] = ""; (new Object[1])[0] = "'" + pkPath + "'"; throw (WrongArgumentException)ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("Sha256PasswordPlugin.0", ((Boolean)propertySet.getBooleanProperty(PropertyKey.paranoid).getValue()).booleanValue() ? new Object[1] : new Object[1]), exceptionInterceptor); } finally { if (fileIn != null) try { fileIn.close(); } catch (IOException e) { throw ExceptionFactory.createException(Messages.getString("Sha256PasswordPlugin.1"), e, exceptionInterceptor); } } return res; } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\com\mysql\cj\protocol\a\authentication\Sha256PasswordPlugin.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package com.packers.movers.commons.contracts; import java.time.Instant; public class TimestampContract extends ContractBase { private String timestamp; public TimestampContract() { this.timestamp = Instant.now().toString(); } public TimestampContract(Instant timestamp) { this.timestamp = timestamp.toString(); } public String getTimestamp() { return timestamp; } public Instant toInstant() { return Instant.parse(timestamp); } }
package org.terasoluna.gfw.examples.pagination.app; import java.io.Serializable; import java.util.Date; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.springframework.format.annotation.DateTimeFormat; import org.terasoluna.gfw.common.codelist.ExistInCodeList; public class SearchForm implements Serializable { private static final long serialVersionUID = 1L; @NotNull @Size(min = 1, max = 30) private String title; @DateTimeFormat(pattern = "yyyyMMdd") private Date publishedDate; @ExistInCodeList(codeListId = "CL_ARTICLE_SEARCH_MAX_DISPLAY_NUMBER") private String size; @ExistInCodeList(codeListId = "CL_ARTICLE_SEARCH_DEFAULT_SORT") private String sort; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Date getPublishedDate() { return publishedDate; } public void setPublishedDate(Date publishedDate) { this.publishedDate = publishedDate; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public String getSort() { return sort; } public void setSort(String sort) { this.sort = sort; } }
package com.rxc.service; import com.rxc.dao.UserRepository; import com.rxc.domain.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.stereotype.Service; @Service("userService") public class UserService { @Autowired UserRepository userRepository; }
package com.ryl.framework.base; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletResponse; @ControllerAdvice public class ExceptionController { private static final Logger log = LoggerFactory.getLogger(ExceptionController.class); @ResponseBody @ExceptionHandler(value = Exception.class) public ResultModel handleException(HttpServletResponse resp, Exception e) { resp.setStatus(HttpStatus.BAD_REQUEST.value()); log.error(String.format("handleException(HttpServletRequest, HttpServletResponse, Exception) - %s", e.getMessage()), e); if (e instanceof ServiceException) { ServiceException se = (ServiceException) e; return ResultModel.fail(se.getErrorCode(),se.getErrorMessage()); } else { //未捕捉的内部服务异常 String name = Thread.currentThread().getName(); log.debug(String.format("当前线程: %s,异常具体类容为:", name, e.getMessage())); StackTraceElement[] stackTrace = e.getStackTrace(); for (StackTraceElement stackTraceElement : stackTrace) { String threadName = stackTraceElement.getClass().getName(); log.debug(String.format("具体异常跟踪:%s", threadName)); } log.warn(String.format("uncaught internal server exception, msg: %s", e.getMessage()), e); return ResultModel.fail(ResultStatus.INTERNAL_SERVER_ERROR); } } }
package com.example.tris_meneghetti; import android.view.View; public interface IplayerVS { int onButtonClick(View view, Design[][] grigliaPulsanti, boolean turnoX, String[][] griglia, int pareggio); }
package com.gtfs.dao.impl; import java.io.Serializable; import java.util.Date; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.criterion.ProjectionList; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; import org.hibernate.transform.Transformers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.gtfs.dao.ProjectMilestoneDao; import com.gtfs.dto.ProjectMilestoneDto; import com.gtfs.pojo.FlatInvoiceCombo; import com.gtfs.pojo.FlatPaySchd; import com.gtfs.pojo.ProjectMilestone; import com.gtfs.pojo.ProjectMst; @Repository public class ProjectMilestoneDaoImpl implements ProjectMilestoneDao,Serializable { private Logger log = Logger.getLogger(ProjectMilestoneDaoImpl.class); @Autowired private SessionFactory sessionFactory; @Override public List<ProjectMilestoneDto> findAll() { Session session = null; List<ProjectMilestoneDto> list = null; try { session = sessionFactory.openSession(); Criteria criteria = session.createCriteria(ProjectMilestone.class); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("id"),"id"); projectionList.add(Projections.property("projectMst.id"), "projectMst"); projectionList.add(Projections.property("milestoneSrlNo"), "milestoneSrlNo"); projectionList.add(Projections.property("milestoneDesc"), "milestoneDesc"); projectionList.add(Projections.property("milestoneScope"), "milestoneScope"); projectionList.add(Projections.property("milestoneStatus"), "milestoneStatus"); projectionList.add(Projections.property("paymentPerc"), "paymentPerc"); projectionList.add(Projections.property("createdBy"), "createdBy"); projectionList.add(Projections.property("modifiedBy"), "modifiedBy"); projectionList.add(Projections.property("deletedBy"), "deletedBy"); projectionList.add(Projections.property("createdDate"), "createdDate"); projectionList.add(Projections.property("modifiedDate"), "modifiedDate"); projectionList.add(Projections.property("deletedDate"), "deletedDate"); projectionList.add(Projections.property("deleteFlag"), "deleteFlag"); criteria.setProjection(projectionList); criteria.add(Restrictions.eq("deleteFlag", "N")); criteria.setResultTransformer(Transformers.aliasToBean(ProjectMilestoneDto.class)); list = criteria.list(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } return list; } @Override public ProjectMilestone findById(Long id) { Session session = null; ProjectMilestone projectMilestone = null; try { session = sessionFactory.openSession(); projectMilestone = (ProjectMilestone) session.get(ProjectMilestone.class, id); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } return projectMilestone; } @Override public List<ProjectMilestoneDto> findByProjectId(Long projectId) { Session session = null; List<ProjectMilestoneDto> list = null; try { session = sessionFactory.openSession(); Criteria criteria = session.createCriteria(ProjectMilestone.class); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("id"),"id"); projectionList.add(Projections.property("projectMst.id"), "projectMst"); projectionList.add(Projections.property("milestoneSrlNo"), "milestoneSrlNo"); projectionList.add(Projections.property("milestoneDesc"), "milestoneDesc"); projectionList.add(Projections.property("milestoneScope"), "milestoneScope"); projectionList.add(Projections.property("milestoneStatus"), "milestoneStatus"); projectionList.add(Projections.property("paymentPerc"), "paymentPerc"); projectionList.add(Projections.property("createdBy"), "createdBy"); projectionList.add(Projections.property("modifiedBy"), "modifiedBy"); projectionList.add(Projections.property("deletedBy"), "deletedBy"); projectionList.add(Projections.property("createdDate"), "createdDate"); projectionList.add(Projections.property("modifiedDate"), "modifiedDate"); projectionList.add(Projections.property("deletedDate"), "deletedDate"); projectionList.add(Projections.property("deleteFlag"), "deleteFlag"); criteria.setProjection(projectionList); criteria.add(Restrictions.eq("deleteFlag", "N")); criteria.add(Restrictions.eq("projectMst.id", projectId)); criteria.setResultTransformer(Transformers.aliasToBean(ProjectMilestoneDto.class)); list = criteria.list(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } return list; } @Override public List<ProjectMilestoneDto> findFlatSpecificByProjectId(Long projectId) { Session session = null; List<ProjectMilestoneDto> list = null; try { session = sessionFactory.openSession(); Criteria criteria = session.createCriteria(ProjectMilestone.class); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("id"),"id"); projectionList.add(Projections.property("projectMst.id"), "projectMst"); projectionList.add(Projections.property("milestoneSrlNo"), "milestoneSrlNo"); projectionList.add(Projections.property("milestoneDesc"), "milestoneDesc"); projectionList.add(Projections.property("milestoneScope"), "milestoneScope"); projectionList.add(Projections.property("milestoneStatus"), "milestoneStatus"); projectionList.add(Projections.property("paymentPerc"), "paymentPerc"); projectionList.add(Projections.property("createdBy"), "createdBy"); projectionList.add(Projections.property("modifiedBy"), "modifiedBy"); projectionList.add(Projections.property("deletedBy"), "deletedBy"); projectionList.add(Projections.property("createdDate"), "createdDate"); projectionList.add(Projections.property("modifiedDate"), "modifiedDate"); projectionList.add(Projections.property("deletedDate"), "deletedDate"); projectionList.add(Projections.property("deleteFlag"), "deleteFlag"); criteria.setProjection(projectionList); criteria.add(Restrictions.eq("deleteFlag", "N")); criteria.add(Restrictions.eq("projectMst.id", projectId)); criteria.add(Restrictions.eq("milestoneScope", "F")); criteria.setResultTransformer(Transformers.aliasToBean(ProjectMilestoneDto.class)); list = criteria.list(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } return list; } @Override public List<ProjectMilestoneDto> findNextProjectSpcMilstoneByProjectId(Long projectId) { Session session = null; List<ProjectMilestoneDto> list = null; try { session = sessionFactory.openSession(); ProjectMst projectMst = (ProjectMst) session.load(ProjectMst.class, projectId); System.out.println("xxxxxxxxxxxxxx "+projectMst.getMilestoneCompltd()); Criteria criteria = session.createCriteria(ProjectMilestone.class); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("id"),"id"); projectionList.add(Projections.property("projectMst.id"), "projectMst"); projectionList.add(Projections.property("milestoneSrlNo"), "milestoneSrlNo"); projectionList.add(Projections.property("milestoneDesc"), "milestoneDesc"); projectionList.add(Projections.property("milestoneScope"), "milestoneScope"); projectionList.add(Projections.property("milestoneStatus"), "milestoneStatus"); projectionList.add(Projections.property("paymentPerc"), "paymentPerc"); projectionList.add(Projections.property("createdBy"), "createdBy"); projectionList.add(Projections.property("modifiedBy"), "modifiedBy"); projectionList.add(Projections.property("deletedBy"), "deletedBy"); projectionList.add(Projections.property("createdDate"), "createdDate"); projectionList.add(Projections.property("modifiedDate"), "modifiedDate"); projectionList.add(Projections.property("deletedDate"), "deletedDate"); projectionList.add(Projections.property("deleteFlag"), "deleteFlag"); criteria.setProjection(projectionList); criteria.add(Restrictions.eq("deleteFlag", "N")); criteria.add(Restrictions.eq("projectMst.id", projectId)); if(projectMst.getMilestoneCompltd() == null || projectMst.getMilestoneCompltd()<3){ criteria.add(Restrictions.eq("milestoneSrlNo", 3l)); }else{ criteria.add(Restrictions.eq("milestoneSrlNo", ((long)(projectMst.getMilestoneCompltd()+1)))); } criteria.setResultTransformer(Transformers.aliasToBean(ProjectMilestoneDto.class)); list = criteria.list(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } return list; } @Override public String updateProjectMilestone(Long projectId, Long milestoneId, Date dateGiven) { Session session = null; String status = null; Transaction tx = null; try{ session = sessionFactory.openSession(); tx = session.beginTransaction(); Query projMil = session.createQuery("FROM ProjectMilestone WHERE milestoneSrlNo = :milestoneSrlNo AND projectMst.id = :projectId AND deleteFlag = :deleteFlag"); projMil.setParameter("milestoneSrlNo", milestoneId); projMil.setParameter("projectId", projectId); projMil.setParameter("deleteFlag", "N"); List<ProjectMilestone> projMilList = projMil.list(); /* Update FLAT_PAY_SCHD */ Query query1 = session.createQuery("UPDATE FlatPaySchd SET " + "dueDate = :dueDate " + "WHERE " + "projectMilestone.id = :milestoneId " + "and deleteFlag = :deleteFlag " + "and customerMst is not null " + "and dueDate is null"); query1.setParameter("dueDate", dateGiven); query1.setParameter("milestoneId", projMilList.get(0).getId()); query1.setParameter("deleteFlag", "N"); query1.executeUpdate(); /* Update PROJECT_MST */ Query query2 = session.createQuery("UPDATE ProjectMst SET " + "milestoneCompltd = :milestoneCompltd " + "WHERE " + "id = :projectMstId " + "and deleteFlag = :deleteFlag"); query2.setParameter("milestoneCompltd", milestoneId.intValue()); query2.setParameter("projectMstId", projectId); query2.setParameter("deleteFlag", "N"); query2.executeUpdate(); /* Insert Into FLAT_INVOICE_COMBO */ Query query3 = session.createQuery("FROM FlatPaySchd WHERE projectMilestone.id = :projectMilestoneId " + "and deleteFlag = :deleteFlag and customerMst is not null and dueDate is null"); query3.setParameter("projectMilestoneId", projMilList.get(0).getId()); query3.setParameter("deleteFlag", "N"); List<FlatPaySchd> list = query3.list(); /* Insert Into FLAT_INVOICE_COMBO*/ int count=1; for(FlatPaySchd flatPaySchd : list){ FlatInvoiceCombo flatInvoiceCombo = new FlatInvoiceCombo(); flatInvoiceCombo.setFlatPaySchd(flatPaySchd); flatInvoiceCombo.setInvoiceNo("Inv" + new Date().getTime() + flatPaySchd.getId()); flatInvoiceCombo.setInvoiceDate(new Date()); flatInvoiceCombo.setCreatedDate(new Date()); flatInvoiceCombo.setDeleteFlag("N"); session.save(flatInvoiceCombo); if( count % 50 == 0 ) { session.flush(); session.clear(); } count++; } tx.commit(); status = "true"; }catch(Exception e){ status = "false"; log.info("Error : ", e); } return status; } }
import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import javax.swing.JOptionPane; /** * Our "Copy" action. */ public class CopyAction extends AbstractAction { public CopyAction(String name, ImageIcon icon, String shortDescription, Integer mnemonic) { super(name, icon); putValue(SHORT_DESCRIPTION, shortDescription); putValue(MNEMONIC_KEY, mnemonic); } public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Would have done the 'Copy' action."); } public static CopyAction copyActionFactory() { return new CopyAction("Copy", null, "Copy stuff to the clipboard", new Integer(KeyEvent.VK_COPY)); } }
package me.jessepayne.pad4j.visualizer.swing.theme; import java.awt.*; import java.util.ArrayList; import java.util.TimerTask; public class ThemeChangeTask extends TimerTask { private ThemeManager themeManager; private LPTheme startTheme; private LPTheme endTheme; private ArrayList<LPTheme> steps; private Runnable endTask; private int stepCount; private int curStep = 1; public ThemeChangeTask(ThemeManager themeManager, int stepCount, LPTheme startTheme, LPTheme endTheme){ this.themeManager = themeManager; this.stepCount = stepCount; this.startTheme = startTheme; this.endTheme = endTheme; setup(); } public void setup(){ System.out.println("---"); steps = new ArrayList<>(); ArrayList<Color> backgroundsColors = generateColors(startTheme.getBackgroundColor(), endTheme.getBackgroundColor()); ArrayList<Color> accentColors = generateColors(startTheme.getAccentColor(), endTheme.getAccentColor()); for(int i = 0; i < backgroundsColors.size() - 1; i++){ steps.add(new LPTheme(backgroundsColors.get(i), accentColors.get(i))); } } @Override public void run() { if(curStep >= stepCount){ cancel(); themeManager.setIsFading(false); if(endTask != null){ endTask.run(); }else{ themeManager.setTheme(endTheme); } return; } /*Color bc = endTheme.getBackgroundColor(); Color lc = steps.get(curStep-1).getBackgroundColor(); int avgBC = ((bc.getRed() + bc.getGreen() + bc.getBlue()) / 3); int avgLC = ((lc.getRed() + lc.getGreen() + lc.getBlue())/3); int avg = Math.max(avgBC, avgLC) - Math.min(avgBC, avgLC); System.out.println(avg + " avg units from final color.");*/ themeManager.setTheme(steps.get(curStep - 1)); curStep++; } public ArrayList<Color> generateColors(Color oldColor, Color newColor){ ArrayList<Color> colors = new ArrayList<>(); colors.add(oldColor); // cF = c0 + (c1-c0) * ratio; for(int i = 0; i <= stepCount; i++){ double ratio = (1.0/stepCount)*i; int r = (int)Math.abs((ratio * newColor.getRed()) + ((1 - ratio) * oldColor.getRed())); int g = (int)Math.abs((ratio * newColor.getGreen()) + ((1 - ratio) * oldColor.getGreen())); int b = (int)Math.abs((ratio * newColor.getBlue()) + ((1 - ratio) * oldColor.getBlue())); //System.out.println("(" + r + ", " + g + ", " + b + ") (" + Math.round(ratio * 100) + "% complete.)"); colors.add(new Color(r,g,b)); } return colors; } public void setEndTask(Runnable endTask){ this.endTask = endTask; } public ArrayList<LPTheme> getSteps(){ return steps; } }
package com.stark.netty.section_2.charpter_2_3; import com.stark.netty.section_2.charpter_2_1.TimeServerHandler; /** * Created by Stark on 2018/3/1. * NIO时间服务器客户端 */ public class TimeClient { public static void main(String[] args) { int port = 8080; new Thread(new TimeClientHandler(port)).start(); } }
package br.com.alura.livrariaAPI.dto; import br.com.alura.livrariaAPI.modelo.Autor; import lombok.Getter; import lombok.Setter; @Getter @Setter public class LivroDto { private String titulo; private AutorDto autor; private int numeroDePaginas; }
package com.appc.report.service; import com.appc.report.model.CommonRegion; /** * CommonRegionService * * @version : Ver 1.0 * @author : panda * @date : 2017-9-14 */ public interface CommonRegionService extends CommonService<CommonRegion>{ void save(CommonRegion commonRegion); }
/* * 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 classes; import javax.swing.JOptionPane; /** * * @author Mateus Bernini */ public abstract class ContaBancaria { protected int numConta; protected double saldo; public ContaBancaria() { } public ContaBancaria(int numConta, double saldo) { this.numConta = numConta; this.saldo = saldo; } public double getNumConta() { return numConta; } public void setNumConta(int numConta) { this.numConta = numConta; } public double getSaldo() { return saldo; } public void setSaldo(double saldo) { this.saldo = saldo; } public abstract boolean sacar(double saque); public abstract boolean depositar(double deposito); public void Mostrar() { JOptionPane.showMessageDialog(null, "Número da conta: " + this.numConta + "\n Saldo: " + this.saldo); } public boolean transferir(double valor, ContaBancaria cb) { if (this.sacar(valor)) { cb.depositar(valor); return true; } return false; } }
package com.example.Journal.UI; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.*; import com.example.Journal.R; import com.example.Journal.db.DBAdapter; import com.example.Journal.provider.Group; import com.example.Journal.util.MyLog; import java.util.Calendar; import java.util.Locale; /** * Created with IntelliJ IDEA. * User: Andrey * Date: 4/16/13 * Time: 1:10 AM * To change this template use File | Settings | File Templates. */ public class ActivityAddStudent extends Activity implements View.OnClickListener { private static final int IDD_DATE = 300; private Button back,save; private EditText first,last,patronymic,tel,email,note; private Spinner choseGroup; private TextView dataBirthday; DBAdapter dbAdapter; private int mYear; private int mMonth; private int mDay; public void onCreate(Bundle savedInstanceState) { setTheme(android.R.style.Theme_Light); super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_student); //extract data Bundle extra=getIntent().getExtras(); int id_group_sel= extra.getInt(Group.ID_GROUP); int selected=-1; first=(EditText)findViewById(R.id.etFirstName); last=(EditText)findViewById(R.id.etLastName); patronymic=(EditText)findViewById(R.id.etPatronymic); tel=(EditText)findViewById(R.id.etTel); email=(EditText)findViewById(R.id.etEmail); note=(EditText)findViewById(R.id.etNote); dataBirthday=(TextView)findViewById(R.id.tvDataBirthday); dataBirthday.setOnClickListener(this); choseGroup=(Spinner)findViewById(R.id.spinChoseGroup); back=(Button)findViewById(R.id.btnBackAddStudent); save=(Button)findViewById(R.id.btnSaveStudent); back.setOnClickListener(this); save.setOnClickListener(this); final Calendar mCalendar = Calendar.getInstance(); dataBirthday.setText(mCalendar.get(Calendar.DAY_OF_MONTH) + " " + mCalendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + " " + mCalendar.get(Calendar.YEAR)); mYear = mCalendar.get( Calendar.YEAR ); mMonth = mCalendar.get( Calendar.MONTH ); mDay = mCalendar.get( Calendar.DATE ); //Filling array groups from DB dbAdapter= new DBAdapter(this); Cursor cur_group= dbAdapter.selectGroupBySpinner(); if (cur_group==null){ MyLog.e("error select by spinner");} cur_group.moveToFirst(); int count_group= cur_group.getCount(); SimpleCursorAdapter mAdapter = new SimpleCursorAdapter( this, android.R.layout.simple_spinner_item, cur_group, new String[] { "name_group" }, new int[] { android.R.id.text1 } ); mAdapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item ); if (count_group>0){ for (int i =1;i<=count_group;i++){ cur_group= mAdapter.getCursor(); if (cur_group.getInt(0)==id_group_sel){ selected =i; break; } if (i!=count_group) cur_group.moveToNext(); } } choseGroup.setAdapter(mAdapter); if (selected>0) choseGroup.setSelection(selected-1); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.btnSaveStudent: String strLast=last.getText().toString(); String strFirst= first.getText().toString(); String strPatronymic=patronymic.getText().toString(); String strTel=tel.getText().toString(); String strNote= note.getText().toString(); String strEmail= email.getText().toString(); Cursor item=(Cursor)(choseGroup.getItemAtPosition(choseGroup.getSelectedItemPosition())); if (item==null||item.getCount()<=0){ setResult(RESULT_CANCELED); item.close(); finish(); } if (!strLast.equals("")){ int ret= dbAdapter.insertStudent(item.getInt(0),strFirst,strLast, strPatronymic,strTel,mDay, mMonth + 1, mYear,strEmail,strNote); if (ret<=0){ MyLog.e("error add Student"); return; } setResult(RESULT_OK); item.close(); finish(); } else{ Toast.makeText(this,"Please, enter Last Name.",Toast.LENGTH_SHORT).show(); } break; case R.id.tvDataBirthday: showDialog(IDD_DATE); break; case R.id.btnBackAddStudent: setResult(RESULT_CANCELED); finish(); break; } //To change body of implemented methods use File | Settings | File Templates. } @Override protected Dialog onCreateDialog(int id) { final Calendar c = Calendar.getInstance(); mYear = c.get( Calendar.YEAR ); mMonth = c.get( Calendar.MONTH ); mDay = c.get( Calendar.DATE ); switch (id) { case IDD_DATE: { return new DatePickerDialog( this, mDateSetListener, mYear, mMonth, mDay ); } } return null; } /** */ private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { //@Override public void onDateSet(DatePicker view, int year, int month, int day) { mYear = year; mMonth = month; mDay = day; final Calendar mCalendar = Calendar.getInstance(); mCalendar.set( mYear, mMonth, mDay ); dataBirthday.setText(mCalendar.get(Calendar.DAY_OF_MONTH) + " " + mCalendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + " " + mCalendar.get(Calendar.YEAR)); } }; }
package com.tencent.tencentmap.mapsdk.a; public final class rj { private final qx a; private final int b; private final qw c; private final qw d; private final qw e; private final qw f; protected rj(int i, qw qwVar, qw qwVar2, qw qwVar3, qw qwVar4, qx qxVar) { this.b = i; this.d = qwVar; this.c = qwVar2; this.f = qwVar3; this.e = qwVar4; this.a = qxVar; } public rj(qw qwVar, qw qwVar2, qw qwVar3, qw qwVar4, qx qxVar) { this(1, qwVar, qwVar2, qwVar3, qwVar4, qxVar); } public final qw a() { return this.d; } public final qw b() { return this.c; } public final qw c() { return this.f; } public final qw d() { return this.e; } public final qx e() { return this.a; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof rj)) { return false; } rj rjVar = (rj) obj; return a().equals(rjVar.a()) && b().equals(rjVar.b()) && c().equals(rjVar.c()) && d().equals(rjVar.d()) && e().equals(rjVar.e()); } public final int hashCode() { return sz.a(new Object[]{a(), b(), c(), d(), e()}); } public final String toString() { return sz.a(new String[]{sz.a("nearLeft", a()), sz.a("nearRight", b()), sz.a("farLeft", c()), sz.a("farRight", d()), sz.a("latLngBounds", e())}); } }
package com.iw4.iwnet.ipserver; import java.net.SocketAddress; public class IPResponsePacket { public SocketAddress source; public short sequence; public boolean natOpen; public boolean blockGame; public IPResponsePacket(SocketAddress source, short sequence, boolean natOpen, boolean blockGame) { this.source = source; this.sequence = sequence; this.natOpen = natOpen; this.blockGame = blockGame; } public void write(Object writer) { //method stub } }
package org.dummy.jdbc.utils; import org.dummy.jdbc.annotation.Col; import java.lang.reflect.Field; import java.sql.ResultSet; import java.sql.SQLException; import static org.dummy.jdbc.utils.EntityUtils.*; public final class RowMapperUtils { private RowMapperUtils() { //Utility } private static Object get(ResultSet rs, String name) { return get(rs, name, null); } private static <T> T get(ResultSet rs, String name, Class<T> type) { try { return type != null ? rs.getObject(name, type) : (T) rs.getObject(name); } catch (SQLException e) { throw new IllegalStateException(e); } } private static void set(Object dto, Field field, Object value) { try { boolean isPrivate = !field.isAccessible(); if (isPrivate) { field.setAccessible(true); } field.set(dto, value); if (isPrivate) { field.setAccessible(false); } } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } private static Object getValue(ResultSet rs, Field field) { Class fieldType = primitiveToReference(field.getType()); String colName = getColumnName(field); return fieldType.equals(Object.class) ? get(rs, colName) : get(rs, colName, fieldType); } public static <T> T constructFrom(ResultSet rs, Class type) { try { T dto = (T) type.newInstance(); for (Field field : getFields(type, Col.class)) { set(dto, field, getValue(rs, field)); } return dto; } catch (InstantiationException | IllegalAccessException e) { throw new IllegalStateException(e); } } }
package genscript.defaultops.math; import genscript.defaultops.InfixOperation; import genscript.execution.ExecuterTreeNodeEager; import genscript.parse.IndexReader; import scriptinterface.defaulttypes.GBoolean; import scriptinterface.defaulttypes.GFloat; import scriptinterface.defaulttypes.GInteger; import scriptinterface.execution.ExecutionScope; import scriptinterface.execution.returnvalues.ExecutionResult; import scriptinterface.execution.returnvalues.ExecutionReturn; public class OpBiggerEq<ScopeType extends ExecutionScope, ReaderType extends IndexReader> extends ExecuterTreeNodeEager<ScopeType, ReaderType> { @Override public ExecutionReturn derivExecute(ScopeType scope, ExecutionResult<?>[] executedChildren) { ExecutionResult<?> arg1 = executedChildren[0]; ExecutionResult<?> arg2 = executedChildren[1]; if (arg1 instanceof GInteger && arg2 instanceof GBoolean) return GBoolean.create(((GInteger) arg1).getValue() >= (((GBoolean) arg2).asInteger())); if (arg1 instanceof GInteger && arg2 instanceof GInteger) return GBoolean.create(((GInteger) arg1).getValue() >= ((GInteger) arg2).getValue()); if (arg1 instanceof GInteger && arg2 instanceof GFloat) return GBoolean.create(((GInteger) arg1).getValue() >= ((GFloat) arg2).getValue()); if (arg1 instanceof GFloat && arg2 instanceof GBoolean) return GBoolean.create(((GFloat) arg1).getValue() >= (((GBoolean) arg2).asInteger())); if (arg1 instanceof GFloat && arg2 instanceof GInteger) return GBoolean.create(((GFloat) arg1).getValue() >= ((GInteger) arg2).getValue()); if (arg1 instanceof GFloat && arg2 instanceof GFloat) return GBoolean.create(((GFloat) arg1).getValue() >= ((GFloat) arg2).getValue()); arg1 = (GFloat) scope.getParseSystem().cast(arg1, GFloat.getTypeStatic()); arg2 = (GFloat) scope.getParseSystem().cast(arg2, GFloat.getTypeStatic()); if (arg1 == null || arg2 == null) return InfixOperation.getInfixError(arg1, arg2); return GBoolean.create(((GFloat) arg1).getValue() >= ((GFloat) arg2).getValue()); } @Override public String getName() { return "biggerEqual"; } @Override public String getSign() { return ">="; } }
package org.surkovp.pythonliterals; import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertEquals; class UtilTests { @Test void getLiteralsEmptyStringTest() { assertEquals( Collections.emptyList(), Util.getLiterals("")); } @Test void getLiteralsEmptyLiteralTest() { assertEquals( Collections.singletonList(""), Util.getLiterals("''") ); assertEquals( Collections.singletonList(""), Util.getLiterals("\"\"") ); } @Test void getLiteralsWholeStringLiteralTest() { assertEquals( Collections.singletonList("literal"), Util.getLiterals("'literal'")); assertEquals( Collections.singletonList("literal"), Util.getLiterals("\"literal\"")); } @Test void getLiteralsTextWithLiteralsAndNonLiteralsTest() { assertEquals( List.of("literal", "literal2"), Util.getLiterals("text\"literal\"text'literal2'") ); } @Test void getLiteralsDuplicatesLiteralsTest() { assertEquals( List.of("literal1", "literal2", "literal1"), Util.getLiterals("text text'literal1'text\"literal2\"texttext\"literal1\"") ); } @Test void getLiteralsDifferentQuotesMarksTest() { assertEquals( Collections.emptyList(), Util.getLiterals("'literal\"") ); assertEquals( Collections.emptyList(), Util.getLiterals("\"literal'") ); } @Test void getLiteralsWholeLineCommentTest() { assertEquals( Collections.emptyList(), Util.getLiterals("# 'literal' ") ); } @Test void getLiteralsLiteralAndCommentThenTest() { assertEquals( Collections.singletonList("literal1"), Util.getLiterals("'literal1'# 'literal2' ") ); } @Test void getLiteralsMultipleCommentLineTest() { assertEquals( Collections.singletonList("literal1"), Util.getLiterals("'literal1'# 'literal2' 'literal3' \"literal4\"") ); } @Test void getLiteralsEscapeLiterals() { assertEquals( Collections.emptyList(), Util.getLiterals("'text\\'") ); assertEquals( Collections.emptyList(), Util.getLiterals("\"text\\\"") ); } @Test void getLiteralsSharpInLiteral() { assertEquals( Collections.singletonList("li#eral"), Util.getLiterals("'li#eral'") ); } @Test void getLiteralsManyEscapes() { assertEquals( Collections.singletonList("literal"), Util.getLiterals("\\\\'literal'") ); assertEquals( Collections.emptyList(), Util.getLiterals("\\\\\\'literal'") ); } @Test void getLiteralLinesEmptyTextTest() { assertEquals( Collections.emptyMap(), Util.getLiteralLines(Stream.empty()) ); } @Test void getLiteralLinesTest() { assertEquals( Map.of( "literal", List.of(0, 1, 4), "literal2", Collections.singletonList(1), "literal4", List.of(2, 2), "li#eral", Collections.singletonList(5)), Util.getLiteralLines(Stream.of( "text 'literal' text #text 'literal2' # 'literal2'", "text \"literal2\" \"literal\"", "'literal4' text 'literal4'", "text", "'literal'", "'li#eral'") ) ); } @Test void getLiteralLinesOccurringAtLeastOnceTest() { assertEquals( Map.of( "literal", List.of(0, 1, 4), "literal4", List.of(2, 2)), Util.getLiteralLinesOccurringAtLeastOnce(Stream.of( "text 'literal' text #text 'literal2' # 'literal2'", "text \"literal2\" \"literal\"", "'literal4' text 'literal4'", "text", "'literal'", "'li#eral") ) ); } @Test void getLiteralLinesOccurringAtLeastOnceEscapeQuotes() { assertEquals( Collections.singletonMap("a ' b", List.of(0, 1)), Util.getLiteralLinesOccurringAtLeastOnce(Stream.of( "x = 'a \\' b'", "y = 'a \\' b'") ) ); } }
package web.inttest.objects.login; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class LoginPage { private WebDriver driver; private WebElement email; private WebElement password; private WebElement logginButton; private WebElement appStoreIcon; private WebElement googlePlayIcon; private WebElement notifyMessage; private WebElement mitigramIcon; private WebElement mitigramIconOnAppleStore; private WebElement mitigramIconOnGoogleStore; private WebElement emailFieldOnForgotPassword; public LoginPage(WebDriver driver) { this.driver = driver; email = driver.findElement(By.id("Email")); password = driver.findElement(By.id("Password")); logginButton = driver.findElement(By.id("loginBtn")); appStoreIcon = driver.findElement(By.xpath("//*[@id=\"app-store-badges\"]/a[1]/img")); googlePlayIcon = driver.findElement(By.xpath("//*[@id=\"app-store-badges\"]/a[2]")); mitigramIcon = driver.findElement(By.xpath("/html/body/div/div/div/div/a/img")); //WebElement mitigramIconOnAppleStore = driver.findElement(By.xpath("//*[@id=\"ember91\"]")); //WebElement mitigramIconOnGoogleStore = driver.findElement(By.xpath("//*[@id=\"fcxH9b\"]/div[4]/c-wiz/div/div[2]/div/div/main/c-wiz[1]/c-wiz[1]/div/div[1]/div/img")); emailFieldOnForgotPassword = driver.findElement(By.className("form-control")); } public WebElement getEmailField() { return email; } public WebElement getPasswordFeild() { return password; } public WebElement getLogginButton() { return logginButton; } public WebElement getAppStoreIcon() { return appStoreIcon; } public WebElement getGooglePlayIcon() { return googlePlayIcon; } public WebElement getNotifyMessage() { return notifyMessage; } public WebElement getMitigramIcon() { return mitigramIcon; } public WebElement getMitigramIconOnAppleStore() { return mitigramIconOnAppleStore; } public WebElement getMitigramIconOnGoogleStore() { return mitigramIconOnGoogleStore; } }
/* * Created on Dec 10, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package com.ibm.ive.tools.japt.reduction; import java.io.PrintStream; import com.ibm.ive.tools.japt.InternalClassesInterface; import com.ibm.ive.tools.japt.JaptRepository; import com.ibm.jikesbt.BT_Class; import com.ibm.jikesbt.BT_Field; import com.ibm.jikesbt.BT_Item; import com.ibm.jikesbt.BT_Method; /** * @author sfoley * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class EntryPointLister { private PrintStream out; boolean markEntryPoints; InternalClassesInterface internalClassesInterface; String arrow = " --> "; /** * An entry point is any element of the internal classes that is accessed from external classes. The interface * to the internal classes generally consists of all entry points. * This listener object acts upon all entry points found during reduction. * @param out the print stream for listing entry points, may be null for no such listing * @param markEntryPoints whether to mark the found entry points as part of the interface to the internal classes * @param japtRepository */ public EntryPointLister(PrintStream out, boolean markEntryPoints, JaptRepository japtRepository) { this.out = out; this.markEntryPoints = markEntryPoints; this.internalClassesInterface = japtRepository.getInternalClassesInterface(); } /** * indicate that the given internal class is referenced externally * @param clazz * @param from */ public void foundEntryTo(BT_Class clazz, BT_Item from) { if(markEntryPoints) { internalClassesInterface.addToInterface(clazz); internalClassesInterface.addTargetedClassToInterface(clazz); } if(out != null) { out.print(from.useName()); out.print(arrow); out.println(clazz.useName()); } } public void foundEntryTo(BT_Class clazz) { if(out != null) { out.println(clazz.useName()); } } /** * indicate that the given internal field is referenced from the given external method * @param field * @param from */ public void foundEntryTo(BT_Field field, BT_Method from) { if(markEntryPoints) { internalClassesInterface.addToInterface(field); internalClassesInterface.addToInterface(field.getDeclaringClass()); internalClassesInterface.addTargetedClassToInterface(field.getDeclaringClass()); } if(out != null) { out.print(from.useName()); out.print(arrow); out.println(field.useName()); } } public void foundEntryTo(BT_Field field) { if(out != null) { out.println(field.useName()); } } /** * indicate that the given internal method is referenced from the given external method, but is not * called directly but instead overrides or implements a third method. * @param method * @param from */ public void foundOverridingOrImplementingEntryTo(BT_Method method, BT_Method from) { if(markEntryPoints) { internalClassesInterface.addToInterface(method); } if(out != null) { out.print(from.useName()); out.print(arrow); out.print(method.qualifiedName()); out.print(' '); out.print('('); out.print(method.getDeclaringClass().useName()); out.println(')'); } } /** * indicate that the given internal method is referenced from the given external method * @param method * @param from */ public void foundEntryTo(BT_Method method, BT_Method from) { if(markEntryPoints) { internalClassesInterface.addToInterface(method); internalClassesInterface.addToInterface(method.getDeclaringClass()); internalClassesInterface.addTargetedClassToInterface(method.getDeclaringClass()); } if(out != null) { out.print(from.useName()); out.print(arrow); out.println(method.useName()); } } public void foundEntryTo(BT_Method method) { if(out != null) { out.println(method.useName()); } } }
package client; import javax.swing.*; import java.awt.*; public class MessageArea extends JPanel { private static final String BTN_TXT = " Send Message "; JTextField textField; JButton btn; public MessageArea() throws HeadlessException { super(); this.setLayout(new BorderLayout()); textField = new JTextField(); add(textField, BorderLayout.CENTER); btn = new JButton(BTN_TXT); add(btn, BorderLayout.EAST); setVisible(true); } public void setTextField(String textField) { this.textField.setText(textField); } public JButton getBtn() { return btn; } public JTextField getTextField() { return textField; } }
package sandbox.cdi; import static org.hamcrest.Matchers.notNullValue; import static org.junit.Assert.assertThat; import javax.enterprise.inject.Instance; import javax.enterprise.inject.se.SeContainer; import javax.enterprise.inject.se.SeContainerInitializer; import javax.enterprise.inject.spi.CDI; import javax.inject.Inject; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; public class JUTMinimalFieldInjection { /** Instances of this tiny class can be injected into CDI managed beans. It is important * that this class is {@code static}. Otherwise a {@code DeploymentException} is thrown. */ private static class Injectable {} /** Instances of this tiny class, if managed by CDI, benefit from CDI injection. It is important * that is class is {@code static}. Otherwise a {@code UnsatisfiedResolutionException} is thrown. */ private static class InjectionTarget { @Inject private Injectable injectable; } private static SeContainer container; private static CDI<Object> cdi; @BeforeClass public static void beforeClass() { SeContainerInitializer initializer = SeContainerInitializer.newInstance(); container = initializer.initialize(); cdi = CDI.current(); } @AfterClass public static void afterClass() { container.close(); } @Before public void before() { } @After public void after() { } @Test public void instanceBenefitsFromInjectionAfterSelectionFromCDI() { Instance<InjectionTarget> instance = cdi.select(InjectionTarget.class); InjectionTarget injectionTarget = instance.get(); assertThat(injectionTarget.injectable, notNullValue()); } }
package org.foobarspam.cotxox.conductores; import java.util.ArrayList; import java.util.concurrent.ThreadLocalRandom; public class PoolConductores { // Atributos private ArrayList<Conductor> poolConductores = new ArrayList<Conductor>(); // Getters y setters public ArrayList<Conductor> getPoolConductores() { return poolConductores; } // Constructor public PoolConductores(ArrayList<Conductor> poolConductores) { this.poolConductores = poolConductores; } // Lógica public Conductor asignarConductor() { // elecciona un conductor libre entre la flota y lo devuelve, // estableciendo que ese conductor está ahora ocupado. ArrayList<Conductor> conductoresDisponibles = new ArrayList<Conductor>(); for (Conductor conductor : poolConductores) { if (conductor.isOcupado() == false) { conductoresDisponibles.add(conductor); } } int numeroConductorAleatorio = ThreadLocalRandom.current().nextInt(0, conductoresDisponibles.size()); Conductor conductorSeleccionado = conductoresDisponibles.get(numeroConductorAleatorio); conductorSeleccionado.setOcupado(true); return conductorSeleccionado; } }
package com.example.myapplication.app; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.os.Message; import com.example.myapplication.model.PersonalSmsGateway; import com.example.myapplication.model.ResponseWrapper; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.json.JSONObject; import java.lang.reflect.Type; import java.util.ArrayList; public class AppService extends Service { // // Binder given to clients // private final IBinder binder = new LocalBinder(); // /** // * Class used for the client Binder. Because we know this service always // * runs in the same process as its clients, we don't need to deal with IPC. // */ // public class LocalBinder extends Binder { // AppService getService() { // // Return this instance of LocalService so clients can call public methods // return AppService.this; // } // } // /** method for clients */ // public boolean isRunning() { // return true; // } // // public void ddd(){ // Intent intent = new Intent(); // //Bundle the timervalue with Intent // intent.putExtra("0", timer); // intent.setAction("TimerIntent"); // sendBroadcast(intent); // finally broadcast to the UI // } // // @Override // public IBinder onBind(Intent intent) { // return binder; // } Context context = this; private final Handler handler = new Handler(); private final Handler smsHandler = new Handler(); private Runnable fetchPendingRequest = new Runnable() { @Override public void run() { handleRequest(); long oneSecondInMillis = 1000L; int intervalPreference = AppComponent.Preferences.getIntervalFetchRequest(context); handler.postDelayed(this, oneSecondInMillis * intervalPreference); } }; @Override public int onStartCommand(Intent intent, int flags, int startId) { handler.post(fetchPendingRequest); return START_STICKY; } @Override public IBinder onBind(Intent intent) { return null; } @Override public void onDestroy() { handler.removeCallbacksAndMessages(null); RequestHandler.getInstance(this).cancelAll(); super.onDestroy(); } private Integer subscriptionId = null; private void handleRequest(){ subscriptionId = AppComponent.Config.getPreferenceSubscriptionId(this); String url = AppComponent.Preferences.getFetchUrl(this); RequestHandler.getInstance(this) .doFetchHasNotSent(url, (JSONObject response) -> { Type type = new TypeToken<ResponseWrapper<ArrayList<PersonalSmsGateway>>>() {}.getType(); try { ResponseWrapper<ArrayList<PersonalSmsGateway>> responseWrapperResponse = new Gson().fromJson(response.toString(), type); ArrayList<PersonalSmsGateway> personalSmsGateways = responseWrapperResponse.getData(); for (PersonalSmsGateway personalSmsGateway : personalSmsGateways) { long id = personalSmsGateway.getId(); Intent intentSent = new Intent(context, SmsSentReceiver.class); // intentSent.setAction(String.valueOf(id)); intentSent.setAction("SENT." + String.valueOf(id)); intentSent.putExtra("id", id); Intent intentDelivered = new Intent(context, SmsDeliveredReceiver.class); // intentDelivered.setAction(String.valueOf(id)); intentDelivered.setAction("DELIVERED." + String.valueOf(id)); intentDelivered.putExtra("id", id); PendingIntent pendingIntentSent = PendingIntent.getBroadcast(context, 0, intentSent, 0); PendingIntent pendingIntentDelivered = PendingIntent.getBroadcast(context, 0, intentDelivered, 0); // PendingIntent pendingIntentSent = null; // PendingIntent pendingIntentDelivered = null; smsHandler.postDelayed(new Thread(){ @Override public void run() { SmsService.sendMessage(subscriptionId, personalSmsGateway.getPhoneNumber(), personalSmsGateway.getMessage(), pendingIntentSent, pendingIntentDelivered); } }, 3000); // Thread.sleep(3000); // SmsService.sendMessage(subscriptionId, personalSmsGateway.getPhoneNumber(), personalSmsGateway.getMessage(), pendingIntentSent, pendingIntentDelivered); } } catch (Exception e) { e.printStackTrace(); } } ); } }
package com.facebook.yoga; public enum YogaExperimentalFeature { WEB_FLEX_BASIS(0); private final int mIntValue; static { $VALUES = new YogaExperimentalFeature[] { WEB_FLEX_BASIS }; } YogaExperimentalFeature(int paramInt1) { this.mIntValue = paramInt1; } public static YogaExperimentalFeature fromInt(int paramInt) { if (paramInt == 0) return WEB_FLEX_BASIS; StringBuilder stringBuilder = new StringBuilder("Unknown enum value: "); stringBuilder.append(paramInt); throw new IllegalArgumentException(stringBuilder.toString()); } public final int intValue() { return this.mIntValue; } } /* Location: C:\Users\august\Desktop\tik\df_rn_kit\classes.jar.jar!\com\facebook\yoga\YogaExperimentalFeature.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
import java.io.IOException; import java.util.List; import model.VEHBrand; import model.VEHDetail; import model.VEHEngine; import model.VEHFamily; import model.VEHGearbox; import model.VEHGroup; import model.VEHInfo; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import com.alibaba.fastjson.JSON; public class CarTypeTest { private static int num = 0; public static void main(String[] args) throws UnsupportedOperationException, IOException { getBrnad(); System.out.println("num = " + num); } //获取车品牌 @SuppressWarnings("deprecation") public static void getBrnad() throws IOException, ClientProtocolException { HttpClient httpclient = new DefaultHttpClient(); /* * F:报错 URL解析有误 * L:报错 * R:报错 */ for (char c = 'H'; c <= 'H'; c++) { HttpGet httpget = new HttpGet( "http://www.minanins.com/maechannel/initBrnadIcon?returnType=div&requestType=pyPPInitIcon&letter=" + c + "&vehicleType="); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { int i = 0; int n = 0; String brnad = EntityUtils.toString(entity); while (i >= 0 && n >= 0) { i = brnad.indexOf("src='http", n); if (i < 0) break; System.out.println("brnadA = " + brnad); n = brnad.indexOf("'", i + 5); System.out.println(brnad.substring(i + 5, n));//标志图片路径 i = brnad.indexOf("_click('", n); n = brnad.indexOf("')", i + 8); // System.out.println(brnad.substring(i+8, n)); String brnadStr = brnad.substring(i + 8, n); brnadStr = brnadStr.replace("'", ""); System.out.println("brnadStr = " + brnadStr); String[] s = brnadStr.split(","); if("路特斯(莲花".equals(s[1])) { System.out.println("dog"); } System.out.println("---------" + s[0] + ", " + s[1] + ", " + s[2] + "----------"); System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaa = " + c + "aaaaaaaaaaaaaaaaaaaaaaaaaaaa"); VEHBrand vehbrand = new VEHBrand(); vehbrand.setBrandcode(s[0]); vehbrand.setBrandname(s[1]); vehbrand.setVehtype(s[2]); //gcbrnadDetail(s[0]); gcbrnadDetail(vehbrand); } } } } //车型类别 public static void gcbrnadDetail(VEHBrand vehbrand) throws ClientProtocolException, IOException { // [{ "familyId":"402880ef0ca9c2b6010cc8bf0ff00108", // "brandName":"一汽大众","familyAbbr":"开迪" } HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet( "http://www.minanins.com/maechannel/initBrnadIcon?returnType=div&requestType=choosePPIcon&qcpp=" + vehbrand.getBrandcode() + "&vehicleType="); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { String brnadDetail = EntityUtils.toString(entity); if (null!=brnadDetail && !"".equals(brnadDetail)){ List<FamilyDo> familyList = JSON.parseArray(brnadDetail, FamilyDo.class); for (FamilyDo familyDo : familyList) { System.out.println(familyDo.getFamilyId() + familyDo.getBrandName() + familyDo.getFamilyAbbr()); VEHFamily vehFamily = new VEHFamily(); vehFamily.setVehbrand(vehbrand); vehFamily.setFamilyid(familyDo.getFamilyId()); vehFamily.setFamilyabbr(familyDo.getFamilyAbbr()); //getGroupId(familyDo.getFamilyId()); getGroupId(vehFamily); } } } } //车款 public static void getGroupId(VEHFamily vehFamily) throws ClientProtocolException, IOException { //[{ "groupId":"4028808832a004df0132fb38232c2ef5", "groupName":"(2009年07月至今)福仕达" }] HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet( "http://www.minanins.com/maechannel/initBrnadIcon?returnType=div&requestType=changePPIcon&familyId=" + vehFamily.getFamilyid()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { String groupId = EntityUtils.toString(entity); if (null!=groupId && !"".equals(groupId)){ List<GroupDo> groupList = JSON.parseArray(groupId, GroupDo.class); for (GroupDo groupDo : groupList) { System.out.println(groupDo.getGroupId() + groupDo.getGroupName()); VEHGroup vehgroup = new VEHGroup(); vehgroup.setGroupid(groupDo.getGroupId()); vehgroup.setGroupname(groupDo.getGroupName()); vehgroup.setVehfamily(vehFamily); vehgroup.setImgurl(""); getEngineDesc(vehgroup); } } } } //获取车的排量 public static void getEngineDesc(VEHGroup vehgroup) throws ClientProtocolException, IOException { //{ "engineDesc":"1.0L" } HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet( "http://www.minanins.com/maechannel/initBrnadIcon?returnType=div&requestType=initPl&groupId=" + vehgroup.getGroupid() + "&familyId=" + vehgroup.getVehfamily().getFamilyid()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { String engineDesc = EntityUtils.toString(entity); // System.out.println(engineDesc); if (null != engineDesc && !engineDesc.equals("")) { List<EngineDesc> engineDescList = JSON.parseArray(engineDesc, EngineDesc.class); for (EngineDesc engine : engineDescList) { System.out.println(engine.getEngineDesc()); VEHEngine vehengine = new VEHEngine(); vehengine.setEnginedesc(engine.getEngineDesc()); vehengine.setVehgroup(vehgroup); getgearBoxType(vehengine); } } } } //获取自动档或手动档 public static void getgearBoxType(VEHEngine vehengine) throws ClientProtocolException, IOException { //{ "gearboxType":"0" } try { HttpClient httpclient = new DefaultHttpClient(); if( "I0000000000000000210000000000694".equals(vehengine.getVehgroup().getVehfamily().getFamilyid()) && "402880882703579901270e5aa5ee075a".equals(vehengine.getVehgroup().getGroupid()) && "3.2L".equals(vehengine.getEnginedesc().trim())) { System.out.println("dog"); } HttpGet httpget = new HttpGet( "http://www.minanins.com/maechannel/initBrnadIcon?returnType=div&requestType=changePL&familyId=" + vehengine.getVehgroup().getVehfamily().getFamilyid() + "&groupId=" + vehengine.getVehgroup().getGroupid() + "&pl=" + vehengine.getEnginedesc()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { String gearBoxType = EntityUtils.toString(entity); if (null!=gearBoxType && !"".equals(gearBoxType)){ List<GearboxType> gearBoxTypeList = JSON.parseArray(gearBoxType, GearboxType.class); // System.out.println(gearBoxType); for (GearboxType gearbox : gearBoxTypeList) { System.out.println(gearbox.getGearboxType()); VEHGearbox vehgearbox = new VEHGearbox(); vehgearbox.setGearboxtype(gearbox.getGearboxType()); vehgearbox.setVehengine(vehengine); getVehype(vehgearbox); } } } }catch(Exception e){ System.err.println("error error error error "); } } //获取对应的配置型号 public static void getVehype(VEHGearbox vehgearbox) throws ClientProtocolException, IOException { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet( "http://www.minanins.com/maechannel/initBrnadIcon?returnType=div&requestType=changeGear&familyId=" + vehgearbox.getVehengine().getVehgroup().getVehfamily().getFamilyid() + "&groupId=" + vehgearbox.getVehengine().getVehgroup().getGroupid() + "&pl=" + vehgearbox.getVehengine().getEnginedesc() + "&gearbox=" + vehgearbox.getGearboxtype()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { String vehType = EntityUtils.toString(entity); if (null!=vehType && !"".equals(vehType)){ List<VehType> vehTypeList = JSON.parseArray(vehType, VehType.class); for (VehType veh : vehTypeList) { System.out.println(veh.getParentVehId() + veh.getParentVehName() + veh.getPrice()); VEHInfo vehInfo = new VEHInfo(); vehInfo.setParentVehId(veh.getParentVehId()); vehInfo.setParentVehName(veh.getParentVehName()); vehInfo.setImportFlag(veh.getImportFlag()); vehInfo.setPrice(veh.getPrice()); vehInfo.setSeat(veh.getSeat()); vehInfo.setSeatFlag(veh.getSeatFlag()); vehInfo.setVehgearbox(vehgearbox); //getVehypeDetail(veh.getParentVehId(), veh.getPrice()); getVehypeDetail(vehInfo); } } } } //最后一步获取车的详细信息 public static void getVehypeDetail(VEHInfo vehInfo) throws ClientProtocolException, IOException { /*[{ "rbCode":"ALD1013ZZQ", "familyName":"福仕达","brandName":"奥路卡", "vehicleFgwCode":"ZQ6385A62F","importFlag" :"B", "marketDate":"","engineDesc":"1.0L", "gearboxType":"1","seat":"8", "power":"45","fullWeight":"1100" , "tonnage":"","vehicleClassCode":"IC03", "vehicleClassName":"旅行车类","purchasePrice":"30000", "purchasePriceTax" :"32600","kindredPrice":"0", "kindredPriceTax":"0","fuelCode":"", "fuelName":"","vehicleFgwName":"奥路 卡","powerCode":"", "powerName":""}] */ HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet( "http://www.minanins.com/maechannel/initBrnadIcon?returnType=div&requestType=changeFcx&parentId=" + vehInfo.getParentVehId() + "&price=" + vehInfo.getPrice()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { String vehypeDetail = EntityUtils.toString(entity); if (null != vehypeDetail && !vehypeDetail.equals("")) { List<VehTypeDetail> vehTypeDetailList = JSON.parseArray( vehypeDetail, VehTypeDetail.class); for (VehTypeDetail vehDetail : vehTypeDetailList) { VEHDetail vehdetail = new VEHDetail(); vehdetail.setVehInfo(vehInfo); vehdetail.setRbcode(vehDetail.getRbCode()); vehdetail.setFamilyname(vehDetail.getFamilyName()); vehdetail.setVehiclefgwcode(vehDetail.getVehicleFgwCode()); vehdetail.setMarketdate(vehDetail.getMarketDate()); vehdetail.setSeat(vehDetail.getSeat()); vehdetail.setPower(vehDetail.getPower()); vehdetail.setFullweight(vehDetail.getFullWeight()); vehdetail.setTonnage(vehDetail.getTonnage()); vehdetail.setVehicleclasscode(vehDetail.getVehicleClassCode()); vehdetail.setVehicleclassname(vehDetail.getVehicleClassName()); vehdetail.setPurchaseprice(vehDetail.getPurchasePrice()); vehdetail.setPurchasepricetax(vehDetail.getPurchasePriceTax()); vehdetail.setKindredprice(vehDetail.getKindredPrice()); vehdetail.setKindredpricetax(vehDetail.getKindredPriceTax()); vehdetail.setFuelcode(vehDetail.getFuelCode()); vehdetail.setFuelname(vehDetail.getFuelName()); vehdetail.setVehiclefgwname(vehDetail.getVehicleFgwName()); vehdetail.setPowercode(vehDetail.getPowerCode()); vehdetail.setPowername(vehDetail.getPowerName()); System.out.println(vehDetail.getFamilyName() + vehDetail.getSeat()); num++; } } } } }
package com.tencent.mm.aq; import com.tencent.mm.plugin.messenger.foundation.a.a.h.b; import com.tencent.mm.protocal.c.bhz; import com.tencent.mm.protocal.c.rd; import com.tencent.mm.sdk.platformtools.bi; @Deprecated public final class d extends b { private rd ecd = new rd(); public d(String str, long j) { super(8); this.ecd.rvi = new bhz().VO(bi.oV(str)); this.ecd.rcq = j; this.lcH = this.ecd; } }
package com.tamimattafi.mydebts.model.database.dao; import android.database.Cursor; import androidx.room.EntityDeletionOrUpdateAdapter; import androidx.room.EntityInsertionAdapter; import androidx.room.RoomDatabase; import androidx.room.RxRoom; import androidx.room.util.DBUtil; import androidx.sqlite.db.SupportSQLiteQuery; import androidx.sqlite.db.SupportSQLiteStatement; import com.tamimattafi.mydebts.model.entities.Debt; import io.reactivex.Flowable; import java.lang.Exception; import java.lang.Long; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; @SuppressWarnings({"unchecked", "deprecation"}) public final class DebtsDao_Impl implements DebtsDao { private final RoomDatabase __db; private final EntityInsertionAdapter<Debt> __insertionAdapterOfDebt; private final EntityDeletionOrUpdateAdapter<Debt> __deletionAdapterOfDebt; private final EntityDeletionOrUpdateAdapter<Debt> __updateAdapterOfDebt; public DebtsDao_Impl(RoomDatabase __db) { this.__db = __db; this.__insertionAdapterOfDebt = new EntityInsertionAdapter<Debt>(__db) { @Override public String createQuery() { return "INSERT OR IGNORE INTO `debts` (`id`,`sum`,`currency`,`person`,`isDebtor`,`date`,`creationDate`) VALUES (?,?,?,?,?,?,?)"; } @Override public void bind(SupportSQLiteStatement stmt, Debt value) { if (value.getId() == null) { stmt.bindNull(1); } else { stmt.bindLong(1, value.getId()); } if (value.getSum() == null) { stmt.bindNull(2); } else { stmt.bindString(2, value.getSum()); } if (value.getCurrency() == null) { stmt.bindNull(3); } else { stmt.bindString(3, value.getCurrency()); } if (value.getPerson() == null) { stmt.bindNull(4); } else { stmt.bindString(4, value.getPerson()); } final int _tmp; _tmp = value.isDebtor() ? 1 : 0; stmt.bindLong(5, _tmp); stmt.bindLong(6, value.getDate()); stmt.bindLong(7, value.getCreationDate()); } }; this.__deletionAdapterOfDebt = new EntityDeletionOrUpdateAdapter<Debt>(__db) { @Override public String createQuery() { return "DELETE FROM `debts` WHERE `id` = ?"; } @Override public void bind(SupportSQLiteStatement stmt, Debt value) { if (value.getId() == null) { stmt.bindNull(1); } else { stmt.bindLong(1, value.getId()); } } }; this.__updateAdapterOfDebt = new EntityDeletionOrUpdateAdapter<Debt>(__db) { @Override public String createQuery() { return "UPDATE OR ABORT `debts` SET `id` = ?,`sum` = ?,`currency` = ?,`person` = ?,`isDebtor` = ?,`date` = ?,`creationDate` = ? WHERE `id` = ?"; } @Override public void bind(SupportSQLiteStatement stmt, Debt value) { if (value.getId() == null) { stmt.bindNull(1); } else { stmt.bindLong(1, value.getId()); } if (value.getSum() == null) { stmt.bindNull(2); } else { stmt.bindString(2, value.getSum()); } if (value.getCurrency() == null) { stmt.bindNull(3); } else { stmt.bindString(3, value.getCurrency()); } if (value.getPerson() == null) { stmt.bindNull(4); } else { stmt.bindString(4, value.getPerson()); } final int _tmp; _tmp = value.isDebtor() ? 1 : 0; stmt.bindLong(5, _tmp); stmt.bindLong(6, value.getDate()); stmt.bindLong(7, value.getCreationDate()); if (value.getId() == null) { stmt.bindNull(8); } else { stmt.bindLong(8, value.getId()); } } }; } @Override public long insertItem(final Debt arg0) { __db.assertNotSuspendingTransaction(); __db.beginTransaction(); try { long _result = __insertionAdapterOfDebt.insertAndReturnId(arg0); __db.setTransactionSuccessful(); return _result; } finally { __db.endTransaction(); } } @Override public List<Long> insertAll(final ArrayList<Debt> arg0) { __db.assertNotSuspendingTransaction(); __db.beginTransaction(); try { List<Long> _result = __insertionAdapterOfDebt.insertAndReturnIdsList(arg0); __db.setTransactionSuccessful(); return _result; } finally { __db.endTransaction(); } } @Override public int deleteItem(final Debt arg0) { __db.assertNotSuspendingTransaction(); int _total = 0; __db.beginTransaction(); try { _total +=__deletionAdapterOfDebt.handle(arg0); __db.setTransactionSuccessful(); return _total; } finally { __db.endTransaction(); } } @Override public int updateItem(final Debt arg0) { __db.assertNotSuspendingTransaction(); int _total = 0; __db.beginTransaction(); try { _total +=__updateAdapterOfDebt.handle(arg0); __db.setTransactionSuccessful(); return _total; } finally { __db.endTransaction(); } } @Override public List<Debt> getList(final SupportSQLiteQuery arg0) { final SupportSQLiteQuery _internalQuery = arg0; __db.assertNotSuspendingTransaction(); final Cursor _cursor = DBUtil.query(__db, _internalQuery, false, null); try { final List<Debt> _result = new ArrayList<Debt>(_cursor.getCount()); while(_cursor.moveToNext()) { final Debt _item; _item = __entityCursorConverter_comTamimattafiMydebtsModelEntitiesDebt(_cursor); _result.add(_item); } return _result; } finally { _cursor.close(); } } @Override public Debt getItem(final SupportSQLiteQuery arg0) { final SupportSQLiteQuery _internalQuery = arg0; __db.assertNotSuspendingTransaction(); final Cursor _cursor = DBUtil.query(__db, _internalQuery, false, null); try { final Debt _result; if(_cursor.moveToFirst()) { _result = __entityCursorConverter_comTamimattafiMydebtsModelEntitiesDebt(_cursor); } else { _result = null; } return _result; } finally { _cursor.close(); } } @Override public Flowable<List<Debt>> getRxList(final SupportSQLiteQuery query) { final SupportSQLiteQuery _internalQuery = query; return RxRoom.createFlowable(__db, false, new String[]{"debts"}, new Callable<List<Debt>>() { @Override public List<Debt> call() throws Exception { final Cursor _cursor = DBUtil.query(__db, _internalQuery, false, null); try { final List<Debt> _result = new ArrayList<Debt>(_cursor.getCount()); while(_cursor.moveToNext()) { final Debt _item; _item = __entityCursorConverter_comTamimattafiMydebtsModelEntitiesDebt(_cursor); _result.add(_item); } return _result; } finally { _cursor.close(); } } }); } @Override public Flowable<Debt> getRxItem(final SupportSQLiteQuery query) { final SupportSQLiteQuery _internalQuery = query; return RxRoom.createFlowable(__db, false, new String[]{"debts"}, new Callable<Debt>() { @Override public Debt call() throws Exception { final Cursor _cursor = DBUtil.query(__db, _internalQuery, false, null); try { final Debt _result; if(_cursor.moveToFirst()) { _result = __entityCursorConverter_comTamimattafiMydebtsModelEntitiesDebt(_cursor); } else { _result = null; } return _result; } finally { _cursor.close(); } } }); } private Debt __entityCursorConverter_comTamimattafiMydebtsModelEntitiesDebt(Cursor cursor) { final Debt _entity; final int _cursorIndexOfId = cursor.getColumnIndex("id"); final int _cursorIndexOfSum = cursor.getColumnIndex("sum"); final int _cursorIndexOfCurrency = cursor.getColumnIndex("currency"); final int _cursorIndexOfPerson = cursor.getColumnIndex("person"); final int _cursorIndexOfIsDebtor = cursor.getColumnIndex("isDebtor"); final int _cursorIndexOfDate = cursor.getColumnIndex("date"); final int _cursorIndexOfCreationDate = cursor.getColumnIndex("creationDate"); final Long _tmpId; if (_cursorIndexOfId == -1) { _tmpId = null; } else { if (cursor.isNull(_cursorIndexOfId)) { _tmpId = null; } else { _tmpId = cursor.getLong(_cursorIndexOfId); } } final String _tmpSum; if (_cursorIndexOfSum == -1) { _tmpSum = null; } else { _tmpSum = cursor.getString(_cursorIndexOfSum); } final String _tmpCurrency; if (_cursorIndexOfCurrency == -1) { _tmpCurrency = null; } else { _tmpCurrency = cursor.getString(_cursorIndexOfCurrency); } final String _tmpPerson; if (_cursorIndexOfPerson == -1) { _tmpPerson = null; } else { _tmpPerson = cursor.getString(_cursorIndexOfPerson); } final boolean _tmpIsDebtor; if (_cursorIndexOfIsDebtor == -1) { _tmpIsDebtor = false; } else { final int _tmp; _tmp = cursor.getInt(_cursorIndexOfIsDebtor); _tmpIsDebtor = _tmp != 0; } final long _tmpDate; if (_cursorIndexOfDate == -1) { _tmpDate = 0; } else { _tmpDate = cursor.getLong(_cursorIndexOfDate); } final long _tmpCreationDate; if (_cursorIndexOfCreationDate == -1) { _tmpCreationDate = 0; } else { _tmpCreationDate = cursor.getLong(_cursorIndexOfCreationDate); } _entity = new Debt(_tmpId,_tmpSum,_tmpCurrency,_tmpPerson,_tmpIsDebtor,_tmpDate,_tmpCreationDate); return _entity; } }
/* * Collin Tod * C2N1P1JavaRules */ package C2N1P1JavaRules; public class C2N1P1JavaRules { public static void main(String[] args) { //Output System.out.println("Java Rules."); } } /* *Java Rules. */
package com.example.cj.perfectj.service; import java.math.BigDecimal; /** * Created on 2020-04-19 */ public interface ProductService { long addProduct(String name, int stock, BigDecimal price); }
package assemAssist.model.clock.clock; import org.joda.time.DateTime; import assemAssist.model.clock.event.Event; /** * An unmodifiable view for the {@link ModifiableClock}. The time of this clock * equals the time of the {@link ModifiableClock}, with which this clock has * been initialised. To adjust the time, one should set the time of the * {@link ModifiableClock}. * * @author SWOP Group 3 * @version 3.0 */ final class ClockProxy implements Clock { /** * Initialises this ClockProxy with the given clock. * * @param clock * The clock to set the clock to * @throws IllegalArgumentException * Thrown when the given clock is invalid */ public ClockProxy(ModifiableClock clock) throws IllegalArgumentException { if (!isValidClock(clock)) { throw new IllegalArgumentException("The given clock is invalid."); } this.clock = clock; } /** * Checks whether the given clock is valid. * * @param clock * The clock to check * @return True if and only if the given clock is effective */ public boolean isValidClock(Clock clock) { return clock != null; } private final ModifiableClock clock; /** * {@inheritDoc} */ @Override public boolean isValidTime(DateTime time) { return clock.isValidTime(time); } /** * {@inheritDoc} */ public DateTime getTime() { return clock.getTime(); } /** * {@inheritDoc} */ @Override public void addEvent(Event event) throws IllegalArgumentException { clock.addEvent(event); } /** * {@inheritDoc} */ @Override public ClockProxy getClockProxy() { return this; } /** * {@inheritDoc} */ @Override public ModifiableClock getModifiableClock() { return clock; } }
package vanadis.extrt; import vanadis.ext.Inject; import vanadis.osgi.Reference; import vanadis.osgi.ServiceProperties; public class ReferenceInjectee { private Reference<TestService> propertiedTestServiceRef; private TestService testService; private ServiceProperties<TestService> properties; private ServiceProperties<TestService> refProperties; public ServiceProperties<TestService> getRefProperties() { return refProperties; } public Reference<TestService> getTestServiceRef() { return testServiceRef; } private Reference<TestService> testServiceRef; @Inject(injectType = TestService.class) public void setPropertiedTestServiceRef(Reference<TestService> registration) { this.testServiceRef = registration; } @Inject(injectType = TestService.class) public void setTestServiceRef(Reference<TestService> registration, ServiceProperties<TestService> properties) { this.propertiedTestServiceRef = registration; this.refProperties = properties; } public Reference<TestService> getPropertiedTestServiceRef() { return propertiedTestServiceRef; } @Inject public void setTestService(TestService testService, ServiceProperties<TestService> properties) { this.testService = testService; this.properties = properties; } public TestService getTestService() { return testService; } public ServiceProperties<TestService> getPropertySet() { return properties; } }
package main.java.com.loss; /* * Interface for loss function * * Author: Dylan Lasher */ import main.java.com.deepNeuralNetwork.Matrix; public interface LossFunction { double computeCost(Matrix Y, Matrix AL); Matrix computeCostGradient(Matrix Y, Matrix AL); }
package org.automator.core; import java.io.File; import java.util.Properties; import org.automator.config.ApplicationProperties; import org.automator.config.ApplicationPropertiesKeys; import org.automator.config.DriverConfiguration; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriverService; import org.testng.ISuiteListener; import org.testng.TestListenerAdapter; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; public abstract class AbstractWebBaseTest extends TestListenerAdapter implements BaseTest { protected ThreadLocal<WebDriver> webDrivers=new ThreadLocal<>(); protected DriverConfiguration driverConfig; protected ApplicationProperties appProp; private WebDriver driver; @BeforeSuite(alwaysRun=true) public void loadConfiguration(){ appProp=ApplicationProperties.getInstance(); appProp.loadProperties(getConfig()); driverConfig=DriverConfiguration.getDriverConfig(appProp); //AbstractWebBaseTest.class.getResourceAsStream("classpath:/webdrivers/chrome") } public ApplicationProperties getApplicationProperties(){ return appProp; } @BeforeMethod public void beforeTestMethod(){ WebDriver driver=driverConfig.createWebDriver(); driver.get(appProp.getEnvironmentUrl()); webDrivers.set(driver); } @AfterMethod public void afterTestMethod(){ getDriver().quit(); } public WebDriver getDriver(){ return webDrivers.get(); } public abstract Properties getConfig(); }
package net.d4rk.inventorychef.inventory.expandablelistview.roomembedded.model; public class PositionMapping { private int mGroupIndex; private int mChildIndex; public PositionMapping(int groupIndex, int childIndex) { mGroupIndex = groupIndex; mChildIndex = childIndex; } public int getGroupIndex() { return mGroupIndex; } public int getChildIndex() { return mChildIndex; } }
package leetcode; /* * Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. Example: Given this linked list: 1->2->3->4->5 For k = 2, you should return: 2->1->4->3->5 For k = 3, you should return: 3->2->1->4->5 Note: Only constant extra memory is allowed. You may not alter the values in the list's nodes, only nodes itself may be changed. */ public class ReverseNodes { public static void main(String[] args) { // TODO Auto-generated method stub int nums[]={1,2,3,4,5}; ListNode list = ListNode.retListNode(nums); ReverseNodes o = new ReverseNodes(); list = o.Reserve(list); ListNode.cout(list); } public ListNode Reserve(ListNode node) { ListNode prev = null; ListNode next = null; while (node != null) { next = node.next; node.next = prev; prev = node; node = next; } return prev; } }
package com.tencent.mm.plugin.appbrand.b; import android.os.Message; import com.tencent.mm.plugin.appbrand.g; final class c$a extends f { final /* synthetic */ c fjx; c$a(c cVar, h hVar, g gVar) { this.fjx = cVar; super(hVar, gVar); } public final String getName() { return this.fjx.mName + "|Background"; } public final boolean j(Message message) { switch (message.what) { case 3: c.a(this.fjx, this.fjx.fjo); return true; case 12: super.jH(16); return true; default: return super.j(message); } } public final void enter() { super.enter(); } public final void exit() { super.exit(); } final void acx() { if (this.fjx.cjn() == this) { c.a(this.fjx, this.fjx.fjr); this.fjx.jG(1000); } } }
package com.adms.web.bean.nav; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class NavigatorBean { private final String REDIRECT_PARAM = "?faces-redirect=true"; //Main Page URL private final String TO_MAIN_PAGE = "/main"; private final String TO_CUSTOMER_ENQUIRY_PAGE = "/cs/customer-enquiry"; private final String TO_CONFIRMATION_PAGE = "/confirmation"; //Confirmation URL private final String TO_FILE_UPLOAD_PAGE = "/confirmation/upload"; private final String TO_ADD_LOG_PAGE = "/confirmation/addlog"; private final String TO_FILE_DOWNLOAD_PAGE = "/confirmation/download"; //OMNI Channel private final String TO_OMNI_CH_MAIN_PAGE = "/omni/main-omni"; private final String TO_CHAT_PAGE = "/primepush/chat"; private final String TO_COUNTER_PAGE = "/primepush/counter"; public String mainMenu() throws Exception { return TO_MAIN_PAGE + REDIRECT_PARAM; } public String customerEnquiryMenu() throws Exception { return TO_CUSTOMER_ENQUIRY_PAGE + REDIRECT_PARAM; } public String confirmationMenu() throws Exception { return TO_CONFIRMATION_PAGE + REDIRECT_PARAM; } public String expiredPage() throws Exception { return "/errors/expired" + REDIRECT_PARAM; } public String toFileUploadPage() throws Throwable { return TO_FILE_UPLOAD_PAGE + REDIRECT_PARAM; } public String toAddLogPage() throws Throwable { return TO_ADD_LOG_PAGE + REDIRECT_PARAM; } public String toFileDownloadPage() throws Throwable { return TO_FILE_DOWNLOAD_PAGE + REDIRECT_PARAM; } public String toChatPage() throws Throwable { return TO_CHAT_PAGE + REDIRECT_PARAM; } public String toCounterPage() throws Throwable { return TO_COUNTER_PAGE + REDIRECT_PARAM; } public String toOmniChMainPage() throws Throwable { return TO_OMNI_CH_MAIN_PAGE + REDIRECT_PARAM; } }
package com.clean.flyjiang.cleanbaseapp.callback; import android.app.Activity; import android.app.Dialog; import com.clean.flyjiang.cleanbaseapp.okgomodel.CommonReturnData; import com.clean.flyjiang.cleanbaseapp.okgomodel.SimpleResponse; import com.clean.flyjiang.cleanbaseapp.utils.Convert; import com.google.gson.stream.JsonReader; import com.lzy.okgo.request.base.Request; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import okhttp3.Response; /** * ================================================ * 描 述:对于网络请求是否需要弹出进度对话框 * 修订历史: * ================================================ */ public abstract class DialogCallback<T> extends JsonCallback<T> { private Dialog dialog; /* private Activity mActivity;*/ /* private void initDialog(Activity activity) { dialog = new ProgressDialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setMessage("请求网络中..."); }*/ public DialogCallback(Activity activity) { super(activity); this.mActivity = activity; } @Override public void onStart(Request<T, ? extends Request> request) { super.onStart(request); //网络请求前显示对话框 /*if (dialog != null && !dialog.isShowing()) { dialog.show(); }*/ } @Override public void onFinish() { super.onFinish(); //网络请求结束后关闭对话框 /* if (dialog != null && dialog.isShowing()) { dialog.dismiss(); }*/ } @Override public T convertResponse(Response response) throws Exception { Type genType = getClass().getGenericSuperclass(); Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); Type type = params[0]; if (!(type instanceof ParameterizedType)) throw new IllegalStateException("没有填写泛型参数"); Type rawType = ((ParameterizedType) type).getRawType(); JsonReader jsonReader = new JsonReader(response.body().charStream()); if (rawType == Void.class) { SimpleResponse simpleResponse = Convert.fromJson(jsonReader, SimpleResponse.class); response.close(); return (T) simpleResponse.toCommonReturnData(); } else if (rawType == CommonReturnData.class) { CommonReturnData commonReturnData = Convert.fromJson(jsonReader, type); response.close(); return (T) commonReturnData; } else { response.close(); throw new IllegalStateException("基类错误无法解析!"); } } }
package com.orca.web; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.servlet.ModelAndView; import com.orca.domain.User; import com.orca.form.ResetPasswordForm; import com.orca.service.EmailService; import com.orca.service.UserService; import com.orca.validator.ChangePasswordValidator; import com.orca.validator.ResetPasswordFormValidator; import com.orca.validator.UserValidator; @SessionAttributes({ "user", "resetPasswordForm"}) @Controller public class UserController { @Autowired private UserService userService; @Autowired public UserValidator userValidator; @Autowired private ChangePasswordValidator changePasswordValidator; @Autowired private EmailService emailService; @Autowired private ResetPasswordFormValidator resetPasswordFormValidator; public void setValidator(UserValidator userValidator) { this.userValidator = userValidator; } @RequestMapping(value = "login.html") public ModelAndView login() { return new ModelAndView("login"); } @RequestMapping(value = "createAccount.html") public ModelAndView createAccount() { ModelAndView mav = new ModelAndView("createAccount"); User user = new User(); mav.addObject("user", user); return mav; } @RequestMapping(value = "saveUser.html") public ModelAndView saveUser(@ModelAttribute("user") User user, BindingResult result) { userValidator.validate(user, result); if (result.hasErrors()) { ModelAndView mav = new ModelAndView("createAccount"); mav.addObject("user", user); return mav; } userService.saveUser(user); ModelAndView mav = new ModelAndView("myAccount"); mav.addObject("user", user); return mav; } @RequestMapping(value = "myAccount.html") public ModelAndView myAccount() { if (userService.authenticatedUser()) { ModelAndView mav = new ModelAndView("myAccount"); mav.addObject("user", userService.getUserByUserName(userService.getUsernameFromSecurityContext())); return mav; } ModelAndView mav = new ModelAndView("login"); mav.addObject("user", new User()); return mav; } @RequestMapping(value = "resetPassword.html") public ModelAndView resetPassword() { ModelAndView mav = new ModelAndView("resetPassword"); mav.addObject("resetPasswordForm", new ResetPasswordForm()); return mav; } @RequestMapping(value = "resetPasswordVerify.html") public ModelAndView resetPasswordVerify(@ModelAttribute("resetPasswordForm") ResetPasswordForm form, BindingResult result, HttpServletRequest request) { resetPasswordFormValidator.validate(form, result); if (result.hasErrors()) { ModelAndView mav = new ModelAndView("resetPassword"); mav.addObject("form", form); return mav; } User user = userService.getUserByUserName(form.getEmail()); String newPassword = userService.resetUserPassword(user); emailService.sendEmail(form.getEmail(), resetPasswordSubject(), resetPasswordBody(newPassword)); return new ModelAndView("resetPasswordConfirmation"); } @RequestMapping(value = "changePassword.html") public ModelAndView changePassword(){ if (userService.authenticatedUser()) { ModelAndView mav = new ModelAndView("changePassword"); mav.addObject("user", userService.getUserByUserName(userService.getUsernameFromSecurityContext())); return mav; } ModelAndView mav = new ModelAndView("login"); mav.addObject("user", new User()); return mav; } @RequestMapping(value = "changePasswordVerify.html") public ModelAndView changePasswordVerify(@ModelAttribute("user") User user, BindingResult result){ changePasswordValidator.validate(user, result); if (result.hasErrors()) { ModelAndView mav = new ModelAndView("changePassword"); mav.addObject("user", user); return mav; } userService.updateUserPassword(user); ModelAndView mav = new ModelAndView("myAccount"); mav.addObject("user", user); return mav; } public String resetPasswordSubject(){ return new String("Your password has been reset"); } public String resetPasswordBody(String password){ return new String("Thank you for using the ORCA (Open Source Rapid Analysis) tool. \n\n" + "Your password has been changed to " + password + ". \n\n " + "Please log into your account and change your password as soon as possible by going to http://orca-project.herokuapp.com/myAccount.html" + ". \n\n Many thanks. \n The ORCA Team."); } }
package CompaniesInterview.amazon.skillinefficiency; import java.util.ArrayList; import java.util.Collections; public class Solution { // review https://leetcode.com/problems/find-k-th-smallest-pair-distance/solutions/127408/find-k-th-smallest-pair-distance/ public static void main(String[] args) { var skills = new int[] {6, 9, 1}; var k = 2; var result = getSmallestInefficiencyBruteForce(skills, k); for (int i = 0; i < result.length; i++) { System.out.println(result[i]); } } // will not work for large array private static int[] getSmallestInefficiencyBruteForce(int[] skills, int k) { var result = new int[k]; // loop through all elements in skills var result1 = new ArrayList<Integer>(); // find all the difference for (int i = 0; i < skills.length; i++) { for (int j = i + 1; j < skills.length; j++) { var currentDiff = Math.abs(skills[j] - skills[i]); result1.add(currentDiff); } } Collections.sort(result1); for (int i = 0; i < k; i++) { result[i] = result1.get(i); } return result; } // review solutions from Leetcode! private static int[] getSmallestInEfficiency(int[] skills, int k) { return new int[10]; } }
package com.prashanth.sunvalley.mapper; import com.prashanth.sunvalley.Model.LocationDTO; import com.prashanth.sunvalley.domain.Location; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @Mapper public interface LocationMapper { LocationMapper INSTANCE = Mappers.getMapper(LocationMapper.class); LocationDTO locationToLocationDTO(Location location); Location locationDTOToLocation(LocationDTO locationDTO); }
package edu.pdx.cs410J.mckean; import edu.pdx.cs410J.web.HttpRequestHelper; import java.io.IOException; /** * A helper class for accessing the rest client. Note that this class provides * an example of how to make gets and posts to a URL. You'll need to change it * to do something other than just send key/value pairs. */ public class PhoneBillRestClient extends HttpRequestHelper { private static final String WEB_APP = "phonebill"; private static final String SERVLET = "calls"; private final String url; /** * Creates a client to the Phone Bil REST service running on the given host and port * @param hostName The name of the host * @param port The port */ public PhoneBillRestClient( String hostName, int port) { this.url = String.format( "http://%s:%d/%s/%s", hostName, port, WEB_APP, SERVLET); } public PhoneBillRestClient(String hostName, int port, String customer, String startTime, String endTime) { this.url = String.format("http://%s:%d/%s%s?customer=%s&startTime=%s&endTime=%s", hostName, port, WEB_APP, SERVLET, customer, startTime, endTime); } /** * Returns all keys and values from the server */ public Response getAllKeysAndValues() throws IOException { return get(this.url ); } /** * Returns all values for the given key */ public Response getValues( String customer) throws IOException { return get(this.url, "customer", customer); } public Response getSearch(String customer, String startTime, String endTime) throws IOException { return get(this.url, "customer", customer, "startTime", startTime, "endTime", endTime); } public Response addCall(String customername, PhoneCall call) throws IOException { String customer = customername; String caller = call.getCaller(); String callee = call.getCallee(); String startTime = call.getStartTimeString(); String endTime = call.getEndTimeString(); return post( this.url, "customer", customer, "caller", caller, "callee", callee, "startTime", startTime, "endTime", endTime); } }
package fr.umlv.escape.editor; import fr.umlv.escape.R; import android.app.Activity; import android.content.Context; import android.database.DataSetObserver; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.View.OnTouchListener; import android.widget.ArrayAdapter; import android.widget.ExpandableListView; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.Toast; public class ShipPlacerActivity extends Activity implements OnTouchListener{ int HEIGHT; int WIDTH; int pos_wave; ArrayAdapter<String> moveAdapter; private final String[] listMove = {"DownMove","DownUpMove","KamikazeMove", "LeftDampedMove","LeftMove","LeftRightMove", "RightDampedMove","RightMove","SquareLeft", "SquareRight","StraightLine","UpMove"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.builder_wave); if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if(extras == null) { throw new IllegalArgumentException(); } pos_wave = extras.getInt("pos"); } else { pos_wave = Integer.parseInt((String) savedInstanceState.getSerializable("pos")); } ImageView img; moveAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,listMove); img = (ImageView)findViewById(R.id.mini_map_builder); } @Override public boolean onTouch(View v, MotionEvent event) { ShipEditor s = WaveObject.ships.get(pos_wave); s.x = (int)event.getX(); s.y = (int)event.getY(); Toast.makeText(getApplicationContext(), "Pos:"+s.x+":"+s.y, Toast.LENGTH_SHORT).show(); return true; } }
package com.tt.miniapp.util; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintStream; import java.util.List; public class CommandUtil { public static List<String> executeShellCommand(String paramString) { // Byte code: // 0: aconst_null // 1: astore #5 // 3: invokestatic getRuntime : ()Ljava/lang/Runtime; // 6: aload_0 // 7: invokevirtual exec : (Ljava/lang/String;)Ljava/lang/Process; // 10: astore_0 // 11: new java/io/DataOutputStream // 14: dup // 15: aload_0 // 16: invokevirtual getOutputStream : ()Ljava/io/OutputStream; // 19: invokespecial <init> : (Ljava/io/OutputStream;)V // 22: astore_3 // 23: new java/io/BufferedReader // 26: dup // 27: new java/io/InputStreamReader // 30: dup // 31: aload_0 // 32: invokevirtual getInputStream : ()Ljava/io/InputStream; // 35: invokespecial <init> : (Ljava/io/InputStream;)V // 38: invokespecial <init> : (Ljava/io/Reader;)V // 41: astore #6 // 43: new java/io/BufferedReader // 46: dup // 47: new java/io/InputStreamReader // 50: dup // 51: aload_0 // 52: invokevirtual getErrorStream : ()Ljava/io/InputStream; // 55: invokespecial <init> : (Ljava/io/InputStream;)V // 58: invokespecial <init> : (Ljava/io/Reader;)V // 61: astore #7 // 63: aload_3 // 64: ldc 'exit\\n' // 66: invokevirtual writeBytes : (Ljava/lang/String;)V // 69: aload_3 // 70: invokevirtual flush : ()V // 73: aload #6 // 75: invokestatic readOSMessage : (Ljava/io/BufferedReader;)Ljava/lang/String; // 78: astore #4 // 80: aload #7 // 82: invokestatic readOSMessage : (Ljava/io/BufferedReader;)Ljava/lang/String; // 85: astore #5 // 87: aload_0 // 88: invokevirtual waitFor : ()I // 91: istore_1 // 92: new java/util/ArrayList // 95: dup // 96: invokespecial <init> : ()V // 99: astore_2 // 100: aload_2 // 101: iload_1 // 102: invokestatic valueOf : (I)Ljava/lang/String; // 105: invokeinterface add : (Ljava/lang/Object;)Z // 110: pop // 111: aload_2 // 112: aload #4 // 114: invokeinterface add : (Ljava/lang/Object;)Z // 119: pop // 120: aload_2 // 121: aload #5 // 123: invokeinterface add : (Ljava/lang/Object;)Z // 128: pop // 129: aload_3 // 130: invokevirtual close : ()V // 133: aload #6 // 135: invokevirtual close : ()V // 138: aload #7 // 140: invokevirtual close : ()V // 143: goto -> 146 // 146: aload_2 // 147: astore_3 // 148: aload_0 // 149: ifnull -> 379 // 152: aload_0 // 153: invokevirtual destroy : ()V // 156: aload_2 // 157: areturn // 158: astore_2 // 159: aload_3 // 160: astore #5 // 162: aload #6 // 164: astore #4 // 166: aload #7 // 168: astore_3 // 169: goto -> 273 // 172: aconst_null // 173: astore_2 // 174: aload #7 // 176: astore #4 // 178: goto -> 204 // 181: astore_2 // 182: aconst_null // 183: astore #7 // 185: aload_3 // 186: astore #5 // 188: aload #6 // 190: astore #4 // 192: aload #7 // 194: astore_3 // 195: goto -> 273 // 198: aconst_null // 199: astore #4 // 201: aload #4 // 203: astore_2 // 204: aload #6 // 206: astore #5 // 208: aload_3 // 209: astore #6 // 211: aload #4 // 213: astore_3 // 214: goto -> 333 // 217: astore_2 // 218: aconst_null // 219: astore #6 // 221: aload #6 // 223: astore #4 // 225: aload_3 // 226: astore #5 // 228: aload #6 // 230: astore_3 // 231: goto -> 273 // 234: aconst_null // 235: astore_2 // 236: aload_3 // 237: astore #4 // 239: aload_2 // 240: astore_3 // 241: goto -> 327 // 244: astore_2 // 245: aconst_null // 246: astore #4 // 248: aload #4 // 250: astore_3 // 251: aload_3 // 252: astore #5 // 254: goto -> 273 // 257: goto -> 322 // 260: astore_2 // 261: aconst_null // 262: astore #5 // 264: aload #5 // 266: astore #4 // 268: aload #4 // 270: astore_3 // 271: aload_3 // 272: astore_0 // 273: aload #5 // 275: ifnull -> 286 // 278: aload #5 // 280: invokevirtual close : ()V // 283: goto -> 286 // 286: aload #4 // 288: ifnull -> 299 // 291: aload #4 // 293: invokevirtual close : ()V // 296: goto -> 299 // 299: aload_3 // 300: ifnull -> 310 // 303: aload_3 // 304: invokevirtual close : ()V // 307: goto -> 310 // 310: aload_0 // 311: ifnull -> 318 // 314: aload_0 // 315: invokevirtual destroy : ()V // 318: aload_2 // 319: athrow // 320: aconst_null // 321: astore_0 // 322: aconst_null // 323: astore #4 // 325: aconst_null // 326: astore_3 // 327: aload_3 // 328: astore_2 // 329: aload #4 // 331: astore #6 // 333: aload #6 // 335: ifnull -> 346 // 338: aload #6 // 340: invokevirtual close : ()V // 343: goto -> 346 // 346: aload #5 // 348: ifnull -> 359 // 351: aload #5 // 353: invokevirtual close : ()V // 356: goto -> 359 // 359: aload_3 // 360: ifnull -> 370 // 363: aload_3 // 364: invokevirtual close : ()V // 367: goto -> 370 // 370: aload_2 // 371: astore_3 // 372: aload_0 // 373: ifnull -> 379 // 376: goto -> 152 // 379: aload_3 // 380: areturn // 381: astore_0 // 382: goto -> 320 // 385: astore_2 // 386: goto -> 257 // 389: astore_2 // 390: goto -> 234 // 393: astore_2 // 394: goto -> 198 // 397: astore_2 // 398: goto -> 172 // 401: astore #4 // 403: aload #7 // 405: astore #4 // 407: goto -> 204 // 410: astore_3 // 411: goto -> 133 // 414: astore_3 // 415: goto -> 138 // 418: astore_3 // 419: goto -> 146 // 422: astore #5 // 424: goto -> 286 // 427: astore #4 // 429: goto -> 299 // 432: astore_3 // 433: goto -> 310 // 436: astore #4 // 438: goto -> 346 // 441: astore #4 // 443: goto -> 359 // 446: astore_3 // 447: goto -> 370 // Exception table: // from to target type // 3 11 381 java/io/IOException // 3 11 381 java/lang/InterruptedException // 3 11 260 finally // 11 23 385 java/io/IOException // 11 23 385 java/lang/InterruptedException // 11 23 244 finally // 23 43 389 java/io/IOException // 23 43 389 java/lang/InterruptedException // 23 43 217 finally // 43 63 393 java/io/IOException // 43 63 393 java/lang/InterruptedException // 43 63 181 finally // 63 100 397 java/io/IOException // 63 100 397 java/lang/InterruptedException // 63 100 158 finally // 100 129 401 java/io/IOException // 100 129 401 java/lang/InterruptedException // 100 129 158 finally // 129 133 410 java/io/IOException // 133 138 414 java/io/IOException // 138 143 418 java/io/IOException // 278 283 422 java/io/IOException // 291 296 427 java/io/IOException // 303 307 432 java/io/IOException // 338 343 436 java/io/IOException // 351 356 441 java/io/IOException // 363 367 446 java/io/IOException } private static String readOSMessage(BufferedReader paramBufferedReader) throws IOException { StringBuilder stringBuilder = new StringBuilder(); while (true) { String str = paramBufferedReader.readLine(); if (str != null) { PrintStream printStream = System.out; StringBuilder stringBuilder1 = new StringBuilder("lineString : "); stringBuilder1.append(str); printStream.println(stringBuilder1.toString()); stringBuilder.append(str); stringBuilder.append("\n"); continue; } return stringBuilder.toString(); } } } /* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\miniap\\util\CommandUtil.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package com.sinotao.web.util; public class UploadConfig { /** * 上传文件保存地址基本路径 */ private String basePath; /** * “x光”上传文件保存地址相对路径 */ private String xRayFolder; /** * “心电图”上传文件保存地址相对路径 */ private String heartFolder; /** * “B超”上传文件保存地址相对路径 */ private String bUtraFolder; /** * “阴道镜”上传文件保存地址相对路径 */ private String colposcopeFolder; /** * @return the basePath */ public String getBasePath() { return basePath; } /** * @param basePath the basePath to set */ public void setBasePath(String basePath) { this.basePath = basePath; } /** * @return the xRayFolder */ public String getxRayFolder() { return xRayFolder; } /** * @param xRayFolder the xRayFolder to set */ public void setxRayFolder(String xRayFolder) { this.xRayFolder = xRayFolder; } /** * @return the heartFolder */ public String getHeartFolder() { return heartFolder; } /** * @param heartFolder the heartFolder to set */ public void setHeartFolder(String heartFolder) { this.heartFolder = heartFolder; } /** * @return the bUtraFolder */ public String getbUtraFolder() { return bUtraFolder; } /** * @param bUtraFolder the bUtraFolder to set */ public void setbUtraFolder(String bUtraFolder) { this.bUtraFolder = bUtraFolder; } /** * @return the colposcopeFolder */ public String getColposcopeFolder() { return colposcopeFolder; } /** * @param colposcopeFolder the colposcopeFolder to set */ public void setColposcopeFolder(String colposcopeFolder) { this.colposcopeFolder = colposcopeFolder; } }
package com.huawei.esdk.platform.professional.local.impl.service; import javax.xml.ws.Holder; import org.apache.log4j.Logger; import com.huawei.esdk.platform.professional.local.bean.SDKResponse; import com.huawei.esdk.platform.professional.local.impl.autogen.PlatformKeyMgr; import com.huawei.esdk.platform.professional.local.impl.utils.ClientProvider; import com.huawei.esdk.platform.professional.local.impl.utils.RSA2048Utils; import com.huawei.esdk.platform.professional.local.service.common.PlatformKeyServiceEx; import com.huawei.esdk.tp.professional.local.impl.utils.ExceptionUtils; public class PlatformKeyServiceExImpl implements PlatformKeyServiceEx { private static final Logger LOGGER = Logger.getLogger(PlatformKeyServiceExImpl.class); private PlatformKeyMgr platformKeyMgr = (PlatformKeyMgr)ClientProvider.getClient(PlatformKeyMgr.class); private static PlatformKeyServiceExImpl instance = null; public static synchronized PlatformKeyServiceExImpl getInstance() { if (null == instance) { instance = new PlatformKeyServiceExImpl(); } return instance; } @Override public SDKResponse<String> getPublicKey(String secretType) { LOGGER.debug("begin to execute getPublicKey method"); SDKResponse<String> result = new SDKResponse<String>(); Holder<Integer> resultCode = new Holder<Integer>(); Holder<String> publicKey = new Holder<String>(); try { platformKeyMgr.getPublicKey(secretType, resultCode, publicKey); } catch (Exception e) { LOGGER.error("getPublicKey method exception happened", e); result.setResultCode(ExceptionUtils.processSoapException(e)); return result; } result.setResultCode(resultCode.value); result.setResult(publicKey.value); LOGGER.debug("execute getPublicKey method completed"); LOGGER.debug("begin to execute setPublicKey method"); RSA2048Utils.setPublicKey(publicKey.value); LOGGER.debug("execute setPublicKey method completed"); return result; } @Override public Integer setSecretKey(String secretType, String secretKey, String iv) { LOGGER.debug("begin to execute setSecretKey method"); Integer resultCode = null; try { resultCode = platformKeyMgr.setSecretKey(secretType, secretKey, iv); } catch (Exception e) { LOGGER.error("setSecretKey method exception happened", e); return ExceptionUtils.processSoapException(e); } LOGGER.debug("execute setSecretKey method completed"); return resultCode; } }
package moderate; /* Sample code to read in test cases:*/ import java.io.*; import java.util.*; import java.lang.*; public class DetectingCycles { public static void main (String[] args) throws IOException { File file = new File("/Users/Priyatham/Git/CodeEval/bin/text.txt"); BufferedReader buffer = new BufferedReader(new FileReader(file)); String line; while ((line = buffer.readLine()) != null) { line = line.trim(); String[] str = line.split("\\s+"); Set<String> h1 = new LinkedHashSet<String>(); Set<String> h2 = new LinkedHashSet<String>(); StringBuffer sb = new StringBuffer(); for(int i=0; i< str.length; i++){ if(!h1.contains(str[i])){ h1.add(str[i]); continue; }else if(h1.contains(str[i]) && !h2.contains(str[i])){ h2.add(str[i]); sb.append(str[i]+" "); }else{ break; } } System.out.println(sb.toString().trim()); } } }
package bnorm.base; import bnorm.robots.IRobotSnapshot; import bnorm.utils.Trig; import bnorm.utils.Utils; import robocode.AdvancedRobot; import robocode.Robot; /** * An abstract representation of a {@link AdvancedRobot}. This class allows the the robot to perform * some basic moving and turning by utilizing some convince functions. * * @author Brian Norman */ public class AdvTank extends Tank { /** * The {@link AdvancedRobot} that created the {@link AdvTank} instance. */ protected AdvancedRobot advRobot_; /** * Constructs a new {@link AdvTank} class that gives the {@link AdvancedRobot} some convenience * functions for moving and turning. * * @param robot the {@link AdvancedRobot} creating the class. */ public AdvTank(AdvancedRobot robot) { super(robot); advRobot_ = robot; } // -------------------- // Information Commands // -------------------- @Override public double getHeading() { return advRobot_.getHeadingRadians(); } /** * Returns the angle in radians that the robot has yet to turn. * <p/> * This call returns both positive and negative values. Positive values means that the robot is * currently turning to the right. Negative values means that the robot is currently turning to * the left. If the returned value is <code>0</code>, the robot is currently not turning. * * @return the turning angle remaining. */ public double getTurnRemaining() { return advRobot_.getTurnRemainingRadians(); } /** * Returns the sign of the angle that the robot has yet to turn. Will return <code>1</code> if * the robot is turning to the right, <code>-1</code> if the robot is turning to the left, and * <code>0</code> if the robot is not turning. * * @return the sign of the turn remaining. */ public int getTurningSign() { return Utils.signZ(getTurnRemaining()); } /** * Returns the distance that the robot has yet to move. * <p/> * This call returns both positive and negative values. Positive values means that the robot is * currently moving forward. Negative values means that the robot is currently moving backward. * If the returned value is <code>0</code>, the robot is currently not moving. * * @return the moving distance remaining. */ public double getMoveRemaining() { return advRobot_.getDistanceRemaining(); } /** * Returns the sign of the distance that the robot has yet to move. Will return <code>1</code> if * the robot is moving forward, <code>-1</code> if the robot is moving backward, and * <code>0</code> if the robot is not moving. * * @return the sign of the move remaining. */ public int getMovingSign() { return Utils.signZ(getTurnRemaining()); } // ---------------- // Turning Commands // ---------------- /** * Sets the {@link AdvancedRobot} to turn right a specified angle in radians. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param a the angle to turn. */ public void setTurnRight(double a) { advRobot_.setTurnRightRadians(a); } /** * Sets the {@link AdvancedRobot} to turn left a specified angle in radians. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param a the angle to turn. */ public void setTurnLeft(double a) { advRobot_.setTurnLeftRadians(a); } /** * Sets the {@link AdvancedRobot} to turn a specified angle in radians. A positive angle will * cause the robot to turn to the right, a negative angle will cause the robot to turn to the * left, and if an angle of <code>0</code> is specified, no action is taken. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param a the angle to turn. */ public void setTurn(double a) { setTurnRight(a); } /** * Sets the {@link AdvancedRobot} to turn to a specified angle. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param angle the angle for the robot to turn to. */ public void setTurnTo(double angle) { setTurn(getBearing(angle)); } /** * Sets the {@link AdvancedRobot} to turn so it is in line with the specified angle and returns a * value corresponding to which direction the robot would need to move to follow the line. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param angle the line for the robot to turn to. * @return the direction the robot would need to move to follow the line. */ public int setTurnToLine(double angle) { if (Math.abs(getBearing(angle)) <= Trig.QUARTER_CIRCLE) { setTurnTo(angle); return Tank.FORWARD; } else { setTurnTo(angle + Trig.HALF_CIRCLE); return Tank.BACKWARD; } } /** * Sets the {@link AdvancedRobot} turn to a specified coordinates, <code>(x, y)</code>. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param x the ordinate coordinate for the robot to turn to. * @param y the abscissa coordinate for the robot to turn to. */ public void setTurnTo(double x, double y) { setTurnTo(angle(x, y)); } /** * Sets the {@link AdvancedRobot} to turn so it is in line with the specified coordinates, * <code>(x, y)</code>, and returns a value corresponding to which direction the robot would need * to move to follow the line. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param x the ordinate coordinate of the line for the robot to turn to. * @param y the abscissa coordinate of the line for the robot to turn to. * @return the direction the robot would need to move to follow the line. */ public int setTurnToLine(double x, double y) { return setTurnToLine(angle(x, y)); } /** * Sets the {@link AdvancedRobot} to turn to a specified robot snapshot. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param robot the snapshot for the robot to turn to. */ public void setTurnTo(IRobotSnapshot robot) { if (robot != null && robot.getEnergy() >= 0.0) { setTurnTo(angle(robot)); } } /** * Sets the {@link AdvancedRobot} turn so it is in line with the specified robot snapshot and * returns a value corresponding to which direction the robot would need to move to follow the * line. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param robot the snapshot of the line for the robot to turn to. * @return the direction the robot would need to move to follow the line. */ public int setTurnToLine(IRobotSnapshot robot) { if (robot != null && robot.getEnergy() >= 0.0) { return setTurnToLine(angle(robot)); } return 0; } // ----------------- // Movement Commands // ----------------- /** * Sets the {@link AdvancedRobot} to move a specified distance forward. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param d the distance to move forward. */ public void setMoveForward(double d) { advRobot_.setAhead(d); } /** * Sets the {@link Robot} to move a specified distance backward. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param d the distance to move backward. */ public void setMoveBackward(double d) { advRobot_.setBack(d); } /** * Sets the {@link Robot} to move a specified distance. A positive distance will cause the robot * to move forwards, a negative distance will cause the robot to move backwards, and if the * distance of <code>0</code> is specified, no action is taken. * <p/> * This call returns immediately, and will not execute until you call * {@link AdvancedRobot#execute() execute()} or take an action that executes. * * @param d the distance to move. */ public void setMove(double d) { setMoveForward(d); } }
package com.example.adminjs.jiaosheng11004; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; /** * Created by Adminjs on 2017/11/4. */ public class MactActivity extends AppCompatActivity{ private Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.action_mate); button = (Button)findViewById(R.id.left_btn); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setClass(MactActivity.this,MainActivity.class); startActivity(intent); finish(); } }); } }
package com.jasoftsolutions.mikhuna.activity.fragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import com.jasoftsolutions.mikhuna.R; /** * Created by pc07 on 23/04/2014. */ public class FoodTypePreferencesFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_preferences_foodtype, container, false); ListView listView=(ListView)rootView.findViewById(R.id.preferences_foodtype_list); String[] data = getResources().getStringArray(R.array.preferences_foodtype_test_list); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_multiple_choice, data); listView.setAdapter(adapter); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); // listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { // @Override // public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { // if (0 == i) { // Preferencias // Intent preferencesIntent = new Intent(getActivity(), PreferencesActivity.class); // startActivity(preferencesIntent); // } // } // }); return rootView; } }
package br.inf.ufg.mddsm.controller.policy.repository; public class Decision { private String param; private String operation; private String value; public Decision(String par, String anOperaiton, String val) { param=par; operation= anOperaiton; value=val; } public String getParam() { return param; } public String getOperation() { return operation; } public String getValue() { return value; } }
package com.fleet.easyexcel.entity; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.format.DateTimeFormat; import com.alibaba.excel.annotation.format.NumberFormat; import com.alibaba.excel.converters.string.StringImageConverter; import com.fasterxml.jackson.annotation.JsonFormat; import com.fleet.easyexcel.converter.SexConverter; import java.io.Serializable; import java.util.Date; /** * @author April Han */ public class User implements Serializable { private static final long serialVersionUID = 1L; @ExcelProperty(value = {"用户id"}, index = 0) private Long id; @ExcelProperty(value = {"姓名"}, index = 1) private String name; @ExcelProperty(value = {"性别"}, index = 2, converter = SexConverter.class) private Integer sex; @ExcelProperty(value = {"头像"}, index = 3, converter = StringImageConverter.class) private String avatar; @JsonFormat(pattern = "yyyy年MM月dd日", timezone = "GMT+8") @DateTimeFormat("yyyy年MM月dd日") @ExcelProperty(value = {"出生日期"}, index = 4) private Date birth; @ExcelIgnore private String idNo; @NumberFormat("#.##") @ExcelProperty(value = {"分数"}, index = 5) private Double score; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex = sex; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public Date getBirth() { return birth; } public void setBirth(Date birth) { this.birth = birth; } public String getIdNo() { return idNo; } public void setIdNo(String idNo) { this.idNo = idNo; } public Double getScore() { return score; } public void setScore(Double score) { this.score = score; } }
package com.example.dao; import com.example.entities.Order; import com.example.entities.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; /** * Created by Andros on 28.02.2017. */ @Repository public interface OrderDao extends JpaRepository<Order,Long> { List<Order> findByUser(User user); List<Order> findByConfirmed(int id); }
package com.cpe.mysql.webblog.repository; import com.cpe.mysql.webblog.entity.Tag; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.stereotype.Repository; import java.util.Optional; @Repository @RepositoryRestResource public interface TagRepository extends JpaRepository<Tag, Long> { Optional<Tag> findByText(String text); }
package com.tencent.mm.plugin.music.model.e; import android.widget.Toast; import com.tencent.mm.plugin.music.b.e; import com.tencent.mm.plugin.music.model.e.e.2; import com.tencent.mm.sdk.platformtools.ad; class e$2$2 implements Runnable { final /* synthetic */ 2 lzQ; e$2$2(2 2) { this.lzQ = 2; } public final void run() { Toast.makeText(ad.getContext(), ad.getContext().getString(e.music_url_wrong), 1).show(); } }
package SeliniumSessions; import java.util.ArrayList; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class ElementUtil { WebDriver driver; public ElementUtil(WebDriver driver) { this.driver=driver; } public WebElement getElement(By locator) { WebElement element=driver.findElement(locator); return element; } public void doSendKeys(By locator,String value) { getElement(locator).sendKeys(value); } public void doActionsSenKeys(By locator,String value) { Actions actions=new Actions(driver); WebElement element=getElement(locator); actions.sendKeys(element, value).build().perform(); } public void doClick(By locator) { getElement(locator).click(); } public void doActionsClick(By locator) { Actions actions=new Actions(driver); WebElement element=getElement(locator); actions.click(element).build().perform(); } public String dogetText(By locator) { return getElement(locator).getText(); } /** * This method is used to get total values and all the values from dropdown * @param locator */ public void getAllvaluesfromdropdown(By locator) { Select select=new Select(getElement(locator)); List<WebElement> optionsList=select.getOptions(); System.out.println("total values in the dropdown is :"+optionsList.size()); for(int i=0;i<optionsList.size();i++) { System.out.println(optionsList.get(i).getText()); } } /** * This method is used to select dropdown values by visibleText in Selenium * @param locator * @param value */ public void selectDropdown(By locator,String value) { Select select=new Select(getElement(locator)); select.selectByVisibleText(value); } /** * This method is used to select drop down values by index in Selenium * @param locator * @param index */ public void selectDropdown(By locator,int index) { Select select=new Select(getElement(locator)); select.selectByIndex(index); } /** * This method is used to get total values in the drop down and select patricular value from drop down * @param locator * @param value */ public void SelectDropDownValue(By locator,String value) { Select select=new Select(getElement(locator)); List<WebElement> valuesList=select.getOptions(); System.out.println(valuesList.size()); for(int i=0;i<valuesList.size(); i++) { if(valuesList.get(i).getText().equals(value)) { valuesList.get(i).click(); break; } } } /** * This method is used to get all the drop down values list * @param locator * @return */ public List<String> getDropDownvaluesList(By locator) { List<String> ar=new ArrayList<String>(); Select select=new Select(getElement(locator)); List<WebElement> optionsList=select.getOptions(); for(int i=0;i<optionsList.size();i++) { ar.add(optionsList.get(i).getText()); } return ar; } /** * this method is user to select the value from the drop down-with out using Select class in selenium * @param locator * @param locatorValue * @param value */ public void doSelectValueFromDropDownWithoutSelect(String locator,String locatorValue,String value) { List<WebElement> valuesList=null; if(locator.equals("xpath")) { valuesList= driver.findElements(By.xpath(locatorValue)); } else if(locator.equals("css")) { valuesList= driver.findElements(By.cssSelector(locatorValue)); } System.out.println(valuesList.size()); for(int i=0;i<valuesList.size();i++) { if(valuesList.get(i).getText().equals(value)) { valuesList.get(i).click(); break; } } } //wait custom method:wait utilities public void visibilityOfAllElements(List<WebElement> elements,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.visibilityOfAllElements(elements)); } public WebElement waitForElementToBePresent(By locator,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.presenceOfElementLocated(locator)); return getElement(locator); } public WebElement waitForElementToBeClickable(By locator,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.elementToBeClickable(locator)); return getElement(locator); } public WebElement waitForElementToBeVisible(By locator,int timeout) { WebElement element=getElement(locator); WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.visibilityOf(element)); return element; } public WebElement waitForElementToBeVisibilityLocated(By locator,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); return getElement(locator); } public String waitForUrl(String url,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.urlContains(url)); return driver.getCurrentUrl(); } public boolean waitForAlerttoBePresent(By locator,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.alertIsPresent()); return true; } public void clickWhenReady(By locator,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.elementToBeClickable(locator)); getElement(locator).click(); } public String waitForTitleToBePresent(String title,int timeout) { WebDriverWait wait=new WebDriverWait(driver,timeout); wait.until(ExpectedConditions.titleContains(title)); return driver.getTitle(); } }
package com.paleimitations.schoolsofmagic.common.containers; import com.paleimitations.schoolsofmagic.common.registries.ContainerRegistry; import com.paleimitations.schoolsofmagic.common.tileentities.MortarTileEntity; import com.paleimitations.schoolsofmagic.common.tileentities.TeapotTileEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.network.IContainerFactory; public class TeapotContainerProvider extends AbstractContainerProvider<TeapotContainer> { private final TeapotTileEntity teapot; public TeapotContainerProvider(TeapotTileEntity teapot) { super(ContainerRegistry.TEAPOT_CONTAINER.get()); this.teapot = teapot; } @Override public ITextComponent getDisplayName() { return teapot.getDisplayName(); } @Override public TeapotContainer createMenu(int id, PlayerInventory plInventory, PlayerEntity player) { return (TeapotContainer) teapot.createMenu(id, plInventory, player); } public static TeapotContainer createFromPacket(int id, PlayerInventory plInventory, PacketBuffer data) { BlockPos pos = BlockPos.of(data.readLong()); PlayerEntity player = plInventory.player; if(player.level.getBlockEntity(pos) instanceof TeapotTileEntity) { return (TeapotContainer) ((TeapotTileEntity) player.level.getBlockEntity(pos)).createMenu(id, plInventory, player); } return null; } @Override protected void writeExtraData(PacketBuffer buf) { buf.writeLong(teapot.getBlockPos().asLong()); } public static class Factory implements IContainerFactory<TeapotContainer> { @Override public TeapotContainer create(int windowId, PlayerInventory inv, PacketBuffer data) { return TeapotContainerProvider.createFromPacket(windowId, inv, data); } } }
package com.espendwise.manta.util.arguments.resolvers; import com.espendwise.manta.util.Constants; import com.espendwise.manta.util.alert.AppLocale; import com.espendwise.manta.util.arguments.ArgumentResolver; public class ObjectI18nResolver implements ArgumentResolver<Object> { @Override public String resolve(AppLocale locale, Object obj) { return obj != null ? obj.toString() : Constants.EMPTY; } @Override public String resolve(Object obj) { return obj != null ? obj.toString() : Constants.EMPTY; } }
package kodlamaio.hrms.business.abstracts; import java.util.List; import kodlamaio.hrms.core.utilities.results.DataResult; import kodlamaio.hrms.core.utilities.results.Result; import kodlamaio.hrms.entities.concreates.VerificationCode; public interface VerificationCodeService { Result add(VerificationCode verificationCode); DataResult<String> generateCode(int userId); DataResult<VerificationCode> findByCode(String code); DataResult<List<VerificationCode>> getAll(); }
package member.msite; import cucumber.api.CucumberOptions; /** * Created by admin.son.ton on 1/17/18. * * */ @CucumberOptions( features = {"src/test/java/member/msite/features"}, tags = {"@17480537"}, glue = {"member.msite.step_definitions"}) public class MsiteRunner extends _base.TestRunner {}
package com.sinata.rwxchina.component_home.adapter; import android.content.Context; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.widget.ImageView; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.sinata.rwxchina.basiclib.HttpPath; import com.sinata.rwxchina.basiclib.utils.imageUtils.ImageUtils; import com.sinata.rwxchina.component_home.R; import java.util.List; /** * @author HRR * @datetime 2017/12/11 * @describe 猜你喜欢中商铺展示图片的适配器 * @modifyRecord */ public class OtherLovelyImageAdapter extends BaseQuickAdapter<String,BaseViewHolder>{ private Context mC; public OtherLovelyImageAdapter(@LayoutRes int layoutResId, @Nullable List<String> data,Context context) { super(layoutResId, data); this.mC=context; } @Override protected void convert(BaseViewHolder helper, String item) { ImageUtils.showImage(mC, HttpPath.IMAGEURL+item, (ImageView) helper.getView(R.id.guesslike_recycler_item_img)); } }
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.cmsfacades.rendering.validators.page.impl; import de.hybris.platform.cmsfacades.constants.CmsfacadesConstants; import de.hybris.platform.cmsfacades.dto.RenderingPageValidationDto; import de.hybris.platform.cmsfacades.rendering.validators.page.RenderingPageChecker; import org.springframework.beans.factory.annotation.Required; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; import java.util.List; import java.util.function.Predicate; /** * Validator to validate attributes used to extract a page for rendering. */ public class DefaultRenderingPageValidator implements Validator { private Predicate<String> typeCodeExistsPredicate; private List<RenderingPageChecker> renderingPageCheckers; @Override public boolean supports(Class<?> clazz) { return RenderingPageValidationDto.class.isAssignableFrom(clazz); } @Override public void validate(Object obj, Errors errors) { RenderingPageValidationDto validationDto = (RenderingPageValidationDto) obj; ValidationUtils.rejectIfEmpty(errors, "pageTypeCode", CmsfacadesConstants.FIELD_REQUIRED); if (getTypeCodeExistsPredicate().test(validationDto.getPageTypeCode())) { checkAbstractPage(validationDto, errors); } else { errors.rejectValue("pageTypeCode", CmsfacadesConstants.FIELD_NOT_ALLOWED); } } protected void checkAbstractPage(final RenderingPageValidationDto renderPageValidationDto, final Errors errors) { getRenderingPageCheckers().stream() .filter(checker -> checker.getConstrainedBy().test(renderPageValidationDto.getPageTypeCode())) .forEach(checker -> checker.verify(renderPageValidationDto, errors)); } protected Predicate<String> getTypeCodeExistsPredicate() { return typeCodeExistsPredicate; } @Required public void setTypeCodeExistsPredicate(Predicate<String> typeCodeExistsPredicate) { this.typeCodeExistsPredicate = typeCodeExistsPredicate; } protected List<RenderingPageChecker> getRenderingPageCheckers() { return renderingPageCheckers; } @Required public void setRenderingPageCheckers( List<RenderingPageChecker> renderingPageCheckers) { this.renderingPageCheckers = renderingPageCheckers; } }
/* */ package datechooser.beans.editor.descriptor; /* */ /* */ import datechooser.beans.locale.LocaleUtils; /* */ import java.awt.Font; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class FontDescriptor /* */ extends ClassDescriptor /* */ { /* */ public FontDescriptor() {} /* */ /* */ public Class getDescriptedClass() /* */ { /* 23 */ return Font.class; /* */ } /* */ /* */ public String getDescription(Object value) { /* 27 */ StringBuffer buf = new StringBuffer(); /* 28 */ Font selFont = (Font)value; /* 29 */ buf.append(selFont.getFamily()); /* 30 */ buf.append(", "); /* 31 */ if (selFont.isItalic()) { /* 32 */ buf.append(LocaleUtils.getEditorLocaleString("italic") + ", "); /* */ } /* 34 */ if (selFont.isBold()) { /* 35 */ buf.append(LocaleUtils.getEditorLocaleString("bold") + ", "); /* */ } /* 37 */ buf.append(selFont.getSize()); /* 38 */ return buf.toString(); /* */ } /* */ /* */ public String getJavaDescription(Object value) { /* 42 */ StringBuffer buf = new StringBuffer(); /* 43 */ Font selFont = (Font)value; /* 44 */ buf.append("new " + getClassName() + "("); /* 45 */ buf.append('"' + selFont.getFamily() + '"'); /* 46 */ buf.append(", "); /* 47 */ if ((selFont.isBold()) && (selFont.isItalic())) { /* 48 */ buf.append(getClassName() + ".BOLD + " + getClassName() + ".ITALIC"); /* 49 */ } else if (selFont.isBold()) { /* 50 */ buf.append(getClassName() + ".BOLD"); /* 51 */ } else if (selFont.isItalic()) { /* 52 */ buf.append(getClassName() + ".ITALIC"); /* */ } else { /* 54 */ buf.append(getClassName() + ".PLAIN"); /* */ } /* 56 */ buf.append(", "); /* 57 */ buf.append(selFont.getSize()); /* 58 */ buf.append(")"); /* 59 */ return buf.toString(); /* */ } /* */ } /* Location: /home/work/vm/shared-folder/reverse/ketonix/KetonixUSB-20170310.jar!/datechooser/beans/editor/descriptor/FontDescriptor.class * Java compiler version: 5 (49.0) * JD-Core Version: 0.7.1 */
package lesson18.Ex2; public class Ex2_Autumobile extends Ex2_Transport { private int numberOfWheel; //số bánh xe private String engineType; //loại động cơ private String name; //tên xe private String color; //màu xe private Owner owner; //chủ sở hữu //constructors public Ex2_Autumobile(String brand, String manufactureYear, String address, long price, float weight, String id, int numberOfWheel, String engineType, String name, String color, Owner owner) { super(brand, manufactureYear, address, price, weight, id); this.numberOfWheel = numberOfWheel; this.engineType = engineType; this.name = name; this.color = color; this.owner = owner; } //getter and setter public int getNumberOfWheel() { return numberOfWheel; } public void setNumberOfWheel(int numberOfWheel) { this.numberOfWheel = numberOfWheel; } public String getEngineType() { return engineType; } public void setEngineType(String engineType) { this.engineType = engineType; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public Owner getOwner() { return owner; } public void setOwner(Owner owner) { this.owner = owner; } } class Owner { //lớp chứa các thông tin của chủ xe private String id; private String firstName; private String midName; private String lastName; //constructors public Owner(String id, String firstName, String midName, String lastName) { this.id = id; this.firstName = firstName; this.midName = midName; this.lastName = lastName; } }
package cz.kojotak.udemy.vertx.stockBroker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import cz.kojotak.udemy.vertx.stockBroker.cfg.ConfigLoader; import io.vertx.core.AbstractVerticle; import io.vertx.core.Promise; public class VersionInfoVerticle extends AbstractVerticle { private static final Logger LOG = LoggerFactory.getLogger(VersionInfoVerticle.class); @Override public void start(Promise<Void> startPromise) throws Exception { ConfigLoader .load(vertx) .onFailure(startPromise::fail) .onSuccess(cfg->{ LOG.info("retrieved version from cfg {}", cfg.getVersion()); startPromise.complete(); }); } }
package com.org.c2y2.serv.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.org.c2y2.base.AbstractService; import com.org.c2y2.entity.PptpdAdmin; import com.org.c2y2.mapper.PptpdAdminMapper; import com.org.c2y2.serv.IPptpdAdminService; @Service public class PptpdAdminServiceImpl extends AbstractService<PptpdAdmin> implements IPptpdAdminService { @Autowired protected void setMapper(PptpdAdminMapper pptpdAdminMapper) { this.mapper = pptpdAdminMapper; } /** * * @name insertPptpdAdmin * @todo (用于添加pptpd管理员时的业务处理) * @conditions (这里描述这个方法适用条件 – 可选) * @step (这里描述这个方法业务步骤 – 可选) * @param pptpdAdmin * @throws Exception void * @exception * @author c2y2 Mar 3, 2014 11:05:55 PM * @since 1.0.0 */ @Override public void insertPptpdAdmin(PptpdAdmin pptpdAdmin) throws Exception { String username = (pptpdAdmin.getUsername()==null||pptpdAdmin.getUsername().equals(""))?null:pptpdAdmin.getUsername(); if(username!=null){ Integer flag = checkUserNameUnique(username); if(flag == 0){ this.mapper.insert(pptpdAdmin); }else{ return; } } } /** * * @name checkUserNameUnique * @todo (验证管理员名字的唯一性) * @param username * @return * @throws Exception Integer * @exception * @author c2y2 Mar 3, 2014 11:12:51 PM * @since 1.0.0 */ public Integer checkUserNameUnique(String username) throws Exception{ return ((PptpdAdminMapper)this.mapper).checkUserNameUnique(username); } /** * * @name pptpdSupperAdminLogin * @todo (用于超级管理员登录) * @conditions (超级管理员登录时使用) * @param pptpdAdmin * @return * @throws Exception PptpdAdmin * @exception * @author c2y2 Mar 3, 2014 11:33:27 PM * @since 1.0.0 */ @Override public PptpdAdmin pptpdAdminLogin(PptpdAdmin pptpdAdmin)throws Exception { return ((PptpdAdminMapper)this.mapper).pptpdAdminLogin(pptpdAdmin); } }