text
stringlengths
10
2.72M
package com.smxknife.rocketmq.demo1; import org.apache.rocketmq.client.exception.MQBrokerException; import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.client.producer.DefaultMQProducer; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.remoting.exception.RemotingException; /** * @author smxknife * 2020/5/15 */ public class Producer { public static void main(String[] args) { DefaultMQProducer producer = new DefaultMQProducer("MyGrp"); producer.setNamesrvAddr("localhost:9876"); try { producer.start(); Message msg = new Message("push_topic", "push", "1", "Just for test1".getBytes()); SendResult result = producer.send(msg); System.out.println("id:" + result.getMsgId() + " result:" + result.getSendStatus()); msg = new Message("push_topic", "push", "2", "Just for test2.".getBytes()); result = producer.send(msg); System.out.println("id:" + result.getMsgId() + " result:" + result.getSendStatus()); msg = new Message("push_topic", "push", "1", "Just for test3.".getBytes()); result = producer.send(msg); System.out.println("id:" + result.getMsgId() + " result:" + result.getSendStatus()); } catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) { e.printStackTrace(); } } }
package menusandprograms; /** * @author Stefan Ohlsson * @author Erik Olsson */ import mainstart.Main; import initializers.*; public class StaffMangement { public static void printMenu() { System.out.println("\tEmployeeMangement"); System.out.println("**************************************************"); String decision; do { System.out.println("1. Add or Delete Employee"); System.out.println("2. Update Employee"); System.out.println("3. Search Employee"); System.out.println("4. Display Employee"); System.out.println("0. Main Menu"); decision = Main.sc.nextLine(); switch (decision) { case "1": addOrDeleteDecision(); break; case "2": updateDecision(); break; case "3": searchDecision(); break; case "4": displayDecision(); case "0": MainMenu.printMainMenu(); break; default: System.out.println("Please make a decision..."); } } while (!(decision.equals("1") || decision.equals("2") || decision.equals("3") || decision.equals("4"))); } private static void addOrDeleteDecision() { boolean loop = true; System.out.println("Add or Delete? '+' or '-'"); do { String decision = Main.sc.nextLine(); if (decision.equalsIgnoreCase("+") || decision.equalsIgnoreCase("add")) { loop = false; add(); } else if (decision.equalsIgnoreCase("-") || decision.equalsIgnoreCase("delete")) { loop = false; // Method for DELETE delete(); } else { System.out.println("Please do char '+' or '-'"); System.out.println("Do you want to go back? y or n"); String decision2 = Main.sc.nextLine(); if (decision2.equalsIgnoreCase("y")) { printMenu(); } else { System.out.println("Add or Delete? '+' or '-'"); } } } while (loop); } private static void add() { System.out.println("ADD EMPLOYEE"); System.out.println("****************"); String firstName = addFirstName(); String lastName = addLastName(); int birthYear = addBirthYear(); int salary = addSalary(); String sex = addSex(); addDepartment(firstName, lastName, birthYear, salary, sex); printMenu(); addAnother(); } private static void addDepartment(String firstName, String lastName, int birthYear, int salary, String sex) { System.out.println("Department"); System.out.println("IT , Management or Sales?"); String department; do { department = Main.sc.nextLine(); if (department.equalsIgnoreCase("it")) { addITEmployee(firstName, lastName, birthYear, salary, sex); } else if (department.equalsIgnoreCase("management")) { addManagementEmployee(firstName, lastName, birthYear, salary, sex); } else if (department.equalsIgnoreCase("sales")) { addSalesEmployee(firstName, lastName, birthYear, salary, sex); } else { System.out.println("IT , Management or Sales?"); } } while (!((department.equalsIgnoreCase("it")) || (department.equalsIgnoreCase("management")) || (department.equalsIgnoreCase("sales")))); if (department.equalsIgnoreCase("it")) { System.out.println(department.toUpperCase() + " Employee added to the ArrayList"); } else { System.out.println( department.toUpperCase().charAt(0) + department.substring(1) + " Employee added to the Array"); } } private static String addSex() { boolean loop; System.out.println("Male/Female : "); loop = true; String sex = null; while (loop) { sex = Main.sc.nextLine(); if (!(sex.equalsIgnoreCase("male") || sex.equalsIgnoreCase("female"))) { System.out.println("MALE OR FEMALE?"); } else { loop = false; } } return sex; } private static int addSalary() { boolean loop; boolean hasNext; System.out.println("Salary : "); loop = true; int salary = 0; while (loop) { hasNext = Main.sc.hasNextInt(); if (hasNext) { salary = Main.sc.nextInt(); if (salary < 0) { System.out.println("Invalid salary!"); Main.sc.nextLine(); } else { loop = false; Main.sc.nextLine(); } } else { System.out.println("Thats not even a number!"); Main.sc.nextLine(); // ERROR MESSAGE FOR !INT } } // END OF LOOP return salary; } private static int addBirthYear() { System.out.println("Birth Year : yyyy "); boolean loop = true; boolean hasNext; int birthYear = 0; while (loop) { hasNext = Main.sc.hasNextInt(); if (hasNext) { birthYear = Main.sc.nextInt(); if ((hasNext) && (birthYear > 2018) || (birthYear < 1900)) { System.out.println("You are too young or too old!"); System.out.println("Birthday : yyyy "); Main.sc.nextLine(); } else { loop = false; Main.sc.nextLine(); } } else { System.out.println("Thats not even a number!"); Main.sc.nextLine(); // ERROR MESSAGE FOR !INT } } // END OF LOOP return birthYear; } private static String addLastName() { System.out.println("Last name : "); String lastName = Main.sc.nextLine(); lastName = lastName.toUpperCase().charAt(0) + lastName.substring(1); return lastName; } private static String addFirstName() { System.out.println("First name : "); String firstName = Main.sc.nextLine(); firstName = firstName.toUpperCase().charAt(0) + firstName.substring(1); return firstName; } private static void delete() { System.out.println("DELETE EMPLOYEE"); System.out.println("****************"); Employee del = getEmployee(); System.out.println(del); System.out.println("Are you sure?"); String decision = Main.sc.nextLine(); if (decision.equalsIgnoreCase("yes") || decision.equalsIgnoreCase("y")) { int index = del.getNumber() - 1; Main.employeeList.remove(index); System.out.println("Employee : " + del.getLastName() + ", " + del.getFirstName() + " deleted!"); } printMenu(); } private static Employee getEmployee() { System.out.println("Enter ID number :"); int index = Main.sc.nextInt(); Main.sc.nextLine(); index--; // Array Index Modifier if ((index < 0) || (index > Main.employeeList.size())) { System.out.println("ID NUMBER DOSENT EXIST"); System.out.println("WAS PRINTED AS DEFAULT"); index = 0; return Main.employeeList.get(index); } return Main.employeeList.get(index); } private static void updateDecision() { System.out.println("\tUpdate Employee"); System.out.println("*********************************"); Employee getEmployee = getEmployee(); System.out.println("What do you want to change?"); System.out.println("1. First name : " + getEmployee.getFirstName()); System.out.println("2. Last Name : " + getEmployee.getLastName()); System.out.println("3. Birth year : " + getEmployee.getBirthYear()); System.out.println("4. Salary : " + getEmployee.getSalary()); System.out.println("5. Sex :" + getEmployee.getSex()); System.out.println("6. Department"); System.out.println("0. Menu"); String decision = Main.sc.nextLine(); switch (decision) { case "1": updateFirstName(getEmployee); break; case "2": updateLastName(getEmployee); break; case "3": updateBirthYear(getEmployee); break; case "4": updateSalary(getEmployee); break; case "5": updateSex(getEmployee); break; case "6": updateDepartment(getEmployee); break; case "0": printMenu(); break; } } private static void updateFirstName(Employee employee) { int index = employee.getNumber() - 1; System.out.println("Enter new First Name :"); String newFirstName = Main.sc.nextLine(); Main.employeeList.get(index).setFirstName(newFirstName); System.out.println(employee.toString2()); } private static void updateLastName(Employee employee) { int index = employee.getNumber() - 1; System.out.println("Enter new Last Name :"); String newLastName = Main.sc.nextLine(); Main.employeeList.get(index).setLastName(newLastName); } private static void updateBirthYear(Employee employee) { int index = employee.getNumber() - 1; System.out.println("Enter new birth year :"); int newBirthYear = Main.sc.nextInt(); Main.sc.nextLine(); Main.employeeList.get(index).setBirthYear(newBirthYear); printMenu(); } private static void updateSalary(Employee employee) { int index = employee.getNumber() - 1; System.out.println("Enter new Salary :"); int newSalary = Main.sc.nextInt(); Main.sc.nextLine(); Main.employeeList.get(index).setSalary(newSalary); System.out.println("New salary added!"); printMenu(); } private static void updateSex(Employee employee) { int index = employee.getNumber() - 1; System.out.println("Enter new sex:"); String newSex = Main.sc.nextLine(); Main.employeeList.get(index).setSex(newSex); System.out.println("New sex added!"); printMenu(); } private static void updateDepartment(Employee employee) { int index = employee.getNumber() - 1; // Array Index Modifier int remove = Main.employeeList.size(); System.out.println("To what Department :"); System.out.println("1. IT"); System.out.println("2. Sales"); System.out.println("3. Mangement"); String decision = Main.sc.nextLine(); switch (decision) { case "1": // IT updateITDepartment(employee, index, remove); break; case "2": // Sales updateSalesEmployee(employee, index, remove); break; case "3": // Management updateMangementEmployee(employee, index, remove); break; } printMenu(); } // end of method private static void updateMangementEmployee(Employee employee, int index, int remove) { System.out.println("To wich employee Cathegory??"); System.out.println("1. Chief Executive Officer"); System.out.println("2. Chief Financial Officer"); System.out.println("3. Chief Operations Officer"); String decision3 = Main.sc.nextLine(); switch (decision3) { case "1": if (employee instanceof ChiefExecutiveOfficer) { System.out.println("Employee already in that cathegory!"); break; } ChiefExecutiveOfficer updatedCEO = new ChiefExecutiveOfficer(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "Management", "ChiefExecutiveOfficer"); Main.employeeList.add(updatedCEO); Main.employeeList.set(index, updatedCEO); Main.employeeList.remove(remove); break; case "2": if (employee instanceof ChiefFinancialOfficer) { System.out.println("Employee already in that cathegory!"); break; } ChiefFinancialOfficer updatedCFO = new ChiefFinancialOfficer(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "Management", "ChiefFinancialOfficer"); Main.employeeList.add(updatedCFO); Main.employeeList.set(index, updatedCFO); Main.employeeList.remove(remove); break; case "3": if (employee instanceof ChiefOperationsOfficer) { System.out.println("Employee already in that cathegory!"); break; } ChiefOperationsOfficer updatedCOO = new ChiefOperationsOfficer(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "Management", "ChiefOperationsOfficer"); Main.employeeList.add(updatedCOO); Main.employeeList.set(index, updatedCOO); Main.employeeList.remove(remove); break; } } private static void updateSalesEmployee(Employee employee, int index, int remove) { System.out.println("To wich employee Cathegory??"); System.out.println("1. Account Manager"); System.out.println("2. Market Manager"); String decision2 = Main.sc.nextLine(); switch (decision2) { case "1": if (employee instanceof AccountManager) { System.out.println("Employee already in that cathegory!"); break; } AccountManager updatedAccountManager = new AccountManager(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "Sales", "Account Manager"); Main.employeeList.add(updatedAccountManager); Main.employeeList.set(index, updatedAccountManager); Main.employeeList.remove(remove); break; case "2": if (employee instanceof MarketManager) { System.out.println("Employee already in that cathegory!"); break; } MarketManager updatedMarketManager = new MarketManager(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "Sales", "Market Manager"); Main.employeeList.add(updatedMarketManager); Main.employeeList.set(index, updatedMarketManager); Main.employeeList.remove(remove); break; } } private static void updateITDepartment(Employee employee, int index, int remove) { System.out.println("To wich employee Cathegory??"); System.out.println("1. Tester"); System.out.println("2. Analyst"); System.out.println("3. Developer"); String decision1 = Main.sc.nextLine(); switch (decision1) { case "1": if (employee instanceof Tester) { System.out.println("Employee already in that cathegory!"); break; } Tester updatedTest = new Tester(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "IT", "Tester"); Main.employeeList.add(updatedTest); Main.employeeList.set(index, updatedTest); Main.employeeList.remove(remove); break; case "2": if (employee instanceof Analyst) { System.out.println("Employee already in that cathegory!"); break; } Analyst updatedAnalyst = new Analyst(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "IT", "Analyst"); Main.employeeList.add(updatedAnalyst); Main.employeeList.set(index, updatedAnalyst); Main.employeeList.remove(remove); break; case "3": if (employee instanceof Developer) { System.out.println("Employee already in that cathegory!"); break; } Developer updatedDeveloper = new Developer(employee.getFirstName(), employee.getLastName(), employee.getBirthYear(), employee.getSalary(), 0, employee.getSex(), "IT", "Developer"); Main.employeeList.add(updatedDeveloper); Main.employeeList.set(index, updatedDeveloper); Main.employeeList.remove(remove); break; } } private static void searchDecision() { System.out.println("SEARCH EMPLOYEE"); System.out.println("****************"); System.out.println("Search by :"); System.out.println("1. First name"); System.out.println("2. Last name"); System.out.println("3. Birth Year"); System.out.println("4. Department"); System.out.println("0. Back to Menu"); String decision = Main.sc.nextLine(); switch (decision) { case "1": searchFirstName(); break; case "2": searchLastName(); break; case "3": searchBirthYear(); break; case "4": searchDepartment(); break; case "0": printMenu(); break; } } private static void searchFirstName() { System.out.println("Search by first name"); System.out.println("*********************"); String decision; do { String getName; System.out.println("Enter first name :"); getName = Main.sc.nextLine(); for (Employee employee : Main.employeeList) { if (getName.equalsIgnoreCase(employee.getFirstName())) { System.out.println(employee); } } System.out.println("Do another search?"); decision = Main.sc.nextLine(); } while (decision.equalsIgnoreCase("yes") || (decision.equalsIgnoreCase("y"))); searchDecision(); } private static void searchLastName() { System.out.println("Search by last name"); System.out.println("*********************"); String decision; do { System.out.println("Enter last name :"); String getName = Main.sc.nextLine(); for (Employee employee : Main.employeeList) { if (getName.equalsIgnoreCase(employee.getLastName())) { System.out.println(employee); } } System.out.println("Do another search?"); decision = Main.sc.nextLine(); } while (decision.equalsIgnoreCase("yes") || (decision.equalsIgnoreCase("y"))); searchDecision(); } private static void searchBirthYear() { System.out.println("Search by Birth Year"); System.out.println("*********************"); String decision; do { System.out.println("Enter birth year : yyyy"); String getYear = Main.sc.nextLine(); for (Employee employee : Main.employeeList) { if (getYear.equals(String.valueOf(employee.getBirthYear()))) { System.out.println(employee); } } System.out.println("Do another search?"); decision = Main.sc.nextLine(); } while (decision.equalsIgnoreCase("yes") || (decision.equalsIgnoreCase("y"))); searchDecision(); } private static void searchDepartment() { System.out.println("Search by Department"); System.out.println("*********************"); String decision; do { System.out.println("Wich department?"); System.out.println("1. IT"); System.out.println("2. Sales"); System.out.println("3. Mangement"); decision = Main.sc.nextLine(); switch (decision) { case "1": case "it": displayIT(); break; case "2": case "sales": displaySales(); break; case "3": case "management": displayMangement(); break; } System.out.println("Do another search?"); decision = Main.sc.nextLine(); } while (decision.equalsIgnoreCase("yes") || (decision.equalsIgnoreCase("y"))); searchDecision(); } private static void displayDecision() { System.out.println("Display Employees"); System.out.println("*****************"); System.out.println("1. IT-Department"); System.out.println("2. Sales-Department"); System.out.println("3. Mangement-Department"); System.out.println("4. Everyone"); System.out.println("0. Back to Menu"); String decision = Main.sc.nextLine(); switch (decision) { case "1": case "it": displayIT(); break; case "2": case "sales": displaySales(); break; case "3": case "mangement": displayMangement(); break; case "4": case "all": displayAll(); break; case "0": case "back": printMenu(); break; } displayDecision(); } private static void displayAll() { int counter = 0; for (Employee employee : Main.employeeList) { System.out.println(employee.toString2()); counter++; } System.out.println(counter + " people in the Company at the moment"); } private static void displayMangement() { int counter = 0; for (Employee employee : Main.employeeList) { if (employee instanceof Management) { System.out.println(employee.toString2()); counter++; } } System.out.println(counter + " people in the Mangement department at the moment"); } private static void displaySales() { int counter = 0; for (Employee employee : Main.employeeList) { if (employee instanceof Sales) { System.out.println(employee.toString2()); counter++; } } System.out.println(counter + " people in the Sales department at the moment"); } private static void displayIT() { int counter = 0; for (Employee employee : Main.employeeList) { if (employee instanceof IT) { System.out.println(employee.toString2()); counter++; } } System.out.println(counter + " people in the IT department at the moment"); } private static void addITEmployee(String firstName, String lastName, int birthYear, int salary, String sex) { String department = "IT"; System.out.println("\tAdd IT Employee"); System.out.println("What employee cathegory?\n \n1. Developer\n2. Tester\n3. Analyst"); String decision; do { decision = Main.sc.nextLine(); switch (decision) { case "1": String cathegory = "Developer"; int bonus = bonusControl(); Developer developer = new Developer(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(developer); System.out.println("New " + cathegory + " added"); break; case "2": cathegory = "Tester"; bonus = bonusControl(); Tester tester = new Tester(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(tester); System.out.println("New " + cathegory + " added"); break; case "3": cathegory = "Analyst"; bonus = bonusControl(); Analyst analyst = new Analyst(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(analyst); System.out.println("New " + cathegory + " added"); break; default: System.out.println("Please make a decision..."); } } while (!(decision.equals("1") || decision.equals("2") || decision.equals("3"))); addAnother(); } private static void addManagementEmployee(String firstName, String lastName, int birthYear, int salary, String sex) { String department = "Management"; System.out.println("\tAdd Management Employee"); System.out.println( "What employee cathegory?\n \n1. Chief Executive Officer\n2. Chief Financial Officer\n3. Chief Operations Officer"); String decision; do { decision = Main.sc.nextLine(); switch (decision) { case "1": String cathegory = "Chief Executive Officer"; int bonus = bonusControl(); ChiefExecutiveOfficer chiefExecutiveOfficer = new ChiefExecutiveOfficer(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(chiefExecutiveOfficer); System.out.println("New " + cathegory + " added"); break; case "2": cathegory = "Chief Financial Officer"; bonus = bonusControl(); ChiefFinancialOfficer chiefFinancialOfficer = new ChiefFinancialOfficer(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(chiefFinancialOfficer); System.out.println("New " + cathegory + " added"); break; case "3": cathegory = "Chief Operations Officer"; bonus = bonusControl(); ChiefOperationsOfficer chiefOperationsOfficer = new ChiefOperationsOfficer(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(chiefOperationsOfficer); System.out.println("New " + cathegory + " added"); break; default: System.out.println("Please make a decision..."); } } while (!(decision.equals("1") || decision.equals("2") || decision.equals("3"))); addAnother(); } private static void addSalesEmployee(String firstName, String lastName, int birthYear, int salary, String sex) { String department = "Sales"; System.out.println("\tAdd Sales Employee"); System.out.println("What employee cathegory?\n \n1. Account Manager\n2. Chief Financial Officer"); String decision; do { decision = Main.sc.nextLine(); switch (decision) { case "1": String cathegory = "Account Manager"; int bonus = bonusControl(); AccountManager accountManager = new AccountManager(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(accountManager); System.out.println("New " + cathegory + " added"); break; case "2": cathegory = "Market Manager"; bonus = bonusControl(); MarketManager marketManager = new MarketManager(firstName, lastName, birthYear, salary, bonus, sex, department, cathegory); Main.employeeList.add(marketManager); System.out.println("New " + cathegory + " added"); break; default: System.out.println("Please make a decision..."); } } while (!(decision.equals("1") || decision.equals("2"))); addAnother(); } public static void addAnother() { System.out.println("Do you want to add another?"); System.out.println("Yes or no ?"); String decision = Main.sc.nextLine(); if (decision.equalsIgnoreCase("yes") || (decision.equalsIgnoreCase("y"))) { add(); } else if (decision.equalsIgnoreCase("no") || (decision.equalsIgnoreCase("n"))) { System.out.println("Wich menu?"); System.out.println("1. StaffMangementMenu"); System.out.println("2. Main Menu"); do { decision = Main.sc.nextLine(); switch (decision) { case "1": printMenu(); break; case "2": MainMenu.printMainMenu(); break; default: System.out.println("1. StaffMangementMenu"); System.out.println("2. Main Menu"); } } while (!(decision.equals("1") || decision.equals("2"))); } } public static int bonusControl() { boolean loop; boolean hasNext; System.out.println("Bonus. Please supply bonus points: "); loop = true; int bonus = 0; while (loop) { hasNext = Main.sc.hasNextInt(); if (hasNext) { bonus = Main.sc.nextInt(); if (bonus < 0) { System.out.println("Invalid bonus!"); Main.sc.nextLine(); } else { loop = false; Main.sc.nextLine(); } } else { System.out.println("Thats not even a number!"); Main.sc.nextLine(); // ERROR MESSAGE FOR !INT } } // END OF LOOP return bonus; } }
package rhtn_homework; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Stack; import java.util.StringTokenizer; public class KAKAO_크레인_인형뽑기 { private static StringBuilder sb = new StringBuilder(); private static Stack<Integer> stack = new Stack<>(); private static int ans; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int[][] board = {{0,0,0,0,0},{0,0,1,0,3},{0,2,5,0,1},{4,2,4,4,2},{3,5,1,3,1}}; int[] moves = {1,5,3,5,1,2,1,4}; System.out.println(solution(board, moves)); } public static int solution(int[][] board, int[] moves) { ans = 0; int[][] tmp = {}; for (int i = 0; i < moves.length; i++) { tmp = pick(board, moves[i]-1); } return ans; } public static int[][] pick(int[][] board , int move) { for (int i = 0; i < board.length; i++) { if(board[i][move]==0) continue; else { if(!stack.isEmpty() && stack.peek() == board[i][move]) { stack.pop(); ans+=2; }else stack.add(board[i][move]); board[i][move]=0; break; } } return board; } }
package com.daheka.nl.social.shadowfish.restserver.repository; import com.daheka.nl.social.shadowfish.dao.AppUser; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; /** * Extension interface for the existing CrudRepository */ @Repository public interface AppUserRepository extends CrudRepository<AppUser, Long> { /** * Method to find a user by username * @param username The name of the user * @return The requested user */ AppUser findByUsername(String username); }
package uz.pdp.apphemanagement.payload; import lombok.Data; import javax.validation.constraints.NotNull; import java.sql.Date; import java.util.UUID; @Data public class TaskDto { @NotNull private String name; @NotNull private String description; @NotNull private Date deadline; @NotNull private UUID userId; }
/* * Copyright 2009 Kjetil Valstadsve * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package vanadis.osgi.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import vanadis.core.lang.Not; import vanadis.osgi.Context; import vanadis.osgi.Filter; import vanadis.osgi.Reference; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; final class ServiceProxyHandler<T> implements InvocationHandler { private final Context context; private final Class<T> serviceInterface; private final Filter filter; private final boolean persistent; private Reference<T> reference; ServiceProxyHandler(Context context, Class<T> serviceInterface, Filter filter, boolean persistent) { this.persistent = persistent; this.context = Not.nil(context, "context"); this.serviceInterface = Not.nil(serviceInterface, "service interface"); this.filter = filter; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getDeclaringClass() == Object.class) { return method.invoke(this, args); } Reference<T> reference = getReference(false); if (reference == null) { throw new IllegalStateException(this + ": No target service found"); } return attemptCall(method, args, reference); } private Object attemptCall(Method method, Object[] args, Reference<T> reference) throws IllegalAccessException, InvocationTargetException { T service = reference.getService(); try { if (service == null) { throw new IllegalStateException(this + ": No target service found"); } return method.invoke(service, args); } finally { ungetReference(reference); } } public void close() { if (persistent) { ungetReference(reference); } } private void ungetReference(Reference<T> reference) { if (reference != null) { if (!persistent) { try { reference.unget(); } catch (Exception e) { log.warn(this + " failed to unget " + reference, e); } } } } private Reference<T> getReference(boolean clear) { if (persistent) { if (reference == null || clear) { reference = getFreshReference(); } return reference; } return getFreshReference(); } private Reference<T> getFreshReference() { return context.getReference(serviceInterface, filter); } private static final Logger log = LoggerFactory.getLogger(ServiceProxyHandler.class); }
package com.bingo.code.example.design.strategy.rewrite; /** * �����㷨ʵ�֣�Ϊս�Ժ����ͻ��ͻ�����Ӧ���ļ۸� */ public class CooperateCustomerStrategy implements Strategy{ public double calcPrice(double goodsPrice) { System.out.println("����ս�Ժ����ͻ���ͳһ8��"); return goodsPrice*0.8; } }
package vn.silverbot99.farm_traders.func.map; import org.jetbrains.annotations.NotNull; import be.trikke.intentbuilder.BuildIntent; import be.trikke.intentbuilder.Extra; import vn.silverbot99.core.base.presentation.mvp.android.AndroidMvpView; import vn.silverbot99.core.base.presentation.mvp.android.MvpActivity; import vn.silverbot99.farm_traders.func.map.presentation.MapView; import vn.silverbot99.farm_traders.func.nearest_farm.presentation.model.LocationFarmItemModel; @BuildIntent public class MapActivity extends MvpActivity { @Extra LocationFarmItemModel location; @NotNull @Override public AndroidMvpView createAndroidMvpView() { return new MapView(this,new MapView.ViewCreator(this,null),location); } }
package com.tencent.mm.plugin.card.sharecard.ui; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.tencent.mm.plugin.card.sharecard.a.b; import com.tencent.mm.ui.MMActivity; public final class f { MMActivity gKS; View hyK; b hzM; ImageView hzQ; TextView hzR; TextView hzS; public f(MMActivity mMActivity, View view) { this.gKS = mMActivity; this.hyK = view; } }
package models; import java.util.List; public class Group { private List<User> usersInGroup; private String groupName; private List<Expense> listOfExpenses; public Group(List<User> usersInGroup, String groupName, List<Expense> listOfExpenses) { super(); this.usersInGroup = usersInGroup; this.groupName = groupName; this.listOfExpenses = listOfExpenses; } public void addUserToGroup(User user) { this.usersInGroup.add(user); } public List<User> getUsersInGroup() { return usersInGroup; } public void setUsersInGroup(List<User> usersInGroup) { this.usersInGroup = usersInGroup; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public List<Expense> getListOfExpenses() { return listOfExpenses; } public void setListOfExpenses(List<Expense> listOfExpenses) { this.listOfExpenses = listOfExpenses; } public void addListOfExpenses(List<Expense> listOfExpenses) { this.listOfExpenses = listOfExpenses; } }
package com.zhixinhuixue.querykylin.DTO; import java.math.BigDecimal; public class ClazzExamMethodScoreResDTO { /** * 考点ID */ private Integer methodId; /** * 考点名称 */ private String methodName; /** * 考试次数 */ private Integer examNum; /** * 题目数 */ private Integer topicNum; /** * 错题数 */ private Integer wrongNum; /** * 得分率 */ private BigDecimal scoreRatio; public Integer getMethodId() { return methodId; } public void setMethodId(Integer methodId) { this.methodId = methodId; } public String getMethodName() { return methodName; } public void setMethodName(String methodName) { this.methodName = methodName; } public Integer getExamNum() { return examNum; } public void setExamNum(Integer examNum) { this.examNum = examNum; } public Integer getTopicNum() { return topicNum; } public void setTopicNum(Integer topicNum) { this.topicNum = topicNum; } public Integer getWrongNum() { return wrongNum; } public void setWrongNum(Integer wrongNum) { this.wrongNum = wrongNum; } public BigDecimal getScoreRatio() { return scoreRatio; } public void setScoreRatio(BigDecimal scoreRatio) { this.scoreRatio = scoreRatio; } }
package com.bowlong.reflect; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Hashtable; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Vector; import java.util.WeakHashMap; public class TypeCSharpEx { public static String getType(Object object) { return object.getClass().getName(); } public static String getSimpleType(Object object) { return object.getClass().getSimpleName(); } public static String getBasicType(String t) { if (t.endsWith("Boolean") || t.equals("boolean")) return "bool"; else if (t.endsWith("Byte") || t.equals("byte")) return "byte"; else if (t.endsWith("Short") || t.equals("short")) return "short"; else if (t.endsWith("Integer") || t.equals("int")) return "int"; else if (t.endsWith("Long") || t.equals("long")) return "long"; else if (t.endsWith("Float") || t.equals("float")) return "float"; else if (t.endsWith("Double") || t.equals("double")) return "double"; else if (t.endsWith("String")) return "string"; return t; } public static String typeValue(String t) { if (t.endsWith("Boolean") || t.equals("boolean")) return "false"; else if (t.endsWith("Byte") || t.equals("byte")) return "0"; else if (t.endsWith("Short") || t.equals("short")) return "0"; else if (t.endsWith("Integer") || t.equals("int")) return "0"; else if (t.endsWith("Long") || t.equals("long")) return "0"; else if (t.endsWith("Float") || t.equals("float")) return "0.0"; else if (t.endsWith("Double") || t.equals("double")) return "0.0"; else if (t.endsWith("BigDecimal")) return "0.0"; else if (t.endsWith("String") || t.equals("string")) return "\"\""; else if (t.endsWith("Map") || t.endsWith("Hashtable")) return "new Hashtable()"; else if (t.endsWith("List") || t.endsWith("Vector")) return "new ArrayList()"; return t; } public static String getObjectType(String t) { if (t.endsWith("Boolean") || t.equals("boolean")) return "bool"; else if (t.endsWith("Byte") || t.equals("byte")) return "byte"; else if (t.endsWith("Short") || t.equals("short")) return "short"; else if (t.endsWith("Integer") || t.equals("int")) return "int"; else if (t.endsWith("Long") || t.equals("long")) return "Int64"; else if (t.endsWith("Float") || t.equals("float")) return "flat"; else if (t.endsWith("Double") || t.equals("double")) return "double"; else if (t.endsWith("String") || t.equals("double")) return "string"; else if (t.endsWith(".Map")) return "Hashtable"; else if (t.endsWith(".List")) return "ArrayList"; return t; } public static boolean isNull(Object object) { return object == null; } public static boolean isBoolean(Object object) { return object instanceof Boolean; } public static boolean isByte(Object object) { return object instanceof Byte; } public static boolean isShort(Object object) { return object instanceof Short; } public static boolean isInteger(Object object) { return object instanceof Integer; } public static boolean isLong(Object object) { return object instanceof Long; } public static boolean isFloat(Object object) { return object instanceof Float; } public static boolean isDouble(Object object) { return object instanceof Double; } public static boolean isDate(Object object) { return object instanceof Date; } public static boolean isString(Object object) { return object instanceof String; } public static boolean isByteArray(Object object) { return object instanceof byte[] || object instanceof Byte[]; } public static boolean isBooleanArray(Object object) { return object instanceof boolean[] || object instanceof Boolean[]; } public static boolean isShortArray(Object object) { return object instanceof short[] || object instanceof Short[]; } public static boolean isIntegerArray(Object object) { return object instanceof int[] || object instanceof Integer[]; } public static boolean isLongArray(Object object) { return object instanceof long[] || object instanceof Long[]; } public static boolean isFloatArray(Object object) { return object instanceof float[] || object instanceof Float[]; } public static boolean isDoubleArray(Object object) { return object instanceof double[] || object instanceof Double[]; } public static boolean isVector(Object object) { return object instanceof Vector; } public static boolean isLinkedList(Object object) { return object instanceof LinkedList; } public static boolean isArrayList(Object object) { return object instanceof ArrayList; } public static boolean isList(Object object) { return object instanceof List; } public static boolean isHashtable(Object object) { return object instanceof Hashtable; } public static boolean isHashMap(Object object) { return object instanceof HashMap; } public static boolean isWeakHashMap(Object object) { return object instanceof WeakHashMap; } public static boolean isMap(Object object) { return object instanceof Map; } public static String getDefaultValue(String t, Object v) { if (t.endsWith("Boolean") || t.equals("boolean")) return String.valueOf(v); else if (t.endsWith("Byte") || t.equals("byte")) return String.valueOf(v); else if (t.endsWith("Short") || t.equals("short")) return String.valueOf(v); else if (t.endsWith("Integer") || t.equals("int")) return String.valueOf(v); else if (t.endsWith("Long") || t.equals("long")) return String.valueOf(v); else if (t.endsWith("Float") || t.equals("float")) return String.valueOf(v); else if (t.endsWith("Double") || t.equals("double")) return String.valueOf(v); else if (t.endsWith("String") || t.equals("string")) return String.format("\"%s\"", v); else if (t.endsWith("BigDecimal")) { return String.format("%s", v); } return String.valueOf(v); } }
package chat.signa.net.pingfang.logging.datebase; import android.net.Uri; import android.provider.BaseColumns; /** * Created by Administrator on 2016/1/22. */ public final class AppContract { public AppContract() {} public static final String AUTHORITY = "net.pingfang.signalr.chat.provider"; public static abstract class UserEntity implements BaseColumns{ // 访问Uri public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/user"); // 内容类型 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/net.pingfang.signalr.chat.user"; public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/net.pingfang.signalr.chat.user"; // 默认排序常量 public static final String DEFAULT_SORT_ORDER = "t_id ASC"; public static final String TABLE_NAME="user"; public static final String USER_ID="u_id"; public static final String USER_NAME="u_name"; public static final String USER_PASSWORD="u_password"; public static final String USER_AGE="u_age"; public static final String USER_SEX="u_sex"; public static final String USER_ADDRESS="u_addressb "; } }
package ch24.ex24_01; import java.util.ListResourceBundle; /** * * @author kmori * */ public class GlobalRes_ja_JP extends ListResourceBundle{ public static final String HELLO = "hello"; public static final String GOODBYE = "goodbye"; @Override protected Object[][] getContents() { return contents; } private static final Object[][] contents = { {GlobalRes_ja_JP.HELLO, "こんにちは"}, {GlobalRes_ja_JP.GOODBYE, "さようなら"}, }; }
package collection; import java.util.ArrayList; import java.util.Iterator; import java.util.ListIterator; public class TestArrayList { public static void main(String []args) { ArrayList<String> arrl = new ArrayList<String>(); arrl.add("Jayanta"); arrl.add("Arijit"); arrl.add("Abhijoy"); arrl.add("Manab"); System.out.println("Print with iterator"); Iterator itr = arrl.iterator(); while(itr.hasNext()) { System.out.print(itr.next()+" "); } System.out.println("\n"); System.out.println("Print with for each loop"); for(String str : arrl) { System.out.print(str+" "); } System.out.println("\n"); System.out.println("Traverse with for loop"); for(int i=0; i< arrl.size(); i++) { System.out.print(arrl.get(i)+" "); } System.out.println("\n"); System.out.println("Reverse the list"); ListIterator ltrl = arrl.listIterator(arrl.size()); while(ltrl.hasPrevious()) { System.out.print(ltrl.previous()+" "); } System.out.println("\n"); System.out.println("Reverse with for loop"); for(int j=arrl.size()-1; j >=0; j--) { System.out.print(arrl.get(j)+" "); } } }
package artem; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; @Service public class SimpleTimeCalculator extends Description implements TimeCalculator { @Override public Response calculate(TimeCalcArguments arguments) throws NotTimeException { try { uranus(arguments); this.clear(); int result = getMinutes(arguments.getFinish()) - getMinutes(arguments.getStart()); this.doMainPhase(arguments.getStart(), arguments.getFinish(), getHours(result)); if (arguments.getInputs() != null && arguments.getInputs().length > 0) { for (String r : arguments.getInputs()) result = qwe(result, r); } return Response.create(getHours(result), this.getResult()); } catch (RuntimeException e) { return Response.create(e.getMessage(), "check out description"); } } private void uranus(TimeCalcArguments calcArguments) { String[] T = Arrays.stream(calcArguments.getInputs()) .map(this::saturn) .toArray(String[]::new); String start = saturn(calcArguments.getStart()); String finish = saturn(calcArguments.getFinish()); if (getMinutes(start) > getMinutes(finish)) throw new ArithmeticException("incorrect input: \'Finish\' must be bigger then \'Start\'"); calcArguments.setStart(start); calcArguments.setFinish(finish); calcArguments.setInputs(T); } public String saturn(String input) { String temp = input; if (input.contains(";")) temp = input.replaceAll(";", ":"); else if (input.contains(",")) temp = input.replaceAll(",", "."); if (temp.contains("+") || temp.contains("-")) { if (temp.contains(":")) dumbCheck(temp, TimeCalcArguments.time_interval_pattern); else dumbCheck(temp, TimeCalcArguments.time_amount_pattern); } else dumbCheck(temp, TimeCalcArguments.time_pattern); return temp; } private void dumbCheck(String input, String pattern) { if (!input.matches(pattern)) throw new NotTimeException(input); } private int getMinutes(int time) { return (time / 100) * 60 + time % 100; } public int getMinutes(String time) { return getMinutes(Integer.parseInt(time.replaceAll("\\D", ""))); } private String getHours(int time) { int a = time / 60, b = time % 60; String result, h = a > 1 ? " hours " : " hour "; if (a == 0) result = b + " min "; else if (b == 0) result = a + h; else result = a + h + b + " min "; return result; } private int qwe(int input, String argument) { int arg, result = 0; if (argument.contains(":")) { String[] t = argument.substring(2).split(" "); arg = getMinutes(t[1]) - getMinutes(t[0]); this.doMainPhase(t[0], t[1], getHours(arg)); } else arg = getMinutes(argument); if (argument.charAt(0) == '+') result = input + arg; else if (argument.charAt(0) == '-') result = input - arg; this.doSecondaryPhase(getHours(input), argument.charAt(0) + " " + getHours(arg), getHours(result)); return result; } }
// Will Westrich and Seth Hunter import java.util.Iterator; class TableSTBased implements TableInterface{ private int size; private SearchTreeInterface tree; public TableSTBased(){ tree = new AdaptableBinarySearchTree(); size = 0; } public boolean tableIsEmpty(){ if(size == 0) return true; else return false; } public int tableSize(){ return size; } public void tableInsert(KeyedItem item) throws TableException{ try{ tree.insert(item); ++size; }catch(TreeException e){ throw new TableException("Can't insert duplicates."); } } public boolean tableDelete(Comparable searchKey){ try{ tree.delete(searchKey); --size; return true; }catch(TreeException e){ return false; } } public KeyedItem tableRetrieve(Comparable searchKey){ return tree.retrieve(searchKey); } public Iterator iterator(){ BinaryTreeIterator it = new BinaryTreeIterator(tree.getRootNode()); it.setLevelorder(); return it; } }
/* * created 28.08.2006 * * Copyright 2009, ByteRefinery * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * $Id$ */ package com.byterefinery.rmbench.external.database.jdbc; import java.sql.Connection; import java.sql.Driver; import java.sql.SQLException; import java.util.Properties; /** * adapter interface for JDBC connection creation and release * * @author cse */ public interface IJdbcConnectAdapter { public interface Factory { /** * @param driver the JDBC driver * @param url the connection URL * @param properties the already configured connect properties, which may be amended * by the implementing class * @return a connect adapter that wraps a valid JDBC connection */ IJdbcConnectAdapter create(Driver driver, String url, Properties properties); } /** * @return the JDBC connection wrapped by this object. Note that the results of closing that * connection are undefined, but most likely undesirable * @see #release() */ Connection getConnection() throws SQLException; /** * release this object, by closing the underlying connection and performing any additional * cleanup * * @throws SQLException */ void release() throws SQLException; }
package com.dataflow.exportable; public class MappingInfo { public String templateId; public String description; public String author; public String organisation; public String email; public String date; }
package com.smxknife.kafka.demo02; import org.apache.kafka.clients.consumer.ConsumerInterceptor; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; import org.apache.kafka.clients.consumer.OffsetAndMetadata; import org.apache.kafka.common.TopicPartition; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 给消息设置过期时间 * @author smxknife * 2020/8/31 */ public class _02_9_ConsumerInterceptorTTL implements ConsumerInterceptor<String, String> { private static final long EXPIRE_INTERVAL = 10 * 1000; @Override public ConsumerRecords<String, String> onConsume(ConsumerRecords<String, String> consumerRecords) { System.out.println("...onConsumer"); final long now = System.currentTimeMillis(); Map<TopicPartition, List<ConsumerRecord<String, String>>> newConsumerRecords = new HashMap<>(); consumerRecords.partitions().forEach(tp -> { final List<ConsumerRecord<String, String>> records = consumerRecords.records(tp); final List<ConsumerRecord<String, String>> newRecords = newConsumerRecords.get(tp); records.forEach(rd -> { // 注意这里,每一个ConsumerRecord都有一个timestamp,那么在消费的时候,可以与当前的时间进行判断,如果超过了 // 最大时间,判断为过期了 final long timestamp = rd.timestamp(); if ((now - timestamp) < EXPIRE_INTERVAL) { newRecords.add(rd); } if (!newRecords.isEmpty()) { newConsumerRecords.put(tp, newRecords); } }); }); return new ConsumerRecords<>(newConsumerRecords); } @Override public void onCommit(Map<TopicPartition, OffsetAndMetadata> map) { System.out.println("...onCommit | " + map); } @Override public void close() { System.out.println("...close"); } @Override public void configure(Map<String, ?> map) { System.out.println("...configure | " + map); } }
package com.guille.util; import java.awt.Component; import java.awt.Image; import javax.swing.ImageIcon; public class Images { /** * Given a component a the path of the image will compute the resized image for that specific component. * * @param comp where the image is going to be placed. * @param picture to set. * @return an ImagaIcon that has the same size as the component given. */ public static ImageIcon resize(Component comp, String picture) { ImageIcon imageIcon = new ImageIcon(picture); // load the image to a imageIcon Image image = imageIcon.getImage(); // transform it Image newimg = image.getScaledInstance(comp.getWidth(), comp.getHeight(), java.awt.Image.SCALE_SMOOTH); // scale it the smooth way imageIcon = new ImageIcon(newimg); // transform it back return imageIcon; } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package co.th.aten.football.dao; import co.th.aten.football.model.VideoModel; import java.util.List; import javax.sql.DataSource; /** * * @author Atenpunk */ public interface VideoPlayersDao { public DataSource getDataSource(); public void setDataSource(DataSource dataSource); public boolean insertVideoPlayer(VideoModel videoModel); public int getMaxVideoId(); public List<VideoModel> searchByKeyWord(int playerId); public boolean deleteVideoByPlayerId(int playerId); public boolean deleteVideoByVideoId(int videoId); }
package kh.cocoa.dto; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.sql.Timestamp; @Data @NoArgsConstructor public class MessengerViewDTO { private int seq; private String type; private String name; private int party_seq; private int emp_code; private String contents; private String msg_type; private Timestamp write_date; //추가부분 private String empname; private String deptname; private String teamname; private String posname; // 의진추가 - 프로필사진 private String profile; @Builder public MessengerViewDTO(int seq, String type, String name, int party_seq, int emp_code, String contents, String msg_type, Timestamp write_date, String empname, String deptname, String teamname, String posname, String profile) { this.seq = seq; this.type = type; this.name = name; this.party_seq = party_seq; this.emp_code = emp_code; this.contents = contents; this.msg_type = msg_type; this.write_date = write_date; this.empname = empname; this.deptname = deptname; this.teamname = teamname; this.posname = posname; this.profile = profile; } }
package com.ejsfbu.app_main.DialogFragments; import android.content.Intent; import android.graphics.Point; import android.os.Bundle; import android.view.Display; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.DialogFragment; import com.ejsfbu.app_main.Activities.AddGoalActivity; import com.ejsfbu.app_main.Activities.SignUpActivity; import com.ejsfbu.app_main.R; import com.ejsfbu.app_main.Models.User; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseUser; import com.parse.SaveCallback; import java.util.List; public class NeedsParentDialogFragment extends DialogFragment { private TextView tvNeedsParentChildCode; private Button bNeedsParentParentSignUp; private Button bNeedsParentSubmit; private EditText etNeedsParentParentCode; private String parentCode; private User parent; private User user; public NeedsParentDialogFragment() { } public static NeedsParentDialogFragment newInstance(String title) { NeedsParentDialogFragment needsParentDialogFragment = new NeedsParentDialogFragment(); Bundle args = new Bundle(); args.putString("title", title); needsParentDialogFragment.setArguments(args); return needsParentDialogFragment; } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_needs_parent, container); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); user = (User) ParseUser.getCurrentUser(); tvNeedsParentChildCode = view.findViewById(R.id.tvNeedsParentChildCode); tvNeedsParentChildCode.setText(user.getObjectId()); bNeedsParentParentSignUp = view.findViewById(R.id.bNeedsParentParentSignUp); bNeedsParentParentSignUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ParseUser.logOut(); Intent intent = new Intent(getContext(), SignUpActivity.class); intent.putExtra("isParent", true); getContext().startActivity(intent); getActivity().finish(); } }); etNeedsParentParentCode = view.findViewById(R.id.etNeedsParentParentCode); bNeedsParentSubmit = view.findViewById(R.id.bNeedsParentSubmit); bNeedsParentSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { parentCode = etNeedsParentParentCode.getText().toString(); getParentFromCode(parentCode); } }); String title = getArguments().getString("title", "Needs Parent"); getDialog().setTitle(title); tvNeedsParentChildCode.requestFocus(); getDialog().setCanceledOnTouchOutside(false); } @Override public void onResume() { Window window = getDialog().getWindow(); Point size = new Point(); Display display = window.getWindowManager().getDefaultDisplay(); display.getSize(size); window.setLayout((int) (size.x * 0.9), WindowManager.LayoutParams.WRAP_CONTENT); window.setGravity(Gravity.CENTER); super.onResume(); } public void getParentFromCode(String parentCode) { User.Query userQuery = new User.Query(); userQuery.whereEqualTo("objectId", parentCode); userQuery.findInBackground(new FindCallback<User>() { @Override public void done(List<User> objects, ParseException e) { if (objects.size() == 0) { Toast.makeText(NeedsParentDialogFragment.this.getContext(), "Parent code is invalid", Toast.LENGTH_LONG).show(); parent = null; } else { parent = objects.get(0); updateUser(); } } }); } public void updateUser() { user.addParent(parent); user.setNeedsParent(false); user.saveInBackground(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { Toast.makeText(NeedsParentDialogFragment.this.getContext(), "Account Validated", Toast.LENGTH_LONG).show(); Intent intent = new Intent( NeedsParentDialogFragment.this.getContext(), AddGoalActivity.class); NeedsParentDialogFragment.this.getContext().startActivity(intent); NeedsParentDialogFragment.this.getActivity().finish(); } else { Toast.makeText(NeedsParentDialogFragment.this.getContext(), "Validation Error", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } } }); } }
package com.tencent.mm.plugin.dbbackup; import com.tencent.mm.model.au; import com.tencent.mm.model.c; import com.tencent.mm.plugin.dbbackup.d.9; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.vfs.b; class d$9$2 implements Runnable { final /* synthetic */ boolean hZs; final /* synthetic */ b iaa; final /* synthetic */ 9 iay; d$9$2(9 9, boolean z, b bVar) { this.iay = 9; this.hZs = z; this.iaa = bVar; } public final void run() { d.a(this.iay.iam, null); au.HU(); long length = new b(c.DR()).length(); long cja = bi.cja(); if (length == 0) { x.i("MicroMsg.SubCoreDBBackup", "Invalid database size, backup canceled."); } else if (length > d.f(this.iay.iam) || length > cja) { x.i("MicroMsg.SubCoreDBBackup", "Not enough disk space, backup canceled."); h hVar = h.mEJ; Object[] objArr = new Object[2]; objArr[0] = Integer.valueOf(10008); objArr[1] = String.format("%d|%d", new Object[]{Long.valueOf(length), Long.valueOf(cja)}); hVar.h(11098, objArr); } else { d.d(this.iay.iam, this.iay.iam.a(this.hZs, this.iaa)); if (d.o(this.iay.iam)) { x.i("MicroMsg.SubCoreDBBackup", "Auto database backup started."); } } } }
/** * Test class for BST * Expected output: * * TESTING INTEGERS * Root: 6 * * 4 exists: true * 7 exists: true * * 0 exists: false * 11 exists: false * * Printed in order: * 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * * TESTING STRINGS * Root: Crabcake * * Salmon exists: true * Aaron exists: true * * Biscotti exists: false * Shark exists: false * * Printed in order: * Aardvark * Aaron * Biscuit * Boulevard * Crabcake * Dalmation * Salmon * Salmons * Shunty * * @author Jesse Li */ public class BstTester <T> { public static void main(String[] args) { System.out.println("TESTING INTEGERS"); BST<Integer> tree = new BST<Integer>(); tree.insert(6); tree.insert(3); tree.insert(7); tree.insert(4); tree.insert(8); tree.insert(1); tree.insert(2); tree.insert(5); tree.insert(9); System.out.println("Root: " + tree.root.get()); System.out.println(); System.out.println("4 exists: " + tree.exists(4)); System.out.println("7 exists: " + tree.exists(7)); System.out.println(); System.out.println("0 exists: " + tree.exists(0)); System.out.println("11 exists: " + tree.exists(11)); System.out.println("\nPrinted in order:"); tree.inOrderPrint(); System.out.println(); /////////////////////////////////////////////////// System.out.println("TESTING STRINGS"); BST<String> tree2 = new BST<String>(); tree2.insert("Crabcake"); tree2.insert("Zebra"); tree2.insert("Aardvark"); tree2.insert("Dalmation"); tree2.insert("Salmons"); tree2.insert("Boulevard"); tree2.insert("Aaron"); tree2.insert("Salmon"); tree2.insert("Shunty"); System.out.println("Root: " + tree2.root.get()); System.out.println(); System.out.println("Salmon exists: " + tree2.exists("Salmon")); System.out.println("Aaron exists: " + tree2.exists("Aaron")); System.out.println(); System.out.println("Biscotti exists: " + tree2.exists("Biscotti")); System.out.println("Shark exists: " + tree2.exists("Shark")); System.out.println("\nPrinted in order:"); tree2.inOrderPrint(); } }
package com.tencent.mm.ui.transmit; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.BitmapFactory.Options; import android.os.Bundle; import android.text.TextUtils; import com.tencent.mm.R; import com.tencent.mm.ab.e; import com.tencent.mm.ab.f; import com.tencent.mm.ak.l; import com.tencent.mm.ak.o; import com.tencent.mm.compatible.util.d; import com.tencent.mm.g.a.n; import com.tencent.mm.g.a.ow; import com.tencent.mm.g.a.px; import com.tencent.mm.g.a.py; import com.tencent.mm.model.au; import com.tencent.mm.model.br; import com.tencent.mm.model.ca; import com.tencent.mm.model.m; import com.tencent.mm.model.q; import com.tencent.mm.model.s; import com.tencent.mm.modelcdntran.g; import com.tencent.mm.modelcdntran.i; import com.tencent.mm.modelsfs.FileOp; import com.tencent.mm.modelvideo.r; import com.tencent.mm.modelvideo.t; import com.tencent.mm.opensdk.modelmsg.WXEmojiObject; import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.sns.i$l; import com.tencent.mm.pluginsdk.model.app.aa; import com.tencent.mm.pluginsdk.model.app.b; import com.tencent.mm.pointers.PInt; import com.tencent.mm.pointers.PString; import com.tencent.mm.sdk.platformtools.MMBitmapFactory; import com.tencent.mm.sdk.platformtools.MMBitmapFactory.DecodeResultLogger; import com.tencent.mm.sdk.platformtools.MMBitmapFactory.KVStatHelper; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.bd; import com.tencent.mm.storage.emotion.EmojiInfo; import com.tencent.mm.ui.MMBaseActivity; import com.tencent.mm.ui.ak; import com.tencent.mm.ui.chatting.ChattingUI; import com.tencent.mm.ui.chatting.j; import com.tencent.mm.ui.widget.a.c; import com.tencent.mm.y.g.a; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import junit.framework.Assert; public class MsgRetransmitUI extends MMBaseActivity implements e { public long bJC; private String bOX; private float bSx; public String bWW; private int dTO = 0; private float dVI; private String dVJ; private f dVg = null; private ProgressDialog eHw = null; public String fileName; private String fmS; long hpD; private int length; private ag mHandler = new ag(); public int msgType; boolean qIZ; private long startTime = 0; private boolean tFy = false; private boolean uDA; private boolean uDB = true; private boolean uDC = true; private int uDD = 0; private int uDE; private String uDF; private String uDG; private int uDH; private int uDI; private boolean uDJ = true; boolean uDK = false; public List<String> uDl; private String uDm = null; private boolean uDn = true; private boolean uDo = false; private c uDp; private int uDq = 0; private int uDr = 0; private l uDs = null; private boolean uDt = false; private List<String> uDu = null; private int uDv = 0; private int uDw = 0; private boolean uDx = false; private boolean uDy = false; private int uDz; private int ubT = -1; public void onCreate(Bundle bundle) { super.onCreate(bundle); overridePendingTransition(0, 0); ak.a(getWindow()); x.i("MicroMsg.MsgRetransmitUI", "on activity create"); this.startTime = bi.VE(); this.msgType = getIntent().getIntExtra("Retr_Msg_Type", -1); this.bWW = getIntent().getStringExtra("Retr_Msg_content"); this.bJC = getIntent().getLongExtra("Retr_Msg_Id", -1); this.fileName = getIntent().getStringExtra("Retr_File_Name"); this.uDu = getIntent().getStringArrayListExtra("Retr_File_Path_List"); boolean z = this.uDu != null && this.uDu.size() > 0; this.uDx = z; this.dTO = getIntent().getIntExtra("Retr_Compress_Type", 0); this.uDr = getIntent().getIntExtra("Retr_Scene", 0); this.length = getIntent().getIntExtra("Retr_length", 0); this.uDq = getIntent().getIntExtra("Retr_video_isexport", 0); this.uDm = getIntent().getStringExtra("Retr_Msg_thumb_path"); this.uDn = getIntent().getBooleanExtra("Retr_go_to_chattingUI", true); this.uDB = getIntent().getBooleanExtra("Retr_start_where_you_are", true); Intent intent = getIntent(); String str = "Multi_Retr"; if (this.uDr == 0) { z = true; } else { z = false; } this.uDC = intent.getBooleanExtra(str, z); if (this.uDC) { this.uDB = true; } this.uDo = getIntent().getBooleanExtra("Retr_show_success_tips", this.uDB); this.uDy = getIntent().getBooleanExtra("Edit_Mode_Sigle_Msg", false); this.tFy = getIntent().getBooleanExtra("is_group_chat", false); this.ubT = getIntent().getIntExtra("Retr_Biz_Msg_Selected_Msg_Index", -1); this.bOX = getIntent().getStringExtra("Retr_NewYear_Thumb_Path"); this.uDz = getIntent().getIntExtra("Retr_MsgImgScene", 0); this.dVI = getIntent().getFloatExtra("Retr_Longtitude", -1000.0f); this.bSx = getIntent().getFloatExtra("Retr_Latitude", -1000.0f); this.dVJ = getIntent().getStringExtra("Retr_AttachedContent"); this.uDA = "gallery".equals(getIntent().getStringExtra("Retr_From")); this.fmS = getIntent().getStringExtra("reportSessionId"); this.uDE = getIntent().getIntExtra("Retr_MsgFromScene", 0); this.uDF = getIntent().getStringExtra("Retr_MsgFromUserName"); this.uDG = getIntent().getStringExtra("Retr_MsgTalker"); this.uDH = getIntent().getIntExtra("Retr_MsgAppBrandFromScene", 1); this.uDI = getIntent().getIntExtra("Retr_MsgAppBrandServiceType", 0); au.DF().a(i$l.AppCompatTheme_spinnerStyle, this); if (!d.fR(19)) { setContentView(R.i.black_empty_layout); } Intent intent2 = new Intent(this, SelectConversationUI.class); intent2.putExtra("scene", 8); intent2.putExtra("select_is_ret", true); if (this.uDC) { intent2.putExtra("mutil_select_is_ret", true); } switch (this.msgType) { case 2: case 6: case 7: case 14: case 15: case 16: intent2.putExtra("appbrand_params", getIntent().getSerializableExtra("appbrand_params")); if (this.uDE == 3) { intent2.putExtra("scene_from", 3); } intent2.putExtra("Retr_Biz_Msg_Selected_Msg_Index", this.ubT); intent2.putExtra("Retr_Big_File", getIntent().getBooleanExtra("Retr_Big_File", false)); intent2.putExtra("Select_Conv_Type", 3); break; case 13: intent2.putExtra("Select_Conv_Type", 11); break; default: intent2.putExtra("Select_Conv_Type", 3); break; } intent2.putExtra("Retr_Msg_Type", this.msgType); intent2.putExtra("Retr_Msg_Id", this.bJC); intent2.putExtra("Retr_Msg_content", this.bWW); intent2.putExtra("image_path", this.fileName); startActivityForResult(intent2, 0); } public void finish() { super.finish(); overridePendingTransition(0, 0); } protected void onDestroy() { if (!this.uDt) { au.DF().b(i$l.AppCompatTheme_spinnerStyle, this); } super.onDestroy(); } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void cAb() { /* r15 = this; r14 = 3; r8 = 2; r1 = 0; r4 = 1; r6 = 0; r0 = r15.uDr; switch(r0) { case 0: goto L_0x0021; case 1: goto L_0x0406; case 2: goto L_0x04ca; default: goto L_0x000a; }; L_0x000a: r0 = "MicroMsg.MsgRetransmitUI"; r1 = "unknown scene %s"; r2 = new java.lang.Object[r4]; r3 = r15.uDr; r3 = java.lang.Integer.valueOf(r3); r2[r6] = r3; com.tencent.mm.sdk.platformtools.x.e(r0, r1, r2); r15.finish(); L_0x0020: return; L_0x0021: r0 = r15.msgType; switch(r0) { case 0: goto L_0x007c; case 1: goto L_0x007c; case 2: goto L_0x0039; case 3: goto L_0x0026; case 4: goto L_0x0087; case 5: goto L_0x007c; case 6: goto L_0x0039; case 7: goto L_0x00a9; case 8: goto L_0x007c; case 9: goto L_0x00c7; case 10: goto L_0x0039; case 11: goto L_0x007c; case 12: goto L_0x0039; case 13: goto L_0x0039; case 14: goto L_0x0039; case 15: goto L_0x00a4; case 16: goto L_0x0039; default: goto L_0x0026; }; L_0x0026: r0 = "MicroMsg.MsgRetransmitUI"; r2 = "unknown type %s"; r3 = new java.lang.Object[r4]; r5 = r15.msgType; r5 = java.lang.Integer.valueOf(r5); r3[r6] = r5; com.tencent.mm.sdk.platformtools.x.e(r0, r2, r3); L_0x0039: r0 = r4; L_0x003a: if (r0 == 0) goto L_0x0020; L_0x003c: r0 = r15.msgType; r2 = 11; if (r0 == r2) goto L_0x0046; L_0x0042: r0 = r15.msgType; if (r0 != r4) goto L_0x013d; L_0x0046: r0 = r15.uDl; r1 = "MicroMsg.MsgRetransmitUI"; r2 = "processVideoTransfer"; com.tencent.mm.sdk.platformtools.x.i(r1, r2); r1 = 11; r2 = r15.msgType; if (r1 != r2) goto L_0x00e5; L_0x0057: r1 = r15.fileName; r1 = com.tencent.mm.modelvideo.t.nY(r1); if (r1 == 0) goto L_0x00e5; L_0x005f: r0 = r15.getResources(); r1 = com.tencent.mm.R.l.sendrequest_send_fail; r0 = r0.getString(r1); r1 = ""; com.tencent.mm.ui.widget.snackbar.b.d(r15, r0, r1); r0 = r15.mHandler; r1 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$15; r1.<init>(r15); r2 = 1800; // 0x708 float:2.522E-42 double:8.893E-321; r0.postDelayed(r1, r2); goto L_0x0020; L_0x007c: r0 = r15.cAc(); if (r0 != 0) goto L_0x0039; L_0x0082: r15.finish(); r0 = r6; goto L_0x003a; L_0x0087: r0 = r15.bWW; if (r0 == 0) goto L_0x0096; L_0x008b: r0 = r15.bWW; r2 = ""; r0 = r0.equals(r2); if (r0 == 0) goto L_0x0039; L_0x0096: r0 = "MicroMsg.MsgRetransmitUI"; r2 = "Transfer text erro: content null"; com.tencent.mm.sdk.platformtools.x.e(r0, r2); r15.finish(); r0 = r6; goto L_0x003a; L_0x00a4: r15.finish(); r0 = r6; goto L_0x003a; L_0x00a9: r0 = r15.cAc(); if (r0 != 0) goto L_0x00b4; L_0x00af: r15.finish(); r0 = r6; goto L_0x003a; L_0x00b4: r0 = r15.fileName; if (r0 != 0) goto L_0x0039; L_0x00b8: r0 = "MicroMsg.MsgRetransmitUI"; r2 = "Transfer fileName erro: fileName null"; com.tencent.mm.sdk.platformtools.x.e(r0, r2); r15.finish(); r0 = r6; goto L_0x003a; L_0x00c7: r0 = r15.bWW; if (r0 == 0) goto L_0x00d6; L_0x00cb: r0 = r15.bWW; r2 = ""; r0 = r0.equals(r2); if (r0 == 0) goto L_0x0039; L_0x00d6: r0 = "MicroMsg.MsgRetransmitUI"; r2 = "Transfer text erro: content null"; com.tencent.mm.sdk.platformtools.x.e(r0, r2); r15.finish(); r0 = r6; goto L_0x003a; L_0x00e5: r1 = r15.fileName; r1 = com.tencent.mm.modelvideo.t.nW(r1); if (r1 == 0) goto L_0x00f3; L_0x00ed: r2 = r1.status; r3 = 199; // 0xc7 float:2.79E-43 double:9.83E-322; if (r2 != r3) goto L_0x00f8; L_0x00f3: r15.ec(r0); goto L_0x0020; L_0x00f8: r2 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$9; r2.<init>(r15, r0); r0 = com.tencent.mm.modelvideo.o.Ta(); r3 = android.os.Looper.getMainLooper(); r0.a(r2, r3); r0 = "MicroMsg.MsgRetransmitUI"; r2 = "oreh sendVideo start fileName:%s"; r3 = new java.lang.Object[r4]; r4 = r15.fileName; r3[r6] = r4; com.tencent.mm.sdk.platformtools.x.i(r0, r2, r3); r0 = r1.To(); if (r0 == 0) goto L_0x012d; L_0x011d: r0 = "MicroMsg.MsgRetransmitUI"; r1 = "start complete online video"; com.tencent.mm.sdk.platformtools.x.i(r0, r1); r0 = r15.fileName; com.tencent.mm.modelvideo.t.oa(r0); goto L_0x0020; L_0x012d: r0 = "MicroMsg.MsgRetransmitUI"; r1 = "start complete offline video"; com.tencent.mm.sdk.platformtools.x.i(r0, r1); r0 = r15.fileName; com.tencent.mm.modelvideo.t.nS(r0); goto L_0x0020; L_0x013d: r0 = r15.msgType; if (r0 != 0) goto L_0x0149; L_0x0141: r0 = r15.uDl; r0 = r0.size(); r15.uDD = r0; L_0x0149: r0 = r15.uDl; r0 = r0.size(); r2 = r15.uDl; r9 = r2.iterator(); r2 = r0; r3 = r4; L_0x0157: r0 = r9.hasNext(); if (r0 == 0) goto L_0x0269; L_0x015d: r0 = r9.next(); r0 = (java.lang.String) r0; r2 = r2 + -1; if (r2 != 0) goto L_0x0177; L_0x0167: r5 = r4; L_0x0168: r7 = r15.msgType; switch(r7) { case 0: goto L_0x0179; case 1: goto L_0x016d; case 2: goto L_0x018e; case 3: goto L_0x016d; case 4: goto L_0x0194; case 5: goto L_0x01ab; case 6: goto L_0x01b1; case 7: goto L_0x01cd; case 8: goto L_0x01e3; case 9: goto L_0x0207; case 10: goto L_0x021a; case 11: goto L_0x016d; case 12: goto L_0x0241; case 13: goto L_0x0247; case 14: goto L_0x024d; case 15: goto L_0x016d; case 16: goto L_0x018e; default: goto L_0x016d; }; L_0x016d: r0 = r3; L_0x016e: r3 = r15.uDy; if (r3 == 0) goto L_0x0175; L_0x0172: com.tencent.mm.ui.chatting.k.lR(r5); L_0x0175: r3 = r0; goto L_0x0157; L_0x0177: r5 = r6; goto L_0x0168; L_0x0179: r7 = com.tencent.mm.model.au.Em(); r7.uW(); r7 = com.tencent.mm.model.au.Em(); r10 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$1; r10.<init>(r0); r7.H(r10); r0 = r3; goto L_0x016e; L_0x018e: r3 = r15.abh(r0); r0 = r3; goto L_0x016e; L_0x0194: com.tencent.mm.model.q.GF(); r3 = new com.tencent.mm.modelmulti.i; r7 = r15.bWW; r10 = com.tencent.mm.model.s.hQ(r0); r3.<init>(r0, r7, r10); r0 = com.tencent.mm.model.au.DF(); r0.a(r3, r6); r0 = r4; goto L_0x016e; L_0x01ab: r3 = r15.bB(r0, r6); r0 = r3; goto L_0x016e; L_0x01b1: r3 = r15.bWW; r3 = com.tencent.mm.sdk.platformtools.bi.WT(r3); r3 = com.tencent.mm.y.g.a.gp(r3); if (r3 != 0) goto L_0x01c8; L_0x01bd: r0 = "MicroMsg.MsgRetransmitUI"; r3 = "transfer app message error: app content null"; com.tencent.mm.sdk.platformtools.x.e(r0, r3); r0 = r6; goto L_0x016e; L_0x01c8: r15.a(r0, r3, r1, r1); r0 = r4; goto L_0x016e; L_0x01cd: r3 = r15.fileName; r7 = r15.length; r0 = com.tencent.mm.modelvoice.q.e(r0, r3, r7); r3 = new com.tencent.mm.modelvoice.f; r3.<init>(r0, r4); r0 = com.tencent.mm.model.au.DF(); r0.a(r3, r6); r0 = r4; goto L_0x016e; L_0x01e3: r7 = r15.bWW; r7 = com.tencent.mm.storage.bd.a.YV(r7); r10 = new com.tencent.mm.modelmulti.i; r11 = r15.bWW; r7 = r7.otZ; r7 = com.tencent.mm.storage.ab.XR(r7); if (r7 == 0) goto L_0x0204; L_0x01f5: r7 = 66; L_0x01f7: r10.<init>(r0, r11, r7); r0 = com.tencent.mm.model.au.DF(); r0.a(r10, r6); r0 = r3; goto L_0x016e; L_0x0204: r7 = 42; goto L_0x01f7; L_0x0207: r3 = new com.tencent.mm.modelmulti.i; r7 = r15.bWW; r10 = 48; r3.<init>(r0, r7, r10); r0 = com.tencent.mm.model.au.DF(); r0.a(r3, r6); r0 = r4; goto L_0x016e; L_0x021a: r7 = new com.tencent.mm.g.a.mw; r7.<init>(); r10 = r7.bXL; r11 = 4; r10.type = r11; r10 = r7.bXL; com.tencent.mm.model.au.HU(); r11 = com.tencent.mm.model.c.FT(); r12 = r15.bJC; r11 = r11.dW(r12); r10.bXQ = r11; r10 = r7.bXL; r10.toUser = r0; r0 = com.tencent.mm.sdk.b.a.sFg; r0.m(r7); r0 = r3; goto L_0x016e; L_0x0241: com.tencent.mm.ui.chatting.k.k(r15, r0, r5); r0 = r3; goto L_0x016e; L_0x0247: com.tencent.mm.ui.chatting.k.j(r15, r0, r5); r0 = r3; goto L_0x016e; L_0x024d: r7 = new com.tencent.mm.g.a.pi; r7.<init>(); r10 = r7.cag; r12 = r15.bJC; r10.bIZ = r12; r10 = r7.cag; r11 = r15.bWW; r10.bRw = r11; r10 = r7.cag; r10.bRx = r0; r0 = com.tencent.mm.sdk.b.a.sFg; r0.m(r7); goto L_0x016d; L_0x0269: r0 = r15.uDl; r0 = r0.get(r6); r0 = (java.lang.String) r0; r1 = r15.msgType; switch(r1) { case 0: goto L_0x027b; case 1: goto L_0x0020; case 2: goto L_0x027b; case 3: goto L_0x0276; case 4: goto L_0x027b; case 5: goto L_0x027b; case 6: goto L_0x027b; case 7: goto L_0x027b; case 8: goto L_0x027b; case 9: goto L_0x027b; case 10: goto L_0x027b; case 11: goto L_0x0020; case 12: goto L_0x027b; case 13: goto L_0x027b; case 14: goto L_0x027b; case 15: goto L_0x0276; case 16: goto L_0x027b; default: goto L_0x0276; }; L_0x0276: r15.finish(); goto L_0x0020; L_0x027b: r1 = r15.msgType; if (r1 == r8) goto L_0x0285; L_0x027f: r1 = r15.msgType; r2 = 16; if (r1 != r2) goto L_0x030d; L_0x0285: r1 = r15.bWW; r1 = com.tencent.mm.sdk.platformtools.bi.WT(r1); r5 = com.tencent.mm.y.g.a.gp(r1); if (r5 == 0) goto L_0x0375; L_0x0291: r1 = r5.type; r2 = 5; if (r1 != r2) goto L_0x0375; L_0x0296: r1 = r5.url; r1 = com.tencent.mm.sdk.platformtools.bi.oW(r1); if (r1 != 0) goto L_0x0375; L_0x029e: r2 = ""; r1 = r5.url; Catch:{ UnsupportedEncodingException -> 0x0364 } r7 = "UTF-8"; r1 = java.net.URLEncoder.encode(r1, r7); Catch:{ UnsupportedEncodingException -> 0x0364 } r2 = r1; L_0x02ab: if (r3 == 0) goto L_0x0372; L_0x02ad: r1 = r4; L_0x02ae: r7 = "MicroMsg.MsgRetransmitUI"; r9 = "report(%s), url : %s, clickTimestamp : %d, scene : %d, actionType : %d, flag : %d"; r10 = 6; r10 = new java.lang.Object[r10]; r11 = 13378; // 0x3442 float:1.8747E-41 double:6.6096E-320; r11 = java.lang.Integer.valueOf(r11); r10[r6] = r11; r5 = r5.url; r10[r4] = r5; r12 = r15.startTime; r5 = java.lang.Long.valueOf(r12); r10[r8] = r5; r5 = r15.uDE; r5 = java.lang.Integer.valueOf(r5); r10[r14] = r5; r5 = 4; r11 = java.lang.Integer.valueOf(r4); r10[r5] = r11; r5 = 5; r11 = java.lang.Integer.valueOf(r1); r10[r5] = r11; com.tencent.mm.sdk.platformtools.x.d(r7, r9, r10); r5 = com.tencent.mm.plugin.report.service.h.mEJ; r7 = 13378; // 0x3442 float:1.8747E-41 double:6.6096E-320; r9 = 5; r9 = new java.lang.Object[r9]; r9[r6] = r2; r10 = r15.startTime; r2 = java.lang.Long.valueOf(r10); r9[r4] = r2; r2 = r15.uDE; r2 = java.lang.Integer.valueOf(r2); r9[r8] = r2; r2 = java.lang.Integer.valueOf(r4); r9[r14] = r2; r2 = 4; r1 = java.lang.Integer.valueOf(r1); r9[r2] = r1; r5.h(r7, r9); L_0x030d: if (r3 == 0) goto L_0x0401; L_0x030f: r1 = r15.uDo; if (r1 == 0) goto L_0x031c; L_0x0313: r1 = com.tencent.mm.R.l.has_send; r1 = r15.getString(r1); com.tencent.mm.ui.widget.snackbar.b.h(r15, r1); L_0x031c: r1 = new android.content.Intent; r1.<init>(); r2 = new java.util.ArrayList; r2.<init>(); r3 = r15.uDl; r2.addAll(r3); r3 = "SendMsgUsernames"; r1.putStringArrayListExtra(r3, r2); r2 = -1; r15.setResult(r2, r1); r1 = r15.uDJ; if (r1 == 0) goto L_0x0345; L_0x0339: r1 = r15.mHandler; r2 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$5; r2.<init>(r15); r4 = 1800; // 0x708 float:2.522E-42 double:8.893E-321; r1.postDelayed(r2, r4); L_0x0345: r1 = r15.uDn; if (r1 == 0) goto L_0x0020; L_0x0349: r1 = r15.uDB; if (r1 != 0) goto L_0x0020; L_0x034d: r1 = new android.content.Intent; r2 = com.tencent.mm.ui.chatting.ChattingUI.class; r1.<init>(r15, r2); r2 = 67108864; // 0x4000000 float:1.5046328E-36 double:3.31561842E-316; r1.addFlags(r2); r2 = "Chat_User"; r1.putExtra(r2, r0); r15.startActivity(r1); goto L_0x0020; L_0x0364: r1 = move-exception; r7 = "MicroMsg.MsgRetransmitUI"; r9 = ""; r10 = new java.lang.Object[r6]; com.tencent.mm.sdk.platformtools.x.printErrStackTrace(r7, r1, r9, r10); goto L_0x02ab; L_0x0372: r1 = r8; goto L_0x02ae; L_0x0375: if (r3 != 0) goto L_0x030d; L_0x0377: if (r5 == 0) goto L_0x030d; L_0x0379: r1 = r5.type; r2 = 33; if (r1 != r2) goto L_0x030d; L_0x037f: r1 = new com.tencent.mm.g.a.n; r1.<init>(); r2 = r1.bGE; r6 = r15.uDH; r2.scene = r6; r2 = r1.bGE; r6 = r15.uDI; r2.bGM = r6; r2 = r15.uDH; if (r8 != r2) goto L_0x03f5; L_0x0394: r2 = r1.bGE; r6 = new java.lang.StringBuilder; r6.<init>(); r7 = r15.uDG; r6 = r6.append(r7); r7 = ":"; r6 = r6.append(r7); r7 = r15.uDF; r6 = r6.append(r7); r6 = r6.toString(); r2.bGG = r6; L_0x03b4: r2 = "@chatroom"; r2 = r0.endsWith(r2); if (r2 == 0) goto L_0x03fc; L_0x03bd: r2 = r1.bGE; r2.action = r8; L_0x03c1: r2 = r1.bGE; r4 = r5.dyZ; r4 = r4 + 1; r2.bGF = r4; r2 = r1.bGE; r4 = r5.dyR; r2.bGH = r4; r2 = r1.bGE; r4 = r5.dyS; r2.bGy = r4; r2 = r1.bGE; r4 = r5.dyT; r2.appId = r4; r2 = r1.bGE; r4 = ""; r2.bGI = r4; r2 = r1.bGE; r4 = com.tencent.mm.sdk.platformtools.bi.VE(); r2.bGJ = r4; r2 = r1.bGE; r2.bGK = r8; r2 = com.tencent.mm.sdk.b.a.sFg; r2.m(r1); goto L_0x030d; L_0x03f5: r2 = r1.bGE; r6 = r15.uDG; r2.bGG = r6; goto L_0x03b4; L_0x03fc: r2 = r1.bGE; r2.action = r4; goto L_0x03c1; L_0x0401: r15.finish(); goto L_0x0020; L_0x0406: r0 = r15.uDl; r0 = r0.get(r6); r0 = (java.lang.String) r0; r1 = r15.cAc(); if (r1 != 0) goto L_0x0419; L_0x0414: r15.finish(); goto L_0x0020; L_0x0419: r1 = r15.msgType; switch(r1) { case 0: goto L_0x0433; case 1: goto L_0x049e; case 5: goto L_0x04c5; case 11: goto L_0x049e; default: goto L_0x041e; }; L_0x041e: r0 = "MicroMsg.MsgRetransmitUI"; r1 = "doRetransmitOnSceneShareFromSystemGallery unknown msg type:%d"; r2 = new java.lang.Object[r4]; r3 = r15.msgType; r3 = java.lang.Integer.valueOf(r3); r2[r6] = r3; com.tencent.mm.sdk.platformtools.x.i(r0, r1, r2); goto L_0x0020; L_0x0433: r1 = r15.uDu; if (r1 == 0) goto L_0x0447; L_0x0437: r1 = r15.uDu; r1 = r1.size(); if (r1 <= 0) goto L_0x0447; L_0x043f: r1 = r15.uDu; r1 = r1.size(); r15.uDw = r1; L_0x0447: r1 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$2; r1.<init>(r15); r15.dVg = r1; r1 = com.tencent.mm.R.l.msgretr_uploading_img; r2 = new java.lang.Object[r14]; r3 = java.lang.Integer.valueOf(r4); r2[r6] = r3; r3 = r15.uDw; r3 = java.lang.Integer.valueOf(r3); r2[r4] = r3; r3 = java.lang.Integer.valueOf(r6); r2[r8] = r3; r1 = r15.getString(r1, r2); r2 = com.tencent.mm.R.l.app_tip; r2 = r15.getString(r2); r3 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$3; r3.<init>(r15); r1 = com.tencent.mm.ui.base.h.a(r15, r1, r2, r3); r15.uDp = r1; r1 = r15.uDp; r2 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$4; r2.<init>(r15); r1.setOnCancelListener(r2); r1 = r15.uDp; r1.setCanceledOnTouchOutside(r6); r1 = r15.uDp; r2 = -1; r1 = r1.getButton(r2); r2 = com.tencent.mm.R.l.app_cancel; r1.setText(r2); r1 = 6; r2 = r15.dVg; r15.a(r0, r1, r2); goto L_0x0020; L_0x049e: r1 = com.tencent.mm.network.ab.bU(r15); if (r1 != 0) goto L_0x04bc; L_0x04a4: r1 = com.tencent.mm.R.l.video_export_file_warning; r2 = com.tencent.mm.R.l.app_tip; r3 = com.tencent.mm.R.l.app_ok; r4 = com.tencent.mm.R.l.app_cancel; r5 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$13; r5.<init>(r15, r0); r6 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$14; r6.<init>(r15); r0 = r15; com.tencent.mm.ui.base.h.a(r0, r1, r2, r3, r4, r5, r6); goto L_0x0020; L_0x04bc: r1 = r15.getIntent(); r15.m(r1, r0); goto L_0x0020; L_0x04c5: r15.bB(r0, r4); goto L_0x0020; L_0x04ca: r0 = r15.msgType; switch(r0) { case 2: goto L_0x04d1; case 16: goto L_0x04d1; default: goto L_0x04cf; }; L_0x04cf: goto L_0x0020; L_0x04d1: r0 = r15.uDl; r0.get(r6); r0 = r15.getIntent(); r0 = r0.getExtras(); r2 = "_mmessage_appPackage"; r0 = r0.getString(r2); r5 = new com.tencent.mm.pluginsdk.model.app.f; r5.<init>(); r5.field_packageName = r0; r0 = com.tencent.mm.pluginsdk.model.app.ao.bmf(); r2 = new java.lang.String[r4]; r3 = "packageName"; r2[r6] = r3; r0.b(r5, r2); r0 = new com.tencent.mm.opensdk.modelmsg.SendMessageToWX$Req; r2 = r15.getIntent(); r2 = r2.getExtras(); r0.<init>(r2); r4 = r0.message; r0 = new com.tencent.mm.ui.transmit.MsgRetransmitUI$11; r0.<init>(r15); r7 = new com.tencent.mm.ui.transmit.c; r7.<init>(r0); r0 = r4.thumbData; if (r0 != 0) goto L_0x053f; L_0x0517: r2 = r1; L_0x0518: r0 = r4.mediaObject; r0 = r0.type(); switch(r0) { case 1: goto L_0x0547; case 2: goto L_0x0588; case 3: goto L_0x05a8; case 4: goto L_0x05d5; case 5: goto L_0x0631; case 6: goto L_0x0603; case 7: goto L_0x065f; default: goto L_0x0521; }; L_0x0521: r0 = "MicroMsg.SendAppMessage"; r1 = new java.lang.StringBuilder; r2 = "unkown app message type, skipped, type="; r1.<init>(r2); r2 = r4.mediaObject; r2 = r2.type(); r1 = r1.append(r2); r1 = r1.toString(); com.tencent.mm.sdk.platformtools.x.e(r0, r1); goto L_0x0020; L_0x053f: r0 = r4.thumbData; r0 = com.tencent.mm.sdk.platformtools.c.bs(r0); r2 = r0; goto L_0x0518; L_0x0547: r0 = com.tencent.mm.R.i.appmsg_transmit_confirm_text; r2 = android.view.View.inflate(r15, r0, r1); r0 = com.tencent.mm.R.h.title_tv; r0 = r2.findViewById(r0); r0 = (android.widget.TextView) r0; r3 = r4.title; r0.setText(r3); L_0x055a: r0 = com.tencent.mm.R.h.source_tv; r0 = r2.findViewById(r0); r0 = (android.widget.TextView) r0; r3 = com.tencent.mm.pluginsdk.model.app.g.b(r15, r5, r1); r0.setText(r3); r0 = com.tencent.mm.R.l.app_send; r3 = r15.getString(r0); r0 = com.tencent.mm.R.l.app_cancel; r4 = r15.getString(r0); r5 = new com.tencent.mm.ui.transmit.c$1; r5.<init>(r7); r6 = new com.tencent.mm.ui.transmit.c$2; r6.<init>(r7); r0 = r15; r0 = com.tencent.mm.ui.base.h.a(r0, r1, r2, r3, r4, r5, r6); r7.eIW = r0; goto L_0x0020; L_0x0588: r0 = com.tencent.mm.R.i.appmsg_transmit_confirm_image; r3 = android.view.View.inflate(r15, r0, r1); r0 = com.tencent.mm.R.h.thumb_iv; r0 = r3.findViewById(r0); r0 = (android.widget.ImageView) r0; r0.setImageBitmap(r2); r0 = com.tencent.mm.R.h.title_tv; r0 = r3.findViewById(r0); r0 = (android.widget.TextView) r0; r2 = r4.title; r0.setText(r2); r2 = r3; goto L_0x055a; L_0x05a8: r0 = com.tencent.mm.R.i.appmsg_transmit_confirm_file; r3 = android.view.View.inflate(r15, r0, r1); r0 = com.tencent.mm.R.h.thumb_iv; r0 = r3.findViewById(r0); r0 = (android.widget.ImageView) r0; r0.setImageBitmap(r2); r0 = com.tencent.mm.R.h.title_tv; r0 = r3.findViewById(r0); r0 = (android.widget.TextView) r0; r2 = com.tencent.mm.R.h.desc_tv; r2 = r3.findViewById(r2); r2 = (android.widget.TextView) r2; r6 = r4.title; r0.setText(r6); r0 = r4.description; r2.setText(r0); r2 = r3; goto L_0x055a; L_0x05d5: r0 = com.tencent.mm.R.i.appmsg_transmit_confirm_file; r3 = android.view.View.inflate(r15, r0, r1); r0 = com.tencent.mm.R.h.thumb_iv; r0 = r3.findViewById(r0); r0 = (android.widget.ImageView) r0; r0.setImageBitmap(r2); r0 = com.tencent.mm.R.h.title_tv; r0 = r3.findViewById(r0); r0 = (android.widget.TextView) r0; r2 = com.tencent.mm.R.h.desc_tv; r2 = r3.findViewById(r2); r2 = (android.widget.TextView) r2; r6 = r4.title; r0.setText(r6); r0 = r4.description; r2.setText(r0); r2 = r3; goto L_0x055a; L_0x0603: r0 = com.tencent.mm.R.i.appmsg_transmit_confirm_file; r3 = android.view.View.inflate(r15, r0, r1); r0 = com.tencent.mm.R.h.thumb_iv; r0 = r3.findViewById(r0); r0 = (android.widget.ImageView) r0; r0.setImageBitmap(r2); r0 = com.tencent.mm.R.h.title_tv; r0 = r3.findViewById(r0); r0 = (android.widget.TextView) r0; r2 = com.tencent.mm.R.h.desc_tv; r2 = r3.findViewById(r2); r2 = (android.widget.TextView) r2; r6 = r4.title; r0.setText(r6); r0 = r4.description; r2.setText(r0); r2 = r3; goto L_0x055a; L_0x0631: r0 = com.tencent.mm.R.i.appmsg_transmit_confirm_file; r3 = android.view.View.inflate(r15, r0, r1); r0 = com.tencent.mm.R.h.thumb_iv; r0 = r3.findViewById(r0); r0 = (android.widget.ImageView) r0; r0.setImageBitmap(r2); r0 = com.tencent.mm.R.h.title_tv; r0 = r3.findViewById(r0); r0 = (android.widget.TextView) r0; r2 = com.tencent.mm.R.h.desc_tv; r2 = r3.findViewById(r2); r2 = (android.widget.TextView) r2; r6 = r4.title; r0.setText(r6); r0 = r4.description; r2.setText(r0); r2 = r3; goto L_0x055a; L_0x065f: r0 = com.tencent.mm.R.i.appmsg_transmit_confirm_file; r3 = android.view.View.inflate(r15, r0, r1); r0 = com.tencent.mm.R.h.thumb_iv; r0 = r3.findViewById(r0); r0 = (android.widget.ImageView) r0; r0.setImageBitmap(r2); r0 = com.tencent.mm.R.h.title_tv; r0 = r3.findViewById(r0); r0 = (android.widget.TextView) r0; r2 = com.tencent.mm.R.h.desc_tv; r2 = r3.findViewById(r2); r2 = (android.widget.TextView) r2; r6 = r4.title; r0.setText(r6); r0 = r4.description; r2.setText(r0); r2 = r3; goto L_0x055a; */ throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.ui.transmit.MsgRetransmitUI.cAb():void"); } protected void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); String str; if (i2 != -1) { a gp = a.gp(bi.WT(this.bWW)); if (gp != null && gp.type == 5 && gp.url != null) { x.d("MicroMsg.MsgRetransmitUI", "report(%s), url : %s, clickTimestamp : %d, scene : %d, actionType : %d, flag : %d", new Object[]{Integer.valueOf(13378), gp.url, Long.valueOf(this.startTime), Integer.valueOf(this.uDE), Integer.valueOf(1), Integer.valueOf(3)}); str = ""; try { str = URLEncoder.encode(gp.url, "UTF-8"); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.MsgRetransmitUI", e, "", new Object[0]); } h.mEJ.h(13378, new Object[]{str, Long.valueOf(this.startTime), Integer.valueOf(this.uDE), Integer.valueOf(1), Integer.valueOf(3)}); } else if (gp != null && gp.type == 33) { n nVar = new n(); nVar.bGE.bGM = this.uDI; nVar.bGE.scene = this.uDH; if (2 == this.uDH) { nVar.bGE.bGG = this.uDG + ":" + this.uDF; } else { nVar.bGE.bGG = this.uDG; } nVar.bGE.bGF = gp.dyZ + 1; nVar.bGE.bGH = gp.dyR; nVar.bGE.bGy = gp.dyS; nVar.bGE.appId = gp.dyT; nVar.bGE.action = 1; nVar.bGE.bGI = ""; nVar.bGE.bGJ = bi.VE(); nVar.bGE.bGK = 3; com.tencent.mm.sdk.b.a.sFg.m(nVar); } finish(); } else if (i != 0) { x.e("MicroMsg.MsgRetransmitUI", "onActivityResult, unknown requestCode = " + i); } else { this.uDl = bi.F(intent.getStringExtra("Select_Conv_User").split(",")); Object stringExtra = intent.getStringExtra("custom_send_text"); this.qIZ = intent.getBooleanExtra("key_is_biz_chat", false); if (this.qIZ) { this.hpD = intent.getLongExtra("key_biz_chat_id", -1); } int intExtra = intent.getIntExtra("Retr_Msg_Type", -1); if (intExtra != -1) { x.i("MicroMsg.MsgRetransmitUI", "summerbig replace msgType %d->%d", new Object[]{Integer.valueOf(this.msgType), Integer.valueOf(intExtra)}); this.msgType = intExtra; } x.i("MicroMsg.MsgRetransmitUI", "summersafecdn onActivityResult doRetransmit msgType[%d], iScene[%d], size[%d]", new Object[]{Integer.valueOf(this.msgType), Integer.valueOf(this.uDr), Integer.valueOf(this.uDl.size())}); cAb(); if (!TextUtils.isEmpty(stringExtra)) { for (String str2 : this.uDl) { ow owVar = new ow(); owVar.bZQ.bZR = str2; owVar.bZQ.content = stringExtra; owVar.bZQ.type = s.hQ(str2); owVar.bZQ.flags = 0; com.tencent.mm.sdk.b.a.sFg.m(owVar); } } } } private boolean abh(String str) { byte[] bArr = null; a gp = a.gp(bi.WT(this.bWW)); x.d("MicroMsg.MsgRetransmitUI", "summerbig processAppMessageTransfer msgContent[%s], content[%s]", new Object[]{this.bWW, gp}); if (gp == null) { x.e("MicroMsg.MsgRetransmitUI", "transfer app message error: app content null"); return false; } au.HU(); bd dW = com.tencent.mm.model.c.FT().dW(this.bJC); if (!dW.cky()) { if (this.uDm != null) { try { bArr = FileOp.e(this.uDm, 0, -1); if (!bG(bArr)) { return false; } } catch (Throwable e) { x.printErrStackTrace("MicroMsg.MsgRetransmitUI", e, "", new Object[0]); x.e("MicroMsg.MsgRetransmitUI", "send appmsg to %s, error:%s", new Object[]{str, e.getLocalizedMessage()}); } } else if (!(this.ubT >= 0 || dW.field_imgPath == null || dW.field_imgPath.equals(""))) { try { bArr = FileOp.e(o.Pf().E(dW.field_imgPath, true), 0, -1); if (!bG(bArr)) { return false; } } catch (Exception e2) { x.e("MicroMsg.MsgRetransmitUI", "send appmsg to %s, error:%s", new Object[]{str, e2.getLocalizedMessage()}); } } au.Em().H(new 12(this, str, gp, bArr, dW)); } else if (gp.type == 33) { com.tencent.mm.ui.chatting.l.b(str, gp, ca.f(((HashMap) getIntent().getSerializableExtra("appbrand_params")).get("img_url"), null)); } else { j.a(this, str, this.bWW, dW.field_isSend, this.tFy); } return true; } private void a(String str, a aVar, byte[] bArr, bd bdVar) { x.d("MicroMsg.MsgRetransmitUI", "summerbig send toUser[%s], attachid[%s]", new Object[]{str, aVar.bGP}); b d = com.tencent.mm.pluginsdk.model.app.l.d(bdVar, aVar.bGP); String str2 = ""; if (!(d == null || d.field_fileFullPath == null || d.field_fileFullPath.equals(""))) { au.HU(); str2 = com.tencent.mm.pluginsdk.model.app.l.al(com.tencent.mm.model.c.Gk(), aVar.title, aVar.dwp); FileOp.y(d.field_fileFullPath, str2); x.i("MicroMsg.MsgRetransmitUI", "summerbig send old path[%s], title[%s] attachPath[%s], finish[%b]", new Object[]{d.field_fileFullPath, aVar.title, str2, Boolean.valueOf(d.aSc())}); } a a = a.a(aVar); a.dwr = 3; if (bdVar != null && aVar.type == 6 && !bi.oW(aVar.dwu) && d != null && (!com.tencent.mm.a.e.cn(d.field_fileFullPath) || ((long) com.tencent.mm.a.e.cm(d.field_fileFullPath)) != d.field_totalLen)) { i iVar = new i(); iVar.dPV = new 17(this, d, bdVar, a, str, str2, bArr); iVar.field_mediaId = com.tencent.mm.modelcdntran.d.a("checkExist", bi.VF(), bdVar.field_talker, bdVar.field_msgId); iVar.field_aesKey = a.dwK; iVar.field_fileType = 19; iVar.field_authKey = a.dwA; iVar.dPW = a.dwu; iVar.field_fullpath = str2; if (!g.ND().b(iVar, -1)) { x.e("MicroMsg.MsgRetransmitUI", "openim attach download failed before rescend"); } } else if (!bi.oW(str2) || (aVar.dws == 0 && aVar.dwo <= 26214400)) { com.tencent.mm.pluginsdk.model.app.l.a(a, aVar.appId, aVar.appName, str, str2, bArr, this.fmS); if (a.type == 36) { int i = str.endsWith("chatroom") ? 1 : 0; String encode = URLEncoder.encode(bi.oV(a.url)); String encode2 = URLEncoder.encode(bi.oV(a.title)); String encode3 = URLEncoder.encode(bi.oV(a.description)); String encode4 = URLEncoder.encode(bi.oV(a.dyR)); h.mEJ.h(14127, new Object[]{a.appId, a.dyS, encode4, encode2, encode3, "", encode, Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(1), Integer.valueOf(i), str}); } } else { x.i("MicroMsg.MsgRetransmitUI", "summerbig send attachPath is null islargefilemsg[%d], attachlen[%d]", new Object[]{Integer.valueOf(aVar.dws), Integer.valueOf(aVar.dwo)}); au.DF().a(new aa(aVar, null, str, new 16(this, aVar, a, str, bArr)), 0); } } private boolean bB(String str, boolean z) { if (this.fileName == null) { return false; } EmojiInfo zi = ((com.tencent.mm.plugin.emoji.b.c) com.tencent.mm.kernel.g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().zi(this.fileName); int cm = zi == null ? com.tencent.mm.a.e.cm(this.fileName) : com.tencent.mm.a.e.cm(zi.cnF()); String cnF = zi == null ? this.fileName : zi.cnF(); Options options = new Options(); options.inJustDecodeBounds = true; boolean z2; if ((com.tencent.mm.sdk.platformtools.c.decodeFile(cnF, options) == null || options.outHeight <= com.tencent.mm.k.b.Az()) && options.outWidth <= com.tencent.mm.k.b.Az()) { z2 = false; } else { z2 = true; } Object[] objArr; if (cm > com.tencent.mm.k.b.AA() || z2) { String str2 = "MicroMsg.MsgRetransmitUI"; String str3 = "emoji is over size. md5:%s size:%d"; objArr = new Object[2]; objArr[0] = zi == null ? "fileName" : zi.Xh(); objArr[1] = Integer.valueOf(this.length); x.i(str2, str3, objArr); this.uDJ = false; this.uDo = false; com.tencent.mm.ui.base.h.a(this, getString(R.l.emoji_custom_gif_max_size_limit_cannot_send), "", getString(R.l.i_know_it), new 18(this)); if (this.uDz != 1) { return true; } h.mEJ.h(13459, new Object[]{Integer.valueOf(cm), Integer.valueOf(1), zi.Xh(), Integer.valueOf(1)}); return true; } if (this.uDz == 1) { h hVar = h.mEJ; objArr = new Object[4]; objArr[0] = Integer.valueOf(cm); objArr[1] = Integer.valueOf(0); objArr[2] = zi == null ? "" : zi.Xh(); objArr[3] = Integer.valueOf(1); hVar.h(13459, objArr); } if (z) { EmojiInfo zi2; if (zi == null) { zi2 = ((com.tencent.mm.plugin.emoji.b.c) com.tencent.mm.kernel.g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().zi(((com.tencent.mm.plugin.emoji.b.c) com.tencent.mm.kernel.g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().a(getApplicationContext(), new WXMediaMessage(new WXEmojiObject(this.fileName)), "")); } else { zi2 = zi; } h.mEJ.h(13459, new Object[]{Integer.valueOf(cm), Integer.valueOf(0), zi2.Xh(), Integer.valueOf(2)}); j.b(zi2, str); finish(); return true; } else if (zi != null && cm > com.tencent.mm.k.b.Ay()) { j.b(zi, str); return true; } else if (((com.tencent.mm.plugin.emoji.b.c) com.tencent.mm.kernel.g.n(com.tencent.mm.plugin.emoji.b.c.class)).getEmojiMgr().o(this, str, this.fileName)) { return true; } else { x.e("MicroMsg.MsgRetransmitUI", "Retransmit emoji failed."); return false; } } private boolean cAc() { au.HU(); if (com.tencent.mm.model.c.isSDCardAvailable()) { return true; } x.e("MicroMsg.MsgRetransmitUI", "sdcard is not available, type = " + this.msgType); com.tencent.mm.ui.base.s.gH(this); return false; } private void m(Intent intent, String str) { if (this.uDx) { this.uDw = this.uDu.size(); ArrayList parcelableArrayList = intent.getExtras().getParcelableArrayList("android.intent.extra.STREAM"); if (parcelableArrayList == null || parcelableArrayList.size() <= 0) { finish(); return; } Iterator it = parcelableArrayList.iterator(); while (it.hasNext()) { it.next(); if (!this.uDK) { abi(str); } else { return; } } return; } this.uDw = 1; abi(str); } private void abi(String str) { x.i("MicroMsg.MsgRetransmitUI", "sendMultiVedeo"); com.tencent.mm.pluginsdk.model.j jVar = new com.tencent.mm.pluginsdk.model.j(this, null, getIntent(), str, 1, new 6(this)); com.tencent.mm.sdk.f.e.post(jVar, "ChattingUI_importMultiVideo"); getString(R.l.app_tip); this.eHw = com.tencent.mm.ui.base.h.a(this, getString(R.l.app_waiting), true, new 7(this, jVar)); } private void a(String str, int i, f fVar) { String str2; String GF = q.GF(); String str3 = ""; au.HU(); bd dW = com.tencent.mm.model.c.FT().dW(this.bJC); if (dW.field_msgId == this.bJC) { str3 = dW.field_content; } com.tencent.mm.ak.e eVar = null; if (dW.field_msgId > 0) { eVar = o.Pf().br(dW.field_msgId); } if ((eVar == null || eVar.dTK <= 0) && dW.field_msgSvrId > 0) { eVar = o.Pf().bq(dW.field_msgSvrId); } if (str3 != null || dW.field_msgSvrId <= 0) { str2 = str3; } else { str2 = eVar.dTV; } if (eVar == null || ((eVar.offset >= eVar.dHI && eVar.dHI != 0) || this.uDx)) { a(str, i, GF, str2, fVar); return; } int i2; com.tencent.mm.ak.e bq = o.Pf().bq(dW.field_msgSvrId); if (dW.field_isSend == 1) { int i3; if (bq.ON()) { i3 = 1; } else { i3 = 0; } i2 = i3; } else if (bq.ON()) { if (com.tencent.mm.a.e.cn(o.Pf().o(com.tencent.mm.ak.f.a(bq).dTL, "", ""))) { i2 = 1; } else { i2 = 0; } } else { i2 = 0; } PString pString = new PString(); PInt pInt = new PInt(); PInt pInt2 = new PInt(); pString.value = this.fileName; long a = o.Pf().a(this.fileName, i2, i, 0, pString, pInt, pInt2); eVar = o.Pf().b(Long.valueOf(a)); eVar.hO(1); bd bdVar = new bd(); bdVar.setType(s.hR(str)); bdVar.ep(str); bdVar.eX(1); bdVar.setStatus(1); bdVar.eq(pString.value); bdVar.fh(pInt.value); bdVar.fi(pInt2.value); bdVar.ay(com.tencent.mm.model.bd.iD(bdVar.field_talker)); if (com.tencent.mm.ac.f.eZ(bdVar.field_talker)) { dW.dt(com.tencent.mm.ac.a.e.Ir()); } au.HU(); long T = com.tencent.mm.model.c.FT().T(bdVar); Assert.assertTrue(T >= 0); x.i("MicroMsg.MsgRetransmitUI", "NetSceneUploadMsgImg: local msgId = " + T); eVar.bo((long) ((int) T)); o.Pf().a(Long.valueOf(a), eVar); HashMap hashMap = new HashMap(); hashMap.put(Long.valueOf(T), bq); o.Pg().a(bq.dTK, dW.field_msgId, i2, hashMap, R.g.chat_img_template, new 8(this, str, i, GF, str2, fVar)); } private void a(String str, int i, String str2, String str3, f fVar) { if (!bi.oW(this.fileName)) { this.uDv = 1; this.uDw = 1; if (abj(this.fileName)) { if (q.a(this.fileName, str, this.dTO == 0)) { this.dTO = 1; } else { this.dTO = 0; } long currentTimeMillis = System.currentTimeMillis(); h.mEJ.a(106, 96, 1, false); this.uDs = new l(i, str2, str, this.fileName, this.dTO, fVar, 0, str3, "", true, R.g.chat_img_template, this.uDz, this.dVI, this.bSx); if (this.uDr == 1) { this.uDs.OV(); } au.DF().a(this.uDs, 0); this.uDt = true; x.d("MicroMsg.MsgRetransmitUI", "summersafecdn jacks consumption: %d, compressType:%d", new Object[]{Long.valueOf(System.currentTimeMillis() - currentTimeMillis), Integer.valueOf(this.dTO)}); br.IE().c(br.dDm, null); } } else if (this.uDx) { this.uDv++; if (abj((String) this.uDu.get(0))) { if (q.a((String) this.uDu.get(0), str, this.dTO == 0)) { this.dTO = 1; } else { this.dTO = 0; } x.d("MicroMsg.MsgRetransmitUI", "summersafecdn multiSendType compressType:%d", new Object[]{Integer.valueOf(this.dTO)}); this.uDs = new l(i, str2, str, (String) this.uDu.get(0), this.dTO, fVar, 0, str3, "", true, R.g.chat_img_template); if (this.uDr == 1) { this.uDs.OV(); } this.uDt = true; au.DF().a(this.uDs, 0); br.IE().c(br.dDm, null); } } } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ private static boolean abj(java.lang.String r6) { /* r5 = 7; r1 = 1; r0 = 0; r2 = "MicroMsg.MsgRetransmitUI"; r3 = "isImage called, fn:%s, scene:%d"; r4 = 2; r4 = new java.lang.Object[r4]; r4[r0] = r6; r5 = java.lang.Integer.valueOf(r5); r4[r1] = r5; com.tencent.mm.sdk.platformtools.x.i(r2, r3, r4); r2 = 0; r2 = com.tencent.mm.modelsfs.FileOp.openRead(r6); Catch:{ FileNotFoundException -> 0x0051, all -> 0x006a } r3 = new com.tencent.mm.sdk.platformtools.MMBitmapFactory$DecodeResultLogger; Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } r3.<init>(); Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } r4 = com.tencent.mm.sdk.platformtools.MMBitmapFactory.checkIsImageLegal(r2, r3); Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } if (r4 != 0) goto L_0x004a; L_0x0027: r4 = r3.getDecodeResult(); Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } r5 = 2000; // 0x7d0 float:2.803E-42 double:9.88E-321; if (r4 < r5) goto L_0x004a; L_0x002f: r1 = "MicroMsg.MsgRetransmitUI"; r4 = "try to send illegal image."; com.tencent.mm.sdk.platformtools.x.w(r1, r4); Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } r1 = 7; r1 = com.tencent.mm.sdk.platformtools.MMBitmapFactory.KVStatHelper.getKVStatString(r6, r1, r3); Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } r3 = com.tencent.mm.plugin.report.service.h.mEJ; Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } r4 = 12712; // 0x31a8 float:1.7813E-41 double:6.2806E-320; r3.k(r4, r1); Catch:{ FileNotFoundException -> 0x007a, all -> 0x006a } if (r2 == 0) goto L_0x0049; L_0x0046: r2.close(); Catch:{ Exception -> 0x0071 } L_0x0049: return r0; L_0x004a: if (r2 == 0) goto L_0x004f; L_0x004c: r2.close(); Catch:{ Exception -> 0x0073 } L_0x004f: r0 = r1; goto L_0x0049; L_0x0051: r1 = move-exception; r1 = r2; L_0x0053: r2 = "MicroMsg.MsgRetransmitUI"; r3 = "fn:%s not found."; r4 = 1; r4 = new java.lang.Object[r4]; Catch:{ all -> 0x0077 } r5 = 0; r4[r5] = r6; Catch:{ all -> 0x0077 } com.tencent.mm.sdk.platformtools.x.w(r2, r3, r4); Catch:{ all -> 0x0077 } if (r1 == 0) goto L_0x0049; L_0x0064: r1.close(); Catch:{ Exception -> 0x0068 } goto L_0x0049; L_0x0068: r1 = move-exception; goto L_0x0049; L_0x006a: r0 = move-exception; L_0x006b: if (r2 == 0) goto L_0x0070; L_0x006d: r2.close(); Catch:{ Exception -> 0x0075 } L_0x0070: throw r0; L_0x0071: r1 = move-exception; goto L_0x0049; L_0x0073: r0 = move-exception; goto L_0x004f; L_0x0075: r1 = move-exception; goto L_0x0070; L_0x0077: r0 = move-exception; r2 = r1; goto L_0x006b; L_0x007a: r1 = move-exception; r1 = r2; goto L_0x0053; */ throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.ui.transmit.MsgRetransmitUI.abj(java.lang.String):boolean"); } private static boolean bG(byte[] bArr) { x.i("MicroMsg.MsgRetransmitUI", "isImage called, data[0-4]:[%d,%d,%d,%d,%d], scene:%d", new Object[]{Byte.valueOf(bArr[0]), Byte.valueOf(bArr[1]), Byte.valueOf(bArr[2]), Byte.valueOf(bArr[3]), Byte.valueOf(bArr[4]), Integer.valueOf(6)}); DecodeResultLogger decodeResultLogger = new DecodeResultLogger(); if (MMBitmapFactory.checkIsImageLegal(bArr, decodeResultLogger) || decodeResultLogger.getDecodeResult() < 2000) { return true; } x.w("MicroMsg.MsgRetransmitUI", "try to send illegal image."); h.mEJ.k(12712, KVStatHelper.getKVStatString(bArr, 6, decodeResultLogger)); return false; } private void ec(List<String> list) { b bVar = new b((byte) 0); bVar.uEd = new LinkedList(); bVar.uEd.addAll(list); for (String str : list) { a aVar = new a(); getString(R.l.app_tip); this.eHw = com.tencent.mm.ui.base.h.a(this, getString(R.l.app_sending), true, new 10(this, aVar)); aVar.context = this; aVar.fileName = this.fileName; aVar.eXG = this.eHw; aVar.uDq = this.uDq; aVar.enM = this.length; aVar.elY = this.msgType; aVar.uDX = false; aVar.userName = str; aVar.uDY = true; aVar.uDo = this.uDo; aVar.uEb = bVar; r nW = t.nW(this.fileName); if (!(nW == null || nW.enV == null)) { x.d("MicroMsg.MsgRetransmitUI", "msgRetrans streamvideo"); aVar.uEa = nW.enV; aVar.cqb = nW.Tj(); } aVar.execute(new Object[0]); br.IE().c(br.dDn, null); if (this.bJC != -1) { au.HU(); bd dW = com.tencent.mm.model.c.FT().dW(this.bJC); boolean fq = s.fq(str); com.tencent.mm.ui.chatting.a.a(fq ? com.tencent.mm.ui.chatting.a.c.tFW : com.tencent.mm.ui.chatting.a.c.tFV, this.uDA ? com.tencent.mm.ui.chatting.a.d.tGa : com.tencent.mm.ui.chatting.a.d.tFZ, dW, fq ? m.gK(str) : 0); } else { return; } } } @com.tencent.mm.sdk.platformtools.f public final void a(int i, int i2, String str, com.tencent.mm.ab.l lVar) { if (lVar.getType() == i$l.AppCompatTheme_spinnerStyle && (lVar instanceof l)) { String stringExtra; l lVar2 = (l) lVar; if (getIntent().getBooleanExtra("Retr_FromMainTimeline", false)) { stringExtra = getIntent().getStringExtra("Retr_KSnsId"); if (s.fq(lVar2.bZR)) { px pxVar = new px(); pxVar.caD.bSZ = stringExtra; com.tencent.mm.sdk.b.a.sFg.m(pxVar); } else { py pyVar = new py(); pyVar.caE.bSZ = stringExtra; com.tencent.mm.sdk.b.a.sFg.m(pyVar); } } if (this.uDu == null || this.uDu.size() <= 1) { if (this.uDp != null) { this.uDp.dismiss(); this.uDp = null; } this.uDD--; if (this.uDD <= 0 || !this.uDC) { this.uDt = false; au.DF().b(i$l.AppCompatTheme_spinnerStyle, this); if (this.uDr != 0) { if (this.uDn && !this.uDB) { Intent intent = new Intent(this, ChattingUI.class); intent.addFlags(67108864); intent.putExtra("Chat_User", lVar2.bZR); startActivity(intent); } finish(); return; } return; } return; } this.uDu.remove(0); stringExtra = lVar2.bZR; if (bi.oW(stringExtra) && this.uDl != null) { stringExtra = (String) this.uDl.get(0); } a(stringExtra, 3, this.dVg); } } }
/* * Copyright (C) 2013 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.rack; import org.slf4j.Logger; import static com.google.common.base.Preconditions.checkNotNull; /** * Adapts a {@link Logger} to the required interface for {@code rack.errors}. */ public class RackErrors { private final Logger logger; private final StringBuffer buffer; /** * Creates a {@link RackErrors} stream that forwards messages to the given {@link Logger}. * * @param logger the destination {@link Logger}. */ public RackErrors(Logger logger) { this.logger = checkNotNull(logger); this.buffer = new StringBuffer(); } /** * Immediately writes the given message out to the error logger. * * @param message */ public void puts(String message) { logger.error(message); } /** * Buffers the given message internally. You may call {@link #write(String)} as many times as you * like. To then write the composite buffered message to the error logger, call {@link #flush()}. * * @param message */ public void write(String message) { buffer.append(message); } /** * Writes internally-buffered messages out to the error logger. * * @see #write(String) */ public void flush() { if (buffer.length() > 0) { logger.error(buffer.toString()); buffer.setLength(0); } } }
package com.findme.service; import java.util.ArrayList; import java.util.List; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.findme.model.SearchQuery; import com.findme.model.SearchQueryResult; /** * @author vinodkumara * */ @Service public class SearchService { @Autowired private HibernateTemplate hibernateTemplate; @Autowired public void setHibernateTemplate(HibernateTemplate hibernateTemplate) { this.hibernateTemplate = hibernateTemplate; } @SuppressWarnings("unchecked") @Transactional public List<SearchQueryResult> searchQuery(SearchQuery data) { String sql = dynamicQuery(); String where = formWhereCondition(data); List<SearchQueryResult> list = null; SessionFactory sessionFactory = hibernateTemplate.getSessionFactory(); Session session = sessionFactory.getCurrentSession(); SQLQuery query = (SQLQuery) session.createSQLQuery(sql + where); query.addEntity(SearchQueryResult.class); list = (List<SearchQueryResult>) query.list(); return list; } private String dynamicQuery() { String sql = "SELECT distinct ut.user_id AS userid," + " ut.username AS username," + " CONCAT(pst.last_name, CONCAT(', ', pst.first_name)) AS fullname," + " pt.project AS project" + " FROM user_t ut" + " INNER JOIN project_t pt" + " ON ut.user_id = pt.user_id" + " INNER JOIN person_t pst" + " ON pt.user_id = pst.user_id" + " INNER JOIN database_t dbt" + " ON pst.user_id = dbt.user_id" + " INNER JOIN development_t devt" + " ON dbt.user_id = devt.user_id" + " WHERE "; return sql; } private String formWhereCondition(SearchQuery data) { String where = null; List<String> dbs = new ArrayList<String>(); List<String> devs = new ArrayList<String>(); for (String str : data.getDatabase()) { dbs.add('"' + str + '"'); } for (String str : data.getDevelopment()) { devs.add('"' + str + '"'); } if (data.getUser() != null && where == null) { where = " ut.username LIKE '%" + data.getUser() + "%'"; } if (data.getProject() != null && data.getProject() != "") { if (where != null) { where = where + " AND pt.project LIKE '%" + data.getProject() + "%'"; } else { where = " pt.project LIKE '%" + data.getProject() + "%'"; } } if (data.getDesignation() != null && data.getDesignation() != "") { if (where != null) { where = where + " AND pt.designation LIKE '%" + data.getDesignation() + "%'"; } else { where = " pt.designation LIKE '%" + data.getDesignation() + "%'"; } } if (dbs.size() > 0) { if (where != null) { where = where + " AND dbt.technology IN (" + dbs.toString().replaceAll("\\[", "") .replaceAll("\\]", "") + ")"; } else { where = " dbt.technology IN (" + dbs.toString().replaceAll("\\[", "") .replaceAll("\\]", "") + ")"; } } if (devs.size() > 0) { if (where != null) { where = where + " AND devt.technology IN (" + devs.toString().replaceAll("\\[", "") .replaceAll("\\]", "") + ")"; } else { where = " devt.technology IN (" + devs.toString().replaceAll("\\[", "") .replaceAll("\\]", "") + ")"; } } return where; } }
package com.tianlang.dao; import com.tianlang.entity.City; import com.tianlang.entity.Province; import com.tianlang.jdbcutil.JDBCUtil; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class CityDao { public List<City> query(String provinceid){ List<City> list = new ArrayList<>(); JDBCUtil jdbcUtil = new JDBCUtil(); String sql = "select * from city where province = ?"; jdbcUtil.getConnection(); PreparedStatement preparedStatement = jdbcUtil.getPrepareStatement(sql); ResultSet resultSet = null; try { preparedStatement.setString(1,provinceid); resultSet = preparedStatement.executeQuery(); while (resultSet.next()){ City city = new City(); String province = resultSet.getString("province"); String city1 = resultSet.getString("city"); city.setProvince(province); city.setCity(city1); list.add(city); } } catch (SQLException e) { e.printStackTrace(); }finally { jdbcUtil.close(); }return list; } }
package zystudio.demo; import zystudio.cases.graphics.scrolls.CaseNestedScrollFragment; import zystudio.cases.graphics.touch.CaseForTouch2; import zystudio.cases.multithread.CaseCallableAndFuture; import zystudio.cases.multithread.CaseFutureCancel; import zystudio.cases.multithread.CaseSemaphore; import zystudio.cases.multithread.CaseThreadJoin; import zystudio.demo.activitylifecycle.CaseThreeActivityStart; import zystudio.demo.activitylifecycle2.CaseActivityLifeCycle2; import zystudio.demo.ipc.ShowAIDLActivity; //import zystudio.ffmpeg.CaseFFmpegInvoke; //import zystudio.ffmpeg.CaseFFmpegInvoke; import zystudio.ffmpeg.CaseFFmpegInvoke; import zystudio.mylib.utils.LogUtil; import zystudio.nativemodule.CaseNativeInvoke; import android.app.Activity; import android.content.Context; import android.support.v4.app.FragmentActivity; import java.lang.reflect.Constructor; import java.lang.reflect.Method; public class CaseInvoke { private static void invokeCase(Class<?> clazz, Activity act) { //判断clazz 的构造函数,有没有不需要参数的构造默认函数 /** * class类有四个得到构造函数的method: * getConstructors : 这个只返回public的构造函数 * getDeclaredConstructors: 这个返回包括public 与private的所有构造函数,就是这个类里所有的构造函数,都在这里边 * getConstructor(Class<?> ...parameterTypes) * getDeclaredConstructor( Class<?>... parameterTypes) * * 同时构造一个新实例,也有这么几个函数: * */ try { Constructor consMethod = clazz.getConstructor(); //可变参数,不写参数也可以,写空参数也可以 //Constructor consMethod=clazz.getConstructor(new Class[]{}); if (consMethod != null) { Object obj = clazz.newInstance(); // method.invoke(obj,null); //Method method=clazz.getMethod("work",new Class<?>[]{}); Method method = clazz.getMethod("work"); method.invoke(obj); return; } //后两个是带有context或activity的构造函数,这两个还没经过测试,不过看样子还不算太麻烦 consMethod = clazz.getConstructor(Context.class); if (consMethod == null) { consMethod = clazz.getConstructor(Activity.class); } if (consMethod != null) { Object obj = consMethod.newInstance(act); Method method = clazz.getMethod("work"); method.invoke(obj); return; } } catch (Exception e) { if (e != null) { LogUtil.log(e.getMessage()); } } } public static void invokeCase(FragmentActivity activity) { CaseNestedScrollFragment.work(activity); // (new CaseFFmpegInvoke()).work(); // (new CaseNativeInvoke()).work(); // CaseForTouch2.obtain(activity).work(); // CaseThreeActivityStart.work(activity); // CaseActivityLifeCycle2.showCase(activity); // CaseThreadJoin.obtain().work(); // CaseCallableAndFuture.instance().work(); // CaseFutureCancel.instance().work(); // CaseSemaphore.getInstance().work(); // ShowAIDLActivity.showCase(activity); // CaseNotifyVsNotifyAll.work(); // CaseSynchronousQueue.obtain().showCase(); // CaseDynamicProxy.obtain().perform(); // CaseClsLoadOrder.showCase(activity); // CaseContextKinds.obtain(activity).work(); // CaseForTryFinally.obtain().work(); // CaseForTryFinally2.obtain().work(); // CaseBufferAllocate.obtain().work(); //-----------------------------------develop start-----------------------------/ // (new CaseAndroidPluginDemo()).work(activity); // (new CaseInitFieldDemo()).work(); // (new CaseReentrantLock3()).work(); // (new CaseReentrantLock()).work(); // (new CaseMultiActivityLifeCycle(activity)).work(); // invokeCase(CaseAutoBoxingUnboxing.class, activity); // invokeCase(CaseLinkedHashMapAccessOrder.class, activity); // invokeCase(CaseAnnotationFruit.class,activity); // CaseForAnnotation.getInstance(activity).work(); //-----------------------------------develop End-----------------------------/ // (new CaseHashSet()).work(); // (new CaseIOReader()).work(); // (new CaseCharEncode(activity)).showCase(); // (new CaseArrayListNew()).work(); // (new CaseMaps()).work(); // CaseAsyncGenerateBitmap.getInstance(activity).work(); // (new CaseForEachIterator()).work(); // CaseAsyncGenerateBitmap.getInstance(activity).work(); // CaseCustViewPager.getInstance().showCase(activity); // CaseOOMErrorCatch.obtain(activity).work(); // CaseRandomAccessFile.showDemo(); // MixColorTextActivity.startMixColorActivity(activity); // CaseAES.getInstance(activity).showCase(); // CaseLoadExternalApkActivity.launch(activity); // CaseShow.show(); // CaseAOP.obtain().performTest(); // CaseVelloyNetActivity.start(activity); // CaseBlockingQueue.getInstance().showCase(); // CaseStaticLayout.getInstance(activity).work(); // CaseDrawText.obtain(activity).work(); // CaseInstanceof.obtain(activity).work(); // CaseTimerAndTimerTask.intance().work(); // CaseThreadPriority.getInstance(activity).work(); // CaseForCustViewAttr.obtain(activity).work(); // CaseParamDelivery.work(); // CaseAddAdd.work(); // CaseCountDownLatch.obtain().work(); // CaseJavaRandom.obtain().work(); // CaseDeepCopy.obtain().work(); // CaseShallowCopy.obtain().work(); // CaseURLEncoder.obtain().work(); // CaseBase64.obtain().work(); // CaseMD5Digest.obtain().work(); // CaseScrolls.obtain(activity).work(); // CaseInvokeFinalStatic.obtain().work(); // CaseTrigger.obtain(activity).work(); // CaseLikeEscape.obtain(activity).work(); // CaseForTouch2.obtain(activity).work(); // CaseDecorMeasureInfo.instance(activity).work(); // CaseForRegex.obtain().work(); // CaseDrawables.obtain(activity).work(); // CaseJavaContainer.obtain().work(); // CaseCanvas.obtain(activity).work(); // CaseSpecialDrawable.obtain(activity).work(); // CaseDownloadActivity.start(activity); // CaseGson.obtain(activity).work(); // CaseBitmapOperate.obtain(activity).work(); // CaseForLinkedHashMap.instance(activity).work(); // CaseCreateTempFile.showDemo(activity); // CaseForViewRootImpl.getInstance(activity).work(); // CaseShiftOperation.obtain(activity).work(); // CaseForCustomAnim1.obtain(activity).work(); // CaseForMath.obtain().work(); // CaseForFinal.getInstance(activity).work(); // CaseForTryFinally.obtain().work(); // CaseForResourceUri.obtain().work(activity); // CaseForNullInvoke.obtain().work(); // CaseForFinal.getInstance(activity).work(); // CaseForAnim1.getInstance(activity).work(); // CaseForDraw.getInstance(activity).work(); // CaseInterpolator.obtain(this).work(); // CaseViewConfiguration.obtain(this).work(); // CaseBitMask.obtain().work(); // CaseForTouch.obtain(this).work4(); // CaseExecutor.getInstance().work(0); // CaseObserver.getInstance().work(); // (new Handler()).postDelayed(new Runnable(){ // @Override // public void run() { // CaseDefaultBrowser.getInstance().work1(MainActivity.this); // } // }, 1000); // // CaseDecorator.getInstance().work(); // // String str= CaseForJson.assembleMsgIdArrayStr("wangzhengyu"); // Log.i("ertewu","str is:"+str); } }
package customer.gajamove.com.gajamove_customer.utils; import android.animation.ValueAnimator; import android.view.animation.LinearInterpolator; import com.google.android.gms.maps.model.LatLng; import static java.lang.Math.atan; public class AnimationUtils { public static ValueAnimator polylineAnimator(){ ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100); valueAnimator.setInterpolator(new LinearInterpolator()); valueAnimator.setDuration(4000); return valueAnimator; } public static ValueAnimator carAnimator(){ ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f,1f); valueAnimator.setDuration(3000); valueAnimator.setInterpolator(new LinearInterpolator()); return valueAnimator; } public static double getRotation(LatLng start,LatLng end){ double latDifference = Math.abs(start.latitude - end.latitude); double lngDifference = Math.abs(start.longitude - end.longitude); double rotation = -1F; if (start.latitude <end.latitude && start.longitude <end.longitude) rotation = Math.toDegrees(Math.atan(lngDifference/latDifference)); else if (start.latitude >= end.latitude && start.longitude <end.longitude) rotation = (90 - Math.toDegrees(Math.atan(lngDifference/latDifference))) + 90; else if (start.latitude >= end.latitude && start.longitude >= end.longitude) rotation = (Math.toDegrees(atan(lngDifference / latDifference)) + 180); else if (start.latitude < end.latitude && start.longitude >= end.longitude) rotation = (90 - Math.toDegrees(atan(lngDifference / latDifference)) + 270); return rotation; } }
package com.duofei.shiro.utils; import org.apache.shiro.config.Ini; import org.apache.shiro.config.ReflectionBuilder; import org.apache.shiro.env.DefaultEnvironment; import org.apache.shiro.env.Environment; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.realm.text.IniRealm; import java.util.HashMap; import java.util.Map; /** * 构造全局唯一的Environment * @author duofei * @date 2019/7/10 */ public class Env { private static Environment environment; static { Ini ini = new Ini(); ini.loadFromPath("classpath:shiro.ini"); ReflectionBuilder builder = new ReflectionBuilder(); Map<String, Object> objects = new HashMap<>(); objects.put("iniRealm",new IniRealm(ini)); builder.setObjects(objects); builder.buildObjects(ini.getSection("main")); environment = new DefaultEnvironment(builder.getObjects()); } public SecurityManager getSecurityManager() throws IllegalStateException { return environment.getSecurityManager(); } }
package com.doujg; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; /** * @author * @create 2017-12-12 14:33 **/ @SpringBootApplication @EnableZuulProxy public class SpringCloudZuulApplication { public static void main(String []args){ SpringApplication.run(SpringCloudZuulApplication.class, args); } }
package com.niubimq.thread; import java.net.Socket; import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.LinkedBlockingQueue; import net.sf.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import com.niubimq.listener.LifeCycle; import com.niubimq.pojo.Message; import com.niubimq.pojo.MessageWrapper; import com.niubimq.queue.QueueFactory; import com.niubimq.util.MessageSender; import com.niubimq.util.PropertiesReader; /** * @Description: thread1 * step1 :从即时消息队列中取出消息 * step2 :发送消息给指定的消费者 * step3 :将消费对象包装,放入待相应的消息队列 * * @author junjin4838 * @version 1.0 */ @Service public class ImmediatelyMsgConsumeService extends BaseService { private final static Logger log = LoggerFactory.getLogger(ImmediatelyMsgConsumeService.class); /** * 配置文件读取类 */ private PropertiesReader reader = PropertiesReader.getInstance(); /** * 即时消息队列的引用 */ private LinkedBlockingQueue<Message> immediateMessageQueue; /** * 包含连接对象的消息队列的引用 */ private LinkedBlockingQueue<MessageWrapper> consumingMessageQueue; /** * Queue4: 消费完毕的消息队列 */ private LinkedBlockingQueue<Message> consumedMessageQueue; /** * 消费队列最大值 */ private int consumingMsgQueueMaCount = 1000; /** * 消息消费服务超时时间 */ private int msgResponseTimeout; /** * 休眠时间 */ private int sleepTime = 100; public void run() { while(this.state == LifeCycle.RUNNING || this.state == LifeCycle.STARTING){ Message msg = null; if(consumingMessageQueue.size() <= consumingMsgQueueMaCount){ msg = immediateMessageQueue.poll(); } if(msg != null){ //设定超时时间 if(msg.getResponseTimeOut() == null){ msg.setResponseTimeOut(msgResponseTimeout); } //开始消费 sleepTime = 0; try{ //推送消息给消费者 Socket so = MessageSender.sendMessageBySocket(msg); if(so == null) throw new Exception("消息推送失败"); MessageWrapper msgWrapper = new MessageWrapper(); msgWrapper.setMessage(msg); msgWrapper.setConnCreateTime(System.currentTimeMillis()); msgWrapper.setSocket(so); msgWrapper.setResponseTimeOut(msg.getResponseTimeOut()); consumingMessageQueue.add(msgWrapper); }catch(Exception e){ // 消费异常 if(msg.getAllowRetryTimes() > msg.getRetryTimes()){ //允许重试,将消息放入即时消费队列等待再次消费 msg.setRetryTimes(msg.getRetryTimes()+1); msg.setConsumeResult(2); msg.setFinishTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); msg.setFailedReason(e.getMessage()); immediateMessageQueue.add(msg); }else{ // 重试结束 msg.setConsumeResult(2); msg.setFinishTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); msg.setFailedReason(e.getMessage()); // 失败消息入库 consumedMessageQueue.add(msg); } log.error("消息推送失败,消息内容:"+JSONObject.fromObject(msg).toString() + "\n失败原因:"+ e.getMessage()); e.printStackTrace(); } }else{ try { Thread.sleep((sleepTime++) * sleepTime < 2000 ? (sleepTime) * sleepTime : 2000); } catch (InterruptedException e) { e.printStackTrace(); } } } } /** * 初始化 */ @SuppressWarnings("unchecked") @Override public void initInternal() { //队列初始化 QueueFactory queryFactory = QueueFactory.getInstance(); immediateMessageQueue = (LinkedBlockingQueue<Message>)queryFactory.getQueue(QueueFactory.IMMEDIATE_QUEUE); consumingMessageQueue = (LinkedBlockingQueue<MessageWrapper>)queryFactory.getQueue(QueueFactory.CONSUMING_QUEUE); // 初始化休眠时间 Integer spt = Integer.parseInt((String)reader.get("thread.ImmediatelyMsgConsumeService.sleeptime")); this.sleepTime = spt; // 初始化全局响应超时时间 Integer mrt = Integer.parseInt(reader.get("message.responseTimeOut").toString()); if(mrt != null){ this.msgResponseTimeout = mrt; } // 初始化consumingMsgQueueMaxCount Integer cmmt = Integer.parseInt(reader.get("queue.consumingMessageQueue.maxCount").toString()); if(mrt != null){ this.consumingMsgQueueMaCount = cmmt; } log.info("-------ImmediatelyMsgConsumeService初始化完毕-----"); } @Override public void startInternal() { Thread t = new Thread(this); t.setDaemon(true); t.setName("Immediately-Msg-Consume-Service-Thread"); t.start(); log.info("----ImmediatelyMsgConsumeService-- 启动完毕"); } @Override public void destroyInternal() { while(immediateMessageQueue.size() != 0){ try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } log.info("-------ImmediatelyMsgConsumeService销毁完毕-----"); } }
package com.tencent.mm.plugin.wallet_core.ui; import android.graphics.Paint; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; class WalletOrderInfoNewUI$6 implements Runnable { final /* synthetic */ WalletOrderInfoNewUI pwh; WalletOrderInfoNewUI$6(WalletOrderInfoNewUI walletOrderInfoNewUI) { this.pwh = walletOrderInfoNewUI; } public final void run() { try { if (WalletOrderInfoNewUI.r(this.pwh).getVisibility() == 0 && WalletOrderInfoNewUI.s(this.pwh).getRight() > 0 && WalletOrderInfoNewUI.r(this.pwh).getLeft() > 0 && WalletOrderInfoNewUI.s(this.pwh).getRight() >= WalletOrderInfoNewUI.r(this.pwh).getLeft() && !bi.K(WalletOrderInfoNewUI.s(this.pwh).getText())) { float textSize = WalletOrderInfoNewUI.s(this.pwh).getTextSize(); x.i("MicroMsg.WalletOrderInfoNewUI", "tinyAppDescTv size exceed, tinyAppDescTv.getRight(): %s, tinyAppButton.getLeft(): %s", new Object[]{Integer.valueOf(WalletOrderInfoNewUI.s(this.pwh).getRight()), Integer.valueOf(WalletOrderInfoNewUI.r(this.pwh).getLeft())}); Paint paint = new Paint(); paint.setTextSize(textSize); String charSequence = WalletOrderInfoNewUI.s(this.pwh).getText().toString(); float left = (float) (WalletOrderInfoNewUI.r(this.pwh).getLeft() - WalletOrderInfoNewUI.s(this.pwh).getLeft()); int i = 1; while (paint.measureText(charSequence.substring(0, (charSequence.length() - i) - 1)) > left && i <= charSequence.length() - 1) { i++; } x.i("MicroMsg.WalletOrderInfoNewUI", "tinyAppDescTv, exceed len, final search count: %s, text.length: %s", new Object[]{Integer.valueOf(i), Integer.valueOf(charSequence.length())}); CharSequence substring = charSequence.substring(0, (charSequence.length() - i) - 1); if (charSequence.length() > 9 && substring.length() < 9) { substring = charSequence.substring(0, 9); } WalletOrderInfoNewUI.s(this.pwh).setText(substring); WalletOrderInfoNewUI.s(this.pwh).append("..."); } } catch (Throwable e) { x.printErrStackTrace("MicroMsg.WalletOrderInfoNewUI", e, "calc tinyapp name error: %s", new Object[]{e.getMessage()}); } } }
//finds empty room and updates txt file when new members are checked in import java.io.*; import static java.lang.System.out; public class hotelgp1data { public static void main (String [] args) throws IOException { //create file reader BufferedReader br = new BufferedReader(new FileReader("src/hotelgp.txt")); BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int guests [] = new int [5]; int roomNum; for (roomNum = 0; roomNum < guests.length; roomNum++) { guests[roomNum] = Integer.parseInt(br.readLine()); } roomNum = 0; while (roomNum < guests.length && guests[roomNum] != 0) { roomNum++; } if (roomNum == 5) { out.println("Sorry. There are no vacancies today."); } else { out.print("Congrats! Room "+roomNum+" is empty.\n"); out.print("How many guests would you like to check in?: "); guests[roomNum] = Integer.parseInt(input.readLine()); out.println(); out.println("You have successfully checked into room "+roomNum+" for "+guests[roomNum]+". Thank you."); } br.close();//close br to prevent conflict when reading/writing to files. input.close(); PrintStream ps = new PrintStream("src/hotelgp.txt"); for (roomNum = 0; roomNum < guests.length; roomNum++) { ps.println(guests[roomNum]); } ps.close(); } }
package cpen221.mp3.wikimediator; import java.util.ArrayList; import java.util.List; public class Query { private final String item; private final List<Condition> cond; private final String sorted; public Query(String item, List<Condition> cond, String sorted) { this.item = item; this.cond = new ArrayList<>(cond); this.sorted = sorted; } public ArrayList<Condition> getConditions() { return new ArrayList<>(cond); } public String getItem() { return item; } public String getSorted() { return sorted; } }
package org.config.spring; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Created by yangyu on 2016/6/2. */ public class Startup { public static void main(String[] args) { new ClassPathXmlApplicationContext("classpath:/config/applicationContext.xml"); } }
/** * shopmobile for tpshop * ============================================================================ * 版权所有 2015-2099 深圳搜豹网络科技有限公司,并保留所有权利。 * 网站地址: http://www.tp-shop.cn * —————————————————————————————————————— * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 . * 不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * Author: 飞龙 wangqh01292@163.com * Date: @date 2015年10月30日 下午10:03:56 * Description: 我的 -> 优惠券列表 * @version V1.0 */ package com.tpshop.mallc.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.tpshop.mallc.R; import com.tpshop.mallc.model.shop.SPCoupon; import com.soubao.tpshop.utils.SPCommonUtils; import com.soubao.tpshop.utils.SPStringUtils; import java.util.List; /** * @author 飞龙 * */ public class SPCouponListAdapter extends BaseAdapter { private List<SPCoupon> mCoupons ; private Context mContext ; private int mType; public SPCouponListAdapter(Context context , int type){ this.mContext = context; this.mType = type; } public void setType(int type){ this.mType = type; } public void setData(List<SPCoupon> coupons){ if(coupons == null)return; this.mCoupons = coupons; } @Override public int getCount() { if(mCoupons == null)return 0; return mCoupons.size(); } @Override public Object getItem(int position) { if(mCoupons == null) return null; return mCoupons.get(position); } @Override public long getItemId(int position) { if(mCoupons == null) return -1; return Integer.valueOf(mCoupons.get(position).getCouponID()); } @Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if(convertView == null){ //使用自定义的list_items作为Layout convertView = LayoutInflater.from(mContext).inflate(R.layout.person_coupon_list_item, parent, false); //使用减少findView的次数 holder = new ViewHolder(); holder.couponRlayout = ((View) convertView.findViewById(R.id.coupon_rlayout)) ; holder.rmbTxtv = ((TextView) convertView.findViewById(R.id.coupon_rmb_txtv)) ; holder.moneyTxtv = ((TextView) convertView.findViewById(R.id.coupon_money_txtv)) ; holder.titleTxtv = ((TextView) convertView.findViewById(R.id.coupon_title_txtv)) ; holder.timeTxtv = ((TextView) convertView.findViewById(R.id.coupon_time_txtv)) ; //设置标记 convertView.setTag(holder); }else{ holder = (ViewHolder) convertView.getTag(); } SPCoupon coupon = mCoupons.get(position); String money = coupon.getMoney(); String title = coupon.getName(); String userTimeText = ""; int colorId = mContext.getResources().getColor(R.color.color_font_gray); switch (this.mType){ case 0: colorId = mContext.getResources().getColor(R.color.color_font_blue); if(!SPStringUtils.isEmpty(coupon.getUseEndTime())){ userTimeText = "过期时间:\n"+ SPCommonUtils.getDateFullTime(Long.valueOf(coupon.getUseEndTime())); } holder.couponRlayout.setBackgroundResource(R.drawable.icon_coupon_unuse); break; case 1: colorId = mContext.getResources().getColor(R.color.color_font_gray); if(!SPStringUtils.isEmpty(coupon.getUseTime())){ userTimeText = "使用时间:\n"+ SPCommonUtils.getDateFullTime(Long.valueOf(coupon.getUseTime())); } holder.couponRlayout.setBackgroundResource(R.drawable.icon_coupon_used); break; case 2: colorId = mContext.getResources().getColor(R.color.color_font_gray); if(!SPStringUtils.isEmpty(coupon.getUseTime())){ userTimeText = "使用时间:\n"+ SPCommonUtils.getDateFullTime(Long.valueOf(coupon.getUseTime())); } holder.couponRlayout.setBackgroundResource(R.drawable.icon_coupon_used); break; } if (!SPStringUtils.isEmpty(money)){ holder.moneyTxtv.setText(Double.valueOf(money).intValue()+"");; } holder.titleTxtv.setText(title); holder.timeTxtv.setText(userTimeText); holder.rmbTxtv.setTextColor(colorId); holder.moneyTxtv.setTextColor(colorId); return convertView; } class ViewHolder{ View couponRlayout; TextView rmbTxtv; TextView moneyTxtv; TextView titleTxtv; TextView timeTxtv; } }
package com.sysh.entity.helplog; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; /** * ClassName: <br/> * Function: 帮扶日志查询<br/> * date: 2018年06月11日 <br/> * * @author 苏积钰 * @since JDK 1.8 */ public class HelpLogModel implements Serializable { private String log,helptime,helpNumber; private Long id ,numberPraise,visitingMode; private List<DiscussDD> discussList; private List<String> list; public HelpLogModel(String log, String helptime, String helpNumber, Long id, Long numberPraise, Long visitingMode, List<String> list) { this.log = log; this.helptime = helptime; this.helpNumber = helpNumber; this.id = id; this.numberPraise = numberPraise; this.visitingMode = visitingMode; this.list = list; } public HelpLogModel(String log, String helptime, String helpNumber, Long numberPraise, Long visitingMode) { this.log = log; this.helptime = helptime; this.helpNumber = helpNumber; this.numberPraise = numberPraise; this.visitingMode = visitingMode; } public HelpLogModel(String log, String helptime, String helpNumber, Long id, Long numberPraise, Long visitingMode, List<DiscussDD> discussList, List<String> list) { this.log = log; this.helptime = helptime; this.helpNumber = helpNumber; this.id = id; this.numberPraise = numberPraise; this.visitingMode = visitingMode; this.discussList = discussList; this.list = list; } public List<DiscussDD> getDiscussList() { return discussList; } public void setDiscussList(List<DiscussDD> discussList) { this.discussList = discussList; } public String getHelpNumber() { return helpNumber; } public void setHelpNumber(String helpNumber) { this.helpNumber = helpNumber; } public HelpLogModel() { super(); } public String getLog() { return log; } public void setLog(String log) { this.log = log; } public String getHelptime() { return helptime; } public void setHelptime(String helptime) { this.helptime = helptime; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getNumberPraise() { return numberPraise; } public void setNumberPraise(Long numberPraise) { this.numberPraise = numberPraise; } public Long getVisitingMode() { return visitingMode; } public void setVisitingMode(Long visitingMode) { this.visitingMode = visitingMode; } public List<String> getList() { return list; } public void setList(List<String> list) { this.list = list; } @Override public String toString() { return "HelpLogModel{" + "log='" + log + '\'' + ", helptime='" + helptime + '\'' + ", helpNumber='" + helpNumber + '\'' + ", id=" + id + ", numberPraise=" + numberPraise + ", visitingMode=" + visitingMode + ", discussList=" + discussList + ", list=" + list + '}'; } }
package com.tencent.mm.plugin.appbrand.jsapi.media; import com.tencent.mm.plugin.appbrand.jsapi.media.c.2; import com.tencent.mm.plugin.appbrand.jsapi.media.c.b; import com.tencent.mm.plugin.appbrand.jsapi.media.c.c; import com.tencent.mm.plugin.appbrand.jsapi.media.c.e; import com.tencent.mm.plugin.appbrand.l; import com.tencent.mm.vending.j.a; import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.Map; class c$1 implements Runnable { final /* synthetic */ int doP; final /* synthetic */ l fCl; final /* synthetic */ WeakReference fUX; final /* synthetic */ c fUY; final /* synthetic */ String val$url; c$1(c cVar, l lVar, String str, WeakReference weakReference, int i) { this.fUY = cVar; this.fCl = lVar; this.val$url = str; this.fUX = weakReference; this.doP = i; } public final void run() { a aVar = null; for (b i : c.ajq()) { aVar = i.i(this.fCl.fdO, this.val$url); if (aVar != null) { break; } } a aVar2 = aVar; if (this.fUX.get() != null && ((l) this.fUX.get()).Sx) { if (aVar2 != null) { String f; switch (2.fUZ[((e) aVar2.get(0)).ordinal()]) { case 1: f = this.fUY.f("fail:file not found", null); break; case 2: Map hashMap = new HashMap(2); hashMap.put("width", Integer.valueOf(((c) aVar2.get(1)).width)); hashMap.put("height", Integer.valueOf(((c) aVar2.get(1)).height)); hashMap.put("orientation", ((c) aVar2.get(1)).fqt); hashMap.put("type", ((c) aVar2.get(1)).type); f = this.fUY.f("ok", hashMap); break; default: f = this.fUY.f("fail", null); break; } ((l) this.fUX.get()).E(this.doP, f); return; } ((l) this.fUX.get()).E(this.doP, this.fUY.f("fail:src not support", null)); } } }
package com.openclassrooms.KatzenheimLibrariesApp.batchConfig; import javax.transaction.Transactional; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.item.ItemProcessor; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import com.openclassrooms.KatzenheimLibrariesApp.entities.Borrow; import com.openclassrooms.KatzenheimLibrariesApp.entities.LibraryUser; import com.openclassrooms.KatzenheimLibrariesApp.service.BatchProcessingService; import com.openclassrooms.KatzenheimLibrariesApp.service.BorrowService; @Configuration @EnableBatchProcessing @EnableScheduling public class SpringBatchConfig { @Autowired BatchProcessingService batchProcessingService ; @Scheduled(cron="0 10 13 * * *") @Transactional public Job job() { batchProcessingService.batchProcessing(); return null; } }
package napps.com.nearbycoffee.Contract; import napps.com.nearbycoffee.BasePresenter; import napps.com.nearbycoffee.BaseView; /** * Created by "nithesh" on 7/15/2017. */ public interface LocationContract { interface View extends BaseView<Presenter>{ void showLoadingLocation(); void showRequestLocationAccess(); void showRequestLocationSettings(); void showRequestLocationSuccesful(); } interface Presenter extends BasePresenter { void locationAccessResult(int resultCode); void locationSettingsResult(int resultCode); void requestLocation(); } }
package com.tencent.mm.plugin.bottle.ui; import com.tencent.mm.plugin.bottle.ui.ThrowBottleAnimUI.a; class OpenBottleUI$1 implements a { final /* synthetic */ OpenBottleUI hmh; OpenBottleUI$1(OpenBottleUI openBottleUI) { this.hmh = openBottleUI; } public final void auA() { OpenBottleUI.a(this.hmh).setVisibility(8); OpenBottleUI.b(this.hmh).nm(0); } }
package com.xuanxing.core.home.service; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.xuanxing.core.home.model.City; public interface CityService { City selectById(int id); PageList<City> queryPage(City record, PageBounds pb); }
package com.tuitaking.everyDay; import java.util.Arrays; /** * 老师想给孩子们分发糖果,有 N个孩子站成了一条直线,老师会根据每个孩子的表现,预先给他们评分。 * 你需要按照以下要求,帮助老师给这些孩子分发糖果: * 每个孩子至少分配到 1 个糖果。 * 相邻的孩子中,评分高的孩子必须获得更多的糖果。 * 那么这样下来,老师至少需要准备多少颗糖果呢? * 示例1: * 输入: [1,0,2] * 输出: 5 * 解释: 你可以分别给这三个孩子分发 2、1、2 颗糖果。 * 示例2: * 输入: [1,2,2] * 输出: 4 * 解释: 你可以分别给这三个孩子分发 1、2、1 颗糖果。 * 第三个孩子只得到 1 颗糖果,这已满足上述两个条件。 * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/candy * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ public class Candy_135 { /** * 如果当前比左右都小,则获取1个糖果, * 如果当前比左边大,比右边小,则在左边的加1 * 如果当前比左边小,比右边大,则获取两个 * [36, 68, 52, 31] * 如果连续递减,那么第一个需要连续递减区间的多大的那个 * @param ratings * @return */ public int candy_my(int[] ratings) { if(ratings.length<=1){ return 1; } int res=0; int[] dp=new int[ratings.length]; dp[0]=1; if(ratings.length>1){ if(dp[0]>dp[1]){ dp[0]=2; } } for(int i = 1 ; i<ratings.length;i++){ if(i==ratings.length-1){ if(ratings[i]>ratings[i-1]){ dp[i]=dp[i-1]+1; }else { dp[i]=1; } break; } // 当前比左边大,比右边小 if(ratings[i]>ratings[i-1]&&ratings[i]<ratings[i+1]){ dp[i]=dp[i-1]+1; } //比左边小,比右边小 if(ratings[i]<=ratings[i-1]&&ratings[i]<ratings[i+1]){ dp[i]=2; } // 比左右都大 if(ratings[i]>ratings[i-1]&&ratings[i]>ratings[i+1]){ dp[i]=dp[i-1]+1; } // 比左右都小 if(ratings[i]<=ratings[i-1]&&ratings[i]<=ratings[i+1]){ dp[i]=1; } } for(int i : dp){ if(i==0){ res+=1; } res+=i; } return res; } // 从左往右找最小的值,给他1个,然后累加到最大的那个位置,1+2+n public int candy(int[] ratings) { int n = ratings.length; int[] left = new int[n]; for (int i = 0; i < n; i++) { if (i > 0 && ratings[i] > ratings[i - 1]) { left[i] = left[i - 1] + 1; } else { left[i] = 1; } } int right = 0, ret = 0; for (int i = n - 1; i >= 0; i--) { if (i < n - 1 && ratings[i] > ratings[i + 1]) { right++; } else { right = 1; } ret += Math.max(left[i], right); } return ret; } public int candy_v1(int[] ratings) { int n = ratings.length; int ret = 1; int inc = 1, dec = 0, pre = 1; for (int i = 1; i < n; i++) { if (ratings[i] >= ratings[i - 1]) { dec = 0; pre = ratings[i] == ratings[i - 1] ? 1 : pre + 1; ret += pre; inc = pre; } else { dec++; if (dec == inc) { dec++; } ret += dec; pre = 1; } } return ret; } }
package com.tencent.mm.plugin.topstory.ui.video; import com.tencent.mm.plugin.topstory.ui.video.b.a; class TopStoryVideoStreamUI$5 implements a { final /* synthetic */ TopStoryVideoStreamUI oBa; TopStoryVideoStreamUI$5(TopStoryVideoStreamUI topStoryVideoStreamUI) { this.oBa = topStoryVideoStreamUI; } public final void sO(int i) { TopStoryVideoStreamUI.a(this.oBa, i); } }
package com.elepy.describers; import com.elepy.Resource; import com.elepy.ResourceArray; import com.elepy.models.FieldType; import com.elepy.models.Model; import com.elepy.models.Property; import com.elepy.models.TextType; import com.elepy.models.props.*; import com.elepy.uploads.FileUploadEvaluator; import com.elepy.utils.ModelUtils; import org.junit.jupiter.api.Test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.stream.Collectors; import static com.elepy.models.FieldType.*; import static com.google.common.truth.Truth.assertThat; import static org.junit.jupiter.api.Assertions.*; public class ModelUtilsTest { @Test void testCorrectOrderingAndPropertySizeOfModel() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); //Should be + 1 because of the @GeneratedField method assertEquals(Resource.class.getDeclaredFields().length + 1, modelFromClass.getProperties().size()); assertEquals("id", modelFromClass.getProperties().get(0).getName()); assertEquals("generated", modelFromClass.getProperties().get(modelFromClass.getProperties().size() - 1).getName()); } @Test void testCorrectDate() throws ParseException { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); final Property property = modelFromClass.getProperty("date"); final DatePropertyConfig of = DatePropertyConfig.of(property); assertEquals(new Date(0), of.getMinimumDate()); assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("2019-22-12"), of.getMaximumDate()); assertThat(property.getType()) .isEqualTo(DATE); } @Test void testCorrectText() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); final Property property = modelFromClass.getProperty("minLen10MaxLen50"); final TextPropertyConfig of = TextPropertyConfig.of(property); assertEquals(TextType.TEXTAREA, of.getTextType()); assertEquals(10, of.getMinimumLength()); assertEquals(50, of.getMaximumLength()); assertThat(property.getType()) .isEqualTo(TEXT); } @Test void testCorrectEnum() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); final Property property = modelFromClass.getProperty("textType"); final EnumPropertyConfig of = EnumPropertyConfig.of(property); assertTrue(of.getAvailableValues().stream().map(map -> map.get("enumValue")).collect(Collectors.toList()).contains("HTML")); assertThat(property.getType()) .isEqualTo(ENUM); } @Test void testCorrectObject() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); final Property property = modelFromClass.getProperty("resourceCustomObject"); final ObjectPropertyConfig of = ObjectPropertyConfig.of(property); assertThat(property.getType()) .isEqualTo(OBJECT); assertThat(of.getObjectName()) .isEqualTo("ResourceCustomObject"); assertThat(of.getFeaturedProperty()) .isEqualTo("featured"); assertThat(of.getProperties().size()) .isEqualTo(1); } @Test void testCorrectNumber() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); final Property property = modelFromClass.getProperty("numberMin10Max50"); final NumberPropertyConfig of = NumberPropertyConfig.of(property); assertEquals(10, of.getMinimum()); assertEquals(50, of.getMaximum()); assertThat(property.getType()) .isEqualTo(NUMBER); } @Test void testCorrectUnique() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); assertTrue(modelFromClass.getProperty("unique").isUnique()); } @Test void testCorrectFileReference() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); final Property property = modelFromClass.getProperty("fileReference"); final var reference = FileReferencePropertyConfig.of(property); assertThat(reference.getAllowedMimeType()) .isEqualTo("image/png"); assertThat(reference.getMaxSizeInBytes()) .isEqualTo(FileUploadEvaluator.DEFAULT_MAX_FILE_SIZE); assertThat(property.getType()) .isEqualTo(FILE_REFERENCE); } @Test void testCorrectRequired() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); assertTrue(modelFromClass.getProperty("required").isRequired()); } @Test void testCorrectUneditable() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); assertFalse(modelFromClass.getProperty("nonEditable").isEditable()); } @Test void testCorrectIdProperty() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); assertThat(modelFromClass.getIdProperty()).isEqualTo("id"); } @Test void testCorrectFeaturedProperty() { final Model<Resource> modelFromClass = ModelUtils.createModelFromClass(Resource.class); assertThat(modelFromClass.getFeaturedProperty()).isEqualTo("featuredProperty"); } //TODO consider splitting this into multiple tests and testing the extras @Test void testCorrectArray() { final Model<ResourceArray> model = ModelUtils.createModelFromClass(ResourceArray.class); final Property arrayString = model.getProperty("arrayString"); final Property arrayNumber = model.getProperty("arrayNumber"); final Property arrayDate = model.getProperty("arrayDate"); final Property arrayObject = model.getProperty("arrayObject"); final Property arrayBoolean = model.getProperty("arrayBoolean"); final Property arrayEnum = model.getProperty("arrayEnum"); assertThat(arrayString.getType()).isEqualTo(FieldType.ARRAY); assertThat(arrayNumber.getType()).isEqualTo(FieldType.ARRAY); assertThat(arrayDate.getType()).isEqualTo(FieldType.ARRAY); assertThat(arrayObject.getType()).isEqualTo(FieldType.ARRAY); assertThat(arrayBoolean.getType()).isEqualTo(FieldType.ARRAY); assertThat(arrayEnum.getType()).isEqualTo(FieldType.ARRAY); assertThat((FieldType) arrayString.getExtra("arrayType")).isEqualTo(FieldType.TEXT); assertThat((FieldType) arrayNumber.getExtra("arrayType")).isEqualTo(FieldType.NUMBER); assertThat((FieldType) arrayDate.getExtra("arrayType")).isEqualTo(FieldType.DATE); assertThat((FieldType) arrayObject.getExtra("arrayType")).isEqualTo(FieldType.OBJECT); assertThat((FieldType) arrayBoolean.getExtra("arrayType")).isEqualTo(FieldType.BOOLEAN); assertThat((FieldType) arrayEnum.getExtra("arrayType")).isEqualTo(FieldType.ENUM); } }
package org.simplyatul.cassandrademo.repository; import org.springframework.data.cassandra.repository.CassandraRepository; import org.springframework.stereotype.Repository; import org.simplyatul.cassandrademo.model.DemoTable; @Repository public interface DemoTableRepo extends CassandraRepository<DemoTable, String>, CustomizedSave<DemoTable> { }
package com.smos.smartlistview; import android.graphics.Canvas; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; /** * Created by zhangjunxing on 16-3-7. */ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration { HeaderProvider mHeaderProvider; public StickyHeaderDecoration(HeaderProvider headerProvider) { mHeaderProvider = headerProvider; } @Override public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { super.onDraw(canvas, parent, state); } @Override public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) { super.onDraw(canvas, parent, state); View currentHeader = getCurrentHeader(parent); if (currentHeader == null) { return; } measureHeader(parent, currentHeader); float headerOffset = configureHeader(parent, currentHeader); int saveCount = canvas.save(); canvas.translate(0, headerOffset); canvas.clipRect(0, 0, parent.getWidth(), currentHeader.getMeasuredHeight()); // needed // for // < // HONEYCOMB currentHeader.draw(canvas); canvas.restoreToCount(saveCount); } private float configureHeader(RecyclerView recyclerView, View currentHeader) { float headerOffset = 0.0f; int childCount = recyclerView.getChildCount(); for (int i = 0; i < childCount - 1; i++) { View header = recyclerView.getChildAt(i); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) header.getLayoutParams(); if (!params.isViewInvalid()) { RecyclerView.ViewHolder childViewHolder = recyclerView.getChildViewHolder(header); int adapterPosition = childViewHolder.getAdapterPosition(); if (mHeaderProvider.isHeader(adapterPosition)) { float headerTop = header.getTop(); float pinnedHeaderHeight = currentHeader.getMeasuredHeight(); if (pinnedHeaderHeight >= headerTop && headerTop > 0) { headerOffset = headerTop - header.getHeight(); } } } } return headerOffset; } private void measureHeader(RecyclerView parent, View header) { int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(parent.getWidth(), View .MeasureSpec.EXACTLY); int heightMeasureSpec; ViewGroup.LayoutParams params = header.getLayoutParams(); if (params != null && params.height > 0) { heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(params.height, View.MeasureSpec .EXACTLY); } else { heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); } header.measure(widthMeasureSpec, heightMeasureSpec); header.layout(parent.getLeft() + parent.getPaddingLeft(), 0, parent.getRight() - parent .getPaddingRight(), header.getMeasuredHeight()); } private View getCurrentHeader(RecyclerView recyclerView) { LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager(); int firstVisiblePos = lm.findFirstVisibleItemPosition(); return mHeaderProvider.getHeader(firstVisiblePos); } public interface HeaderProvider { View getHeader(int position); boolean isHeader(int position); } }
package fall2018.csc2017.scoring; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import fall2018.csc2017.R; import fall2018.csc2017.common.SaveAndLoadFiles; import fall2018.csc2017.common.SectionsPageAdapter; import fall2018.csc2017.gamelauncher.MainActivity; public class LeaderBoardActivity extends AppCompatActivity implements SaveAndLoadFiles { /** * ViewPager to contain fragments */ private ViewPager mViewPager; @Override @SuppressWarnings("unchecked") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_leaderboard); mViewPager = findViewById(R.id.container); setupViewPager(mViewPager); mViewPager.setCurrentItem(getIntent().getIntExtra("frgToLoad", 0)); TabLayout tabLayout = findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); } private void setupViewPager(ViewPager viewPager) { SectionsPageAdapter adapter = new SectionsPageAdapter(getSupportFragmentManager()); adapter.addFragment(new SlidingTileLeaderBoardFragment()); adapter.addFragment(new FourLeaderBoardFragment()); adapter.addFragment(new MatchingLeaderBoardFragment()); viewPager.setAdapter(adapter); } /** * Switch to the MainActivity view. */ private void switchToTitleActivity(int page) { Intent tmp = new Intent(this, MainActivity.class); tmp.putExtra("frgToLoad", page); startActivity(tmp); } @Override public void onBackPressed() { switchToTitleActivity(mViewPager.getCurrentItem()); finish(); } /** * Passes context of the activity to utility interface * * @return Context of current activity */ public Context getActivity() { return this; } }
import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Scanner; public class ServerCommandListener implements Runnable, KeyListener { SpaceStats spaceStats; Server server; Scanner sc; public ServerCommandListener(Server server) { this.server = server; sc = new Scanner(System.in); Thread commandListener = new Thread(this); commandListener.start(); } public void run() { while(true) { String fullCommand = sc.nextLine(); String[] commandList = fullCommand.split(" "); String args = ""; for(int i = 1; i < commandList.length; i++) { args += commandList[i] + " "; } String firstCommand = commandList[0]; switch(firstCommand) { case "exit": for(int i = 0; i < spaceStats.playerList.length; i++) { try { server.printMessageToAll("Server stopped. Please restart client. "); } catch(Exception ex) { System.out.println("Problem stopping server. "); } } System.exit(0); break; case "print": try { server.printMessageToAll("SERVER: " + args); } catch(Exception ex) { System.out.println("Could not write server message "); } break; case "save": server.saveProgress(); break; case "help": System.out.println("\nCommand List:"); System.out.println("exit Saves the server and closes the game. "); System.out.println("print (Message) Sends a message to the whole server. "); System.out.println("save Saves the game. "); System.out.println(); break; default: break; } } } public void keyPressed(KeyEvent arg0) { int key = arg0.getKeyCode(); if(key == KeyEvent.VK_ESCAPE) { server.saveProgress(); System.exit(0); } } public void keyReleased(KeyEvent arg0) { } public void keyTyped(KeyEvent arg0) { } }
/* * 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. */ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.when; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; /** * * @author marcu */ @ExtendWith(MockitoExtension.class) public class PerguntaTestTrue { Pergunta perguntaPrincipalMock = Mockito.mock(Pergunta.class); @org.junit.jupiter.api.Test public void testSomeMethod() { perguntarTrue(); } public void perguntarTrue(){ JogoGurmet jg = new JogoGurmet(); jg.setPerguntaPrincipal(perguntaPrincipalMock); when(perguntaPrincipalMock.isPerguntaSim()).thenReturn(true); } }
package com.smxknife.cloud.netflix; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; import org.springframework.web.client.RestTemplate; /** * @author smxknife * 2021/4/29 */ @SpringBootApplication public class EurekaConsumer { public static void main(String[] args) { SpringApplication.run(EurekaConsumer.class, args); } @Bean @Primary public RestTemplate restTemplate() { return new RestTemplate(); } @Bean("loadBalancer") @LoadBalanced public RestTemplate loadBalancerRestTemplate() { return new RestTemplate(); } }
/* * $Id: Sorts.java, 2018年10月15日 下午6:51:21 XiuYu.Ge Exp $ * * Copyright (c) 2018 Vnierlai Technologies Co.,Ltd All rights reserved. * * This software is copyrighted and owned by Vnierlai or the copyright holder specified, unless otherwise noted, and may * not be reproduced or distributed in whole or in part in any form or medium without express written permission. */ package cn.zzcode.geek._11sorts; /** * <p> * Title: Sorts * </p> * <p> * Description:冒泡排序,插入排序,选择排序 * </p> * * @author XiuYu.Ge * @created 2018年10月15日 下午6:51:21 * @modified [who date description] * @check [who date description] */ public class Sorts { /** * 冒泡排序 * * @author XiuYu.Ge * @created 2018年10月15日 下午6:56:57 * @param array */ public static void bubbleSort(int[] array) { for (int i = 0; i < array.length; i++) { for (int j = 0; j < i; j++) { // 交换 if (array[j] > array[j + 1]) { int tmp = array[j]; array[j] = array[j + 1]; array[j + 1] = tmp; } } } } /** * 插入排序 * * @author XiuYu.Ge * @created 2018年10月15日 下午7:07:50 */ public static void insertSort(int[] array) { for (int i = 1; i < array.length; i++) { int curr = array[i]; int j = i - 1; while (j >= 0 && array[j] > curr) { array[j + 1] = array[j]; j--; } array[j + 1] = curr; } } /** * 选择排序 * * @author XiuYu.Ge * @created 2018年10月15日 下午8:36:05 */ public static void selectionSort(int[] array) { for (int i = 0; i < array.length; i++) { int minIndex = i; int minValue = array[i]; for (int j = i + 1; j < array.length; j++) { if (minValue < array[j]) { minIndex = j; minValue = array[j]; } } int tmp = array[i]; array[i] = array[minIndex]; array[minIndex] = tmp; } } /** * * @author XiuYu.Ge * @created 2018年10月15日 下午6:56:53 * @param array */ public static void print(int[] array) { for (int curr = 0; curr < array.length; curr++) { System.out.print(array[curr] + " "); } System.out.println(); } public static void main(String[] args) { int[] arr = {2, 1, 5, 4, 3}; // bubbleSort(arr); selectionSort(arr); // print(arr); } }
import java.util.ArrayList; public class Conta { private double saldo; private double numero; private double limite; private ArrayList<Titular> titular = new ArrayList<Titular>(); public Conta(double saldo, double numero, double limite, Titular titular) { this.saldo = saldo; this.numero = numero; this.limite = limite; this.titular.add(titular); } public Conta(double saldo, double numero, double limite, ArrayList<Titular> titular) { this.saldo = saldo; this.numero = numero; this.limite = limite; this.titular = titular; } public void saque(double valor) { if (valor > this.getSaldo()) { System.out.println("Nao eh possivel sacar, saldo insuficiente!"); } else { this.setSaldo(this.getSaldo() - valor); } } public void deposito(double valor) { this.setSaldo(this.getSaldo() + valor); System.out.println("Deposito realizado com sucesso!"); } public double getSaldo() { return saldo; } private void setSaldo(double saldo) { this.saldo = saldo; } public double getNumero() { return numero; } private void setNumero(double numero) { this.numero = numero; } public double getLimite() { return limite; } private void setLimite(double limite) { this.limite = limite; } public ArrayList<Titular> getTitular() { return titular; } public void setTitular(ArrayList<Titular> titular) { this.titular = titular; } @Override public String toString() { return "Conta{" + "saldo=" + saldo + ", numero=" + numero + ", limite=" + limite + ", titular=" + titular + '}'; } }
package com.laychv.module_open_projects.okHttp; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * OkHttp中线程池的使用 * * @see okhttp3.Dispatcher */ public class OkHttpThreadPool { public static void main(String[] args) { /** * 阿里巴巴 安卓开发手册 建议使用本方式 * * int corePoolSize,核心线程数 * int maximumPoolSize,线程池非核心线程数,线程池规定大小 * long keepAliveTime,设定时间 * TimeUnit unit,在时间范围内线程复用,超出时间范围,销毁Runnable任务 * BlockingQueue<Runnable> workQueue,把超出的任务加入到队列中缓存起来 */ Executor executor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, new LinkedBlockingDeque<>()); for (int i = 0; i < 20; i++) { executor.execute(() -> { try { Thread.sleep(1000); System.out.println("当前线程,执行耗时任务" + Thread.currentThread().getName()); } catch (InterruptedException e) { e.printStackTrace(); } }); } /** * 已经封装好的线程池 */ Executors.newCachedThreadPool(); Executors.newSingleThreadExecutor(); Executors.newFixedThreadPool(1); Executors.newScheduledThreadPool(1); } }
package com.ssgl.mapper; import com.ssgl.bean.RoomRank; import com.ssgl.bean.RoomRankExample; import org.apache.ibatis.annotations.Param; import java.util.List; public interface RoomRankMapper { int countByExample(RoomRankExample example); int deleteByExample(RoomRankExample example); int deleteByPrimaryKey(String id); int insert(RoomRank record); int insertSelective(RoomRank record); List<RoomRank> selectByExample(RoomRankExample example); RoomRank selectByPrimaryKey(String id); int updateByExampleSelective(@Param("record") RoomRank record, @Param("example") RoomRankExample example); int updateByExample(@Param("record") RoomRank record, @Param("example") RoomRankExample example); int updateByPrimaryKeySelective(RoomRank record); int updateByPrimaryKey(RoomRank record); }
package _start; import view.GameFrame; /** * @author Dillon Tuhy, Lamec Fletez, Laura Vonessen, Martin Stankard * */ public class Start { /** * @param args * * This main sets the Game Frame as visible */ public static void main(String[] args) { GameFrame NG = new GameFrame(); NG.pack(); NG.setVisible(true); NG.setResizable(false); } }
package com.avogine.junkyard.scene.render.load; import java.util.HashMap; import java.util.Map; import com.avogine.junkyard.scene.render.data.Font; public class FontCache { private static Map<String, Font> fonts = new HashMap<>(); public static Font getFont(String fontName) { if(fonts.containsKey(fontName)) { return fonts.get(fontName); } Font font = null; try { font = FontLoader.loadFont(fontName); } catch (Exception e) { e.printStackTrace(); } fonts.put(fontName, font); return font; } }
package com.info.proyectoFinal.models; import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonManagedReference; import com.info.proyectoFinal.controllers.UsuarioController; import javax.persistence.*; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; @Entity public class Usuario { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private String nombre; private String apellido; @Column(unique = true) private String email; private String password; private LocalDate creacion; private String ciudad; private String provincia; private String pais; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellido() { return apellido; } public void setApellido(String apellido) { this.apellido = apellido; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } /*public String getPassword() { return null; }*/ public void setPassword(String password) { this.password = password; } public LocalDate getCreacion() { return creacion; } public void setCreacion(LocalDate creacion) { this.creacion = creacion; } public String getCiudad() { return ciudad; } public void setCiudad(String ciudad) { this.ciudad = ciudad; } public String getProvincia() { return provincia; } public void setProvincia(String provincia) { this.provincia = provincia; } public String getPais() { return pais; } public void setPais(String pais) { this.pais = pais; } }
package lapechealaqueue.episode1; import lapechealaqueue.episode1.util.ScaleManager; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.drawable.AnimationDrawable; import android.media.MediaPlayer; import android.os.Bundle; import android.os.PowerManager; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.TranslateAnimation; import android.widget.ImageView; public class Home extends Activity implements OnClickListener { protected PowerManager.WakeLock mWakeLock; ImageView activites, episodes, about, exit, oui, non, renard1, texte1, texte2,renard2; View exit2, about2; View layout; AnimationDrawable frameAnimation; private TranslateAnimation trans2; private boolean scalingComplete = false; private MediaPlayer mp; @SuppressWarnings("deprecation") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home); final PowerManager power = (PowerManager) getSystemService(Context.POWER_SERVICE); this.mWakeLock = power.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); this.mWakeLock.acquire(); episodes = (ImageView) findViewById(R.id.btn_episode); activites = (ImageView) findViewById(R.id.btn_activite); exit = (ImageView) findViewById(R.id.exit); about = (ImageView) findViewById(R.id.btn_about); texte1 = (ImageView) findViewById(R.id.texte1); renard1 = (ImageView) findViewById(R.id.renard1); renard2 = (ImageView) findViewById(R.id.renard2); oui = (ImageView) findViewById(R.id.btn_oui); non = (ImageView) findViewById(R.id.btn_non); exit2 = (View) findViewById(R.id.exit_popup); episodes.setOnClickListener(this); activites.setOnClickListener(this); exit.setOnClickListener(this); oui.setOnClickListener(this); non.setOnClickListener(this); Animation scale = AnimationUtils.loadAnimation(this, R.anim.scale_bouttun_ep1); episodes.startAnimation(scale); activites.startAnimation(scale); Animation scale1 = AnimationUtils.loadAnimation(this, R.anim.scale_loup_ep1); renard2.startAnimation(scale1); Animation scale2 = AnimationUtils.loadAnimation(this, R.anim.rotate_renard_ep1); renard1.startAnimation(scale2); Animation fadein1 = AnimationUtils.loadAnimation(this, R.anim.mainfadein1_ep1); fadein1.setFillAfter(true); fadein1.setFillEnabled(true); texte1.startAnimation(fadein1); about.setBackgroundResource(R.drawable.anim_about); frameAnimation = (AnimationDrawable) about.getBackground(); frameAnimation.setCallback(about); frameAnimation.setOneShot(false); frameAnimation.setVisible(false, true); about.setBackgroundDrawable(frameAnimation); about.post(new Runnable() { public void run() { frameAnimation.start(); } }); // anim_bateau = new CustomAnim(AnimationUtils.loadAnimation(this, // R.anim.anim_sc7), true); // bateau.startAnimation(anim_bateau); mp = new MediaPlayer(); mp = MediaPlayer.create(this, R.raw.fond_sonore); mp.start(); mp.setLooping(true); } protected void onPause() { super.onPause(); if (mp != null) { mp.stop(); } finish(); } public void onDestroy() { this.mWakeLock.release(); super.onDestroy(); mp.release(); } protected void onRestart() { super.onRestart(); } @Override public void onWindowFocusChanged(boolean hasFocus) { if (!scalingComplete) { ScaleManager sm = new ScaleManager(); sm.scaleContents(findViewById(R.id.contents), findViewById(R.id.container)); scalingComplete = true; } super.onWindowFocusChanged(hasFocus); } @Override public void onClick(View v) { Intent i2 = null; switch (v.getId()) { case R.id.btn_episode: i2 = new Intent(getApplicationContext(), Episodes.class); startActivity(i2); finish(); break; case R.id.btn_activite: i2 = new Intent(getApplicationContext(), Activities.class); startActivity(i2); finish(); break; case R.id.exit: exit2.setVisibility(View.VISIBLE); break; case R.id.btn_oui: finish(); break; case R.id.btn_non: exit2.setVisibility(View.INVISIBLE); break; default: break; } } }
package de.madjosz.adventofcode.y2015; import static org.junit.jupiter.api.Assertions.assertEquals; import de.madjosz.adventofcode.AdventOfCodeUtil; import java.util.List; import org.junit.jupiter.api.Test; class Day16Test { @Test void day16() { List<String> lines = AdventOfCodeUtil.readLines(2015, 16); Day16 day16 = new Day16(lines); assertEquals(213, day16.a1()); assertEquals(323, day16.a2()); } @Test void day16_exampleinput() { List<String> lines = AdventOfCodeUtil.readLines(2015, 16, "test"); Day16 day16 = new Day16(lines); assertEquals(3, day16.a1()); assertEquals(2, day16.a2()); } }
/* * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import com.sun.net.httpserver.*; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; /** * Extremely simple server that only performs one task. The server listens for * requests on the ephemeral port. If it sees a request that begins with * "/multi-release.jar", it consumes the request and returns a stream of bytes * representing the jar file multi-release.jar found in "userdir". */ class SimpleHttpServer { private static final String userdir = System.getProperty("user.dir", "."); private static final Path multirelease = Paths.get(userdir, "multi-release.jar"); private final HttpServer server; private final InetAddress address; public SimpleHttpServer() throws IOException { this(null); } public SimpleHttpServer(InetAddress addr) throws IOException { address = addr; server = HttpServer.create(); } public void start() throws IOException { server.bind(new InetSocketAddress(address, 0), 0); server.createContext("/multi-release.jar", t -> { try (InputStream is = t.getRequestBody()) { is.readAllBytes(); // probably not necessary to consume request byte[] bytes = Files.readAllBytes(multirelease); t.sendResponseHeaders(200, bytes.length); try (OutputStream os = t.getResponseBody()) { os.write(bytes); } } }); server.setExecutor(null); // creates a default executor server.start(); } public void stop() { server.stop(0); } int getPort() { return server.getAddress().getPort(); } }
package com.tencent.mm.modelsimple; import com.tencent.mm.ab.j; import com.tencent.mm.protocal.k.d; import com.tencent.mm.protocal.k.e; import com.tencent.mm.protocal.v.a; final class b extends j { private final a eeT = new a(); private final com.tencent.mm.protocal.v.b eeU = new com.tencent.mm.protocal.v.b(); b() { } protected final d Ic() { return this.eeT; } public final e Id() { return this.eeU; } public final int getType() { return 26; } public final String getUri() { return "/cgi-bin/micromsg-bin/sendcard"; } }
package ExerDay30; import java.util.Scanner; public class CompareNum { public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); String[] data = new String[n]; if(n>=100){ throw new IllegalArgumentException(); } for(int i = 0;i < n;i++){ data[i] = notHasZero(in.nextLine()); } data = compareNum(data); for(String str:data){ System.out.println(str); } } //保证每个数字前缀无0 public static String notHasZero(String str){ if(str.charAt(0) == '0'){ str = String.copyValueOf(str.toCharArray(),1,str.length()-1); notHasZero(str); } return str; } //比较这些数字,结果存入数组中 public static String[] compareNum(String[] data){ for(int i = 0;i < data.length;i++){ for(int j = 0;j < data.length-i-1;j++){ //比较数字长短 if(data[j].length() > data[j+1].length()){ String tmp = data[j]; data[j] = data[j+1]; data[j+1] = tmp; } //长短相同的数字,再比较大小 if(data[j].length() == data[j+1].length()){ for(int k = 0;k < data[j].length();k++){ if(Integer.parseInt(data[j].substring(k,k+1)) > Integer.parseInt(data[j+1].substring(k,k+1))){ String tmp = data[j]; data[j] = data[j+1]; data[j+1] = tmp; } } } } } return data; } }
/* * Copyright(c) 2018 Hemajoo Ltd. * --------------------------------------------------------------------------- * This file is part of the Hemajoo's Foundation project which is licensed * under the Apache license version 2 and use is subject to license terms. * You should have received a copy of the license with the project's artifact * binaries and/or sources. * * License can be consulted at http://www.apache.org/licenses/LICENSE-2.0 * --------------------------------------------------------------------------- */ package com.hemajoo.foundation.common; /** * Marker interface for the {@code Hemajoo} entities. * <hr> * @author <a href="mailto:christophe.resse@gmail.com">Resse Christophe - Hemajoo</a> * @version 1.0.0 */ public interface IHemajoo { // Empty. }
/* * Copyright (c) 2016 Mobvoi Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ticwear.design.widget; import android.support.annotation.NonNull; /** * An interface for container has multiple picker. * * Created by tankery on 4/13/16. */ public interface MultiPickerContainer { interface MultiPickerClient { /** * Invoke before a number picker is focused. * * This method give the client a chance to handle the 'next focus' * event. If the client handled the event, multi-picker will not * response this focus request. * * @param numberPicker the number picker who about to be focus. * @param fromLast If this focus is changed from last picker. * @return true if the client wan't to handle the focus event. */ boolean onPickerPreFocus(NumberPicker numberPicker, boolean fromLast); /** * Notify the view has gain focus * * @param numberPicker the picker who gain focus */ void onPickerPostFocus(@NonNull NumberPicker numberPicker); } void setMultiPickerClient(MultiPickerClient client); }
package jp.noxi.collection; import java.util.List; public interface LinqList<T> extends Enumerable<T>, List<T> { }
/* * 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 view; /** * * @author Babi */ public class AdicionarClienteUi extends javax.swing.JDialog { /** * Creates new form AdicionarCliente */ public AdicionarClienteUi(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); tfBusca = new javax.swing.JTextField(); jpAdicionarCliente = new javax.swing.JPanel(); jbSalvar = new javax.swing.JPanel(); jlSalvar = new javax.swing.JLabel(); jbCancelar = new javax.swing.JPanel(); jLabel31 = new javax.swing.JLabel(); jpEmpresa = new javax.swing.JPanel(); tfCnpj = new javax.swing.JTextField(); tfRazaoSocial = new javax.swing.JTextField(); tfNomeFantasia = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jpEndereco = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jTextField5 = new javax.swing.JTextField(); jTextField6 = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); jpContato = new javax.swing.JPanel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); tfEmail = new javax.swing.JTextField(); tfTelefone = new javax.swing.JTextField(); tfCelular = new javax.swing.JTextField(); jLabel13 = new javax.swing.JLabel(); jPanel1.setBackground(new java.awt.Color(50, 104, 112)); jPanel1.setMaximumSize(new java.awt.Dimension(1069, 757)); jPanel1.setMinimumSize(new java.awt.Dimension(1069, 757)); jPanel1.setName(""); // NOI18N jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); tfBusca.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tfBuscaActionPerformed(evt); } }); jPanel1.add(tfBusca, new org.netbeans.lib.awtextra.AbsoluteConstraints(790, 40, 210, -1)); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jpAdicionarCliente.setBackground(new java.awt.Color(23, 35, 51)); jpAdicionarCliente.setMaximumSize(new java.awt.Dimension(1069, 757)); jpAdicionarCliente.setMinimumSize(new java.awt.Dimension(1069, 757)); jpAdicionarCliente.setName(""); // NOI18N jpAdicionarCliente.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jbSalvar.setBackground(new java.awt.Color(41, 57, 80)); jbSalvar.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jbSalvarMouseClicked(evt); } }); jlSalvar.setBackground(new java.awt.Color(0, 0, 0)); jlSalvar.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jlSalvar.setForeground(new java.awt.Color(255, 255, 255)); jlSalvar.setText("Salvar"); javax.swing.GroupLayout jbSalvarLayout = new javax.swing.GroupLayout(jbSalvar); jbSalvar.setLayout(jbSalvarLayout); jbSalvarLayout.setHorizontalGroup( jbSalvarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jbSalvarLayout.createSequentialGroup() .addContainerGap(56, Short.MAX_VALUE) .addComponent(jlSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(24, 24, 24)) ); jbSalvarLayout.setVerticalGroup( jbSalvarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jbSalvarLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jlSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jpAdicionarCliente.add(jbSalvar, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 400, 150, 50)); jbCancelar.setBackground(new java.awt.Color(23, 35, 51)); jbCancelar.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jbCancelarMouseClicked(evt); } }); jLabel31.setBackground(new java.awt.Color(0, 0, 0)); jLabel31.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel31.setForeground(new java.awt.Color(255, 255, 255)); jLabel31.setText("Cancelar"); javax.swing.GroupLayout jbCancelarLayout = new javax.swing.GroupLayout(jbCancelar); jbCancelar.setLayout(jbCancelarLayout); jbCancelarLayout.setHorizontalGroup( jbCancelarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jbCancelarLayout.createSequentialGroup() .addContainerGap(53, Short.MAX_VALUE) .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(24, 24, 24)) ); jbCancelarLayout.setVerticalGroup( jbCancelarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jbCancelarLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jpAdicionarCliente.add(jbCancelar, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 450, 150, 50)); jpEmpresa.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Empresa", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 14))); // NOI18N jLabel2.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel2.setText("Razão Social:"); jLabel3.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel3.setText("CNPJ:"); jLabel4.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel4.setText("Nome Fantasia:"); javax.swing.GroupLayout jpEmpresaLayout = new javax.swing.GroupLayout(jpEmpresa); jpEmpresa.setLayout(jpEmpresaLayout); jpEmpresaLayout.setHorizontalGroup( jpEmpresaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpEmpresaLayout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(jpEmpresaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jpEmpresaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jpEmpresaLayout.createSequentialGroup() .addComponent(tfCnpj, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(tfNomeFantasia, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(tfRazaoSocial)) .addGap(25, 25, 25)) ); jpEmpresaLayout.setVerticalGroup( jpEmpresaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jpEmpresaLayout.createSequentialGroup() .addGap(19, 19, 19) .addGroup(jpEmpresaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(tfRazaoSocial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jpEmpresaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(tfCnpj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(tfNomeFantasia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(20, Short.MAX_VALUE)) ); jpEndereco.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Endereço", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 14))); // NOI18N jLabel5.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel5.setText("Rua:"); jLabel6.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel6.setText("Cidade:"); jLabel7.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel7.setText("Bairro:"); jLabel8.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel8.setText("Número:"); javax.swing.GroupLayout jpEnderecoLayout = new javax.swing.GroupLayout(jpEndereco); jpEndereco.setLayout(jpEnderecoLayout); jpEnderecoLayout.setHorizontalGroup( jpEnderecoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpEnderecoLayout.createSequentialGroup() .addGap(53, 53, 53) .addGroup(jpEnderecoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel6) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jpEnderecoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jpEnderecoLayout.createSequentialGroup() .addComponent(jTextField4) .addGap(18, 18, 18) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jpEnderecoLayout.createSequentialGroup() .addComponent(jTextField6) .addGap(18, 18, 18) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(25, 25, 25)) ); jpEnderecoLayout.setVerticalGroup( jpEnderecoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jpEnderecoLayout.createSequentialGroup() .addGap(26, 26, 26) .addGroup(jpEnderecoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(jLabel8) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jpEnderecoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7) .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(20, Short.MAX_VALUE)) ); jpContato.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Contato", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 14))); // NOI18N jLabel9.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel9.setText("E-mail:"); jLabel10.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel10.setText("Telefone:"); jLabel11.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel11.setText("Celular:"); javax.swing.GroupLayout jpContatoLayout = new javax.swing.GroupLayout(jpContato); jpContato.setLayout(jpContatoLayout); jpContatoLayout.setHorizontalGroup( jpContatoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jpContatoLayout.createSequentialGroup() .addGroup(jpContatoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jpContatoLayout.createSequentialGroup() .addGap(55, 55, 55) .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(tfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 479, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpContatoLayout.createSequentialGroup() .addContainerGap() .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(tfTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(14, 14, 14) .addComponent(jLabel11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(tfCelular, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(17, Short.MAX_VALUE)) ); jpContatoLayout.setVerticalGroup( jpContatoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jpContatoLayout.createSequentialGroup() .addGap(23, 23, 23) .addGroup(jpContatoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9)) .addGap(20, 20, 20) .addGroup(jpContatoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tfTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(tfCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10) .addComponent(jLabel11)) .addContainerGap(20, Short.MAX_VALUE)) ); jLabel13.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N jLabel13.setText("Adicionar Cliente"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(18, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jpContato, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jpEndereco, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jpEmpresa, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addComponent(jpAdicionarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jpEmpresa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jpEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jpContato, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jpAdicionarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 541, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void tfBuscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfBuscaActionPerformed // TODO add your handling code here: }//GEN-LAST:event_tfBuscaActionPerformed private void jbSalvarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbSalvarMouseClicked // TODO add your handling code here: }//GEN-LAST:event_jbSalvarMouseClicked private void jbCancelarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbCancelarMouseClicked // TODO add your handling code here: }//GEN-LAST:event_jbCancelarMouseClicked /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(AdicionarClienteUi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(AdicionarClienteUi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(AdicionarClienteUi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(AdicionarClienteUi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { AdicionarClienteUi dialog = new AdicionarClienteUi(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel31; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JPanel jbCancelar; private javax.swing.JPanel jbSalvar; private javax.swing.JLabel jlSalvar; private javax.swing.JPanel jpAdicionarCliente; private javax.swing.JPanel jpContato; private javax.swing.JPanel jpEmpresa; private javax.swing.JPanel jpEndereco; private javax.swing.JTextField tfBusca; private javax.swing.JTextField tfCelular; private javax.swing.JTextField tfCnpj; private javax.swing.JTextField tfEmail; private javax.swing.JTextField tfNomeFantasia; private javax.swing.JTextField tfRazaoSocial; private javax.swing.JTextField tfTelefone; // End of variables declaration//GEN-END:variables }
import org.testng.Assert; import org.junit.jupiter.api.Test; class PermutationTest { @Test void check() { var result = Permutation.check("abcd", "dabc"); Assert.assertEquals(true, result); } @Test void checkUsingSort() { var result = Permutation.checkUsingSort("abcd", "dabc"); Assert.assertEquals(true, result); } @Test void checkUsingOptimalPermutation() { var result = Permutation.permutation("adba", "cabd"); Assert.assertEquals(false, result); } }
package commands; import com.github.motoki317.traq_bot.Responder; import com.github.motoki317.traq_bot.model.MessageCreatedEvent; import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.Map; import java.util.function.Supplier; import java.util.stream.Collectors; public class CommandAliases extends GenericCommand { private final Map<String, BotCommand> commandNameMap; private final Supplier<Integer> maxArgumentsLength; public CommandAliases(Map<String, BotCommand> commandNameMap, Supplier<Integer> maxArgumentsLength) { this.commandNameMap = commandNameMap; this.maxArgumentsLength = maxArgumentsLength; } @NotNull @Override protected String[][] names() { return new String[][]{{"alias", "aliases"}}; } @Override public @NotNull String syntax() { return "alias <command name>"; } @Override public @NotNull String shortHelp() { return "Shows all aliases of each bot command."; } @Override public @NotNull String longHelp() { return String.format("Alias Command Help\n" + "Syntax: %s\n" + "%s" + "Example: `alias music`, `alias help`", this.syntax(), this.shortHelp()); } @Override public void process(@NotNull MessageCreatedEvent event, @NotNull Responder res, @NotNull String[] args) { if (args.length <= 1) { respond(res, this.longHelp()); return; } // Supports nested command (e.g. ">alias guild levelRank") args = Arrays.copyOfRange(args, 1, args.length); for (int argLength = Math.min(this.maxArgumentsLength.get(), args.length); argLength > 0; argLength--) { String cmdBase = String.join(" ", Arrays.copyOfRange(args, 0, argLength)); if (this.commandNameMap.containsKey(cmdBase.toLowerCase())) { BotCommand cmd = this.commandNameMap.get(cmdBase.toLowerCase()); respond(res, formatMessage(cmd)); return; } } respond(res, "Command not found, try `help`."); } private static String formatMessage(BotCommand cmd) { return "This command has following aliases:\n" + cmd.getNames().stream().map(n -> "`" + n + "`").collect(Collectors.joining(", ")); } }
package com.rc.portal.vo; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.rc.app.framework.webapp.model.BaseModel; public class TGoodsPropertyExample extends BaseModel{ protected String orderByClause; protected List oredCriteria; public TGoodsPropertyExample() { oredCriteria = new ArrayList(); } protected TGoodsPropertyExample(TGoodsPropertyExample example) { this.orderByClause = example.orderByClause; this.oredCriteria = example.oredCriteria; } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public List getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); } public static class Criteria { protected List criteriaWithoutValue; protected List criteriaWithSingleValue; protected List criteriaWithListValue; protected List criteriaWithBetweenValue; protected Criteria() { super(); criteriaWithoutValue = new ArrayList(); criteriaWithSingleValue = new ArrayList(); criteriaWithListValue = new ArrayList(); criteriaWithBetweenValue = new ArrayList(); } public boolean isValid() { return criteriaWithoutValue.size() > 0 || criteriaWithSingleValue.size() > 0 || criteriaWithListValue.size() > 0 || criteriaWithBetweenValue.size() > 0; } public List getCriteriaWithoutValue() { return criteriaWithoutValue; } public List getCriteriaWithSingleValue() { return criteriaWithSingleValue; } public List getCriteriaWithListValue() { return criteriaWithListValue; } public List getCriteriaWithBetweenValue() { return criteriaWithBetweenValue; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteriaWithoutValue.add(condition); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } Map map = new HashMap(); map.put("condition", condition); map.put("value", value); criteriaWithSingleValue.add(map); } protected void addCriterion(String condition, List values, String property) { if (values == null || values.size() == 0) { throw new RuntimeException("Value list for " + property + " cannot be null or empty"); } Map map = new HashMap(); map.put("condition", condition); map.put("values", values); criteriaWithListValue.add(map); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } List list = new ArrayList(); list.add(value1); list.add(value2); Map map = new HashMap(); map.put("condition", condition); map.put("values", list); criteriaWithBetweenValue.add(map); } public Criteria andGoodsidIsNull() { addCriterion("goodsid is null"); return this; } public Criteria andGoodsidIsNotNull() { addCriterion("goodsid is not null"); return this; } public Criteria andGoodsidEqualTo(Long value) { addCriterion("goodsid =", value, "goodsid"); return this; } public Criteria andGoodsidNotEqualTo(Long value) { addCriterion("goodsid <>", value, "goodsid"); return this; } public Criteria andGoodsidGreaterThan(Long value) { addCriterion("goodsid >", value, "goodsid"); return this; } public Criteria andGoodsidGreaterThanOrEqualTo(Long value) { addCriterion("goodsid >=", value, "goodsid"); return this; } public Criteria andGoodsidLessThan(Long value) { addCriterion("goodsid <", value, "goodsid"); return this; } public Criteria andGoodsidLessThanOrEqualTo(Long value) { addCriterion("goodsid <=", value, "goodsid"); return this; } public Criteria andGoodsidIn(List values) { addCriterion("goodsid in", values, "goodsid"); return this; } public Criteria andGoodsidNotIn(List values) { addCriterion("goodsid not in", values, "goodsid"); return this; } public Criteria andGoodsidBetween(Long value1, Long value2) { addCriterion("goodsid between", value1, value2, "goodsid"); return this; } public Criteria andGoodsidNotBetween(Long value1, Long value2) { addCriterion("goodsid not between", value1, value2, "goodsid"); return this; } public Criteria andAttentionIsNull() { addCriterion("attention is null"); return this; } public Criteria andAttentionIsNotNull() { addCriterion("attention is not null"); return this; } public Criteria andAttentionEqualTo(Integer value) { addCriterion("attention =", value, "attention"); return this; } public Criteria andAttentionNotEqualTo(Integer value) { addCriterion("attention <>", value, "attention"); return this; } public Criteria andAttentionGreaterThan(Integer value) { addCriterion("attention >", value, "attention"); return this; } public Criteria andAttentionGreaterThanOrEqualTo(Integer value) { addCriterion("attention >=", value, "attention"); return this; } public Criteria andAttentionLessThan(Integer value) { addCriterion("attention <", value, "attention"); return this; } public Criteria andAttentionLessThanOrEqualTo(Integer value) { addCriterion("attention <=", value, "attention"); return this; } public Criteria andAttentionIn(List values) { addCriterion("attention in", values, "attention"); return this; } public Criteria andAttentionNotIn(List values) { addCriterion("attention not in", values, "attention"); return this; } public Criteria andAttentionBetween(Integer value1, Integer value2) { addCriterion("attention between", value1, value2, "attention"); return this; } public Criteria andAttentionNotBetween(Integer value1, Integer value2) { addCriterion("attention not between", value1, value2, "attention"); return this; } public Criteria andSalesIsNull() { addCriterion("sales is null"); return this; } public Criteria andSalesIsNotNull() { addCriterion("sales is not null"); return this; } public Criteria andSalesEqualTo(Integer value) { addCriterion("sales =", value, "sales"); return this; } public Criteria andSalesNotEqualTo(Integer value) { addCriterion("sales <>", value, "sales"); return this; } public Criteria andSalesGreaterThan(Integer value) { addCriterion("sales >", value, "sales"); return this; } public Criteria andSalesGreaterThanOrEqualTo(Integer value) { addCriterion("sales >=", value, "sales"); return this; } public Criteria andSalesLessThan(Integer value) { addCriterion("sales <", value, "sales"); return this; } public Criteria andSalesLessThanOrEqualTo(Integer value) { addCriterion("sales <=", value, "sales"); return this; } public Criteria andSalesIn(List values) { addCriterion("sales in", values, "sales"); return this; } public Criteria andSalesNotIn(List values) { addCriterion("sales not in", values, "sales"); return this; } public Criteria andSalesBetween(Integer value1, Integer value2) { addCriterion("sales between", value1, value2, "sales"); return this; } public Criteria andSalesNotBetween(Integer value1, Integer value2) { addCriterion("sales not between", value1, value2, "sales"); return this; } public Criteria andEvaluateIsNull() { addCriterion("evaluate is null"); return this; } public Criteria andEvaluateIsNotNull() { addCriterion("evaluate is not null"); return this; } public Criteria andEvaluateEqualTo(Integer value) { addCriterion("evaluate =", value, "evaluate"); return this; } public Criteria andEvaluateNotEqualTo(Integer value) { addCriterion("evaluate <>", value, "evaluate"); return this; } public Criteria andEvaluateGreaterThan(Integer value) { addCriterion("evaluate >", value, "evaluate"); return this; } public Criteria andEvaluateGreaterThanOrEqualTo(Integer value) { addCriterion("evaluate >=", value, "evaluate"); return this; } public Criteria andEvaluateLessThan(Integer value) { addCriterion("evaluate <", value, "evaluate"); return this; } public Criteria andEvaluateLessThanOrEqualTo(Integer value) { addCriterion("evaluate <=", value, "evaluate"); return this; } public Criteria andEvaluateIn(List values) { addCriterion("evaluate in", values, "evaluate"); return this; } public Criteria andEvaluateNotIn(List values) { addCriterion("evaluate not in", values, "evaluate"); return this; } public Criteria andEvaluateBetween(Integer value1, Integer value2) { addCriterion("evaluate between", value1, value2, "evaluate"); return this; } public Criteria andEvaluateNotBetween(Integer value1, Integer value2) { addCriterion("evaluate not between", value1, value2, "evaluate"); return this; } } }
package bnorm.draw; import java.awt.Graphics2D; import bnorm.virtual.IPoint; import bnorm.virtual.IVector; import bnorm.virtual.IVectorWave; import bnorm.virtual.IWave; public final class Draw { private Draw() { } public static void point(Graphics2D g, IPoint point, double radius) { g.fillOval((int) (point.getX() - radius), (int) (point.getY() - radius), (int) (2.0 * radius), (int) (2.0 * radius)); } public static void points(Graphics2D g, Iterable<? extends IPoint> points, double radius) { for (IPoint p : points) { point(g, p, radius); } } public static void box(Graphics2D g, IPoint point, double side) { g.drawRect((int) (point.getX() - side), (int) (point.getY() - side), (int) (2.0 * side), (int) (2.0 * side)); } public static void boxes(Graphics2D g, Iterable<? extends IPoint> points, double side) { for (IPoint p : points) { box(g, p, side); } } public static void vector(Graphics2D g, IVector vector) { double x = vector.getX(); double y = vector.getY(); g.drawLine((int) x, (int) y, (int) (x + vector.getDeltaX()), (int) (y + vector.getDeltaY())); } public static void vectors(Graphics2D g, Iterable<? extends IVector> vectors) { for (IVector v : vectors) { vector(g, v); } } public static void wave(Graphics2D g, IWave wave, long time) { int dist = (int) wave.dist(time); g.drawOval((int) (wave.getX() - dist), (int) (wave.getY() - dist), 2 * dist, 2 * dist); } public static void wave(Graphics2D g, IVectorWave wave, long time) { int dist = (int) wave.dist(time); long dt = time - wave.getTime(); int dx = (int) (wave.getDeltaX() * dt); int dy = (int) (wave.getDeltaY() * dt); g.drawOval((int) (wave.getX() - dist), (int) (wave.getY() - dist), 2 * dist, 2 * dist); g.drawLine((int) wave.getX(), (int) wave.getY(), dx, dy); } public static <W extends IWave> void waves(Graphics2D g, Iterable<W> waves, long time) { for (W w : waves) { wave(g, w, time); } } }
package com.cz.android.simplehttp.io.remote; import com.cz.android.simplehttp.io.Constants; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousChannelGroup; import java.nio.channels.AsynchronousServerSocketChannel; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; import java.util.Objects; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; final class FileReceiverAsync { private final AsynchronousServerSocketChannel server; private final AsynchronousChannelGroup group; private final String path; private final OnComplete onFileComplete; FileReceiverAsync(final int port, final int poolSize, final String path, final OnComplete onFileComplete) { assert !Objects.isNull(path); this.path = path; this.onFileComplete = onFileComplete; try { this.group = AsynchronousChannelGroup.withThreadPool(Executors.newFixedThreadPool(poolSize)); this.server = AsynchronousServerSocketChannel.open(this.group).bind(new InetSocketAddress(port)); } catch (IOException e) { throw new IllegalStateException("unable to start FileReceiver", e); } } void start() { accept(); } void stop(long wait) { try { this.group.shutdown(); this.group.awaitTermination(wait, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("unable to stop FileReceiver", e); } } private void read(final AsynchronousSocketChannel channel, final FileWriterProxy proxy) { assert !Objects.isNull(channel) && !Objects.isNull(proxy); final ByteBuffer buffer = ByteBuffer.allocate(Constants.BUFFER_SIZE); channel.read(buffer, proxy, new CompletionHandler<Integer, FileWriterProxy>() { @Override public void completed(final Integer result, final FileWriterProxy attachment) { if (result >= 0) { if (result > 0) { writeToFile(channel, buffer, attachment); } buffer.clear(); channel.read(buffer, attachment, this); } else if (result < 0 || attachment.done()) { onComplete(attachment); close(channel, attachment); } } @Override public void failed(final Throwable exc, final FileWriterProxy attachment) { throw new RuntimeException("unable to read data", exc); } }); } private void onComplete(final FileWriterProxy proxy) { assert !Objects.isNull(proxy); this.onFileComplete.onComplete(proxy); } private void meta(final AsynchronousSocketChannel channel) { assert !Objects.isNull(channel); final ByteBuffer buffer = ByteBuffer.allocate(Constants.BUFFER_SIZE); channel.read(buffer, new StringBuffer(), new CompletionHandler<Integer, StringBuffer>() { @Override public void completed(final Integer result, final StringBuffer attachment) { if (result < 0) { close(channel, null); } else { if (result > 0) { attachment.append(new String(buffer.array()).trim()); } if (attachment.toString().contains(Constants.END_MESSAGE_MARKER)) { final FileMetaData metaData = FileMetaData.from(attachment.toString()); FileWriterProxy fileWriterProxy; try { fileWriterProxy = new FileWriterProxy(FileReceiverAsync.this.path, metaData); confirm(channel, fileWriterProxy); } catch (IOException e) { close(channel, null); throw new RuntimeException("unable to create file writer proxy", e); } } else { buffer.clear(); channel.read(buffer, attachment, this); } } } @Override public void failed(final Throwable exc, final StringBuffer attachment) { close(channel, null); throw new RuntimeException("unable to read meta data", exc); } }); } private void confirm(final AsynchronousSocketChannel channel, final FileWriterProxy proxy) { assert !Objects.isNull(channel) && !Objects.isNull(proxy); final ByteBuffer buffer = ByteBuffer.wrap(Constants.CONFIRMATION.getBytes()); channel.write(buffer, null, new CompletionHandler<Integer, Void>() { @Override public void completed(final Integer result, final Void attachment) { while (buffer.hasRemaining()) { channel.write(buffer, null, this); } read(channel, proxy); } @Override public void failed(final Throwable exc, final Void attachment) { close(channel, null); throw new RuntimeException("unable to confirm", exc); } }); } private void accept() { this.server.accept(null, new CompletionHandler<AsynchronousSocketChannel, Void>() { public void completed(final AsynchronousSocketChannel channel, final Void attachment) { // Delegate off to another thread for the next connection. accept(); // Delegate off to another thread to handle this connection. meta(channel); } public void failed(final Throwable exc, final Void attachment) { throw new RuntimeException("unable to accept new connection", exc); } }); } private void writeToFile(final AsynchronousSocketChannel channel, final ByteBuffer buffer, final FileWriterProxy proxy) { assert !Objects.isNull(buffer) && !Objects.isNull(proxy) && !Objects.isNull(channel); try { buffer.flip(); final long bytesWritten = proxy.getFileWriter().write(buffer, proxy.getPosition().get()); proxy.getPosition().addAndGet(bytesWritten); } catch (IOException e) { close(channel, proxy); throw new RuntimeException("unable to write bytes to file", e); } } private void close(final AsynchronousSocketChannel channel, final FileWriterProxy proxy) { assert !Objects.isNull(channel); try { if (!Objects.isNull(proxy)) { proxy.getFileWriter().close(); } channel.close(); } catch (IOException e) { throw new RuntimeException("unable to close channel and FileWriter", e); } } }
package com.freejavaman; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; //磁場測試 public class MyCompass extends Activity implements SensorEventListener { private SensorManager sMgr; //儲存加速感測器,所取得的資料 private float[] aValues = null; //儲存磁場感測器,所取得的資料 private float[] mValues = null; //設定取得磁場感測器 private int sensorType = Sensor.TYPE_ALL; private CompassView compassView; private float degree; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); compassView = new CompassView(this); setContentView(compassView); //取得感測器管理元件 sMgr = (SensorManager)this.getSystemService(Context.SENSOR_SERVICE); } //Activity恢復時執行 protected void onResume() { super.onResume(); //取得加速度感測器 Sensor accelerometer_sensor = sMgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); //取得磁場感測器 Sensor magnetic_sensor = sMgr.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); //進行資料取得註冊 if (accelerometer_sensor != null && magnetic_sensor != null){ sMgr.registerListener(this, accelerometer_sensor, SensorManager.SENSOR_DELAY_UI); sMgr.registerListener(this, magnetic_sensor, SensorManager.SENSOR_DELAY_UI); } else { Log.v("sensor", "no suitable sensor"); } } //Activity停止時執行 protected void onPause() { super.onPause(); sMgr.unregisterListener(this); } //實作SensorEventListener, 所必須提供的函數 public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { //取得加速度感測器的資料 aValues = (float[]) event.values.clone(); } else if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { //取得磁場感測器的資料 mValues = (float[]) event.values.clone(); } else { Log.v("sensor", "call back, but not register:" + event.sensor.getType()); } checkOrientation(); } //進行方位的判斷 private void checkOrientation() { if (aValues != null && mValues != null) { float[] R = new float[9]; float[] values = new float[3]; //進行陣列旋轉 SensorManager.getRotationMatrix(R, null, aValues, mValues); //取得方位資訊 SensorManager.getOrientation(R, values); degree = (float)Math.toDegrees(values[0]); if (compassView != null) compassView.invalidate(); } } //實作SensorEventListener, 所必須提供的函數 public void onAccuracyChanged(Sensor sensor, int arg1) { } //畫出指北針的View private class CompassView extends View { private Paint mPaint = new Paint(); private Path mPath = new Path(); private boolean mAnimate; private long mNextTime; public CompassView(Context context) { super(context); //繪製箭頭 mPath.moveTo(0, -50); mPath.lineTo(-20, 60); mPath.lineTo(0, 50); mPath.lineTo(20, 60); mPath.close(); } protected void onDraw(Canvas canvas) { Paint paint = mPaint; canvas.drawColor(Color.WHITE); paint.setAntiAlias(true); paint.setColor(Color.BLACK); paint.setStyle(Paint.Style.FILL); int w = canvas.getWidth(); int h = canvas.getHeight(); int cx = w / 2; int cy = h / 2; //根據傳入的角度,修正與旋轉箭頭 canvas.translate(cx, cy); canvas.rotate(-degree); canvas.drawPath(mPath, mPaint); } protected void onAttachedToWindow() { mAnimate = true; super.onAttachedToWindow(); } protected void onDetachedFromWindow() { mAnimate = false; super.onDetachedFromWindow(); } } }
package com.weaver.wevaer; /** * @author zuoshao * @date 2019/7/20 - 23:00 */ public class heihei { public void hello(){ System.out.println("helloword"); } }
package com.meridal.examples.springbootmysql.elasticsearch.domain; import java.io.Serializable; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Document; @Document(indexName = "sandbox") public class Recording implements Serializable { private static final long serialVersionUID = 1L; @Id private String id; private String title; private String artist; private String year; private String format; public String getId() { return this.id; } public String getTitle() { return this.title; } public String getArtist() { return this.artist; } public String getYear() { return this.year; } public String getFormat() { return this.format; } public void setId(String id) { this.id = id; } public void setTitle(String title) { this.title = title; } public void setArtist(String artist) { this.artist = artist; } public void setYear(String year) { this.year = year; } public void setFormat(String format) { this.format = format; } @Override public boolean equals(Object o) { return EqualsBuilder.reflectionEquals(this, o); } @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); } }
package com.tencent.mm.plugin.setting.ui.qrcode; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import com.tencent.mm.plugin.account.ui.FacebookAuthUI; class ShareToQQUI$6 implements OnClickListener { final /* synthetic */ ShareToQQUI mPF; ShareToQQUI$6(ShareToQQUI shareToQQUI) { this.mPF = shareToQQUI; } public final void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(this.mPF.mController.tml, FacebookAuthUI.class); intent.putExtra("is_force_unbind", true); this.mPF.mController.tml.startActivityForResult(intent, 8); } }
package auxiliares; public class Contexto { public static String USUARIO; }
/* (c) Julian Vera & Nathan S. Andersen * CS 136 Spring 2015 * Lab Section 12 - 2 * Lab 4 * */ import java.util.Comparator; /* * This StudentLNComparator class provides a way to compare * the last names of two Students. Comparators are an * essential part of the sorting method found in the MyVector * class. */ public class StudentLNComparator implements Comparator<Student> { public int compare(Student a, Student b) { return (a.getLastName().compareTo(b.getLastName())); } }
package minstack; public class MinMaxStackClient { public static void main(String[] args) { MinMaxStack minStack= new MinMaxStack("MAN"); // minStack.push(5); minStack.push(9); minStack.push(1); minStack.push(4); System.out.println(minStack.getMin()); minStack.pop(); minStack.pop(); System.out.println(minStack.getMin()); } }
/* * LumaQQ - Java QQ Client * * Copyright (C) 2004 luma <stubma@163.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package edu.tsinghua.lumaqq.ui.wizard.search; import static edu.tsinghua.lumaqq.resource.Messages.*; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.graphics.Image; import edu.tsinghua.lumaqq.qq.beans.AdvancedUserInfo; import edu.tsinghua.lumaqq.qq.beans.ClusterInfo; import edu.tsinghua.lumaqq.qq.beans.UserInfo; import edu.tsinghua.lumaqq.resource.Resources; import edu.tsinghua.lumaqq.ui.helper.BeanHelper; /** * 搜索结构的label provider * * @author luma */ public class SearchResultLabelProvider extends LabelProvider implements ITableLabelProvider { /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) */ public Image getColumnImage(Object element, int columnIndex) { if(element instanceof UserInfo) { UserInfo user = (UserInfo)element; if(columnIndex == 0) return Resources.getInstance().getSmallHead(user.face); else return null; } else if(element instanceof AdvancedUserInfo) { AdvancedUserInfo user = (AdvancedUserInfo)element; if(columnIndex == 0) return Resources.getInstance().getSmallHead(user.face); else return null; } else if(element instanceof ClusterInfo) { if(columnIndex == 0) return Resources.getInstance().getSmallClusterHead(4); else return null; } else return null; } /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) */ public String getColumnText(Object element, int columnIndex) { if(element instanceof UserInfo) { UserInfo user = (UserInfo)element; switch(columnIndex) { case 0: return String.valueOf(user.qqNum); case 1: return user.nick; case 4: return user.province; default: return ""; } } else if(element instanceof AdvancedUserInfo) { AdvancedUserInfo user = (AdvancedUserInfo)element; switch(columnIndex) { case 0: return String.valueOf(user.qqNum); case 1: return user.nick; case 2: return BeanHelper.getGender(user.genderIndex); case 3: return String.valueOf(user.age); case 4: return BeanHelper.getProvince(user.provinceIndex) + ' ' + BeanHelper.getCity(user.provinceIndex, user.cityIndex); case 5: return user.online ? status_online : status_offline; default: return ""; } } else if(element instanceof ClusterInfo) { ClusterInfo cluster = (ClusterInfo)element; switch(columnIndex) { case 0: return String.valueOf(cluster.externalId); case 1: return cluster.name; case 2: return String.valueOf(cluster.creator); default: return ""; } } else return ""; } }
package com.ibeiliao.pay.idgen.api.dto; import com.ibeiliao.pay.api.ApiCode; import com.ibeiliao.pay.api.ApiResultBase; import java.util.List; /** * 返回一个ID数组 * @author linyi 2016/7/11. */ public class IdArray extends ApiResultBase { private static final long serialVersionUID = 1; public IdArray() {} public IdArray(int code, String message) { super(code, message); } public IdArray(List<Long> idArray) { super(ApiCode.SUCCESS, ""); this.idArray = idArray; } /** * 返回的ID数组,不会为null */ private List<Long> idArray; public List<Long> getIdArray() { return idArray; } public void setIdArray(List<Long> idArray) { this.idArray = idArray; } }
import java.util.ArrayList; public class SListT { public void traverse(SkipList skipList) { for(int i=0; i < skipList.getSize(); i++) { System.out.println(skipList.getNode(i)); } } }
package hirondelle.web4j.database; import hirondelle.web4j.util.Util; import static hirondelle.web4j.util.Consts.NEW_LINE; /** Dynamic SQL statement created in code. The SQL statement can be either: <ul> <li>a complete statement <li>a fragment of a statement, to be appended to the end of a static base statement </ul> <P>This class is intended for two use cases: <ul> <li>creating a statement entirely in code <li>creating <tt>WHERE</tt> and <tt>ORDER BY</tt> clauses dynamically, by building sort and filter criteria from user input </ul> <P><b>The creation of SQL in code is dangerous. You have to exercise care that your code will not be subject to <a href='http://en.wikipedia.org/wiki/SQL_injection'>SQL Injection attacks</a>. If you don't know what such attacks are all about, then you are in danger of creating very large, dangerous security flaws in your application.</b> <P>The main means of protecting yourself from these attacks is to ensure that the sql strings you pass to this class never contain data that has come directly from the user, in an unescaped form. You achieve this by <tt>parameterizing</tt> user input, and proceeding in 2 steps: <ol> <li>create an SQL statement that always uses a <tt>?</tt> placeholder for data entered by the user <li>pass all user-entered data as parameters to the above statement </ol> The above corresponds to the correct use of a <tt>PreparedStatement</tt>. After you have built your dynamic SQL, you will usually pass it to {@link hirondelle.web4j.database.Db#search(Class, SqlId, DynamicSql, Object[])} to retrieve the data. <h3>Entries in .sql Files</h3> <P>The SQL string you pass to this class is always <em>appended</em> (using {@link #toString}) to a (possibly-empty) base SQL statement already defined (as usual), in your <tt>.sql</tt> file. That entry can take several forms. The criteria on the entry are: <ul> <li>it can be precompiled by WEB4J upon startup, if desired. <li>it contains only <i>static</i> elements of the final SQL statement </ul> <em>It's important to note that the static base SQL can be completely empty.</em> For example, the entry in your <tt>.sql file</tt> can look something like this: <pre>MY_DYNAMIC_REPORT { -- this sql is generated in code }</pre> As you can see, there's only a comment here; there's no real SQL. In this case, you will need to build the entire SQL statement in code. (Even though the above entry is empty, it's still necessary, since it's where you specify any non-default target database name. It also ensures that the same mechanism web4j applies to processing <tt>SqlId</tt> objects will remain in effect, which is useful.) <P>You are encouraged to implement joins between tables using the <tt>JOIN</tt> syntax. The alternative is to implement joins using expressions in the <tt>WHERE</tt> clause. This usually isn't desirable, since it mixes up two distinct items - joins and actual criteria. Using <tt>JOIN</tt> allows these items to remain separate and distinct. <h3>See Also</h3> Other items closely related to this class are : <ul> <li> {@link hirondelle.web4j.action.ActionImpl#getOrderBy(hirondelle.web4j.request.RequestParameter,hirondelle.web4j.request.RequestParameter, String)} - convenience method for constructing an <tt>ORDER BY</tt> clause from request parameters. <li> {@link hirondelle.web4j.database.Db#search(Class, SqlId, DynamicSql, Object[])} <li> the {@link hirondelle.web4j.database.Report} class. </ul> <h3>Constants</h3> The {@link #WHERE}, {@link #AND}, and other constants are included in this class as a simple convenience. Note that each value includes a leading a trailing space, to avoid trivial spacing errors. <P>This class is non-final, and can be overridden, if desired. The reason is that some applications may wish to try to validate that the SQL passed to this class has been properly parameterized. */ public class DynamicSql {; /** Value - {@value}, convenience value for building a <tt>WHERE</tt> clause.*/ public static final String WHERE = " WHERE "; /** Value - {@value}, convenience value for building a <tt>WHERE</tt> clause. */ public static final String AND = " AND "; /** Value - {@value}, convenience value for building a <tt>WHERE</tt> clause. */ public static final String OR = " OR "; /** Value - {@value}, convenience value for building an <tt>ORDER BY</tt> clause. */ public static final String ORDER_BY = " ORDER BY "; /** Value - {@value}, convenience value for building an <tt>ORDER BY</tt> clause. */ public static final String ASC = " ASC "; /** Value - {@value}, convenience value for building an <tt>ORDER BY</tt> clause. */ public static final String DESC = " DESC "; /** Represents the absence of any criteria. The value of this item is simply <tt>null</tt>. <P>If a method allows a <tt>null</tt> object to indicate the absence of any criteria, then it is recommended that this reference be used instead of <tt>null</tt>. */ public static final DynamicSql NONE = null; /** Constructor. <P>This constructor will slightly modify the given parameter: it will trim it, and prepend a new line to the result. @param aSql must have content; it will be trimmed by this method. */ public DynamicSql(String aSql){ if( ! Util.textHasContent(aSql) ){ throw new IllegalArgumentException("The SQL text has no content."); } fSql = NEW_LINE + aSql.trim(); } /** Convenience constructor, forwards to {@link #DynamicSql(String)}. */ public DynamicSql(StringBuilder aSql){ this(aSql.toString()); } /** Return the String passed to the constructor, trimmed. <P>The returned value is appended by the framework to an existing (possibly empty) entry in an <tt>.sql</tt> file. */ @Override final public String toString(){ return fSql; } // PRIVATE private String fSql = ""; }
package enthu_l; public class e_904 { public int base; public int height; private static double ANGLE; public static double getAngle(); public static void Main(String[] args) { System.out.println(getAngle()); } }
package net.manager; import net.interfaces.OnMessageChangedListener; import net.interfaces.OnMsgActionListener; import net.manager.MessageInfo; /** * Created by taro on 16/3/4. 消息管理操作 */ public interface IMessageMgrAction { /** * 获取指定设备的消息信息 * * @param deviceToken * @return */ public MessageInfo getMsgInfoByDevice(String deviceToken); /** * 添加消息到指定设备消息缓存中(区分客户端消息和服务端消息) * * @param deviceToken * 设备标识 * @param msg * 消息内容 * @param from * 消息来源对象:{@link MessageInfo#MSG_FOR_SEND}客户端/ * {@link MessageInfo#MSG_FOR_RECEIVE}服务端 */ public void appendMsg(String deviceToken, String msg, int from); /** * 清除指定设备的消息 * * @param deviceToken * 设备标识 * @param from * 消息来源对象:{@link MessageInfo#MSG_FOR_SEND}客户端/ * {@link MessageInfo#MSG_FOR_RECEIVE}服务端 */ public void clearMsg(String deviceToken, int from); /** * 清除所有设备的消息 */ public void clearMsgAllDevice(int from); /** * 保存所有设备的消息 */ public void saveMsgAllDevice(int from); /** * 保存所有的消息 * * @param deviceToken * 设备标识 * @param isClearAfterSave * 是否在保存后清除,true为清除,false不清除缓存 * @param from * 消息来源对象:{@link MessageInfo#MSG_FOR_SEND}客户端/ * {@link MessageInfo#MSG_FOR_RECEIVE}服务端 */ public void saveAllMsg(String deviceToken, boolean isClearAfterSave, int from); /** * 设置消息更新接口 * * @param listener */ public void setOnMessageChangedListener(OnMessageChangedListener listener); /** * 获取消息更新接口,消息新增/清除所有/清除部分缓存/是否保存都会通过此接口回调 * * @return */ public OnMessageChangedListener getOnMessageChangedListener(); /** * 获取消息接收处理监听,此监听接口用于处理接收到的所有数据 * * @return */ public OnMsgActionListener getOnMsgActionListener(); }
package com.smxknife.energy.collector.sink.kafka; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** * @author smxknife * 2021/5/14 */ @Data @Component @ConfigurationProperties("sink.kafka") public class KafkaSinkProperties { private String topic; private String bootstrapServers; }
package com.sporsimdi.action.facadeBean; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import com.sporsimdi.action.facade.GrupFacade; import com.sporsimdi.model.entity.Grup; import com.sporsimdi.model.type.Status; @Stateless public class GrupFacadeBean implements GrupFacade { @PersistenceContext(unitName = "sporsimdi") EntityManager entityManager; public GrupFacadeBean() { } public void persist(Grup grup) { entityManager.persist(grup); } public void merge(Grup grup) { entityManager.merge(grup); } public void remove(Grup grup) { entityManager.remove(grup); } public void delete(Grup grup) { grup.setStatus(Status.PASSIVE); entityManager.merge(grup); } @Override public Grup findById(long id) { return entityManager.find(Grup.class, id); } @SuppressWarnings("unchecked") @Override public List<Grup> listAll() { Query q = entityManager.createQuery("select g from Grup g"); return q.getResultList(); } @SuppressWarnings("unchecked") @Override public List<Grup> listByOrgTesis(Long orgTesisId) { Query q = entityManager.createQuery("select g from Grup g " + "where g.orgTesis.id = :id") .setParameter("id", orgTesisId); List<Grup> grupListesi = q.getResultList(); return grupListesi; } }
package com.codependent.mutualauth.config; import com.codependent.mutualauth.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken; import org.springframework.stereotype.Component; /** * Created by e076103 on 21-08-2018. */ @Component public class CustomAuthProvider implements AuthenticationProvider { @Autowired CustomAuthenticationUserDetailsService preAuthenticatedUserDetailsService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { //if(true) //throw new BadCredentialsException("No pre-authenticated principal found in request."); UserDetails ud = this.preAuthenticatedUserDetailsService.loadUserDetails(authentication); PreAuthenticatedAuthenticationToken result = new PreAuthenticatedAuthenticationToken(ud, authentication.getCredentials(), ud.getAuthorities()); result.setDetails(authentication.getDetails()); return result; } @Override public boolean supports(Class<?> aClass) { return true; } }
/* * [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 com.hybris.backoffice.cockpitng.search.builder.impl; import static org.fest.assertions.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import de.hybris.platform.core.GenericCondition; import de.hybris.platform.core.GenericConditionList; import de.hybris.platform.core.GenericValueCondition; import de.hybris.platform.core.Operator; import de.hybris.platform.core.model.type.AttributeDescriptorModel; import de.hybris.platform.servicelayer.model.ModelService; import de.hybris.platform.servicelayer.type.impl.DefaultTypeService; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Set; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.time.DateUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.runners.MockitoJUnitRunner; import com.google.common.collect.Sets; import com.hybris.cockpitng.search.data.SearchAttributeDescriptor; import com.hybris.cockpitng.search.data.SearchQueryData; import com.hybris.cockpitng.search.data.ValueComparisonOperator; @RunWith(MockitoJUnitRunner.class) public class GenericConditionQueryBuilderTest { private static final String TYPE_CODE = "Product"; public static final String DATE_TYPE_ATTRIBUTE = "dateAttribute"; private final Set<Character> queryBuilderSeparators = Sets.newHashSet(ArrayUtils.toObject(new char[] { ' ', ',', ';', '\t', '\n', '\r' })); @Mock private DefaultTypeService typeService; @Mock private ModelService modelService; @InjectMocks private GenericConditionQueryBuilder queryBuilder; @Before public void prepare() { MockitoAnnotations.initMocks(this); queryBuilder.setSeparators(queryBuilderSeparators); } @Test public void testSearchForDateWithEquals() { SearchAttributeDescriptor attributeDescriptor = mock(SearchAttributeDescriptor.class); when(attributeDescriptor.getAttributeName()).thenReturn(DATE_TYPE_ATTRIBUTE); SearchQueryData searchQueryData = mock(SearchQueryData.class); when(searchQueryData.getSearchType()).thenReturn(TYPE_CODE); when(typeService.getAttributeDescriptor(TYPE_CODE, DATE_TYPE_ATTRIBUTE)).thenReturn(mock(AttributeDescriptorModel.class)); final Date now = new Date(); final Date midnightOfToday = DateUtils.truncate(now, Calendar.DAY_OF_MONTH); final Date midnightOfTomorrow = DateUtils.addDays(midnightOfToday, 1); final GenericCondition condition = queryBuilder.createSingleTokenCondition(searchQueryData, attributeDescriptor, now, ValueComparisonOperator.EQUALS); assertThat(condition instanceof GenericConditionList).isTrue(); GenericConditionList conditionList = (GenericConditionList)condition; assertThat(conditionList.getConditionList()).hasSize(2); assertThat(conditionList.getOperator()).isEqualTo(Operator.AND); assertThat(conditionList.getConditionList().get(0).getOperator()).isEqualTo(Operator.GREATER_OR_EQUAL); assertThat(((GenericValueCondition)conditionList.getConditionList().get(0)).getValue()).isEqualTo(midnightOfToday); assertThat(conditionList.getConditionList().get(1).getOperator()).isEqualTo(Operator.LESS); assertThat(((GenericValueCondition)conditionList.getConditionList().get(1)).getValue()).isEqualTo(midnightOfTomorrow); } @Test public void testSearchForExactDateWithEquals() { SearchAttributeDescriptor attributeDescriptor = mock(SearchAttributeDescriptor.class); when(attributeDescriptor.getAttributeName()).thenReturn(DATE_TYPE_ATTRIBUTE); final HashMap<String, String> editorParameters = new HashMap<>(); editorParameters.put(GenericConditionQueryBuilder.EDITOR_PARAM_EQUALS_COMPARES_EXACT_DATE, "true"); when(attributeDescriptor.getEditorParameters()).thenReturn(editorParameters); SearchQueryData searchQueryData = mock(SearchQueryData.class); when(searchQueryData.getSearchType()).thenReturn(TYPE_CODE); when(typeService.getAttributeDescriptor(TYPE_CODE, DATE_TYPE_ATTRIBUTE)).thenReturn(mock(AttributeDescriptorModel.class)); final Date now = new Date(); final GenericCondition condition = queryBuilder.createSingleTokenCondition(searchQueryData, attributeDescriptor, now, ValueComparisonOperator.EQUALS); assertThat(condition instanceof GenericValueCondition).isTrue(); GenericValueCondition valueCondition = (GenericValueCondition) condition; assertThat(valueCondition.getOperator()).isEqualTo(Operator.EQUAL); assertThat(valueCondition.getValue()).isEqualTo(now); } }
/** * 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.hadoop.raid; import java.io.IOException; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.Daemon; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.raid.protocol.PolicyInfo; /** * Implementation of {@link RaidNode} that uses map reduce jobs to raid files. */ public class DistRaidNode extends RaidNode { public static final Log LOG = LogFactory.getLog(DistRaidNode.class); /** Daemon thread to monitor raid job progress */ JobMonitor jobMonitor = null; Daemon jobMonitorThread = null; public DistRaidNode(Configuration conf) throws IOException { super(conf); this.jobMonitor = new JobMonitor(conf); this.jobMonitorThread = new Daemon(this.jobMonitor); this.jobMonitorThread.start(); } /** * {@inheritDocs} */ @Override public void join() { super.join(); try { if (jobMonitorThread != null) jobMonitorThread.join(); } catch (InterruptedException ie) { // do nothing } } /** * {@inheritDocs} */ @Override public void stop() { if (stopRequested) { return; } super.stop(); if (jobMonitor != null) jobMonitor.running = false; if (jobMonitorThread != null) jobMonitorThread.interrupt(); } /** * {@inheritDocs} */ @Override void raidFiles(PolicyInfo info, List<FileStatus> paths) throws IOException { // We already checked that no job for this policy is running // So we can start a new job. DistRaid dr = new DistRaid(conf); //add paths for distributed raiding dr.addRaidPaths(info, paths); boolean started = dr.startDistRaid(); if (started) { jobMonitor.monitorJob(info.getName(), dr); } } /** * {@inheritDocs} */ @Override int getRunningJobsForPolicy(String policyName) { return jobMonitor.runningJobsCount(policyName); } }
package ch.fhnw.edu.cpib.cst.interfaces; import ch.fhnw.edu.cpib.scanner.enumerations.Changemodes; public interface IChangeModeNTS extends IProduction { public Changemodes toAbsSyntax(); }
package com.santander.bi.dtos; import java.sql.Timestamp; import java.util.Set; public class ModuloDTO { private String idModulo; private String codigoModulo; private String modulo; private String descripcion; //CAMPOS SEGUIMIENTO private String habilitado="H"; private Timestamp fechaCreacion; private String usuarioCreador; private Timestamp fechaModificacion; private String usuarioModifica; private Set<PrivilegioModuloDTO> privilegiosModulo; public String getIdModulo() { return idModulo; } public void setIdModulo(String idModulo) { this.idModulo = idModulo; } public String getCodigoModulo() { return codigoModulo; } public void setCodigoModulo(String codigoModulo) { this.codigoModulo = codigoModulo; } public String getModulo() { return modulo; } public void setModulo(String modulo) { this.modulo = modulo; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getHabilitado() { return habilitado; } public void setHabilitado(String habilitado) { this.habilitado = habilitado; } public Timestamp getFechaCreacion() { return fechaCreacion; } public void setFechaCreacion(Timestamp fechaCreacion) { this.fechaCreacion = fechaCreacion; } public String getUsuarioCreador() { return usuarioCreador; } public void setUsuarioCreador(String usuarioCreador) { this.usuarioCreador = usuarioCreador; } public Timestamp getFechaModificacion() { return fechaModificacion; } public void setFechaModificacion(Timestamp fechaModificacion) { this.fechaModificacion = fechaModificacion; } public String getUsuarioModifica() { return usuarioModifica; } public void setUsuarioModifica(String usuarioModifica) { this.usuarioModifica = usuarioModifica; } public Set<PrivilegioModuloDTO> getPrivilegiosModulo() { return privilegiosModulo; } public void setPrivilegiosModulo(Set<PrivilegioModuloDTO> privilegiosModulo) { this.privilegiosModulo = privilegiosModulo; } }
package com.darkania.darkers.comandos; import java.util.List; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftHorse; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import net.minecraft.server.v1_11_R1.EntityHorse; public class Relinchar implements CommandExecutor{ public boolean onCommand(CommandSender sender, Command cmd, String labbel, String[] args) { if(cmd.getName().equalsIgnoreCase("relinchar") && sender instanceof Player){ Player p = (Player)sender; List<Entity> ent = p.getNearbyEntities(10, 10, 10); for(Entity ent2:ent){ if(ent2.getType().equals(EntityType.HORSE) && ent2.getCustomName().equals("CPrueba")){ EntityHorse CB = ((CraftHorse)ent2).getHandle(); CB.setStanding(true); p.sendMessage("Tu ip es: "+p.getAddress().getHostName()); } } } return false; } }
/** * 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.hadoop.mapred; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import java.io.FileReader; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.Closeable; /** * Implements persistent storage for queue budget and spending * information in a file. */ public class FileAllocationStore extends AllocationStore { private static final Log LOG = LogFactory.getLog(FileAllocationStore.class); private String fileName = ""; private boolean loaded = false; /** {@inheritDoc} */ public void init(Configuration conf) { fileName = conf.get(PrioritySchedulerOptions.DYNAMIC_SCHEDULER_BUDGET_FILE, "/etc/hadoop.budget"); } /** {@inheritDoc} */ public void save() { PrintWriter out = null; try { out = new PrintWriter(new BufferedWriter(new FileWriter(fileName))); for (BudgetQueue queue: getQueues()) { out.printf("%s %.20f %.20f\n", queue.name, queue.budget, queue.spending); } } catch (Exception e) { LOG.error("Error writing to file: " + fileName, e); } finally { close(out); } } private void close(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (Exception ce) { LOG.error("Error closing file: " + fileName, ce); } } } /** {@inheritDoc} */ public void load() { if (loaded) { return; } BufferedReader in = null; try { in = new BufferedReader(new FileReader(fileName)); String line = in.readLine(); while (line != null) { String[] nameValue = line.split(" "); if (nameValue.length != 3) { continue; } queueCache.put(nameValue[0], new BudgetQueue(nameValue[0], Float.parseFloat(nameValue[1]), Float.parseFloat(nameValue[2]))); line = in.readLine(); } loaded = true; } catch (Exception e) { LOG.error("Error reading file: " + fileName, e); } finally { close(in); } } }
package com.supinfo.SupTrip.entity; import javax.persistence.*; /** * Created by Boufle on 21/03/2016. */ @Entity @Table(name = "campus", schema = "suptrip", catalog = "") public class CampusEntity { private String campusName; private String description; private int campusId; @Basic @Column(name = "CampusName") public String getCampusName() { return campusName; } public void setCampusName(String campusName) { this.campusName = campusName; } @Basic @Column(name = "Description") public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "CampusID", nullable = false) public int getCampusId() { return campusId; } public void setCampusId(int campusId) { this.campusId = campusId; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CampusEntity that = (CampusEntity) o; if (campusId != that.campusId) return false; if (campusName != null ? !campusName.equals(that.campusName) : that.campusName != null) return false; if (description != null ? !description.equals(that.description) : that.description != null) return false; return true; } @Override public int hashCode() { int result = campusName != null ? campusName.hashCode() : 0; result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + campusId; return result; } }
package org.sonar.plugins.profiler; import org.sonar.api.Extension; import org.sonar.api.Plugin; import org.sonar.api.Properties; import org.sonar.api.Property; import org.sonar.plugins.profiler.viewer.CpuHotspotsViewerDefinition; import org.sonar.plugins.profiler.viewer.MemoryHotspotsViewerDefinition; import java.util.Arrays; import java.util.List; /** * @author Evgeny Mandrikov */ @Properties( @Property( key = ProfilerPlugin.LICENSE_PROPERTY, name = "License" ) ) public class ProfilerPlugin implements Plugin { public static final String LICENSE_PROPERTY = "sonar.profiler.license.secured"; public static final String JPROFILER_HOME_PROPERTY = "jprofiler.home"; public String getKey() { return "profiler"; } public String getName() { return "Profiler"; } public String getDescription() { return "<a href='http://www.ej-technologies.com/products/jprofiler/overview.html'>JProfiler</a> is a Java profiler."; } public List<Class<? extends Extension>> getExtensions() { return Arrays.asList( ProfilerMetrics.class, //ProfilerConfigGenerator.class, ProfilerSensor.class, ProfilerDecorator.class, ProfilerWidget.class, CpuHotspotsViewerDefinition.class, MemoryHotspotsViewerDefinition.class ); } }