blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
689M
⌀ | 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 131
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 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f13257f34359c8b41dc783177c1e8274547bf53e | f07946e772638403c47cc3e865fd8a5e976c0ce6 | /leetcode_java/src/1375.bulb-switcher-iii.java | 2d424073a9e43ba53ad5897df3582bc873201d3e | [] | no_license | yuan-fei/Coding | 2faf4f87c72694d56ac082778cfc81c6ff8ec793 | 2c64b53c5ec1926002d6e4236c4a41a676aa9472 | refs/heads/master | 2023-07-23T07:32:33.776398 | 2023-07-21T15:34:25 | 2023-07-21T15:34:25 | 113,255,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,273 | java | /*
* @lc app=leetcode id=1375 lang=java
*
* [1375] Bulb Switcher III
*
* https://leetcode.com/problems/bulb-switcher-iii/description/
*
* algorithms
* Medium (58.84%)
* Likes: 74
* Dislikes: 9
* Total Accepted: 7.5K
* Total Submissions: 12.7K
* Testcase Example: '[2,1,3,5,4]'
*
* There is a room with n bulbs, numbered from 1 to n, arranged in a row from
* left to right. Initially, all the bulbs are turned off.
*
* At moment k (for k from 0 to n - 1), we turn on the light[k] bulb. A bulb
* change color to blue only if it is on and all the previous bulbs (to the
* left) are turned on too.
*
* Return the number of moments in which all turned on bulbs are blue.
*
*
* Example 1:
*
*
*
*
* Input: light = [2,1,3,5,4]
* Output: 3
* Explanation: All bulbs turned on, are blue at the moment 1, 2 and 4.
*
*
* Example 2:
*
*
* Input: light = [3,2,4,1,5]
* Output: 2
* Explanation: All bulbs turned on, are blue at the moment 3, and 4
* (index-0).
*
*
* Example 3:
*
*
* Input: light = [4,1,2,3]
* Output: 1
* Explanation: All bulbs turned on, are blue at the moment 3 (index-0).
* Bulb 4th changes to blue at the moment 3.
*
*
* Example 4:
*
*
* Input: light = [2,1,4,3,6,5]
* Output: 3
*
*
* Example 5:
*
*
* Input: light = [1,2,3,4,5,6]
* Output: 6
*
*
*
* Constraints:
*
*
* n == light.length
* 1 <= n <= 5 * 10^4
* light is a permutation of [1, 2, ..., n]
*
*
*/
// @lc code=start
class Solution {
public int numTimesAllBlue(int[] light) {
TreeSet<int[]> ts = new TreeSet<>((a, b)->Integer.compare(a[0], b[0]));
int cnt = 0;
for (int l : light) {
int[] cur = new int[]{l, l};
int[] higher = ts.higher(cur);
int[] lower = ts.lower(cur);
if(higher != null){
if(cur[1] == higher[0] - 1){
ts.remove(higher);
cur[1] = higher[1];
}
}
if(lower != null){
if(cur[0] == lower[1] + 1){
ts.remove(lower);
cur[0] = lower[0];
}
}
ts.add(cur);
if(ts.size() == 1 && ts.first()[0] == 1){
cnt++;
}
}
return cnt;
}
}
// @lc code=end
| [
"[email protected]"
] | |
984e81b42b0ce461fce69a2084ab4d81c7d0161c | ddb0f39444d9706ede108300a2ef168f86fa0b1d | /src/main/java/lab3/FlightStats.java | 8e13ba9eaf69223941dacee2039ecbfa1ca6bb71 | [] | no_license | SalemDrk/PADP | c21887288b89d1fe1f4404da4b3c2652a978bb08 | 9ad29ca8b11ac38cbe0bf9899f897f45392cedde | refs/heads/main | 2023-02-03T05:01:29.118240 | 2020-12-18T13:00:50 | 2020-12-18T13:00:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,991 | java | package lab3;
import scala.Tuple2;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
public class FlightStats implements Serializable {
private long originID, arrivalID;
private float maxDelayedFlight, perDelay, perCancelled;
private String originPortName, arrivalPortName;
private static final String NULL_DELAY = "0.00";
public static FlightStats CountStats(Iterator<String> delays){
int cancelledFlights = 0;
int delayedFlights = 0;
int generalCountFlights = 0;
float maxDelayedFlight = 0;
while (delays.hasNext()){
String delay = delays.next();
generalCountFlights++;
if (delay.isEmpty()){
cancelledFlights++;
} else if (!delay.equals(NULL_DELAY)){
delayedFlights++;
if (Float.parseFloat(delay) > maxDelayedFlight){
maxDelayedFlight = Float.parseFloat(delay);
}
}
}
float perDelay = (float)delayedFlights*100/generalCountFlights;
float perCancelled = (float)cancelledFlights*100/generalCountFlights;
return new FlightStats(maxDelayedFlight, perDelay, perCancelled);
}
private FlightStats(float maxDelayedFlight, float perDelay, float perCancelled) {
this.maxDelayedFlight = maxDelayedFlight;
this.perDelay = perDelay;
this.perCancelled = perCancelled;
}
public FlightStats formFinalStats(Map<Long, String> portNames, Tuple2<Long, Long> portIDs){
originID = portIDs._1;
arrivalID = portIDs._2;
originPortName = portNames.get(originID);
arrivalPortName = portNames.get(arrivalID);
return this;
}
@Override
public String toString() {
return originPortName + ", " + arrivalPortName + ", " + "Max: " + maxDelayedFlight + ", " +
"Delayed: " + perDelay + "%, " + "Cancelled: " + perCancelled + "%.";
}
}
| [
"[email protected]"
] | |
bc2d9688b30e840a695eac76ebe828d0f5fe4b39 | 31a2fa1bec7a08179e2cb0ce617755f0d13c8caa | /src/LinkHashSetDemo.java | 192a3376101877ff61d296f3577e99f8c403eb7b | [] | no_license | NinhThiLien/Collection | d32a72bedf11dbabde7d8e34c7a88564b3cf931c | 13fe897d1dc1c4dfa01cef36e8fd9b9e7e49c0d2 | refs/heads/master | 2021-05-16T05:47:20.080730 | 2017-09-12T05:28:25 | 2017-09-12T05:28:25 | 103,239,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,339 | java | import java.util.*;
public class LinkHashSetDemo {
public static void main(String[] args) {
LinkedHashMap<Integer,String> lhm = new LinkedHashMap<Integer,String>();
lhm.put(104,"Hieu");
lhm.put(101,"Luyen");
lhm.put(102,"KA");
lhm.put(103,"VA");
for(Map.Entry m: lhm.entrySet()){
System.out.println(m.getKey()+" "+m.getValue());
}
lhm.remove(103);
System.out.println("After:" );
for(Map.Entry m: lhm.entrySet()){
System.out.println(m.getKey()+" "+m.getValue());
}
//-------------------------Test voi class Book
Map<Integer,Book> map1 = new LinkedHashMap<Integer,Book>();
//Creating Books
Book b1 = new Book(100,"Ti va Quay","abc","fjs",8);
Book b2 = new Book(200,"Conan","sasrd","ada",95);
Book b3 = new Book(301, "doraemon",",nkojjb","jafjs",40);
//Adding Book to map
map1.put(2,b1);
map1.put(4,b3);
map1.put(3,b2);
//traversing map
for(Map.Entry<Integer,Book> entry : map1.entrySet()){
int key = entry.getKey();
Book b = entry.getValue();
System.out.println(key+ "Details:");
System.out.println(b.id+" "+b.name+" "+b.author+" "+b.publisher+" "+b.quantity);
}
}
}
| [
"[email protected]"
] | |
c091a205d4b59e009e51653b9ca8a0a878e15101 | 5830049ed5010a589bf85c840ec52924b973b9bb | /app/src/main/java/com/wzlab/smartcity/activity/account/AccountActivity.java | 11e266826bae6651865282ca02839345a0f4873b | [] | no_license | zwangZJU/SmartCity | 6062bb668128d7c94f70661bfb57629fb6958eda | d60459155da10b663e7e96789046390060a10593 | refs/heads/master | 2020-03-19T11:12:05.201501 | 2018-09-26T10:52:41 | 2018-09-26T10:52:41 | 136,438,731 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,543 | java | package com.wzlab.smartcity.activity.account;
import android.annotation.SuppressLint;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import com.wzlab.smartcity.R;
public class AccountActivity extends AppCompatActivity {
private boolean isExit = false; //按两次退出
private static int ACTION_EXIT = -1;
@SuppressLint("HandlerLeak")
private Handler handler=new Handler(){
public void handleMessage(Message msg) {
if (msg.what == ACTION_EXIT){
isExit = false;
}
}
};
private LoginFragment loginFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
//Make the status bar transparent
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//Make the Navigation bar transparent
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
setContentView(R.layout.activity_account);
loginFragment = new LoginFragment();
getFragmentManager().beginTransaction().add(R.id.fl_account_container, loginFragment).commitAllowingStateLoss();
}
/*
点击两次返回才退出程序
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
exit();
return false;
}
return super.onKeyDown(keyCode, event);
}
private void exit() {
if (!isExit) {
if( getFragmentManager().findFragmentById(R.id.fl_account_container) == loginFragment){
isExit = true;
Toast.makeText(getApplicationContext(), "再按一次退出程序",
Toast.LENGTH_SHORT).show();
} else{
getFragmentManager().popBackStack();
}
// 利用handler延迟发送更改状态信息
handler.sendEmptyMessageDelayed(ACTION_EXIT, 2000);
} else {
finish();
System.exit(0);
}
}
}
| [
"[email protected]"
] | |
c3082fe68da01a88e7ffd8e88cedac086306c211 | e32301927e6a7c06fc5805fa726dfa4a051b906f | /im-base-common/src/main/java/com/lcy/common/constant/Constant.java | dcf720842d938ac3c9b13bc935c27d8fbfd50192 | [] | no_license | qq2597126/im | 1e2f87985022104f2d9fb62c27ed10a91fc99e9e | 1ab15081f3f9015974327e4c4855dfea25b70fee | refs/heads/main | 2023-01-06T17:14:59.477123 | 2020-11-04T09:24:36 | 2020-11-04T09:24:36 | 303,305,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,078 | java | package com.lcy.common.constant;
import io.netty.util.AttributeKey;
/**
* @author lcy
* @DESC:
* @date 2020/9/4.
*/
public final class Constant {
/**
* 编解码
*/
public final static class MessageCodecConstants{
/**
* 魔数,可以通过配置获取
*/
public static final short MAGIC_CODE = 0x86;
/**
* 版本号
*/
public static final short VERSION_CODE = 0x01;
}
public final static class ImServerConstants{
public static final AttributeKey<String> CHANNEL_NAME=
AttributeKey.valueOf("CHANNEL_NAME");
// 服务器节点的相关信息
public static final String MANAGE_PATH = "/im/nodes";
//服务器节点
public static final String PATH_PREFIX = MANAGE_PATH + "/seq-";
//统计用户数
public static final String WEB_URL = "http://localhost:8080";
}
public final static class RedisConstants{
public static final String REDIS_ONLINE_COUNTER = "onlineCounter";
}
}
| [
"[email protected]"
] | |
91c9847119f69e76aa8be8822720b3e04d4b9603 | 90b2d133a5cedc9758d3dac8a50e3747c59a2f6a | /draco/src/java/game/com/game/draco/app/pet/UserPetApp.java | 7b9dfd5e7d102bad9f88cd0b063003dbc457ebcf | [] | no_license | brandonlamb/game-server-mmorpg | 890f191b727b760e018bcf173c54978b1d4e50a8 | 50f869a180b2333db35801a827ab99634dd8217b | refs/heads/master | 2020-05-15T20:58:14.830098 | 2017-03-27T09:44:40 | 2017-03-27T09:44:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,459 | java | package com.game.draco.app.pet;
import java.util.Map;
import com.game.draco.app.pet.domain.RolePet;
import com.game.draco.app.pet.domain.RolePetStatus;
public interface UserPetApp {
public void addRolePet(String roleId, RolePet rolePet);// 增加宠物(不入库)
public void insertRolePet(RolePet rolePet);// 增加宠物(入库)
public Map<Integer, RolePet> getAllRolePet(String roleId);// 获得所有的宠物
public void removeAllRolePet(String roleId);// 移除所有的宠物
public RolePet getRolePet(String roleId, int petId);// 获得宠物对象
public RolePet getOnBattleRolePet(String roleId);// 获得出战宠物对象
public void addRolePetStatus(String roleId, RolePetStatus status);// 增加状态
public void removeRolePetStatus(String roleId);// 移除状态
public void setOnBattleRolePet(String roleId, RolePet offBattlePet, RolePet onBattlePet);// 更改出战宠物
public void petOffBattle(String roleId);// 宠物休息
public RolePetStatus getRolePetStatus(String roleId);// 获得状态
public boolean isOnBattle(String roleId, int petId);// 是否出战
public void rolePetUpdate(String roleId, RolePet rolePet);// 修改宠物信息(入库)
public void removeRolePet(String roleId, int petId);// 删除宠物(不入库)
public void cleanRolePetDate(String roleId);// 下线清楚数据
public void deleteRolePet(String roleId, int petId);// 删除宠物(入库)
}
| [
"[email protected]"
] | |
df291f349870a37c0ac74252d2f867fb546e5d0b | 0b4844d550c8e77cd93940e4a1d8b06d0fbeabf7 | /JavaSource/dream/work/pm/std/service/LovStdPointListService.java | 37c94a51dc9dc1029ab0766be0a652a26e7fc1d6 | [] | no_license | eMainTec-DREAM/DREAM | bbf928b5c50dd416e1d45db3722f6c9e35d8973c | 05e3ea85f9adb6ad6cbe02f4af44d941400a1620 | refs/heads/master | 2020-12-22T20:44:44.387788 | 2020-01-29T06:47:47 | 2020-01-29T06:47:47 | 236,912,749 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 774 | java | package dream.work.pm.std.service;
import java.util.List;
import common.bean.User;
import dream.work.pm.std.dto.LovStdPointListDTO;
/**
* 표준항목선택 Service
* @author ssong
* @version $Id:$
* @since 1.0
*
*/
public interface LovStdPointListService
{
/**
* 거래처검색
* @author ssong
* @version $Id:$
* @since 1.0
*
* @param LovStdPointListDTO
* @param loginUser
* @return
*/
List findStdPointList(LovStdPointListDTO lovStdPointListDTO, User loginUser);
/**
* Input the selected point
* @param deleteRows
* @param user
* @param lovStdPointListDTO
*/
void inputStdPoint(String[] deleteRows, User user, LovStdPointListDTO lovStdPointListDTO);
} | [
"[email protected]"
] | |
8c891a82f8fd5a606ab95103d20cb74276e3ef8e | 5e54a931d63c19d4fc97ad96e262e69aacf23c2e | /src/main/java/com/lechebang/model/SaveCarModel.java | 2174c14e2b76633b6d6908f11127ff6182482792 | [] | no_license | snamper/lcb | 223b67ad73e122b94d23628213906f187a51146c | 3821d4ddc7ba77a79be0ff04b22dd7b57aa6ab5a | refs/heads/master | 2020-05-16T04:23:45.691408 | 2017-03-06T02:32:02 | 2017-03-06T02:32:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | package com.lechebang.model;
/**
* Created by Administrator on 2017/3/2.
*/
public class SaveCarModel {
private int costTime;
private String msg;
private SaveCar result=new SaveCar();
private String resultCode;
private String statusCode;
private Object validationErrors;
public int getCostTime() {
return costTime;
}
public void setCostTime(int costTime) {
this.costTime = costTime;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public SaveCar getResult() {
return result;
}
public void setResult(SaveCar result) {
this.result = result;
}
public String getResultCode() {
return resultCode;
}
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public Object getValidationErrors() {
return validationErrors;
}
public void setValidationErrors(Object validationErrors) {
this.validationErrors = validationErrors;
}
}
| [
"[email protected]"
] | |
2513ea9fa6155be5f99f1936c5610aab52ac8ac0 | 97790a55fc53c32110efaafc5756573e29716e44 | /eforceconfig-core/src/main/java/com/google/code/eforceconfig/ConfigValueTable.java | 9e790aac180fc42b379e339d164b84207c32af04 | [] | no_license | debrando/eforceconfig | 83964d5a0ac62b0abee5eaf67b13fbbe0187656d | 4443c379cebb9ae9b59560f58e75f05ed565b875 | refs/heads/master | 2021-01-10T11:51:31.713698 | 2011-02-01T19:12:57 | 2011-02-01T19:12:57 | 49,513,956 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package com.google.code.eforceconfig;
import java.util.Hashtable;
public class ConfigValueTable extends Hashtable
{
}
| [
"Andrea.Gariboldi@8797f1b1-c6c7-ddcb-aba0-cce677c8d905"
] | Andrea.Gariboldi@8797f1b1-c6c7-ddcb-aba0-cce677c8d905 |
cb0e0aea34abf5653776848ddce3170bf4accc10 | a2655159c8dd9a225ba1ed940a675c51a7658697 | /PAF/src/com/hari/controller/LoginController.java | 044373173da0c173aabae3e8aec8dad1636ecfc9 | [] | no_license | HariharanMiracle/3rd-year-1st-Semenster-PAF-codes | de7fff56cc37e8cf38eeb6c51ad05757e637b7ab | 6ecebe71d5303536b5904ae18359ea83eb4e43fb | refs/heads/master | 2022-12-22T08:23:52.938780 | 2019-05-26T04:12:09 | 2019-05-26T04:12:09 | 188,584,590 | 2 | 0 | null | 2022-12-16T12:12:55 | 2019-05-25T15:46:33 | JavaScript | UTF-8 | Java | false | false | 2,770 | java | package com.hari.controller;
import java.io.IOException;
import java.sql.Connection;
import javax.swing.text.Document;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.hari.dao.*;
import com.hari.model.Member;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@RestController
@RequestMapping("/Login")
public class LoginController implements LoginControllerImpl {
private Connection con = null;
MemberDao dao;
Member mem;
@Override
@RequestMapping(value = "/validate", method = RequestMethod.POST)
public void login(@RequestParam("un") String name, @RequestParam("pw") String password, HttpServletRequest request, HttpServletResponse response) {
String msg = "";
String url = "";
try(ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml")) {
dao=(MemberDao)ctx.getBean("mdao");
Member mem = dao.loginValidate(name, password);
if ((mem == null) || !password.equals(mem.getPassword())) {
msg = "Login invalid";
url = "http://localhost:8081/PAF/logReg.jsp?msg="+msg;
redirect(url, request, response);
}
else {
HttpSession session=request.getSession();
session.setAttribute("member",mem);
String state = mem.getType();
System.out.println(mem.getType());
if(state.equals("Buyer")) {
url = "http://localhost:8081/PAF/Home.jsp";
redirect(url, request, response);
}
else {
url = "http://localhost:8081/PAF/HomeSeller.jsp";
redirect(url, request, response);
}
}
}
catch (Exception e) {
msg = "Something went wrong";
url = "http://localhost:8081/PAF/logReg.jsp?msg="+msg;
System.out.println("Error: " + e);
}
}
@Override
@RequestMapping(value = "/redirect", method = RequestMethod.POST)
public void redirect(String url, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
try{
response.sendRedirect(url);
}
catch (Exception e) {
// TODO: handle exception
//response.sendRedirect("http://localhost:8081/PAF/logReg.jsp");
System.out.println("Failed");
}
}
}
| [
"[email protected]"
] | |
2a3b35470da2d8cf9aac0cab330020b2741a1b87 | 7d5168f187f9264b0ad05c543450dd78ba96ef0b | /learn-zookeeper/dubbo-consumer/src/main/java/com/wll/test/zookeeper/web/HomeController.java | 17e9bf63741bae194356b9eb5adf37418d9de311 | [] | no_license | wlily/learn-distribute | a39b307c67a474c140a076c0c3507f77cf6aacde | 8852fdd70409a25a7e8ffac1e4ffc8f7e29a5c86 | refs/heads/master | 2020-06-18T15:38:40.104494 | 2017-08-31T00:41:17 | 2017-08-31T00:41:17 | 94,168,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | package com.wll.test.zookeeper.web;
import com.wll.test.zookeeper.service.IProduct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.Locale;
/**
* Created by wll on 17-7-11.
*/
@Controller
//@RequestMapping(value = "/")
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
@Autowired
private IProduct productService;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
String productName=this.productService.getProductName();
model.addAttribute("name", productName);
// model.addAttribute("name", "haha");
return "home";
}
} | [
"[email protected]"
] | |
2249be67e928e43be2d0209316d0149450394953 | 521633be8207344502e665447251982d7f6aaad7 | /src/main/java/io/github/incplusplus/bigtoolbox/network/interop/lin/nm/org/freedesktop/networkmanager/types/NMManagerReloadFlags.java | 6257baeb5eea45793b4b6993b438c5f426163950 | [
"Apache-2.0"
] | permissive | IncPlusPlus/bigtoolbox-network | 6c725a6ac2aa82f9bd84a5daea36a13071a3a163 | 9c431a7c9d2c1b00207260502b6e4d87022ec8ef | refs/heads/master | 2021-08-03T00:28:16.047875 | 2020-10-03T22:52:14 | 2020-10-03T22:52:14 | 210,644,178 | 1 | 1 | Apache-2.0 | 2021-07-21T03:04:09 | 2019-09-24T16:04:44 | Java | UTF-8 | Java | false | false | 1,804 | java | package io.github.incplusplus.bigtoolbox.network.interop.lin.nm.org.freedesktop.networkmanager.types;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.freedesktop.dbus.types.UInt32;
/** Flags for the manager Reload() call. */
public enum NMManagerReloadFlags {
/**
* an alias for numeric zero, no flags set. This reloads everything that is supported and is
* identical to a SIGHUP.
*/
NM_MANAGER_RELOAD_FLAG_NONE(0),
/**
* reload the NetworkManager.conf configuration from disk. Note that this does not include
* connections, which can be reloaded via Setting's ReloadConnections().
*/
NM_MANAGER_RELOAD_FLAG_CONF(1),
/** update DNS configuration, which usually involves writing /etc/resolv.conf anew. */
NM_MANAGER_RELOAD_FLAG_DNS_RC(2),
/**
* means to restart the DNS plugin. This is for example useful when using dnsmasq plugin, which
* uses additional configuration in /etc/NetworkManager/dnsmasq.d. If you edit those files, you
* can restart the DNS plugin. This action shortly interrupts name resolution.
*/
NM_MANAGER_RELOAD_FLAG_DNS_FULL(4),
/** all flags. */
NM_MANAGER_RELOAD_FLAG_ALL(7);
private static final Map<UInt32, NMManagerReloadFlags> NM_MANAGER_RELOAD_FLAGS_MAP;
static {
NM_MANAGER_RELOAD_FLAGS_MAP =
Arrays.stream(NMManagerReloadFlags.values())
.collect(Collectors.toMap(NMManagerReloadFlags::getValue, Function.identity()));
}
private final UInt32 value;
NMManagerReloadFlags(int i) {
this.value = new UInt32(i);
}
public static NMManagerReloadFlags getNMManagerReloadFlags(UInt32 uInt32) {
return NM_MANAGER_RELOAD_FLAGS_MAP.get(uInt32);
}
public UInt32 getValue() {
return value;
}
}
| [
"[email protected]"
] | |
8320f2bd08921f5a5abd00f2f76e89c06343cb2c | a52b1d91a5a2984591df9b2f03b1014c263ee8ab | /net/minecraft/server/MinecraftServer.java | 031e816c576681c65e51393195eb0d5abc60ad7e | [] | no_license | MelonsYum/leap-client | 5c200d0b39e0ca1f2071f9264f913f9e6977d4b4 | c6611d4b9600311e1eb10f87a949419e34749373 | refs/heads/main | 2023-08-04T17:40:13.797831 | 2021-09-17T00:18:38 | 2021-09-17T00:18:38 | 411,085,054 | 3 | 3 | null | 2021-09-28T00:33:06 | 2021-09-28T00:33:05 | null | UTF-8 | Java | false | false | 55,406 | java | /* */ package net.minecraft.server;
/* */ import com.google.common.collect.Lists;
/* */ import com.google.common.collect.Queues;
/* */ import com.google.common.util.concurrent.Futures;
/* */ import com.google.common.util.concurrent.ListenableFuture;
/* */ import com.google.common.util.concurrent.ListenableFutureTask;
/* */ import com.mojang.authlib.GameProfile;
/* */ import com.mojang.authlib.GameProfileRepository;
/* */ import com.mojang.authlib.minecraft.MinecraftSessionService;
/* */ import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
/* */ import io.netty.buffer.ByteBuf;
/* */ import io.netty.buffer.ByteBufOutputStream;
/* */ import io.netty.buffer.Unpooled;
/* */ import io.netty.handler.codec.base64.Base64;
/* */ import java.awt.GraphicsEnvironment;
/* */ import java.awt.image.BufferedImage;
/* */ import java.io.File;
/* */ import java.io.IOException;
/* */ import java.io.OutputStream;
/* */ import java.net.Proxy;
/* */ import java.security.KeyPair;
/* */ import java.text.SimpleDateFormat;
/* */ import java.util.ArrayList;
/* */ import java.util.Arrays;
/* */ import java.util.Collections;
/* */ import java.util.Date;
/* */ import java.util.Iterator;
/* */ import java.util.List;
/* */ import java.util.Queue;
/* */ import java.util.Random;
/* */ import java.util.UUID;
/* */ import java.util.concurrent.Callable;
/* */ import java.util.concurrent.Executors;
/* */ import java.util.concurrent.FutureTask;
/* */ import javax.imageio.ImageIO;
/* */ import net.minecraft.command.CommandBase;
/* */ import net.minecraft.command.CommandResultStats;
/* */ import net.minecraft.command.ICommandManager;
/* */ import net.minecraft.command.ICommandSender;
/* */ import net.minecraft.command.ServerCommandManager;
/* */ import net.minecraft.crash.CrashReport;
/* */ import net.minecraft.entity.Entity;
/* */ import net.minecraft.entity.player.EntityPlayer;
/* */ import net.minecraft.entity.player.EntityPlayerMP;
/* */ import net.minecraft.network.NetworkSystem;
/* */ import net.minecraft.network.Packet;
/* */ import net.minecraft.network.ServerStatusResponse;
/* */ import net.minecraft.network.play.server.S03PacketTimeUpdate;
/* */ import net.minecraft.profiler.IPlayerUsage;
/* */ import net.minecraft.profiler.PlayerUsageSnooper;
/* */ import net.minecraft.profiler.Profiler;
/* */ import net.minecraft.server.gui.IUpdatePlayerListBox;
/* */ import net.minecraft.server.management.PlayerProfileCache;
/* */ import net.minecraft.server.management.ServerConfigurationManager;
/* */ import net.minecraft.util.BlockPos;
/* */ import net.minecraft.util.ChatComponentText;
/* */ import net.minecraft.util.IChatComponent;
/* */ import net.minecraft.util.IProgressUpdate;
/* */ import net.minecraft.util.IThreadListener;
/* */ import net.minecraft.util.MathHelper;
/* */ import net.minecraft.util.ReportedException;
/* */ import net.minecraft.util.Vec3;
/* */ import net.minecraft.world.EnumDifficulty;
/* */ import net.minecraft.world.IWorldAccess;
/* */ import net.minecraft.world.MinecraftException;
/* */ import net.minecraft.world.World;
/* */ import net.minecraft.world.WorldManager;
/* */ import net.minecraft.world.WorldServer;
/* */ import net.minecraft.world.WorldServerMulti;
/* */ import net.minecraft.world.WorldSettings;
/* */ import net.minecraft.world.WorldType;
/* */ import net.minecraft.world.chunk.storage.AnvilSaveConverter;
/* */ import net.minecraft.world.demo.DemoWorldServer;
/* */ import net.minecraft.world.storage.ISaveFormat;
/* */ import net.minecraft.world.storage.ISaveHandler;
/* */ import net.minecraft.world.storage.WorldInfo;
/* */ import org.apache.commons.lang3.Validate;
/* */ import org.apache.logging.log4j.LogManager;
/* */ import org.apache.logging.log4j.Logger;
/* */
/* */ public abstract class MinecraftServer implements ICommandSender, Runnable, IThreadListener, IPlayerUsage {
/* 82 */ private static final Logger logger = LogManager.getLogger();
/* 83 */ public static final File USER_CACHE_FILE = new File("usercache.json");
/* */
/* */
/* */ private static MinecraftServer mcServer;
/* */
/* */ private final ISaveFormat anvilConverterForAnvilFile;
/* */
/* 90 */ private final PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("server", this, getCurrentTimeMillis());
/* */
/* */ private final File anvilFile;
/* */
/* 94 */ private final List playersOnline = Lists.newArrayList();
/* */ private final ICommandManager commandManager;
/* 96 */ public final Profiler theProfiler = new Profiler();
/* */ private final NetworkSystem networkSystem;
/* 98 */ private final ServerStatusResponse statusResponse = new ServerStatusResponse();
/* 99 */ private final Random random = new Random();
/* */
/* */
/* 102 */ private int serverPort = -1;
/* */
/* */
/* */ public WorldServer[] worldServers;
/* */
/* */
/* */ private ServerConfigurationManager serverConfigManager;
/* */
/* */
/* */ private boolean serverRunning = true;
/* */
/* */
/* */ private boolean serverStopped;
/* */
/* */
/* */ private int tickCounter;
/* */
/* */
/* */ protected final Proxy serverProxy;
/* */
/* */
/* */ public String currentTask;
/* */
/* */
/* */ public int percentDone;
/* */
/* */
/* */ private boolean onlineMode;
/* */
/* */
/* */ private boolean canSpawnAnimals;
/* */
/* */
/* */ private boolean canSpawnNPCs;
/* */
/* */
/* */ private boolean pvpEnabled;
/* */
/* */
/* */ private boolean allowFlight;
/* */
/* */
/* */ private String motd;
/* */
/* */ private int buildLimit;
/* */
/* 148 */ private int maxPlayerIdleMinutes = 0;
/* 149 */ public final long[] tickTimeArray = new long[100];
/* */
/* */
/* */ public long[][] timeOfLastDimensionTick;
/* */
/* */ private KeyPair serverKeyPair;
/* */
/* */ private String serverOwner;
/* */
/* */ private String folderName;
/* */
/* */ private String worldName;
/* */
/* */ private boolean isDemo;
/* */
/* */ private boolean enableBonusChest;
/* */
/* */ private boolean worldIsBeingDeleted;
/* */
/* 168 */ private String resourcePackUrl = "";
/* 169 */ private String resourcePackHash = "";
/* */
/* */ private boolean serverIsRunning;
/* */
/* */ private long timeOfLastWarning;
/* */
/* */ private String userMessage;
/* */
/* */ private boolean startProfiling;
/* */ private boolean isGamemodeForced;
/* */ private final YggdrasilAuthenticationService authService;
/* */ private final MinecraftSessionService sessionService;
/* 181 */ private long nanoTimeSinceStatusRefresh = 0L;
/* */ private final GameProfileRepository profileRepo;
/* */ private final PlayerProfileCache profileCache;
/* 184 */ protected final Queue futureTaskQueue = Queues.newArrayDeque();
/* */ private Thread serverThread;
/* 186 */ private long currentTime = getCurrentTimeMillis();
/* */
/* */ private static final String __OBFID = "CL_00001462";
/* */
/* */ public MinecraftServer(Proxy p_i46053_1_, File p_i46053_2_) {
/* 191 */ this.serverProxy = p_i46053_1_;
/* 192 */ mcServer = this;
/* 193 */ this.anvilFile = null;
/* 194 */ this.networkSystem = null;
/* 195 */ this.profileCache = new PlayerProfileCache(this, p_i46053_2_);
/* 196 */ this.commandManager = null;
/* 197 */ this.anvilConverterForAnvilFile = null;
/* 198 */ this.authService = new YggdrasilAuthenticationService(p_i46053_1_, UUID.randomUUID().toString());
/* 199 */ this.sessionService = this.authService.createMinecraftSessionService();
/* 200 */ this.profileRepo = this.authService.createProfileRepository();
/* */ }
/* */
/* */
/* */ public MinecraftServer(File workDir, Proxy proxy, File profileCacheDir) {
/* 205 */ this.serverProxy = proxy;
/* 206 */ mcServer = this;
/* 207 */ this.anvilFile = workDir;
/* 208 */ this.networkSystem = new NetworkSystem(this);
/* 209 */ this.profileCache = new PlayerProfileCache(this, profileCacheDir);
/* 210 */ this.commandManager = (ICommandManager)createNewCommandManager();
/* 211 */ this.anvilConverterForAnvilFile = (ISaveFormat)new AnvilSaveConverter(workDir);
/* 212 */ this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString());
/* 213 */ this.sessionService = this.authService.createMinecraftSessionService();
/* 214 */ this.profileRepo = this.authService.createProfileRepository();
/* */ }
/* */
/* */
/* */ protected ServerCommandManager createNewCommandManager() {
/* 219 */ return new ServerCommandManager();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected void convertMapIfNeeded(String worldNameIn) {
/* 229 */ if (getActiveAnvilConverter().isOldMapFormat(worldNameIn)) {
/* */
/* 231 */ logger.info("Converting map!");
/* 232 */ setUserMessage("menu.convertingLevel");
/* 233 */ getActiveAnvilConverter().convertMapFormat(worldNameIn, new IProgressUpdate()
/* */ {
/* 235 */ private long startTime = System.currentTimeMillis(); private static final String __OBFID = "CL_00001417";
/* */ public void displaySavingString(String message) {}
/* */
/* */ public void resetProgressAndMessage(String p_73721_1_) {}
/* */
/* */ public void setLoadingProgress(int progress) {
/* 241 */ if (System.currentTimeMillis() - this.startTime >= 1000L) {
/* */
/* 243 */ this.startTime = System.currentTimeMillis();
/* 244 */ MinecraftServer.logger.info("Converting... " + progress + "%");
/* */ }
/* */ }
/* */
/* */
/* */ public void setDoneWorking() {}
/* */
/* */
/* */ public void displayLoadingString(String message) {}
/* */ });
/* */ }
/* */ }
/* */
/* */ protected synchronized void setUserMessage(String message) {
/* 258 */ this.userMessage = message;
/* */ }
/* */
/* */
/* */ public synchronized String getUserMessage() {
/* 263 */ return this.userMessage;
/* */ }
/* */
/* */ protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) {
/* */ WorldSettings var8;
/* 268 */ convertMapIfNeeded(p_71247_1_);
/* 269 */ setUserMessage("menu.loadingLevel");
/* 270 */ this.worldServers = new WorldServer[3];
/* 271 */ this.timeOfLastDimensionTick = new long[this.worldServers.length][100];
/* 272 */ ISaveHandler var7 = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true);
/* 273 */ setResourcePackFromWorld(getFolderName(), var7);
/* 274 */ WorldInfo var9 = var7.loadWorldInfo();
/* */
/* */
/* 277 */ if (var9 == null) {
/* */
/* 279 */ if (isDemo()) {
/* */
/* 281 */ var8 = DemoWorldServer.demoWorldSettings;
/* */ }
/* */ else {
/* */
/* 285 */ var8 = new WorldSettings(seed, getGameType(), canStructuresSpawn(), isHardcore(), type);
/* 286 */ var8.setWorldName(p_71247_6_);
/* */
/* 288 */ if (this.enableBonusChest)
/* */ {
/* 290 */ var8.enableBonusChest();
/* */ }
/* */ }
/* */
/* 294 */ var9 = new WorldInfo(var8, p_71247_2_);
/* */ }
/* */ else {
/* */
/* 298 */ var9.setWorldName(p_71247_2_);
/* 299 */ var8 = new WorldSettings(var9);
/* */ }
/* */
/* 302 */ for (int var10 = 0; var10 < this.worldServers.length; var10++) {
/* */
/* 304 */ byte var11 = 0;
/* */
/* 306 */ if (var10 == 1)
/* */ {
/* 308 */ var11 = -1;
/* */ }
/* */
/* 311 */ if (var10 == 2)
/* */ {
/* 313 */ var11 = 1;
/* */ }
/* */
/* 316 */ if (var10 == 0) {
/* */
/* 318 */ if (isDemo()) {
/* */
/* 320 */ this.worldServers[var10] = (WorldServer)(new DemoWorldServer(this, var7, var9, var11, this.theProfiler)).init();
/* */ }
/* */ else {
/* */
/* 324 */ this.worldServers[var10] = (WorldServer)(new WorldServer(this, var7, var9, var11, this.theProfiler)).init();
/* */ }
/* */
/* 327 */ this.worldServers[var10].initialize(var8);
/* */ }
/* */ else {
/* */
/* 331 */ this.worldServers[var10] = (WorldServer)(new WorldServerMulti(this, var7, var11, this.worldServers[0], this.theProfiler)).init();
/* */ }
/* */
/* 334 */ this.worldServers[var10].addWorldAccess((IWorldAccess)new WorldManager(this, this.worldServers[var10]));
/* */
/* 336 */ if (!isSinglePlayer())
/* */ {
/* 338 */ this.worldServers[var10].getWorldInfo().setGameType(getGameType());
/* */ }
/* */ }
/* */
/* 342 */ this.serverConfigManager.setPlayerManager(this.worldServers);
/* 343 */ setDifficultyForAllWorlds(getDifficulty());
/* 344 */ initialWorldChunkLoad();
/* */ }
/* */
/* */
/* */ protected void initialWorldChunkLoad() {
/* 349 */ boolean var1 = true;
/* 350 */ boolean var2 = true;
/* 351 */ boolean var3 = true;
/* 352 */ boolean var4 = true;
/* 353 */ int var5 = 0;
/* 354 */ setUserMessage("menu.generatingTerrain");
/* 355 */ byte var6 = 0;
/* 356 */ logger.info("Preparing start region for level " + var6);
/* 357 */ WorldServer var7 = this.worldServers[var6];
/* 358 */ BlockPos var8 = var7.getSpawnPoint();
/* 359 */ long var9 = getCurrentTimeMillis();
/* */
/* 361 */ for (int var11 = -192; var11 <= 192 && isServerRunning(); var11 += 16) {
/* */
/* 363 */ for (int var12 = -192; var12 <= 192 && isServerRunning(); var12 += 16) {
/* */
/* 365 */ long var13 = getCurrentTimeMillis();
/* */
/* 367 */ if (var13 - var9 > 1000L) {
/* */
/* 369 */ outputPercentRemaining("Preparing spawn area", var5 * 100 / 625);
/* 370 */ var9 = var13;
/* */ }
/* */
/* 373 */ var5++;
/* 374 */ var7.theChunkProviderServer.loadChunk(var8.getX() + var11 >> 4, var8.getZ() + var12 >> 4);
/* */ }
/* */ }
/* */
/* 378 */ clearCurrentTask();
/* */ }
/* */
/* */
/* */ protected void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) {
/* 383 */ File var3 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip");
/* */
/* 385 */ if (var3.isFile())
/* */ {
/* 387 */ setResourcePack("level://" + worldNameIn + "/" + var3.getName(), "");
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected void outputPercentRemaining(String message, int percent) {
/* 412 */ this.currentTask = message;
/* 413 */ this.percentDone = percent;
/* 414 */ logger.info(String.valueOf(message) + ": " + percent + "%");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ protected void clearCurrentTask() {
/* 422 */ this.currentTask = null;
/* 423 */ this.percentDone = 0;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ protected void saveAllWorlds(boolean dontLog) {
/* 431 */ if (!this.worldIsBeingDeleted) {
/* */
/* 433 */ WorldServer[] var2 = this.worldServers;
/* 434 */ int var3 = var2.length;
/* */
/* 436 */ for (int var4 = 0; var4 < var3; var4++) {
/* */
/* 438 */ WorldServer var5 = var2[var4];
/* */
/* 440 */ if (var5 != null) {
/* */
/* 442 */ if (!dontLog)
/* */ {
/* 444 */ logger.info("Saving chunks for level '" + var5.getWorldInfo().getWorldName() + "'/" + var5.provider.getDimensionName());
/* */ }
/* */
/* */
/* */ try {
/* 449 */ var5.saveAllChunks(true, null);
/* */ }
/* 451 */ catch (MinecraftException var7) {
/* */
/* 453 */ logger.warn(var7.getMessage());
/* */ }
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void stopServer() {
/* 465 */ if (!this.worldIsBeingDeleted) {
/* */
/* 467 */ logger.info("Stopping server");
/* */
/* 469 */ if (getNetworkSystem() != null)
/* */ {
/* 471 */ getNetworkSystem().terminateEndpoints();
/* */ }
/* */
/* 474 */ if (this.serverConfigManager != null) {
/* */
/* 476 */ logger.info("Saving players");
/* 477 */ this.serverConfigManager.saveAllPlayerData();
/* 478 */ this.serverConfigManager.removeAllPlayers();
/* */ }
/* */
/* 481 */ if (this.worldServers != null) {
/* */
/* 483 */ logger.info("Saving worlds");
/* 484 */ saveAllWorlds(false);
/* */
/* 486 */ for (int var1 = 0; var1 < this.worldServers.length; var1++) {
/* */
/* 488 */ WorldServer var2 = this.worldServers[var1];
/* 489 */ var2.flush();
/* */ }
/* */ }
/* */
/* 493 */ if (this.usageSnooper.isSnooperRunning())
/* */ {
/* 495 */ this.usageSnooper.stopSnooper();
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */ public boolean isServerRunning() {
/* 502 */ return this.serverRunning;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void initiateShutdown() {
/* 510 */ this.serverRunning = false;
/* */ }
/* */
/* */
/* */ protected void func_175585_v() {
/* 515 */ mcServer = this;
/* */ }
/* */
/* */
/* */
/* */ public void run() {
/* */ try {
/* 522 */ if (startServer()) {
/* */
/* 524 */ this.currentTime = getCurrentTimeMillis();
/* 525 */ long var1 = 0L;
/* 526 */ this.statusResponse.setServerDescription((IChatComponent)new ChatComponentText(this.motd));
/* 527 */ this.statusResponse.setProtocolVersionInfo(new ServerStatusResponse.MinecraftProtocolVersionIdentifier("1.8", 47));
/* 528 */ addFaviconToStatusResponse(this.statusResponse);
/* */
/* 530 */ while (this.serverRunning)
/* */ {
/* 532 */ long var48 = getCurrentTimeMillis();
/* 533 */ long var5 = var48 - this.currentTime;
/* */
/* 535 */ if (var5 > 2000L && this.currentTime - this.timeOfLastWarning >= 15000L) {
/* */
/* 537 */ logger.warn("Can't keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(var5), Long.valueOf(var5 / 50L) });
/* 538 */ var5 = 2000L;
/* 539 */ this.timeOfLastWarning = this.currentTime;
/* */ }
/* */
/* 542 */ if (var5 < 0L) {
/* */
/* 544 */ logger.warn("Time ran backwards! Did the system time change?");
/* 545 */ var5 = 0L;
/* */ }
/* */
/* 548 */ var1 += var5;
/* 549 */ this.currentTime = var48;
/* */
/* 551 */ if (this.worldServers[0].areAllPlayersAsleep()) {
/* */
/* 553 */ tick();
/* 554 */ var1 = 0L;
/* */ }
/* */ else {
/* */
/* 558 */ while (var1 > 50L) {
/* */
/* 560 */ var1 -= 50L;
/* 561 */ tick();
/* */ }
/* */ }
/* */
/* 565 */ Thread.sleep(Math.max(1L, 50L - var1));
/* 566 */ this.serverIsRunning = true;
/* */ }
/* */
/* */ } else {
/* */
/* 571 */ finalTick(null);
/* */ }
/* */
/* 574 */ } catch (Throwable var46) {
/* */
/* 576 */ logger.error("Encountered an unexpected exception", var46);
/* 577 */ CrashReport var2 = null;
/* */
/* 579 */ if (var46 instanceof ReportedException) {
/* */
/* 581 */ var2 = addServerInfoToCrashReport(((ReportedException)var46).getCrashReport());
/* */ }
/* */ else {
/* */
/* 585 */ var2 = addServerInfoToCrashReport(new CrashReport("Exception in server tick loop", var46));
/* */ }
/* */
/* 588 */ File var3 = new File(new File(getDataDirectory(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
/* */
/* 590 */ if (var2.saveToFile(var3)) {
/* */
/* 592 */ logger.error("This crash report has been saved to: " + var3.getAbsolutePath());
/* */ }
/* */ else {
/* */
/* 596 */ logger.error("We were unable to save this crash report to disk.");
/* */ }
/* */
/* 599 */ finalTick(var2);
/* */ } finally {
/* */
/* */
/* */ try {
/* */
/* 605 */ stopServer();
/* 606 */ this.serverStopped = true;
/* */ }
/* 608 */ catch (Throwable var44) {
/* */
/* 610 */ logger.error("Exception stopping the server", var44);
/* */ }
/* */ finally {
/* */
/* 614 */ systemExitNow();
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */ private void addFaviconToStatusResponse(ServerStatusResponse response) {
/* 621 */ File var2 = getFile("server-icon.png");
/* */
/* 623 */ if (var2.isFile()) {
/* */
/* 625 */ ByteBuf var3 = Unpooled.buffer();
/* */
/* */
/* */ try {
/* 629 */ BufferedImage var4 = ImageIO.read(var2);
/* 630 */ Validate.validState((var4.getWidth() == 64), "Must be 64 pixels wide", new Object[0]);
/* 631 */ Validate.validState((var4.getHeight() == 64), "Must be 64 pixels high", new Object[0]);
/* 632 */ ImageIO.write(var4, "PNG", (OutputStream)new ByteBufOutputStream(var3));
/* 633 */ ByteBuf var5 = Base64.encode(var3);
/* 634 */ response.setFavicon("data:image/png;base64," + var5.toString(Charsets.UTF_8));
/* */ }
/* 636 */ catch (Exception var9) {
/* */
/* 638 */ logger.error("Couldn't load server icon", var9);
/* */ }
/* */ finally {
/* */
/* 642 */ var3.release();
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */ public File getDataDirectory() {
/* 649 */ return new File(".");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ protected void finalTick(CrashReport report) {}
/* */
/* */
/* */
/* */
/* */ protected void systemExitNow() {}
/* */
/* */
/* */
/* */
/* */ public void tick() {
/* 667 */ long var1 = System.nanoTime();
/* 668 */ this.tickCounter++;
/* */
/* 670 */ if (this.startProfiling) {
/* */
/* 672 */ this.startProfiling = false;
/* 673 */ this.theProfiler.profilingEnabled = true;
/* 674 */ this.theProfiler.clearProfiling();
/* */ }
/* */
/* 677 */ this.theProfiler.startSection("root");
/* 678 */ updateTimeLightAndEntities();
/* */
/* 680 */ if (var1 - this.nanoTimeSinceStatusRefresh >= 5000000000L) {
/* */
/* 682 */ this.nanoTimeSinceStatusRefresh = var1;
/* 683 */ this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(getMaxPlayers(), getCurrentPlayerCount()));
/* 684 */ GameProfile[] var3 = new GameProfile[Math.min(getCurrentPlayerCount(), 12)];
/* 685 */ int var4 = MathHelper.getRandomIntegerInRange(this.random, 0, getCurrentPlayerCount() - var3.length);
/* */
/* 687 */ for (int var5 = 0; var5 < var3.length; var5++)
/* */ {
/* 689 */ var3[var5] = ((EntityPlayerMP)this.serverConfigManager.playerEntityList.get(var4 + var5)).getGameProfile();
/* */ }
/* */
/* 692 */ Collections.shuffle(Arrays.asList((Object[])var3));
/* 693 */ this.statusResponse.getPlayerCountData().setPlayers(var3);
/* */ }
/* */
/* 696 */ if (this.tickCounter % 900 == 0) {
/* */
/* 698 */ this.theProfiler.startSection("save");
/* 699 */ this.serverConfigManager.saveAllPlayerData();
/* 700 */ saveAllWorlds(true);
/* 701 */ this.theProfiler.endSection();
/* */ }
/* */
/* 704 */ this.theProfiler.startSection("tallying");
/* 705 */ this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - var1;
/* 706 */ this.theProfiler.endSection();
/* 707 */ this.theProfiler.startSection("snooper");
/* */
/* 709 */ if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100)
/* */ {
/* 711 */ this.usageSnooper.startSnooper();
/* */ }
/* */
/* 714 */ if (this.tickCounter % 6000 == 0)
/* */ {
/* 716 */ this.usageSnooper.addMemoryStatsToSnooper();
/* */ }
/* */
/* 719 */ this.theProfiler.endSection();
/* 720 */ this.theProfiler.endSection();
/* */ }
/* */
/* */
/* */ public void updateTimeLightAndEntities() {
/* 725 */ this.theProfiler.startSection("jobs");
/* 726 */ Queue var1 = this.futureTaskQueue;
/* */
/* 728 */ synchronized (this.futureTaskQueue) {
/* */
/* 730 */ while (!this.futureTaskQueue.isEmpty()) {
/* */
/* */
/* */ try {
/* 734 */ ((FutureTask)this.futureTaskQueue.poll()).run();
/* */ }
/* 736 */ catch (Throwable var9) {
/* */
/* 738 */ logger.fatal(var9);
/* */ }
/* */ }
/* */ }
/* */
/* 743 */ this.theProfiler.endStartSection("levels");
/* */
/* */ int var11;
/* 746 */ for (var11 = 0; var11 < this.worldServers.length; var11++) {
/* */
/* 748 */ long var2 = System.nanoTime();
/* */
/* 750 */ if (var11 == 0 || getAllowNether()) {
/* */
/* 752 */ WorldServer var4 = this.worldServers[var11];
/* 753 */ this.theProfiler.startSection(var4.getWorldInfo().getWorldName());
/* */
/* 755 */ if (this.tickCounter % 20 == 0) {
/* */
/* 757 */ this.theProfiler.startSection("timeSync");
/* 758 */ this.serverConfigManager.sendPacketToAllPlayersInDimension((Packet)new S03PacketTimeUpdate(var4.getTotalWorldTime(), var4.getWorldTime(), var4.getGameRules().getGameRuleBooleanValue("doDaylightCycle")), var4.provider.getDimensionId());
/* 759 */ this.theProfiler.endSection();
/* */ }
/* */
/* 762 */ this.theProfiler.startSection("tick");
/* */
/* */
/* */
/* */ try {
/* 767 */ var4.tick();
/* */ }
/* 769 */ catch (Throwable var8) {
/* */
/* 771 */ CrashReport var6 = CrashReport.makeCrashReport(var8, "Exception ticking world");
/* 772 */ var4.addWorldInfoToCrashReport(var6);
/* 773 */ throw new ReportedException(var6);
/* */ }
/* */
/* */
/* */ try {
/* 778 */ var4.updateEntities();
/* */ }
/* 780 */ catch (Throwable var7) {
/* */
/* 782 */ CrashReport var6 = CrashReport.makeCrashReport(var7, "Exception ticking world entities");
/* 783 */ var4.addWorldInfoToCrashReport(var6);
/* 784 */ throw new ReportedException(var6);
/* */ }
/* */
/* 787 */ this.theProfiler.endSection();
/* 788 */ this.theProfiler.startSection("tracker");
/* 789 */ var4.getEntityTracker().updateTrackedEntities();
/* 790 */ this.theProfiler.endSection();
/* 791 */ this.theProfiler.endSection();
/* */ }
/* */
/* 794 */ this.timeOfLastDimensionTick[var11][this.tickCounter % 100] = System.nanoTime() - var2;
/* */ }
/* */
/* 797 */ this.theProfiler.endStartSection("connection");
/* 798 */ getNetworkSystem().networkTick();
/* 799 */ this.theProfiler.endStartSection("players");
/* 800 */ this.serverConfigManager.onTick();
/* 801 */ this.theProfiler.endStartSection("tickables");
/* */
/* 803 */ for (var11 = 0; var11 < this.playersOnline.size(); var11++)
/* */ {
/* 805 */ ((IUpdatePlayerListBox)this.playersOnline.get(var11)).update();
/* */ }
/* */
/* 808 */ this.theProfiler.endSection();
/* */ }
/* */
/* */
/* */ public boolean getAllowNether() {
/* 813 */ return true;
/* */ }
/* */
/* */
/* */ public void startServerThread() {
/* 818 */ this.serverThread = new Thread(this, "Server thread");
/* 819 */ this.serverThread.start();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public File getFile(String fileName) {
/* 827 */ return new File(getDataDirectory(), fileName);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void logWarning(String msg) {
/* 835 */ logger.warn(msg);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public WorldServer worldServerForDimension(int dimension) {
/* 843 */ return (dimension == -1) ? this.worldServers[1] : ((dimension == 1) ? this.worldServers[2] : this.worldServers[0]);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String getMinecraftVersion() {
/* 851 */ return "1.8";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public int getCurrentPlayerCount() {
/* 859 */ return this.serverConfigManager.getCurrentPlayerCount();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public int getMaxPlayers() {
/* 867 */ return this.serverConfigManager.getMaxPlayers();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String[] getAllUsernames() {
/* 875 */ return this.serverConfigManager.getAllUsernames();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public GameProfile[] getGameProfiles() {
/* 883 */ return this.serverConfigManager.getAllProfiles();
/* */ }
/* */
/* */
/* */ public String getServerModName() {
/* 888 */ return "vanilla";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public CrashReport addServerInfoToCrashReport(CrashReport report) {
/* 896 */ report.getCategory().addCrashSectionCallable("Profiler Position", new Callable()
/* */ {
/* */ private static final String __OBFID = "CL_00001418";
/* */
/* */ public String func_179879_a() {
/* 901 */ return MinecraftServer.this.theProfiler.profilingEnabled ? MinecraftServer.this.theProfiler.getNameOfLastSection() : "N/A (disabled)";
/* */ }
/* */
/* */ public Object call() {
/* 905 */ return func_179879_a();
/* */ }
/* */ });
/* */
/* 909 */ if (this.serverConfigManager != null)
/* */ {
/* 911 */ report.getCategory().addCrashSectionCallable("Player Count", new Callable()
/* */ {
/* */ private static final String __OBFID = "CL_00001419";
/* */
/* */ public String call() {
/* 916 */ return String.valueOf(MinecraftServer.this.serverConfigManager.getCurrentPlayerCount()) + " / " + MinecraftServer.this.serverConfigManager.getMaxPlayers() + "; " + MinecraftServer.this.serverConfigManager.playerEntityList;
/* */ }
/* */ });
/* */ }
/* */
/* 921 */ return report;
/* */ }
/* */
/* */
/* */ public List func_180506_a(ICommandSender p_180506_1_, String p_180506_2_, BlockPos p_180506_3_) {
/* 926 */ ArrayList<String> var4 = Lists.newArrayList();
/* */
/* 928 */ if (p_180506_2_.startsWith("/")) {
/* */
/* 930 */ p_180506_2_ = p_180506_2_.substring(1);
/* 931 */ boolean var11 = !p_180506_2_.contains(" ");
/* 932 */ List var12 = this.commandManager.getTabCompletionOptions(p_180506_1_, p_180506_2_, p_180506_3_);
/* */
/* 934 */ if (var12 != null) {
/* */
/* 936 */ Iterator<String> var13 = var12.iterator();
/* */
/* 938 */ while (var13.hasNext()) {
/* */
/* 940 */ String var14 = var13.next();
/* */
/* 942 */ if (var11) {
/* */
/* 944 */ var4.add("/" + var14);
/* */
/* */ continue;
/* */ }
/* 948 */ var4.add(var14);
/* */ }
/* */ }
/* */
/* */
/* 953 */ return var4;
/* */ }
/* */
/* */
/* 957 */ String[] var5 = p_180506_2_.split(" ", -1);
/* 958 */ String var6 = var5[var5.length - 1];
/* 959 */ String[] var7 = this.serverConfigManager.getAllUsernames();
/* 960 */ int var8 = var7.length;
/* */
/* 962 */ for (int var9 = 0; var9 < var8; var9++) {
/* */
/* 964 */ String var10 = var7[var9];
/* */
/* 966 */ if (CommandBase.doesStringStartWith(var6, var10))
/* */ {
/* 968 */ var4.add(var10);
/* */ }
/* */ }
/* */
/* 972 */ return var4;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static MinecraftServer getServer() {
/* 981 */ return mcServer;
/* */ }
/* */
/* */
/* */ public boolean func_175578_N() {
/* 986 */ return (this.anvilFile != null);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String getName() {
/* 994 */ return "Server";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void addChatMessage(IChatComponent message) {
/* 1005 */ logger.info(message.getUnformattedText());
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public boolean canCommandSenderUseCommand(int permissionLevel, String command) {
/* 1013 */ return true;
/* */ }
/* */
/* */
/* */ public ICommandManager getCommandManager() {
/* 1018 */ return this.commandManager;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public KeyPair getKeyPair() {
/* 1026 */ return this.serverKeyPair;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String getServerOwner() {
/* 1034 */ return this.serverOwner;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void setServerOwner(String owner) {
/* 1042 */ this.serverOwner = owner;
/* */ }
/* */
/* */
/* */ public boolean isSinglePlayer() {
/* 1047 */ return (this.serverOwner != null);
/* */ }
/* */
/* */
/* */ public String getFolderName() {
/* 1052 */ return this.folderName;
/* */ }
/* */
/* */
/* */ public void setFolderName(String name) {
/* 1057 */ this.folderName = name;
/* */ }
/* */
/* */
/* */ public void setWorldName(String p_71246_1_) {
/* 1062 */ this.worldName = p_71246_1_;
/* */ }
/* */
/* */
/* */ public String getWorldName() {
/* 1067 */ return this.worldName;
/* */ }
/* */
/* */
/* */ public void setKeyPair(KeyPair keyPair) {
/* 1072 */ this.serverKeyPair = keyPair;
/* */ }
/* */
/* */
/* */ public void setDifficultyForAllWorlds(EnumDifficulty difficulty) {
/* 1077 */ for (int var2 = 0; var2 < this.worldServers.length; var2++) {
/* */
/* 1079 */ WorldServer var3 = this.worldServers[var2];
/* */
/* 1081 */ if (var3 != null)
/* */ {
/* 1083 */ if (var3.getWorldInfo().isHardcoreModeEnabled()) {
/* */
/* 1085 */ var3.getWorldInfo().setDifficulty(EnumDifficulty.HARD);
/* 1086 */ var3.setAllowedSpawnTypes(true, true);
/* */ }
/* 1088 */ else if (isSinglePlayer()) {
/* */
/* 1090 */ var3.getWorldInfo().setDifficulty(difficulty);
/* 1091 */ var3.setAllowedSpawnTypes((var3.getDifficulty() != EnumDifficulty.PEACEFUL), true);
/* */ }
/* */ else {
/* */
/* 1095 */ var3.getWorldInfo().setDifficulty(difficulty);
/* 1096 */ var3.setAllowedSpawnTypes(allowSpawnMonsters(), this.canSpawnAnimals);
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */ protected boolean allowSpawnMonsters() {
/* 1104 */ return true;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public boolean isDemo() {
/* 1112 */ return this.isDemo;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void setDemo(boolean demo) {
/* 1120 */ this.isDemo = demo;
/* */ }
/* */
/* */
/* */ public void canCreateBonusChest(boolean enable) {
/* 1125 */ this.enableBonusChest = enable;
/* */ }
/* */
/* */
/* */ public ISaveFormat getActiveAnvilConverter() {
/* 1130 */ return this.anvilConverterForAnvilFile;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void deleteWorldAndStopServer() {
/* 1139 */ this.worldIsBeingDeleted = true;
/* 1140 */ getActiveAnvilConverter().flushCache();
/* */
/* 1142 */ for (int var1 = 0; var1 < this.worldServers.length; var1++) {
/* */
/* 1144 */ WorldServer var2 = this.worldServers[var1];
/* */
/* 1146 */ if (var2 != null)
/* */ {
/* 1148 */ var2.flush();
/* */ }
/* */ }
/* */
/* 1152 */ getActiveAnvilConverter().deleteWorldDirectory(this.worldServers[0].getSaveHandler().getWorldDirectoryName());
/* 1153 */ initiateShutdown();
/* */ }
/* */
/* */
/* */ public String getResourcePackUrl() {
/* 1158 */ return this.resourcePackUrl;
/* */ }
/* */
/* */
/* */ public String getResourcePackHash() {
/* 1163 */ return this.resourcePackHash;
/* */ }
/* */
/* */
/* */ public void setResourcePack(String url, String hash) {
/* 1168 */ this.resourcePackUrl = url;
/* 1169 */ this.resourcePackHash = hash;
/* */ }
/* */
/* */
/* */ public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) {
/* 1174 */ playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false));
/* 1175 */ playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0));
/* */
/* 1177 */ if (this.serverConfigManager != null) {
/* */
/* 1179 */ playerSnooper.addClientStat("players_current", Integer.valueOf(getCurrentPlayerCount()));
/* 1180 */ playerSnooper.addClientStat("players_max", Integer.valueOf(getMaxPlayers()));
/* 1181 */ playerSnooper.addClientStat("players_seen", Integer.valueOf((this.serverConfigManager.getAvailablePlayerDat()).length));
/* */ }
/* */
/* 1184 */ playerSnooper.addClientStat("uses_auth", Boolean.valueOf(this.onlineMode));
/* 1185 */ playerSnooper.addClientStat("gui_state", getGuiEnabled() ? "enabled" : "disabled");
/* 1186 */ playerSnooper.addClientStat("run_time", Long.valueOf((getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
/* 1187 */ playerSnooper.addClientStat("avg_tick_ms", Integer.valueOf((int)(MathHelper.average(this.tickTimeArray) * 1.0E-6D)));
/* 1188 */ int var2 = 0;
/* */
/* 1190 */ if (this.worldServers != null)
/* */ {
/* 1192 */ for (int var3 = 0; var3 < this.worldServers.length; var3++) {
/* */
/* 1194 */ if (this.worldServers[var3] != null) {
/* */
/* 1196 */ WorldServer var4 = this.worldServers[var3];
/* 1197 */ WorldInfo var5 = var4.getWorldInfo();
/* 1198 */ playerSnooper.addClientStat("world[" + var2 + "][dimension]", Integer.valueOf(var4.provider.getDimensionId()));
/* 1199 */ playerSnooper.addClientStat("world[" + var2 + "][mode]", var5.getGameType());
/* 1200 */ playerSnooper.addClientStat("world[" + var2 + "][difficulty]", var4.getDifficulty());
/* 1201 */ playerSnooper.addClientStat("world[" + var2 + "][hardcore]", Boolean.valueOf(var5.isHardcoreModeEnabled()));
/* 1202 */ playerSnooper.addClientStat("world[" + var2 + "][generator_name]", var5.getTerrainType().getWorldTypeName());
/* 1203 */ playerSnooper.addClientStat("world[" + var2 + "][generator_version]", Integer.valueOf(var5.getTerrainType().getGeneratorVersion()));
/* 1204 */ playerSnooper.addClientStat("world[" + var2 + "][height]", Integer.valueOf(this.buildLimit));
/* 1205 */ playerSnooper.addClientStat("world[" + var2 + "][chunks_loaded]", Integer.valueOf(var4.getChunkProvider().getLoadedChunkCount()));
/* 1206 */ var2++;
/* */ }
/* */ }
/* */ }
/* */
/* 1211 */ playerSnooper.addClientStat("worlds", Integer.valueOf(var2));
/* */ }
/* */
/* */
/* */ public void addServerTypeToSnooper(PlayerUsageSnooper playerSnooper) {
/* 1216 */ playerSnooper.addStatToSnooper("singleplayer", Boolean.valueOf(isSinglePlayer()));
/* 1217 */ playerSnooper.addStatToSnooper("server_brand", getServerModName());
/* 1218 */ playerSnooper.addStatToSnooper("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
/* 1219 */ playerSnooper.addStatToSnooper("dedicated", Boolean.valueOf(isDedicatedServer()));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public boolean isSnooperEnabled() {
/* 1227 */ return true;
/* */ }
/* */
/* */
/* */
/* */
/* */ public boolean isServerInOnlineMode() {
/* 1234 */ return this.onlineMode;
/* */ }
/* */
/* */
/* */ public void setOnlineMode(boolean online) {
/* 1239 */ this.onlineMode = online;
/* */ }
/* */
/* */
/* */ public boolean getCanSpawnAnimals() {
/* 1244 */ return this.canSpawnAnimals;
/* */ }
/* */
/* */
/* */ public void setCanSpawnAnimals(boolean spawnAnimals) {
/* 1249 */ this.canSpawnAnimals = spawnAnimals;
/* */ }
/* */
/* */
/* */ public boolean getCanSpawnNPCs() {
/* 1254 */ return this.canSpawnNPCs;
/* */ }
/* */
/* */
/* */ public void setCanSpawnNPCs(boolean spawnNpcs) {
/* 1259 */ this.canSpawnNPCs = spawnNpcs;
/* */ }
/* */
/* */
/* */ public boolean isPVPEnabled() {
/* 1264 */ return this.pvpEnabled;
/* */ }
/* */
/* */
/* */ public void setAllowPvp(boolean allowPvp) {
/* 1269 */ this.pvpEnabled = allowPvp;
/* */ }
/* */
/* */
/* */ public boolean isFlightAllowed() {
/* 1274 */ return this.allowFlight;
/* */ }
/* */
/* */
/* */ public void setAllowFlight(boolean allow) {
/* 1279 */ this.allowFlight = allow;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public String getMOTD() {
/* 1289 */ return this.motd;
/* */ }
/* */
/* */
/* */ public void setMOTD(String motdIn) {
/* 1294 */ this.motd = motdIn;
/* */ }
/* */
/* */
/* */ public int getBuildLimit() {
/* 1299 */ return this.buildLimit;
/* */ }
/* */
/* */
/* */ public void setBuildLimit(int maxBuildHeight) {
/* 1304 */ this.buildLimit = maxBuildHeight;
/* */ }
/* */
/* */
/* */ public ServerConfigurationManager getConfigurationManager() {
/* 1309 */ return this.serverConfigManager;
/* */ }
/* */
/* */
/* */ public void setConfigManager(ServerConfigurationManager configManager) {
/* 1314 */ this.serverConfigManager = configManager;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void setGameType(WorldSettings.GameType gameMode) {
/* 1322 */ for (int var2 = 0; var2 < this.worldServers.length; var2++)
/* */ {
/* 1324 */ (getServer()).worldServers[var2].getWorldInfo().setGameType(gameMode);
/* */ }
/* */ }
/* */
/* */
/* */ public NetworkSystem getNetworkSystem() {
/* 1330 */ return this.networkSystem;
/* */ }
/* */
/* */
/* */ public boolean serverIsInRunLoop() {
/* 1335 */ return this.serverIsRunning;
/* */ }
/* */
/* */
/* */ public boolean getGuiEnabled() {
/* 1340 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public int getTickCounter() {
/* 1350 */ return this.tickCounter;
/* */ }
/* */
/* */
/* */ public void enableProfiling() {
/* 1355 */ this.startProfiling = true;
/* */ }
/* */
/* */
/* */ public PlayerUsageSnooper getPlayerUsageSnooper() {
/* 1360 */ return this.usageSnooper;
/* */ }
/* */
/* */
/* */ public BlockPos getPosition() {
/* 1365 */ return BlockPos.ORIGIN;
/* */ }
/* */
/* */
/* */ public Vec3 getPositionVector() {
/* 1370 */ return new Vec3(0.0D, 0.0D, 0.0D);
/* */ }
/* */
/* */
/* */ public World getEntityWorld() {
/* 1375 */ return (World)this.worldServers[0];
/* */ }
/* */
/* */
/* */ public Entity getCommandSenderEntity() {
/* 1380 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public int getSpawnProtectionSize() {
/* 1388 */ return 16;
/* */ }
/* */
/* */
/* */ public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn) {
/* 1393 */ return false;
/* */ }
/* */
/* */
/* */ public boolean getForceGamemode() {
/* 1398 */ return this.isGamemodeForced;
/* */ }
/* */
/* */
/* */ public Proxy getServerProxy() {
/* 1403 */ return this.serverProxy;
/* */ }
/* */
/* */
/* */ public static long getCurrentTimeMillis() {
/* 1408 */ return System.currentTimeMillis();
/* */ }
/* */
/* */
/* */ public int getMaxPlayerIdleMinutes() {
/* 1413 */ return this.maxPlayerIdleMinutes;
/* */ }
/* */
/* */
/* */ public void setPlayerIdleTimeout(int idleTimeout) {
/* 1418 */ this.maxPlayerIdleMinutes = idleTimeout;
/* */ }
/* */
/* */
/* */ public IChatComponent getDisplayName() {
/* 1423 */ return (IChatComponent)new ChatComponentText(getName());
/* */ }
/* */
/* */
/* */ public boolean isAnnouncingPlayerAchievements() {
/* 1428 */ return true;
/* */ }
/* */
/* */
/* */ public MinecraftSessionService getMinecraftSessionService() {
/* 1433 */ return this.sessionService;
/* */ }
/* */
/* */
/* */ public GameProfileRepository getGameProfileRepository() {
/* 1438 */ return this.profileRepo;
/* */ }
/* */
/* */
/* */ public PlayerProfileCache getPlayerProfileCache() {
/* 1443 */ return this.profileCache;
/* */ }
/* */
/* */
/* */ public ServerStatusResponse getServerStatusResponse() {
/* 1448 */ return this.statusResponse;
/* */ }
/* */
/* */
/* */ public void refreshStatusNextTick() {
/* 1453 */ this.nanoTimeSinceStatusRefresh = 0L;
/* */ }
/* */
/* */
/* */ public Entity getEntityFromUuid(UUID uuid) {
/* 1458 */ WorldServer[] var2 = this.worldServers;
/* 1459 */ int var3 = var2.length;
/* */
/* 1461 */ for (int var4 = 0; var4 < var3; var4++) {
/* */
/* 1463 */ WorldServer var5 = var2[var4];
/* */
/* 1465 */ if (var5 != null) {
/* */
/* 1467 */ Entity var6 = var5.getEntityFromUuid(uuid);
/* */
/* 1469 */ if (var6 != null)
/* */ {
/* 1471 */ return var6;
/* */ }
/* */ }
/* */ }
/* */
/* 1476 */ return null;
/* */ }
/* */
/* */
/* */ public boolean sendCommandFeedback() {
/* 1481 */ return (getServer()).worldServers[0].getGameRules().getGameRuleBooleanValue("sendCommandFeedback");
/* */ }
/* */
/* */
/* */ public void func_174794_a(CommandResultStats.Type p_174794_1_, int p_174794_2_) {}
/* */
/* */ public int getMaxWorldSize() {
/* 1488 */ return 29999984;
/* */ }
/* */
/* */
/* */ public ListenableFuture callFromMainThread(Callable callable) {
/* 1493 */ Validate.notNull(callable);
/* */
/* 1495 */ if (!isCallingFromMinecraftThread()) {
/* */
/* 1497 */ ListenableFutureTask var2 = ListenableFutureTask.create(callable);
/* 1498 */ Queue var3 = this.futureTaskQueue;
/* */
/* 1500 */ synchronized (this.futureTaskQueue) {
/* */
/* 1502 */ this.futureTaskQueue.add(var2);
/* 1503 */ return (ListenableFuture)var2;
/* */ }
/* */ }
/* */
/* */
/* */
/* */ try {
/* 1510 */ return Futures.immediateFuture(callable.call());
/* */ }
/* 1512 */ catch (Exception var6) {
/* */
/* 1514 */ return (ListenableFuture)Futures.immediateFailedCheckedFuture(var6);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ public ListenableFuture addScheduledTask(Runnable runnableToSchedule) {
/* 1521 */ Validate.notNull(runnableToSchedule);
/* 1522 */ return callFromMainThread(Executors.callable(runnableToSchedule));
/* */ }
/* */
/* */
/* */ public boolean isCallingFromMinecraftThread() {
/* 1527 */ return (Thread.currentThread() == this.serverThread);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public int getNetworkCompressionTreshold() {
/* 1535 */ return 256;
/* */ }
/* */
/* */ protected abstract boolean startServer() throws IOException;
/* */
/* */ public abstract boolean canStructuresSpawn();
/* */
/* */ public abstract WorldSettings.GameType getGameType();
/* */
/* */ public abstract EnumDifficulty getDifficulty();
/* */
/* */ public abstract boolean isHardcore();
/* */
/* */ public abstract int getOpPermissionLevel();
/* */
/* */ public abstract boolean isDedicatedServer();
/* */
/* */ public abstract boolean isCommandBlockEnabled();
/* */
/* */ public abstract String shareToLAN(WorldSettings.GameType paramGameType, boolean paramBoolean);
/* */ }
/* Location: C:\Users\wyatt\Downloads\Leap-Client.jar!\net\minecraft\server\MinecraftServer.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | [
"[email protected]"
] | |
357ac7cd27c51c874998dbe9ee426b38a3a17ad8 | 7eecd8af862531023e696105544a8754e83d8bfb | /TakingOrder/java/good/job/pj/common/exception/ServiceException.java | f2d1d88d07155ce46362cd5ad2bcc8e1d5ab4a57 | [] | no_license | longbazb/TakingOrders | 9f9a0fcfab2614094fe766c0f4bb3a5dabe7e2bf | 823beb3345be6c15037a42b2c9721e32839136e1 | refs/heads/master | 2023-08-12T01:37:52.103425 | 2019-10-31T08:42:19 | 2019-10-31T08:42:19 | 217,248,434 | 0 | 0 | null | 2023-07-22T19:39:27 | 2019-10-24T08:21:58 | Java | UTF-8 | Java | false | false | 442 | java | package good.job.pj.common.exception;
public class ServiceException extends RuntimeException {
private static final long serialVersionUID = 7716942467478836250L;
public ServiceException() {
super();
}
public ServiceException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public ServiceException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
}
| [
"Administrator@2016-20180417HZ"
] | Administrator@2016-20180417HZ |
e2ba79bbd27f0b785fa9b826053b89ab24f8e36d | 0ebeebb9940a1245a902f5e52776dfd9a02e6ea0 | /src/org/assassin/jr/attabot/logger/DynamicLogger.java | 1776e94f0ea1bf3ef9377fe6918ba380da3e4518 | [] | no_license | jokerrules/atta | 712640dc695ce92a990e5e0f2a672426b5d1f249 | 8ad078567fa8fe520054095a424f792d1613dd5b | refs/heads/master | 2021-09-08T17:19:41.092466 | 2018-03-11T08:18:41 | 2018-03-11T08:18:41 | 121,135,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package org.assassin.jr.attabot.logger;
import java.util.HashMap;
import java.util.Map;
import org.assassin.jr.attabot.utility.AttaGobalSetting;
public class DynamicLogger {
private static DynamicLogger singleton;
private Map<String, LoggerStandard> mapLogger;
private DynamicLogger() {
this.mapLogger = new HashMap<String, LoggerStandard>();
}
public synchronized static DynamicLogger getInstance() {
if (singleton == null) {
singleton = new DynamicLogger();
}
return singleton;
}
public LoggerStandard getLogger(String name) {
LoggerStandard logger = mapLogger.get(name);
if (logger == null) {
logger = new LoggerRollingDate(AttaGobalSetting.getInstance().getStringValue(AttaGobalSetting.LOG_DIR) + name + "/" + name);
mapLogger.put(name, logger);
}
return logger;
}
} | [
"[email protected]"
] | |
a49b1509a72de129274a8a04f288cf027fee5978 | 40c3fcdef18020c903929ba0981e8c6c0dcd09f8 | /tubemq-connectors/tubemq-connector-flink/src/main/java/org/apache/flink/connectors/tubemq/TubemqOptions.java | d37dbe0eeb7fee9a2d29e6c916b1aa8bf6b1b1a7 | [
"Apache-2.0",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | zjmeow/incubator-tubemq | 7dabb443452d291dee6adb0c3f5f5acb82de01ba | e25e399c6994d9dc45f10e84dd1f5b50dd072b11 | refs/heads/master | 2022-12-05T00:09:45.448367 | 2020-08-19T11:08:54 | 2020-08-19T11:08:54 | 288,690,447 | 1 | 0 | Apache-2.0 | 2020-08-19T09:32:46 | 2020-08-19T09:32:45 | null | UTF-8 | Java | false | false | 2,620 | 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.
*/
package org.apache.flink.connectors.tubemq;
import org.apache.flink.configuration.ConfigOption;
import org.apache.flink.configuration.ConfigOptions;
/**
* The configuration options for tubemq sources and sink.
*/
public class TubemqOptions {
public static final ConfigOption<String> SESSION_KEY =
ConfigOptions.key("session.key")
.noDefaultValue()
.withDescription("The session key for this consumer group at startup.");
public static final ConfigOption<String> TID =
ConfigOptions.key("topic.tid")
.noDefaultValue()
.withDescription("The tid owned this topic.");
public static final ConfigOption<Integer> MAX_RETRIES =
ConfigOptions.key("max.retries")
.defaultValue(5)
.withDescription("The maximum number of retries when an " +
"exception is caught.");
public static final ConfigOption<Boolean> BOOTSTRAP_FROM_MAX =
ConfigOptions.key("bootstrap.from.max")
.defaultValue(false)
.withDescription("True if consuming from the most recent " +
"position when the tubemq source starts.. It only takes " +
"effect when the tubemq source does not recover from " +
"checkpoints.");
public static final ConfigOption<String> SOURCE_MAX_IDLE_TIME =
ConfigOptions.key("source.task.max.idle.time")
.defaultValue("5min")
.withDescription("The max time of the source marked as temporarily idle.");
public static final ConfigOption<String> MESSAGE_NOT_FOUND_WAIT_PERIOD =
ConfigOptions.key("message.not.found.wait.period")
.defaultValue("350ms")
.withDescription("The time of waiting period if tubemq broker return message not found.");
}
| [
"[email protected]"
] | |
9bc49c00071159bb8bf638ee9756b1d2cddad261 | 31f043184e2839ad5c3acbaf46eb1a26408d4296 | /src/main/java/com/github/highcharts4gwt/model/highcharts/option/jso/plotoptions/line/JsoLegendItemClickEvent.java | 29ec90eed29c9469fabb2c12bae8535c3e49c65f | [] | no_license | highcharts4gwt/highchart-wrapper | 52ffa84f2f441aa85de52adb3503266aec66e0ac | 0a4278ddfa829998deb750de0a5bd635050b4430 | refs/heads/master | 2021-01-17T20:25:22.231745 | 2015-06-30T15:05:01 | 2015-06-30T15:05:01 | 24,794,406 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java |
package com.github.highcharts4gwt.model.highcharts.option.jso.plotoptions.line;
import com.github.highcharts4gwt.model.highcharts.object.api.Series;
import com.github.highcharts4gwt.model.highcharts.option.api.plotoptions.line.LegendItemClickEvent;
import com.google.gwt.dom.client.NativeEvent;
public class JsoLegendItemClickEvent
extends NativeEvent
implements LegendItemClickEvent
{
protected JsoLegendItemClickEvent() {
}
public final native Series series()
throws RuntimeException /*-{
return this.source;
}-*/
;
}
| [
"[email protected]"
] | |
5373911273d349e388bd3927533630a5e061a40a | b723cd7038c2c3734eee1f7bd61b6d1f6362dd79 | /JavaEx/src/com/javaex/io/bytestream/FileStreamEx.java | be3080084d12c23220026ead0a284740f2380986 | [] | no_license | scottku/JavaEX | 74271f6b4382fcb7f1b79febfe46e93832832bce | dba15e707e994ec8ac1b63b227a9253ef97cbc7e | refs/heads/master | 2023-05-06T05:33:10.268233 | 2021-05-31T00:45:48 | 2021-05-31T00:45:48 | 363,072,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | package com.javaex.io.bytestream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class FileStreamEx {
static String rootPath = System.getProperty("user.dir") + "\\files\\";
static String source = rootPath + "img.jpg"; // -> read
static String target = rootPath + "img_copy.jpg";// <- write
public static void main(String[] args) {
try {
InputStream is = new FileInputStream(source);
OutputStream os = new FileOutputStream(target);
int data = 0;
while((data = is.read()) != -1) {
// 출력
os.write(data);
}
os.close();
is.close();
System.out.println("파일을 복사했습니다.");
// TODO : 성능 개선 (보조 스트림 이용)
} catch (FileNotFoundException e) {
System.err.println("파일을 찾을 수 없습니다.");
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
df3918fdaece480d16e8a3e4d0cc714deeabc8ff | 1e0e9b82cbd43b13eedc44186f065b6804f13080 | /leadcanary-watcher/gen/com/squareup/leakcanary/watcher/R.java | ed4bd77ffbc3123457c21e745ac43a5427713b2e | [] | no_license | liwenzhi/wenzhi_leakCanary_eclipse | bc429767cae72dc29033a26e6b310f44acee30ba | 1b08e4234ba777ba1d9c2466216ba7b64ccb929f | refs/heads/master | 2021-01-25T07:02:10.560175 | 2017-06-08T15:31:43 | 2017-06-08T15:31:43 | 93,646,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | /*___Generated_by_IDEA___*/
package com.squareup.leakcanary.watcher;
/* This stub is for using by IDE only. It is NOT the R class actually packed into APK */
public final class R {
} | [
"[email protected]"
] | |
101d8cd86ff900ae42cdb3426c87f911472760e4 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EnableHealthServiceAccessForOrganizationResult.java | 50088c202364bd75f55b4a03b21483771a758430 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,517 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.health.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/health-2016-08-04/EnableHealthServiceAccessForOrganization"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class EnableHealthServiceAccessForOrganizationResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements
Serializable, Cloneable {
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof EnableHealthServiceAccessForOrganizationResult == false)
return false;
EnableHealthServiceAccessForOrganizationResult other = (EnableHealthServiceAccessForOrganizationResult) obj;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
return hashCode;
}
@Override
public EnableHealthServiceAccessForOrganizationResult clone() {
try {
return (EnableHealthServiceAccessForOrganizationResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
4058ede953e38efa65f550668760ae7dc9dae8e4 | 23acf5f50e8629949b2f26288a11651b5af3fe77 | /src/main/g8/$api__packaged$/src/main/$java__packaged$/com/isuwang/soa/hello/service/HelloService.java | ebc49204cdb0a37344c43698c30ee8530642cde4 | [] | no_license | isuwang/dapeng-soa.g8 | b2d179aaee34a54e8a6e8b8429b4bc997ca1c36d | 5fc9ca76337c81a249b153db07cf1cc3f9ca41e6 | refs/heads/master | 2021-09-02T15:15:55.695798 | 2017-12-18T15:40:31 | 2017-12-18T15:40:31 | 109,946,763 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 578 | java |
package com.isuwang.soa.hello.service;
import com.isuwang.dapeng.core.Processor;
import com.isuwang.dapeng.core.Service;
/**
* Autogenerated by Dapeng-Code-Generator (1.2.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*
**/
@Service(name="com.isuwang.soa.hello.service.HelloService",version = "1.0.0")
@Processor(className = "com.isuwang.soa.hello.HelloServiceCodec\$Processor")
public interface HelloService {
/**
*
**/
com.isuwang.soa.hello.domain.Hello sayHello( String content) throws com.isuwang.dapeng.core.SoaException;
} | [
"[email protected]"
] | |
6e525c596f39941ae80c42c842433b7cfec1c23b | 3cfffef6873f6e15baeb3839a32920d677fe0956 | /src/main/java/com/zxs/server/mobile/controller/gugeng/repairmanage/ProductionManageRepairManageMController.java | 02e1fc9dc0c57df17e02e2cf47345d73792d1543 | [] | no_license | jayzc1234/learngit | 2ba4c8bf939ea82b7bc73d17c6f1dc5fb09139f8 | 804d6bb3317acf23477b044a841b0ebf7c10a966 | refs/heads/master | 2022-07-16T16:53:45.645407 | 2021-08-05T13:15:17 | 2021-08-05T13:15:17 | 158,473,801 | 0 | 0 | null | 2022-06-21T03:38:42 | 2018-11-21T01:33:25 | Java | UTF-8 | Java | false | false | 7,449 | java | package com.zxs.server.mobile.controller.gugeng.repairmanage;
import com.jgw.supercodeplatform.common.AbstractPageService;
import com.jgw.supercodeplatform.exception.SuperCodeException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import net.app315.hydra.intelligent.planting.annotation.gugeng.NeedAdvancedSearch;
import net.app315.hydra.intelligent.planting.common.gugeng.model.RestResult;
import net.app315.hydra.intelligent.planting.common.gugeng.util.CommonUtil;
import net.app315.hydra.intelligent.planting.dto.gugeng.repairmanage.*;
import net.app315.hydra.intelligent.planting.server.service.gugeng.common.repairmanage.ExportRepairApplyPdfService;
import net.app315.hydra.intelligent.planting.server.service.gugeng.repairmanage.ProductionManageRepairManageService;
import net.app315.hydra.intelligent.planting.vo.gugeng.repairmanage.ProductionManageRepairManageDetailVO;
import net.app315.hydra.intelligent.planting.vo.gugeng.repairmanage.ProductionManageRepairManageListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import static net.app315.hydra.intelligent.planting.AppConstants.VALID_MOBILE_PATH;
/**
* <p>
* 前端控制器
* </p>
*
* @author shixiongfei
* @since 2019-09-29
*/
@RestController
@RequestMapping(VALID_MOBILE_PATH+"/repairManage")
@Api(value = "维修管理", tags = "维修管理")
public class ProductionManageRepairManageMController extends CommonUtil {
@Autowired
private ProductionManageRepairManageService service;
@Autowired
private ExportRepairApplyPdfService applyPdfService;
@PostMapping("/callRepair")
@ApiOperation(value = "维修申请", notes = "维修申请")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult callRepair(@RequestBody ProductionManageRepairApplyDTO repairApplyDTO) throws SuperCodeException, ParseException {
service.callRepair(repairApplyDTO);
return RestResult.success();
}
@PostMapping("/assignRepair")
@ApiOperation(value = "维修指派")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult assignRepair(@RequestBody ProductionManageRepairAssignDTO assignDTO) throws SuperCodeException, ParseException {
service.assignRepair(assignDTO);
return RestResult.success();
}
@PostMapping("/runRepair")
@ApiOperation(value = "执行维修")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult runRepair(@RequestBody ProductionManageRunRepairDTO runRepairDTO) throws SuperCodeException, ParseException {
service.runRepair(runRepairDTO);
return RestResult.success();
}
@PostMapping("/doneRepair")
@ApiOperation(value = "维修完成")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult doneRepair(@RequestBody ProductionManageRepairDoneDTO repairDoneDTO) throws SuperCodeException, ParseException {
service.doneRepair(repairDoneDTO);
return RestResult.success();
}
@PostMapping("/doneConfirm")
@ApiOperation(value = "完成确定")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult doneConfirm(@RequestBody ProductionManageRepairConfirmDoneManageDTO confirmDoneManageDTO) throws SuperCodeException, ParseException {
service.doneConfirm(confirmDoneManageDTO);
return RestResult.success();
}
@PostMapping("/commentRepair")
@ApiOperation(value = "维修评价")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult commentRepair(@RequestBody ProductionManageRepairCommentDTO commentDTO) throws SuperCodeException, ParseException {
service.commentRepair(commentDTO);
return RestResult.success();
}
@PostMapping("/update")
@ApiOperation(value = "更新")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult update(@RequestBody ProductionManageRepairApplyDTO repairApplyDTO) throws SuperCodeException {
service.update(repairApplyDTO);
return RestResult.success();
}
@DeleteMapping("/deleteOne")
@ApiOperation(value = "删除")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult deleteOne(@RequestParam("id") Long id) throws SuperCodeException {
service.deleteOne(id);
return RestResult.success();
}
@GetMapping("/detail")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
@ApiOperation(value = "查看")
public RestResult<ProductionManageRepairManageDetailVO> getById(@RequestParam("id") Long id) throws SuperCodeException {
ProductionManageRepairManageDetailVO repairManageDetailVO=service.detail(id);
return RestResult.success(repairManageDetailVO);
}
@NeedAdvancedSearch
@GetMapping("/list")
@ApiOperation(value = "列表")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public RestResult<AbstractPageService.PageResults<List<ProductionManageRepairManageListVO>>> list(ProductionManageRepairManageListDTO repairManageListDTO) throws SuperCodeException {
return RestResult.success(CommonUtil.iPageToPageResults(service.pageList(repairManageListDTO),null));
}
@PostMapping("/exportPdf")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
@ApiOperation(value = "导出pdf", notes = "")
public void exportPdf(@RequestParam("id") Long id, HttpServletResponse response) throws Exception {
response.setHeader("Content-disposition", "attachment;filename=工程维修单.pdf");
applyPdfService.exportPdf(id,response.getOutputStream());
}
/**
* 信息导出
*/
@NeedAdvancedSearch
@PostMapping("/exportExcel")
@ApiOperation(value = "导出excel", notes = "")
@ApiImplicitParam(name = "super-token", paramType = "header", defaultValue = "64b379cd47c843458378f479a115c322", value = "token信息", required = true)
public void export(ProductionManageRepairManageListDTO listDTO, HttpServletResponse response) throws Exception {
service.exportExcel(listDTO, getExportNumber(), "维修管理", response);
}
}
| [
"[email protected]"
] | |
8201eb1be85a0486dfc9053ccc917ecb82d155c6 | 1a5b44cfe82af1b1cdb485a48bdf3483c6a3e2dd | /Member/src/main/java/com/icia/member/dao/MemberDAO.java | abbdb5f06cd0956c66939df490c43966a79a8742 | [] | no_license | lehebk/FRAME | 79f7fd8c7cd5ccf4b8a93e0e9d8d6420af51e178 | 868aa195d8f99320daed813c820ef089133a02b5 | refs/heads/master | 2023-05-11T11:27:18.767999 | 2021-06-02T10:39:07 | 2021-06-02T10:39:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package com.icia.member.dao;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.icia.member.dto.MemberDTO;
@Repository
public class MemberDAO {
@Autowired
private SqlSessionTemplate sql;
public int memberjoin(MemberDTO member) {
return sql.insert("mm.memberjoin", member);
}
public String memberLogin(MemberDTO member) {
return sql.selectOne("mm.memberlogin", member);
}
public MemberDTO update(String loginId) {
return sql.selectOne("mm.memberupdate", loginId);
}
public int updateProcess(MemberDTO member) {
return sql.update("mm.updateprocess", member);
}
}
| [
"[email protected]"
] | |
d1a765bb9d0f3932253bb523154e78a60b1e0ca9 | 688f0c041250cbe4735d36cc58c3891d59a6cbd0 | /src/warenautomat/Kasse.java | f83444043405d2f27c618381df8188e744d632ec | [
"MIT"
] | permissive | LucaMele/warenautomat | f20b23554800fe5214aacaffbd3bb9c7f25f269b | 225a7b055a84a778cc9d3953185ea35074be83b0 | refs/heads/master | 2021-01-23T10:35:44.332148 | 2017-06-08T17:04:20 | 2017-06-08T17:04:20 | 93,075,302 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,178 | java | package warenautomat;
import java.util.ArrayList;
import warenautomat.SystemSoftware;
/**
* Die Kasse verwaltet das eingenommene Geld sowie das Wechselgeld. <br>
* Die Kasse hat fünf Münz-Säulen für: <br>
* - 10 Rappen <br>
* - 20 Rappen <br>
* - 50 Rappen <br>
* - 1 Franken <br>
* - 2 Franken <br>
*/
public class Kasse {
private Muenzseule[] mMuenzseule;
final static boolean DRY_RUN = true;
final static int OEFFNEN_MODUS = 1;
final static int RESTGELD_MODUS = 2;
// immer von klein zu gross!
final static double VALUE_MUENZEN[] = { 0.10, 0.20, 0.50, 1.00, 2.00 };
private double mEinwurfBetrag;
private Statistik mStatistik;
/**
* Standard-Konstruktor. <br>
* Führt die nötigen Initialisierungen durch.
*/
public Kasse() {
int totMuenezen = VALUE_MUENZEN.length;
mMuenzseule = new Muenzseule[totMuenezen];
for (int i = 0; i < totMuenezen; i++) {
mMuenzseule[i] = new Muenzseule(VALUE_MUENZEN[i], 0);
}
mEinwurfBetrag = 0.0;
mStatistik = new Statistik();
}
/**
* Diese Methode wird aufgerufen nachdem das Personal beim Verwalten des
* Wechselgeldbestand die Münzart und die Anzahl der Münzen über die
* Tastatur eingegeben hat
* (siehe Use-Case "Wechselgeldbestand (Münzbestand) verwalten").
*
* @param pMuenzenBetrag Der Betrag der Münzart in Franken.
* @param pAnzahl Die Anzahl der Münzen. Bei der Entnahme von Münzen als
* entsprechender negativer Wert.
* @return Anzahl der Münzen welche hinzugefügt resp. entnommen werden (bei
* Entnahme als negativer Wert). <br>
* Im Normalfall entspricht dieser Wert dem Übergabeparameter
* <code>pAnzahl</code>. <br>
* Er kann kleiner sein falls beim Hinzufügen in der Münzsäule zu
* wenig Platz vorhanden ist oder wenn bei der Entnahme ein grössere
* Anzahl angegeben wurde als tatsächlich in der Münzsäule vorhanden
* ist. <br>
* Wenn ein nicht unterstützter Münzbetrag übergeben wurde: -200
*/
public int verwalteMuenzbestand(double pMuenzenBetrag, int pAnzahl) {
boolean muenzeGefunden = false;
int totalMuenzeUnterschied = 0;
for (int i = 0; i < mMuenzseule.length; i++) {
if (getIntValueMuenze(mMuenzseule[i].gibMuenzart()) == getIntValueMuenze(pMuenzenBetrag)) {
mMuenzseule[i].istAmVerwalten(true);
int originalAnzahl = mMuenzseule[i].gibAnzahlMuenzen();
if (pAnzahl < 0) {
mMuenzseule[i].entferneMuenzen(Math.abs(pAnzahl));
totalMuenzeUnterschied = mMuenzseule[i].gibAnzahlMuenzen() - originalAnzahl;
} else {
mMuenzseule[i].fuegeMunzenHinzu(pAnzahl);
totalMuenzeUnterschied = mMuenzseule[i].gibAnzahlMuenzen() - originalAnzahl;
}
muenzeGefunden = true;
mMuenzseule[i].istAmVerwalten(false);
break;
}
}
if(!muenzeGefunden) {
return -200;
}
return totalMuenzeUnterschied;
}
/**
* Diese Methode wird aufgerufen nachdem das Personal beim Geldauffüllen den
* Knopf "Bestätigen" gedrückt hat
* (siehe Use-Case "Wechselgeldbestand (Münzbestand) verwalten"). <br>
* Verbucht die Münzen gemäss dem vorangegangenen Aufruf der Methode
* <code>verwalteMuenzbestand()</code>.
*/
public void verwalteMuenzbestandBestaetigung() {
for (int i = 0; i < mMuenzseule.length; i++) {
mMuenzseule[i].speichereVerwalteteMuenzen();
SystemSoftware.zeigeMuenzenInGui(mMuenzseule[i].gibMuenzart(), mMuenzseule[i].gibAnzahlMuenzen());
}
}
/**
* Diese Methode wird aufgerufen wenn ein Kunde eine Münze eingeworfen hat. <br>
* Führt den eingenommenen Betrag entsprechend nach. <br>
* Stellt den nach dem Einwerfen vorhandenen Betrag im Kassen-Display dar. <br>
* Eingenommenes Geld steht sofort als Wechselgeld zur Verfügung. <br>
* Die Münzen werden von der Hardware-Kasse auf Falschgeld, Fremdwährung und
* nicht unterstützte Münzarten geprüft, d.h. diese Methode wird nur
* aufgerufen wenn ein Münzeinwurf soweit erfolgreich war. <br>
* Ist die Münzsäule voll (d.h. 100 Münzen waren vor dem Einwurf bereits darin
* enthalten), so wird mittels
* <code> SystemSoftware.auswerfenWechselGeld() </code> unmittelbar ein
* entsprechender Münz-Auswurf ausgeführt. <br>
* Hinweis: eine Hardware-Münzsäule hat jeweils effektiv Platz für 101 Münzen.
*
* @param pMuenzenBetrag Der Betrag der neu eingeworfenen Münze in Franken.
* @return <code> true </code>, wenn er Einwurf erfolgreich war. <br>
* <code> false </code>, wenn Münzsäule bereits voll war.
*/
public boolean einnehmen(double pMuenzenBetrag) {
for (int i = 0; i < mMuenzseule.length; i++) {
if (getIntValueMuenze(mMuenzseule[i].gibMuenzart()) == getIntValueMuenze(pMuenzenBetrag)) {
return checkAndFillAndShow(mMuenzseule[i], 1);
}
}
return false;
}
/**
*
* @param mMuenzseule
* @param pAmount
* @return
*/
private boolean checkAndFillAndShow(Muenzseule pMuenzseule, int pAmount) {
if (pMuenzseule.fuegeMunzenHinzu(pAmount)) {
aktualisiereBetrag(pMuenzseule, pAmount);
return true;
}
return false;
}
/**
*
* @param pMuenzseule
*/
private void aktualisiereBetrag(Muenzseule pMuenzseule, int pAmount) {
int eingefuegtesGeld = getIntValueMuenze(pMuenzseule.gibMuenzart()) * pAmount;
mEinwurfBetrag = getDoubleValueMuenze(getIntValueMuenze(mEinwurfBetrag) + eingefuegtesGeld);
SystemSoftware.zeigeBetragAn(mEinwurfBetrag);
}
/**
*
* @param muenze
* @return
*/
public int getIntValueMuenze(double pMuenze) {
return (int) Math.round(pMuenze * 100);
}
/**
*
* @return
*/
public double getEinwurfBetrag() {
return mEinwurfBetrag;
}
/**
*
* @param muenze
* @return
*/
public double getDoubleValueMuenze(int pMuenze) {
return pMuenze / 100.0;
}
/**
* Bewirkt den Auswurf des Restbetrages.
*/
public void gibWechselGeld() {
if (getIntValueMuenze(mEinwurfBetrag) != 0) {
if (entferneMuenzenVonIntBetrag(getIntValueMuenze(mEinwurfBetrag), RESTGELD_MODUS) == 0) {
SystemSoftware.auswerfenWechselGeld(mEinwurfBetrag);
mEinwurfBetrag = 0.0;
SystemSoftware.zeigeBetragAn(mEinwurfBetrag);
} else {
throw new Error("System Fehler, sollte nie vorkommen dass ein fach offen ist dass kein wechselgeld hat!");
}
// TODO -> remove before prod
for (int i = mMuenzseule.length - 1; i >= 0; i--) {
System.out.print("\nREST in Kolonnen: " + mMuenzseule[i].gibAnzahlMuenzen() + " des tip: "+ mMuenzseule[i].gibMuenzart() + "\n");
}
}
}
/**
* Gibt den Gesamtbetrag der bisher verkauften Waren zurück. <br>
* Analyse: Abgeleitetes Attribut.
*
* @return Gesamtbetrag der bisher verkauften Waren.
*/
public double gibBetragVerkaufteWaren() {
int ganzWert = 0;
ArrayList<Ware> warenbezug = mStatistik.gibWarenbezug();
for (Ware ware: warenbezug) {
ganzWert += getIntValueMuenze(ware.getPreis());
}
return getDoubleValueMuenze(ganzWert);
}
/**
*
* @return
*/
public Statistik getStatistik() {
return mStatistik;
}
/**
*
* @param betrag
* @param pDryRun
* @return
*/
public boolean entferneGeldMuenzseule (double pBetrag, boolean pDryRun, int pModus) {
int preisInt = getIntValueMuenze(pBetrag);
int restGeldNachBezahlung = getIntValueMuenze(mEinwurfBetrag) - preisInt;
if (!pDryRun) {
mEinwurfBetrag = getDoubleValueMuenze(restGeldNachBezahlung);
SystemSoftware.zeigeBetragAn(mEinwurfBetrag);
}
restGeldNachBezahlung = entferneMuenzenVonIntBetrag(restGeldNachBezahlung, pModus);
return restGeldNachBezahlung == 0;
}
/**
*
* @param preisInt
* @return
*/
private int entferneMuenzenVonIntBetrag(int pBetragInt, int pModus) {
for (int i = mMuenzseule.length - 1; i >= 0; i--) {
int maxMuenzeDiePlatzHaben = (int) (pBetragInt / getIntValueMuenze(mMuenzseule[i].gibMuenzart()));
int anzahlMuenzen = mMuenzseule[i].gibAnzahlMuenzen();
if (maxMuenzeDiePlatzHaben > anzahlMuenzen) {
maxMuenzeDiePlatzHaben = anzahlMuenzen;
}
if (maxMuenzeDiePlatzHaben > 0 && maxMuenzeDiePlatzHaben > 0) {
int tmpPreis = pBetragInt - (maxMuenzeDiePlatzHaben * getIntValueMuenze(mMuenzseule[i].gibMuenzart()));
if (tmpPreis == 0) {
pBetragInt = tmpPreis;
if (pModus == RESTGELD_MODUS) {
mMuenzseule[i].entferneMuenzen(maxMuenzeDiePlatzHaben);
}
break;
} else if (tmpPreis > 0) {
pBetragInt = tmpPreis;
if (pModus == RESTGELD_MODUS) {
mMuenzseule[i].entferneMuenzen(maxMuenzeDiePlatzHaben);
}
}
}
}
return pBetragInt;
}
/**
*
* @param betrag
* @return
*/
public boolean istAusreichendWechselgeldVorhanden(double pBetrag) {
return entferneGeldMuenzseule(pBetrag, DRY_RUN, OEFFNEN_MODUS);
}
/**
*
* @param preis
* @return
*/
public boolean istAusreichendGuthabendVorhanden (double pPreis){
int wertEingewurfeneBetrag = getIntValueMuenze(mEinwurfBetrag);
int wertWare = getIntValueMuenze(pPreis);
return wertEingewurfeneBetrag >= wertWare;
}
}
| [
"[email protected]"
] | |
cb26befb414340ee452481368e330663ede09a5a | 4315f28ca48cc4a46ee924bae604fe18ba8b08f8 | /gitproject/src/gitproject/test2.java | 2468b2f27ee6476dfd52027c1c76fcfec55bfee8 | [] | no_license | bharathimidde/git | 4ee0aec6116adec2089685437e993499e04bc0a3 | d71f6527dcd0f09a9b94cb9e22734df4b9a045c1 | refs/heads/master | 2023-03-02T03:46:27.684022 | 2021-02-02T08:11:07 | 2021-02-02T08:11:07 | 335,214,024 | 0 | 0 | null | 2021-02-02T16:04:02 | 2021-02-02T08:09:18 | Java | UTF-8 | Java | false | false | 140 | java | package gitproject;
public class test2 {
public static void main(String[] args) {
System.out.println("second program");
}
}
| [
"[email protected]"
] | |
ec141428af67a2315e1eb59dcf0282731d9f051c | 06c302ae0ee099de7c00897d1d8b1e48d45ecc5b | /src/com/qlzy/mainPage/indexGoods/service/impl/DictionaryServiceImpl.java | b1da47fcb0d64dcc566a899c9f8cbd274446a362 | [] | no_license | 945284941/haoxingPC | c14df3d69bca6f8b0b1f6d8af3f09b8b8686c678 | af53b4afe937981d8937c21116e834e1a8e15b92 | refs/heads/master | 2020-03-15T11:23:22.413113 | 2018-05-25T05:26:35 | 2018-05-25T05:26:35 | 132,119,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,267 | java | package com.qlzy.mainPage.indexGoods.service.impl;
import com.qlzy.mainPage.indexGoods.dao.QlDictMapper;
import com.qlzy.mainPage.indexGoods.service.DictionaryService;
import com.qlzy.model.QlDict;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2018/4/2.
*/
@Service("dictionaryService")
public class DictionaryServiceImpl implements DictionaryService {
@Resource
QlDictMapper qlDictMapper;
@Override
public QlDict gainByType(String type){
return qlDictMapper.getByType(type);
}
@Override
public Map<String, Double> selectByHvType(String hv_type) {
Map<String,Double> resultMap = new HashMap<>();
List<QlDict> querMap = qlDictMapper.selectByType(hv_type);
if(null != querMap && querMap.size() > 0){
for(QlDict dictionary :querMap){
resultMap.put(dictionary.getLabel(),Double.parseDouble(dictionary.getValue()));
}
}
return resultMap;
}
@Override
public List<QlDict> selectByType(String type) {
List<QlDict> querMap = qlDictMapper.selectByType(type);
return querMap;
}
}
| [
"[email protected]"
] | |
bd9f1a0312012cb08a9a43764cce4dd76779a722 | e70ce3054aa22dd22895eed9ba6f2dbb5f51a9f3 | /manage/src/main/java/team/nercita/manage/cms/service/project/BusinessService.java | 64234574750ffe1a68c92db716525c6c334169e6 | [] | no_license | love-zhawa/manage | e42c4109fdfe5a76c39f1ea829997353c7e58ee3 | b874ceba9c79004c015f1fc4356090b5d468b039 | refs/heads/master | 2020-04-01T00:38:59.415905 | 2018-10-29T01:22:07 | 2018-10-29T01:22:07 | 152,706,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | /*
* BusinessService.java
* 创建者:侯建玮
* 系统名称:农业自动化内部管理系统。
* 创建日期:2017年11月19日 上午8:58:16
* 创业小团队-后台
*/
package team.nercita.manage.cms.service.project;
import java.util.List;
import java.util.Map;
import team.nercita.manage.cms.po.project.BusinessDetail;
import team.nercita.manage.cms.po.project.ProjectBusniess;
import team.nercita.manage.cms.po.project.ProjectFile;
/**
*
* @author 侯建玮
* @date 2017年11月19日 上午8:58:16
*/
public interface BusinessService {
public Map<String, Object> doJoinTransQueryBusiness(Integer goPage, Map<String, Object> paramMap);
public void doTransSaveProJectBusniess(ProjectBusniess projectBusniess, List<ProjectFile> fileList);
public ProjectBusniess doJoinTransFindProjectBusniessById(String id);
public void doTransUpdateProjectBusniess(ProjectBusniess projectBusniess, List<ProjectFile> fileList);
public void doTransSaveProjectNode(BusinessDetail businessDetail);
public void doTransDelBusiness(String id);
public List<BusinessDetail> doJoinTransQueryNode(String id);
public List<ProjectFile> doJoinTransFindFileList(String id);
public List<ProjectBusniess> doJoinTransQueryBuss();
}
| [
"Administrator@WV922H92DCCPOXN"
] | Administrator@WV922H92DCCPOXN |
3221cf95cc524d16f819c1ef41b17cb79876ac30 | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/Hadoop/1303_1.java | d8c3154678a617cf336776d725750bd069145055 | [
"MIT"
] | permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 693 | java | //,temp,TestFileBasedCopyListing.java,157,176,temp,TestIntegration.java,419,439
//,3
public class xxx {
private void caseSingleFileTargetDir(boolean sync) {
try {
Path listFile = new Path("/tmp/listing");
Path target = new Path("/tmp/target");
addEntries(listFile, "/tmp/singlefile2/file2");
createFiles("/tmp/singlefile2/file2");
mkdirs(target.toString());
runTest(listFile, target, true, sync);
checkResult(listFile, 1);
} catch (IOException e) {
LOG.error("Exception encountered while testing build listing", e);
Assert.fail("build listing failure");
} finally {
TestDistCpUtils.delete(fs, "/tmp");
}
}
}; | [
"[email protected]"
] | |
efbe0588a58b96f3f68addd1a2b857cbf24fb1e1 | 28c2a0b55ace621405654389af11b388455f2b38 | /src/main/java/concretemanor/tools/teamview/actions/ActionBeanBase.java | 614c21fa8f0f1f3e94ce455762fa31416ed91013 | [] | no_license | concretemanor/teamview | 680d4d6da1d879bd2b6b998028b402f1b03738a8 | 112b9aa255d3d6384286321a34bb030891fa967c | refs/heads/master | 2020-05-25T12:16:30.154962 | 2013-04-14T19:07:04 | 2013-04-14T19:07:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 641 | java | package concretemanor.tools.teamview.actions;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.integration.spring.SpringBean;
import concretemanor.tools.teamview.service.IService;
public class ActionBeanBase {
ActionBeanContext context;
@SpringBean
private IService service;
public ActionBeanBase() {
super();
}
protected IService getService() {
return service;
}
public void setContext(ActionBeanContext context) {
this.context = context;
}
public ActionBeanContext getContext() {
return context;
}
} | [
"[email protected]"
] | |
206e220389f167bffe0bda4bd6256f996ab1e3b4 | 81da72b24376f1fc5a1fa831c8edd9c591008575 | /src/main/java/com/github/mybatis/spring/MapperFactoryBean.java | afd86e70817d5317992037e619144d4288f635e7 | [
"Apache-2.0"
] | permissive | ImmortalCountry/mybatis-spring-support | b0c0c0feebdcc5dcda836c2396568bc26403853d | de412e98d00e9a012c0619778fa1a61832863b82 | refs/heads/master | 2021-05-30T05:40:54.896825 | 2015-10-25T02:06:02 | 2015-10-25T02:06:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,656 | java | package com.github.mybatis.spring;
/*
* Copyright 2010-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
*/
import com.github.mybatis.entity.IdEntity;
import com.github.trace.TraceContext;
import com.github.trace.TraceRecorder;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.Reflection;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.session.Configuration;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.FactoryBean;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.*;
import static org.springframework.util.Assert.notNull;
/**
* BeanFactory that enables injection of MyBatis mapper interfaces. It can be set up with a
* SqlSessionFactory or a pre-configured SqlSessionTemplate.
*
* Sample configuration:
*
* <pre class="code">
* {@code
* <bean id="baseMapper" class="org.mybatis.spring.mapper.MapperFactoryBean" abstract="true" lazy-init="true">
* <property name="sqlSessionFactory" ref="sqlSessionFactory" />
* </bean>
*
* <bean id="oneMapper" parent="baseMapper">
* <property name="mapperInterface" value="my.package.MyMapperInterface" />
* </bean>
*
* <bean id="anotherMapper" parent="baseMapper">
* <property name="mapperInterface" value="my.package.MyAnotherMapperInterface" />
* </bean>
* }
* </pre>
*
* Note that this factory can only inject <em>interfaces</em>, not concrete classes.
*
* @author Eduardo Macarron
* @version $Id$
* @see org.mybatis.spring.SqlSessionTemplate
*/
public class MapperFactoryBean<T> extends SqlSessionDaoSupport implements FactoryBean<T> {
private static final Logger LOG = LoggerFactory.getLogger(MapperFactoryBean.class);
private static final TimeZone CHINA_ZONE = TimeZone.getTimeZone("GMT+08:00");
private static final Locale CHINA_LOCALE = Locale.CHINA;
private static final Set<String> NAMES = ImmutableSet.of("Boolean", "Character", "Byte", "Short", "Long", "Integer", "Byte", "Float", "Double", "Void", "String");
private Class<T> mapperInterface;
private String iface;
private boolean addToConfig = true;
/**
* Sets the mapper interface of the MyBatis mapper
*
* @param mapperInterface class of the interface
*/
public void setMapperInterface(Class<T> mapperInterface) {
this.mapperInterface = mapperInterface;
this.iface = mapperInterface.getSimpleName();
}
/**
* If addToConfig is false the mapper will not be added to MyBatis. This means
* it must have been included in mybatis-config.xml.
*
* If it is true, the mapper will be added to MyBatis in the case it is not already
* registered.
*
* By default addToCofig is true.
*
* @param addToConfig
*/
public void setAddToConfig(boolean addToConfig) {
this.addToConfig = addToConfig;
}
/**
* {@inheritDoc}
*/
@Override
protected void checkDaoConfig() {
super.checkDaoConfig();
notNull(this.mapperInterface, "Property 'mapperInterface' is required");
Configuration configuration = getSqlSession().getConfiguration();
if (this.addToConfig && !configuration.hasMapper(this.mapperInterface)) {
try {
configuration.addMapper(this.mapperInterface);
} catch (Throwable t) {
logger.error("Error while adding the mapper '" + this.mapperInterface + "' to configuration.", t);
throw new IllegalArgumentException(t);
} finally {
ErrorContext.instance().reset();
}
}
}
/**
* {@inheritDoc}
*/
public T getObject() throws Exception {
final T mapper = getSqlSession().getMapper(this.mapperInterface);
return Reflection.newProxy(this.mapperInterface, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
long start = System.currentTimeMillis();
TraceContext rpc = TraceContext.get();
String parameters = getParameters(args);
String iface = MapperFactoryBean.this.iface;
rpc.reset().inc().setStamp(start).setIface(iface).setMethod(method.getName()).setParameter(parameters);
try {
return method.invoke(mapper, args);
} catch (Exception e) {
rpc.setFail(true).setReason(e.getMessage());
LOG.error("{}.{}({})", iface, method.getName(), parameters, e);
throw e;
} finally {
rpc.setCost(System.currentTimeMillis() - start);
TraceRecorder.getInstance().post(rpc.copy());
}
}
});
}
/**
* {@inheritDoc}
*/
public Class<T> getObjectType() {
return this.mapperInterface;
}
/**
* {@inheritDoc}
*/
public boolean isSingleton() {
return false;
}
/**
* 函数参数信息
*
* @param args 参数列表
* @return 格式化输出
*/
protected String getParameters(Object[] args) {
if (args == null)
return "";
StringBuilder sbd = new StringBuilder();
if (args.length > 0) {
for (Object i : args) {
if (i == null) {
sbd.append("null");
} else {
Class clz = i.getClass();
if (isPrimitive(clz)) {
sbd.append(evalPrimitive(i));
} else if (clz.isArray()) {
evalArray(i, sbd);
} else if (Collection.class.isAssignableFrom(clz)) {
Object[] arr = ((Collection<?>) i).toArray();
evalArray(arr, sbd);
} else if (i instanceof Date) {
sbd.append('"').append(formatYmdHis(((Date) i))).append('"');
} else if (i instanceof IdEntity) {
sbd.append(i.getClass().getSimpleName()).append("[id=").append(((IdEntity) i).getId()).append(']');
}else {
sbd.append(clz.getSimpleName()).append(":OBJ");
}
}
sbd.append(',');
}
sbd.setLength(sbd.length() - 1);
}
return sbd.toString();
}
private static boolean isPrimitive(Class clz) {
return clz.isPrimitive() || NAMES.contains(clz.getSimpleName());
}
private String evalPrimitive(Object obj) {
String s = String.valueOf(obj);
if (s.length() > 32) {
return s.substring(0, 32) + "...";
}
return s;
}
private void evalArray(Object arr, StringBuilder sbd) {
int sz = Array.getLength(arr);
if (sz == 0) {
sbd.append("[]");
return;
}
Class<?> clz = Array.get(arr, 0).getClass();
if (clz == Byte.class) {
sbd.append("Byte[").append(sz).append(']');
return;
}
if (isPrimitive(clz)) {
sbd.append('[');
int len = Math.min(sz, 10);
for (int i = 0; i < len; i++) {
Object obj = Array.get(arr, i);
if (isPrimitive(obj.getClass())) {
sbd.append(evalPrimitive(obj));
} else {
sbd.append(obj.getClass().getSimpleName()).append(":OBJ");
}
sbd.append(',');
}
if (sz > 10) {
sbd.append(",...,len=").append(sz);
}
if (sbd.charAt(sbd.length() - 1) == ',') {
sbd.setCharAt(sbd.length() - 1, ']');
} else {
sbd.append(']');
}
} else {
sbd.append("[len=").append(sz).append(']');
}
}
/**
* 构造时间的显示,带上时分秒的信息,如 2013-06-11 03:14:25
*
* @param date 时间
* @return 字符串表示
*/
private String formatYmdHis(Date date) {
Calendar ca = Calendar.getInstance(CHINA_ZONE, CHINA_LOCALE);
ca.setTimeInMillis(date.getTime());
StringBuilder sbd = new StringBuilder();
sbd.append(ca.get(Calendar.YEAR)).append('-');
int month = 1 + ca.get(Calendar.MONTH);
if (month < 10) {
sbd.append('0');
}
sbd.append(month).append('-');
int day = ca.get(Calendar.DAY_OF_MONTH);
if (day < 10) {
sbd.append('0');
}
sbd.append(day).append(' ');
int hour = ca.get(Calendar.HOUR_OF_DAY);
if (hour < 10) {
sbd.append('0');
}
sbd.append(hour).append(':');
int minute = ca.get(Calendar.MINUTE);
if (minute < 10) {
sbd.append('0');
}
sbd.append(minute).append(':');
int second = ca.get(Calendar.SECOND);
if (second < 10) {
sbd.append('0');
}
sbd.append(second);
return sbd.toString();
}
protected Object findDefault(Method method) {
Class<?> clz = method.getReturnType();
if (clz == String.class) {
return "";
} else if (clz == Long.class || clz == Double.class) {
return 0L;
} else if (clz == Boolean.class) {
return Boolean.FALSE;
} else if (clz.isArray()) {
return new byte[0];
} else if (clz.isAssignableFrom(Set.class)) {
return ImmutableSet.of();
} else if (clz.isAssignableFrom(List.class)) {
return ImmutableList.of();
} else if (clz.isAssignableFrom(Map.class)) {
return ImmutableMap.of();
} else {
return null;
}
}
}
| [
"[email protected]"
] | |
65a8309c65d47e11150b6d80356d7af605852c5e | ae35d831bab14899f961a0b8784903708149a907 | /core/src/lando/systems/trainjam2016/utils/accessors/RectangleAccessor.java | 8bbb767b2285e3598a8e745aee79fa143c3d86e6 | [] | no_license | mtolly/trainjam-2016 | 854bb799ba5a078cc3a079796dede96307a0e364 | 4139862536d0be3c378bc828163c555369699439 | refs/heads/master | 2021-01-18T07:29:31.471383 | 2016-03-13T22:00:33 | 2016-03-13T22:00:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,297 | java | package lando.systems.trainjam2016.utils.accessors;
import aurelienribon.tweenengine.TweenAccessor;
import com.badlogic.gdx.math.Rectangle;
public class RectangleAccessor implements TweenAccessor<Rectangle> {
public static final int X = 1;
public static final int Y = 2;
public static final int W = 3;
public static final int H = 4;
public static final int XY = 5;
public static final int WH = 6;
public static final int XYWH = 7;
@Override
public int getValues(Rectangle target, int tweenType, float[] returnValues) {
switch (tweenType) {
case X: returnValues[0] = target.x; return 1;
case Y: returnValues[0] = target.y; return 1;
case W: returnValues[0] = target.width; return 1;
case H: returnValues[0] = target.height; return 1;
case XY:
returnValues[0] = target.x;
returnValues[1] = target.y;
return 2;
case WH:
returnValues[0] = target.getWidth();
returnValues[1] = target.getHeight();
return 2;
case XYWH:
returnValues[0] = target.x;
returnValues[1] = target.y;
returnValues[2] = target.width;
returnValues[3] = target.height;
return 4;
default: assert false; return -1;
}
}
@Override
public void setValues(Rectangle target, int tweenType, float[] newValues) {
switch (tweenType) {
case X: target.x = newValues[0]; break;
case Y: target.y = newValues[0]; break;
case W: target.width = newValues[0]; break;
case H: target.height = newValues[0]; break;
case XY:
target.x = newValues[0];
target.y = newValues[1];
break;
case WH:
target.width = newValues[0];
target.height = newValues[1];
break;
case XYWH:
target.x = newValues[0];
target.y = newValues[1];
target.width = newValues[2];
target.height = newValues[3];
break;
default: assert false;
}
}
}
| [
"[email protected]"
] | |
46d9417fd4f19d2f03f6fb729197ddc051b33d6f | c5a3b7cf4e2a66f75860658a3f38462458dd3150 | /library/src/main/java/com/kimeeo/library/utils/NetworkUtilities.java | 1d86c7dcef7bc57d1e70c9f004708de196ea5b11 | [] | no_license | djinnovations/Kandroid | e59391678db98018a5e4cca7f94bfcf097676ffe | 28de2c8ae96b0706dc363a3ccca4ed798b6f8683 | refs/heads/master | 2021-01-16T20:05:49.806107 | 2016-05-10T15:20:09 | 2016-05-10T15:20:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,283 | java | package com.kimeeo.library.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by bhavinpadhiyar on 4/13/15.
*/
public class NetworkUtilities
{
public static boolean haveConnectedWifi(Context c)
{
boolean connectedWifi = false;
ConnectivityManager cm = (ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
if ( ni != null && ni.getType() == ConnectivityManager.TYPE_WIFI && ni.isConnectedOrConnecting())
connectedWifi = true;
return connectedWifi;
}
public static boolean haveConnectedMobile(Context c)
{
boolean connectedMobile = false;
ConnectivityManager cm = (ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
if ( ni != null && ni.getType() == ConnectivityManager.TYPE_MOBILE && ni.isConnectedOrConnecting())
connectedMobile = true;
return connectedMobile;
}
public static boolean haveConnected2GMobile(Context c)
{
boolean connectedMobile = false;
ConnectivityManager cm = (ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
if ( ni != null && ni.getType() == ConnectivityManager.TYPE_MOBILE && ni.isConnectedOrConnecting())
connectedMobile = true;
return connectedMobile;
}
public static boolean isConnected(Context c)
{
boolean haveConnectedWifi = false;
boolean haveConnectedMobile = false;
ConnectivityManager cm = (ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
if ( ni != null )
{
if (ni.getType() == ConnectivityManager.TYPE_WIFI)
if (ni.isConnectedOrConnecting())
haveConnectedWifi = true;
if (ni.getType() == ConnectivityManager.TYPE_MOBILE)
if (ni.isConnectedOrConnecting())
haveConnectedMobile = true;
}
return haveConnectedWifi || haveConnectedMobile;
}
}
| [
"[email protected]"
] | |
16c89691eace1f4dbc5fd185be48916c99af280b | b25097ff76ac644dcf10252883a082250e542aaf | /week7/IntegerArrayTest/src/IntegerArrayTest.java | ccd39351013bee834cadb521487db3c03c383e7a | [] | no_license | ConnorDillonDev/JavaWokshops | d75c22df69301645df9b6fbc7a958f7c35c70ab4 | 1682765eace6e33bd041790d9cd0c64e266e0ecf | refs/heads/master | 2022-11-05T16:08:35.178342 | 2020-06-19T12:08:41 | 2020-06-19T12:08:41 | 247,721,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java |
public class IntegerArrayTest {
public static void main(String[] args) {
Integer[] numbers={5, 6, 3, 7, 8};
IntegerArray integers = new IntegerArray(numbers);
System.out.println(integers);
System.out.println("total: "+integers.getTotal());
}
}
| [
"[email protected]"
] | |
6c835b70c5f1e9c3638fc3f4b1a0d9aa64ee4b51 | a0eb77c1bb0c48aa98b3c5f6f0617befb27c815d | /src/AgentFusionCenter.java | ca5948c17471e0c5b242701a2d08eaacaed71f1d | [] | no_license | nyrzhun/Simulation | da395ecc8c679d4d4cfe3fdd343d5b152691c421 | b618c3a655ad44acafc1f18e4afae6b09d1823ad | refs/heads/master | 2021-06-15T00:28:34.066107 | 2017-03-06T06:02:15 | 2017-03-06T06:02:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,474 | java | import java.util.ArrayList;
import java.util.Iterator;
public class AgentFusionCenter extends AgentAbstract{
private double theta;
RunTime rt;
int cycles;
public ArrayList<Double> averageReads = new ArrayList<Double>();
public AgentFusionCenter(RunTime rt,double theta,int cycles){
this.rt = rt;
this.theta = theta;
this.cycles = cycles;
}
public double getAverageTheta(){
Iterator it = averageReads.iterator();
double average = 0;
while(it.hasNext()){
average +=(double) it.next();
}
return average /= averageReads.size();
}
@Override
public void step() {
// TODO Auto-generated method stub
Iterator it = rt.agents.iterator();
double averageTheta = 0;
while(it.hasNext()){
AgentAbstract t = (AgentAbstract) it.next();
if( t.getClass() == AgentNode.class){
AgentNode node = (AgentNode) t;
averageTheta += node.theta;
averageReads.add(node.theta);
}
}
averageTheta /= (rt.agents.size() - 1);
System.out.println("Average Theta of this step is "+averageTheta);
//int a = (int) averageTheta;
//rt.label.setText("The average temperature is "+a);
//Warning!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//rt.isPaused = true;
//Warning!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if(--cycles > 0)
rt.addToSchedule(new ScheduledSimple(this,rt.currentTime+10));//rt.agents.size()));//+1));
}
}
| [
"[email protected]"
] | |
95f97d059f28044b60b58fa00778e16f4226d4e2 | 5b4f6cbe59656be088655ca91c880909491c8849 | /app/src/test/java/com/krunal/example/imageandvideodemo/ExampleUnitTest.java | 0e9585bf1b6a0ce7e6dbe56ae138807a67a5fb0d | [] | no_license | krunalpatel3/Image-and-Video-demo-ert | 78bb71d01598986dcde2255edd64bf5ab186d729 | 9027dd8ed5cdb74f1c93d6dfc9d5fe1ca0fe9b6c | refs/heads/master | 2023-03-03T20:39:09.931093 | 2021-02-07T13:31:27 | 2021-02-07T13:31:27 | 306,573,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.krunal.example.imageandvideodemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
00fabb7a572dbfbf7819ba2071297fc7df51914a | a776b75f8b150d366b03084162d6be33a187cad4 | /src/main/java/com/model/PurchaseInvoiceItem.java | 9530ebf058fb10d7bb7b4d766f86bca996981c0e | [] | no_license | Nikki-Nagdev/EasyBilling | 83c3de830b3ab403a9a75031cfd9be302a5caa21 | 05b2ed8398e24dc7a0f98fab99c09d8328748f97 | refs/heads/main | 2023-05-08T10:45:43.180427 | 2021-06-02T01:59:34 | 2021-06-02T01:59:34 | 372,122,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.model;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
@Entity
public class PurchaseInvoiceItem {
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "invoice_id", referencedColumnName = "id")
private PurchaseInvoice purchaseInvoice;
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "item_id", referencedColumnName = "id")
private Item item;
private int quantity;
}
| [
"[email protected]"
] | |
1a23f582e82ce8ed5a10e55736ebe7bf68899ff1 | 57eaf717cf10fb8c4705e4e7eba151e7acabc05f | /ArchivosDos/src/lecturaArchivosClase/RegistroCuenta.java | 50ffa48204aed59fa33278a2d2bb3163cbe00bdb | [] | no_license | Programacion-Algoritmos-18-2/2bim-clase-03-JosePullaguariQ | a00185fb1d9cacdaef0949b06a5adaef78b50cf2 | f9cbfffba97b0998c81a570dcb0f565fb0bbec2c | refs/heads/master | 2020-04-12T21:27:26.314938 | 2018-12-21T22:41:01 | 2018-12-21T22:41:01 | 162,762,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,189 | java | // Una clase que representa un registro de informaci�n
package lecturaArchivosClase; // se empaqueta para reutilizarla
public class RegistroCuenta { //Creamos la clase RegistroCuenta y sus atributos
private int cuenta;
private String primerNombre;
private String apellidoPaterno;
private double saldo;
// Creamos un constructor sin argumentos llama a otro constructor con valores predeterminados
public RegistroCuenta() {
this(0, "", "", 0.0); // llama al constructor con cuatro argumentos
} // fin del constructor de RegistroCuenta sin argumentos
// Creacion de contructor que recibe parametros de la clase
public RegistroCuenta(int cta, String nombre, String apellido, double sal) {
establecerCuenta(cta);
establecerPrimerNombre(nombre);
establecerApellidoPaterno(apellido);
establecerSaldo(sal);
} // fin del constructor de RegistroCuenta con cuatro argumentos
// establece el numero de cuenta
public void establecerCuenta(int cta) {
cuenta = cta;
} // fin del metodo establecerCuenta
// obtiene el n�mero de cuenta
public int obtenerCuenta() {
return cuenta;
} // fin del metodo obtenerCuenta
// establece el primer nombre
public void establecerPrimerNombre(String nombre) {
primerNombre = nombre;
} // fin del metodo establecerPrimerNombre
// obtiene el primer nombre
public String obtenerPrimerNombre() {
return primerNombre;
} // fin del metodo obtenerPrimerNombre
// establece el apellido paterno
public void establecerApellidoPaterno(String apellido) {
apellidoPaterno = apellido;
} // fin del metodo establecerApellidoPaterno
// obtiene el apellido paterno
public String obtenerApellidoPaterno() {
return apellidoPaterno;
} // fin del metodo obtenerApellidoPaterno
// establece el saldo
public void establecerSaldo(double sal) {
saldo = sal;
} // fin del metodo establecerSaldo
// obtiene el saldo
public double obtenerSaldo() {
return saldo;
} // fin del metodo obtenerSaldo
} // fin de la clase RegistroCuenta
| [
"[email protected]"
] | |
ce90c80e87943f9cff10383189355383823ed31c | b90776a12561fbdb6422f5b80da577c5056700ac | /src/main/java/dbutils/ExampleJDBC.java | 573ed31226b4baf91c533cd6e8260485bf1055c0 | [] | no_license | kinggod/BoneCP | c81ad2115a9b5a2822fec36750b9571d48dbf4d4 | 893894d2631657097b3a3f8e4f366fe4235a7537 | refs/heads/master | 2021-01-21T05:05:19.396040 | 2013-08-26T06:46:55 | 2013-08-26T06:46:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,266 | java | /*
* Created on 13-5-25
*
* 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.
*
* Copyright @2013 the original author or authors.
*/
package dbutils;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import model.Student;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.dbutils.ProxyFactory;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.MapListHandler;
import org.apache.commons.dbutils.wrappers.SqlNullCheckedResultSet;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
/**
* 利用DBUtils测试数据库的修改
* <p/>
* (2)org.apache.commons.dbutils.handlers
* ArrayHandler :将ResultSet中第一行的数据转化成对象数组
* ArrayListHandler将ResultSet中所有的数据转化成List,List中存放的是Object[]
* BeanHandler :将ResultSet中第一行的数据转化成类对象
* BeanListHandler :将ResultSet中所有的数据转化成List,List中存放的是类对象
* ColumnListHandler :将ResultSet中某一列的数据存成List,List中存放的是Object对象
* KeyedHandler :将ResultSet中存成映射,key为某一列对应为Map。Map中存放的是数据
* MapHandler :将ResultSet中第一行的数据存成Map映射
* MapListHandler :将ResultSet中所有的数据存成List。List中存放的是Map
* ScalarHandler :将ResultSet中一条记录的其中某一列的数据存成Object
* <p/>
* (3)org.apache.commons.dbutils.wrappers
* SqlNullCheckedResultSet :该类是用来对sql语句执行完成之后的的数值进行null的替换。
* StringTrimmedResultSet :去除ResultSet中中字段的左右空格。Trim()
*
* @author XiongNeng
* @version 1.0
* @since 13-5-25
*/
public class ExampleJDBC {
private static final Logger log = LoggerFactory.getLogger(ExampleJDBC.class);
public static void main(String[] args) {
JdbcUtil.initDataSourcePool();
ComboPooledDataSource ds = ((ComboPooledDataSource)JdbcUtil.getDataSource());
ds.setJdbcUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8");
ds.setUser("root");
ds.setPassword("123456");
getBeanListData();
}
/**
* BeanListHandler :将ResultSet中所有的数据转化成List,List中存放的是类对象
*/
public static void getBeanListData() {
Connection conn = getConnection();
QueryRunner qr = new QueryRunner();
try {
ResultSetHandler<Student> rsh = new BeanHandler(Student.class);
Student usr = qr.query(conn, "SELECT id, name, gender, age, team_id as teamId FROM test_student WHERE id=1", rsh);
System.out.println(StringUtils.center("findById", 50, '*'));
System.out.println("id=" + usr.getId() + " name=" + usr.getName() + " gender=" + usr.getGender());
List<Student> results = (List<Student>) qr.query(conn, "SELECT id, name, gender, age, team_id as teamId FROM test_student LIMIT 10",
new BeanListHandler(Student.class));
System.out.println(StringUtils.center("findAll", 50, '*'));
for (Student result : results) {
System.out.println("id=" + result.getId() + " name=" + result.getName() + " gender=" + result.getGender());
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
DbUtils.closeQuietly(conn);
}
}
/**
* MapListHandler :将ResultSet中所有的数据存成List。List中存放的是Map
*/
public static void getMapListData() {
Connection conn = getConnection();
QueryRunner qr = new QueryRunner();
try {
List results = (List) qr.query(conn, "SELECT id, name, gender, age, team_id FROM test_student", new MapListHandler());
for (Object result : results) {
Map map = (Map) result;
System.out.println("id=" + map.get("id") + " name=" + map.get("name") + " gender=" + map.get("gender"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
DbUtils.closeQuietly(conn);
}
}
/**
* 新增和更新例子
*/
public static void insertAndUpdateData() throws SQLException {
Connection conn = getConnection();
QueryRunner qr = new QueryRunner();
try {
//创建一个数组来存要insert的数据
Object[] insertParams = {"John Doe", "男", 12, 3};
int inserts = qr.update(conn, "INSERT INTO test_student(name,gender,age,team_id) VALUES (?,?,?,?)", insertParams);
System.out.println("inserted " + inserts + " data");
Object[] updateParams = {"John Doe Update", "John Doe"};
int updates = qr.update(conn, "UPDATE test_student SET name=? WHERE name=?", updateParams);
System.out.println("updated " + updates + " data");
} catch (SQLException e) {
e.printStackTrace();
conn.rollback();
} finally {
DbUtils.close(conn);
}
}
/**
* Unlike some other classes in DbUtils, this class(SqlNullCheckedResultSet) is NOT thread-safe.
*/
public static void findUseSqlNullCheckedResultSet() {
Connection conn = getConnection();
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT id, name, gender, age, team_id as teamId FROM test_student");
SqlNullCheckedResultSet wrapper = new SqlNullCheckedResultSet(rs);
wrapper.setNullString("N/A"); // Set null string
rs = ProxyFactory.instance().createResultSet(wrapper);
while (rs.next()) {
System.out.println("id=" + rs.getInt("id") + " username=" + rs.getString("name")
+ " gender=" + rs.getString("gender"));
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
DbUtils.closeQuietly(conn);
}
}
/**
* *数据库连接***
*/
public static Connection getConnection() {
try {
return JdbcUtil.getConnection();
} catch (Exception e) {
log.error("获取数据库连接错误", e);
return null;
}
}
}
| [
"[email protected]"
] | |
d06128b774c1916ba0b029bd06c00c662cd1a193 | 3650af57babb8c5a26ccbb4f9c52f7ee2c704cc9 | /src/list/lx/WatchList.java | 8625a1d5b84da9edaa225ed7cfc98fa0248a87bf | [] | no_license | SmartComputerMonkey/myJavaBaseCode | 05efc486a0af3a43857cc98cda125a233237c6e2 | 33c03c4ca1db5e7fc68c70c83f4ab6019dc80deb | refs/heads/master | 2020-03-20T13:23:14.535850 | 2018-06-15T07:59:36 | 2018-06-15T07:59:36 | 137,454,277 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 380 | java | package list.lx;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.LinkedTransferQueue;
public class WatchList {
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
list.add("张三");
list.add("李四");
list.add("王五");
list.add("赵柳");
new LinkedTransferQueue<>();
}
}
| [
"[email protected]"
] | |
a4477a460a54675098a0683c79fa526cb37fd867 | 73dbe3f25fc907ab957b069ee30749605961409a | /src/L2Questions/Pattern.java | d2b455c666420bac37ed7c1a4640b05433dca715 | [] | no_license | MarkretG/L2Task | 07b5eed4bbf92b32fa8439fbce01fe8e0dc031f6 | 6f7cbd7fdc80db6f01628bc61a8b1f60977084a7 | refs/heads/main | 2023-07-27T07:16:22.999807 | 2021-09-08T11:00:06 | 2021-09-08T11:00:06 | 392,193,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 887 | java | package L2Questions;
import java.util.Scanner;
public class Pattern {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
String s=scanner.nextLine();
int space=(s.length()-1)*2;
char[] arr=new char[s.length()];
int j=0;
for(int i=s.length()/2;i<s.length();i++)
{
arr[j]=s.charAt(i);
j++;
}
for(int i=0;i<s.length()/2;i++)
{
arr[j]=s.charAt(i);
j++;
}
for (int i=0;i<s.length();i++)
{
for (int m=0;m<space;m++)
System.out.print(" ");
/*if(space>0)
System.out.format("%1$"+space+"s","");*/
for(int k=0;k<i+1;k++)
System.out.print(arr[k]);
System.out.println();
space=space-2;
}
}
}
| [
"[email protected]"
] | |
0b3669b18d892aa1ff718b805cb8367b5e091286 | c585523199f7ce7708ee1c51c0d9898d997d8eeb | /src/main/java/cn/mljia/common/notify/application/command/CreateNotifyRecordCommand.java | 61b8e1406bc40c152c8517e8dba80536518475d4 | [] | no_license | 4017147/common.notify | 97cafeccf81a999dca9fbd0e5e7566a9e7074127 | 53e44e47cc320a9e5899353c368f0e020166ceeb | refs/heads/master | 2021-01-19T16:01:37.738692 | 2017-05-19T02:53:46 | 2017-05-19T02:53:46 | 88,238,340 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,367 | java | package cn.mljia.common.notify.application.command;
import java.io.Serializable;
import java.util.Map;
import cn.mljia.ddd.common.AssertionConcern;
public class CreateNotifyRecordCommand extends AssertionConcern implements Serializable {
/**
* @fieldName: serialVersionUID
* @fieldType: long
* @Description: TODO
*/
private static final long serialVersionUID = 1L;
String notifyId;
Map<Integer, Integer> notifyParams;
Integer limitNotifyTimes;
String url;
String notifyBody;
public CreateNotifyRecordCommand(String notifyId, Map<Integer, Integer> notifyParams, Integer limitNotifyTimes,
String url, String notifyBody) {
super();
this.notifyId = notifyId;
this.notifyParams = notifyParams;
this.limitNotifyTimes = limitNotifyTimes;
this.url = url;
this.notifyBody = notifyBody;
}
public Map<Integer, Integer> getNotifyParams() {
return notifyParams;
}
public Integer getLimitNotifyTimes() {
return limitNotifyTimes;
}
public String getUrl() {
return url;
}
public String getNotifyBody() {
return notifyBody;
}
public String getNotifyId() {
return notifyId;
}
@Override
public String toString() {
return "CreateNotifyRecordCommand [notifyId=" + notifyId + ", notifyParams=" + notifyParams
+ ", limitNotifyTimes=" + limitNotifyTimes + ", url=" + url + ", notifyBody=" + notifyBody + "]";
}
}
| [
"[email protected]"
] | |
1ecdf4cf9e9c27dfbc3d91a44bb64203d7766427 | 291ea2973eebc41c305e380d31dddab170abe944 | /src/main/java/com/mrporter/locallection_cli_web/api/token/service/TokenService.java | 5a87bedf5648c435463a55188ece556bb6c328f9 | [] | no_license | cholnh/locallection_cli_web | 1f4e9798d2746f2b17aabc61d8450e587a1e7b82 | d93b68f6f695322dfad3d2b789adbee4dd77ee5b | refs/heads/master | 2022-02-14T13:07:51.974869 | 2019-09-01T20:35:56 | 2019-09-01T20:35:56 | 202,062,355 | 0 | 0 | null | 2022-01-15T05:13:01 | 2019-08-13T04:09:59 | JavaScript | UTF-8 | Java | false | false | 433 | java | package com.mrporter.locallection_cli_web.api.token.service;
import com.mrporter.locallection_cli_web.api.token.domain.RefreshToken;
import com.mrporter.locallection_cli_web.api.token.domain.User;
import org.springframework.http.ResponseEntity;
public interface TokenService {
ResponseEntity<?> getGuestToken();
ResponseEntity<?> getUserToken(User user);
ResponseEntity<?> getRefreshToken(RefreshToken refreshToken);
}
| [
"ㅜ마ㅓㅑ4866"
] | ㅜ마ㅓㅑ4866 |
a1b92bd0c52bd5068df175e247aecfb60a437d28 | 672c5629a59a94bf348820b7cf0f68e325c1a491 | /src/_09_oop3/_03_InnerClass.java | d7765d6acfa53a049a4d122d76f323f387143daa | [] | no_license | geonheecho/chattingproject-java- | 8bb4cc0f65f66afab8747538ecbd77e179c839ee | 044f904cf45e24e930ad35086cdd73f8d71212f4 | refs/heads/master | 2022-12-29T02:19:06.117906 | 2020-10-17T08:41:32 | 2020-10-17T08:41:32 | 304,833,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,880 | java | package _09_oop3;
class OuterClass{
String insStr = "인스턴스 변수";
static String staStr = "클래스 변수";
void instanceMethod() {
System.out.println("인스턴스 메서드");
}
static void staticMethod() {
System.out.println("클래스 메서드");
}
/***인스턴스형 내부클래스***/
class InsInnerClass{
String innerInsStr = "인스턴스 변수";
// static String innerStaStr = "클래스 변수" //Error
void innerInstanceMethod() {
System.out.println("인스턴스 메서드");
}
// static void innerStaticMethod() { //Error
// System.out.println("클래스 메서드");
// }
void forUseOuter() {
System.out.println(insStr);
System.out.println(staStr);
instanceMethod();
staticMethod();
}
}
/***클래스형 내부클래스***/
static class StaInnerClass{
String staInnerInsStr = "인스턴스 변수";
static String staInnerStaStr = "클래스 변수";
void staInnerInstanceMethod() {
System.out.println("인스턴스 메서드");
}
static void staInnerStaticMethod() {
System.out.println("클래스 메서드");
}
void staForUserOuter() {
// System.out.println(insStr); //Error
System.out.println(staStr);
// instanceMethod(); //Error
staticMethod();
}
}
}
public class _03_InnerClass {
public static void main(String[] args) {
OuterClass outer = new OuterClass();
// outer.innerInstanceMethod(); //Error
/*
* 내부클래스에 있는 기능을 바로 쓸 수 없는 것을 볼 수 있다.
* 이유는 OuterClass만 불렀지 InnerClass를 부르진 않았다.
*/
OuterClass.InsInnerClass inner1 = new OuterClass().new InsInnerClass();
OuterClass.StaInnerClass inner2 = new OuterClass.StaInnerClass();
inner1.innerInstanceMethod();
inner2.staInnerInstanceMethod();
OuterClass.StaInnerClass.staInnerStaticMethod();
}
}
| [
"[email protected]"
] | |
ab44c9b9c0e8e01e279616c25b1003ff556bc63a | 681c7c8cceb39a6503ba3114eabd27f6aec21871 | /src/repetition/exercises/solutions/string/Exercise9.java | 6c0ff370b508614e1f025bd6c18e1bff29aba9d5 | [
"MIT"
] | permissive | JonasAndree/Programmering1IT | 47ff440993cb4df1f4867bb593719c6c9dfb488c | 30244113eb40078ca30fe5fcf7d651aba4589ec6 | refs/heads/master | 2021-01-20T13:11:53.363355 | 2018-10-10T08:50:05 | 2018-10-10T08:50:05 | 101,739,887 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package repetition.exercises.solutions.string;
public class Exercise9 {
public static void main(String[] args) {
String string1 = "example.com", string2 = "Example.com";
CharSequence cs = "example.com";
System.out.println("Comparing " + string1 + " and " + cs + ": " + string1.contentEquals(cs));
System.out.println("Comparing " + string2 + " and " + cs + ": " + string2.contentEquals(cs));
}
} | [
"[email protected]"
] | |
c1ee3ae40c136a1e73d990e4b5ee48408b16dae0 | e8cd24201cbfadef0f267151ea5b8a90cc505766 | /group04/312816708/coding/coding02/src/main/java/com/kevin/coding02/litestruts/Struts.java | 3488ebbc824fa6396c8477510ad3f38d2b04c4c1 | [] | no_license | XMT-CN/coding2017-s1 | 30dd4ee886dd0a021498108353c20360148a6065 | 382f6bfeeeda2e76ffe27b440df4f328f9eafbe2 | refs/heads/master | 2021-01-21T21:38:42.199253 | 2017-06-25T07:44:21 | 2017-06-25T07:44:21 | 94,863,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,795 | java | package com.kevin.coding02.litestruts;
import com.kevin.coding02.model.ActionModel;
import com.kevin.coding02.model.ResultModel;
import com.kevin.coding02.util.SaxUtil;
import org.xml.sax.XMLReader;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Struts {
public static View runAction(String actionName, Map<String, String> parameters) {
/*
0. 读取配置文件struts.xml
1. 根据actionName找到相对应的class , 例如LoginAction, 通过反射实例化(创建对象)
据parameters中的数据,调用对象的setter方法, 例如parameters中的数据是
("name"="test" , "password"="1234") ,
那就应该调用 setName和setPassword方法
2. 通过反射调用对象的exectue 方法, 并获得返回值,例如"success"
3. 通过反射找到对象的所有getter方法(例如 getMessage),
通过反射来调用, 把值和属性形成一个HashMap , 例如 {"message": "登录成功"} ,
放到View对象的parameters
4. 根据struts.xml中的 <result> 配置,以及execute的返回值, 确定哪一个jsp,
放到View对象的jsp字段中。
*/
View view = new View();
try {
//创建sax解析工厂
SAXParserFactory factory = SAXParserFactory.newInstance();
//获取Sax解析器
SAXParser saxParser = factory.newSAXParser();
//获取xml读取器
XMLReader xmlReader = saxParser.getXMLReader();
//设置内容处理器
SaxUtil saxUtil = new SaxUtil();
xmlReader.setContentHandler(saxUtil);
//读取xml
xmlReader.parse("src/main/java/com/kevin/coding02/litestruts/struts.xml");
List<ActionModel> actions = saxUtil.getActions();
for (ActionModel action : actions) {
if (actionName.equals(action.getActionName())) {
String actionClass = action.getActionClass();
Class<?> clazz = Class.forName(actionClass);
Object obj=clazz.newInstance();
for (String key : parameters.keySet()) {
if ("name".equals(key)) {
Method setNameMethod = clazz.getDeclaredMethod("setName", String.class);
setNameMethod.invoke(obj, parameters.get(key));
}
if ("password".equals(key)) {
Method setPasswordMethod = clazz.getDeclaredMethod("setPassword", String.class);
setPasswordMethod.invoke(obj, parameters.get(key));
}
}
Method executeMethod = clazz.getDeclaredMethod("execute");
String flag = (String) executeMethod.invoke(obj);
Map<String, String> map = new HashMap<String, String>();
for (ResultModel result : action.getResults()) {
if (flag.equals(result.getName())) {
view.setJsp(result.getValue());
Method getMessage = clazz.getDeclaredMethod("getMessage");
map.put("message", String.valueOf(getMessage.invoke(obj)));
view.setParameters(map);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return view;
}
}
| [
"[email protected]"
] | |
78e55ddba899b740af8e2de7ea85ef1b31be7b54 | cded1f2110cf2887bd676232c1b7880d1d0cc0da | /src/com/lulu/dao/UserDao.java | ab5200494fd0dea1fe647f5a8e72402949e68eb0 | [] | no_license | ma303893/servlet_crud | 6078beecea399f3422cb77b5f21ae91dcba0bcab | 0a7280ed37114f112d66d3e7e1765fb143932d4d | refs/heads/master | 2020-03-26T00:05:40.340860 | 2018-08-12T17:45:51 | 2018-08-12T17:45:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,488 | java | package com.lulu.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import com.lulu.model.User;
import com.lulu.util.DbUtil;
import javax.sql.rowset.serial.SerialBlob;
public class UserDao {
private Connection connection;
public UserDao() {
connection = DbUtil.getConnection();
}
public User addUser(User user) {
try {
String generatedColumns[] = {"userid"};
PreparedStatement preparedStatement = connection.prepareStatement("insert into users(firstname,lastname,dob,email,file) values (?, ?, ?, ?, ?)", generatedColumns);
// Parameters start with 1
preparedStatement.setString(1, user.getFirstName());
preparedStatement.setString(2, user.getLastName());
preparedStatement.setDate(3, new java.sql.Date(user.getDob().getTime()));
preparedStatement.setString(4, user.getEmail());
preparedStatement.setString(5, user.getFileName());
int affectedRows = preparedStatement.executeUpdate();
if (affectedRows == 0) {
throw new SQLException("Creating user failed, no rows affected.");
}
try (ResultSet generatedKeys = preparedStatement.getGeneratedKeys()) {
if (generatedKeys.next()) {
user.setUserid(generatedKeys.getInt(1));
} else {
throw new SQLException("Creating user failed, no ID obtained.");
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return user;
}
public void deleteUser(int userId) {
try {
PreparedStatement preparedStatement = connection
.prepareStatement("delete from users where userid=?");
// Parameters start with 1
preparedStatement.setInt(1, userId);
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void updateUser(User user) {
try {
PreparedStatement preparedStatement = connection
.prepareStatement("update users set firstname=?, lastname=?, dob=?, email=?, file=?" +
"where userid=?");
// Parameters start with 1
preparedStatement.setString(1, user.getFirstName());
preparedStatement.setString(2, user.getLastName());
preparedStatement.setDate(3, new java.sql.Date(user.getDob().getTime()));
preparedStatement.setString(4, user.getEmail());
preparedStatement.setString(5, user.getFileName());
preparedStatement.setInt(6, user.getUserid());
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public List<User> getAllUsers() {
List<User> users = new ArrayList<User>();
try {
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("select * from users");
while (rs.next()) {
User user = new User();
user.setUserid(rs.getInt("userid"));
user.setFirstName(rs.getString("firstname"));
user.setLastName(rs.getString("lastname"));
user.setDob(rs.getDate("dob"));
user.setEmail(rs.getString("email"));
user.setFileName(rs.getString("file"));
users.add(user);
}
} catch (SQLException e) {
e.printStackTrace();
}
return users;
}
public User getUserById(int userId) {
User user = new User();
try {
PreparedStatement preparedStatement = connection.
prepareStatement("select * from users where userid=?");
preparedStatement.setInt(1, userId);
ResultSet rs = preparedStatement.executeQuery();
if (rs.next()) {
user.setUserid(rs.getInt("userid"));
user.setFirstName(rs.getString("firstname"));
user.setLastName(rs.getString("lastname"));
user.setDob(rs.getDate("dob"));
user.setEmail(rs.getString("email"));
user.setFileName(rs.getString("file"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return user;
}
public User getUserByEmail(String email) {
User user = new User();
try {
PreparedStatement preparedStatement = null;
preparedStatement = connection.prepareStatement("select * from users where email=?");
preparedStatement.setString(1, email);
ResultSet rs = preparedStatement.executeQuery();
if (rs.next()) {
user.setUserid(rs.getInt("userid"));
user.setFirstName(rs.getString("firstname"));
user.setLastName(rs.getString("lastname"));
user.setDob(rs.getDate("dob"));
user.setEmail(rs.getString("email"));
user.setFileName(rs.getString("file"));
}
} catch (Exception e) {
e.printStackTrace();
}
return user;
}
} | [
"[email protected]"
] | |
11944f6e4bf7b7175f6f48efaedc4899778bc37f | e5c3be1fd08218d52fcc1b43085bee305d30e707 | /src/main/java/org/jukeboxmc/item/ItemFilledMap.java | ced09143c8f7ed2fad1ef8d4d29ba7c494642e1b | [] | no_license | Leontking/JukeboxMC | e6d48b1270300ea3f72eca3267ccb8b9eafcba44 | 89490a0cf157b2f806937ad5104cb2d4f5147d56 | refs/heads/master | 2023-02-23T05:47:29.714715 | 2021-01-20T12:10:20 | 2021-01-20T12:10:20 | 329,557,296 | 0 | 0 | null | 2021-01-14T08:48:11 | 2021-01-14T08:48:11 | null | UTF-8 | Java | false | false | 203 | java | package org.jukeboxmc.item;
/**
* @author LucGamesYT
* @version 1.0
*/
public class ItemFilledMap extends Item {
public ItemFilledMap() {
super( "minecraft:filled_map", 418 );
}
}
| [
"[email protected]"
] | |
e89d6879a1d3dba714ed222eb1af911451e7c612 | 635f226066bd493918b4fc732c4e7cb586360bad | /src/p15/lecture/sample/Ex01List.java | e35bebc404b2eed3e2c1d370cb74f90cf2e2f89a | [] | no_license | eemin90/java_210325 | b3df4ff24dd332078108f9a710f49d10da854fd7 | 9d64cfe3e048924a1696d3afeb8f3f7c5450e499 | refs/heads/master | 2023-04-12T20:15:55.427336 | 2021-05-04T15:45:43 | 2021-05-04T15:45:43 | 351,269,408 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package p15.lecture.sample;
import java.util.Arrays;
import java.util.List;
public class Ex01List {
public static void main(String[] args) {
List<Integer> list = Arrays.asList(7, 9, -100, 30, 90, 700);
System.out.println(list);
int sum = sum(list);
System.out.println(sum);
int max = max(list);
System.out.println(max);
int indexOfMax = indexOfMax(list);
System.out.println(indexOfMax);
System.out.println(list.get(indexOfMax));
}
public static int sum(List<Integer> list) {
int res = 0;
// for (int i = 0; i < list.size(); i++) {
// res += list.get(i);
// }
for (int i : list) {
res += i;
}
return res;
}
public static int max(List<Integer> list) {
// int max = list.get(0);
int max = Integer.MIN_VALUE;
// for (int i = 0; i < list.size(); i++) {
// if (max < list.get(i)) {
// max = list.get(i);
// }
// }
for (int i : list) {
if (max < i) {
max = i;
}
}
return max;
}
public static int indexOfMax(List<Integer> list) {
// int max = Integer.MIN_VALUE;
//
// for (int i : list) {
// if (max < i) {
// max = i;
// }
// }
//
// return list.indexOf(max);
int idx = 0;
int max = Integer.MIN_VALUE;
for (int i = 0; i < list.size(); i++) {
if (max < list.get(i)) {
max = list.get(i);
idx = i;
}
}
return idx;
}
}
| [
"[email protected]"
] | |
8a44bf17d06f36ed5744b1aba62ebb6089a322f2 | d07443eaaf525ac5f38caed9d004f205de346632 | /Answers Ville/Backend/src/main/java/lk/ijse/edu/answersville/entity/Answer.java | 00dd9165dc4f697ac2fee0741795cac5f39922f8 | [] | no_license | KushanDhananjala/answersville.github.io | 8bb973d119d15555a2612611cbfb0de68593a609 | 7cc9abf9f30039492d8796d975c431bed3cd3439 | refs/heads/master | 2020-04-09T02:42:50.148675 | 2018-12-01T14:14:47 | 2018-12-01T14:14:47 | 146,472,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,569 | java | package lk.ijse.edu.answersville.entity;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import javax.persistence.*;
@Entity
public class Answer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@ManyToOne
@JoinColumn(name = "userName")
@OnDelete(action = OnDeleteAction.CASCADE)
private User user;
@ManyToOne
@JoinColumn(name = "questionID")
@OnDelete(action = OnDeleteAction.CASCADE)
private Question question;
private String answer;
private long score;
private int status;
private String date;
public Answer() {
}
public Answer(User user, Question question, String answer, long score, int status, String date) {
this.user = user;
this.question = question;
this.answer = answer;
this.score = score;
this.status = status;
this.date = date;
}
public Answer(long id, User user, Question question, String answer, long score, int status, String date) {
this.id = id;
this.user = user;
this.question = question;
this.answer = answer;
this.score = score;
this.status = status;
this.date = date;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Question getQuestion() {
return question;
}
public void setQuestion(Question question) {
this.question = question;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public long getScore() {
return score;
}
public void setScore(long score) {
this.score = score;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
@Override
public String toString() {
return "Answer{" +
"id=" + id +
", user=" + user +
", question=" + question +
", answer='" + answer + '\'' +
", score=" + score +
", status=" + status +
", date='" + date + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
49296a8427175d36e4e240a81347d7c52b68f361 | b80dd0e67d1484c7aceb627c491f754f662558fe | /th-service-api/src/main/java/com/treehole/api/evaluation/ScaleSelectControllerApi.java | ba2612606566e6d2d4318c107d310ecc2de18ee9 | [] | no_license | luoshiF18/treehole-master | 5bd8121bed1beff9557155304a51863c600d0378 | 45fa890459e93a9d3868bb5460d9dc6abeb08d0b | refs/heads/master | 2022-12-01T05:49:29.289730 | 2019-12-14T09:10:24 | 2019-12-14T09:10:24 | 214,382,321 | 9 | 4 | null | 2022-11-24T06:27:15 | 2019-10-11T08:20:55 | Java | UTF-8 | Java | false | false | 2,503 | java | package com.treehole.api.evaluation;
import com.treehole.framework.domain.evaluation.Description;
import com.treehole.framework.domain.evaluation.dto.OptionsDTO;
import com.treehole.framework.domain.evaluation.response.*;
import com.treehole.framework.model.response.QueryResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @auther: Yan Hao
* @date: 2019/10/15
*/
@Api(value = "量表查询管理", description = "对量表进行查询")
public interface ScaleSelectControllerApi {
@ApiOperation("搜索量表")
public QueryResponseResult findScale(Integer page, Integer size, String sortBy, Boolean desc, String key, String typeId);
@ApiOperation("得到量表详细信息")
public DetailResult findScaleDetail(String scaleId, String scaleName);
@ApiOperation("搜索所有量表描述")
public QueryResponseResult findScaleDesc(String scaleId);
@ApiOperation("开始测试,多选类型")
public StartTestResult startTestType1(String scaleId, Integer nextQuestionSort);
@ApiOperation("开始测试,跳题类型")
public StartTestResult2 startTestType2(String scaleId, String nextQuestionId, Integer questionSort, String optionId);
@ApiOperation("根据选项得出测试结果")
public ResultRequest testResult(OptionsDTO optionsDTO);
@ApiOperation("根据量表名和用户id查询用户选项")
public UserOptionResult findUserOption(String scaleName, String userId);
@ApiOperation("根据量表名或用户id查询用户结果")
public QueryResponseResult findResult(Integer page, Integer size, String scaleName, String userId);
@ApiOperation("获取要更改的问题和选项")
public UpdateQuestionResult findUpdateQuestion(String scaleId);
@ApiOperation("获取所有分类")
public QueryResponseResult findScaleType();
@ApiOperation("获取所有分数计算方法")
public QueryResponseResult findScoreMethod();
@ApiOperation("根据分类id查询量表")
public QueryResponseResult findScaleByType(Integer page, Integer size, String scaleTypeId, Boolean isFree);
@ApiOperation("根据量表id查询下一个要添加的问题id")
public Integer findNextQuestionSort(String scaleId);
@ApiOperation("获取一个问题的信息")
public UpdateOneQuestionResult findOneQuestion(String questionId);
@ApiOperation("获取一个得分描述的信息")
public Description findOneDescription(String descId);
}
| [
"[email protected]"
] | |
f36261067cd3e283a46acae3d6302bc016203503 | 7ed73787a1f212d81eace50d73e594c857909dfa | /src/main/java/com/lms/models/nonpersistentclasses/ReturnBookTableView.java | 2b3fc54f2a5b829ccdfa6e039ac2508afaf420e3 | [] | no_license | marian150/Library | 96ea73013d1316eca9d5c6148a9c75972da71c6a | 6a7d406fb8f7adc61bb17dc824cbb81fbf3a366a | refs/heads/master | 2023-01-31T16:53:36.653118 | 2020-12-18T11:00:28 | 2020-12-18T11:00:28 | 297,385,460 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,176 | java | package com.lms.models.nonpersistentclasses;
import javafx.beans.property.SimpleStringProperty;
public class ReturnBookTableView {
private SimpleStringProperty lendId;
private SimpleStringProperty readerId;
private SimpleStringProperty inv;
private SimpleStringProperty title;
private SimpleStringProperty author;
private SimpleStringProperty lendDate;
private SimpleStringProperty dueDate;
private SimpleStringProperty operator;
private SimpleStringProperty type;
public ReturnBookTableView( SimpleStringProperty lendId, SimpleStringProperty readerId, SimpleStringProperty inv, SimpleStringProperty title, SimpleStringProperty author, SimpleStringProperty lendDate, SimpleStringProperty dueDate, SimpleStringProperty operator, SimpleStringProperty type) {
this.lendId = lendId;
this.readerId = readerId;
this.inv = inv;
this.title = title;
this.author = author;
this.lendDate = lendDate;
this.dueDate = dueDate;
this.operator = operator;
this.type = type;
}
public String getLendId() {
return lendId.get();
}
public SimpleStringProperty lendIdProperty() {
return lendId;
}
public void setLendId(String lendId) {
this.lendId.set(lendId);
}
public String getReaderId() {
return readerId.get();
}
public SimpleStringProperty readerIdProperty() {
return readerId;
}
public void setReaderId(String readerId) {
this.readerId.set(readerId);
}
public String getInv() {
return inv.get();
}
public SimpleStringProperty invProperty() {
return inv;
}
public void setInv(String inv) {
this.inv.set(inv);
}
public String getTitle() {
return title.get();
}
public SimpleStringProperty titleProperty() {
return title;
}
public void setTitle(String title) {
this.title.set(title);
}
public String getAuthor() {
return author.get();
}
public SimpleStringProperty authorProperty() {
return author;
}
public void setAuthor(String author) {
this.author.set(author);
}
public String getLendDate() {
return lendDate.get();
}
public SimpleStringProperty lendDateProperty() {
return lendDate;
}
public void setLendDate(String lendDate) {
this.lendDate.set(lendDate);
}
public String getDueDate() {
return dueDate.get();
}
public SimpleStringProperty dueDateProperty() {
return dueDate;
}
public void setDueDate(String dueDate) {
this.dueDate.set(dueDate);
}
public String getOperator() {
return operator.get();
}
public SimpleStringProperty operatorProperty() {
return operator;
}
public void setOperator(String operator) {
this.operator.set(operator);
}
public String getType() {
return type.get();
}
public SimpleStringProperty typeProperty() {
return type;
}
public void setType(String type) {
this.type.set(type);
}
}
| [
"[email protected]"
] | |
83c6d5302ac1445fe152135dd50190eec5261eee | 0916a6cce3a7bc829e71a51850ea0f79802a6610 | /ReflectionLab2/src/ClassScanner.java | 48dc03160a2a68df1003e2b55047d86f17f9f8ae | [] | no_license | gabkdejesus/CS124B | 6165e5da60a8d8d67df696a5888cffb238bbeeb4 | 7a6ab72409071f91df8adfc842c4841b4e938b2d | refs/heads/master | 2021-09-06T22:20:34.405471 | 2018-02-12T12:47:14 | 2018-02-12T12:47:14 | 118,578,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,754 | java | import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Parameter;
import java.lang.reflect.TypeVariable;
import java.util.List;
import java.util.Set;
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
public class ClassScanner {
// Method that prints the info of a class
// Prints fields, constructors, methods, and parameters
public static void printClassInfo(String cls) throws Exception {
Class<?> currClass = Class.forName(cls);
System.out.println("Class: " + currClass.getName());
// Fields
if(currClass.getDeclaredFields().length > 0) {
System.out.println("Fields:");
for(Field f : currClass.getDeclaredFields()) {
System.out.println("\t" + Modifier.toString(f.getModifiers()) + " " + f.getType() + " " + f.getName() + ";");
}
}
// Constructors
try {
if(currClass.getDeclaredConstructor() != null) {
System.out.println("Constructors:");
System.out.println("\t" + currClass.getDeclaredConstructor() + ";");
}
} catch (Exception e) {
}
// Methods
System.out.println("Methods:");
for(Method m : currClass.getDeclaredMethods()) {
System.out.print("\t" + Modifier.toString(m.getModifiers()) + " " + m.getReturnType() + " " + m.getName() + "(");
Parameter params[] = m.getParameters();
// Loop through parameters with a var, so that you can check if last param
for(int paramNum = 0; paramNum < m.getParameterCount(); paramNum ++) {
System.out.print(params[paramNum].getType());
if(!(paramNum == m.getParameterCount() - 1)) {
System.out.print(", ");
}
}
System.out.println(");");
}
System.out.println();
}
// Takes in a string cls, and recurses through the superclasses of cls
// Base case of cls.equals("java.lang.Object")
// printClassInfo starts at the 'bottom', at java.lang.Object
public static int getClassInfo(String cls) throws Exception {
Class<?> currClass = Class.forName(cls);
try {
getClassInfo(currClass.getSuperclass().getName());
} catch (Exception e) {
// If no super class
printClassInfo(cls);
return 1;
}
printClassInfo(cls);
return 1;
}
public static void main(String[] args) throws Exception
{
FastClasspathScanner scanner = new FastClasspathScanner("lab");
ScanResult result = scanner.scan();
List<String> allClasses = result.getNamesOfAllClasses();
System.out.println(allClasses);
// Get the class info of input object and its super classes
getClassInfo("lab.WaterVehicle");
}
}
| [
"[email protected]"
] | |
72f335316075a9973168b344be1cf01c3975ff4a | 9aff33fae51426b94f888cc5306e7e48e9a3c7fe | /src/it/gestioneordini/dao/EntityManagerUtil.java | 8282b89cd01ca5de2b2f955f273b993c0bd4fa27 | [] | no_license | MohamedMohamedAli/repositoryProva | 2c7d2fd11e7fcb1d6f9051b944083854ded12f6d | bee64adba59cceff358445bf722a5ab1bdfb958a | refs/heads/master | 2020-12-28T16:32:57.752456 | 2020-02-05T09:30:20 | 2020-02-05T09:30:20 | 238,407,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package it.gestioneordini.dao;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class EntityManagerUtil {
private static final EntityManagerFactory entityManagerFactory;
static {
try {
entityManagerFactory = Persistence.createEntityManagerFactory("gestioneordini_unit");
} catch (Throwable ex) {
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static EntityManager getEntityManager() {
return entityManagerFactory.createEntityManager();
}
}
| [
"[email protected]"
] | |
e20e2070a53e94bd5d6540501e8960383a292f36 | 2dfa54c369b42ffe260d0615f237640001d09c8f | /src/main/java/functional/consumers/MyPrintBiConsumer.java | 10f56067fecc545e04fd04ac4e1e5a316437afd9 | [] | no_license | danilovsantos/core-java8 | f4187461b6e4bc9548ecdfdfebb966dcefdcc15c | fc6711e6c6c8b1c91a1bd2cae373014b87b2b0c9 | refs/heads/master | 2020-12-10T03:27:57.492229 | 2017-07-19T20:43:56 | 2017-07-19T20:43:56 | 95,581,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | package functional.consumers;
@FunctionalInterface
public interface MyPrintBiConsumer<T,U> {
public abstract void accept(String arg1, String arg2);
}
| [
"[email protected]"
] | |
364973aa956c458162dca2d2b00d3ad8ee825dcc | 8bce653e68e4083b89a9e58a5edcebf247afada3 | /src/test/java/com/bitfury/pages/BallotSignedPage.java | 4d325c30de6d5df777f082eff634f4a93b54a2a1 | [] | no_license | vozlok/exonum | b01a170ea845d7c166dd28a02e07f75407c46bff | d5189061a7b719cecc2f0db22005078025d8d976 | refs/heads/master | 2020-03-13T09:17:15.277965 | 2018-05-04T04:55:22 | 2018-05-04T04:55:22 | 131,061,258 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,580 | java | package com.bitfury.pages;
import com.bitfury.TestBase;
import io.qameta.allure.Step;
import static com.codeborne.selenide.Condition.cssClass;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selectors.byXpath;
import static com.codeborne.selenide.Selenide.$;
public class BallotSignedPage extends TestBase {
@Step("Check Ballot signed nessage")
public BallotSignedPage checkSuccessMessageBallotSigned() {
$("div.toolbar-title span").shouldHave(text("Ballot has been signed"));
return this;
}
@Step("Check Button appeared on ballot signed page")
public BallotSignedPage checkButtonAppearedOnBallotSignedPage() {
$(byXpath("//div[text()='SUBMIT BALLOT']")).shouldHave(cssClass("button-green")).shouldBe(visible);
$(byXpath("//div[@ng-click='electionWizardReset()']")).shouldHave(text("DISCARD BALLOT")).shouldBe(visible);
return this;
}
@Step("Click DISCARD BALLOT")
public WelcomePage clickDiscardBallot() {
$(byXpath("//div[@ng-click='electionWizardReset()']")).click();
return new WelcomePage();
}
@Step("Set email value")
public BallotSignedPage setEmail(String email) {
$(byXpath("//input[@ng-model='inputs.email']")).setValue(email);
return this;
}
@Step("Click Submit Ballot")
public ElectionSubmittedPage clickSubmitBallot() {
$(byXpath("//div[text()='SUBMIT BALLOT']")).click();
return new ElectionSubmittedPage();
}
}
| [
"[email protected]"
] | |
3adc96a1a55c0316749adb4f073cd83cbfd6cbf4 | 316e742214d044f5cc3c430d635854ec0f0a2238 | /gmall-mbg/src/main/java/com/atguigu/gmall/sms/service/impl/CouponProductCategoryRelationServiceImpl.java | a3d754e322d0590f2e2d21dcc62ef52b2141fe87 | [] | no_license | chengxulaohan/gmall-1111 | bba45c4b1dbb0f241be389efda54d3c432d8abf7 | cdec0c63c044d95ed805159a85185160c1330233 | refs/heads/master | 2022-07-05T19:41:04.326299 | 2019-12-10T05:06:50 | 2019-12-10T05:06:50 | 227,030,095 | 0 | 0 | null | 2022-06-21T02:25:06 | 2019-12-10T04:37:34 | Java | UTF-8 | Java | false | false | 715 | java | package com.atguigu.gmall.sms.service.impl;
import com.atguigu.gmall.sms.entity.CouponProductCategoryRelation;
import com.atguigu.gmall.sms.mapper.CouponProductCategoryRelationMapper;
import com.atguigu.gmall.sms.service.CouponProductCategoryRelationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 优惠券和产品分类关系表 服务实现类
* </p>
*
* @author Lfy
* @since 2019-12-08
*/
@Service
public class CouponProductCategoryRelationServiceImpl extends ServiceImpl<CouponProductCategoryRelationMapper, CouponProductCategoryRelation> implements CouponProductCategoryRelationService {
}
| [
"[email protected]"
] | |
5a543fa97ce5e9c5adf51d8b70a8557eb3a14adc | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/XWIKI-13138-15-14-Single_Objective_GGA-WeightedSum/org/xwiki/platform/wiki/creationjob/internal/WikiCreationJob_ESTest_scaffolding.java | c0d87f8ec33100ef5421ebc187760801bd7214d2 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Wed Apr 01 12:26:12 UTC 2020
*/
package org.xwiki.platform.wiki.creationjob.internal;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class WikiCreationJob_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
] | |
f26194be8e8af352a6ba34e2fadfcf79d831455f | 665c6d1831ad35006c8dc48173096fdf2c5c9fce | /src/main/java/ktv/pojo/response/Video.java | 1a7193c66aa08d1146d9b85d3db234dcc99ee2f1 | [] | no_license | GoldButcher/ktttttv | 689a56309d29202bac23fe95fde247399943870b | 1c53763283fe3a17fd98ca5e1ed8abe49e24c32f | refs/heads/master | 2021-01-19T08:22:23.052171 | 2017-04-14T12:00:55 | 2017-04-14T12:00:55 | 87,621,627 | 1 | 0 | null | 2017-04-08T09:04:42 | 2017-04-08T09:04:42 | null | UTF-8 | Java | false | false | 621 | java | package ktv.pojo.response;
/**
* Created by evam on 16-12-18.
*/
public class Video {
private String MediaId;
private String Title;
private String Description;
public String getMediaId() {
return MediaId;
}
public void setMediaId(String mediaId) {
MediaId = mediaId;
}
public String getTitle() {
return Title;
}
public void setTitle(String title) {
Title = title;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
}
| [
"[email protected]"
] | |
f755d1ba231eba88e681ec0f8433298eac463a03 | 29471ac0ccc8a4d3983af0fc3abc6c484c5c7f24 | /DoubleList raserch.java | ac6b758193a98bfed714e71d4bd379f1a7f1fc5c | [] | no_license | HissZxy/leetcode | 4bad1968914ad9d30caed95f9eeb753e66c82078 | ed795004b7a4b317515d844354c1de1507ac13b5 | refs/heads/master | 2023-05-28T18:35:31.397995 | 2020-08-17T13:14:06 | 2020-08-17T13:14:06 | 244,637,808 | 1 | 0 | null | 2023-05-23T20:12:28 | 2020-03-03T13:04:07 | Java | UTF-8 | Java | false | false | 986 | java | import java.util.Stack;
public class Solution {
public TreeNode Convert(TreeNode pRootOfTree) {
if(pRootOfTree==null){
return null;
}
TreeNode node=pRootOfTree;
Stack<TreeNode> stack=new Stack<TreeNode>();
Connection(node,stack);
node=stack.get(0);
return node;
}
public void Connection(TreeNode newNode,Stack<TreeNode> stack){
if(newNode==null) {
return;
}
Connection(newNode.left,stack);
if(stack.isEmpty()){
stack.push(newNode);
}
else{
stack.peek().right=newNode;
newNode.left=stack.peek();
stack.push(newNode);
}
Connection(newNode.right,stack);
}
} | [
"[email protected]"
] | |
4e53a3529315eaa5f406eb9083a5d0880dc1d172 | 1216273c97535726b005591dfe187e89f7ee6209 | /rahul/naveenAutomation/src/corejava/This.java | 59ebad7facf992cea6bf90335345803a60b3c24b | [] | no_license | rahulrj810/selenium | ed6fc998efd3bc082fa64a6dd99c8262f0478bd7 | 086f44f68087622d061b68653e89ee33dd0cb602 | refs/heads/master | 2020-09-03T15:46:16.818300 | 2019-11-18T13:46:55 | 2019-11-18T13:46:55 | 219,501,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package corejava;
public class This {
int i =10;
public void sum ()
{
int i =20;
System.out.println(i+this.i);
}
public static void main(String[] args) {
This t = new This();
t.sum();
}
}
| [
"[email protected]"
] | |
fc2f99450fe77c561d6fa7a254b3005aee93e9b3 | 8b07bd27162f0dc6c9b1c6d462c153166254d68b | /pixel-commons/src/main/java/org/onebeartoe/pixel/PixelLogFormatter.java | 29a54177fab77109df98bda791d855f0a6973b80 | [] | no_license | alinke/PIXEL | d1d58c13e16656e59b0c5d1416becdc1d55f8e76 | 9815af7c080644542385dc4912349e383a0a75f7 | refs/heads/master | 2023-01-23T04:55:22.904215 | 2020-12-25T06:44:03 | 2020-12-25T06:44:03 | 15,560,008 | 27 | 19 | null | 2023-01-15T14:36:48 | 2014-01-01T03:24:08 | Java | UTF-8 | Java | false | false | 455 | java | package org.onebeartoe.pixel;
import java.util.logging.*;
public class PixelLogFormatter extends Formatter {
/* (non-Javadoc)
* @see java.util.logging.Formatter#format(java.util.logging.LogRecord)
*/
public String format(LogRecord record) {
StringBuilder sb = new StringBuilder();
sb.append(record.getLevel()).append(':');
sb.append(record.getMessage()).append('\n');
return sb.toString();
}
}
| [
"[email protected]"
] | |
5680c5370fae028d0e6db7019a90fc2f3c4b3aa3 | 80fb0ccabbbd6b9458ef9c5e31c1f24400b20539 | /android/TamperOnAndroid/src/main/java/com/dasho/android/tamper/FibActivity.java | e2e7a283e532e12cd3948d8965fe4e78217690a1 | [
"MS-PL",
"CC-BY-3.0"
] | permissive | Evgenii-dor/dasho-samples | 90e7757cfae118b43d5c94a86939884b657524ac | 043bcf4c5a9c5cb67c321e5b536aeee3f223bc90 | refs/heads/master | 2020-09-14T11:16:40.711207 | 2019-10-11T20:21:53 | 2019-10-11T20:21:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,225 | java | /* Copyright 2018 PreEmptive Solutions, LLC. All Rights Reserved.
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the LICENSE.txt file for more information.
*/
package com.dasho.android.tamper;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.ref.WeakReference;
import java.text.NumberFormat;
/**
* The Fibonacci calculator
*
* @author Matt Insko
*/
public class FibActivity extends Activity implements OnClickListener {
private String num = "";
private TextView fibNum;
private EditText seqNum;
private FibTask fibTask;
private static final int WARN_SEQUENCE = 30;
private static final int MAX_SEQUENCE = 50;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fib_main);
findViewById(R.id.calcFibBtn).setOnClickListener(this);
seqNum = findViewById(R.id.fibSeqNum);
fibNum = findViewById(R.id.calcFibRes);
}
/**
* Processes the button click
*/
public void onClick(View v) {
if (v.getId() == R.id.calcFibBtn) {
processFibRequest();
}
}
/**
* Processes the request
*/
private void processFibRequest() {
if (fibNum.getText().toString().startsWith(getResources().getString(R.string.fibCalcProcessing))) {
Toast.makeText(getApplicationContext(), R.string.fibProc, Toast.LENGTH_SHORT).show();
return;
}
fibNum.setText(R.string.fibCalcProcessing);
try {
num = seqNum.getText().toString();
int seq = Integer.parseInt(num);
if (seq > MAX_SEQUENCE) {
num = Integer.toString(MAX_SEQUENCE);
Toast.makeText(getApplicationContext(), getString(R.string.fibTooLarge, MAX_SEQUENCE), Toast.LENGTH_LONG)
.show();
seqNum.setText(num);
} else if (seq < 1) {
showNumberError();
return;
} else if (seq > WARN_SEQUENCE) {
Toast.makeText(getApplicationContext(), R.string.fibLarge, Toast.LENGTH_SHORT)
.show();
}
findFib();
} catch (NumberFormatException e) {
showNumberError();
}
}
/**
* Shows an error
*/
private void showNumberError() {
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
dlgAlert.setMessage(R.string.badNum);
dlgAlert.setTitle(R.string.errTitle);
dlgAlert.setPositiveButton(Resources.getSystem().getText(android.R.string.ok), null);
dlgAlert.setCancelable(true);
dlgAlert.create().show();
fibNum.setText("");
}
/**
* Finds the Fibonacci number at that sequence index
*/
private void findFib() {
fibTask = new FibTask(fibNum, getString(R.string.fibCalcProgress));
fibTask.execute(Integer.valueOf(num));
}
/**
* Saves the request
*/
@Override
protected void onPause() {
super.onPause();
SharedPreferences prefs = getSharedPreferences("FibPrefs", MODE_PRIVATE);
Editor prefEditor = prefs.edit();
prefEditor.putString("seq", num);
prefEditor.apply();
if (fibTask != null) {
fibTask.cancel();
}
}
/**
* Restores the last request
*/
@Override
protected void onResume() {
super.onResume();
SharedPreferences prefs = getSharedPreferences("FibPrefs", MODE_PRIVATE);
num = prefs.getString("seq", getString(R.string.fibSeqDef));
seqNum.setText(num);
seqNum.setSelection(num.length());
}
/**
* An async task to calculate the number.
*
* @author Matt Insko
*/
private static class FibTask extends AsyncTask<Integer, Integer, Long> {
private boolean cancelled;
private int seqNum;
private int max;
private final WeakReference<TextView> outputText;
private final String progressString;
private final NumberFormat nf = NumberFormat.getIntegerInstance();
public FibTask(TextView fibNum, String progressString) {
this.outputText = new WeakReference<>(fibNum);
this.progressString = progressString;
}
private void cancel() {
cancelled = true;
}
@Override
protected Long doInBackground(Integer... params) {
seqNum = params[0];
return getFib(seqNum);
}
/**
* Calculates the Fibonacci number at a certain location
*
* @param num The location
* @return The Fibonacci number at that location
*/
private long getFib(int num) {
long result;
if (num < 3 || cancelled) {
result = 1;
} else {
result = getFib(num - 1) + getFib(num - 2);
}
reportMax(num);
return result;
}
private void reportMax(int num) {
if (num > max) {
publishProgress(num);
max = num;
}
}
@Override
protected void onPostExecute(Long result) {
TextView field = outputText.get();
if (field != null) {
if (cancelled) {
field.setText("");
} else {
field.setText(nf.format(result));
}
}
}
@Override
protected void onProgressUpdate(Integer... values) {
TextView field = outputText.get();
if (field != null) {
field.setText(String.format(progressString, values[0]));
}
}
}
}
| [
"[email protected]"
] | |
54592dfdcaf3071fdbdaef4d82993b6db6716b4f | c771c42a3d208bc968207d0ebdd4f498451a0e00 | /src-pos/com/openbravo/pos/printer/DeviceDisplayImpl.java | 3e73c6fa58fa7739f75393d227cfae236568a9a2 | [] | no_license | brainhell/unicentaopos | 8819fde44d39d57f6df53664cc1a2c1b1ae49361 | 166223c6cd48febe44b09ba5619d202081e0a561 | refs/heads/master | 2021-01-21T07:38:58.900021 | 2014-02-16T14:12:48 | 2014-02-16T14:12:48 | 17,788,836 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,001 | java | // uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2013 uniCenta & previous Openbravo POS works
// http://www.unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS 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.
//
// uniCenta oPOS 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 uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.openbravo.pos.printer;
public interface DeviceDisplayImpl {
public void repaintLines();
}
| [
"[email protected]"
] | |
8c6a76519cdc01d541caa88b5344979b2e0626fb | 8f40741baa22530bdfd645883d0e6f626a2d99d3 | /src/main/java/com/haikan/iptv/elasticsearch/service/CustomShortUrlEsService.java | e3b2964f08e0d2e1dd2f7ce519dd61665446ad95 | [] | no_license | LichaoStone/hk_iptv_mms | 1d62eb4f15fe9ebf82137c0492c7c6f25a35fbfd | 4b9cb8d282bd38fce964546abbae1c8946334de2 | refs/heads/master | 2022-11-27T21:50:36.466406 | 2020-03-10T06:57:31 | 2020-03-10T06:57:31 | 246,228,850 | 0 | 0 | null | 2022-11-16T08:32:15 | 2020-03-10T06:53:40 | Java | UTF-8 | Java | false | false | 606 | java | package com.haikan.iptv.elasticsearch.service;
import com.haikan.iptv.config.elasticsearch.model.PageQuery;
import com.haikan.iptv.config.elasticsearch.model.PageResult;
import com.haikan.iptv.elasticsearch.model.ShortUrlDTO;
import java.util.List;
public interface CustomShortUrlEsService {
String save(ShortUrlDTO shortUrlDTO);
PageResult<ShortUrlDTO> pageShortUrl(PageQuery<ShortUrlDTO> pageQuery);
boolean saveShortUrl(ShortUrlDTO shortUrlDTO);
boolean deleteShortUrlById(Long id);
List<ShortUrlDTO> listShortUrls(ShortUrlDTO shortUrlDTO);
ShortUrlDTO getShortUrlById(Long id);
}
| [
"[email protected]"
] | |
4e61fa0199a4f50e6c660e4a6a95cb4250dc8683 | d4261417db59c92bb118cb7ec12c0bc43c85d62f | /src/de/uni/bielefeld/sc/hterhors/psink/obie/projects/soccerplayer/ontology/interfaces/IDefenderAssociationFootball.java | d76348ede10c93b08bc8b20ec96151b5cd50a734 | [
"Apache-2.0"
] | permissive | berezovskyi/SoccerPlayerOntology | ed3a24a7ace88ba209f5439a49b04c11a8e6034a | c7dafee008911b45a2b9e8c55ffd43c1e69c3660 | refs/heads/master | 2022-06-20T02:17:21.385038 | 2018-09-21T17:09:38 | 2018-09-21T17:09:38 | 149,870,122 | 0 | 0 | Apache-2.0 | 2022-05-20T22:00:24 | 2018-09-22T11:19:31 | Java | UTF-8 | Java | false | false | 628 | java | package de.uni.bielefeld.sc.hterhors.psink.obie.projects.soccerplayer.ontology.interfaces;
import de.uni.bielefeld.sc.hterhors.psink.obie.core.ontology.annotations.AssignableSubInterfaces;
import de.uni.bielefeld.sc.hterhors.psink.obie.core.ontology.annotations.ImplementationClass;
import de.uni.bielefeld.sc.hterhors.psink.obie.projects.soccerplayer.ontology.classes.DefenderAssociationFootball;
/**
*
* @author hterhors
*
*
* Sep 6, 2018
*/
@ImplementationClass(get = DefenderAssociationFootball.class)
@AssignableSubInterfaces(get = {})
public interface IDefenderAssociationFootball extends IPosition {
}
| [
"[email protected]"
] | |
fd4e76ed344841146073ab06ef1972e9952d1eff | 915ae30f73f3c277beedebdc781ad918c8e6e1ad | /dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/DrawableLruCache.java | e3ddfbfd068568abaa28e4a02f9ae62ee8fa151e | [
"Apache-2.0"
] | permissive | pranavpandey/dynamic-utils | 64592b94e98a346e9d8fc006b2adb9586e454299 | 7ea2ade380ead29bf27f00c8472bd5f0db0a1ade | refs/heads/master | 2023-07-13T11:19:45.631072 | 2023-07-09T11:52:50 | 2023-07-09T11:52:50 | 95,197,482 | 101 | 17 | Apache-2.0 | 2018-11-08T20:54:51 | 2017-06-23T07:58:43 | Java | UTF-8 | Java | false | false | 1,803 | java | /*
* Copyright 2017-2022 Pranav Pandey
*
* 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.pranavpandey.android.dynamic.util.cache;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
/**
* A {@link DynamicLruCache} for the {@link Drawable}.
*
* @param <T> The type of the key for this cache.
*/
public final class DrawableLruCache<T> extends DynamicLruCache<T, Drawable> {
/**
* Constructor to initialize an object of this class.
*/
public DrawableLruCache() {
super();
}
@Override
protected int sizeOf(@NonNull T key, @NonNull Drawable value) {
if (value instanceof BitmapDrawable) {
return ((BitmapDrawable) value).getBitmap().getByteCount() / getByteMultiplier();
} else {
Bitmap bitmap = Bitmap.createBitmap(value.getIntrinsicWidth(),
value.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
value.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
value.draw(canvas);
return bitmap.getByteCount() / getByteMultiplier();
}
}
}
| [
"[email protected]"
] | |
caa17b19ba22e0a84512a827cb7106527022f4c8 | 2bc551f9c2ecb57ec0cb93ad18d3ce0bafbddb34 | /Spring/SCW-Project/scw/scw-user/src/main/java/tk/billhu/scw/user/controller/UserLoginRegistController.java | 7cd9a3ba11c5b6dc27f4d07fc1b7d48329b79dae | [] | no_license | YiboXu/JavaLearning | c42091d6ca115826c00aad2565d9d0f29b1f5f68 | 97b4769ebbe096e0ab07acb6889fb177e2ca5abe | refs/heads/master | 2022-10-27T23:47:54.637565 | 2020-06-16T09:12:09 | 2020-06-16T09:12:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,834 | java | package tk.billhu.scw.user.controller;
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import com.netflix.discovery.converters.Auto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import tk.billhu.scw.user.component.SmsTemplate;
import tk.billhu.scw.user.entities.TMemberExample;
import tk.billhu.scw.user.entities.TRole;
import tk.billhu.scw.user.mapper.TMemberMapper;
import tk.billhu.scw.user.service.TMemberService;
import tk.billhu.scw.user.vo.request.UserRegisterVo;
import tk.billhu.scw.user.vo.request.UserResetPswVo;
import tk.billhu.scw.user.vo.response.UserLoginVo;
import tk.billhu.scw.user.vo.response.UserResponseVo;
import tk.billhu.scw.vo.resp.AppResponse;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Slf4j
@Api(tags = "用户登陆注册模块")
@RequestMapping("/user")
@RestController
public class UserLoginRegistController {
@Autowired
SmsTemplate smsTemplate;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
TMemberService tMemberService;
private static Random random = new Random(37);
@PostMapping("/login")
public AppResponse<UserResponseVo> login(String loginacct, String userpswd){
try {
//登录验证
UserResponseVo userResponseVo = tMemberService.login(loginacct, userpswd);
log.debug("登录成功-{}", userResponseVo);
return AppResponse.ok(userResponseVo);
}catch(Exception e){
e.printStackTrace();
AppResponse response = AppResponse.fail(null);
response.setMsg(e.getMessage());
return response;
}
}
@ApiOperation(value="用户注册")
@PostMapping("/register")
public AppResponse<String> register(@RequestBody UserRegisterVo userRegisterVo){
//检查验证码
AppResponse response = validate(userRegisterVo.getLoginacct(),userRegisterVo.getCode());
if(response.getCode() == 0) {
//如果验证通过, 调用业务层(service)进行用户注册
try{
tMemberService.register(userRegisterVo);
}catch (Exception e){
//如果注册失败,返回错误
log.error("注册失败,请重新注册-{}", userRegisterVo);
return AppResponse.fail("注册失败,请重新注册");
}
}else {
return response;
}
return AppResponse.ok("用户注册成功");
}
@ApiOperation(value="发送短信验证码")
@PostMapping("/sendsms")
public AppResponse<String> sendsms(String loginacct){
//生成短线验证码
StringBuilder sb = new StringBuilder();
for(int i=0;i<4;i++){
sb.append(random.nextInt(10));
}
//缓存短信验证码(有效期5分钟)
stringRedisTemplate.opsForValue().set(loginacct,sb.toString(),5, TimeUnit.MINUTES);
//发送短信验证码
Map<String,String> queries = new HashMap<String,String>();
queries.put("mobile",loginacct);
queries.put("param","code:"+sb.toString());
queries.put("tpl_id","TP1711063");
smsTemplate.sendSms(queries);
//DEGUG
log.info("用户注册短信验证码: "+sb.toString());
return AppResponse.ok(sb.toString());
}
@ApiOperation(value="验证短信验证码")
@PostMapping("/validate")
public AppResponse<Object> validate(String loginacct, String inputCode){
String code = stringRedisTemplate.opsForValue().get(loginacct);
if(!StringUtils.isEmpty(code)){
if(code.equals(inputCode)){
//如果验证通过, 删除验证码缓存
stringRedisTemplate.delete(loginacct);
}else{
//如果验证失败, 返回错误
log.error("验证码不匹配-{}",loginacct);
return AppResponse.fail("验证码不匹配");
}
}else{
//如果验证失败, 返回错误
log.error("验证码过期,请重新获取-{}",loginacct);
return AppResponse.fail("验证码过期,请重新获取");
}
return AppResponse.ok("ok");
}
@ApiOperation(value="重置密码")
@PostMapping("/reset")
public AppResponse<Object> reset(UserResetPswVo userResetPswVo){
//检查验证码
AppResponse response = validate(userResetPswVo.getLoginacct(),userResetPswVo.getCode());
if(response.getCode() == 0) {
//如果验证通过, 调用业务层(service)
try{
tMemberService.resetPsw(userResetPswVo);
}catch (Exception e){
//如果重置密码失败,返回错误
log.error("密码重置失败-{}", userResetPswVo);
return AppResponse.fail("注册失败,请重新注册");
}
}else {
return response;
}
return AppResponse.ok("用户密码重置成功");
}
@ApiOperation(value="获取用户账号信息")
@PostMapping("/getUserLogin")
public AppResponse<UserLoginVo> getUserLogin(String loginacct){
UserLoginVo userLoginVo;
try{
userLoginVo = tMemberService.getUserLogin(loginacct);
}catch (Exception e){
//如果重置密码失败,返回错误
log.error("获取账号失败-{}", loginacct);
AppResponse response = AppResponse.fail(null);
response.setMsg("获取账号失败");
return response;
}
return AppResponse.ok(userLoginVo);
}
@ApiOperation(value="获取登录令牌")
@PostMapping("/getAccessToken")
public AppResponse<UserResponseVo> getAccessToken(String loginacct){
try {
UserResponseVo userResponseVo = tMemberService.getAccessToken(loginacct);
log.debug("令牌获取成功-{}", userResponseVo);
return AppResponse.ok(userResponseVo);
}catch(Exception e){
e.printStackTrace();
AppResponse response = AppResponse.fail(null);
response.setMsg(e.getMessage());
return response;
}
}
@ApiOperation(value="获取管理员账号信息")
@PostMapping("/getAdminLogin")
public AppResponse<UserLoginVo> getAdminLogin(String loginacct){
UserLoginVo userLoginVo;
try{
userLoginVo = tMemberService.getAdminLogin(loginacct);
}catch (Exception e){
//如果重置密码失败,返回错误
log.error("获取管理员账号失败-{}", loginacct);
AppResponse response = AppResponse.fail(null);
response.setMsg("获取管理员账号失败");
return response;
}
return AppResponse.ok(userLoginVo);
}
@ApiOperation(value="获取管理员账号角色信息")
@PostMapping("/getAdminRoles")
public AppResponse<List<TRole>> getAdminRoles(String loginacct){
List<TRole> roleList = new ArrayList<>();
try{
roleList = tMemberService.getAdminRoles(loginacct);
}catch (Exception e){
//如果重置密码失败,返回错误
log.error("获取管理员角色失败-{}", loginacct);
AppResponse response = AppResponse.fail(null);
response.setMsg("获取管理员角色失败");
return response;
}
return AppResponse.ok(roleList);
}
}
| [
"[email protected]"
] | |
b764e69e151cbdf480335f868d029d0e5059533c | 9e494ec84c9448dd5cbc0254f312376a4e17c740 | /minium-app/src/main/java/com/vilt/minium/app/webdrivers/WebElementsDriverManager.java | bc84d92272bb8ed04219157a836c7e059849ae6b | [
"Apache-2.0"
] | permissive | Jigsaw52/minium | 42c7646a5e124fc88630e30cb9965ff07a6644b7 | b87d1854428c0a75c5505b1c8b6c7169767c207f | refs/heads/master | 2020-12-01T13:07:08.237561 | 2014-12-23T11:29:04 | 2014-12-23T11:29:04 | 29,671,617 | 0 | 0 | null | 2015-01-22T09:41:28 | 2015-01-22T09:41:27 | null | UTF-8 | Java | false | false | 2,305 | java | /*
* Copyright (C) 2013 The Minium Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.vilt.minium.app.webdrivers;
import static java.lang.String.format;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.vilt.minium.WebElementsDriver;
import com.vilt.minium.script.MiniumScriptEngine;
@Component
public class WebElementsDriverManager {
@Autowired private MiniumScriptEngine engine;
private Map<String, WebElementsDriver<?>> webDrivers = Maps.newHashMap();
private Map<String, WebDriverInfo> webDriversInfo = Maps.newHashMap();
public boolean contains(String var) {
return webDrivers.get(var) != null;
}
public WebElementsDriver<?> get(String var) {
return webDrivers.get(var);
}
public void put(WebDriverInfo wdInfo, WebElementsDriver<?> driver) {
String variableName = wdInfo.getVarName();
if (engine.contains(variableName)) {
throw new IllegalStateException(format("Variable %s already exists in script engine", wdInfo.getVarName()));
}
webDrivers.put(variableName, driver);
webDriversInfo.put(variableName, wdInfo);
engine.put(variableName, driver);
}
public boolean delete(String var) {
webDriversInfo.remove(var);
WebElementsDriver<?> wd = webDrivers.remove(var);
engine.delete(var);
if (wd != null) {
wd.quit();
return true;
}
return false;
}
public List<WebDriverInfo> getWebDriverVariables() {
return Lists.newArrayList(webDriversInfo.values());
}
}
| [
"[email protected]"
] | |
dbe9be19879194d9ee41875f7a2331fad5d4c49f | 57c16e2334928feec3343574d0b7a758b47e7f45 | /app/src/main/java/org/xmlrpc/android/Base64.java | 95183ca4adde30aabd66c0b77116b7992952fc18 | [] | no_license | jpittmanpc/tidevalet-master | d2521df2648a992529a9117c80a112647a7d6e83 | af0ddca9fe8742497d62bcfb06f0d4c7d133bdd1 | refs/heads/master | 2020-12-24T06:57:40.528062 | 2017-04-05T01:45:42 | 2017-04-05T01:45:42 | 56,984,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86,862 | java | package org.xmlrpc.android;
/**
* <p>Encodes and decodes to and from Base64 notation.</p>
* <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
*
* <p>Example:</p>
*
* <code>String encoded = Base64.encode( myByteArray );</code>
* <br />
* <code>byte[] myByteArray = Base64.decode( encoded );</code>
*
* <p>The <tt>options</tt> parameter, which appears in a few places, is used to pass
* several pieces of information to the encoder. In the "higher level" methods such as
* encodeBytes( bytes, options ) the options parameter can be used to indicate such
* things as first gzipping the bytes before encoding them, not inserting linefeeds,
* and encoding using the URL-safe and Ordered dialects.</p>
*
* <p>Note, according to <a href="http://www.faqs.org/rfcs/rfc3548.html">RFC3548</a>,
* Section 2.1, implementations should not add line feeds unless explicitly told
* to do so. I've got Base64 set to this behavior now, although earlier versions
* broke lines by default.</p>
*
* <p>The constants defined in Base64 can be OR-ed together to combine options, so you
* might make a call like this:</p>
*
* <code>String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DO_BREAK_LINES );</code>
* <p>to compress the data before encoding it and then making the output have newline characters.</p>
* <p>Also...</p>
* <code>String encoded = Base64.encodeBytes( crazyString.getBytes() );</code>
*
*
*
* <p>
* Change Log:
* </p>
* <ul>
* <li>v2.3.7 - Fixed subtle bug when base 64 input stream contained the
* value 01111111, which is an invalid base 64 character but should not
* throw an ArrayIndexOutOfBoundsException either. Led to discovery of
* mishandling (or potential for better handling) of other bad input
* characters. You should now get an IOException if you try decoding
* something that has bad characters in it.</li>
* <li>v2.3.6 - Fixed bug when breaking lines and the final byte of the encoded
* string ended in the last column; the buffer was not properly shrunk and
* contained an extra (null) byte that made it into the string.</li>
* <li>v2.3.5 - Fixed bug in {@link #encodeFromFile} where estimated buffer size
* was wrong for files of size 31, 34, and 37 bytes.</li>
* <li>v2.3.4 - Fixed bug when working with gzipped streams whereby flushing
* the Base64.OutputStream closed the Base64 encoding (by padding with equals
* signs) too soon. Also added an option to suppress the automatic decoding
* of gzipped streams. Also added experimental support for specifying a
* class loader when using the
* {@link #decodeToObject(java.lang.String, int, java.lang.ClassLoader)}
* method.</li>
* <li>v2.3.3 - Changed default char encoding to US-ASCII which reduces the internal Java
* footprint with its CharEncoders and so forth. Fixed some javadocs that were
* inconsistent. Removed imports and specified things like java.io.IOException
* explicitly inline.</li>
* <li>v2.3.2 - Reduced memory footprint! Finally refined the "guessing" of how big the
* final encoded data will be so that the code doesn't have to create two output
* arrays: an oversized initial one and then a final, exact-sized one. Big win
* when using the {@link #encodeBytesToBytes(byte[])} family of methods (and not
* using the gzip options which uses a different mechanism with streams and stuff).</li>
* <li>v2.3.1 - Added {@link #encodeBytesToBytes(byte[], int, int, int)} and some
* similar helper methods to be more efficient with memory by not returning a
* String but just a byte array.</li>
* <li>v2.3 - <strong>This is not a drop-in replacement!</strong> This is two years of contractorComments
* and bug fixes queued up and finally executed. Thanks to everyone who sent
* me stuff, and I'm sorry I wasn't able to distribute your fixes to everyone else.
* Much bad coding was cleaned up including throwing exceptions where necessary
* instead of returning null values or something similar. Here are some changes
* that may affect you:
* <ul>
* <li><em>Does not break lines, by default.</em> This is to keep in compliance with
* <a href="http://www.faqs.org/rfcs/rfc3548.html">RFC3548</a>.</li>
* <li><em>Throws exceptions instead of returning null values.</em> Because some operations
* (especially those that may permit the GZIP option) use IO streams, there
* is a possiblity of an java.io.IOException being thrown. After some discussion and
* thought, I've changed the behavior of the methods to throw java.io.IOExceptions
* rather than return null if ever there's an error. I think this is more
* appropriate, though it will require some changes to your code. Sorry,
* it should have been done this way to begin with.</li>
* <li><em>Removed all references to System.out, System.err, and the like.</em>
* Shame on me. All I can say is sorry they were ever there.</li>
* <li><em>Throws NullPointerExceptions and IllegalArgumentExceptions</em> as needed
* such as when passed arrays are null or offsets are invalid.</li>
* <li>Cleaned up as much javadoc as I could to avoid any javadoc warnings.
* This was especially annoying before for people who were thorough in their
* own projects and then had gobs of javadoc warnings on this file.</li>
* </ul>
* <li>v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug
* when using very small files (~< 40 bytes).</li>
* <li>v2.2 - Added some helper methods for encoding/decoding directly from
* one file to the next. Also added a main() method to support command line
* encoding/decoding from one file to the next. Also added these Base64 dialects:
* <ol>
* <li>The default is RFC3548 format.</li>
* <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates
* URL and file name friendly format as described in Section 4 of RFC3548.
* http://www.faqs.org/rfcs/rfc3548.html</li>
* <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates
* URL and file name friendly format that preserves lexical ordering as described
* in http://www.faqs.org/qa/rfcc-1940.html</li>
* </ol>
* Special thanks to Jim Kellerman at <a href="http://www.powerset.com/">http://www.powerset.com/</a>
* for contributing the new Base64 dialects.
* </li>
*
* <li>v2.1 - Cleaned up javadoc contractorComments and unused variables and methods. Added
* some convenience methods for reading and writing to and from files.</li>
* <li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
* with other encodings (like EBCDIC).</li>
* <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
* encoded data was a single byte.</li>
* <li>v2.0 - I got rid of methods that used booleans to set options.
* Now everything is more consolidated and cleaner. The code now detects
* when data that's being decoded is gzip-compressed and will decompress it
* automatically. Generally things are cleaner. You'll probably have to
* change some method calls that you were making to support the new
* options format (<tt>int</tt>s that you "OR" together).</li>
* <li>v1.5.1 - Fixed bug when decompressing and decoding to a
* byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
* Added the ability to "suspend" encoding in the Output Stream so
* you can turn on and off the encoding if you need to embed base64
* data in an otherwise "normal" stream (like an XML file).</li>
* <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
* This helps when using GZIP streams.
* Added the ability to GZip-compress objects before encoding them.</li>
* <li>v1.4 - Added helper methods to read/write files.</li>
* <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
* <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
* where last buffer being read, if not completely full, was not returned.</li>
* <li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
* <li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
* </ul>
*
* <p>
* I am placing this code in the Public Domain. Do with it as you will.
* This software comes with no guarantees or warranties but with
* plenty of well-wishing instead!
* Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
* periodically to check for updates or to contribute improvements.
* </p>
*
* @author Robert Harder
* @author [email protected]
* @version 2.3.7
*/
public class Base64
{
/* ******** P U B L I C F I E L D S ******** */
/** No options specified. Value is zero. */
public final static int NO_OPTIONS = 0;
/** Specify encoding in first bit. Value is one. */
public final static int ENCODE = 1;
/** Specify decoding in first bit. Value is zero. */
public final static int DECODE = 0;
/** Specify that data should be gzip-compressed in second bit. Value is two. */
public final static int GZIP = 2;
/** Specify that gzipped data should <em>not</em> be automatically gunzipped. */
public final static int DONT_GUNZIP = 4;
/** Do break lines when encoding. Value is 8. */
public final static int DO_BREAK_LINES = 8;
/**
* Encode using Base64-like encoding that is URL- and Filename-safe as described
* in Section 4 of RFC3548:
* <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
* It is important to note that data encoded this way is <em>not</em> officially valid Base64,
* or at the very least should not be called Base64 without also specifying that is
* was encoded using the URL- and Filename-safe dialect.
*/
public final static int URL_SAFE = 16;
/**
* Encode using the special "ordered" dialect of Base64 described here:
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
*/
public final static int ORDERED = 32;
/* ******** P R I V A T E F I E L D S ******** */
/** Maximum line length (76) of Base64 output. */
private final static int MAX_LINE_LENGTH = 76;
/** The equals sign (=) as a byte. */
private final static byte EQUALS_SIGN = (byte)'=';
/** The new line character (\n) as a byte. */
private final static byte NEW_LINE = (byte)'\n';
/** Preferred encoding. */
private final static String PREFERRED_ENCODING = "US-ASCII";
private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
/** The 64 valid Base64 values. */
/* Host platform me be something funny like EBCDIC, so we hardcode these values. */
private final static byte[] _STANDARD_ALPHABET = {
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
(byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
(byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
(byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
(byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
(byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
(byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
};
/**
* Translates a Base64 value to either its 6-bit reconstruction value
* or a negative number indicating some other meaning.
**/
private final static byte[] _STANDARD_DECODABET = {
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
-5,-5, // Whitespace: Tab and Linefeed
-9,-9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
-9,-9,-9,-9,-9, // Decimal 27 - 31
-5, // Whitespace: Space
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
62, // Plus sign at decimal 43
-9,-9,-9, // Decimal 44 - 46
63, // Slash at decimal 47
52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
-9,-9,-9, // Decimal 58 - 60
-1, // Equals sign at decimal 61
-9,-9,-9, // Decimal 62 - 64
0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
-9,-9,-9,-9,-9,-9, // Decimal 91 - 96
26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
-9,-9,-9,-9,-9 // Decimal 123 - 127
,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255
};
/* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */
/**
* Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548:
* <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
* Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
*/
private final static byte[] _URL_SAFE_ALPHABET = {
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
(byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
(byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
(byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
(byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
(byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
(byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_'
};
/**
* Used in decoding URL- and Filename-safe dialects of Base64.
*/
private final static byte[] _URL_SAFE_DECODABET = {
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
-5,-5, // Whitespace: Tab and Linefeed
-9,-9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
-9,-9,-9,-9,-9, // Decimal 27 - 31
-5, // Whitespace: Space
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
-9, // Plus sign at decimal 43
-9, // Decimal 44
62, // Minus sign at decimal 45
-9, // Decimal 46
-9, // Slash at decimal 47
52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
-9,-9,-9, // Decimal 58 - 60
-1, // Equals sign at decimal 61
-9,-9,-9, // Decimal 62 - 64
0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
-9,-9,-9,-9, // Decimal 91 - 94
63, // Underscore at decimal 95
-9, // Decimal 96
26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
-9,-9,-9,-9,-9 // Decimal 123 - 127
,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255
};
/* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */
/**
* I don't get the point of this technique, but someone requested it,
* and it is described here:
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
*/
private final static byte[] _ORDERED_ALPHABET = {
(byte)'-',
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
(byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
(byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
(byte)'_',
(byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
(byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
(byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
(byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z'
};
/**
* Used in decoding the "ordered" dialect of Base64.
*/
private final static byte[] _ORDERED_DECODABET = {
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
-5,-5, // Whitespace: Tab and Linefeed
-9,-9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
-9,-9,-9,-9,-9, // Decimal 27 - 31
-5, // Whitespace: Space
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
-9, // Plus sign at decimal 43
-9, // Decimal 44
0, // Minus sign at decimal 45
-9, // Decimal 46
-9, // Slash at decimal 47
1,2,3,4,5,6,7,8,9,10, // Numbers zero through nine
-9,-9,-9, // Decimal 58 - 60
-1, // Equals sign at decimal 61
-9,-9,-9, // Decimal 62 - 64
11,12,13,14,15,16,17,18,19,20,21,22,23, // Letters 'A' through 'M'
24,25,26,27,28,29,30,31,32,33,34,35,36, // Letters 'N' through 'Z'
-9,-9,-9,-9, // Decimal 91 - 94
37, // Underscore at decimal 95
-9, // Decimal 96
38,39,40,41,42,43,44,45,46,47,48,49,50, // Letters 'a' through 'm'
51,52,53,54,55,56,57,58,59,60,61,62,63, // Letters 'n' through 'z'
-9,-9,-9,-9,-9 // Decimal 123 - 127
,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255
};
/* ******** D E T E R M I N E W H I C H A L H A B E T ******** */
/**
* Returns one of the _SOMETHING_ALPHABET byte arrays depending on
* the options specified.
* It's possible, though silly, to specify ORDERED <b>and</b> URLSAFE
* in which case one of them will be picked, though there is
* no guarantee as to which one will be picked.
*/
private final static byte[] getAlphabet( int options ) {
if ((options & URL_SAFE) == URL_SAFE) {
return _URL_SAFE_ALPHABET;
} else if ((options & ORDERED) == ORDERED) {
return _ORDERED_ALPHABET;
} else {
return _STANDARD_ALPHABET;
}
} // end getAlphabet
/**
* Returns one of the _SOMETHING_DECODABET byte arrays depending on
* the options specified.
* It's possible, though silly, to specify ORDERED and URL_SAFE
* in which case one of them will be picked, though there is
* no guarantee as to which one will be picked.
*/
private final static byte[] getDecodabet( int options ) {
if( (options & URL_SAFE) == URL_SAFE) {
return _URL_SAFE_DECODABET;
} else if ((options & ORDERED) == ORDERED) {
return _ORDERED_DECODABET;
} else {
return _STANDARD_DECODABET;
}
} // end getAlphabet
/** Defeats instantiation. */
private Base64(){}
/* ******** E N C O D I N G M E T H O D S ******** */
/**
* Encodes up to the first three bytes of array <var>threeBytes</var>
* and returns a four-byte array in Base64 notation.
* The actual number of significant bytes in your array is
* given by <var>numSigBytes</var>.
* The array <var>threeBytes</var> needs only be as big as
* <var>numSigBytes</var>.
* Code can reuse a byte array by passing a four-byte array as <var>b4</var>.
*
* @param b4 A reusable byte array to reduce array instantiation
* @param threeBytes the array to convert
* @param numSigBytes the number of significant bytes in your array
* @return four byte array in Base64 notation.
* @since 1.5.1
*/
private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes, int options ) {
encode3to4( threeBytes, 0, numSigBytes, b4, 0, options );
return b4;
} // end encode3to4
/**
* <p>Encodes up to three bytes of the array <var>source</var>
* and writes the resulting four Base64 bytes to <var>destination</var>.
* The source and destination arrays can be manipulated
* anywhere along their length by specifying
* <var>srcOffset</var> and <var>destOffset</var>.
* This method does not check to make sure your arrays
* are large enough to accomodate <var>srcOffset</var> + 3 for
* the <var>source</var> array or <var>destOffset</var> + 4 for
* the <var>destination</var> array.
* The actual number of significant bytes in your array is
* given by <var>numSigBytes</var>.</p>
* <p>This is the lowest level of the encoding methods with
* all possible parameters.</p>
*
* @param source the array to convert
* @param srcOffset the index where conversion begins
* @param numSigBytes the number of significant bytes in your array
* @param destination the array to hold the conversion
* @param destOffset the index where output will be put
* @return the <var>destination</var> array
* @since 1.3
*/
private static byte[] encode3to4(
byte[] source, int srcOffset, int numSigBytes,
byte[] destination, int destOffset, int options ) {
byte[] ALPHABET = getAlphabet( options );
// 1 2 3
// 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Array position from threeBytes
// --------| || || || | Six bit groups to index ALPHABET
// >>18 >>12 >> 6 >> 0 Right shift necessary
// 0x3f 0x3f 0x3f Additional AND
// Create buffer with zero-padding if there are only one or two
// significant bytes passed in the array.
// We have to shift left 24 in order to flush out the 1's that appear
// when Java treats a value as negative that is cast from a byte to an int.
int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
| ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
| ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
switch( numSigBytes )
{
case 3:
destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
return destination;
case 2:
destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
destination[ destOffset + 3 ] = EQUALS_SIGN;
return destination;
case 1:
destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
destination[ destOffset + 2 ] = EQUALS_SIGN;
destination[ destOffset + 3 ] = EQUALS_SIGN;
return destination;
default:
return destination;
} // end switch
} // end encode3to4
/**
* Performs Base64 encoding on the <code>raw</code> ByteBuffer,
* writing it to the <code>encoded</code> ByteBuffer.
* This is an experimental feature. Currently it does not
* pass along any options (such as {@link #DO_BREAK_LINES}
* or {@link #GZIP}.
*
* @param raw input buffer
* @param encoded output buffer
* @since 2.3
*/
public static void encode( java.nio.ByteBuffer raw, java.nio.ByteBuffer encoded ){
byte[] raw3 = new byte[3];
byte[] enc4 = new byte[4];
while( raw.hasRemaining() ){
int rem = Math.min(3,raw.remaining());
raw.get(raw3,0,rem);
Base64.encode3to4(enc4, raw3, rem, Base64.NO_OPTIONS );
encoded.put(enc4);
} // end input remaining
}
/**
* Performs Base64 encoding on the <code>raw</code> ByteBuffer,
* writing it to the <code>encoded</code> CharBuffer.
* This is an experimental feature. Currently it does not
* pass along any options (such as {@link #DO_BREAK_LINES}
* or {@link #GZIP}.
*
* @param raw input buffer
* @param encoded output buffer
* @since 2.3
*/
public static void encode( java.nio.ByteBuffer raw, java.nio.CharBuffer encoded ){
byte[] raw3 = new byte[3];
byte[] enc4 = new byte[4];
while( raw.hasRemaining() ){
int rem = Math.min(3,raw.remaining());
raw.get(raw3,0,rem);
Base64.encode3to4(enc4, raw3, rem, Base64.NO_OPTIONS );
for( int i = 0; i < 4; i++ ){
encoded.put( (char)(enc4[i] & 0xFF) );
}
} // end input remaining
}
/**
* Serializes an object and returns the Base64-encoded
* version of that serialized object.
*
* <p>As of v 2.3, if the object
* cannot be serialized or there is another error,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned a null value, but
* in retrospect that's a pretty poor way to handle it.</p>
*
* The object is not GZip-compressed before being encoded.
*
* @param serializableObject The object to encode
* @return The Base64-encoded object
* @throws java.io.IOException if there is an error
* @throws NullPointerException if serializedObject is null
* @since 1.4
*/
public static String encodeObject( java.io.Serializable serializableObject )
throws java.io.IOException {
return encodeObject( serializableObject, NO_OPTIONS );
} // end encodeObject
/**
* Serializes an object and returns the Base64-encoded
* version of that serialized object.
*
* <p>As of v 2.3, if the object
* cannot be serialized or there is another error,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned a null value, but
* in retrospect that's a pretty poor way to handle it.</p>
*
* The object is not GZip-compressed before being encoded.
* <p>
* Example options:<pre>
* GZIP: gzip-compresses object before encoding it.
* DO_BREAK_LINES: break lines at 76 characters
* </pre>
* <p>
* Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
* <p>
* Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
*
* @param serializableObject The object to encode
* @param options Specified options
* @return The Base64-encoded object
* @see Base64#GZIP
* @see Base64#DO_BREAK_LINES
* @throws java.io.IOException if there is an error
* @since 2.0
*/
public static String encodeObject( java.io.Serializable serializableObject, int options )
throws java.io.IOException {
if( serializableObject == null ){
throw new NullPointerException( "Cannot serialize a null object." );
} // end if: null
// Streams
java.io.ByteArrayOutputStream baos = null;
java.io.OutputStream b64os = null;
java.util.zip.GZIPOutputStream gzos = null;
java.io.ObjectOutputStream oos = null;
try {
// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
baos = new java.io.ByteArrayOutputStream();
b64os = new Base64.OutputStream( baos, ENCODE | options );
if( (options & GZIP) != 0 ){
// Gzip
gzos = new java.util.zip.GZIPOutputStream(b64os);
oos = new java.io.ObjectOutputStream( gzos );
} else {
// Not gzipped
oos = new java.io.ObjectOutputStream( b64os );
}
oos.writeObject( serializableObject );
} // end try
catch( java.io.IOException e ) {
// Catch it and then throw it immediately so that
// the finally{} block is called for cleanup.
throw e;
} // end catch
finally {
try{ oos.close(); } catch( Exception e ){}
try{ gzos.close(); } catch( Exception e ){}
try{ b64os.close(); } catch( Exception e ){}
try{ baos.close(); } catch( Exception e ){}
} // end finally
// Return value according to relevant encoding.
try {
return new String( baos.toByteArray(), PREFERRED_ENCODING );
} // end try
catch (java.io.UnsupportedEncodingException uue){
// Fall back to some Java default
return new String( baos.toByteArray() );
} // end catch
} // end encode
/**
* Encodes a byte array into Base64 notation.
* Does not GZip-compress data.
*
* @param source The data to convert
* @return The data in Base64-encoded form
* @throws NullPointerException if source array is null
* @since 1.4
*/
public static String encodeBytes( byte[] source ) {
// Since we're not going to have the GZIP encoding turned on,
// we're not going to have an java.io.IOException thrown, so
// we should not force the user to have to catch it.
String encoded = null;
try {
encoded = encodeBytes(source, 0, source.length, NO_OPTIONS);
} catch (java.io.IOException ex) {
assert false : ex.getMessage();
} // end catch
assert encoded != null;
return encoded;
} // end encodeBytes
/**
* Encodes a byte array into Base64 notation.
* <p>
* Example options:<pre>
* GZIP: gzip-compresses object before encoding it.
* DO_BREAK_LINES: break lines at 76 characters
* <i>Note: Technically, this makes your encoding non-compliant.</i>
* </pre>
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
*
*
* <p>As of v 2.3, if there is an error with the GZIP stream,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned a null value, but
* in retrospect that's a pretty poor way to handle it.</p>
*
*
* @param source The data to convert
* @param options Specified options
* @return The Base64-encoded data as a String
* @see Base64#GZIP
* @see Base64#DO_BREAK_LINES
* @throws java.io.IOException if there is an error
* @throws NullPointerException if source array is null
* @since 2.0
*/
public static String encodeBytes( byte[] source, int options ) throws java.io.IOException {
return encodeBytes( source, 0, source.length, options );
} // end encodeBytes
/**
* Encodes a byte array into Base64 notation.
* Does not GZip-compress data.
*
* <p>As of v 2.3, if there is an error,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned a null value, but
* in retrospect that's a pretty poor way to handle it.</p>
*
*
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
* @return The Base64-encoded data as a String
* @throws NullPointerException if source array is null
* @throws IllegalArgumentException if source array, offset, or length are invalid
* @since 1.4
*/
public static String encodeBytes( byte[] source, int off, int len ) {
// Since we're not going to have the GZIP encoding turned on,
// we're not going to have an java.io.IOException thrown, so
// we should not force the user to have to catch it.
String encoded = null;
try {
encoded = encodeBytes( source, off, len, NO_OPTIONS );
} catch (java.io.IOException ex) {
assert false : ex.getMessage();
} // end catch
assert encoded != null;
return encoded;
} // end encodeBytes
/**
* Encodes a byte array into Base64 notation.
* <p>
* Example options:<pre>
* GZIP: gzip-compresses object before encoding it.
* DO_BREAK_LINES: break lines at 76 characters
* <i>Note: Technically, this makes your encoding non-compliant.</i>
* </pre>
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
* <p>
* Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
*
*
* <p>As of v 2.3, if there is an error with the GZIP stream,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned a null value, but
* in retrospect that's a pretty poor way to handle it.</p>
*
*
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
* @param options Specified options
* @return The Base64-encoded data as a String
* @see Base64#GZIP
* @see Base64#DO_BREAK_LINES
* @throws java.io.IOException if there is an error
* @throws NullPointerException if source array is null
* @throws IllegalArgumentException if source array, offset, or length are invalid
* @since 2.0
*/
public static String encodeBytes( byte[] source, int off, int len, int options ) throws java.io.IOException {
byte[] encoded = encodeBytesToBytes( source, off, len, options );
// Return value according to relevant encoding.
try {
return new String( encoded, PREFERRED_ENCODING );
} // end try
catch (java.io.UnsupportedEncodingException uue) {
return new String( encoded );
} // end catch
} // end encodeBytes
/**
* Similar to {@link #encodeBytes(byte[])} but returns
* a byte array instead of instantiating a String. This is more efficient
* if you're working with I/O streams and have large data sets to encode.
*
*
* @param source The data to convert
* @return The Base64-encoded data as a byte[] (of ASCII characters)
* @throws NullPointerException if source array is null
* @since 2.3.1
*/
public static byte[] encodeBytesToBytes( byte[] source ) {
byte[] encoded = null;
try {
encoded = encodeBytesToBytes( source, 0, source.length, Base64.NO_OPTIONS );
} catch( java.io.IOException ex ) {
assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage();
}
return encoded;
}
/**
* Similar to {@link #encodeBytes(byte[], int, int, int)} but returns
* a byte array instead of instantiating a String. This is more efficient
* if you're working with I/O streams and have large data sets to encode.
*
*
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
* @param options Specified options
* @return The Base64-encoded data as a String
* @see Base64#GZIP
* @see Base64#DO_BREAK_LINES
* @throws java.io.IOException if there is an error
* @throws NullPointerException if source array is null
* @throws IllegalArgumentException if source array, offset, or length are invalid
* @since 2.3.1
*/
public static byte[] encodeBytesToBytes( byte[] source, int off, int len, int options ) throws java.io.IOException {
if( source == null ){
throw new NullPointerException( "Cannot serialize a null array." );
} // end if: null
if( off < 0 ){
throw new IllegalArgumentException( "Cannot have negative offset: " + off );
} // end if: off < 0
if( len < 0 ){
throw new IllegalArgumentException( "Cannot have length offset: " + len );
} // end if: len < 0
if( off + len > source.length ){
throw new IllegalArgumentException(
String.format( "Cannot have offset of %d and length of %d with array of length %d", off,len,source.length));
} // end if: off < 0
// Compress?
if( (options & GZIP) != 0 ) {
java.io.ByteArrayOutputStream baos = null;
java.util.zip.GZIPOutputStream gzos = null;
Base64.OutputStream b64os = null;
try {
// GZip -> Base64 -> ByteArray
baos = new java.io.ByteArrayOutputStream();
b64os = new Base64.OutputStream( baos, ENCODE | options );
gzos = new java.util.zip.GZIPOutputStream( b64os );
gzos.write( source, off, len );
gzos.close();
} // end try
catch( java.io.IOException e ) {
// Catch it and then throw it immediately so that
// the finally{} block is called for cleanup.
throw e;
} // end catch
finally {
try{ gzos.close(); } catch( Exception e ){}
try{ b64os.close(); } catch( Exception e ){}
try{ baos.close(); } catch( Exception e ){}
} // end finally
return baos.toByteArray();
} // end if: compress
// Else, don't compress. Better not to use streams at all then.
else {
boolean breakLines = (options & DO_BREAK_LINES) != 0;
//int len43 = len * 4 / 3;
//byte[] outBuff = new byte[ ( len43 ) // Main 4:3
// + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
// + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
// Try to determine more precisely how big the array needs to be.
// If we get it right, we don't have to do an array copy, and
// we save a bunch of memory.
int encLen = ( len / 3 ) * 4 + ( len % 3 > 0 ? 4 : 0 ); // Bytes needed for actual encoding
if( breakLines ){
encLen += encLen / MAX_LINE_LENGTH; // Plus extra newline characters
}
byte[] outBuff = new byte[ encLen ];
int d = 0;
int e = 0;
int len2 = len - 2;
int lineLength = 0;
for( ; d < len2; d+=3, e+=4 ) {
encode3to4( source, d+off, 3, outBuff, e, options );
lineLength += 4;
if( breakLines && lineLength >= MAX_LINE_LENGTH )
{
outBuff[e+4] = NEW_LINE;
e++;
lineLength = 0;
} // end if: end of line
} // en dfor: each piece of array
if( d < len ) {
encode3to4( source, d+off, len - d, outBuff, e, options );
e += 4;
} // end if: some padding needed
// Only resize array if we didn't guess it right.
if( e <= outBuff.length - 1 ){
// If breaking lines and the last byte falls right at
// the line length (76 bytes per line), there will be
// one extra byte, and the array will need to be resized.
// Not too bad of an estimate on array size, I'd say.
byte[] finalOut = new byte[e];
System.arraycopy(outBuff,0, finalOut,0,e);
//System.err.println("Having to resize array from " + outBuff.length + " to " + e );
return finalOut;
} else {
//System.err.println("No need to resize array.");
return outBuff;
}
} // end else: don't compress
} // end encodeBytesToBytes
/* ******** D E C O D I N G M E T H O D S ******** */
/**
* Decodes four bytes from array <var>source</var>
* and writes the resulting bytes (up to three of them)
* to <var>destination</var>.
* The source and destination arrays can be manipulated
* anywhere along their length by specifying
* <var>srcOffset</var> and <var>destOffset</var>.
* This method does not check to make sure your arrays
* are large enough to accomodate <var>srcOffset</var> + 4 for
* the <var>source</var> array or <var>destOffset</var> + 3 for
* the <var>destination</var> array.
* This method returns the actual number of bytes that
* were converted from the Base64 encoding.
* <p>This is the lowest level of the decoding methods with
* all possible parameters.</p>
*
*
* @param source the array to convert
* @param srcOffset the index where conversion begins
* @param destination the array to hold the conversion
* @param destOffset the index where output will be put
* @param options alphabet type is pulled from this (standard, url-safe, ordered)
* @return the number of decoded bytes converted
* @throws NullPointerException if source or destination arrays are null
* @throws IllegalArgumentException if srcOffset or destOffset are invalid
* or there is not enough room in the array.
* @since 1.3
*/
private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
if( destination == null ){
throw new NullPointerException( "Destination array was null." );
} // end if
if( srcOffset < 0 || srcOffset + 3 >= source.length ){
throw new IllegalArgumentException( String.format(
"Source array with length %d cannot have offset of %d and still process four bytes.", source.length, srcOffset ) );
} // end if
if( destOffset < 0 || destOffset +2 >= destination.length ){
throw new IllegalArgumentException( String.format(
"Destination array with length %d cannot have offset of %d and still store three bytes.", destination.length, destOffset ) );
} // end if
byte[] DECODABET = getDecodabet( options );
// Example: Dk==
if( source[ srcOffset + 2] == EQUALS_SIGN ) {
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
return 1;
}
// Example: DkL=
else if( source[ srcOffset + 3 ] == EQUALS_SIGN ) {
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
return 2;
}
// Example: DkLE
else {
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
| ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
destination[ destOffset ] = (byte)( outBuff >> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
destination[ destOffset + 2 ] = (byte)( outBuff );
return 3;
}
} // end decodeToBytes
/**
* Low-level access to decoding ASCII characters in
* the form of a byte array. <strong>Ignores GUNZIP option, if
* it's set.</strong> This is not generally a recommended method,
* although it is used internally as part of the decoding process.
* Special case: if len = 0, an empty array is returned. Still,
* if you need more speed and reduced memory footprint (and aren't
* gzipping), consider this method.
*
* @param source The Base64 encoded data
* @return decoded data
* @since 2.3.1
*/
public static byte[] decode( byte[] source )
throws java.io.IOException {
byte[] decoded = null;
// try {
decoded = decode( source, 0, source.length, Base64.NO_OPTIONS );
// } catch( java.io.IOException ex ) {
// assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage();
// }
return decoded;
}
/**
* Low-level access to decoding ASCII characters in
* the form of a byte array. <strong>Ignores GUNZIP option, if
* it's set.</strong> This is not generally a recommended method,
* although it is used internally as part of the decoding process.
* Special case: if len = 0, an empty array is returned. Still,
* if you need more speed and reduced memory footprint (and aren't
* gzipping), consider this method.
*
* @param source The Base64 encoded data
* @param off The offset of where to begin decoding
* @param len The length of characters to decode
* @param options Can specify options such as alphabet type to use
* @return decoded data
* @throws java.io.IOException If bogus characters exist in source data
* @since 1.3
*/
public static byte[] decode( byte[] source, int off, int len, int options )
throws java.io.IOException {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Cannot decode null source array." );
} // end if
if( off < 0 || off + len > source.length ){
throw new IllegalArgumentException( String.format(
"Source array with length %d cannot have offset of %d and process %d bytes.", source.length, off, len ) );
} // end if
if( len == 0 ){
return new byte[0];
}else if( len < 4 ){
throw new IllegalArgumentException(
"Base64-encoded string must have at least four characters, but length specified was " + len );
} // end if
byte[] DECODABET = getDecodabet( options );
int len34 = len * 3 / 4; // Estimate on array size
byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
int outBuffPosn = 0; // Keep track of where we're writing
byte[] b4 = new byte[4]; // Four byte buffer from source, eliminating white space
int b4Posn = 0; // Keep track of four byte input buffer
int i = 0; // Source array counter
byte sbiDecode = 0; // Special value from DECODABET
for( i = off; i < off+len; i++ ) { // Loop through source
sbiDecode = DECODABET[ source[i]&0xFF ];
// White space, Equals sign, or legit Base64 character
// Note the values such as -5 and -9 in the
// DECODABETs at the top of the file.
if( sbiDecode >= WHITE_SPACE_ENC ) {
if( sbiDecode >= EQUALS_SIGN_ENC ) {
b4[ b4Posn++ ] = source[i]; // Save non-whitespace
if( b4Posn > 3 ) { // Time to decode?
outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn, options );
b4Posn = 0;
// If that was the equals sign, break out of 'for' loop
if( source[i] == EQUALS_SIGN ) {
break;
} // end if: equals sign
} // end if: quartet built
} // end if: equals sign or better
} // end if: white space, equals sign or better
else {
// There's a bad input character in the Base64 stream.
throw new java.io.IOException( String.format(
"Bad Base64 input character decimal %d in array position %d", ((int)source[i])&0xFF, i ) );
} // end else:
} // each input character
byte[] out = new byte[ outBuffPosn ];
System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
return out;
} // end decode
/**
* Decodes data from Base64 notation, automatically
* detecting gzip-compressed data and decompressing it.
*
* @param s the string to decode
* @return the decoded data
* @throws java.io.IOException If there is a problem
* @since 1.4
*/
public static byte[] decode( String s ) throws java.io.IOException {
return decode( s, NO_OPTIONS );
}
/**
* Decodes data from Base64 notation, automatically
* detecting gzip-compressed data and decompressing it.
*
* @param s the string to decode
* @param options encode options such as URL_SAFE
* @return the decoded data
* @throws java.io.IOException if there is an error
* @throws NullPointerException if <tt>s</tt> is null
* @since 1.4
*/
public static byte[] decode( String s, int options ) throws java.io.IOException {
if( s == null ){
throw new NullPointerException( "Input string was null." );
} // end if
byte[] bytes;
try {
bytes = s.getBytes( PREFERRED_ENCODING );
} // end try
catch( java.io.UnsupportedEncodingException uee ) {
bytes = s.getBytes();
} // end catch
//</change>
// Decode
bytes = decode( bytes, 0, bytes.length, options );
// Check to see if it's gzip-compressed
// GZIP Magic Two-Byte Number: 0x8b1f (35615)
boolean dontGunzip = (options & DONT_GUNZIP) != 0;
if( (bytes != null) && (bytes.length >= 4) && (!dontGunzip) ) {
int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head ) {
java.io.ByteArrayInputStream bais = null;
java.util.zip.GZIPInputStream gzis = null;
java.io.ByteArrayOutputStream baos = null;
byte[] buffer = new byte[2048];
int length = 0;
try {
baos = new java.io.ByteArrayOutputStream();
bais = new java.io.ByteArrayInputStream( bytes );
gzis = new java.util.zip.GZIPInputStream( bais );
while( ( length = gzis.read( buffer ) ) >= 0 ) {
baos.write(buffer,0,length);
} // end while: reading input
// No error? Get new bytes.
bytes = baos.toByteArray();
} // end try
catch( java.io.IOException e ) {
e.printStackTrace();
// Just return originally-decoded bytes
} // end catch
finally {
try{ baos.close(); } catch( Exception e ){}
try{ gzis.close(); } catch( Exception e ){}
try{ bais.close(); } catch( Exception e ){}
} // end finally
} // end if: gzipped
} // end if: bytes.length >= 2
return bytes;
} // end decode
/**
* Attempts to decode Base64 data and deserialize a Java
* Object within. Returns <tt>null</tt> if there was an error.
*
* @param encodedObject The Base64 data to decode
* @return The decoded and deserialized object
* @throws NullPointerException if encodedObject is null
* @throws java.io.IOException if there is a general error
* @throws ClassNotFoundException if the decoded object is of a
* class that cannot be found by the JVM
* @since 1.5
*/
public static Object decodeToObject( String encodedObject )
throws java.io.IOException, java.lang.ClassNotFoundException {
return decodeToObject(encodedObject,NO_OPTIONS,null);
}
/**
* Attempts to decode Base64 data and deserialize a Java
* Object within. Returns <tt>null</tt> if there was an error.
* If <tt>loader</tt> is not null, it will be the class loader
* used when deserializing.
*
* @param encodedObject The Base64 data to decode
* @param options Various parameters related to decoding
* @param loader Optional class loader to use in deserializing classes.
* @return The decoded and deserialized object
* @throws NullPointerException if encodedObject is null
* @throws java.io.IOException if there is a general error
* @throws ClassNotFoundException if the decoded object is of a
* class that cannot be found by the JVM
* @since 2.3.4
*/
public static Object decodeToObject(
String encodedObject, int options, final ClassLoader loader )
throws java.io.IOException, java.lang.ClassNotFoundException {
// Decode and gunzip if necessary
byte[] objBytes = decode( encodedObject, options );
java.io.ByteArrayInputStream bais = null;
java.io.ObjectInputStream ois = null;
Object obj = null;
try {
bais = new java.io.ByteArrayInputStream( objBytes );
// If no custom class loader is provided, use Java's builtin OIS.
if( loader == null ){
ois = new java.io.ObjectInputStream( bais );
} // end if: no loader provided
// Else make a customized object input stream that uses
// the provided class loader.
else {
ois = new java.io.ObjectInputStream(bais){
@Override
public Class<?> resolveClass(java.io.ObjectStreamClass streamClass)
throws java.io.IOException, ClassNotFoundException {
Class c = Class.forName(streamClass.getName(), false, loader);
if( c == null ){
return super.resolveClass(streamClass);
} else {
return c; // Class loader knows of this class.
} // end else: not null
} // end resolveClass
}; // end ois
} // end else: no custom class loader
obj = ois.readObject();
} // end try
catch( java.io.IOException e ) {
throw e; // Catch and throw in order to execute finally{}
} // end catch
catch( java.lang.ClassNotFoundException e ) {
throw e; // Catch and throw in order to execute finally{}
} // end catch
finally {
try{ bais.close(); } catch( Exception e ){}
try{ ois.close(); } catch( Exception e ){}
} // end finally
return obj;
} // end decodeObject
/**
* Convenience method for encoding data to a file.
*
* <p>As of v 2.3, if there is a error,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned false, but
* in retrospect that's a pretty poor way to handle it.</p>
*
* @param dataToEncode byte array of data to encode in base64 form
* @param filename Filename for saving encoded data
* @throws java.io.IOException if there is an error
* @throws NullPointerException if dataToEncode is null
* @since 2.1
*/
public static void encodeToFile( byte[] dataToEncode, String filename )
throws java.io.IOException {
if( dataToEncode == null ){
throw new NullPointerException( "Data to encode was null." );
} // end iff
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(
new java.io.FileOutputStream( filename ), Base64.ENCODE );
bos.write( dataToEncode );
} // end try
catch( java.io.IOException e ) {
throw e; // Catch and throw to execute finally{} block
} // end catch: java.io.IOException
finally {
try{ bos.close(); } catch( Exception e ){}
} // end finally
} // end encodeToFile
/**
* Convenience method for decoding data to a file.
*
* <p>As of v 2.3, if there is a error,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned false, but
* in retrospect that's a pretty poor way to handle it.</p>
*
* @param dataToDecode Base64-encoded data as a string
* @param filename Filename for saving decoded data
* @throws java.io.IOException if there is an error
* @since 2.1
*/
public static void decodeToFile( String dataToDecode, String filename )
throws java.io.IOException {
Base64.OutputStream bos = null;
try{
bos = new Base64.OutputStream(
new java.io.FileOutputStream( filename ), Base64.DECODE );
bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
} // end try
catch( java.io.IOException e ) {
throw e; // Catch and throw to execute finally{} block
} // end catch: java.io.IOException
finally {
try{ bos.close(); } catch( Exception e ){}
} // end finally
} // end decodeToFile
/**
* Convenience method for reading a base64-encoded
* file and decoding it.
*
* <p>As of v 2.3, if there is a error,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned false, but
* in retrospect that's a pretty poor way to handle it.</p>
*
* @param filename Filename for reading encoded data
* @return decoded byte array
* @throws java.io.IOException if there is an error
* @since 2.1
*/
public static byte[] decodeFromFile( String filename )
throws java.io.IOException {
byte[] decodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File( filename );
byte[] buffer = null;
int length = 0;
int numBytes = 0;
// Check for size of file
if( file.length() > Integer.MAX_VALUE )
{
throw new java.io.IOException( "File is too big for this convenience method (" + file.length() + " bytes)." );
} // end if: file too big for int index
buffer = new byte[ (int)file.length() ];
// Open a stream
bis = new Base64.InputStream(
new java.io.BufferedInputStream(
new java.io.FileInputStream( file ) ), Base64.DECODE );
// Read until done
while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 ) {
length += numBytes;
} // end while
// Save in a variable to return
decodedData = new byte[ length ];
System.arraycopy( buffer, 0, decodedData, 0, length );
} // end try
catch( java.io.IOException e ) {
throw e; // Catch and release to execute finally{}
} // end catch: java.io.IOException
finally {
try{ bis.close(); } catch( Exception e) {}
} // end finally
return decodedData;
} // end decodeFromFile
/**
* Convenience method for reading a binary file
* and base64-encoding it.
*
* <p>As of v 2.3, if there is a error,
* the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
* In earlier versions, it just returned false, but
* in retrospect that's a pretty poor way to handle it.</p>
*
* @param filename Filename for reading binary data
* @return base64-encoded string
* @throws java.io.IOException if there is an error
* @since 2.1
*/
public static String encodeFromFile( String filename )
throws java.io.IOException {
String encodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File( filename );
byte[] buffer = new byte[ Math.max((int)(file.length() * 1.4+1),40) ]; // Need max() for math on small files (v2.2.1); Need +1 for a few corner cases (v2.3.5)
int length = 0;
int numBytes = 0;
// Open a stream
bis = new Base64.InputStream(
new java.io.BufferedInputStream(
new java.io.FileInputStream( file ) ), Base64.ENCODE );
// Read until done
while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 ) {
length += numBytes;
} // end while
// Save in a variable to return
encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
} // end try
catch( java.io.IOException e ) {
throw e; // Catch and release to execute finally{}
} // end catch: java.io.IOException
finally {
try{ bis.close(); } catch( Exception e) {}
} // end finally
return encodedData;
} // end encodeFromFile
/**
* Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.
*
* @param infile Input file
* @param outfile Output file
* @throws java.io.IOException if there is an error
* @since 2.2
*/
public static void encodeFileToFile( String infile, String outfile )
throws java.io.IOException {
String encoded = Base64.encodeFromFile( infile );
java.io.OutputStream out = null;
try{
out = new java.io.BufferedOutputStream(
new java.io.FileOutputStream( outfile ) );
out.write( encoded.getBytes("US-ASCII") ); // Strict, 7-bit output.
} // end try
catch( java.io.IOException e ) {
throw e; // Catch and release to execute finally{}
} // end catch
finally {
try { out.close(); }
catch( Exception ex ){}
} // end finally
} // end encodeFileToFile
/**
* Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.
*
* @param infile Input file
* @param outfile Output file
* @throws java.io.IOException if there is an error
* @since 2.2
*/
public static void decodeFileToFile( String infile, String outfile )
throws java.io.IOException {
byte[] decoded = Base64.decodeFromFile( infile );
java.io.OutputStream out = null;
try{
out = new java.io.BufferedOutputStream(
new java.io.FileOutputStream( outfile ) );
out.write( decoded );
} // end try
catch( java.io.IOException e ) {
throw e; // Catch and release to execute finally{}
} // end catch
finally {
try { out.close(); }
catch( Exception ex ){}
} // end finally
} // end decodeFileToFile
/* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
/**
* A {@link Base64.InputStream} will read data from another
* <tt>java.io.InputStream</tt>, given in the constructor,
* and encode/decode to/from Base64 notation on the fly.
*
* @see Base64
* @since 1.3
*/
public static class InputStream extends java.io.FilterInputStream {
private boolean encode; // Encoding or decoding
private int position; // Current position in the buffer
private byte[] buffer; // Small buffer holding converted data
private int bufferLength; // Length of buffer (3 or 4)
private int numSigBytes; // Number of meaningful bytes in the buffer
private int lineLength;
private boolean breakLines; // Break lines at less than 80 characters
private int options; // Record options used to create the stream.
private byte[] decodabet; // Local copies to avoid extra method calls
/**
* Constructs a {@link Base64.InputStream} in DECODE mode.
*
* @param in the <tt>java.io.InputStream</tt> from which to read data.
* @since 1.3
*/
public InputStream( java.io.InputStream in ) {
this( in, DECODE );
} // end constructor
/**
* Constructs a {@link Base64.InputStream} in
* either ENCODE or DECODE mode.
* <p>
* Valid options:<pre>
* ENCODE or DECODE: Encode or Decode as data is read.
* DO_BREAK_LINES: break lines at 76 characters
* (only meaningful when encoding)</i>
* </pre>
* <p>
* Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
*
*
* @param in the <tt>java.io.InputStream</tt> from which to read data.
* @param options Specified options
* @see Base64#ENCODE
* @see Base64#DECODE
* @see Base64#DO_BREAK_LINES
* @since 2.0
*/
public InputStream( java.io.InputStream in, int options ) {
super( in );
this.options = options; // Record for later
this.breakLines = (options & DO_BREAK_LINES) > 0;
this.encode = (options & ENCODE) > 0;
this.bufferLength = encode ? 4 : 3;
this.buffer = new byte[ bufferLength ];
this.position = -1;
this.lineLength = 0;
this.decodabet = getDecodabet(options);
} // end constructor
/**
* Reads enough of the input stream to convert
* to/from Base64 and returns the next byte.
*
* @return next byte
* @since 1.3
*/
@Override
public int read() throws java.io.IOException {
// Do we need to get data?
if( position < 0 ) {
if( encode ) {
byte[] b3 = new byte[3];
int numBinaryBytes = 0;
for( int i = 0; i < 3; i++ ) {
int b = in.read();
// If end of stream, b is -1.
if( b >= 0 ) {
b3[i] = (byte)b;
numBinaryBytes++;
} else {
break; // out of for loop
} // end else: end of stream
} // end for: each needed input byte
if( numBinaryBytes > 0 ) {
encode3to4( b3, 0, numBinaryBytes, buffer, 0, options );
position = 0;
numSigBytes = 4;
} // end if: got data
else {
return -1; // Must be end of stream
} // end else
} // end if: encoding
// Else decoding
else {
byte[] b4 = new byte[4];
int i = 0;
for( i = 0; i < 4; i++ ) {
// Read four "meaningful" bytes:
int b = 0;
do{ b = in.read(); }
while( b >= 0 && decodabet[ b & 0x7f ] <= WHITE_SPACE_ENC );
if( b < 0 ) {
break; // Reads a -1 if end of stream
} // end if: end of stream
b4[i] = (byte)b;
} // end for: each needed input byte
if( i == 4 ) {
numSigBytes = decode4to3( b4, 0, buffer, 0, options );
position = 0;
} // end if: got four characters
else if( i == 0 ){
return -1;
} // end else if: also padded correctly
else {
// Must have broken out from above.
throw new java.io.IOException( "Improperly padded Base64 input." );
} // end
} // end else: decode
} // end else: get data
// Got data?
if( position >= 0 ) {
// End of relevant data?
if( /*!encode &&*/ position >= numSigBytes ){
return -1;
} // end if: got data
if( encode && breakLines && lineLength >= MAX_LINE_LENGTH ) {
lineLength = 0;
return '\n';
} // end if
else {
lineLength++; // This isn't important when decoding
// but throwing an extra "if" seems
// just as wasteful.
int b = buffer[ position++ ];
if( position >= bufferLength ) {
position = -1;
} // end if: end
return b & 0xFF; // This is how you "cast" a byte that's
// intended to be unsigned.
} // end else
} // end if: position >= 0
// Else error
else {
throw new java.io.IOException( "Error in Base64 code reading stream." );
} // end else
} // end read
/**
* Calls {@link #read()} repeatedly until the end of stream
* is reached or <var>len</var> bytes are read.
* Returns number of bytes read into array or -1 if
* end of stream is encountered.
*
* @param dest array to hold values
* @param off offset for array
* @param len max number of bytes to read into array
* @return bytes read into array or -1 if end of stream is encountered.
* @since 1.3
*/
@Override
public int read( byte[] dest, int off, int len )
throws java.io.IOException {
int i;
int b;
for( i = 0; i < len; i++ ) {
b = read();
if( b >= 0 ) {
dest[off + i] = (byte) b;
}
else if( i == 0 ) {
return -1;
}
else {
break; // Out of 'for' loop
} // Out of 'for' loop
} // end for: each byte read
return i;
} // end read
} // end inner class InputStream
/* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
/**
* A {@link Base64.OutputStream} will write data to another
* <tt>java.io.OutputStream</tt>, given in the constructor,
* and encode/decode to/from Base64 notation on the fly.
*
* @see Base64
* @since 1.3
*/
public static class OutputStream extends java.io.FilterOutputStream {
private boolean encode;
private int position;
private byte[] buffer;
private int bufferLength;
private int lineLength;
private boolean breakLines;
private byte[] b4; // Scratch used in a few places
private boolean suspendEncoding;
private int options; // Record for later
private byte[] decodabet; // Local copies to avoid extra method calls
/**
* Constructs a {@link Base64.OutputStream} in ENCODE mode.
*
* @param out the <tt>java.io.OutputStream</tt> to which data will be written.
* @since 1.3
*/
public OutputStream( java.io.OutputStream out ) {
this( out, ENCODE );
} // end constructor
/**
* Constructs a {@link Base64.OutputStream} in
* either ENCODE or DECODE mode.
* <p>
* Valid options:<pre>
* ENCODE or DECODE: Encode or Decode as data is read.
* DO_BREAK_LINES: don't break lines at 76 characters
* (only meaningful when encoding)</i>
* </pre>
* <p>
* Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
*
* @param out the <tt>java.io.OutputStream</tt> to which data will be written.
* @param options Specified options.
* @see Base64#ENCODE
* @see Base64#DECODE
* @see Base64#DO_BREAK_LINES
* @since 1.3
*/
public OutputStream( java.io.OutputStream out, int options ) {
super( out );
this.breakLines = (options & DO_BREAK_LINES) != 0;
this.encode = (options & ENCODE) != 0;
this.bufferLength = encode ? 3 : 4;
this.buffer = new byte[ bufferLength ];
this.position = 0;
this.lineLength = 0;
this.suspendEncoding = false;
this.b4 = new byte[4];
this.options = options;
this.decodabet = getDecodabet(options);
} // end constructor
/**
* Writes the byte to the output stream after
* converting to/from Base64 notation.
* When encoding, bytes are buffered three
* at a time before the output stream actually
* gets a write() call.
* When decoding, bytes are buffered four
* at a time.
*
* @param theByte the byte to write
* @since 1.3
*/
@Override
public void write(int theByte)
throws java.io.IOException {
// Encoding suspended?
if( suspendEncoding ) {
this.out.write( theByte );
return;
} // end if: supsended
// Encode?
if( encode ) {
buffer[ position++ ] = (byte)theByte;
if( position >= bufferLength ) { // Enough to encode.
this.out.write( encode3to4( b4, buffer, bufferLength, options ) );
lineLength += 4;
if( breakLines && lineLength >= MAX_LINE_LENGTH ) {
this.out.write( NEW_LINE );
lineLength = 0;
} // end if: end of line
position = 0;
} // end if: enough to output
} // end if: encoding
// Else, Decoding
else {
// Meaningful Base64 character?
if( decodabet[ theByte & 0x7f ] > WHITE_SPACE_ENC ) {
buffer[ position++ ] = (byte)theByte;
if( position >= bufferLength ) { // Enough to output.
int len = Base64.decode4to3( buffer, 0, b4, 0, options );
out.write( b4, 0, len );
position = 0;
} // end if: enough to output
} // end if: meaningful base64 character
else if( decodabet[ theByte & 0x7f ] != WHITE_SPACE_ENC ) {
throw new java.io.IOException( "Invalid character in Base64 data." );
} // end else: not white space either
} // end else: decoding
} // end write
/**
* Calls {@link #write(int)} repeatedly until <var>len</var>
* bytes are written.
*
* @param theBytes array from which to read bytes
* @param off offset for array
* @param len max number of bytes to read into array
* @since 1.3
*/
@Override
public void write( byte[] theBytes, int off, int len )
throws java.io.IOException {
// Encoding suspended?
if( suspendEncoding ) {
this.out.write( theBytes, off, len );
return;
} // end if: supsended
for( int i = 0; i < len; i++ ) {
write( theBytes[ off + i ] );
} // end for: each byte written
} // end write
/**
* Method added by PHIL. [Thanks, PHIL. -Rob]
* This pads the buffer without closing the stream.
* @throws java.io.IOException if there's an error.
*/
public void flushBase64() throws java.io.IOException {
if( position > 0 ) {
if( encode ) {
out.write( encode3to4( b4, buffer, position, options ) );
position = 0;
} // end if: encoding
else {
throw new java.io.IOException( "Base64 input not properly padded." );
} // end else: decoding
} // end if: buffer partially full
} // end flush
/**
* Flushes and closes (I think, in the superclass) the stream.
*
* @since 1.3
*/
@Override
public void close() throws java.io.IOException {
// 1. Ensure that pending characters are written
flushBase64();
// 2. Actually close the stream
// Base class both flushes and closes.
super.close();
buffer = null;
out = null;
} // end close
/**
* Suspends encoding of the stream.
* May be helpful if you need to embed a piece of
* base64-encoded data in a stream.
*
* @throws java.io.IOException if there's an error flushing
* @since 1.5.1
*/
public void suspendEncoding() throws java.io.IOException {
flushBase64();
this.suspendEncoding = true;
} // end suspendEncoding
/**
* Resumes encoding of the stream.
* May be helpful if you need to embed a piece of
* base64-encoded data in a stream.
*
* @since 1.5.1
*/
public void resumeEncoding() {
this.suspendEncoding = false;
} // end resumeEncoding
} // end inner class OutputStream
} // end class Base64
| [
"[email protected]"
] | |
2dc4aa5e4fa69d5c0e59a3416d7e77aadc664390 | e43495f5e2549f0f8a826e49a8679cefbb9fe7cc | /app/src/main/java/com/huoniao/oc/trainstation/NewWarningDetailsA.java | aef083ad9177e004bbd1f0cd303e5d3505a34a72 | [] | no_license | Potat0chips/Android_OC_1.14 | cd9db6a0440f3f3f7838117a02cb2efd00f554fc | 07009bbab1374656d86308551b63e736ca124eba | refs/heads/master | 2022-03-22T04:53:16.584559 | 2019-11-21T15:58:53 | 2019-11-21T15:58:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,441 | java | package com.huoniao.oc.trainstation;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huoniao.oc.BaseActivity;
import com.huoniao.oc.R;
import com.huoniao.oc.bean.NewPayWarningBean;
import com.huoniao.oc.bean.User;
import com.huoniao.oc.user.LoginA;
import com.huoniao.oc.user.PerfectInformationA;
import com.huoniao.oc.user.RegisterSuccessA;
import com.huoniao.oc.util.ContainsEmojiEditText;
import com.huoniao.oc.util.Define;
import com.huoniao.oc.util.ObjectSaveUtil;
import com.huoniao.oc.util.ToastUtils;
import com.huoniao.oc.wxapi.WXEntryActivity;
import org.json.JSONException;
import org.json.JSONObject;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import static com.huoniao.oc.util.ObjectSaveUtil.readObject;
public class NewWarningDetailsA extends BaseActivity {
@InjectView(R.id.iv_back)
ImageView ivBack;
@InjectView(R.id.tv_date)
TextView tvDate;
@InjectView(R.id.tv_winNumber)
TextView tvWinNumber;
@InjectView(R.id.tv_ownership_institution)
TextView tvOwnershipInstitution;
@InjectView(R.id.tv_warningNumber)
TextView tvWarningNumber;
@InjectView(R.id.tv_warningType)
TextView tvWarningType;
@InjectView(R.id.tv_warningContent)
TextView tvWarningContent;
@InjectView(R.id.tv_state)
TextView tvState;
@InjectView(R.id.tv_handlerState)
TextView tvHandlerState;
@InjectView(R.id.et_handlerResult)
ContainsEmojiEditText etHandlerResult;
@InjectView(R.id.tv_handlerResult)
TextView tvHandlerResult;
@InjectView(R.id.tv_handlerPeple)
TextView tvHandlerPeple;
@InjectView(R.id.tv_handlerDate)
TextView tvHandlerDate;
@InjectView(R.id.ll_finishContent)
LinearLayout llFinishContent;
@InjectView(R.id.tv_confirm)
TextView tvConfirm;
@InjectView(R.id.ll_auditingButton)
LinearLayout llAuditingButton;
@InjectView(R.id.ll_resultContentArea)
LinearLayout llResultContentArea;
@InjectView(R.id.ll_line)
LinearLayout llLine;
private NewPayWarningBean.DataBean dataBean;
private String id = "";
private String handlerResult = "";
private String handlerState;
private String roleName;
private User user;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_warning_details);
ButterKnife.inject(this);
initData();
}
private void initData() {
user = (User) readObject(NewWarningDetailsA.this, "loginResult");
roleName = user.getRoleName(); //获取角色名
dataBean = (NewPayWarningBean.DataBean) ObjectSaveUtil.readObject(this, "alarmList");
if (dataBean != null) {
handlerState = dataBean.getHandleState();
tvDate.setText(dataBean.getCreateDateString());
tvWinNumber.setText(dataBean.getWinNumber());
tvOwnershipInstitution.setText(dataBean.getParentName());
tvWarningNumber.setText(dataBean.getAlarmNumber());
tvWarningType.setText(dataBean.getTypeName());
tvWarningContent.setText(dataBean.getContent());
tvState.setText(dataBean.getStateName());
tvHandlerState.setText(dataBean.getHandleStateName());
id = dataBean.getId();
if ("1".equals(handlerState)){
tvHandlerResult.setText(dataBean.getHandleResult());
tvHandlerPeple.setText(dataBean.getHandleUserName());
tvHandlerDate.setText(dataBean.getHandleDateString());
}
if (Define.TRAINSTATION.equals(LoginA.IDENTITY_TAG) || Define.TRAINSTATION.equals(PerfectInformationA.IDENTITY_TAG)
|| Define.TRAINSTATION.equals(WXEntryActivity.IDENTITY_TAG) || Define.TRAINSTATION.equals(RegisterSuccessA.IDENTITY_TAG)
|| "铁路总局".equals(roleName) || "铁路分局".equals(roleName)) {
if ("0".equals(handlerState)){
// setPremissionShowHideView(Premission.FB_ALARM_VIEW, llResultContentArea); //汇缴预警 处理内容权限
llResultContentArea.setVisibility(View.VISIBLE);
llAuditingButton.setVisibility(View.VISIBLE);
llLine.setVisibility(View.VISIBLE);
llFinishContent.setVisibility(View.GONE);
}else {
llResultContentArea.setVisibility(View.GONE);
llAuditingButton.setVisibility(View.GONE);
llLine.setVisibility(View.GONE);
llFinishContent.setVisibility(View.VISIBLE);
}
}else {
if ("0".equals(handlerState)){
// setPremissionShowHideView(Premission.FB_ALARM_VIEW, llResultContentArea); //汇缴预警 处理内容权限
llResultContentArea.setVisibility(View.GONE);
llAuditingButton.setVisibility(View.GONE);
llLine.setVisibility(View.GONE);
llFinishContent.setVisibility(View.GONE);
}else {
llResultContentArea.setVisibility(View.GONE);
llAuditingButton.setVisibility(View.GONE);
llLine.setVisibility(View.GONE);
llFinishContent.setVisibility(View.VISIBLE);
}
}
}
}
@OnClick({R.id.iv_back, R.id.tv_confirm})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_back:
finish();
break;
case R.id.tv_confirm:
handlerResult = etHandlerResult.getText().toString().trim();
if (handlerResult == null || handlerResult.isEmpty()) {
ToastUtils.showToast(NewWarningDetailsA.this, "请输入处理结果!");
return;
}
requestAlarmHandle();
break;
}
}
private void requestAlarmHandle() {
String url = Define.URL + "fb/alarmHandle";
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("id", id);
jsonObject.put("handleResult", handlerResult);
} catch (JSONException e) {
e.printStackTrace();
}
requestNet(url, jsonObject, "alarmHandle", "0", true, false); //0 不代表什么
}
@Override
protected void dataSuccess(JSONObject json, String tag, String pageNumber) {
super.dataSuccess(json, tag, pageNumber);
switch (tag) {
case "alarmHandle":
try {
JSONObject jsonObject = json.getJSONObject("data");
String result = jsonObject.optString("result");
if ("success".equals(result)) {
setResult(60);
finish();
} else {
String message = jsonObject.optString("msg");
ToastUtils.showToast(NewWarningDetailsA.this, message);
}
} catch (JSONException e) {
e.printStackTrace();
}
break;
}
}
}
| [
"[email protected]"
] | |
187eb4577686fd7ac71304d4586867f6e2cad606 | 14639ff178036abe14e888e395bd97c00e58a0f6 | /running-parent/running-pojo/src/main/java/com/running/pojo/TbUser.java | 802b6a9f7f48bd0647bf5242b79fa19540aa1d08 | [] | no_license | seho-dev/running | 19ba63cfac8f5ff243e96c77c1cf497777aed22d | 217fe936fd539ad6ee06e017dbdd4202db4a8e33 | refs/heads/master | 2023-05-14T21:10:48.404344 | 2019-02-08T16:04:51 | 2019-02-08T16:04:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,683 | java | package com.running.pojo;
import java.io.Serializable;
public class TbUser implements Serializable {
private Integer id;
private String username;
private String password;
private String sex;
private String head;
private String address;
private String wechat;
private String slogan;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex == null ? null : sex.trim();
}
public String getHead() {
return head;
}
public void setHead(String head) {
this.head = head == null ? null : head.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getWechat() {
return wechat;
}
public void setWechat(String wechat) {
this.wechat = wechat == null ? null : wechat.trim();
}
public String getSlogan() {
return slogan;
}
public void setSlogan(String slogan) {
this.slogan = slogan == null ? null : slogan.trim();
}
@Override
public String toString() {
return "TbUser [id=" + id + ", username=" + username + ", password=" + password + ", sex=" + sex + ", head="
+ head + ", address=" + address + ", wechat=" + wechat + ", slogan=" + slogan + "]";
}
} | [
"[email protected]"
] | |
998d0818d811f8a598fa2e755d7c5544a6aa058e | 19f3e4df408f56e7f4fe20c8cdecedbd71d9887e | /37_java/classes-dex2jar/net/youmi/android/e/b/a/c.java | b7c532e1097781463575e93592b4e690296429f3 | [] | no_license | XuGuangHuiGit/softwareSecurity | 5ed6dfe1316672a061dbe03bf235c452342b296f | 9f1eb53d3e06751fe17dbf43a5d7a5fa95051313 | refs/heads/master | 2020-04-08T01:42:39.467579 | 2018-11-24T05:46:28 | 2018-11-24T05:46:28 | 158,906,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,497 | java | package net.youmi.android.e.b.a;
import android.content.Context;
import android.net.Uri;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import net.youmi.android.e.b.b;
import net.youmi.android.e.b.f;
import net.youmi.android.e.b.h;
public abstract class c
extends net.youmi.android.c.l.a
implements net.youmi.android.e.b.e, f, h
{
private HashSet a = new HashSet();
private HashMap b = new HashMap();
protected Context c;
private HashMap d = new HashMap();
private HashSet e;
public c(Context paramContext)
{
this.c = paramContext.getApplicationContext();
this.e = new HashSet();
d.a().a(this);
}
protected File a(b paramb, String paramString)
{
try
{
paramb = a(paramb).b(a().a(paramb, paramString));
return paramb;
}
catch (Throwable paramb) {}
return null;
}
protected abstract net.youmi.android.c.f.a a(b paramb);
protected abstract net.youmi.android.e.b.d a();
protected abstract void a(Object paramObject, b paramb);
protected abstract void a(Object paramObject, b paramb, long paramLong1, long paramLong2, int paramInt, long paramLong3);
protected abstract void a(Object paramObject, b paramb, File paramFile);
public void a(g paramg)
{
try
{
if (this.a == null) {
return;
}
if (paramg != null)
{
this.a.remove(paramg);
return;
}
}
catch (Throwable paramg) {}
}
public void a(g paramg, b paramb)
{
for (;;)
{
try
{
if (this.a == null) {
return;
}
if (paramg == null) {
return;
}
this.a.remove(paramg);
}
catch (Throwable paramg)
{
continue;
}
try
{
i(paramb);
return;
}
catch (Throwable paramg) {}
}
}
public final void a(g paramg, b paramb, String paramString1, String paramString2, String paramString3)
{
if (paramb != null) {}
try
{
if ((paramb.c()) && (d.a().a(this.c, paramb, a(paramb, paramString2), this)))
{
this.e.add(paramb);
this.d.put(paramb.f(), paramb);
this.b.put(paramb.f(), paramb.b());
}
try
{
label71:
this.a.remove(paramg);
return;
}
catch (Throwable paramg) {}
}
catch (Throwable paramb)
{
break label71;
}
}
public final void a(b paramb, long paramLong1, long paramLong2, int paramInt, long paramLong3)
{
if (paramb == null) {
return;
}
for (;;)
{
for (;;)
{
try
{
boolean bool = this.e.contains(paramb);
if (!bool) {
break;
}
}
catch (Throwable localThrowable1)
{
List localList;
int i;
int j;
Object localObject;
continue;
}
try
{
localList = b();
i = 0;
j = localList.size();
if (i >= j) {
break;
}
}
catch (Throwable paramb)
{
return;
}
}
try
{
localObject = localList.get(i);
if (localObject != null) {
a(localObject, paramb, paramLong1, paramLong2, paramInt, paramLong3);
}
}
catch (Throwable localThrowable2)
{
continue;
}
i += 1;
}
}
public boolean a(String paramString)
{
return a(paramString, null);
}
/* Error */
public boolean a(String paramString1, String paramString2)
{
// Byte code:
// 0: aload_1
// 1: ifnonnull +5 -> 6
// 4: iconst_0
// 5: ireturn
// 6: aload_1
// 7: invokevirtual 138 java/lang/String:trim ()Ljava/lang/String;
// 10: astore_1
// 11: aload_1
// 12: invokevirtual 141 java/lang/String:length ()I
// 15: ifle -11 -> 4
// 18: aload_0
// 19: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 22: aload_1
// 23: invokevirtual 144 java/util/HashMap:containsKey (Ljava/lang/Object;)Z
// 26: ifeq +5 -> 31
// 29: iconst_1
// 30: ireturn
// 31: aload_0
// 32: aload_1
// 33: invokevirtual 146 net/youmi/android/e/b/a/c:c (Ljava/lang/String;)Z
// 36: istore_3
// 37: iload_3
// 38: ifeq +44 -> 82
// 41: new 148 net/youmi/android/e/b/a/g
// 44: dup
// 45: aload_0
// 46: getfield 43 net/youmi/android/e/b/a/c:c Landroid/content/Context;
// 49: aload_0
// 50: aload_1
// 51: aload_2
// 52: invokespecial 151 net/youmi/android/e/b/a/g:<init> (Landroid/content/Context;Lnet/youmi/android/e/b/h;Ljava/lang/String;Ljava/lang/String;)V
// 55: astore_1
// 56: aload_0
// 57: getfield 28 net/youmi/android/e/b/a/c:a Ljava/util/HashSet;
// 60: aload_1
// 61: invokevirtual 100 java/util/HashSet:add (Ljava/lang/Object;)Z
// 64: pop
// 65: new 153 java/lang/Thread
// 68: dup
// 69: aload_1
// 70: invokespecial 156 java/lang/Thread:<init> (Ljava/lang/Runnable;)V
// 73: invokevirtual 159 java/lang/Thread:start ()V
// 76: aload_1
// 77: invokevirtual 161 net/youmi/android/e/b/a/g:b ()V
// 80: iconst_1
// 81: ireturn
// 82: new 163 net/youmi/android/e/b/a/e
// 85: dup
// 86: aload_1
// 87: aload_2
// 88: invokespecial 166 net/youmi/android/e/b/a/e:<init> (Ljava/lang/String;Ljava/lang/String;)V
// 91: astore_2
// 92: invokestatic 50 net/youmi/android/e/b/a/d:a ()Lnet/youmi/android/e/b/a/d;
// 95: aload_0
// 96: getfield 43 net/youmi/android/e/b/a/c:c Landroid/content/Context;
// 99: aload_2
// 100: aload_0
// 101: aload_2
// 102: aconst_null
// 103: invokevirtual 94 net/youmi/android/e/b/a/c:a (Lnet/youmi/android/e/b/b;Ljava/lang/String;)Ljava/io/File;
// 106: aload_0
// 107: invokevirtual 97 net/youmi/android/e/b/a/d:a (Landroid/content/Context;Lnet/youmi/android/e/b/b;Ljava/io/File;Lnet/youmi/android/e/b/e;)Z
// 110: ifeq -106 -> 4
// 113: aload_0
// 114: getfield 45 net/youmi/android/e/b/a/c:e Ljava/util/HashSet;
// 117: aload_2
// 118: invokevirtual 100 java/util/HashSet:add (Ljava/lang/Object;)Z
// 121: pop
// 122: aload_0
// 123: getfield 33 net/youmi/android/e/b/a/c:b Ljava/util/HashMap;
// 126: aload_1
// 127: aload_1
// 128: invokevirtual 108 java/util/HashMap:put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
// 131: pop
// 132: aload_0
// 133: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 136: aload_1
// 137: aload_2
// 138: invokevirtual 108 java/util/HashMap:put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
// 141: pop
// 142: iconst_1
// 143: ireturn
// 144: astore_1
// 145: iconst_0
// 146: ireturn
// 147: astore_1
// 148: iconst_0
// 149: ireturn
// 150: astore_2
// 151: goto -75 -> 76
// Local variable table:
// start length slot name signature
// 0 154 0 this c
// 0 154 1 paramString1 String
// 0 154 2 paramString2 String
// 36 2 3 bool boolean
// Exception table:
// from to target type
// 6 29 144 java/lang/Throwable
// 31 37 144 java/lang/Throwable
// 82 142 144 java/lang/Throwable
// 41 65 147 java/lang/Throwable
// 76 80 147 java/lang/Throwable
// 65 76 150 java/lang/Throwable
}
protected abstract void b(Object paramObject, b paramb);
protected abstract void b(Object paramObject, b paramb, File paramFile);
protected abstract boolean b(String paramString);
public Context c()
{
return this.c;
}
protected boolean c(String paramString)
{
try
{
Uri localUri = Uri.parse(paramString);
if (localUri.getQuery() == null)
{
if (localUri.getFragment() != null) {
return true;
}
boolean bool = b(paramString);
if (bool) {
return false;
}
}
}
catch (Throwable paramString) {}
return true;
}
public boolean c(b paramb, File paramFile)
{
if ((paramb == null) || (paramFile == null)) {}
for (;;)
{
return false;
try
{
if (paramFile.exists())
{
if (paramb.e() != null) {
return net.youmi.android.c.c.e.a(paramFile, paramb.e());
}
if (paramb.d() > 0L)
{
long l1 = paramb.d();
long l2 = paramFile.length();
if (l1 == l2) {
return true;
}
}
}
}
catch (Throwable paramb) {}
}
return false;
}
/* Error */
public final void d(b paramb, File paramFile)
{
// Byte code:
// 0: aload_1
// 1: ifnonnull +4 -> 5
// 4: return
// 5: aload_0
// 6: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 9: aload_1
// 10: invokevirtual 104 net/youmi/android/e/b/b:f ()Ljava/lang/String;
// 13: invokevirtual 144 java/util/HashMap:containsKey (Ljava/lang/Object;)Z
// 16: ifeq +15 -> 31
// 19: aload_0
// 20: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 23: aload_1
// 24: invokevirtual 104 net/youmi/android/e/b/b:f ()Ljava/lang/String;
// 27: invokevirtual 202 java/util/HashMap:remove (Ljava/lang/Object;)Ljava/lang/Object;
// 30: pop
// 31: aload_0
// 32: getfield 45 net/youmi/android/e/b/a/c:e Ljava/util/HashSet;
// 35: aload_1
// 36: invokevirtual 114 java/util/HashSet:contains (Ljava/lang/Object;)Z
// 39: istore 5
// 41: iload 5
// 43: ifeq -39 -> 4
// 46: aload_0
// 47: aload_1
// 48: aload_2
// 49: invokevirtual 204 net/youmi/android/e/b/a/c:f (Lnet/youmi/android/e/b/b;Ljava/io/File;)V
// 52: aload_0
// 53: invokevirtual 117 net/youmi/android/e/b/a/c:b ()Ljava/util/List;
// 56: astore 6
// 58: iconst_0
// 59: istore_3
// 60: aload 6
// 62: invokeinterface 123 1 0
// 67: istore 4
// 69: iload_3
// 70: iload 4
// 72: if_icmpge -68 -> 4
// 75: aload 6
// 77: iload_3
// 78: invokeinterface 127 2 0
// 83: astore 7
// 85: aload 7
// 87: ifnull +11 -> 98
// 90: aload_0
// 91: aload 7
// 93: aload_1
// 94: aload_2
// 95: invokevirtual 206 net/youmi/android/e/b/a/c:b (Ljava/lang/Object;Lnet/youmi/android/e/b/b;Ljava/io/File;)V
// 98: iload_3
// 99: iconst_1
// 100: iadd
// 101: istore_3
// 102: goto -42 -> 60
// 105: astore 6
// 107: goto -55 -> 52
// 110: astore_1
// 111: return
// 112: astore 7
// 114: goto -16 -> 98
// 117: astore 6
// 119: goto -73 -> 46
// 122: astore 6
// 124: goto -93 -> 31
// Local variable table:
// start length slot name signature
// 0 127 0 this c
// 0 127 1 paramb b
// 0 127 2 paramFile File
// 59 43 3 i int
// 67 6 4 j int
// 39 3 5 bool boolean
// 56 20 6 localList List
// 105 1 6 localThrowable1 Throwable
// 117 1 6 localThrowable2 Throwable
// 122 1 6 localThrowable3 Throwable
// 83 9 7 localObject Object
// 112 1 7 localThrowable4 Throwable
// Exception table:
// from to target type
// 46 52 105 java/lang/Throwable
// 52 58 110 java/lang/Throwable
// 60 69 110 java/lang/Throwable
// 75 85 112 java/lang/Throwable
// 90 98 112 java/lang/Throwable
// 31 41 117 java/lang/Throwable
// 5 31 122 java/lang/Throwable
}
/* Error */
public final void e(b paramb, File paramFile)
{
// Byte code:
// 0: aload_1
// 1: ifnonnull +4 -> 5
// 4: return
// 5: aload_0
// 6: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 9: aload_1
// 10: invokevirtual 104 net/youmi/android/e/b/b:f ()Ljava/lang/String;
// 13: invokevirtual 144 java/util/HashMap:containsKey (Ljava/lang/Object;)Z
// 16: ifeq +15 -> 31
// 19: aload_0
// 20: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 23: aload_1
// 24: invokevirtual 104 net/youmi/android/e/b/b:f ()Ljava/lang/String;
// 27: invokevirtual 202 java/util/HashMap:remove (Ljava/lang/Object;)Ljava/lang/Object;
// 30: pop
// 31: aload_0
// 32: getfield 45 net/youmi/android/e/b/a/c:e Ljava/util/HashSet;
// 35: aload_1
// 36: invokevirtual 114 java/util/HashSet:contains (Ljava/lang/Object;)Z
// 39: istore 5
// 41: iload 5
// 43: ifeq -39 -> 4
// 46: aload_0
// 47: aload_1
// 48: aload_2
// 49: invokevirtual 209 net/youmi/android/e/b/a/c:g (Lnet/youmi/android/e/b/b;Ljava/io/File;)V
// 52: aload_0
// 53: invokevirtual 117 net/youmi/android/e/b/a/c:b ()Ljava/util/List;
// 56: astore 6
// 58: iconst_0
// 59: istore_3
// 60: aload 6
// 62: invokeinterface 123 1 0
// 67: istore 4
// 69: iload_3
// 70: iload 4
// 72: if_icmpge -68 -> 4
// 75: aload 6
// 77: iload_3
// 78: invokeinterface 127 2 0
// 83: astore 7
// 85: aload 7
// 87: ifnull +11 -> 98
// 90: aload_0
// 91: aload 7
// 93: aload_1
// 94: aload_2
// 95: invokevirtual 211 net/youmi/android/e/b/a/c:a (Ljava/lang/Object;Lnet/youmi/android/e/b/b;Ljava/io/File;)V
// 98: iload_3
// 99: iconst_1
// 100: iadd
// 101: istore_3
// 102: goto -42 -> 60
// 105: astore 6
// 107: goto -55 -> 52
// 110: astore_1
// 111: return
// 112: astore 7
// 114: goto -16 -> 98
// 117: astore 6
// 119: goto -73 -> 46
// 122: astore 6
// 124: goto -93 -> 31
// Local variable table:
// start length slot name signature
// 0 127 0 this c
// 0 127 1 paramb b
// 0 127 2 paramFile File
// 59 43 3 i int
// 67 6 4 j int
// 39 3 5 bool boolean
// 56 20 6 localList List
// 105 1 6 localThrowable1 Throwable
// 117 1 6 localThrowable2 Throwable
// 122 1 6 localThrowable3 Throwable
// 83 9 7 localObject Object
// 112 1 7 localThrowable4 Throwable
// Exception table:
// from to target type
// 46 52 105 java/lang/Throwable
// 52 58 110 java/lang/Throwable
// 60 69 110 java/lang/Throwable
// 75 85 112 java/lang/Throwable
// 90 98 112 java/lang/Throwable
// 31 41 117 java/lang/Throwable
// 5 31 122 java/lang/Throwable
}
protected abstract void f(b paramb, File paramFile);
protected abstract void g(b paramb, File paramFile);
public boolean g(b paramb)
{
if (paramb == null) {}
for (;;)
{
return false;
try
{
if (paramb.e() == null)
{
long l = paramb.d();
if (l <= 0L) {
return true;
}
}
}
catch (Throwable paramb) {}
}
return true;
}
/* Error */
public final void h(b paramb)
{
// Byte code:
// 0: aload_1
// 1: ifnonnull +4 -> 5
// 4: return
// 5: aload_0
// 6: getfield 45 net/youmi/android/e/b/a/c:e Ljava/util/HashSet;
// 9: aload_1
// 10: invokevirtual 114 java/util/HashSet:contains (Ljava/lang/Object;)Z
// 13: istore 4
// 15: iload 4
// 17: ifeq -13 -> 4
// 20: aload_0
// 21: aload_1
// 22: invokevirtual 216 net/youmi/android/e/b/a/c:j (Lnet/youmi/android/e/b/b;)V
// 25: aload_0
// 26: invokevirtual 117 net/youmi/android/e/b/a/c:b ()Ljava/util/List;
// 29: astore 5
// 31: iconst_0
// 32: istore_2
// 33: aload 5
// 35: invokeinterface 123 1 0
// 40: istore_3
// 41: iload_2
// 42: iload_3
// 43: if_icmpge -39 -> 4
// 46: aload 5
// 48: iload_2
// 49: invokeinterface 127 2 0
// 54: astore 6
// 56: aload 6
// 58: ifnull +10 -> 68
// 61: aload_0
// 62: aload 6
// 64: aload_1
// 65: invokevirtual 218 net/youmi/android/e/b/a/c:b (Ljava/lang/Object;Lnet/youmi/android/e/b/b;)V
// 68: iload_2
// 69: iconst_1
// 70: iadd
// 71: istore_2
// 72: goto -39 -> 33
// 75: astore 5
// 77: goto -52 -> 25
// 80: astore_1
// 81: return
// 82: astore 6
// 84: goto -16 -> 68
// 87: astore 5
// 89: goto -69 -> 20
// Local variable table:
// start length slot name signature
// 0 92 0 this c
// 0 92 1 paramb b
// 32 40 2 i int
// 40 4 3 j int
// 13 3 4 bool boolean
// 29 18 5 localList List
// 75 1 5 localThrowable1 Throwable
// 87 1 5 localThrowable2 Throwable
// 54 9 6 localObject Object
// 82 1 6 localThrowable3 Throwable
// Exception table:
// from to target type
// 20 25 75 java/lang/Throwable
// 25 31 80 java/lang/Throwable
// 33 41 80 java/lang/Throwable
// 46 56 82 java/lang/Throwable
// 61 68 82 java/lang/Throwable
// 5 15 87 java/lang/Throwable
}
/* Error */
public final void i(b paramb)
{
// Byte code:
// 0: aload_1
// 1: ifnonnull +4 -> 5
// 4: return
// 5: aload_0
// 6: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 9: aload_1
// 10: invokevirtual 104 net/youmi/android/e/b/b:f ()Ljava/lang/String;
// 13: invokevirtual 144 java/util/HashMap:containsKey (Ljava/lang/Object;)Z
// 16: ifeq +15 -> 31
// 19: aload_0
// 20: getfield 35 net/youmi/android/e/b/a/c:d Ljava/util/HashMap;
// 23: aload_1
// 24: invokevirtual 104 net/youmi/android/e/b/b:f ()Ljava/lang/String;
// 27: invokevirtual 202 java/util/HashMap:remove (Ljava/lang/Object;)Ljava/lang/Object;
// 30: pop
// 31: aload_0
// 32: getfield 45 net/youmi/android/e/b/a/c:e Ljava/util/HashSet;
// 35: aload_1
// 36: invokevirtual 114 java/util/HashSet:contains (Ljava/lang/Object;)Z
// 39: istore 4
// 41: iload 4
// 43: ifeq -39 -> 4
// 46: aload_0
// 47: aload_1
// 48: invokevirtual 221 net/youmi/android/e/b/a/c:k (Lnet/youmi/android/e/b/b;)V
// 51: aload_0
// 52: invokevirtual 117 net/youmi/android/e/b/a/c:b ()Ljava/util/List;
// 55: astore 5
// 57: iconst_0
// 58: istore_2
// 59: aload 5
// 61: invokeinterface 123 1 0
// 66: istore_3
// 67: iload_2
// 68: iload_3
// 69: if_icmpge -65 -> 4
// 72: aload 5
// 74: iload_2
// 75: invokeinterface 127 2 0
// 80: astore 6
// 82: aload 6
// 84: ifnull +10 -> 94
// 87: aload_0
// 88: aload 6
// 90: aload_1
// 91: invokevirtual 223 net/youmi/android/e/b/a/c:a (Ljava/lang/Object;Lnet/youmi/android/e/b/b;)V
// 94: iload_2
// 95: iconst_1
// 96: iadd
// 97: istore_2
// 98: goto -39 -> 59
// 101: astore 5
// 103: goto -52 -> 51
// 106: astore_1
// 107: return
// 108: astore 6
// 110: goto -16 -> 94
// 113: astore 5
// 115: goto -69 -> 46
// 118: astore 5
// 120: goto -89 -> 31
// Local variable table:
// start length slot name signature
// 0 123 0 this c
// 0 123 1 paramb b
// 58 40 2 i int
// 66 4 3 j int
// 39 3 4 bool boolean
// 55 18 5 localList List
// 101 1 5 localThrowable1 Throwable
// 113 1 5 localThrowable2 Throwable
// 118 1 5 localThrowable3 Throwable
// 80 9 6 localObject Object
// 108 1 6 localThrowable4 Throwable
// Exception table:
// from to target type
// 46 51 101 java/lang/Throwable
// 51 57 106 java/lang/Throwable
// 59 67 106 java/lang/Throwable
// 72 82 108 java/lang/Throwable
// 87 94 108 java/lang/Throwable
// 31 41 113 java/lang/Throwable
// 5 31 118 java/lang/Throwable
}
protected abstract void j(b paramb);
protected abstract void k(b paramb);
}
/* Location: C:\Users\guanghui\Desktop\软件安全\37\classes-dex2jar.jar
* Qualified Name: net.youmi.android.e.b.a.c
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
] | |
653491973d9b1d8c55fb4f4e04faa0331a34e041 | e95f0a9c5c208506423f5db1cb4a99ca285468e4 | /app/src/main/java/com/brunoeleodoro/org/qletra/mvp/Model.java | a307e0f8f23d327fe1ff09cbd3014b49fd7641c4 | [] | no_license | BrunoEleodoro/QLetra | 7cd53e268a1d1b02f180ef6aca130d2c0c1a18e2 | be519fd6d0d71441f361ebf2d2fe6e70987b0097 | refs/heads/master | 2021-09-01T07:43:33.855383 | 2017-12-25T19:49:13 | 2017-12-25T19:49:13 | 115,285,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,109 | java | package com.brunoeleodoro.org.qletra.mvp;
import android.database.Cursor;
import android.util.Log;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.brunoeleodoro.org.qletra.Database;
import org.json.JSONObject;
import java.net.URLEncoder;
import java.util.HashMap;
/**
* Created by bruno on 24/12/17.
*/
public class Model implements MVP.Model {
MVP.Presenter presenter;
Database db;
public Model(MVP.Presenter presenter)
{
this.presenter = presenter;
}
@Override
public void conectarBanco() {
db = new Database(presenter.getContext());
}
@Override
public void getLetras(final String banda, final String nome_musica) {
RequestQueue queue = Volley.newRequestQueue(presenter.getContext());
StringRequest request = new StringRequest(Request.Method.GET, "https://api.lyrics.ovh/v1/"+ URLEncoder.encode(banda) +"/"+URLEncoder.encode(nome_musica), new Response.Listener<String>() {
@Override
public void onResponse(String s) {
try
{
JSONObject object = new JSONObject(s);
String letra = object.getString("lyrics");
salvarLetra(banda,nome_musica,letra);
presenter.mostrarAviso("Letra encontrada!\nlista atualizada.");
}
catch (Exception e)
{
presenter.mostrarAviso("Letra não encontrada!");
Log.i("Script","erro getLetras="+e);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Log.i("Script","volley error="+volleyError);
}
});
queue.add(request);
}
@Override
public void salvarLetra(String banda, String nome_musica, String letra) {
db.sql("DELETE FROM musicas WHERE titulo=\""+banda+"\" AND nome_musica=\""+nome_musica+"\"");
db.sql("INSERT INTO musicas VALUES(null,\""+banda+"\",\""+nome_musica+"\",\""+letra+"\");");
}
@Override
public void pesquisar(String termo) {
Cursor cursor = db.select("SELECT * FROM musicas WHERE " +
"titulo LIKE \"%"+termo+"%\" OR " +
"nome_musica LIKE \"%"+termo+"%\" OR " +
"letra LIKE \""+termo+"\"");
presenter.montarLista(cursor);
}
@Override
public void removerLetra(String cod) {
db.sql("DELETE FROM musicas WHERE cod="+cod);
presenter.atualizarLista();
}
@Override
public void atualizarLista() {
Cursor c = db.select("SELECT * FROM musicas");
presenter.montarLista(c);
}
@Override
public void buscarLetra(String cod) {
Cursor c = db.select("SELECT * FROM musicas WHERE cod="+cod);
presenter.verLetra(c);
}
}
| [
"[email protected]"
] | |
9886f92fda43e182f73fe85e87c287fe2ac2cfdc | 1b14dcd6d834e855af0c92d0ef942a5787ab545c | /common/src/main/java/com/xd/springboot/common/util/MD5.java | ed1ba0fb98e977b2c2b8e74d693e60a38e484f20 | [] | no_license | xiedongchn/spring-boot-demo | af55a4a26af0cf10d2ad16cc3cc6ca4cc23d929d | a6eeebe72317db127c23e6df936be1a9be84719e | refs/heads/master | 2022-09-11T20:49:38.097486 | 2022-08-12T10:27:43 | 2022-08-12T10:27:43 | 145,700,314 | 0 | 0 | null | 2021-07-24T14:46:43 | 2018-08-22T11:34:01 | Java | UTF-8 | Java | false | false | 2,074 | java | package com.xd.springboot.common.util;
import java.io.BufferedReader;
import java.io.FileReader;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
/**
* 计算MD5摘要
* @author xd
*/
public class MD5 {
/**
* 直接计算MD5
*
* @param buf buf
* @return String
*/
public static String encoderByMd5(String buf) {
try {
MessageDigest digist = MessageDigest.getInstance("MD5");
byte[] rs = digist.digest(buf.getBytes(StandardCharsets.UTF_8));
StringBuilder digestHexStr = new StringBuilder();
for (int i = 0; i < 16; i++) {
digestHexStr.append(byteHex(rs[i]));
}
return digestHexStr.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 强化的MD5计算
*
* @param inBuf 需做md5的字符串
* @return String
*/
public static String encodeByMd5WithSalt(String inBuf, String salt) {
return encoderByMd5(encoderByMd5(inBuf + salt));
}
public static String encodeByMd5AndSalt(String inbuf, String salt) {
if (salt == null || "".equals(salt.trim())) {
return encoderByMd5(encoderByMd5(inbuf) + "HXWcjvQWVG1wI4FQBLZpQ3pWj48AV63d");
} else {
return encoderByMd5(encoderByMd5(inbuf) + salt);
}
}
private static String byteHex(byte ib) {
char[] digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
char[] ob = new char[2];
ob[0] = digit[(ib >>> 4) & 0X0F];
ob[1] = digit[ib & 0X0F];
return new String(ob);
}
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Administrator\\Desktop\\1.txt"));
String l = br.readLine();
br.close();
System.out.println("md5(\"" + l + "\")\n=\n" + encodeByMd5WithSalt(l, "8aa16b3b-fbbd-424e-badf-788ccce0d1b1"));
}
}
| [
"[email protected]"
] | |
80ea75d1aa2c2d1833ab34c8694d2d0ca5d97046 | f8138841c3d8f08aed962efbea584158764d9c38 | /service/src/main/java/com/github/hotire/springcore/bean/register/factory/ToolUser.java | 67c6dfe03b199df2f7c77c9d4fcf568dce144767 | [] | no_license | hotire/spring-core | 37da8b554111166caee58be0383a69680c7746f0 | f41f105576a2957657cb35d363abab901f0ccf79 | refs/heads/master | 2023-09-04T08:04:29.912221 | 2023-08-29T17:57:23 | 2023-08-29T17:57:23 | 172,330,931 | 156 | 16 | null | 2023-06-14T22:44:09 | 2019-02-24T11:47:19 | Java | UTF-8 | Java | false | false | 649 | java | package com.github.hotire.springcore.bean.register.factory;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import lombok.RequiredArgsConstructor;
@Component
@RequiredArgsConstructor
public class ToolUser {
private final Tool toolFactory;
private final Tool toolFactory2;
private final AbstractFactoryBean<Tool> factoryBean;
@PostConstruct
public void init() throws Exception {
Assert.isTrue(factoryBean.getObject() == toolFactory2, "factory bean is diff");
}
}
| [
"[email protected]"
] | |
656a18ee18bd8a9d098ba84f574ad8c98d6c755c | a9e9226c212f8e1abb2b7881300df3b2cb97fb3b | /app/src/main/java/mody/vkmusic/Fragments/StartUpProgress.java | 8469614a7aaaf0836097b6f928510f48b5e8cda9 | [] | no_license | Modestovich/VkMusic | a264e25acdb67acf89c47d3bb209876aad306b8f | e185f4eea85090a629de51343aac1a797933a56c | refs/heads/master | 2021-01-19T13:50:41.829866 | 2015-08-16T15:16:45 | 2015-08-16T15:16:45 | 40,824,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | java | package mody.vkmusic.Fragments;
import android.app.ActivityOptions;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import mody.vkmusic.ListActivity;
import mody.vkmusic.R;
public class StartUpProgress extends Fragment {
private ProgressBar startUpProgress;
private TextView progressText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_start_up_progress,container,false);
startUpProgress =(ProgressBar) view.findViewById(R.id.startUpBar);
progressText =(TextView) view.findViewById(R.id.percentProgress);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
new ProgressingBar().execute();
}
public class ProgressingBar extends AsyncTask<String, Integer, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
//Toast.makeText(getApplicationContext() ,"Start loading...",Toast.LENGTH_LONG).show();
}
@Override
protected String doInBackground(String... params) {
for(int i=startUpProgress.getProgress();i<=startUpProgress.getMax();i++){
try{
Thread.sleep(10);
}catch(Exception ex){
ex.printStackTrace();
}
publishProgress(i);
}
return "Finish loading";
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
startUpProgress.setProgress(values[0]);
progressText.setText(values[0]+"%");
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Intent slideactivity = new Intent( getActivity(), ListActivity.class);
Bundle bndlanimation =
ActivityOptions.makeCustomAnimation(getActivity(),
R.anim.current,R.anim.next)
.toBundle();
startActivity(slideactivity, bndlanimation);
}
}
} | [
"[email protected]"
] | |
401a869213b6dbd6fa68d4c770988c08317f3ced | 334fbc70b074adee6c80f8c964063977ba0b02a3 | /src/gestion_semestre/Horario.java | 4915c1e03eb5556aacfa2e50d3691ee20ac44df3 | [] | no_license | MrPichichi/GestionarSemestre | 737cacd926f27e053ebabd17a561b2bd3454fe41 | bff8146ec94b91f5981fcd80b7d67b77ed248916 | refs/heads/master | 2020-04-10T08:25:22.224709 | 2018-12-08T05:25:29 | 2018-12-08T05:25:29 | 160,905,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java |
package gestion_semestre;
import java.time.LocalTime;
public class Horario {
LocalTime horaInicio;
LocalTime horaTermino;
public LocalTime getHoraInicio() {
return horaInicio;
}
public void setHoraInicio(int hora, int minuto) {
this.horaInicio = LocalTime.of(hora, minuto);
}
public LocalTime getHoraTermino() {
return horaTermino;
}
public void setHoraTermino(int hora, int minuto) {
this.horaTermino = LocalTime.of(hora, minuto);
}
}
| [
"[email protected]"
] | |
6f485d6ce0bd6284c84bafbaac7d77be55ba115f | 15a9a0f603a58b5c2765ebc759474bffde4f9987 | /HostalWebFinal/src/java/controlador/SvOrden_Habitacion.java | b3df17aea9536a74dd5d695deba0e1e5f0f0ea10 | [] | no_license | hugoaraya/Portafolio_2.0 | 037681472e2132b761151904e91d8b7fb122e300 | ebff44444f4d0b09710cc47d9caee22173149ef0 | refs/heads/Rama_Principal | 2020-03-15T18:37:38.987825 | 2018-07-02T19:13:31 | 2018-07-02T19:13:31 | 132,288,156 | 3 | 1 | null | 2018-06-22T23:02:20 | 2018-05-05T22:09:46 | Java | UTF-8 | Java | false | false | 11,203 | 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 controlador;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import static consultas.Query.*;
import dao.Conexion;
import dao.HabitacionesDAO;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Date;
import modelo.Habitacion;
/**
*
* @author 420NiggaBytes
*/
@WebServlet(name = "SvOrden_Habitacion", urlPatterns = {"/detalle_orden_compra.pdf"})
public class SvOrden_Habitacion extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
response.setContentType("aplication/pdf");
OutputStream out = response.getOutputStream();
int nro_orden = Integer.parseInt(request.getParameter("nro_orden"));
try {
String sql1 = SQL_LISTAR_DETALLE_ORDEN_COMPRA_METODO(nro_orden);
String sql2 = SQL_PRECIO_TOTAL_ORDEN_COMPRA_METODO(nro_orden);
String sql3 = SQL_LISTAR_DETALLE_ORDEN_HABITACION_METODO(nro_orden);
Connection conexion = new Conexion().fabricarConexion();
PreparedStatement ps = conexion.prepareStatement(sql1);
PreparedStatement ps2 = conexion.prepareStatement(sql2);
PreparedStatement ps3 = conexion.prepareStatement(sql3);
ResultSet rs;
ResultSet rs2;
ResultSet rs3;
rs = ps.executeQuery();
rs2 = ps2.executeQuery();
rs3 = ps3.executeQuery();
//fecha
Date fechahoy = new Date();
SimpleDateFormat formato
= new SimpleDateFormat("dd/MM/yyyy");
String fecha = formato.format(fechahoy);
//generar el documento
Document documento = new Document();
PdfWriter.getInstance(documento, out);
documento.open();
//Imagen
String relativeWebPath = "/img/logo_hostal.png";
String absoluteDiskPath = getServletContext().getRealPath(relativeWebPath);
Image imagenes = Image.getInstance(absoluteDiskPath);
imagenes.setAlignment(Element.ALIGN_CENTER);
imagenes.scalePercent(50);
documento.add(imagenes);
//parrafo titulo
Paragraph par1 = new Paragraph();
par1.add(new Phrase(Chunk.NEWLINE));
par1.add(new Phrase(Chunk.NEWLINE));
Font fontitulo = new Font(Font.FontFamily.HELVETICA, 18, Font.BOLD, BaseColor.BLACK);
par1.add(new Phrase("DETALLE DE FACTURA", fontitulo));
par1.setAlignment(Element.ALIGN_CENTER);
par1.add(new Phrase(Chunk.NEWLINE));
par1.add(new Phrase(Chunk.NEWLINE));
documento.add(par1);
Paragraph par2 = new Paragraph();
Font fontdescripcion = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK);
par2.add(new Phrase("Fecha: " + fecha + " Nro Orden: " + nro_orden, fontdescripcion));
par2.setAlignment(Element.ALIGN_LEFT);
par2.add(new Phrase(Chunk.NEWLINE));
par2.add(new Phrase(Chunk.NEWLINE));
documento.add(par2);
Paragraph par3 = new Paragraph();
Font fontHuesped = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL, BaseColor.BLACK);
par3.add(new Phrase(Chunk.NEWLINE));
par3.add(new Phrase("Detalle de Huespedes", fontHuesped));
par3.setAlignment(Element.ALIGN_CENTER);
par3.add(new Phrase(Chunk.NEWLINE));
par3.add(new Phrase(Chunk.NEWLINE));
documento.add(par3);
PdfPTable tabla = new PdfPTable(6);
tabla.setWidthPercentage(100);
PdfPCell celda1 = new PdfPCell(new Paragraph("Nombre Huesped", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell celda2 = new PdfPCell(new Paragraph("Rut Huesped", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell celda3 = new PdfPCell(new Paragraph("Cargo", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell celda4 = new PdfPCell(new Paragraph("Correo", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell celda5 = new PdfPCell(new Paragraph("Telefono", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell celda6 = new PdfPCell(new Paragraph("Tipo Servicio", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
tabla.addCell(celda1);
tabla.addCell(celda2);
tabla.addCell(celda3);
tabla.addCell(celda4);
tabla.addCell(celda5);
tabla.addCell(celda6);
while (rs.next()) {
tabla.addCell(rs.getString(1) + " " + rs.getString(2));
tabla.addCell(rs.getString(3) +"-"+rs.getString(4));
tabla.addCell(rs.getString(5));
tabla.addCell(rs.getString(6));
tabla.addCell(String.valueOf(rs.getInt(7)));
tabla.addCell(rs.getString(8));
}
//
documento.add(tabla);
//
Paragraph par4 = new Paragraph();
Font fontHabi = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL, BaseColor.BLACK);
par4.add(new Phrase(Chunk.NEWLINE));
par4.add(new Phrase(Chunk.NEWLINE));
par4.add(new Phrase("Detalle de Habitaciones", fontHabi));
par4.setAlignment(Element.ALIGN_CENTER);
par4.add(new Phrase(Chunk.NEWLINE));
par4.add(new Phrase(Chunk.NEWLINE));
documento.add(par4);
PdfPTable tablah = new PdfPTable(6);
tablah.setWidthPercentage(100);
PdfPCell hcelda1 = new PdfPCell(new Paragraph("Nombre Habitacion", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell hcelda2 = new PdfPCell(new Paragraph("Tipo Cama", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell hcelda3 = new PdfPCell(new Paragraph("Accesorios", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell hcelda4 = new PdfPCell(new Paragraph("Descripcion", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell hcelda5 = new PdfPCell(new Paragraph("Capacidad", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
PdfPCell hcelda6 = new PdfPCell(new Paragraph("Precio", FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)));
tablah.addCell(hcelda1);
tablah.addCell(hcelda2);
tablah.addCell(hcelda3);
tablah.addCell(hcelda4);
tablah.addCell(hcelda5);
tablah.addCell(hcelda6);
while (rs3.next()) {
tablah.addCell(rs3.getString(1));
tablah.addCell(rs3.getString(2));
tablah.addCell(rs3.getString(3));
tablah.addCell(rs3.getString(4));
tablah.addCell(rs3.getString(5));
tablah.addCell(rs3.getString(6));
}
//
documento.add(tablah);
//
Paragraph par5 = new Paragraph();
par5.add(new Phrase(Chunk.NEWLINE));
par5.add(new Phrase(Chunk.NEWLINE));
Font fontprecio = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL, BaseColor.BLACK);
while (rs2.next()) {
HabitacionesDAO daoco = new HabitacionesDAO();
Habitacion con = new Habitacion();
Habitacion con2 = new Habitacion();
Habitacion con3 = new Habitacion();
con3 = daoco.getHabitacionIdOrden(nro_orden);
con2 = daoco.getHabitacionPorId(con3.getId_habitacion());
con = daoco.getFehasPorId(con2.getId_fechas());
//
int dias = con.getTotal_dias();
int precio = rs2.getInt(1);
int total = precio * dias;
//
par5.add(new Phrase("Cantidad de dias: " +dias+" Precio Total: $" + String.valueOf(total),fontprecio));
par5.setAlignment(Element.ALIGN_RIGHT);
}
documento.add(par5);
documento.close();
rs.close();
rs2.close();
rs3.close();
conexion.close();
} catch (Exception ex) {
System.out.println("error"+ex);
}
}catch(Exception ex) {
System.out.println("error"+ex);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
66d1bb97d299f209efb76debf407efe3774815b3 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/24/24_523bfcdb0224db6c39916dcae71a188bca773c29/SearchController/24_523bfcdb0224db6c39916dcae71a188bca773c29_SearchController_t.java | e84e12c41629d8a0ff4aa07158e0c1225046d4c4 | [] | 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,972 | java | package uk.ac.ebi.ep.web;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import uk.ac.ebi.ep.adapter.ebeye.EbeyeConfig;
import uk.ac.ebi.ep.adapter.intenz.IntenzConfig;
import uk.ac.ebi.ep.adapter.reactome.ReactomeConfig;
import uk.ac.ebi.ep.adapter.uniprot.UniprotConfig;
import uk.ac.ebi.ep.core.filter.CompoundsPredicate;
import uk.ac.ebi.ep.core.filter.DiseasesPredicate;
import uk.ac.ebi.ep.core.filter.SpeciesPredicate;
import uk.ac.ebi.ep.core.search.Config;
import uk.ac.ebi.ep.core.search.EnzymeFinder;
import uk.ac.ebi.ep.core.search.EnzymeRetriever;
import uk.ac.ebi.ep.entry.Field;
import uk.ac.ebi.ep.enzyme.model.EnzymeModel;
import uk.ac.ebi.ep.search.exception.EnzymeFinderException;
import uk.ac.ebi.ep.search.model.EnzymeSummary;
import uk.ac.ebi.ep.search.model.SearchModel;
import uk.ac.ebi.ep.search.model.SearchParams;
import uk.ac.ebi.ep.search.model.SearchResults;
import uk.ac.ebi.ep.search.result.Pagination;
/**
*
* @since 1.0
* @version $LastChangedRevision$ <br/>
* $LastChangedDate$ <br/>
* $Author$
* @author $Author$
*/
@Controller
public class SearchController {
private static final Logger LOGGER = Logger.getLogger(SearchController.class);
private enum ResponsePage {
ENTRY, ERROR;
public String toString(){ return name().toLowerCase(); }
}
@Autowired
private EbeyeConfig ebeyeConfig;
@Autowired
private UniprotConfig uniprotConfig;
@Autowired
private Config searchConfig;
@Autowired
private IntenzConfig intenzConfig;
@Autowired
private ReactomeConfig reactomeConfig;
/**
* Process the entry page,
* @param accession The UniProt accession of the enzyme.
* @param field the requested tab.
* @param model
* @return
*/
@RequestMapping(value="/search/{accession}/{field}")
protected String getEnzymeModel(Model model,
@PathVariable String accession, @PathVariable String field,
HttpSession session) {
Field requestedField = Field.valueOf(field);
EnzymeRetriever retriever = new EnzymeRetriever(searchConfig);
retriever.getEbeyeAdapter().setConfig(ebeyeConfig);
retriever.getUniprotAdapter().setConfig(uniprotConfig);
retriever.getIntenzAdapter().setConfig(intenzConfig);
EnzymeModel enzymeModel = null;
String responsePage = ResponsePage.ENTRY.toString();
try {
switch (requestedField) {
case proteinStructure:
enzymeModel = retriever.getProteinStructure(accession);
break;
case reactionsPathways:
enzymeModel = retriever.getReactionsPathways(accession);
retriever.getReactomeAdapter().setConfig(reactomeConfig);
break;
case molecules:
enzymeModel = retriever.getMolecules(accession);
break;
case diseaseDrugs:
enzymeModel = retriever.getEnzyme(accession);
break;
case literature:
enzymeModel = retriever.getLiterature(accession);
break;
default:
enzymeModel = retriever.getEnzyme(accession);
requestedField = Field.enzyme;
break;
}
enzymeModel.setRequestedfield(requestedField.name());
model.addAttribute("enzymeModel", enzymeModel);
addToHistory(session, accession);
} catch (Exception ex) {
LOGGER.error("Unable to retrieve the entry!", ex);
responsePage = ResponsePage.ERROR.toString();
}
return responsePage;
}
/**
* This method is an entry point that accepts the request when the search home
* page is loaded. It then forwards the request to the search page.
*
* @param model
* @return
*/
@RequestMapping(value="/")
public String viewSearchHome(Model model, HttpSession session) {
SearchModel searchModelForm = new SearchModel();
SearchParams searchParams = new SearchParams();
searchParams.setText("Enter a name to search");
searchParams.setStart(0);
searchModelForm.setSearchparams(searchParams);
model.addAttribute("searchModel", searchModelForm);
clearHistory(session);
return "index";
}
/**
* A wrapper of {@code postSearchResult} method, created to accept the search
* request using GET.
* @param searchModel
* @param result
* @param model
* @return
*/
@RequestMapping(value = "/search", method = RequestMethod.GET)
public String getSearchResult(SearchModel searchModel, BindingResult result,
Model model, HttpSession session) {
return postSearchResult(searchModel, result, model, session);
}
/**
* Processes the search request. When user enters a search text and presses
* the submit button the request is processed here.
* @param searchModelForm
* @param result
* @param model
* @return
*/
@RequestMapping(value = "/search", method = RequestMethod.POST)
public String postSearchResult(SearchModel searchModelForm, BindingResult result,
Model model, HttpSession session) {
String view = "search";
if (searchModelForm != null) try {
SearchParams searchParameters = searchModelForm.getSearchparams();
searchParameters.setSize(searchConfig.getResultsPerPage());
SearchResults resultSet = null;
// See if it is already there, perhaps we are paginating:
@SuppressWarnings("unchecked")
Map<String, SearchResults> prevSearches = (Map<String, SearchResults>)
session.getServletContext().getAttribute("searches");
if (prevSearches != null){
resultSet = prevSearches.get(searchParameters.getText().toLowerCase());
} else {
// Map implementation which maintains the order of access:
prevSearches = new LinkedHashMap<String, SearchResults>(
searchConfig.getSearchCacheSize(), 1, true);
session.getServletContext().setAttribute("searches", prevSearches);
}
if (resultSet == null){
// Make a new search:
EnzymeFinder finder = new EnzymeFinder(searchConfig);
finder.getEbeyeAdapter().setConfig(ebeyeConfig);
finder.getUniprotAdapter().setConfig(uniprotConfig);
finder.getIntenzAdapter().setConfig(intenzConfig);
try {
resultSet = finder.getEnzymes(searchParameters);
// cache it in the session, making room if necessary:
while (prevSearches.size() >= searchConfig.getSearchCacheSize()){
// remove the eldest:
prevSearches.remove(prevSearches.keySet().iterator().next());
}
prevSearches.put(searchParameters.getText().toLowerCase(), resultSet);
} catch (EnzymeFinderException ex) {
LOGGER.error("Unable to create the result list because an error " +
"has occurred in the find method! \n", ex);
}
}
// Filter:
List<String> speciesFilter = searchParameters.getSpecies();
List<String> compoundsFilter = searchParameters.getCompounds();
List<String> diseasesFilter = searchParameters.getDiseases();
if (!speciesFilter.isEmpty() || !compoundsFilter.isEmpty() || !diseasesFilter.isEmpty()){
List<EnzymeSummary> filteredResults =
new ArrayList<EnzymeSummary>(resultSet.getSummaryentries());
CollectionUtils.filter(filteredResults,
new SpeciesPredicate(speciesFilter));
CollectionUtils.filter(filteredResults,
new CompoundsPredicate(compoundsFilter));
CollectionUtils.filter(filteredResults,
new DiseasesPredicate(diseasesFilter));
// Create a new SearchResults, don't modify the one in session
SearchResults sr = new SearchResults();
sr.setSearchfilters(resultSet.getSearchfilters());
sr.setSummaryentries(filteredResults);
// show the total number of hits (w/o filtering):
sr.setTotalfound(resultSet.getTotalfound());
searchModelForm.setSearchresults(sr);
} else {
// Show all of them:
searchModelForm.setSearchresults(resultSet);
}
model.addAttribute("searchModel", searchModelForm);
// Paginate:
final int numOfResults =
searchModelForm.getSearchresults().getSummaryentries().size();
Pagination pagination = new Pagination(
numOfResults, searchParameters.getSize());
pagination.setMaxDisplayedPages(searchConfig.getMaxPages());
pagination.setFirstResult(searchParameters.getStart());
model.addAttribute("pagination", pagination);
addToHistory(session,
"searchparams.text=" + searchParameters.getText());
} catch (Exception e) {
LOGGER.error("Failed search", e);
view = "error";
}
return view;
}
@RequestMapping(value = "/underconstruction", method = RequestMethod.GET)
public String getSearchResult(Model model) {
return "underconstruction";
}
private void addToHistory(HttpSession session, String s){
@SuppressWarnings("unchecked")
List<String> history = (List<String>) session.getAttribute("history");
if (history == null){
history = new ArrayList<String>();
session.setAttribute("history", history);
}
if (history.isEmpty() || !history.get(history.size()-1).equals(s)){
history.add(s);
}
}
private void clearHistory(HttpSession session){
@SuppressWarnings("unchecked")
List<String> history = (List<String>) session.getAttribute("history");
if (history == null){
history = new ArrayList<String>();
session.setAttribute("history", history);
} else history.clear();
}
}
| [
"[email protected]"
] | |
5b59e5abb7044b53b73aa2f4254bc321a26f6e48 | 8b4d1bbc42828814a7d144174b9abe3bfed80151 | /igbeok-websocket/src/main/java/com/igbeok/showcase/xml/entity/jaxb/Address.java | 3dd87a35d5e7c500476b481198ffabd83d751a3c | [
"Apache-2.0"
] | permissive | ricoyu520/igbeok | cfae530e5352fd37865dd0b1dbd2cc6117a5c104 | dcd636f5e402e3b87ababdf137bf4eea1ac81c48 | refs/heads/master | 2020-12-24T19:18:34.957646 | 2013-10-04T09:48:35 | 2013-10-04T09:48:35 | 13,319,470 | 0 | 1 | null | 2016-03-09T17:03:42 | 2013-10-04T08:12:07 | Shell | UTF-8 | Java | false | false | 621 | java | package com.igbeok.showcase.xml.entity.jaxb;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Address {
private Long id;
private String streatName;
private String postalCode;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getStreatName() {
return streatName;
}
public void setStreatName(String streatName) {
this.streatName = streatName;
}
public String getPostalCode() {
return postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
}
| [
"[email protected]"
] | |
2834225c3877162f8d60dd1a7ee44aa91146ede3 | df4eb7b3e3d53c85108d2d0d412aa85d6ffb2c76 | /main/java/vvr/core/src/test/java/com/oodrive/nuage/vvr/persistence/repository/TestRepositoryHistory.java | 7fad758c5315a0a21660971c1e1a4854d39125f9 | [] | no_license | cyrinux/eguan | 8526c418480f30a3a3ccd5eca2237a68fd2bbc8f | 9e20281655838c8c300f1aa97ad03448e16328c8 | refs/heads/master | 2021-01-17T20:21:35.000299 | 2015-02-19T15:22:46 | 2015-02-19T15:22:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 60,670 | java | package com.oodrive.nuage.vvr.persistence.repository;
/*
* #%L
* Project eguan
* %%
* Copyright (C) 2012 - 2015 Oodrive
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.oodrive.nuage.nrs.NrsFile;
import com.oodrive.nuage.proto.Common.OpCode;
import com.oodrive.nuage.proto.Common.ProtocolVersion;
import com.oodrive.nuage.proto.Common.Type;
import com.oodrive.nuage.proto.Common.Uuid;
import com.oodrive.nuage.proto.nrs.NrsRemote.NrsVersion;
import com.oodrive.nuage.proto.vvr.VvrRemote.RemoteOperation;
import com.oodrive.nuage.vvr.configuration.AbstractVvrCommonFixture;
import com.oodrive.nuage.vvr.remote.VvrRemoteUtils;
import com.oodrive.nuage.vvr.repository.core.api.Device;
import com.oodrive.nuage.vvr.repository.core.api.FutureSnapshot;
import com.oodrive.nuage.vvr.repository.core.api.FutureVoid;
import com.oodrive.nuage.vvr.repository.core.api.Snapshot;
import com.oodrive.nuage.vvr.repository.core.api.VersionedVolumeRepository;
/**
* Tests the history of a repository.
*
* @author oodrive
* @author llambert
* @author ebredzinski
* @author pwehrle
* @author jmcaba
*/
public class TestRepositoryHistory extends AbstractVvrCommonFixture {
protected static final Logger LOGGER = LoggerFactory.getLogger(TestRepositoryHistory.class);
private VersionedVolumeRepository repository = null;
private Snapshot rootSnapshot = null;
private UUID nodeId = null;
public TestRepositoryHistory() {
super(true);
}
/**
* Create the repository to test.
*/
@Before
public void createRepository() {
boolean done = false;
// Nrs
final NrsRepository.Builder vvrBuilder = new NrsRepository.Builder();
vvrBuilder.configuration(getConfiguration());
vvrBuilder.uuid(UUID.randomUUID());
vvrBuilder.ownerId(UUID.randomUUID());
vvrBuilder.nodeId(nodeId = UUID.randomUUID());
vvrBuilder.rootUuid(UUID.randomUUID());
repository = vvrBuilder.create();
Assert.assertNotNull(repository);
try {
repository.init();
try {
repository.start(true);
try {
rootSnapshot = repository.getRootSnapshot();
done = true;
}
finally {
if (!done) {
repository.stop(false);
}
}
}
finally {
if (!done) {
repository.fini();
}
}
}
finally {
if (!done) {
repository = null;
rootSnapshot = null;
}
}
}
/**
* Release resources.
*/
@After
public void finiRepository() {
if (repository != null) {
try {
repository.stop(false);
}
catch (final Throwable t) {
LOGGER.warn("Failed to stop repository " + repository, t);
}
try {
repository.fini();
}
catch (final Throwable t) {
LOGGER.warn("Failed to fini repository " + repository, t);
}
repository = null;
}
}
@Test
public void testHistory() throws Exception {
final long size1 = getDefaultBlockSize() * 512;
final long size2 = getDefaultBlockSize() * 1071;
final long size3 = getDefaultBlockSize() * 12;
final long size4 = getDefaultBlockSize() * 333;
final UUID device1Uuid;
final UUID device2Uuid;
final UUID device3Uuid;
final UUID cloneDevice1Uuid;
final UUID snapshot1Uuid;
final UUID snapshot2Uuid;
final UUID snapshot3Uuid;
{
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
{ // rootSnapshot has 0 snapshot and 1 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot().get();
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(device1.getParent(), snapshot1.getUuid());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// New device
final Device device2 = snapshot1.createDevice("D2", size2).get();
Assert.assertEquals(size2, device2.getSize());
Assert.assertEquals(snapshot1.getUuid(), device2.getParent());
{ // snapshot1 has 0 snapshot and 2 devices
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(2, devices.size());
Assert.assertTrue(devices.contains(device1.getUuid()));
Assert.assertTrue(devices.contains(device2.getUuid()));
}
// New snapshot
final Snapshot snapshot2 = device2.createSnapshot("snap2").get();
Assert.assertEquals(size2, snapshot2.getSize());
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), device2.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 1 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
{ // snapshot2 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device2.getUuid());
}
// clone device1
final Device cloneDevice1 = device1.clone("clonedev1", "description").get();
Assert.assertEquals(device1.getParent(), cloneDevice1.getParent());
Assert.assertEquals(device1.getSize(), cloneDevice1.getSize());
Assert.assertEquals(device1.getBlockSize(), cloneDevice1.getBlockSize());
Assert.assertEquals(device1.getDataSize(), cloneDevice1.getDataSize());
// Resize device2
device2.setSize(size3).get();
Assert.assertEquals(size3, device2.getSize());
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size2, snapshot2.getSize());
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), device2.getParent());
Assert.assertEquals(snapshot1.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 1 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(2, devices.size());
int count = 0;
for (final UUID deviceUuid : devices) {
if (deviceUuid.equals(device1.getUuid()) || deviceUuid.equals(cloneDevice1.getUuid())) {
count++;
}
}
Assert.assertEquals(2, count);
}
{ // snapshot2 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device2.getUuid());
}
// New snapshot of device2
final Snapshot snapshot3 = device2.createSnapshot("snap3").get();
Assert.assertEquals(size3, snapshot3.getSize());
Assert.assertEquals(size3, device2.getSize());
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size2, snapshot2.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), snapshot3.getParent());
Assert.assertEquals(snapshot3.getUuid(), device2.getParent());
Assert.assertEquals(snapshot1.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 1 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(2, devices.size());
int count = 0;
for (final UUID deviceUuid : devices) {
if (deviceUuid.equals(device1.getUuid()) || deviceUuid.equals(cloneDevice1.getUuid())) {
count++;
}
}
Assert.assertEquals(2, count);
}
{ // snapshot2 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot3.getUuid());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot3 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot3.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot3.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device2.getUuid());
}
// Test resize under root
// New device under root
final Device device3 = rootSnapshot.createDevice("D3", size3).get();
Assert.assertEquals(size3, device3.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device3.getParent());
{ // rootSnapshot has 1 snapshot and 1 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device3.getUuid());
}
// Resize device4
device3.setSize(size4).get();
Assert.assertEquals(size4, device3.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device3.getParent());
{ // rootSnapshot has 1 snapshot and 1 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device3.getUuid());
}
device1Uuid = device1.getUuid();
device2Uuid = device2.getUuid();
device3Uuid = device3.getUuid();
cloneDevice1Uuid = cloneDevice1.getUuid();
snapshot1Uuid = snapshot1.getUuid();
snapshot2Uuid = snapshot2.getUuid();
snapshot3Uuid = snapshot3.getUuid();
}
//
// Restart repository and check state
//
repository.stop(true);
repository.fini();
Thread.sleep(100);
repository.init();
repository.start(true);
// Load new objects
rootSnapshot = repository.getRootSnapshot();
final Device device1 = repository.getDevice(device1Uuid);
final Device device2 = repository.getDevice(device2Uuid);
final Device device3 = repository.getDevice(device3Uuid);
final Device cloneDevice1 = repository.getDevice(cloneDevice1Uuid);
final Snapshot snapshot1 = repository.getSnapshot(snapshot1Uuid);
final Snapshot snapshot2 = repository.getSnapshot(snapshot2Uuid);
final Snapshot snapshot3 = repository.getSnapshot(snapshot3Uuid);
Assert.assertEquals(size3, snapshot3.getSize());
Assert.assertEquals(size3, device2.getSize());
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size2, snapshot2.getSize());
Assert.assertEquals(size4, device3.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device3.getParent());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), snapshot3.getParent());
Assert.assertEquals(snapshot3.getUuid(), device2.getParent());
Assert.assertEquals(snapshot1.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 1 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device3.getUuid());
}
{ // snapshot1 has 1 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(2, devices.size());
int count = 0;
for (final UUID deviceUuid : devices) {
if (deviceUuid.equals(device1.getUuid()) || deviceUuid.equals(cloneDevice1.getUuid())) {
count++;
}
}
Assert.assertEquals(2, count);
}
{ // snapshot2 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot3.getUuid());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot3 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot3.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot3.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device2.getUuid());
}
// Take a snapshot of cloneDevice1
final Snapshot snapshot4 = cloneDevice1.createSnapshot("snap4").get();
Assert.assertEquals(size3, snapshot3.getSize());
Assert.assertEquals(size3, device2.getSize());
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(size1, cloneDevice1.getSize());
Assert.assertEquals(size1, snapshot4.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size2, snapshot2.getSize());
Assert.assertEquals(size4, device3.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device3.getParent());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), snapshot3.getParent());
Assert.assertEquals(snapshot3.getUuid(), device2.getParent());
Assert.assertEquals(snapshot1.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 1 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device3.getUuid());
}
{ // snapshot1 has 2 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(2, snapshots.size());
int count = 0;
for (final UUID snapshotUuid : snapshots) {
if (snapshotUuid.equals(snapshot2.getUuid()) || snapshotUuid.equals(snapshot4.getUuid())) {
count++;
}
}
Assert.assertEquals(2, count);
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
{ // snapshot2 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot3.getUuid());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot3 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot3.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot3.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device2.getUuid());
}
{ // snapshot4 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot4.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot4.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), cloneDevice1.getUuid());
}
}
@Test
public void testHistoryDeleteSnapshot() throws Exception {
final long size1 = getDefaultBlockSize() * 512;
final long size2 = getDefaultBlockSize() * 12;
final UUID device1Uuid;
final UUID snapshot2Uuid;
{
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
{ // rootSnapshot has 0 snapshot and 1 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(device1.getParent(), snapshot1.getUuid());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// New snapshot
final Snapshot snapshot2 = device1.createSnapshot("snap2").get();
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), device1.getParent());
Assert.assertEquals(size1, snapshot2.getSize());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot2 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// Resize device1
device1.setSize(size2).get();
Assert.assertEquals(size2, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size1, snapshot2.getSize());
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot2 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// New snapshot of device1
final Snapshot snapshot3 = device1.createSnapshot("snap3").get();
Assert.assertEquals(size2, snapshot3.getSize());
Assert.assertEquals(size2, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size1, snapshot2.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
Assert.assertEquals(snapshot1.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), snapshot3.getParent());
Assert.assertEquals(snapshot3.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot2 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot3.getUuid());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot3 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot3.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot3.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// Delete snapshot1
snapshot1.delete().get();
Assert.assertEquals(size2, snapshot3.getSize());
Assert.assertEquals(size2, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size1, snapshot2.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), snapshot3.getParent());
Assert.assertEquals(snapshot3.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot2 has 1 snapshot and 0 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot3.getUuid());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot3 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot3.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot3.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// Delete snapshot3
snapshot3.delete();
Assert.assertEquals(size2, snapshot3.getSize());
Assert.assertEquals(size2, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(size1, snapshot2.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot2 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
device1Uuid = device1.getUuid();
snapshot2Uuid = snapshot2.getUuid();
}
//
// Restart repository and check state
//
repository.stop(true);
repository.fini();
Thread.sleep(1000);
repository.init();
repository.start(true);
// Load new objects
rootSnapshot = repository.getRootSnapshot();
final Device device1 = repository.getDevice(device1Uuid);
final Snapshot snapshot2 = repository.getSnapshot(snapshot2Uuid);
Assert.assertEquals(size2, device1.getSize());
Assert.assertEquals(size1, snapshot2.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot2.getParent());
Assert.assertEquals(snapshot2.getUuid(), device1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot2.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot2 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot2.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot2.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
}
/**
* Check the {@link NrsFile} created with a simplest history.
*
* @throws Exception
*/
@Test
public void testNrsFiles() throws Exception {
final long size1 = getDefaultBlockSize() * 512;
final long size2 = getDefaultBlockSize() * 12;
final Uuid snapshot1FileUuid;
{
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
{ // rootSnapshot has 0 snapshot and 1 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// New snapshot
final NrsSnapshot snapshot1 = (NrsSnapshot) device1.createSnapshot("snap1").get();
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(device1.getParent(), snapshot1.getUuid());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
// Resize device1
device1.setSize(size2).get();
Assert.assertEquals(size2, device1.getSize());
Assert.assertEquals(size1, snapshot1.getSize());
Assert.assertEquals(device1.getParent(), snapshot1.getUuid());
Assert.assertEquals(rootSnapshot.getUuid(), snapshot1.getParent());
{ // rootSnapshot has 1 snapshot and 0 device
final Collection<UUID> snapshots = rootSnapshot.getChildrenSnapshotsUuid();
Assert.assertEquals(1, snapshots.size());
Assert.assertEquals(snapshots.iterator().next(), snapshot1.getUuid());
final Collection<UUID> devices = rootSnapshot.getSnapshotDevicesUuid();
Assert.assertTrue(devices.isEmpty());
}
{ // snapshot1 has 0 snapshot and 1 device
final Collection<UUID> snapshots = snapshot1.getChildrenSnapshotsUuid();
Assert.assertTrue(snapshots.isEmpty());
final Collection<UUID> devices = snapshot1.getSnapshotDevicesUuid();
Assert.assertEquals(1, devices.size());
Assert.assertEquals(devices.iterator().next(), device1.getUuid());
}
snapshot1FileUuid = VvrRemoteUtils.newTUuid(snapshot1.getNrsFileId());
}
// Get the NrsFile list
final List<NrsVersion> versions;
final Uuid nodeUuid = VvrRemoteUtils.newUuid(nodeId);
{
final RemoteOperation.Builder builder = RemoteOperation.newBuilder();
builder.setVersion(ProtocolVersion.VERSION_1);
builder.setType(Type.NRS);
builder.setOp(OpCode.LIST);
final RemoteOperation reply = (RemoteOperation) repository.handleMsg(builder.build());
Assert.assertSame(Type.NRS, reply.getType());
Assert.assertSame(OpCode.LIST, reply.getOp());
Assert.assertTrue(VvrRemoteUtils.equalsUuid(nodeUuid, reply.getSource()));
Assert.assertEquals(4, reply.getNrsVersionsCount());
versions = reply.getNrsVersionsList();
}
final Uuid rootSnapshotUuid = VvrRemoteUtils.newUuid(rootSnapshot.getUuid());
{
boolean rootFound = false;
boolean snapFound = false;
boolean unknownWritableFound = false;
int unknownCount = 0;
{
for (final NrsVersion version : versions) {
Assert.assertTrue(VvrRemoteUtils.equalsUuid(nodeUuid, version.getSource()));
Assert.assertEquals(0L, version.getVersion());
if (VvrRemoteUtils.equalsUuid(rootSnapshotUuid, version.getUuid())) {
Assert.assertFalse(rootFound);
rootFound = true;
Assert.assertFalse(version.getWritable());
}
else if (VvrRemoteUtils.equalsUuid(snapshot1FileUuid, version.getUuid())) {
Assert.assertFalse(snapFound);
snapFound = true;
Assert.assertFalse(version.getWritable());
}
else {
unknownCount++;
if (version.getWritable()) {
// Only the NrsFile after resize should be writable
Assert.assertFalse(unknownWritableFound);
unknownWritableFound = true;
}
}
}
}
// Found everything?
Assert.assertTrue(rootFound);
Assert.assertTrue(snapFound);
Assert.assertTrue(unknownWritableFound);
Assert.assertEquals(2, unknownCount);
}
}
@Test(expected = IllegalArgumentException.class)
public void testRootSnapshotCreateDeviceNullName() throws Throwable {
rootSnapshot.createDevice(null, 12345678);
}
@Test(expected = IllegalArgumentException.class)
public void testRootSnapshotCreateDeviceZeroSize() throws Throwable {
try {
rootSnapshot.createDevice("D1", 0);
}
catch (final Exception e) {
if (e.getCause() != null)
throw e.getCause();
}
}
@Test(expected = IllegalStateException.class)
public void testRootSnapshotCreateDeviceBadSize() throws Exception {
rootSnapshot.createDevice("D1", 256);
}
@Test(expected = IllegalArgumentException.class)
public void testRootSnapshotCreateDeviceNoSize() throws Throwable {
try {
rootSnapshot.createDevice("D1");
}
catch (final Exception e) {
if (e.getCause() != null)
throw e.getCause();
}
}
@Test(expected = NullPointerException.class)
public void testRootSnapshotCreateDeviceNullUuid1() throws Throwable {
rootSnapshot.createDevice("D1", (UUID) null);
}
@Test(expected = NullPointerException.class)
public void testRootSnapshotCreateDeviceNullUuid2() throws Throwable {
rootSnapshot.createDevice("D1", (UUID) null, 123456789);
}
@Test(expected = NullPointerException.class)
public void testRootSnapshotCreateDeviceNullUuid3() throws Throwable {
rootSnapshot.createDevice("D1", "description", (UUID) null);
}
@Test(expected = NullPointerException.class)
public void testRootSnapshotCreateDeviceNullUuid4() throws Throwable {
rootSnapshot.createDevice("D1", "description", (UUID) null, 123456789);
}
@Test(expected = IllegalStateException.class)
public void testRootSnapshotCreateDeviceDuplicateUuid() throws Throwable {
final UUID uuid1 = UUID.randomUUID();
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", uuid1, size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
Assert.assertEquals(uuid1, device1.getUuid());
// Other device, same uuid
rootSnapshot.createDevice("D2", uuid1, size1).get();
}
@Test(expected = IllegalStateException.class)
public void testRootSnapshotCreateDeviceDuplicateUuidSnapshot() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
rootSnapshot.createDevice("D1", rootSnapshot.getUuid(), size1).get();
}
@Test
public void testCreateSnapshotUuid1() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final UUID uuid = UUID.randomUUID();
final Snapshot snapshot1 = device1.createSnapshot(uuid).get();
Assert.assertEquals(uuid, snapshot1.getUuid());
}
@Test
public void testCreateSnapshotUuid2() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final UUID uuid = UUID.randomUUID();
final Snapshot snapshot1 = device1.createSnapshot("snap1", uuid).get();
Assert.assertEquals("snap1", snapshot1.getName());
Assert.assertEquals(uuid, snapshot1.getUuid());
}
@Test(expected = IllegalStateException.class)
public void testCreateSnapshotDuplicateUuid() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
// Other snapshot, same uuid
device1.createSnapshot("snap2", snapshot1.getUuid()).get();
}
@Test(expected = IllegalStateException.class)
public void testCreateSnapshotDuplicateUuidDevice() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
final Device device2 = rootSnapshot.createDevice("D2", size1).get();
// Other snapshot, same uuid as device
device1.createSnapshot(device2.getUuid()).get();
}
@Test
public void testCreateSnapshotsNoWait() throws Throwable {
// New device
final long size1 = getDefaultBlockSize() * 512;
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
final FutureSnapshot futureSnapshot1 = device1.createSnapshot();
final FutureSnapshot futureSnapshot2 = device1.createSnapshot();
// Wait for the end of the second one, the first should be done too
final Snapshot snapshot2 = futureSnapshot2.get();
Assert.assertTrue(futureSnapshot1.isDone());
final Snapshot snapshot1 = futureSnapshot1.get();
// Check history
Assert.assertEquals(snapshot1.getParent(), rootSnapshot.getUuid());
Assert.assertEquals(snapshot2.getParent(), snapshot1.getUuid());
Assert.assertEquals(device1.getParent(), snapshot2.getUuid());
}
@Test
public void testResizeDeviceNoWait() throws Throwable {
// New device
final long size1 = getDefaultBlockSize() * 512;
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
final FutureVoid futureVoid1 = device1.setSize(size1 * 2);
final FutureVoid futureVoid2 = device1.setSize(size1 * 3);
// Wait for the end of the second one, the first should be done too
futureVoid2.get();
Assert.assertTrue(futureVoid1.isDone());
// Check history and size
Assert.assertEquals(device1.getParent(), rootSnapshot.getUuid());
Assert.assertEquals(size1 * 3, device1.getSize());
}
@Test(expected = IllegalArgumentException.class)
public void testSnapshotCreateDeviceZeroSize() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
try {
snapshot1.createDevice("D1", 0);
}
catch (final IllegalStateException e) {
if (e.getCause() != null)
throw e.getCause();
}
}
@Test
public void testSnapshotCreateDeviceNoSize() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
snapshot1.createDevice("D1");
}
@Test(expected = IllegalStateException.class)
public void testSnapshotCreateDeviceBadSize() throws Exception {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
snapshot1.createDevice("D1", 256);
}
@Test(expected = NullPointerException.class)
public void testSnapshotCreateDeviceNullUuid1() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
snapshot1.createDevice("D1", (UUID) null);
}
@Test(expected = NullPointerException.class)
public void testSnapshotCreateDeviceNullUuid2() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
snapshot1.createDevice("D1", (UUID) null, 123456789);
}
@Test(expected = NullPointerException.class)
public void testSnapshotCreateDeviceNullUuid3() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
snapshot1.createDevice("D1", "description", (UUID) null);
}
@Test(expected = NullPointerException.class)
public void testSnapshotCreateDeviceNullUuid4() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
snapshot1.createDevice("D1", "description", (UUID) null, 123456789);
}
@Test(expected = IllegalStateException.class)
public void testSnapshotCreateDeviceDuplicateUuid() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshot
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
// Other device, same uuid
snapshot1.createDevice("D2", device1.getUuid()).get();
}
@Test(expected = IllegalStateException.class)
public void testSnapshotCreateDeviceDuplicateUuidSnapshot() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
// New device
final Device device1 = rootSnapshot.createDevice("D1", size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
// New snapshots
final Snapshot snapshot1 = device1.createSnapshot("snap1").get();
final Snapshot snapshot2 = device1.createSnapshot("snap2").get();
// Other device, same uuid
snapshot1.createDevice("D2", "description", snapshot2.getUuid(), 123456789);
}
/**
* Create a device, giving its UUID.
*
* @throws Throwable
*/
@Test
public void testCreateDeviceUuid() throws Throwable {
final long size1 = getDefaultBlockSize() * 512;
{// New device
final UUID uuid1 = UUID.randomUUID();
final Device device1 = rootSnapshot.createDevice("D1", uuid1, size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
Assert.assertEquals(uuid1, device1.getUuid());
Assert.assertEquals("D1", device1.getName());
Assert.assertNull(device1.getDescription());
}
final Snapshot snapshot1;
{
final UUID uuid1 = UUID.randomUUID();
final Device device1 = rootSnapshot.createDevice("D1", "Descr", uuid1, size1).get();
Assert.assertEquals(size1, device1.getSize());
Assert.assertEquals(rootSnapshot.getUuid(), device1.getParent());
Assert.assertEquals(uuid1, device1.getUuid());
Assert.assertEquals("D1", device1.getName());
Assert.assertEquals("Descr", device1.getDescription());
// New snapshot
snapshot1 = device1.createSnapshot("snap1").get();
}
// Create device, not changing the size
{
final UUID uuid2 = UUID.randomUUID();
final Device device2 = snapshot1.createDevice("D1", uuid2).get();
Assert.assertEquals(size1, device2.getSize());
Assert.assertEquals(snapshot1.getUuid(), device2.getParent());
Assert.assertEquals(uuid2, device2.getUuid());
Assert.assertEquals("D1", device2.getName());
Assert.assertNull(device2.getDescription());
}
{
final UUID uuid2 = UUID.randomUUID();
final Device device2 = snapshot1.createDevice("D1", "description", uuid2).get();
Assert.assertEquals(size1, device2.getSize());
Assert.assertEquals(snapshot1.getUuid(), device2.getParent());
Assert.assertEquals(uuid2, device2.getUuid());
Assert.assertEquals("D1", device2.getName());
Assert.assertEquals("description", device2.getDescription());
}
}
@Test
public void testUserProperties() {
final String PROP1 = "the first property";
final String PROP2 = "the second property";
final String PROP3 = "the third property";
final String PROP4 = "not set property";
final String VAL11 = "the first value of property 1";
final String VAL12 = "the second value of property 1";
final String VAL2 = "value of property 2";
final String VAL3 = "value of property 3";
Assert.assertTrue(rootSnapshot.getUserProperties().isEmpty());
Assert.assertNull(rootSnapshot.getUserProperty(PROP1));
Assert.assertNull(rootSnapshot.getUserProperty(PROP2));
Assert.assertNull(rootSnapshot.getUserProperty(PROP3));
Assert.assertNull(rootSnapshot.getUserProperty(PROP4));
rootSnapshot.setUserProperties(PROP1, VAL11, PROP2, VAL2);
Assert.assertEquals(VAL11, rootSnapshot.getUserProperty(PROP1));
Assert.assertEquals(VAL2, rootSnapshot.getUserProperty(PROP2));
Assert.assertNull(rootSnapshot.getUserProperty(PROP3));
Assert.assertNull(rootSnapshot.getUserProperty(PROP4));
rootSnapshot.setUserProperties(PROP1, VAL12);
Assert.assertEquals(VAL12, rootSnapshot.getUserProperty(PROP1));
Assert.assertEquals(VAL2, rootSnapshot.getUserProperty(PROP2));
Assert.assertNull(rootSnapshot.getUserProperty(PROP3));
Assert.assertNull(rootSnapshot.getUserProperty(PROP4));
// Unsetting VAL12, which is not a user property should not fail
rootSnapshot.unsetUserProperties(PROP1, VAL12);
Assert.assertNull(rootSnapshot.getUserProperty(PROP1));
Assert.assertEquals(VAL2, rootSnapshot.getUserProperty(PROP2));
Assert.assertNull(rootSnapshot.getUserProperty(PROP3));
Assert.assertNull(rootSnapshot.getUserProperty(PROP4));
rootSnapshot.setUserProperties(PROP3, VAL3);
Assert.assertNull(rootSnapshot.getUserProperty(PROP1));
Assert.assertEquals(VAL2, rootSnapshot.getUserProperty(PROP2));
Assert.assertEquals(VAL3, rootSnapshot.getUserProperty(PROP3));
Assert.assertNull(rootSnapshot.getUserProperty(PROP4));
final Map<String, String> keyValues = rootSnapshot.getUserProperties();
Assert.assertEquals(VAL2, keyValues.remove(PROP2));
Assert.assertEquals(VAL3, keyValues.remove(PROP3));
Assert.assertEquals(0, keyValues.size());
}
@Test(expected = NullPointerException.class)
public void testUserPropertiesNull() {
rootSnapshot.setUserProperties((String[]) null);
}
@Test(expected = IllegalArgumentException.class)
public void testUserPropertiesEmpty() {
rootSnapshot.setUserProperties(new String[0]);
}
@Test(expected = IllegalArgumentException.class)
public void testUserPropertiesOdd1() {
final String PROP1 = "the first property";
Assert.assertNull(rootSnapshot.getUserProperty(PROP1));
// Odd number of key/value items
rootSnapshot.setUserProperties(PROP1);
}
@Test(expected = IllegalArgumentException.class)
public void testUserPropertiesOdd3() {
final String PROP1 = "the first property";
final String PROP2 = "the second property";
final String VAL1 = "the first value of property 1";
Assert.assertNull(rootSnapshot.getUserProperty(PROP1));
Assert.assertNull(rootSnapshot.getUserProperty(PROP2));
// Odd number of key/value items
rootSnapshot.setUserProperties(PROP1, VAL1, PROP2);
}
}
| [
"[email protected]"
] | |
25de11a1822a7c57ba15414f068faa356d0ec2a8 | e531e5b038346428160fffb720fe2be87b19a63e | /ecsite/src/com/internousdev/ecsite/util/DateUtil.java | ca33250c03480ac84f6084d97b8e0b76e21c9929 | [] | no_license | tanoue-ryouichi/ECsite | c00c2c550992f47e4afc774b7f76356b793b5cd6 | b2550fbf4ab908ec4355dbf73d605d297ebb44a3 | refs/heads/master | 2020-12-22T18:20:29.481918 | 2020-01-30T08:18:57 | 2020-01-30T08:18:57 | 236,887,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package com.internousdev.ecsite.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtil {
public String getDate(){
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
return simpleDateFormat.format(date);
}
}
| [
"[email protected]"
] | |
988b92a70c222cf7d60a0263a460e0033bafb55c | bdf855f24243b2222446b12d54643874c72879d6 | /o2o-offline/src/com/sunvsoft/wxpay/tencent/service/.svn/text-base/BaseService.java.svn-base | 576436ec52326a26a15d575a79471707754eeb8a | [] | no_license | nshgdq/learngit | 403bf11b6097407295f10db54ee5ab3963bc176d | 0cb7f3ea16242aa02c32a0a48458e3fd2b49e60f | refs/heads/master | 2021-06-16T16:00:46.206938 | 2017-04-14T02:23:05 | 2017-04-14T02:23:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | package com.sunvsoft.wxpay.tencent.service;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import com.sunvsoft.wxpay.tencent.common.Configure;
/**
* User: rizenguo
* Date: 2014/12/10
* Time: 15:44
* 服务的基类
*/
public class BaseService{
//API的地址
private String apiURL;
//发请求的HTTPS请求器
private IServiceRequest serviceRequest;
@SuppressWarnings("rawtypes")
public BaseService(String api) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
apiURL = api;
Class c = Class.forName(Configure.HttpsRequestClassName);
serviceRequest = (IServiceRequest) c.newInstance();
}
protected String sendPost(Object xmlObj) throws UnrecoverableKeyException, IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
return serviceRequest.sendPost(apiURL,xmlObj);
}
/**
* 供商户想自定义自己的HTTP请求器用
* @param request 实现了IserviceRequest接口的HttpsRequest
*/
public void setServiceRequest(IServiceRequest request){
serviceRequest = request;
}
}
| [
"[email protected]"
] | ||
c53dd8a89f0e4a3fa72d24e20d9c731b4ec1e566 | d970e64aab5c967ba8a1e14958b781a30bba09bd | /src/main/java/springmvc/dao/UserDao.java | 9c310ad9b34f5b9ca0bcdfc831c5dc729ed98915 | [] | no_license | dhruba-roka/Spring-MVC-Learning-Site | e2be2d6e7069c1270cac7b06e3531c87f333ea82 | 296ea7b0bacacfe3155064fd4bfab92919a7cb88 | refs/heads/master | 2023-03-06T15:29:41.510465 | 2021-02-18T16:50:23 | 2021-02-18T16:50:23 | 340,115,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package springmvc.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import springmvc.model.User;
@Repository
public class UserDao {
@Autowired
private HibernateTemplate hibernateTemplate;
@Transactional
public int saveUser(User user) {
int id=(Integer) this.hibernateTemplate.save(user);
return id;
}
}
| [
"[email protected]"
] | |
148f85737089c937ef93e067c5eb3decb3912eba | 8ad5495b1a5f4140cda68176e3a1af400f08af33 | /eclipse-workspace/TEST_2/src/exo_1/tableau.java | abc63dd8998c0fc4d5ad1f2b051292da719b5316 | [] | no_license | mustafanajib/projet-eclipse | 78d567cd43420edf59ddb07bac3c68bb7ae0a6e5 | 7df7f8853e2ebec24a323a010d884f4865c4fefc | refs/heads/master | 2020-05-24T21:34:18.693631 | 2019-05-19T13:28:36 | 2019-05-19T13:28:36 | 187,478,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package exo_1;
public class tableau {
public static void main(String[] args) {
// TODO Auto-generated method stub
int tab[]={0,1,2,3,4};
char tabc[]= {'a','b','c','d'};
double tabd[]= {1.0,2.0,3.0,4.0};
String tabs[]= {"najib","mustafa","Ahyaoui","Keltoum"};
//un tableau vide de 4 cases ou bien vide
int tabv[]=new int [4];
int tabvv[];
//tableau multidimentionnels
int tabmultidim[][] = {{1,2,3,4},{5,6,7,8}};
System.out.println(tabc[3]);
//afficher l'integralité du tableau
for(int i = 0;i<tabc.length;i++) {
System.out.println("dans la case "+i+" nous avons "+tabc[i]);
}
}
}
| [
"[email protected]"
] | |
4e0386c531d4112c18271ed5f2d76a93a9aa17aa | 22d4d740455d1be67b1fa773f69fb0f7bad60d0b | /src/main/java/org/apache/activemq/schema/core/DtoJmsQueueConnector.java | 8bca8c79862d45386ead3fbd07c93f300339d047 | [] | no_license | brentos/activemq-editor-plugin | 727c7cc22ea82bcb2fe11bcd4e025c5132e42c10 | b5fef51454dbbecebf35b472b5b55bb05268e5ba | refs/heads/master | 2021-01-10T14:21:49.627745 | 2016-04-08T23:31:15 | 2016-04-08T23:31:15 | 54,238,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119,310 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.10-b140310.1920
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.04.08 at 03:50:50 PM PDT
//
package org.apache.activemq.schema.core;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice maxOccurs="unbounded" minOccurs="0">
* <choice>
* <element name="brokerService" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}broker"/>
* <element ref="{http://activemq.apache.org/schema/core}brokerService"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="inboundMessageConvertor" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}simpleJmsMessageConvertor"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="inboundQueueBridges" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}inboundQueueBridge"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="localQueueConnection" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence minOccurs="0">
* <any maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="localQueueConnectionFactory" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}connectionFactory"/>
* <element ref="{http://activemq.apache.org/schema/core}xaConnectionFactory"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="outboundMessageConvertor" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}simpleJmsMessageConvertor"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="outboundQueueBridges" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}outboundQueueBridge"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="outboundQueueConnection" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence minOccurs="0">
* <any maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="outboundQueueConnectionFactory" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}connectionFactory"/>
* <element ref="{http://activemq.apache.org/schema/core}xaConnectionFactory"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="reconnectionPolicy" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}reconnectionPolicy"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* </choice>
* </choice>
* <attribute name="brokerService" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="inboundMessageConvertor" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="jndiLocalTemplate" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="jndiOutboundTemplate" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="localClientId" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="localConnectionFactoryName" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="localPassword" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="localQueueConnection" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="localQueueConnectionFactory" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="localUsername" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="outboundClientId" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="outboundMessageConvertor" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="outboundPassword" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="outboundQueueConnection" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="outboundQueueConnectionFactory" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="outboundQueueConnectionFactoryName" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="outboundUsername" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="preferJndiDestinationLookup" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* <attribute name="reconnectionPolicy" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="replyToDestinationCacheSize" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <anyAttribute processContents='lax' namespace='##other'/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"brokerServiceOrInboundMessageConvertorOrInboundQueueBridges"
})
@XmlRootElement(name = "jmsQueueConnector")
public class DtoJmsQueueConnector implements Equals, HashCode, ToString
{
@XmlElementRefs({
@XmlElementRef(name = "outboundMessageConvertor", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "brokerService", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "outboundQueueConnectionFactory", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "outboundQueueBridges", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "localQueueConnection", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "inboundMessageConvertor", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "localQueueConnectionFactory", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "inboundQueueBridges", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "reconnectionPolicy", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false),
@XmlElementRef(name = "outboundQueueConnection", namespace = "http://activemq.apache.org/schema/core", type = JAXBElement.class, required = false)
})
@XmlAnyElement(lax = true)
protected List<Object> brokerServiceOrInboundMessageConvertorOrInboundQueueBridges;
@XmlAttribute(name = "brokerService")
protected String brokerService;
@XmlAttribute(name = "inboundMessageConvertor")
protected String inboundMessageConvertor;
@XmlAttribute(name = "jndiLocalTemplate")
protected String jndiLocalTemplate;
@XmlAttribute(name = "jndiOutboundTemplate")
protected String jndiOutboundTemplate;
@XmlAttribute(name = "localClientId")
protected String localClientId;
@XmlAttribute(name = "localConnectionFactoryName")
protected String localConnectionFactoryName;
@XmlAttribute(name = "localPassword")
protected String localPassword;
@XmlAttribute(name = "localQueueConnection")
protected String localQueueConnection;
@XmlAttribute(name = "localQueueConnectionFactory")
protected String localQueueConnectionFactory;
@XmlAttribute(name = "localUsername")
protected String localUsername;
@XmlAttribute(name = "name")
protected String name;
@XmlAttribute(name = "outboundClientId")
protected String outboundClientId;
@XmlAttribute(name = "outboundMessageConvertor")
protected String outboundMessageConvertor;
@XmlAttribute(name = "outboundPassword")
protected String outboundPassword;
@XmlAttribute(name = "outboundQueueConnection")
protected String outboundQueueConnection;
@XmlAttribute(name = "outboundQueueConnectionFactory")
protected String outboundQueueConnectionFactory;
@XmlAttribute(name = "outboundQueueConnectionFactoryName")
protected String outboundQueueConnectionFactoryName;
@XmlAttribute(name = "outboundUsername")
protected String outboundUsername;
@XmlAttribute(name = "preferJndiDestinationLookup")
protected Boolean preferJndiDestinationLookup;
@XmlAttribute(name = "reconnectionPolicy")
protected String reconnectionPolicy;
@XmlAttribute(name = "replyToDestinationCacheSize")
protected BigInteger replyToDestinationCacheSize;
@XmlAttribute(name = "id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the brokerServiceOrInboundMessageConvertorOrInboundQueueBridges property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the brokerServiceOrInboundMessageConvertorOrInboundQueueBridges property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.OutboundMessageConvertor }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.BrokerService }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.OutboundQueueConnectionFactory }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.OutboundQueueBridges }{@code >}
* {@link Object }
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.LocalQueueConnection }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.InboundMessageConvertor }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.LocalQueueConnectionFactory }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.InboundQueueBridges }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.ReconnectionPolicy }{@code >}
* {@link JAXBElement }{@code <}{@link DtoJmsQueueConnector.OutboundQueueConnection }{@code >}
*
*
*/
public List<Object> getBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges() {
if (brokerServiceOrInboundMessageConvertorOrInboundQueueBridges == null) {
brokerServiceOrInboundMessageConvertorOrInboundQueueBridges = new ArrayList<Object>();
}
return this.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges;
}
/**
* Gets the value of the brokerService property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBrokerService() {
return brokerService;
}
/**
* Sets the value of the brokerService property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBrokerService(String value) {
this.brokerService = value;
}
/**
* Gets the value of the inboundMessageConvertor property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getInboundMessageConvertor() {
return inboundMessageConvertor;
}
/**
* Sets the value of the inboundMessageConvertor property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInboundMessageConvertor(String value) {
this.inboundMessageConvertor = value;
}
/**
* Gets the value of the jndiLocalTemplate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJndiLocalTemplate() {
return jndiLocalTemplate;
}
/**
* Sets the value of the jndiLocalTemplate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJndiLocalTemplate(String value) {
this.jndiLocalTemplate = value;
}
/**
* Gets the value of the jndiOutboundTemplate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getJndiOutboundTemplate() {
return jndiOutboundTemplate;
}
/**
* Sets the value of the jndiOutboundTemplate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setJndiOutboundTemplate(String value) {
this.jndiOutboundTemplate = value;
}
/**
* Gets the value of the localClientId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalClientId() {
return localClientId;
}
/**
* Sets the value of the localClientId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalClientId(String value) {
this.localClientId = value;
}
/**
* Gets the value of the localConnectionFactoryName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalConnectionFactoryName() {
return localConnectionFactoryName;
}
/**
* Sets the value of the localConnectionFactoryName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalConnectionFactoryName(String value) {
this.localConnectionFactoryName = value;
}
/**
* Gets the value of the localPassword property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalPassword() {
return localPassword;
}
/**
* Sets the value of the localPassword property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalPassword(String value) {
this.localPassword = value;
}
/**
* Gets the value of the localQueueConnection property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalQueueConnection() {
return localQueueConnection;
}
/**
* Sets the value of the localQueueConnection property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalQueueConnection(String value) {
this.localQueueConnection = value;
}
/**
* Gets the value of the localQueueConnectionFactory property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalQueueConnectionFactory() {
return localQueueConnectionFactory;
}
/**
* Sets the value of the localQueueConnectionFactory property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalQueueConnectionFactory(String value) {
this.localQueueConnectionFactory = value;
}
/**
* Gets the value of the localUsername property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalUsername() {
return localUsername;
}
/**
* Sets the value of the localUsername property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalUsername(String value) {
this.localUsername = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the outboundClientId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutboundClientId() {
return outboundClientId;
}
/**
* Sets the value of the outboundClientId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutboundClientId(String value) {
this.outboundClientId = value;
}
/**
* Gets the value of the outboundMessageConvertor property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutboundMessageConvertor() {
return outboundMessageConvertor;
}
/**
* Sets the value of the outboundMessageConvertor property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutboundMessageConvertor(String value) {
this.outboundMessageConvertor = value;
}
/**
* Gets the value of the outboundPassword property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutboundPassword() {
return outboundPassword;
}
/**
* Sets the value of the outboundPassword property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutboundPassword(String value) {
this.outboundPassword = value;
}
/**
* Gets the value of the outboundQueueConnection property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutboundQueueConnection() {
return outboundQueueConnection;
}
/**
* Sets the value of the outboundQueueConnection property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutboundQueueConnection(String value) {
this.outboundQueueConnection = value;
}
/**
* Gets the value of the outboundQueueConnectionFactory property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutboundQueueConnectionFactory() {
return outboundQueueConnectionFactory;
}
/**
* Sets the value of the outboundQueueConnectionFactory property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutboundQueueConnectionFactory(String value) {
this.outboundQueueConnectionFactory = value;
}
/**
* Gets the value of the outboundQueueConnectionFactoryName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutboundQueueConnectionFactoryName() {
return outboundQueueConnectionFactoryName;
}
/**
* Sets the value of the outboundQueueConnectionFactoryName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutboundQueueConnectionFactoryName(String value) {
this.outboundQueueConnectionFactoryName = value;
}
/**
* Gets the value of the outboundUsername property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutboundUsername() {
return outboundUsername;
}
/**
* Sets the value of the outboundUsername property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutboundUsername(String value) {
this.outboundUsername = value;
}
/**
* Gets the value of the preferJndiDestinationLookup property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isPreferJndiDestinationLookup() {
return preferJndiDestinationLookup;
}
/**
* Sets the value of the preferJndiDestinationLookup property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setPreferJndiDestinationLookup(Boolean value) {
this.preferJndiDestinationLookup = value;
}
/**
* Gets the value of the reconnectionPolicy property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReconnectionPolicy() {
return reconnectionPolicy;
}
/**
* Sets the value of the reconnectionPolicy property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReconnectionPolicy(String value) {
this.reconnectionPolicy = value;
}
/**
* Gets the value of the replyToDestinationCacheSize property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getReplyToDestinationCacheSize() {
return replyToDestinationCacheSize;
}
/**
* Sets the value of the replyToDestinationCacheSize property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setReplyToDestinationCacheSize(BigInteger value) {
this.replyToDestinationCacheSize = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
List<Object> theBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges;
theBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges = (((this.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges!= null)&&(!this.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges.isEmpty()))?this.getBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges():null);
strategy.appendField(locator, this, "brokerServiceOrInboundMessageConvertorOrInboundQueueBridges", buffer, theBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges);
}
{
String theBrokerService;
theBrokerService = this.getBrokerService();
strategy.appendField(locator, this, "brokerService", buffer, theBrokerService);
}
{
String theInboundMessageConvertor;
theInboundMessageConvertor = this.getInboundMessageConvertor();
strategy.appendField(locator, this, "inboundMessageConvertor", buffer, theInboundMessageConvertor);
}
{
String theJndiLocalTemplate;
theJndiLocalTemplate = this.getJndiLocalTemplate();
strategy.appendField(locator, this, "jndiLocalTemplate", buffer, theJndiLocalTemplate);
}
{
String theJndiOutboundTemplate;
theJndiOutboundTemplate = this.getJndiOutboundTemplate();
strategy.appendField(locator, this, "jndiOutboundTemplate", buffer, theJndiOutboundTemplate);
}
{
String theLocalClientId;
theLocalClientId = this.getLocalClientId();
strategy.appendField(locator, this, "localClientId", buffer, theLocalClientId);
}
{
String theLocalConnectionFactoryName;
theLocalConnectionFactoryName = this.getLocalConnectionFactoryName();
strategy.appendField(locator, this, "localConnectionFactoryName", buffer, theLocalConnectionFactoryName);
}
{
String theLocalPassword;
theLocalPassword = this.getLocalPassword();
strategy.appendField(locator, this, "localPassword", buffer, theLocalPassword);
}
{
String theLocalQueueConnection;
theLocalQueueConnection = this.getLocalQueueConnection();
strategy.appendField(locator, this, "localQueueConnection", buffer, theLocalQueueConnection);
}
{
String theLocalQueueConnectionFactory;
theLocalQueueConnectionFactory = this.getLocalQueueConnectionFactory();
strategy.appendField(locator, this, "localQueueConnectionFactory", buffer, theLocalQueueConnectionFactory);
}
{
String theLocalUsername;
theLocalUsername = this.getLocalUsername();
strategy.appendField(locator, this, "localUsername", buffer, theLocalUsername);
}
{
String theName;
theName = this.getName();
strategy.appendField(locator, this, "name", buffer, theName);
}
{
String theOutboundClientId;
theOutboundClientId = this.getOutboundClientId();
strategy.appendField(locator, this, "outboundClientId", buffer, theOutboundClientId);
}
{
String theOutboundMessageConvertor;
theOutboundMessageConvertor = this.getOutboundMessageConvertor();
strategy.appendField(locator, this, "outboundMessageConvertor", buffer, theOutboundMessageConvertor);
}
{
String theOutboundPassword;
theOutboundPassword = this.getOutboundPassword();
strategy.appendField(locator, this, "outboundPassword", buffer, theOutboundPassword);
}
{
String theOutboundQueueConnection;
theOutboundQueueConnection = this.getOutboundQueueConnection();
strategy.appendField(locator, this, "outboundQueueConnection", buffer, theOutboundQueueConnection);
}
{
String theOutboundQueueConnectionFactory;
theOutboundQueueConnectionFactory = this.getOutboundQueueConnectionFactory();
strategy.appendField(locator, this, "outboundQueueConnectionFactory", buffer, theOutboundQueueConnectionFactory);
}
{
String theOutboundQueueConnectionFactoryName;
theOutboundQueueConnectionFactoryName = this.getOutboundQueueConnectionFactoryName();
strategy.appendField(locator, this, "outboundQueueConnectionFactoryName", buffer, theOutboundQueueConnectionFactoryName);
}
{
String theOutboundUsername;
theOutboundUsername = this.getOutboundUsername();
strategy.appendField(locator, this, "outboundUsername", buffer, theOutboundUsername);
}
{
Boolean thePreferJndiDestinationLookup;
thePreferJndiDestinationLookup = this.isPreferJndiDestinationLookup();
strategy.appendField(locator, this, "preferJndiDestinationLookup", buffer, thePreferJndiDestinationLookup);
}
{
String theReconnectionPolicy;
theReconnectionPolicy = this.getReconnectionPolicy();
strategy.appendField(locator, this, "reconnectionPolicy", buffer, theReconnectionPolicy);
}
{
BigInteger theReplyToDestinationCacheSize;
theReplyToDestinationCacheSize = this.getReplyToDestinationCacheSize();
strategy.appendField(locator, this, "replyToDestinationCacheSize", buffer, theReplyToDestinationCacheSize);
}
{
String theId;
theId = this.getId();
strategy.appendField(locator, this, "id", buffer, theId);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
List<Object> theBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges;
theBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges = (((this.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges!= null)&&(!this.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges.isEmpty()))?this.getBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "brokerServiceOrInboundMessageConvertorOrInboundQueueBridges", theBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges), currentHashCode, theBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges);
}
{
String theBrokerService;
theBrokerService = this.getBrokerService();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "brokerService", theBrokerService), currentHashCode, theBrokerService);
}
{
String theInboundMessageConvertor;
theInboundMessageConvertor = this.getInboundMessageConvertor();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "inboundMessageConvertor", theInboundMessageConvertor), currentHashCode, theInboundMessageConvertor);
}
{
String theJndiLocalTemplate;
theJndiLocalTemplate = this.getJndiLocalTemplate();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "jndiLocalTemplate", theJndiLocalTemplate), currentHashCode, theJndiLocalTemplate);
}
{
String theJndiOutboundTemplate;
theJndiOutboundTemplate = this.getJndiOutboundTemplate();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "jndiOutboundTemplate", theJndiOutboundTemplate), currentHashCode, theJndiOutboundTemplate);
}
{
String theLocalClientId;
theLocalClientId = this.getLocalClientId();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "localClientId", theLocalClientId), currentHashCode, theLocalClientId);
}
{
String theLocalConnectionFactoryName;
theLocalConnectionFactoryName = this.getLocalConnectionFactoryName();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "localConnectionFactoryName", theLocalConnectionFactoryName), currentHashCode, theLocalConnectionFactoryName);
}
{
String theLocalPassword;
theLocalPassword = this.getLocalPassword();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "localPassword", theLocalPassword), currentHashCode, theLocalPassword);
}
{
String theLocalQueueConnection;
theLocalQueueConnection = this.getLocalQueueConnection();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "localQueueConnection", theLocalQueueConnection), currentHashCode, theLocalQueueConnection);
}
{
String theLocalQueueConnectionFactory;
theLocalQueueConnectionFactory = this.getLocalQueueConnectionFactory();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "localQueueConnectionFactory", theLocalQueueConnectionFactory), currentHashCode, theLocalQueueConnectionFactory);
}
{
String theLocalUsername;
theLocalUsername = this.getLocalUsername();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "localUsername", theLocalUsername), currentHashCode, theLocalUsername);
}
{
String theName;
theName = this.getName();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "name", theName), currentHashCode, theName);
}
{
String theOutboundClientId;
theOutboundClientId = this.getOutboundClientId();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundClientId", theOutboundClientId), currentHashCode, theOutboundClientId);
}
{
String theOutboundMessageConvertor;
theOutboundMessageConvertor = this.getOutboundMessageConvertor();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundMessageConvertor", theOutboundMessageConvertor), currentHashCode, theOutboundMessageConvertor);
}
{
String theOutboundPassword;
theOutboundPassword = this.getOutboundPassword();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundPassword", theOutboundPassword), currentHashCode, theOutboundPassword);
}
{
String theOutboundQueueConnection;
theOutboundQueueConnection = this.getOutboundQueueConnection();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundQueueConnection", theOutboundQueueConnection), currentHashCode, theOutboundQueueConnection);
}
{
String theOutboundQueueConnectionFactory;
theOutboundQueueConnectionFactory = this.getOutboundQueueConnectionFactory();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundQueueConnectionFactory", theOutboundQueueConnectionFactory), currentHashCode, theOutboundQueueConnectionFactory);
}
{
String theOutboundQueueConnectionFactoryName;
theOutboundQueueConnectionFactoryName = this.getOutboundQueueConnectionFactoryName();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundQueueConnectionFactoryName", theOutboundQueueConnectionFactoryName), currentHashCode, theOutboundQueueConnectionFactoryName);
}
{
String theOutboundUsername;
theOutboundUsername = this.getOutboundUsername();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundUsername", theOutboundUsername), currentHashCode, theOutboundUsername);
}
{
Boolean thePreferJndiDestinationLookup;
thePreferJndiDestinationLookup = this.isPreferJndiDestinationLookup();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "preferJndiDestinationLookup", thePreferJndiDestinationLookup), currentHashCode, thePreferJndiDestinationLookup);
}
{
String theReconnectionPolicy;
theReconnectionPolicy = this.getReconnectionPolicy();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "reconnectionPolicy", theReconnectionPolicy), currentHashCode, theReconnectionPolicy);
}
{
BigInteger theReplyToDestinationCacheSize;
theReplyToDestinationCacheSize = this.getReplyToDestinationCacheSize();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "replyToDestinationCacheSize", theReplyToDestinationCacheSize), currentHashCode, theReplyToDestinationCacheSize);
}
{
String theId;
theId = this.getId();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "id", theId), currentHashCode, theId);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector that = ((DtoJmsQueueConnector) object);
{
List<Object> lhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges;
lhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges = (((this.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges!= null)&&(!this.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges.isEmpty()))?this.getBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges():null);
List<Object> rhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges;
rhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges = (((that.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges!= null)&&(!that.brokerServiceOrInboundMessageConvertorOrInboundQueueBridges.isEmpty()))?that.getBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "brokerServiceOrInboundMessageConvertorOrInboundQueueBridges", lhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges), LocatorUtils.property(thatLocator, "brokerServiceOrInboundMessageConvertorOrInboundQueueBridges", rhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges), lhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges, rhsBrokerServiceOrInboundMessageConvertorOrInboundQueueBridges)) {
return false;
}
}
{
String lhsBrokerService;
lhsBrokerService = this.getBrokerService();
String rhsBrokerService;
rhsBrokerService = that.getBrokerService();
if (!strategy.equals(LocatorUtils.property(thisLocator, "brokerService", lhsBrokerService), LocatorUtils.property(thatLocator, "brokerService", rhsBrokerService), lhsBrokerService, rhsBrokerService)) {
return false;
}
}
{
String lhsInboundMessageConvertor;
lhsInboundMessageConvertor = this.getInboundMessageConvertor();
String rhsInboundMessageConvertor;
rhsInboundMessageConvertor = that.getInboundMessageConvertor();
if (!strategy.equals(LocatorUtils.property(thisLocator, "inboundMessageConvertor", lhsInboundMessageConvertor), LocatorUtils.property(thatLocator, "inboundMessageConvertor", rhsInboundMessageConvertor), lhsInboundMessageConvertor, rhsInboundMessageConvertor)) {
return false;
}
}
{
String lhsJndiLocalTemplate;
lhsJndiLocalTemplate = this.getJndiLocalTemplate();
String rhsJndiLocalTemplate;
rhsJndiLocalTemplate = that.getJndiLocalTemplate();
if (!strategy.equals(LocatorUtils.property(thisLocator, "jndiLocalTemplate", lhsJndiLocalTemplate), LocatorUtils.property(thatLocator, "jndiLocalTemplate", rhsJndiLocalTemplate), lhsJndiLocalTemplate, rhsJndiLocalTemplate)) {
return false;
}
}
{
String lhsJndiOutboundTemplate;
lhsJndiOutboundTemplate = this.getJndiOutboundTemplate();
String rhsJndiOutboundTemplate;
rhsJndiOutboundTemplate = that.getJndiOutboundTemplate();
if (!strategy.equals(LocatorUtils.property(thisLocator, "jndiOutboundTemplate", lhsJndiOutboundTemplate), LocatorUtils.property(thatLocator, "jndiOutboundTemplate", rhsJndiOutboundTemplate), lhsJndiOutboundTemplate, rhsJndiOutboundTemplate)) {
return false;
}
}
{
String lhsLocalClientId;
lhsLocalClientId = this.getLocalClientId();
String rhsLocalClientId;
rhsLocalClientId = that.getLocalClientId();
if (!strategy.equals(LocatorUtils.property(thisLocator, "localClientId", lhsLocalClientId), LocatorUtils.property(thatLocator, "localClientId", rhsLocalClientId), lhsLocalClientId, rhsLocalClientId)) {
return false;
}
}
{
String lhsLocalConnectionFactoryName;
lhsLocalConnectionFactoryName = this.getLocalConnectionFactoryName();
String rhsLocalConnectionFactoryName;
rhsLocalConnectionFactoryName = that.getLocalConnectionFactoryName();
if (!strategy.equals(LocatorUtils.property(thisLocator, "localConnectionFactoryName", lhsLocalConnectionFactoryName), LocatorUtils.property(thatLocator, "localConnectionFactoryName", rhsLocalConnectionFactoryName), lhsLocalConnectionFactoryName, rhsLocalConnectionFactoryName)) {
return false;
}
}
{
String lhsLocalPassword;
lhsLocalPassword = this.getLocalPassword();
String rhsLocalPassword;
rhsLocalPassword = that.getLocalPassword();
if (!strategy.equals(LocatorUtils.property(thisLocator, "localPassword", lhsLocalPassword), LocatorUtils.property(thatLocator, "localPassword", rhsLocalPassword), lhsLocalPassword, rhsLocalPassword)) {
return false;
}
}
{
String lhsLocalQueueConnection;
lhsLocalQueueConnection = this.getLocalQueueConnection();
String rhsLocalQueueConnection;
rhsLocalQueueConnection = that.getLocalQueueConnection();
if (!strategy.equals(LocatorUtils.property(thisLocator, "localQueueConnection", lhsLocalQueueConnection), LocatorUtils.property(thatLocator, "localQueueConnection", rhsLocalQueueConnection), lhsLocalQueueConnection, rhsLocalQueueConnection)) {
return false;
}
}
{
String lhsLocalQueueConnectionFactory;
lhsLocalQueueConnectionFactory = this.getLocalQueueConnectionFactory();
String rhsLocalQueueConnectionFactory;
rhsLocalQueueConnectionFactory = that.getLocalQueueConnectionFactory();
if (!strategy.equals(LocatorUtils.property(thisLocator, "localQueueConnectionFactory", lhsLocalQueueConnectionFactory), LocatorUtils.property(thatLocator, "localQueueConnectionFactory", rhsLocalQueueConnectionFactory), lhsLocalQueueConnectionFactory, rhsLocalQueueConnectionFactory)) {
return false;
}
}
{
String lhsLocalUsername;
lhsLocalUsername = this.getLocalUsername();
String rhsLocalUsername;
rhsLocalUsername = that.getLocalUsername();
if (!strategy.equals(LocatorUtils.property(thisLocator, "localUsername", lhsLocalUsername), LocatorUtils.property(thatLocator, "localUsername", rhsLocalUsername), lhsLocalUsername, rhsLocalUsername)) {
return false;
}
}
{
String lhsName;
lhsName = this.getName();
String rhsName;
rhsName = that.getName();
if (!strategy.equals(LocatorUtils.property(thisLocator, "name", lhsName), LocatorUtils.property(thatLocator, "name", rhsName), lhsName, rhsName)) {
return false;
}
}
{
String lhsOutboundClientId;
lhsOutboundClientId = this.getOutboundClientId();
String rhsOutboundClientId;
rhsOutboundClientId = that.getOutboundClientId();
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundClientId", lhsOutboundClientId), LocatorUtils.property(thatLocator, "outboundClientId", rhsOutboundClientId), lhsOutboundClientId, rhsOutboundClientId)) {
return false;
}
}
{
String lhsOutboundMessageConvertor;
lhsOutboundMessageConvertor = this.getOutboundMessageConvertor();
String rhsOutboundMessageConvertor;
rhsOutboundMessageConvertor = that.getOutboundMessageConvertor();
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundMessageConvertor", lhsOutboundMessageConvertor), LocatorUtils.property(thatLocator, "outboundMessageConvertor", rhsOutboundMessageConvertor), lhsOutboundMessageConvertor, rhsOutboundMessageConvertor)) {
return false;
}
}
{
String lhsOutboundPassword;
lhsOutboundPassword = this.getOutboundPassword();
String rhsOutboundPassword;
rhsOutboundPassword = that.getOutboundPassword();
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundPassword", lhsOutboundPassword), LocatorUtils.property(thatLocator, "outboundPassword", rhsOutboundPassword), lhsOutboundPassword, rhsOutboundPassword)) {
return false;
}
}
{
String lhsOutboundQueueConnection;
lhsOutboundQueueConnection = this.getOutboundQueueConnection();
String rhsOutboundQueueConnection;
rhsOutboundQueueConnection = that.getOutboundQueueConnection();
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundQueueConnection", lhsOutboundQueueConnection), LocatorUtils.property(thatLocator, "outboundQueueConnection", rhsOutboundQueueConnection), lhsOutboundQueueConnection, rhsOutboundQueueConnection)) {
return false;
}
}
{
String lhsOutboundQueueConnectionFactory;
lhsOutboundQueueConnectionFactory = this.getOutboundQueueConnectionFactory();
String rhsOutboundQueueConnectionFactory;
rhsOutboundQueueConnectionFactory = that.getOutboundQueueConnectionFactory();
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundQueueConnectionFactory", lhsOutboundQueueConnectionFactory), LocatorUtils.property(thatLocator, "outboundQueueConnectionFactory", rhsOutboundQueueConnectionFactory), lhsOutboundQueueConnectionFactory, rhsOutboundQueueConnectionFactory)) {
return false;
}
}
{
String lhsOutboundQueueConnectionFactoryName;
lhsOutboundQueueConnectionFactoryName = this.getOutboundQueueConnectionFactoryName();
String rhsOutboundQueueConnectionFactoryName;
rhsOutboundQueueConnectionFactoryName = that.getOutboundQueueConnectionFactoryName();
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundQueueConnectionFactoryName", lhsOutboundQueueConnectionFactoryName), LocatorUtils.property(thatLocator, "outboundQueueConnectionFactoryName", rhsOutboundQueueConnectionFactoryName), lhsOutboundQueueConnectionFactoryName, rhsOutboundQueueConnectionFactoryName)) {
return false;
}
}
{
String lhsOutboundUsername;
lhsOutboundUsername = this.getOutboundUsername();
String rhsOutboundUsername;
rhsOutboundUsername = that.getOutboundUsername();
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundUsername", lhsOutboundUsername), LocatorUtils.property(thatLocator, "outboundUsername", rhsOutboundUsername), lhsOutboundUsername, rhsOutboundUsername)) {
return false;
}
}
{
Boolean lhsPreferJndiDestinationLookup;
lhsPreferJndiDestinationLookup = this.isPreferJndiDestinationLookup();
Boolean rhsPreferJndiDestinationLookup;
rhsPreferJndiDestinationLookup = that.isPreferJndiDestinationLookup();
if (!strategy.equals(LocatorUtils.property(thisLocator, "preferJndiDestinationLookup", lhsPreferJndiDestinationLookup), LocatorUtils.property(thatLocator, "preferJndiDestinationLookup", rhsPreferJndiDestinationLookup), lhsPreferJndiDestinationLookup, rhsPreferJndiDestinationLookup)) {
return false;
}
}
{
String lhsReconnectionPolicy;
lhsReconnectionPolicy = this.getReconnectionPolicy();
String rhsReconnectionPolicy;
rhsReconnectionPolicy = that.getReconnectionPolicy();
if (!strategy.equals(LocatorUtils.property(thisLocator, "reconnectionPolicy", lhsReconnectionPolicy), LocatorUtils.property(thatLocator, "reconnectionPolicy", rhsReconnectionPolicy), lhsReconnectionPolicy, rhsReconnectionPolicy)) {
return false;
}
}
{
BigInteger lhsReplyToDestinationCacheSize;
lhsReplyToDestinationCacheSize = this.getReplyToDestinationCacheSize();
BigInteger rhsReplyToDestinationCacheSize;
rhsReplyToDestinationCacheSize = that.getReplyToDestinationCacheSize();
if (!strategy.equals(LocatorUtils.property(thisLocator, "replyToDestinationCacheSize", lhsReplyToDestinationCacheSize), LocatorUtils.property(thatLocator, "replyToDestinationCacheSize", rhsReplyToDestinationCacheSize), lhsReplyToDestinationCacheSize, rhsReplyToDestinationCacheSize)) {
return false;
}
}
{
String lhsId;
lhsId = this.getId();
String rhsId;
rhsId = that.getId();
if (!strategy.equals(LocatorUtils.property(thisLocator, "id", lhsId), LocatorUtils.property(thatLocator, "id", rhsId), lhsId, rhsId)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}broker"/>
* <element ref="{http://activemq.apache.org/schema/core}brokerService"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"broker",
"brokerService",
"any"
})
public static class BrokerService
implements Equals, HashCode, ToString
{
protected DtoBroker broker;
protected DtoBrokerService brokerService;
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the broker property.
*
* @return
* possible object is
* {@link DtoBroker }
*
*/
public DtoBroker getBroker() {
return broker;
}
/**
* Sets the value of the broker property.
*
* @param value
* allowed object is
* {@link DtoBroker }
*
*/
public void setBroker(DtoBroker value) {
this.broker = value;
}
/**
* Gets the value of the brokerService property.
*
* @return
* possible object is
* {@link DtoBrokerService }
*
*/
public DtoBrokerService getBrokerService() {
return brokerService;
}
/**
* Sets the value of the brokerService property.
*
* @param value
* allowed object is
* {@link DtoBrokerService }
*
*/
public void setBrokerService(DtoBrokerService value) {
this.brokerService = value;
}
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
DtoBroker theBroker;
theBroker = this.getBroker();
strategy.appendField(locator, this, "broker", buffer, theBroker);
}
{
DtoBrokerService theBrokerService;
theBrokerService = this.getBrokerService();
strategy.appendField(locator, this, "brokerService", buffer, theBrokerService);
}
{
Object theAny;
theAny = this.getAny();
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
DtoBroker theBroker;
theBroker = this.getBroker();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "broker", theBroker), currentHashCode, theBroker);
}
{
DtoBrokerService theBrokerService;
theBrokerService = this.getBrokerService();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "brokerService", theBrokerService), currentHashCode, theBrokerService);
}
{
Object theAny;
theAny = this.getAny();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.BrokerService)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.BrokerService that = ((DtoJmsQueueConnector.BrokerService) object);
{
DtoBroker lhsBroker;
lhsBroker = this.getBroker();
DtoBroker rhsBroker;
rhsBroker = that.getBroker();
if (!strategy.equals(LocatorUtils.property(thisLocator, "broker", lhsBroker), LocatorUtils.property(thatLocator, "broker", rhsBroker), lhsBroker, rhsBroker)) {
return false;
}
}
{
DtoBrokerService lhsBrokerService;
lhsBrokerService = this.getBrokerService();
DtoBrokerService rhsBrokerService;
rhsBrokerService = that.getBrokerService();
if (!strategy.equals(LocatorUtils.property(thisLocator, "brokerService", lhsBrokerService), LocatorUtils.property(thatLocator, "brokerService", rhsBrokerService), lhsBrokerService, rhsBrokerService)) {
return false;
}
}
{
Object lhsAny;
lhsAny = this.getAny();
Object rhsAny;
rhsAny = that.getAny();
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}simpleJmsMessageConvertor"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"simpleJmsMessageConvertor",
"any"
})
public static class InboundMessageConvertor
implements Equals, HashCode, ToString
{
protected DtoSimpleJmsMessageConvertor simpleJmsMessageConvertor;
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the simpleJmsMessageConvertor property.
*
* @return
* possible object is
* {@link DtoSimpleJmsMessageConvertor }
*
*/
public DtoSimpleJmsMessageConvertor getSimpleJmsMessageConvertor() {
return simpleJmsMessageConvertor;
}
/**
* Sets the value of the simpleJmsMessageConvertor property.
*
* @param value
* allowed object is
* {@link DtoSimpleJmsMessageConvertor }
*
*/
public void setSimpleJmsMessageConvertor(DtoSimpleJmsMessageConvertor value) {
this.simpleJmsMessageConvertor = value;
}
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
DtoSimpleJmsMessageConvertor theSimpleJmsMessageConvertor;
theSimpleJmsMessageConvertor = this.getSimpleJmsMessageConvertor();
strategy.appendField(locator, this, "simpleJmsMessageConvertor", buffer, theSimpleJmsMessageConvertor);
}
{
Object theAny;
theAny = this.getAny();
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
DtoSimpleJmsMessageConvertor theSimpleJmsMessageConvertor;
theSimpleJmsMessageConvertor = this.getSimpleJmsMessageConvertor();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "simpleJmsMessageConvertor", theSimpleJmsMessageConvertor), currentHashCode, theSimpleJmsMessageConvertor);
}
{
Object theAny;
theAny = this.getAny();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.InboundMessageConvertor)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.InboundMessageConvertor that = ((DtoJmsQueueConnector.InboundMessageConvertor) object);
{
DtoSimpleJmsMessageConvertor lhsSimpleJmsMessageConvertor;
lhsSimpleJmsMessageConvertor = this.getSimpleJmsMessageConvertor();
DtoSimpleJmsMessageConvertor rhsSimpleJmsMessageConvertor;
rhsSimpleJmsMessageConvertor = that.getSimpleJmsMessageConvertor();
if (!strategy.equals(LocatorUtils.property(thisLocator, "simpleJmsMessageConvertor", lhsSimpleJmsMessageConvertor), LocatorUtils.property(thatLocator, "simpleJmsMessageConvertor", rhsSimpleJmsMessageConvertor), lhsSimpleJmsMessageConvertor, rhsSimpleJmsMessageConvertor)) {
return false;
}
}
{
Object lhsAny;
lhsAny = this.getAny();
Object rhsAny;
rhsAny = that.getAny();
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}inboundQueueBridge"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"inboundQueueBridgeOrAny"
})
public static class InboundQueueBridges
implements Equals, HashCode, ToString
{
@XmlElementRef(name = "inboundQueueBridge", namespace = "http://activemq.apache.org/schema/core", type = DtoInboundQueueBridge.class, required = false)
@XmlAnyElement(lax = true)
protected List<Object> inboundQueueBridgeOrAny;
/**
* Gets the value of the inboundQueueBridgeOrAny property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the inboundQueueBridgeOrAny property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getInboundQueueBridgeOrAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DtoInboundQueueBridge }
* {@link Object }
*
*
*/
public List<Object> getInboundQueueBridgeOrAny() {
if (inboundQueueBridgeOrAny == null) {
inboundQueueBridgeOrAny = new ArrayList<Object>();
}
return this.inboundQueueBridgeOrAny;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
List<Object> theInboundQueueBridgeOrAny;
theInboundQueueBridgeOrAny = (((this.inboundQueueBridgeOrAny!= null)&&(!this.inboundQueueBridgeOrAny.isEmpty()))?this.getInboundQueueBridgeOrAny():null);
strategy.appendField(locator, this, "inboundQueueBridgeOrAny", buffer, theInboundQueueBridgeOrAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
List<Object> theInboundQueueBridgeOrAny;
theInboundQueueBridgeOrAny = (((this.inboundQueueBridgeOrAny!= null)&&(!this.inboundQueueBridgeOrAny.isEmpty()))?this.getInboundQueueBridgeOrAny():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "inboundQueueBridgeOrAny", theInboundQueueBridgeOrAny), currentHashCode, theInboundQueueBridgeOrAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.InboundQueueBridges)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.InboundQueueBridges that = ((DtoJmsQueueConnector.InboundQueueBridges) object);
{
List<Object> lhsInboundQueueBridgeOrAny;
lhsInboundQueueBridgeOrAny = (((this.inboundQueueBridgeOrAny!= null)&&(!this.inboundQueueBridgeOrAny.isEmpty()))?this.getInboundQueueBridgeOrAny():null);
List<Object> rhsInboundQueueBridgeOrAny;
rhsInboundQueueBridgeOrAny = (((that.inboundQueueBridgeOrAny!= null)&&(!that.inboundQueueBridgeOrAny.isEmpty()))?that.getInboundQueueBridgeOrAny():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "inboundQueueBridgeOrAny", lhsInboundQueueBridgeOrAny), LocatorUtils.property(thatLocator, "inboundQueueBridgeOrAny", rhsInboundQueueBridgeOrAny), lhsInboundQueueBridgeOrAny, rhsInboundQueueBridgeOrAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence minOccurs="0">
* <any maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"any"
})
public static class LocalQueueConnection
implements Equals, HashCode, ToString
{
@XmlAnyElement(lax = true)
protected List<Object> any;
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Object }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
List<Object> theAny;
theAny = (((this.any!= null)&&(!this.any.isEmpty()))?this.getAny():null);
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
List<Object> theAny;
theAny = (((this.any!= null)&&(!this.any.isEmpty()))?this.getAny():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.LocalQueueConnection)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.LocalQueueConnection that = ((DtoJmsQueueConnector.LocalQueueConnection) object);
{
List<Object> lhsAny;
lhsAny = (((this.any!= null)&&(!this.any.isEmpty()))?this.getAny():null);
List<Object> rhsAny;
rhsAny = (((that.any!= null)&&(!that.any.isEmpty()))?that.getAny():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}connectionFactory"/>
* <element ref="{http://activemq.apache.org/schema/core}xaConnectionFactory"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"connectionFactory",
"xaConnectionFactory",
"any"
})
public static class LocalQueueConnectionFactory
implements Equals, HashCode, ToString
{
protected DtoConnectionFactory connectionFactory;
protected DtoXaConnectionFactory xaConnectionFactory;
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the connectionFactory property.
*
* @return
* possible object is
* {@link DtoConnectionFactory }
*
*/
public DtoConnectionFactory getConnectionFactory() {
return connectionFactory;
}
/**
* Sets the value of the connectionFactory property.
*
* @param value
* allowed object is
* {@link DtoConnectionFactory }
*
*/
public void setConnectionFactory(DtoConnectionFactory value) {
this.connectionFactory = value;
}
/**
* Gets the value of the xaConnectionFactory property.
*
* @return
* possible object is
* {@link DtoXaConnectionFactory }
*
*/
public DtoXaConnectionFactory getXaConnectionFactory() {
return xaConnectionFactory;
}
/**
* Sets the value of the xaConnectionFactory property.
*
* @param value
* allowed object is
* {@link DtoXaConnectionFactory }
*
*/
public void setXaConnectionFactory(DtoXaConnectionFactory value) {
this.xaConnectionFactory = value;
}
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
DtoConnectionFactory theConnectionFactory;
theConnectionFactory = this.getConnectionFactory();
strategy.appendField(locator, this, "connectionFactory", buffer, theConnectionFactory);
}
{
DtoXaConnectionFactory theXaConnectionFactory;
theXaConnectionFactory = this.getXaConnectionFactory();
strategy.appendField(locator, this, "xaConnectionFactory", buffer, theXaConnectionFactory);
}
{
Object theAny;
theAny = this.getAny();
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
DtoConnectionFactory theConnectionFactory;
theConnectionFactory = this.getConnectionFactory();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "connectionFactory", theConnectionFactory), currentHashCode, theConnectionFactory);
}
{
DtoXaConnectionFactory theXaConnectionFactory;
theXaConnectionFactory = this.getXaConnectionFactory();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "xaConnectionFactory", theXaConnectionFactory), currentHashCode, theXaConnectionFactory);
}
{
Object theAny;
theAny = this.getAny();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.LocalQueueConnectionFactory)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.LocalQueueConnectionFactory that = ((DtoJmsQueueConnector.LocalQueueConnectionFactory) object);
{
DtoConnectionFactory lhsConnectionFactory;
lhsConnectionFactory = this.getConnectionFactory();
DtoConnectionFactory rhsConnectionFactory;
rhsConnectionFactory = that.getConnectionFactory();
if (!strategy.equals(LocatorUtils.property(thisLocator, "connectionFactory", lhsConnectionFactory), LocatorUtils.property(thatLocator, "connectionFactory", rhsConnectionFactory), lhsConnectionFactory, rhsConnectionFactory)) {
return false;
}
}
{
DtoXaConnectionFactory lhsXaConnectionFactory;
lhsXaConnectionFactory = this.getXaConnectionFactory();
DtoXaConnectionFactory rhsXaConnectionFactory;
rhsXaConnectionFactory = that.getXaConnectionFactory();
if (!strategy.equals(LocatorUtils.property(thisLocator, "xaConnectionFactory", lhsXaConnectionFactory), LocatorUtils.property(thatLocator, "xaConnectionFactory", rhsXaConnectionFactory), lhsXaConnectionFactory, rhsXaConnectionFactory)) {
return false;
}
}
{
Object lhsAny;
lhsAny = this.getAny();
Object rhsAny;
rhsAny = that.getAny();
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}simpleJmsMessageConvertor"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"simpleJmsMessageConvertor",
"any"
})
public static class OutboundMessageConvertor
implements Equals, HashCode, ToString
{
protected DtoSimpleJmsMessageConvertor simpleJmsMessageConvertor;
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the simpleJmsMessageConvertor property.
*
* @return
* possible object is
* {@link DtoSimpleJmsMessageConvertor }
*
*/
public DtoSimpleJmsMessageConvertor getSimpleJmsMessageConvertor() {
return simpleJmsMessageConvertor;
}
/**
* Sets the value of the simpleJmsMessageConvertor property.
*
* @param value
* allowed object is
* {@link DtoSimpleJmsMessageConvertor }
*
*/
public void setSimpleJmsMessageConvertor(DtoSimpleJmsMessageConvertor value) {
this.simpleJmsMessageConvertor = value;
}
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
DtoSimpleJmsMessageConvertor theSimpleJmsMessageConvertor;
theSimpleJmsMessageConvertor = this.getSimpleJmsMessageConvertor();
strategy.appendField(locator, this, "simpleJmsMessageConvertor", buffer, theSimpleJmsMessageConvertor);
}
{
Object theAny;
theAny = this.getAny();
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
DtoSimpleJmsMessageConvertor theSimpleJmsMessageConvertor;
theSimpleJmsMessageConvertor = this.getSimpleJmsMessageConvertor();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "simpleJmsMessageConvertor", theSimpleJmsMessageConvertor), currentHashCode, theSimpleJmsMessageConvertor);
}
{
Object theAny;
theAny = this.getAny();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.OutboundMessageConvertor)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.OutboundMessageConvertor that = ((DtoJmsQueueConnector.OutboundMessageConvertor) object);
{
DtoSimpleJmsMessageConvertor lhsSimpleJmsMessageConvertor;
lhsSimpleJmsMessageConvertor = this.getSimpleJmsMessageConvertor();
DtoSimpleJmsMessageConvertor rhsSimpleJmsMessageConvertor;
rhsSimpleJmsMessageConvertor = that.getSimpleJmsMessageConvertor();
if (!strategy.equals(LocatorUtils.property(thisLocator, "simpleJmsMessageConvertor", lhsSimpleJmsMessageConvertor), LocatorUtils.property(thatLocator, "simpleJmsMessageConvertor", rhsSimpleJmsMessageConvertor), lhsSimpleJmsMessageConvertor, rhsSimpleJmsMessageConvertor)) {
return false;
}
}
{
Object lhsAny;
lhsAny = this.getAny();
Object rhsAny;
rhsAny = that.getAny();
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}outboundQueueBridge"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"outboundQueueBridgeOrAny"
})
public static class OutboundQueueBridges
implements Equals, HashCode, ToString
{
@XmlElementRef(name = "outboundQueueBridge", namespace = "http://activemq.apache.org/schema/core", type = DtoOutboundQueueBridge.class, required = false)
@XmlAnyElement(lax = true)
protected List<Object> outboundQueueBridgeOrAny;
/**
* Gets the value of the outboundQueueBridgeOrAny property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the outboundQueueBridgeOrAny property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOutboundQueueBridgeOrAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DtoOutboundQueueBridge }
* {@link Object }
*
*
*/
public List<Object> getOutboundQueueBridgeOrAny() {
if (outboundQueueBridgeOrAny == null) {
outboundQueueBridgeOrAny = new ArrayList<Object>();
}
return this.outboundQueueBridgeOrAny;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
List<Object> theOutboundQueueBridgeOrAny;
theOutboundQueueBridgeOrAny = (((this.outboundQueueBridgeOrAny!= null)&&(!this.outboundQueueBridgeOrAny.isEmpty()))?this.getOutboundQueueBridgeOrAny():null);
strategy.appendField(locator, this, "outboundQueueBridgeOrAny", buffer, theOutboundQueueBridgeOrAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
List<Object> theOutboundQueueBridgeOrAny;
theOutboundQueueBridgeOrAny = (((this.outboundQueueBridgeOrAny!= null)&&(!this.outboundQueueBridgeOrAny.isEmpty()))?this.getOutboundQueueBridgeOrAny():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "outboundQueueBridgeOrAny", theOutboundQueueBridgeOrAny), currentHashCode, theOutboundQueueBridgeOrAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.OutboundQueueBridges)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.OutboundQueueBridges that = ((DtoJmsQueueConnector.OutboundQueueBridges) object);
{
List<Object> lhsOutboundQueueBridgeOrAny;
lhsOutboundQueueBridgeOrAny = (((this.outboundQueueBridgeOrAny!= null)&&(!this.outboundQueueBridgeOrAny.isEmpty()))?this.getOutboundQueueBridgeOrAny():null);
List<Object> rhsOutboundQueueBridgeOrAny;
rhsOutboundQueueBridgeOrAny = (((that.outboundQueueBridgeOrAny!= null)&&(!that.outboundQueueBridgeOrAny.isEmpty()))?that.getOutboundQueueBridgeOrAny():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "outboundQueueBridgeOrAny", lhsOutboundQueueBridgeOrAny), LocatorUtils.property(thatLocator, "outboundQueueBridgeOrAny", rhsOutboundQueueBridgeOrAny), lhsOutboundQueueBridgeOrAny, rhsOutboundQueueBridgeOrAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence minOccurs="0">
* <any maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"any"
})
public static class OutboundQueueConnection
implements Equals, HashCode, ToString
{
@XmlAnyElement(lax = true)
protected List<Object> any;
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Object }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
List<Object> theAny;
theAny = (((this.any!= null)&&(!this.any.isEmpty()))?this.getAny():null);
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
List<Object> theAny;
theAny = (((this.any!= null)&&(!this.any.isEmpty()))?this.getAny():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.OutboundQueueConnection)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.OutboundQueueConnection that = ((DtoJmsQueueConnector.OutboundQueueConnection) object);
{
List<Object> lhsAny;
lhsAny = (((this.any!= null)&&(!this.any.isEmpty()))?this.getAny():null);
List<Object> rhsAny;
rhsAny = (((that.any!= null)&&(!that.any.isEmpty()))?that.getAny():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}connectionFactory"/>
* <element ref="{http://activemq.apache.org/schema/core}xaConnectionFactory"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"connectionFactory",
"xaConnectionFactory",
"any"
})
public static class OutboundQueueConnectionFactory
implements Equals, HashCode, ToString
{
protected DtoConnectionFactory connectionFactory;
protected DtoXaConnectionFactory xaConnectionFactory;
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the connectionFactory property.
*
* @return
* possible object is
* {@link DtoConnectionFactory }
*
*/
public DtoConnectionFactory getConnectionFactory() {
return connectionFactory;
}
/**
* Sets the value of the connectionFactory property.
*
* @param value
* allowed object is
* {@link DtoConnectionFactory }
*
*/
public void setConnectionFactory(DtoConnectionFactory value) {
this.connectionFactory = value;
}
/**
* Gets the value of the xaConnectionFactory property.
*
* @return
* possible object is
* {@link DtoXaConnectionFactory }
*
*/
public DtoXaConnectionFactory getXaConnectionFactory() {
return xaConnectionFactory;
}
/**
* Sets the value of the xaConnectionFactory property.
*
* @param value
* allowed object is
* {@link DtoXaConnectionFactory }
*
*/
public void setXaConnectionFactory(DtoXaConnectionFactory value) {
this.xaConnectionFactory = value;
}
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
DtoConnectionFactory theConnectionFactory;
theConnectionFactory = this.getConnectionFactory();
strategy.appendField(locator, this, "connectionFactory", buffer, theConnectionFactory);
}
{
DtoXaConnectionFactory theXaConnectionFactory;
theXaConnectionFactory = this.getXaConnectionFactory();
strategy.appendField(locator, this, "xaConnectionFactory", buffer, theXaConnectionFactory);
}
{
Object theAny;
theAny = this.getAny();
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
DtoConnectionFactory theConnectionFactory;
theConnectionFactory = this.getConnectionFactory();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "connectionFactory", theConnectionFactory), currentHashCode, theConnectionFactory);
}
{
DtoXaConnectionFactory theXaConnectionFactory;
theXaConnectionFactory = this.getXaConnectionFactory();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "xaConnectionFactory", theXaConnectionFactory), currentHashCode, theXaConnectionFactory);
}
{
Object theAny;
theAny = this.getAny();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.OutboundQueueConnectionFactory)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.OutboundQueueConnectionFactory that = ((DtoJmsQueueConnector.OutboundQueueConnectionFactory) object);
{
DtoConnectionFactory lhsConnectionFactory;
lhsConnectionFactory = this.getConnectionFactory();
DtoConnectionFactory rhsConnectionFactory;
rhsConnectionFactory = that.getConnectionFactory();
if (!strategy.equals(LocatorUtils.property(thisLocator, "connectionFactory", lhsConnectionFactory), LocatorUtils.property(thatLocator, "connectionFactory", rhsConnectionFactory), lhsConnectionFactory, rhsConnectionFactory)) {
return false;
}
}
{
DtoXaConnectionFactory lhsXaConnectionFactory;
lhsXaConnectionFactory = this.getXaConnectionFactory();
DtoXaConnectionFactory rhsXaConnectionFactory;
rhsXaConnectionFactory = that.getXaConnectionFactory();
if (!strategy.equals(LocatorUtils.property(thisLocator, "xaConnectionFactory", lhsXaConnectionFactory), LocatorUtils.property(thatLocator, "xaConnectionFactory", rhsXaConnectionFactory), lhsXaConnectionFactory, rhsXaConnectionFactory)) {
return false;
}
}
{
Object lhsAny;
lhsAny = this.getAny();
Object rhsAny;
rhsAny = that.getAny();
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice minOccurs="0">
* <element ref="{http://activemq.apache.org/schema/core}reconnectionPolicy"/>
* <any namespace='##other'/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"reconnectionPolicy",
"any"
})
public static class ReconnectionPolicy
implements Equals, HashCode, ToString
{
protected DtoReconnectionPolicy reconnectionPolicy;
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the reconnectionPolicy property.
*
* @return
* possible object is
* {@link DtoReconnectionPolicy }
*
*/
public DtoReconnectionPolicy getReconnectionPolicy() {
return reconnectionPolicy;
}
/**
* Sets the value of the reconnectionPolicy property.
*
* @param value
* allowed object is
* {@link DtoReconnectionPolicy }
*
*/
public void setReconnectionPolicy(DtoReconnectionPolicy value) {
this.reconnectionPolicy = value;
}
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
DtoReconnectionPolicy theReconnectionPolicy;
theReconnectionPolicy = this.getReconnectionPolicy();
strategy.appendField(locator, this, "reconnectionPolicy", buffer, theReconnectionPolicy);
}
{
Object theAny;
theAny = this.getAny();
strategy.appendField(locator, this, "any", buffer, theAny);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
DtoReconnectionPolicy theReconnectionPolicy;
theReconnectionPolicy = this.getReconnectionPolicy();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "reconnectionPolicy", theReconnectionPolicy), currentHashCode, theReconnectionPolicy);
}
{
Object theAny;
theAny = this.getAny();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "any", theAny), currentHashCode, theAny);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof DtoJmsQueueConnector.ReconnectionPolicy)) {
return false;
}
if (this == object) {
return true;
}
final DtoJmsQueueConnector.ReconnectionPolicy that = ((DtoJmsQueueConnector.ReconnectionPolicy) object);
{
DtoReconnectionPolicy lhsReconnectionPolicy;
lhsReconnectionPolicy = this.getReconnectionPolicy();
DtoReconnectionPolicy rhsReconnectionPolicy;
rhsReconnectionPolicy = that.getReconnectionPolicy();
if (!strategy.equals(LocatorUtils.property(thisLocator, "reconnectionPolicy", lhsReconnectionPolicy), LocatorUtils.property(thatLocator, "reconnectionPolicy", rhsReconnectionPolicy), lhsReconnectionPolicy, rhsReconnectionPolicy)) {
return false;
}
}
{
Object lhsAny;
lhsAny = this.getAny();
Object rhsAny;
rhsAny = that.getAny();
if (!strategy.equals(LocatorUtils.property(thisLocator, "any", lhsAny), LocatorUtils.property(thatLocator, "any", rhsAny), lhsAny, rhsAny)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = new org.apache.activemq.plugin.jaxb2_commons.ElementAwareEqualsStrategy();
return equals(null, null, object, strategy);
}
}
}
| [
"[email protected]"
] | |
9ed7f9c7fb2838c0dfc286a28d66b225717e3a80 | 80b292849056cb4bf3f8f76f127b06aa376fdaaa | /java/game/tera/gameserver/model/GuildRankLaw.java | 0a76da553bf9ac19b877fcaee85d693dfad5fcd9 | [] | no_license | unnamed44/tera_2805 | 70f099c4b29a8e8e19638d9b80015d0f3560b66d | 6c5be9fc79157b44058c816dd8f566b7cf7eea0d | refs/heads/master | 2020-04-28T04:06:36.652737 | 2019-03-11T01:26:47 | 2019-03-11T01:26:47 | 174,964,999 | 2 | 0 | null | 2019-03-11T09:15:36 | 2019-03-11T09:15:35 | null | UTF-8 | Java | false | false | 1,780 | java | package tera.gameserver.model;
/**
* Перечисление наборов прав рангов гильдий.
*
* @author Ronn
*/
public enum GuildRankLaw
{
/** 0 простой мембер */
MEMBER,
/** 1 возможность изменять состав гильдии */
LINE_UP,
/** 2 возможность лазить в банк */
BANK,
/** 3 менять состав + банк */
LINE_UP_BANK,
/** 4 трогать титулы */
TITLE,
/** 5 менять состав гильдий и титулы */
LINE_UP_TITLE,
/** 6 лазить в банк и менять титулы */
BANK_TITLE,
/** 7 менять состав гильдии, титулы и лазить в банк */
LINE_UP_BANK_TITLE,
/** 8 */
UNKNOW1,
/** 9 */
UNKNOW2,
/** 10 */
UNKNOW3,
/** 11 */
UNKNOW4,
/** 12 */
UNKNOW5,
/** 13 */
UNKNOW6,
/** 14 */
UNKNOW7,
/** 15 */
UNKNOW8,
/** 16 начинать войну */
GVG,
/** 17 менять состав, начинать войну */
LINE_UP_GVG,
/** 18 */
UNKNOW9,
/** 19 менять состав и ГвГ */
LINE_UP_BANK_GVG,
/** 20 титул и ГвГ */
TITLE_GVG,
/** 21 изменять состав, титулы и ГвГ */
LINE_UP_TITLE_GVG,
/** 22 лазить в банк, титулы и ГвГ */
BANK_TITLE_GVG,
/** 23 бан, титулы и ГвГ */
LINE_UP_BANK_TITLE_GVG,
/** 24 все можно */
GUILD_MASTER;
/** массив всех наборов */
public static final GuildRankLaw[] VALUES = values();
public static GuildRankLaw valueOf(int index)
{
if(index < 0 || index >= VALUES.length)
return MEMBER;
GuildRankLaw rank = VALUES[index];
if(rank.name().contains("UNKNOW"))
return MEMBER;
return rank;
}
}
| [
"[email protected]"
] | |
44d3fc4b6e12176dbc998cf56ee2c08fc9a2aa15 | 8ad639f7054b1d8f887dd3bf59de0e6e6a74f47c | /api-server/src/main/java/com/clsaa/dop/server/api/config/FeignErrorDecoder.java | afec536d13a24bcc98ea0e37afbdc83d769fa83c | [] | no_license | doporg/dopv2 | d0bb691d90534a56d2255e768806f9c268efa5c0 | ea4d9ebe3a1122e617318f8578105ff14df1bc24 | refs/heads/master | 2022-12-12T01:03:18.846113 | 2020-09-24T02:31:06 | 2020-09-24T02:31:06 | 233,534,334 | 7 | 5 | null | 2022-12-06T00:46:18 | 2020-01-13T07:14:49 | Java | UTF-8 | Java | false | false | 1,541 | java | package com.clsaa.dop.server.api.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.clsaa.rest.result.exception.*;
import feign.Response;
import feign.Util;
import feign.codec.ErrorDecoder;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
/**
* 讲FeignException转换为标准业务异常
*
* @author joyren
*/
@Configuration
public class FeignErrorDecoder implements ErrorDecoder {
@Override
public Exception decode(String methodKey, Response response) {
try {
String body = Util.toString(response.body().asReader());
JSONObject jsonObject = JSON.parseObject(body);
int code = Integer.valueOf(String.valueOf(jsonObject.get("code")));
String msg = String.valueOf(jsonObject.get("message"));
switch (response.status()) {
case 400:
return new InvalidParameterException(code, msg);
case 403:
return new AccessDeniedException(code, msg);
case 404:
return new NotFoundException(code, msg);
case 417:
return new StandardBusinessException(code, msg);
case 401:
return new UnauthorizedException(code, msg);
default:
return new RuntimeException(body);
}
} catch (IOException ignored) {
}
return decode(methodKey, response);
}
} | [
"[email protected]"
] | |
0fdfa07ba36e92c5e850d26d4b121621f2b161f4 | 77a833b1440d910c0fe2731c440a2bb43a725e25 | /ama/src/main/java/com/itu/ama/amaProject/repository/HousingGroupRepository.java | 66e1f696df08bbe56a9437d2548e56c9f52cee25 | [] | no_license | AnanthChristy/apt-maint-app | 78b42d4531f5c05e31c8aacdb803866293cebf04 | c5939b721c3fcacca4fbb806270d5c03021dfbc5 | refs/heads/master | 2020-06-22T07:21:19.430263 | 2019-07-28T01:49:10 | 2019-07-28T01:49:10 | 197,669,993 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.itu.ama.amaProject.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.itu.ama.amaProject.model.HousingGroup;
public interface HousingGroupRepository extends JpaRepository<HousingGroup,Long> {
List<HousingGroup> findByGroupName(String name);
}
| [
"[email protected]"
] | |
f08bf1e467377c106abf22db7b8dc7d4538243e1 | f1fe7127e6046c6bd647bd95c10a93715bb398a9 | /CapoMazeCommons/src/pl/edu/agh/capo/maze/Node.java | a3fe9e1ff94682cfaa2ff173e90b976b24c35ee2 | [] | no_license | showmen15/CapoRobotFearBasedControl | 3b9668eb1993a8ee35ea31f20139e3072273acf6 | 03647a35bc1b3c5465d4f652fe0d856563d48905 | refs/heads/master | 2021-05-01T09:12:30.118739 | 2016-12-29T19:57:55 | 2016-12-29T19:57:55 | 53,355,685 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package pl.edu.agh.capo.maze;
public class Node {
private String id;
private String kind;
private Coordinates position;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public Coordinates getPosition() {
return position;
}
public void setPosition(Coordinates position) {
this.position = position;
}
}
| [
"[email protected]"
] | |
16745cae5b0de44b83f89ac1e5044d75b073d8c8 | d90ab218b89c3f22b4ffc0ae12b60b4fe0de9af0 | /jse/src/OOP/AnimalService.java | 444e8649c4769d0d8f9703fd7dd6b29aaeed20d4 | [] | no_license | kwonharry/jse_homework | 2bbc6d74b572e1470a71ab27644c2ba0406211f0 | 809d4f7028b1eec55cfbbb17157d50d35c3b6191 | refs/heads/master | 2021-01-10T08:01:43.181745 | 2016-02-17T00:40:20 | 2016-02-17T00:40:20 | 51,723,858 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 138 | java | package OOP;
public interface AnimalService {
public void bark();
public void eat();
public void run();
public void see();
}
| [
"user@user-PC"
] | user@user-PC |
29c1644f4864140d84b7fc7bda19cd62f32a6e5e | 09856edb80359c94154bf333a512211be40fd50c | /Java/06_Design_Patterns/structural/decorator/diveintodspt/DataSource.java | 06ec4165440df5f52ae8afc6d0e622421307ffd1 | [] | no_license | i-den/Courses | e76b4b9a713881f8b21f05cf2ab6203f472e5cd5 | 2aade397df33692b4d50a8c04e6e1e22a27e62d0 | refs/heads/master | 2023-01-23T22:24:08.185286 | 2020-11-29T08:42:04 | 2020-11-29T08:42:04 | 89,019,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package structural.decorator.diveintodspt;
public interface DataSource {
void writeData();
void readData();
}
| [
"[email protected]"
] | |
2fbf1c4ec3d16a6afb8574b3b4a616895e68aa61 | ecaf6e5714dbdf2dba49b93de944695dedee480d | /src/gphhucarp/algorithm/ccgp/CCGPHHProblem.java | 1cedd49f4e22bff9c6838ed2a75410bf405c9ba2 | [
"Apache-2.0"
] | permissive | meiyi1986/gpucarp | d0755f70a9541f081fad4f15b0a2a50c5c4ab833 | b3bd3d89edd6615150eeec8d0596f611c94636c2 | refs/heads/master | 2021-06-06T10:13:57.664892 | 2020-08-11T00:08:03 | 2020-08-11T00:08:03 | 129,506,372 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 5,185 | java | package gphhucarp.algorithm.ccgp;
import ec.EvolutionState;
import ec.Individual;
import ec.Population;
import ec.coevolve.GroupedProblemForm;
import ec.gp.GPIndividual;
import ec.multiobjective.MultiObjectiveFitness;
import ec.util.Parameter;
import gphhucarp.decisionprocess.routingpolicy.GPRoutingPolicy;
import gphhucarp.decisionprocess.routingpolicy.ensemble.Combiner;
import gphhucarp.decisionprocess.routingpolicy.ensemble.EnsemblePolicy;
import gphhucarp.gp.ReactiveGPHHProblem;
/**
* The CCGPHH problem.
* The problem evalutes a set of individuals together by forming an ensemble policy.
* Then it sets the fitness for all the indices to be updated.
* Finally, it updates the context vector and its fitness if better context vector is found.
*
*/
public class CCGPHHProblem extends ReactiveGPHHProblem implements GroupedProblemForm {
public static final String P_SHOULD_SET_CONTEXT = "set-context";
public static final String P_COMBINER = "combiner";
boolean shouldSetContext;
private Combiner combiner;
public Combiner getCombiner() {
return combiner;
}
public void setup(final EvolutionState state, final Parameter base) {
super.setup(state, base);
// load whether we should set context or not
shouldSetContext = state.parameters.getBoolean(base.push(P_SHOULD_SET_CONTEXT), null, true);
// load the combiner for the ensember routing policy
combiner = (Combiner)(
state.parameters.getInstanceForParameter(
base.push(P_COMBINER), null, Combiner.class));
}
@Override
public void preprocessPopulation(final EvolutionState state, Population pop, boolean[] prepareForAssessment, boolean countVictoriesOnly) {
}
@Override
public void postprocessPopulation(final EvolutionState state, Population pop, boolean[] assessFitness, boolean countVictoriesOnly) {
}
@Override
public void evaluate(final EvolutionState state,
final Individual[] ind, // the individuals to evaluate together
final boolean[] updateFitness, // should this individuals' fitness be updated?
final boolean countVictoriesOnly, // can be neglected in cooperative coevolution
int[] subpops,
final int threadnum) {
if (ind.length == 0)
state.output.fatal("Number of individuals provided to CoevolutionaryECSuite is 0!");
if (ind.length == 1)
state.output.warnOnce("Coevolution used, but number of individuals provided to CoevolutionaryECSuite is 1.");
for(int i = 0 ; i < ind.length; i++)
if ( ! ( ind[i] instanceof GPIndividual) )
state.output.error( "Individual " + i + "in coevolution is not a GPIndividual." );
state.output.exitIfErrors();
// create an ensemble routing policy based on the individuals
GPRoutingPolicy[] policies = new GPRoutingPolicy[ind.length];
for (int i = 0; i < policies.length; i++)
policies[i] = new GPRoutingPolicy(poolFilter, ((GPIndividual)ind[i]).trees[0]);
EnsemblePolicy ensemblePolicy = new EnsemblePolicy(poolFilter, policies, combiner);
MultiObjectiveFitness trialFit = (MultiObjectiveFitness)ind[0].fitness.clone();
evaluationModel.evaluate(ensemblePolicy, null, trialFit, state);
// update the fitness of the evaluated individuals
for (int i = 0; i < ind.length; i++) {
if (updateFitness[i])
((MultiObjectiveFitness)(ind[i].fitness)).setObjectives(state, trialFit.objectives);
}
// update the context vector if the trial fitness is better
CCGPHHEvolutionState ccgpState = (CCGPHHEvolutionState)state;
MultiObjectiveFitness contextFitness =
(MultiObjectiveFitness)ccgpState.getContext(0).fitness;
if (trialFit.betterThan(contextFitness)) {
for (int i = 0; i < ind.length; i++) {
((MultiObjectiveFitness)ind[i].fitness).setObjectives(state, trialFit.objectives);
ccgpState.setContext(i, ind[i]);
}
}
}
/**
* Evaluate the context vector.
* @param state the evolution state.
* @param ind the context vector as an array of individuals.
*/
public void evaluateContextVector(final EvolutionState state,
final Individual[] ind) {
// create an ensemble routing policy based on the individuals
GPRoutingPolicy[] policies = new GPRoutingPolicy[ind.length];
for (int i = 0; i < policies.length; i++)
policies[i] = new GPRoutingPolicy(poolFilter, ((GPIndividual)ind[i]).trees[0]);
EnsemblePolicy ensemblePolicy = new EnsemblePolicy(poolFilter, policies, combiner);
MultiObjectiveFitness trialFit = (MultiObjectiveFitness)ind[0].fitness.clone();
evaluationModel.evaluate(ensemblePolicy, null, trialFit, state);
for (Individual i : ind)
((MultiObjectiveFitness)(i.fitness)).setObjectives(state, trialFit.objectives);
}
}
| [
"[email protected]"
] | |
f4743bdb8d33664b7990b39d20b9870b1f412077 | dc0abedd6434fddf3b0081c4f0d818a93b915a14 | /code-g-maven-plugin/trunk/src/main/java/org/abstractmeta/toolbox/codegen/plugin/Descriptor.java | aa6bb3bd9aebe4091c6ff20e50a219121b9343b0 | [
"Apache-2.0"
] | permissive | zohirbenslama/code-g | 546e0d92dc8bee9fb778f3f8ee4c4327e5091a4c | 4629e57e905dc1d2aa439b5decad015969f67df2 | refs/heads/master | 2021-01-19T09:24:41.873411 | 2013-11-18T00:19:04 | 2013-11-18T00:19:04 | 32,510,583 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,899 | java | /**
* Copyright 2011 Adrian Witas
*
* 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 org.abstractmeta.toolbox.codegen.plugin;
import org.abstractmeta.code.g.config.NamingConvention;
import org.abstractmeta.code.g.core.config.DescriptorImpl;
import java.util.Properties;
/**
*
* Convenience class for maven plugin
* Represents code plugin configuration descriptor.
*
* @author Adrian Witas
*/
public class Descriptor {
private SourceMatcher sourceMatcher;
private NamingConvention namingConvention;
private String generatorClass;
private Properties properties;
public SourceMatcher getSourceMatcher() {
return sourceMatcher;
}
public NamingConvention getNamingConvention() {
return namingConvention;
}
public String getGeneratorClass() {
return generatorClass;
}
public Properties getProperties() {
return properties;
}
public void setSourceMatcher(SourceMatcher sourceMatcher) {
this.sourceMatcher = sourceMatcher;
}
public void setNamingConvention(NamingConvention namingConvention) {
this.namingConvention = namingConvention;
}
public void setGeneratorClass(String generatorClass) {
this.generatorClass = generatorClass;
}
public void setProperties(Properties properties) {
this.properties = properties;
}
}
| [
"abstractmeta@7b257d32-9133-9ba5-60da-1b10c5724092"
] | abstractmeta@7b257d32-9133-9ba5-60da-1b10c5724092 |
f48eaf6f3b610da9affa5999ac86e790f2573f50 | cdba0b72c969380b336607687533caef9af0a848 | /IdeaProjects/HelloWorld/HelloPitts/src/main/java/com/leetcode/number29/Solution.java | 67a25c1ba1105891d15fd648a1d9d093c7d51bbb | [] | no_license | lupx/LeetCode | 8fa246264349ad35c3f58dd69a95ebcabb95b28d | c3eed86bdda0ff9d3ca5ca07613feb97be133518 | refs/heads/master | 2021-01-10T07:41:45.965986 | 2016-01-11T23:21:58 | 2016-01-11T23:21:58 | 49,460,910 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,248 | java | package com.leetcode.number29;
/**
* Divide two integers without using multiplication, division and mod operator.
* If it is overflow, return MAX_INT.
*
* 什么时候会overflow?
* divisor是int,所以divisor不可能<1或者>-1,那么还有什么时候会溢出?!
* dividend == Integer.MIN_VALUE时,而divisor为-1. 那么相除后就会溢出.所以特殊对待!
*
* Created by PeixinLu on 15/10/1.
*/
public class Solution {
/**
* 用位移运算符,二分!这个题考察的其实是二分!!!
* 经过测试divisor不会给0, 所以不用考虑0的情况
* 什么时候会溢出?
* dividend == Integer.MIN_VALUE, 同时 divisor是-1时, 就会溢出! 就这一个情况!
* @param dividend
* @param divisor
* @return
*/
public static int divide(int dividend, int divisor) {
//溢出就出现在这里! 如果dividend为Integer.MIN_VALUE, divisor为-1, 那么除-1后就溢出
if(divisor == -1) {
if(dividend == Integer.MIN_VALUE) {
return Integer.MAX_VALUE;
}
}
int sign = 1;
if((dividend > 0 && divisor < 0)
||(dividend < 0 && divisor > 0)) sign = -1;
//直接两个正数算商,最后补上符号即可
long quo = 0;
long twice = 1;
long longDividendTmp = Math.abs((long)dividend);
long longDivisorTmp = Math.abs((long)divisor);
while(longDividendTmp > 0) {
while (longDivisorTmp << 1 < longDividendTmp) {
twice <<= 1;
longDivisorTmp <<= 1;
}
longDividendTmp -= longDivisorTmp;
quo += twice;
longDivisorTmp = Math.abs((long)divisor);
twice = 1L;
}
//longDividendTmp == 0的时候,说明刚好,那么quo就是所求
//longDividendTmp < 0的时候, 说明quo多算了一个, quo-1就是所求
return (int)(quo - (longDividendTmp == 0 ? 0 : 1)) * sign;
}
public static void main(String[] args) {
long startTime=System.nanoTime();
System.out.println(divide(-1,
1));
long endTime=System.nanoTime();
System.out.println(endTime-startTime);
}
}
| [
"[email protected]"
] | |
bd78c9a0cf60c01332dea65dd281a953807ce319 | 2aba63c943cfe39fe373f9134bb12d6d5e96dee7 | /ServidorTragamonedas/src/servidorTragamonedas/Controlador.java | ffc8718a5158abb41c157a5df8c0be3e04395931 | [] | no_license | ChristianTaborda/SlotMachine | f5d7a16bbbb8a0825f9f6f1fdf3620ab63b7c0d6 | 75439a4e7ddabe785f5326372e8ce55052e938f5 | refs/heads/main | 2023-02-10T19:05:15.077366 | 2020-12-30T02:42:29 | 2020-12-30T02:42:29 | 325,429,664 | 1 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 7,931 | java | /********************************************
* Christian Camilo Taborda Campiño *
* Código: 1632081-3743 *
* Fecha de creación: 12/05/2017 *
* Fecha de última modificación: 20/05/2017 *
* ******************************************
*/
package servidorTragamonedas;
import java.util.Random;
public class Controlador{
//ATRIBUTOS:
private static final int FILAS = 3, COLUMNAS = 5;
private int[][] tablero;
private int[][] pagos;
//Inicializa la matriz de pagos:
public void initPagos(){
pagos = new int[12][6];
pagos[0][2] = 5;
pagos[0][3] = 50;
pagos[0][4] = 250;
pagos[0][5] = 2500;
pagos[1][2] = 2;
pagos[1][3] = 25;
pagos[1][4] = 100;
pagos[1][5] = 500;
pagos[2][2] = 2;
pagos[2][3] = 20;
pagos[2][4] = 80;
pagos[2][5] = 400;
pagos[3][2] = 2;
pagos[3][3] = 5;
pagos[3][4] = 25;
pagos[3][5] = 100;
pagos[4][3] = 10;
pagos[4][4] = 75;
pagos[4][5] = 350;
pagos[5][3] = 10;
pagos[5][4] = 50;
pagos[5][5] = 250;
pagos[6][3] = 10;
pagos[6][4] = 50;
pagos[6][5] = 200;
pagos[7][3] = 5;
pagos[7][4] = 50;
pagos[7][5] = 125;
pagos[8][3] = 5;
pagos[8][4] = 25;
pagos[8][5] = 125;
pagos[9][3] = 5;
pagos[9][4] = 25;
pagos[9][5] = 100;
pagos[10][3] = 5;
pagos[10][4] = 25;
pagos[10][5] = 100;
pagos[11][3] = 10;
pagos[11][4] = 25;
pagos[11][5] = 75;
}
//Genera un tablero aleatorio:
public void generarTablero(){
Random aleatorio = new Random();
int comodines = 0;
for(int x=0; x<FILAS; x++){
for(int y=0; y<COLUMNAS; y++){
do{
tablero[x][y] = aleatorio.nextInt(12);
if(tablero[x][y] == 11){
comodines++;
}
//Control de comodines:
}while(!(comodines <= 3));
}
}
}
//Constructor:
public Controlador(){
tablero = new int[FILAS][COLUMNAS];
generarTablero();
initPagos();
}
//Construye y retorna una cadena con la información del tablero:
public String getTablero(){
String salida = "";
for(int x=0; x<FILAS; x++){
for(int y=0; y<COLUMNAS; y++){
switch(tablero[x][y]){
case 10:
salida += "A";
break;
case 11:
salida += "B";
break;
default:
salida += tablero[x][y];
break;
}
}
}
return salida;
}
//Retorna el número que genera el match de una jugada:
public int buscarMatch(int A, int B, int C, int D, int E){
int match;
if(A == 11){
if(B == 11){
if(C == 11){
match = D;
}else{
match = C;
}
}else{
match = B;
}
}else{
match = A;
}
return match;
}
//Indica si una jugada es de combinación o simple:
public boolean tipoMatch(int match, int[] fichas){
boolean salida = false;
if(match == 2 || match == 3){
for(int x=0; x<fichas.length; x++){
if(match != fichas[x] && fichas[x] != 11){
salida = true;
}
}
}
return salida;
}
//Extrae los números participantes en una jugada:
public int[] getMatch(int match, int[] fichas, int cantidad){
int contador = 0;
int[] salida = new int[cantidad];
for(int x=0; x<COLUMNAS; x++){
if(match == 3 || match == 2){
if((fichas[x] == 3 || fichas[x] == 11 || fichas[x] == 2) && contador == x){
salida[x] = fichas[x];
contador++;
}
}else{
if((fichas[x] == match || fichas[x] == 11) && contador == x){
salida[x] = fichas[x];
contador++;
}
}
}
return salida;
}
//Retorna el tamaño de una jugada:
public int contarMatch(int match, int[] fichas){
int salida = 0;
for(int x=0; x<COLUMNAS; x++){
if(match == 3 || match == 2){
if((fichas[x] == 3 || fichas[x] == 11 || fichas[x] == 2) && salida == x){
salida++;
}
}else{
if((fichas[x] == match || fichas[x] == 11) && salida == x){
salida++;
}
}
}
return salida;
}
//Retorna el pago acordado por tipo y cantidad:
public int recibirPago(int match, int cantidad){
return pagos[match][cantidad];
}
//Retorna las ganancias de una jugada y su tamaño:
public String revisarLinea(int A, int B, int C, int D, int E){
int pago = 0;
int match = buscarMatch(A,B,C,D,E);
int[] fichas = {A,B,C,D,E};
int cantidad = contarMatch(match,fichas);
boolean tipo = false;
//Validación del tamaño necesario por jugada:
if(match >= 0 && match < 4){
if(cantidad >= 2){
tipo = tipoMatch(match,getMatch(match,fichas,cantidad));
if(tipo){
if(cantidad >= 3){
pago += recibirPago(11,cantidad);
}
}else{
pago += recibirPago(match,cantidad);
}
}
}else{
if(cantidad >= 3){
pago += recibirPago(match,cantidad);
}
}
String salida;
//Validación de las ganancias:
if(pago != 0){
salida = pago + "-" + cantidad;
}else{
salida = String.valueOf(pago);
}
return salida;
}
//Retorna las ganancias obtenidas por una línea y los datos de la jugada:
public String obtenerGanancias(int lineas){
int ganancias = 0;
String salida = "";
if(lineas >= 1){
String[] paquete = revisarLinea(tablero[1][0],tablero[1][1],tablero[1][2],tablero[1][3],tablero[1][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 1 + "_" + paquete[1];
}
}
if(lineas >= 2){
String[] paquete = revisarLinea(tablero[0][0],tablero[0][1],tablero[0][2],tablero[0][3],tablero[0][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 2 + "_" + paquete[1];
}
}
if(lineas >= 3){
String[] paquete = revisarLinea(tablero[2][0],tablero[2][1],tablero[2][2],tablero[2][3],tablero[2][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 3 + "_" + paquete[1];
}
}
if(lineas >= 4){
String[] paquete = revisarLinea(tablero[0][0],tablero[1][1],tablero[2][2],tablero[1][3],tablero[0][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 4 + "_" + paquete[1];
}
}
if(lineas >= 5){
String[] paquete = revisarLinea(tablero[2][0],tablero[1][1],tablero[0][2],tablero[1][3],tablero[2][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 5 + "_" + paquete[1];
}
}
if(lineas >= 6){
String[] paquete = revisarLinea(tablero[0][0],tablero[0][1],tablero[1][2],tablero[2][3],tablero[2][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 6 + "_" + paquete[1];
}
}
if(lineas >= 7){
String[] paquete = revisarLinea(tablero[2][0],tablero[2][1],tablero[1][2],tablero[0][3],tablero[0][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 7 + "_" + paquete[1];
}
}
if(lineas >= 8){
String[] paquete = revisarLinea(tablero[1][0],tablero[2][1],tablero[1][2],tablero[0][3],tablero[1][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 8 + "_" + paquete[1];
}
}
if(lineas >= 9){
String[] paquete = revisarLinea(tablero[1][0],tablero[0][1],tablero[1][2],tablero[2][3],tablero[1][4]).split("-");
ganancias += Integer.parseInt(paquete[0]);
if(paquete.length != 1){
if(!salida.equals("")){
salida += "-";
}
salida += 9 + "_" + paquete[1];
}
}
//Validación de la cantidad de ganancias:
if(ganancias == 0){
return ganancias + " Nel";
}else{
return ganancias + " " + salida;
}
}
}
| [
"[email protected]"
] | |
4340476b5298a2e66d24fe1c00b459bb2adbd886 | 1cdc93f9adc4dc93fb6b22e75096554796aa1cb7 | /matisse/build/generated/source/r/debug/android/support/graphics/drawable/R.java | 4d987e2860e8ebe7542e2768696747e887105e09 | [
"Apache-2.0"
] | permissive | huangjingqiang/matisse_android | b7347101fb94ef84a441673017e700344f00e144 | a560d9ac6a7e9d5545377f5cde37a13550c7f7ef | refs/heads/master | 2020-03-22T23:52:38.238064 | 2018-07-13T10:28:06 | 2018-07-13T10:28:06 | 140,832,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,324 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.graphics.drawable;
public final class R {
public static final class attr {
public static int font = 0x7f040082;
public static int fontProviderAuthority = 0x7f040084;
public static int fontProviderCerts = 0x7f040085;
public static int fontProviderFetchStrategy = 0x7f040086;
public static int fontProviderFetchTimeout = 0x7f040087;
public static int fontProviderPackage = 0x7f040088;
public static int fontProviderQuery = 0x7f040089;
public static int fontStyle = 0x7f04008a;
public static int fontWeight = 0x7f04008b;
}
public static final class bool {
public static int abc_action_bar_embed_tabs = 0x7f050001;
}
public static final class color {
public static int notification_action_color_filter = 0x7f060057;
public static int notification_icon_bg_color = 0x7f060058;
public static int ripple_material_light = 0x7f060065;
public static int secondary_text_default_material_light = 0x7f060067;
}
public static final class dimen {
public static int compat_button_inset_horizontal_material = 0x7f08004d;
public static int compat_button_inset_vertical_material = 0x7f08004e;
public static int compat_button_padding_horizontal_material = 0x7f08004f;
public static int compat_button_padding_vertical_material = 0x7f080050;
public static int compat_control_corner_material = 0x7f080051;
public static int notification_action_icon_size = 0x7f080064;
public static int notification_action_text_size = 0x7f080065;
public static int notification_big_circle_margin = 0x7f080066;
public static int notification_content_margin_start = 0x7f080067;
public static int notification_large_icon_height = 0x7f080068;
public static int notification_large_icon_width = 0x7f080069;
public static int notification_main_column_padding_top = 0x7f08006a;
public static int notification_media_narrow_margin = 0x7f08006b;
public static int notification_right_icon_size = 0x7f08006c;
public static int notification_right_side_padding_top = 0x7f08006d;
public static int notification_small_icon_background_padding = 0x7f08006e;
public static int notification_small_icon_size_as_large = 0x7f08006f;
public static int notification_subtext_size = 0x7f080070;
public static int notification_top_pad = 0x7f080071;
public static int notification_top_pad_large_text = 0x7f080072;
}
public static final class drawable {
public static int notification_action_background = 0x7f090064;
public static int notification_bg = 0x7f090065;
public static int notification_bg_low = 0x7f090066;
public static int notification_bg_low_normal = 0x7f090067;
public static int notification_bg_low_pressed = 0x7f090068;
public static int notification_bg_normal = 0x7f090069;
public static int notification_bg_normal_pressed = 0x7f09006a;
public static int notification_icon_background = 0x7f09006b;
public static int notification_template_icon_bg = 0x7f09006c;
public static int notification_template_icon_low_bg = 0x7f09006d;
public static int notification_tile_bg = 0x7f09006e;
public static int notify_panel_notification_icon_bg = 0x7f09006f;
}
public static final class id {
public static int action_container = 0x7f0c0009;
public static int action_divider = 0x7f0c000b;
public static int action_image = 0x7f0c000c;
public static int action_text = 0x7f0c0012;
public static int actions = 0x7f0c0013;
public static int async = 0x7f0c001b;
public static int blocking = 0x7f0c001c;
public static int chronometer = 0x7f0c0029;
public static int forever = 0x7f0c0039;
public static int icon = 0x7f0c003d;
public static int icon_group = 0x7f0c003e;
public static int info = 0x7f0c0041;
public static int italic = 0x7f0c0042;
public static int line1 = 0x7f0c0045;
public static int line3 = 0x7f0c0046;
public static int normal = 0x7f0c004f;
public static int notification_background = 0x7f0c0050;
public static int notification_main_column = 0x7f0c0051;
public static int notification_main_column_container = 0x7f0c0052;
public static int right_icon = 0x7f0c005c;
public static int right_side = 0x7f0c005d;
public static int tag_transition_group = 0x7f0c007b;
public static int text = 0x7f0c007c;
public static int text2 = 0x7f0c007d;
public static int time = 0x7f0c0080;
public static int title = 0x7f0c0081;
}
public static final class integer {
public static int status_bar_notification_info_maxnum = 0x7f0d0005;
}
public static final class layout {
public static int notification_action = 0x7f0f0025;
public static int notification_action_tombstone = 0x7f0f0026;
public static int notification_template_custom_big = 0x7f0f002d;
public static int notification_template_icon_group = 0x7f0f002e;
public static int notification_template_part_chronometer = 0x7f0f0032;
public static int notification_template_part_time = 0x7f0f0033;
}
public static final class string {
public static int status_bar_notification_info_overflow = 0x7f150039;
}
public static final class style {
public static int TextAppearance_Compat_Notification = 0x7f1600f1;
public static int TextAppearance_Compat_Notification_Info = 0x7f1600f2;
public static int TextAppearance_Compat_Notification_Line2 = 0x7f1600f4;
public static int TextAppearance_Compat_Notification_Time = 0x7f1600f7;
public static int TextAppearance_Compat_Notification_Title = 0x7f1600f9;
public static int Widget_Compat_NotificationActionContainer = 0x7f160164;
public static int Widget_Compat_NotificationActionText = 0x7f160165;
}
public static final class styleable {
public static int[] FontFamily = { 0x7f040084, 0x7f040085, 0x7f040086, 0x7f040087, 0x7f040088, 0x7f040089 };
public static int FontFamily_fontProviderAuthority = 0;
public static int FontFamily_fontProviderCerts = 1;
public static int FontFamily_fontProviderFetchStrategy = 2;
public static int FontFamily_fontProviderFetchTimeout = 3;
public static int FontFamily_fontProviderPackage = 4;
public static int FontFamily_fontProviderQuery = 5;
public static int[] FontFamilyFont = { 0x01010532, 0x0101053f, 0x01010533, 0x7f040082, 0x7f04008a, 0x7f04008b };
public static int FontFamilyFont_android_font = 0;
public static int FontFamilyFont_android_fontStyle = 1;
public static int FontFamilyFont_android_fontWeight = 2;
public static int FontFamilyFont_font = 3;
public static int FontFamilyFont_fontStyle = 4;
public static int FontFamilyFont_fontWeight = 5;
}
}
| [
"[email protected]"
] | |
1f9a230270404c51965797e988166300a18886f0 | a4b702d8ba9910d96e3ad64dff018cdeb5d11592 | /src/mvc_crud/dao/CustomerDAOImpl.java | c2dd85466c5d6afdfc91e1a82481527a3e5019e3 | [] | no_license | redikx/mvc-crud | d7b4c94e0c2a62b80424b7ab1cc0243bc7a942b8 | 5d3abb6d0f5a2a6574672cfc48c554d1efe6b7e7 | refs/heads/master | 2020-03-24T21:48:49.011223 | 2018-09-22T23:35:57 | 2018-09-22T23:35:57 | 143,051,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,955 | java | package mvc_crud.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import mvc_crud.entities.Customer;
@Repository
public class CustomerDAOImpl implements CustomerDAO {
@Autowired
private SessionFactory sessionFactory;
@Override
public List<Customer> getCustomers() {
Session session = sessionFactory.getCurrentSession();
Query<Customer> thisQuery = session.createQuery("from Customer order by last_name", Customer.class);
List<Customer> customers = thisQuery.getResultList();
return customers;
}
@Override
public void saveCustomer(Customer addedCustomer) {
Session session = sessionFactory.getCurrentSession();
session.saveOrUpdate(addedCustomer);
}
@Override
public Customer getCustomer(int id) {
Session session = sessionFactory.getCurrentSession();
Customer customer = session.get(Customer.class, id);
return customer; }
@Override
@Transactional
public void deleteCustomer(int id) {
Session session = sessionFactory.getCurrentSession();
Query theQuery = session.createQuery("delete from Customer where id = :theCustomerId");
theQuery.setParameter("theCustomerId", id);
theQuery.executeUpdate();
}
@Override
@Transactional
public List<Customer> searchCustomers(String theSearchName) {
Session session = sessionFactory.getCurrentSession();
Query theQuery = null;
if (theSearchName != null && theSearchName.trim().length() > 0 ) {
theQuery = session.createQuery("from Customer where lower(firstName) like lower(:theName) or lower(lastName) like lower(:theName)",Customer.class);
theQuery.setParameter("theName", "%" + theSearchName+ "%");
}
List<Customer> customers = theQuery.getResultList();
return customers;
}
}
| [
"[email protected]"
] | |
e9eecc0dc7146221a2090e7c5010fb5ac9c32ae4 | d47f6740fe83d8d2b48fdc7eea2912b54959c043 | /web09/src/com/bdqn/zmj/entity/User.java | a0059604332e7d7cdb74f0af6d425a0c81dc4ed0 | [] | no_license | creing/silver-barnacle | b9117dafc3dc48443d89c724c4530ef1f198a3d8 | fedb8f0512fa8b3b2fd4738b5dba13a553c11b31 | refs/heads/master | 2020-04-27T10:27:59.947715 | 2019-03-07T02:47:55 | 2019-03-07T03:39:10 | 174,255,035 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 487 | java | package com.bdqn.zmj.entity;
/*
* Óû§Àà
*/
public class User {
private int uid;
private String uname;
private String upwd;
public void setUid(int uid) {
this.uid = uid;
}
public void setUname(String uname) {
this.uname = uname;
}
public void setUpwd(String upwd) {
this.upwd = upwd;
}
public int getUid() {
return uid;
}
public String getUname() {
return uname;
}
public String getUpwd() {
return upwd;
}
}
| [
"[email protected]"
] | |
2ab5b741517f6153111e0ac4b168a8fa46d27916 | ee00731f920da906a10d94e52e05e75aada62c55 | /NorwegianRailsapp/app/src/main/java/com/oslomet/norwegianrails/datasource/AppController.java | 9a1be44f7658cb434a73d9f3f539012ee98e88e6 | [] | no_license | niksam99/norwegianRails | 94a238b9a799196a9e205657a741ca9fffe49926 | c70016ceaffa01d8c7ae8e9608b4b69a7f39c12d | refs/heads/master | 2020-09-16T08:33:47.481122 | 2019-11-24T09:50:05 | 2019-11-24T09:50:05 | 223,713,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,343 | java | package com.oslomet.norwegianrails.datasource;
import android.app.Application;
import android.content.Context;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import androidx.multidex.MultiDex;
public class AppController extends Application {
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(newBase);
MultiDex.install(this);
}
public static final String TAG = AppController.class.getSimpleName();
private RequestQueue mRequestQueue;
private static AppController mInstance;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized AppController getInstance() {
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
} | [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.