blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0a1696005cc2f92b7c84c023ad1c2238af0f395f | 07af209df92e6c247d12f76b91f2f2e2edfb46f0 | /Other_tutorials/JSF/JSF tutorialpoint/TutorialpointJsfSpringIntegrationProject/src/com/tutorialspoint/test/UserData.java | fdb37f4fa77f94223b34da62b10610303bf4ef7c | [] | no_license | michaelzherdev/Java | 7d19bf3358ce5d4cbb4774cdf86488aef9d26bb4 | 5b71e9b42814304d1128d696c91bb97f301a5d99 | refs/heads/master | 2021-01-10T06:31:36.341504 | 2015-10-15T19:31:46 | 2015-10-15T19:31:46 | 44,328,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.tutorialspoint.test;
import java.io.Serializable;
public class UserData implements Serializable {
private static final long serialVersionUID = 1L;
private MessageService messageService;
public MessageService getMessageService() {
return messageService;
}
public void setMessageService(MessageService messageService) {
this.messageService = messageService;
}
public String getGreetingMessage(){
return messageService.getGreetingMessage();
}
} | [
"michaelzherdev@gmail.com"
] | michaelzherdev@gmail.com |
473d8fa8d59205ff5125688bf9d2ea024ff509e3 | 732992b63fc229bb5a52a3e1bce2ffa12b0579f7 | /api/src/main/java/com/github/fernthedev/pi_mp3/api/exceptions/song/NoSongsException.java | bfa4e56ed08c8187650a37b9b122f5604f3f66d1 | [] | no_license | Fernthedev/Pi_MP3 | 547b6764e807a129127676d1e8ece2b34a3f448d | e18f3f8dda754884b651f56a15fb35bea0d23522 | refs/heads/master | 2023-03-03T21:42:05.330524 | 2021-02-16T21:28:09 | 2021-02-16T21:28:09 | 273,111,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,215 | java | package com.github.fernthedev.pi_mp3.api.exceptions.song;
public class NoSongsException extends SongException {
/**
* Constructs a new runtime exception with {@code null} as its
* detail message. The cause is not initialized, and may subsequently be
* initialized by a call to {@link #initCause}.
*/
public NoSongsException() {
super();
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public NoSongsException(String message) {
super(message);
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public NoSongsException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new runtime exception with the specified cause and a
* detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
* {@code cause}). This constructor is useful for runtime exceptions
* that are little more than wrappers for other throwables.
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public NoSongsException(Throwable cause) {
super(cause);
}
/**
* Constructs a new runtime exception with the specified detail
* message, cause, suppression enabled or disabled, and writable
* stack trace enabled or disabled.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled
* or disabled
* @param writableStackTrace whether or not the stack trace should
* be writable
* @since 1.7
*/
protected NoSongsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"15272073+Fernthedev@users.noreply.github.com"
] | 15272073+Fernthedev@users.noreply.github.com |
359566696c1a3394ea2cff2d6886b79aa49cd0b4 | 2b0694f0563192e2d148d130164e94faf3b4e12f | /Android3D游戏开发技术详解与典型案例-OpenGLES1/第22章/CountrysideRacing/src/com/bn/carracer/ViewOver.java | e8b5d54118ed370347df932e5380e805807d6766 | [] | no_license | bxh7425014/BookCode | 4757956275cf540e9996b9064d981f6da75c9602 | 8996b36e689861d55662d15c5db8b0eb498c864b | refs/heads/master | 2020-05-23T00:48:51.430340 | 2017-02-06T01:04:25 | 2017-02-06T01:04:25 | 84,735,079 | 9 | 3 | null | null | null | null | GB18030 | Java | false | false | 2,151 | java | package com.bn.carracer;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import static com.bn.carracer.Constant.*;
public class ViewOver extends SurfaceView implements SurfaceHolder.Callback{
Activity_GL_Racing activity;//声明引用
Bitmap over;//设置界面背景
float screenWidth=480;//图片宽度
float x_Offset=Activity_GL_Racing.screenWidth/2-screenWidth/2;
Paint paint;//画笔
public ViewOver(Activity_GL_Racing activity) {
super(activity);
// TODO Auto-generated constructor stub
this.activity=activity;
getHolder().addCallback(this);
paint=new Paint();
over=BitmapFactory.decodeResource(this.getResources(), R.drawable.over);
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
int x = (int) event.getX();//获取X坐标
int y = (int) event.getY();
if(x>135+x_Offset&&x<343+x_Offset&&y>122&&y<193)//点击主菜单
{
activity.toAnotherView(LOADING);//返回值主菜单
}
if(x>135+x_Offset&&x<343+x_Offset&&y>193&&y<265)//点击在玩一次
{
activity.toAnotherView(ENTER_MENU);//进入游戏
}
break;
}
return true;
}
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
canvas.drawBitmap(over, Activity_GL_Racing.screenWidth/2-screenWidth/2,0, paint);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
Canvas canvas = holder.lockCanvas();//获取画布
try{
synchronized(holder){
onDraw(canvas);//绘制
}
}
catch(Exception e){
e.printStackTrace();
}
finally{
if(canvas != null){
holder.unlockCanvasAndPost(canvas);
}
}
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
}
| [
"bxh7425014@163.com"
] | bxh7425014@163.com |
6fa882d59c9346ab08b8ebf5aaf98b43901377e2 | cd9ed6b0a37b47bffd624e7434158d3eca3cf52d | /Week_02/leetcode_94.java | 1b535beb1178ad4b468997b7f83b65a3c3e39685 | [] | no_license | sky19910906/algorithm024 | 6b3e138936b4402bfad7b6a9237f11975a1b0a80 | 61d870d49016d976966bee9d8b0de604aa602ff0 | refs/heads/main | 2023-04-03T02:28:51.154113 | 2021-04-11T11:27:16 | 2021-04-11T11:27:16 | 334,667,184 | 0 | 0 | null | 2021-01-31T13:53:35 | 2021-01-31T13:53:35 | null | UTF-8 | Java | false | false | 1,139 | java | import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class leetcode_94 {
public List<Integer> inorderTraversal(TreeNode root) {
List<Integer> result = new ArrayList<Integer>();
inorderTraversal(result, root);
return result;
}
public void inorderTraversal(List<Integer> result,TreeNode node) {
if (node == null) {
return;
}
//左根右
inorderTraversal(result,node.left);
result.add(node.val);
inorderTraversal(result,node.right);
}
public List<Integer> inorderTraversalIter(TreeNode root) {
List<Integer> result = new ArrayList<Integer>();
Stack<TreeNode> stack = new Stack<TreeNode>();
while (root != null || !stack.isEmpty()) {
while(root != null) {
stack.push(root);
root = root.left;
}
root = stack.pop();
result.add(root.val);
root = root.right;
}
return result;
}
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode() {
}
TreeNode(int val) {
this.val = val;
}
TreeNode(int val, TreeNode left, TreeNode right) {
this.val = val;
this.left = left;
this.right = right;
}
}
}
| [
"752236348@qq.com"
] | 752236348@qq.com |
144882c8f78641f75dd71e7f27bb150e3361f9e1 | ce5f5095ad583026e9ee88105dee1d7c75799c56 | /src/mrl_2021/complex/firebrigade/TargetBaseExploreManager.java | b237f122d5b46d788e54b7e5d0696391d98a1f9b | [
"MIT",
"BSD-3-Clause"
] | permissive | amirh-moshfeghi/MRL-Rescue-Simulation | cecd2a3dd16b070e345b33f8f77506a915c28176 | 5a3340ce9334ae3ce552edd8e05a77e903d18ea6 | refs/heads/master | 2023-08-15T21:48:14.328241 | 2021-10-15T18:04:38 | 2021-10-15T18:04:38 | 417,587,162 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,067 | java | package mrl_2021.complex.firebrigade;
import adf.agent.action.fire.ActionExtinguish;
import adf.agent.communication.MessageManager;
import adf.agent.develop.DevelopData;
import adf.agent.info.AgentInfo;
import adf.agent.info.ScenarioInfo;
import adf.agent.info.WorldInfo;
import adf.agent.module.ModuleManager;
import adf.agent.precompute.PrecomputeData;
import adf.component.extaction.ExtAction;
import adf.component.module.algorithm.PathPlanning;
import adf.component.module.complex.Search;
import rescuecore2.standard.entities.Area;
import rescuecore2.standard.entities.StandardEntityURN;
import rescuecore2.worldmodel.EntityID;
import java.util.List;
import static rescuecore2.standard.entities.StandardEntityURN.AMBULANCE_TEAM;
import static rescuecore2.standard.entities.StandardEntityURN.FIRE_BRIGADE;
import static rescuecore2.standard.entities.StandardEntityURN.POLICE_FORCE;
/**
* Created with IntelliJ IDEA.
* User: MRL
* Date: 11/26/13
* Time: 7:55 PM
*
* @Author: Mostafa Shabani
*/
public class TargetBaseExploreManager extends ExploreManager {
private PathPlanning pathPlanning;
public TargetBaseExploreManager(AgentInfo ai, WorldInfo wi, ScenarioInfo si, ModuleManager moduleManager, DevelopData developData) {
super(ai, wi, si, moduleManager, developData);
StandardEntityURN agentURN = ai.me().getStandardURN();
switch (si.getMode()) {
case PRECOMPUTATION_PHASE:
if (agentURN == AMBULANCE_TEAM) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Ambulance", "adf.sample.module.algorithm.SamplePathPlanning");
} else if (agentURN == FIRE_BRIGADE) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Fire", "adf.sample.module.algorithm.SamplePathPlanning");
} else if (agentURN == POLICE_FORCE) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Police", "adf.sample.module.algorithm.SamplePathPlanning");
}
break;
case PRECOMPUTED:
if (agentURN == AMBULANCE_TEAM) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Ambulance", "adf.sample.module.algorithm.SamplePathPlanning");
} else if (agentURN == FIRE_BRIGADE) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Fire", "adf.sample.module.algorithm.SamplePathPlanning");
} else if (agentURN == POLICE_FORCE) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Police", "adf.sample.module.algorithm.SamplePathPlanning");
}
break;
case NON_PRECOMPUTE:
if (agentURN == AMBULANCE_TEAM) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Ambulance", "adf.sample.module.algorithm.SamplePathPlanning");
} else if (agentURN == FIRE_BRIGADE) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Fire", "adf.sample.module.algorithm.SamplePathPlanning");
} else if (agentURN == POLICE_FORCE) {
this.pathPlanning = moduleManager.getModule("SampleSearch.PathPlanning.Police", "adf.sample.module.algorithm.SamplePathPlanning");
}
break;
}
}
protected FireBrigadeTarget exploringTarget = null;
protected Area preFBTargetArea = null;
private int timeToExtinguish = MAX_TIME_TO_EXTINGUISH;
private static final int MAX_TIME_TO_EXTINGUISH = 4;
private static final int MAX_TIME_TO_EXTINGUISH_CL = 4;
private boolean reachedToFirstTarget = true;
/**
* In this strategy fireBrigade "MAX_TIME_TO_EXTINGUISH" to extinguish only.
* if time to extinguish finished and target is not extinguished FB should be goto explore for all explore targets and back to extinguish work.
* zamani ke map CL bashad har 4 cycle explore mikonad. va dar gheire pas az 6 cycle extinguish momtad.
*
* @param fireBrigadeTarget target of this agent
* @return boolean is true equals now goto explore
*/
public boolean isTimeToExplore(FireBrigadeTarget fireBrigadeTarget) {
boolean returnVal = false;
Area area = exploreDecisionMaker.getNextArea();
if (lastFireBrigadeTarget != null) {
Integer lastClusterId = lastFireBrigadeTarget.getCluster().getId();
Integer exploringClusterId = (exploringTarget == null ? null : exploringTarget.getCluster().getId());
Integer newClusterId = (fireBrigadeTarget == null ? null : fireBrigadeTarget.getCluster().getId());
boolean targetChanged = !lastClusterId.equals(newClusterId) || (exploringClusterId != null && !exploringClusterId.equals(newClusterId));
boolean fireIsNear = fireBrigadeTarget != null && world.getDistance(fireBrigadeTarget.getMrlBuilding().getID(), world.getSelfPosition().getID()) <= world.getViewDistance();
if (!reachedToFirstTarget && area != null && !fireIsNear) {
if (preFBTargetArea != null && preFBTargetArea.getID().equals(world.getSelfPosition().getID())) {
reachedToFirstTarget = true;
// world.printData("reachedToFirstTarget " + preFBTargetArea);
} else {
lastFireBrigadeTarget = fireBrigadeTarget;
preFBTargetArea = area;
return true;
}
}
if (targetChanged && area != null && !fireIsNear) {
lastFireBrigadeTarget = fireBrigadeTarget;
// world.printData("continue explore goto " + area);
return true;
}
EntityID clusterLeaderId = leaderSelector.findLeader(lastFireBrigadeTarget);
if (clusterLeaderId != null && world.getAgentInfo().getID().equals(clusterLeaderId)) {
if (fireBrigadeTarget == null || targetChanged || timeToExtinguish == 0) {
timeToExtinguish = MAX_TIME_TO_EXTINGUISH;
if (world.isCommunicationLess()) {
timeToExtinguish = MAX_TIME_TO_EXTINGUISH_CL;
}
exploreDecisionMaker.setTargetFire(lastFireBrigadeTarget, fireBrigadeTarget == null);
preFBTargetArea = exploreDecisionMaker.getNextArea();
exploringTarget = lastFireBrigadeTarget;
reachedToFirstTarget = false;
returnVal = true;
// LOGGER.debug("now I'm goto exploring cluster " + lastFireBrigadeTarget.getCluster().getId() + " places:" + exploreTargets);
// world.printData("now I'm goto exploring cluster " + lastFireBrigadeTarget.getCluster().getId() + " places: " + exploreDecisionMaker.getExploreTargets());
} else {
ExtAction extAction = world.getModuleManager().getExtAction("TacticsFireBrigade.ActionFireFighting", "adf.sample.extaction.ActionFireFighting");
boolean wasExtinguish = extAction != null && extAction.getAction() != null && (extAction.getAction() instanceof ActionExtinguish);
if (wasExtinguish) {
timeToExtinguish--;
} else {
timeToExtinguish = MAX_TIME_TO_EXTINGUISH;
}
}
}
} else if (area != null) {
returnVal = true;
}
lastFireBrigadeTarget = fireBrigadeTarget;
// MrlPersonalData.VIEWER_DATA.setExploreBuildings(world.getSelf().getID(), new FastSet<MrlBuilding>());
return returnVal;
}
private void initialize() {
exploreDecisionMaker.initialize();
}
@Override
public Search updateInfo(MessageManager messageManager) {
super.updateInfo(messageManager);
if (getCountUpdateInfo() >= 2) {
return this;
}
this.world.updateInfo(messageManager);
this.pathPlanning.updateInfo(messageManager);
return null;
}
// @Override
// public void execute() {
// exploreDecisionMaker.getNextArea()
// }
static int tryCount = 0;
static int lastTime = 0;
protected Area targetArea = null;
protected EntityID target = null;
@Override
public Search calc() {
execute();
return this;
}
@Override
public EntityID getTarget() {
return target;
}
@Override
public Search precompute(PrecomputeData precomputeData) {
super.precompute(precomputeData);
if (getCountPrecompute() >= 2) {
return this;
}
this.world.precompute(precomputeData);
this.pathPlanning.precompute(precomputeData);
this.initialize();
return this;
}
@Override
public Search resume(PrecomputeData precomputeData) {
super.resume(precomputeData);
if (getCountResume() >= 2) {
return this;
}
this.world.resume(precomputeData);
this.pathPlanning.resume(precomputeData);
this.initialize();
return this;
}
@Override
public Search preparate() {
super.preparate();
if (getCountPreparate() >= 2) {
return this;
}
this.world.preparate();
this.pathPlanning.preparate();
this.initialize();
return this;
}
private void execute() {
if (lastTime != world.getTime()) {
tryCount = 0;
lastTime = world.getTime();
}
tryCount++;
if (tryCount > 5) {
tryCount = 0;
return;
}
exploreDecisionMaker.update();
targetArea = exploreDecisionMaker.getNextArea();
if (targetArea == null) {
// LOGGER.debug("targetArea is null");
target = null;
return;
}
target = targetArea.getID();
//TODO @MRL Check black list targets.
List<EntityID> path = pathPlanning.setFrom(agentInfo.getPosition()).setDestination(target).calc().getResult();
if (path == null) {
exploreDecisionMaker.removeUnreachableArea(target);
target = null;
execute();
}
// SearchStatus status = searchStrategy.manualMoveToArea(targetArea);
// if (status == CANCELED) {
// exploreDecisionMaker.removeUnreachableArea(targetArea.getID());
// execute();
//// LOGGER.debug("unreachable area for search: " + targetArea);
// }
//
// if (status == FINISHED) {
//// LOGGER.debug("explored area = " + targetArea);
// world.printData("explored area = " + targetArea);
// execute();
// } else if (status == SEARCHING) {
// //Do Nothing
// }
}
}
| [
"amirh.moshfeghi@gmail.com"
] | amirh.moshfeghi@gmail.com |
d6112850836e9b0b65844a66aa8313b2296e4acf | 36e726531d9561e14663d318ef1c7accf79d6756 | /pw-api-user/src/main/java/com/pw/api/user/service/LogService.java | fbe6f1b23d8e806e85af9952fa89392863fed5b1 | [] | no_license | superliu213/pwdubbo | 61661a75ed380c77f9951264b6d61cfea3db1d77 | 2de8965b9c3b017e688bfb28f920063fbd8f382c | refs/heads/master | 2021-05-07T00:40:22.225339 | 2017-11-10T04:05:24 | 2017-11-10T04:05:24 | 110,192,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.pw.api.user.service;
import com.pw.common.entity.SysLog;
import com.pw.common.page.PageBean;
import com.pw.common.page.PageParam;
import java.util.List;
import java.util.Map;
public interface LogService {
public PageBean getLogs(PageParam pageParam, Map<String, Object> paramMap);
List<SysLog> getLogs();
void initData();
}
| [
"kaka_517727926@qq.com"
] | kaka_517727926@qq.com |
6c98a2ff0ba5d4bfabf7aaccef040d6f4d22f150 | 306fdb5e9f648186afe8e46ea25cf922405b7f6d | /Mission2/src/SimpleRpgGame.java | 7013929ec4d5e37d891bf5156bc47e3e4ecbe788 | [] | no_license | boseung2/codesquad-cocoa | cf2e75ab695038b08ee6cf206f938c7376e76e9a | e474c1264631db23bb2e27e74680f8965a1ed166 | refs/heads/main | 2023-01-13T08:30:59.649330 | 2020-11-23T20:23:03 | 2020-11-23T20:23:03 | 309,439,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,987 | java | import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import java.util.Random;
import java.util.Scanner;
class Character {
private int x, y;
Character(int x, int y) {
this.x = x;
this.y = y;
Map.array[x][y] = " 🧍 ";
}
int getX() {
return this.x;
}
int getY() {
return this.y;
}
void setX(int x) {
this.x = x;
}
void setY(int y) {
this.y = y;
}
boolean checkInputKey(String inputKey) {
if (inputKey.equals("w") || inputKey.equals("W") ||
inputKey.equals("a") || inputKey.equals("A") ||
inputKey.equals("s") || inputKey.equals("S") ||
inputKey.equals("d") || inputKey.equals("D") ) {
return true;
}else {
System.out.println("잘못 입력하셨습니다. wasd중 입력해주세요.");
return false;
}
}
void move(String inputKey) {
Map.array[this.x][this.y] = " ";
if (inputKey.equals("w") || inputKey.equals("W")) {
this.x--;
}
if (inputKey.equals("a") || inputKey.equals("A")) {
this.y--;
}
if (inputKey.equals("s") || inputKey.equals("S")) {
this.x++;
}
if (inputKey.equals("d") || inputKey.equals("D")) {
this.y++;
}
Map.array[this.x][this.y] = " 🧍 ";
}
boolean checkOverLine(int x, int y){
if(x > 10 || y > 10){
return false;
}
else{
return true;
}
}
}
class Bomb {
Random random = new Random();
private int x = random.nextInt(10);
private int y = random.nextInt(10);
Bomb() {
while (x != 5 && y != 5) {
if (x != 0 && y != 0) {
if (x != 0 && y != 10) {
if (x != 10 && y != 0) {
if (x != 10 && y != 10) {
this.x = x;
this.y = y;
break;
}
}
}
}
}
}
int getX() {
return this.x;
}
int getY() {
return this.y;
}
void setX(int x) {
this.x = x;
}
void setY(int y) {
this.y = y;
}
}
class Monster{
private int x, y;
int getX() {
return this.x;
}
int getY() {
return this.y;
}
void setX(int x) {
this.x = x;
}
void setY(int y) {
this.y = y;
}
}
class Map{
static String[][] array = new String[11][11];
Map(){
for(int i=0; i < array.length; i++){
for(int j=0; j < array.length; j++){
array[i][j] = " ";
}
}
}
void print(){
System.out.println("=================================");
for(int i=0; i < array.length; i++){
for(int j=0; j < array.length; j++){
System.out.print(array[i][j]);
}
System.out.println();
}
System.out.println("=================================");
}
}
public class SimpleRpgGame {
static void makeMonster(Character character, Bomb bomb, Monster monster) {
Random random = new Random();
while (true) {
int x = random.nextInt(10);
int y = random.nextInt(10);
if (x != character.getX() || y != character.getY()) {
if (x != bomb.getX() || y != bomb.getY()) {
monster.setX(x);
monster.setY(y);
Map.array[monster.getX()][monster.getY()] = " 🐖 ";
break;
}
}
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Map map = new Map(); //맵 생성 및 초기화
Character character = new Character(5, 5); //캐릭터 생성 및 초기화
Bomb bomb = new Bomb(); //첫번째 폭탄 생성 및 초기화
Monster monster = new Monster(); //몬스터 인터페이스 생성
int score = 0; //점수생성
// 초기 몬스터생성
makeMonster(character, bomb, monster);
//초기 배열 출력
System.out.println(" 🐖🐖🐖🐖🐖돼지RPG🐖🐖🐖🐖🐖");
System.out.println(" 숨겨져 있는 폭탄을 피해 돼지를 잡으세요 ");
map.print();
//폭탄밟기전까지 무한반복
while (true) {
//문자열 입력받아서 wasd해당할시 캐릭터 이동
String inputKey = new String();
while(true) {
inputKey = scanner.next();
if(character.checkInputKey(inputKey) == true) break;
}
character.move(inputKey);
map.print();
//캐릭터가 폭탄만났을데 게임오버
if (character.getX() == bomb.getX() && character.getY() == bomb.getY()){
Map.array[ character.getX() ][ character.getY() ] = " 💥 ";
map.print();
System.out.println("Game Over");
break;
}
//캐릭터가 몬스터만나면면 점수획득
if(character.getX() == monster.getX() && character.getY() == monster.getY()){
Map.array[ character.getX() ][ character.getY() ] = " 🧍 ";
score += 100;
System.out.println();
System.out.println("돼지를 잡았습니다. 현재점수 : " + score + "점");
System.out.println();
//몬스터 재생성
makeMonster(character, bomb, monster);
map.print();
}
}
}
}
| [
"jungbs3726@gmail.com"
] | jungbs3726@gmail.com |
fab621b9f6ddc316b54bd34b2f31a49588c720b0 | 25e1f5e3cdd94aa76cdf199b3f7005a07cd58d4d | /app/src/main/java/util/ResUtils.java | fefd72d82137ec582c89e5f558c3e30980257842 | [] | no_license | flexicious/android-datagrid-poc | 9c47415024928e0cfe309e87ff26ad17939acf3d | 3918816a9ab4f7de55c43159750c38077865e2d4 | refs/heads/master | 2021-05-15T05:15:40.120291 | 2018-07-05T23:38:37 | 2018-07-05T23:38:37 | 116,815,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,150 | java | package util;
import android.content.Context;
import android.graphics.drawable.Drawable;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Created by SoftSuave-PC on 1/9/2018.
*/
public class ResUtils {
public static String getStringFromResource(final Context mContext, int resouceId) {
BufferedReader reader = new BufferedReader(new InputStreamReader(mContext.getResources().openRawResource(resouceId)));
StringBuilder builder = new StringBuilder();
String aux = "";
try {
while ((aux = reader.readLine()) != null) {
builder.append(aux);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return builder.toString();
}
public static InputStream getResourceInputStream(final Context mContext, int resouceId) {
return mContext.getResources().openRawResource(resouceId);
}
public static Drawable getDrawable(Context context, int resourceId) {
return context.getResources().getDrawable(resourceId, null);
}
}
| [
"manohar.vayyavuru@gmail.com"
] | manohar.vayyavuru@gmail.com |
54ff78619a067a69a98b54bc61cc97fdad747e79 | 113d9ed3335b1bebd915ab476e1bc85fdf9a64e4 | /src/main/java/br/com/nossagrana/emailsender/emailsender/entrypoint/Scheduler/EnviaEmailScheduler.java | 44fb7acbac2dac26159b42a2307ea32f221fb51b | [] | no_license | bruno-vieira-farias/microservice-emailsender | 9fd131648ba34cdb2bfb4fd65cfb9066e2473871 | 76ff8661ca0a2aaac0b49cbd7a90daa3343630f9 | refs/heads/master | 2022-12-22T20:08:32.618396 | 2020-08-09T18:36:17 | 2020-08-09T18:36:17 | 286,114,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package br.com.nossagrana.emailsender.emailsender.entrypoint.Scheduler;
import br.com.nossagrana.emailsender.emailsender.domain.fila.EnviaEmailDaFila;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class EnviaEmailScheduler {
private EnviaEmailDaFila enviaEmailDaFila;
@Autowired
public EnviaEmailScheduler(EnviaEmailDaFila enviaEmailDaFila) {
this.enviaEmailDaFila = enviaEmailDaFila;
}
/* Tenta enviar a cada 5 segundos. */
@Scheduled(cron = "*/5 * * * * ?")
public void execute() {
enviaEmailDaFila.enviaEmailDisponivelNaFila();
}
} | [
"contato.brunofarias@gmail.com"
] | contato.brunofarias@gmail.com |
971b41e3d893e953386702f4841062d3c0061225 | 78075cd5cd4de1065335306bbcf88a85c920a42d | /src/main/java/by/slivki/trainings/rest/mapper/ReportMapper.java | eb59abc04d40616f11295e6075d34df23d701a0b | [] | no_license | svetaklimenkova/trainings | 157312d47080e4232b80f3612c6e3480a1d71411 | d9449ccfd857c2dbc446a0b93a3b68229c7afeb9 | refs/heads/master | 2021-10-22T01:47:16.430589 | 2019-03-07T12:01:52 | 2019-03-07T12:01:52 | 108,248,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,898 | java | package by.slivki.trainings.rest.mapper;
import by.slivki.trainings.dao.jpa.Report;
import by.slivki.trainings.rest.dto.BaseReportDto;
import by.slivki.trainings.rest.dto.ReportDto;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class ReportMapper {
public List<ReportDto> toReportDtos(List<Report> reports) {
List<ReportDto> reportDtos = new ArrayList<>();
if (reports != null) {
for (Report report : reports) {
reportDtos.add(toReportDto(report));
}
}
return reportDtos;
}
private ReportDto toReportDto(Report report) {
ReportDto dto = new ReportDto();
dto.setId(report.getReportId());
dto.setMessage(report.getMessage());
dto.setStatus(report.getStatus().getStatusName());
dto.setStatusId(report.getStatus().getStatusId());
dto.setCreatedBy(report.getCreatedBy());
dto.setTraining(report.getTask().getStage().getTraining().getTitle());
dto.setTask(report.getTask().getTaskName());
dto.setFrom(report.getUser().getUsername());
return dto;
}
public List<BaseReportDto> toBaseReportDtos(List<Report> reports) {
List<BaseReportDto> reportDtos = new ArrayList<>();
if (reports != null) {
for (Report report : reports) {
reportDtos.add(toBaseReportDto(report));
}
}
return reportDtos;
}
public BaseReportDto toBaseReportDto(Report report) {
BaseReportDto dto = new BaseReportDto();
dto.setId(report.getReportId());
dto.setMessage(report.getMessage());
dto.setStatus(report.getStatus().getStatusName());
dto.setStatusId(report.getStatus().getStatusId());
dto.setCreatedBy(report.getCreatedBy());
return dto;
}
}
| [
"s.klimenkova@sam-solutions.com"
] | s.klimenkova@sam-solutions.com |
c3b80c8f2c00c185935c75ed4c4870d557f73750 | 42d63fc41bec5f4521f3e5a2e0bfaa8193919efe | /src/com/ramnivas/home/HelloRxWorld.java | 562b294974374dc985bbee6ffadc247328d3af7b | [] | no_license | RamIndani/LearningRxJava | b25dc39e9be66bf2241b4f37bf2e01f1e7bcbd16 | 8d95a8ec9d2aa33c6ac1a51585a5f89d21eb5d1e | refs/heads/master | 2021-05-14T03:55:27.378899 | 2018-01-08T04:48:27 | 2018-01-08T04:48:27 | 116,621,742 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.ramnivas.home;
import rx.Observable;
/**
* Created by ramnivasindani on 1/7/18.
*/
public class HelloRxWorld {
private static Observable<String> RxHelloWorldObservable =
Observable.create(subscriber -> {subscriber.onNext("Hello World");});
public static void main(String[] args) {
RxHelloWorldObservable
.subscribe(greetings -> System.out.println(greetings),
error -> System.out.println(error.getMessage()));
}
}
| [
"ram.0737@gmail.com"
] | ram.0737@gmail.com |
91b516287d7fc905c207fe7fbe711b7bb8d842a0 | f79d2b18491d93e5e26eca89de06a7bf3768f42b | /aerfa-ui/src/main/java/com/zhangysh/accumulate/ui/ufs/IUploadFileService.java | 0ee8e5c42ddc4049af389bbbaa06c4186020c06c | [] | no_license | 1989zhang/aerfa | bd68c489a32477eb52c85f5a1e6991ee25007d01 | bb31df4af61f6f72595a904ad6f2eef6643fb8b8 | refs/heads/master | 2022-12-10T05:54:20.776092 | 2020-05-30T15:57:50 | 2020-05-30T15:57:50 | 238,894,009 | 1 | 0 | null | 2022-12-06T00:44:14 | 2020-02-07T10:11:57 | JavaScript | UTF-8 | Java | false | false | 1,271 | java | package com.zhangysh.accumulate.ui.ufs;
import com.zhangysh.accumulate.common.constant.CacheConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.zhangysh.accumulate.pojo.ufs.transobj.AefufsUploadFileDto;
/*****
* 文件上传调用后台相关方法
* @author zhangysh
* @date 2019年5月13日
*****/
@FeignClient(name = "${feign.back.name}")
public interface IUploadFileService {
/****
*通过传对象的形势上传文件
*@param uploadFileDto 文件相关对象
***/
@RequestMapping(value = "/ufs/upload",method = RequestMethod.POST)
public String uploadFile(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken, @RequestBody AefufsUploadFileDto uploadFileDto);
/****
*获取保存的文件对象,后台自己判定返回方式
*@param id 文件的id
***/
@RequestMapping(value = "/ufs/download",method = RequestMethod.POST)
public String downloadFile(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken,@RequestBody Long id);
}
| [
"215642240@qq.com"
] | 215642240@qq.com |
8c6a3e0c8640de566f79b49a71a4827baf610c43 | be67c2a5aab7fb9ccd1e6a1e8a7ad73733dcdbab | /libs/YouTubeAndroidPlayerApi.src/com/google/android/youtube/player/internal/ad.java | 95efec15b7758821837de1b740482bca9e5e44de | [] | no_license | Yasser-Mahmoud/HelwanSBV2 | 60751f17afb5afaf66c93a77b6e33a1e7c17a25b | 69937ecf297e1dc505164439392c073b5c7c1efc | refs/heads/master | 2021-01-22T03:54:51.923287 | 2014-03-16T07:31:45 | 2014-03-16T07:31:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.google.android.youtube.player.internal;
import android.app.Activity;
import android.content.Context;
import com.google.android.youtube.player.YouTubeThumbnailLoader;
import com.google.android.youtube.player.YouTubeThumbnailView;
public final class ad
extends ab
{
public final b a(Context paramContext, String paramString, t.a parama, t.b paramb)
{
return new o(paramContext, paramString, paramContext.getPackageName(), z.d(paramContext), parama, paramb);
}
public final d a(Activity paramActivity, b paramb)
throws w.a
{
return w.a(paramActivity, paramb.a());
}
public final YouTubeThumbnailLoader a(b paramb, YouTubeThumbnailView paramYouTubeThumbnailView)
{
return new p(paramb, paramYouTubeThumbnailView);
}
}
/* Location: E:\Android\Workspace\HelwanSBV2\libs\YouTubeAndroidPlayerApi.jar
* Qualified Name: com.google.android.youtube.player.internal.ad
* JD-Core Version: 0.7.0.1
*/ | [
"eng.y.hassan@ieee.org"
] | eng.y.hassan@ieee.org |
93ec22877661b7b1dd4bdefb7bf858c45dc0e265 | c495a30c10994f0a7ff2452005d1ea0d31447eee | /wgetj/src/main/java/ru/job4j/wgetj/Main.java | 3e60bbb7bdb97841bab67d9b410bafde80c1b3c5 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ik87/job4j | 857b43d1d626718f966abe738c3dac2eb81d09c4 | b93fb4293218b6b28f3000043e753ed2c3c7a288 | refs/heads/master | 2022-09-22T19:24:39.724072 | 2020-10-20T09:31:19 | 2020-10-20T09:51:14 | 157,400,093 | 5 | 0 | Apache-2.0 | 2022-09-22T18:59:04 | 2018-11-13T15:14:50 | Java | UTF-8 | Java | false | false | 1,270 | java | package ru.job4j.wgetj;
import java.net.URL;
/**
* Easy java version of the wget
*
* @author Kosolapov Ilya (d_dexter@mail.ru)
* @version $id$
* @since 0.1
*/
public class Main {
private static final boolean DEBUG = true;
public static void main(String[] args) {
Parameters param;
try {
if (DEBUG) {
param = new Parameters(
new URL("https://github.com/ik87/TheatreSquare/archive/master.zip"),
//new URL("https://avatars.mds.yandex.net/get-pdb/231404/7723056e-1a65-4325-b324-71a46289ef78/s1200"),
1000
);
} else {
param = getParameters(args);
}
Thread thread = new Thread(new Downloader(param));
thread.start();
thread.join();
} catch (Exception e) {
System.out.println("set correct args: wgetj [url] <speed>");
}
}
private static Parameters getParameters(String[] args) throws Exception {
URL url = new URL(args[0]);
int maxSpeed = 10_000;
if (args.length == 2) {
maxSpeed = Integer.parseInt(args[1]);
}
return new Parameters(url, maxSpeed);
}
}
| [
"d_dexter@mail.ru"
] | d_dexter@mail.ru |
c0682bd2d897b90ab17e540bcd9cea171c8e563a | 31db60fe49ef7d31f3fc29221a69b97c19c59bb3 | /src/main/resources/oracle-db/kv-18.1.19/src/oracle/kv/impl/tif/FeederPartReaderCbk.java | b317e891f2f5120711e8315689a91eae71d1870e | [
"Apache-2.0",
"Zlib",
"MIT",
"CC0-1.0",
"FSFAP",
"BSD-3-Clause"
] | permissive | joelnewcom/embeddedOracleKv | d39cc4db1aa26962d7a1c721b87aa55a23124c3e | 138d23c66ae91d8e367b5456e4c5ab85dc47fcdc | refs/heads/master | 2021-06-25T20:24:13.850335 | 2019-06-02T19:43:27 | 2019-06-02T19:43:27 | 134,009,219 | 0 | 0 | Apache-2.0 | 2020-10-13T01:06:34 | 2018-05-18T22:19:51 | Java | UTF-8 | Java | false | false | 8,187 | java | /*-
* Copyright (C) 2011, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This file was distributed by Oracle as part of a version of Oracle NoSQL
* Database made available at:
*
* http://www.oracle.com/technetwork/database/database-technologies/nosqldb/downloads/index.html
*
* Please see the LICENSE file included in the top-level directory of the
* appropriate version of Oracle NoSQL Database for a copy of the license and
* additional information.
*/
package oracle.kv.impl.tif;
import com.sleepycat.je.log.LogEntryType;
import com.sleepycat.je.rep.GroupShutdownException;
import com.sleepycat.je.rep.InsufficientLogException;
import com.sleepycat.je.rep.subscription.Subscription;
import com.sleepycat.je.rep.subscription.SubscriptionStatus;
import com.sleepycat.je.utilint.InternalException;
import com.sleepycat.je.utilint.VLSN;
import oracle.kv.impl.rep.subscription.partreader.PartitionReader;
import oracle.kv.impl.rep.subscription.partreader.PartitionReaderCallBack;
import oracle.kv.impl.topo.PartitionId;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
/**
* Default callback to process each entry received from partition migration
* stream.
*/
class FeederPartReaderCbk implements PartitionReaderCallBack {
private final PartitionId partitionId;
private final SubscriptionManager manager;
private final BlockingQueue<DataItem> inputQueue;
private final PartitionReader reader;
private final Subscription repStreamConsumer;
private final Logger logger;
FeederPartReaderCbk(SubscriptionManager manager,
PartitionId partitionId,
Logger logger) {
this.partitionId = partitionId;
this.manager = manager;
this.logger = logger;
reader = manager.getPartitionReaderMap().get(partitionId);
repStreamConsumer = manager.getRepStreamConsumer();
inputQueue = manager.getInputQueuePartReader();
}
/**
* callback function to process a COPY or PUT operation
*
* @param pid id of partition
* @param vlsn vlsn of operation
* @param exp expiration time
* @param key key to copy or put
* @param value value part of operation
*/
@Override
public void processCopy(PartitionId pid, long vlsn, long exp, byte[] key,
byte[] value) {
final DataItem entry = new DataItem(new VLSN(vlsn),
DataItem.TXN_ID_COPY_IN_PARTTRANS,
key, value);
entry.setPartitionId(pid);
processEntry(entry);
}
/**
* callback function to process a COPY or PUT operation
*
* @param pid id of partition
* @param vlsn vlsn of operation
* @param exp expiration time
* @param key key to copy or put
* @param value value part of operation
* @param txnId id of transaction
*/
@Override
public void processPut(PartitionId pid, long vlsn, long exp, byte[] key,
byte[] value, long txnId) {
final DataItem entry = new DataItem(new VLSN(vlsn), txnId, key, value);
entry.setPartitionId(pid);
processEntry(entry);
}
/**
* callback function to process a DEL operation
*
* @param pid id of partition
* @param vlsn vlsn of operation
* @param key key to delete
* @param txnId id of transaction
*/
@Override
public void processDel(PartitionId pid,
long vlsn,
byte[] key,
long txnId) {
final DataItem entry = new DataItem(new VLSN(vlsn), txnId, key);
entry.setPartitionId(pid);
processEntry(entry);
}
/**
* callback function to process a PREPARE operation
*
* @param pid id of partition
* @param txnId id of transaction
*/
@Override
public void processPrepare(PartitionId pid, long txnId) {
/* useless to TIF, skip */
}
/**
* callback function to COMMIT a transaction
*
* @param pid id of partition
* @param txnId id of transaction
*/
@Override
public void processCommit(PartitionId pid, long txnId) {
/*
* current migration stream implementation does not send VLSN for
* transaction resolution such as COMMIT and ABORT, we tentatively
* use a NULL VLSN. TIF need take it in consideration when consuming
* VLSN from entries from migration stream.
*/
final DataItem entry = new DataItem(VLSN.NULL_VLSN, txnId,
LogEntryType.LOG_TXN_COMMIT);
entry.setPartitionId(pid);
processEntry(entry);
}
/**
* callback function to ABORT a transaction
*
* @param pid id of partition
* @param txnId id of transaction
*/
@Override
public void processAbort(PartitionId pid, long txnId) {
final DataItem entry = new DataItem(VLSN.NULL_VLSN, txnId,
LogEntryType.LOG_TXN_ABORT);
entry.setPartitionId(pid);
processEntry(entry);
}
/**
* callback function to process EOD
*
* @param pid id of partition
*/
@Override
public synchronized void processEOD(PartitionId pid) {
final SubscriptionManager.SubscriptionFilter
filter = manager.getSubscriptionFilter();
final VLSN highVLSN = new VLSN(reader.getHighestVLSN());
logger.info(partitionId + " transfer is done at high vlsn " + highVLSN);
/* add this partition to completed partitions in filter */
filter.addPartition(pid);
try {
/* the first partition done, start ongoing rep from high vlsn */
if (filter.getCompletePartitions().size() == 1) {
assert (repStreamConsumer != null);
if (!repStreamConsumer.getSubscriptionStatus()
.equals(SubscriptionStatus.SUCCESS)) {
/* start rep stream if not started */
repStreamConsumer.start(highVLSN.getNext());
/* no exception, subscription is successful */
assert (repStreamConsumer.getSubscriptionStatus()
.equals(
SubscriptionStatus.SUCCESS));
logger.info("successfully start rep stream consumer " +
"from VLSN " + highVLSN.getNext() +
" after finishing " + partitionId);
} else {
logger.info("the rep stream consumer has already started " +
"when " + partitionId + " is done.");
}
}
/* the last partition done, change state to ongoing */
if (manager.allPartComplete()) {
manager.setSubscriptionState(SubscriptionState
.REPLICATION_STREAM);
}
} catch (InsufficientLogException | IllegalArgumentException |
TimeoutException | GroupShutdownException | InternalException e) {
logger.warning("Unable to subscribe from VLSN " +
highVLSN.getNext() +
" after finishing " + partitionId + "" +
", reason: " + e.getMessage());
manager.shutdown(SubscriptionState.ERROR);
}
}
/* action applied to each entry. user can override */
private void processEntry(DataItem entry) {
while (true) {
try {
inputQueue.put(entry);
return;
} catch (InterruptedException e) {
/* This might have to get smarter. */
logger.warning(partitionId + ": interrupted input " +
"queue operation put, retrying");
}
}
}
}
| [
"joel.neukom@gmx.ch"
] | joel.neukom@gmx.ch |
2eb72ba6d5cee4b863f8b3ed6bf7255bec2b3570 | eb40c41801fcf4484f2ada77e7c93a215c17c48d | /Symbol.java | 21817d5ae4abe34903a321d2f68d1cd844aadf95 | [] | no_license | emmytyro9/Tic-Tac-Toe-game-9x9 | 4683dd93ea23ab997348fde7d5015e00bf702b81 | 9c2c00b1fb3e574d7e503f85a03065fe2775b11a | refs/heads/master | 2021-01-23T21:45:34.343790 | 2017-02-25T07:15:02 | 2017-02-25T07:15:02 | 83,111,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 846 | java |
public class Symbol {
private static char currentSymbol = 'X';
private static Board board = new Board() ;
private static Symbol symbol = new Symbol() ;
public static char getCurrentSymbol() {
return currentSymbol;
}
public static void setCurrentSymbol(char currentSymbol) {
Symbol.currentSymbol = currentSymbol;
}
//To change symbol when the player is changed.
public static void changeSymbol() {
if (currentSymbol == 'X') {
currentSymbol = 'O';
} else {
currentSymbol = 'X';
}
}
//To mark the current position with symbol.
public static boolean currentMark(int row, int col) {
if ((row >= 0) && (row < 9)) {
if ((col >= 0) && (col < 9)) {
if (board.getBoard()[row][col] == '-') {
board.getBoard()[row][col] = symbol.getCurrentSymbol();
return true;
}
}
}
return false;
}
} | [
"emmytyro9@gmail.com"
] | emmytyro9@gmail.com |
81d5a400500a4b2e83301b0bc6433a27601d36e3 | 406a5a12d7c61e915517320c9bf3e173014e8a12 | /src/main/java/com/grachro/dbviewer/DbRecord.java | a730ec76cc40068b936a5f4cc307c8dadb222e06 | [] | no_license | grachro/dbviewer-core | 3f7ae2ef99e81ea05ade735962b4a7b7b480c449 | 267099dac189452512f45018d384251ed86a3497 | refs/heads/master | 2022-07-03T16:43:40.347868 | 2015-08-23T12:26:49 | 2015-08-23T12:26:49 | 39,684,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 189 | java | package com.grachro.dbviewer;
import java.util.LinkedHashMap;
public class DbRecord extends LinkedHashMap<String, String> {
private static final long serialVersionUID = 1L;
}
| [
"grachro@gmail.com"
] | grachro@gmail.com |
990aaac23c8adb2657223e7244003c85dee65e54 | c874acc355a6903346324d5b73fbb7100a651a6b | /softAccomany/src/com/example/softAccomany/mark/Action.java | 956a28a62ca2675d64abffea127ee69f4d203359 | [] | no_license | baby10024/softAccomany | 24a52cb06e14d150e25669cd277a7aa035f9bed9 | 0f65df26fc8ba681e68ccbb6e9fcc2e11ae161d6 | refs/heads/master | 2021-01-11T13:33:45.743042 | 2017-02-10T11:58:09 | 2017-02-10T11:58:09 | 81,546,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.example.softAccomany.mark;
@SuppressWarnings("serial")
public class Action implements java.io.Serializable {
public int num_id;
public Integer type_id;
public Integer flag;
public String actiontitle;
public String actiondetail;
public String actiontype;
public String date;
public String time;
public String remidtype;
} | [
"18647374104@163.com"
] | 18647374104@163.com |
8f94a09725ee2eb1584dccb855c43da8f75913ff | 89b2a95656a76ac05d6d4c9fc795c09ce23d43dd | /GameOfWar/src/main/java/com/model/GameStatus.java | dd58baa10ca433ce95e67ba8bc186ed534bc26dd | [] | no_license | shwethadavenapalli/GameOfWar | 7526417f019a0c2e6ccda6e118fc2e1ff6ccdfa7 | c3d299acce0ab7ce5dacfd349722ebfff730bf4c | refs/heads/master | 2020-04-14T03:13:46.605360 | 2018-12-30T16:50:07 | 2018-12-30T16:50:07 | 163,602,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package com.model;
/**
* Created by Shwetha on 28-12-2018.
*/
public enum GameStatus {
Playable,War,Won,Draw;
}
| [
"shwetha.davenapalli@gmail.com"
] | shwetha.davenapalli@gmail.com |
962c81aed92153a64b396c82fb7774a1e64b5c30 | 3c054fafee61418e484e4f8efc264f5ce0696e33 | /vertx-orientdb-examples/src/main/java/org/cstamas/vertx/orientdb/examples/ServiceWriterVerticle.java | 94f1fcd42880e1670bb10e39b1fb37b19d75e3b6 | [
"Apache-2.0"
] | permissive | cstamas/vertx-orientdb | 71e99253aa054476898b434838b3ac2ee1351a98 | bc3c1ca700d788ba87ca402ae07c5ddf8d7c34b5 | refs/heads/master | 2021-06-07T00:52:56.296956 | 2017-11-21T14:51:50 | 2017-11-21T14:53:10 | 57,416,385 | 8 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package org.cstamas.vertx.orientdb.examples;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.eventbus.Message;
import io.vertx.core.eventbus.MessageConsumer;
import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.cstamas.vertx.orientdb.examples.service.DocumentDatabaseService;
/**
* OrientDB test verticle.
*/
public class ServiceWriterVerticle
extends AbstractVerticle
{
private static final Logger log = LoggerFactory.getLogger(ServiceWriterVerticle.class);
private MessageConsumer<JsonObject> consumer;
@Override
public void start(final Future<Void> startFuture) throws Exception {
DocumentDatabaseService documentDatabaseService = DocumentDatabaseService.createProxy(vertx, "test");
consumer = vertx.eventBus().consumer("write",
(Message<JsonObject> m) -> {
documentDatabaseService.insert(
"test",
new JsonObject().put("name", "name").put("value", "value"),
h -> {
if (h.succeeded()) {
log.info("Written OID " + h.result());
}
else {
log.error("Error", h.cause());
}
}
);
}
);
super.start(startFuture);
}
}
| [
"tamas@cservenak.net"
] | tamas@cservenak.net |
c4e29d9a97734ca75d574d996c43de53c46b0912 | 05caa58ddd168bce3fff1680f247d388ba38ce46 | /IQcm/src/qcm/persistences/QuestionnairePasseDAO.java | 51799b5cc27f880e83e8287aa3b57e7a99a263ed | [] | no_license | svatre/IQCMGenerator | 602b55d9f8eabdee3c66b7ba33fc37f333b117b5 | 48782038f7cce9f13a5108d0be19682e288aef60 | refs/heads/master | 2020-05-18T03:37:08.719454 | 2015-04-03T17:30:53 | 2015-04-03T17:30:53 | 33,299,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,609 | java | package qcm.persistences;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import qcm.models.QuestionnairePasse;
public class QuestionnairePasseDAO extends ModeleDAO {
public static List<QuestionnairePasse> getByUser(int idUser) throws SQLException {
List<QuestionnairePasse> qP = new ArrayList<QuestionnairePasse>();
String sql = "SELECT questionnaire_passe.id_questionnaire, questionnaire.libelle, questionnaire_passe.id_user, "
+ "questionnaire_passe.note, questionnaire_passe.date , questionnaire_passe.temps "
+ "FROM questionnaire_passe "
+ "INNER JOIN questionnaire "
+ "ON questionnaire.id_questionnaire = questionnaire_passe.id_questionnaire "
+ "WHERE questionnaire_passe.id_user = ? ORDER BY id_questionnaire";
ResultSet rs = selectById(sql, idUser);
while (rs.next()) {
qP.add(new QuestionnairePasse(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), rs.getDate(5), rs.getInt(6)));
}
rs.close();
return qP;
}
public static List<QuestionnairePasse> getByQuestionnaire(int idQuestionnaire) throws SQLException {
List<QuestionnairePasse> qP = new ArrayList<QuestionnairePasse>();
String sql = "SELECT questionnaire_passe.id_questionnaire, questionnaire.libelle, questionnaire_passe.id_user, "
+ "questionnaire_passe.note, questionnaire_passe.date , questionnaire_passe.temps "
+ "FROM questionnaire_passe "
+ "INNER JOIN questionnaire "
+ "ON questionnaire.id_questionnaire = questionnaire_passe.id_questionnaire "
+ "WHERE questionnaire_passe.id_questionnaire = ? ORDER BY questionnaire_passe.date DESC";
ResultSet rs = selectById(sql, idQuestionnaire);
while (rs.next()) {
qP.add(new QuestionnairePasse(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), rs.getDate(5), rs.getInt(6)));
}
rs.close();
return qP;
}
public static int getNbUsersByResponse(int idReponse, int idQuestion, int idQuestionnaire) throws SQLException{
int nbUsers = 0;
int idContenu = QcmDAO.getIdContenu(idQuestionnaire, idQuestion);
String sql = "SELECT COUNT(id_user) AS nb FROM user_reponse WHERE id_contenu = "+idContenu+" AND id_reponse = ?";
ResultSet rs = selectById(sql, idReponse);
if(rs.next()){
nbUsers = rs.getInt("nb");
}
return nbUsers;
}
}
| [
"stephanevatre.ynov@gmail.com"
] | stephanevatre.ynov@gmail.com |
00e91c166891a48599d4a18af66b45981fa6a1fa | f9a1eb6dbe6ce6d043fac298451360c19f9ec924 | /AndroidService/AndroidService/gen/com/example/androidservice/R.java | 2e31f4163b65e9880e38cb7cb3dbfe5b4e03a297 | [] | no_license | apoorvvw/Android_Projects | 0da9f8266af24dc54852f42983235100d00cf3fa | 474ffb04bdebb3903ff02df77ac317e848d8c020 | refs/heads/master | 2021-01-20T00:48:30.525262 | 2015-10-02T01:28:38 | 2015-10-02T01:28:38 | 29,497,871 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,101 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.androidservice;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int button1=0x7f070001;
public static final int button2=0x7f070000;
public static final int menu_settings=0x7f070002;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int activity_main=0x7f060000;
}
public static final class string {
public static final int app_name=0x7f040000;
public static final int hello_world=0x7f040001;
public static final int menu_settings=0x7f040002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f050000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f050001;
}
}
| [
"awairaga@purdue.edu"
] | awairaga@purdue.edu |
0dfa93c82252ade7411723161934e94bc6ce3bb9 | 00b1c53f40b7c0c975f7a5caaba5f55c7f06dac7 | /dbLoader/src/main/java/com/vmware/weathervane/auction/data/model/Keyword.java | afb0aeaf335a38222aa7bae68468e47227d035ca | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | vmware/weathervane | 6c493971618bf3188e16a9aeae584779a9555ad6 | 2a9edbdde98985eabe0c404e0fcce559067d04c3 | refs/heads/master | 2023-08-29T22:26:58.318277 | 2022-05-24T19:11:23 | 2022-05-24T19:11:23 | 85,119,966 | 162 | 41 | NOASSERTION | 2023-06-09T17:39:34 | 2017-03-15T20:54:26 | Java | UTF-8 | Java | false | false | 1,082 | java | /*
Copyright 2017-2019 VMware, Inc.
SPDX-License-Identifier: BSD-2-Clause
*/
package com.vmware.weathervane.auction.data.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
@Entity
@Table(name="keyword")
public class Keyword implements Serializable, DomainObject {
private static final long serialVersionUID = 1L;
private Long id;
private String keyword;
private Integer version;
public Keyword() {
}
@Id
@GeneratedValue(strategy=GenerationType.TABLE)
public Long getId() {
return id;
}
private void setId(Long id) {
this.id = id;
}
@Version
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
@Override
public String toString() {
return keyword;
}
}
| [
"hrosenbe@vmware.com"
] | hrosenbe@vmware.com |
06a2b6d3a8dacda10313b87605c9fcf943438eb7 | e1eb49c08b47712ac9dbbcbf8d54037b5986d06c | /string/Plaindrome.java | e05c88ccc99c22370d94f55b14455870c2205e13 | [] | no_license | rahi2109/DS-Questions | f4b5dbe5711585423233c0a5227e3f1767ffb578 | 8040067b2745d0d39c16b16acd3a0037c1d1462a | refs/heads/master | 2023-06-07T05:37:31.957697 | 2021-06-23T01:45:32 | 2021-06-23T01:45:32 | 374,586,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | package string;
public class Plaindrome {
static boolean palin(String s) {
boolean palin=true;
int i=0,j=s.length()-1;
while(i<j) {
if(s.charAt(i)!=s.charAt(j)) {
palin=false;
break;
}
i++;
j--;
}
return palin;
}
public static void main(String []args) {
String s= "abca";
if(palin(s))
System.out.println(s+" is palindrome");
else
System.out.println(s+" is not palindrome");
}
}
| [
"rahi.anshuman21@gmail.com"
] | rahi.anshuman21@gmail.com |
3889b0aa790017684f834ee4393788e6f7f4124e | 56aae923670a6c21bb2c13b8906af48e184766d2 | /cs2010_prototype/src/input_output/SaveGeneValuesToTextFile.java | d5f978e2e7151000d4af81a6127bc8e29eb548d1 | [] | no_license | abibiallan/CS2010 | 753dccaa2da8ecb157fef18c453ca69661834a2e | bcfb34c87bc32da8c30d240f51cdfe0f56a389f7 | refs/heads/master | 2021-01-15T10:59:52.435897 | 2015-04-27T22:57:12 | 2015-04-27T22:57:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,125 | java | package input_output;
import genes.Gene;
import gui.OpenGLFrame;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import javax.imageio.ImageIO;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;
import javax.swing.JPanel;
import jogamp.opengl.glu.mipmap.Image;
import org.lwjgl.BufferUtils;
import biomorphHandling.*;
import com.jogamp.opengl.util.FPSAnimator;
/**
* Class to handle exporting of Biomorphs.
* @author Tom Connolly
* @version 04/03/2015
*/
public class SaveGeneValuesToTextFile
{
static FileOutputStream fop = null;
static File file;
public SaveGeneValuesToTextFile(Gene[] geneValues, String fileName)
{
try
{
String content = "";
for (Gene gene : geneValues)
{
content = content + gene.getValue() + ", ";
}
// save file to src
file = new File("src/" + fileName + ".txt");
fop = new FileOutputStream(file);
// if file doesnt exists, then create it
if (!file.exists())
{
file.createNewFile();
}
// get the content in bytes
byte[] contentInBytes = content.getBytes();
fop.write(contentInBytes);
fop.flush();
fop.close();
System.out.println("Genes have been saved.");
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try
{
if (fop != null)
{
fop.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
public static void main(String[] args){
BiomorphCreator bc = new BiomorphCreator();
Biomorph biomorph = bc.createBiomorph();
SaveGeneValuesToTextFile save = new SaveGeneValuesToTextFile(biomorph.getGenes(), "biomorph");
}
} | [
"tom.connolly2511@gmail.com"
] | tom.connolly2511@gmail.com |
ea6abc281e02dffc1949476b19f11943af706adf | 4a821ece748b0585267d04cd863ba6cb08efb5dc | /app/controllers/forms/NewEnquiryForm.java | 2b7d7e4372181df409c79eceeaab772bc3323fa1 | [] | no_license | abhirakshit/EnquiryTracker | 1d6ccde9f412a2a8b3ed75a7bb697a0482e0877d | c8944ab3f5b57bee627da007a6110782c0a6e4f8 | refs/heads/master | 2016-09-06T08:24:13.356086 | 2013-11-30T16:10:02 | 2013-11-30T16:10:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java | package controllers.forms;
import java.util.Date;
import java.util.Set;
import javax.persistence.Lob;
import play.data.validation.Constraints.Email;
import play.data.validation.Constraints.Required;
/*
* This class is made specifically as Enquiry does not contain comments.
* EnquiryForm will capture Comment and Enquiry data and maybe momre later
*/
public class NewEnquiryForm {
// @Required
// public Long creatorId;
//
// @Required
// public Long assignedTo;
// public Long assignedTo1;
// public Long assignedTo2;
@Required
public String firstName;
public String lastName;
public Set<Long> countriesInterested;
// @Required
// public String contactNumber;
//
// @Lob
// public String address;
//
// @Email
// public String email;
// public String courseType;
// public Long service;
// public Long service1;
// public Long service2;
// public Long countryInterested;
// public Long countryInterested1;
// public Long countryInterested2;
// @Lob
// public String comments;
//
// @Required
// // @Formats.DateTime(pattern = "dd/MM/yyyy HH:mm:ss aa")
// public Date followUp;
//
// public String status;
//
// // X
// public String highSchoolScore;
//
// // X+2
// public String seniorSecondaryScore;
//
// public String graduationScore;
//
// public String testScores;
//
// public String program;
//
// public String intake;
//
// public String source;
//
// public String remarks;
}
| [
"abhishek06161@gmail.com"
] | abhishek06161@gmail.com |
dbe1c75a4c71dd62818220d1b90bfa5812eef7c5 | 1b8ae41e4e43429ba6c21b49fdfa7312ddee23b3 | /dp_labs_and_solutions/original/dp_labs_and_solutions/dp_java_labs_and_solutions/chain_of_responsibility/solution/Handler.java | d729c2d09cd7d5389c51bc8df707ebbccd450336 | [] | no_license | Technipire/Cpp | 9f8476a944497b82ce425a3d9191acb74337a129 | 78d4c89385216865b9a9f475055fca1ff600d2a4 | refs/heads/master | 2021-05-01T16:31:45.977554 | 2017-04-03T00:02:01 | 2017-04-03T00:02:01 | 32,282,437 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java | // Handler.java
public abstract class Handler
{
public Handler(Handler aSuccessor)
{
setSuccessor(aSuccessor);
}
public final void handle(CustomerRequestsDiscountEvent aCustomerRequestsDiscountEvent)
{
if (canHandle(aCustomerRequestsDiscountEvent))
{
doHandle(aCustomerRequestsDiscountEvent);
}
else if (getSuccessor() != null)
{
getSuccessor().handle(aCustomerRequestsDiscountEvent);
}
else
{
// aCustomerRequestsDiscountEvent is not handled.
}
}
protected abstract boolean canHandle(CustomerRequestsDiscountEvent aCustomerRequestsDiscountEvent);
protected abstract void doHandle(CustomerRequestsDiscountEvent aCustomerRequestsDiscountEvent);
private Handler getSuccessor()
{
return mySuccessor;
}
private void setSuccessor(Handler aSuccessor)
{
mySuccessor = aSuccessor;
}
private Handler mySuccessor;
}
| [
"andyxian510@gmail.com"
] | andyxian510@gmail.com |
d5fa125781945a19a6fa97c6a6ed1da62718eefb | a6e90d7152a335e081baa4dabe6cd5f73580d388 | /src/com/reallymany/scaffoldstoscaffoldcontigs/Scaffold.java | 3bbeee5b6067bcbd8fe05b83750e255e42e0aa65 | [] | no_license | genomeannotation/ScaffoldsToScaffoldContigs | 53a2646a15d666488ed3af184699e5d3209368f4 | ed37d03c63c0dada0fc593bd28914abfdeec0946 | refs/heads/master | 2016-09-05T12:17:58.274657 | 2014-05-28T01:16:08 | 2014-05-28T01:16:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,498 | java | package com.reallymany.scaffoldstoscaffoldcontigs;
import java.util.ArrayList;
import java.util.Iterator;
public class Scaffold {
public String name;
public ArrayList<ScaffoldContig> scaffoldContigs;
public Scaffold(String n) {
name = n;
scaffoldContigs = new ArrayList<ScaffoldContig>();
}
public String getName() {
return name;
}
public ArrayList<ScaffoldContig> getScaffoldContigs() {
return scaffoldContigs;
}
public void addScaffoldContig(ScaffoldContig sctg) {
this.scaffoldContigs.add(sctg);
}
public ScaffoldContig getScaffoldContig(int index) throws ScaffoldContigException {
if (scaffoldContigs.size() == 0) {
throw new ScaffoldContigException("No ScaffoldContigs");
}
Iterator<ScaffoldContig> sctgIterator = scaffoldContigs.iterator();
while (sctgIterator.hasNext()) {
ScaffoldContig currentSctg = sctgIterator.next();
if ((index >= currentSctg.getBegin()) &&
index <= currentSctg.getEnd()) {
return currentSctg;
}
}
throw new ScaffoldContigException("Correct ScaffoldContig not found; " +
this.getName()+ " and index "+index + "; discarding Gene");
}
public ScaffoldContig getNextScaffoldContig(ScaffoldContig sctg) throws ScaffoldContigException {
int inputIndex = scaffoldContigs.indexOf(sctg);
if (inputIndex + 2 <= scaffoldContigs.size()) {
return scaffoldContigs.get(inputIndex+1);
} else {
throw new ScaffoldContigException("index out of bounds at Scaffold.getNextScaffoldContig");
}
}
}
| [
"bhall7@hawaii.edu"
] | bhall7@hawaii.edu |
201d9b3e584b18eefd58e9b4359f87de4ae3086b | e46cb7757360dc74987830374e6294add13547af | /src/test/java/com/china/gavin/AppTest.java | 3cf7b162518a6f8931eee7c1927bc371b1156aca | [] | no_license | coderxb/HelloLucence | a91377d02f17b1e805aa6a762321e626791de127 | 69fd53a42d8c13ddfaf866b06c5c33cee4f8b998 | refs/heads/master | 2021-01-20T18:23:56.538787 | 2016-07-26T02:19:03 | 2016-07-26T02:19:03 | 64,182,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.china.gavin;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"coderxb@163.com"
] | coderxb@163.com |
7990ac188963e35473e503364c3aa69c7660db6f | a3c15052bc894da5d470f7fc3b961217b891e827 | /src/main/java/com/chan/delaywork/service/DelayService.java | 96a8312573b48ad585efbe02ce86f31b02c43e10 | [] | no_license | topspeedbus/delaywork | 12b039cdbaae19803678316795ba5b53ed63a763 | 258fb9cfa0014b1f8b0700133b19fa0ae00871dc | refs/heads/master | 2022-10-30T12:27:27.763201 | 2020-06-23T04:01:45 | 2020-06-23T04:01:45 | 266,000,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,298 | java | package com.chan.delaywork.service;
import com.chan.delaywork.entities.Order;
import org.redisson.api.RBlockingDeque;
import org.redisson.api.RDelayedQueue;
import org.redisson.api.RFuture;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* @author: chen
* @date: 2020/5/12 - 21:33
* @describe:
*/
@Service
public class DelayService {
@Resource
private RedissonClient redissonClient;
public void offerWork(String msg) throws InterruptedException {
RBlockingDeque<Order> orderDelayQueue = redissonClient.getBlockingDeque("order_delay");
RDelayedQueue<Order> delayedQueue = redissonClient.getDelayedQueue(orderDelayQueue);
// Order order = Order.builder().id("12321").createDate(new Date()).orderName("testName").build();
Order order = null;
for (int i = 0; i < 10; i++) {
order = Order.builder().id(i + "").createDate(null).orderName("testName" + i).build();
delayedQueue.offer(order, 5, TimeUnit.SECONDS);
}
Thread.sleep(1000);
boolean remove2 = delayedQueue.remove(Order.builder().id(3 + "").createDate(null).orderName("testName" + 3).build());
System.out.println(remove2);
RFuture<Boolean> remove = orderDelayQueue.removeFirstOccurrenceAsync(Order.builder().id(2 + "").createDate(null).orderName("testName" + 2).build());
boolean success = remove.isSuccess();
// orderDelayQueue.removeFirstOccurrenceAsync()
System.out.println(success);
boolean remove1 = orderDelayQueue.remove(order);
System.out.println(remove1);
// Order order = Order.builder().id(111 + "").createDate(null).orderName("testName" + 111).build();
// delayedQueue.offer(order, 5, TimeUnit.SECONDS);
// for (int i = 10; i < 20; i++) {
// try {
//
// Order order = Order.builder().id(i + "").createDate(new Date()).orderName("testName" + i).build();
// delayedQueue.offer(order, 1, TimeUnit.MINUTES);
//
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
delayedQueue.destroy();
}
}
| [
"243987701@qq.com"
] | 243987701@qq.com |
eee3ef7b1c08d082788df90be3163b6e20912548 | 516004e60baa5b7c5659c319434166122bdfeb2b | /src/leetcode/dp/Solution121.java | 8c2d575523567a0798037b86ef07170e7cde12f0 | [] | no_license | ClearMindzj/leetcode | b0aee866278fa4bb3c9a33b5b3884996665c1f7c | aa80acae34c2d93b0f4e441f9573935d44922f6e | refs/heads/master | 2022-10-31T20:47:57.188787 | 2020-06-15T02:04:51 | 2020-06-15T02:04:51 | 232,229,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package leetcode.dp;
/**
* Created by zhengjie on 2020/3/3.
* 买股票最佳时机
* 双指针
*/
public class Solution121 {
public int maxProfit(int[] prices) {
int m=prices.length;
int left=0;
int right=0;
int max=0;
for(;right<m;right++){
if(prices[right]>prices[left]) {
max = Math.max(max, prices[right] - prices[left]);
}
else {
left=right;
}
}
return max;
}
}
| [
"1106646009@qq.com"
] | 1106646009@qq.com |
d4a589a4d221f2ece5b3758b3857aa1ee5c94ac9 | d668447c5e451fe9806cd5dc4838de045353cae8 | /Assignments/Unit 2/HW09EmbeddedStructures.java | de32c763d00451f357260d13b21398fc27fe5008 | [] | no_license | Evelin630/ESPE202011_FP_GEO-3285 | cba74b141f4d27f6cbc7081ee0927cdc1d1152c2 | 054c586311f691312e4612476106b822fc1cadc0 | refs/heads/main | 2023-03-28T17:41:49.416426 | 2021-04-07T17:49:04 | 2021-04-07T17:49:04 | 318,602,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,513 | java | /*
* 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 hw09.embeddedstructures;
import java.util.Scanner;
/**
*
* @author Evelyn
*/
public class HW09EmbeddedStructures {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner scanner = new Scanner(System.in);
int number1;
int number2;
int result;
char option;
do {
System.out.print("ingrese el numero 1: ");
number1 = scanner.nextInt();
scanner.nextLine();
System.out.print("ingrese el numero 2: ");
number2 = scanner.nextInt();
scanner.nextLine();
if (number1 % 2 == 0 && number2 % 2 == 0) {
result = number1 * number2;
System.out.println(number1 + " x " + number2 + " = " + result);
} else if (number1 % 3 == 0 && number2 % 3 == 0) {
result = number1 + number2;
System.out.println(number1 + " + " + number2 + " = " + result);
} else if (number1 % 7 == 0 && number2 % 7 == 0) {
result = number1 % number2;
System.out.println(number1 + " % " + number2 + " = " + result);
} else if (number1 % 11 == 0 && number2 % 11 == 0) {
for (int i = 1; i <= 12; i++) {
System.out.println(number1 + " x " + i + " = " + (number1 * i));
}
if (number1 != number2) {
for (int i = 1; i <= 12; i++) {
System.out.println(number2 + " x " + i + " = " + (number2 * i));
}
}
} else if (number1 % 13 == 0 && number2 % 13 == 0) {
result = (number1 / number2);
System.out.println(number1 + " / " + number2 + " = " + result);
} else {
System.out.println("No es posible realizar esta operacion");
System.out.println("No existe esta operacion");
}
System.out.println();
System.out.println();
System.out.println("Do you want retry again? [y/n]");
option = scanner.nextLine().charAt(0);
} while (option != 'n');
}
}
}
}
| [
"Evelin630"
] | Evelin630 |
013ccf2c233313b3ae9506257072b0a61de5404d | 1e8837412022974fd7ef277dfbb177a9ef86adfc | /Point2GPX/src/ku/ign/mapmatcher/HttpsClient.java | 173fc4f4adb3e88be85004fb01d422fd5d1ebcb2 | [] | no_license | bsnizek/gisMapMatching | fd607b6cc41e7337b7aa98f8114c167465d8bbd9 | d712d249ec1bc2e0ee4287a14a1870ce8510c5c4 | refs/heads/master | 2020-04-18T11:54:03.016880 | 2014-09-15T08:46:14 | 2014-09-15T08:46:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,582 | java | package ku.ign.mapmatcher;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.io.*;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;
public class HttpsClient{
// http://stackoverflow.com/questions/20422649/how-to-write-image-or-file-to-httpsurlconnection
String app_id = "01e8761c";
String app_key = "5c989d0272b48a9b2cbefd19d23d95e9";
String file = "/Users/besn/Documents/workspace/Point2GPX/out/point-raw-0.gpx";
String requestURL = "https://test.roadmatching.com/rest/mapmatch";
String certfile = "jssecacerts";
public static void main(String[] args)
{
new HttpsClient().testIt();
}
private void testIt(){
String https_url = requestURL;
URL url;
SSLSocketFactory socketFactory = null;
try {
try {
socketFactory = createSSLContext().getSocketFactory();
} catch (UnrecoverableKeyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (KeyManagementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (KeyStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CertificateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
url = new URL(https_url);
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
conn.setDoInput(true); // Allow Inputs
conn.setDoOutput(true); // Allow Outputs
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("ENCTYPE", "multipart/form-data");
conn.setSSLSocketFactory(socketFactory);
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
conn.addRequestProperty("app_id", app_id);
conn.addRequestProperty("app_key", app_key);
// dump all cert info
// print_https_cert(con);
//dump all the content
print_content(conn);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void print_https_cert(HttpsURLConnection con){
if(con!=null){
try {
System.out.println("Response Code : " + con.getResponseCode());
System.out.println("Cipher Suite : " + con.getCipherSuite());
System.out.println("\n");
Certificate[] certs = con.getServerCertificates();
for(Certificate cert : certs){
System.out.println("Cert Type : " + cert.getType());
System.out.println("Cert Hash Code : " + cert.hashCode());
System.out.println("Cert Public Key Algorithm : "
+ cert.getPublicKey().getAlgorithm());
System.out.println("Cert Public Key Format : "
+ cert.getPublicKey().getFormat());
System.out.println("\n");
}
} catch (SSLPeerUnverifiedException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
}
}
private void print_content(HttpsURLConnection con){
if(con!=null){
try {
System.out.println("****** Content of the URL ********");
BufferedReader br =
new BufferedReader(
new InputStreamReader(con.getInputStream()));
String input;
while ((input = br.readLine()) != null){
System.out.println(input);
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private final SSLContext createSSLContext()
throws NoSuchAlgorithmException, KeyStoreException,
CertificateException, IOException,
UnrecoverableKeyException, KeyManagementException {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream fis = null;
try {
fis = new FileInputStream("keystore_file");
} catch (Exception ex) {
throw new IOException("not found keystore file:");
}
try{
keyStore.load(fis, "blab".toCharArray());
}finally {
// IOUtils.closeQuietly(fis);
}
CertificateFactory cf = CertificateFactory.getInstance("X.509");
FileInputStream in = new FileInputStream("cert");
KeyStore trustStore = KeyStore.getInstance("JKS");
trustStore.load(null);
try {
X509Certificate cacert = (X509Certificate) cf.generateCertificate(in);
trustStore.setCertificateEntry("alias", cacert);
} finally {
// IOUtils.closeQuietly(in);
}
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
tmf.init(trustStore);
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(keyStore, "pwd".toCharArray());
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom());
return sslContext;
}
} | [
"bs@metascapes.org"
] | bs@metascapes.org |
efddc7d162cd4d9fb3103b6c3bbcc6bd77f85eb5 | a2f955a8ba9551a28fbb31768b667deaf50af2ba | /app/src/main/java/com/antonenkodev/heynow/heynow2/MemoryCache.java | 3849936b0b227e2f1cebd690e8212650f9053bf3 | [] | no_license | timofeyantonenko/HeyNow | 51fd6e7bef5e6b9238e3c412679f66e0dae05b1c | bddd5840567467377fc1b539d3e59041fb7a8397 | refs/heads/master | 2021-01-22T10:09:18.798752 | 2015-08-11T17:59:44 | 2015-08-11T17:59:44 | 40,353,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,533 | java | package com.antonenkodev.heynow.heynow2;
/**
* Created by root on 19.04.15.
*/
import android.graphics.Bitmap;
import android.util.Log;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
public class MemoryCache {
private static final String TAG = "MemoryCache";
// Last argument true for LRU ordering
private Map<String, Bitmap> cache = Collections
.synchronizedMap(new LinkedHashMap<String, Bitmap>(10, 1.5f, true));
// Current allocated size
private long size = 0;
// Max memory in bytes
private long limit = 1000000;
public MemoryCache() {
// Use 25% of available heap size
setLimit(Runtime.getRuntime().maxMemory() / 2);
}
public void setLimit(long new_limit) {
limit = new_limit;
Log.i(TAG, "MemoryCache will use up to " + limit / 1024. / 1024. + "MB");
}
public Bitmap get(String id) {
try {
if (!cache.containsKey(id))
return null;
return cache.get(id);
} catch (NullPointerException ex) {
ex.printStackTrace();
return null;
}
}
public void put(String id, Bitmap bitmap) {
try {
if (cache.containsKey(id))
size -= getSizeInBytes(cache.get(id));
cache.put(id, bitmap);
size += getSizeInBytes(bitmap);
checkSize();
} catch (Throwable th) {
th.printStackTrace();
}
}
private void checkSize() {
Log.i(TAG, "cache size=" + size + " length=" + cache.size());
if (size > limit) {
// Least recently accessed item will be the first one iterated
Iterator<Entry<String, Bitmap>> iter = cache.entrySet().iterator();
while (iter.hasNext()) {
Entry<String, Bitmap> entry = iter.next();
size -= getSizeInBytes(entry.getValue());
iter.remove();
if (size <= limit)
break;
}
Log.i(TAG, "Clean cache. New size " + cache.size());
}
}
public void clear() {
try {
cache.clear();
size = 0;
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}
long getSizeInBytes(Bitmap bitmap) {
if (bitmap == null)
return 0;
return bitmap.getRowBytes() * bitmap.getHeight();
}
} | [
"antonenkodev@gmail.com"
] | antonenkodev@gmail.com |
c85a7087028336d0472f032d2410f948b8aedff7 | ca98476ac0c19b09759a77ccf52ce613a1dabf0b | /debug/apps/ToBeDeleted/app/src/main/java/com/core/PMatrix2D.java | 246ded0f0a629ae6b58c9b72ebb2a228968f9bc6 | [] | no_license | pallav12/processing-android | c57bffecaaa428d197b0c74bb6a40ff66c8de544 | a3ca64299a4b3374faf201e2b9ede6b1e0e28e65 | refs/heads/master | 2020-12-02T09:21:05.838583 | 2020-01-01T18:45:58 | 2020-01-01T18:45:58 | 230,960,268 | 0 | 0 | null | 2019-12-30T18:17:38 | 2019-12-30T18:17:37 | null | UTF-8 | Java | false | false | 11,108 | java | /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-16 The Processing Foundation
Copyright (c) 2005-12 Ben Fry and Casey Reas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
package com.core;
/**
* 3x2 affine matrix implementation.
*/
public class PMatrix2D implements PMatrix {
public float m00, m01, m02;
public float m10, m11, m12;
public PMatrix2D() {
reset();
}
public PMatrix2D(float m00, float m01, float m02,
float m10, float m11, float m12) {
set(m00, m01, m02,
m10, m11, m12);
}
public PMatrix2D(PMatrix matrix) {
set(matrix);
}
public void reset() {
set(1, 0, 0,
0, 1, 0);
}
/**
* Returns a copy of this PMatrix.
*/
public PMatrix2D get() {
PMatrix2D outgoing = new PMatrix2D();
outgoing.set(this);
return outgoing;
}
/**
* Copies the matrix contents into a 6 entry float array.
* If target is null (or not the correct size), a new array will be created.
*/
public float[] get(float[] target) {
if ((target == null) || (target.length != 6)) {
target = new float[6];
}
target[0] = m00;
target[1] = m01;
target[2] = m02;
target[3] = m10;
target[4] = m11;
target[5] = m12;
return target;
}
public void set(PMatrix matrix) {
if (matrix instanceof PMatrix2D) {
PMatrix2D src = (PMatrix2D) matrix;
set(src.m00, src.m01, src.m02,
src.m10, src.m11, src.m12);
} else {
throw new IllegalArgumentException("PMatrix2D.set() only accepts PMatrix2D objects.");
}
}
public void set(PMatrix3D src) {
}
public void set(float[] source) {
m00 = source[0];
m01 = source[1];
m02 = source[2];
m10 = source[3];
m11 = source[4];
m12 = source[5];
}
public void set(float m00, float m01, float m02,
float m10, float m11, float m12) {
this.m00 = m00; this.m01 = m01; this.m02 = m02;
this.m10 = m10; this.m11 = m11; this.m12 = m12;
}
public void set(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33) {
}
public void translate(float tx, float ty) {
m02 = tx*m00 + ty*m01 + m02;
m12 = tx*m10 + ty*m11 + m12;
}
public void translate(float x, float y, float z) {
throw new IllegalArgumentException("Cannot use translate(x, y, z) on a PMatrix2D.");
}
// Implementation roughly based on AffineTransform.
public void rotate(float angle) {
float s = sin(angle);
float c = cos(angle);
float temp1 = m00;
float temp2 = m01;
m00 = c * temp1 + s * temp2;
m01 = -s * temp1 + c * temp2;
temp1 = m10;
temp2 = m11;
m10 = c * temp1 + s * temp2;
m11 = -s * temp1 + c * temp2;
}
public void rotateX(float angle) {
throw new IllegalArgumentException("Cannot use rotateX() on a PMatrix2D.");
}
public void rotateY(float angle) {
throw new IllegalArgumentException("Cannot use rotateY() on a PMatrix2D.");
}
public void rotateZ(float angle) {
rotate(angle);
}
public void rotate(float angle, float v0, float v1, float v2) {
throw new IllegalArgumentException("Cannot use this version of rotate() on a PMatrix2D.");
}
public void scale(float s) {
scale(s, s);
}
public void scale(float sx, float sy) {
m00 *= sx; m01 *= sy;
m10 *= sx; m11 *= sy;
}
public void scale(float x, float y, float z) {
throw new IllegalArgumentException("Cannot use this version of scale() on a PMatrix2D.");
}
public void shearX(float angle) {
apply(1, 0, 1, tan(angle), 0, 0);
}
public void shearY(float angle) {
apply(1, 0, 1, 0, tan(angle), 0);
}
public void apply(PMatrix source) {
if (source instanceof PMatrix2D) {
apply((PMatrix2D) source);
} else if (source instanceof PMatrix3D) {
apply((PMatrix3D) source);
}
}
public void apply(PMatrix2D source) {
apply(source.m00, source.m01, source.m02,
source.m10, source.m11, source.m12);
}
public void apply(PMatrix3D source) {
throw new IllegalArgumentException("Cannot use apply(PMatrix3D) on a PMatrix2D.");
}
public void apply(float n00, float n01, float n02,
float n10, float n11, float n12) {
float t0 = m00;
float t1 = m01;
m00 = n00 * t0 + n10 * t1;
m01 = n01 * t0 + n11 * t1;
m02 += n02 * t0 + n12 * t1;
t0 = m10;
t1 = m11;
m10 = n00 * t0 + n10 * t1;
m11 = n01 * t0 + n11 * t1;
m12 += n02 * t0 + n12 * t1;
}
public void apply(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
throw new IllegalArgumentException("Cannot use this version of apply() on a PMatrix2D.");
}
/**
* Apply another matrix to the left of this one.
*/
public void preApply(PMatrix source) {
if (source instanceof PMatrix2D) {
preApply((PMatrix2D) source);
} else if (source instanceof PMatrix3D) {
preApply((PMatrix3D) source);
}
}
/**
* Apply another matrix to the left of this one.
*/
public void preApply(PMatrix2D left) {
preApply(left.m00, left.m01, left.m02,
left.m10, left.m11, left.m12);
}
public void preApply(PMatrix3D left) {
throw new IllegalArgumentException("Cannot use preApply(PMatrix3D) on a PMatrix2D.");
}
public void preApply(float n00, float n01, float n02,
float n10, float n11, float n12) {
float t0 = m02;
float t1 = m12;
n02 += t0 * n00 + t1 * n01;
n12 += t0 * n10 + t1 * n11;
m02 = n02;
m12 = n12;
t0 = m00;
t1 = m10;
m00 = t0 * n00 + t1 * n01;
m10 = t0 * n10 + t1 * n11;
t0 = m01;
t1 = m11;
m01 = t0 * n00 + t1 * n01;
m11 = t0 * n10 + t1 * n11;
}
public void preApply(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
throw new IllegalArgumentException("Cannot use this version of preApply() on a PMatrix2D.");
}
//////////////////////////////////////////////////////////////
/**
* Multiply the x and y coordinates of a PVector against this matrix.
*/
public PVector mult(PVector source, PVector target) {
if (target == null) {
target = new PVector();
}
target.x = m00*source.x + m01*source.y + m02;
target.y = m10*source.x + m11*source.y + m12;
return target;
}
/**
* Multiply a two element vector against this matrix.
* If out is null or not length four, a new float array will be returned.
* The values for vec and out can be the same (though that's less efficient).
*/
public float[] mult(float vec[], float out[]) {
if (out == null || out.length != 2) {
out = new float[2];
}
if (vec == out) {
float tx = m00*vec[0] + m01*vec[1] + m02;
float ty = m10*vec[0] + m11*vec[1] + m12;
out[0] = tx;
out[1] = ty;
} else {
out[0] = m00*vec[0] + m01*vec[1] + m02;
out[1] = m10*vec[0] + m11*vec[1] + m12;
}
return out;
}
public float multX(float x, float y) {
return m00*x + m01*y + m02;
}
public float multY(float x, float y) {
return m10*x + m11*y + m12;
}
/**
* Transpose this matrix.
*/
public void transpose() {
}
/**
* Invert this matrix. Implementation stolen from OpenJDK.
* @return true if successful
*/
public boolean invert() {
float determinant = determinant();
if (Math.abs(determinant) <= Float.MIN_VALUE) {
return false;
}
float t00 = m00;
float t01 = m01;
float t02 = m02;
float t10 = m10;
float t11 = m11;
float t12 = m12;
m00 = t11 / determinant;
m10 = -t10 / determinant;
m01 = -t01 / determinant;
m11 = t00 / determinant;
m02 = (t01 * t12 - t11 * t02) / determinant;
m12 = (t10 * t02 - t00 * t12) / determinant;
return true;
}
/**
* @return the determinant of the matrix
*/
public float determinant() {
return m00 * m11 - m01 * m10;
}
//////////////////////////////////////////////////////////////
public void print() {
int big = (int) abs(max(PApplet.max(abs(m00), abs(m01), abs(m02)),
PApplet.max(abs(m10), abs(m11), abs(m12))));
int digits = 1;
if (Float.isNaN(big) || Float.isInfinite(big)) { // avoid infinite loop
digits = 5;
} else {
while ((big /= 10) != 0) digits++; // cheap log()
}
System.out.println(PApplet.nfs(m00, digits, 4) + " " +
PApplet.nfs(m01, digits, 4) + " " +
PApplet.nfs(m02, digits, 4));
System.out.println(PApplet.nfs(m10, digits, 4) + " " +
PApplet.nfs(m11, digits, 4) + " " +
PApplet.nfs(m12, digits, 4));
System.out.println();
}
//////////////////////////////////////////////////////////////
// TODO these need to be added as regular API, but the naming and
// implementation needs to be improved first. (e.g. actually keeping track
// of whether the matrix is in fact identity internally.)
protected boolean isIdentity() {
return ((m00 == 1) && (m01 == 0) && (m02 == 0) &&
(m10 == 0) && (m11 == 1) && (m12 == 0));
}
// TODO make this more efficient, or move into PMatrix2D
protected boolean isWarped() {
// was &&, but changed so shearX and shearY will work
return ((m00 != 1) || (m01 != 0) ||
(m10 != 0) || (m11 != 1));
}
//////////////////////////////////////////////////////////////
private final float max(float a, float b) {
return (a > b) ? a : b;
}
private final float abs(float a) {
return (a < 0) ? -a : a;
}
private final float sin(float angle) {
return (float)Math.sin(angle);
}
private final float cos(float angle) {
return (float)Math.cos(angle);
}
private final float tan(float angle) {
return (float)Math.tan(angle);
}
}
| [
"rajeevpallav606@gmail.com"
] | rajeevpallav606@gmail.com |
6b3f547daadb5dce2862323a2ebf43702452e2ed | b6f61e4f09815086b6ebca584009f9808a9f4a31 | /app/src/main/java/com/yogeshborhade/shaktidevelopers/RemainingPoints.java | b681335e0270971ab2454b618ee3eec97c151bb2 | [] | no_license | kingYog/ShaktiDevelopers | 5d5840f5585cd99a39c174f28d1362a6886a9871 | 5f79658042b62a28b74be5503c49d0246b47be59 | refs/heads/master | 2020-03-28T13:11:24.731215 | 2018-09-11T20:16:06 | 2018-09-11T20:16:10 | 148,373,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,241 | java | package com.yogeshborhade.shaktidevelopers;
/**
* Created by admin on 03-06-2018.
*/
public class RemainingPoints {
//1)Customer and farmer update notification
//2)Book plot
//3)Create Reciept finsh the things
//4)import from Excel it reads on xls formate right now
//5)Check all Transaction and notifications
//6)print recipt
//7)check all Transactions
//8)update customer and Farmer Transaction and Notification will Create every time need to check solution for this
//9)Call me options
//9) Create Project Finish Button clos activity
//10) Project Sale Plot , Available Plot,Remainign Plot
//11) Add Transaction Update Customer and Farmer Table
// To client
//1)formate shoud be xls or xlsx
//2)At the Time of adding data dont add enythying else with only numberk
//3)Project -> Add Plot -> import Excel Shuld Be One Character
// Importants Links
// 1)https://www.logicchip.com/creating-image-view-android/
// 2)http://deepshikhapuri.blogspot.com/2017/06/video-demo-i-am-using-pdfdocument-to.html
// 18-6-2018
/* One Plot will be for only one customer
1 plot = 1 Customer
Many Plot != Customer
Check above Issue*/
}
| [
"borhadyog@gmail.com"
] | borhadyog@gmail.com |
6a354b390da4e4525b5073d3fd1442eef5831a73 | 70ddcacd439125cc1e22cb732eff8224e4a42423 | /app/src/main/java/com/frogoutofwell/yullfrogapplication/write/WriteTestActivity.java | 8855cff56be491cd02fa04a9d7011082f74ce5dc | [] | no_license | yull2/YullFrogApplication-release | bf27d3011c98da103e8940ddd0266ffbd9cd7f18 | b5d67f0f01f2f6edad46d960decca82ae2ce5af8 | refs/heads/master | 2021-01-17T17:46:00.307219 | 2016-06-30T08:41:46 | 2016-06-30T08:41:46 | 62,294,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,478 | java | package com.frogoutofwell.yullfrogapplication.write;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.RatingBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.frogoutofwell.yullfrogapplication.R;
import com.frogoutofwell.yullfrogapplication.data.ActivityDetailResult;
import com.frogoutofwell.yullfrogapplication.manager.NetworkManager;
import java.io.IOException;
import okhttp3.Request;
public class WriteTestActivity extends AppCompatActivity {
TextView infoView;
EditText questionView, answerView, wayView;
Spinner spinner_term, spinner_level;
RadioGroup radio_result;
String tmp_term;
int tmp_level,seq;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_write_test);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back);
Intent intent = getIntent();
seq = intent.getIntExtra("seq",1);
infoView = (TextView)findViewById(R.id.text_info);
questionView = (EditText)findViewById(R.id.edit_question);
answerView = (EditText)findViewById(R.id.edit_answer);
wayView = (EditText)findViewById(R.id.edit_way);
spinner_term = (Spinner)findViewById(R.id.spinner_term);
spinner_level = (Spinner)findViewById(R.id.spinner_level);
radio_result = (RadioGroup)findViewById(R.id.radio_result);
setData();
spinner_term.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
//Toast.makeText(WriteTestActivity.this, "term // position : "+ position+", id : "+parent.getItemAtPosition(position),Toast.LENGTH_SHORT).show();
tmp_term = parent.getItemAtPosition(position).toString();
//Log.i("tmp_term","tmp_term : "+tmp_term);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
spinner_level.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// Toast.makeText(WriteTestActivity.this, "level// position : "+ position+", id : "+parent.getItemAtPosition(position),Toast.LENGTH_SHORT).show();
tmp_level = position;
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
radio_result.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
/*if (checkedId == R.id.radio_s) {
Toast.makeText(WriteTestActivity.this,"합격",Toast.LENGTH_SHORT).show();
}
else Toast.makeText(WriteTestActivity.this,"불합격",Toast.LENGTH_SHORT).show();*/
}
});
Button btn_upload = (Button)findViewById(R.id.btn_upload);
btn_upload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String question = questionView.getText().toString();
String answer = answerView.getText().toString();
String way = wayView.getText().toString();
String term = tmp_term;
int level = tmp_level;
int test_result = 1;
// Log.i("term","term : "+term);
//Log.i("level","level : "+level);
int id = radio_result.getCheckedRadioButtonId();
if (id == R.id.radio_s) test_result = 0;
else test_result = 1;
reviewUpload(seq, level, test_result, term, question, answer, way);
}
});
}
private void reviewUpload(int activitySeq, int level, int test_result,
String term, String question, String answer, String way){
NetworkManager.getInstance().getFrogTestReviewPost(this, activitySeq, level, test_result, term, question, answer, way, new NetworkManager.OnResultListener<String>() {
@Override
public void onSuccess(Request request, String result) {
String status = result;
//Toast.makeText(WriteTestActivity.this, "업로드 상태 "+ status, Toast.LENGTH_LONG).show();
if (status.equals("OK")){
AlertDialog.Builder alert = new AlertDialog.Builder(WriteTestActivity.this);
alert.setPositiveButton("확인", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
});
alert.setMessage("면접후기가 업로드 되었습니다. 10개굴이 적립됩니다.");
alert.show();
}
}
@Override
public void onFail(Request request, IOException exception) {
Toast.makeText(WriteTestActivity.this, "fail : " + exception.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
private void setData() {
NetworkManager.getInstance().getInterClassInfo(this, seq, new NetworkManager.OnResultListener<ActivityDetailResult>() {
@Override
public void onSuccess(Request request, ActivityDetailResult result) {
String actName = result.activityDetail.getName();
String actClass = result.activityDetail.getActClass();
String comName = result.activityDetail.getCompanyName();
String region = result.activityDetail.getRegion();
infoView.setText(actName+" / "+actClass+" / "+comName+" / "+region);
}
@Override
public void onFail(Request request, IOException exception) {
Toast.makeText(WriteTestActivity.this, "fail : " + exception.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home){
finish();
}
return super.onOptionsItemSelected(item);
}
}
| [
"yul2yull@gmail.com"
] | yul2yull@gmail.com |
dd02c69fa167cb7cfdaba2a009883170f8872b8f | f43f09457e83ee5c7600d2e9c2f402674db3b81c | /Lesson 07 class design/src/a/Employee.java | 6c1f3054dade75d0ae3e60e2d06acbd345c6744c | [] | no_license | dankosorkin/822-124 | 73d05271f079df319284234aa1c8fdeb839ea4e2 | 18352dbc5d14f2c7607e37045de10f97a4c5b8b4 | refs/heads/master | 2023-03-03T13:45:18.492132 | 2021-02-15T14:04:50 | 2021-02-15T14:04:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package a;
public class Employee extends Person {
private double salary;
public Employee(int id, String name, int age, double salary) {
super(id, name, age); // invoke another CTOR in SUPER class
this.salary = salary;
}
public Employee(int id, String name, int age) {
this(id, name, age, 17_000_000); // invoke another CTOR in THIS class
}
}
| [
"jbt@54914_"
] | jbt@54914_ |
0c36d54cb243f49d86a92409557e204526b2c471 | e80f9ebda734bbd9ba86ac639b7ec0282446e1c2 | /sparrow-parent/sparrow-common/src/main/java/org/sparrow/common/RpcDecoder.java | 2a0b206c3ea0536e6983800757d5830044f32e2f | [
"Apache-2.0"
] | permissive | ManderLS/sparrow-rpc | db6351169431b67647cd6a20eaa30123f99015ad | 801475f53a803f8a9548921c8b1b4355fa426dbb | refs/heads/master | 2020-04-15T16:27:56.581819 | 2019-01-08T03:39:59 | 2019-01-08T03:39:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package org.sparrow.common;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.List;
/**
* 继承ByteToMessageDecoder 自己处理半包问题
* 或者基于其他策略进行处理
* @author Administrator
*
*/
public class RpcDecoder extends ByteToMessageDecoder {
private Class<?> genericClass;
public RpcDecoder(Class<?> genericClass) {
this.genericClass = genericClass;
}
@Override
public final void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
if (in.readableBytes() < 4) {
return;
}
in.markReaderIndex();
int dataLength = in.readInt();
System.out.println("data.length"+dataLength);
if (dataLength < 0) {
ctx.close();
}
if (in.readableBytes() < dataLength) {
in.resetReaderIndex();
return ;
}
byte[] data = new byte[dataLength];
try {
in.readBytes(data);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Object obj = SerializationUtil.deserialize(data, genericClass);
out.add(obj);
}
}
| [
"neumann104@sina.com"
] | neumann104@sina.com |
99e568c9ca5a1e190984c7345a8f2b049cd46593 | ffc75de3db55387fb4e122e5d716aba560a04a6d | /quotation_access_scheduler/java/src/main/java/xueqiao/quotation/account/thriftapi/ReqAccountCommodityRegisterAbilityOption.java | a3a247080172eb521bb7070b723fffe0e6e4babd | [] | no_license | xueqiao-codes/xueqiao-quotation | 1ba1caacf04ef1bfd7f11590a4b3a92a55b5c8b0 | 25b2e1a948d7971de2aedb95b18dc9cca3d5f220 | refs/heads/master | 2023-04-15T16:55:18.430768 | 2021-04-25T10:28:32 | 2021-04-25T10:28:32 | 361,395,856 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | true | 37,116 | java | /**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package xueqiao.quotation.account.thriftapi;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ReqAccountCommodityRegisterAbilityOption implements org.apache.thrift.TBase<ReqAccountCommodityRegisterAbilityOption, ReqAccountCommodityRegisterAbilityOption._Fields>, java.io.Serializable, Cloneable, Comparable<ReqAccountCommodityRegisterAbilityOption> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ReqAccountCommodityRegisterAbilityOption");
private static final org.apache.thrift.protocol.TField REGISTER_ABILITY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("registerAbilityId", org.apache.thrift.protocol.TType.I64, (short)1);
private static final org.apache.thrift.protocol.TField ACCOUNT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("accountId", org.apache.thrift.protocol.TType.I64, (short)2);
private static final org.apache.thrift.protocol.TField SLED_COMMODITY_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("sledCommodityIds", org.apache.thrift.protocol.TType.SET, (short)3);
private static final org.apache.thrift.protocol.TField SLED_EXCHANGE_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("sledExchangeIds", org.apache.thrift.protocol.TType.SET, (short)4);
private static final org.apache.thrift.protocol.TField SUPPORT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("supportType", org.apache.thrift.protocol.TType.I32, (short)5);
private static final org.apache.thrift.protocol.TField EXCHANGE_MICS_FIELD_DESC = new org.apache.thrift.protocol.TField("exchangeMics", org.apache.thrift.protocol.TType.SET, (short)6);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ReqAccountCommodityRegisterAbilityOptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new ReqAccountCommodityRegisterAbilityOptionTupleSchemeFactory());
}
public long registerAbilityId; // optional
public long accountId; // optional
public Set<Integer> sledCommodityIds; // optional
public Set<Integer> sledExchangeIds; // optional
/**
*
* @see SupportType
*/
public SupportType supportType; // optional
public Set<String> exchangeMics; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
REGISTER_ABILITY_ID((short)1, "registerAbilityId"),
ACCOUNT_ID((short)2, "accountId"),
SLED_COMMODITY_IDS((short)3, "sledCommodityIds"),
SLED_EXCHANGE_IDS((short)4, "sledExchangeIds"),
/**
*
* @see SupportType
*/
SUPPORT_TYPE((short)5, "supportType"),
EXCHANGE_MICS((short)6, "exchangeMics");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // REGISTER_ABILITY_ID
return REGISTER_ABILITY_ID;
case 2: // ACCOUNT_ID
return ACCOUNT_ID;
case 3: // SLED_COMMODITY_IDS
return SLED_COMMODITY_IDS;
case 4: // SLED_EXCHANGE_IDS
return SLED_EXCHANGE_IDS;
case 5: // SUPPORT_TYPE
return SUPPORT_TYPE;
case 6: // EXCHANGE_MICS
return EXCHANGE_MICS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __REGISTERABILITYID_ISSET_ID = 0;
private static final int __ACCOUNTID_ISSET_ID = 1;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.REGISTER_ABILITY_ID,_Fields.ACCOUNT_ID,_Fields.SLED_COMMODITY_IDS,_Fields.SLED_EXCHANGE_IDS,_Fields.SUPPORT_TYPE,_Fields.EXCHANGE_MICS};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.REGISTER_ABILITY_ID, new org.apache.thrift.meta_data.FieldMetaData("registerAbilityId", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.ACCOUNT_ID, new org.apache.thrift.meta_data.FieldMetaData("accountId", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.SLED_COMMODITY_IDS, new org.apache.thrift.meta_data.FieldMetaData("sledCommodityIds", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
tmpMap.put(_Fields.SLED_EXCHANGE_IDS, new org.apache.thrift.meta_data.FieldMetaData("sledExchangeIds", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
tmpMap.put(_Fields.SUPPORT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("supportType", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SupportType.class)));
tmpMap.put(_Fields.EXCHANGE_MICS, new org.apache.thrift.meta_data.FieldMetaData("exchangeMics", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ReqAccountCommodityRegisterAbilityOption.class, metaDataMap);
}
public ReqAccountCommodityRegisterAbilityOption() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ReqAccountCommodityRegisterAbilityOption(ReqAccountCommodityRegisterAbilityOption other) {
__isset_bitfield = other.__isset_bitfield;
this.registerAbilityId = other.registerAbilityId;
this.accountId = other.accountId;
if (other.isSetSledCommodityIds()) {
Set<Integer> __this__sledCommodityIds = new HashSet<Integer>(other.sledCommodityIds);
this.sledCommodityIds = __this__sledCommodityIds;
}
if (other.isSetSledExchangeIds()) {
Set<Integer> __this__sledExchangeIds = new HashSet<Integer>(other.sledExchangeIds);
this.sledExchangeIds = __this__sledExchangeIds;
}
if (other.isSetSupportType()) {
this.supportType = other.supportType;
}
if (other.isSetExchangeMics()) {
Set<String> __this__exchangeMics = new HashSet<String>(other.exchangeMics);
this.exchangeMics = __this__exchangeMics;
}
}
public ReqAccountCommodityRegisterAbilityOption deepCopy() {
return new ReqAccountCommodityRegisterAbilityOption(this);
}
@Override
public void clear() {
setRegisterAbilityIdIsSet(false);
this.registerAbilityId = 0;
setAccountIdIsSet(false);
this.accountId = 0;
this.sledCommodityIds = null;
this.sledExchangeIds = null;
this.supportType = null;
this.exchangeMics = null;
}
public long getRegisterAbilityId() {
return this.registerAbilityId;
}
public ReqAccountCommodityRegisterAbilityOption setRegisterAbilityId(long registerAbilityId) {
this.registerAbilityId = registerAbilityId;
setRegisterAbilityIdIsSet(true);
return this;
}
public void unsetRegisterAbilityId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __REGISTERABILITYID_ISSET_ID);
}
/** Returns true if field registerAbilityId is set (has been assigned a value) and false otherwise */
public boolean isSetRegisterAbilityId() {
return EncodingUtils.testBit(__isset_bitfield, __REGISTERABILITYID_ISSET_ID);
}
public void setRegisterAbilityIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __REGISTERABILITYID_ISSET_ID, value);
}
public long getAccountId() {
return this.accountId;
}
public ReqAccountCommodityRegisterAbilityOption setAccountId(long accountId) {
this.accountId = accountId;
setAccountIdIsSet(true);
return this;
}
public void unsetAccountId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACCOUNTID_ISSET_ID);
}
/** Returns true if field accountId is set (has been assigned a value) and false otherwise */
public boolean isSetAccountId() {
return EncodingUtils.testBit(__isset_bitfield, __ACCOUNTID_ISSET_ID);
}
public void setAccountIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACCOUNTID_ISSET_ID, value);
}
public int getSledCommodityIdsSize() {
return (this.sledCommodityIds == null) ? 0 : this.sledCommodityIds.size();
}
public java.util.Iterator<Integer> getSledCommodityIdsIterator() {
return (this.sledCommodityIds == null) ? null : this.sledCommodityIds.iterator();
}
public void addToSledCommodityIds(int elem) {
if (this.sledCommodityIds == null) {
this.sledCommodityIds = new HashSet<Integer>();
}
this.sledCommodityIds.add(elem);
}
public Set<Integer> getSledCommodityIds() {
return this.sledCommodityIds;
}
public ReqAccountCommodityRegisterAbilityOption setSledCommodityIds(Set<Integer> sledCommodityIds) {
this.sledCommodityIds = sledCommodityIds;
return this;
}
public void unsetSledCommodityIds() {
this.sledCommodityIds = null;
}
/** Returns true if field sledCommodityIds is set (has been assigned a value) and false otherwise */
public boolean isSetSledCommodityIds() {
return this.sledCommodityIds != null;
}
public void setSledCommodityIdsIsSet(boolean value) {
if (!value) {
this.sledCommodityIds = null;
}
}
public int getSledExchangeIdsSize() {
return (this.sledExchangeIds == null) ? 0 : this.sledExchangeIds.size();
}
public java.util.Iterator<Integer> getSledExchangeIdsIterator() {
return (this.sledExchangeIds == null) ? null : this.sledExchangeIds.iterator();
}
public void addToSledExchangeIds(int elem) {
if (this.sledExchangeIds == null) {
this.sledExchangeIds = new HashSet<Integer>();
}
this.sledExchangeIds.add(elem);
}
public Set<Integer> getSledExchangeIds() {
return this.sledExchangeIds;
}
public ReqAccountCommodityRegisterAbilityOption setSledExchangeIds(Set<Integer> sledExchangeIds) {
this.sledExchangeIds = sledExchangeIds;
return this;
}
public void unsetSledExchangeIds() {
this.sledExchangeIds = null;
}
/** Returns true if field sledExchangeIds is set (has been assigned a value) and false otherwise */
public boolean isSetSledExchangeIds() {
return this.sledExchangeIds != null;
}
public void setSledExchangeIdsIsSet(boolean value) {
if (!value) {
this.sledExchangeIds = null;
}
}
/**
*
* @see SupportType
*/
public SupportType getSupportType() {
return this.supportType;
}
/**
*
* @see SupportType
*/
public ReqAccountCommodityRegisterAbilityOption setSupportType(SupportType supportType) {
this.supportType = supportType;
return this;
}
public void unsetSupportType() {
this.supportType = null;
}
/** Returns true if field supportType is set (has been assigned a value) and false otherwise */
public boolean isSetSupportType() {
return this.supportType != null;
}
public void setSupportTypeIsSet(boolean value) {
if (!value) {
this.supportType = null;
}
}
public int getExchangeMicsSize() {
return (this.exchangeMics == null) ? 0 : this.exchangeMics.size();
}
public java.util.Iterator<String> getExchangeMicsIterator() {
return (this.exchangeMics == null) ? null : this.exchangeMics.iterator();
}
public void addToExchangeMics(String elem) {
if (this.exchangeMics == null) {
this.exchangeMics = new HashSet<String>();
}
this.exchangeMics.add(elem);
}
public Set<String> getExchangeMics() {
return this.exchangeMics;
}
public ReqAccountCommodityRegisterAbilityOption setExchangeMics(Set<String> exchangeMics) {
this.exchangeMics = exchangeMics;
return this;
}
public void unsetExchangeMics() {
this.exchangeMics = null;
}
/** Returns true if field exchangeMics is set (has been assigned a value) and false otherwise */
public boolean isSetExchangeMics() {
return this.exchangeMics != null;
}
public void setExchangeMicsIsSet(boolean value) {
if (!value) {
this.exchangeMics = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case REGISTER_ABILITY_ID:
if (value == null) {
unsetRegisterAbilityId();
} else {
setRegisterAbilityId((Long)value);
}
break;
case ACCOUNT_ID:
if (value == null) {
unsetAccountId();
} else {
setAccountId((Long)value);
}
break;
case SLED_COMMODITY_IDS:
if (value == null) {
unsetSledCommodityIds();
} else {
setSledCommodityIds((Set<Integer>)value);
}
break;
case SLED_EXCHANGE_IDS:
if (value == null) {
unsetSledExchangeIds();
} else {
setSledExchangeIds((Set<Integer>)value);
}
break;
case SUPPORT_TYPE:
if (value == null) {
unsetSupportType();
} else {
setSupportType((SupportType)value);
}
break;
case EXCHANGE_MICS:
if (value == null) {
unsetExchangeMics();
} else {
setExchangeMics((Set<String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case REGISTER_ABILITY_ID:
return Long.valueOf(getRegisterAbilityId());
case ACCOUNT_ID:
return Long.valueOf(getAccountId());
case SLED_COMMODITY_IDS:
return getSledCommodityIds();
case SLED_EXCHANGE_IDS:
return getSledExchangeIds();
case SUPPORT_TYPE:
return getSupportType();
case EXCHANGE_MICS:
return getExchangeMics();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case REGISTER_ABILITY_ID:
return isSetRegisterAbilityId();
case ACCOUNT_ID:
return isSetAccountId();
case SLED_COMMODITY_IDS:
return isSetSledCommodityIds();
case SLED_EXCHANGE_IDS:
return isSetSledExchangeIds();
case SUPPORT_TYPE:
return isSetSupportType();
case EXCHANGE_MICS:
return isSetExchangeMics();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ReqAccountCommodityRegisterAbilityOption)
return this.equals((ReqAccountCommodityRegisterAbilityOption)that);
return false;
}
public boolean equals(ReqAccountCommodityRegisterAbilityOption that) {
if (that == null)
return false;
boolean this_present_registerAbilityId = true && this.isSetRegisterAbilityId();
boolean that_present_registerAbilityId = true && that.isSetRegisterAbilityId();
if (this_present_registerAbilityId || that_present_registerAbilityId) {
if (!(this_present_registerAbilityId && that_present_registerAbilityId))
return false;
if (this.registerAbilityId != that.registerAbilityId)
return false;
}
boolean this_present_accountId = true && this.isSetAccountId();
boolean that_present_accountId = true && that.isSetAccountId();
if (this_present_accountId || that_present_accountId) {
if (!(this_present_accountId && that_present_accountId))
return false;
if (this.accountId != that.accountId)
return false;
}
boolean this_present_sledCommodityIds = true && this.isSetSledCommodityIds();
boolean that_present_sledCommodityIds = true && that.isSetSledCommodityIds();
if (this_present_sledCommodityIds || that_present_sledCommodityIds) {
if (!(this_present_sledCommodityIds && that_present_sledCommodityIds))
return false;
if (!this.sledCommodityIds.equals(that.sledCommodityIds))
return false;
}
boolean this_present_sledExchangeIds = true && this.isSetSledExchangeIds();
boolean that_present_sledExchangeIds = true && that.isSetSledExchangeIds();
if (this_present_sledExchangeIds || that_present_sledExchangeIds) {
if (!(this_present_sledExchangeIds && that_present_sledExchangeIds))
return false;
if (!this.sledExchangeIds.equals(that.sledExchangeIds))
return false;
}
boolean this_present_supportType = true && this.isSetSupportType();
boolean that_present_supportType = true && that.isSetSupportType();
if (this_present_supportType || that_present_supportType) {
if (!(this_present_supportType && that_present_supportType))
return false;
if (!this.supportType.equals(that.supportType))
return false;
}
boolean this_present_exchangeMics = true && this.isSetExchangeMics();
boolean that_present_exchangeMics = true && that.isSetExchangeMics();
if (this_present_exchangeMics || that_present_exchangeMics) {
if (!(this_present_exchangeMics && that_present_exchangeMics))
return false;
if (!this.exchangeMics.equals(that.exchangeMics))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public int compareTo(ReqAccountCommodityRegisterAbilityOption other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetRegisterAbilityId()).compareTo(other.isSetRegisterAbilityId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRegisterAbilityId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.registerAbilityId, other.registerAbilityId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAccountId()).compareTo(other.isSetAccountId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAccountId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.accountId, other.accountId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSledCommodityIds()).compareTo(other.isSetSledCommodityIds());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSledCommodityIds()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sledCommodityIds, other.sledCommodityIds);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSledExchangeIds()).compareTo(other.isSetSledExchangeIds());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSledExchangeIds()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sledExchangeIds, other.sledExchangeIds);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSupportType()).compareTo(other.isSetSupportType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSupportType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.supportType, other.supportType);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetExchangeMics()).compareTo(other.isSetExchangeMics());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetExchangeMics()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.exchangeMics, other.exchangeMics);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ReqAccountCommodityRegisterAbilityOption(");
boolean first = true;
if (isSetRegisterAbilityId()) {
sb.append("registerAbilityId:");
sb.append(this.registerAbilityId);
first = false;
}
if (isSetAccountId()) {
if (!first) sb.append(", ");
sb.append("accountId:");
sb.append(this.accountId);
first = false;
}
if (isSetSledCommodityIds()) {
if (!first) sb.append(", ");
sb.append("sledCommodityIds:");
if (this.sledCommodityIds == null) {
sb.append("null");
} else {
sb.append(this.sledCommodityIds);
}
first = false;
}
if (isSetSledExchangeIds()) {
if (!first) sb.append(", ");
sb.append("sledExchangeIds:");
if (this.sledExchangeIds == null) {
sb.append("null");
} else {
sb.append(this.sledExchangeIds);
}
first = false;
}
if (isSetSupportType()) {
if (!first) sb.append(", ");
sb.append("supportType:");
if (this.supportType == null) {
sb.append("null");
} else {
sb.append(this.supportType);
}
first = false;
}
if (isSetExchangeMics()) {
if (!first) sb.append(", ");
sb.append("exchangeMics:");
if (this.exchangeMics == null) {
sb.append("null");
} else {
sb.append(this.exchangeMics);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ReqAccountCommodityRegisterAbilityOptionStandardSchemeFactory implements SchemeFactory {
public ReqAccountCommodityRegisterAbilityOptionStandardScheme getScheme() {
return new ReqAccountCommodityRegisterAbilityOptionStandardScheme();
}
}
private static class ReqAccountCommodityRegisterAbilityOptionStandardScheme extends StandardScheme<ReqAccountCommodityRegisterAbilityOption> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ReqAccountCommodityRegisterAbilityOption struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // REGISTER_ABILITY_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.registerAbilityId = iprot.readI64();
struct.setRegisterAbilityIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // ACCOUNT_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.accountId = iprot.readI64();
struct.setAccountIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // SLED_COMMODITY_IDS
if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
{
org.apache.thrift.protocol.TSet _set148 = iprot.readSetBegin();
struct.sledCommodityIds = new HashSet<Integer>(2*_set148.size);
for (int _i149 = 0; _i149 < _set148.size; ++_i149)
{
int _elem150;
_elem150 = iprot.readI32();
struct.sledCommodityIds.add(_elem150);
}
iprot.readSetEnd();
}
struct.setSledCommodityIdsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // SLED_EXCHANGE_IDS
if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
{
org.apache.thrift.protocol.TSet _set151 = iprot.readSetBegin();
struct.sledExchangeIds = new HashSet<Integer>(2*_set151.size);
for (int _i152 = 0; _i152 < _set151.size; ++_i152)
{
int _elem153;
_elem153 = iprot.readI32();
struct.sledExchangeIds.add(_elem153);
}
iprot.readSetEnd();
}
struct.setSledExchangeIdsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // SUPPORT_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.supportType = SupportType.findByValue(iprot.readI32());
struct.setSupportTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // EXCHANGE_MICS
if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
{
org.apache.thrift.protocol.TSet _set154 = iprot.readSetBegin();
struct.exchangeMics = new HashSet<String>(2*_set154.size);
for (int _i155 = 0; _i155 < _set154.size; ++_i155)
{
String _elem156;
_elem156 = iprot.readString();
struct.exchangeMics.add(_elem156);
}
iprot.readSetEnd();
}
struct.setExchangeMicsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ReqAccountCommodityRegisterAbilityOption struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.isSetRegisterAbilityId()) {
oprot.writeFieldBegin(REGISTER_ABILITY_ID_FIELD_DESC);
oprot.writeI64(struct.registerAbilityId);
oprot.writeFieldEnd();
}
if (struct.isSetAccountId()) {
oprot.writeFieldBegin(ACCOUNT_ID_FIELD_DESC);
oprot.writeI64(struct.accountId);
oprot.writeFieldEnd();
}
if (struct.sledCommodityIds != null) {
if (struct.isSetSledCommodityIds()) {
oprot.writeFieldBegin(SLED_COMMODITY_IDS_FIELD_DESC);
{
oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.sledCommodityIds.size()));
for (int _iter157 : struct.sledCommodityIds)
{
oprot.writeI32(_iter157);
}
oprot.writeSetEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.sledExchangeIds != null) {
if (struct.isSetSledExchangeIds()) {
oprot.writeFieldBegin(SLED_EXCHANGE_IDS_FIELD_DESC);
{
oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.sledExchangeIds.size()));
for (int _iter158 : struct.sledExchangeIds)
{
oprot.writeI32(_iter158);
}
oprot.writeSetEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.supportType != null) {
if (struct.isSetSupportType()) {
oprot.writeFieldBegin(SUPPORT_TYPE_FIELD_DESC);
oprot.writeI32(struct.supportType.getValue());
oprot.writeFieldEnd();
}
}
if (struct.exchangeMics != null) {
if (struct.isSetExchangeMics()) {
oprot.writeFieldBegin(EXCHANGE_MICS_FIELD_DESC);
{
oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.exchangeMics.size()));
for (String _iter159 : struct.exchangeMics)
{
oprot.writeString(_iter159);
}
oprot.writeSetEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ReqAccountCommodityRegisterAbilityOptionTupleSchemeFactory implements SchemeFactory {
public ReqAccountCommodityRegisterAbilityOptionTupleScheme getScheme() {
return new ReqAccountCommodityRegisterAbilityOptionTupleScheme();
}
}
private static class ReqAccountCommodityRegisterAbilityOptionTupleScheme extends TupleScheme<ReqAccountCommodityRegisterAbilityOption> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ReqAccountCommodityRegisterAbilityOption struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetRegisterAbilityId()) {
optionals.set(0);
}
if (struct.isSetAccountId()) {
optionals.set(1);
}
if (struct.isSetSledCommodityIds()) {
optionals.set(2);
}
if (struct.isSetSledExchangeIds()) {
optionals.set(3);
}
if (struct.isSetSupportType()) {
optionals.set(4);
}
if (struct.isSetExchangeMics()) {
optionals.set(5);
}
oprot.writeBitSet(optionals, 6);
if (struct.isSetRegisterAbilityId()) {
oprot.writeI64(struct.registerAbilityId);
}
if (struct.isSetAccountId()) {
oprot.writeI64(struct.accountId);
}
if (struct.isSetSledCommodityIds()) {
{
oprot.writeI32(struct.sledCommodityIds.size());
for (int _iter160 : struct.sledCommodityIds)
{
oprot.writeI32(_iter160);
}
}
}
if (struct.isSetSledExchangeIds()) {
{
oprot.writeI32(struct.sledExchangeIds.size());
for (int _iter161 : struct.sledExchangeIds)
{
oprot.writeI32(_iter161);
}
}
}
if (struct.isSetSupportType()) {
oprot.writeI32(struct.supportType.getValue());
}
if (struct.isSetExchangeMics()) {
{
oprot.writeI32(struct.exchangeMics.size());
for (String _iter162 : struct.exchangeMics)
{
oprot.writeString(_iter162);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ReqAccountCommodityRegisterAbilityOption struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(6);
if (incoming.get(0)) {
struct.registerAbilityId = iprot.readI64();
struct.setRegisterAbilityIdIsSet(true);
}
if (incoming.get(1)) {
struct.accountId = iprot.readI64();
struct.setAccountIdIsSet(true);
}
if (incoming.get(2)) {
{
org.apache.thrift.protocol.TSet _set163 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, iprot.readI32());
struct.sledCommodityIds = new HashSet<Integer>(2*_set163.size);
for (int _i164 = 0; _i164 < _set163.size; ++_i164)
{
int _elem165;
_elem165 = iprot.readI32();
struct.sledCommodityIds.add(_elem165);
}
}
struct.setSledCommodityIdsIsSet(true);
}
if (incoming.get(3)) {
{
org.apache.thrift.protocol.TSet _set166 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, iprot.readI32());
struct.sledExchangeIds = new HashSet<Integer>(2*_set166.size);
for (int _i167 = 0; _i167 < _set166.size; ++_i167)
{
int _elem168;
_elem168 = iprot.readI32();
struct.sledExchangeIds.add(_elem168);
}
}
struct.setSledExchangeIdsIsSet(true);
}
if (incoming.get(4)) {
struct.supportType = SupportType.findByValue(iprot.readI32());
struct.setSupportTypeIsSet(true);
}
if (incoming.get(5)) {
{
org.apache.thrift.protocol.TSet _set169 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.exchangeMics = new HashSet<String>(2*_set169.size);
for (int _i170 = 0; _i170 < _set169.size; ++_i170)
{
String _elem171;
_elem171 = iprot.readString();
struct.exchangeMics.add(_elem171);
}
}
struct.setExchangeMicsIsSet(true);
}
}
}
}
| [
"wangli@authine.com"
] | wangli@authine.com |
0c106da27b0f87494133455a7911c6b588994be7 | a9914626c19f4fbcb5758a1953a4efe4c116dfb9 | /L2JTW_DataPack_Ertheia/dist/game/data/scripts/quests/TerritoryWarScripts/Q00735_MakeSpearsDull.java | 75a22d27eea2ade12616c450b91daee1c9c56213 | [] | no_license | mjsxjy/l2jtw_datapack | ba84a3bbcbae4adbc6b276f9342c248b6dd40309 | c6968ae0475a076080faeead7f94bda1bba3def7 | refs/heads/master | 2021-01-19T18:21:37.381390 | 2015-08-03T00:20:39 | 2015-08-03T00:20:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,644 | java | /*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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 quests.TerritoryWarScripts;
import com.l2jserver.gameserver.network.NpcStringId;
/**
* Make Spears Dull! (735)
* @author Gigiikun
*/
public final class Q00735_MakeSpearsDull extends TerritoryWarSuperClass
{
public Q00735_MakeSpearsDull()
{
super(735, Q00735_MakeSpearsDull.class.getSimpleName(), "Make Spears Dull");
CLASS_IDS = new int[]
{
23,
101,
36,
108,
8,
93,
2,
88,
3,
89,
48,
114,
46,
113,
55,
117,
9,
92,
24,
102,
37,
109,
34,
107,
21,
100,
127,
131,
128,
132,
129,
133,
130,
134,
135,
136
};
RANDOM_MIN = 15;
RANDOM_MAX = 20;
npcString = new NpcStringId[]
{
NpcStringId.YOU_HAVE_DEFEATED_S2_OF_S1_WARRIORS_AND_ROGUES,
NpcStringId.YOU_WEAKENED_THE_ENEMYS_ATTACK
};
}
}
| [
"rocknow@9bd44e3e-6552-0410-907e-a6ca40b856b6"
] | rocknow@9bd44e3e-6552-0410-907e-a6ca40b856b6 |
893cce1704450584061d7f410d25ac51e78f1423 | af5c6643b7520c4299d9ee04025b815954b46751 | /RedBaby/app/src/main/java/com/erzu/dearbaby/home/view/activity/Class_Edits.java | dbfea267740a9fcb47e5a54ea68355218253801f | [] | no_license | tanruimin/1502stanruimin | fe4379d4d5d63ac701f54a80e71677c67d33dbbe | 512e34be02a27f2b528cc9685548ec55db453138 | refs/heads/master | 2021-01-19T07:06:59.471544 | 2017-05-31T02:31:03 | 2017-05-31T02:31:03 | 87,523,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,704 | java | package com.erzu.dearbaby.home.view.activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.erzu.dearbaby.R;
import com.erzu.dearbaby.home.view.adapter.Class_MyGridView_pindao;
import com.erzu.dearbaby.home.view.adapter.Class_OtherAdapter;
import java.util.ArrayList;
import java.util.List;
public class Class_Edits extends AppCompatActivity implements AdapterView.OnItemClickListener {
private Class_MyGridView_pindao mUserGv, mOtherGv;
private List<String> mUserList = new ArrayList<>();
private List<String> mOtherList = new ArrayList<>();
private Class_OtherAdapter mUserAdapter, mOtherAdapter;
private TextView class_edit_cancel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.class_edit);
initView();
class_edit_cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
public void initView() {
mUserGv = (Class_MyGridView_pindao) findViewById(R.id.userGridView);
mOtherGv = (Class_MyGridView_pindao) findViewById(R.id.otherGridView);
class_edit_cancel = (TextView) findViewById(R.id.class_edit_cancel);
mOtherList.add("育儿图书");
mOtherList.add("防辐射服");
mOtherList.add("儿童车");
mOtherList.add("奶瓶");
mOtherList.add("自行车");
mOtherList.add("纸尿裤");
mOtherList.add("奶粉");
mOtherList.add("驱蚊液");
mOtherList.add("推车");
mOtherList.add("男童夏装");
mOtherList.add("女童夏装");
mOtherList.add("儿童玩具");
// mUserList.add("情感");
// mUserList.add("儿童车");
mUserAdapter = new Class_OtherAdapter(this, mUserList, true);
mOtherAdapter = new Class_OtherAdapter(this, mOtherList, false);
mUserGv.setAdapter(mUserAdapter);
mOtherGv.setAdapter(mOtherAdapter);
mUserGv.setOnItemClickListener(this);
mOtherGv.setOnItemClickListener(this);
}
/**
* 获取点击的Item的对应View,
* 因为点击的Item已经有了自己归属的父容器MyGridView,所有我们要是有一个ImageView来代替Item移动
*
* @param view
* @return
*/
private ImageView getView(View view) {
view.destroyDrawingCache();
view.setDrawingCacheEnabled(true);
Bitmap cache = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
ImageView iv = new ImageView(this);
iv.setImageBitmap(cache);
return iv;
}
/**
* 获取移动的VIEW,放入对应ViewGroup布局容器
*
* @param viewGroup
* @param view
* @param initLocation
* @return
*/
private View getMoveView(ViewGroup viewGroup, View view, int[] initLocation) {
int x = initLocation[0];
int y = initLocation[1];
viewGroup.addView(view);
LinearLayout.LayoutParams mLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mLayoutParams.leftMargin = x;
mLayoutParams.topMargin = y;
view.setLayoutParams(mLayoutParams);
return view;
}
/**
* 创建移动的ITEM对应的ViewGroup布局容器
* 用于存放我们移动的View
*/
private ViewGroup getMoveViewGroup() {
//window中最顶层的view
ViewGroup moveViewGroup = (ViewGroup) getWindow().getDecorView();
LinearLayout moveLinearLayout = new LinearLayout(this);
moveLinearLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
moveViewGroup.addView(moveLinearLayout);
return moveLinearLayout;
}
/**
* 点击ITEM移动动画
*
* @param moveView
* @param startLocation
* @param endLocation
* @param moveChannel
* @param clickGridView
*/
private void MoveAnim(View moveView, int[] startLocation, int[] endLocation, final String moveChannel,
final GridView clickGridView, final boolean isUser) {
int[] initLocation = new int[2];
//获取传递过来的VIEW的坐标
moveView.getLocationInWindow(initLocation);
//得到要移动的VIEW,并放入对应的容器中
final ViewGroup moveViewGroup = getMoveViewGroup();
final View mMoveView = getMoveView(moveViewGroup, moveView, initLocation);
//创建移动动画
TranslateAnimation moveAnimation = new TranslateAnimation(
startLocation[0], endLocation[0], startLocation[1],
endLocation[1]);
moveAnimation.setDuration(300L);//动画时间
//动画配置
AnimationSet moveAnimationSet = new AnimationSet(true);
moveAnimationSet.setFillAfter(false);//动画效果执行完毕后,View对象不保留在终止的位置
moveAnimationSet.addAnimation(moveAnimation);
mMoveView.startAnimation(moveAnimationSet);
moveAnimationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
moveViewGroup.removeView(mMoveView);
// 判断点击的是DragGrid还是OtherGridView
if (isUser) {
mOtherAdapter.setVisible(true);
mOtherAdapter.notifyDataSetChanged();
mUserAdapter.remove();
} else {
mUserAdapter.setVisible(true);
mUserAdapter.notifyDataSetChanged();
mOtherAdapter.remove();
}
}
});
}
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
switch (parent.getId()) {
case R.id.userGridView:
//position为 0,1 的不可以进行任何操作
// if (position != 0 && position != 1) {
{
final ImageView moveImageView = getView(view);
if (moveImageView != null) {
TextView newTextView = (TextView) view.findViewById(R.id.text_item);
final int[] startLocation = new int[2];
newTextView.getLocationInWindow(startLocation);
final String channel = ((Class_OtherAdapter) parent.getAdapter()).getItem(position);//获取点击的频道内容
mOtherAdapter.setVisible(false);
//添加到最后一个
mOtherAdapter.addItem(channel);
new Handler().postDelayed(new Runnable() {
public void run() {
try {
int[] endLocation = new int[2];
//获取终点的坐标
mOtherGv.getChildAt(mOtherGv.getLastVisiblePosition()).getLocationInWindow(endLocation);
MoveAnim(moveImageView, startLocation, endLocation, channel, mUserGv, true);
mUserAdapter.setRemove(position);
} catch (Exception localException) {
}
}
}, 50L);
// }
}
}
break;
case R.id.otherGridView:
final ImageView moveImageView = getView(view);
if (moveImageView != null) {
TextView newTextView = (TextView) view.findViewById(R.id.text_item);
final int[] startLocation = new int[2];
newTextView.getLocationInWindow(startLocation);
final String channel = ((Class_OtherAdapter) parent.getAdapter()).getItem(position);
mUserAdapter.setVisible(false);
//添加到最后一个
mUserAdapter.addItem(channel);
new Handler().postDelayed(new Runnable() {
public void run() {
try {
int[] endLocation = new int[2];
//获取终点的坐标
mUserGv.getChildAt(mUserGv.getLastVisiblePosition()).getLocationInWindow(endLocation);
MoveAnim(moveImageView, startLocation, endLocation, channel, mOtherGv, false);
mOtherAdapter.setRemove(position);
} catch (Exception localException) {
}
}
}, 50L);
}
break;
default:
break;
}
}
}
| [
"1165185929@qq.com"
] | 1165185929@qq.com |
592299bc5f4548064849a5d43fd15603f1cb4803 | c5451a4b9c3558bccf45e429821f39398adefde5 | /src/nullobject/VehicleFactory.java | c1644482747a2bd6e9f798f1e8a8ec9125a2b218 | [] | no_license | Rameshkatiyar/design-patterns | 9d94740f5033517da277e7a76da960064416faab | 2d1d96cf97696890566264f7c9a0b90ee0aeaa8a | refs/heads/master | 2023-04-14T13:32:46.340153 | 2023-04-13T12:08:21 | 2023-04-13T12:08:21 | 222,151,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package nullobject;
public class VehicleFactory {
public Vehicle getVehicle(String type) {
switch (type) {
case "car": return new Car();
case "bike": return new Bike();
default: return new NullVehicle();
}
}
}
| [
"er.rameshkatiyar@gmail.com"
] | er.rameshkatiyar@gmail.com |
b92d3320a23dc085320617850c7924681b998ed0 | df50a2dbb588d8859e513ddc40431d6f7c532a42 | /src/main/java/com/ericsson/jigsaw/redis/shard/ShardingProvider.java | 3805c7539610d689fb6dc58fefda2c0f167c2199 | [
"Apache-2.0"
] | permissive | supercyc/jigsaw-redis | 54f15f4c4796d01b50d908fb38b1b37070c51b28 | 098a608e0b26f3996d0270665784159a8beb0ff0 | refs/heads/master | 2021-01-10T03:08:30.075377 | 2015-11-13T04:49:00 | 2015-11-13T04:49:00 | 46,098,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | /*
* ----------------------------------------------------------------------
* COPYRIGHT Ericsson 2015
*
* The copyright to the computer program(s) herein is the property of
* Ericsson Inc. The programs may be used and/or copied only with written
* permission from Ericsson Inc. or in accordance with the terms and
* conditions stipulated in the agreement/contract under which the
* program(s) have been supplied.
* ----------------------------------------------------------------------
*/
package com.ericsson.jigsaw.redis.shard;
import java.util.List;
public interface ShardingProvider<T> {
public void initNode(List<T> sourceNodes);
public T getNode(String key);
public T getSpecifiedNode(int index);
public <A> ShardingProvider<A> derive(Class<A> clazz);
//Did not support add and remove yet.
//public void addNode(List<T> newNodes);
//public void removeNode(List<T> delNodes);
}
| [
"cycrjgs@163.com"
] | cycrjgs@163.com |
cdb7ce2c21ce04ea75669055ad5cb526d63376c3 | 20f067c10907f04399a475cc08eedcdde65797ad | /Factory/AnimalFactory.java | 55a0787717ca0947904a287bcb48ed37dc23ceda | [] | no_license | doohinkus/JavaPatterns | 246b0d47276133a52aa12b2304abac5772c42299 | 2141ef75b14184894d7494988f31d83bc47090fa | refs/heads/master | 2023-03-27T12:04:13.415581 | 2021-03-22T00:33:17 | 2021-03-22T00:33:17 | 337,254,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package Factory;
public class AnimalFactory {
public static Animal getAnimal(AnimalType type){
// FACTORY instantiates the classes
switch(type){
case TIGER:
return new Tiger();
case DOG:
return new Dog();
case CAT:
return new Cat();
}
return null;
}
}
| [
"valenlongfeather@Valens-MacBook-Pro.local"
] | valenlongfeather@Valens-MacBook-Pro.local |
bd59493692fce9b46d2d94fdcb61bd97fe0bdfdf | d333f1578b308cd0b464cfd5c24cb67d6af20f1c | /School/CSC 130 Data Structures and Algorithm Analysis/Project 3/Warren-Quattrocchi/Project 3/AVLTree.java | 6235ed64a2bb1d6750a5ebda9b842bffd978e39b | [] | no_license | WarrenQuat/CSUS | ffc117def45dae2f85ce0c08f1f897e70c7e3a9f | 8dff69928251494b6f882e233194eb1bf568fb4b | refs/heads/master | 2023-03-03T16:05:45.861957 | 2021-02-11T00:22:20 | 2021-02-11T00:22:20 | 187,153,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,750 | java | //Warren Quattrocchi
//CSC 130
//AVLTree class
public class AVLTree <E extends Comparable<? super E>> extends BinarySearchTree<E>
{
private int height;
public AVLTree()
{
}
public BSTNode balance(BSTNode node)
{
if(node == null)
return null;
if(getHeight(node.left)- getHeight(node.right) > 1)
{
if(getHeight(node.left.left) >= getHeight(node.left.right))
node = singleRightRotation(node);
else
{
node = doubleLeftRightRotation(node);
}
}
else if(getHeight(node.right) - getHeight(node.left) > 1)
{
if(getHeight(node.right.right) >= getHeight(node.right.left))
node = singleLeftRotation(node);
else
{
node = doubleRightLeftRotation(node);
}
}
return node;
}
//call inccount from bst class
//balance the resulting tree
public void incCount(E data)
{
super.incCount(data);
overallRoot = balance(overallRoot);
}
private BSTNode singleRightRotation(BSTNode k2)
{
BSTNode k1 = k2.left;
k2.left = k1.right;
k1.right = k2;
return k1;
}
private BSTNode singleLeftRotation(BSTNode k1)
{
BSTNode k2 = k1.right;
k1.right = k2.left;
k2.left = k1;
return k2;
}
private BSTNode doubleLeftRightRotation(BSTNode k3)
{
k3.left = singleLeftRotation(k3.left);
return singleRightRotation(k3);
}
private BSTNode doubleRightLeftRotation(BSTNode k1)
{
k1.right = singleRightRotation(k1.right);
return singleLeftRotation(k1);
}
public int getHeight()
{
return height;
}
int getHeight(BSTNode node)
{
int right;
int left;
if(node == null)
return 0;
else
{
left = getHeight(node.left);
right = getHeight(node.right);
if(right > left)
return right+1;
else
return left+1;
}
}
}
| [
"warren.quatrocchi@gmail.com"
] | warren.quatrocchi@gmail.com |
e75886e7a379ee7178721169d222b13859517a67 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Time-6/org.joda.time.chrono.GJChronology/BBC-F0-opt-50/tests/29/org/joda/time/chrono/GJChronology_ESTest_scaffolding.java | f63025319542fde67dc4156e33c1bcabbac8380f | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 22,325 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sun Oct 24 04:21:29 GMT 2021
*/
package org.joda.time.chrono;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class GJChronology_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.joda.time.chrono.GJChronology";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.timezone", "Etc/UTC");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(GJChronology_ESTest_scaffolding.class.getClassLoader() ,
"org.joda.time.DateTimeZone",
"org.joda.time.field.AbstractPartialFieldProperty",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.convert.ConverterSet$Entry",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.LocalDate$Property",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.ReadWritableInterval",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.DateTimePrinter",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.base.BaseLocal",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.convert.DateConverter",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.base.BaseInterval",
"org.joda.time.Duration",
"org.joda.time.format.FormatUtils",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.Interval",
"org.joda.time.convert.LongConverter",
"org.joda.time.base.AbstractInstant",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.ReadWritablePeriod",
"org.joda.time.convert.ConverterSet",
"org.joda.time.LocalDateTime",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.base.BasePeriod$1",
"org.joda.time.convert.IntervalConverter",
"org.joda.time.format.PeriodPrinter",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.convert.ReadableDurationConverter",
"org.joda.time.base.BaseDuration",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.YearMonthDay",
"org.joda.time.format.DateTimeParser",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.YearMonth",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.DateTime$Property",
"org.joda.time.convert.ReadablePeriodConverter",
"org.joda.time.Years",
"org.joda.time.convert.ReadableIntervalConverter",
"org.joda.time.DateTimeField",
"org.joda.time.field.FieldUtils",
"org.joda.time.Partial",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.IllegalInstantException",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.ReadablePeriod",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.convert.ConverterManager",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.Minutes",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.base.AbstractPartial",
"org.joda.time.base.BasePartial",
"org.joda.time.base.BaseDateTime",
"org.joda.time.base.AbstractDuration",
"org.joda.time.DateTimeUtils",
"org.joda.time.LocalTime",
"org.joda.time.base.AbstractInterval",
"org.joda.time.Hours",
"org.joda.time.base.BasePeriod",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.format.DateTimeFormat$1",
"org.joda.time.TimeOfDay",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.ReadableDuration",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.DurationField",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.DateTime",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.ReadWritableDateTime",
"org.joda.time.convert.PeriodConverter",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.Instant",
"org.joda.time.convert.CalendarConverter",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.chrono.BuddhistChronology",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.format.ISODateTimeFormat$Constants",
"org.joda.time.convert.ReadablePartialConverter",
"org.joda.time.DateTimeUtils$MillisProvider",
"org.joda.time.convert.Converter",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.convert.PartialConverter",
"org.joda.time.Seconds",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.JodaTimePermission",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.DateTimeFieldType",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.format.DateTimeFormatterBuilder$FixedNumber",
"org.joda.time.MutableDateTime$Property",
"org.joda.time.ReadableInterval",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.convert.AbstractConverter",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.PeriodType",
"org.joda.time.field.MillisDurationField",
"org.joda.time.chrono.GJChronology",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.MonthDay",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.MutablePeriod",
"org.joda.time.MutableDateTime",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.ReadableDateTime",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.format.PeriodParser",
"org.joda.time.DateMidnight",
"org.joda.time.convert.DurationConverter",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.Days",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.YearMonth$Property",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.tz.UTCProvider",
"org.joda.time.ReadableInstant",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.convert.NullConverter",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.tz.Provider",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.DurationFieldType",
"org.joda.time.ReadWritableInstant",
"org.joda.time.MutableInterval",
"org.joda.time.tz.NameProvider",
"org.joda.time.convert.ReadableInstantConverter",
"org.joda.time.convert.StringConverter",
"org.joda.time.convert.InstantConverter",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.DateTimeZone$1",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.Period",
"org.joda.time.Weeks",
"org.joda.time.Chronology",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.format.PeriodFormatterBuilder$PeriodFieldAffix",
"org.joda.time.LocalDate",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.MonthDay$Property",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.ReadablePartial",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.field.BaseDurationField"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("org.joda.time.format.DateTimeParser", false, GJChronology_ESTest_scaffolding.class.getClassLoader()));
mock(Class.forName("org.joda.time.format.DateTimePrinter", false, GJChronology_ESTest_scaffolding.class.getClassLoader()));
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(GJChronology_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.joda.time.Chronology",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.base.AbstractInstant",
"org.joda.time.Instant",
"org.joda.time.chrono.GJChronology",
"org.joda.time.DateTimeField",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.DurationField",
"org.joda.time.field.BaseDurationField",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.DateTimeZone",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.DateTimeUtils",
"org.joda.time.format.FormatUtils",
"org.joda.time.field.MillisDurationField",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.DurationFieldType",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.DateTimeFieldType",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.format.DateTimeFormatterBuilder$FixedNumber",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.format.ISODateTimeFormat$Constants",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.field.FieldUtils",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.base.BaseDateTime",
"org.joda.time.DateTime",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.MutableDateTime",
"org.joda.time.base.AbstractPartial",
"org.joda.time.Partial",
"org.joda.time.base.AbstractDuration",
"org.joda.time.base.BaseDuration",
"org.joda.time.Duration",
"org.joda.time.tz.UTCProvider",
"org.joda.time.base.BaseLocal",
"org.joda.time.LocalDateTime",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.chrono.BuddhistChronology",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.format.DateTimeParserBucket$SavedState",
"org.joda.time.base.BasePartial",
"org.joda.time.YearMonth",
"org.joda.time.LocalDate",
"org.joda.time.format.DateTimeFormat$1",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.MonthDay",
"org.joda.time.chrono.BasicFixedMonthChronology",
"org.joda.time.chrono.CopticChronology",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.DateTime$Property",
"org.joda.time.convert.ConverterManager",
"org.joda.time.convert.ConverterSet",
"org.joda.time.convert.AbstractConverter",
"org.joda.time.convert.ReadableInstantConverter",
"org.joda.time.convert.StringConverter",
"org.joda.time.convert.CalendarConverter",
"org.joda.time.convert.DateConverter",
"org.joda.time.convert.LongConverter",
"org.joda.time.convert.NullConverter",
"org.joda.time.convert.ReadablePartialConverter",
"org.joda.time.convert.ReadableDurationConverter",
"org.joda.time.convert.ReadableIntervalConverter",
"org.joda.time.convert.ReadablePeriodConverter",
"org.joda.time.convert.ConverterSet$Entry",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.base.BasePeriod$1",
"org.joda.time.base.BasePeriod",
"org.joda.time.PeriodType",
"org.joda.time.Period",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.Minutes",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.chrono.EthiopicChronology",
"org.joda.time.MutableDateTime$Property",
"org.joda.time.LocalTime",
"org.joda.time.chrono.IslamicChronology$LeapYearPatternType",
"org.joda.time.chrono.IslamicChronology",
"org.joda.time.Months",
"org.joda.time.Weeks",
"org.joda.time.field.AbstractPartialFieldProperty",
"org.joda.time.MonthDay$Property",
"org.joda.time.base.AbstractInterval",
"org.joda.time.base.BaseInterval",
"org.joda.time.Interval",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.MutablePeriod",
"org.joda.time.Days",
"org.joda.time.chrono.StrictChronology",
"org.joda.time.Years",
"org.joda.time.Seconds",
"org.joda.time.Hours",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.YearMonth$Property",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.MutableInterval",
"org.joda.time.format.DateTimeFormatterBuilder$TextField",
"org.joda.time.DateTimeZone$1",
"org.joda.time.LocalDate$Property",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.LocalTime$Property",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneName",
"org.joda.time.chrono.GJLocaleSymbols",
"org.joda.time.IllegalInstantException"
);
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
787bbd1b7b01f1c3a0f2084a6224c7e1df45cff6 | 91a5e7a1ce9587337486a1253a37e0c7f628318b | /src/main/java/com/star/easydoc/util/HttpUtil.java | 989d5e638cab115e1feaf7d98416939f68d1bb10 | [
"Apache-2.0"
] | permissive | wsmdbzd135531/easy_javadoc | 65ca6336a2576e74f85dcd6b4cf7bdd33cb1b217 | cbe8643d068795caaf55444dc1541443ac65d453 | refs/heads/master | 2023-07-13T09:10:17.700674 | 2021-08-11T16:26:41 | 2021-08-11T16:26:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,612 | java | package com.star.easydoc.util;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.stream.Collectors;
import com.intellij.openapi.diagnostic.Logger;
import org.apache.commons.codec.Charsets;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.HttpClientUtils;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
/**
* @author wangchao
* @date 2019/09/01
*/
public class HttpUtil {
private static final Logger LOGGER = Logger.getInstance(HttpUtil.class);
private static final int CONNECT_TIMEOUT = 300;
private static final int SOCKET_TIMEOUT = 1000;
private HttpUtil() {}
public static String get(String url) {
if (StringUtils.isBlank(url)) {
return null;
}
String result = null;
CloseableHttpClient httpclient = null;
CloseableHttpResponse response = null;
try {
httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(url);
httpGet.setConfig(RequestConfig.custom().setSocketTimeout(SOCKET_TIMEOUT).setConnectTimeout(CONNECT_TIMEOUT).build());
response = httpclient.execute(httpGet);
result = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
} catch (IOException e) {
LOGGER.warn("请求" + url + "异常", e);
} finally {
HttpClientUtils.closeQuietly(response);
HttpClientUtils.closeQuietly(httpclient);
}
return result;
}
public static String get(String url, Map<String, Object> params) {
if (StringUtils.isBlank(url)) {
return null;
}
String paramStr = params.entrySet().stream()
.map(e -> e.getKey() + "=" + encode(String.valueOf(e.getValue()))).collect(Collectors.joining("&"));
url = url.contains("?") ? url + "&" + paramStr : url + "?" + paramStr;
return get(url);
}
public static String encode(String word) {
try {
return URLEncoder.encode(word, Charsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
LOGGER.warn("url转义失败,word=" + word, e);
return StringUtils.EMPTY;
}
}
}
| [
"wangchao.star@gmail.com"
] | wangchao.star@gmail.com |
638bf11a05594524cd30366f06a1a9764ce9ed15 | e45666ade6364f0f69fb364613a018e7b165ccab | /SinglePageSpring/src/main/java/br/com/spring/DemoApplication.java | c33707f902650e147ab4c57a0a0f77ede28cab6c | [] | no_license | FelipeJS/Projeto-InvestProj | f03cbb120d0d32eba77f100c111a93f01280a723 | 7519fdc1b76acec456d7dca09fe4516e9b9a2463 | refs/heads/master | 2021-01-10T17:19:36.849660 | 2016-02-15T02:54:59 | 2016-02-15T02:54:59 | 51,726,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package br.com.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"tecnologiagrave@gmail.com"
] | tecnologiagrave@gmail.com |
245382f03aa393dfd52d03f28d4fd20650b9874f | 05e595078e56307728b7e1c63dcf6c1e8581e09b | /app/src/main/java/baryz/esti/MessageViewActivity.java | e160de32c44909a7f9f9e7aa06929d4836dfef61 | [] | no_license | baryz/estimote_notifications | 7b02fb63caa19465592c210d8c728b6ce69d8ea3 | b41c9ed40c61cd35c6fd1aab477c96ab1d9d119e | refs/heads/master | 2021-01-19T13:44:07.504872 | 2017-02-18T20:58:56 | 2017-02-18T20:58:56 | 82,414,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,908 | java | package baryz.esti;
import android.app.Activity;
import android.app.NotificationManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import com.estimote.sdk.Beacon;
import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.Region;
import database.Category;
import database.Sensor;
/**
* Created by user on 2015-02-14.
*/
public class MessageViewActivity extends Activity {
private TextView addedDateTextView;
private TextView titleTextView;
private TextView senosrTextView;
private TextView categoryNameTextView;
private TextView contentMessageTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.message_view);
addedDateTextView=(TextView) findViewById(R.id.addedDateTextView);
titleTextView=(TextView) findViewById(R.id.messageTitleTextView);
senosrTextView= (TextView) findViewById(R.id.sensorTextView);
categoryNameTextView=(TextView) findViewById(R.id.categoryNameTextView);
contentMessageTextView = (TextView) findViewById(R.id.contentMessageTextView);
Intent intent = getIntent();
String addedDate,title,contentMessage,sensor,category;
int idSensor,idCat;
if (intent != null){
addedDate = intent.getExtras().getString(ListBeaconsActivity.EXTRA_MESSAGE_ADDED_DATE);
title = intent.getExtras().getString(ListBeaconsActivity.EXTRA_MESSAGE_TITLE);
idSensor = intent.getExtras().getInt(ListBeaconsActivity.EXTRA_SENSOR_ID);
Sensor sen=new Sensor(getBaseContext(),idSensor);
sensor=sen.getTitle();
idCat = intent.getExtras().getInt(ListBeaconsActivity.EXTRA_CAT_ID);
Category cat= new Category(getBaseContext(),idCat,idSensor);
category= cat.getNameCat();
contentMessage = intent.getExtras().getString(ListBeaconsActivity.EXTRA_MESSAGE_TEXT);
}else {
addedDate=getString(R.string.noData);
title=getString(R.string.noData);
sensor = getString(R.string.noData);
category = getString(R.string.noData);
contentMessage= getString(R.string.noData);
}
addedDateTextView.setText(addedDate);
titleTextView.setText(title);
senosrTextView.setText(sensor);
categoryNameTextView.setText(category);
contentMessageTextView.setText(contentMessage);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
return super.onOptionsItemSelected(item);
}
}
| [
"milosz.s.michalik@almfactory.com"
] | milosz.s.michalik@almfactory.com |
2e643aa0729128bde477506cba05c21d5ec4c241 | 1c588d233fcbf08e998f83701c7d4505cae4617d | /src/com/leclercb/taskunifier/gui/components/modelnote/editors/WysiwygInsertHTMLTextAction.java | 5fd699860272252f826aaa23f10157c3fe895763 | [] | no_license | senthilksp/taskUnifier | ff8049e18e6b8a0ab7bbcbfe68d97dfa494c7b41 | 9bcbb182fc1e15851a0e111053cb4d7a80ccfeec | refs/heads/master | 2016-09-06T16:33:19.830310 | 2013-11-13T11:51:13 | 2013-11-13T11:51:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,773 | java | /*
* TaskUnifier
* Copyright (c) 2013, Benjamin Leclerc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of TaskUnifier or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.leclercb.taskunifier.gui.components.modelnote.editors;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.JEditorPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import com.leclercb.commons.api.utils.CheckUtils;
import com.leclercb.commons.gui.logger.GuiLogger;
import com.leclercb.taskunifier.gui.utils.ImageUtils;
public class WysiwygInsertHTMLTextAction extends AbstractAction {
protected JEditorPane editor;
protected String html;
protected HTML.Tag tag;
public WysiwygInsertHTMLTextAction(
JEditorPane editor,
String icon,
String description,
String html,
HTML.Tag tag) {
super(description);
CheckUtils.isNotNull(editor);
CheckUtils.isNotNull(icon);
this.editor = editor;
this.setHtml(html);
this.setTag(tag);
this.putValue(SMALL_ICON, ImageUtils.getResourceImage(icon, 16, 16));
this.putValue(SHORT_DESCRIPTION, description);
}
public String getHtml() {
return this.html;
}
public void setHtml(String html) {
CheckUtils.isNotNull(html);
this.html = html;
}
public HTML.Tag getTag() {
return this.tag;
}
public void setTag(HTML.Tag tag) {
CheckUtils.isNotNull(tag);
this.tag = tag;
}
@Override
public void actionPerformed(ActionEvent event) {
if (this.editor.isEditable()) {
HTMLDocument document = (HTMLDocument) this.editor.getDocument();
HTMLEditorKit editorKit = (HTMLEditorKit) this.editor.getEditorKit();
int offset = this.editor.getCaretPosition();
try {
document.insertString(offset, " ", null);
editorKit.insertHTML(
document,
offset,
this.html,
0,
0,
this.tag);
} catch (BadLocationException e) {
GuiLogger.getLogger().log(
Level.WARNING,
"Wysiwyg action error",
e);
} catch (IOException e) {
GuiLogger.getLogger().log(
Level.WARNING,
"Wysiwyg action error",
e);
}
this.editor.requestFocus();
}
}
}
| [
"senthilkumar.sp@madronesoft.com"
] | senthilkumar.sp@madronesoft.com |
f849dcd75bd2758d335abb80eb164abe6959aa59 | 9a0895cb3f7765d669f75f27783d9d5ee73c1e35 | /app/src/main/java/com/lijiankun24/architecturepractice/ui/activity/GirlActivity.java | 87dc792d942489f8902d64c234e33bcbc445f81d | [] | no_license | chenchen211/ArchitecturePractice | 6d92cf1e5b41d107318f5a3803b4a352374fbeea | 816dd95edd6c13ef62e44234642c6ec0535e7607 | refs/heads/master | 2021-03-27T16:01:06.054274 | 2017-08-10T13:02:13 | 2017-08-10T13:02:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,231 | java | package com.lijiankun24.architecturepractice.ui.activity;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lijiankun24.architecturepractice.R;
import com.lijiankun24.architecturepractice.utils.Consts;
import com.lijiankun24.architecturepractice.utils.Util;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Date;
import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;
public class GirlActivity extends BaseActivity {
private static final String GIRL_IMG_URL = "girl_img_url";
private PhotoViewAttacher mPhotoViewAttacher;
private Boolean mIsToolbarHidden = false;
private String mGirlImgUrl = null;
private Toolbar mToolbar = null;
private View mRLGirlRoot = null;
private View mStatusBar = null;
public static void startGirlActivity(Activity activity, String girlUrl) {
if (activity == null || TextUtils.isEmpty(girlUrl)) {
return;
}
Intent intent = new Intent(activity, GirlActivity.class);
intent.putExtra(GIRL_IMG_URL, girlUrl);
activity.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_girl);
readIntent();
initView();
}
private void readIntent() {
Intent intent = GirlActivity.this.getIntent();
if (intent.hasExtra(GIRL_IMG_URL)) {
mGirlImgUrl = intent.getStringExtra(GIRL_IMG_URL);
}
}
private void initView() {
PhotoView photoView = findViewById(R.id.photoView);
mPhotoViewAttacher = new PhotoViewAttacher(photoView);
mPhotoViewAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
toggleToolbar();
}
});
mPhotoViewAttacher.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
showSaveGirlDialog();
return true;
}
});
Glide.with(this)
.load(mGirlImgUrl)
.fitCenter()
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(photoView);
mToolbar = findViewById(R.id.toolbar);
initToolbar(mToolbar, true, R.string.girl_title);
mRLGirlRoot = findViewById(R.id.rl_girl_root);
mStatusBar = findViewById(R.id.fake_status_bar);
}
private void showSaveGirlDialog() {
new AlertDialog.Builder(GirlActivity.this)
.setMessage(getString(R.string.girl_save))
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface anInterface, int i) {
anInterface.dismiss();
}
})
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface anInterface, int i) {
anInterface.dismiss();
saveGirl();
}
}).show();
}
private void saveGirl() {
File directory = new File(Environment.getExternalStorageDirectory(), Consts.FILEROOTPATH);
if (!directory.exists())
directory.mkdirs();
Bitmap drawingCache = mPhotoViewAttacher.getImageView().getDrawingCache();
try {
File file = new File(directory, new Date().getTime() + Consts.IMAGE_FORMAT);
FileOutputStream fos = new FileOutputStream(file);
drawingCache.compress(Bitmap.CompressFormat.JPEG, 100, fos);
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri uri = Uri.fromFile(file);
intent.setData(uri);
GirlActivity.this.getApplicationContext().sendBroadcast(intent);
Util.showSnackbar(mRLGirlRoot, getString(R.string.girl_save_succeed));
} catch (FileNotFoundException e) {
e.printStackTrace();
Util.showSnackbar(mRLGirlRoot, getString(R.string.girl_save_failed));
}
}
private void toggleToolbar() {
mToolbar.animate()
.translationY(mIsToolbarHidden ? 0 : -(mToolbar.getHeight() + mStatusBar.getHeight()))
.setInterpolator(new DecelerateInterpolator(2))
.start();
mIsToolbarHidden = !mIsToolbarHidden;
}
}
| [
"lijk@rd.netease.com"
] | lijk@rd.netease.com |
45f80fdaccffaf313554580d48d368994a88fe54 | 5e921906ad311a0b8cb25c59f0f303e1b49e2bfa | /client/Class9.java | 6e426f47162ba550c011a4b2848e19f4e064aa2b | [] | no_license | Phynvi/rsps-2 | 37585a4519d125a241cfc12300ad5f6c142bf474 | 4fdc522f37a7216415156f3e3a62c61f28032439 | refs/heads/master | 2020-12-06T04:26:35.302313 | 2018-11-01T19:24:30 | 2018-11-01T19:24:30 | 232,341,143 | 1 | 0 | null | 2020-01-07T14:24:06 | 2020-01-07T14:24:05 | null | UTF-8 | Java | false | false | 17,990 | java | public class Class9
{
public Class30_Sub2_Sub1_Sub1 aClass30_Sub2_Sub1_Sub1_207;
public int anInt208;
public Class30_Sub2_Sub1_Sub1 aClass30_Sub2_Sub1_Sub1Array209[];
public static Class9 aClass9Array210[];
public int anInt211;
public int anIntArray212[];
private int anInt213;
public int anInt214;
public int anIntArray215[];
public int anInt216;
public int anInt217;
public String aString218;
public int anInt219;
public int anInt220;
public String aString221;
public String aString222;
public boolean aBoolean223;
public int anInt224;
public String aStringArray225[];
public int anIntArrayArray226[][];
public boolean aBoolean227;
public String aString228;
private int anInt229;
public int anInt230;
public int anInt231;
public int anInt232;
public int anInt233;
public int anInt234;
public boolean aBoolean235;
public int anInt236;
public int anInt237;
private static Class12 aClass12_238;
public int anInt239;
public int anIntArray240[];
public int anIntArray241[];
public boolean aBoolean242;
public Class30_Sub2_Sub1_Sub4 aClass30_Sub2_Sub1_Sub4_243;
public int anInt244;
public int anIntArray245[];
public int anInt246;
public int anIntArray247[];
public String aString248;
public boolean aBoolean249;
public int anInt250;
public boolean aBoolean251;
public int anIntArray252[];
public int anIntArray253[];
public byte aByte254;
public int anInt255;
public int anInt256;
public int anInt257;
public int anInt258;
public boolean aBoolean259;
public Class30_Sub2_Sub1_Sub1 aClass30_Sub2_Sub1_Sub1_260;
public int anInt261;
public int anInt262;
public int anInt263;
static Class12 aClass12_264 = new Class12(false, 30);
public int anInt265;
public boolean aBoolean266;
public int anInt267;
public boolean aBoolean268;
public int anInt269;
public int anInt270;
public int anInt271;
public int anIntArray272[];
public void method204(int i, byte byte0, int j)
{
int k = anIntArray253[i];
anIntArray253[i] = anIntArray253[j];
if(byte0 == 9)
{
byte0 = 0;
} else
{
anInt229 = -76;
}
anIntArray253[j] = k;
k = anIntArray252[i];
anIntArray252[i] = anIntArray252[j];
anIntArray252[j] = k;
}
public static void method205(Class44 class44, Class30_Sub2_Sub1_Sub4 aclass30_sub2_sub1_sub4[], byte byte0, Class44 class44_1)
{
aClass12_238 = new Class12(false, 50000);
Class30_Sub2_Sub2 class30_sub2_sub2 = new Class30_Sub2_Sub2(class44.method571("data", null), 891);
int i = -1;
int j = class30_sub2_sub2.method410();
aClass9Array210 = new Class9[j];
do
{
if(class30_sub2_sub2.anInt1406 >= class30_sub2_sub2.aByteArray1405.length)
{
break;
}
int k = class30_sub2_sub2.method410();
if(k == 65535)
{
i = class30_sub2_sub2.method410();
k = class30_sub2_sub2.method410();
}
Class9 class9 = aClass9Array210[k] = new Class9();
class9.anInt250 = k;
class9.anInt236 = i;
class9.anInt262 = class30_sub2_sub2.method408();
class9.anInt217 = class30_sub2_sub2.method408();
class9.anInt214 = class30_sub2_sub2.method410();
class9.anInt220 = class30_sub2_sub2.method410();
class9.anInt267 = class30_sub2_sub2.method410();
class9.aByte254 = (byte)class30_sub2_sub2.method408();
class9.anInt230 = class30_sub2_sub2.method408();
if(class9.anInt230 != 0)
{
class9.anInt230 = (class9.anInt230 - 1 << 8) + class30_sub2_sub2.method408();
} else
{
class9.anInt230 = -1;
}
int l = class30_sub2_sub2.method408();
if(l > 0)
{
class9.anIntArray245 = new int[l];
class9.anIntArray212 = new int[l];
for(int i1 = 0; i1 < l; i1++)
{
class9.anIntArray245[i1] = class30_sub2_sub2.method408();
class9.anIntArray212[i1] = class30_sub2_sub2.method410();
}
}
int j1 = class30_sub2_sub2.method408();
if(j1 > 0)
{
class9.anIntArrayArray226 = new int[j1][];
for(int k1 = 0; k1 < j1; k1++)
{
int j3 = class30_sub2_sub2.method410();
class9.anIntArrayArray226[k1] = new int[j3];
for(int l4 = 0; l4 < j3; l4++)
{
class9.anIntArrayArray226[k1][l4] = class30_sub2_sub2.method410();
}
}
}
if(class9.anInt262 == 0)
{
class9.anInt261 = class30_sub2_sub2.method410();
class9.aBoolean266 = class30_sub2_sub2.method408() == 1;
int l1 = class30_sub2_sub2.method410();
class9.anIntArray240 = new int[l1];
class9.anIntArray241 = new int[l1];
class9.anIntArray272 = new int[l1];
for(int k3 = 0; k3 < l1; k3++)
{
class9.anIntArray240[k3] = class30_sub2_sub2.method410();
class9.anIntArray241[k3] = class30_sub2_sub2.method411();
class9.anIntArray272[k3] = class30_sub2_sub2.method411();
}
}
if(class9.anInt262 == 1)
{
class9.anInt211 = class30_sub2_sub2.method410();
class9.aBoolean251 = class30_sub2_sub2.method408() == 1;
}
if(class9.anInt262 == 2)
{
class9.anIntArray253 = new int[class9.anInt220 * class9.anInt267];
class9.anIntArray252 = new int[class9.anInt220 * class9.anInt267];
class9.aBoolean259 = class30_sub2_sub2.method408() == 1;
class9.aBoolean249 = class30_sub2_sub2.method408() == 1;
class9.aBoolean242 = class30_sub2_sub2.method408() == 1;
class9.aBoolean235 = class30_sub2_sub2.method408() == 1;
class9.anInt231 = class30_sub2_sub2.method408();
class9.anInt244 = class30_sub2_sub2.method408();
class9.anIntArray215 = new int[20];
class9.anIntArray247 = new int[20];
class9.aClass30_Sub2_Sub1_Sub1Array209 = new Class30_Sub2_Sub1_Sub1[20];
for(int i2 = 0; i2 < 20; i2++)
{
int l3 = class30_sub2_sub2.method408();
if(l3 != 1)
{
continue;
}
class9.anIntArray215[i2] = class30_sub2_sub2.method411();
class9.anIntArray247[i2] = class30_sub2_sub2.method411();
String s1 = class30_sub2_sub2.method415();
if(class44_1 != null && s1.length() > 0)
{
int i5 = s1.lastIndexOf(",");
class9.aClass30_Sub2_Sub1_Sub1Array209[i2] = method207(Integer.parseInt(s1.substring(i5 + 1)), false, class44_1, s1.substring(0, i5));
}
}
class9.aStringArray225 = new String[5];
for(int j2 = 0; j2 < 5; j2++)
{
class9.aStringArray225[j2] = class30_sub2_sub2.method415();
if(class9.aStringArray225[j2].length() == 0)
{
class9.aStringArray225[j2] = null;
}
}
}
if(class9.anInt262 == 3)
{
class9.aBoolean227 = class30_sub2_sub2.method408() == 1;
}
if(class9.anInt262 == 4 || class9.anInt262 == 1)
{
class9.aBoolean223 = class30_sub2_sub2.method408() == 1;
int k2 = class30_sub2_sub2.method408();
if(aclass30_sub2_sub1_sub4 != null)
{
class9.aClass30_Sub2_Sub1_Sub4_243 = aclass30_sub2_sub1_sub4[k2];
}
class9.aBoolean268 = class30_sub2_sub2.method408() == 1;
}
if(class9.anInt262 == 4)
{
class9.aString248 = class30_sub2_sub2.method415();
class9.aString228 = class30_sub2_sub2.method415();
}
if(class9.anInt262 == 1 || class9.anInt262 == 3 || class9.anInt262 == 4)
{
class9.anInt232 = class30_sub2_sub2.method413();
}
if(class9.anInt262 == 3 || class9.anInt262 == 4)
{
class9.anInt219 = class30_sub2_sub2.method413();
class9.anInt216 = class30_sub2_sub2.method413();
class9.anInt239 = class30_sub2_sub2.method413();
}
if(class9.anInt262 == 5)
{
String s = class30_sub2_sub2.method415();
if(class44_1 != null && s.length() > 0)
{
int i4 = s.lastIndexOf(",");
class9.aClass30_Sub2_Sub1_Sub1_207 = method207(Integer.parseInt(s.substring(i4 + 1)), false, class44_1, s.substring(0, i4));
}
s = class30_sub2_sub2.method415();
if(class44_1 != null && s.length() > 0)
{
int j4 = s.lastIndexOf(",");
class9.aClass30_Sub2_Sub1_Sub1_260 = method207(Integer.parseInt(s.substring(j4 + 1)), false, class44_1, s.substring(0, j4));
}
}
if(class9.anInt262 == 6)
{
int l2 = class30_sub2_sub2.method408();
if(l2 != 0)
{
class9.anInt233 = 1;
class9.anInt234 = (l2 - 1 << 8) + class30_sub2_sub2.method408();
}
l2 = class30_sub2_sub2.method408();
if(l2 != 0)
{
class9.anInt255 = 1;
class9.anInt256 = (l2 - 1 << 8) + class30_sub2_sub2.method408();
}
l2 = class30_sub2_sub2.method408();
if(l2 != 0)
{
class9.anInt257 = (l2 - 1 << 8) + class30_sub2_sub2.method408();
} else
{
class9.anInt257 = -1;
}
l2 = class30_sub2_sub2.method408();
if(l2 != 0)
{
class9.anInt258 = (l2 - 1 << 8) + class30_sub2_sub2.method408();
} else
{
class9.anInt258 = -1;
}
class9.anInt269 = class30_sub2_sub2.method410();
class9.anInt270 = class30_sub2_sub2.method410();
class9.anInt271 = class30_sub2_sub2.method410();
}
if(class9.anInt262 == 7)
{
class9.anIntArray253 = new int[class9.anInt220 * class9.anInt267];
class9.anIntArray252 = new int[class9.anInt220 * class9.anInt267];
class9.aBoolean223 = class30_sub2_sub2.method408() == 1;
int i3 = class30_sub2_sub2.method408();
if(aclass30_sub2_sub1_sub4 != null)
{
class9.aClass30_Sub2_Sub1_Sub4_243 = aclass30_sub2_sub1_sub4[i3];
}
class9.aBoolean268 = class30_sub2_sub2.method408() == 1;
class9.anInt232 = class30_sub2_sub2.method413();
class9.anInt231 = class30_sub2_sub2.method411();
class9.anInt244 = class30_sub2_sub2.method411();
class9.aBoolean249 = class30_sub2_sub2.method408() == 1;
class9.aStringArray225 = new String[5];
for(int k4 = 0; k4 < 5; k4++)
{
class9.aStringArray225[k4] = class30_sub2_sub2.method415();
if(class9.aStringArray225[k4].length() == 0)
{
class9.aStringArray225[k4] = null;
}
}
}
if(class9.anInt217 == 2 || class9.anInt262 == 2)
{
class9.aString222 = class30_sub2_sub2.method415();
class9.aString218 = class30_sub2_sub2.method415();
class9.anInt237 = class30_sub2_sub2.method410();
}
if(class9.anInt262 == 8) { // Loads new .dat files
class9.aString248 = class30_sub2_sub2.method415();
}
if(class9.anInt217 == 1 || class9.anInt217 == 4 || class9.anInt217 == 5 || class9.anInt217 == 6)
{
class9.aString221 = class30_sub2_sub2.method415();
if(class9.aString221.length() == 0)
{
if(class9.anInt217 == 1)
{
class9.aString221 = "Ok";
}
if(class9.anInt217 == 4)
{
class9.aString221 = "Select";
}
if(class9.anInt217 == 5)
{
class9.aString221 = "Select";
}
if(class9.anInt217 == 6)
{
class9.aString221 = "Continue";
}
}
}
} while(true);
aClass12_238 = null;
if(byte0 != -84);
}
private Class30_Sub2_Sub4_Sub6 method206(int i, int j)
{
Class30_Sub2_Sub4_Sub6 class30_sub2_sub4_sub6 = (Class30_Sub2_Sub4_Sub6)aClass12_264.method222((i << 16) + j);
if(class30_sub2_sub4_sub6 != null)
{
return class30_sub2_sub4_sub6;
}
if(i == 1)
{
class30_sub2_sub4_sub6 = Class30_Sub2_Sub4_Sub6.method462(anInt213, j);
}
if(i == 2)
{
class30_sub2_sub4_sub6 = Class5.method159(j).method160(true);
}
if(i == 3)
{
class30_sub2_sub4_sub6 = client.aClass30_Sub2_Sub4_Sub1_Sub2_1126.method453((byte)-41);
}
if(i == 4)
{
class30_sub2_sub4_sub6 = Class8.method198(j).method202(50, true);
}
if(i == 5)
{
class30_sub2_sub4_sub6 = null;
}
if(class30_sub2_sub4_sub6 != null)
{
aClass12_264.method223(class30_sub2_sub4_sub6, (i << 16) + j, (byte)2);
}
return class30_sub2_sub4_sub6;
}
private static Class30_Sub2_Sub1_Sub1 method207(int i, boolean flag, Class44 class44, String s)
{
long l = (Class50.method585((byte)1, s) << 8) + (long)i;
if(flag)
{
throw new NullPointerException();
}
Class30_Sub2_Sub1_Sub1 class30_sub2_sub1_sub1 = (Class30_Sub2_Sub1_Sub1)aClass12_238.method222(l);
if(class30_sub2_sub1_sub1 != null)
{
return class30_sub2_sub1_sub1;
}
try
{
class30_sub2_sub1_sub1 = new Class30_Sub2_Sub1_Sub1(class44, s, i);
aClass12_238.method223(class30_sub2_sub1_sub1, l, (byte)2);
}
catch(Exception exception)
{
return null;
}
return class30_sub2_sub1_sub1;
}
public static void method208(int i, boolean flag, int j, Class30_Sub2_Sub4_Sub6 class30_sub2_sub4_sub6)
{
if(flag)
{
return;
}
aClass12_264.method224();
if(class30_sub2_sub4_sub6 != null && j != 4)
{
aClass12_264.method223(class30_sub2_sub4_sub6, (j << 16) + i, (byte)2);
}
}
public Class30_Sub2_Sub4_Sub6 method209(int i, int j, int k, boolean flag)
{
Class30_Sub2_Sub4_Sub6 class30_sub2_sub4_sub6;
if(flag)
{
class30_sub2_sub4_sub6 = method206(anInt255, anInt256);
} else
{
class30_sub2_sub4_sub6 = method206(anInt233, anInt234);
}
if(class30_sub2_sub4_sub6 == null)
{
return null;
}
if(k == -1 && j == -1 && class30_sub2_sub4_sub6.anIntArray1640 == null)
{
return class30_sub2_sub4_sub6;
}
Class30_Sub2_Sub4_Sub6 class30_sub2_sub4_sub6_1 = new Class30_Sub2_Sub4_Sub6(9, true, Class36.method532(k, false) & Class36.method532(j, false), false, class30_sub2_sub4_sub6);
if(k != -1 || j != -1)
{
class30_sub2_sub4_sub6_1.method469((byte)-71);
}
if(k != -1)
{
class30_sub2_sub4_sub6_1.method470(k, 40542);
}
if(j != -1)
{
class30_sub2_sub4_sub6_1.method470(j, 40542);
}
class30_sub2_sub4_sub6_1.method479(64, 768, -50, -10, -50, true);
if(i != 0)
{
throw new NullPointerException();
} else
{
return class30_sub2_sub4_sub6_1;
}
}
public Class9()
{
anInt213 = 9;
anInt229 = 891;
}
}
| [
"akiraff@hotmail.com"
] | akiraff@hotmail.com |
a565c8e3272fcba7c4e3db4951a876496a147d99 | 2a246b04554d518d5103edc2dfe77eaf392e5dd5 | /rmtcmp3/android/app/src/main/java/com/example/rmtcmp3/MainActivity.java | 451df3181a935eebfbf455dfcbd1cf11d9c8f34c | [] | no_license | neilhighley/flSoundBoard | da4c53efb488542b393e1beda99e30eede627251 | 305cbb1f0f96577d809d690069312565fd6083d0 | refs/heads/master | 2020-06-10T20:50:18.729959 | 2019-06-25T16:50:12 | 2019-06-25T16:50:12 | 193,742,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.example.rmtcmp3;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
| [
"neil@neilhighley.com"
] | neil@neilhighley.com |
b882745f4e7d4bac47b0598f23ae7f7a8cb646e6 | fb9dc130b282b7dafc8b249e002ea1ff26292060 | /app/src/main/java/com/example/miwok/PhraseFragment.java | 0a7a6ed9f6df8bd1d8c45e447c2ca158fefaeef4 | [] | no_license | Omayr98a/Miwok-App-with-Fragments- | 566dfebbcd3b6fd0ad23f6c05fcd1ee60830b497 | 9c7963821a65a95cf5d268574c5825766e71ff70 | refs/heads/master | 2023-07-24T05:14:12.654616 | 2021-08-31T17:16:29 | 2021-08-31T17:16:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,621 | java | package com.example.miwok;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
* create an instance of this fragment.
*/
public class PhraseFragment extends Fragment {
private MediaPlayer mMediaPlayer;
private AudioManager mAudioManager;
private AudioManager.OnAudioFocusChangeListener mOnAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT ||
focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
// The AUDIOFOCUS_LOSS_TRANSIENT case means that we've lost audio focus for a
// short amount of time. The AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK case means that
// our app is allowed to continue playing sound but at a lower volume. We'll treat
// both cases the same way because our app is playing short sound files.
// Pause playback and reset player to the start of the file. That way, we can
// play the word from the beginning when we resume playback.
mMediaPlayer.pause();
mMediaPlayer.seekTo(0);
} else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
// The AUDIOFOCUS_GAIN case means we have regained focus and can resume playback.
mMediaPlayer.start();
} else if (focusChange == AudioManager.AUDIOFOCUS_LOSS) {
// The AUDIOFOCUS_LOSS case means we've lost audio focus and
// Stop playback and clean up resources
releaseMediaPlayer();
}
}
};
private MediaPlayer.OnCompletionListener mCompletionListener = new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
// Now that the sound file has finished playing, release the media player resources.
releaseMediaPlayer();
}
};
public PhraseFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.word_list, container, false);
mAudioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
final ArrayList<Word> words = new ArrayList<Word>();
Word w = new Word("Where are you going?", "minto wuksus", R.raw.phrase_where_are_you_going);
words.add(w);
words.add(new Word("What is your name?", "tinnә oyaase'nә", R.raw.phrase_what_is_your_name));
words.add(new Word("My name is...", "oyaaset...", R.raw.phrase_my_name_is));
words.add(new Word("How are you feeling?", "michәksәs?", R.raw.phrase_how_are_you_feeling));
words.add(new Word("I’m feeling good.", "kuchi achit", R.raw.phrase_im_feeling_good));
words.add(new Word("Are you coming?", "әәnәs'aa?", R.raw.phrase_are_you_coming));
words.add(new Word("Yes, I’m coming.", "hәә’ әәnәm", R.raw.phrase_yes_im_coming));
words.add(new Word("I’m coming.", "әәnәm", R.raw.phrase_im_coming));
// Create an {@link ArrayAdapter}, whose data source is a list of Strings. The
// adapter knows how to create layouts for each item in the list, using the
// simple_list_item_1.xml layout resource defined in the Android framework.
// This list item layout contains a single {@link TextView}, which the adapter will set to
// display a single word.
WordAdapter Adapter =
new WordAdapter(getActivity(), words, R.color.teal_200);
// Find the {@link ListView} object in the view hierarchy of the {@link Activity}.
// There should be a {@link ListView} with the view ID called list, which is declared in the
// activity_numbers.xml layout file.
ListView listView = (ListView) rootView.findViewById(R.id.list);
// Make the {@link ListView} use the {@link ArrayAdapter} we created above, so that the
// {@link ListView} will display list items for each word in the list of words.
// Do this by calling the setAdapter method on the {@link ListView} object and pass in
// 1 argument, which is the {@link ArrayAdapter} with the variable name itemsAdapter.
listView.setAdapter(Adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Word word = words.get(position);
releaseMediaPlayer();
int result = mAudioManager.requestAudioFocus(mOnAudioFocusChangeListener,
AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
mMediaPlayer = MediaPlayer.create(getActivity(), word.mAudioResourceID);
mMediaPlayer.start(); // no need to call prepare(); create() does that for you
mMediaPlayer.setOnCompletionListener(mCompletionListener);
}
}
});
return rootView;
}
private void releaseMediaPlayer() {
// If the media player is not null, then it may be currently playing a sound.
if (mMediaPlayer != null) {
// Regardless of the current state of the media player, release its resources
// because we no longer need it.
mMediaPlayer.release();
// Set the media player back to null. For our code, we've decided that
// setting the media player to null is an easy way to tell that the media player
// is not configured to play an audio file at the moment.
mMediaPlayer = null;
mAudioManager.abandonAudioFocus(mOnAudioFocusChangeListener);
}
}
@Override
public void onStop() {
super.onStop();
releaseMediaPlayer();
}
} | [
"umair98a@gmail.com"
] | umair98a@gmail.com |
28e25799af3280656d9b79a0919dca8bb96d2bdc | ffa7cfa17e2f489159b416a8df66cdaef651be13 | /src/main/java/org/dmitrynikol/javapatterns/proxy/Image.java | 3f4037e2db50b29fe4571405f0059760824e645c | [] | no_license | dmitrynikol/java-design-patterns | 6b03429bf79fd9035386a13fc8c7017bbdded511 | ee4a0a7b54884ee3cd34551413bc784792d7fc13 | refs/heads/master | 2021-01-22T07:17:57.254240 | 2013-10-02T01:47:30 | 2013-10-02T01:47:30 | 10,891,461 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package main.java.org.dmitrynikol.javapatterns.proxy;
public class Image implements Renderer {
private byte[] data;
public Image(String filename) {
data = loadImage(filename);
}
@Override
public void render() {
System.out.println("*(-_-)*");
}
private byte[] loadImage(String filename) {
return null;
}
}
| [
"dnikolaenko9@gmail.com"
] | dnikolaenko9@gmail.com |
19de80674fd57f892d92cabb0ee8a04eb8196c65 | 5e93b326318fa8ae69273b3d17dbe96727c01ef1 | /jmh/src/main/java/com/github/tommyettinger/ds/ObjectMapFib2.java | 96850f146864b8f183447769e15f994710a7f385 | [
"Apache-2.0"
] | permissive | tommyettinger/assorted-benchmarks | 97dd5c7c26d478814361d64f41599ce6da90a3b0 | 67ca2055b5c2641352ddd47fa4c233cf1d9fac78 | refs/heads/master | 2023-08-22T12:59:23.543671 | 2023-08-20T06:11:40 | 2023-08-20T06:11:40 | 203,266,694 | 9 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,739 | java | /*******************************************************************************
* Copyright 2020 See AUTHORS file.
*
* 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.github.tommyettinger.ds;
import javax.annotation.Nullable;
import java.io.Serializable;
import java.util.*;
import static com.github.tommyettinger.ds.Utilities.neverIdentical;
import static com.github.tommyettinger.ds.Utilities.tableSize;
/**
* An unordered map where the keys and values are objects. Null keys are not allowed. No allocation is done except when growing
* the table size.
* <p>
* This class performs fast contains and remove (typically O(1), worst case O(n) but that is rare in practice). Add may be
* slightly slower, depending on hash collisions. Hashcodes are rehashed to reduce collisions and the need to resize. Load factors
* greater than 0.91 greatly increase the chances to resize to the next higher POT size.
* <p>
* Unordered sets and maps are not designed to provide especially fast iteration. Iteration is faster with OrderedSet and
* OrderedMap.
* <p>
* This implementation uses linear probing with the backward shift algorithm for removal. Hashcodes are rehashed using Fibonacci
* hashing, instead of the more common power-of-two mask, to better distribute poor hashCodes (see <a href=
* "https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/">Malte
* Skarupke's blog post</a>). Linear probing continues to work even when all hashCodes collide, just more slowly.
*
* @author Nathan Sweet
* @author Tommy Ettinger
*/
public class ObjectMapFib2<K, V> implements Map<K, V>, Iterable<Map.Entry<K, V>>, Serializable {
private static final long serialVersionUID = 0L;
public int size;
protected K[] keyTable;
protected V[] valueTable;
protected float loadFactor;
protected int threshold;
protected int shift;
/**
* A bitmask used to confine hashcodes to the size of the table. Must be all 1 bits in its low positions, ie a power of two
* minus 1.
*/
protected int mask;
protected @Nullable Entries<K, V> entries1;
protected @Nullable Entries<K, V> entries2;
protected @Nullable Values<V> values1;
protected @Nullable Values<V> values2;
protected @Nullable Keys<K> keys1;
protected @Nullable Keys<K> keys2;
/**
* Creates a new map with an initial capacity of 51 and a load factor of 0.8.
*/
public ObjectMapFib2() {
this(51, 0.8f);
}
/**
* Creates a new map with a load factor of 0.8.
*
* @param initialCapacity If not a power of two, it is increased to the next nearest power of two.
*/
public ObjectMapFib2(int initialCapacity) {
this(initialCapacity, 0.8f);
}
/**
* Creates a new map with the specified initial capacity and load factor. This map will hold initialCapacity items before
* growing the backing table.
*
* @param initialCapacity If not a power of two, it is increased to the next nearest power of two.
*/
public ObjectMapFib2(int initialCapacity, float loadFactor) {
if (loadFactor <= 0f || loadFactor > 1f)
throw new IllegalArgumentException("loadFactor must be > 0 and <= 1: " + loadFactor);
this.loadFactor = loadFactor;
int tableSize = tableSize(initialCapacity, loadFactor);
threshold = (int)(tableSize * loadFactor);
mask = tableSize - 1;
shift = Integer.numberOfLeadingZeros(mask);
keyTable = (K[])new Object[tableSize];
valueTable = (V[])new Object[tableSize];
}
/**
* Creates a new map identical to the specified map.
*/
public ObjectMapFib2(ObjectMapFib2<? extends K, ? extends V> map) {
this.loadFactor = map.loadFactor;
this.threshold = map.threshold;
this.mask = map.mask;
this.shift = map.shift;
keyTable = Arrays.copyOf(map.keyTable, map.keyTable.length);
valueTable = Arrays.copyOf(map.valueTable, map.valueTable.length);
size = map.size;
}
/**
* Creates a new map identical to the specified map.
*/
public ObjectMapFib2(Map<? extends K, ? extends V> map) {
this(map.size());
for (Map.Entry<? extends K, ? extends V> kv : map.entrySet()) {
put(kv.getKey(), kv.getValue());
}
}
/**
* Returns an index >= 0 and <= {@link #mask} for the specified {@code item}.
*
* @param item a non-null Object; its hashCode() method should be used by most implementations.
*/
protected int place (Object item) {
return (int)(item.hashCode() * 0x9E3779B5L) >>> shift;
}
/**
* Returns the index of the key if already present, else {@code ~index} for the next empty index. This can be overridden
* to compare for equality differently than {@link Object#equals(Object)}.
*
* @param key a non-null Object that should probably be a K
*/
protected int locateKey (Object key) {
K[] keyTable = this.keyTable;
for (int i = place(key); ; i = i + 1 & mask) {
K other = keyTable[i];
if (other == null)
return ~i; // Empty space is available.
if (other.equals(key))
return i; // Same key was found.
}
}
/**
* Returns the old value associated with the specified key, or null.
*/
@Override
public @Nullable V put (K key, @Nullable V value) {
int i = locateKey(key);
if (i >= 0) { // Existing key was found.
V oldValue = valueTable[i];
valueTable[i] = value;
return oldValue;
}
i = ~i; // Empty space was found.
keyTable[i] = key;
valueTable[i] = value;
if (++size >= threshold)
resize(keyTable.length << 1);
return null;
}
public void putAll (ObjectMapFib2<? extends K, ? extends V> map) {
ensureCapacity(map.size);
K[] keyTable = map.keyTable;
V[] valueTable = map.valueTable;
K key;
for (int i = 0, n = keyTable.length; i < n; i++) {
key = keyTable[i];
if (key != null)
put(key, valueTable[i]);
}
}
/**
* Skips checks for existing keys, doesn't increment size.
*/
private void putResize (K key, @Nullable V value) {
K[] keyTable = this.keyTable;
for (int i = place(key); ; i = (i + 1) & mask) {
if (keyTable[i] == null) {
keyTable[i] = key;
valueTable[i] = value;
return;
}
}
}
/**
* Returns the value for the specified key, or null if the key is not in the map.
* Note that null is also a valid value that can be assigned to a legitimate key, so
* checking that the result of this method is null does not guarantee that the
* {@code key} is not present.
*
* @param key a non-null Object that should almost always be a {@code K} (or an instance of a subclass of {@code K})
*/
@Override
public @Nullable V get (Object key) {
int i = locateKey(key);
return i < 0 ? null : valueTable[i];
}
/**
* Returns the value for the specified key, or the default value if the key is not in the map.
*/
public @Nullable V get (Object key, @Nullable V defaultValue) {
int i = locateKey(key);
return i < 0 ? defaultValue : valueTable[i];
}
@Override
public @Nullable V remove (Object key) {
int i = locateKey(key);
if (i < 0)
return null;
K[] keyTable = this.keyTable;
V[] valueTable = this.valueTable;
V oldValue = valueTable[i];
int mask = this.mask, next = i + 1 & mask;
while ((key = keyTable[next]) != null) {
int placement = place(key);
if ((next - placement & mask) > (i - placement & mask)) {
keyTable[i] = (K)key;
valueTable[i] = valueTable[next];
i = next;
}
next = next + 1 & mask;
}
keyTable[i] = null;
valueTable[i] = null;
size--;
return oldValue;
}
/**
* Copies all of the mappings from the specified map to this map
* (optional operation). The effect of this call is equivalent to that
* of calling {@link #put(Object, Object) put(k, v)} on this map once
* for each mapping from key <tt>k</tt> to value <tt>v</tt> in the
* specified map. The behavior of this operation is undefined if the
* specified map is modified while the operation is in progress.
*
* @param m mappings to be stored in this map
* @throws UnsupportedOperationException if the <tt>putAll</tt> operation
* is not supported by this map
* @throws ClassCastException if the class of a key or value in the
* specified map prevents it from being stored in this map
* @throws NullPointerException if the specified map is null, or if
* this map does not permit null keys or values, and the
* specified map contains null keys or values
* @throws IllegalArgumentException if some property of a key or value in
* the specified map prevents it from being stored in this map
*/
@Override
public void putAll (Map<? extends K, ? extends V> m) {
ensureCapacity(m.size());
// for (K k : m.keySet()) {
// put(k, m.get(k));
// }
for (Map.Entry<? extends K, ? extends V> kv : m.entrySet()) {
put(kv.getKey(), kv.getValue());
}
}
/**
* Returns true if the map has one or more items.
*/
public boolean notEmpty () {
return size > 0;
}
/**
* Returns the number of key-value mappings in this map. If the
* map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
* <tt>Integer.MAX_VALUE</tt>.
*
* @return the number of key-value mappings in this map
*/
@Override
public int size () {
return size;
}
/**
* Returns true if the map is empty.
*/
@Override
public boolean isEmpty () {
return size == 0;
}
/**
* Reduces the size of the backing arrays to be the specified capacity / loadFactor, or less. If the capacity is already less,
* nothing is done. If the map contains more items than the specified capacity, the next highest power of two capacity is used
* instead.
*/
public void shrink (int maximumCapacity) {
if (maximumCapacity < 0)
throw new IllegalArgumentException("maximumCapacity must be >= 0: " + maximumCapacity);
int tableSize = tableSize(maximumCapacity, loadFactor);
if (keyTable.length > tableSize)
resize(tableSize);
}
/**
* Clears the map and reduces the size of the backing arrays to be the specified capacity / loadFactor, if they are larger.
*/
public void clear (int maximumCapacity) {
int tableSize = tableSize(maximumCapacity, loadFactor);
if (keyTable.length <= tableSize) {
clear();
return;
}
size = 0;
resize(tableSize);
}
@Override
public void clear () {
if (size == 0)
return;
size = 0;
Arrays.fill(keyTable, null);
Arrays.fill(valueTable, null);
}
/**
* Returns true if the specified value is in the map. Note this traverses the entire map and compares every value, which may
* be an expensive operation.
*
* @param identity If true, uses == to compare the specified value with values in the map. If false, uses
* {@link #equals(Object)}.
*/
public boolean containsValue (@Nullable Object value, boolean identity) {
V[] valueTable = this.valueTable;
if (value == null) {
K[] keyTable = this.keyTable;
for (int i = valueTable.length - 1; i >= 0; i--)
if (keyTable[i] != null && valueTable[i] == null)
return true;
} else if (identity) {
for (int i = valueTable.length - 1; i >= 0; i--)
if (valueTable[i] == value)
return true;
} else {
for (int i = valueTable.length - 1; i >= 0; i--)
if (value.equals(valueTable[i]))
return true;
}
return false;
}
@Override
public boolean containsKey (Object key) {
return locateKey(key) >= 0;
}
/**
* Returns <tt>true</tt> if this map maps one or more keys to the
* specified value. More formally, returns <tt>true</tt> if and only if
* this map contains at least one mapping to a value <tt>v</tt> such that
* <tt>(value==null ? v==null : value.equals(v))</tt>. This operation
* will probably require time linear in the map size for most
* implementations of the <tt>Map</tt> interface.
*
* @param value value whose presence in this map is to be tested
* @return <tt>true</tt> if this map maps one or more keys to the
* specified value
* @throws ClassCastException if the value is of an inappropriate type for
* this map
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified value is null and this
* map does not permit null values
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
@Override
public boolean containsValue (Object value) {
return containsValue(value, false);
}
/**
* Returns the key for the specified value, or null if it is not in the map. Note this traverses the entire map and compares
* every value, which may be an expensive operation.
*
* @param identity If true, uses == to compare the specified value with values in the map. If false, uses
* {@link #equals(Object)}.
*/
public @Nullable K findKey (@Nullable Object value, boolean identity) {
V[] valueTable = this.valueTable;
if (value == null) {
K[] keyTable = this.keyTable;
for (int i = valueTable.length - 1; i >= 0; i--)
if (keyTable[i] != null && valueTable[i] == null)
return keyTable[i];
} else if (identity) {
for (int i = valueTable.length - 1; i >= 0; i--)
if (valueTable[i] == value)
return keyTable[i];
} else {
for (int i = valueTable.length - 1; i >= 0; i--)
if (value.equals(valueTable[i]))
return keyTable[i];
}
return null;
}
/**
* Increases the size of the backing array to accommodate the specified number of additional items / loadFactor. Useful before
* adding many items to avoid multiple backing array resizes.
*/
public void ensureCapacity (int additionalCapacity) {
int tableSize = tableSize(size + additionalCapacity, loadFactor);
if (keyTable.length < tableSize)
resize(tableSize);
}
final void resize (int newSize) {
int oldCapacity = keyTable.length;
threshold = (int)(newSize * loadFactor);
mask = newSize - 1;
shift = Integer.numberOfLeadingZeros(mask);
K[] oldKeyTable = keyTable;
V[] oldValueTable = valueTable;
keyTable = (K[])new Object[newSize];
valueTable = (V[])new Object[newSize];
if (size > 0) {
for (int i = 0; i < oldCapacity; i++) {
K key = oldKeyTable[i];
if (key != null)
putResize(key, oldValueTable[i]);
}
}
}
public int hashCode () {
int h = size;
K[] keyTable = this.keyTable;
V[] valueTable = this.valueTable;
for (int i = 0, n = keyTable.length; i < n; i++) {
K key = keyTable[i];
if (key != null) {
h += key.hashCode();
V value = valueTable[i];
if (value != null)
h += value.hashCode();
}
}
return h;
}
public boolean equals (Object obj) {
if (obj == this)
return true;
if (!(obj instanceof ObjectMapFib2))
return false;
ObjectMapFib2 other = (ObjectMapFib2)obj;
if (other.size != size)
return false;
K[] keyTable = this.keyTable;
V[] valueTable = this.valueTable;
for (int i = 0, n = keyTable.length; i < n; i++) {
K key = keyTable[i];
if (key != null) {
V value = valueTable[i];
if (value == null) {
if (other.get(key, neverIdentical) != null)
return false;
} else {
if (!value.equals(other.get(key)))
return false;
}
}
}
return true;
}
/**
* Uses == for comparison of each value.
*/
public boolean equalsIdentity (@Nullable Object obj) {
if (obj == this)
return true;
if (!(obj instanceof ObjectMapFib2))
return false;
ObjectMapFib2 other = (ObjectMapFib2)obj;
if (other.size != size)
return false;
K[] keyTable = this.keyTable;
V[] valueTable = this.valueTable;
for (int i = 0, n = keyTable.length; i < n; i++) {
K key = keyTable[i];
if (key != null && valueTable[i] != other.get(key, neverIdentical))
return false;
}
return true;
}
public String toString (String separator) {
return toString(separator, false);
}
public String toString () {
return toString(", ", true);
}
protected String toString (String separator, boolean braces) {
if (size == 0)
return braces ? "{}" : "";
StringBuilder buffer = new StringBuilder(32);
if (braces)
buffer.append('{');
K[] keyTable = this.keyTable;
V[] valueTable = this.valueTable;
int i = keyTable.length;
while (i-- > 0) {
K key = keyTable[i];
if (key == null)
continue;
buffer.append(key == this ? "(this)" : key);
buffer.append('=');
V value = valueTable[i];
buffer.append(value == this ? "(this)" : value);
break;
}
while (i-- > 0) {
K key = keyTable[i];
if (key == null)
continue;
buffer.append(separator);
buffer.append(key == this ? "(this)" : key);
buffer.append('=');
V value = valueTable[i];
buffer.append(value == this ? "(this)" : value);
}
if (braces)
buffer.append('}');
return buffer.toString();
}
/**
* Reuses the iterator of the reused {@link Entries} produced by {@link #entrySet()};
* does not permit nested iteration. Iterate over {@link Entries#Entries(ObjectMapFib2)} if you
* need nested or multithreaded iteration. You can remove an Entry from this ObjectMap
* using this Iterator.
*
* @return an {@link Iterator} over {@link Map.Entry} key-value pairs; remove is supported.
*/
@Override
public Iterator<Map.Entry<K, V>> iterator () {
return entrySet().iterator();
}
/**
* Returns a {@link Set} view of the keys contained in this map.
* The set is backed by the map, so changes to the map are
* reflected in the set, and vice-versa. If the map is modified
* while an iteration over the set is in progress (except through
* the iterator's own <tt>remove</tt> operation), the results of
* the iteration are undefined. The set supports element removal,
* which removes the corresponding mapping from the map, via the
* <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
* operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
* operations.
*
* <p>Note that the same Collection instance is returned each time this
* method is called. Use the {@link Keys} constructor for nested or
* multithreaded iteration.
*
* @return a set view of the keys contained in this map
*/
@Override
public Keys<K> keySet () {
if (keys1 == null || keys2 == null) {
keys1 = new Keys<>(this);
keys2 = new Keys<>(this);
}
if (!keys1.iter.valid) {
keys1.iter.reset();
keys1.iter.valid = true;
keys2.iter.valid = false;
return keys1;
}
keys2.iter.reset();
keys2.iter.valid = true;
keys1.iter.valid = false;
return keys2;
}
/**
* Returns a Collection of the values in the map. Remove is supported. Note that the same Collection instance is returned each
* time this method is called. Use the {@link Values} constructor for nested or multithreaded iteration.
*
* @return a {@link Collection} of V values
*/
@Override
public Values<V> values () {
if (values1 == null || values2 == null) {
values1 = new Values<>(this);
values2 = new Values<>(this);
}
if (!values1.iter.valid) {
values1.iter.reset();
values1.iter.valid = true;
values2.iter.valid = false;
return values1;
}
values2.iter.reset();
values2.iter.valid = true;
values1.iter.valid = false;
return values2;
}
/**
* Returns a Set of Map.Entry, containing the entries in the map. Remove is supported by the Set's iterator.
* Note that the same iterator instance is returned each time this method is called.
* Use the {@link Entries} constructor for nested or multithreaded iteration.
*
* @return a {@link Set} of {@link Map.Entry} key-value pairs
*/
@Override
public Entries<K, V> entrySet () {
if (entries1 == null || entries2 == null) {
entries1 = new Entries<>(this);
entries2 = new Entries<>(this);
}
if (!entries1.iter.valid) {
entries1.iter.reset();
entries1.iter.valid = true;
entries2.iter.valid = false;
return entries1;
}
entries2.iter.reset();
entries2.iter.valid = true;
entries1.iter.valid = false;
return entries2;
}
static public class Entry<K, V> implements Map.Entry<K, V> {
public K key;
public @Nullable V value;
public @Nullable String toString () {
return key + "=" + value;
}
/**
* Returns the key corresponding to this entry.
*
* @return the key corresponding to this entry
* @throws IllegalStateException implementations may, but are not
* required to, throw this exception if the entry has been
* removed from the backing map.
*/
@Override
public K getKey () {
return key;
}
/**
* Returns the value corresponding to this entry. If the mapping
* has been removed from the backing map (by the iterator's
* <tt>remove</tt> operation), the results of this call are undefined.
*
* @return the value corresponding to this entry
* @throws IllegalStateException implementations may, but are not
* required to, throw this exception if the entry has been
* removed from the backing map.
*/
@Override
public @Nullable V getValue () {
return value;
}
/**
* Replaces the value corresponding to this entry with the specified
* value (optional operation). (Writes through to the map.) The
* behavior of this call is undefined if the mapping has already been
* removed from the map (by the iterator's <tt>remove</tt> operation).
*
* @param value new value to be stored in this entry
* @return old value corresponding to the entry
* @throws UnsupportedOperationException if the <tt>put</tt> operation
* is not supported by the backing map
* @throws ClassCastException if the class of the specified value
* prevents it from being stored in the backing map
* @throws NullPointerException if the backing map does not permit
* null values, and the specified value is null
* @throws IllegalArgumentException if some property of this value
* prevents it from being stored in the backing map
* @throws IllegalStateException implementations may, but are not
* required to, throw this exception if the entry has been
* removed from the backing map.
*/
@Override
public @Nullable V setValue (V value) {
V old = this.value;
this.value = value;
return old;
}
@Override
public boolean equals (@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Entry<?, ?> entry = (Entry<?, ?>)o;
if (key != null ? !key.equals(entry.key) : entry.key != null)
return false;
return value != null ? value.equals(entry.value) : entry.value == null;
}
@Override
public int hashCode () {
int result = key != null ? key.hashCode() : 0;
result = 31 * result + (value != null ? value.hashCode() : 0);
return result;
}
}
static protected abstract class MapIterator<K, V, I> implements Iterable<I>, Iterator<I> {
public boolean hasNext;
protected final ObjectMapFib2<K, V> map;
protected int nextIndex, currentIndex;
protected boolean valid = true;
public MapIterator (ObjectMapFib2<K, V> map) {
this.map = map;
reset();
}
public void reset () {
currentIndex = -1;
nextIndex = -1;
findNextIndex();
}
void findNextIndex () {
K[] keyTable = map.keyTable;
for (int n = keyTable.length; ++nextIndex < n; ) {
if (keyTable[nextIndex] != null) {
hasNext = true;
return;
}
}
hasNext = false;
}
@Override
public void remove () {
int i = currentIndex;
if (i < 0)
throw new IllegalStateException("next must be called before remove.");
K[] keyTable = map.keyTable;
V[] valueTable = map.valueTable;
int mask = map.mask, next = i + 1 & mask;
K key;
while ((key = keyTable[next]) != null) {
int placement = map.place(key);
if ((next - placement & mask) > (i - placement & mask)) {
keyTable[i] = key;
valueTable[i] = valueTable[next];
i = next;
}
next = next + 1 & mask;
}
keyTable[i] = null;
valueTable[i] = null;
map.size--;
if (i != currentIndex)
--nextIndex;
currentIndex = -1;
}
}
static public class Entries<K, V> extends AbstractSet<Map.Entry<K, V>> {
protected Entry<K, V> entry = new Entry<K, V>();
protected MapIterator<K, V, Map.Entry<K, V>> iter;
protected Entries () {
}
public Entries (ObjectMapFib2<K, V> map) {
iter = new MapIterator<K, V, Map.Entry<K, V>>(map) {
@Override
public Iterator<Map.Entry<K, V>> iterator () {
return this;
}
/** Note the same entry instance is returned each time this method is called. */
@Override
public Map.Entry<K, V> next () {
if (!hasNext)
throw new NoSuchElementException();
if (!valid)
throw new RuntimeException("#iterator() cannot be used nested.");
K[] keyTable = map.keyTable;
entry.key = keyTable[nextIndex];
entry.value = map.valueTable[nextIndex];
currentIndex = nextIndex;
findNextIndex();
return entry;
}
@Override
public boolean hasNext () {
if (!valid)
throw new RuntimeException("#iterator() cannot be used nested.");
return hasNext;
}
};
}
/**
* Returns an iterator over the elements contained in this collection.
*
* @return an iterator over the elements contained in this collection
*/
@Override
public Iterator<Map.Entry<K, V>> iterator () {
return iter;
}
@Override
public int size () {
return iter.map.size;
}
}
static public class Values<V> extends AbstractCollection<V> {
protected MapIterator<Object, V, V> iter;
/**
* Returns an iterator over the elements contained in this collection.
*
* @return an iterator over the elements contained in this collection
*/
@Override
public Iterator<V> iterator () {
return iter;
}
@Override
public int size () {
return iter.map.size;
}
protected Values () {
}
public Values (ObjectMapFib2<?, V> map) {
iter = new MapIterator<Object, V, V>((ObjectMapFib2<Object, V>)map) {
@Override
public Iterator<V> iterator () {
return this;
}
@Override
public boolean hasNext () {
if (!valid)
throw new RuntimeException("#iterator() cannot be used nested.");
return hasNext;
}
@Override
public V next () {
if (!hasNext)
throw new NoSuchElementException();
if (!valid)
throw new RuntimeException("#iterator() cannot be used nested.");
V value = map.valueTable[nextIndex];
currentIndex = nextIndex;
findNextIndex();
return value;
}
};
}
}
static public class Keys<K> extends AbstractSet<K> {
protected MapIterator<K, Object, K> iter;
protected Keys () {
}
public Keys (ObjectMapFib2<K, ?> map) {
iter = new MapIterator<K, Object, K>((ObjectMapFib2<K, Object>)map) {
@Override
public Iterator<K> iterator () {
return this;
}
@Override
public boolean hasNext () {
if (!valid)
throw new RuntimeException("#iterator() cannot be used nested.");
return hasNext;
}
@Override
public K next () {
if (!hasNext)
throw new NoSuchElementException();
if (!valid)
throw new RuntimeException("#iterator() cannot be used nested.");
K key = map.keyTable[nextIndex];
currentIndex = nextIndex;
findNextIndex();
return key;
}
};
}
/**
* Returns an iterator over the elements contained in this collection.
*
* @return an iterator over the elements contained in this collection
*/
@Override
public Iterator<K> iterator () {
return iter;
}
@Override
public int size () {
return iter.map.size;
}
}
}
| [
"tommy.ettinger@gmail.com"
] | tommy.ettinger@gmail.com |
39c8fd2a252a0d624c571994f9f10d40bfcb9392 | 3cd5444fcb4cdba272db86b1106f9842f9910f33 | /src/main/java/com/sample/mavenwithgit/App.java | 0bd7f632518971c5c194009dab3919fcc5b840a8 | [] | no_license | Sachin325/mavenwithgit | da778196e92dd768f32b61bcbf72161b1f3485df | 97bc9d85961f5ee1debde2ecaba3dec2e6068758 | refs/heads/master | 2020-03-24T18:27:55.539662 | 2018-07-30T15:27:03 | 2018-07-30T15:27:03 | 142,892,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.sample.mavenwithgit;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"SachinS@svam.com"
] | SachinS@svam.com |
f35bf3b1b0023e4011ed8d3a98f0482676d95551 | 84856827191c5f40ff667c04fbc0d94a8f02a1a5 | /String_Assignment-3/src/com/nit/pro10/TextWraping.java | 448f3714616946dbaed48fb463c844fd20ad8eec | [] | no_license | danishali2196/StringAssignment | 89b35337584f48e1be5daf207bb1fd77aa062e24 | 3a13853ebf978f6483560fabb4583b6e5f4f4595 | refs/heads/master | 2020-08-12T04:08:29.135500 | 2019-10-12T17:24:50 | 2019-10-12T17:24:50 | 214,686,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | package com.nit.pro10;
import java.util.Scanner;
public class TextWraping {
public static void main(String[] args) {
int count=0;
String str="ABCDEFGHIJKLIMNOQRSTUVWXYZ";
String wraps="";
try (Scanner scan=new Scanner(System.in)){
System.out.println("Enter Number From where you Want Text Wrapping");
int wrap= scan.nextInt();
if(wrap>str.length()) {
System.err.println("Enter Valid Number,This Number Exceed the length Of Giving String");
return ;
}
System.out.println("Wrap String is:: ");
for(int i=0;i<str.length();i++) {
count++;
wraps=wraps+str.charAt(i);
if(count==wrap) {
System.out.println(wraps);
count=0;
wraps="";
}
}
System.out.println(wraps);
}catch (Exception e) {
System.err.println("For Text Wrap Enter Number Only" );
}
}
}
| [
"danishali@gmail.com"
] | danishali@gmail.com |
159ac2145ded3ad7d4073e18934cff7858d3807f | e252cb9925fe5e5bae48a5f39dbc452c2537cd5f | /UISample/app/src/test/java/com/guette/uisample/ExampleUnitTest.java | 0b3851bf23b2f2b8459885a719b3836a89b6d60c | [] | no_license | Guette/M4SAndroidCourse | 484e3a25fb947c63df20605eb15f0e161f209949 | 0ea1951318cc8ce46934ad966516b07d12c53363 | refs/heads/master | 2021-01-18T18:50:11.306608 | 2016-08-12T10:45:41 | 2016-08-12T10:45:41 | 61,647,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.guette.uisample;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"murge1988@gmail.com"
] | murge1988@gmail.com |
709b759a351c9b3d04f779d609e780b3c2e7d070 | 2817bdc69bb0af807cf67e42ac5ce9e39eebccdf | /com.exercise.carparking/src/test/java/ParkingAttendantTest.java | a6d6cae7ef5ae72b62cd581bd9c4111050df4130 | [] | no_license | junaidAnwar/carParkingProblem | b88b87797ca8a102387905300920de38792e5675 | d2eb4ff58f27d9e2ab4fa1ad2e5ef5981427ff0a | refs/heads/master | 2020-05-02T19:25:09.971081 | 2015-04-24T10:17:20 | 2015-04-24T10:17:20 | 34,319,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,920 | java | import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class ParkingAttendantTest {
ParkingAttendant parkingAttendant;
List<ParkingLot> parkingLotList;
@Before
public void setUp() throws Exception {
parkingLotList = new ArrayList<ParkingLot>();
parkingLotList.add(new ParkingLot(1));
parkingLotList.add(new ParkingLot(1));
parkingLotList.add(new ParkingLot(1));
parkingAttendant = new ParkingAttendant(parkingLotList);
}
@Test
public void shouldNotCreateParkingAttendantForEmptyParkingLotList() throws Exception {
try {
new ParkingAttendant(null);
} catch (Exception e) {
assertEquals("Cannot Create Parking Attendant as Parking lot list not Present", e.getMessage());
}
}
@Test
public void shouldParkCarAtFirstParkingLot() throws Exception {
Car car = new Car("");
Ticket ticket = parkingAttendant.parkCar(car);
int parkingLotNumber = ticket.getParkingLotNumber();
assertEquals(0, parkingLotNumber);
}
@Test
public void shouldParkCarAtSecondParkingLot() throws Exception {
parkingAttendant.parkCar(new Car(""));
Ticket ticket = parkingAttendant.parkCar(new Car(""));
int parkingLotNumber = ticket.getParkingLotNumber();
assertEquals(1, parkingLotNumber);
}
@Test
public void shouldRetrieveCarFromParkingLot() throws Exception {
Car car = new Car("");
Ticket ticket = parkingAttendant.parkCar(car);
Car retrievedCar = parkingAttendant.retrieveParkedCarForTicket(ticket);
assertSame(car, retrievedCar);
}
@Test
public void shouldNotRetrieveCarFromNonExistingParkingLot() throws Exception {
try {
Car car = new Car("");
parkingAttendant.parkCar(car);
parkingAttendant.parkCar(car);
Ticket ticket = parkingAttendant.parkCar(car);
parkingLotList.set(2, null);
parkingAttendant.retrieveParkedCarForTicket(ticket);
} catch (Exception e) {
assertEquals("Parking lot does not exist", e.getMessage());
}
}
@Test
public void shouldNotParkCarIfParkingLotIsFull() throws Exception {
try {
Car car = new Car("");
parkingAttendant.parkCar(car);
parkingAttendant.parkCar(car);
parkingAttendant.parkCar(car);
parkingAttendant.parkCar(car);
} catch (Exception e) {
assertEquals("All parking lots are full.", e.getMessage());
}
}
@Test
public void shouldReturnValidParkingTimeForParkedCars() throws Exception {
Car car = new Car("");
Ticket ticket = parkingAttendant.parkCar(car);
assertNotNull(ticket.getParkingTime());
}
} | [
"junaid2905@gmail.com"
] | junaid2905@gmail.com |
fbc732528c8f91746058c2e81be19ef2d8b120da | f07da4c098d88c96b30a846f5ba7c3d6a084d5f1 | /src/main/java/it/polimi/ingsw/GC_18/model/effects/dynamic/ResourcesMultiplier.java | f493260c6ca5e79e1c7e826c96d27474ba2ed4ea | [] | no_license | lpraat/LorenzoIlMagnifico | e60d520800b5ab1bb6a7a5b291a7157682e691db | 5a8d8af22dfb534da4c69d428b52f084d1d86f3a | refs/heads/master | 2022-11-09T21:19:25.766526 | 2020-06-25T19:40:23 | 2020-06-30T19:03:07 | 274,988,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,608 | java | package it.polimi.ingsw.GC_18.model.effects.dynamic;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.logging.Level;
import it.polimi.ingsw.GC_18.model.ModelLogger;
import it.polimi.ingsw.GC_18.model.Player;
import it.polimi.ingsw.GC_18.model.Source;
import it.polimi.ingsw.GC_18.model.notifiers.NotifyResource;
import it.polimi.ingsw.GC_18.model.resources.Resource;
import it.polimi.ingsw.GC_18.model.resources.Resources;
/**
* This class represents a dynamic effect that multiplies the resources given to a Player when he receives
* resources from a game Source.
*/
public class ResourcesMultiplier extends ResourcesChange implements Serializable {
private static final long serialVersionUID = 3743147224784678774L;
private int multiplier;
/**
* @param resources the resources to add
* @param source the source from where the external resources come from
* @param multiplier the multiply factor
*/
public ResourcesMultiplier(Resources resources, ArrayList<Source> source, int multiplier) {
super(resources, source);
this.multiplier = multiplier;
}
/**
* Using a NotifyResource applies the effect.
*/
@Override
public void update(Observable o, Object arg) {
try {
NotifyResource notifyResource = (NotifyResource) arg;
Source notifySource = notifyResource.getSource();
for (Source s : source) {
if (s.equals(notifySource)) {
List<Resource> resourcesList = resources.getResourcesList();
Player player = (Player) o;
for (Resource resource: resourcesList) {
if (notifyResource.getResourceType() == resource.getType() && resource.getValue() != 0) {
for (int i = 1; i < multiplier; i++) {
notifyResource.getResource().addPlayer(player, null);
}
}
}
}
}
} catch (ClassCastException e) {
ModelLogger.getInstance().log(Level.INFO, "Notify thrown", e);
}
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
source.forEach(source1 -> stringBuilder.append(source1.name()).append(" "));
return "Multiplies resources of " + multiplier+ " after getting resources from " + stringBuilder.toString() + " \n" + resources.toString();
}
}
| [
"pratissolil@gmail.com"
] | pratissolil@gmail.com |
94f46b1c3b727eda819fe780abbd5ccfbb8804b8 | 1f6c80f895aeed38e80edeec91bcb4aac0593cb2 | /adui/src/main/java/com/kuyun/common/util/SpringContextUtil.java | 65d1e0229f0d7b40d9615a31ad81026cafacc67a | [] | no_license | zhangzhijian2010/adui | 1bb598da415126378a1c404652b71eba0864ad4a | 9fc969187750e278934f616ceadffae904f61574 | refs/heads/master | 2021-01-23T12:11:09.792394 | 2013-08-06T09:32:01 | 2013-08-06T09:32:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,953 | java | /**
* tenfen.com Inc.
* Copyright (c) 2012-2015 All Rights Reserved.
*/
package com.kuyun.common.util;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
public class SpringContextUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext; // Spring应用上下文环境
/**
* 实现ApplicationContextAware接口的回调方法,设置上下文环境
*
* @param applicationContext
* @throws BeansException
*/
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
SpringContextUtil.applicationContext = applicationContext;
}
/**
* @return ApplicationContext
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
/**
* 获取对象
*
* @param name
* @return Object 一个以所给名字注册的bean的实例
* @throws BeansException
*/
public static Object getBean(String name) throws BeansException {
return applicationContext.getBean(name);
}
/**
* 获取类型为requiredType的对象
* 如果bean不能被类型转换,相应的异常将会被抛出(BeanNotOfRequiredTypeException)
*
* @param name
* bean注册名
* @param requiredType
* 返回对象类型
* @return Object 返回requiredType类型对象
* @throws BeansException
*/
public static Object getBean(String name, Class<?> requiredType)
throws BeansException {
return applicationContext.getBean(name, requiredType);
}
/**
* 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
*
* @param name
* @return boolean
*/
public static boolean containsBean(String name) {
return applicationContext.containsBean(name);
}
/**
* 判断以给定名字注册的bean定义是一个singleton还是一个prototype。
* 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
*
* @param name
* @return boolean
* @throws NoSuchBeanDefinitionException
*/
public static boolean isSingleton(String name)
throws NoSuchBeanDefinitionException {
return applicationContext.isSingleton(name);
}
/**
* @param name
* @return Class 注册对象的类型
* @throws NoSuchBeanDefinitionException
*/
@SuppressWarnings("rawtypes")
public static Class getType(String name)
throws NoSuchBeanDefinitionException {
return applicationContext.getType(name);
}
/**
* 如果给定的bean名字在bean定义中有别名,则返回这些别名
*
* @param name
* @return
* @throws NoSuchBeanDefinitionException
*/
public static String[] getAliases(String name)
throws NoSuchBeanDefinitionException {
return applicationContext.getAliases(name);
}
} | [
"zhangzhijian2010@sina.com"
] | zhangzhijian2010@sina.com |
d40b3e9aeca0775a523a2b881ff2554b0d281898 | 671b9ed32dd4d454eee100c99065e4293f47c784 | /Circle.java | a5adc52addde8078734aa8559141e9ad78ce8648 | [] | no_license | Khanhvnth1908/Mrs.Thi | 6ac08f2b873ccf2c221859cec4fb597bd607d306 | c0927b8ae3cd99196dfa50c7e32f970792ea0a3f | refs/heads/master | 2020-12-12T18:44:19.511793 | 2020-04-10T14:20:42 | 2020-04-10T14:20:42 | 234,204,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 802 | java | /*
* 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 helloworld;
/**
*
* @author User
*/
public class Circle { //class
private double radius; //variables
private String color;
public Circle(){
System.out.println("Information about the Circle");
}
//dinh nghia constructor de khoi tao doi tuong
public Circle(double radius,String color){
this.radius = radius;
this.color = color;
System.out.println(" radius " + radius + " color " + color);
}
//method
public void says(){
System.out.println("This is one way");
}
public void moves(){
System.out.println("Not a circle");
}
}
| [
"khanhvuong987@gmail.com"
] | khanhvuong987@gmail.com |
0b99129025ffce2b504ed6dbf012ec06c678fa72 | bb9140f335d6dc44be5b7b848c4fe808b9189ba4 | /Extra-DS/Corpus/class/aspectj/2450.java | 2461bd142b04e44b9c46b6e7ccdebd86b6e85356 | [] | no_license | masud-technope/EMSE-2019-Replication-Package | 4fc04b7cf1068093f1ccf064f9547634e6357893 | 202188873a350be51c4cdf3f43511caaeb778b1e | refs/heads/master | 2023-01-12T21:32:46.279915 | 2022-12-30T03:22:15 | 2022-12-30T03:22:15 | 186,221,579 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 4,274 | java | /* *******************************************************************
* Copyright (c) 2003 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Common Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Matthew Webster initial implementation
* ******************************************************************/
package org.aspectj.ajde;
import java.io.File;
import java.io.IOException;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.aspectj.util.FileUtil;
public class OutxmlTest extends AjdeTestCase {
public static final String PROJECT_DIR = "OutxmlTest";
public static final String BIN_DIR = "bin";
public static final String OUTJAR_NAME = "/bin/test.jar";
public static final String DEFAULT_AOPXML_NAME = "META-INF/aop.xml";
public static final String CUSTOM_AOPXML_NAME = "custom/aop.xml";
/*
* Ensure the output directory is clean
*/
protected void setUp() throws Exception {
super.setUp(PROJECT_DIR);
FileUtil.deleteContents(openFile(BIN_DIR));
}
/*
* Clean up afterwards
*/
protected void tearDown() throws Exception {
super.tearDown();
FileUtil.deleteContents(openFile(BIN_DIR));
openFile(BIN_DIR).delete();
}
/**
* Aim: Test "-outxml" option produces the correct xml file
*
*/
public void testOutxmlToFile() {
// System.out.println("OutxmlTest.testOutxmlToFile() outputpath='" + ideManager.getProjectProperties().getOutputPath() + "'");
assertTrue("Build failed", doSynchronousBuild("outxml-to-file.lst"));
assertTrue("Build warnings", ideManager.getCompilationSourceLineTasks().isEmpty());
File aopxml = openFile(BIN_DIR + "/" + DEFAULT_AOPXML_NAME);
assertTrue(DEFAULT_AOPXML_NAME + " missing", aopxml.exists());
}
/**
* Aim: Test "-outxmlfile filename" option produces the correct
* xml file
*
*/
public void testOutxmlfileToFile() {
assertTrue("Build failed", doSynchronousBuild("outxmlfile-to-file.lst"));
assertTrue("Build warnings", ideManager.getCompilationSourceLineTasks().isEmpty());
File aopxml = openFile(BIN_DIR + "/" + CUSTOM_AOPXML_NAME);
assertTrue(CUSTOM_AOPXML_NAME + " missing", aopxml.exists());
}
/**
* Aim: Test "-outxml" option produces the correct
* xml entry in outjar file
*
*/
public void testOutxmlToOutjar() {
File outjar = openFile(OUTJAR_NAME);
ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
assertTrue("Build failed", doSynchronousBuild("outxml-to-outjar.lst"));
assertTrue("Build warnings", ideManager.getCompilationSourceLineTasks().isEmpty());
File aopxml = openFile(BIN_DIR + "/" + DEFAULT_AOPXML_NAME);
assertFalse(DEFAULT_AOPXML_NAME + " should not exisit", aopxml.exists());
assertJarContainsEntry(outjar, DEFAULT_AOPXML_NAME);
}
/**
* Aim: Test "-outxmlfile filename" option produces the correct
* xml entry in outjar file
*
*/
public void testOutxmlfileToOutjar() {
// System.out.println("OutxmlTest.testOutxmlToOutjar() outputpath='" + ideManager.getProjectProperties().getOutputPath() + "'");
File outjar = openFile(OUTJAR_NAME);
ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
assertTrue("Build failed", doSynchronousBuild("outxmlfile-to-outjar.lst"));
assertTrue("Build warnings", ideManager.getCompilationSourceLineTasks().isEmpty());
File aopxml = openFile(BIN_DIR + "/" + CUSTOM_AOPXML_NAME);
assertFalse(CUSTOM_AOPXML_NAME + " should not exisit", aopxml.exists());
assertJarContainsEntry(outjar, CUSTOM_AOPXML_NAME);
}
private void assertJarContainsEntry(File file, String entryName) {
try {
JarFile jarFile = new JarFile(file);
JarEntry jarEntry = jarFile.getJarEntry(entryName);
assertNotNull(entryName + " missing", jarEntry);
} catch (IOException ex) {
fail(ex.toString());
}
}
}
| [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
61d384b341ef4ca22209d7f2cf09cd31e32ca329 | f0753120a5ae2f0291212aa98ef7c2857021ac01 | /src/lk/ijse/rj/dto/StockDTO.java | 3a5075495cfaaf21458b55cf2ff102898f32a833 | [] | no_license | milmaniq/sales-and-installment-based-order-system-in-javafx | 8cccd2e84e607ff778bb5d188d48d108358e4232 | c5d5d962096622ce5e298c02f18814f865439a32 | refs/heads/master | 2020-03-30T17:49:21.986050 | 2018-10-05T03:26:41 | 2018-10-05T03:26:41 | 151,471,429 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,038 | java | /*
* 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 lk.ijse.rj.dto;
import java.math.BigDecimal;
import java.sql.Date;
/**
*
* @author Ilman Iqbal
*/
public class StockDTO {
private String itemId;
private String description;
private String weight;
private BigDecimal rate;
private Date dateAdded;
public StockDTO() {
}
public StockDTO(String itemId, String description, String weight, BigDecimal rate, Date dateAdded) {
this.itemId = itemId;
this.description = description;
this.weight = weight;
this.rate = rate;
this.dateAdded = dateAdded;
}
/**
* @return the itemId
*/
public String getItemId() {
return itemId;
}
/**
* @param itemId the itemId to set
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the weight
*/
public String getWeight() {
return weight;
}
/**
* @param weight the weight to set
*/
public void setWeight(String weight) {
this.weight = weight;
}
/**
* @return the rate
*/
public BigDecimal getRate() {
return rate;
}
/**
* @param rate the rate to set
*/
public void setRate(BigDecimal rate) {
this.rate = rate;
}
/**
* @return the dateAdded
*/
public Date getDateAdded() {
return dateAdded;
}
/**
* @param dateAdded the dateAdded to set
*/
public void setDateAdded(Date dateAdded) {
this.dateAdded = dateAdded;
}
}
| [
"milmaniq@gmail.com"
] | milmaniq@gmail.com |
b10615d840cc272fa39731853dc145b81ff5b040 | 3020087edaad48460860115aa64cd991b98a3fca | /src/main/java/br/com/forumapi/forum/model/Usuario.java | 634668a254edb56fb4c55836896aa763605f890a | [] | no_license | RodrigoGreff3D/Forum-API | a73494c9b3149c5073dafca3457a202e9c22f815 | 28faed596dd88eef1387ea1d63c6ade55a3c2d7e | refs/heads/master | 2022-12-03T06:15:10.714905 | 2020-08-24T18:44:00 | 2020-08-24T18:44:00 | 288,740,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,188 | java | package br.com.forumapi.forum.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
@Entity
public class Usuario implements UserDetails {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nome;
private String email;
private String senha;
@ManyToMany(fetch = FetchType.EAGER)
private List<Perfil> perfis = new ArrayList<>();
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Usuario other = (Usuario) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return this.perfis;
}
@Override
public String getPassword() {
return this.senha;
}
@Override
public String getUsername() {
return this.email;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"greff3d@hotmail.com"
] | greff3d@hotmail.com |
c8db84a85ab458c1de304a3a59bd580eb988c132 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/24/24_16f6379df8ae6e057910d05a2fb582f1ebc4f009/GeoHashTest/24_16f6379df8ae6e057910d05a2fb582f1ebc4f009_GeoHashTest_s.java | b2656bf27aceda56f3225e7c1bd09c5dcbfd51e0 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 10,288 | java | package ch.hsr.geohash;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Method;
import java.util.Random;
import org.junit.Before;
import org.junit.Test;
public class GeoHashTest {
private GeoHash hash;
private Random rand;
@Before
public void setUp() {
hash = new GeoHash();
rand = new Random();
}
@Test
public void testAddingOnes() {
hash.addOnBitToEnd();
assertEquals(0x1l, hash.bits);
assertEquals(1, hash.significantBits());
hash.addOnBitToEnd();
hash.addOnBitToEnd();
hash.addOnBitToEnd();
assertEquals(0xfl, hash.bits);
assertEquals(4, hash.significantBits());
}
@Test
public void testAddingZeroes() {
hash.addOnBitToEnd();
assertEquals(0x1l, hash.bits);
hash.addOffBitToEnd();
hash.addOffBitToEnd();
hash.addOffBitToEnd();
hash.addOffBitToEnd();
assertEquals(0x10l, hash.bits);
assertEquals(5, hash.significantBits());
}
@Test
public void testToBase32() {
hash.bits = 0x6ff0414000000000l;
hash.significantBits = 25;
String base32 = hash.toBase32();
assertEquals("ezs42", base32);
}
@Test
public void testDecode() {
// for all lat/lon pairs check decoded point is in the same bbox as the
// geohash formed by encoder
// TODO could possibly be less brute-force here and be more scientific
// about possible failure points
for (double lat = -90; lat <= 90; lat += rand.nextDouble() + 0.5) {
for (double lon = -180; lon <= 180; lon += rand.nextDouble() + 0.5) {
for (int precisionChars = 2; precisionChars <= 12; precisionChars++) {
GeoHash gh = GeoHash.withCharacterPrecision(lat, lon, precisionChars);
BoundingBox bbox = gh.getBoundingBox();
GeoHash decodedHash = GeoHash.fromGeohashString(gh.toBase32());
WGS84Point decodedCenter = decodedHash.getBoundingBoxCenterPoint();
/*assertTrue("Decoded position should be within bounds of original",
(decodedCenter.latitude >= bbox[0].latitude)
&& (decodedCenter.longitude >= bbox[0].longitude)
&& (decodedCenter.latitude <= bbox[1].latitude)
&& (decodedCenter.longitude <= bbox[1].longitude));
*/
// they should now actually have the same bounding box.
BoundingBox decodedBoundingBox = decodedHash.getBoundingBox();
assertEquals(bbox, decodedBoundingBox);
// the two hashes should also be equal
assertEquals(gh, decodedHash);
assertEquals(gh.toBase32(), decodedHash.toBase32());
}
}
}
}
@Test
public void testWithin() {
hash.bits = 0x6ff0414000000000l;
hash.significantBits = 25;
System.out.println(hash.toBase32());
assertEquals("ezs42", hash.toBase32());
GeoHash bbox = new GeoHash();
bbox.bits = 0x6ff0000000000000l;
bbox.significantBits = 12;
assertWithin(hash, bbox);
}
private void assertWithin(GeoHash hash, GeoHash bbox) {
assertTrue(hash.toBase32() + " should be within " + bbox.toBase32(), hash.within(bbox));
}
@Test
public void testNotWithin() {
hash.bits = 0x6ff0414000000000l;
hash.significantBits = 25;
assertEquals("ezs42", hash.toBase32());
GeoHash bbox = new GeoHash();
bbox.bits = 0x6fc0000000000000l;
bbox.significantBits = 12;
assertFalse(hash.toBase32() + " should NOT be within " + bbox.toBase32(), hash.within(bbox));
}
@Test
public void testConstructorWithBitPrecision() {
GeoHash hash1 = GeoHash.withBitPrecision(45, 120, 20);
assertEquals(hash1.significantBits, 20);
System.out.println(hash1);
System.out.println(hash1.toBase32());
GeoHash hash2 = GeoHash.withBitPrecision(45, 120, 55);
assertEquals(hash2.significantBits, 55);
System.out.println(hash2);
System.out.println(hash2.toBase32());
assertTrue(hash2.within(hash1));
// this should match Dave Troys Codebase. This is also his maximum
// accuracy (12 5-nibbles).
GeoHash hash3 = GeoHash.withBitPrecision(20, 31, 60);
assertEquals("sew1c2vs2q5r", hash3.toBase32());
}
@Test
public void testLatLonBoundingBoxes() {
hash = GeoHash.withBitPrecision(40, 120, 10);
System.out.println(hash.toBase32());
printBoundingBox(hash);
}
@Test
public void testByCharacterPrecision() {
assertEncodingWithCharacterPrecision(new WGS84Point(20, 31), 12, "sew1c2vs2q5r");
assertEncodingWithCharacterPrecision(new WGS84Point(-20, 31), 12, "ksqn1rje83g2");
assertEncodingWithCharacterPrecision(new WGS84Point(-20.783236276, 31.9867127312312), 12, "ksq9zbs0b7vw");
WGS84Point point = new WGS84Point(-76.5110040642321, 39.0247389581054);
String fullStringValue = "hf7u8p8gn747";
for (int characters = 12; characters > 1; characters--) {
assertEncodingWithCharacterPrecision(point, characters, fullStringValue.substring(0, characters));
}
assertEncodingWithCharacterPrecision(new WGS84Point(39.0247389581054, -76.5110040642321), 12, "dqcw4bnrs6s7");
}
private void assertEncodingWithCharacterPrecision(WGS84Point point, int numberOfCharacters, String stringValue) {
GeoHash hash = GeoHash.withCharacterPrecision(point.getLatitude(), point.getLongitude(), numberOfCharacters);
assertEquals(stringValue, hash.toBase32());
}
@Test
public void testGetLatitudeBits() {
hash = GeoHash.withBitPrecision(30, 30, 16);
long[] latitudeBits = hash.getRightAlignedLatitudeBits();
assertEquals(0xaal, latitudeBits[0]);
assertEquals(8, latitudeBits[1]);
}
@Test
public void testGetLongitudeBits() {
hash = GeoHash.withBitPrecision(30, 30, 16);
long[] longitudeBits = hash.getRightAlignedLongitudeBits();
assertEquals(0x95l, longitudeBits[0]);
assertEquals(8, longitudeBits[1]);
}
@Test
public void testNeighbourLocationCode() {
// set up corner case
hash.bits = 0xc400000000000000l;
hash.significantBits = 7;
long[] lonBits = hash.getRightAlignedLongitudeBits();
assertEquals(0x8, lonBits[0]);
assertEquals(4, lonBits[1]);
long[] latBits = hash.getRightAlignedLatitudeBits();
assertEquals(0x5, latBits[0]);
assertEquals(3, latBits[1]);
GeoHash north = hash.getNorthernNeighbour();
assertEquals(0xc000000000000000l, north.bits);
assertEquals(7, north.significantBits);
GeoHash south = hash.getSouthernNeighbour();
assertEquals(0xd000000000000000l, south.bits);
assertEquals(7, south.significantBits());
GeoHash east = hash.getEasternNeighbour();
assertEquals(0xc600000000000000l, east.bits);
// NOTE: this is actually a corner case!
GeoHash west = hash.getWesternNeighbour();
assertEquals(0x6e00000000000000l, west.bits);
// NOTE: and now, for the most extreme corner case in 7-bit geohash-land
hash.bits = 0xfe00000000000000l;
east = hash.getEasternNeighbour();
assertEquals(0x5400000000000000l, east.bits);
// and then from there, just a little south of sanity...
south = east.getSouthernNeighbour();
assertEquals(0x0l, south.bits);
}
@Test
public void testEqualsAndHashCode() {
GeoHash hash1 = GeoHash.withBitPrecision(30, 30, 24);
GeoHash hash2 = GeoHash.withBitPrecision(30, 30, 24);
GeoHash hash3 = GeoHash.withBitPrecision(30, 30, 10);
assertTrue(hash1.equals(hash2) && hash2.equals(hash1));
assertFalse(hash1.equals(hash3) && hash3.equals(hash1));
assertEquals(hash1.hashCode(), hash2.hashCode());
assertFalse(hash1.hashCode() == hash3.hashCode());
}
@Test
public void testAdjacentHashes() {
GeoHash[] adjacent = GeoHash.fromGeohashString("dqcw4").getAdjacent();
assertEquals(8, adjacent.length);
}
@Test
public void testMovingInCircle() {
// moving around hashes in a circle should be possible
checkMovingInCircle(34.2, -45.123);
// this should also work at the "back" of the earth
checkMovingInCircle(45, 180);
checkMovingInCircle(90, 180);
checkMovingInCircle(0, -180);
}
private void checkMovingInCircle(double latitude, double longitude) {
GeoHash start;
GeoHash end;
start = GeoHash.withCharacterPrecision(latitude, longitude, 12);
end = start.getEasternNeighbour();
end = end.getSouthernNeighbour();
end = end.getWesternNeighbour();
end = end.getNorthernNeighbour();
assertEquals(start, end);
assertEquals(start.getBoundingBox(), end.getBoundingBox());
}
@Test
public void testMovingAroundWorldOnHashStrips() throws Exception {
String[] directions = { "Northern", "Eastern", "Southern", "Western" };
for (String direction : directions) {
checkMoveAroundStrip(direction);
}
}
private void checkMoveAroundStrip(String direction) throws Exception {
for (int bits = 2; bits < 16; bits++) {
double randomLatitude = (rand.nextDouble() - 0.5) * 180;
double randomLongitude = (rand.nextDouble() - 0.5) * 360;
// this divides the range by 2^bits
GeoHash hash = GeoHash.withBitPrecision(randomLatitude, randomLongitude, bits);
Method method = hash.getClass().getDeclaredMethod("get" + direction + "Neighbour");
GeoHash result = hash;
// moving this direction 2^bits times should yield the same hash
// again
for (int i = 0; i < Math.pow(2, bits); i++) {
result = (GeoHash) method.invoke(result);
}
assertEquals(hash, result);
}
}
@Test
public void testIssue1() {
double lat = 40.390943;
double lon = -75.9375;
GeoHash hash = GeoHash.withCharacterPrecision(lat, lon, 12);
String base32 = "dr4jb0bn2180";
GeoHash fromRef = GeoHash.fromGeohashString(base32);
assertEquals(hash, fromRef);
assertEquals(base32, hash.toBase32());
assertEquals(base32, fromRef.toBase32());
hash = GeoHash.withCharacterPrecision(lat, lon, 10);
assertEquals("dr4jb0bn21", hash.toBase32());
}
@Test
public void testSimpleWithin() {
GeoHash hash = GeoHash.withBitPrecision(70, -120, 8);
GeoHash inside = GeoHash.withBitPrecision(74, -130, 64);
assertWithin(inside, hash);
}
private void printBoundingBox(GeoHash hash) {
System.out.println("Bounding Box: \ncenter =" + hash.getBoundingBoxCenterPoint());
System.out.print("corners=");
System.out.println(hash.getBoundingBox());
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
69e1f873accedfcaed58cb706c15041fc74c874b | 67a1b5e8dc998ce3594c1c3bb2ec89c30850dee7 | /GooglePlay6.0.5/app/src/main/java/android/support/v7/widget/AppCompatSpinner.java | 5ce8b4e2ae7c06627a4474d141eefc9805fb4622 | [
"Apache-2.0"
] | permissive | matrixxun/FMTech | 4a47bd0bdd8294cc59151f1bffc6210567487bac | 31898556baad01d66e8d87701f2e49b0de930f30 | refs/heads/master | 2020-12-29T01:31:53.155377 | 2016-01-07T04:39:43 | 2016-01-07T04:39:43 | 49,217,400 | 2 | 0 | null | 2016-01-07T16:51:44 | 2016-01-07T16:51:44 | null | UTF-8 | Java | false | false | 23,305 | java | package android.support.v7.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.support.v4.view.TintableBackgroundView;
import android.support.v7.appcompat.R.attr;
import android.support.v7.appcompat.R.styleable;
import android.support.v7.internal.view.ContextThemeWrapper;
import android.support.v7.internal.widget.TintManager;
import android.support.v7.internal.widget.TintTypedArray;
import android.support.v7.internal.widget.ViewUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.ThemedSpinnerAdapter;
public class AppCompatSpinner
extends Spinner
implements TintableBackgroundView
{
private static final int[] ATTRS_ANDROID_SPINNERMODE;
private static final boolean IS_AT_LEAST_JB;
private static final boolean IS_AT_LEAST_M;
private AppCompatBackgroundHelper mBackgroundTintHelper;
private int mDropDownWidth;
private ListPopupWindow.ForwardingListener mForwardingListener;
private DropdownPopup mPopup;
private Context mPopupContext;
private boolean mPopupSet;
private SpinnerAdapter mTempAdapter;
private final Rect mTempRect = new Rect();
private TintManager mTintManager;
static
{
boolean bool1;
if (Build.VERSION.SDK_INT >= 23)
{
bool1 = true;
IS_AT_LEAST_M = bool1;
if (Build.VERSION.SDK_INT < 16) {
break label45;
}
}
label45:
for (boolean bool2 = true;; bool2 = false)
{
IS_AT_LEAST_JB = bool2;
ATTRS_ANDROID_SPINNERMODE = new int[] { 16843505 };
return;
bool1 = false;
break;
}
}
public AppCompatSpinner(Context paramContext)
{
this(paramContext, null);
}
public AppCompatSpinner(Context paramContext, int paramInt)
{
this(paramContext, null, R.attr.spinnerStyle, paramInt);
}
public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet)
{
this(paramContext, paramAttributeSet, R.attr.spinnerStyle);
}
public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
this(paramContext, paramAttributeSet, paramInt, -1);
}
public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet, int paramInt1, int paramInt2)
{
this(paramContext, paramAttributeSet, paramInt1, paramInt2, null);
}
public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet, int paramInt1, int paramInt2, Resources.Theme paramTheme)
{
super(paramContext, paramAttributeSet, paramInt1);
TintTypedArray localTintTypedArray1 = TintTypedArray.obtainStyledAttributes$1a6c1917(paramContext, paramAttributeSet, R.styleable.Spinner, paramInt1);
this.mTintManager = localTintTypedArray1.getTintManager();
this.mBackgroundTintHelper = new AppCompatBackgroundHelper(this, this.mTintManager);
Object localObject1;
AppCompatSpinner localAppCompatSpinner;
TypedArray localTypedArray;
if (paramTheme != null)
{
localObject1 = new ContextThemeWrapper(paramContext, paramTheme);
localAppCompatSpinner = this;
localAppCompatSpinner.mPopupContext = ((Context)localObject1);
if (this.mPopupContext != null) {
if (paramInt2 == -1)
{
if (Build.VERSION.SDK_INT < 11) {
break label402;
}
localTypedArray = null;
}
}
}
for (;;)
{
try
{
localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, ATTRS_ANDROID_SPINNERMODE, paramInt1, 0);
if (localTypedArray.hasValue(0))
{
int j = localTypedArray.getInt(0, 0);
paramInt2 = j;
}
}
catch (Exception localException)
{
final DropdownPopup localDropdownPopup;
TintTypedArray localTintTypedArray2;
int i;
int k;
Log.i("AppCompatSpinner", "Could not read android:spinnerMode", localException);
if (localTypedArray == null) {
continue;
}
localTypedArray.recycle();
continue;
}
finally
{
if (localTypedArray == null) {
continue;
}
localTypedArray.recycle();
}
if (paramInt2 == 1)
{
localDropdownPopup = new DropdownPopup(this.mPopupContext, paramAttributeSet, paramInt1);
localTintTypedArray2 = TintTypedArray.obtainStyledAttributes$1a6c1917(this.mPopupContext, paramAttributeSet, R.styleable.Spinner, paramInt1);
this.mDropDownWidth = localTintTypedArray2.getLayoutDimension(R.styleable.Spinner_android_dropDownWidth, -2);
localDropdownPopup.setBackgroundDrawable(localTintTypedArray2.getDrawable(R.styleable.Spinner_android_popupBackground));
i = R.styleable.Spinner_android_prompt;
localDropdownPopup.mHintText = localTintTypedArray1.mWrapped.getString(i);
localTintTypedArray2.mWrapped.recycle();
this.mPopup = localDropdownPopup;
this.mForwardingListener = new ListPopupWindow.ForwardingListener(this)
{
public final ListPopupWindow getPopup()
{
return localDropdownPopup;
}
public final boolean onForwardingStarted()
{
if (!AppCompatSpinner.this.mPopup.mPopup.isShowing()) {
AppCompatSpinner.this.mPopup.show();
}
return true;
}
};
}
localTintTypedArray1.mWrapped.recycle();
this.mPopupSet = true;
if (this.mTempAdapter != null)
{
setAdapter(this.mTempAdapter);
this.mTempAdapter = null;
}
this.mBackgroundTintHelper.loadFromAttributes(paramAttributeSet, paramInt1);
return;
k = localTintTypedArray1.getResourceId(R.styleable.Spinner_popupTheme, 0);
if (k != 0)
{
localObject1 = new ContextThemeWrapper(paramContext, k);
localAppCompatSpinner = this;
break;
}
if (!IS_AT_LEAST_M)
{
localObject1 = paramContext;
localAppCompatSpinner = this;
break;
}
localAppCompatSpinner = this;
localObject1 = null;
break;
label402:
paramInt2 = 1;
}
}
private int compatMeasureContentWidth(SpinnerAdapter paramSpinnerAdapter, Drawable paramDrawable)
{
int i;
if (paramSpinnerAdapter == null) {
i = 0;
}
do
{
return i;
i = 0;
View localView = null;
int j = 0;
int k = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 0);
int m = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 0);
int n = Math.max(0, getSelectedItemPosition());
int i1 = Math.min(paramSpinnerAdapter.getCount(), n + 15);
for (int i2 = Math.max(0, n - (15 - (i1 - n))); i2 < i1; i2++)
{
int i3 = paramSpinnerAdapter.getItemViewType(i2);
if (i3 != j)
{
j = i3;
localView = null;
}
localView = paramSpinnerAdapter.getView(i2, localView, this);
if (localView.getLayoutParams() == null) {
localView.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
}
localView.measure(k, m);
i = Math.max(i, localView.getMeasuredWidth());
}
} while (paramDrawable == null);
paramDrawable.getPadding(this.mTempRect);
return i + (this.mTempRect.left + this.mTempRect.right);
}
protected void drawableStateChanged()
{
super.drawableStateChanged();
if (this.mBackgroundTintHelper != null) {
this.mBackgroundTintHelper.applySupportBackgroundTint();
}
}
public int getDropDownHorizontalOffset()
{
if (this.mPopup != null) {
return this.mPopup.mDropDownHorizontalOffset;
}
if (IS_AT_LEAST_JB) {
return super.getDropDownHorizontalOffset();
}
return 0;
}
public int getDropDownVerticalOffset()
{
if (this.mPopup != null)
{
localDropdownPopup = this.mPopup;
if (localDropdownPopup.mDropDownVerticalOffsetSet) {}
}
while (!IS_AT_LEAST_JB)
{
DropdownPopup localDropdownPopup;
return 0;
return localDropdownPopup.mDropDownVerticalOffset;
}
return super.getDropDownVerticalOffset();
}
public int getDropDownWidth()
{
if (this.mPopup != null) {
return this.mDropDownWidth;
}
if (IS_AT_LEAST_JB) {
return super.getDropDownWidth();
}
return 0;
}
public Drawable getPopupBackground()
{
if (this.mPopup != null) {
return this.mPopup.mPopup.getBackground();
}
if (IS_AT_LEAST_JB) {
return super.getPopupBackground();
}
return null;
}
public Context getPopupContext()
{
if (this.mPopup != null) {
return this.mPopupContext;
}
if (IS_AT_LEAST_M) {
return super.getPopupContext();
}
return null;
}
public CharSequence getPrompt()
{
if (this.mPopup != null) {
return this.mPopup.mHintText;
}
return super.getPrompt();
}
public ColorStateList getSupportBackgroundTintList()
{
if (this.mBackgroundTintHelper != null) {
return this.mBackgroundTintHelper.getSupportBackgroundTintList();
}
return null;
}
public PorterDuff.Mode getSupportBackgroundTintMode()
{
if (this.mBackgroundTintHelper != null) {
return this.mBackgroundTintHelper.getSupportBackgroundTintMode();
}
return null;
}
protected void onDetachedFromWindow()
{
super.onDetachedFromWindow();
if ((this.mPopup != null) && (this.mPopup.mPopup.isShowing())) {
this.mPopup.dismiss();
}
}
protected void onMeasure(int paramInt1, int paramInt2)
{
super.onMeasure(paramInt1, paramInt2);
if ((this.mPopup != null) && (View.MeasureSpec.getMode(paramInt1) == -2147483648)) {
setMeasuredDimension(Math.min(Math.max(getMeasuredWidth(), compatMeasureContentWidth(getAdapter(), getBackground())), View.MeasureSpec.getSize(paramInt1)), getMeasuredHeight());
}
}
public boolean onTouchEvent(MotionEvent paramMotionEvent)
{
if ((this.mForwardingListener != null) && (this.mForwardingListener.onTouch(this, paramMotionEvent))) {
return true;
}
return super.onTouchEvent(paramMotionEvent);
}
public boolean performClick()
{
if ((this.mPopup != null) && (!this.mPopup.mPopup.isShowing()))
{
this.mPopup.show();
return true;
}
return super.performClick();
}
public void setAdapter(SpinnerAdapter paramSpinnerAdapter)
{
if (!this.mPopupSet) {
this.mTempAdapter = paramSpinnerAdapter;
}
do
{
return;
super.setAdapter(paramSpinnerAdapter);
} while (this.mPopup == null);
if (this.mPopupContext == null) {}
for (Context localContext = getContext();; localContext = this.mPopupContext)
{
this.mPopup.setAdapter(new DropDownAdapter(paramSpinnerAdapter, localContext.getTheme()));
return;
}
}
public void setBackgroundDrawable(Drawable paramDrawable)
{
super.setBackgroundDrawable(paramDrawable);
if (this.mBackgroundTintHelper != null) {
this.mBackgroundTintHelper.setInternalBackgroundTint(null);
}
}
public void setBackgroundResource(int paramInt)
{
super.setBackgroundResource(paramInt);
if (this.mBackgroundTintHelper != null) {
this.mBackgroundTintHelper.onSetBackgroundResource(paramInt);
}
}
public void setDropDownHorizontalOffset(int paramInt)
{
if (this.mPopup != null) {
this.mPopup.mDropDownHorizontalOffset = paramInt;
}
while (!IS_AT_LEAST_JB) {
return;
}
super.setDropDownHorizontalOffset(paramInt);
}
public void setDropDownVerticalOffset(int paramInt)
{
if (this.mPopup != null)
{
localDropdownPopup = this.mPopup;
localDropdownPopup.mDropDownVerticalOffset = paramInt;
localDropdownPopup.mDropDownVerticalOffsetSet = true;
}
while (!IS_AT_LEAST_JB)
{
DropdownPopup localDropdownPopup;
return;
}
super.setDropDownVerticalOffset(paramInt);
}
public void setDropDownWidth(int paramInt)
{
if (this.mPopup != null) {
this.mDropDownWidth = paramInt;
}
while (!IS_AT_LEAST_JB) {
return;
}
super.setDropDownWidth(paramInt);
}
public void setPopupBackgroundDrawable(Drawable paramDrawable)
{
if (this.mPopup != null) {
this.mPopup.setBackgroundDrawable(paramDrawable);
}
while (!IS_AT_LEAST_JB) {
return;
}
super.setPopupBackgroundDrawable(paramDrawable);
}
public void setPopupBackgroundResource(int paramInt)
{
setPopupBackgroundDrawable(getPopupContext().getDrawable(paramInt));
}
public void setPrompt(CharSequence paramCharSequence)
{
if (this.mPopup != null)
{
this.mPopup.mHintText = paramCharSequence;
return;
}
super.setPrompt(paramCharSequence);
}
public void setSupportBackgroundTintList(ColorStateList paramColorStateList)
{
if (this.mBackgroundTintHelper != null) {
this.mBackgroundTintHelper.setSupportBackgroundTintList(paramColorStateList);
}
}
public void setSupportBackgroundTintMode(PorterDuff.Mode paramMode)
{
if (this.mBackgroundTintHelper != null) {
this.mBackgroundTintHelper.setSupportBackgroundTintMode(paramMode);
}
}
private static final class DropDownAdapter
implements ListAdapter, SpinnerAdapter
{
private SpinnerAdapter mAdapter;
private ListAdapter mListAdapter;
public DropDownAdapter(SpinnerAdapter paramSpinnerAdapter, Resources.Theme paramTheme)
{
this.mAdapter = paramSpinnerAdapter;
if ((paramSpinnerAdapter instanceof ListAdapter)) {
this.mListAdapter = ((ListAdapter)paramSpinnerAdapter);
}
if ((paramTheme != null) && (AppCompatSpinner.IS_AT_LEAST_M) && ((paramSpinnerAdapter instanceof ThemedSpinnerAdapter)))
{
ThemedSpinnerAdapter localThemedSpinnerAdapter = (ThemedSpinnerAdapter)paramSpinnerAdapter;
if (localThemedSpinnerAdapter.getDropDownViewTheme() != paramTheme) {
localThemedSpinnerAdapter.setDropDownViewTheme(paramTheme);
}
}
}
public final boolean areAllItemsEnabled()
{
ListAdapter localListAdapter = this.mListAdapter;
if (localListAdapter != null) {
return localListAdapter.areAllItemsEnabled();
}
return true;
}
public final int getCount()
{
if (this.mAdapter == null) {
return 0;
}
return this.mAdapter.getCount();
}
public final View getDropDownView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
if (this.mAdapter == null) {
return null;
}
return this.mAdapter.getDropDownView(paramInt, paramView, paramViewGroup);
}
public final Object getItem(int paramInt)
{
if (this.mAdapter == null) {
return null;
}
return this.mAdapter.getItem(paramInt);
}
public final long getItemId(int paramInt)
{
if (this.mAdapter == null) {
return -1L;
}
return this.mAdapter.getItemId(paramInt);
}
public final int getItemViewType(int paramInt)
{
return 0;
}
public final View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
return getDropDownView(paramInt, paramView, paramViewGroup);
}
public final int getViewTypeCount()
{
return 1;
}
public final boolean hasStableIds()
{
return (this.mAdapter != null) && (this.mAdapter.hasStableIds());
}
public final boolean isEmpty()
{
return getCount() == 0;
}
public final boolean isEnabled(int paramInt)
{
ListAdapter localListAdapter = this.mListAdapter;
if (localListAdapter != null) {
return localListAdapter.isEnabled(paramInt);
}
return true;
}
public final void registerDataSetObserver(DataSetObserver paramDataSetObserver)
{
if (this.mAdapter != null) {
this.mAdapter.registerDataSetObserver(paramDataSetObserver);
}
}
public final void unregisterDataSetObserver(DataSetObserver paramDataSetObserver)
{
if (this.mAdapter != null) {
this.mAdapter.unregisterDataSetObserver(paramDataSetObserver);
}
}
}
private final class DropdownPopup
extends ListPopupWindow
{
private ListAdapter mAdapter;
CharSequence mHintText;
private final Rect mVisibleRect = new Rect();
public DropdownPopup(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramAttributeSet, paramInt);
this.mDropDownAnchorView = AppCompatSpinner.this;
setModal$1385ff();
this.mPromptPosition = 0;
this.mItemClickListener = new AdapterView.OnItemClickListener()
{
public final void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
{
AppCompatSpinner.this.setSelection(paramAnonymousInt);
if (AppCompatSpinner.this.getOnItemClickListener() != null) {
AppCompatSpinner.this.performItemClick(paramAnonymousView, paramAnonymousInt, AppCompatSpinner.DropdownPopup.this.mAdapter.getItemId(paramAnonymousInt));
}
AppCompatSpinner.DropdownPopup.this.dismiss();
}
};
}
final void computeContentWidth()
{
Drawable localDrawable = this.mPopup.getBackground();
int i;
int j;
int k;
int m;
if (localDrawable != null)
{
localDrawable.getPadding(AppCompatSpinner.this.mTempRect);
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this))
{
i = AppCompatSpinner.this.mTempRect.right;
j = AppCompatSpinner.this.getPaddingLeft();
k = AppCompatSpinner.this.getPaddingRight();
m = AppCompatSpinner.this.getWidth();
if (AppCompatSpinner.this.mDropDownWidth != -2) {
break label250;
}
int i1 = AppCompatSpinner.this.compatMeasureContentWidth((SpinnerAdapter)this.mAdapter, this.mPopup.getBackground());
int i2 = AppCompatSpinner.this.getContext().getResources().getDisplayMetrics().widthPixels - AppCompatSpinner.this.mTempRect.left - AppCompatSpinner.this.mTempRect.right;
if (i1 > i2) {
i1 = i2;
}
setContentWidth(Math.max(i1, m - j - k));
label175:
if (!ViewUtils.isLayoutRtl(AppCompatSpinner.this)) {
break label290;
}
}
}
label290:
for (int n = i + (m - k - this.mDropDownWidth);; n = i + j)
{
this.mDropDownHorizontalOffset = n;
return;
i = -AppCompatSpinner.this.mTempRect.left;
break;
Rect localRect = AppCompatSpinner.this.mTempRect;
AppCompatSpinner.this.mTempRect.right = 0;
localRect.left = 0;
i = 0;
break;
label250:
if (AppCompatSpinner.this.mDropDownWidth == -1)
{
setContentWidth(m - j - k);
break label175;
}
setContentWidth(AppCompatSpinner.this.mDropDownWidth);
break label175;
}
}
public final void setAdapter(ListAdapter paramListAdapter)
{
super.setAdapter(paramListAdapter);
this.mAdapter = paramListAdapter;
}
public final void show()
{
boolean bool = this.mPopup.isShowing();
computeContentWidth();
setInputMethodMode$13462e();
super.show();
this.mDropDownList.setChoiceMode(1);
int i = AppCompatSpinner.this.getSelectedItemPosition();
ListPopupWindow.DropDownListView localDropDownListView = this.mDropDownList;
if ((this.mPopup.isShowing()) && (localDropDownListView != null))
{
ListPopupWindow.DropDownListView.access$502(localDropDownListView, false);
localDropDownListView.setSelection(i);
if ((Build.VERSION.SDK_INT >= 11) && (localDropDownListView.getChoiceMode() != 0)) {
localDropDownListView.setItemChecked(i, true);
}
}
if (bool) {}
ViewTreeObserver localViewTreeObserver;
do
{
return;
localViewTreeObserver = AppCompatSpinner.this.getViewTreeObserver();
} while (localViewTreeObserver == null);
final ViewTreeObserver.OnGlobalLayoutListener local2 = new ViewTreeObserver.OnGlobalLayoutListener()
{
public final void onGlobalLayout()
{
if (!AppCompatSpinner.DropdownPopup.access$600(AppCompatSpinner.DropdownPopup.this, AppCompatSpinner.this))
{
AppCompatSpinner.DropdownPopup.this.dismiss();
return;
}
AppCompatSpinner.DropdownPopup.this.computeContentWidth();
AppCompatSpinner.DropdownPopup.this.show();
}
};
localViewTreeObserver.addOnGlobalLayoutListener(local2);
setOnDismissListener(new PopupWindow.OnDismissListener()
{
public final void onDismiss()
{
ViewTreeObserver localViewTreeObserver = AppCompatSpinner.this.getViewTreeObserver();
if (localViewTreeObserver != null) {
localViewTreeObserver.removeGlobalOnLayoutListener(local2);
}
}
});
}
}
}
/* Location: F:\apktool\apktool\Google_Play_Store6.0.5\classes-dex2jar.jar
* Qualified Name: android.support.v7.widget.AppCompatSpinner
* JD-Core Version: 0.7.0.1
*/ | [
"jiangchuna@126.com"
] | jiangchuna@126.com |
200ac50a53c4df49d0ed2cd297f48b80c624eae4 | a25a8f5a2dc7397cd35a449739af03adaaa7108e | /app/src/main/java/com/example/khanh/test1/ImageHelper.java | ffe183bee0354d184ef80a216b9a5164a7949efe | [] | no_license | khanhpt19/AndroidEmotionDetectionDemo | 25898bf6ccd0b19683116aaa46d14763f63113d5 | e8a1490ed1ab8a0fbeb4ef5b739726e9037c7756 | refs/heads/master | 2021-06-14T04:16:43.432358 | 2017-04-17T01:10:15 | 2017-04-17T01:10:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,535 | java | package com.example.khanh.test1;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.microsoft.projectoxford.emotion.contract.FaceRectangle;
/**
* Created by khanh on 4/14/2017.
*/
public class ImageHelper {
public static Bitmap drawRectOnBitmap(Bitmap mBitmap, FaceRectangle faceRectangle, String status) {
Bitmap bitmap = mBitmap.copy(Bitmap.Config.ARGB_8888,true);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.GREEN);
paint.setStrokeWidth(12);
canvas.drawRect(faceRectangle.left,
faceRectangle.top,
faceRectangle.left+faceRectangle.width,
faceRectangle.top+faceRectangle.height,
paint);
int cX = faceRectangle.left+faceRectangle.width;
int cY = faceRectangle.top+faceRectangle.height;
drawTextOnBitmap(canvas,70,cX/2+cX/5,cY+100,Color.GREEN,status);
return bitmap;
}
private static void drawTextOnBitmap(Canvas canvas, int textSize, int cX, int cY, int color, String status) {
Paint tempTextPaint = new Paint();
tempTextPaint.setAntiAlias(true);
tempTextPaint.setStyle(Paint.Style.FILL);
tempTextPaint.setColor(color);
tempTextPaint.setTextSize(textSize);
canvas.drawText(status,cX,cY,tempTextPaint);
}
}
| [
"khanh281096@gmail.com"
] | khanh281096@gmail.com |
dfa6be97611c656fdd80eb43d3d75c08940bdf1a | d844cbb6ecd0ee0880abe44f078c24e8e4453ca1 | /app/src/main/java/com/toonapps/toon/data/IRestClientDebugResponseHandler.java | 63b10db86a7cd2ffd6e251d5bd5ba13d01a3f28c | [
"MIT"
] | permissive | Inversion-NL/Toon-Android | 90115b6ca4f079a2314dd344ecd54dd044d4cc91 | cd806a7d02bc649757c440012367b1f2db54a62c | refs/heads/master | 2022-08-27T16:45:50.792683 | 2021-01-26T09:10:07 | 2021-01-26T09:10:07 | 128,404,361 | 3 | 1 | MIT | 2022-08-17T13:53:25 | 2018-04-06T14:19:06 | Java | UTF-8 | Java | false | false | 975 | java | /*
* Copyright (c) 2020
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements
* See the NOTICE file distributed with this work for additional information regarding copyright ownership
* The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and limitations
* under the License.
*/
package com.toonapps.toon.data;
public interface IRestClientDebugResponseHandler {
void onResponse(String response);
void onResponseError(Exception e);
} | [
"nl.inversion@gmail.com"
] | nl.inversion@gmail.com |
15262275c95419e6923c04844a6cc500be7ff66c | 7cbd008ae6e81da575f6b9becc80c5526b005cc3 | /src/esercizio20191014/Persona.java | ab889cfc9b6c1c2998368bf59d4829359adecdb0 | [] | no_license | Marco-01/Esercizio20191014 | 8a3ee2d321ab98d976a7b5a1f005827f84d8a454 | 412f9bc04de877b31aad825be056d94e1b1f05bc | refs/heads/master | 2020-08-13T19:01:38.378055 | 2019-10-14T11:13:49 | 2019-10-14T11:13:49 | 215,021,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | /*
* 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 esercizio20191014;
/**
*
* @author LAB-INF
*/
public class Persona {
public String nome;
public String cognome;
public String titolo;
public String professione;
public Persona(){
nome = " Marco ";
cognome = " Rossi ";
titolo = " Signore ";
professione = " Pizzaiolo ";
}
public String invia_nome(){
return nome;
}
public String invia_cognome(){
return cognome;
}
public String invia_titolo(){
return titolo;
}
public String invia_professione(){
return professione;
}
}
| [
"LAB-INF@DESKTOP-F6KS80J"
] | LAB-INF@DESKTOP-F6KS80J |
4190a0a032ceab61e644228c36e5c8dea53bb7b1 | eb9c3dac0dca0ecd184df14b1fda62e61cc8c7d7 | /google/cloud/recommender/v1beta1/google-cloud-recommender-v1beta1-java/gapic-google-cloud-recommender-v1beta1-java/src/test/java/com/google/cloud/recommender/v1beta1/RecommenderClientTest.java | 34eb89371d78af40d9bb0907ca321b255d4ccdae | [
"Apache-2.0"
] | permissive | Tryweirder/googleapis-gen | 2e5daf46574c3af3d448f1177eaebe809100c346 | 45d8e9377379f9d1d4e166e80415a8c1737f284d | refs/heads/master | 2023-04-05T06:30:04.726589 | 2021-04-13T23:35:20 | 2021-04-13T23:35:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 40,053 | java | /*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.recommender.v1beta1;
import static com.google.cloud.recommender.v1beta1.RecommenderClient.ListInsightsPagedResponse;
import static com.google.cloud.recommender.v1beta1.RecommenderClient.ListRecommendationsPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Duration;
import com.google.protobuf.Struct;
import com.google.protobuf.Timestamp;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@Generated("by gapic-generator-java")
public class RecommenderClientTest {
private static MockServiceHelper mockServiceHelper;
private RecommenderClient client;
private LocalChannelProvider channelProvider;
private static MockRecommender mockRecommender;
@BeforeClass
public static void startStaticServer() {
mockRecommender = new MockRecommender();
mockServiceHelper =
new MockServiceHelper(
UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockRecommender));
mockServiceHelper.start();
}
@AfterClass
public static void stopServer() {
mockServiceHelper.stop();
}
@Before
public void setUp() throws IOException {
mockServiceHelper.reset();
channelProvider = mockServiceHelper.createChannelProvider();
RecommenderSettings settings =
RecommenderSettings.newBuilder()
.setTransportChannelProvider(channelProvider)
.setCredentialsProvider(NoCredentialsProvider.create())
.build();
client = RecommenderClient.create(settings);
}
@After
public void tearDown() throws Exception {
client.close();
}
@Test
public void listInsightsTest() throws Exception {
Insight responsesElement = Insight.newBuilder().build();
ListInsightsResponse expectedResponse =
ListInsightsResponse.newBuilder()
.setNextPageToken("")
.addAllInsights(Arrays.asList(responsesElement))
.build();
mockRecommender.addResponse(expectedResponse);
InsightTypeName parent =
InsightTypeName.ofProjectLocationInsightTypeName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]");
ListInsightsPagedResponse pagedListResponse = client.listInsights(parent);
List<Insight> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getInsightsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListInsightsRequest actualRequest = ((ListInsightsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void listInsightsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
InsightTypeName parent =
InsightTypeName.ofProjectLocationInsightTypeName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]");
client.listInsights(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void listInsightsTest2() throws Exception {
Insight responsesElement = Insight.newBuilder().build();
ListInsightsResponse expectedResponse =
ListInsightsResponse.newBuilder()
.setNextPageToken("")
.addAllInsights(Arrays.asList(responsesElement))
.build();
mockRecommender.addResponse(expectedResponse);
String parent = "parent-995424086";
ListInsightsPagedResponse pagedListResponse = client.listInsights(parent);
List<Insight> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getInsightsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListInsightsRequest actualRequest = ((ListInsightsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void listInsightsExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String parent = "parent-995424086";
client.listInsights(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void getInsightTest() throws Exception {
Insight expectedResponse =
Insight.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.setDescription("description-1724546052")
.addAllTargetResources(new ArrayList<String>())
.setInsightSubtype("insightSubtype841535170")
.setContent(Struct.newBuilder().build())
.setLastRefreshTime(Timestamp.newBuilder().build())
.setObservationPeriod(Duration.newBuilder().build())
.setStateInfo(InsightStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedRecommendations(new ArrayList<Insight.RecommendationReference>())
.build();
mockRecommender.addResponse(expectedResponse);
InsightName name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
Insight actualResponse = client.getInsight(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetInsightRequest actualRequest = ((GetInsightRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void getInsightExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
InsightName name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
client.getInsight(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void getInsightTest2() throws Exception {
Insight expectedResponse =
Insight.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.setDescription("description-1724546052")
.addAllTargetResources(new ArrayList<String>())
.setInsightSubtype("insightSubtype841535170")
.setContent(Struct.newBuilder().build())
.setLastRefreshTime(Timestamp.newBuilder().build())
.setObservationPeriod(Duration.newBuilder().build())
.setStateInfo(InsightStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedRecommendations(new ArrayList<Insight.RecommendationReference>())
.build();
mockRecommender.addResponse(expectedResponse);
String name = "name3373707";
Insight actualResponse = client.getInsight(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetInsightRequest actualRequest = ((GetInsightRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void getInsightExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String name = "name3373707";
client.getInsight(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markInsightAcceptedTest() throws Exception {
Insight expectedResponse =
Insight.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.setDescription("description-1724546052")
.addAllTargetResources(new ArrayList<String>())
.setInsightSubtype("insightSubtype841535170")
.setContent(Struct.newBuilder().build())
.setLastRefreshTime(Timestamp.newBuilder().build())
.setObservationPeriod(Duration.newBuilder().build())
.setStateInfo(InsightStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedRecommendations(new ArrayList<Insight.RecommendationReference>())
.build();
mockRecommender.addResponse(expectedResponse);
InsightName name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Insight actualResponse = client.markInsightAccepted(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkInsightAcceptedRequest actualRequest = ((MarkInsightAcceptedRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markInsightAcceptedExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
InsightName name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markInsightAccepted(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markInsightAcceptedTest2() throws Exception {
Insight expectedResponse =
Insight.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.setDescription("description-1724546052")
.addAllTargetResources(new ArrayList<String>())
.setInsightSubtype("insightSubtype841535170")
.setContent(Struct.newBuilder().build())
.setLastRefreshTime(Timestamp.newBuilder().build())
.setObservationPeriod(Duration.newBuilder().build())
.setStateInfo(InsightStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedRecommendations(new ArrayList<Insight.RecommendationReference>())
.build();
mockRecommender.addResponse(expectedResponse);
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Insight actualResponse = client.markInsightAccepted(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkInsightAcceptedRequest actualRequest = ((MarkInsightAcceptedRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markInsightAcceptedExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markInsightAccepted(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void listRecommendationsTest() throws Exception {
Recommendation responsesElement = Recommendation.newBuilder().build();
ListRecommendationsResponse expectedResponse =
ListRecommendationsResponse.newBuilder()
.setNextPageToken("")
.addAllRecommendations(Arrays.asList(responsesElement))
.build();
mockRecommender.addResponse(expectedResponse);
RecommenderName parent =
RecommenderName.ofProjectLocationRecommenderName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
String filter = "filter-1274492040";
ListRecommendationsPagedResponse pagedListResponse = client.listRecommendations(parent, filter);
List<Recommendation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getRecommendationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListRecommendationsRequest actualRequest = ((ListRecommendationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(filter, actualRequest.getFilter());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void listRecommendationsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
RecommenderName parent =
RecommenderName.ofProjectLocationRecommenderName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
String filter = "filter-1274492040";
client.listRecommendations(parent, filter);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void listRecommendationsTest2() throws Exception {
Recommendation responsesElement = Recommendation.newBuilder().build();
ListRecommendationsResponse expectedResponse =
ListRecommendationsResponse.newBuilder()
.setNextPageToken("")
.addAllRecommendations(Arrays.asList(responsesElement))
.build();
mockRecommender.addResponse(expectedResponse);
String parent = "parent-995424086";
String filter = "filter-1274492040";
ListRecommendationsPagedResponse pagedListResponse = client.listRecommendations(parent, filter);
List<Recommendation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getRecommendationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListRecommendationsRequest actualRequest = ((ListRecommendationsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertEquals(filter, actualRequest.getFilter());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void listRecommendationsExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String parent = "parent-995424086";
String filter = "filter-1274492040";
client.listRecommendations(parent, filter);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void getRecommendationTest() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Recommendation actualResponse = client.getRecommendation(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetRecommendationRequest actualRequest = ((GetRecommendationRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void getRecommendationExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
client.getRecommendation(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void getRecommendationTest2() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
String name = "name3373707";
Recommendation actualResponse = client.getRecommendation(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetRecommendationRequest actualRequest = ((GetRecommendationRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void getRecommendationExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String name = "name3373707";
client.getRecommendation(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markRecommendationClaimedTest() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Recommendation actualResponse = client.markRecommendationClaimed(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkRecommendationClaimedRequest actualRequest =
((MarkRecommendationClaimedRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markRecommendationClaimedExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markRecommendationClaimed(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markRecommendationClaimedTest2() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Recommendation actualResponse = client.markRecommendationClaimed(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkRecommendationClaimedRequest actualRequest =
((MarkRecommendationClaimedRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markRecommendationClaimedExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markRecommendationClaimed(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markRecommendationSucceededTest() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Recommendation actualResponse = client.markRecommendationSucceeded(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkRecommendationSucceededRequest actualRequest =
((MarkRecommendationSucceededRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markRecommendationSucceededExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markRecommendationSucceeded(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markRecommendationSucceededTest2() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Recommendation actualResponse = client.markRecommendationSucceeded(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkRecommendationSucceededRequest actualRequest =
((MarkRecommendationSucceededRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markRecommendationSucceededExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markRecommendationSucceeded(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markRecommendationFailedTest() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Recommendation actualResponse = client.markRecommendationFailed(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkRecommendationFailedRequest actualRequest =
((MarkRecommendationFailedRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markRecommendationFailedExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markRecommendationFailed(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void markRecommendationFailedTest2() throws Exception {
Recommendation expectedResponse =
Recommendation.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.setDescription("description-1724546052")
.setRecommenderSubtype("recommenderSubtype1811451601")
.setLastRefreshTime(Timestamp.newBuilder().build())
.setPrimaryImpact(Impact.newBuilder().build())
.addAllAdditionalImpact(new ArrayList<Impact>())
.setContent(RecommendationContent.newBuilder().build())
.setStateInfo(RecommendationStateInfo.newBuilder().build())
.setEtag("etag3123477")
.addAllAssociatedInsights(new ArrayList<Recommendation.InsightReference>())
.build();
mockRecommender.addResponse(expectedResponse);
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
Recommendation actualResponse = client.markRecommendationFailed(name, stateMetadata, etag);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecommender.getRequests();
Assert.assertEquals(1, actualRequests.size());
MarkRecommendationFailedRequest actualRequest =
((MarkRecommendationFailedRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(stateMetadata, actualRequest.getStateMetadataMap());
Assert.assertEquals(etag, actualRequest.getEtag());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void markRecommendationFailedExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecommender.addException(exception);
try {
String name = "name3373707";
Map<String, String> stateMetadata = new HashMap<>();
String etag = "etag3123477";
client.markRecommendationFailed(name, stateMetadata, etag);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
] | bazel-bot-development[bot]@users.noreply.github.com |
cd48c8922450d60cbe0f03b50bae7d8b1a850704 | 21ba6450e755433ea077c0834aa7a32e9f63d7dc | /sources/org/apache/cordova/CordovaResourceApi.java | 09c570483b8b4a0f669bd9b468b9e1416a9a09f6 | [] | no_license | primanandaaditya/rosalia | a8655d5bb77fbfa470fdb6cc58ca0945f0f6f5d9 | 0627b799559fb46b219c1d812ef4ae42e7a4db2d | refs/heads/master | 2020-09-02T06:11:28.584630 | 2019-11-02T12:40:02 | 2019-11-02T12:40:02 | 219,151,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,221 | java | package org.apache.cordova;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Looper;
import android.util.Base64;
import android.webkit.MimeTypeMap;
import com.google.firebase.analytics.FirebaseAnalytics.Param;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.channels.FileChannel;
import java.util.Locale;
public class CordovaResourceApi {
private static final String[] LOCAL_FILE_PROJECTION = {"_data"};
private static final String LOG_TAG = "CordovaResourceApi";
public static final String PLUGIN_URI_SCHEME = "cdvplugin";
public static final int URI_TYPE_ASSET = 1;
public static final int URI_TYPE_CONTENT = 2;
public static final int URI_TYPE_DATA = 4;
public static final int URI_TYPE_FILE = 0;
public static final int URI_TYPE_HTTP = 5;
public static final int URI_TYPE_HTTPS = 6;
public static final int URI_TYPE_PLUGIN = 7;
public static final int URI_TYPE_RESOURCE = 3;
public static final int URI_TYPE_UNKNOWN = -1;
public static Thread jsThread;
private final AssetManager assetManager;
private final ContentResolver contentResolver;
private final PluginManager pluginManager;
private boolean threadCheckingEnabled = true;
public static final class OpenForReadResult {
public final AssetFileDescriptor assetFd;
public final InputStream inputStream;
public final long length;
public final String mimeType;
public final Uri uri;
public OpenForReadResult(Uri uri2, InputStream inputStream2, String mimeType2, long length2, AssetFileDescriptor assetFd2) {
this.uri = uri2;
this.inputStream = inputStream2;
this.mimeType = mimeType2;
this.length = length2;
this.assetFd = assetFd2;
}
}
public CordovaResourceApi(Context context, PluginManager pluginManager2) {
this.contentResolver = context.getContentResolver();
this.assetManager = context.getAssets();
this.pluginManager = pluginManager2;
}
public void setThreadCheckingEnabled(boolean value) {
this.threadCheckingEnabled = value;
}
public boolean isThreadCheckingEnabled() {
return this.threadCheckingEnabled;
}
public static int getUriType(Uri uri) {
assertNonRelative(uri);
String scheme = uri.getScheme();
if (Param.CONTENT.equalsIgnoreCase(scheme)) {
return 2;
}
if ("android.resource".equalsIgnoreCase(scheme)) {
return 3;
}
if ("file".equalsIgnoreCase(scheme)) {
if (uri.getPath().startsWith("/android_asset/")) {
return 1;
}
return 0;
} else if ("data".equalsIgnoreCase(scheme)) {
return 4;
} else {
if ("http".equalsIgnoreCase(scheme)) {
return 5;
}
if ("https".equalsIgnoreCase(scheme)) {
return 6;
}
if (PLUGIN_URI_SCHEME.equalsIgnoreCase(scheme)) {
return 7;
}
return -1;
}
}
public Uri remapUri(Uri uri) {
assertNonRelative(uri);
Uri pluginUri = this.pluginManager.remapUri(uri);
return pluginUri != null ? pluginUri : uri;
}
public String remapPath(String path) {
return remapUri(Uri.fromFile(new File(path))).getPath();
}
public File mapUriToFile(Uri uri) {
assertBackgroundThread();
switch (getUriType(uri)) {
case 0:
return new File(uri.getPath());
case 2:
Cursor cursor = this.contentResolver.query(uri, LOCAL_FILE_PROJECTION, null, null, null);
if (cursor == null) {
return null;
}
try {
int columnIndex = cursor.getColumnIndex(LOCAL_FILE_PROJECTION[0]);
if (columnIndex != -1 && cursor.getCount() > 0) {
cursor.moveToFirst();
String realPath = cursor.getString(columnIndex);
if (realPath != null) {
return new File(realPath);
}
}
cursor.close();
return null;
} finally {
cursor.close();
}
default:
return null;
}
}
public String getMimeType(Uri uri) {
switch (getUriType(uri)) {
case 0:
case 1:
return getMimeTypeFromPath(uri.getPath());
case 2:
case 3:
return this.contentResolver.getType(uri);
case 4:
return getDataUriMimeType(uri);
case 5:
case 6:
try {
HttpURLConnection conn = (HttpURLConnection) new URL(uri.toString()).openConnection();
conn.setDoInput(false);
conn.setRequestMethod("HEAD");
String mimeType = conn.getHeaderField("Content-Type");
if (mimeType != null) {
return mimeType.split(";")[0];
}
return mimeType;
} catch (IOException e) {
break;
}
}
return null;
}
private String getMimeTypeFromPath(String path) {
String extension = path;
int lastDot = extension.lastIndexOf(46);
if (lastDot != -1) {
extension = extension.substring(lastDot + 1);
}
String extension2 = extension.toLowerCase(Locale.getDefault());
if (extension2.equals("3ga")) {
return "audio/3gpp";
}
if (extension2.equals("js")) {
return "text/javascript";
}
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension2);
}
public OpenForReadResult openForRead(Uri uri) throws IOException {
return openForRead(uri, false);
}
public OpenForReadResult openForRead(Uri uri, boolean skipThreadCheck) throws IOException {
InputStream inputStream;
if (!skipThreadCheck) {
assertBackgroundThread();
}
switch (getUriType(uri)) {
case 0:
FileInputStream inputStream2 = new FileInputStream(uri.getPath());
return new OpenForReadResult(uri, inputStream2, getMimeTypeFromPath(uri.getPath()), inputStream2.getChannel().size(), null);
case 1:
String assetPath = uri.getPath().substring(15);
AssetFileDescriptor assetFd = null;
long length = -1;
try {
assetFd = this.assetManager.openFd(assetPath);
inputStream = assetFd.createInputStream();
length = assetFd.getLength();
} catch (FileNotFoundException e) {
inputStream = this.assetManager.open(assetPath);
}
return new OpenForReadResult(uri, inputStream, getMimeTypeFromPath(assetPath), length, assetFd);
case 2:
case 3:
String mimeType = this.contentResolver.getType(uri);
AssetFileDescriptor assetFd2 = this.contentResolver.openAssetFileDescriptor(uri, "r");
return new OpenForReadResult(uri, assetFd2.createInputStream(), mimeType, assetFd2.getLength(), assetFd2);
case 4:
OpenForReadResult ret = readDataUri(uri);
if (ret != null) {
return ret;
}
break;
case 5:
case 6:
HttpURLConnection conn = (HttpURLConnection) new URL(uri.toString()).openConnection();
conn.setDoInput(true);
String mimeType2 = conn.getHeaderField("Content-Type");
if (mimeType2 != null) {
mimeType2 = mimeType2.split(";")[0];
}
int length2 = conn.getContentLength();
return new OpenForReadResult(uri, conn.getInputStream(), mimeType2, (long) length2, null);
case 7:
CordovaPlugin plugin = this.pluginManager.getPlugin(uri.getHost());
if (plugin != null) {
return plugin.handleOpenForRead(uri);
}
throw new FileNotFoundException("Invalid plugin ID in URI: " + uri);
}
throw new FileNotFoundException("URI not supported by CordovaResourceApi: " + uri);
}
public OutputStream openOutputStream(Uri uri) throws IOException {
return openOutputStream(uri, false);
}
public OutputStream openOutputStream(Uri uri, boolean append) throws IOException {
assertBackgroundThread();
switch (getUriType(uri)) {
case 0:
File localFile = new File(uri.getPath());
File parent = localFile.getParentFile();
if (parent != null) {
parent.mkdirs();
}
return new FileOutputStream(localFile, append);
case 2:
case 3:
return this.contentResolver.openAssetFileDescriptor(uri, append ? "wa" : "w").createOutputStream();
default:
throw new FileNotFoundException("URI not supported by CordovaResourceApi: " + uri);
}
}
public HttpURLConnection createHttpConnection(Uri uri) throws IOException {
assertBackgroundThread();
return (HttpURLConnection) new URL(uri.toString()).openConnection();
}
public void copyResource(OpenForReadResult input, OutputStream outputStream) throws IOException {
assertBackgroundThread();
try {
InputStream inputStream = input.inputStream;
if (!(inputStream instanceof FileInputStream) || !(outputStream instanceof FileOutputStream)) {
byte[] buffer = new byte[8192];
while (true) {
int bytesRead = inputStream.read(buffer, 0, 8192);
if (bytesRead <= 0) {
break;
}
outputStream.write(buffer, 0, bytesRead);
}
} else {
FileChannel inChannel = ((FileInputStream) input.inputStream).getChannel();
FileChannel outChannel = ((FileOutputStream) outputStream).getChannel();
long offset = 0;
long length = input.length;
if (input.assetFd != null) {
offset = input.assetFd.getStartOffset();
}
inChannel.position(offset);
outChannel.transferFrom(inChannel, 0, length);
}
} finally {
input.inputStream.close();
if (outputStream != null) {
outputStream.close();
}
}
}
public void copyResource(Uri sourceUri, OutputStream outputStream) throws IOException {
copyResource(openForRead(sourceUri), outputStream);
}
public void copyResource(Uri sourceUri, Uri dstUri) throws IOException {
copyResource(openForRead(sourceUri), openOutputStream(dstUri));
}
private void assertBackgroundThread() {
if (this.threadCheckingEnabled) {
Thread curThread = Thread.currentThread();
if (curThread == Looper.getMainLooper().getThread()) {
throw new IllegalStateException("Do not perform IO operations on the UI thread. Use CordovaInterface.getThreadPool() instead.");
} else if (curThread == jsThread) {
throw new IllegalStateException("Tried to perform an IO operation on the WebCore thread. Use CordovaInterface.getThreadPool() instead.");
}
}
}
private String getDataUriMimeType(Uri uri) {
String uriAsString = uri.getSchemeSpecificPart();
int commaPos = uriAsString.indexOf(44);
if (commaPos == -1) {
return null;
}
String[] mimeParts = uriAsString.substring(0, commaPos).split(";");
if (mimeParts.length > 0) {
return mimeParts[0];
}
return null;
}
private OpenForReadResult readDataUri(Uri uri) {
byte[] data;
String uriAsString = uri.getSchemeSpecificPart();
int commaPos = uriAsString.indexOf(44);
if (commaPos == -1) {
return null;
}
String[] mimeParts = uriAsString.substring(0, commaPos).split(";");
String contentType = null;
boolean base64 = false;
if (mimeParts.length > 0) {
contentType = mimeParts[0];
}
for (int i = 1; i < mimeParts.length; i++) {
if ("base64".equalsIgnoreCase(mimeParts[i])) {
base64 = true;
}
}
String dataPartAsString = uriAsString.substring(commaPos + 1);
if (base64) {
data = Base64.decode(dataPartAsString, 0);
} else {
try {
data = dataPartAsString.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
data = dataPartAsString.getBytes();
}
}
return new OpenForReadResult(uri, new ByteArrayInputStream(data), contentType, (long) data.length, null);
}
private static void assertNonRelative(Uri uri) {
if (!uri.isAbsolute()) {
throw new IllegalArgumentException("Relative URIs are not supported.");
}
}
}
| [
"parmi24@gmail.com"
] | parmi24@gmail.com |
33fddca6d208b787d73b36f0beca396e6dc0190e | 2f260fa01c744d93aacfe592b62b1cee08b469de | /sphinx/java-intro/source/code/src/main/java/com/oneoffcoder/java/lambda/GenericFunctionalInterface.java | 01b023618178f458c5c283da6819111066b0fba8 | [
"CC-BY-4.0"
] | permissive | oneoffcoder/books | 2c1b9b5c97d3eaaf47bafcb1af884b1adcc23bba | 35c69915a2a54f62c2c3a542045719cf5540f6ba | refs/heads/master | 2023-06-25T16:00:10.926072 | 2023-06-20T03:40:09 | 2023-06-20T03:40:09 | 216,915,443 | 50 | 3 | null | 2023-03-07T01:27:50 | 2019-10-22T21:46:03 | Jupyter Notebook | UTF-8 | Java | false | false | 438 | java | package com.oneoffcoder.java.lambda;
public class GenericFunctionalInterface {
interface NumberFormatter<T extends Number> {
String format(T num);
}
public static void main(String[] args) throws Exception {
NumberFormatter formatter = (num) -> String.format("%.3f", num);
var data = new Double[] { 1.22222, 3.44444, 5.823432 };
for (var num : data) {
System.out.println(formatter.format(num));
}
}
}
| [
"vangjee@gmail.com"
] | vangjee@gmail.com |
d20c63b106359fc0bd31550d8666c4afe94dd445 | 300dcff5a71ca2cd65b7cd6b4527f9ad5330b6e1 | /app/src/main/java/com/ahmedagamy/task/data/model/response/MatchedSubstring.java | 12fbe304fc01f53008b7a17fd50b89f3c4bd1971 | [] | no_license | ahmedthinkdifferent/be2olaktask | 57ce04f8a9be6712d33b0d0038a4a096c81cfd94 | b399016b28209d1814c17dacb5992e95955afbd9 | refs/heads/master | 2021-06-24T10:55:53.088497 | 2017-09-12T12:13:50 | 2017-09-12T12:13:50 | 103,264,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java |
package com.ahmedagamy.task.data.model.response;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class MatchedSubstring {
@SerializedName("length")
private Long mLength;
@SerializedName("offset")
private Long mOffset;
public Long getLength() {
return mLength;
}
public void setLength(Long length) {
mLength = length;
}
public Long getOffset() {
return mOffset;
}
public void setOffset(Long offset) {
mOffset = offset;
}
}
| [
"ahmed.thinkdifferent@gmail.com"
] | ahmed.thinkdifferent@gmail.com |
cda8f249895dca7b9f897a5403ceaf497d739f74 | ad1653f32027bfb655361daf6b4db1d457ee1952 | /opt4j-optimizers/src/main/java/org/opt4j/optimizers/ea/BasicMatingModule.java | 35572a150c99ad7cef026db91c74ac17c5fdfbb9 | [
"MIT"
] | permissive | FedorSmirnov89/opt4j | 7660e75958e2574efdd50d077b275e359ae043f3 | aad653d2c026ec3a38c59f56af0bd60f831c4edd | refs/heads/master | 2022-02-22T18:54:55.666546 | 2022-02-14T07:12:40 | 2022-02-14T07:12:40 | 119,882,017 | 2 | 0 | MIT | 2020-06-04T12:44:38 | 2018-02-01T19:21:24 | Java | UTF-8 | Java | false | false | 3,068 | java | /*******************************************************************************
* Copyright (c) 2014 Opt4J
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
package org.opt4j.optimizers.ea;
import org.opt4j.core.config.annotations.Info;
import org.opt4j.core.config.annotations.Parent;
/**
* The {@link BasicMatingModule} is the basic property module for the
* {@link Mating} and {@link Coupler}.
*
* @author glass
*
*/
@Parent(EvolutionaryAlgorithmModule.class)
@Info("Basic strategies to determine couples from the set of parents for a crossover.")
public class BasicMatingModule extends MatingModule {
@Info("The type of couple operation")
protected CouplerType type = CouplerType.DEFAULT;
/**
* The {@link CouplerType} determines the coupler operator to use.
*
* @author glass
*
*/
public enum CouplerType {
/**
* Use the {@link CouplerDefault} operator.
*/
DEFAULT,
/**
* Use the {@link CouplerRandom} operator.
*/
RANDOM,
/**
* Use the {@link CouplerUnique} operator.
*/
UNIQUE;
}
/**
* Returns the type of {@link Coupler} operator to use.
*
* @see #setType
* @return the the type of coupler operator to use
*/
public CouplerType getType() {
return type;
}
/**
* Sets the the type of {@link Coupler} operator to use.
*
* @see #getType
* @param type
* the type to set
*/
public void setType(CouplerType type) {
this.type = type;
}
/*
* (non-Javadoc)
*
* @see org.opt4j.start.Opt4JModule#config()
*/
@Override
public void config() {
switch (type) {
case RANDOM:
bind(Coupler.class).to(CouplerRandom.class).in(SINGLETON);
break;
case UNIQUE:
bind(Coupler.class).to(CouplerUnique.class).in(SINGLETON);
break;
default: // DEFAULT
bind(Coupler.class).to(CouplerDefault.class).in(SINGLETON);
break;
}
}
}
| [
"lukasiewycz@gmail.com"
] | lukasiewycz@gmail.com |
b02d4f376d59cbb7386cd7c0b917b20d0f861834 | 694a4fe16e222a63da25dec7ba0d218c6561e0df | /taotao-sso/src/main/java/com/taotao/sso/service/UserService.java | a4a7a51c5054a5f7529558e98e8987528a0837ef | [] | no_license | hanchun995/taotao | 11210a689183fb780b39b69eda6ca5224c60b913 | 80afe5e4a48049b0f7ca46ab0a32c3161aaffad7 | refs/heads/master | 2021-05-08T08:52:14.239249 | 2017-11-13T02:18:41 | 2017-11-13T02:18:41 | 107,131,038 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | package com.taotao.sso.service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.taotao.common.TaotaoResult;
import com.taotao.pojo.TbUser;
public interface UserService {
TaotaoResult checkData(String content, Integer type);
TaotaoResult createUser(TbUser user) ;
TaotaoResult userLogin(String username, String password,HttpServletRequest request,HttpServletResponse response);
TaotaoResult getUserByToken(String token);
TaotaoResult logoutByToken(String token);
}
| [
"paperpass@DESKTOP-P83MD22"
] | paperpass@DESKTOP-P83MD22 |
206b26966113c52be546af4d7a70959bb12b7b4e | 9f0f118f262403c3b99c37f8db885989400dc955 | /novice/02-02/latihan/Testing/src/test/java/Testing/AppTest.java | 55b23e06f234119d8154f573e072828c33c2db98 | [] | no_license | ariesmo/praxis-academy | 8becbaa60abef366f4db0b49ce51551678890eb5 | 67ab1ba5714eb5e5b7ca7389780c1f2771cf79b8 | refs/heads/master | 2022-12-22T16:03:15.226038 | 2019-09-17T00:11:37 | 2019-09-17T00:11:37 | 203,109,626 | 0 | 0 | null | 2022-12-11T06:08:05 | 2019-08-19T06:14:03 | JavaScript | UTF-8 | Java | false | false | 349 | java | /*
* This Java source file was generated by the Gradle 'init' task.
*/
package Testing;
import org.junit.Test;
import static org.junit.Assert.*;
public class AppTest {
@Test public void testAppHasAGreeting() {
App classUnderTest = new App();
assertNotNull("app should have a greeting", classUnderTest.getGreeting());
}
}
| [
"abiesah@gmail.com"
] | abiesah@gmail.com |
0565c87e739a4c5dd114834f2ba9af7262338c51 | 65c6d9809ce1e1fd522cac3bf2f1258eb521b038 | /src/ee/ttu/algoritmid/dijkstra/Edge.java | 828c276d757dd265a3a6ad781aa8b8f6fcf19fbf | [] | no_license | PraiseTheSun-MySunBro/HW03 | 2fb3215893ffe95b1bef08a13f3cfbdd3cebede7 | 5120772e2feb6d77ed244658c612f84921bcb640 | refs/heads/master | 2020-03-26T02:17:53.441716 | 2018-08-11T17:27:46 | 2018-08-11T17:27:46 | 144,405,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package ee.ttu.algoritmid.dijkstra;
import ee.ttu.algoritmid.bfs.Direction;
public class Edge {
public final Vertex vertex;
public final int distance;
public final Direction.Type direction;
public Edge(Vertex vertex, int distance, Direction.Type direction) {
this.vertex = vertex;
this.distance = distance;
this.direction = direction;
}
}
| [
"erpris@ttu.ee"
] | erpris@ttu.ee |
f972f4cf6faa56489eb30e1e5aed3eb02a3f551b | 44f403cc44f4b692f0091df2e65ca43099be37aa | /src/com/practice/TopKFrequentWords.java | 13bb3ecc8f0741b93ee6a02d7360de01e859143c | [] | no_license | rajeshanumula/Leetcode | 2f0c80544257168bfeae76140285f7a62e408667 | 8f148a58554cffd7a470b5d4e2b6b9d45ada9eb7 | refs/heads/master | 2023-07-13T01:45:53.186126 | 2021-08-10T19:46:59 | 2021-08-10T19:46:59 | 394,465,337 | 0 | 0 | null | 2021-08-10T19:46:59 | 2021-08-09T23:16:18 | Java | UTF-8 | Java | false | false | 1,673 | java | package com.practice;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Map.Entry;
import java.util.*;
public class TopKFrequentWords {
List<String> topWords = new ArrayList<String>();
public List<String> topKFrequent(String[] words, int k) {
HashMap<String, Integer> map = new HashMap<String, Integer>();
for (String word : words) {
map.put(word, map.getOrDefault(word, 0) + 1);
}
Comparator<Map.Entry<String, Integer>> sorting = new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Entry<String, Integer> map1, Entry<String, Integer> map2) {
int diff = map2.getValue() - map1.getValue();
return diff == 0 ? map1.getKey().compareTo(map2.getKey()) : diff;
}
};
// Either this way
Queue<Map.Entry<String, Integer>> topQueue = new PriorityQueue<Map.Entry<String, Integer>>(sorting);
// or this way
/*
* Queue<Map.Entry<String, Integer>> topQueue=new PriorityQueue<>( new
* Comparator<Map.Entry<String, Integer>>() {
*
* @Override public int compare(Map.Entry<String, Integer>
* map1,Map.Entry<String, Integer> map2) { int
* diff=map2.getValue()-map1.getValue(); return
* diff==0?map1.getKey().compareTo(map2.getKey()):diff; } });
*/
topQueue.addAll(map.entrySet());
while (!topQueue.isEmpty() && k > 0) {
topWords.add(topQueue.poll().getKey());
k--;
}
return topWords;
}
public static void main(String[] args) {
String[] words = { "i", "love", "leetcode", "i", "love", "coding" };
TopKFrequentWords top = new TopKFrequentWords();
top.topKFrequent(words, 3);
}
}
| [
"60593237+rajeshanumula@users.noreply.github.com"
] | 60593237+rajeshanumula@users.noreply.github.com |
a6b6bdf7ba6db13d53d96ac1d5c27f5772a686ae | e7d68c3ce87032ff6250966acc4b8687e38359d0 | /personblog/src/main/java/com/qm/spring/boot/blog/personblog/service/EsBlogServiceImpl.java | 04c0f6a478a5ab7f43544c13be77544591f9b872 | [] | no_license | qm8956/blog | 52780fb3c217c99faeab987205d3ade759daa789 | 0524fd486f8ff6930ed2e7487f0a18faa45a4207 | refs/heads/master | 2021-05-06T23:27:08.835014 | 2017-12-03T12:20:32 | 2017-12-03T12:20:32 | 112,925,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,811 | java | package com.qm.spring.boot.blog.personblog.service;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.qm.spring.boot.blog.personblog.domain.User;
import com.qm.spring.boot.blog.personblog.domain.es.EsBlog;
import com.qm.spring.boot.blog.personblog.repository.es.EsBlogRepository;
import com.qm.spring.boot.blog.personblog.vo.TagVO;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.search.SearchParseException;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.core.ResultsExtractor;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.elasticsearch.core.query.SearchQuery;
import org.springframework.stereotype.Service;
/**
* EsBlog 服务.
*
* @since 1.0.0 2017年4月12日
* @author <a href="https://waylau.com">Way Lau</a>
*/
@Service
public class EsBlogServiceImpl implements EsBlogService {
@Autowired
private EsBlogRepository esBlogRepository;
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
@Autowired
private UserService userService;
private static final Pageable TOP_5_PAGEABLE = new PageRequest(0, 5);
private static final String EMPTY_KEYWORD = "";
/* (non-Javadoc)
* @see com.waylau.spring.boot.blog.service.EsBlogService#removeEsBlog(java.lang.String)
*/
@Override
public void removeEsBlog(String id) {
esBlogRepository.delete(id);
}
/* (non-Javadoc)
* @see com.waylau.spring.boot.blog.service.EsBlogService#updateEsBlog(com.waylau.spring.boot.blog.domain.es.EsBlog)
*/
@Override
public EsBlog updateEsBlog(EsBlog esBlog) {
return esBlogRepository.save(esBlog);
}
/* (non-Javadoc)
* @see com.waylau.spring.boot.blog.service.EsBlogService#getEsBlogByBlogId(java.lang.Long)
*/
@Override
public EsBlog getEsBlogByBlogId(Long blogId) {
return esBlogRepository.findByBlogId(blogId);
}
/* (non-Javadoc)
* @see com.waylau.spring.boot.blog.service.EsBlogService#listNewestEsBlogs(java.lang.String, org.springframework.data.domain.Pageable)
*/
@Override
public Page<EsBlog> listNewestEsBlogs(String keyword, Pageable pageable) throws SearchParseException {
Page<EsBlog> pages = null;
Sort sort = new Sort(Direction.DESC,"createTime");
if (pageable.getSort() == null) {
pageable = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), sort);
}
pages = esBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContainingOrContentContainingOrTagsContaining(keyword,keyword,keyword,keyword, pageable);
return pages;
}
/* (non-Javadoc)
* @see com.waylau.spring.boot.blog.service.EsBlogService#listHotestEsBlogs(java.lang.String, org.springframework.data.domain.Pageable)
*/
@Override
public Page<EsBlog> listHotestEsBlogs(String keyword, Pageable pageable) throws SearchParseException{
Sort sort = new Sort(Direction.DESC,"readSize","commentSize","voteSize","createTime");
if (pageable.getSort() == null) {
pageable = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), sort);
}
return esBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContainingOrContentContainingOrTagsContaining(keyword, keyword, keyword, keyword, pageable);
}
@Override
public Page<EsBlog> listEsBlogs(Pageable pageable) {
return esBlogRepository.findAll(pageable);
}
/**
* 最新前5
* @param
* @return
*/
@Override
public List<EsBlog> listTop5NewestEsBlogs() {
Page<EsBlog> page = this.listHotestEsBlogs(EMPTY_KEYWORD, TOP_5_PAGEABLE);
return page.getContent();
}
/**
* 最热前5
* @param
* @return
*/
@Override
public List<EsBlog> listTop5HotestEsBlogs() {
Page<EsBlog> page = this.listHotestEsBlogs(EMPTY_KEYWORD, TOP_5_PAGEABLE);
return page.getContent();
}
@Override
public List<TagVO> listTop30Tags() {
List<TagVO> list = new ArrayList<>();
// given
SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withQuery(matchAllQuery())
.withSearchType(SearchType.QUERY_THEN_FETCH)
.withIndices("blog").withTypes("blog")
.addAggregation(terms("tags").field("tags").order(Terms.Order.count(false)).size(30))
.build();
// when
Aggregations aggregations = elasticsearchTemplate.query(searchQuery, new ResultsExtractor<Aggregations>() {
@Override
public Aggregations extract(SearchResponse response) {
return response.getAggregations();
}
});
StringTerms modelTerms = (StringTerms)aggregations.asMap().get("tags");
Iterator<Bucket> modelBucketIt = modelTerms.getBuckets().iterator();
while (modelBucketIt.hasNext()) {
Bucket actiontypeBucket = modelBucketIt.next();
list.add(new TagVO(actiontypeBucket.getKey().toString(),
actiontypeBucket.getDocCount()));
}
return list;
}
@Override
public List<User> listTop12Users() {
List<String> usernamelist = new ArrayList<>();
// given
SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withQuery(matchAllQuery())
.withSearchType(SearchType.QUERY_THEN_FETCH)
.withIndices("blog").withTypes("blog")
.addAggregation(terms("users").field("username").order(Terms.Order.count(false)).size(12))
.build();
// when
Aggregations aggregations = elasticsearchTemplate.query(searchQuery, new ResultsExtractor<Aggregations>() {
@Override
public Aggregations extract(SearchResponse response) {
return response.getAggregations();
}
});
StringTerms modelTerms = (StringTerms)aggregations.asMap().get("users");
Iterator<Bucket> modelBucketIt = modelTerms.getBuckets().iterator();
while (modelBucketIt.hasNext()) {
Bucket actiontypeBucket = modelBucketIt.next();
String username = actiontypeBucket.getKey().toString();
usernamelist.add(username);
}
List<User> list = userService.listUsersByUsernames(usernamelist);
return list;
}
}
| [
"qianming_521@126.com"
] | qianming_521@126.com |
c950d5fa5019d417b90a2d4dccf3cf4f8451b906 | b0ef931fd22e4a7be06101ba1c84a45351b142d0 | /producer/src/main/java/producer/thrift/HelloServerDemo3.java | 093b55243bc1e5aa416f078520545bcb4cb7c914 | [] | no_license | louisdai/billsonSpringCloud | 99813032905e2e5d7cdee6c27b5aa626ba8fb8ca | 288052b163f586e85f8fbb78dd9867dedde489e3 | refs/heads/master | 2020-04-25T02:24:51.433196 | 2019-02-21T07:37:37 | 2019-02-21T07:37:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,692 | java | package producer.thrift;
import org.apache.thrift.TProcessor;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TNonblockingServer;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TNonblockingServerSocket;
import org.apache.thrift.transport.TServerSocket;
public class HelloServerDemo3 {
public static final int SERVER_PORT = 8090;
public void startServer() {
try {
System.out.println("HelloWorld TNonblockingServer start ....");
TProcessor tprocessor = new HelloWorldService.Processor<HelloWorldService.Iface>(new HelloWorldImpl());
TNonblockingServerSocket tnbSocketTransport = new TNonblockingServerSocket(SERVER_PORT);
TNonblockingServer.Args tnbArgs = new TNonblockingServer.Args(tnbSocketTransport);
tnbArgs.processor(tprocessor);
tnbArgs.transportFactory(new TFramedTransport.Factory());
tnbArgs.protocolFactory(new TCompactProtocol.Factory());
// 使用非阻塞式IO,服务端和客户端需要指定TFramedTransport数据传输的方式
TServer server = new TNonblockingServer(tnbArgs);
server.serve();
} catch (Exception e) {
System.out.println("Server start error!!!");
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
HelloServerDemo3 server = new HelloServerDemo3();
server.startServer();
}
}
| [
"bixin@corp.netease.com"
] | bixin@corp.netease.com |
4e5c7447ddc6e88299b13d2d454817dffe0d6026 | 340df977a96a63f8468b9223abdf2d6177c85c1c | /app/src/main/java/com/example/cyborg/Models/StockDetails.java | 7c38d7757b88c89af4e1d99f8e0fae319faad0cc | [] | no_license | tejavarma-aln/Cyborg | 71702a339f2fc72146afb418f2671d539b52137d | 407801258495effe798f959def474b1e62230e29 | refs/heads/master | 2022-11-24T18:24:39.784417 | 2020-08-05T08:35:14 | 2020-08-05T08:35:14 | 285,208,707 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package com.example.cyborg.Models;
public class StockDetails {
private String itemQuantity;
private String itemRate;
private String itemAmount;
public StockDetails(String itemQuantity, String itemRate, String itemAmount) {
this.itemQuantity = itemQuantity;
this.itemRate = itemRate;
this.itemAmount = itemAmount;
}
public String getItemQuantity() {
return itemQuantity;
}
public String getItemRate() {
return itemRate;
}
public String getItemAmount() {
return itemAmount;
}
}
| [
"yetukurivarma@gmail.com"
] | yetukurivarma@gmail.com |
b1b15b4874e91cb41b72a61e07343039e24b6184 | c4b527e9ab9e9e42954e0b25327d73d9e0146955 | /lesson_16/MassiveTest11.java | 8f45613fed695f475f967f833bca6a211d527c24 | [] | no_license | AlenaYurkevich/PVTcourses | 61baf6dd5465d6df7c69e9a81c50ec880a0c431a | e9c55158cd1e3809bf94fcdba29ffce3dedb4c4c | refs/heads/master | 2020-04-19T05:54:39.312959 | 2019-04-02T19:53:41 | 2019-04-02T19:56:45 | 168,002,624 | 0 | 0 | null | 2019-04-02T19:56:47 | 2019-01-28T17:15:07 | Java | UTF-8 | Java | false | false | 551 | java | package core;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import static org.testng.Assert.assertSame;
import org.testng.annotations.AfterClass;
public class MassiveTest11 {
@Test(timeOut=2000)
public void testSecondPowerWithAssertSame() {
int a = 65;
Massive massive = new Massive();
assertSame(a, massive.getSecondPower(8));
}
@BeforeClass
public void beforeClass() {
System.out.println("YOU SHALL NOT PASS!");
}
@AfterClass
public void afterClass() {
System.out.println("Told ya");
}
}
| [
"47116829+AlenaYurkevich@users.noreply.github.com"
] | 47116829+AlenaYurkevich@users.noreply.github.com |
4cab5ef41848dc8df2cf4ff0391e8e67c177f848 | 4ef431684e518b07288e8b8bdebbcfbe35f364e4 | /em-tests/test-core/src/main/java/com/ca/apm/test/atc/performance/TimelinePerformanceTest.java | 7cbfa2355826cd6b9b0379463c27df342aae09f9 | [] | no_license | Sarojkswain/APMAutomation | a37c59aade283b079284cb0a8d3cbbf79f3480e3 | 15659ce9a0030c2e9e5b992040e05311fff713be | refs/heads/master | 2020-03-30T00:43:23.925740 | 2018-09-27T23:42:04 | 2018-09-27T23:42:04 | 150,540,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,377 | java | /*
* Copyright (c) 2015 CA. All rights reserved.
*
* This software and all information contained therein is confidential and
* proprietary and shall not be duplicated, used, disclosed or disseminated in
* any way except as authorized by the applicable license agreement, without
* the express written permission of CA. All authorized reproductions must be
* marked with this language.
*
* EXCEPT AS SET FORTH IN THE APPLICABLE LICENSE AGREEMENT, TO THE EXTENT
* PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS SOFTWARE WITHOUT WARRANTY OF
* ANY KIND, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL CA BE
* LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR
* INDIRECT, FROM THE USE OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, LOST
* PROFITS, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF CA IS
* EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE.
*/
package com.ca.apm.test.atc.performance;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.ca.apm.test.atc.common.Timeline;
import com.ca.apm.test.atc.common.UI;
import com.ca.apm.test.atc.common.UI.Role;
public class TimelinePerformanceTest extends PerformanceTest implements RepeatableTest {
private int counter = 0;
@Test
@Parameters({ "testIterations" })
public void testDecreasingEndTime(int iterations) {
try {
UI ui = getUI();
ui.login(Role.ADMIN);
ui.getLeftNavigationPanel().goToMapViewPage();
ui.getRibbon().expandTimelineToolbar();
ui.getTimeline().turnOnLiveMode();
ui.getCanvas().waitForUpdate();
runTest(this, iterations);
} catch (Exception e) {
// TODO Auto-generated catch block
}
}
@Override
public void oneLoop() {
UI ui = getUI();
Timeline timeline = ui.getTimeline();
timeline.openStartTimeCalendar();
if ((counter / 10) % 2 == 0) {
timeline.getStartTimeCalendarMinuteDecreaseBtn().click();
}
else {
timeline.getStartTimeCalendarMinuteIncreaseBtn().click();
}
timeline.calendarApply();
ui.getCanvas().waitForUpdate();
counter++;
}
}
| [
"sarojkswain@gmail.com"
] | sarojkswain@gmail.com |
ceda42417fb63434b8eacb7eb7a876759d6ca5e5 | 816590cae552505fdbed0fa145789fa4dae80102 | /src/main/java/com/wrh/thread/CylicBarrier/TestCylicBarrier.java | 141c1e486856e4fe6309d68d1bb5c3fb5362307c | [
"MIT"
] | permissive | ruo96/mynetty | 8f48ea47dbd0a5153d7d71aeb1b8af3f04fcac79 | d20ab81693d7166510f4f52036e38ff31662286b | refs/heads/master | 2023-07-21T06:11:33.959836 | 2023-07-19T01:55:49 | 2023-07-19T01:55:49 | 145,347,283 | 1 | 0 | MIT | 2023-06-14T22:19:23 | 2018-08-20T00:22:33 | Java | UTF-8 | Java | false | false | 1,121 | java | package com.wrh.thread.CylicBarrier;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
/**
* @Created by wrh
* @Description:
* @Date: Created in 下午 2:53 2019/2/19 0019
* @Modified By:
*/
public class TestCylicBarrier {
static CyclicBarrier c = new CyclicBarrier(2);
public static void main(String[] args) {
new Thread(new Runnable() {
@Override
public void run() {
try {
c.await();
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
System.out.println(1);
}
}).start();
try {
c.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
System.out.println(2);
}
}
| [
"314825560@qq.com"
] | 314825560@qq.com |
77c4173ec52ed51921fcfe1da1d1e97c4d4a7c7c | 8c2927f2656225ea200abbfa0636bb062761ddc0 | /jlmqserverstomp/src/main/java/team404/jlmqserver/handler/CustomerStompSessionHandler.java | 755eca56521ea01193674b1c387041de97a139e6 | [] | no_license | MarselAhmetov/JavaLab | 145aaf81046ef168fde79365069a383f04d618ac | 9e003a7cf07afaa0bacb1e47927a057123e0562a | refs/heads/master | 2022-12-28T10:37:06.300525 | 2021-01-08T12:03:02 | 2021-01-08T12:03:02 | 246,674,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,676 | java | package team404.jlmqserver.handler;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.converter.StringMessageConverter;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter;
import org.springframework.stereotype.Component;
import team404.jlmqserver.model.Message;
@Component
public class CustomerStompSessionHandler extends StompSessionHandlerAdapter {
StompSession session;
@Autowired
ObjectMapper objectMapper;
@SneakyThrows
@Override
public void handleFrame(StompHeaders headers, Object payload) {
System.out.println("Received task");
System.out.println(payload.toString());
StompHeaders stompHeaders = new StompHeaders();
stompHeaders.add("destination", "/app/jlmq/complete" + headers.getDestination().substring(headers.getDestination().lastIndexOf("/")));
stompHeaders.add("type", "complete");
session.send(stompHeaders, payload);
}
@Override
public void afterConnected(StompSession session, StompHeaders connectedHeaders) {
System.out.println("Connected");
this.session = session;
}
@Override
public void handleException(StompSession session, StompCommand command, StompHeaders headers, byte[] payload, Throwable exception) {
throw new RuntimeException("Failure in WebSocket handling", exception);
}
}
| [
"marsel5027@gmail.com"
] | marsel5027@gmail.com |
33673cfc8d51a8c8988897882854a00a61b649cc | f8bdf5083165cc95c8e1ad19053a8031ddd575ca | /core/src/main/java/com/memory/platform/rpc/dubbo/DubboFilter.java | 758a37dc7067949d31efe40aa65295e2ca55fe60 | [] | no_license | ladanniel/- | 1ec0c7cba535b8cfbd2e20dc5785ea8d8b70b759 | c6953ebeb2eafb27c6e72a78c6551e12b441f518 | refs/heads/master | 2020-04-26T11:34:03.761608 | 2019-03-03T02:20:51 | 2019-03-03T02:20:51 | 173,521,158 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package com.memory.platform.rpc.dubbo;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import com.alibaba.dubbo.rpc.Filter;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.Result;
import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.dubbo.rpc.RpcException;
import com.memory.platform.core.AppUtil;
import com.memory.platform.entity.member.Account;
/*
* bylil 消费者拦截器
* 传入token账号
* */
@Aspect
@Component
public class DubboFilter implements Filter{
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation)
throws RpcException {
Account account = AppUtil.getLoginUser();
if(account!=null) {
RpcContext.getContext().setAttachment("tokenID", account.getToken());
}
return invoker.invoke(invocation);
}
}
| [
"ldanniel@sina.com"
] | ldanniel@sina.com |
d9502068a9fb2a350abd1fd4ac087e9d32bc443f | 7f69e2b6ec47fdfd7088f63eda64c80d9f1f1b0f | /Web2SMS_Common_DALayer/src/main/java/com/edafa/web2sms/dalayer/dao/interfaces/AccountSenderDaoLocal.java | 260527e268919b476f7779f1ba50ce3becff321b | [] | no_license | MahmoudFouadMohamed/WEB2SMS | 53246564d5c0098737222aa602955238e60338c2 | 1693b5a1749a7f1ebfa0fc4d15d1e3117759efc9 | refs/heads/master | 2020-05-17T01:49:23.308128 | 2019-04-25T19:37:06 | 2019-04-25T19:37:06 | 183,435,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package com.edafa.web2sms.dalayer.dao.interfaces;
import java.util.List;
import javax.ejb.Local;
import com.edafa.web2sms.dalayer.exception.DBException;
import com.edafa.web2sms.dalayer.model.AccountSender;
@Local
public interface AccountSenderDaoLocal {
void create(AccountSender sender) throws DBException;
void edit(AccountSender sender) throws DBException;
void remove(AccountSender sender) throws DBException;
AccountSender find(Object id) throws DBException;
List<AccountSender> findAll() throws DBException;
List<AccountSender> findRange(int[] range) throws DBException;
int count() throws DBException;
List<AccountSender> findByAccountId(String accountId) throws DBException;
// AccountSender findBySenderName(String sender) throws DBException;
void removeAllByAccountId(String acctId) throws DBException;
int CountByAccountId(String accountId) throws DBException;
// int CountBySenderName(String sender) throws DBException;
AccountSender findByAccountIdAndSenderName(String accountId, String sender) throws DBException;
}
| [
"mahmoud.fouad@edafa.com"
] | mahmoud.fouad@edafa.com |
7762ce9b525faace10262a100be37c7e000fbbf3 | 24d8cf871b092b2d60fc85d5320e1bc761a7cbe2 | /iText/rev2818-3988/left-trunk-3988/rups/com/lowagie/rups/view/itext/PagesTable.java | e8617dd83bd3a30346f262d029fb01903a0875cb | [] | no_license | joliebig/featurehouse_fstmerge_examples | af1b963537839d13e834f829cf51f8ad5e6ffe76 | 1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad | refs/heads/master | 2016-09-05T10:24:50.974902 | 2013-03-28T16:28:47 | 2013-03-28T16:28:47 | 9,080,611 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,075 | java |
package com.lowagie.rups.view.itext;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JTable;
import javax.swing.event.ListSelectionEvent;
import com.lowagie.rups.controller.PdfReaderController;
import com.lowagie.rups.model.ObjectLoader;
import com.lowagie.rups.model.TreeNodeFactory;
import com.lowagie.rups.view.PageNavigationListener;
import com.lowagie.rups.view.itext.treenodes.PdfObjectTreeNode;
import com.lowagie.rups.view.itext.treenodes.PdfPageTreeNode;
import com.lowagie.rups.view.itext.treenodes.PdfPagesTreeNode;
import com.lowagie.rups.view.itext.treenodes.PdfTrailerTreeNode;
import com.lowagie.rups.view.models.JTableAutoModel;
import com.lowagie.rups.view.models.JTableAutoModelInterface;
import com.lowagie.text.pdf.PdfName;
import com.lowagie.text.pdf.PdfPageLabels;
public class PagesTable extends JTable implements JTableAutoModelInterface, Observer {
protected ArrayList<PdfPageTreeNode> list = new ArrayList<PdfPageTreeNode>();
protected PdfReaderController controller;
protected PageNavigationListener listener;
public PagesTable(PdfReaderController controller, PageNavigationListener listener) {
this.controller = controller;
this.listener = listener;
}
public void update(Observable observable, Object obj) {
if (obj == null) {
list = new ArrayList<PdfPageTreeNode>();
repaint();
return;
}
if (obj instanceof ObjectLoader) {
ObjectLoader loader = (ObjectLoader)obj;
String[] pagelabels = PdfPageLabels.getPageLabels(loader.getReader());
int i = 0;
TreeNodeFactory factory = loader.getNodes();
PdfTrailerTreeNode trailer = controller.getPdfTree().getRoot();
PdfObjectTreeNode catalog = factory.getChildNode(trailer, PdfName.ROOT);
PdfPagesTreeNode pages = (PdfPagesTreeNode)factory.getChildNode(catalog, PdfName.PAGES);
if (pages == null) {
return;
}
Enumeration p = pages.depthFirstEnumeration();
PdfObjectTreeNode child;
StringBuffer buf;
while (p.hasMoreElements()) {
child = (PdfObjectTreeNode)p.nextElement();
if (child instanceof PdfPageTreeNode) {
buf = new StringBuffer("Page ");
buf.append(++i);
if (pagelabels != null) {
buf.append(" ( ");
buf.append(pagelabels[i - 1]);
buf.append(" )");
}
child.setUserObject(buf.toString());
list.add((PdfPageTreeNode)child);
}
}
}
setModel(new JTableAutoModel(this));
}
public int getColumnCount() {
return 2;
}
public int getRowCount() {
return list.size();
}
public Object getValueAt(int rowIndex, int columnIndex) {
if (getRowCount() == 0) return null;
switch (columnIndex) {
case 0:
return "Object " + list.get(rowIndex).getNumber();
case 1:
return list.get(rowIndex);
}
return null;
}
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return "Object";
case 1:
return "Page";
default:
return null;
}
}
@Override
public void valueChanged(ListSelectionEvent evt) {
if (evt != null)
super.valueChanged(evt);
if (controller == null)
return;
if (getRowCount() > 0) {
controller.selectNode(list.get(getSelectedRow()));
if (listener != null)
listener.gotoPage(getSelectedRow() + 1);
}
}
private static final long serialVersionUID = -6523261089453886508L;
} | [
"joliebig@fim.uni-passau.de"
] | joliebig@fim.uni-passau.de |
c07987f577c528127ff7209b35e5507e953e6246 | 46ceff72ebb088f092865af5195c096dbaaf81c5 | /src/Package1/Gamer.java | 75d3df35359e9056881aec33bc7d3c1afc21f5ad | [] | no_license | dominiklazarecki/Learn | 6a2e8c7c7fb688a8576519ae563257c0f423d853 | dd519e47b215d7e787f5e25468dcb836c935be12 | refs/heads/master | 2022-07-04T08:58:25.504298 | 2020-05-13T16:58:04 | 2020-05-13T16:58:04 | 255,932,532 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package Package1;
public class Gamer extends Player {
@Override
public void takeChoice(int choice) {
setChoice(choice);
}
@Override
public int getChoice() {
return super.getChoice();
}
}
| [
"dominik_lazarecki@wp.pl"
] | dominik_lazarecki@wp.pl |
f5769f6666bd614505487cac4facabee9b923f86 | f1f2a857e683d0f1f93f700e2b821c0a4b875a7f | /KajCarRentalService/test/BE/CreditCardTest.java | d102febc4f40444d86375f29915b80493fd9d091 | [] | no_license | kriahja/CarPeople | b8ff55a7ace6eec97960996ee7eb1d3f3173269b | 802042b2cb31aed70a82b8fb3821785eaf131fb7 | refs/heads/master | 2020-06-06T12:53:55.925479 | 2015-04-16T08:42:22 | 2015-04-16T08:42:22 | 32,870,267 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,129 | java | /*
* 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 BE;
import BE.CreditCard;
import org.junit.*;
import static org.junit.Assert.*;
/**
*
* @author notandi
*/
public class CreditCardTest
{
private CreditCard credit;
@Before
public void testSetUp()
{
credit = new CreditCard(1111, 2222, 920);
}
/**
* Test of getCardNumber method, of class CreditCard.
*/
@Test
public void testGetCardNumber()
{
System.out.println("testGetCardNumber()");
assertTrue("Credit number = 1111", credit.getCardNumber() == 1111);
}
/**
* Test of setCardNumber method, of class CreditCard.
*/
@Test
public void testSetCardNumber()
{
System.out.println("testSetCardNumber()");
credit.setCardNumber(2222);
assertTrue("CreditNr changed to 2222", credit.getCardNumber() == 2222);
}
/**
* Test of getRegNumber method, of class CreditCard.
*/
@Test
public void testGetRegNumber()
{
System.out.println("testGetRegNumber()");
assertTrue("RegNum == 2222", credit.getRegNumber() == 2222);
}
/**
* Test of setRegNumber method, of class CreditCard.
*/
@Test
public void testSetRegNumber()
{
System.out.println("testSetRegNumber()");
credit.setRegNumber(3333);
assertTrue("RegNum changed to 3333", credit.getRegNumber() == 3333);
}
/**
* Test of getExp method, of class CreditCard.
*/
@Test
public void testGetExp()
{
System.out.println("testGetExp()");
assertTrue("Exp == 920", credit.getExp() == 920);
}
/**
* Test of setExp method, of class CreditCard.
*/
@Test
public void testSetExp()
{
System.out.println("testSetExp()");
credit.setExp(919);
assertTrue("Exp changed to 919", credit.getExp() == 919);
}
}
| [
"kriahja@gmail.com"
] | kriahja@gmail.com |
22879a086c5d873c4fc455eab1caa98fe4448deb | d954670a214dc84a912d7a5942bc45164260cf49 | /src/main/java/org/apache/fop/render/RendererFactory.java | 415af037d2229c081de509bf1198d1808e02558c | [
"Apache-2.0"
] | permissive | nghinv/Apache-Fop | d1e6663ca2f9b76d3b3055cc0f2ac88907373c09 | 9d65e2a01cd344ccdc44b5ac176b07657a1bd8cd | refs/heads/master | 2020-06-28T03:06:01.795472 | 2014-04-21T19:23:34 | 2014-04-21T19:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,606 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id: RendererFactory.java 820672 2009-10-01 14:48:27Z jeremias $ */
package org.apache.fop.render;
import java.io.OutputStream;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.area.AreaTreeHandler;
import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.render.intermediate.AbstractIFDocumentHandlerMaker;
import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
import org.apache.fop.render.intermediate.IFRenderer;
import org.apache.xmlgraphics.util.Service;
/**
* Factory for FOEventHandlers and Renderers.
*/
@Slf4j
public class RendererFactory {
private final Map rendererMakerMapping = new java.util.HashMap();
private final Map eventHandlerMakerMapping = new java.util.HashMap();
private final Map documentHandlerMakerMapping = new java.util.HashMap();
private boolean rendererPreferred = false;
/**
* Main constructor.
*/
public RendererFactory() {
discoverRenderers();
discoverFOEventHandlers();
discoverDocumentHandlers();
}
/**
* Controls whether a {@link Renderer} is preferred over a
* {@link IFDocumentHandler} if both are available for the same MIME type.
*
* @param value
* true to prefer the {@link Renderer}, false to prefer the
* {@link IFDocumentHandler}.
*/
public void setRendererPreferred(final boolean value) {
this.rendererPreferred = value;
}
/**
* Indicates whether a {@link Renderer} is preferred over a
* {@link IFDocumentHandler} if both are available for the same MIME type.
*
* @return true if the {@link Renderer} is preferred, false if the
* {@link IFDocumentHandler} is preferred.
*/
public boolean isRendererPreferred() {
return this.rendererPreferred;
}
/**
* Add a new RendererMaker. If another maker has already been registered for
* a particular MIME type, this call overwrites the existing one.
*
* @param maker
* the RendererMaker
*/
public void addRendererMaker(final AbstractRendererMaker maker) {
final String[] mimes = maker.getSupportedMimeTypes();
for (final String mime : mimes) {
// This overrides any renderer previously set for a MIME type
if (this.rendererMakerMapping.get(mime) != null) {
log.trace("Overriding renderer for " + mime + " with "
+ maker.getClass().getName());
}
this.rendererMakerMapping.put(mime, maker);
}
}
/**
* Add a new FOEventHandlerMaker. If another maker has already been
* registered for a particular MIME type, this call overwrites the existing
* one.
*
* @param maker
* the FOEventHandlerMaker
*/
public void addFOEventHandlerMaker(final AbstractFOEventHandlerMaker maker) {
final String[] mimes = maker.getSupportedMimeTypes();
for (final String mime : mimes) {
// This overrides any event handler previously set for a MIME type
if (this.eventHandlerMakerMapping.get(mime) != null) {
log.trace("Overriding FOEventHandler for " + mime + " with "
+ maker.getClass().getName());
}
this.eventHandlerMakerMapping.put(mime, maker);
}
}
/**
* Add a new document handler maker. If another maker has already been
* registered for a particular MIME type, this call overwrites the existing
* one.
*
* @param maker
* the intermediate format document handler maker
*/
public void addDocumentHandlerMaker(
final AbstractIFDocumentHandlerMaker maker) {
final String[] mimes = maker.getSupportedMimeTypes();
for (final String mime : mimes) {
// This overrides any renderer previously set for a MIME type
if (this.documentHandlerMakerMapping.get(mime) != null) {
log.trace("Overriding document handler for " + mime + " with "
+ maker.getClass().getName());
}
this.documentHandlerMakerMapping.put(mime, maker);
}
}
/**
* Add a new RendererMaker. If another maker has already been registered for
* a particular MIME type, this call overwrites the existing one.
*
* @param className
* the fully qualified class name of the RendererMaker
*/
public void addRendererMaker(final String className) {
try {
final AbstractRendererMaker makerInstance = (AbstractRendererMaker) Class
.forName(className).newInstance();
addRendererMaker(makerInstance);
} catch (final ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " + className);
} catch (final InstantiationException e) {
throw new IllegalArgumentException("Could not instantiate "
+ className);
} catch (final IllegalAccessException e) {
throw new IllegalArgumentException("Could not access " + className);
} catch (final ClassCastException e) {
throw new IllegalArgumentException(className + " is not an "
+ AbstractRendererMaker.class.getName());
}
}
/**
* Add a new FOEventHandlerMaker. If another maker has already been
* registered for a particular MIME type, this call overwrites the existing
* one.
*
* @param className
* the fully qualified class name of the FOEventHandlerMaker
*/
public void addFOEventHandlerMaker(final String className) {
try {
final AbstractFOEventHandlerMaker makerInstance = (AbstractFOEventHandlerMaker) Class
.forName(className).newInstance();
addFOEventHandlerMaker(makerInstance);
} catch (final ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " + className);
} catch (final InstantiationException e) {
throw new IllegalArgumentException("Could not instantiate "
+ className);
} catch (final IllegalAccessException e) {
throw new IllegalArgumentException("Could not access " + className);
} catch (final ClassCastException e) {
throw new IllegalArgumentException(className + " is not an "
+ AbstractFOEventHandlerMaker.class.getName());
}
}
/**
* Add a new document handler maker. If another maker has already been
* registered for a particular MIME type, this call overwrites the existing
* one.
*
* @param className
* the fully qualified class name of the document handler maker
*/
public void addDocumentHandlerMaker(final String className) {
try {
final AbstractIFDocumentHandlerMaker makerInstance = (AbstractIFDocumentHandlerMaker) Class
.forName(className).newInstance();
addDocumentHandlerMaker(makerInstance);
} catch (final ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " + className);
} catch (final InstantiationException e) {
throw new IllegalArgumentException("Could not instantiate "
+ className);
} catch (final IllegalAccessException e) {
throw new IllegalArgumentException("Could not access " + className);
} catch (final ClassCastException e) {
throw new IllegalArgumentException(className + " is not an "
+ AbstractIFDocumentHandlerMaker.class.getName());
}
}
/**
* Returns a RendererMaker which handles the given MIME type.
*
* @param mime
* the requested output format
* @return the requested RendererMaker or null if none is available
*/
public AbstractRendererMaker getRendererMaker(final String mime) {
final AbstractRendererMaker maker = (AbstractRendererMaker) this.rendererMakerMapping
.get(mime);
return maker;
}
/**
* Returns a FOEventHandlerMaker which handles the given MIME type.
*
* @param mime
* the requested output format
* @return the requested FOEventHandlerMaker or null if none is available
*/
public AbstractFOEventHandlerMaker getFOEventHandlerMaker(final String mime) {
final AbstractFOEventHandlerMaker maker = (AbstractFOEventHandlerMaker) this.eventHandlerMakerMapping
.get(mime);
return maker;
}
/**
* Returns a RendererMaker which handles the given MIME type.
*
* @param mime
* the requested output format
* @return the requested RendererMaker or null if none is available
*/
public AbstractIFDocumentHandlerMaker getDocumentHandlerMaker(
final String mime) {
final AbstractIFDocumentHandlerMaker maker = (AbstractIFDocumentHandlerMaker) this.documentHandlerMakerMapping
.get(mime);
return maker;
}
/**
* Creates a Renderer object based on render-type desired
*
* @param userAgent
* the user agent for access to configuration
* @param outputFormat
* the MIME type of the output format to use (ex.
* "application/pdf").
* @return the new Renderer instance
* @throws FOPException
* if the renderer cannot be properly constructed
*/
public Renderer createRenderer(final FOUserAgent userAgent,
final String outputFormat) throws FOPException {
if (userAgent.getDocumentHandlerOverride() != null) {
return createRendererForDocumentHandler(userAgent
.getDocumentHandlerOverride());
} else if (userAgent.getRendererOverride() != null) {
return userAgent.getRendererOverride();
} else {
Renderer renderer;
if (isRendererPreferred()) {
// Try renderer first
renderer = tryRendererMaker(userAgent, outputFormat);
if (renderer == null) {
renderer = tryIFDocumentHandlerMaker(userAgent,
outputFormat);
}
} else {
// Try document handler first
renderer = tryIFDocumentHandlerMaker(userAgent, outputFormat);
if (renderer == null) {
renderer = tryRendererMaker(userAgent, outputFormat);
}
}
if (renderer == null) {
throw new UnsupportedOperationException(
"No renderer for the requested format available: "
+ outputFormat);
}
return renderer;
}
}
private Renderer tryIFDocumentHandlerMaker(final FOUserAgent userAgent,
final String outputFormat) throws FOPException {
final AbstractIFDocumentHandlerMaker documentHandlerMaker = getDocumentHandlerMaker(outputFormat);
if (documentHandlerMaker != null) {
final IFDocumentHandler documentHandler = createDocumentHandler(
userAgent, outputFormat);
return createRendererForDocumentHandler(documentHandler);
} else {
return null;
}
}
private Renderer tryRendererMaker(final FOUserAgent userAgent,
final String outputFormat) throws FOPException {
final AbstractRendererMaker maker = getRendererMaker(outputFormat);
if (maker != null) {
final Renderer rend = maker.makeRenderer(userAgent);
rend.setUserAgent(userAgent);
final RendererConfigurator configurator = maker
.getConfigurator(userAgent);
if (configurator != null) {
configurator.configure(rend);
}
return rend;
} else {
return null;
}
}
private Renderer createRendererForDocumentHandler(
final IFDocumentHandler documentHandler) {
final IFRenderer rend = new IFRenderer();
rend.setUserAgent(documentHandler.getContext().getUserAgent());
rend.setDocumentHandler(documentHandler);
return rend;
}
/**
* Creates FOEventHandler instances based on the desired output.
*
* @param userAgent
* the user agent for access to configuration
* @param outputFormat
* the MIME type of the output format to use (ex.
* "application/pdf").
* @param out
* the OutputStream where the output is written to (if
* applicable)
* @return the newly constructed FOEventHandler
* @throws FOPException
* if the FOEventHandler cannot be properly constructed
*/
public FOEventHandler createFOEventHandler(final FOUserAgent userAgent,
final String outputFormat, final OutputStream out)
throws FOPException {
if (userAgent.getFOEventHandlerOverride() != null) {
return userAgent.getFOEventHandlerOverride();
} else {
final AbstractFOEventHandlerMaker maker = getFOEventHandlerMaker(outputFormat);
if (maker != null) {
return maker.makeFOEventHandler(userAgent, out);
} else {
final AbstractRendererMaker rendMaker = getRendererMaker(outputFormat);
AbstractIFDocumentHandlerMaker documentHandlerMaker = null;
boolean outputStreamMissing = userAgent.getRendererOverride() == null
&& userAgent.getDocumentHandlerOverride() == null;
if (rendMaker == null) {
documentHandlerMaker = getDocumentHandlerMaker(outputFormat);
if (documentHandlerMaker != null) {
outputStreamMissing &= out == null
&& documentHandlerMaker.needsOutputStream();
}
} else {
outputStreamMissing &= out == null
&& rendMaker.needsOutputStream();
}
if (userAgent.getRendererOverride() != null
|| rendMaker != null
|| userAgent.getDocumentHandlerOverride() != null
|| documentHandlerMaker != null) {
if (outputStreamMissing) {
throw new FOPException("OutputStream has not been set");
}
// Found a Renderer so we need to construct an
// AreaTreeHandler.
return new AreaTreeHandler(userAgent, outputFormat, out);
} else {
throw new UnsupportedOperationException(
"Don't know how to handle \""
+ outputFormat
+ "\" as an output format."
+ " Neither an FOEventHandler, nor a Renderer could be found"
+ " for this output format.");
}
}
}
}
/**
* Creates a {@link IFDocumentHandler} object based on the desired output
* format.
*
* @param userAgent
* the user agent for access to configuration
* @param outputFormat
* the MIME type of the output format to use (ex.
* "application/pdf").
* @return the new {@link IFDocumentHandler} instance
* @throws FOPException
* if the document handler cannot be properly constructed
*/
public IFDocumentHandler createDocumentHandler(final FOUserAgent userAgent,
final String outputFormat) throws FOPException {
if (userAgent.getDocumentHandlerOverride() != null) {
return userAgent.getDocumentHandlerOverride();
}
final AbstractIFDocumentHandlerMaker maker = getDocumentHandlerMaker(outputFormat);
if (maker == null) {
throw new UnsupportedOperationException(
"No IF document handler for the requested format available: "
+ outputFormat);
}
final IFDocumentHandler documentHandler = maker
.makeIFDocumentHandler(userAgent);
final IFDocumentHandlerConfigurator configurator = documentHandler
.getConfigurator();
if (configurator != null) {
configurator.configure(documentHandler);
}
return documentHandler;
}
/**
* @return an array of all supported MIME types
*/
public String[] listSupportedMimeTypes() {
final List lst = new java.util.ArrayList();
Iterator iter = this.rendererMakerMapping.keySet().iterator();
while (iter.hasNext()) {
lst.add(iter.next());
}
iter = this.eventHandlerMakerMapping.keySet().iterator();
while (iter.hasNext()) {
lst.add(iter.next());
}
iter = this.documentHandlerMakerMapping.keySet().iterator();
while (iter.hasNext()) {
lst.add(iter.next());
}
Collections.sort(lst);
return (String[]) lst.toArray(new String[lst.size()]);
}
/**
* Discovers Renderer implementations through the classpath and dynamically
* registers them.
*/
private void discoverRenderers() {
// add mappings from available services
final Iterator providers = Service.providers(Renderer.class);
if (providers != null) {
while (providers.hasNext()) {
final AbstractRendererMaker maker = (AbstractRendererMaker) providers
.next();
try {
if (log.isDebugEnabled()) {
log.debug("Dynamically adding maker for Renderer: "
+ maker.getClass().getName());
}
addRendererMaker(maker);
} catch (final IllegalArgumentException e) {
log.error("Error while adding maker for Renderer", e);
}
}
}
}
/**
* Discovers FOEventHandler implementations through the classpath and
* dynamically registers them.
*/
private void discoverFOEventHandlers() {
// add mappings from available services
final Iterator providers = Service.providers(FOEventHandler.class);
if (providers != null) {
while (providers.hasNext()) {
final AbstractFOEventHandlerMaker maker = (AbstractFOEventHandlerMaker) providers
.next();
try {
if (log.isDebugEnabled()) {
log.debug("Dynamically adding maker for FOEventHandler: "
+ maker.getClass().getName());
}
addFOEventHandlerMaker(maker);
} catch (final IllegalArgumentException e) {
log.error("Error while adding maker for FOEventHandler", e);
}
}
}
}
/**
* Discovers {@link IFDocumentHandler} implementations through the classpath
* and dynamically registers them.
*/
private void discoverDocumentHandlers() {
// add mappings from available services
final Iterator providers = Service.providers(IFDocumentHandler.class);
if (providers != null) {
while (providers.hasNext()) {
final AbstractIFDocumentHandlerMaker maker = (AbstractIFDocumentHandlerMaker) providers
.next();
try {
if (log.isDebugEnabled()) {
log.debug("Dynamically adding maker for IFDocumentHandler: "
+ maker.getClass().getName());
}
addDocumentHandlerMaker(maker);
} catch (final IllegalArgumentException e) {
log.error("Error while adding maker for IFDocumentHandler",
e);
}
}
}
}
}
| [
"guillaume.rodrigues@gmail.com"
] | guillaume.rodrigues@gmail.com |
cdeb4432162a461574fe9d2bd37dc9ce5035676f | 3e689131366e5cef6fe2e776f8099fd611481e3b | /02NIO/topic5/HttpServer01.java | 751e7139d51c3d46925eb985196cebce345cd06e | [] | no_license | tirion510/javaHomework | 5255aa562ef6dfd3ae1d85add45a8d505f1f3ee4 | fdb3b3b5ea7acac246d720c4211a34b784183e0a | refs/heads/main | 2023-08-17T06:50:05.683262 | 2021-10-14T03:34:47 | 2021-10-14T03:34:47 | 380,463,403 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | import java.io.IOException;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
// 单线程的socket程序
public class HttpServer01 {
public static void main(String[] args) throws IOException{
ServerSocket serverSocket = new ServerSocket(8801);
while (true) {
try {
Socket socket = serverSocket.accept();
service(socket);
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void service(Socket socket) {
try {
PrintWriter printWriter = new PrintWriter(socket.getOutputStream(), true);
printWriter.println("HTTP/1.1 200 OK");
printWriter.println("Content-Type:text/html;charset=utf-8");
String body = "hello,nio1";
printWriter.println("Content-Length:" + body.getBytes().length);
printWriter.println();
printWriter.write(body);
printWriter.close();
Thread.sleep(1000);
socket.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} | [
"tirion.yy@alibaba-inc.com"
] | tirion.yy@alibaba-inc.com |
99e8eab9f03fc75b8f5707884c7c54066affabef | d42deb267860f0c6a13745a96f5704e3739a3352 | /src/main/java/com/henrique/pojo/Item.java | ddae6b1cce33f08c9685b197b675a34fa6263ff9 | [] | no_license | henriquevergara/apache-camel-with-spring-boot | 648bd94dd595c2dac9d70498e41e594082b0e33f | cdbef394743690b943326a820a85c95a5c65c1bf | refs/heads/master | 2023-02-12T21:42:32.248939 | 2021-01-18T17:40:17 | 2021-01-18T17:40:17 | 329,930,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | package com.henrique.pojo;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
public class Item {
@JacksonXmlProperty(localName = "formato")
private String formato;
@JacksonXmlProperty(localName = "quantidade")
private String quantidade;
@JacksonXmlProperty(localName = "livro")
private Livro livro;
public String getFormato() {
return formato;
}
public void setFormato(String formato) {
this.formato = formato;
}
public String getQuantidade() {
return quantidade;
}
public void setQuantidade(String quantidade) {
this.quantidade = quantidade;
}
public Item() {
super();
}
}
| [
"henrique.vergara.hv@gmail.com"
] | henrique.vergara.hv@gmail.com |
599063f3ee1323b82b6d8c6ee60d506c46d3da7a | 14fa6e5827cf6555d7f58a2336d9c439e0a4bbdf | /src/main/java/fi/hut/cs/treelib/internal/TreeOperations.java | 73a5f841fc758b5fc2a3ac782d381936bddd1af9 | [] | no_license | thaapasa/treelib | cb3e5e090a02d9228763f16be74dd285ffd80e84 | 20ff50053c2faf9fb040733eeab0d3c41cc16dbe | refs/heads/master | 2022-11-13T08:41:51.445693 | 2020-06-23T12:11:35 | 2020-06-23T12:11:35 | 274,396,273 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,292 | java | package fi.hut.cs.treelib.internal;
import fi.hut.cs.treelib.Key;
import fi.hut.cs.treelib.Owner;
import fi.hut.cs.treelib.Page;
import fi.hut.cs.treelib.PageID;
import fi.hut.cs.treelib.PageValue;
import fi.hut.cs.treelib.Transaction;
import fi.hut.cs.treelib.common.PagePath;
public interface TreeOperations<K extends Key<K>, V extends PageValue<?>, P extends Page<K, V>> {
/**
* Finds a path of pages from the given root page to the corresponding
* leaf page at the given version.
*
* Path will have all pages fixed (once by this operation) to the page
* buffer. Release after use by calling unfixPath(path).
*/
void findPathToLeafPage(PageID rootPageID, K key, PagePath<K, V, P> path, int version,
Owner owner);
PagePath<K, V, P> validatePathToLeafPage(PageID rootPageID, K key, PagePath<K, V, P> path,
Transaction<K, V> tx);
PagePath<K, V, P> findPathForInsert(PageID rootPageID, K key, PagePath<K, V, P> path,
Transaction<K, V> tx);
/**
* Inserts a value with the given key to a page that has been located and
* is at the end of the page path. Will split the page (and possibly other
* pages higher in the path) if required.
*
* @param path the path ending at the leaf page where the key-value-pair
* is to be inserted
* @return true on success; false on failure. Fails on certain trees if,
* for example, an attempt is made to insert a duplicate key.
*/
boolean insert(PagePath<K, V, P> path, K key, V value, Transaction<K, V> tx);
/**
* Split the page at the end of the path (it is assumed to be full at this
* point).
*
* The path is corrected to contain the new page (whose key range contains
* the given key)
*
* @param checkUnderflowAfterSplit true to check for underflow after split
* (relevant at least in MVBT). Set to false if the caller will check
* underflow conditions after the split.
* @param childID can be null, but when set, the operation path must
* contain the parent page that contains the child page ID (favored over
* the key)
*/
void split(PagePath<K, V, P> path, K key, PageID childID, boolean checkUnderflowAfterSplit,
Transaction<K, V> tx);
}
| [
"tuukka.haapasalo@gmail.com"
] | tuukka.haapasalo@gmail.com |
e1a850f3cee24fe1b0db8466b12e50406b9e3cf1 | 62694463e927d89778a71f76cf46c6353c42ec26 | /src/main/java/kumsher/ryan/finra/domain/util/JSR310DateTimeSerializer.java | db678ac0567500015ed0c46e097935a9e4c838f5 | [] | no_license | RKumsher/finra-assignment | 97f8c8d763483ea24bd45f036345d09ac247d383 | 9835a42716c0e757b4991fd045eed1dfad7c0f62 | refs/heads/master | 2021-07-25T17:26:02.053703 | 2017-11-07T22:28:54 | 2017-11-07T22:28:54 | 109,897,501 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 916 | java | package kumsher.ryan.finra.domain.util;
import java.io.IOException;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
public final class JSR310DateTimeSerializer extends JsonSerializer<TemporalAccessor> {
private static final DateTimeFormatter ISOFormatter =
DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Z"));
public static final JSR310DateTimeSerializer INSTANCE = new JSR310DateTimeSerializer();
private JSR310DateTimeSerializer() {}
@Override
public void serialize(TemporalAccessor value, JsonGenerator generator, SerializerProvider serializerProvider) throws IOException {
generator.writeString(ISOFormatter.format(value));
}
}
| [
"RKumsher@5amsolutions.com"
] | RKumsher@5amsolutions.com |
278f07c0b79d55e41e154efcc85e3c6fba43f230 | 8188882c4e50d0a0662c9b264599b938380cbe57 | /src/appfilachar/FilaChar.java | bc82b44da2f0b157d8c3656443aae507a74734c8 | [] | no_license | FabianoBFCarvalho/Project-AppFila | d01412b5bb51fdacdd0fcf92baf78d7561d41433 | 5861dfcdd69df3ffeeb280a89b3e2d7786d3ac25 | refs/heads/master | 2023-03-21T17:09:35.414669 | 2020-03-08T21:43:06 | 2020-03-08T21:43:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,756 | java | /*
* 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 appfilachar;
public class FilaChar {
private int quantidade;
private char fila[];
//Constructor
public FilaChar(int tamanho) {
fila = new char [tamanho];
quantidade = 0;
}
//Metodo para verificar se está vazio
public boolean isEmpty() {
return quantidade==0;
}
//Metodo para verificar se está cheio
public boolean isFull() {
return quantidade==fila.length;
}
//Meotodo para verificar o tamanho
public int size() {
return quantidade;
}
//Metodo para verificar o valor que está a frente
public char front() {
return isEmpty() ? ' ' : fila[0] ;
}
//Metodo para Inserir
public boolean enqueue(char valor) {
if (!isFull()) {
fila[quantidade++]=valor;
return true;
} else {
return false;
}
}
//Metodo para remover
public char dequeue() {
char temp = fila[0];
if (!isEmpty()) {
for (int i=0;i<=quantidade;i++) {
fila[i]=fila[i+1];
}
quantidade--;
return temp;
} else {
return ' ';
}
}
//Metodo para imprimir
public String printFila() {
String printFila = "";
for (int i = 0; i < fila.length; i++) {
printFila += (i<quantidade-1) ? fila[i] + ", " : fila[i];
}
return printFila;
}
}
| [
"johnnybravo.jc@hotmail.com"
] | johnnybravo.jc@hotmail.com |
3b089095b6ba63671834733ce90afeb4d0c5a874 | bbc0af3e50c6235d72a7bc17fe2a6e4e21336dab | /app/src/main/java/com/signoperu/mynewapp/Main3Activity.java | f5c0c131e897c1dc8b4fabfbda74d3f283fd5fa2 | [] | no_license | mikezarathustra/myNewApp | 3860effea86058e26923d35b12031a40e1843e64 | 9c8d7482c81a712e6de114138d3e5cb60fcd893b | refs/heads/master | 2020-03-22T02:04:18.665596 | 2018-07-01T16:54:47 | 2018-07-01T16:54:47 | 139,347,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,828 | java | package com.signoperu.mynewapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
public class Main3Activity extends AppCompatActivity {
Button miboton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);
miboton=findViewById(R.id.button3);
miboton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent abrir4 = new Intent(getApplicationContext(),Main4Activity.class);
startActivity(abrir4);
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.opcion1:
Intent v1 = new Intent(this, MainActivity.class);
startActivity(v1);
return true;
case R.id.opcion2:
Intent v2 = new Intent(this, MainActivity.class);
startActivity(v2);
return true;
case R.id.opcion3:
Intent v3 = new Intent(this, MainActivity.class);
startActivity(v3);
return true;
case R.id.opcion4:
Intent v4 = new Intent(this, MainActivity.class);
startActivity(v4);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public boolean onCreateOptionsMenu(Menu m) {
getMenuInflater().inflate(R.menu.menu_uno,m);
return true;
}
}
| [
"mikemunoz@yahoo.com"
] | mikemunoz@yahoo.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.