text
stringlengths 10
2.72M
|
|---|
package edu.mines.msmith1.universepoint.dao;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import edu.mines.msmith1.universepoint.SQLiteHelper;
import edu.mines.msmith1.universepoint.dto.BaseDTO;
import edu.mines.msmith1.universepoint.dto.Game;
import edu.mines.msmith1.universepoint.dto.OffensiveStat;
import edu.mines.msmith1.universepoint.dto.Player;
import edu.mines.msmith1.universepoint.dto.Team;
/**
* DAO for {@link OffensiveStat} table. Eager fetches {@link Game} and {@link Player}s.
* @author vanxrice
*/
public class OffensiveStatDAO extends BaseDAO {
private String LOG_TAG = OffensiveStatDAO.class.getSimpleName();
private String[] columns = {SQLiteHelper.COLUMN_ID,
SQLiteHelper.COLUMN_GAME_ID,
SQLiteHelper.COLUMN_TEAM_ID,
SQLiteHelper.COLUMN_PLAYER_ID,
SQLiteHelper.COLUMN_ASSISTING_PLAYER_ID,
SQLiteHelper.COLUMN_TURNOVER_PLAYER_ID}; // shouldn't have removed the offensive_stat_type_ref table
private GameDAO gameDAO;
private PlayerDAO playerDAO;
private TeamDAO teamDAO;
public OffensiveStatDAO(Context context) {
super(context);
gameDAO = new GameDAO(context);
playerDAO = new PlayerDAO(context);
teamDAO = new TeamDAO(context);
}
/**
* Helper method to persist multiple offensive stats, use to reduce the number of database calls
* @param offensiveStats to be added to the database
* @return persisted offensive stats
*/
public List<OffensiveStat> createOffensiveStats(List<OffensiveStat> offensiveStats) {
List<OffensiveStat> newOffensiveStats = new ArrayList<OffensiveStat>();
for (OffensiveStat offensiveStat : offensiveStats) {
newOffensiveStats.add(createOffensiveStat(offensiveStat));
}
return newOffensiveStats;
}
/**
* @param offensiveStat to be added
* @return persisted offensiveStat
*/
public OffensiveStat createOffensiveStat(OffensiveStat offensiveStat) {
ContentValues values = getContentValues(offensiveStat);
long id = db.insert(SQLiteHelper.TABLE_OFFENSIVE_STAT, null, values);
return getOffensiveStatById(id);
}
/**
* @param offensiveStat to be removed from database
*/
public void deleteOffensiveStat(OffensiveStat offensiveStat) {
String[] whereArgs = getWhereArgsWithId(offensiveStat);
Log.d(LOG_TAG, "deleting offensive_stat with id " + offensiveStat.getId());
db.delete(SQLiteHelper.TABLE_OFFENSIVE_STAT, WHERE_SELECTION_FOR_ID, whereArgs);
}
/**
* @param id
* @return OffensiveStat matching id, null if id is not found
*/
public OffensiveStat getOffensiveStatById(long id) {
String[] whereArgs = {String.valueOf(id)};
Cursor cursor = db.query(SQLiteHelper.TABLE_OFFENSIVE_STAT, columns, WHERE_SELECTION_FOR_ID,
whereArgs, null, null, null);
cursor.moveToFirst();
OffensiveStat offensiveStat = cursorToOffensiveStat(cursor);
cursor.close();
return offensiveStat;
}
/**
* @param player
* @return List of all OffensiveStat where the player scored a point
*/
public List<OffensiveStat> getAllPointsForPlayer(Player player) {
return getAllOffensiveStatForPlayer(player, SQLiteHelper.COLUMN_PLAYER_ID + " = ?");
}
/**
* @param player
* @return List of all OffensiveStat where the player has an assist
*/
public List<OffensiveStat> getAllAssistsForPlayer(Player player) {
return getAllOffensiveStatForPlayer(player, SQLiteHelper.COLUMN_ASSISTING_PLAYER_ID +" = ?");
}
/**
* @param player
* @return List of all OffensiveStat where the player has a turnover
*/
public List<OffensiveStat> getAllTurnoversForPlayer(Player player) {
return getAllOffensiveStatForPlayer(player, SQLiteHelper.COLUMN_TURNOVER_PLAYER_ID + " = ?");
}
/**
* Helper method to getAll*ForPlayer queries
* @param player
* @param whereClause
* @return
*/
private List<OffensiveStat> getAllOffensiveStatForPlayer(Player player, String whereClause) {
String[] whereArgs = {String.valueOf(player.getId())};
Cursor cursor = db.query(SQLiteHelper.TABLE_OFFENSIVE_STAT, columns, whereClause,
whereArgs, null, null, null);
return cursorToList(cursor);
}
/**
* @param game
* @return all offensive stats for the game
*/
public List<BaseDTO> getAllOffensiveStatForGame(Game game) {
List<BaseDTO> offensiveStats = new ArrayList<BaseDTO>();
String[] whereArgs = {String.valueOf(game.getId())};
Cursor cursor = db.query(SQLiteHelper.TABLE_OFFENSIVE_STAT, columns, "game_id = ?", whereArgs, null, null, null);
cursor.moveToFirst();
while(!cursor.isAfterLast()) {
offensiveStats.add(cursorToOffensiveStat(cursor));
cursor.moveToNext();
}
return offensiveStats;
}
/**
* @param cursor to be examined
* @return a non-null {@link List} of {@link OffensiveStat}
*/
private List<OffensiveStat> cursorToList(Cursor cursor) {
List<OffensiveStat> offensiveStats = new ArrayList<OffensiveStat>();
cursor.moveToFirst();
while(!cursor.isAfterLast()) {
offensiveStats.add(cursorToOffensiveStat(cursor));
cursor.moveToNext();
}
cursor.close();
return offensiveStats;
}
/**
* @param team
* @param game
* @return List of OffensiveStat for the team and game
*/
public List<OffensiveStat> getOffensiveStatsForTeam(Team team, Game game) {
String[] whereArgs = {String.valueOf(team.getId()), String.valueOf(game.getId())};
Cursor cursor = db.query(SQLiteHelper.TABLE_OFFENSIVE_STAT, columns, "team_id = ? AND game_id = ?",
whereArgs, null, null, null);
return cursorToList(cursor);
}
/**
* Deletes all the {@link OffensiveStat}s for the associated game
* @param game
*/
public void deleteOffensiveStatsForGame(Game game) {
String[] whereArgs = {String.valueOf(game.getId())};
Log.d(LOG_TAG, "deleting offensive_stat for game " + game.getId());
db.delete(SQLiteHelper.TABLE_OFFENSIVE_STAT, "game_id = ?", whereArgs);
}
/**
* Converts a {@link Cursor} to {@link OffensiveStat}
* @param cursor
*/
private OffensiveStat cursorToOffensiveStat(Cursor cursor) {
OffensiveStat offensiveStat = null;
if (!cursor.isAfterLast()) {
offensiveStat = new OffensiveStat();
offensiveStat.setId(cursor.getLong(0));
offensiveStat.setGame(gameDAO.getGameById(cursor.getLong(1)));
offensiveStat.setTeam(teamDAO.getTeamById(cursor.getLong(2)));
Long playerId = cursor.getLong(3);
if (playerId != null)
offensiveStat.setPlayer(playerDAO.getPlayerById(playerId));
else
offensiveStat.setPlayer(null);
Long assistingPlayerId = cursor.getLong(4);
if (assistingPlayerId != null)
offensiveStat.setAssistingPlayer(playerDAO.getPlayerById(assistingPlayerId));
else
offensiveStat.setAssistingPlayer(null);
Long turnoverPlayerId = cursor.getLong(5);
if (turnoverPlayerId != null)
offensiveStat.setTurnoverPlayer(playerDAO.getPlayerById(turnoverPlayerId));
else
offensiveStat.setTurnoverPlayer(null);
}
return offensiveStat;
}
/**
* Populates {@link ContentValues} with values from {@link OffensiveStat}
* @param offensiveStat
* @return
*/
private ContentValues getContentValues(OffensiveStat offensiveStat) {
ContentValues values = new ContentValues();
values.put(SQLiteHelper.COLUMN_GAME_ID, offensiveStat.getGame().getId());
values.put(SQLiteHelper.COLUMN_TEAM_ID, offensiveStat.getTeam().getId());
if (offensiveStat.getPlayer() != null)
values.put(SQLiteHelper.COLUMN_PLAYER_ID, offensiveStat.getPlayer().getId());
if (offensiveStat.getAssistingPlayer() != null)
values.put(SQLiteHelper.COLUMN_ASSISTING_PLAYER_ID, offensiveStat.getAssistingPlayer().getId());
if (offensiveStat.getTurnoverPlayer() != null)
values.put(SQLiteHelper.COLUMN_TURNOVER_PLAYER_ID, offensiveStat.getTurnoverPlayer().getId());
return values;
}
@Override
public void open() {
super.open();
gameDAO.open();
playerDAO.open();
teamDAO.open();
}
@Override
public void close() {
super.close();
gameDAO.close();
playerDAO.close();
teamDAO.close();
}
}
|
package com.noringerazancutyun.retrofit_example.UI;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.noringerazancutyun.retrofit_example.Adapter.RecyclerViewAdapter;
import com.noringerazancutyun.retrofit_example.Model.MovieModel;
import com.noringerazancutyun.retrofit_example.Model.MovieViewModel;
import com.noringerazancutyun.retrofit_example.R;
import com.noringerazancutyun.retrofit_example.Util.NetworkUtils;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private LinearLayoutManager linearLayoutManager;
private RecyclerViewAdapter adapter;
private RecyclerView recyclerView;
private List<MovieModel> modelList = new ArrayList<>();
private MovieViewModel viewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initRecycler();
initViewModel();
}
private void initRecycler() {
recyclerView = findViewById(R.id.recycler);
linearLayoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(linearLayoutManager);
adapter = new RecyclerViewAdapter(modelList, this);
recyclerView.setAdapter(adapter);
}
private void initViewModel() {
if (NetworkUtils.isNetworkAvailable(this)) {
viewModel = ViewModelProviders.of(this).get(MovieViewModel.class);
viewModel.getFromRepo();
viewModel.getMovieList().observe(this, new Observer<List<MovieModel>>() {
@Override
public void onChanged(@Nullable List<MovieModel> movieModels) {
modelList.addAll(movieModels);
adapter.notifyDataSetChanged();
}
});
}
}
}
|
package com.barclays.tshapeproject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.boot.json.BasicJsonParser;
import org.springframework.boot.json.JsonParseException;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
import java.time.LocalDate;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
@Service
public class TicketService {
private TicketRepository repo;
private static final Logger LOGGER = LogManager.getLogger();
public TicketService(TicketRepository repo) {
super();
this.repo = repo;
}
public List<Tickets> getAllTickets(){
return this.repo.findAll();
}
public Tickets getTicketById(long id){
Optional result = this.repo.findById(id);
if( result.isPresent()){
return (Tickets) result.get();
}else {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"invalid id - ticket does not exist");
}
}
public List<Tickets> getTicketsByStatus(String status){
return this.repo.findTicketsByStatus(statusEnumFinder(status));
}
public Boolean addTicket(String ticket){
BasicJsonParser parser = new BasicJsonParser();
Map<String,Object> jsonMap;
try{
jsonMap = parser.parseMap(ticket) ;
}catch(JsonParseException e){
LOGGER.error(e.getMessage());
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"INVALID JSON REQUEST");
}
TshapeprojectApplication.Status statusEnum = statusEnumFinder(jsonMap.get("status").toString());
Tickets tickets = new Tickets(jsonMap.get("author").toString(),jsonMap.get("title").toString(),statusEnum,jsonMap.get("description").toString(), LocalDate.now());
Object created = this.repo.save(tickets);
if(created != null ){
return true;
}else{
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "unknown error save failed");
}
}
public Object editTicket(long id, String field, String value){
try{
Object ticket = this.repo.findById(id);
if(ticket != null){
Tickets unEditedTicket = (Tickets) ((Optional) ticket).get();
Tickets editedTicket = unEditedTicket;
switch(field.toLowerCase(Locale.ROOT)){
case "title": editedTicket.setTitle(value);
break;
case "status": editedTicket.setStatus(statusEnumFinder(value));
break;
case "description": editedTicket.setDescription(value);
break;
case "author" : editedTicket.setAuthor(value);
break;
}
editedTicket.setLast_edited(LocalDate.now());
return this.repo.save(editedTicket);
}else{
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"invalid id - ticket does not exist");
}
}catch(Exception e){
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR,e.getMessage());
}
}
public void deleteTicket(long id) {
try{
this.repo.deleteById(id);
}catch(Exception e) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"invalid id - ticket does not exist" + e.getMessage());
}
}
private TshapeprojectApplication.Status statusEnumFinder(String status){
switch(status){
case "DEVELOPMENT":{ return TshapeprojectApplication.Status.DEVELOPMENT;}
case "UAT_TESTING":{return TshapeprojectApplication.Status.UAT_TESTING;}
case "CLOSED":{return TshapeprojectApplication.Status.CLOSED;}
case "PENDING":{return TshapeprojectApplication.Status.PENDING;}
default: throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"invalid ticket status please enter: DEVELOPMENT , UAT_TESTING , CLOSED , PENDING") ;//throw a web exception ;
}
}
}
|
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int q = in.nextInt();
for(int a0 = 0; a0 < q; a0++){
int x = in.nextInt();
int y = in.nextInt();
int z = in.nextInt();
Triplet triplet = new Triplet(x, y, z);
System.out.println(triplet.winner());
}
}
}
class Triplet {
int a;
int b;
int c;
public Triplet(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
public String winner() {
int ano = Math.abs(c - a);
int bno = Math.abs(c - b);
if(ano == bno) { return "Mouse C"; }
return bno < ano ? "Cat B" : "Cat A";
}
}
|
public interface StackInterface<T> {
/**
* 入栈
*
* @param item 入栈元素
*/
public void push(T item);
/**
* 出栈
*
* @return 出栈元素
*/
public T pop();
}
|
package com.rx.rxmvvmlib.repository.datasource.remote.retrofit;
import com.google.gson.Gson;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.HashMap;
import okhttp3.FormBody;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
/**
* Created by wuwei
* 2018/1/12
* 佛祖保佑 永无BUG
*/
public class JsonInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
RequestBody requestBody = request.body();
HashMap<String, String> map = new HashMap<>();
if (request.body() instanceof FormBody) {
FormBody body = (FormBody) request.body();
int size = body.size();
for (int i = 0; i < size; i++) {
String name = body.encodedName(i);
String value = body.encodedValue(i);
String nameDecode = URLDecoder.decode(name, "UTF-8");
String valueDecode = URLDecoder.decode(value, "UTF-8");
map.put(nameDecode, valueDecode);
}
String json = new Gson().toJson(map);
requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), json);
}
Request request1 = request.newBuilder().method(request.method(), requestBody).build();
return chain.proceed(request1);
}
}
|
package com.tencent.mm.ac;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import org.json.JSONObject;
public class d$b$c$a {
public long appid = 0;
public String dLD;
public String dLE;
public int dLF;
public String dLG;
public String dLH;
public static d$b$c$a kw(String str) {
x.i("MicroMsg.BizInfo", "EnterpriseBizInfo = " + str);
d$b$c$a d_b_c_a = new d$b$c$a();
if (str != null && str.length() > 0) {
try {
JSONObject jSONObject = new JSONObject(str);
d_b_c_a.dLD = jSONObject.optString("belong");
d_b_c_a.dLE = jSONObject.optString("freeze_wording");
d_b_c_a.dLF = jSONObject.optInt("child_type");
d_b_c_a.dLG = jSONObject.optString("home_url");
String optString = jSONObject.optString("exattr");
if (bi.oW(optString)) {
d_b_c_a.dLH = null;
} else {
JSONObject jSONObject2 = new JSONObject(optString);
d_b_c_a.dLH = jSONObject2.optString("chat_extension_url");
d_b_c_a.appid = jSONObject2.optLong("app_id");
}
} catch (Throwable e) {
x.e("MicroMsg.BizInfo", "exception:%s", new Object[]{bi.i(e)});
}
}
return d_b_c_a;
}
}
|
package sort;
import java.util.Arrays;
public class Solution {
public int[] solve(int[] array) {
// Write your solution here.
if (array==null||array.length<=1){
return array;
}
for(int i=0;i<array.length-1;i++)
for(int j=i+1;j<array.length;j++)
if (array[i]>array[j]){
int temp= array[i];
array[i]=array[j];
array[j]=temp;
};
return array;
}
public static void main(String[] args) {
int[] a1 = { 1 };
int[] a2 = { 1, 2 , 3};
int[] a3 = { 3, 2, 1};
int[] a4 = { 4, 2, -3, 6, 1 };
Solution S = new Solution();
S.solve(a1);
System.out.println(Arrays.toString(a1));
S.solve(a2);
System.out.println(Arrays.toString(a2));
S.solve(a3);
System.out.println(Arrays.toString(a3));
S.solve(a4);
System.out.println(Arrays.toString(a4));
}
}
|
package com.accp.pub.pojo;
public class Awardandpunishmentsort {
private Integer asortid;
private String asortname;
public Integer getAsortid() {
return asortid;
}
public void setAsortid(Integer asortid) {
this.asortid = asortid;
}
public String getAsortname() {
return asortname;
}
public void setAsortname(String asortname) {
this.asortname = asortname == null ? null : asortname.trim();
}
}
|
package exer;
public class TestEmployee {
public static void main(String[] args) {
Employee[] emArr = new Employee[5];
emArr[0] = new Employee(1, "张三", 13000);
emArr[1] = new Employee(2, "李四", 13000);
emArr[2] = new Employee(3, "王五", 14000);
emArr[3] = new Employee(4, "赵六", 7000);
emArr[4] = new Employee(5, "钱七", 9000);
myArraysBub.sort(emArr);
for (int i = 0; i < emArr.length; i++) {
System.out.println(emArr[i]);
}
}
}
// 冒泡排序
class myArraysBub {
public static void sort(Object[] arr) {
for (int i = 0; i < arr.length - 1; i++) {
for (int j = 0; j < arr.length - 1 - i; j++) {
//将arr[j]强制为Comparable接口类型,目的是调用compareTo方法
//当然如果数组的元素没有实现这个接口,那么将会发生ClassCastException
Comparable c = (Comparable) arr[j];
if (c.compareTo(arr[j + 1]) > 0) {
Object temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
}
// 选择排序
class myArraysSel {
public static void sort(Object[] arr) {
int index;
for (int i = 0; i < arr.length - 1; i++) {
index = i;
for (int j = i + 1; j < arr.length; j++) {
Comparable c = (Comparable) arr[index];
if (c.compareTo(arr[j]) > 0) {
index = j;
}
}
if (index != i) {
Object temp = arr[i];
arr[i] = arr[index];
arr[index] = temp;
}
}
}
}
class Employee implements Comparable {
private int id;
private String name;
private double salary;
public Employee(int id, String name, double salary) {
super();
this.id = id;
this.name = name;
this.salary = salary;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public Employee() {
super();
}
@Override
public int compareTo(Object o) {
Employee em = (Employee) o;
if (this.salary != em.salary) {
if (this.salary > em.salary)
return 1;
else if (this.salary < em.salary)
return -1;
else
return 0;
}
return this.id - em.id;
}
@Override
public String toString() {
return "Employee [id=" + id + ", name=" + name + ", salary=" + salary + "]";
}
}
|
package com.appatstudio.snakerpg;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import java.awt.Menu;
/**
* Created by pat on 29.03.2018.
*/
public class MenuPosition {
public int tier;
public int class1mele;
public int positionInRow;
public float upperPanelHeight;
public float MENU_SIZE_X;
public float MENU_SIZE_X_window;
public float MENU_SIZE_X_description;
public float MENU_SIZE_Y;
public float MENU_POSITION_X;
public float stageWidth;
public float stageHeight;
public float ANIMATION_FRAME_START_1;
public float ANIMATION_FRAME_START_2;
public float ANIMATION_FRAME_START_3;
public float ANIMATION_FRAME_START_4;
public float ANIMATION_FRAME_START_5;
public float ANIMATION_FRAME_START_6;
public float ANIMATION_FRAME_START_7;
public float ANIMATION_FRAME_START_8;
public float ANIMATION_FRAME_START_9;
public float ANIMATION_FRAME_START_10;
public float ANIMATION_FRAME_START_11;
public float ANIMATION_FRAME_START_12;
public float ANIMATION_FRAME_START_13;
public float ANIMATION_FRAME_START_14;
public float ANIMATION_FRAME_START_15;
public float ANIMATION_FRAME_START_16;
public float ANIMATION_FRAME_START_17;
public float ANIMATION_FRAME_START_18;
public float ANIMATION_FRAME_START_19;
public float ANIMATION_FRAME_START_20;
public Image animatedWindow;
public Image description;
public Image upgradeButton;
private TextureRegionDrawable animationArray[];
private float posXwindow;
private float posXdescription;
private float posY;
public static float posXupgrade;
public int upgradeCost;
public int sellPrice;
public MenuPosition(int tierhere, int class1melehere, int positioninrowhere, Stage stage, float upperpanelHeighthere) {
tier = tierhere;
class1mele = class1melehere;
positionInRow = positioninrowhere;
upperPanelHeight = upperpanelHeighthere;
stageWidth = stage.getWidth();
stageHeight = stage.getHeight();
MENU_SIZE_X = stageWidth*0.9f;
MENU_SIZE_X_window = MENU_SIZE_X * (49f/149f);
MENU_SIZE_X_description = MENU_SIZE_X * (100f/149f);
MENU_SIZE_Y = MENU_SIZE_X*0.32885906040268f;
MENU_POSITION_X = stageWidth*0.05f;
posXwindow = MENU_POSITION_X;
posXdescription = MENU_POSITION_X+MENU_SIZE_X_window;
posY = stageHeight-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X);
posXupgrade = MENU_POSITION_X + MENU_SIZE_X_window + (MENU_SIZE_X_description*(111/200f));
switch (tier) {
case 1:
switch (class1mele) {
case 0:
animationArray = SnakeRPG.textureManager.get_AnimationMeleTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_emptySlotTexture());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;
ANIMATION_FRAME_START_2 = 11f;
ANIMATION_FRAME_START_3 = 11f;
ANIMATION_FRAME_START_4 = 11f;
ANIMATION_FRAME_START_5 = 11f;
ANIMATION_FRAME_START_6 = 11f;
ANIMATION_FRAME_START_7 = 11f;
ANIMATION_FRAME_START_8 = 11f;
ANIMATION_FRAME_START_9 = 11f;
ANIMATION_FRAME_START_10 = 11f;
ANIMATION_FRAME_START_11 = 11f;
ANIMATION_FRAME_START_12 = 11f;
ANIMATION_FRAME_START_13 = 11f;
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 0;
sellPrice = 0;
animatedWindow.getColor().a=0f;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 1:
animationArray = SnakeRPG.textureManager.get_AnimationMeleTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mele_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f; //0.1f
ANIMATION_FRAME_START_2 = 0.1f; //0.2f
ANIMATION_FRAME_START_3 = 0.3f; //0.4f
ANIMATION_FRAME_START_4 = 0.7f; //0.1f
ANIMATION_FRAME_START_5 = 0.8f; //3f
ANIMATION_FRAME_START_6 = 3.8f; //0.1f
ANIMATION_FRAME_START_7 = 3.9f; //3f
ANIMATION_FRAME_START_8 = 6.9f; //0.1f
ANIMATION_FRAME_START_9 = 7f; //3f
ANIMATION_FRAME_START_10 = 11f;
ANIMATION_FRAME_START_11 = 11f;
ANIMATION_FRAME_START_12 = 11f;
ANIMATION_FRAME_START_13 = 11f;
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 1000;
sellPrice = 40;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mele_tier1_upgrade());
break;
case 2:
animationArray = SnakeRPG.textureManager.get_AnimationArcherTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_archer_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 0.6f;//0.3f
ANIMATION_FRAME_START_7 = 0.9f;//0.8f
ANIMATION_FRAME_START_8 = 1.7f;//0.15f
ANIMATION_FRAME_START_9 = 1.85f;//0.1f
ANIMATION_FRAME_START_10 = 1.95f;//0.1f
ANIMATION_FRAME_START_11 = 2.05f;//0.1f
ANIMATION_FRAME_START_12 = 2.15f;//0.1f
ANIMATION_FRAME_START_13 = 2.25f;//3.5f
ANIMATION_FRAME_START_14 = 5.75f;//0.1f
ANIMATION_FRAME_START_15 = 5.85f;//2.5f
ANIMATION_FRAME_START_16 = 8.35f;//0.1f
ANIMATION_FRAME_START_17 = 8.55f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 1400;
sellPrice = 140;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_archer_tier1_upgrade());
break;
case 3:
animationArray = SnakeRPG.textureManager.get_AnimationBerserkTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_berserk_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 0.7f;//0.3f
ANIMATION_FRAME_START_7 = 0.8f;//0.8f
ANIMATION_FRAME_START_8 = 1.1f;//0.15f
ANIMATION_FRAME_START_9 = 1.2f;//0.1f
ANIMATION_FRAME_START_10 = 1.5f;//0.1f
ANIMATION_FRAME_START_11 = 1.6f;//0.1f
ANIMATION_FRAME_START_12 = 1.7f;//0.1f
ANIMATION_FRAME_START_13 = 1.8f;//3.5f
ANIMATION_FRAME_START_14 = 4.7f;//0.1f
ANIMATION_FRAME_START_15 = 4.8f;//2.5f
ANIMATION_FRAME_START_16 = 7.1f;//0.1f
ANIMATION_FRAME_START_17 = 7.2f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 2000;
sellPrice = 240;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_berserk_tier1_upgrade());
break;
case 4:
animationArray = SnakeRPG.textureManager.get_AnimationMageTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mage_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 4.2f;
ANIMATION_FRAME_START_17 = 4.3f;
ANIMATION_FRAME_START_18 = 6.8f;
ANIMATION_FRAME_START_19 = 6.9f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 2800;
sellPrice = 350;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mage_tier1_upgrade());
break;
case 5:
animationArray = SnakeRPG.textureManager.get_AnimationAssasinTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_assasin_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.7f;//0.1f
ANIMATION_FRAME_START_9 = 0.8f;//3.5f
ANIMATION_FRAME_START_10 = 0.9f;//0.1f
ANIMATION_FRAME_START_11 = 1f;//3.5f
ANIMATION_FRAME_START_12 = 1.1f;//0.1f
ANIMATION_FRAME_START_13 = 5.4f;//xf
ANIMATION_FRAME_START_14 = 5.5f;
ANIMATION_FRAME_START_15 = 7.4f;
ANIMATION_FRAME_START_16 = 7.5f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 3500;
sellPrice = 450;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_assasin_tier1_upgrade());
break;
case 6:
animationArray = SnakeRPG.textureManager.get_AnimationMinerTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_miner_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.7f;//0.1f
ANIMATION_FRAME_START_9 = 0.8f;//3.5f
ANIMATION_FRAME_START_10 = 4.3f;//0.1f
ANIMATION_FRAME_START_11 = 4.4f;//3.5f
ANIMATION_FRAME_START_12 = 7.9f;//0.1f
ANIMATION_FRAME_START_13 = 8f;//xf
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 4500;
sellPrice = 600;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_miner_tier1_upgrade());
break;
case 7:
animationArray = SnakeRPG.textureManager.get_AnimationBardTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_bard_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 1.9f;
ANIMATION_FRAME_START_17 = 2f;
ANIMATION_FRAME_START_18 = 5.4f;
ANIMATION_FRAME_START_19 = 5.5f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 9000;
sellPrice = 800;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_bard_tier1_upgrade());
break;
}
if (class1mele != 0){
upgradeButton.setSize(MENU_SIZE_X_description*(79/200f), MENU_SIZE_Y/2);
upgradeButton.setPosition(posXupgrade, animatedWindow.getY());
stage.addActor(upgradeButton);
}
break;
case 2:
switch (class1mele) {
case 1: {
animationArray = SnakeRPG.textureManager.get_AnimationMeleTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mele_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f; //0.03
ANIMATION_FRAME_START_2 = 0.03f; //0.045
ANIMATION_FRAME_START_3 = 0.075f; //0.060
ANIMATION_FRAME_START_4 = 0.135f; //0.075
ANIMATION_FRAME_START_5 = 0.210f; //0.09
ANIMATION_FRAME_START_6 = 0.300f; //0.105
ANIMATION_FRAME_START_7 = 0.405f; //0.120
ANIMATION_FRAME_START_8 = 0.525f; //0.3
ANIMATION_FRAME_START_9 = 0.825f; //0.120
ANIMATION_FRAME_START_10 = 0.945f; //0.105
ANIMATION_FRAME_START_11 = 1.050f; //0.09
ANIMATION_FRAME_START_12 = 1.140f; //0.075
ANIMATION_FRAME_START_13 = 1.215f; //0.060
ANIMATION_FRAME_START_14 = 1.275f; //0.045
ANIMATION_FRAME_START_15 = 1.310f; //2.2
ANIMATION_FRAME_START_16 = 2.510f; //0.1
ANIMATION_FRAME_START_17 = 2.610f; //2.4
ANIMATION_FRAME_START_18 = 5.010f; //1.2
ANIMATION_FRAME_START_19 = 6.210f; //0.1
ANIMATION_FRAME_START_20 = 6.310f; //
upgradeCost = 3600;
sellPrice = 450;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mele_tier2_upgrade());
}
break;
case 2:
animationArray = SnakeRPG.textureManager.get_AnimationArcherTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_archer_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 1f;//0.3f
ANIMATION_FRAME_START_7 = 1.5f;//0.8f
ANIMATION_FRAME_START_8 = 1.7f;//0.15f
ANIMATION_FRAME_START_9 = 1.85f;//0.1f
ANIMATION_FRAME_START_10 = 3.5f;//0.1f
ANIMATION_FRAME_START_11 = 3.6f;//0.1f
ANIMATION_FRAME_START_12 = 6.4f;//0.1f
ANIMATION_FRAME_START_13 = 6.5f;//3.5f
ANIMATION_FRAME_START_14 = 11f;//0.1f
ANIMATION_FRAME_START_15 = 11f;//2.5f
ANIMATION_FRAME_START_16 = 11f;//0.1f
ANIMATION_FRAME_START_17 = 11f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 4500;
sellPrice = 650;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_archer_tier2_upgrade());
break;
case 3:
animationArray = SnakeRPG.textureManager.get_AnimationBerserkTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_berserk_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 0.5f;//0.3f
ANIMATION_FRAME_START_7 = 1f;//0.8f
ANIMATION_FRAME_START_8 = 1.1f;//0.15f
ANIMATION_FRAME_START_9 = 1.2f;//0.1f
ANIMATION_FRAME_START_10 = 1.3f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//0.1f
ANIMATION_FRAME_START_12 = 4f;//0.1f
ANIMATION_FRAME_START_13 = 4.1f;//3.5f
ANIMATION_FRAME_START_14 = 7f;//0.1f
ANIMATION_FRAME_START_15 = 7.1f;//2.5f
ANIMATION_FRAME_START_16 = 11f;//0.1f
ANIMATION_FRAME_START_17 = 11f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 5400;
sellPrice = 800;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_berserk_tier2_upgrade());
break;
case 4:
animationArray = SnakeRPG.textureManager.get_AnimationMageTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mage_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 4.2f;
ANIMATION_FRAME_START_17 = 4.3f;
ANIMATION_FRAME_START_18 = 6.8f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 7800;
sellPrice = 1200;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mage_tier2_upgrade());
break;
case 5:
animationArray = SnakeRPG.textureManager.get_AnimationAssasinTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_assasin_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.5f;//0.1f
ANIMATION_FRAME_START_4 = 2.1f;//0.1f
ANIMATION_FRAME_START_5 = 2.3f;//0.1f
ANIMATION_FRAME_START_6 = 4.5f;//0.1f
ANIMATION_FRAME_START_7 = 4.6f;//0.1f
ANIMATION_FRAME_START_8 = 7.1f;//0.1f
ANIMATION_FRAME_START_9 = 7.2f;//3.5f
ANIMATION_FRAME_START_10 = 11f;//0.1f
ANIMATION_FRAME_START_11 = 11f;//3.5f
ANIMATION_FRAME_START_12 = 11f;//0.1f
ANIMATION_FRAME_START_13 = 11f;//xf
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 9000;
sellPrice = 1800;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_assasin_tier2_upgrade());
break;
case 6:
animationArray = SnakeRPG.textureManager.get_AnimationMinerTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_miner_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;
ANIMATION_FRAME_START_2 = 0.1f;
ANIMATION_FRAME_START_3 = 0.3f;
ANIMATION_FRAME_START_4 = 0.5f;
ANIMATION_FRAME_START_5 = 1.5f;
ANIMATION_FRAME_START_6 = 1.6f;
ANIMATION_FRAME_START_7 = 1.7f;
ANIMATION_FRAME_START_8 = 4.35f;
ANIMATION_FRAME_START_9 = 4.45f;
ANIMATION_FRAME_START_10 = 6.7f;
ANIMATION_FRAME_START_11 = 6.8f;
ANIMATION_FRAME_START_12 = 11f;
ANIMATION_FRAME_START_13 = 11f;
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 11000;
sellPrice = 2000;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_miner_tier2_upgrade());
break;
case 7:
animationArray = SnakeRPG.textureManager.get_AnimationBardTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_bard_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.7f;//0.1f
ANIMATION_FRAME_START_9 = 0.8f;//3.5f
ANIMATION_FRAME_START_10 = 0.9f;//0.1f
ANIMATION_FRAME_START_11 = 1f;//3.5f
ANIMATION_FRAME_START_12 = 3.5f;//0.1f
ANIMATION_FRAME_START_13 = 3.6f;//xf
ANIMATION_FRAME_START_14 = 6.5f;;
ANIMATION_FRAME_START_15 = 6.6f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 1800;
sellPrice = 4300;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_bard_tier2_upgrade());
break;
}
upgradeButton.setSize(MENU_SIZE_X_description*(79/200f), MENU_SIZE_Y/2);
upgradeButton.setPosition(posXupgrade, animatedWindow.getY());
stage.addActor(upgradeButton);
break;
case 3: {
switch (class1mele) {
case 1: {
animationArray = SnakeRPG.textureManager.get_AnimationMeleTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mele_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f; //0.1
ANIMATION_FRAME_START_2 = 0.1f; //0.2
ANIMATION_FRAME_START_3 = 0.3f; //0.6
ANIMATION_FRAME_START_4 = 0.9f; //0.2
ANIMATION_FRAME_START_5 = 1.1f; //0.1
ANIMATION_FRAME_START_6 = 1.2f; //3.1
ANIMATION_FRAME_START_7 = 4.3f; //0.1
ANIMATION_FRAME_START_8 = 4.4f; //2.4
ANIMATION_FRAME_START_9 = 6.7f; //0.1
ANIMATION_FRAME_START_10 = 6.8f; //
ANIMATION_FRAME_START_11 = 11f; //
ANIMATION_FRAME_START_12 = 11f; //
ANIMATION_FRAME_START_13 = 11f; //
ANIMATION_FRAME_START_14 = 11f; //
ANIMATION_FRAME_START_15 = 11f; //
ANIMATION_FRAME_START_16 = 11f; //
ANIMATION_FRAME_START_17 = 11f; //
ANIMATION_FRAME_START_18 = 11f; //
ANIMATION_FRAME_START_19 = 11f; //
ANIMATION_FRAME_START_20 = 11f; //
stage.addActor(animatedWindow);
stage.addActor(description);
sellPrice = 1500;
}
break;
case 2: {
animationArray = SnakeRPG.textureManager.get_AnimationArcherTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_archer_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f; //0.1
ANIMATION_FRAME_START_2 = 0.1f; //0.2
ANIMATION_FRAME_START_3 = 0.3f; //0.6
ANIMATION_FRAME_START_4 = 0.9f; //0.2
ANIMATION_FRAME_START_5 = 1.1f; //0.1
ANIMATION_FRAME_START_6 = 1.4f; //3.1
ANIMATION_FRAME_START_7 = 1.7f; //0.1
ANIMATION_FRAME_START_8 = 4.8f; //2.4
ANIMATION_FRAME_START_9 = 4.9f; //0.1
ANIMATION_FRAME_START_10 = 6.8f; //
ANIMATION_FRAME_START_11 = 6.9f; //
ANIMATION_FRAME_START_12 = 11f; //
ANIMATION_FRAME_START_13 = 11f; //
ANIMATION_FRAME_START_14 = 11f; //
ANIMATION_FRAME_START_15 = 11f; //
ANIMATION_FRAME_START_16 = 11f; //
ANIMATION_FRAME_START_17 = 11f; //
ANIMATION_FRAME_START_18 = 11f; //
ANIMATION_FRAME_START_19 = 11f; //
ANIMATION_FRAME_START_20 = 11f; //
stage.addActor(animatedWindow);
stage.addActor(description);
sellPrice = 800;
}
break;
case 3:
animationArray = SnakeRPG.textureManager.get_AnimationBerserkTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_berserk_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 2f;//0.1f
ANIMATION_FRAME_START_3 = 2.1f;//0.1f
ANIMATION_FRAME_START_4 = 4.8f;//0.1f
ANIMATION_FRAME_START_5 = 4.9f;//0.2f
ANIMATION_FRAME_START_6 = 7f;//0.3f
ANIMATION_FRAME_START_7 = 7.1f;//0.8f
ANIMATION_FRAME_START_8 = 8.9f;//0.15f
ANIMATION_FRAME_START_9 = 9f;//0.1f
ANIMATION_FRAME_START_10 = 11f;//0.1f
ANIMATION_FRAME_START_11 = 11f;//0.1f
ANIMATION_FRAME_START_12 = 11f;//0.1f
ANIMATION_FRAME_START_13 = 11f;//3.5f
ANIMATION_FRAME_START_14 = 11f;//0.1f
ANIMATION_FRAME_START_15 = 11f;//2.5f
ANIMATION_FRAME_START_16 = 11f;//0.1f
ANIMATION_FRAME_START_17 = 11f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 1500;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 4:
animationArray = SnakeRPG.textureManager.get_AnimationMageTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mage_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 1.9f;
ANIMATION_FRAME_START_17 = 2f;
ANIMATION_FRAME_START_18 = 5.5f;
ANIMATION_FRAME_START_19 = 5.6f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 2700;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 5:
animationArray = SnakeRPG.textureManager.get_AnimationAssasinTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_assasin_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 1f;//0.1f
ANIMATION_FRAME_START_6 = 1.1f;//0.1f
ANIMATION_FRAME_START_7 = 1.2f;//0.1f
ANIMATION_FRAME_START_8 = 1.3f;//0.1f
ANIMATION_FRAME_START_9 = 1.4f;//3.5f
ANIMATION_FRAME_START_10 = 1.5f;//0.1f
ANIMATION_FRAME_START_11 = 3.6f;//3.5f
ANIMATION_FRAME_START_12 = 3.7f;//0.1f
ANIMATION_FRAME_START_13 = 7.1f;//xf
ANIMATION_FRAME_START_14 = 7.2f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 3500;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 6:
animationArray = SnakeRPG.textureManager.get_AnimationMinerTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_miner_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;
ANIMATION_FRAME_START_2 = 0.2f;
ANIMATION_FRAME_START_3 = 0.4f;
ANIMATION_FRAME_START_4 = 0.6f;
ANIMATION_FRAME_START_5 = 0.8f;
ANIMATION_FRAME_START_6 = 3f;
ANIMATION_FRAME_START_7 = 3.1f;
ANIMATION_FRAME_START_8 = 6.7f;
ANIMATION_FRAME_START_9 = 6.8f;
ANIMATION_FRAME_START_10 = 11f;
ANIMATION_FRAME_START_11 = 11f;
ANIMATION_FRAME_START_12 = 11f;
ANIMATION_FRAME_START_13 = 11f;
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 4000;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 7:
animationArray = SnakeRPG.textureManager.get_AnimationBardTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_bard_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.8f;//0.1f
ANIMATION_FRAME_START_6 = 0.9f;//0.1f
ANIMATION_FRAME_START_7 = 1f;//0.1f
ANIMATION_FRAME_START_8 = 1.2f;//0.1f
ANIMATION_FRAME_START_9 = 1.3f;//3.5f
ANIMATION_FRAME_START_10 = 4.2f;//0.1f
ANIMATION_FRAME_START_11 = 4.3f;//3.5f
ANIMATION_FRAME_START_12 = 6.8f;//0.1f
ANIMATION_FRAME_START_13 = 6.9f;//xf
ANIMATION_FRAME_START_14 = 11f;;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 5000;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
}
}
}
}
public MenuPosition(int tierhere, int class1melehere, int positioninrowhere, Stage stage, float upperpanelHeighthere, float posYhere) {
tier = tierhere;
class1mele = class1melehere;
positionInRow = positioninrowhere;
upperPanelHeight = upperpanelHeighthere;
stageWidth = stage.getWidth();
stageHeight = stage.getHeight();
MENU_SIZE_X = stageWidth * 0.9f;
MENU_SIZE_X_window = MENU_SIZE_X * (49f / 149f);
MENU_SIZE_X_description = MENU_SIZE_X * (100f / 149f);
MENU_SIZE_Y = MENU_SIZE_X * 0.32885906040268f;
MENU_POSITION_X = stageWidth * 0.05f;
posXwindow = MENU_POSITION_X;
posXdescription = MENU_POSITION_X + MENU_SIZE_X_window;
posY = posYhere;
//posXupgrade = MENU_POSITION_X + MENU_SIZE_X - (MENU_SIZE_Y / 2) * (59 / 24);
posXupgrade = MENU_POSITION_X + MENU_SIZE_X_window + (MENU_SIZE_X_description*(111/200f));
switch (tier) {
case 1:
switch (class1mele) {
case 1:
animationArray = SnakeRPG.textureManager.get_AnimationMeleTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mele_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, posY);
description.setPosition(MENU_POSITION_X + MENU_SIZE_X_window, posY);
ANIMATION_FRAME_START_1 = 0.0f; //0.1f
ANIMATION_FRAME_START_2 = 0.1f; //0.2f
ANIMATION_FRAME_START_3 = 0.3f; //0.4f
ANIMATION_FRAME_START_4 = 0.7f; //0.1f
ANIMATION_FRAME_START_5 = 0.8f; //3f
ANIMATION_FRAME_START_6 = 3.8f; //0.1f
ANIMATION_FRAME_START_7 = 3.9f; //3f
ANIMATION_FRAME_START_8 = 6.9f; //0.1f
ANIMATION_FRAME_START_9 = 7f; //3f
ANIMATION_FRAME_START_10 = 11f;
ANIMATION_FRAME_START_11 = 11f;
ANIMATION_FRAME_START_12 = 11f;
ANIMATION_FRAME_START_13 = 11f;
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 1000;
sellPrice = 40;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mele_tier1_upgrade());
break;
case 2:
animationArray = SnakeRPG.textureManager.get_AnimationArcherTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_archer_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 0.6f;//0.3f
ANIMATION_FRAME_START_7 = 0.9f;//0.8f
ANIMATION_FRAME_START_8 = 1.7f;//0.15f
ANIMATION_FRAME_START_9 = 1.85f;//0.1f
ANIMATION_FRAME_START_10 = 1.95f;//0.1f
ANIMATION_FRAME_START_11 = 2.05f;//0.1f
ANIMATION_FRAME_START_12 = 2.15f;//0.1f
ANIMATION_FRAME_START_13 = 2.25f;//3.5f
ANIMATION_FRAME_START_14 = 5.75f;//0.1f
ANIMATION_FRAME_START_15 = 5.85f;//2.5f
ANIMATION_FRAME_START_16 = 8.35f;//0.1f
ANIMATION_FRAME_START_17 = 8.55f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 1400;
sellPrice = 140;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_archer_tier1_upgrade());
break;
case 3:
animationArray = SnakeRPG.textureManager.get_AnimationBerserkTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_berserk_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 0.7f;//0.3f
ANIMATION_FRAME_START_7 = 0.8f;//0.8f
ANIMATION_FRAME_START_8 = 1.1f;//0.15f
ANIMATION_FRAME_START_9 = 1.2f;//0.1f
ANIMATION_FRAME_START_10 = 1.5f;//0.1f
ANIMATION_FRAME_START_11 = 1.6f;//0.1f
ANIMATION_FRAME_START_12 = 1.7f;//0.1f
ANIMATION_FRAME_START_13 = 1.8f;//3.5f
ANIMATION_FRAME_START_14 = 4.7f;//0.1f
ANIMATION_FRAME_START_15 = 4.8f;//2.5f
ANIMATION_FRAME_START_16 = 7.1f;//0.1f
ANIMATION_FRAME_START_17 = 7.2f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 2000;
sellPrice = 240;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_berserk_tier1_upgrade());
break;
case 4:
animationArray = SnakeRPG.textureManager.get_AnimationMageTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mage_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 4.2f;
ANIMATION_FRAME_START_17 = 4.3f;
ANIMATION_FRAME_START_18 = 6.8f;
ANIMATION_FRAME_START_19 = 6.9f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 2800;
sellPrice = 350;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mage_tier1_upgrade());
break;
case 5:
animationArray = SnakeRPG.textureManager.get_AnimationAssasinTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_assasin_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.7f;//0.1f
ANIMATION_FRAME_START_9 = 0.8f;//3.5f
ANIMATION_FRAME_START_10 = 0.9f;//0.1f
ANIMATION_FRAME_START_11 = 1f;//3.5f
ANIMATION_FRAME_START_12 = 1.1f;//0.1f
ANIMATION_FRAME_START_13 = 5.4f;//xf
ANIMATION_FRAME_START_14 = 5.5f;
ANIMATION_FRAME_START_15 = 7.4f;
ANIMATION_FRAME_START_16 = 7.5f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 3500;
sellPrice = 450;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_assasin_tier1_upgrade());
break;
case 6:
animationArray = SnakeRPG.textureManager.get_AnimationMinerTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_miner_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.7f;//0.1f
ANIMATION_FRAME_START_9 = 0.8f;//3.5f
ANIMATION_FRAME_START_10 = 4.3f;//0.1f
ANIMATION_FRAME_START_11 = 4.4f;//3.5f
ANIMATION_FRAME_START_12 = 7.9f;//0.1f
ANIMATION_FRAME_START_13 = 8f;//xf
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 4500;
sellPrice = 600;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_miner_tier1_upgrade());
break;
case 7:
animationArray = SnakeRPG.textureManager.get_AnimationBardTier1();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_bard_tier1_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 1.9f;
ANIMATION_FRAME_START_17 = 2f;
ANIMATION_FRAME_START_18 = 5.4f;
ANIMATION_FRAME_START_19 = 5.5f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 9000;
sellPrice = 800;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_bard_tier1_upgrade());
break;
}
upgradeButton.setSize(MENU_SIZE_X_description*(79/200f), MENU_SIZE_Y/2);
upgradeButton.setPosition(posXupgrade, animatedWindow.getY());
stage.addActor(upgradeButton);
break;
case 2:
switch (class1mele) {
case 1: {
animationArray = SnakeRPG.textureManager.get_AnimationMeleTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mele_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, posY);
description.setPosition(MENU_POSITION_X + MENU_SIZE_X_window, posY);
ANIMATION_FRAME_START_1 = 0.0f; //0.03
ANIMATION_FRAME_START_2 = 0.03f; //0.045
ANIMATION_FRAME_START_3 = 0.075f; //0.060
ANIMATION_FRAME_START_4 = 0.135f; //0.075
ANIMATION_FRAME_START_5 = 0.210f; //0.09
ANIMATION_FRAME_START_6 = 0.300f; //0.105
ANIMATION_FRAME_START_7 = 0.405f; //0.120
ANIMATION_FRAME_START_8 = 0.525f; //0.3
ANIMATION_FRAME_START_9 = 0.825f; //0.120
ANIMATION_FRAME_START_10 = 0.945f; //0.105
ANIMATION_FRAME_START_11 = 1.050f; //0.09
ANIMATION_FRAME_START_12 = 1.140f; //0.075
ANIMATION_FRAME_START_13 = 1.215f; //0.060
ANIMATION_FRAME_START_14 = 1.275f; //0.045
ANIMATION_FRAME_START_15 = 1.310f; //2.2
ANIMATION_FRAME_START_16 = 2.510f; //0.1
ANIMATION_FRAME_START_17 = 2.610f; //2.4
ANIMATION_FRAME_START_18 = 5.010f; //1.2
ANIMATION_FRAME_START_19 = 6.210f; //0.1
ANIMATION_FRAME_START_20 = 6.310f; //
upgradeCost = 3600;
sellPrice = 450;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mele_tier2_upgrade());
}
break;
case 2:
animationArray = SnakeRPG.textureManager.get_AnimationArcherTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_archer_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 1f;//0.3f
ANIMATION_FRAME_START_7 = 1.5f;//0.8f
ANIMATION_FRAME_START_8 = 1.7f;//0.15f
ANIMATION_FRAME_START_9 = 1.85f;//0.1f
ANIMATION_FRAME_START_10 = 3.5f;//0.1f
ANIMATION_FRAME_START_11 = 3.6f;//0.1f
ANIMATION_FRAME_START_12 = 6.4f;//0.1f
ANIMATION_FRAME_START_13 = 6.5f;//3.5f
ANIMATION_FRAME_START_14 = 11f;//0.1f
ANIMATION_FRAME_START_15 = 11f;//2.5f
ANIMATION_FRAME_START_16 = 11f;//0.1f
ANIMATION_FRAME_START_17 = 11f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 4500;
sellPrice = 650;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_archer_tier2_upgrade());
break;
case 3:
animationArray = SnakeRPG.textureManager.get_AnimationBerserkTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_berserk_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.2f
ANIMATION_FRAME_START_6 = 0.5f;//0.3f
ANIMATION_FRAME_START_7 = 1f;//0.8f
ANIMATION_FRAME_START_8 = 1.1f;//0.15f
ANIMATION_FRAME_START_9 = 1.2f;//0.1f
ANIMATION_FRAME_START_10 = 1.3f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//0.1f
ANIMATION_FRAME_START_12 = 4f;//0.1f
ANIMATION_FRAME_START_13 = 4.1f;//3.5f
ANIMATION_FRAME_START_14 = 7f;//0.1f
ANIMATION_FRAME_START_15 = 7.1f;//2.5f
ANIMATION_FRAME_START_16 = 11f;//0.1f
ANIMATION_FRAME_START_17 = 11f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 5400;
sellPrice = 800;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_berserk_tier2_upgrade());
break;
case 4:
animationArray = SnakeRPG.textureManager.get_AnimationMageTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mage_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 4.2f;
ANIMATION_FRAME_START_17 = 4.3f;
ANIMATION_FRAME_START_18 = 6.8f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 7800;
sellPrice = 1200;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_mage_tier2_upgrade());
break;
case 5:
animationArray = SnakeRPG.textureManager.get_AnimationAssasinTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_assasin_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.5f;//0.1f
ANIMATION_FRAME_START_4 = 2.1f;//0.1f
ANIMATION_FRAME_START_5 = 2.3f;//0.1f
ANIMATION_FRAME_START_6 = 4.5f;//0.1f
ANIMATION_FRAME_START_7 = 4.6f;//0.1f
ANIMATION_FRAME_START_8 = 7.1f;//0.1f
ANIMATION_FRAME_START_9 = 7.2f;//3.5f
ANIMATION_FRAME_START_10 = 11f;//0.1f
ANIMATION_FRAME_START_11 = 11f;//3.5f
ANIMATION_FRAME_START_12 = 11f;//0.1f
ANIMATION_FRAME_START_13 = 11f;//xf
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 9000;
sellPrice = 1800;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_assasin_tier2_upgrade());
break;
case 6:
animationArray = SnakeRPG.textureManager.get_AnimationMinerTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_miner_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;
ANIMATION_FRAME_START_2 = 0.1f;
ANIMATION_FRAME_START_3 = 0.3f;
ANIMATION_FRAME_START_4 = 0.5f;
ANIMATION_FRAME_START_5 = 1.5f;
ANIMATION_FRAME_START_6 = 1.6f;
ANIMATION_FRAME_START_7 = 1.7f;
ANIMATION_FRAME_START_8 = 4.35f;
ANIMATION_FRAME_START_9 = 4.45f;
ANIMATION_FRAME_START_10 = 6.7f;
ANIMATION_FRAME_START_11 = 6.8f;
ANIMATION_FRAME_START_12 = 11f;
ANIMATION_FRAME_START_13 = 11f;
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 11000;
sellPrice = 2000;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_miner_tier2_upgrade());
break;
case 7:
animationArray = SnakeRPG.textureManager.get_AnimationBardTier2();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_bard_tier2_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.7f;//0.1f
ANIMATION_FRAME_START_9 = 0.8f;//3.5f
ANIMATION_FRAME_START_10 = 0.9f;//0.1f
ANIMATION_FRAME_START_11 = 1f;//3.5f
ANIMATION_FRAME_START_12 = 3.5f;//0.1f
ANIMATION_FRAME_START_13 = 3.6f;//xf
ANIMATION_FRAME_START_14 = 6.5f;;
ANIMATION_FRAME_START_15 = 6.6f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
upgradeCost = 18000;
sellPrice = 4300;
stage.addActor(animatedWindow);
stage.addActor(description);
upgradeButton = new Image(SnakeRPG.textureManager.get_menu_bard_tier2_upgrade());
break;
}
upgradeButton.setSize(MENU_SIZE_X_description*(79/200f), MENU_SIZE_Y/2);
upgradeButton.setPosition(posXupgrade, animatedWindow.getY());
stage.addActor(upgradeButton);
break;
case 3:
switch (class1mele) {
case 1: {
animationArray = SnakeRPG.textureManager.get_AnimationMeleTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mele_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, posY);
description.setPosition(MENU_POSITION_X + MENU_SIZE_X_window, posY);
ANIMATION_FRAME_START_1 = 0.0f; //0.1
ANIMATION_FRAME_START_2 = 0.1f; //0.2
ANIMATION_FRAME_START_3 = 0.3f; //0.6
ANIMATION_FRAME_START_4 = 0.9f; //0.2
ANIMATION_FRAME_START_5 = 1.1f; //0.1
ANIMATION_FRAME_START_6 = 1.2f; //3.1
ANIMATION_FRAME_START_7 = 4.3f; //0.1
ANIMATION_FRAME_START_8 = 4.4f; //2.4
ANIMATION_FRAME_START_9 = 6.7f; //0.1
ANIMATION_FRAME_START_10 = 6.8f; //
ANIMATION_FRAME_START_11 = 11f; //
ANIMATION_FRAME_START_12 = 11f; //
ANIMATION_FRAME_START_13 = 11f; //
ANIMATION_FRAME_START_14 = 11f; //
ANIMATION_FRAME_START_15 = 11f; //
ANIMATION_FRAME_START_16 = 11f; //
ANIMATION_FRAME_START_17 = 11f; //
ANIMATION_FRAME_START_18 = 11f; //
ANIMATION_FRAME_START_19 = 11f; //
ANIMATION_FRAME_START_20 = 11f; //
stage.addActor(animatedWindow);
stage.addActor(description);
sellPrice = 500;
}
break;
case 2:
animationArray = SnakeRPG.textureManager.get_AnimationArcherTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_archer_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f; //0.1
ANIMATION_FRAME_START_2 = 0.1f; //0.2
ANIMATION_FRAME_START_3 = 0.3f; //0.6
ANIMATION_FRAME_START_4 = 0.9f; //0.2
ANIMATION_FRAME_START_5 = 1.1f; //0.1
ANIMATION_FRAME_START_6 = 1.4f; //3.1
ANIMATION_FRAME_START_7 = 1.7f; //0.1
ANIMATION_FRAME_START_8 = 4.8f; //2.4
ANIMATION_FRAME_START_9 = 4.9f; //0.1
ANIMATION_FRAME_START_10 = 6.8f; //
ANIMATION_FRAME_START_11 = 6.9f; //
ANIMATION_FRAME_START_12 = 11f; //
ANIMATION_FRAME_START_13 = 11f; //
ANIMATION_FRAME_START_14 = 11f; //
ANIMATION_FRAME_START_15 = 11f; //
ANIMATION_FRAME_START_16 = 11f; //
ANIMATION_FRAME_START_17 = 11f; //
ANIMATION_FRAME_START_18 = 11f; //
ANIMATION_FRAME_START_19 = 11f; //
ANIMATION_FRAME_START_20 = 11f; //
sellPrice = 800;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 3:
animationArray = SnakeRPG.textureManager.get_AnimationBerserkTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_berserk_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 2f;//0.1f
ANIMATION_FRAME_START_3 = 2.1f;//0.1f
ANIMATION_FRAME_START_4 = 4.8f;//0.1f
ANIMATION_FRAME_START_5 = 4.9f;//0.2f
ANIMATION_FRAME_START_6 = 7f;//0.3f
ANIMATION_FRAME_START_7 = 7.1f;//0.8f
ANIMATION_FRAME_START_8 = 8.9f;//0.15f
ANIMATION_FRAME_START_9 = 9f;//0.1f
ANIMATION_FRAME_START_10 = 11f;//0.1f
ANIMATION_FRAME_START_11 = 11f;//0.1f
ANIMATION_FRAME_START_12 = 11f;//0.1f
ANIMATION_FRAME_START_13 = 11f;//3.5f
ANIMATION_FRAME_START_14 = 11f;//0.1f
ANIMATION_FRAME_START_15 = 11f;//2.5f
ANIMATION_FRAME_START_16 = 11f;//0.1f
ANIMATION_FRAME_START_17 = 11f;//xf
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 1500;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 4:
animationArray = SnakeRPG.textureManager.get_AnimationMageTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_mage_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.4f;//0.1f
ANIMATION_FRAME_START_6 = 0.5f;//0.1f
ANIMATION_FRAME_START_7 = 0.6f;//0.1f
ANIMATION_FRAME_START_8 = 0.8f;//0.1f
ANIMATION_FRAME_START_9 = 1f;//3.5f
ANIMATION_FRAME_START_10 = 1.2f;//0.1f
ANIMATION_FRAME_START_11 = 1.4f;//3.5f
ANIMATION_FRAME_START_12 = 1.5f;//0.1f
ANIMATION_FRAME_START_13 = 1.6f;//xf
ANIMATION_FRAME_START_14 = 1.7f;
ANIMATION_FRAME_START_15 = 1.8f;
ANIMATION_FRAME_START_16 = 1.9f;
ANIMATION_FRAME_START_17 = 2f;
ANIMATION_FRAME_START_18 = 5.5f;
ANIMATION_FRAME_START_19 = 5.6f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 2700;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 5:
animationArray = SnakeRPG.textureManager.get_AnimationAssasinTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_assasin_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 1f;//0.1f
ANIMATION_FRAME_START_6 = 1.1f;//0.1f
ANIMATION_FRAME_START_7 = 1.2f;//0.1f
ANIMATION_FRAME_START_8 = 1.3f;//0.1f
ANIMATION_FRAME_START_9 = 1.4f;//3.5f
ANIMATION_FRAME_START_10 = 1.5f;//0.1f
ANIMATION_FRAME_START_11 = 3.6f;//3.5f
ANIMATION_FRAME_START_12 = 3.7f;//0.1f
ANIMATION_FRAME_START_13 = 7.1f;//xf
ANIMATION_FRAME_START_14 = 7.2f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 3500;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 6:
animationArray = SnakeRPG.textureManager.get_AnimationMinerTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_miner_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;
ANIMATION_FRAME_START_2 = 0.2f;
ANIMATION_FRAME_START_3 = 0.4f;
ANIMATION_FRAME_START_4 = 0.6f;
ANIMATION_FRAME_START_5 = 0.8f;
ANIMATION_FRAME_START_6 = 3f;
ANIMATION_FRAME_START_7 = 3.1f;
ANIMATION_FRAME_START_8 = 6.7f;
ANIMATION_FRAME_START_9 = 6.8f;
ANIMATION_FRAME_START_10 = 11f;
ANIMATION_FRAME_START_11 = 11f;
ANIMATION_FRAME_START_12 = 11f;
ANIMATION_FRAME_START_13 = 11f;
ANIMATION_FRAME_START_14 = 11f;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 4000;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
case 7:
animationArray = SnakeRPG.textureManager.get_AnimationBardTier3();
animatedWindow = new Image(animationArray[0]);
description = new Image(SnakeRPG.textureManager.get_menu_bard_tier3_description());
animatedWindow.setSize(MENU_SIZE_X_window, MENU_SIZE_Y);
description.setSize(MENU_SIZE_X_description, MENU_SIZE_Y);
animatedWindow.setPosition(MENU_POSITION_X, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stage.getHeight()-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
ANIMATION_FRAME_START_1 = 0.0f;//0.1f
ANIMATION_FRAME_START_2 = 0.1f;//0.1f
ANIMATION_FRAME_START_3 = 0.2f;//0.1f
ANIMATION_FRAME_START_4 = 0.3f;//0.1f
ANIMATION_FRAME_START_5 = 0.8f;//0.1f
ANIMATION_FRAME_START_6 = 0.9f;//0.1f
ANIMATION_FRAME_START_7 = 1f;//0.1f
ANIMATION_FRAME_START_8 = 1.2f;//0.1f
ANIMATION_FRAME_START_9 = 1.3f;//3.5f
ANIMATION_FRAME_START_10 = 4.2f;//0.1f
ANIMATION_FRAME_START_11 = 4.3f;//3.5f
ANIMATION_FRAME_START_12 = 6.8f;//0.1f
ANIMATION_FRAME_START_13 = 6.9f;//xf
ANIMATION_FRAME_START_14 = 11f;;
ANIMATION_FRAME_START_15 = 11f;
ANIMATION_FRAME_START_16 = 11f;
ANIMATION_FRAME_START_17 = 11f;
ANIMATION_FRAME_START_18 = 11f;
ANIMATION_FRAME_START_19 = 11f;
ANIMATION_FRAME_START_20 = 11f;
sellPrice = 5000;
stage.addActor(animatedWindow);
stage.addActor(description);
break;
}
}
}
public void refreshAnimation(float delta) {
if (delta < ANIMATION_FRAME_START_2) {
animatedWindow.setDrawable(animationArray[0]);
}
else if (delta < ANIMATION_FRAME_START_3) {
animatedWindow.setDrawable(animationArray[1]);
}
else if (delta < ANIMATION_FRAME_START_4) {
animatedWindow.setDrawable(animationArray[2]);
}
else if (delta < ANIMATION_FRAME_START_5) {
animatedWindow.setDrawable(animationArray[3]);
}
else if (delta < ANIMATION_FRAME_START_6) {
animatedWindow.setDrawable(animationArray[4]);
}
else if (delta < ANIMATION_FRAME_START_7) {
animatedWindow.setDrawable(animationArray[5]);
}
else if (delta < ANIMATION_FRAME_START_8) {
animatedWindow.setDrawable(animationArray[6]);
}
else if (delta < ANIMATION_FRAME_START_9) {
animatedWindow.setDrawable(animationArray[7]);
}
else if (delta < ANIMATION_FRAME_START_10) {
animatedWindow.setDrawable(animationArray[8]);
}
else if (delta < ANIMATION_FRAME_START_11) {
animatedWindow.setDrawable(animationArray[9]);
}
else if (delta < ANIMATION_FRAME_START_12) {
animatedWindow.setDrawable(animationArray[10]);
}
else if (delta < ANIMATION_FRAME_START_13) {
animatedWindow.setDrawable(animationArray[11]);
}
else if (delta < ANIMATION_FRAME_START_14) {
animatedWindow.setDrawable(animationArray[12]);
}
else if (delta < ANIMATION_FRAME_START_15) {
animatedWindow.setDrawable(animationArray[13]);
}
else if (delta < ANIMATION_FRAME_START_16) {
animatedWindow.setDrawable(animationArray[14]);
}
else if (delta < ANIMATION_FRAME_START_17) {
animatedWindow.setDrawable(animationArray[15]);
}
else if (delta < ANIMATION_FRAME_START_18) {
animatedWindow.setDrawable(animationArray[16]);
}
else if (delta < ANIMATION_FRAME_START_19) {
animatedWindow.setDrawable(animationArray[17]);
}
else if (delta < ANIMATION_FRAME_START_20) {
animatedWindow.setDrawable(animationArray[18]);
}
else if (delta < 10) {
animatedWindow.setDrawable(animationArray[19]);
}
//animatedWindow.setDrawable(new TextureRegionDrawable(animation.getKeyFrame(delta, true)));
}
public void panned(float deltaY) {
animatedWindow.setPosition(MENU_POSITION_X, animatedWindow.getY()-deltaY*1.6f);
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, description.getY()-deltaY*1.6f);
if (upgradeButton!=null) {
upgradeButton.setPosition(posXupgrade, upgradeButton.getY() - deltaY * 1.6f);
}
/*
if (deltaY>0) {
if (animatedWindow.getY() > stageHeight-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X)) {
animatedWindow.setPosition(MENU_POSITION_X, stageHeight-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stageHeight-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
}
else {
animatedWindow.setPosition(MENU_POSITION_X, animatedWindow.getY()-deltaY);
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, description.getY()-deltaY);
}
}
else if (deltaY<0) {
animatedWindow.setPosition(MENU_POSITION_X, animatedWindow.getY()-deltaY);
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, description.getY()-deltaY); //zebys ie nie dalo za nisko jest w MenuScreen
}
if (animatedWindow.getY() > stageHeight-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X)) {
animatedWindow.setPosition(MENU_POSITION_X, stageHeight-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(MENU_POSITION_X+MENU_SIZE_X_window, stageHeight-upperPanelHeight - positionInRow*(MENU_SIZE_Y+MENU_POSITION_X)); }
*/
}
public float getPosY() {
return animatedWindow.getY();
}
public void backToInitPos() {
animatedWindow.setPosition(posXwindow, stageHeight-upperPanelHeight - (SnakeRPG.screenManager.screenMenu.menuPositions.indexOf(this)+1)*(MENU_SIZE_Y+MENU_POSITION_X));
description.setPosition(posXdescription, stageHeight-upperPanelHeight - (SnakeRPG.screenManager.screenMenu.menuPositions.indexOf(this)+1)*(MENU_SIZE_Y+MENU_POSITION_X));
if (upgradeButton!=null) {
upgradeButton.setPosition(posXupgrade, stageHeight-upperPanelHeight - (SnakeRPG.screenManager.screenMenu.menuPositions.indexOf(this)+1)*(MENU_SIZE_Y+MENU_POSITION_X));
}
}
public void toRight() {
animatedWindow.addAction(Actions.moveBy(stageWidth, 0, 0.1f));
description.addAction(Actions.moveBy(stageWidth, 0, 0.1f));
if (upgradeButton!=null) {
upgradeButton.addAction(Actions.moveBy(stageWidth, 0, 0.1f));
}
}
public void toLeft() {
animatedWindow.addAction(Actions.moveBy(-stageWidth, 0, 0.1f));
description.addAction(Actions.moveBy(-stageWidth, 0, 0.1f));
if (upgradeButton!=null) {
upgradeButton.addAction(Actions.moveBy(-stageWidth, 0, 0.1f));
}
}
public boolean isUpgradeHit(float x, float y) {
if (upgradeButton != null) {
return stageHeight - upgradeButton.getY() >= y && stageHeight - (upgradeButton.getY() + upgradeButton.getHeight()) <= y && upgradeButton.getX() <= x && upgradeButton.getX()+ upgradeButton.getWidth() >= x;
}
else return false;
}
public boolean isInfoHit(float x, float y) {
if (class1mele != 0) {
return stageHeight - animatedWindow.getY() - animatedWindow.getHeight() / 2 >= y && stageHeight - (animatedWindow.getY() + animatedWindow.getHeight() / 2) - animatedWindow.getHeight() / 2 <= y && posXdescription + MENU_SIZE_X_description * (111 / 200f) <= x && posXdescription + MENU_SIZE_X_description * (111 / 200f) + description.getWidth() / 2 >= x;
}
else return false;
}
public boolean isPositionHit(float x, float y) {
if (stageHeight - animatedWindow.getY() >= y && stageHeight - (animatedWindow.getY() + animatedWindow.getHeight()) <= y) return true;
else return false;
}
public void upgradePressed(float x, float y) {
if (x>upgradeButton.getX() + upgradeButton.getWidth()*0.7f &&
y < stageHeight - upgradeButton.getY() - upgradeButton.getHeight() * 0.5f) {
SnakeRPG.screenManager.screenMenu.warriorLookup.show(class1mele, tier+1);
}
else {
if (upgradeButton.getColor().a != 0f) {
SnakeRPG.screenManager.screenMenu.upgradeMenuPosition(this);
} else pressed();
}
}
public int getTier() {
return tier;
}
public int getClass1mele() {
return class1mele;
}
public int getPositionInRow() {
return positionInRow;
}
public void moveOut() {
animatedWindow.addAction(Actions.removeActor());
description.addAction(Actions.removeActor());
if (upgradeButton != null) {
upgradeButton.addAction(Actions.removeActor());
}
}
public int getUpgradeCost() {
return upgradeCost;
}
public void refreshUpgradeButtons(int money) {
if (upgradeButton != null) {
if (money < upgradeCost) {
upgradeButton.getColor().a = 0f;
} else {
upgradeButton.getColor().a = 1f;
}
}
}
public void pressed() {
if (!MenuPositionEditionPanel.isUp) {
switch (this.getTier()) {
case 1:
if (this.getClass1mele() == 0) {
SnakeRPG.screenManager.screenMenu.buyingObjectsClassSelect.show(this);
}
else {
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelBronze.show(this);
}
break;
case 2:
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelSilver.show(this);
break;
case 3:
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelGold.show(this);
break;
}
if (SnakeRPG.isVibrate) {
Gdx.input.vibrate(50);
}
}
else {
if (this.getClass1mele() == 0) {
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelBronze.hide();
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelSilver.hide();
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelGold.hide();
SnakeRPG.screenManager.screenMenu.buyingObjectsClassSelect.show(this);
}
else if (MenuPositionEditionPanel.focusedObject != this) {
if (SnakeRPG.isVibrate) {
Gdx.input.vibrate(50);
}
if (this.getTier() != MenuPositionEditionPanel.focusedObject.getTier()) {
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelBronze.hideQuick();
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelSilver.hideQuick();
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelGold.hideQuick();
switch (this.getTier()) {
case 1:
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelBronze.showQuick();
break;
case 2:
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelSilver.showQuick();
break;
case 3:
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelGold.showQuick();
break;
}
}
MenuPositionEditionPanel.changeFocusedObject(this);
}
else {
this.editionUnfocued();
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelBronze.hide();
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelSilver.hide();
SnakeRPG.screenManager.screenMenu.menuPositionEditionPanelGold.hide();
}
}
}
public void editionFocused() {
if (class1mele != 0) {
animatedWindow.getColor().a = 0.45f;
}
description.getColor().a=0.65f;
if (upgradeButton != null) {
if (upgradeButton.getColor().a != 0f) {
upgradeButton.getColor().a = 0.65f;
}
}
}
public void editionUnfocued() {
if (class1mele != 0) {
animatedWindow.getColor().a = 1f;
}
description.getColor().a=1f;
if (upgradeButton != null) {
if (upgradeButton.getColor().a != 0f) {
upgradeButton.getColor().a = 1f;
}
}
}
public void movePosUp() {
animatedWindow.addAction(Actions.moveBy(0, MENU_SIZE_Y + MENU_POSITION_X));
description.addAction(Actions.moveBy(0, MENU_SIZE_Y + MENU_POSITION_X));
if (upgradeButton!=null) {
upgradeButton.addAction(Actions.moveBy(0, MENU_SIZE_Y + MENU_POSITION_X));
}
positionInRow--;
}
public void movePosDown() {
animatedWindow.addAction(Actions.moveBy(0, -(MENU_SIZE_Y + MENU_POSITION_X)));
description.addAction(Actions.moveBy(0, -(MENU_SIZE_Y + MENU_POSITION_X)));
if (upgradeButton!=null) {
upgradeButton.addAction(Actions.moveBy(0, -(MENU_SIZE_Y + MENU_POSITION_X)));
}
positionInRow++;
}
public void setPos(MenuPosition mp) {
animatedWindow.setPosition(MENU_POSITION_X, mp.getPosY() - MENU_POSITION_X - MENU_SIZE_Y);
description.setPosition(MENU_POSITION_X + MENU_SIZE_X_window, mp.getPosY() - MENU_POSITION_X - MENU_SIZE_Y);
if (upgradeButton != null) {
upgradeButton.setPosition(posXupgrade, mp.getPosY() - MENU_POSITION_X - MENU_SIZE_Y);
}
}
}
|
package interpreter.action.executor;
import interpreter.action.type.IDecisionAction;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
public class KeyboardExecutor implements IActionExcecutor{
private Map<String, IDecisionAction> actions;
public KeyboardExecutor(){
actions = new HashMap<>();
}
public void addAction(String actionName, IDecisionAction action){
actions.put(actionName, action);
}
@Override
public void executeAction(String actionName) {
actions.get(actionName).execute();
}
}
|
package br.com.ecommerce.tests.retaguarda.cadastros;
import org.junit.Test;
import br.com.ecommerce.config.BaseTest;
import br.com.ecommerce.pages.retaguarda.cadastros.operadorascartaocredito.PageOpCartoesCredito;
import br.com.ecommerce.pages.retaguarda.dashboard.PageMenu;
/**
*
* Classe de testes com cenários relacionados ao Cadastros >> Grupos Fiscais
* @author Jarbas
*
* */
public class TestCadastrosOpCartaoCredito extends BaseTest{
PageMenu pageMenu = new PageMenu();
PageOpCartoesCredito pageOpCartoesCredito = new PageOpCartoesCredito();
@Test
public void ativarOperadoraMasterCard(){
String operadora = "MasterCard";
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
if (pageOpCartoesCredito.isAtiva(operadora)) {
pageOpCartoesCredito.desativarOperadora(operadora);
}
pageOpCartoesCredito.ativarOperadora(operadora);
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
pageOpCartoesCredito.verificarOperadoraCartaoAtivada(operadora);
}
@Test
public void desativarOperadoraMasterCard(){
String operadora = "MasterCard";
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
if (!pageOpCartoesCredito.isAtiva(operadora)) {
pageOpCartoesCredito.ativarOperadora(operadora);
}
pageOpCartoesCredito.desativarOperadora(operadora);
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
pageOpCartoesCredito.verificarOperadoraCartaoDesativada(operadora);
}
@Test
public void ativarOperadoraVisa(){
String operadora = "Visa";
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
if (pageOpCartoesCredito.isAtiva(operadora)) {
pageOpCartoesCredito.desativarOperadora(operadora);
}
pageOpCartoesCredito.ativarOperadora(operadora);
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
pageOpCartoesCredito.verificarOperadoraCartaoAtivada(operadora);
}
@Test
public void desativarOperdoraVisa(){
String operadora = "Visa";
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
if (!pageOpCartoesCredito.isAtiva(operadora)) {
pageOpCartoesCredito.ativarOperadora(operadora);
}
pageOpCartoesCredito.desativarOperadora(operadora);
pageMenu.acessarMenuCadastrosOpCartaoCredito();
pageOpCartoesCredito.verificarOrtografiaPageOpCartoesCredito();
pageOpCartoesCredito.verificarOperadoraCartaoDesativada(operadora);
}
}
|
package WB.java;
import java.util.Scanner;
public class Homework_0519_1_2 {
public static void main(String[] args) {
int dan;
Scanner scan = new Scanner(System.in);
System.out.println("Enter a dan");
dan = scan.nextInt();
for(int times = 1; times < 10; times++) {
if(dan % 2 == 0) {
System.out.println(dan * times);
}
else {
System.out.println("짝수만 입력");
break;
}
}
} // 구구단을 짝수 단만 출력
}
|
package task26;
import java.util.Set;
import java.util.TreeSet;
/**
* @author Igor
*/
public class Main26 {
private static final int N = 1_000;
public static void main(String[] args) {
int d = 0;
int maxCycle = 0;
for (int i = 2; i < N; i++) {
int cycle = recurringCycleLength(i);
if (cycle > maxCycle) {
maxCycle = cycle;
d = i;
}
}
System.out.println(d + " " + maxCycle);
}
private static int recurringCycleLength(int number) {
Set<Integer> remainders = new TreeSet<>();
int start = 10;
int remainder = 0;
while (!remainders.contains(remainder)) {
remainders.add(remainder);
remainder = start % number;
start = remainder * 10;
}
return remainders.size() - 1;
}
}
|
package GenericDemo;
/**
* A generic type can be restricted, by type of class or/and one to many
* interface types (by using logical operator AND). Keyword 'extends' to set
* upper boundaries. Keyword 'super' to set lover boundaries.
*
* @author Bohdan Skrypnyk
*/
// extends class 'Number' to restrict a generic type,
// so it will not give to use not numeric types.
class Stats<T extends Number> {
T[] nums; // massive of the objects of the type 'T'
public Stats(T[] obj) {
this.nums = obj;
}
// getter for the 'nums' massive
public T[] getObj() {
return nums;
}
// always return type double
public double average() {
double sum = 0.0;
for (int a = 0; a < nums.length; a++) {
sum += nums[a].doubleValue();
}
return sum / nums.length;
}
// <?> is unbounded wildcard enable usage of all data types
public boolean sameAver(Stats<?> ob) {
if (average() == ob.average()) {
return true;
}
return false;
}
}
public class BoundsDemo {
public static void main(String args[]) {
Integer iarr[] = {1, 2, 3, 4, 5, 6, 7, 8};
// create an object of the type 'Stats' for massive of integers
Stats<Integer> istat = new Stats<Integer>(iarr);
double inum = istat.average();
System.out.println("Average Integer : " + inum);
Double darr[] = {1.0, 3.0, 1.9, 4.6, 5.2, 1.0, 3.6, 4.2, 9.0, 7.8};
// create an object of the type 'Stats' for massive of double
Stats<Double> dstat = new Stats<Double>(darr);
double dnum = dstat.average();
System.out.println("Average Double : " + dnum);
Float farr[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f};
// create an object of the type 'Stats' for massive of float
Stats<Float> fstat = new Stats<Float>(farr);
double fnum = fstat.average();
System.out.println("Average Float : " + fnum);
System.out.println("Average of Float : " + fnum + " and Double : " + dnum);
if (fstat.sameAver(dstat)) {
System.out.println("Equal");
} else {
System.out.println("Different");
}
System.out.println("Average of Integer : " + inum + " and Float : " + fnum);
if (istat.sameAver(fstat)) {
System.out.println("Equal");
} else {
System.out.println("Different");
}
}
}
|
package com.tencent.mm.pluginsdk.ui.d;
import android.text.style.CharacterStyle;
import android.view.MotionEvent;
import android.view.View;
import com.tencent.mm.plugin.comm.a.e;
import com.tencent.neattextview.textview.view.NeatTextView;
import com.tencent.neattextview.textview.view.b;
public final class f extends b {
private m qPI;
public f(NeatTextView neatTextView, m mVar) {
super(neatTextView.getContext(), neatTextView);
this.qPI = mVar;
}
public final boolean onTouch(View view, MotionEvent motionEvent) {
view.setTag(e.touch_loc, new int[]{(int) motionEvent.getRawX(), (int) motionEvent.getRawY()});
if (view instanceof NeatTextView) {
NeatTextView neatTextView = (NeatTextView) view;
if (!neatTextView.cAs() || neatTextView.vbj) {
if (motionEvent.getAction() == 3 || motionEvent.getAction() == 1) {
neatTextView.getWrappedTextView().setPressed(false);
} else if (motionEvent.getAction() == 0) {
neatTextView.getWrappedTextView().setPressed(true);
}
return this.qPI.onTouch(neatTextView.getWrappedTextView(), motionEvent);
}
}
return super.onTouch(view, motionEvent);
}
public final boolean onDown(MotionEvent motionEvent) {
boolean onDown = super.onDown(motionEvent);
if (this.vbB != null) {
CharacterStyle characterStyle = this.vbB.vab;
if (characterStyle instanceof n) {
((n) characterStyle).lmQ = true;
}
}
return onDown;
}
protected final void cancel(int i) {
if (this.vbB != null) {
CharacterStyle characterStyle = this.vbB.vab;
if (characterStyle instanceof n) {
((n) characterStyle).lmQ = false;
}
}
super.cancel(i);
}
}
|
package com.snab.tachkit.additional;
import com.snab.tachkit.asyncTaskCustom.LoadListTask;
import com.snab.tachkit.ClassesJson.NewsTableJson;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import com.google.gson.Gson;
import com.snab.tachkit.OpenNewsView;
import com.snab.tachkit.R;
import com.snab.tachkit.adapters.TableNewsAdapter;
import com.snab.tachkit.fragments.FragmentWithUpdate;
import com.snab.tachkit.globalOptions.Global;
import java.util.ArrayList;
/**
* Created by Таня on 26.02.2015.
* загрузка и формирование таблицы новостей
*/
public class TableNews extends ListWithLoadPage<TableNewsAdapter>{
public TableNews(Fragment fragment, GridView listView){
super(fragment, listView);
initUrl();
initParams();
loadPage();
}
public void loadPage(){
new ParseTaskCardData(context).execute();
}
public void initUrl(){
strSearch = Global.getHttp() + "api/article/list?app_key=" + Global.appKey + "&field=id_article_post%2C+ap_title%2C+ap_descrip_main%2C+ap_date%2C+ApiImg&page=0&page_size=10";
}
public class ParseTaskCardData extends LoadListTask {
ArrayList<NewsTableJson.OptionsNews> news;
public ParseTaskCardData(Context context) {
super(context);
}
@Override
protected String doInBackground(Void... params) {
super.doInBackground(params);
strSearch = strSearch.replaceAll("([&?]page=)(\\d+)", "$1" + String.valueOf(mCurrentPage));
url = strSearch;
initRequest();
return null;
}
@Override
protected void onPostExecute(String strJson) {
super.onPostExecute(strJson);
if (showCard) {
if(mCurrentPage == 0) {
fragment.getView().findViewById(R.id.loadingPanel).setVisibility(View.GONE);
((FragmentWithUpdate)fragment).swipeLayout.setRefreshing(false);
adapter = new TableNewsAdapter(context, R.layout.item_news_table, news);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(context, OpenNewsView.class);
intent.putExtra("id", adapter.getIdNews(position));
context.startActivity(intent);
((Activity) context).overridePendingTransition(R.anim.slide_in_left, R.anim.slide_in_right);
}
});
initListener();
}else{
addAdapterItems(news);
}
}
}
@Override
public void initJson(String str) {
NewsTableJson newsTableJson = new Gson().fromJson(str, NewsTableJson.class);
news = new Gson().fromJson(str, NewsTableJson.class).getData().getList();
lastPage = newsTableJson.getData().getPage().get("pageCount");
}
public Boolean adapterState(){
return adapter != null;
}
public void initTaskExecute(){
loadPage();
}
}
}
|
package lib.game.gui;
import static org.lwjgl.opengl.GL11.*;
import org.lwjgl.input.Keyboard;
import lib.game.RenderUtils;
import math.geom.Point2i;
import math.geom.Rectangle;
public class TextField extends TextComponent {
private boolean expanding = true;
public TextField(int chars, Point2i pos) {
super(chars, pos);
}
public TextField(String text, Point2i pos) {
super(text, pos);
}
public void append(String textToAppend) {
if (!expanding) {
for (int i = 0; i < textToAppend.length(); i++) {
if (text.length() + i > textLength)
return;
text += textToAppend.charAt(i);
}
}
else {
text += textToAppend;
if(textLength <text.length()) setTextLength(text.length());
}
}
public void backspace() {
if(text.length() == 0) return;
text = text.substring(0, text.length()-1);
}
public boolean isExpanding() {
return expanding;
}
public void setExpanding(boolean expand) {
this.expanding = expand;
}
@Override
public void render() {
super.render();
if(super.hasFocus()) {
//Draw cursor
int cursorx = bounds.getp1().x + borderWidth + text.length()*fontSize + 2;
RenderUtils.applyColor(textColor);
glBegin(GL_LINES); {
glVertex2i(cursorx, bounds.getp1().y + borderWidth-2);
glVertex2i(cursorx, bounds.getp1().y + (int) ((double)fontSize * fontRatio) + borderWidth+2);
} glEnd();
}
}
@Override
public void onKeyDown(Key key) {
switch(key.getKeyInt()) {
case Keyboard.KEY_BACK:
backspace();
return;
case Keyboard.KEY_RETURN:
onSubmit();
return;
case Keyboard.KEY_LSHIFT:
return;
case Keyboard.KEY_RSHIFT: return;
case Keyboard.KEY_LCONTROL: return;
case Keyboard.KEY_RCONTROL: return;
}
// System.out.println(key);
append(key.getKeyChar());
}
@Override
public void onKeyUp(Key key) {
// System.out.println(key);
}
public void onSubmit() {
//Override if desired (called when enter pressed)
}
@Override
public void onClick(Point2i pos, int button) {
//Place cursor
}
@Override
public void onMouseMove(Point2i pos) {}
}
|
package step._12_Sort;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
/* date : 2021-08-14 (토)
* author : develiberta
* number : 10989
*
* [단계]
* 12. 정렬
* 배열의 원소를 순서대로 나열하는 알고리즘을 배워 봅시다.
* [제목]
* 03. 수 정렬하기 3 (10989)
* 수의 범위가 작다면 카운팅 정렬을 사용하여 더욱 빠르게 정렬할 수 있습니다.
* [문제]
* N개의 수가 주어졌을 때, 이를 오름차순으로 정렬하는 프로그램을 작성하시오.
* [입력]
* 첫째 줄에 수의 개수 N(1 ≤ N ≤ 10,000,000)이 주어진다.
* 둘째 줄부터 N개의 줄에는 수 주어진다.
* 이 수는 10,000보다 작거나 같은 자연수이다.
* [출력]
* 첫째 줄부터 N개의 줄에 오름차순으로 정렬한 결과를 한 줄에 하나씩 출력한다.
* (예제 입력 1)
* 10
* 5
* 2
* 3
* 1
* 4
* 2
* 3
* 5
* 1
* 7
* (예제 출력 1)
* 1
* 1
* 2
* 2
* 3
* 3
* 4
* 5
* 5
* 7
*/
public class _03_10989_SortNumber3 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int N = Integer.parseInt(br.readLine());
int[] count = new int[10001];
for (int i=0; i<N; i++) {
count[Integer.parseInt(br.readLine())]++;
}
for (int i=1; i<count.length; i++) {
for (int j=0; j<count[i]; j++) {
bw.write(String.valueOf(i));
bw.newLine();
}
}
br.close();
bw.flush();
bw.close();
}
}
|
/*
* 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 mylittlechain;
import java.util.GregorianCalendar;
/**
*
* @author urbano
*/
public final class Block {
public String hash;
public String prevHash;
private String content;
private long instant;
public Block(String prevHash, String content) {
this.prevHash = prevHash;
this.content = content;
this.instant = new GregorianCalendar().getTimeInMillis();
this.hash = calcularHash();
}
public String calcularHash(){
String finalHash = ChainUtilities.stringToHash(this.content + this.prevHash + this.instant);
return finalHash;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public String getPrevHash() {
return prevHash;
}
public void setPrevHash(String prevHash) {
this.prevHash = prevHash;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public long getInstant() {
return instant;
}
public void setInstant(long instant) {
this.instant = instant;
}
@Override
public String toString() {
return "Bloque:\n{" + "hash=" + hash + "\n, prevHash=" + prevHash + "\n, content=" + content + "\n, instant=" + instant + '}';
}
}
|
package p4_group_8_repo.Game_functions;
import p4_group_8_repo.Game_actor.Frog_player;
import p4_group_8_repo.Game_scene.MyStage;
public class Create_frogger {
Frog_player animal;
public Create_frogger(MyStage background) {
String main_frog = "/graphic_animation/froggerUp.png";
animal = new Frog_player(main_frog);
background.add(animal);
}
public Frog_player get_player() {
return animal;
}
}
|
/*
* Test class for Room.java of ESOF322-AssignmentP2
*/
package esof322.a4;
import esof322.a4.Room;
import esof322.a4.Key;
import esof322.a4.Item;
import esof322.a4.Player;
import esof322.a4.Treasure;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Matthew Rohrlach
*/
public class RoomTest {
public RoomTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of addItem method, of class Room.
*/
@Test
public void testAddItem() {
System.out.println("Testing: addItem() method");
//Create objects
Item rat = new Item();
Treasure treasure = new Treasure();
Key key = new Key();
//Create room
Room instance = new Room();
//Add first item to empty room
instance.addItem(rat);
assertSame(rat,instance.getRoomContents()[0]);
assertSame(1,instance.getRoomContents().length);
//Add second item to room
instance.addItem(key);
assertSame(key,instance.getRoomContents()[1]);
assertSame(rat,instance.getRoomContents()[0]);
assertSame(2,instance.getRoomContents().length);
//Add third item to room
instance.addItem(treasure);
assertSame(treasure,instance.getRoomContents()[2]);
assertSame(key,instance.getRoomContents()[1]);
assertSame(rat,instance.getRoomContents()[0]);
assertSame(3,instance.getRoomContents().length);
}
/**
* Test of removeItem method, of class Room.
*/
@Test
public void testRemoveItem() {
System.out.println("Testing: removeItem() method");
//Create objects
Item rat = new Item();
Treasure treasure = new Treasure();
Key key = new Key();
//Create room
Room instance = new Room();
//Add first item to empty room
instance.addItem(rat);
//Add second item to room
instance.addItem(key);
//Add third item to room
instance.addItem(treasure);
//Remove rat, assert location of key and treasure are in proper place
instance.removeItem(rat);
assertSame(key,instance.getRoomContents()[0]);
assertSame(treasure,instance.getRoomContents()[1]);
assertSame(2,instance.getRoomContents().length);
//Remove treasure, assert location of key is in proper place
instance.removeItem(treasure);
assertSame(key,instance.getRoomContents()[0]);
assertSame(1,instance.getRoomContents().length);
//Remove key, assert that room is empty
instance.removeItem(key);
assertSame(0,instance.getRoomContents().length);
}
/**
* Test of enter method, of class Room.
*/
@Test
public void testEnter() {
System.out.println("Testing: enter() method");
Player p = new Player();
Room instance = new Room();
instance.enter(p);
assertSame(p.currentStatus(),"You successfully enter the room");
}
/**
* Test of exit method, of class Room.
*/
@Test
public void testExit() {
System.out.println("Testing: exit() method");
//Run into wall
int direction = 0;
Player p = new Player();
Room instance = new Room();
instance.exit(direction, p);
assertSame(p.currentStatus(),"Ow! My face.");
//Run into room
Room adjoining = new Room();
instance.setSide(direction, adjoining);
instance.exit(direction, p);
assertSame(p.currentStatus(),"You successfully enter the room");
}
}
|
package com.travix.toughjet.repository;
import java.time.LocalDate;
import java.util.List;
import com.travix.toughjet.entity.Flight;
public interface FlightRepository {
List<Flight> findFlightBy(String from, String to, LocalDate outboundDate, int numberOfAdults);
}
|
package com.cartshare.models;
import java.util.*;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "user")
@EntityListeners(AuditingEntityListener.class)
@XmlRootElement
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private long id;
@NotBlank
@Column(name = "uid")
private String uid;
@NotBlank
@Column(name = "email")
private String email;
@NotBlank
@Column(name = "nick_name")
private String nickName;
@NotBlank
@Column(name = "screen_name")
private String screenName;
@NotNull
@Column(name = "isadmin")
private boolean isAdmin;
@NotNull
@Column(name = "isactive")
private boolean isActive;
@NotNull
@Column(name = "isverified")
private boolean isVerified;
@NotNull
@Column(name = "isprofilecomplete")
private boolean isProfileComplete;
@NotBlank
@Column(name = "verification_code")
private String verificationCode;
@NotNull
@Column(name = "contributioncredit")
private Long contributionCredit;
@Embedded
@AttributeOverrides(
value = {
@AttributeOverride(name = "street", column = @Column(name = "street")),
@AttributeOverride(name = "city", column = @Column(name = "city")),
@AttributeOverride(name = "state", column = @Column(name = "state")),
@AttributeOverride(name = "zipcode", column = @Column(name = "zipcode"))
}
)
private Address address;
@JsonIgnore
@OneToMany(mappedBy="user", fetch = FetchType.LAZY)
@LazyCollection(LazyCollectionOption.FALSE)
private Set<Store> stores = new HashSet<Store>();
@JsonIgnore
@OneToMany(mappedBy="pooler", fetch = FetchType.LAZY)
@LazyCollection(LazyCollectionOption.FALSE)
private Set<Pool> pools = new HashSet<Pool>();
@JsonIgnore
@OneToMany(mappedBy="member", fetch = FetchType.LAZY)
@LazyCollection(LazyCollectionOption.FALSE)
private Set<PoolMembers> poolMembers = new HashSet<PoolMembers>();
@JsonIgnore
@OneToMany(mappedBy="reference", fetch = FetchType.LAZY)
@LazyCollection(LazyCollectionOption.FALSE)
private Set<PoolMembers> refernces = new HashSet<PoolMembers>();
@JsonIgnore
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
@LazyCollection(LazyCollectionOption.FALSE)
private Set<Orders> orders = new HashSet<Orders>();
@JsonIgnore
@OneToMany(mappedBy = "pickupPooler", fetch = FetchType.LAZY)
@LazyCollection(LazyCollectionOption.FALSE)
private Set<Orders> ordersToPickUp = new HashSet<Orders>();
public User(@NotBlank String uid, @NotBlank String email, @NotBlank String nickName, @NotBlank String screenName,
@NotBlank boolean isAdmin, @NotBlank boolean isVerified, @NotBlank boolean isActive,
@NotBlank boolean isProfileComplete, @NotBlank String verificationCode, Set<Store> stores, Set<Pool> pools,
Set<PoolMembers> poolMembers, Set<PoolMembers> refernces) {
super();
this.uid = uid;
this.email = email;
this.nickName = nickName;
this.screenName = screenName;
this.isAdmin = isAdmin;
this.isActive = isActive;
this.isVerified = isVerified;
this.stores = stores;
this.pools = pools;
this.poolMembers = poolMembers;
this.refernces = refernces;
this.isProfileComplete = isProfileComplete;
this.verificationCode = verificationCode;
this.contributionCredit = (long) 0;
}
public User() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getScreenName() {
return screenName;
}
public void setScreenName(String screenName) {
this.screenName = screenName;
}
public String getVerificationCode() {
return this.verificationCode;
}
public void setVerificationCode(String code) {
this.verificationCode = code;
}
public boolean isAdmin() {
return isAdmin;
}
public void setAdmin(boolean isAdmin) {
this.isAdmin = isAdmin;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public boolean isVerified() {
return this.isVerified;
}
public void setVerified(boolean isVerified) {
this.isVerified = isVerified;
}
public boolean isProfileComplete() {
return this.isProfileComplete;
}
public void setProfileComplete(boolean isProfileComplete) {
this.isProfileComplete = isProfileComplete;
}
public Set<Store> getStores() {
return stores;
}
public void setStores(Set<Store> stores) {
this.stores = stores;
}
public Set<Pool> getPools() {
return pools;
}
public void setPools(Set<Pool> pools) {
this.pools = pools;
}
public Set<PoolMembers> getPoolMembers() {
return poolMembers;
}
public void setPoolMembers(Set<PoolMembers> poolMembers) {
this.poolMembers = poolMembers;
}
public Set<PoolMembers> getRefernces() {
return refernces;
}
public void setRefernces(Set<PoolMembers> refernces) {
this.refernces = refernces;
}
public Long getContributionCredit() {
return this.contributionCredit;
}
public void setContributionCredit(Long contributionCredit) {
this.contributionCredit = contributionCredit;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Set<Orders> getOrders() {
return orders;
}
public void setOrders(Set<Orders> orders) {
this.orders = orders;
}
public Set<Orders> getOrdersToPickUp() {
return this.ordersToPickUp;
}
public void setOrdersToPickUp(Set<Orders> ordersToPickUp) {
this.ordersToPickUp = ordersToPickUp;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
}
|
public class Main {
public static void main(String[] args){
int [][] trianglePascal = new int[10][10];
for (int i = 0; i < trianglePascal.length; i++){
for (int j = 0; j <= i; j++){
trianglePascal[i][0] = 1;
trianglePascal[i][i] = 1;
/*if (i > 1){
trianglePascal[i][1] = i;
trianglePascal[i][i - 1] = i;
}
/*if (i > 2){
trianglePascal[i][2] = i * (i - 1) / 2;
}
if (i > 3 && trianglePascal[i][j] == 0){
int n = i - 3;
trianglePascal[i][3] = n * (n + 1) * (n + 2) / 6;
}*/
if (i > 1 && trianglePascal[i][j] == 0){
trianglePascal[i][j] = trianglePascal[i - 1][j -1] + trianglePascal[i - 1][j];
}
System.out.print(trianglePascal[i][j] + " ");
}
System.out.println();
}
}
}
|
/*
* Copyright 2016 Andrei Zaiats.
*
* 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 io.github.azaiats.androidmvvm.core.delegates;
import android.app.Activity;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import io.github.azaiats.androidmvvm.core.common.MvvmView;
import io.github.azaiats.androidmvvm.core.common.MvvmViewModel;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertSame;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* @author Andrei Zaiats
*/
public class ActivityDelegateTest {
@Mock
private ActivityDelegateCallback callback;
@Mock
private Activity activity;
@Mock
private MvvmViewModel viewModel;
@Mock
private MvvmView view;
@InjectMocks
private ActivityDelegate activityDelegate;
@Before
public void init() {
MockitoAnnotations.initMocks(this);
}
@Test
public void testDestroyViewModelWhenInBackStack() {
activityDelegate.viewModel = viewModel;
when(activity.isChangingConfigurations()).thenReturn(false);
activityDelegate.onRetainCustomNonConfigurationInstance();
verify(viewModel).onDestroy();
}
@Test
public void testNotDestroyViewModelOnConfigurationChange() {
activityDelegate.viewModel = viewModel;
when(activity.isChangingConfigurations()).thenReturn(true);
activityDelegate.onRetainCustomNonConfigurationInstance();
verify(viewModel, never()).onDestroy();
}
@Test
public void testNoNullPointerOnDestroyViewModelIfAlreadyRemoved() {
when(activity.isChangingConfigurations()).thenReturn(true);
assertNull(activityDelegate.viewModel);
activityDelegate.onDestroy();
}
@Test
public void testNotCacheViewModelWhenInBackStack() {
activityDelegate.viewModel = viewModel;
when(activity.isChangingConfigurations()).thenReturn(false);
assertNull(activityDelegate.onRetainCustomNonConfigurationInstance());
}
@Test
public void testCacheViewModelOnConfigurationChange() {
activityDelegate.viewModel = viewModel;
when(activity.isChangingConfigurations()).thenReturn(true);
activityDelegate.onRetainCustomNonConfigurationInstance();
assertSame(viewModel, activityDelegate.onRetainCustomNonConfigurationInstance());
}
@Test
public void testDelegateToActivityFinishingCheck() {
when(activity.isChangingConfigurations()).thenReturn(false).thenReturn(true);
assertTrue(activityDelegate.isFinished());
assertFalse(activityDelegate.isFinished());
}
@Test
public void testGetCachedViewModelFromCallback() {
when(callback.getLastCustomNonConfigurationInstance()).thenReturn(viewModel);
assertSame(activityDelegate.getCachedViewModel(), viewModel);
}
}
|
package edu.lab.server.coodinator.client;
import edu.lab.server.coodinator.communication.Request;
import edu.lab.server.coodinator.communication.RequestCode;
import edu.lab.server.coodinator.communication.Response;
import edu.lab.server.coodinator.communication.requests.RequestFactory;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
public class ClientForIgorImpl{
private static final int MAX_BUFFER_SIZE = 255;
private static final Integer registryPort = 3333;
private String host;
private final Integer port;
public ClientForIgorImpl(String host, Integer port) {
this.host = host;
this.port = port;
}
public byte[] getActualListOfPlayers() {
try (DatagramSocket socket = new DatagramSocket()) {
System.out.println("Создаю реквест");
Request getTableRequest = RequestFactory.createRequest(RequestCode.GET_TABLE);
byte[] msg = getTableRequest.getPacket();
DatagramPacket packet = new DatagramPacket(msg, msg.length);
System.out.println("Реквест создан");
socket.connect(InetAddress.getByName(host), registryPort);
System.out.println("Подключился к Игорю");
DatagramSocket response = new DatagramSocket(port);
byte[] responseBytes = getBuffer();
DatagramPacket responsePacket = new DatagramPacket(responseBytes, responseBytes.length);
socket.send(packet);
socket.disconnect();
System.out.println("Запросил таблицу игроков");
System.out.println("Жду таблицу");
response.receive(responsePacket);
System.out.println("Получил таблицу");
response.disconnect();
response.close();
return responsePacket.getData();
} catch (IOException e) {
System.out.println(e.getMessage());
return getActualListOfPlayers();
}
}
public String registry(String info) {
try (DatagramSocket socket = new DatagramSocket()) {
Request registryRequest = RequestFactory.createRequest(RequestCode.REGISTRY, info);
byte[] msg = registryRequest.getPacket();
DatagramPacket packet = new DatagramPacket(msg, msg.length);
System.out.println("Отправляю запрос на регистрацию...");
socket.connect(InetAddress.getByName(host), registryPort);
socket.send(packet);
System.out.println("Отправил!");
byte[] responseBytes = getBuffer();
DatagramPacket responsePacket = new DatagramPacket(responseBytes, responseBytes.length);
socket.disconnect();
DatagramSocket responseSocket = new DatagramSocket(port);
System.out.println("Жду ответ...");
responseSocket.receive(responsePacket);
String myIp = Response.getMyIp(responsePacket.getData());
System.out.println("Ответ получен");
responseSocket.close();
return myIp;
} catch (IOException e) {
throw new RuntimeException("Регистрация не прошла");
}
}
private byte[] getBuffer() {
return new byte[MAX_BUFFER_SIZE];
}
}
|
package com.udacity.ranjitha.tourguide;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class CityPage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_choice);
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, new CityFragment())
.commit();
}
}
|
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ScrollPaneLayout;
import javax.swing.SwingConstants;
/**
* Create a Calendar (View Portion)
*
* @author Arselan
*/
public class MainView {
/**
* Populates the day panel with events that have been added to the data
* model
*/
private static EventModel model;
private final Calendar cal;
private final JLabel monthLabel = new JLabel();
private final JPanel monthPanel;
private final JPanel dayPanel;
static JTextField jt;
JPanel w;
ArrayList<Event> events;
EventField[] eventfields = new EventField[48];
JLabel topday;
static String name;
static String date;
static String start;
static String end;
JFrame frame;
JTextField j;
JPanel timePanel;
private final String[] MONTHS = { "January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December" };
private final String[] DAYS = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
private final String[] TIME = { "12am", "1am", "2am", "3am", "4am", "5am", "6am", "7am", "8am", "9am", "10am",
"11am", "12pm", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm", "9pm", "10pm", "11pm", "12pm" };
/**
* Constructs a new Main View using an EventModel data model.
*
* @param model
* is required to produce the correct data for the view.
*/
public MainView(final EventModel model) {
// Initializes model variable
this.model = model;
this.cal = model.getCal();
events = model.getEvents();
topday = new JLabel(DAYS[cal.get(Calendar.DAY_OF_WEEK) - 1] + " " + (cal.get(Calendar.MONTH) + 1) + "/"
+ cal.get(Calendar.DAY_OF_MONTH), SwingConstants.CENTER);
topday.setBackground(Color.WHITE);
// Initialazes and setsup buttons
JButton createButton = new JButton("Create");
createButton.setBackground(Color.red);
createButton.setForeground(Color.WHITE);
JButton previousButton = new JButton("<");
previousButton.setBackground(Color.white);
JButton nextButton = new JButton(">");
nextButton.setBackground(Color.white);
JButton quitButton = new JButton("quit");
quitButton.setBackground(Color.white);
JButton deleteButton = new JButton("delete");
deleteButton.setBackground(Color.red);
/*
* CONTROLLER used for main view. This changes the model by adding or
* subtracting a day , create event or quit the application.
*/
quitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// for(int i=0;i<events.size();i++){
// Event et=events.get(i);
// EventsFiler.saveEvent(et);
// }
System.exit(0);
}
});
createButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
CreateEventView cev = new CreateEventView(model);
}
});
deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//ArrayList<Event> events = model.getEvents();
for (int i=0;i<events.size();i++) {
Event ee=events.get(i);
model.clearEvent(ee);;
}
}
});
previousButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
model.previousDay();
}
});
nextButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
model.nextDay();
}
});
// Adds buttons to button panel
JPanel buttonPanel = new JPanel();
buttonPanel.add(createButton);
buttonPanel.add(previousButton);
buttonPanel.add(nextButton);
buttonPanel.add(quitButton);
buttonPanel.add(deleteButton);
buttonPanel.setBackground(Color.WHITE);
// Sets up month panel and calls drawMonth to fill in initial data
monthPanel = new JPanel();
monthPanel.setLayout(new GridLayout(0, 7, 5, 5));
monthPanel.setBorder(new EmptyBorder(0, 10, 0, 0));
monthPanel.setBackground(Color.white);
JPanel monthWrap = new JPanel();
monthWrap.setLayout(new BoxLayout(monthWrap, BoxLayout.Y_AXIS));
monthWrap.add(monthLabel);
monthWrap.add(monthPanel);
monthWrap.setBackground(Color.WHITE);
drawMonth(monthPanel);
// Sets up day view and puts in a scroll pane
JScrollPane scroll = new JScrollPane();
dayPanel = new JPanel();
timePanel = new JPanel();
dayPanel.setLayout(new BoxLayout(dayPanel, BoxLayout.PAGE_AXIS));
dayPanel.setBackground(Color.WHITE);
dayPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
dayPanel.setLayout(new GridLayout(48, 1, 0, 0));
JPanel w = new JPanel();
w = new JPanel(new BorderLayout());
w.add(timePanel, BorderLayout.WEST);
w.add(dayPanel, BorderLayout.CENTER);
w.add(topday, BorderLayout.NORTH);
drawDay(dayPanel);
scroll.getViewport().add(w);
scroll.setPreferredSize(new Dimension(600, 200));
scroll.setVerticalScrollBarPolicy(ScrollPaneLayout.VERTICAL_SCROLLBAR_ALWAYS);
// Adds all panels to frame and sets up frame
frame = new JFrame();
frame.add(buttonPanel, BorderLayout.NORTH);
frame.add(monthWrap, BorderLayout.WEST);
frame.add(scroll, BorderLayout.EAST);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
// Calendar c=new GregorianCalendar();
// Date b=c.getTime();
// SimpleDateFormat fg=new SimpleDateFormat("HH");
// SimpleDateFormat hh=new SimpleDateFormat("mm");
// String s=fg.format(b);
// String m=hh.format(b);
// System.out.println(m);
// System.out.println(s);
}
/**
* draws the event window in the Calendar application
*
* @param dayPanel,
* everything related to the particular day is attached to the
* day panel (right part)
*/
private void drawDay(JPanel dayPanel) {
for (int i = 0; i < 48; i++) {
EventField jt = new EventField(30);
jt.setBackground(Color.WHITE);
jt.setEditable(false);
dayPanel.add(jt);
eventfields[i] = jt;
}
timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.Y_AXIS));
timePanel.setBackground(Color.WHITE);
timePanel.setLayout(new GridLayout(24, 1, 0, 0));
Calendar c = new GregorianCalendar();
int sm = c.getActualMaximum(Calendar.HOUR_OF_DAY);
int s = c.getActualMinimum(Calendar.HOUR_OF_DAY);
// for(int i=s+1;i<=sm+1;i++)
for (int i = 0; i < 24; i++)
// for(int i=0;i<TIME.length;i++)
{
JPanel p = new JPanel();
p.setLayout(new BoxLayout(dayPanel, BoxLayout.PAGE_AXIS));
p.setBackground(Color.WHITE);
p.setLayout(new GridLayout(2, 1, 0, 0));
j = new JTextField(5);
j.setEditable(false);
int hour = i;
String m = "PM";
if (hour < 12) {
m = "AM";
}
if (hour == 0) {
hour += 12;
}
if (hour > 12) {
hour -= 12;
}
j.setText("" + hour + m);
// j.setText(i+":"+"00");
// j.setText(TIME[i]);
j.setHorizontalAlignment(JTextField.RIGHT);
j.setBorder(null);
JTextField o = new JTextField(5);
p.add(j);
o.setBorder(null);
o.setEditable(false);
p.add(o);
p.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
timePanel.add(p);
}
ArrayList<Event> todaysEvents = model.getEvents();
for (int i = 0; i < events.size(); i++) {
Event e = todaysEvents.get(i);
if (e.start.get(Calendar.DAY_OF_MONTH) == cal.get(Calendar.DAY_OF_MONTH)) {
Date startDate = e.start.getTime();
Date endDate = e.end.getTime();
SimpleDateFormat sf = new SimpleDateFormat("hh:mm aa");
SimpleDateFormat fg = new SimpleDateFormat("HH");
String starttimehour = fg.format(startDate);
int starthour = Integer.parseInt(starttimehour);
SimpleDateFormat hh = new SimpleDateFormat("mm");
String starttimemin = hh.format(startDate);
int startmin = Integer.parseInt(starttimemin);
String endtime = sf.format(endDate);
// int endt=Integer.parseInt(endtime);
int index = starthour * 2;
if (startmin >= 30) {
index++;
}
eventfields[index].setText(e.eventname +" "+ sf.format(startDate) + " - " + sf.format(endDate));
eventfields[index].setEvent(e);
index++;
// if(endtime != null)
{
String endtimehour = fg.format(endDate);
int endhour = Integer.parseInt(endtimehour);
// String endtimemin=hh.format(endtime);
// int endmin=Integer.parseInt(endtimemin);
while (index / 2 < endhour) {
eventfields[index].setText(e.eventname +" "+ sf.format(startDate) + " - " + sf.format(endDate));
eventfields[index].setEvent(e);
index++;
}
{
eventfields[index].setText(e.eventname +" "+ sf.format(startDate) + " - " + sf.format(endDate));
eventfields[index].setEvent(e);
index++;
}
{
eventfields[index].setText(e.eventname +" "+ sf.format(startDate) + " - " + sf.format(endDate));
eventfields[index].setEvent(e);
index++;
}
}
}
}
}
public void deleteEvent()
{
int index=0;
}
/**
* This forces the repainting of all variable items in main view. It starts
* by removing all previous items then redrawing with updated data
*/
public void repaint() {
monthPanel.removeAll();
drawMonth(monthPanel);
monthPanel.revalidate();
monthPanel.repaint();
dayPanel.removeAll();
timePanel.removeAll();
drawDay(dayPanel);
dayPanel.revalidate();
dayPanel.repaint();
// timePanel.revalidate();
// timePanel.repaint();
}
/**
* Takes a panel and populates it with the month set in the data model.
*
* @param monthPanel,
* everything related to the monthly calendar is attached to
* month panel( left part)
*/
private void drawMonth(JPanel monthPanel) {
monthLabel.setText(new SimpleDateFormat("MMM yyyy").format(cal.getTime()));
// Add Week Labels at top of Month View
String[] daysOfWeek = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
for (int i = 0; i < 7; i++) {
// JLabel day = new JLabel("<html><u>" + daysOfWeek[i] +
// "</u></html>");
JLabel day = new JLabel(daysOfWeek[i]);
monthPanel.add(day);
}
// Add days in month
int daysInMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
Calendar getStart = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
int startDay = getStart.get(Calendar.DAY_OF_WEEK);
for (int i = 1; i < daysInMonth + startDay; i++) {
if (i < startDay) {
final JLabel day = new JLabel("");
monthPanel.add(day);
} else {
int dayNumber = i - startDay + 1;
final JLabel day = new JLabel(dayNumber + "");
day.addMouseListener(new MouseListener() {
// CONTROLLER updates the model on the currently looked day
@Override
public void mouseClicked(MouseEvent e) {
int num = Integer.parseInt(day.getText());
model.setDay(num);
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
if (dayNumber == cal.get(Calendar.DAY_OF_MONTH)) {
day.setBorder(BorderFactory.createLineBorder(Color.blue));
}
monthPanel.add(day);
}
}
}
}
|
/*
* #%L
* Janus
* %%
* Copyright (C) 2014 KIXEYE, 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.
* #L%
*/
package com.kixeye.janus.client.http;
import java.io.InputStream;
import java.util.Collection;
import java.util.Map;
import com.google.common.base.Preconditions;
/**
* Represents an http request.
*
* @author ebahtijaragic@kixeye.com
*/
public class HttpRequest extends HttpPayload {
private HttpMethod method;
/**
* @param method the http method of the request
* @param headers the headers of the request
* @param body the body of the request
*/
public HttpRequest(HttpMethod method, Map<String, Collection<String>> headers, InputStream body) {
super(headers, body);
setMethod(method);
}
/**
* @return the method
*/
public HttpMethod getMethod() {
return method;
}
/**
* @param method the method to set
*/
public void setMethod(HttpMethod method) {
Preconditions.checkNotNull(method, "'method' cannot be null");
this.method = method;
}
}
|
package fr.pederobien.uhc.dictionary.dictionaries;
import fr.pederobien.uhc.dictionary.IDictionary;
public class DictionaryFactory {
private static IDictionary englishDictionary;
private static IDictionary frenchDictionary;
public static synchronized IDictionary createEnglishDictionary() {
if (englishDictionary == null)
englishDictionary = new EnglishDictionary();
return englishDictionary;
}
public static synchronized IDictionary createFrenchDictionary() {
if (frenchDictionary == null)
frenchDictionary = new FrenchDictionary();
return frenchDictionary;
}
}
|
package com.cnk.travelogix.v2.controller;
import java.io.File;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import com.coxandkings.integ.suppl.acco.OTAHotelAvailRQWrapper;
import com.coxandkings.integ.suppl.acco.OTAHotelGetCancellationPolicyRQWrapper;
import com.coxandkings.integ.suppl.acco.OTAHotelResModifyRQWrapper;
import com.coxandkings.integ.suppl.acco.OTAHotelResRQWrapper;
import com.coxandkings.integ.suppl.acco.OTAReadRQWrapper;
import com.coxandkings.integ.suppl.accointerface.AccoInterfaceRQ;
import com.coxandkings.integ.suppl.accointerface.AccoInterfaceRS;
import com.coxandkings.integ.suppl.airinterface.AirInterfaceRS;
@Controller
@RequestMapping(value = "/{baseSiteId}/ota")
public class OtaAccomController {
private static final Logger LOG = LoggerFactory.getLogger(OtaAccomController.class);
// Acco Search
//@Secured({ "ROLE_CUSTOMERGROUP", "ROLE_TRUSTED_CLIENT", "ROLE_CUSTOMERMANAGERGROUP" })
@RequestMapping(value = "/accoSearch", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS search(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse;
List<OTAHotelAvailRQWrapper> otaAvailRQWrapper = accoInterfaceRQ.getRequestBody().getOTAHotelAvailRQWrapper();
for (OTAHotelAvailRQWrapper otaHotelAvailRQWrapper : otaAvailRQWrapper) {
LOG.info("target Name" + otaHotelAvailRQWrapper.getOTAHotelAvailRQ().getTargetName());
}
accoInterfaceResponse = getResponseFromXml("GetAvailabilityAndPriceRS.xml");
return accoInterfaceResponse;
}
// Acco cancel Passenger
@RequestMapping(value = "/cancelBooking", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS cancelBooking(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("CancelBookingRS.xml");
return accoInterfaceResponse;
}
// Acco cancel Passenger
@RequestMapping(value = "/cancelPassenger", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS cancelPassenger(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("CancelPassengerRS.xml");
return accoInterfaceResponse;
}
// Acco create Booking
@RequestMapping(value = "/createBooking", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS booking(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
List<OTAHotelResRQWrapper> otaAvailRsWrapper = accoInterfaceRQ.getRequestBody().getOTAHotelResRQWrapper();
for (OTAHotelResRQWrapper otaHotelResRQWrapper : otaAvailRsWrapper) {
LOG.info("Discount " + otaHotelResRQWrapper.getOTAHotelResRQ().getHotelReservations().getHotelReservation()
.get(0).getRoomStays().getRoomStay().get(0).getDiscount());
}
accoInterfaceResponse = getResponseFromXml("CreateBookingRS.xml");
return accoInterfaceResponse;
}
// Acco get Details
@RequestMapping(value = "/getDetails", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS getDetails(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
String otaAvailRsWrapper = accoInterfaceRQ.getRequestBody().getOTAHotelAvailRQWrapper().get(0)
.getOTAHotelAvailRQ().getAvailRequestSegments().getAvailRequestSegment().get(0).getHotelSearchCriteria()
.getCriterion().get(0).getHotelRef().get(0).getHotelCode();
LOG.info("Hotel Code" + otaAvailRsWrapper);
accoInterfaceResponse = getResponseFromXml("GetDetailsRS.xml");
return accoInterfaceResponse;
}
// Acco get Policies
@RequestMapping(value = "/getPolicies", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS getPolicies(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse;
List<OTAHotelGetCancellationPolicyRQWrapper> otaAvailRsWrapper = accoInterfaceRQ.getRequestBody()
.getOTAHotelGetCancellationPolicyRQWrapper();
for (OTAHotelGetCancellationPolicyRQWrapper otaHotelGetCancellationPolicyRQWrapper : otaAvailRsWrapper) {
LOG.info("Cancellation Policy Supplier "
+ otaHotelGetCancellationPolicyRQWrapper.getOTAHotelGetCancellationPolicyRQ().getSupplier());
}
accoInterfaceResponse = getResponseFromXml("GetpoliciesRS.xml");
return accoInterfaceResponse;
}
// Acco Modification or add room
@RequestMapping(value = "/addRoom", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoAddRoom(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
List<OTAHotelResModifyRQWrapper> otaAvailRsWrapper = accoInterfaceRQ.getRequestBody()
.getOTAHotelResModifyRQWrapper();
for (OTAHotelResModifyRQWrapper otaHotelResModifyRQWrapper : otaAvailRsWrapper) {
LOG.info("Modificatin Supplier id" + otaHotelResModifyRQWrapper.getSupplierID());
}
accoInterfaceResponse = getResponseFromXml("Modification(AddRooms)RS.xml");
return accoInterfaceResponse;
}
// Acco RePrice
@RequestMapping(value = "/rePrice", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoRePrice(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
List<OTAHotelAvailRQWrapper> otaAvailRsWrapper = accoInterfaceRQ.getRequestBody().getOTAHotelAvailRQWrapper();
for (OTAHotelAvailRQWrapper otaHotelAvailRQWrapper : otaAvailRsWrapper) {
LOG.info("Supplier Id" + otaHotelAvailRQWrapper.getSupplierID());
LOG.info("Sequence Id " + otaHotelAvailRQWrapper.getSequence());
}
accoInterfaceResponse = getResponseFromXml("RePriceRS.xml");
return accoInterfaceResponse;
}
// Acco Retriev Booking
@RequestMapping(value = "/retrieveBooking", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoRetrievBooking(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
List<OTAReadRQWrapper> otaAvailRsWrapper = accoInterfaceRQ.getRequestBody().getOTAReadRQWrapper();
for (OTAReadRQWrapper otaReadRQWrapper : otaAvailRsWrapper) {
LOG.info("Supplier Id" + otaReadRQWrapper.getSupplierID());
LOG.info("Sequence" + otaReadRQWrapper.getSequence());
}
accoInterfaceResponse = getResponseFromXml("RetrieveBookingRS.xml");
return accoInterfaceResponse;
}
// Acco Retrieve Booking List
@RequestMapping(value = "/retrieveBookingList", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoRetrieveBookingList(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("RetrieveBookingListRS.xml");
return accoInterfaceResponse;
}
// Acco add passenger
@RequestMapping(value = "/addPassenger", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoAddPassenger(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
List<OTAHotelResModifyRQWrapper> otaHotelResModifyRQWrapper = accoInterfaceRQ.getRequestBody().getOTAHotelResModifyRQWrapper();
for (OTAHotelResModifyRQWrapper oTAHotelResModifyRQWrapper : otaHotelResModifyRQWrapper) {
LOG.info("Supplier Id "+oTAHotelResModifyRQWrapper.getSupplierID());
}
accoInterfaceResponse = getResponseFromXml("AddPassengerRS.xml");
return accoInterfaceResponse;
}
// Acco update passenger
@RequestMapping(value = "/updatePassenger", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoUpdatePassenger(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("UpdatePassengerRS.xml");
return accoInterfaceResponse;
}
// on request booking update
@RequestMapping(value = "/requestBookingUpdate", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoRequestBookingUpdate(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("OnRequestBookingUpdateRS.xml");
return accoInterfaceResponse;
}
//Cancel Room
@RequestMapping(value = "/cancelRoom", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoCancelRoom(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("CancelRoomRS.xml");
return accoInterfaceResponse;
}
// Acco update room
@RequestMapping(value = "/updateRoom", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoUpdateRoom(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("UpdateRoomRS.xml");
return accoInterfaceResponse;
}
// Acco change period of stay
@RequestMapping(value = "/changePeriodOfStay", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoChangePeriodOfStay(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse ;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("ChangePeriodOfStayRS.xml");
return accoInterfaceResponse;
}
// Acco ancillary booking
@RequestMapping(value = "/ancillaryBooking", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public AccoInterfaceRS accoAncillayBooking(@RequestBody final AccoInterfaceRQ accoInterfaceRQ) {
AccoInterfaceRS accoInterfaceResponse;
LOG.info("Acco Interface Request" + accoInterfaceRQ);
accoInterfaceResponse = getResponseFromXml("AncillaryBookingRS.xml");
return accoInterfaceResponse;
}
public AccoInterfaceRS getResponseFromXml(String xmlName)
{
AccoInterfaceRS airInterfaceResponse = null;
try {
ClassLoader cl = getClass().getClassLoader();
File file = new File(cl.getResource("AirXmls/"+xmlName).getFile());
JAXBContext jaxbContext = JAXBContext.newInstance(AirInterfaceRS.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
airInterfaceResponse = (AccoInterfaceRS) jaxbUnmarshaller.unmarshal(file);
LOG.info("Air Response" + airInterfaceResponse);
} catch (JAXBException e) {
LOG.info("JAXB Exception"+e.getMessage(),e);
}
return airInterfaceResponse;
}
}
|
package findMissing;
import java.util.ArrayList;
public class findMissing{
public int findMissing(ArrayList<BitInteger> array){
return findMissing(array, 0);
}
public int findMissing(ArrayList<BitInteger> input, int column){
if(column >= BitInteger.INTEGER_SIZE){
return 0;
}
ArrayList<BitInteger> oneBits = new ArrayList<BitInteger>(input.size()/2);
ArrayList<BitInteger> zeroBits = new ArrayList<BitInteger>(input.size()/2);
for(BitInteger t:input){
if(t.fetch(column) == 0){
zeroBits.add(t);
}else{
oneBits.add(t);
}
}
if(zeroBits.size()<=oneBits.size()){
int v = findMissing(zeroBits,column+1);
return (v<<1)|0;
}else{
int v = findMissing(oneBits,column+1);
return (v<<1)|1;
}
}
}
|
package voc.cn.cnvoccoin.network;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import voc.cn.cnvoccoin.util.ToastUtil;
public class HttpResponseParser {
private static final String SOCKET_TIMEOUT_EXCEPTION = "请求超时";
private static final String CONNECT_EXCEPTION = "网络连接异常,请检查您的网络状态";
private static final String UNKNOWN_HOST_EXCEPTION = "网络异常,请检查您的网络状态";
// public static void parse(int code,String tip) {
// switch (code) {
// case StatusCode.DEVICE_NOT_AVAILABLE_ERROR_CODE:
// Activity context = AppUtil.getCurrentActivity();
// if(context != null){
// final YHDialog yhDialog = new YHDialog(context);
// yhDialog.setWidth(300);
// yhDialog.setCancelOnTouchOutside(false);
// yhDialog.setMessage(tip);
// yhDialog.setOnComfirmClick(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// yhDialog.dismiss();
// Intent intent = new Intent();
// intent.setAction("yh.action.LoginActivity");
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// YHShopApplication.getInstance().startActivity(intent);
// }
// });
// yhDialog.setConfirm("确定");
// yhDialog.setCancel(null);
// yhDialog.setMessageColor("#000000");
// yhDialog.setConfirmColor("#0498F3");
// yhDialog.show();
// }
// break;
// case StatusCode.INVALID_ACCESS_TOKEN_CODE:
// ToastUtil.showToast("登录过期,请重新登录");
// Intent intent = new Intent();
// intent.setAction("yh.action.LoginActivity");
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// YHShopApplication.getInstance().startActivity(intent);
// break;
// case StatusCode.ERRORCODE_TOKEN_EXPIRED:
// Activity activity = AppUtil.getCurrentActivity();
// if (activity != null) {
// validateTime(activity);
// }
// break;
// default:
// //do not parse here
// break;
// }
// }
public static <T extends Throwable> void parse(T t) {
String error = null;
if (t instanceof SocketTimeoutException) {
error = SOCKET_TIMEOUT_EXCEPTION;
} else if (t instanceof ConnectException) {
error = CONNECT_EXCEPTION;
} else if (t instanceof UnknownHostException) {
error = UNKNOWN_HOST_EXCEPTION;
}
if (!TextUtils.isEmpty(error)) {
// TODO: 17/6/6 show toast
ToastUtil.showToast(error);
}
}
/**
* JSON解析
*
* @param str json字符串
* @return ResBaseModel 返回根model
*/
public static <T> ResBaseModel<T> toJsonResBaseModel(String str) {
if (!TextUtils.isEmpty(str)) {
ResBaseModel<T> model = toJsonParse(str);
return model;
}
return null;
}
/**
* JSON解析
*
* @param str json字符串
* @param cls 返回model的class
* @return T 返回cls的model
*/
public static <T> T toJsonDataModel(String str, Class<T> cls) {
if (!TextUtils.isEmpty(str)) {
try {
Gson gson = new Gson();
JsonObject jsonObject = new JsonParser().parse(str).getAsJsonObject();
if (jsonObject.has("data")) {
JsonObject data = jsonObject.getAsJsonObject("data");
return gson.fromJson(data, cls);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
/**
* JSON解析
*
* @param str json字符串
* @return T 返回cls的model
*/
public static <T> List<T> toJsonListModel(String str, Class<T> cls) {
String jsonList = getData(str);
if (!TextUtils.isEmpty(jsonList)) {
try {
ArrayList<T> list = new ArrayList<T>();
Gson gson = new Gson();
JsonArray array = new JsonParser().parse(jsonList).getAsJsonArray();
for (final JsonElement elem : array) {
list.add(gson.fromJson(elem, cls));
}
return list;
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
public static String getData(String str) {
if (!TextUtils.isEmpty(str)) {
try {
JsonObject jsonObject = new JsonParser().parse(str).getAsJsonObject();
if (jsonObject.has("data")) {
return jsonObject.get("data").toString();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
private static <T> ResBaseModel<T> toJsonParse(String str) {
ResBaseModel<T> model = new Gson().fromJson(str, new TypeToken<ResBaseModel<T>>() {
}.getType());
/* if (model.now > 0) {
ServerTime.getDefault().syncTimeStamp(model.now);
}*/
return model;
}
public static <T> T toJsonResBaseModel(String response, final Type type)
{
Gson gson = new Gson();
Type resultType = new ParameterizedType() {
@Override
public Type[] getActualTypeArguments() {
return new Type[]{type};
}
@Override
public Type getOwnerType() {
return null;
}
@Override
public Type getRawType() {
return ResBaseModel.class;
}
};
return gson.fromJson(response, resultType);
}
/**
* token过期弹窗
*
* @return
*/
// public static final int REFRESH_TOKEN = 1;
//
// public static void validateTime(Context context) {
// SharedPreferences preferences = context.getSharedPreferences(
// ShopPreferenceConstant.PREFERENCE, Context.MODE_PRIVATE);
// SharedPreferences.Editor editor = preferences.edit();
// editor.remove(ShopPreferenceConstant.BAR_CODE);
// editor.remove(ShopPreferenceConstant.MEMBER_POSTOKEN);
// editor.commit();
// final YHDialog yhDialog = new YHDialog(context);
// yhDialog.setWidth(600);
// yhDialog.setCancelOnTouchOutside(false);
// yhDialog.setMessage(context.getString(R.string.token_past_due));
// yhDialog.setOnComfirmClick(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// yhDialog.dismiss();
// Intent intent = new Intent();
// intent.setAction("yh.action.ScanCardGuideActivity");
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.putExtra("refresh_token", REFRESH_TOKEN);
// YHShopApplication.getInstance().startActivity(intent);
// }
// });
// yhDialog.setConfirm(context.getString(R.string.close_hint_know));
// yhDialog.setCancel(null);
// yhDialog.setMessageColor("#000000");
// yhDialog.setConfirmColor("#0498F3");
// yhDialog.show();
// }
}
|
package com.sree.mapreduce.training.forums.toptags;
import java.io.IOException;
import java.util.HashMap;
import java.util.Set;
import java.util.TreeMap;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class TopTags {
public static class MapperClass extends
Mapper<LongWritable, Text, Text, MapWritable> {
String questionNodeType = "\"question\"";
HashMap<String, Integer> countMap = new HashMap<>();
@Override
public void map(LongWritable key, Text value, Context context) {
String[] tokens = value.toString().split("\\t");
if (tokens.length == 19) {
String tag = tokens[2];
String nodeType = tokens[5];
if (nodeType.equalsIgnoreCase(questionNodeType)) {
Integer tagCount = countMap.remove(tag);
if (null == tagCount) {
countMap.put(tag, Integer.valueOf(1));
} else {
countMap.put(tag,
Integer.valueOf(tagCount.intValue() + 1));
}
}
}
}
@Override
public void cleanup(Context context) throws IOException,
InterruptedException {
TreeMap<Integer, String> topTen = new TreeMap<>();
for (String value : countMap.keySet()) {
topTen.put(countMap.get(value), value);
if (topTen.size() > 10) {
topTen.remove(topTen.firstKey());
}
}
MapWritable mw = new MapWritable();
for (Integer count : topTen.keySet()) {
mw.put(new IntWritable(count.intValue()), new Text(topTen.get(count)));
context.write(new Text(""), mw);
}
}
}
public static class ReducerClass extends
Reducer<Text, MapWritable, Text, Text> {
@Override
public void reduce(Text key, Iterable<MapWritable> values,
Context context) throws IOException, InterruptedException {
TreeMap<Integer, String> topTen = new TreeMap<>();
for (MapWritable value : values) {
Set<Writable> keys = value.keySet();
for (Writable writableKey : keys) {
IntWritable count = (IntWritable) writableKey;
Text tag = (Text) value.get(writableKey);
topTen.put(Integer.valueOf(count.get()), tag.toString());
if (topTen.size() > 10) {
topTen.remove(topTen.firstKey());
}
}
}
for (Integer topKey : topTen.keySet()) {
context.write(new Text(topTen.get(topKey)), null);
}
}
}
public static void main(String[] args) throws IOException,
ClassNotFoundException, InterruptedException {
Configuration configuration = new Configuration();
Job job = new Job(configuration, "TopTenTags");
job.setJarByClass(TopTags.class);
Path inputPath = new Path(
"/home/cloudera/datasets/forum_data/forum_node.tsv");
Path outputPath = new Path("/home/cloudera/datasets/forum_data/output");
FileInputFormat.setInputPaths(job, inputPath);
FileOutputFormat.setOutputPath(job, outputPath);
job.setMapperClass(MapperClass.class);
job.setReducerClass(ReducerClass.class);
job.setInputFormatClass(TextInputFormat.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(MapWritable.class);
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
|
package com.pingcap.tools.cdb.binlog.listener;
import com.pingcap.tools.cdb.binlog.common.CDBLifeCycle;
/**
* Created by iamxy on 2017/2/20.
*/
public interface CDBEventListener extends CDBLifeCycle {
}
|
package org.Third.Chapter.CompletableFuture;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
public class TestMoreCompletableFuture {
// 1.异步任务,返回future
public static CompletableFuture<String> doSomethingOne(String id) {
// 1.1创建异步任务
return CompletableFuture.supplyAsync(() -> {
// 1.1.1休眠1s,模拟任务计算
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("one compute " + id);
return id;
});
}
// 2.开启异步任务,返回future
public static CompletableFuture<String> doSomethingTwo(String id) {
return CompletableFuture.supplyAsync(() -> {
// 2.1,休眠3s,模拟计算
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("two compute " + id);
return id;
});
}
/**
* one compute 2
* one compute 1
* two compute 4
* two compute 3
* null
* 1
* 2
* 3
* 4
*/
public static void allOf() throws InterruptedException, ExecutionException {
// 1.创建future列表
List<CompletableFuture<String>> futureList = new ArrayList<>();
futureList.add(doSomethingOne("1"));
futureList.add(doSomethingOne("2"));
futureList.add(doSomethingTwo("3"));
futureList.add(doSomethingTwo("4"));
// 2.转换多个future为一个
CompletableFuture<Void> result = CompletableFuture
.allOf(futureList.toArray(new CompletableFuture[0]));
// 3.等待所有future都完成
System.out.println(result.get());
// 4.等所有future执行完毕后,获取所有future的计算结果
CompletableFuture<List<String>> finallyResult = result.thenApply(t ->
futureList.stream().map(CompletableFuture::join).collect(Collectors.toList()));
// 5.打印所有future的结果
for (String str : finallyResult.get()) {
System.out.println(str);
}
}
/**
* one compute 2
* one compute 1
* 2
* two compute 100
* two compute 3
*/
public static void anyOf() throws InterruptedException, ExecutionException {
// 1.创建future列表
List<CompletableFuture<String>> futureList = new ArrayList<>();
futureList.add(doSomethingOne("1"));
futureList.add(doSomethingOne("2"));
futureList.add(doSomethingTwo("3"));
futureList.add(doSomethingTwo("100"));
// 2.转换多个future为一个
CompletableFuture<Object> result = CompletableFuture
.anyOf(futureList.toArray(new CompletableFuture[0]));
// 3.等待某一个future完成
System.out.println(result.get());
}
public static void main(String[] args) throws InterruptedException, ExecutionException {
// 1.allOf
allOf();
// 2.anyOf
// anyOf();
Thread.sleep(5000);
}
}
|
package com.example.healthmanage.adapter;
import android.content.Context;
import android.view.View;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.healthmanage.R;
import com.example.healthmanage.ui.activity.qualification.response.DepartmentResponse;
import java.util.List;
public class SelectOfficeAdapter extends BaseQuickAdapter<DepartmentResponse.DataBean, BaseViewHolder> {
Context mContext;
public SelectOfficeAdapter(@Nullable List<DepartmentResponse.DataBean> data,Context context) {
super(R.layout.item_choose_office_left, data);
this.mContext = context;
}
@Override
protected void convert(BaseViewHolder helper, DepartmentResponse.DataBean item) {
helper.getView(R.id.item_recycle_all).setBackgroundResource(item.isSelect()?R.color.white:R.color.color_line_grey);
helper.setText(R.id.tv_office,item.getName())
.setTextColor(R.id.tv_office,item.isSelect()?mContext.getResources().getColor(R.color.colorTxtBlue):mContext.getResources().getColor(R.color.colorTxtBlack));
helper.getView(R.id.line_blue).setVisibility(item.isSelect()?View.VISIBLE:View.GONE);
}
}
|
package com.tencent.mm.plugin.appbrand.widget;
import android.graphics.Bitmap;
class c$a {
public int gEA;
public int gEB;
public Bitmap gEv;
public String gEw;
boolean gEx;
public boolean gEy;
public String gEz;
public String mUrl;
public Bitmap sq;
private c$a() {
this.gEx = false;
aoW();
}
public /* synthetic */ c$a(byte b) {
this();
}
public final void aoW() {
this.gEy = false;
this.gEz = "";
this.gEA = 0;
this.gEB = -1;
}
}
|
/*
* Copyright (c) 2014. igitras.com
*
* 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.igitras.codegen.common.java.element.file;
import com.igitras.codegen.common.java.element.JavaDirectory;
import com.igitras.codegen.common.java.element.JavaFile;
import com.igitras.codegen.common.java.element.JavaPackage;
import com.igitras.codegen.common.java.element.enums.IsAbstract;
import com.igitras.codegen.common.java.element.enums.IsFinal;
import com.igitras.codegen.common.java.element.enums.VisitPrivilege;
import com.igitras.codegen.common.java.element.file.part.*;
import com.igitras.codegen.common.utils.StringUtils;
import java.util.Set;
/**
* Created by mason on 2014-12-01.
*/
public class JavaInterfaceFile extends JavaFile implements JavaFileInterface {
private final CopyrightPart copyrightPart;
private final JavaPackagePart packagePart;
private final JavaImportsPart importsPart;
private final JavaAnnotationsPart annotationsPart;
private final String className;
private final JavaExtendsPart extendsPart;
private final JavaFieldsPart fieldsPart;
private final JavaAbstractMethodsPart methodsPart;
private String comment;
private VisitPrivilege visitPrivilege;
public JavaInterfaceFile(String name, JavaDirectory directory) {
super(name, directory);
this.className = name;
this.packagePart = new JavaPackagePart(StringUtils.getPackageName(name));
this.copyrightPart = new CopyrightPart();
this.importsPart = new JavaImportsPart();
this.extendsPart = new JavaExtendsPart();
this.fieldsPart = new JavaFieldsPart();
this.methodsPart = new JavaAbstractMethodsPart();
this.annotationsPart = new JavaAnnotationsPart();
}
public CopyrightPart getCopyrightPart() {
return copyrightPart;
}
public JavaPackagePart getPackagePart() {
return packagePart;
}
public JavaImportsPart getImportsPart() {
return importsPart;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public VisitPrivilege getVisitPrivilege() {
return visitPrivilege;
}
public void setVisitPrivilege(VisitPrivilege visitPrivilege) {
this.visitPrivilege = visitPrivilege;
}
public String getClassName() {
return className;
}
public JavaExtendsPart getExtendsPart() {
return extendsPart;
}
public JavaFieldsPart getFieldsPart() {
return fieldsPart;
}
public JavaAbstractMethodsPart getMethodsPart() {
return methodsPart;
}
public JavaAnnotationsPart getAnnotationsPart() {
return annotationsPart;
}
@Override
protected void collectImports() {
collectJavaFilePartImports(copyrightPart.getImports());
collectJavaFilePartImports(packagePart.getImports());
collectJavaFilePartImports(importsPart.getImports());
collectJavaFilePartImports(extendsPart.getImports());
collectJavaFilePartImports(fieldsPart.getImports());
collectJavaFilePartImports(methodsPart.getImports());
}
@Override
public void withComment(String comment) {
this.comment = comment;
}
@Override
public void withPrivilege(VisitPrivilege privilege) {
this.visitPrivilege = privilege;
}
@Override
public void withAbstract(IsAbstract isAbstract) {
throw new UnsupportedOperationException("Cannot set interface class to abstract.");
}
@Override
public void withFinal(IsFinal isFinal) {
throw new UnsupportedOperationException("Cannot set interface class to final.");
}
@Override
public void preBuild() {
if (comment == null) {
comment = "";
}
if (visitPrivilege == null) {
visitPrivilege = VisitPrivilege.DEFAULT;
}
}
@Override
public void postBuild() {
}
@Override
public void addField(JavaFieldPart fieldPart) {
fieldsPart.addParts(fieldPart);
}
@Override
public void removeField(JavaFieldPart fieldPart) {
fieldsPart.getFieldParts().remove(fieldPart);
}
@Override
public void addAbstractMethod(JavaAbstractMethodPart abstractMethodPart) {
methodsPart.addParts(abstractMethodPart);
}
@Override
public void removeAbstractMethod(JavaAbstractMethodPart abstractMethodPart) {
methodsPart.getAbstractMethodParts().remove(abstractMethodPart);
}
@Override
public void addConstructor(JavaConstructorPart constructorPart) {
throw new UnsupportedOperationException("Cannnot add constructor to an interface.");
}
@Override
public void removeConstructor(JavaConstructorPart constructorPart) {
throw new UnsupportedOperationException("Cannnot remove constructor from an interface.");
}
@Override
public void addMethod(JavaMethodPart methodPart) {
throw new UnsupportedOperationException("Cannnot add non-abstract method to an interface.");
}
@Override
public void removeMethod(JavaMethodPart methodPart) {
throw new UnsupportedOperationException("Cannnot remove non-abstract method from an interface.");
}
@Override
public void addAnnotation(JavaAnnotationPart annotationPart) {
annotationsPart.addParts(annotationPart);
}
@Override
public void removeAnnotation(JavaAnnotationPart annotationPart) {
annotationsPart.getAnnotationParts().remove(annotationPart);
}
protected void collectJavaFilePartImports(Set<JavaImportPart> imports) {
if (imports.size() > 0) {
this.importsPart.addParts(imports.toArray(new JavaImportPart[imports.size()]));
}
}
}
|
package br.com.crudjpa.aplicacao;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import br.com.crudjpa.entidades.Pessoa;
public class Program {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("CRUD_JPA");
EntityManager em = emf.createEntityManager();
Pessoa p1 = new Pessoa(null, "Joćo", "joao@gmail.com");
em.getTransaction().begin();
em.persist(p1);
em.getTransaction().commit();
System.out.println("Inserido com sucesso!");
em.close();
emf.close();
}
}
|
package com.nxtlife.mgs.jpa;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.nxtlife.mgs.entity.oauth.OauthClientDetails;
public interface OauthClientDetailsJpaDao extends JpaRepository<OauthClientDetails, String> {
public OauthClientDetails findByClientId(String clientId);
@Query(value = "select clientId from OauthClientDetails")
public List<String> findClientIds();
}
|
package com.application.model.inventory;
import com.application.model.product.Product;
import java.math.BigInteger;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* This class is inventory representation of store.
* It consist of:
* <li>List of {@link Product}</li>
*/
public final class Inventory {
private static final Inventory INSTANCE = new Inventory();
private final Map<Product, BigInteger> inventories = new HashMap<>();
private Inventory() {
}
public static Inventory getInstance() {
return INSTANCE;
}
public void addToInventory(final Product product, final int count) {
if (inventories.containsKey(product)) {
inventories.put(product, inventories.get(product).add(BigInteger.valueOf(count)));
} else {
inventories.put(product, BigInteger.valueOf(count));
}
}
public void removeFromInventory(final Product product, final int count) {
inventories.computeIfPresent(product, (k, v) -> v.subtract(BigInteger.valueOf(count)));
}
public Map<Product, BigInteger> getInventories() {
return Collections.unmodifiableMap(inventories);
}
}
|
package com.sixmac.service.impl;
import com.sixmac.core.Constant;
import com.sixmac.dao.SysInsuranceDao;
import com.sixmac.entity.SysInsurance;
import com.sixmac.service.SysInsuranceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Created by Administrator on 2016/5/23 0023 下午 1:53.
*/
@Service
public class SysInsuranceServiceImpl implements SysInsuranceService {
@Autowired
private SysInsuranceDao sysInsuranceDao;
@Override
public List<SysInsurance> findAll() {
return sysInsuranceDao.findAll();
}
@Override
public Page<SysInsurance> find(int pageNum, int pageSize) {
return sysInsuranceDao.findAll(new PageRequest(pageNum - 1, pageSize, Sort.Direction.DESC, "id"));
}
@Override
public Page<SysInsurance> find(int pageNum) {
return find(pageNum, Constant.PAGE_DEF_SZIE);
}
@Override
public SysInsurance getById(Long id) {
return sysInsuranceDao.findOne(id);
}
@Override
public SysInsurance deleteById(Long id) {
SysInsurance insurance = getById(id);
sysInsuranceDao.delete(insurance);
return insurance;
}
@Override
public SysInsurance create(SysInsurance insurance) {
return sysInsuranceDao.save(insurance);
}
@Override
public SysInsurance update(SysInsurance insurance) {
return sysInsuranceDao.save(insurance);
}
@Override
@Transactional
public void deleteAll(Long[] ids) {
for (Long id : ids) {
deleteById(id);
}
}
@Override
public List<SysInsurance> findList() {
return sysInsuranceDao.findList(1);
}
}
|
package src.JsoupTest;
import org.jsoup.Jsoup;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File;
import java.io.IOException;
public class DoubanMovie {
private static String TAG = "DoubanMovie";
private static class Log {
public static void d(String tag, String msg) {
System.out.println(tag + " : " + msg);
}
}
public static void main(String[] args) throws IOException {
System.out.println("length = " + args.length);
if (args.length < 1) {
System.out.println("usage: java -cp jsoup-1.8.3.jar src.JsoupTest.DoubanMovie file");
return;
}
String filename = args[0];
File file = new File(filename);
Document doc = Jsoup.parse(file, "UTF-8");
if (doc == null) {
Log.d(TAG, "parse file fail");
return;
}
// information
Element infoElement = doc.getElementById("info");
if (infoElement != null) {
Elements spans = infoElement.getElementsByTag("span");
if (spans != null && spans.size() > 0) {
//Log.d(TAG, "span count = " + spans.size());
String className, property;
for (Element e : spans) {
// obtain genre, release date, duration
property = e.attr("property");
if (property != null && !property.isEmpty()) {
//Log.d(TAG, "property = " + property);
if (property.equals("v:genre")) {
Log.d(TAG, "hit genre : " + e.text());
} else if (property.equals("v:initialReleaseDate")) {
Log.d(TAG, "hit release date : " + e.text());
} else if (property.equals("v:runtime")) {
Log.d(TAG, "hit runtime : " + e.attr("content"));
}
}
className = e.attr("class");
if (className != null && !className.isEmpty()) {
//Log.d(TAG, "class = " + className);
if (className.equals("attrs")) {
// obtain director,script writer, actor
Elements es = e.getElementsByTag("a");
String rel;
if (es != null && es.size() > 0) {
for (Element ee : es) {
rel = ee.attr("rel");
if (rel != null) {
if (rel.equals("v:directedBy")) {
Log.d(TAG, "hit director : " + ee.text());
} else if (rel.equals("v:starring")) {
Log.d(TAG, "hit actor : " + ee.text());
} else {
Log.d(TAG, "script writer? : " + ee.text());
}
} else {
Log.d(TAG, "class attrs no rel attr");
}
}
}
} else if (className.equals("pl")) {
// obtain production area/country, spoken language, other title, imdb info
String content = e.text();
//Log.d(TAG, "content : " + e.text());
if (content != null && !content.isEmpty()) {
if (content.equals("制片国家/地区:")) {
Log.d(TAG, "hit area : " + e.nextSibling());
} else if (content.equals("语言:")) {
Log.d(TAG, "hit language : " + e.nextSibling());
} else if (content.equals("又名:")) {
Log.d(TAG, "hit other title : " + e.nextSibling());
} else if (content.equals("IMDb链接:")) {
Log.d(TAG, "hit imdb info");
Element imdbInfo = e.nextElementSibling();
if (imdbInfo != null) {
Log.d(TAG, "imdb url = "
+ imdbInfo.attr("href"));
Log.d(TAG, "imdb id = " + imdbInfo.text());
} else {
Log.d(TAG, "can not find imdb info");
}
}
}
}
}
}
} else {
Log.d(TAG, "No span in info div");
}
} else {
Log.d(TAG, "No info id");
}
// overview, get the short one if contains short and full
Elements overviewInfo = doc.select("[class=indent][id=link-report]");
if (overviewInfo != null && overviewInfo.size() > 0) {
Element overview = overviewInfo.first();
Elements spans = overview.getElementsByTag("span");
if (spans != null && spans.size() > 0) {
// short, hidden condition
String property = null;
for (Element e : spans) {
property = e.attr("property");
if (property != null && !property.isEmpty()) {
//Log.d(TAG, "property = " + property);
if (property.equals("v:summary")) {
Log.d(TAG, "hit Overview : " + e.text());
}
}
}
} else {
// other
Log.d(TAG, "Not match Overview, use this = " + overview.text());
}
} else {
Log.d(TAG, "Can not find over view");
}
}
}
|
/*
* Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.
*
* This software is the confidential and proprietary information of
* Founder. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms of the agreements
* you entered into with Founder.
*
*/
package return_finnaly_test;
import java.util.ArrayList;
public class Test1 {
public static ArrayList<Integer> al = new ArrayList<Integer>();
public static int test() {
try {
al.add(0, 1);
return al.get(0);
} finally {
al.set(0, 2);
}
}
public static void main(String[] args) {
System.out.println(test());
}
}
|
package com.smxknife.java2.classloader.urlclassloader;
/**
* @author smxknife
* 2020/8/20
*/
public class Hello {
public static void sayHello() {
System.out.println("hello...");
}
}
|
package server.server;
import org.joda.time.DateTime;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class Server {
private ServerSocket serverSocket;
private Socket clientSocket;
private BufferedReader in;
private PrintWriter out;
public void start(int port) throws IOException {
final DateTime startupDate = DateTime.now();
final CommandsService commands = new CommandsService();
serverSocket = new ServerSocket(port);
clientSocket = serverSocket.accept();
out = new PrintWriter(clientSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
while (true) {
switch (in.readLine()) {
case "help":
commands.getHelp(out);
break;
case "info":
commands.getServerInfo(out, startupDate);
break;
case "uptime":
commands.getUptime(out, startupDate);
break;
case "stop":
stop();
return;
default:
out.println("Command not found ");
}
}
}
public void stop() throws IOException {
in.close();
out.close();
clientSocket.close();
serverSocket.close();
}
}
|
package domain;
import utils.structures.OwnSet;
import utils.structures.OwnMap;
/**
* A representation of a nondeterministic finite automaton.
*
* <p>
* Used to simulate the processing of an NFA that recognizes the same language
* that a specified regular expression generates. The information about all the
* states is not easily accessible, but it should not be needed in the process
* of parsing regular expressions.
* </p>
* <p>
* Since all deterministic finite automata can be thought of as restricted NFA,
* the class also represents DFA. Whether it is also (known to be) a DFA is indicated in the
* isDFA attribute
* </p>
*
*/
public class NFA {
/**
* An attempt to cache the implicit DFA that is travelled when simulating
* the NFA Could decrease the performance requirements of simulation closer
* to that of DFA: O(mn) -> O(n) where m is the number of states in the
* automaton.
*
*/
private OwnMap<OwnSet<State>, OwnMap<Character, OwnSet<State>>> cache;
/**
* Whether simulated parts of the implicit DFA are stored and retrieved when
* suitable.
*/
private boolean cacheEnabled;
/**
* The state in which the automaton is prior to reading any input. The
* following states are determined from the transition information contained
* in the startingState
*/
private State startingState;
/**
*
* The set of states that is used to determine whether the automaton accepts
* or rejects an input string.
*
*/
private OwnSet<State> acceptingStates;
/**
* Special attribute that is false by default and only needed with some
* regexes that contain negation. If true, accepting states actually
* indicate all the states that are NOT accepting: every other state is
* accepting, in such a case.
*/
private boolean inverted;
/**
* Indicates whether the NFA meets the stricter criteria of DFA. The NFA can
* theoretically be DFA even with this value being false; the important part
* is that true means it absolutely certainly is.
*/
private boolean isDFA;
/**
* Creates an empty NFA.
*/
public NFA() {
this(new State(0), new OwnSet());
}
/**
*
* Creates the NFA specified by the state information in parameters.
*
* @param startingState The initial state of the NFA
* @param acceptingStates These states result in acceptance
*/
public NFA(State startingState, OwnSet<State> acceptingStates) {
this(startingState, acceptingStates, false);
}
/**
*
*
* @param startingState The initial state
* @param acceptingStates All states that lead to acceptance
* @param isDFA If created object is certain to be DFA, this should be true.
* False by default.
*/
public NFA(State startingState, OwnSet<State> acceptingStates, boolean isDFA) {
this(startingState, acceptingStates, isDFA, true);
}
public NFA(State startingState, OwnSet<State> acceptingStates, boolean isDFA, boolean cacheEnabled) {
this.startingState = startingState;
this.acceptingStates = acceptingStates;
this.isDFA = isDFA;
this.cacheEnabled = cacheEnabled;
cache = new OwnMap();
inverted = false;
}
/**
*
* Changes the starting state to the given state.
*
* @param state New starting state
*/
public void setStartingState(State state) {
this.startingState = state;
}
/**
*
* @return State at which NFA begins.
*/
public State getStartingState() {
return this.startingState;
}
/**
* Begin caching simulation results
*/
public void enableCaching(){
this.cacheEnabled = true;
}
/**
* Stop caching simulation results
*/
public void disableCaching(){
this.cacheEnabled = false;
}
/**
*
* @return Cache containing transition information between sets of states
*/
public OwnMap<OwnSet<State>, OwnMap<Character, OwnSet<State>>> getCache(){
return this.cache;
}
/**
*
* Changes the accepting states to the given set
*
* @param states Set of new accepting states.
*/
public void setAcceptingStates(OwnSet<State> states) {
this.acceptingStates = states;
}
/**
*
* @return The set of accepting states.
*/
public OwnSet<State> getAcceptingStates() {
return this.acceptingStates;
}
/**
*
* Returns whether the NFA accepts or rejects the input string.
*
*
* <p>
* Simulates the operation of the NFA step by step when given the test
* string as input. The method keeps track of all the possible states that
* the NFA could be in at any given step. At first the method initializes
* the set of currents states to include only the starting state of the NFA.
* </p>
* <p>
* For every character the method checks if the next set of states has already
* been calculated from the current set with the current symbol. If not,
* the method queries each current state for the set of states that can be
* accessed with the input symbol. These sets of states from each current
* state are combined to form the set of all the states that the automaton
* can be in after it has processed the next symbol character. This
* set is expanded with all the states that are reachable from its states
* with only empty transitions. Then the
* current states are replaced with the next states, and the next symbol of
* the test string is processed similarly until they end.
* </p>
* <p>
* If at any point the set of current states is empty, it is certain that
* the automaton cannot finish in an accepted state. Hence the method
* immediately returns a boolean that depends on whether the automaton has been
* inverted.
* </p>
*
* @param test Input string which is to be processed. If the string is
* empty, it is replaced with character '#', which represents the empty symbol.
*
* @return Whether any of the possible final states is an accepting one.
*/
public boolean accepts(String test) {
OwnSet<State> currentStates = new OwnSet();
currentStates.add(startingState);
addEpsilonTransitionsOfStates(currentStates);
OwnSet<State> nextStates = new OwnSet();
//Used to momentarily store the pointer to the current set, so that current set and next set point to different sets
//at the end of each cycle
OwnSet<State> empty;
for (int i = 0; i < test.length(); i++) {
char symbol = test.charAt(i);
if (cacheEnabled) {
if (cache.containsKey(currentStates) && cache.get(currentStates).containsKey(symbol)) {
currentStates = cache.get(currentStates).get(symbol).copy();
continue;
}
}
for (State currentState : currentStates) {
nextStates.addAll(currentState.getNextStatesForSymbol(symbol));
nextStates.addAll(currentState.getNextStatesWithAnyCharacter());
}
addEpsilonTransitionsOfStates(nextStates);
if (cacheEnabled) {
if (!cache.containsKey(currentStates)) {
cache.put(currentStates.copy(), new OwnMap());
}
cache.get(currentStates).put(symbol, nextStates.copy());
}
empty = currentStates;
currentStates = nextStates;
nextStates = empty;
nextStates.clear();
if (currentStates.isEmpty()) {
return inverted;
}
}
return containsAcceptingState(currentStates);
}
/**
*
* Expands the parameter set with all states that can be reached from its
* states without reading any input.
*
* <p>
* If a state can be reached by a number of epsilon/# transitions from any
* of the states of the set, is is added to the same set. Uses a helper
* method to discover transitions of different lengths.
* </p>
*
*
* @param states Set of states to be possible expanded
*/
public void addEpsilonTransitionsOfStates(OwnSet<State> states) {
addEpsilonTransitionsOfStates(states, new OwnSet());
}
/**
* Adds to the given states the unvisited states that are reachable with one
* epsilon transition
*
* <p>
* Forms a new empty set. By going through the given states, the method then
* adds to this set of new states all the states that are reachable with one
* epsilon transition and that are not in the visitedStates set. This
* decreases some extra work and prevents infinite loops in cases where two
* states have an epsilon transition to and from each other.
* </p>
* <p>
* If new states are found, the method calls itself recursively with the set
* of new states and the same set of visited states. This continues for as
* long as new states are discovered. Each call expands the chain of
* empty transitions by one.
* </p>
*
* @param states Set of states that caller wants to expand.
* @param visitedStates States that have already been considered.
*/
public void addEpsilonTransitionsOfStates(OwnSet<State> states, OwnSet<State> visitedStates) {
OwnSet<State> newStates = new OwnSet();
for (State s : states) {
if (!visitedStates.contains(s)) {
newStates.addAll(s.getNextStatesWithEmptyTransitions());
visitedStates.add(s);
}
}
if (newStates.size() > 0) {
addEpsilonTransitionsOfStates(newStates, visitedStates);
}
states.addAll(newStates);
}
/**
*
* @param isDFA Change the indicator of whether the NFA is also DFA
*/
public void setIsDFA(boolean isDFA) {
this.isDFA = isDFA;
if(isDFA){
this.disableCaching();
} else {
this.enableCaching();
}
}
/**
*
* @return Whether the NFA is certain to be DFA
*/
public boolean isDFA() {
return isDFA;
}
/**
*
* @return Whether caching of the implicit DFA is in use
*/
public boolean usesCaching(){
return this.cacheEnabled;
}
/**
* The accepting states changes in the following manner, depending on
* whether inverted is true or false: accepting -> non-accepting (false)
* non-accepting -> accepting (true)
*/
public void invert() {
this.inverted = !this.inverted;
}
/**
*
* @return True if inverted, false otherwise
*/
public boolean isInverted() {
return this.inverted;
}
/**
* Determines whether the possible final state is accepting
*
* <p>Depending on the inverted bit, correctly returns whether the given set of
* states contains an accepting state. By default inverted is false, so
* accepting states indicates actual accepting states; method returns true
* only if that set contains any state of the input state. Vice versa when
* inverted is true.</p>
*
* @param states Set of possible final states
* @return Does processing accept the input string
*/
public boolean containsAcceptingState(OwnSet<State> states) {
for (State s : states) {
if (inverted != acceptingStates.contains(s)) {
return true;
}
}
return false;
}
@Override
public boolean equals(Object o) {
if (o == null || this.getClass() != o.getClass()) {
return false;
}
NFA comp = (NFA) o;
if (inverted != comp.isInverted()) {
return false;
}
if (isDFA != comp.isDFA()) {
return false;
}
if (!startingState.equals(comp.getStartingState())) {
return false;
}
if (!acceptingStates.equals(comp.getAcceptingStates())) {
return false;
}
return true;
}
@Override
public int hashCode() {
int code = 7;
code = 31 * code + startingState.hashCode();
code = 31 * code + acceptingStates.hashCode();
code = 31 * code + 7 * (isDFA ? 1 : 0);
code = 31 * code + 7 * (inverted ? 1 : 0);
return code;
}
}
|
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class CalculatorTest {
private Calculator calculator;
@Before
public void before() {
calculator = new Calculator(10, 5, 20, 2);
}
@Test
public void has_first_number() {
assertEquals(10, calculator.getNum1());
}
@Test
public void has_second_number() {
assertEquals(5, calculator.getNum2());
}
@Test
public void calculator_can_add(){
assertEquals(15, calculator.getAddSum());
}
@Test
public void calculator_can_subtract() {
assertEquals(5, calculator.getSubtractSum());
}
@Test
public void calculator_can_multiply() {
assertEquals(50, calculator.getMultiplySum());
}
@Test
public void calculator_can_divide(){
assertEquals(10, calculator.getDivideSum(), 0.01);
}
}
|
package com.example.lucas.prototipo;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.example.lucas.prototipo.histogram.Globals;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import java.util.ArrayList;
/**
* Created by User on 2/28/2017.
*/
public class Tab2Fragment extends Fragment {
private static final String TAG = "Tab2Fragment";
int numDataPoints;
public Button btnRefresh, btnClear;
Globals globals = Globals.getInstance();
TextView tv_color, tv_max_color;
LineChart lineChart;
ArrayList<Entry> red = new ArrayList<>();
ArrayList<Entry> green = new ArrayList<>();
ArrayList<Entry> blue = new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.tab2_fragment,container,false);
btnRefresh = (Button) view.findViewById(R.id.btnRefresh);
btnClear = (Button) view.findViewById(R.id.btnClear);
lineChart = (LineChart) view.findViewById(R.id.lineChart);
tv_max_color = (TextView) view.findViewById(R.id.tv_maximum_color);
btnRefresh.setOnClickListener(clickListener);
btnClear.setOnClickListener(clickListener);
return view;
}
// Create an anonymous implementation of OnClickListener
private View.OnClickListener clickListener = new View.OnClickListener() {
public void onClick(View v) {
// do something when the button is clicked
// Yes we will handle click here but which button clicked??? We don't know
// So we will make
switch (v.getId() /*to get clicked view id**/) {
case R.id.btnRefresh:{
buildChart();
}
break;
case R.id.btnClear:{
clearChart();
}
break;
default:
break;
}
}
};
public void clearChart() {
Intent intent = new Intent(getActivity().getApplicationContext(), MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
public void buildChart(){
int[] arrayR = new int[256];
int[] arrayG = new int[256];
int[] arrayB = new int[256];
arrayR = globals.getArrayRed();
arrayG = globals.getArrayGreen();
arrayB = globals.getArrayBlue();
double x = 0.0;
//Defining the maximum amount of RGB
if (globals.getArrayRed() == null && globals.getArrayGreen() == null && globals.getArrayBlue() == null){
numDataPoints = 10;
}
else{
numDataPoints = globals.getMaxRepeated();
}
for (int i = 0; i < 255; i++) {
int redValues = arrayR[i];
int greenValues = arrayG[i];
int blueValues = arrayB[i];
int xEntry = i;
red.add(new Entry(xEntry, redValues));
green.add(new Entry(xEntry, greenValues));
blue.add(new Entry(xEntry, blueValues));
Log.d(TAG, "Populating Arrays with Data: redValues = " + redValues);
Log.d(TAG, "Populating Arrays with Data: greenValues = " + greenValues);
Log.d(TAG, "Populating Arrays with Data: blueValues = " + blueValues);
Log.d(TAG, "Populating Arrays with Data: xEntry = " + xEntry);
}
ArrayList<ILineDataSet> lineDataSets = new ArrayList<>();
LineDataSet lineDataSetRed = new LineDataSet(red,"vermelho");
LineDataSet lineDataSetGreen = new LineDataSet(green,"verde");
LineDataSet lineDataSetBlue = new LineDataSet(blue,"azul");
lineDataSetRed.setDrawCircles(false);
lineDataSetRed.setColors(Color.RED);
lineDataSetGreen.setDrawCircles(false);
lineDataSetGreen.setColors(Color.GREEN);
lineDataSetBlue.setDrawCircles(false);
lineDataSetBlue.setColors(Color.BLUE);
lineDataSets.add(lineDataSetRed);
lineDataSets.add(lineDataSetGreen);
lineDataSets.add(lineDataSetBlue);
lineChart.setData(new LineData(lineDataSets));
lineChart.setVisibleXRangeMaximum(2000f);
//can also try calling invalidate() to refresh the graph
lineChart.invalidate();
tv_max_color.setText("\nMáximo Vermelho: " + globals.getMaxRepeatedRed() + "\nMáximo Verde: " + globals.getMaxRepeatedGreen()
+ "\nMáximo Azul: " + globals.getMaxRepeatedBlue());
}
}
|
package com.ebay.lightning.client;
import java.util.ArrayList;
import java.util.List;
import com.ebay.lightning.client.caller.EmbeddedAPICaller;
import com.ebay.lightning.client.caller.RestAPICaller;
import com.ebay.lightning.client.caller.ServiceCaller;
import com.ebay.lightning.client.config.LightningClientConfig;
import com.ebay.lightning.core.config.SystemConfig;
import com.ebay.lightning.core.manager.TaskExecutionManager;
import com.ebay.lightning.core.services.TaskExecutionService;
import com.ebay.lightning.core.services.TaskExecutionServiceImpl;
import com.ebay.lightning.core.store.ExecutionDataStore;
import com.ebay.lightning.core.utils.InetSocketAddressCache;
import com.ebay.lightning.core.utils.UrlUtils;
/**
* <p>
* This is a builder class to create an instance of {@link LightningClient} with
* all required dependencies.
* </p>
*
* <p>
* The default implementation of {@link LightningClient} returned submits task
* to one of the many stand alone instances of lightning core through Rest API.
* One or many lightning core instances has to be registered with the lightning
* client via {@link #setSeeds(List)} method before calling the {@link #build()}
* method.
* </p>
*
* <pre>
* List<String> seeds = new ArrayList<String>();
* seeds.add("hostname1");
* seeds.add("hostname2");
* LightningClient client = new LightningClientBuilder()..addSeed("hostname1").setCorePort(8989).build();
* </pre>
*
* <p>
* The lightning core instance can be run in embedded mode by calling
* {@link #setEmbeddedMode(boolean)} before invoking the {@link #build()}
* method.
* </p>
*
* <pre>
* LightningClient client = new LightningClientBuilder().setEmbeddedMode(true).build();
* </pre>
*
* @author shashukla
* @see LightningClient
*/
public class LightningClientBuilder {
private UrlUtils urlUtils = new UrlUtils();
private List<String> seeds;
private List<String> crossRegionSeeds;
private String pollApiUrl = "http://{host}:port/l/poll";
private String reserveApiUrl = "http://{host}:port/l/reserve";
private String submitApiUrl = "http://{host}:port/l/submit";
private String auditApiUrl = "http://{host}:port/l/audit";
private String auditJsonApiUrl = "http://{host}:port/l/audit/json";
private String auditSummaryUrl = "http://{host}:port/l/auditSummary";
private String lightningStatsUrl = "http://{host}:port/l/lightningStats";
private String systemConfigUrl = "http://{host}:port/l/getSystemConfig";
private String systemConfigUpdateUrl = "http://{host}:port/l/updateSystemConfig";
private boolean embeddedMode = false;
private boolean allowCrossRegionInteraction = true;
private int corePort;
/**
* Creates an instance of {@link LightningClient} with all required dependencies.
*
* @return the instance of {@link LightningClient} based on the configuration parameters before calling this method.
* REST API based {@code LightningClient} is returned if {@code embeddedMode} is set to false.
* An embedded {@code LightningClient} is returned if {@code embeddedMode} is set to true
*/
public LightningClient build() {
final LightningClientConfig config = new LightningClientConfig();
config.setEmbeddedMode(embeddedMode);
ServiceCaller apiCaller = null;
if (embeddedMode) {
final SystemConfig systemConfig = new SystemConfig();
final ExecutionDataStore dataStore = new ExecutionDataStore(systemConfig);
final InetSocketAddressCache inetCache = new InetSocketAddressCache(systemConfig);
final TaskExecutionManager taskExecutionManager = new TaskExecutionManager(systemConfig, dataStore, inetCache);
taskExecutionManager.start();
final TaskExecutionService service = new TaskExecutionServiceImpl(taskExecutionManager);
apiCaller = new EmbeddedAPICaller(service);
final ArrayList<String> seedList = new ArrayList<>();
seedList.add("embeddedCoreService");
config.setSeeds(seedList);
} else {
config.setPollApiUrl(pollApiUrl.replace(":port", ":" + corePort));
config.setReserveApiUrl(reserveApiUrl.replace(":port", ":" + corePort));
config.setSeeds(seeds);
config.setSubmitApiUrl(submitApiUrl.replace(":port", ":" + corePort));
config.setAuditApiUrl(auditApiUrl.replace(":port", ":" + corePort));
config.setAuditJsonApiUrl(auditJsonApiUrl.replace(":port", ":" + corePort));
config.setAuditSummaryUrl(auditSummaryUrl.replace(":port", ":" + corePort));
config.setLightningStatsUrl(lightningStatsUrl.replace(":port", ":" + corePort));
config.setSystemConfigUrl(systemConfigUrl.replace(":port", ":" + corePort));
config.setSystemConfigUpdateUrl(systemConfigUpdateUrl.replace(":port", ":" + corePort));
config.setCrossRegionSeeds(crossRegionSeeds);
config.setAllowCrossRegionInteraction(allowCrossRegionInteraction);
apiCaller = new RestAPICaller(config, urlUtils);
}
final ServiceHostResolver resolver = new ServiceHostResolver(config, apiCaller);
return new LightningClient.LightningClientImpl(config, resolver, apiCaller);
}
/**
* Set the {@code UrlUtils}
* @param urlUtils the URL utils object to make http/https calls
* @return a reference to this object.
*/
public LightningClientBuilder setUrlUtils(UrlUtils urlUtils) {
this.urlUtils = urlUtils;
return this;
}
/**
* Set the API URL template for polling response.
*
* <p>
* Format: http://{hostname}:[port]/[some/poll/url]<br>
* Example: http://{host}:{port}/l/poll
* </p>
*
* @param pollApiUrl
* the URL template for polling response
* @return a reference to this object.
*/
public LightningClientBuilder setPollApiUrlTemplate(String pollApiUrl) {
this.pollApiUrl = pollApiUrl;
return this;
}
/**
* Set the API URL template for Reservation.
*
* <p>
* Format: http://{hostname}:[port]/[some/reservation/url]<br>
* Example: http://{host}:{port}/l/reserve
* </p>
*
* @param reserveApiUrl
* the URL template for making reservation
* @return a reference to this object.
*/
public LightningClientBuilder setReserveApiUrlTemplate(String reserveApiUrl) {
this.reserveApiUrl = reserveApiUrl;
return this;
}
/**
* Set the list of stand alone lightning core instances. The seeds are considered only when
* {@code embeddedMode} is set to false.<br>
* @param seeds the list of host names running lightning core
* @return a reference to this object.
*/
public LightningClientBuilder setSeeds(List<String> seeds) {
this.seeds = seeds;
return this;
}
/**
* Adds a single stand alone lightning core instances to the existing Seed
* List. The seeds are considered only when {@code embeddedMode} is set to
* false.<br>
*
* @param seed name of running lightning core instance
* @return a reference to this object.
*/
public LightningClientBuilder addSeed(String seed) {
if (seeds == null) {
seeds = new ArrayList<>();
}
this.seeds.add(seed);
return this;
}
/**
* Set the list of stand alone lightning core instances from different colocations.
* The cross region seeds are considered only when {@code allowCrossRegionInteraction} is set to true<br>
* @param crossRegionSeeds the list of host names on different colocations running lightning core.
* @return a reference to this object.
*/
public LightningClientBuilder setCrossRegionSeeds(List<String> crossRegionSeeds) {
this.crossRegionSeeds = crossRegionSeeds;
return this;
}
/**
* Set the API URL template for submitting request.
*
* <p>
* Format: http://{hostname}:[port]/[some/submit/url]<br>
* Example: http://{host}:{port}/l/submit
* </p>
*
* @param submitApiUrl
* the URL template for submitting tasks
* @return a reference to this object.
*/
public LightningClientBuilder setSubmitApiUrlTemplate(String submitApiUrl) {
this.submitApiUrl = submitApiUrl;
return this;
}
/**
* Set the API URL template for audit data.
*
* <p>
* Format: http://{hostname}:[port]/[some/audit/url]<br>
* Example: http://{host}:{port}/l/audit
* </p>
*
* @param auditApiUrl
* the URL template to get compressed audit data
* @return a reference to this object.
*/
public LightningClientBuilder setAuditApiUrlTemplate(String auditApiUrl) {
this.auditApiUrl = auditApiUrl;
return this;
}
/**
* Set the API URL template for audit data in JSON format.
*
* <p>
* Format: http://{hostname}:[port]/[some/audit/url]<br>
* Example: http://{host}:{port}/l/audit/json
* </p>
*
* @param auditJsonApiUrl
* the URL template to get audit data in JSON format
* @return a reference to this object.
*/
public LightningClientBuilder setAuditJsonApiUrlTemplate(String auditJsonApiUrl) {
this.auditJsonApiUrl = auditJsonApiUrl;
return this;
}
/**
* Set the API URL template to get lightning statistics.
*
* <p>
* Format: http://{hostname}:[port]/[lightningStatsUrl]<br>
* Example: http://{host}:{port}/l/lightningStats
* </p>
*
* @param lightningStatsUrl
* the URL template to get lightning statistics
* @return a reference to this object.
*/
public LightningClientBuilder setLightningStatsUrlTemplate(String lightningStatsUrl) {
this.lightningStatsUrl = lightningStatsUrl;
return this;
}
/**
* Set the API URL template for audit summary data.
*
* <p>
* Format: http://{hostname}:[port]/[some/auditSummary/url]<br>
* Example: http://{host}:{port}/l/auditSummary
* </p>
*
* @param auditSummaryUrl
* the URL template to get audit summary data
* @return a reference to this object.
*/
public LightningClientBuilder setAuditSummaryUrlTemplate(String auditSummaryUrl) {
this.auditSummaryUrl = auditSummaryUrl;
return this;
}
/**
* Set the API URL template to get system configuration.
*
* <p>
* Format: http://{hostname}:[port]/[getSystemConfigUrl]<br>
* Example: http://{host}:{port}/l/getSystemConfig
* </p>
*
* @param systemConfigUrl
* the URL template to get system configuration
* @return a reference to this object.
*/
public LightningClientBuilder setSystemConfigUrlTemplate(String systemConfigUrl) {
this.systemConfigUrl = systemConfigUrl;
return this;
}
/**
* Set the API URL template to update system configuration.
*
* <p>
* Format: http://{hostname}:[port]/[updateSystemConfigUrl]<br>
* Example: http://{host}:{port}/l/updateSystemConfig
* </p>
*
* @param systemConfigUpdateUrl
* the URL template to update system configuration
* @return a reference to this object.
*/
public LightningClientBuilder setSystemConfigUpdateUrlTemplate(String systemConfigUpdateUrl) {
this.systemConfigUpdateUrl = systemConfigUpdateUrl;
return this;
}
/**
* Set the lightning core to run in embedded mode.
* If set to {@code true}, the lightning core will run in embedded mode.
* If set to {@code false}, lightning core will run in standalone mode and has to be registered with client by calling {@link #setSeeds(List)} method.
* @param mode to run lightning core in embedded mode or standalone mode
* @return a reference to this object.
*/
public LightningClientBuilder setEmbeddedMode(boolean mode) {
this.embeddedMode = mode;
return this;
}
/**
* Set the lightning core to run in embedded mode.
* If set to {@code false}, tasks will only be submitted to lightning core running on the same colocation.
* If set to {@code true}, tasks will be submitted to lightning core running on different colocation,
* if all the lightning core instances running in the local colocations are busy.
* @param allowCrossRegionInteraction to allow submitting task to lightning core running on different colocation
* @return a reference to this object.
*/
public LightningClientBuilder setAllowCrossRegionInteraction(boolean allowCrossRegionInteraction) {
this.allowCrossRegionInteraction = allowCrossRegionInteraction;
return this;
}
/**
* Set the lightning core port. Please ensure that lightning core is running
* on this port before setting this.
*
* @param corePort
* port on which lightning core is running
* @return a reference to this object.
*/
public LightningClientBuilder setCorePort(int corePort) {
this.corePort = corePort;
return this;
}
}
|
package by.grechny.importCSV.dto;
import java.io.Serializable;
/**
* Реализация класса Contact, содержащего поля
* login, name, surname, email, phoneNumber
*/
public class Contact implements Serializable{
private String login;
private String name;
private String surname;
private String email;
private Long phoneNumber;
public void setLogin(String login){
this.login = login;
}
public String getLogin(){
return this.login;
}
public void setName(String name){
this.name = name;
}
public String getName(){
return this.name;
}
public void setSurname (String surname){
this.surname = surname;
}
public String getSurname (){
return this.surname;
}
public void setEmail (String email){
this.email = email;
}
public String getEmail (){
return this.email;
}
public void setPhoneNumber (Long phoneNumber){
this.phoneNumber = phoneNumber;
}
public Long getPhoneNumber (){
return this.phoneNumber;
}
}
|
package com.github.baloise.rocketchatrestclient.model;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Represents the different types of rooms available.
*
* @author Bradley Hilton (graywolf336)
* @since 0.1.0
* @version 0.0.1
*/
public enum RoomType {
/** Public Channel */
@JsonProperty("c")
PUBLIC_CHANNEL,
/** Direct Message */
@JsonProperty("d")
DIRECT_MESSAGE,
/** Private Group */
@JsonProperty("p")
PRIVATE_GROUP;
}
|
package com.kerbii.undersiege;
public class MobShield extends MobBase {
float shieldHealth;
public static final int[] TEXTUREARRAY = {
R.drawable.mobgenerica0,
R.drawable.mobgenerica1,
R.drawable.mobgenerica2,
R.drawable.mobgenerica3,
R.drawable.mobgenerica4,
R.drawable.mobgenerica5,
R.drawable.mobgenerica6,
R.drawable.mobgenericd0,
R.drawable.mobgenericd1,
R.drawable.mobgenericd2,
R.drawable.mobgenericd3,
R.drawable.mobgenericd4,
R.drawable.mobgenericd5,
R.drawable.mobgenericd6,
R.drawable.mobgenericd7,
R.drawable.mobgenericd8,
R.drawable.genericattack0,
R.drawable.genericattack1,
R.drawable.genericattack2,
R.drawable.genericattack3,
R.drawable.genericattack4,
R.drawable.genericattack5
};
public static int[] staticTextureIndexArray;
public MobShield(float x, float y, float health, float shieldHealth) {
super(x, y, health);
this.shieldHealth = shieldHealth;
goldMult = 2;
}
public void update(long deltaTime) {
super.update(deltaTime);
textureIndex = staticTextureIndexArray[animationIndex];
}
public float health() {
if (shieldHealth > 0) return shieldHealth;
return super.health();
}
public boolean special() {
if (shieldHealth > 0) return true;
return super.special();
}
public void hit(ArrowBase arrow, float damage) {
if (shieldHealth > 0) {
if (arrow.arrowType == SiegeVariables.FIRE || arrow.arrowType == SiegeVariables.LIGHTNING) {
hitShield(arrow, shieldHealth);
arrow.state = ArrowBase.BROKEN;
} else if (arrow.angle == 0) {
hitShield(arrow, damage);
} else if (arrow.angle <= 0) {
if (arrow.y + (arrow.x - x) * Math.tan(-arrow.angle * (Math.PI / 180)) < y + width) {
if (arrow.x < x + width / 4) {
hitShield(arrow, damage);
}
} else {
super.hit(arrow, damage);
}
} else {
if (arrow.y - (arrow.x - x) * Math.tan(arrow.angle * (Math.PI / 180)) > y) {
if (arrow.x < x + width / 4) {
hitShield(arrow, damage);
}
} else {
super.hit(arrow, damage);
}
}
} else {
super.hit(arrow, damage);
}
}
private void hitShield(ArrowBase arrow, float damage) {
shieldHealth -= damage;
if (shieldHealth > 0) {
arrow.embed(this);
arrow.x = x + width / 4;
}
}
}
|
package com.tencent.mm.plugin.exdevice.model;
import com.tencent.mm.ak.e;
import com.tencent.mm.ak.o;
import com.tencent.mm.g.a.ec;
import com.tencent.mm.model.au;
import com.tencent.mm.modelcdntran.d;
import com.tencent.mm.modelcdntran.g;
import com.tencent.mm.modelcdntran.i;
import com.tencent.mm.modelvideo.r;
import com.tencent.mm.modelvideo.s;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.pluginsdk.model.app.ao;
import com.tencent.mm.protocal.c.amw;
import com.tencent.mm.protocal.c.amx;
import com.tencent.mm.protocal.c.amz;
import com.tencent.mm.protocal.c.ana;
import com.tencent.mm.protocal.c.anb;
import com.tencent.mm.protocal.c.ate;
import com.tencent.mm.protocal.c.bsu;
import com.tencent.mm.sdk.b.b;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.bd;
import com.tencent.mm.y.g.a;
import java.io.File;
import java.util.Random;
class e$26 extends c<ec> {
final /* synthetic */ e iup;
e$26(e eVar) {
this.iup = eVar;
this.sFo = ec.class.getName().hashCode();
}
public final /* synthetic */ boolean a(b bVar) {
ec ecVar = (ec) bVar;
e eVar = this.iup;
ecVar = ecVar;
if (bi.oW(ecVar.bLS.bKv) || bi.oW(ecVar.bLS.byN)) {
ecVar.bLT.bLW = false;
} else {
String str;
Boolean valueOf;
int i;
ec.b bVar2 = ecVar.bLT;
g gVar = eVar.ium;
String str2 = ecVar.bLS.bKv;
String str3 = ecVar.bLS.byN;
String str4 = ecVar.bLS.bLU;
long j = ecVar.bLS.bJC;
String str5 = ecVar.bLS.bKW;
boolean z = ecVar.bLS.bLV;
gVar.cYP = j;
gVar.iuv = false;
gVar.iuw = z;
x.d("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "deviceType: %s, deviceId: %s", new Object[]{str2, str3});
int i2 = 0;
if (str4 == null || !str4.contains("wechat_to_device") || gVar.iuK.get(str3) == null) {
if (str4 != null && str4.contains("internet_to_device")) {
i2 = 1;
if (!z && (g.cD(j).booleanValue() || g.cC(j).booleanValue() || g.cF(j).booleanValue() || g.cE(j).booleanValue())) {
str4 = "MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice";
str5 = "mDeviceMsgForUseCdn %s deviceId %s deviceType %s";
Object[] objArr = new Object[3];
objArr[0] = Boolean.valueOf(gVar.iuG == null);
objArr[1] = str3;
objArr[2] = str2;
x.d(str4, str5, objArr);
if (gVar.iuG != null) {
au.DF().a(new n(gVar.iuG, str2, str3, 1), 0);
} else {
gVar.iuF.put(str3, str2);
if (!gVar.iuE) {
Object obj;
str4 = "";
str = "";
gVar.iuD = true;
au.HU();
bd dW = com.tencent.mm.model.c.FT().dW(j);
Object[] objArr2;
i iVar;
if (g.cD(j).booleanValue()) {
e q = o.Pf().q(dW);
str4 = o.Pf().o(q.dTL, "", "");
str = o.Pf().o(q.dTN, "", "");
gVar.dlN = q.dTK;
if (bi.oW(gVar.dVk)) {
x.i("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "createMediaId time:%d talker:%s msg:%d img:%d compressType:%d", new Object[]{Long.valueOf(dW.field_createTime), dW.field_talker, Long.valueOf(dW.field_msgId), Long.valueOf(gVar.dlN), Integer.valueOf(0)});
gVar.dVk = d.a("upimg", dW.field_createTime, dW.field_talker, dW.field_msgId + "_" + gVar.dlN + "_0");
}
g.ND();
if (!com.tencent.mm.modelcdntran.c.hz(1) && bi.oW(q.dTV)) {
objArr2 = new Object[2];
g.ND();
objArr2[0] = Boolean.valueOf(com.tencent.mm.modelcdntran.c.hz(1));
objArr2[1] = q.dTV;
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra not use cdn flag:%b getCdnInfo:%s", objArr2);
obj = null;
}
if (g.cD(j).booleanValue() || g.cE(j).booleanValue()) {
gVar.iuH = new Random().nextLong();
str4 = g.y(str4, gVar.iuH);
str = g.y(str, gVar.iuH);
}
iVar = new i();
iVar.dPV = gVar.dVu;
iVar.field_mediaId = gVar.dVk;
iVar.field_fullpath = str4;
iVar.field_thumbpath = str;
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOt;
iVar.field_talker = dW.field_talker;
iVar.field_priority = com.tencent.mm.modelcdntran.b.dOj;
iVar.field_needStorage = false;
iVar.field_isStreamMedia = false;
iVar.field_appType = 202;
iVar.field_bzScene = 2;
if (!g.cC(j).booleanValue()) {
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOt;
iVar.field_appType = 202;
} else if (g.cF(j).booleanValue()) {
iVar.field_appType = 102;
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOp;
iVar.field_bzScene = 1;
}
if (g.ND().c(iVar)) {
obj = 1;
} else {
h.mEJ.a(111, 205, 1, false);
x.e("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra addSendTask failed. clientid:%s", new Object[]{gVar.dVk});
gVar.dVk = "";
obj = null;
}
} else if (g.cC(j).booleanValue() || g.cE(j).booleanValue()) {
com.tencent.mm.pluginsdk.model.app.b SR = ao.asF().SR(a.gp(dW.field_content).bGP);
if (SR != null) {
str4 = SR.field_fileFullPath;
g.ND();
if (com.tencent.mm.modelcdntran.c.hz(4) || SR.field_isUseCdn == 1) {
if (!bi.oW(dW.field_imgPath)) {
str = o.Pf().lN(dW.field_imgPath);
}
int cm = com.tencent.mm.a.e.cm(str);
int cm2 = com.tencent.mm.a.e.cm(SR.field_fileFullPath);
if (cm >= com.tencent.mm.modelcdntran.b.dOG) {
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra thumb[%s][%d] Too Big Not Use CDN TRANS", new Object[]{str, Integer.valueOf(cm)});
obj = null;
} else {
gVar.dVk = d.a("upattach", SR.field_createTime, dW.field_talker, "0");
if (bi.oW(gVar.dVk)) {
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra genClientId failed not use cdn compressType:%d", new Object[]{Integer.valueOf(0)});
obj = null;
} else {
x.d("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra checkUseCdn id:%d file[%s][%d] thumb[%s][%d]", new Object[]{Long.valueOf(SR.field_msgInfoId), SR.field_fileFullPath, Integer.valueOf(cm2), str, Integer.valueOf(cm)});
gVar.iuH = new Random().nextLong();
str4 = g.y(str4, gVar.iuH);
str = g.y(str, gVar.iuH);
iVar = new i();
iVar.dPV = gVar.dVu;
iVar.field_mediaId = gVar.dVk;
iVar.field_fullpath = str4;
iVar.field_thumbpath = str;
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOt;
iVar.field_talker = dW.field_talker;
iVar.field_priority = com.tencent.mm.modelcdntran.b.dOj;
iVar.field_needStorage = false;
iVar.field_isStreamMedia = false;
iVar.field_appType = 202;
iVar.field_bzScene = 2;
if (!g.cC(j).booleanValue()) {
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOt;
iVar.field_appType = 202;
} else if (g.cF(j).booleanValue()) {
iVar.field_appType = 102;
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOp;
iVar.field_bzScene = 1;
}
if (g.ND().c(iVar)) {
obj = 1;
} else {
h.mEJ.a(111, 205, 1, false);
x.e("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra addSendTask failed. clientid:%s", new Object[]{gVar.dVk});
gVar.dVk = "";
obj = null;
}
}
}
} else {
objArr2 = new Object[2];
g.ND();
objArr2[0] = Boolean.valueOf(com.tencent.mm.modelcdntran.c.hz(4));
objArr2[1] = Integer.valueOf(SR.field_isUseCdn);
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra not use cdn flag:%b getCdnInfo:%d", objArr2);
obj = null;
}
} else {
x.e("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "getFilePath attInfo is null");
obj = null;
}
} else {
if (g.cF(j).booleanValue()) {
r nI = com.tencent.mm.modelvideo.o.Ta().nI(dW.field_imgPath);
if (nI == null) {
x.e("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "Get info Failed file:" + dW.field_imgPath);
obj = null;
} else {
g.ND();
if (com.tencent.mm.modelcdntran.c.hz(2) || nI.enR == 1) {
gVar.dVk = d.a("upvideo", nI.createTime, nI.Tj(), nI.getFileName());
if (bi.oW(gVar.dVk)) {
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra genClientId failed not use cdn file:%s", new Object[]{nI.getFileName()});
obj = null;
} else {
com.tencent.mm.modelvideo.o.Ta();
str = s.nL(dW.field_imgPath);
com.tencent.mm.modelvideo.o.Ta();
str4 = s.nK(dW.field_imgPath);
}
} else {
r5 = new Object[2];
g.ND();
r5[0] = Boolean.valueOf(com.tencent.mm.modelcdntran.c.hz(2));
r5[1] = Integer.valueOf(nI.enR);
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra not use cdn flag:%b getCdnInfo:%d", r5);
obj = null;
}
}
}
gVar.iuH = new Random().nextLong();
str4 = g.y(str4, gVar.iuH);
str = g.y(str, gVar.iuH);
iVar = new i();
iVar.dPV = gVar.dVu;
iVar.field_mediaId = gVar.dVk;
iVar.field_fullpath = str4;
iVar.field_thumbpath = str;
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOt;
iVar.field_talker = dW.field_talker;
iVar.field_priority = com.tencent.mm.modelcdntran.b.dOj;
iVar.field_needStorage = false;
iVar.field_isStreamMedia = false;
iVar.field_appType = 202;
iVar.field_bzScene = 2;
if (!g.cC(j).booleanValue()) {
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOt;
iVar.field_appType = 202;
} else if (g.cF(j).booleanValue()) {
iVar.field_appType = 102;
iVar.field_fileType = com.tencent.mm.modelcdntran.b.dOp;
iVar.field_bzScene = 1;
}
if (g.ND().c(iVar)) {
h.mEJ.a(111, 205, 1, false);
x.e("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "cdntra addSendTask failed. clientid:%s", new Object[]{gVar.dVk});
gVar.dVk = "";
obj = null;
} else {
obj = 1;
}
}
if (obj == null) {
g.cx(str3, gVar.iuB);
gVar.iuE = false;
} else {
gVar.iuE = true;
}
}
}
valueOf = Boolean.valueOf(true);
bVar2.bLW = valueOf.booleanValue();
}
}
i = i2;
} else {
i = 0;
}
amw amw = new amw();
ate ate;
if (!z) {
gVar.a(amw, gVar.cYP);
} else if (gVar.aGT().sqc.ruz != 1 || i != 0 || gVar.iuy != null) {
if (str5 != null) {
bsu aGT = gVar.aGT();
switch (aGT.sqc.ruz) {
case 1:
x.i("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "is sns photo!");
int i3 = -1;
String str6 = null;
String str7 = null;
str = null;
String str8 = gVar.iuy;
if (str8 != null && str8.length() > 0) {
File file = new File(str8);
str7 = file.getName();
i3 = (int) file.length();
str = str7.substring(str7.lastIndexOf(".") + 1, str7.length());
str6 = com.tencent.mm.a.g.m(file);
x.i("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "dataSnsInit filePath %s, fileSize %s, fileMd5 %s", new Object[]{str8, Integer.valueOf(i3), str6});
}
amx amx = new amx();
amx.rxo = str;
amx.jPe = str7;
amx.hcy = i3;
amx.rwk = str6;
if (i == 1) {
ate = (ate) aGT.sqc.ruA.get(gVar.iuz);
if (ate == null) {
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "mediaObjImage is null");
break;
}
amx.jPK = ate.jPK;
amx.rPJ = ate.rVV;
if (!bi.oW(amx.rPJ)) {
amx.jPK += "?idx=" + ate.rVU + "&token=" + ate.rVT;
}
}
amw.rPF = amx;
amw.rPC = 3;
break;
case 3:
ate = (ate) aGT.sqc.ruA.get(0);
if (ate != null) {
gVar.iuv = true;
ana ana = new ana();
ana.jPK = ate.jPK;
ana.bHD = ate.bHD;
ana.rPM = ate.jOS;
amw.rPH = ana;
amw.rPC = 5;
break;
}
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "mediaObUrl is null");
break;
case 4:
x.i("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "is sns music!");
ate = (ate) aGT.sqc.ruA.get(0);
if (ate != null) {
gVar.iuv = true;
amz amz = new amz();
amz.bHD = ate.bHD;
amz.rPM = ate.jOS;
amz.jPK = aGT.sqc.jPK;
amz.rst = ate.jPK;
amz.rPO = ate.rVI;
amz.jSv = aGT.sqb.jSv;
amw.rPD = amz;
amw.rPC = 1;
break;
}
x.e("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "mediaObj is null");
break;
case 15:
x.i("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "is sns sight!");
ate = (ate) aGT.sqc.ruA.get(0);
if (ate != null) {
gVar.iuv = true;
anb anb = new anb();
anb.jPK = ate.jPK;
x.d("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "videoMsg.url = %s", new Object[]{anb.jPK});
amw.rPI = anb;
amw.rPC = 6;
break;
}
x.w("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "mediaObjSight is null");
break;
}
}
} else {
gVar.iuS = amw;
gVar.iuT = str2;
gVar.iuU = str3;
gVar.iuV = 0;
ate = (ate) gVar.aGT().sqc.ruA.get(gVar.iuz);
if (ate == null) {
x.e("MicroMsg.exdevice.ExdeviceSendDataToNetworkDevice", "mediaObjImage is null");
g.cx(str3, gVar.iuB);
} else {
gVar.bSW = ate.jPK;
com.tencent.mm.sdk.f.e.post(gVar.iuR, "ExdeviceDownloadImage");
}
valueOf = Boolean.valueOf(true);
bVar2.bLW = valueOf.booleanValue();
}
au.DF().a(new n(amw, str2, str3, i), 0);
valueOf = Boolean.valueOf(true);
bVar2.bLW = valueOf.booleanValue();
}
return true;
}
}
|
package io.altar.jseproject.model;
import java.util.ArrayList;
import io.altar.jseproject.repository.ProductRepository;
public class Product extends Entity{
private ArrayList<Integer> shelfIdLocation;
private String name;
private Integer discount;
private Integer tax;
private Double salePrice;
public void setShelfIdLocation(ArrayList<Integer> shelfIdLocation){
this.shelfIdLocation = shelfIdLocation;
}
public void setName(String name){
this.name = name;
}
public void setDiscount(Integer discount){
this.discount = discount;
}
public void setTax(Integer tax){
this.tax = tax;
}
public void setSalePrice(Double salePrice){
this.salePrice = salePrice;
}
public ArrayList<Integer> getShelfIdLocation(){
return this.shelfIdLocation;
}
public String getName(){
return this.name;
}
public Integer getDiscount(){
return this.discount;
}
public Integer getTax(){
return this.tax;
}
public Double getSalePrice(){
return this.salePrice;
}
public Product(ArrayList<Integer> shelfIdLocation, String name, Integer discount, Integer tax, Double salePrice){
this.shelfIdLocation = shelfIdLocation;
this.name = name;
this.discount = discount;
this.tax = tax;
this.salePrice = salePrice;
ProductRepository.getInstance().addToList(this);
}
@Override
public String toString(){
String shelfString = null;
if(!(shelfIdLocation.isEmpty())){
shelfString = shelfIdLocation.toString();
}
return String.format("| ID: %d | Nome: %s | Prateleiras: %s | Desconto: %d%% | IVA: %d%% | PVP: %.2f€ |\n", getId(), name, shelfString, discount, tax, salePrice);
}
}
|
/**
* Percolation simulation. This is a problem domain for the UnionFind algorithm.
*
* Compilation: javac Percolation.java
*
* @author Daniel Norton
*/
public class Percolation {
private int dimensionSize; //the size of each dimension in the grid
private int totalSize; //the total size of the flattened arrays
private boolean[] open; //same array as items with boolean property, open
private int virtualTopIndex;
private int virtualBottomIndex;
private WeightedQuickUnionUF quickUnionUF;
public Percolation(int N) {
this.dimensionSize = N;
this.totalSize = N*N;
open = new boolean[totalSize];
quickUnionUF = new WeightedQuickUnionUF(totalSize + 2); //the 2 additional arrays are for the virtual top and bottom
virtualTopIndex = totalSize;
virtualBottomIndex = totalSize + 1;
}
/**
* Set the site to open and connect it with any open surrounding sites
*
* @param i row position
* @param j column position
*/
public void open(int i, int j) {
if (isOpen(i,j)) return;
int position = flattenPosition(i,j);
open[position] = true;
if (i == 1) {
quickUnionUF.union(virtualTopIndex, position);
}
if (i == dimensionSize) {
quickUnionUF.union(position, virtualBottomIndex);
}
//check for open sites to the top, left, right, then bottom
//top
if (i - 1 > 0 && isOpen(i - 1, j)) {
quickUnionUF.union(flattenPosition(i - 1, j), position);
}
//left
if (j - 1 > 0 && isOpen(i, j - 1)) {
quickUnionUF.union(flattenPosition(i, j - 1), position);
}
//right
if (j + 1 <= dimensionSize && isOpen(i, j + 1)) {
quickUnionUF.union(position, flattenPosition(i, j + 1));
}
//bottom
if (i + 1 <= dimensionSize && isOpen(i + 1, j)) {
quickUnionUF.union(position, flattenPosition(i + 1, j));
}
}
/**
* is the site open
*
* @param i row index
* @param j column index
* @return boolean
*/
public boolean isOpen(int i, int j) {
int position = flattenPosition(i, j);
return open[position];
}
/**
* Determine whether or not a position connects to a site in the top row
* @param i row index
* @param j column index
* @return boolean
*/
public boolean isFull(int i, int j) {
return quickUnionUF.find(flattenPosition(i, j)) == virtualTopIndex;
}
/**
* Determine whether or not a component contains a path from the top to the
* bottom of the matrix
* @return boolean
*/
public boolean percolates(){
return quickUnionUF.find(virtualBottomIndex) == quickUnionUF.find(virtualTopIndex);
}
/**
* helper method to convert the two dimensional position (i,j) to a single array index
* @param i
* @param j
* @return int valid position with the items array
* @throws IndexOutOfBoundsException if either i or j is less than 1 or greater than row/column size
*/
private int flattenPosition (int i, int j) {
if (i < 1 || i > dimensionSize + 1) throw new IndexOutOfBoundsException("row index i=" + i + " is out of bounds");
if (j < 1 || j > dimensionSize + 1) throw new IndexOutOfBoundsException("column index j=" + i + " is out of bounds");
return (dimensionSize * (i - 1)) + (j - 1);
}
}
|
package com.yl.cd.web.handler;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.yl.cd.entity.Cbook;
import com.yl.cd.entity.PaginationBean;
import com.yl.cd.service.BookService;
import com.yl.cd.util.ExcelUtil;
@Controller
@RequestMapping(value = "/report")
public class ExcelHandler {
@Autowired
private BookService bookService;
/**
* 导入管养数据
*/
@ResponseBody
@RequestMapping(value = "/import")
public String importCatedata(@RequestParam("file") MultipartFile file) {
LogManager.getLogger().debug("请求ExcelHandler处理excel的导入......" + file.getOriginalFilename());
int num = 0;
int total = 0;
List<Cbook> ci;
try {
ci = ExcelUtil.readXls();
for (Cbook u : ci) {
boolean flag = bookService.addBook(u);
if(flag){
num++;
}
}
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("有" + num + "条数据插入成功");
return String.valueOf(total + "=" + num);
}
/**
* 导出报表
*/
@RequestMapping(value = "/export")
@ResponseBody
public void export(String page, String rows, Cbook cbook, HttpServletRequest request,
HttpServletResponse response) {
LogManager.getLogger().debug("请求ExcelHandler处理excel的导出......");
// 获取数据
PaginationBean<Cbook> bookPage = bookService.getAllBook(page, rows, cbook);
List<Cbook> list = bookPage.getRows();
// 创建一个Excel文件
HSSFWorkbook workbook = new HSSFWorkbook();
// 创建一个工作表
HSSFSheet sheet = workbook.createSheet("图书信息表");
// 添加表头行
HSSFRow hssfRow = sheet.createRow(0);
// 设置单元格格式居中
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 添加表头内容
HSSFCell headCell = hssfRow.createCell(0);
headCell.setCellValue("图书名称");
headCell.setCellStyle(cellStyle);
headCell = hssfRow.createCell(1);
headCell.setCellValue("作者");
headCell.setCellStyle(cellStyle);
headCell = hssfRow.createCell(2);
headCell.setCellValue("ISBN");
headCell.setCellStyle(cellStyle);
headCell = hssfRow.createCell(3);
headCell.setCellValue("出版社");
headCell.setCellStyle(cellStyle);
headCell = hssfRow.createCell(4);
headCell.setCellValue("出版时间");
headCell.setCellStyle(cellStyle);
headCell = hssfRow.createCell(5);
headCell.setCellValue("字数");
headCell.setCellStyle(cellStyle);
// 添加数据内容
for (int i = 0; i < list.size(); i++) {
hssfRow = sheet.createRow((int) i + 1);
Cbook cbook1 = list.get(i);
// 创建单元格,并设置值
HSSFCell cell = hssfRow.createCell(0);
cell.setCellValue(cbook1.getBookname());
cell.setCellStyle(cellStyle);
cell = hssfRow.createCell(1);
cell.setCellValue(cbook1.getCauthor());
cell.setCellStyle(cellStyle);
cell = hssfRow.createCell(2);
cell.setCellValue(cbook1.getCisbn());
cell.setCellStyle(cellStyle);
cell = hssfRow.createCell(3);
cell.setCellValue(cbook1.getCpublishing());
cell.setCellStyle(cellStyle);
cell = hssfRow.createCell(4);
cell.setCellValue(cbook1.getCpublishtime());
cell.setCellStyle(cellStyle);
cell = hssfRow.createCell(5);
cell.setCellValue(cbook1.getCwordnumber());
cell.setCellStyle(cellStyle);
}
// 保存Excel文件
try {
OutputStream outputStream = new FileOutputStream("D:/book.xls");
workbook.write(outputStream);
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
package rgg.campusvirtualapp.vista.test;
import rgg.campusvirtualapp.modelo.DatosAsignatura;
import rgg.campusvirtualapp.vista.AdaptadorAsignaturas;
import rgg.campusvirtualapp.vista.VistaAsignaturas;
import rgg.campusvirtualapp.vista.VistaLogin;
import rgg.campusvirtualapp.vista.R;
import android.annotation.SuppressLint;
import android.app.Instrumentation.ActivityMonitor;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ViewAsserts;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
public class ManejoDatosTest1 extends
ActivityInstrumentationTestCase2<VistaLogin> {
public ManejoDatosTest1() {
super(VistaLogin.class);
}
private VistaLogin vistaLogin;
private Button iniciarSesion;
@Override
protected void setUp() throws Exception {
super.setUp();
setActivityInitialTouchMode(false);
vistaLogin = (VistaLogin)getActivity();
iniciarSesion = (Button)vistaLogin.findViewById(R.id.iniciarSesion);
}
public void testMostrarAsignaturas() throws Exception {
final EditText dni = (EditText)vistaLogin.findViewById(R.id.dni_alumno);
final EditText password = (EditText)vistaLogin.findViewById(R.id.password_alumno);
vistaLogin.runOnUiThread(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
dni.setText("1234");
password.setText("1234");
iniciarSesion.callOnClick();
}
});
// se presiona el botón Iniciar sesion
// se añade un monitor para testear la actividad VistaAsignaturas
ActivityMonitor monitor = getInstrumentation().addMonitor(VistaAsignaturas.class.getName(), null, false);
// se espera a que se presente la vista de asignaturas
VistaAsignaturas vistaAsignaturas = (VistaAsignaturas) getInstrumentation().waitForMonitorWithTimeout(monitor, 5000);
// esperamos 6 sg. porque los datos vienen de la nube
Thread.sleep(6000);
assertNotNull("La vista es null", vistaAsignaturas);
// si llega aquí, la vista asignaturas está en foreground. Si falla la línea anterior, aumentar el tiempo
ListView lista = (ListView)vistaAsignaturas.findViewById(R.id.listaAsignaturas);
// comprueba que la lista está en la pantalla
ViewAsserts.assertOnScreen(vistaAsignaturas.getWindow().getDecorView(),lista);
// comprueba que tiene 2 elementos y si están en el orden esperado
assertEquals("La cantidad no es correcta",2,lista.getCount());
assertEquals("Asignatura 0 no es correcta","Programación en Entornos Multidispositivos", ((DatosAsignatura)((AdaptadorAsignaturas)lista.getAdapter()).getItem(0)).getNombre());
assertEquals("Asignatura 1 no es correcta","Programación Web", ((DatosAsignatura)((AdaptadorAsignaturas)lista.getAdapter()).getItem(1)).getNombre());
}
}
|
import java.awt.EventQueue;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;
import javax.swing.JFrame;
public class PatentSearcher {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Menu frame = new Menu();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/*
public static void main(String[] args) {
URL url;
InputStream is = null;
BufferedReader br;
String line;
Vector<Concept> concepts = new Vector<Concept>();
Vector<PatentInfo> patents = new Vector<PatentInfo>();
Vector<String> resultPageURLs = new Vector<String>();
Vector<String> urls = new Vector<String>();
Vector<String> searchTerms = new Vector<String>();
// Get info from user
try {
Scanner reader = new Scanner(System.in); // Reading from System.in
System.out.println("Enter a results page URL: ");
String urlString = reader.nextLine();
System.out.println("How many pages of results are there? ");
String pageCountStr = reader.nextLine();
int pageCount = Integer.parseInt(pageCountStr);
System.out.println("Enter path for search terms file: ");
String termsFile = reader.nextLine();
reader.close();
// Read search terms from file
try {
BufferedReader termBuf= new BufferedReader(new FileReader(termsFile));
String termLine = termBuf.readLine();
concepts.add(new Concept("concept"));
while (termLine != null) {
System.out.println("***********" + termLine + "*********");
if (termLine.equals("")) {
System.out.println("#############");
concepts.add(new Concept("concept"));
}
else {
searchTerms.add(termLine);
concepts.get(concepts.size() - 1).addTerm(termLine);
}
termLine = termBuf.readLine();
// abcdefghijklmnopqrstuvwxyz
}
termBuf.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
// TODO Auto-generated catch block
}
for (int i = 0; i < searchTerms.size(); i++)
System.out.println(searchTerms.get(i));
System.out.println("!!!!!!!!!!!!!!!!!!!! " + concepts.size());
//System.out.println("");
for (int i = 0; i < concepts.size(); i++) {
System.out.println("");
for (int i2 = 0; i2 < concepts.get(i).getTerms().size(); i2++) {
System.out.println(concepts.get(i).getTerms().get(i2));
}
}
System.out.println("");
System.out.println("Fetching URLs...");
// Generate result page URLs
for (int i = 0; i < pageCount; i++) {
if (i == 0)
resultPageURLs.add(urlString);
else {
// edit urlString
resultPageURLs.add(urlString.replace("p=1", "p=" + (i + 1)));
// add urlString
}
}
System.out.println("");
// Fetch URLs from all results pages
for (int i = 0; i < resultPageURLs.size(); i++) {
url = new URL(resultPageURLs.get(i));
is = url.openStream(); // throws an IOException
br = new BufferedReader(new InputStreamReader(is));
while ((line = br.readLine()) != null) {
if (line.contains("legacy-container")) {
while (!(line = br.readLine()).contains("</table>")) {
if (line.contains("href")) {
String suburl = line.substring(line.indexOf('=') + 3, line.indexOf('>') - 1);
urls.add("http://www.freepatentsonline.com/" + suburl);
System.out.println(urls.size() + ": " + urls.get(urls.size() - 1));
}
}
}
}
}
} catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (is != null) is.close();
} catch (IOException ioe) {
// nothing to see here
}
}
// Search URLs for keywords
System.out.println("Searching Patents...");
for (int i = 0; i < urls.size(); i++) {
System.out.println((i + 1) + "/" + urls.size());
patents.add(new PatentInfo(urls.get(i), searchTerms));
try {
url = new URL(urls.get(i));
is = url.openStream(); // throws an IOException
br = new BufferedReader(new InputStreamReader(is));
//Vector<Integer> termCounts = new Vector<Integer>();
//for (int i3 = 0; i3 < searchTerms.size(); i3++) {
//termCounts.add(0);
//}
while ((line = br.readLine()) != null) {
for (int i2 = 0; i2 < searchTerms.size(); i2++) {
int lastIndex = 0;
int count = 0;
while(lastIndex != -1) {
lastIndex = line.indexOf(searchTerms.get(i2),lastIndex);
if(lastIndex != -1) {
count ++;
lastIndex += searchTerms.get(i2).length();
}
}
patents.get(patents.size() - 1).addToTermCount(searchTerms.get(i2), count);;
}
}
} catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
//ioe.printStackTrace();
} finally {
try {
if (is != null) is.close();
} catch (IOException ioe) {
// nothing to see here
}
}
}
// Sort by unique term count
//System.out.println("Sorting by relevance...");
for (int i = 0; i < patents.size(); i++) {
if (i < patents.size() - 1) {
for (int i2 = i + 1; i2 < patents.size(); i2++) {
if (patents.get(i).getUniqueTermCount() < patents.get(i2).getUniqueTermCount()) {
Collections.swap(patents, i, i2);
}
}
}
}
// Sort by concepts fulfilled
for (int i = 0; i < patents.size(); i++) {
if (i < patents.size() - 1) {
for (int i2 = i + 1; i2 < patents.size(); i2++) {
if (patents.get(i).getConceptCount(concepts) < patents.get(i2).getConceptCount(concepts)) {
Collections.swap(patents, i, i2);
}
}
}
}
// Sort terms within each patent
for (int i = 0; i < patents.size(); i++) {
patents.get(i).sortTerms();
}
System.out.println();
// Display results and write to file
try {
PrintWriter writer = new PrintWriter("log.txt", "UTF-8");
for (int i = 0; i < patents.size(); i++) {
writer.println(patents.get(i).getName() + " : " + patents.get(i).getConceptCount(concepts));
writer.println(patents.get(i).getURL());
System.out.println(patents.get(i).getName() + " : " + patents.get(i).getConceptCount(concepts));
System.out.println(patents.get(i).getURL());
for (int i2 = 0; i2 < searchTerms.size(); i2++) {
if (patents.get(i).getTerms().get(i2).getCount() > 0) {
writer.println(patents.get(i).getTerms().get(i2).getTerm() + ": " + patents.get(i).getTermCount(patents.get(i).getTerms().get(i2).getTerm()));
System.out.println(patents.get(i).getTerms().get(i2).getTerm() + ": " + patents.get(i).getTermCount(patents.get(i).getTerms().get(i2).getTerm()));
}
//System.out.println(patents.get(i).getTermCount(searchTerms.get(i2)));
}
writer.println("");
System.out.println("");
//System.out.println(i + " : " + patents.get(patents.size() - 1).getURL() + ": " + patents.get(patents.size() - 1).getTotalCount());
}
writer.close();
} catch (FileNotFoundException | UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
*/
}
|
package pl.finsys.constructorExample;
public class PrintRoom {
private final IPrinter printer;
public String print() {
return printer.print();
}
//wstrzykniecie przez konstruktor
public PrintRoom(IPrinter printer){
this.printer = printer;
}
}
|
import com.sun.media.jfxmedia.logging.Logger;
import generatorRaderketen.randomLoad.RandomLoad;
import generatorRaderketen.simulation.Simulation;
import java.util.Scanner;
/**
* Created by Thomas on 1/11/2015.
*/
public class StartGenerator {
public static void main(String[] args) {
// IncidentServiceProxy incidentServiceProxy;
boolean running = true;
Scanner scanner = new Scanner(System.in);
int idKeuze;
Logger.setLevel(Logger.INFO);
while (running) {
System.out.println("Geef generator modus: (1 voor simulatie, 2 voor random load).");
idKeuze = scanner.nextInt();
if (idKeuze == 1) {
Simulation simulation = new Simulation();
simulation.start();
return;
}
if (idKeuze == 2) {
RandomLoad randomLoad = new RandomLoad();
randomLoad.start();
return;
}
}
}
}
|
package com.tencent.mm.plugin.webview.ui.tools.fts;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.view.View;
import com.tencent.mm.R;
import java.lang.reflect.Array;
public class a {
protected View hmt;
protected boolean isAnimating;
protected int lvk;
protected int qeT;
protected int qeU;
protected int qeV;
protected int qeW;
protected View qeX;
protected View qeY;
protected View qeZ;
protected View qfa;
protected View qfb;
protected View qfc;
protected View qfd;
protected View qfe;
protected float[][] qff;
protected int qfg = b.qfq;
protected a qfh;
protected AnimatorUpdateListener qfi = new 3(this);
protected AnimatorUpdateListener qfj = new 4(this);
protected AnimatorUpdateListener qfk = new 5(this);
protected AnimatorUpdateListener qfl = new 6(this);
public enum b {
;
public static int[] bXF() {
return (int[]) qfs.clone();
}
static {
qfq = 1;
qfr = 2;
qfs = new int[]{qfq, qfr};
}
}
public a(Context context, View view, View view2, View view3, View view4, View view5, View view6, View view7, View view8, View view9) {
this.qeT = com.tencent.mm.bp.a.fromDPToPix(context, 48) / 2;
this.lvk = (int) context.getResources().getDimension(R.f.sos_search_edittext_margin);
this.qff = (float[][]) Array.newInstance(Float.TYPE, new int[]{3, 2});
this.qeX = view;
this.qeY = view2;
this.qeZ = view3;
this.qfa = view4;
this.qfb = view5;
this.hmt = view6;
this.qfc = view7;
this.qfd = view8;
this.qfe = view9;
this.qeX.post(new 1(this, view));
this.qfd.post(new 2(this, view8));
}
public final void AX(int i) {
this.qff[0][0] = (float) i;
}
public final void AY(int i) {
this.qfg = i;
}
public void AZ(int i) {
if (i != this.qfg) {
switch (7.qfp[i - 1]) {
case 1:
bXC();
break;
case 2:
bXD();
break;
}
this.qfg = i;
}
}
protected void bXC() {
}
protected void bXD() {
}
public final void a(a aVar) {
this.qfh = aVar;
}
protected boolean bXE() {
return true;
}
}
|
package com.tahmeedul.practicemvvm.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.mikhaellopez.circularimageview.CircularImageView;
import com.tahmeedul.practicemvvm.R;
import com.tahmeedul.practicemvvm.model.NewContactModel;
import java.util.List;
public class AllContactsAdapter extends RecyclerView.Adapter<AllContactsAdapter.MyViewHolder>{
private List<NewContactModel> list;
// 2/6
private ClickInterface clickInterface;
// 3/6
public AllContactsAdapter(ClickInterface clickInterface) {
this.clickInterface = clickInterface;
}
public void getContactList(List<NewContactModel> list){
this.list = list;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View view = layoutInflater.inflate(R.layout.model_contact_list_single_item, parent, false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
Glide.with(holder.imageView.getContext())
.load(list.get(position).newImage)
.centerCrop()
.placeholder(R.drawable.ic_baseline_person_24)
.into(holder.imageView);
holder.textView1.setText(list.get(position).getNewId());
holder.textView2.setText(list.get(position).getNewName());
}
@Override
public int getItemCount() {
return list.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
CircularImageView imageView;
TextView textView1, textView2;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.listDp);
textView1 = itemView.findViewById(R.id.listId);
textView2 = itemView.findViewById(R.id.listName);
// 5/6
// 6/6 in ListFragment.java => implements AllContactsAdapter.ClickInterface
// 7 => Do work on implements method
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
// 4/6
@Override
public void onClick(View view) {
clickInterface.onItemClick(getAdapterPosition());
}
@Override
public boolean onLongClick(View view) {
clickInterface.onItemLongClick(getAdapterPosition());
return false;
}
}
// For the position of item click or item long click
// 1/6 in interface there will be no body for any methods
public interface ClickInterface {
void onItemClick(int position);
void onItemLongClick(int position);
}
}
|
package com.tencent.mm.pluginsdk.model.app;
import android.graphics.BitmapFactory.Options;
import android.util.Base64;
import com.tencent.mm.ab.b;
import com.tencent.mm.ab.b.a;
import com.tencent.mm.ab.e;
import com.tencent.mm.ab.l;
import com.tencent.mm.ac.f;
import com.tencent.mm.ak.o;
import com.tencent.mm.g.a.n;
import com.tencent.mm.g.a.ua;
import com.tencent.mm.model.au;
import com.tencent.mm.model.bf;
import com.tencent.mm.model.c;
import com.tencent.mm.model.m;
import com.tencent.mm.model.t;
import com.tencent.mm.model.u;
import com.tencent.mm.modelcdntran.keep_SceneResult;
import com.tencent.mm.network.k;
import com.tencent.mm.network.q;
import com.tencent.mm.protocal.c.bke;
import com.tencent.mm.protocal.c.bkf;
import com.tencent.mm.protocal.c.bqw;
import com.tencent.mm.protocal.c.df;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.ab;
import com.tencent.mm.storage.bd;
import com.tencent.mm.y.g;
import com.tencent.mm.y.h;
import java.util.Locale;
public final class aj extends l implements k {
private long bJC = 0;
private bd bXQ = null;
private b diG;
private e diJ;
private keep_SceneResult dlU = null;
private String fmS;
private ua nol;
private n qAu;
private b qAx = null;
private boolean qAy = false;
private a qAz = null;
public aj(long j, boolean z, keep_SceneResult keep_sceneresult, a aVar, String str, b bVar) {
this.bJC = j;
this.fmS = str;
this.dlU = keep_sceneresult;
this.qAz = aVar;
this.qAy = z;
this.qAx = bVar;
a aVar2 = new a();
aVar2.dIG = new bke();
aVar2.dIH = new bkf();
aVar2.uri = "/cgi-bin/micromsg-bin/sendappmsg";
aVar2.dIF = 222;
aVar2.dII = 107;
aVar2.dIJ = 1000000107;
this.diG = aVar2.KT();
x.i("MicroMsg.NetSceneSendAppMsgForCdn", "summerbig NetSceneSendAppMsgForCdn msgId[%d], sceneResult[%s], sessionId[%s], attachInfo[%s]. stack[%s]", new Object[]{Long.valueOf(j), keep_sceneresult, str, bVar, bi.cjd()});
}
public final int getType() {
return 222;
}
protected final int a(q qVar) {
return l.b.dJm;
}
public final int a(com.tencent.mm.network.e eVar, e eVar2) {
this.diJ = eVar2;
au.HU();
this.bXQ = c.FT().dW(this.bJC);
if (this.bXQ == null || this.bXQ.field_msgId != this.bJC) {
x.e("MicroMsg.NetSceneSendAppMsgForCdn", "summerbig cdntra doscene msginfo null id:%d", new Object[]{Long.valueOf(this.bJC)});
this.qAz.bp(3, -1);
return -1;
}
String str;
int i;
String string;
g.a gp = g.a.gp(this.bXQ.field_content);
if (gp == null) {
x.e("MicroMsg.NetSceneSendAppMsgForCdn", "summerbig cdntra doscene AppMessage.Content.parse null id:%d", new Object[]{Long.valueOf(this.bJC)});
this.qAz.bp(3, -1);
}
bke bke = (bke) this.diG.dID.dIL;
df dfVar = new df();
dfVar.jQb = gp.appId;
dfVar.rdo = this.bXQ.field_talker + this.bXQ.field_msgId + "T" + this.bXQ.field_createTime;
dfVar.lOH = (int) bi.VE();
dfVar.jTu = this.bXQ.field_talker;
dfVar.jTv = com.tencent.mm.model.q.GF();
dfVar.hcE = gp.type;
dfVar.rdn = gp.sdkVer;
dfVar.rdq = gp.dwr;
if (f.eZ(this.bXQ.field_talker)) {
dfVar.rco = com.tencent.mm.ac.a.e.lg(this.bXQ.cqb);
} else {
dfVar.rco = bf.Ir();
}
dfVar.rds = gp.bZJ;
dfVar.rdt = gp.bZK;
dfVar.rdu = gp.bZL;
u.b ib = u.Hx().ib(this.fmS);
if (ib != null) {
this.nol = new ua();
this.nol.cfH.url = gp.url;
this.nol.cfH.cfI = ib.getString("prePublishId", "");
this.nol.cfH.cfK = ib.getString("preUsername", "");
this.nol.cfH.cfL = ib.getString("preChatName", "");
this.nol.cfH.cfM = ib.getInt("preMsgIndex", 0);
this.nol.cfH.cfQ = ib.getInt("sendAppMsgScene", 0);
this.nol.cfH.cfR = ib.getInt("getA8KeyScene", 0);
this.nol.cfH.cfS = ib.getString("referUrl", null);
this.nol.cfH.cfT = ib.getString("adExtStr", null);
this.nol.cfH.cfN = this.bXQ.field_talker;
this.nol.cfH.cfU = gp.title;
au.HU();
ab Yg = c.FR().Yg(this.bXQ.field_talker);
if (Yg != null) {
this.nol.cfH.cfO = Yg.BK();
}
this.nol.cfH.cfP = m.gK(this.bXQ.field_talker);
str = "";
if (gp.bZN != null) {
bqw bqw = new bqw();
try {
bqw.aG(Base64.decode(gp.bZN, 0));
if (bqw.soY != null) {
str = bqw.soY.jLY;
}
} catch (Exception e) {
}
}
bke.sjU = String.format(Locale.US, "prePublishId=%s&preUserName=%s&preChatName=%s&preChatType=%d&getA8KeyScene=%d&sourceAppId=%s", new Object[]{this.nol.cfH.cfI, this.nol.cfH.cfK, this.nol.cfH.cfL, Integer.valueOf(t.N(this.nol.cfH.cfK, this.nol.cfH.cfL)), Integer.valueOf(this.nol.cfH.cfR), str});
}
if (ib != null && gp.type == 33) {
this.qAu = new n();
i = ib.getInt("fromScene", 1);
this.qAu.bGE.scene = i;
this.qAu.bGE.bGM = ib.getInt("appservicetype", 0);
string = ib.getString("preChatName", "");
if (2 == i) {
this.qAu.bGE.bGG = string + ":" + ib.getString("preUsername", "");
} else {
this.qAu.bGE.bGG = string;
}
str = this.bXQ.field_talker;
boolean z = ib.getBoolean("moreRetrAction", false);
if (str.endsWith("@chatroom")) {
this.qAu.bGE.action = z ? 5 : 2;
} else {
this.qAu.bGE.action = z ? 4 : 1;
}
this.qAu.bGE.bGF = gp.dyZ + 1;
this.qAu.bGE.bGH = gp.dyR;
this.qAu.bGE.bGy = gp.dyS;
this.qAu.bGE.appId = gp.dyT;
this.qAu.bGE.bGJ = bi.VE();
this.qAu.bGE.bGK = 1;
}
x.d("MicroMsg.NetSceneSendAppMsgForCdn", "stev summerbig SnsPostOperationFields: ShareUrlOriginal=%s, ShareUrlOpen=%s, JsAppId=%s", new Object[]{gp.bZJ, gp.bZK, gp.bZL});
int i2 = 0;
i = 0;
if (!bi.oW(this.bXQ.field_imgPath)) {
Options VZ = com.tencent.mm.sdk.platformtools.c.VZ(o.Pf().lN(this.bXQ.field_imgPath));
if (VZ != null) {
i2 = VZ.outWidth;
i = VZ.outHeight;
}
}
if (this.dlU.isUploadBySafeCDNWithMD5()) {
x.i("MicroMsg.NetSceneSendAppMsgForCdn", "summersafecdn app sceneResult crc[%d], safecdn[%b], hitcachetype[%d], aeskey[%s]", new Object[]{Integer.valueOf(this.dlU.field_filecrc), Boolean.valueOf(this.dlU.field_upload_by_safecdn), Integer.valueOf(this.dlU.field_UploadHitCacheType), this.dlU.field_aesKey});
this.dlU.field_aesKey = "";
bke.sjV = 1;
}
bke.rmA = this.dlU.field_filecrc;
string = null;
if (this.qAy) {
string = "@cdn_" + this.dlU.field_fileId + "_" + this.dlU.field_aesKey + "_1";
}
dfVar.jSA = g.a.a(gp, string, this.dlU, i2, i);
bke.sjS = dfVar;
if (this.qAx != null && (gp.dws != 0 || gp.dwo > 26214400)) {
bke.eJK = this.qAx.field_signature;
bke.rdY = com.tencent.mm.modelcdntran.b.dOm;
}
bke.rwk = gp.filemd5;
if (bi.oW(this.dlU.field_filemd5)) {
x.i("MicroMsg.NetSceneSendAppMsgForCdn", "summerbig sceneResult filemd5 is null use content.filemd5[%s]", new Object[]{gp.filemd5});
} else {
bke.rwk = this.dlU.field_filemd5;
}
x.i("MicroMsg.NetSceneSendAppMsgForCdn", "summerbig file md5[%s], HitMd5[%d], signature[%s], type[%d], sceneResult[%s], fromScene[%s]", new Object[]{bke.rwk, Integer.valueOf(bke.sjV), bi.Xf(bke.eJK), Integer.valueOf(bke.rdY), this.dlU, bke.sjU});
return a(eVar, this.diG, this);
}
public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) {
bke bke = (bke) ((b) qVar).dID.dIL;
x.i("MicroMsg.NetSceneSendAppMsgForCdn", "summerbig cdntra onGYNetEnd [%d,%d,%s] msgId:%d, oldContent[%s], newContent[%s]", new Object[]{Integer.valueOf(i2), Integer.valueOf(i3), str, Long.valueOf(this.bJC), this.bXQ.field_content, bke.sjS.jSA});
if (i2 == 0 && i3 == 0) {
bkf bkf = (bkf) ((b) qVar).dIE.dIL;
x.i("MicroMsg.NetSceneSendAppMsgForCdn", "summersafecdn svrid[%d]. aeskey[%s], old content[%s]", new Object[]{Long.valueOf(bkf.rcq), bkf.rmy, this.bXQ.field_content});
if (this.dlU != null && this.dlU.isUploadBySafeCDNWithMD5()) {
if (bi.oW(bkf.rmy)) {
x.w("MicroMsg.NetSceneSendAppMsgForCdn", "summersafecdn need aeskey but ret null");
} else {
g.a gp = g.a.gp(this.bXQ.field_content);
gp.dwK = bkf.rmy;
this.bXQ.setContent(g.a.a(gp, null, null));
x.i("MicroMsg.NetSceneSendAppMsgForCdn", "summersafecdn aeskey[%s], new content[%s]", new Object[]{bkf.rmy, this.bXQ.field_content});
}
}
this.bXQ.setStatus(2);
this.bXQ.ax(bkf.rcq);
au.HU();
c.FT().a(this.bXQ.field_msgId, this.bXQ);
com.tencent.mm.modelstat.b.ehL.a(this.bXQ, h.g(this.bXQ));
this.diJ.a(i2, i3, str, this);
this.qAz.bp(i2, i3);
if (!(this.nol == null || bi.oW(this.nol.cfH.url))) {
this.nol.cfH.cfJ = "msg_" + Long.toString(bkf.rcq);
com.tencent.mm.sdk.b.a.sFg.m(this.nol);
}
if (this.qAu != null) {
this.qAu.bGE.bGI = "msg_" + this.bXQ.field_msgSvrId;
com.tencent.mm.sdk.b.a.sFg.m(this.qAu);
}
} else if (i2 == 4 && i3 == 102) {
x.w("MicroMsg.NetSceneSendAppMsgForCdn", "summersafecdn MM_ERR_GET_AESKEY_FAILED");
this.diJ.a(i2, i3, str, this);
this.qAz.bp(i2, i3);
} else {
this.bXQ.setStatus(5);
au.HU();
c.FT().a(this.bXQ.field_msgId, this.bXQ);
x.e("MicroMsg.NetSceneSendAppMsgForCdn", "summerbig send app msg failed, err=" + i2 + "," + i3);
this.diJ.a(i2, i3, str, this);
this.qAz.bp(i2, i3);
}
}
}
|
package com.jean.sbc.services.validation;
import java.util.ArrayList;
import java.util.List;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.springframework.beans.factory.annotation.Autowired;
import com.jean.sbc.domain.Customer;
import com.jean.sbc.domain.enums.CustomerType;
import com.jean.sbc.dto.CustomerNewDTO;
import com.jean.sbc.repositories.CustomerRepository;
import com.jean.sbc.resources.exception.FieldMessage;
import com.jean.sbc.services.validation.utils.Utils;
public class CustomerInsertValidator implements ConstraintValidator<CustomerInsert, CustomerNewDTO> {
@Autowired
private CustomerRepository customerRepository;
@Override
public void initialize(CustomerInsert ann) {
}
@Override
public boolean isValid(CustomerNewDTO customerNewDTO, ConstraintValidatorContext context) {
List<FieldMessage> list = new ArrayList<>();
if (customerNewDTO.getCustomerType().equals(CustomerType.NATURALPERSON.getCod())
&& !Utils.isValidSocialInsuranceNumber(customerNewDTO.getSocialInsuranceOrBusinessNumber())) {
list.add(new FieldMessage("socialInsuranceOrBusinessNumber", "Social Insurance Number is invalid"));
}
if (customerNewDTO.getCustomerType().equals(CustomerType.LEGALPERSON.getCod())
&& !Utils.isValidBusinessNumber(customerNewDTO.getSocialInsuranceOrBusinessNumber())) {
list.add(new FieldMessage("socialInsuranceOrBusinessNumber", "Business Number is invalid"));
}
Customer customer = customerRepository.findByEmail(customerNewDTO.getEmail());
if (customer != null) {
list.add(new FieldMessage("email", "Email already exists"));
}
for (FieldMessage e : list) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(e.getMessage()).addPropertyNode(e.getFieldName())
.addConstraintViolation();
}
return list.isEmpty();
}
}
|
package jupiterpa;
import jupiterpa.IMasterDataServer.MasterDataException;
public interface IMasterDataClient {
void initialLoad() throws MasterDataException;
void invalidate(IMasterDataServer.EIDTyped id) throws MasterDataException;
}
|
package com.spring.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spring.dao.P2SCScoreCardDao;
@Service
public class P2SCScoreCardServiceImpl implements P2SCScoreCardService{
@Autowired
P2SCScoreCardDao p2scScoreCardDao ;
}
|
package tomekkup.jug.jugcasa.cases;
import me.prettyprint.cassandra.serializers.StringSerializer;
import me.prettyprint.hector.api.Keyspace;
import me.prettyprint.hector.api.factory.HFactory;
import me.prettyprint.hector.api.query.ColumnQuery;
import me.prettyprint.hector.api.query.SliceQuery;
/**
*
* @author tomek
*/
public class GetSlice extends AbstractCase {
public static void main( String[] args )
{
new GetSlice();
}
public GetSlice() {
super();
}
public GetSlice(Keyspace keyspace) {
super(keyspace);
}
@Override
public Object getQueryResult() {
SliceQuery<String,String,String> query = HFactory.createSliceQuery(keyspace, StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
query.setColumnFamily("CustomerAccounts").setKey("000130101").setRange(null, null, true, 4);
return query.execute().get();
}
}
|
import java.util.*;
class ShelvesProblem
{
int shelveSize, nbBoxes;
int[] size, a, b;
int[][][][][] opt;
void readData()
{
Scanner scn = new Scanner(System.in);
shelveSize = scn.nextInt();
nbBoxes = scn.nextInt();
size = new int[nbBoxes+1];
a = new int[nbBoxes+1];
b = new int[nbBoxes+1];
for (int i=1; i<nbBoxes+1; i++)
{
size[i] = scn.nextInt();
a[i] = scn.nextInt();
b[i] = scn.nextInt();
}
}
void calculate()
{
int newOpt;
opt = new int[nbBoxes+1][shelveSize+1][shelveSize+1][shelveSize+1][shelveSize+1];
for (int j=0; j<shelveSize+1; j++)
for (int k=0; k<shelveSize+1; k++)
for (int l=0; l<shelveSize+1; l++)
for (int m=0; m<shelveSize+1; m++)
opt[0][j][k][l][m] = 0;
for (int i=1; i<nbBoxes+1; i++)
for (int j=0; j<shelveSize+1; j++)
for (int k=0; k<shelveSize+1; k++)
for (int l=0; l<shelveSize+1; l++)
for (int m=0; m<shelveSize+1; m++)
{
opt[i][j][k][l][m] = opt[i-1][j][k][l][m];
if (j-size[i]>=0)
{
newOpt = (a[i]+1*b[i]) + opt[i-1][j-size[i]][k][l][m];
if (newOpt > opt[i][j][k][l][m])
opt[i][j][k][l][m] = newOpt;
}
if (k-size[i]>=0)
{
newOpt = (a[i]+2*b[i]) + opt[i-1][j][k-size[i]][l][m];
if (newOpt > opt[i][j][k][l][m])
opt[i][j][k][l][m] = newOpt;
}
if (l-size[i]>=0)
{
newOpt = (a[i]+3*b[i]) + opt[i-1][j][k][l-size[i]][m];
if (newOpt > opt[i][j][k][l][m])
opt[i][j][k][l][m] = newOpt;
}
if (m-size[i]>=0)
{
newOpt = (a[i]+4*b[i]) + opt[i-1][j][k][l][m-size[i]];
if (newOpt > opt[i][j][k][l][m])
opt[i][j][k][l][m] = newOpt;
}
}
System.out.println(opt[nbBoxes][shelveSize][shelveSize][shelveSize][shelveSize]);
}
void traceBack()
{
int i=nbBoxes, j=shelveSize, k=shelveSize, l=shelveSize, m=shelveSize;
while (i>0)
{
if (opt[i][j][k][l][m] == opt[i-1][j][k][l][m])
{
System.out.println("Do not take item " + size[i] +
"/" + a[i] + "/" + b[i]);
}
else if ((j-size[i]>=0) &&
(opt[i][j][k][l][m] == (a[i]+1*b[i]) + opt[i-1][j-size[i]][k][l][m]))
{
System.out.println("Put item " + size[i] +
"/" + a[i] + "/" + b[i] + " in row 1");
j -= size[i];
}
else if ((k-size[i]>=0) &&
(opt[i][j][k][l][m] == (a[i]+2*b[i]) + opt[i-1][j][k-size[i]][l][m]))
{
System.out.println("Put item " + size[i] +
"/" + a[i] + "/" + b[i] + " in row 2");
k -= size[i];
}
else if ((l-size[i]>=0) &&
(opt[i][j][k][l][m] == (a[i]+3*b[i]) + opt[i-1][j][k][l-size[i]][m]))
{
System.out.println("Put item " + size[i] +
"/" + a[i] + "/" + b[i] + " in row 3");
l -= size[i];
}
else if ((m-size[i]>=0) &&
(opt[i][j][k][l][m] == (a[i]+4*b[i]) + opt[i-1][j][k][l][m-size[i]]))
{
System.out.println("Put item " + size[i] +
"/" + a[i] + "/" + b[i] + " in row 4");
m -= size[i];
}
else
System.out.println("ERROR");
i--;
}
}
void run()
{
readData();
calculate();
//traceBack();
}
public static void main(String[] args)
{
ShelvesProblem pgm = new ShelvesProblem();
pgm.run();
}
}
|
package storage;
import static com.mongodb.client.model.Filters.*;
import static com.mongodb.client.model.Updates.*;
import org.bson.Document;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import bean.User;
public class UserDA {
private static MongoClientURI URI = new MongoClientURI(
"mongodb://dlms_webapp:webapp@ds013971.mlab.com:13971/webappdb");
public static String COLLECTION_NAME = "u_test";
public static String USERNAME_KEY = "username";
public static String PASSWORD_KEY = "password";
private MongoClient client;
private MongoDatabase db;
private MongoCollection<Document> collection;
public UserDA() {
super();
this.client = new MongoClient(URI);
this.db = client.getDatabase(URI.getDatabase());
this.collection = db.getCollection(COLLECTION_NAME);
}
public MongoClient getClient() {
return client;
}
public MongoDatabase getDb() {
return db;
}
public User fetch(String username) {
Document doc = collection.find(eq(USERNAME_KEY, username)).first();
User user = null;
if (doc != null) {
user = new User(doc.getString(USERNAME_KEY), doc.getString(PASSWORD_KEY));
}
return user;
}
public void store(User user) {
Document doc = new Document(USERNAME_KEY, user.getUsername()).append(PASSWORD_KEY, user.getPassword());
collection.insertOne(doc);
}
public void update(User user) {
collection.updateOne(eq(USERNAME_KEY, user.getUsername()), set(PASSWORD_KEY, user.getPassword()));
}
public void delete(User user) {
collection.deleteOne(eq(USERNAME_KEY, user.getUsername()));
}
public void delete(String username) {
collection.deleteOne(eq(USERNAME_KEY, username));
}
public void close() {
client.close();
}
public static void main(String[] args) {
User user = new User("aayushi", "pass");
UserDA userDA = new UserDA();
userDA.store(user);
System.out.println(userDA.fetch("aayushi"));
userDA.update(new User("aayushi", "new password"));
System.out.println(userDA.fetch("aayushi"));
userDA.delete("aayushi");
System.out.println(userDA.fetch("aayushi"));
userDA.close();
}
}
|
/*
* 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 Aula5.Exercicio1;
//Crie uma classe geral (superclasse) que contenha um
//atributo privado, um atributo público e um atributo
//protegido. Crie uma classe especializada (subclasse) que
//herde da geral. Na classe especializada (subclasse) crie um
//método público que use o atributo privado e o atributo
//protegido da superclasse. Crie uma terceira classe que
//contenha o método principal (main) e instancie, no método
//main, um objeto da classe geral e um objeto da classe
//especializada. Tente invocar, por meio de cada objeto
//instanciado todos os atributos e métodos da superclasse e da
//subclasse. Justifique o motivo de algumas operações não
//terem sido efetuadas com sucesso.
class SuperClasse {
private int a;
public int b;
protected int c;
public SuperClasse(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
public void setA(int a) {
this.a = a;
}
public int getA() {
return a;
}
}
class SubClasse extends SuperClasse {
public SubClasse(int a, int b, int c) {
super(a,b,c);
}
public void metodo() {
System.out.println(getA());
System.out.println(c);
}
}
/**
*
* @author mauricio.moreira
*/
public class Exercicio1 {
public static void main(String[] args) {
SuperClasse spc = new SuperClasse(1, 2, 3);
SubClasse sc = new SubClasse(4, 5, 6);
// Superclasse
//System.out.println(spc.a);
System.out.println(spc.b);
System.out.println(spc.c);
System.out.println(spc.getA());
System.out.println("---------");
//Subclasse
System.out.println(sc.b);
System.out.println(sc.c);
sc.metodo();
}
}
|
package com.yixin.dsc.dto.field;
import java.io.Serializable;
import javax.persistence.Column;
/**
* 字段dto
* Package : com.yixin.dsc.dto.field
*
* @author YixinCapital -- huguoxing
* 2018年6月6日 下午4:40:49
*
*/
public class DscFieldFDto implements Serializable {
/**
*
* @author YixinCapital -- huguoxing
* 2018年6月6日 下午4:41:26
*
*/
private static final long serialVersionUID = 1L;
/**
* 字段code
*/
private String fieldCode;
/**
* 字段名称
*/
private String fieldName;
/**
* 字段类型
*/
private String fieldType;
/**
* 字段来源
*/
private String fieldSource;
/**
* 字段获取方法
*/
private String fieldGetMethod;
public String getFieldCode() {
return fieldCode;
}
public void setFieldCode(String fieldCode) {
this.fieldCode = fieldCode;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public String getFieldType() {
return fieldType;
}
public void setFieldType(String fieldType) {
this.fieldType = fieldType;
}
public String getFieldSource() {
return fieldSource;
}
public void setFieldSource(String fieldSource) {
this.fieldSource = fieldSource;
}
public String getFieldGetMethod() {
return fieldGetMethod;
}
public void setFieldGetMethod(String fieldGetMethod) {
this.fieldGetMethod = fieldGetMethod;
}
}
|
package com.cg.jdbc;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Map;
import java.util.Scanner;
public class JdbcUpdate {
public static void main(String[] args) {
ReadDbDetails rdb = new ReadDbDetails();
Map<String, String> map = rdb.getDbProp();
Scanner scan = new Scanner(System.in);
try {
Class.forName(map.get("DRIVER"));
String query =
"update employee set desig=?,mobile=? where id=?";
Connection conn = DriverManager.getConnection(map.get("URL"),map.get("USER"),map.get("PASSWORD"));
PreparedStatement stmt = conn.prepareStatement(query);
System.out.println("Enter Your <ID>");
int id = scan.nextInt();
System.out.println("Enter <DESIG> <MOBILE>");
stmt.setString(1, scan.next());
stmt.setLong(2, scan.nextLong());
stmt.setInt(3, id);
int rows = stmt.executeUpdate();
scan.close();
if(rows>0) {
System.out.println("Data Updated");
}else
System.out.println("Failed to Update");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}catch (SQLException e) {
e.printStackTrace();
}
}
}
|
package task179;
import common.Watch;
import java.util.Arrays;
/**
* @author Igor
*/
public class Main179a {
private static final int N = 10_000_000;
public static void main(String[] args) {
Watch.start();
int[] n = new int[N];
for (int i = 2; i < N; i++)
for (int j = i; j < N; j += i)
n[j] += 1;
int count = 0;
for (int i = 1; i < N - 1; i++)
if (n[i] == n[i + 1])
count++;
System.out.println(count);
Watch.stop();
}
}
|
package componentsFX;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
public class TextfieldAndLabel extends GridPane {
private final Label label;
private final TextField text;
/**
* TextField with a label
*
* @param labelString
* @param valueString
*/
public TextfieldAndLabel(String labelString, String valueString) {
this.label = new Label(labelString);
this.text = new TextField(valueString);
this.add(label, 0, 0, 1, 1);
this.add(text, 0, 1, 1, 1);
}
public TextfieldAndLabel(String labelString) {
this(labelString, "");
}
public String getText() {
return text.getText();
}
}
|
/*
* UniTime 3.3 - 3.5 (University Timetabling Application)
* Copyright (C) 2011 - 2013, UniTime LLC, and individual contributors
* as indicated by the @authors tag.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.unitime.timetable.gwt.resources;
import com.google.gwt.i18n.client.Constants;
/**
* @author Tomas Muller
*/
public interface GwtConstants extends Constants {
@DefaultStringValue("3.5")
String version();
@DefaultStringValue("© 2008 - 2014 UniTime LLC")
String copyright();
@DefaultBooleanValue(true)
boolean useAmPm();
@DefaultBooleanValue(false)
boolean firstDayThenMonth();
@DefaultStringArrayValue({"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"})
String[] days();
@DefaultStringValue("MM/dd/yyyy")
String eventDateFormat();
@DefaultStringValue("MM/dd")
String eventDateFormatShort();
@DefaultStringValue("MM/dd, yyyy")
String eventDateFormatLong();
@DefaultStringValue("EEE MM/dd, yyyy")
String meetingDateFormat();
@DefaultStringValue("EEE MM/dd")
String examPeriodDateFormat();
@DefaultStringArrayValue({ "EEE", "MM/dd" })
String[] examPeriodPreferenceDateFormat();
@DefaultStringValue("MM/dd/yyyy hh:mmaa")
String timeStampFormat();
@DefaultStringValue("MM/dd hh:mmaa")
String timeStampFormatShort();
@DefaultIntValue(3)
int eventSlotIncrement();
@DefaultIntValue(90)
int eventStartDefault();
@DefaultIntValue(210)
int eventStopDefault();
@DefaultIntValue(12)
int eventLengthDefault();
@DefaultIntValue(10000)
int maxMeetings();
@DefaultStringArrayValue({"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"})
String[] longDays();
@DefaultStringArrayValue({"M", "T", "W", "Th", "F", "S", "Su"})
String[] shortDays();
@DefaultStringValue("midnight")
String timeMidnight();
@DefaultStringValue("noon")
String timeNoon();
@DefaultStringValue("all day")
String timeAllDay();
@DefaultStringValue("pm")
String timePm();
@DefaultStringValue("am")
String timeAm();
@DefaultStringValue("p")
String timeShortPm();
@DefaultStringValue("a")
String timeShortAm();
@DefaultStringArrayValue({ "h", "hr", "hrs", "hour", "hours" })
String[] parseTimeHours();
@DefaultStringArrayValue({ "m", "min", "mins", "minute", "minutes" })
String[] parseTimeMinutes();
@DefaultStringArrayValue({ "am", "a" })
String[] parseTimeAm();
@DefaultStringArrayValue({ "pm", "p" })
String[] parseTimePm();
@DefaultStringArrayValue({ "noon" })
String[] parseTimeNoon();
@DefaultStringArrayValue({ "midnight" })
String[] parseTimeMidnight();
@DefaultStringValue("Daily")
String daily();
@DefaultStringValue("Arrange Hours")
String arrangeHours();
@DefaultStringArrayValue({
"blue", "green", "orange", "yellow", "pink",
"purple", "teal", "darkpurple", "steelblue", "lightblue",
"lightgreen", "yellowgreen", "redorange", "lightbrown", "lightpurple",
"grey", "bluegrey", "lightteal", "yellowgrey", "brown", "red"})
String[] meetingColors();
@DefaultStringArrayValue({
"Room Timetable", "Subject Timetable", "Curriculum Timetable", "Departmental Timetable", "Personal Timetable", "Course Timetable"
})
String[] resourceType();
@DefaultStringArrayValue({
"Room", "Subject", "Curriculum", "Department", "Person", "Course"
})
String[] resourceName();
@DefaultStringArrayValue({
"Class Event", "Final Examination Event", "Midterm Examination Event", "Course Related Event", "Special Event", "Not Available", "Message"
})
String[] eventTypeName();
@DefaultStringArrayValue({
"Class", "Final Examination", "Midterm Examination", "Course", "Special", "Not Available", "Message"
})
String[] eventTypeAbbv();
@DefaultStringArrayValue({
"Class", "Final", "Midterm", "Course", "Special", "N/A", "Message"
})
String[] eventTypeShort();
@DefaultStringArrayValue({
"Pending", "Approved", "Rejected", "Cancelled"
})
String[] eventApprovalStatus();
// firstDay|lastDay|firstSlot|lastSlot|step
@DefaultStringArrayValue({
"Workdays \u00d7 Daytime|0|4|90|222|6",
"All Week \u00d7 Daytime|0|6|90|222|6",
"Workdays \u00d7 Evening|0|4|222|288|6",
"All Week \u00d7 Evening|0|5|222|288|6",
"All Week \u00d7 All Times|0|6|0|288|6"
})
String[] roomSharingModes();
@DefaultStringValue("MMMM d")
String weekSelectionDateFormat();
@DefaultStringValue("EEEE MMMM d")
String dateSelectionDateFormat();
@DefaultStringValue("EEEE MMMM d yyyy")
String singleDateSelectionFormat();
@DefaultStringValue("M/d")
String dateFormatShort();
@DefaultStringValue("h:mma")
String timeFormatShort();
@DefaultStringValue("MMM d, yyyy")
String sessionDateFormat();
@DefaultStringValue("MM/dd/yyyy")
String dateEntryFormat();
@DefaultStringArrayValue({
"Override: Allow Time Conflict", "Override: Can Assign Over Limit", "Override: Time Conflict & Over Limit"
})
String[] reservationOverrideTypeName();
@DefaultStringArrayValue({
"Time Conflict", "Over Limit", "Time & Limit"
})
String[] reservationOverrideTypeAbbv();
}
|
package com.hadoop;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.hadoop.mapreduce.Reducer;
public class FacebookFriendsReducer extends
Reducer<FriendPair, FriendArray, FriendPair, FriendArray> {
@Override
protected void reduce(
FriendPair key,
Iterable<FriendArray> values,
Reducer<FriendPair, FriendArray, FriendPair, FriendArray>.Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
List<Friend[]> list = new ArrayList<Friend[]>();
List<Friend> commonFriend = new ArrayList<Friend>();
int count = 0;
for (FriendArray value : values) {
Friend[] toadd = Arrays.copyOf(value.get(), value.get().length,
Friend[].class);
list.add(toadd);
count++;
}
if (count != 2) {
return;
}
for (Friend outerF : list.get(0)) {
for (Friend innerF : list.get(1)) {
if (outerF.equals(innerF)) {
if (!(key.getFirst().equals(innerF) || key.getSecond()
.equals(innerF))) {
commonFriend.add(innerF);
}
}
}
}
Friend cfArray[] = Arrays.copyOf(commonFriend.toArray(),
commonFriend.toArray().length, Friend[].class);
context.write(key, new FriendArray(Friend.class, cfArray));
}
}
|
package com.google.android.gms.common.api;
import android.content.IntentSender.SendIntentException;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.e;
class u$b implements Runnable {
final /* synthetic */ u aLV;
private final int aLW;
private final ConnectionResult aLX;
public u$b(u uVar, int i, ConnectionResult connectionResult) {
this.aLV = uVar;
this.aLW = i;
this.aLX = connectionResult;
}
public final void run() {
if (u.a(this.aLV) && !u.b(this.aLV)) {
u.c(this.aLV);
u.a(this.aLV, this.aLW);
u.a(this.aLV, this.aLX);
if (this.aLX.op()) {
try {
this.aLX.b(this.aLV.getActivity(), ((this.aLV.getActivity().getSupportFragmentManager().getFragments().indexOf(this.aLV) + 1) << 16) + 1);
} catch (SendIntentException e) {
u.d(this.aLV);
}
} else if (e.dk(this.aLX.aJC)) {
e.a(this.aLX.aJC, this.aLV.getActivity(), this.aLV, this.aLV);
} else {
u.a(this.aLV, this.aLW, this.aLX);
}
}
}
}
|
package com.pedidovenda.controller;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import com.pedidovenda.model.Pedido;
import com.pedidovenda.model.StatusPedido;
import com.pedidovenda.repository.PedidoRepository;
import com.pedidovenda.repository.filter.PedidoFilter;
import com.pedidovenda.util.jsf.FacesUtil;
@Named
@ViewScoped
public class PesquisaPedidoBean implements Serializable{
private static final long serialVersionUID = 1L;
@Inject
PedidoRepository pedidos;
PedidoFilter filtro;
Pedido pedidoSelecionado;
public void setPedidoSelecionado(Pedido pedidoSelecionado) {
this.pedidoSelecionado = pedidoSelecionado;
}
private List<Pedido> pedidosFiltrados;
public PesquisaPedidoBean(){
filtro = new PedidoFilter();
pedidosFiltrados = new ArrayList<>();
}
public void pesquisar(){
pedidosFiltrados = pedidos.filtrados(filtro);
}
public void remover(){
pedidos.remover(pedidoSelecionado);
FacesUtil.addInfoMessage("Pedido: " + pedidoSelecionado.getId() + " Removido com Sucesso.");
}
public StatusPedido[] getStatuses(){
return StatusPedido.values();
}
public List<Pedido> getPedidosFiltrados() {
return pedidosFiltrados;
}
public PedidoFilter getFiltro() {
return filtro;
}
public Pedido getPedidoSelecionado() {
return pedidoSelecionado;
}
}
|
package gui.controllers;
import enums.PIDControllerType;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javafx.scene.control.TextFormatter;
import javafx.scene.control.TextFormatter.Change;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.util.StringConverter;
import remote.Car;
import remote.Server;
import remote.datatypes.PIDParams;
import remote.listeners.DataListener;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.UnaryOperator;
import java.util.regex.Pattern;
/**
* Control Parameter-feature Controller class. This is the main controller class for the Control Parameter-module.
*
* @author Henrik Nilsson
*/
public class ControlParameterFeatureController implements DataListener<PIDParams> {
@FXML private GridPane controlGrid;
@FXML private TextField controlParameterKP;
@FXML private TextField controlParameterKI;
@FXML private TextField controlParameterKD;
@FXML private TextField controlParameterAlpha;
@FXML private TextField controlParameterBeta;
@FXML private TextField controlParameterAngle;
@FXML private TextField controlParameterSpeed;
@FXML private TextField controlParameterMin;
@FXML private TextField controlParameterSlope;
private AtomicBoolean editing;
public ControlParameterFeatureController() {
editing = new AtomicBoolean(false);
Car.getInstance().addLateBind(this::subscribe);
}
/**
* Initialize method called by JavaFX thread when JavaFX-objects are constructed and ready.
* This sets up all input formatters for parameter inputs.
*/
public void initialize() {
// Add formatters and converters
Pattern validEditingState = Pattern.compile("-?(([1-9][0-9]*)|0)?(\\.[0-9]*)?");
UnaryOperator<Change> filter = c -> {
String text = c.getControlNewText();
if (validEditingState.matcher(text).matches()) {
return c ;
} else {
return null ;
}
};
StringConverter<Double> converter = new StringConverter<Double>() {
@Override
public Double fromString(String s) {
if (s.isEmpty() || "-".equals(s) || ".".equals(s) || "-.".equals(s)) {
return 0.0 ;
} else {
return Double.valueOf(s);
}
}
@Override
public String toString(Double d) {
return d.toString();
}
};
TextFormatter<Double> kpFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> kiFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> kdFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> alphaFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> betaFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> angleFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> speedFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> minFormatter = new TextFormatter<>(converter, 0.0, filter);
TextFormatter<Double> slopeFormatter = new TextFormatter<>(converter, 0.0, filter);
controlParameterKP.setTextFormatter(kpFormatter);
controlParameterKI.setTextFormatter(kiFormatter);
controlParameterKD.setTextFormatter(kdFormatter);
controlParameterAlpha.setTextFormatter(alphaFormatter);
controlParameterBeta.setTextFormatter(betaFormatter);
controlParameterAngle.setTextFormatter(angleFormatter);
controlParameterSpeed.setTextFormatter(speedFormatter);
controlParameterMin.setTextFormatter(minFormatter);
controlParameterSlope.setTextFormatter(slopeFormatter);
Car.getInstance().addLateBind(this::subscribe);
}
/**
* Handle Update button click event. Toggle input lock and pull the server when updating.
* @param mouseEvent Triggering event
*/
public void handleUpdateClicked(MouseEvent mouseEvent) {
if (editing.get()) {
PIDParams newParams = getPIDParamsFromInput();
PIDControllerType subSystem = getParamSubsystem();
lockInputs();
editing.set(false);
Server.getInstance().getRequestBuilder().addSendControlParametersRequest(subSystem, newParams);
Server.getInstance().releaseBuilder();
Server.getInstance().pull();
}
else {
unlockInputs();
editing.set(true);
}
}
/**
* Get the PIDParams from the input fields.
* @return New PID Controller params from the current text inputs
*/
private PIDParams getPIDParamsFromInput() {
double kp = (Double) controlParameterKP.getTextFormatter().getValue();
double ki = (Double) controlParameterKI.getTextFormatter().getValue();
double kd = (Double) controlParameterKD.getTextFormatter().getValue();
double alpha = (Double) controlParameterAlpha.getTextFormatter().getValue();
double beta = (Double) controlParameterBeta.getTextFormatter().getValue();
double angle = (Double) controlParameterAngle.getTextFormatter().getValue();
double speed = (Double) controlParameterSpeed.getTextFormatter().getValue();
double min = (Double) controlParameterMin.getTextFormatter().getValue();
double slope = (Double) controlParameterSlope.getTextFormatter().getValue();
return new PIDParams(kp, ki, kd, alpha, beta, angle, speed, min, slope);
}
/**
* Get the subsystem represented by this feature by looking at the parent ID.
* @return Which subsystem type this feature represents
*/
private PIDControllerType getParamSubsystem() {
String parentName = controlGrid.getParent().getParent().getId();
PIDControllerType subSystem = null;
if (parentName.startsWith("Turning"))
subSystem = PIDControllerType.TURNING;
else if (parentName.startsWith("Parking"))
subSystem = PIDControllerType.PARKING;
else if (parentName.startsWith("Stopping"))
subSystem = PIDControllerType.STOPPING;
else if (parentName.startsWith("LineAngle"))
subSystem = PIDControllerType.LINE_ANGLE;
else if (parentName.startsWith("LineSpeed"))
subSystem = PIDControllerType.LINE_SPEED;
return subSystem;
}
/**
* Lock parameter inputs.
*/
private void lockInputs() {
controlParameterKP.setEditable(false);
controlParameterKI.setEditable(false);
controlParameterKD.setEditable(false);
controlParameterAlpha.setEditable(false);
controlParameterBeta.setEditable(false);
controlParameterAngle.setEditable(false);
controlParameterSpeed.setEditable(false);
controlParameterMin.setEditable(false);
controlParameterSlope.setEditable(false);
}
/**
* Unlock parameter inputs.
*/
private void unlockInputs() {
controlParameterKP.setEditable(true);
controlParameterKI.setEditable(true);
controlParameterKD.setEditable(true);
controlParameterAlpha.setEditable(true);
controlParameterBeta.setEditable(true);
controlParameterAngle.setEditable(true);
controlParameterSpeed.setEditable(true);
controlParameterMin.setEditable(true);
controlParameterSlope.setEditable(true);
}
/**
* Subscribe to changes of parameter data.
*/
public void subscribe() {
switch (getParamSubsystem()) {
case TURNING:
Car.getInstance().turningParams.subscribe(this);
break;
case PARKING:
Car.getInstance().parkingParams.subscribe(this);
break;
case STOPPING:
Car.getInstance().stoppingParams.subscribe(this);
break;
case LINE_ANGLE:
Car.getInstance().lineAngleParams.subscribe(this);
break;
case LINE_SPEED:
Car.getInstance().lineSpeedParams.subscribe(this);
break;
}
}
@Override
public void update(PIDParams data) {
controlParameterKP.setText(String.valueOf(data.kp));
controlParameterKI.setText(String.valueOf(data.ki));
controlParameterKD.setText(String.valueOf(data.kd));
controlParameterAlpha.setText(String.valueOf(data.alpha));
controlParameterBeta.setText(String.valueOf(data.beta));
controlParameterAngle.setText(String.valueOf(data.angleThreshold));
controlParameterSpeed.setText(String.valueOf(data.speedThreshold));
controlParameterMin.setText(String.valueOf(data.minValue));
controlParameterSlope.setText(String.valueOf(data.slope));
}
}
|
package com.mycom.calculator;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
/**
* Panel whose background can be set to any image.
*
* @author Kannan S
* @version 4.0 04/09/2003
*/
public class BackgroundPanel extends JPanel
{
private ImageIcon bgIcon;
public BackgroundPanel() {
super();
}
protected void paintComponent(Graphics g) {
if (bgIcon == null) {
super.paintComponent(g);
} else {
bgIcon = new ImageIcon(bgIcon.getImage().getScaledInstance(this.getSize().width,
this.getSize().height, Image.SCALE_DEFAULT));
g.drawImage(bgIcon.getImage(), 0, 0, this);
}
}
public ImageIcon getBackgroundImage() {
return bgIcon;
}
public void setBackgroundImage(ImageIcon icon) {
bgIcon = icon;
repaint();
}
}
|
package com.example.beatr.miscuentas;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
/**
* Created by beatr on 26/02/2018.
*/
public class Anio implements Parcelable {
public int anio;
public ArrayList<Mes> meses;
public Anio(){}
public Anio(int anio){
this.anio=anio;
meses=new ArrayList<Mes>();
}
// Required method to write to Parcel
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(anio);
dest.writeList(meses);
}
/**
* Constructs a Question from a Parcel
* @param parcel Source Parcel
*/
public Anio(Parcel parcel) {
this.anio = parcel.readInt();
this.meses = parcel.readArrayList(Mes.class.getClassLoader());
}
@Override
public int describeContents() {
return 0;
}
// Method to recreate a Question from a Parcel
public static Creator<Anio> CREATOR = new Creator<Anio>() {
@Override
public Anio createFromParcel(Parcel source) {
return new Anio(source);
}
@Override
public Anio[] newArray(int size) {
return new Anio[size];
}
};
}
|
package com.mideas.rpg.v2.game;
public enum SocialFrameMenu {
FRIEND_FRAME,
WHO_FRAME,
GUILD_FRAME,
DISCUSSION_FRAME,
RAID_FRAME;
}
|
package test.cps3230.yahoo;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.ArrayList;
import java.util.List;
public class YahooTestSteps{
WebDriver driver;
@Given("I am a user of news.yahoo.com")
public void iAmAUserOfNewsYahooCom() {
driver = new ChromeDriver();
driver.manage().window().maximize();
}
@When("I visit news.yahoo.com")
public void iVisitNewsYahooCom() {
driver.get("https://www.news.yahoo.com");
driver.switchTo().activeElement().sendKeys(Keys.TAB);
driver.switchTo().activeElement().sendKeys(Keys.TAB);
driver.switchTo().activeElement().sendKeys(Keys.TAB);
driver.switchTo().activeElement().sendKeys(Keys.TAB);
driver.switchTo().activeElement().sendKeys(Keys.TAB);
driver.switchTo().activeElement().sendKeys(Keys.TAB);
driver.switchTo().activeElement().sendKeys(Keys.ENTER);
}
@And("I click on the {string} section")
public void iClickOnTheSection(String arg0) {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@title='"+arg0+"']")));
WebElement element = driver.findElement(By.xpath("//a[@title='"+arg0+"']"));
element.click();
}
@Then("I should be taken to {string} section")
public void iShouldBeTakenToSection(String arg0) {
WebDriverWait wait = new WebDriverWait(driver, 10);
String resultPage = "https://www.yahoo.com/news/"+arg0.toLowerCase()+"/";
wait.until(ExpectedConditions.urlMatches(resultPage));
Assertions.assertEquals(resultPage, driver.getCurrentUrl());
}
@And("the section should have at least {int} stories")
public void theSectionShouldHaveAtLeastResStories(int int1) {
List<WebElement> articles = driver.findElements((By.xpath("//li[@class='js-stream-content Pos(r)']")));
Assertions.assertTrue(articles.size() >= int1);
}
@And("I search for stories about {string}")
public void iSearchForStoriesAbout(String arg0) {
WebElement searchField = driver.findElement(By.xpath("//input[@data-reactid='45']"));
searchField.sendKeys(arg0);
WebElement searchNewsButton = driver.findElement(By.xpath("//button[@data-reactid='50']"));
searchNewsButton.click();
}
@Then("I should see the search results of {string}")
public void iShouldSeeTheSearchResultsOf(String arg0) {
WebDriverWait wait = new WebDriverWait(driver, 10);
String formattedArg = arg0;
formattedArg = formattedArg.replace(' ', '+');
String resultPage = "https://news.search.yahoo.com/search?p=" + formattedArg;
wait.until(ExpectedConditions.urlContains(resultPage));
Assertions.assertTrue(driver.getCurrentUrl().contains(resultPage));
}
@And("there should be at least {int} stories in the search results")
public void thereShouldBeAtLeastStoriesInTheSearchResults(int arg0) {
List<WebElement> newsArticles = driver.findElements(By.className("compArticleList"));
Assertions.assertTrue(newsArticles.size() >= arg0);
}
@When("I click on the first story in the results")
public void iClickOnTheFirstStoryInTheResults() {
List<WebElement> newsArticles = driver.findElements(By.className("compArticleList"));
List<WebElement> firstArticle = newsArticles.get(0).findElements(By.tagName("a"));
firstArticle.get(1).click();
}
@Then("I should be taken to the story")
public void iShouldBeTakenToTheStory() {
WebDriverWait wait2 = new WebDriverWait(driver, 15);
wait2.until(ExpectedConditions.numberOfWindowsToBe(3));
ArrayList<String> tabs = new ArrayList<String> (driver.getWindowHandles());
driver.switchTo().window(tabs.get(2));
WebElement articleHeadline = driver.findElement(By.xpath("//h1[@data-test-locator='headline']"));
Assertions.assertNotNull(articleHeadline);
}
@Then("I should see the widget")
public void iShouldSeeTheWidget() {
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,350)");
WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("Col2-5-WeatherSimpleForecast")));
WebElement weatherWidget = driver.findElement(By.id("Col2-5-WeatherSimpleForecast"));
Assertions.assertNotNull(weatherWidget);
}
@When("I try to get weather about {string}")
public void iTryToGetWeatherAbout(String arg0) {
WebElement weatherWidget = driver.findElement(By.id("Col2-5-WeatherSimpleForecast"));
WebElement button = weatherWidget.findElement(By.tagName("button"));
button.click();
driver.switchTo().activeElement().sendKeys(arg0);
driver.switchTo().activeElement().sendKeys(Keys.ENTER);
}
@Then("I should see weather forecast of {string}")
public void iShouldSeeWeatherForecastOf(String arg0) {
WebElement weatherWidget = driver.findElement(By.id("Col2-5-WeatherSimpleForecast"));
WebElement city = weatherWidget.findElement(By.tagName("h2"));
String val = city.getText();
Assertions.assertEquals(arg0, val);
}
@When("I try to click on the widget")
public void iTryToClickOnTheWidget() {
WebElement weatherWidget = driver.findElement(By.id("Col2-5-WeatherSimpleForecast"));
WebElement forecast = weatherWidget.findElement(By.xpath("//a[@aria-label='Full forecast']"));
forecast.click();
}
@Then("I should be redirected to a weather forecast webpage")
public void iShouldBeRedirectedToAWeatherForecastWebpage() {
WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.urlContains("/news/weather/"));
String url = driver.getCurrentUrl();
Assertions.assertTrue(url.contains("/news/weather/"));
}
@AfterEach
public void teardown() {
driver.quit();
}
}
|
package com.bw.movie.IView;
public interface IBaseView {
}
|
package org.opensoft.view.controllers;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.el.ELResolver;
import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.apache.myfaces.trinidad.component.UIXTree;
import org.apache.myfaces.trinidad.event.FocusEvent;
import org.apache.myfaces.trinidad.model.ChildPropertyTreeModel;
import org.apache.myfaces.trinidad.model.CollectionModel;
import org.apache.myfaces.trinidad.model.RowKeySet;
import org.apache.myfaces.trinidad.model.RowKeySetTreeImpl;
import org.apache.myfaces.trinidad.model.TreeModel;
import org.opensoft.view.beans.BeanTreeItem;
public class MainTemplateController extends AbstractController {
private List<BeanTreeItem> menuRoot;
private transient TreeModel model;
private String nombreSistema;
public MainTemplateController() {
super();
}
@PostConstruct
public void init() {
System.out.println("Iniciando - MainTemplateController ");
setNombreSistema("<b>Sistema de Información y gestión de Proyectos</b><br></br>Fundación Ecuador");
menuRoot = new ArrayList<BeanTreeItem>();
//opncion de premios
BeanTreeItem node = new BeanTreeItem();
node.setText("Distribución Premios");
List<BeanTreeItem> nodeChildren = new ArrayList<BeanTreeItem>();
BeanTreeItem nodeChild = new BeanTreeItem();
nodeChild.setText("Cargar matriz de Premios");
nodeChild.setAction("/pages/distribucion/cargadistribucion.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Ver matriz de Premios");
nodeChild.setAction("/pages/distribucion/verdistribucion.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Crear matriz de Premios con plantilla");
nodeChild.setAction("/pages/distribucion/creardistribucion.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Generar matriz de Premios");
nodeChild.setAction("");
nodeChildren.add(nodeChild);
node.setChildren(nodeChildren);
menuRoot.add(node);
//opcion de formularios
node = new BeanTreeItem();
node.setText("Formulario de Colegios");
nodeChildren = new ArrayList<BeanTreeItem>();
nodeChild = new BeanTreeItem();
nodeChild.setText("Cargar alumnos premiados");
nodeChild.setAction("/pages/formulario/cargapremiados.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Ver premiados");
nodeChild.setAction("/pages/formulario/verpremiados.jsf");
nodeChildren.add(nodeChild);
/*
///tercer nivel de carga de formulario
List<BeanTreeItem> nodeChildren3Nivel = new ArrayList<BeanTreeItem>();
BeanTreeItem nodeChild3Nivel = new BeanTreeItem();
nodeChild3Nivel.setText("Cargar distribución de premios");
nodeChild3Nivel.setAction("/faces/pages/cargas/cargadistribucionpremios.jspx");
nodeChildren3Nivel.add(nodeChild3Nivel);
nodeChild3Nivel = new BeanTreeItem();
nodeChild3Nivel.setText("Cargar alumnos premiados");
nodeChild3Nivel.setAction("/faces/pages/cargas/cargapremiados.jspx");
nodeChildren3Nivel.add(nodeChild3Nivel);
nodeChild.setChildren(nodeChildren3Nivel);
nodeChildren.add(nodeChild);
///fin tercer nivel de carga de formulario
*/
nodeChild = new BeanTreeItem();
nodeChild.setText("Modificar formularios");
nodeChild.setAction("/faces/ModificarFormularios");
nodeChildren.add(nodeChild);
node.setChildren(nodeChildren);
menuRoot.add(node);
//opcion de registro estudiante
node = new BeanTreeItem();
node.setText("Registros");
nodeChildren = new ArrayList<BeanTreeItem>();
nodeChild = new BeanTreeItem();
nodeChild.setText("Registro de estudiantes");
nodeChild.setAction("/pages/registro/gestionregistro.jsf");
nodeChildren.add(nodeChild);
node.setChildren(nodeChildren);
menuRoot.add(node);
//opcion de reportes
node = new BeanTreeItem();
node.setText("Reportes");
nodeChildren = new ArrayList<BeanTreeItem>();
nodeChild = new BeanTreeItem();
nodeChild.setText("Lista de colegios");
nodeChild.setAction("/pages/consultas/colegios.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Lista alumnos por colegios");
nodeChild.setAction("/pages/consultas/alumnos.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Lista de directores de colegios");
nodeChild.setAction("/pages/consultas/directores.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Colegios que entregaron formularios");
nodeChild.setAction("/pages/consultas/formularios.jsf");
nodeChildren.add(nodeChild);
node.setChildren(nodeChildren);
//menuRoot.add(node);
//opcion de administracion
node = new BeanTreeItem();
node.setText("Administracion");
nodeChildren = new ArrayList<BeanTreeItem>();
nodeChild = new BeanTreeItem();
nodeChild.setText("Colegios");
nodeChild.setAction("/pages/administracion/colegios/colegios.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Roles");
nodeChild.setAction("/pages/administracion/roles/roles.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Usuarios");
nodeChild.setAction("/pages/administracion/usuarios/usuarios.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Perfiles");
nodeChild.setAction("/pages/administracion/perfiles/perfiles.jsf");
nodeChildren.add(nodeChild);
nodeChild = new BeanTreeItem();
nodeChild.setText("Periodos");
nodeChild.setAction("/pages/administracion/periodos/periodos.jsf");
nodeChildren.add(nodeChild);
node.setChildren(nodeChildren);
menuRoot.add(node);
System.out.println("menuRoot - " + menuRoot);
}
public TreeModel getMenuTreeModel() {
if (model == null) {
model = new ChildPropertyTreeModel(menuRoot, "children");
}
return model;
}
protected Object _focusRowKey = null;
public void onTreeFocusListener(FocusEvent focusEvent) {
_focusRowKey = ((UIXTree) focusEvent.getSource()).getRowKey();
}
public Object getDefaultFocusRowKey() {
return _focusRowKey;
}
protected UIXTree _folderTree;
private UIComponent _getComponent() {
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ELResolver elRes = app.getELResolver();
Object editor = elRes.getValue(context.getELContext(), null, "editor");
return (UIComponent) elRes.getValue(context.getELContext(), editor, "component");
}
protected boolean _treeInit = false;
protected RowKeySet _treeDisclosedRowKeys = null;
public RowKeySet getTreeDisclosedRowKeys() {
if (_folderTree == null)
_folderTree = (UIXTree) _getComponent();
if (_folderTree != null && !_treeInit) {
_treeInit = true;
_treeDisclosedRowKeys = new RowKeySetTreeImpl();
_treeDisclosedRowKeys.setCollectionModel((CollectionModel) _folderTree.getValue());
Object oldKey = _folderTree.getRowKey();
try {
_folderTree.setRowKey(null);
_folderTree.setRowIndex(0);
_treeDisclosedRowKeys.add(_folderTree.getRowKey());
} finally {
_folderTree.setRowKey(oldKey);
}
}
return _treeDisclosedRowKeys;
}
private String trxActual = "0";
/**
* Evento que se dispara al seleccionar una opción del menú de árbol que tiene la aplicación, aquí se obtiene el
* valor del atributo "attrUrlTarget" que envía el POST que realiza el menu-item del árbol. Posteriormente el valor
* del atributo "attrUrlTarget" es utilizado por el Action "actionTreeMenuItem" para la navegación entre opciones.
* @param actionEvent
*/
public void onTreeMenuItem(ActionEvent actionEvent) {
String attrUrlTarget =
actionEvent.getComponent().getAttributes().get("attrUrlTarget") == null ? null :
(String) actionEvent.getComponent().getAttributes().get("attrUrlTarget");
setTrxActual(attrUrlTarget);
for (int i = 0; i < (int) (Integer.MAX_VALUE / 1.5); i++) {
int vali = i - 1;
}
if ("0".equals(attrUrlTarget))
_focusRowKey = null;
return;
}
public void setTrxActual(String trxActual) {
this.trxActual = trxActual;
}
public String getTrxActual() {
return trxActual;
}
/**
* Action que tienen asociado los items del menú de árbol para la navegación entre las diferentes opciones
* de la aplicación.
* @return
*/
public String actionTreeMenuItem() {
System.out.println("Menu action -> " + getTrxActual());
return getTrxActual();
}
public void setNombreSistema(String nombreSistema) {
this.nombreSistema = nombreSistema;
}
public String getNombreSistema() {
return nombreSistema;
}
}
|
package jie.android.ip.setup;
import java.io.File;
import java.sql.Connection;
import jie.android.ip.CommonConsts.SystemConfig;
public abstract class Setup {
public abstract void create();
public abstract String getStorageDirectory();
public abstract String getAppDirectory();
public abstract String getCacheDirectory();
public abstract Connection getDatabaseConnection();
public abstract Connection getPatchConnection();
public boolean hasPatch() {
final File patch = new File(getCacheDirectory() + SystemConfig.PATCH_FILE);
return patch.exists();
}
public void removePatch() {
final File patch = new File(getCacheDirectory() + SystemConfig.PATCH_FILE);
patch.delete();
}
public abstract boolean shareScreen();
}
|
package Chap3;
public class WhilePrintFrom1To10 {
public static void main(String...args) {
int sum = 0;
int i = 1;
while(i<=100) {
sum+=i; // i변수의 값을 누적+
i++;
} // while
System.out.printf("1~%d 합: %d\n", (i-1), sum);
} // main
} // end class
|
package com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.builder;
import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.ABKUEHLPlanungType;
import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.BEWB01PlanungType;
import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.ERHITZENPlanungType;
import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.WARMWALZPlanungType;
import java.io.StringWriter;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
public class BEWB01PlanungTypeBuilder
{
public static String marshal(BEWB01PlanungType bEWB01PlanungType)
throws JAXBException
{
JAXBElement<BEWB01PlanungType> jaxbElement = new JAXBElement<>(new QName("TESTING"), BEWB01PlanungType.class , bEWB01PlanungType);
StringWriter stringWriter = new StringWriter();
return stringWriter.toString();
}
private ERHITZENPlanungType eRHITZEN;
private WARMWALZPlanungType wARMWALZ;
private ABKUEHLPlanungType aBKUEHL;
public BEWB01PlanungTypeBuilder setERHITZEN(ERHITZENPlanungType value)
{
this.eRHITZEN = value;
return this;
}
public BEWB01PlanungTypeBuilder setWARMWALZ(WARMWALZPlanungType value)
{
this.wARMWALZ = value;
return this;
}
public BEWB01PlanungTypeBuilder setABKUEHL(ABKUEHLPlanungType value)
{
this.aBKUEHL = value;
return this;
}
public BEWB01PlanungType build()
{
BEWB01PlanungType result = new BEWB01PlanungType();
result.setERHITZEN(eRHITZEN);
result.setWARMWALZ(wARMWALZ);
result.setABKUEHL(aBKUEHL);
return result;
}
}
|
package com.jakob.tonsleymaps;
/* Written by Jakob Pennington
*
* An object to represent the occupant of a room in the database.
*/
public class Occupant extends SearchResult {
private String locationName;
private String floorName;
private String roomNo;
private String roomName;
private String prefix;
private String name;
private String phone;
private String email;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFloorName() {
return floorName;
}
public void setFloorName(String floorName) {
this.floorName = floorName;
}
public String getRoomNo() {
return roomNo;
}
public void setRoomNo(String roomNo) {
this.roomNo = roomNo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
//setResultTitle and setResultDescription methods required to set superclass values after
//subclass is fully created, enabling superclass fields to contain multiple sublcass fields
public void setResultTitle() {
if (this.prefix != null) {
this.setTitle(this.prefix + " " + this.name);
} else {
this.setTitle(this.name);
}
}
public void setResultDescription() {
this.setDescription(this.roomNo + " - " + this.floorName + " - " + this.locationName);
}
}
|
package com.android.yinwear.core.db.dao;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import com.android.yinwear.core.db.entity.DeviceDetail;
import java.util.List;
@Dao
public interface DeviceDao {
@Query("SELECT * FROM devicedetail")
List<DeviceDetail> getAll();
@Query("SELECT * FROM devicedetail WHERE device_id IN (:deviceIds)")
List<DeviceDetail> loadDeviceByIds(String[] deviceIds);
@Insert
void insert(DeviceDetail devicedetail);
@Insert
void insertAll(DeviceDetail[] devicedetail);
@Delete
void delete(DeviceDetail devicedetail);
@Query("DELETE FROM devicedetail")
public void deleteAll();
@Update
void update(DeviceDetail devicedetail);
}
|
package com.workorder.ticket;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
@ComponentScan("com.workorder.ticket")
@PropertySource({ "classpath:application-test.properties" })
@MapperScan("com.workorder.ticket.persistence.dao")
public class TicketLauncher {
public static void main(String[] args) {
SpringApplication.run(TicketLauncher.class, args);
}
}
|
import javax.swing.*;
public class GraphicsTester {
public static void main(String[] args) {
JFrame myFrame = new JFrame("Testing Graphics");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.getContentPane().add(new Clicker());
myFrame.pack();
myFrame.setVisible(true);
}
}
|
package com.rishi.baldawa.iq;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.*;
public class GenerateNParenthesisTest {
@Test
public void generateParenthesis() throws Exception {
List<String> expected = Arrays.asList(
"((()))",
"(()())",
"(())()",
"()(())",
"()()()"
);
assertEquals(new GenerateNParenthesis().generateParenthesis(3), expected);
}
}
|
package com.espendwise.manta.model.entity;
// Generated by Hibernate Tools
import com.espendwise.manta.model.ValueObject;
import com.espendwise.manta.model.data.BudgetData;
import com.espendwise.manta.model.data.BudgetDetailData;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
* BudgetEntity generated by hbm2java
*/
@Entity
@Table(name="CLW_BUDGET")
public class BudgetEntity extends ValueObject implements java.io.Serializable {
private static final long serialVersionUID = -1;
public static final String BUDGET_ID = "budgetId";
public static final String DETAILS = "details";
public static final String BUDGET = "budget";
private Long budgetId;
private Collection<BudgetDetailData> details = new ArrayList<BudgetDetailData>(0);
private BudgetData budget;
public BudgetEntity() {
}
public BudgetEntity(Long budgetId) {
this.setBudgetId(budgetId);
}
public BudgetEntity(Long budgetId, Collection<BudgetDetailData> details, BudgetData budget) {
this.setBudgetId(budgetId);
this.setDetails(details);
this.setBudget(budget);
}
@Id
@Column(name="BUDGET_ID", nullable=false)
public Long getBudgetId() {
return this.budgetId;
}
public void setBudgetId(Long budgetId) {
this.budgetId = budgetId;
setDirty(true);
}
@OneToMany(fetch=FetchType.EAGER)
@JoinColumn(name="BUDGET_ID", updatable=false, columnDefinition="number")
public Collection<BudgetDetailData> getDetails() {
return this.details;
}
public void setDetails(Collection<BudgetDetailData> details) {
this.details = details;
setDirty(true);
}
@ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="BUDGET_ID", unique=true, insertable=false, updatable=false)
public BudgetData getBudget() {
return this.budget;
}
public void setBudget(BudgetData budget) {
this.budget = budget;
setDirty(true);
}
}
|
package com.project.cm.repository;
import com.project.cm.model.entity.User;
import org.graalvm.compiler.nodes.calc.IntegerDivRemNode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface UserRepository extends JpaRepository<User,Long> {
User findFirstByPhoneNumberOrderByIdDesc(String phoneNumber);
}
|
package com.tencent.mm.ac.a;
public interface b$a {
public enum a {
;
static {
dNa = 1;
dNb = 2;
dNc = 3;
dNd = new int[]{dNa, dNb, dNc};
}
}
void a(b bVar);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.