blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 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 listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4fce7f754d0b42ad49e33246e8e5d64b062efb69 | b45a057b52344497f800d247c8aca9ec890c2714 | /holly-chains-mobile/src/main/java/com/bt/chains/service/ValidationService.java | c39bd2ac2c6a7973ee23795fa8aced43e1c4cf67 | [] | no_license | scorpiopapa/game-hollychains | 8f6269663dddf7749066c30583a6eab01e4c5b95 | fc39e8b21d379dc8a89083913e2ef2a407de6368 | refs/heads/master | 2020-06-02T01:27:10.053166 | 2014-09-27T09:40:08 | 2014-09-27T09:40:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,876 | java | package com.bt.chains.service;
import java.util.Date;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bt.chains.bean.domain.User;
import com.bt.chains.bean.domain.UserAuth;
import com.bt.chains.bean.domain.UserProp;
import com.bt.chains.constant.DBConstants;
import com.bt.chains.constant.ErrorCodeConstants;
import com.bt.chains.exception.RequestException;
import com.bt.chains.mapper.UserMapper;
import com.bt.chains.util.DBUtils;
@Service
public class ValidationService {
private final static Logger log = LoggerFactory.getLogger(ValidationService.class);
@Autowired
private UserMapper userMapper;
public void validateBindStatus(int userId) throws RequestException{
User user = userMapper.selectUser(userId);
if(user == null){
throw new RequestException(ErrorCodeConstants.USER_NOEXISTS, ErrorCodeConstants.USER_NOEXISTS_MSG);
}
}
public UserAuth validateBindDevice(int userId, String code) throws RequestException {
validateBindStatus(userId);
UserAuth userAuth = userMapper.selectUserAuth(userId);
if(userAuth == null){
throw new RequestException(ErrorCodeConstants.INVALID_MIGRATE, ErrorCodeConstants.INVALID_MIGRATE_MSG);
}
Date createDate = userAuth.getCreateDate();
Date expireDate = DateUtils.addDays(createDate, DBConstants.codeExpired.expiredDate);
Date today = DBUtils.getCurrentTimestamp();
if(today.compareTo(expireDate) >= 0){
//่ฟๆ
throw new RequestException(ErrorCodeConstants.CODE_EXPIRED, ErrorCodeConstants.CODE_EXPIRED_MSG);
}
if(!userAuth.getCode().equalsIgnoreCase(code)){
throw new RequestException(ErrorCodeConstants.CODE_MISMATCH, ErrorCodeConstants.CODE_MISMATCH_MSG);
}
return userAuth;
}
/**
* ๅคๆญๅฎ็ณๆฏๅฆๅ
่ถณ
* @throws RequestException
*/
public void validateGem(int userId, int gemNumber) throws RequestException {
User user = userMapper.selectUser(userId);
int specialMoney = user.getSpecialMoney();
if(specialMoney < gemNumber){
throw new RequestException(ErrorCodeConstants.NOT_ENOUGH_GEM, ErrorCodeConstants.NOT_ENOUGH_GEM_MSG);
}
}
/**
* ๅคๆญๆญฆๅจๅถ้ ๅธๆฏๅฆๅ
่ถณ
* @throws RequestException
*/
public void validateWeaponSecurities(int userId, int number) throws RequestException {
//่ทๅ็จๆทๆญฆๅจๅถ้ ๅธไธชๆฐ
UserProp up = new UserProp();
up.setUserId(userId);
up.setPropType("3");
int count = userMapper.queryUserPropCount(up);
int weaponSecurities = 0;
if(count > 0){
weaponSecurities = userMapper.queryUserPropNum(userId, "3");
}
if(weaponSecurities < number){
throw new RequestException(ErrorCodeConstants.NOT_ENOUGH_WEAPON_SECURITIES, ErrorCodeConstants.NOT_ENOUGH_WEAPON_SECURITIES_MSG);
}
}
}
| [
"liliang2005@gmail.com"
] | liliang2005@gmail.com |
86460278b226c53755b951edf294a07e3ed823b6 | 4e815e0947989b9890a3f9ee5a096e16e8d787ca | /src/restaurant/food/service/FoodServiceImpl.java | 6f66255191139b0319f212605fe2022633af3dad | [] | no_license | Areum120/Jdbc_RestaurantManagement | 329817c68052f195e4a5f5cd3c34cb769d6a9de5 | 852b26fe8f54bec588d147beb6b48a84ac75c879 | refs/heads/master | 2023-02-26T22:08:20.212858 | 2021-02-08T05:31:53 | 2021-02-08T05:31:53 | 335,913,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,140 | java | package restaurant.food.service;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import restaurant.food.dao.FoodDao;
import restaurant.food.dao.FoodDaoImpl;
import restaurant.food.vo.Food;
import restaurant.food.vo.Ingredient;
import restaurant.supplier.SupplyServiceImpl;
/**
*
* @author Han
*
*/
public class FoodServiceImpl implements FoodService {
private FoodDao dao = new FoodDaoImpl(); //์์ ํจ
private SupplyServiceImpl supply_service = new SupplyServiceImpl(); //์์ ํจ
ArrayList<Ingredient> suppList = restaurant.supplier.dao.SupplyDaoImpl.getInstance().getIngredients();
public FoodServiceImpl() {
}
public FoodDao getDao() {
return dao;
}
/**
* @param scanner๋ก ์์ ์ด๋ฆ/๊ฐ๊ฒฉ/์ฌ๋ฃ ์ด๋ฆ/์ฌ๋ฃ ์๋ ์
๋ ฅ๋ฐ์
* void : ์
๋ ฅ ๋ฐ์ Food ๊ฐ์ฒด๋ฅผ ์ถ๊ฐํจ
*/
@Override
public void addFood(Scanner sc) {
ArrayList<Ingredient> ingredients;
System.out.println("========= ์๋ฆฌ ๋ฑ๋ก =========");
System.out.print("์๋ฆฌ ์ด๋ฆ : ");
String foodName = sc.next();
System.out.print("๊ฐ๊ฒฉ : ");
int price = sc.nextInt();
boolean flag = true;
String ingName = null;
int tempName;
int ingCnt;
Map<String, Integer> temp = new HashMap<>();
while(flag) {
System.out.print("1.์ฌ๋ฃ ์
๋ ฅ 2. ์
๋ ฅ ์ข
๋ฃ");
int num = sc.nextInt();
switch (num) {
case 1:
//์ฌ๋ฃ ๋ฆฌ์คํธ ๋ณด์ฌ์ฃผ๊ณ ์ ํ
supply_service.getAllIng();
System.out.println("์ฌ๋ฃ ๋ฒํธ : ");
tempName = sc.nextInt();
// ์์ธ์ฒ๋ฆฌ : ๋ฐฐ์ด์ ๊ธธ์ด๋ฅผ ๋์ด๊ฐ๊ฒฝ์ฐ
try {
if(tempName == suppList.get(tempName-1).getIdx());
}catch (IndexOutOfBoundsException e) {
System.out.println("์๋ ์ฌ๋ฃ์
๋๋ค. ๋ค์ ์ ํํด์ฃผ์ธ์");
break;
}
//์ ํจ์ฑ๊ฒ์ฆ : ๋์ฅ๊ณ ์ ์๋ ์ฌ๋ฃ์ ์
๋ ฅ๋ฐ์ ์ฌ๋ฃ๊ฐ ๊ฐ์ผ๋ฉด ์๋์ ๋ฐ์
if(tempName == suppList.get(tempName-1).getIdx()) {
ingName = suppList.get(tempName-1).getName();
System.out.println("ํ์ ์๋ : ");
ingCnt = sc.nextInt();
if(ingCnt > 0) {
temp.put(ingName, ingCnt);
System.out.println("์ฌ๋ฃ๋ฅผ ์
๋ ฅํ์์ต๋๋ค!");
}else {
System.out.println("์๋์ด ์์ต๋๋ค!");
}
}else{
System.out.println("์๋ ์ฌ๋ฃ์
๋๋ค. ๋ค์ ์ ํํด์ฃผ์ธ์.");
}
break;
case 2:
flag = false;
break;
default:
System.out.println("๋ฒํธ๋ฅผ ์ ํํ ์
๋ ฅํด์ฃผ์ธ์!");
break;
}
}
Food f = new Food(foodName, price, temp);
//ArrayList๋ก ํ๋ฉด ์ฌ๋ฃ ๊ฐ์๊ฐ ๋ฑ๋ก์ด ์๋๋ค.
//๋ง์ฝ ๊ฐ์๋ฅผ ๋ฑ๋กํ๋ ค๋ฉด Ingredient ํ๋์ ์นด์ดํธ๋ฅผ ์ถ๊ฐํด์ผ๋๋ค.
//์ค๊ณ์ ๊ทธ๊ฑด ๋ณ๋ก์ธ ๊ฒ ๊ฐ๋ค.
dao.insert(f);
}
/**
* ์ธ๋ฑ์ค๋ก ์์์ ์ฐพ์ ๋ฐํํ๋ ๋ฉ์๋
* @param : ์ฐพ๊ณ ์ ํ๋ ์์์ idx
* @return : ์
๋ ฅ๋ idx์ ์ผ์นํ๋ ์์์ ๋ฐํ, ์ฐพ์ง ๋ชปํ ๊ฒฝ์ฐ null ๋ฐํ
*/
@Override
public Food getFoodByIdx(int idx) {
Food tempFood = dao.searchByIdx(idx);
if(tempFood != null){
return tempFood;
}else {
System.out.println("๋ฒํธ๋ฅผ ์๋ชป ์
๋ ฅํ์์ต๋๋ค.");
}
return null;
}
/**
* @return : ์์์ ์ ๋ถ ๋ฐํ, ์๋ ๊ฒฝ์ฐ null ๋ฐํ
*/
@Override
public ArrayList<Food> getAllFood() {
ArrayList<Food> foods = dao.getAllFood();
if(foods != null) {
return dao.getAllFood();
}else {
System.out.println("๋ฑ๋ก๋ ์๋ฆฌ๊ฐ ํ๋๋ ์์ต๋๋ค.");
}
return null;
}
/**
* ์ธ๋ฑ์ค๋ก ์์์ ์ฐพ์ ์ถ๋ ฅํ๋ ๋ฉ์๋
* @param : ์ฐพ๊ณ ์ ํ๋ ์์์ idx
* void : ์
๋ ฅ๋ idx์ ์ผ์นํ๋ ์์์ ์ถ๋ ฅ
*/
@Override
public void printFoodByIdx(Scanner sc) {
System.out.println("");
int idx = sc.nextInt();
Food tempFood = this.getFoodByIdx(idx);
if(tempFood != null){
System.out.println(tempFood);
}else {
System.out.println("ํด๋นํ๋ ์๋ฆฌ๊ฐ ์์ต๋๋ค.");
}
}
/**
* void : ๋ชจ๋ ์์์ ์ถ๋ ฅ
*/
@Override
public void printAllFood() {
ArrayList<Food> foods = this.getAllFood();
if(foods != null) {
for(Food f : foods) {
System.out.println(f);
}
}
}
/**
* @param : scanner๋ก ์์ ๋ฒํธ/์์ ๊ฐ๊ฒฉ ์
๋ ฅ ๋ฐ์
* void : ์
๋ ฅ๋ฐ์ ๋ฒํธ์ ์์์ ๊ฐ๊ฒฉ์ ๋ณ๊ฒฝ
*/
@Override
public void changePriceByIdx(Scanner sc) {
System.out.println("========= ์๋ฆฌ ๊ฐ๊ฒฉ ์์ =========");
this.printAllFood();
System.out.println("========= ========= =========");
System.out.print("์์ ํ ์๋ฆฌ ๋ฒํธ: ");
int num = sc.nextInt();
if(num > getDao().getAllFood().size() || num <=0) {
System.out.println("์
๋ ฅ ๋ฒํธ๋ฅผ ๋ค์ ํ์ธํด์ฃผ์ธ์.");
}else {
try {
if(num != this.getFoodByIdx(num).getIdx());
}catch (ArrayIndexOutOfBoundsException e) {
System.out.println("์๋ ๋ฒํธ ์
๋๋ค. ๋ค์ ํ์ธํด์ฃผ์ธ์!!");
}
if(num == this.getFoodByIdx(num).getIdx()) {
System.out.print("์ ๊ฐ๊ฒฉ : ");
int price = sc.nextInt();
if(price > 0) {
dao.updatePrice(num, price);
}
}
}
}
/**
* @param : scanner๋ก ๋ณ๊ฒฝํ ์์ ๋ฒํธ/๋ณ๊ฒฝํ ์ฌ๋ฃ ์ด๋ฆ ์
๋ ฅ ๋ฐ์
* void : ์
๋ ฅ๋ฐ์ ์์ ์ฌ๋ฃ์ ์๋์ ๋ณ๊ฒฝ
*/
@Override
public void changeFoodNameByIdx(Scanner sc) {
System.out.println("========= ์๋ฆฌ ์ด๋ฆ ๋ณ๊ฒฝ =========");
this.printAllFood();
System.out.println("========= ========= =========");
System.out.print("์ด๋ฆ ๋ณ๊ฒฝํ ์๋ฆฌ ๋ฒํธ: ");
int num = sc.nextInt();
if(num > getDao().getAllFood().size() || num <=0) {
System.out.println("์
๋ ฅ ๋ฒํธ๋ฅผ ๋ค์ ํ์ธํด์ฃผ์ธ์.");
}else {
try {
if(num == this.getFoodByIdx(num).getIdx());
}catch (IndexOutOfBoundsException e) {
System.out.println("์๋ ๋ฒํธ ์
๋๋ค. ๋ค์ ํ์ธํด์ฃผ์ธ์!");
}
if(num == this.getFoodByIdx(num).getIdx()) {
System.out.println("์๋ก์ด ์๋ฆฌ ์ด๋ฆ: ");
String name = sc.next();
if(name != null) {
dao.updateName(num, name);
}
}else {
System.out.println("๋ฒํธ๋ฅผ ์๋ชป ์
๋ ฅํ์์ต๋๋ค.");
}
}
}
/**
* @param : scanner๋ก ์ฌ๋ฃ ์ด๋ฆ/์ฌ๋ฃ ์๋ ์
๋ ฅ ๋ฐ์
* @return : ์
๋ ฅ๋ฐ์ ์ฌ๋ฃ๋ฅผ map์ผ๋ก ๋ฐํ
*/
@Override
public Map<String, Integer> addIng(Scanner sc) {
int tempName, ingCnt;
String ingName = null;
Map<String, Integer> temp = new HashMap<>();
System.out.println("========= ========= =========");
supply_service.getAllIng(); //๊ณต๊ธ์ฒ ์ฌ๋ฃ ๋ฆฌ์คํธ ๋ณด์ฌ์ค
System.out.println("์ฌ๋ฃ ๋ฒํธ : ");
tempName = sc.nextInt();
if(tempName > suppList.size() || tempName <=0) {
System.out.println("์
๋ ฅ ๋ฒํธ๋ฅผ ๋ค์ ํ์ธํด์ฃผ์ธ์.");
return null;
}else {
//์ ํจ์ฑ๊ฒ์ฆ
if(tempName == suppList.get(tempName-1).getIdx()) {
ingName = suppList.get(tempName-1).getName();
System.out.println("ํ์ ์๋ : ");
ingCnt = sc.nextInt();
if(ingCnt > 0) {
temp.put(ingName, ingCnt);
System.out.println("์ฌ๋ฃ๋ฅผ ์
๋ ฅํ์์ต๋๋ค!");
}else {
System.out.println("์๋์ด ์์ต๋๋ค!");
}
}else{
System.out.println("์๋ ์ฌ๋ฃ์
๋๋ค. ๋ค์ ์ ํํด์ฃผ์ธ์.");
}
return temp;
}
}
/**
* @param : scanner๋ก ์ฌ๋ฃ ์ถ๊ฐํ ์์ ๋ฒํธ ์
๋ ฅ ๋ฐ์
* void : ์
๋ ฅ๋ฐ์ ์ฌ๋ฃ๋ฅผ ์ถ๊ฐ
*/
@Override
public void addIngByIdx(Scanner sc) {
Map<String, Integer> temp = null;
System.out.println("========= ์๋ฆฌ ์ฌ๋ฃ ์ถ๊ฐ =========");
this.printAllFood();
System.out.println("========= ========= =========");
System.out.print("์ฌ๋ฃ ์ถ๊ฐํ ์๋ฆฌ ๋ฒํธ: ");
int num = sc.nextInt();
if(num > getDao().getAllFood().size() || num <=0) {
System.out.println("์
๋ ฅ ๋ฒํธ๋ฅผ ๋ค์ ํ์ธํด์ฃผ์ธ์.");
}else {
if(num == dao.searchByIdx(num).getIdx()) {
temp = this.addIng(sc);
if(temp == null) { //์ฌ๋ฃ ๋ฆฌ์คํธ ๋ฐ์ ๊ฐ์ด๋ฉด
//์
๋ ฅ์ํจ
}else {
dao.insertIng(num, temp);
}
}else {
System.out.println("๋ฒํธ๋ฅผ ์๋ชป ์
๋ ฅํ์์ต๋๋ค.");
}
}
}
/**
* @param : scanner๋ก ์ญ์ ํ ์์ ๋ฒํธ/์ญ์ ํ ์ฌ๋ฃ ๋ฒํธ ์
๋ ฅ ๋ฐ์
* void : ์
๋ ฅ๋ฐ์ ์์์ ์ฌ๋ฃ๋ฅผ ์ญ์
*/
@Override
public void delIngByIdx(Scanner sc) {
System.out.println("========= ์๋ฆฌ ์ฌ๋ฃ ์ญ์ =========");
this.printAllFood();
System.out.println("========= ========= =========");
System.out.print("์ฌ๋ฃ ์ญ์ ํ ์๋ฆฌ ๋ฒํธ: ");
int foodNum = sc.nextInt();
if(foodNum > getDao().getAllFood().size() || foodNum <=0) {
System.out.println("์
๋ ฅ ๋ฒํธ๋ฅผ ๋ค์ ํ์ธํด์ฃผ์ธ์.");
}else {
Food f = this.getFoodByIdx(foodNum);
System.out.println("========= ========= =========");
for(Map.Entry<String, Integer> a : f.getIngredient().entrySet()){
System.out.println("์ฌ๋ฃ: "+ a.getKey() + " ์๋: " + a.getValue());
}
System.out.println("========= ========= =========");
System.out.print("์ญ์ ํ ์ฌ๋ฃ ์ด๋ฆ: ");
String ingName = sc.next();
String tempName = null;
for(String key : f.getIngredient().keySet()) {
if(key.equals(ingName)) { //์
๋ ฅ๋ฐ์ ์ฌ๋ฃ๋ ์์ ์ฌ๋ฃ ๋ฆฌ์คํธ๋ ๊ฐ์ผ๋ฉด
tempName = ingName;
}
}
dao.deleteIng(foodNum, tempName);
}
}
/**
* @param : scanner๋ก ์ญ์ ํ ์์ ๋ฒํธ ์
๋ ฅ ๋ฐ์
* void : ์
๋ ฅ๋ฐ์ ์์์ ์ญ์
*/
@Override
public void delFoodByIdx(Scanner sc) {
System.out.println("========= ์๋ฆฌ ์ญ์ =========");
this.printAllFood();
System.out.println("========= ========= =========");
System.out.print("์ญ์ ํ ์๋ฆฌ ๋ฒํธ: ");
int num = sc.nextInt();
if(num > getDao().getAllFood().size() || num <=0) {
System.out.println("์
๋ ฅ ๋ฒํธ๋ฅผ ๋ค์ ํ์ธํด์ฃผ์ธ์.");
}else {
if(num == this.getFoodByIdx(num).getIdx()) {
dao.deleteByIdx(num);
}
}
}
}
| [
"tjfsu120@gmail.com"
] | tjfsu120@gmail.com |
ea94423acb1034b11a2a067c35d393eb96571cc0 | 09fa69751a2afeb2ab56b4dadfae616e49d6b42b | /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/graph2d/TextLine.java | de97bb62be0bd634a804a93f28ed2a203ad81c07 | [] | no_license | VijayEluri/bioclipse.speclipse | ce7c803bab32cdfe5e8cdf5c44253281178ba60b | 89a303867e9ee326ae72468d050d320d30ddfb05 | refs/heads/master | 2020-05-20T11:06:22.160489 | 2017-06-21T07:48:23 | 2017-06-21T07:48:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,807 | java | package net.bioclipse.spectrum.graph2d;
import java.awt.*;
import java.util.*;
import java.lang.*;
import java.awt.image.*;
/*
**************************************************************************
**
** Class TextLine
**
**************************************************************************
** Copyright (C) 1996 Leigh Brookshaw
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**************************************************************************
**
** This class is designed to bundle together all the information required
** to draw short Strings
**
*************************************************************************/
/**
* This class is designed to bundle together all the information required
* to draw short Strings with subscripts and superscripts
*
* @version $Revision: 1.10 $, $Date: 1996/09/05 04:53:27 $
* @author Leigh Brookshaw
*/
public class TextLine extends Object {
/*
*************
**
** Constants
**
************/
/**
* Center the Text over the point
*/
public final static int CENTER = 0;
/**
* Position the Text to the Left of the point
*/
public final static int LEFT = 1;
/**
* Position the Text to the Right of the point
*/
public final static int RIGHT = 2;
/**
* Format to use when parsing a double
*/
public final static int SCIENTIFIC = 1;
/**
* Format to use when parsing a double
*/
public final static int ALGEBRAIC = 2;
/*
** Minimum Point size allowed for script characters
*/
final static int MINIMUM_SIZE = 6;
/*
**********************
**
** Protected Variables
**
*********************/
/**
* Decrease in size of successive script levels
*/
protected double script_fraction = 0.8;
/**
* Superscript offset
*/
protected double sup_offset = 0.6;
/**
* Subscript offset
*/
protected double sub_offset = 0.7;
/**
* Font to use for text
*/
protected Font font = null;
/**
* Text color
*/
protected Color color = null;
/**
* Background Color
*/
protected Color background = null;
/**
* The text to display
*/
protected String text = null;
/**
* The logical name of the font to use
*/
protected String fontname = "TimesRoman";
/**
* The font size
*/
protected int fontsize = 0;
/**
* The font style
*/
protected int fontstyle = Font.PLAIN;
/**
* Text justification. Either CENTER, LEFT or RIGHT
*/
protected int justification = LEFT;
/**
* The width of the text using the current Font
*/
protected int width = 0;
/**
* The ascent using the current font
*/
protected int ascent = 0;
/**
* The maximum ascent using the current font
*/
protected int maxAscent = 0;
/**
* The descent using the current font
*/
protected int descent = 0;
/**
* The maximum descent using the current font
*/
protected int maxDescent = 0;
/**
* The height using the current font ie ascent+descent+leading
*/
protected int height = 0;
/**
* The leading using the current font
*/
protected int leading = 0;
/**
* Has the string been parsed! This only needs to be done once
* unless the font is altered.
*/
protected boolean parse = true;
/**
* Local graphics context.
*/
protected Graphics lg = null;
/**
* The parsed string. Each element in the vector represents
* a change of context in the string ie font change and offset.
*/
protected Vector list = new Vector(8,4);
/*
**********************
**
** Constructors
**
*********************/
/**
* Instantiate the class
*/
public TextLine() { }
/**
* Instantiate the class.
* @param s String to parse.
*/
public TextLine(String s) {
this.text = s;
}
/**
* Instantiate the class
* @param s String to parse.
* @param f Font to use.
*/
public TextLine(String s, Font f) {
this(s);
font = f;
if(font == null) return;
fontname = f.getName();
fontstyle = f.getStyle();
fontsize = f.getSize();
}
/**
* Instantiate the class
* @param s String to parse.
* @param f Font to use.
* @param c Color to use
* @param j Justification
*/
public TextLine(String s, Font f, Color c, int j) {
this(s,f);
color = c;
justification = j;
}
/**
* Instantiate the class
* @param s String to parse.
* @param c Color to use
*/
public TextLine(String s, Color c) {
this(s);
color = c;
}
/**
* Instantiate the class
* @param f Font to use.
* @param c Color to use
* @param j Justification
*/
public TextLine(Font f, Color c, int j) {
font = f;
color = c;
justification = j;
if(font == null) return;
fontname = f.getName();
fontstyle = f.getStyle();
fontsize = f.getSize();
}
/*
*****************
**
** Public Methods
**
*****************/
/**
* Create a New Textline object copying the state of the existing
* object into the new one. The state of the class is the color,
* font, and justification ie everything but the string.
*/
public TextLine copyState() {
return new TextLine(font,color,justification);
}
/**
* Copy the state of the parsed Textline into the existing
* object.
* @param t The TextLine to get the state information from.
*/
public void copyState(TextLine t) {
if(t==null) return;
font = t.getFont();
color = t.getColor();
justification = t.getJustification();
if(font == null) return;
fontname = font.getName();
fontstyle = font.getStyle();
fontsize = font.getSize();
parse = true;
}
/**
* Set the Font to use with the class
* @param f Font
*/
public void setFont( Font f ) {
font = f;
fontname = f.getName();
fontstyle = f.getStyle();
fontsize = f.getSize();
parse = true;
}
/**
* Set the String to use with the class
* @param s String
*/
public void setText( String s ) {
text = s;
parse = true;
}
/**
* Set the Color to use with the class
* @param c Color
*/
public void setColor( Color c ) {
color = c;
}
/**
* Set the Background Color to use with the class
* @param c Color
*/
public void setBackground( Color c ) {
background = c;
}
/**
* Set the Justification to use with the class
* @param t Justification
*/
public void setJustification( int i ) {
switch (i) {
case CENTER:
justification = CENTER;
break;
case LEFT: default:
justification = LEFT;
break;
case RIGHT:
justification = RIGHT;
break;
}
}
/**
* @return the font the class is using
*/
public Font getFont() {
return font;
}
/**
* @return the String the class is using.
*/
public String getText() {
return text;
}
/**
* @return the Color the class is using.
*/
public Color getColor() {
return color;
}
/**
* @return the Background Color the class is using.
*/
public Color getBackground() {
return background;
}
/**
* @return the Justification the class is using.
*/
public int getJustification() {
return justification;
}
/**
* @param g Graphics context.
* @return the Fontmetrics the class is using.
*/
public FontMetrics getFM(Graphics g) {
if(g==null) return null;
if(font==null) return g.getFontMetrics();
else return g.getFontMetrics(font);
}
/**
* @param g Graphics context.
* @param ch The character.
* @return the width of the character.
*/
public int charWidth(Graphics g, char ch) {
FontMetrics fm;
if(g==null) return 0;
if(font==null) fm = g.getFontMetrics();
else fm = g.getFontMetrics(font);
return fm.charWidth(ch);
}
/**
* @param g Graphics context.
* @return the width of the parsed text.
*/
public int getWidth(Graphics g) {
parseText(g);
return width;
}
/**
* @param g Graphics context.
* @return the height of the parsed text.
*/
public int getHeight(Graphics g) {
parseText(g);
return height;
}
/**
* @param g Graphics context.
* @return the ascent of the parsed text.
*/
public int getAscent(Graphics g) {
if(g == null) return 0;
parseText(g);
return ascent;
}
/**
* @param g Graphics context.
* @return the maximum ascent of the parsed text.
*/
public int getMaxAscent(Graphics g) {
if(g == null) return 0;
parseText(g);
return maxAscent;
}
/**
* @param g Graphics context.
* @return the descent of the parsed text.
*/
public int getDescent(Graphics g) {
if(g == null) return 0;
parseText(g);
return descent;
}
/**
* @param g Graphics context.
* @return the maximum descent of the parsed text.
*/
public int getMaxDescent(Graphics g) {
if(g == null) return 0;
parseText(g);
return maxDescent;
}
/**
* @param g Graphics context.
* @return the leading of the parsed text.
*/
public int getLeading(Graphics g) {
if(g == null) return 0;
parseText(g);
return leading;
}
/**
* parse the text. When the text is parsed the width, height, leading
* are all calculated. The text will only be truly parsed if
* the graphics context has changed or the text has changed or
* the font has changed. Otherwise nothing is done when this
* method is called.
* @param g Graphics context.
*/
public void parseText(Graphics g) {
FontMetrics fm;
TextState current = new TextState();
char ch;
Stack state = new Stack();
int w = 0;
if(lg != g) parse = true;
lg = g;
if(!parse) return;
parse = false;
width = 0;
leading = 0;
ascent = 0;
descent = 0;
height = 0;
maxAscent = 0;
maxDescent = 0;
if( text == null || g == null) return;
list.removeAllElements();
if(font == null) current.f = g.getFont();
else current.f = font;
state.push(current);
list.addElement(current);
fm = g.getFontMetrics(current.f);
for(int i=0; i<text.length(); i++) {
ch = text.charAt(i);
switch (ch) {
case '$':
i++;
if(i<text.length()) current.s.append(text.charAt(i));
break;
/*
** Push the current state onto the state stack
** and start a new storage string
*/
case '{':
w = current.getWidth(g);
if(!current.isEmpty()) {
current = current.copyState();
list.addElement(current);
}
state.push(current);
current.x += w;
break;
/*
** Pop the state off the state stack and set the current
** state to the top of the state stack
*/
case '}':
w = current.x + current.getWidth(g);
state.pop();
current = ((TextState)state.peek()).copyState();
list.addElement(current);
current.x = w;
break;
case '^':
w = current.getWidth(g);
if(!current.isEmpty()) {
current = current.copyState();
list.addElement(current);
}
current.f = getScriptFont(current.f);
current.x += w;
current.y -= (int)((double)(current.getAscent(g))*sup_offset+0.5);
break;
case '_':
w = current.getWidth(g);
if(!current.isEmpty()) {
current = current.copyState();
list.addElement(current);
}
current.f = getScriptFont(current.f);
current.x += w;
current.y += (int)((double)(current.getDescent(g))*sub_offset+0.5);
break;
default:
current.s.append(ch);
break;
}
}
for(int i=0; i<list.size(); i++) {
current = ((TextState)(list.elementAt(i)));
if( !current.isEmpty() ) {
width += current.getWidth(g);
ascent = Math.max(ascent, Math.abs(current.y) +
current.getAscent(g));
descent = Math.max(descent, Math.abs(current.y) +
current.getDescent(g));
leading = Math.max(leading, current.getLeading(g));
maxDescent = Math.max(maxDescent, Math.abs(current.y) +
current.getMaxDescent(g));
maxAscent = Math.max(maxAscent, Math.abs(current.y) +
current.getMaxAscent(g));
}
}
height = ascent+descent+leading;
return;
}
/**
* @return true if the text has never been set or is null
*/
public boolean isNull() {
return (text==null);
}
/**
* Parse the text then draw it.
* @param g Graphics context
* @param x pixel position of the text
* @param y pixel position of the text
* @param j justification of the text
*/
public void draw(Graphics g, int x, int y, int j) {
justification = j;
if( g == null ) return;
draw(g,x,y);
}
/**
* Parse the text then draw it without any rotation.
* @param g Graphics context
* @param x pixel position of the text
* @param y pixel position of the text
*/
public void draw(Graphics g, int x, int y) {
TextState ts;
int xoffset = x;
int yoffset = y;
if(g == null || text == null) return;
Graphics lg = g.create();
parseText(g);
if(justification == CENTER ) {
xoffset = x-width/2;
} else
if(justification == RIGHT ) {
xoffset = x-width;
}
if(background != null) {
lg.setColor(background);
lg.fillRect(xoffset,yoffset-ascent,width,height);
lg.setColor(g.getColor());
}
if(font != null) lg.setFont(font);
if(color != null) lg.setColor(color);
for(int i=0; i<list.size(); i++) {
ts = ((TextState)(list.elementAt(i)));
if(ts.f != null) lg.setFont(ts.f);
if(ts.s != null)
lg.drawString(ts.toString(),ts.x+xoffset,ts.y+yoffset);
}
lg.dispose();
lg = null;
}
/**
* @return Logical font name of the set font
*/
public String getFontName() { return fontname; }
/**
* @return Style of the set font
*/
public int getFontStyle() { return fontstyle; }
/**
* @return Size of the set font
*/
public int getFontSize() { return fontsize; }
/**
* Set the Logical font name of the current font
* @param s Logical font name.
*/
public void setFontName(String s) { fontname = s; rebuildFont(); }
/**
* Set the Font style of the current font
* @param i Font style.
*/
public void setFontStyle(int i) { fontstyle = i; rebuildFont(); }
/**
* Set the Font size of the current font
* @param i Font size.
*/
public void setFontSize(int i) { fontsize = i; rebuildFont(); }
/*
** Rebuild the font using the current fontname, fontstyle, and fontsize.
*/
private void rebuildFont() {
parse = true;
if( fontsize <= 0 || fontname == null ) {
font = null;
} else {
font = new Font(fontname, fontstyle, fontsize);
}
}
/**
* @param f Font
* @return The script font version of the parsed font using the
* script_fraction variable.
*/
public Font getScriptFont(Font f) {
int size;
if(f == null) return f;
size = f.getSize();
if(size <= MINIMUM_SIZE) return f;
size = (int)((double)(f.getSize())*script_fraction + 0.5);
if(size <= MINIMUM_SIZE) return f;
return new Font(f.getName(), f.getStyle(), size);
}
/**
* Parse a double value. Precision is 6 figures, with 7 significant
* figures.
* @param d double to parse
* return <i>true</i> if the parse was successful
*/
public boolean parseDouble(double d) {
return parseDouble(d, 7, 6, ALGEBRAIC);
}
/**
* Parse a double value. Number of significant figures is 1 greater than
* the precision.
* @param d double to parse
* @param p precision of the number
* return <i>true</i> if the parse was successful
*/
public boolean parseDouble(double d, int p) {
return parseDouble(d, p+1, p, ALGEBRAIC);
}
/**
* Parse a double value
* @param d double to parse
* @param n number of significant figures
* @param p precision of the number
* @param f format of the number scientific, algebraic etc.
* return <i>true</i> if the parse was successful
*/
public boolean parseDouble(double d, int n, int p, int f) {
double x = d;
int left = n - p;
double right = 0;
int power;
int exponent;
int i;
StringBuffer s = new StringBuffer(n+4);
if(left < 0 ) {
System.out.println(
"TextLine.parseDouble: Precision > significant figures!");
return false;
}
if(d < 0.0) {
x = -d;
s.append("-");
}
//System.out.println("parseDouble: value = "+x);
if( d == 0.0 ) exponent = 0;
else exponent = (int)(Math.floor(SpecialFunction.log10(x)));
//System.out.println("parseDouble: exponent = "+exponent);
power = exponent - (left - 1);
//System.out.println("parseDouble: power = "+power);
if( power < 0 ) {
for(i=power; i<0; i++) { x *= 10.0; }
} else {
for(i=0; i<power; i++) { x /= 10.0; }
}
//System.out.println("parseDouble: adjusted value = "+x);
left = (int)x;
s.append(left);
//System.out.println("parseDouble: left = "+left);
if( p > 0 ) {
s.append('.');
right = x-left;
for(i=0; i<p; i++) {
right *= 10;
if(i==p-1) right += 0.5;
s.append((int)(right));
right -= (int)right;
}
}
//System.out.println("parseDouble: right = "+right);
if(power != 0) {
if(f == SCIENTIFIC) {
s.append('E');
if(power < 0) s.append('-');
else s.append('+');
power = Math.abs(power);
if(power > 9) {
s.append(power);
} else {
s.append('0');
s.append(power);
}
} else {
s.append("x10{^");
s.append(power);
s.append("}");
}
}
setText( s.toString() );
return true;
}
}
/**
* A structure class used exclusively with the TextLine class.
* When the Text changes state (new font, new color, new offset)
* then this class holds the information plus the substring
* that the state pertains to.
*/
class TextState extends Object {
Font f = null;
StringBuffer s = null;
int x = 0;
int y = 0;
public TextState() {
s = new StringBuffer();
}
public TextState copyAll() {
TextState tmp = copyState();
if(s.length()==0) return tmp;
for(int i=0; i<s.length(); i++) { tmp.s.append(s.charAt(i)); }
return tmp;
}
public TextState copyState() {
TextState tmp = new TextState();
tmp.f = f;
tmp.x = x;
tmp.y = y;
return tmp;
}
public String toString() {
return s.toString();
}
public boolean isEmpty() {
return (s.length() == 0);
}
public int getWidth(Graphics g) {
if(g == null || f == null || s.length()==0 ) return 0;
return g.getFontMetrics(f).stringWidth(s.toString());
}
public int getHeight(Graphics g) {
if(g == null || f == null ) return 0;
return g.getFontMetrics(f).getHeight();
}
public int getAscent(Graphics g) {
if(g == null || f == null ) return 0;
return g.getFontMetrics(f).getAscent();
}
public int getDescent(Graphics g) {
if(g == null || f == null ) return 0;
return g.getFontMetrics(f).getDescent();
}
public int getMaxAscent(Graphics g) {
if(g == null || f == null ) return 0;
return g.getFontMetrics(f).getMaxAscent();
}
public int getMaxDescent(Graphics g) {
if(g == null || f == null ) return 0;
return g.getFontMetrics(f).getMaxDescent();
}
public int getLeading(Graphics g) {
if(g == null || f == null ) return 0;
return g.getFontMetrics(f).getLeading();
}
}
| [
"shk3@8c9fa4fb-1519-4cab-aaef-1409e95b607c"
] | shk3@8c9fa4fb-1519-4cab-aaef-1409e95b607c |
7eb967af63ddcae8b1c18f571d4b833a6792bf9e | aed1d8bb22ee66377c90e8709083db56959a5ea5 | /app/src/main/java/com/xsylsb/integrity/mianfragment/homepage/personage/PersonageFragment.java | 4f6be76b1585a33a5a57a4c2916da5aa7b2c33a5 | [] | no_license | 15814903830/IntegrityFactoryProject-master | 096bc7964aa0108041a43989c0eb5aa61b27db9a | cd66221e5623c23c628014751fd48ae779b3ffad | refs/heads/master | 2020-06-29T20:36:18.711104 | 2019-08-05T08:46:02 | 2019-08-05T08:46:02 | 195,791,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,909 | java | package com.xsylsb.integrity.mianfragment.homepage.personage;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.xsylsb.integrity.Examination_Activity;
import com.xsylsb.integrity.MainActivity;
import com.xsylsb.integrity.PracticeMode_Activity;
import com.xsylsb.integrity.R;
import com.xsylsb.integrity.WebActivity;
import com.xsylsb.integrity.mianfragment.homepage.homepage.HomepageFragment;
import com.xsylsb.integrity.mianfragment.homepage.notice.NoticeFragment;
import com.xsylsb.integrity.mvp.MVPBaseFragment;
import com.xsylsb.integrity.mylogin.MyloginActivity;
import com.xsylsb.integrity.util.MyURL;
import com.xsylsb.integrity.util.StowMainInfc;
import com.xsylsb.integrity.util.dialog.BaseNiceDialog;
import com.xsylsb.integrity.util.dialog.NiceDialog;
import com.xsylsb.integrity.util.dialog.ViewConvertListener;
import com.xsylsb.integrity.util.dialog.ViewHolder;
/**
* ไธชไบบ
*/
public class PersonageFragment extends MVPBaseFragment<PersonageContract.View, PersonagePresenter> implements PersonageContract.View {
private static StowMainInfc stowMainInfcss;
private View mView;
private ProgressBar progressBar;
private WebView webView;
private String mUrl = MyURL.URLL+"Worker/PersonalCenter";
private BaseNiceDialog mBaseNiceDialog;
public static final String KEY_URL = "url";
public static final String KEY_TITLE = "title";
private String mTitle = "";
private boolean showlading=true;
/**
* Fragment ็ๆ้ ๅฝๆฐใ
*/
public PersonageFragment() {
}
public static PersonageFragment newInstance(StowMainInfc stowMainInfc) {
stowMainInfcss=stowMainInfc;
return new PersonageFragment();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mView=inflater.inflate(R.layout.homefragment,container,false);
if (showlading){
showLoading();
showlading=false;
}
mUrl=mUrl+"?id="+MyURL.id;
Log.e("Personageurl",mUrl);
initView();
webView.loadUrl(mUrl);
return mView;
}
private void initView() {
progressBar = mView.findViewById(R.id.pb_web);
webView = mView.findViewById(R.id.wv_web);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.e("urlPersonagessss",url);
if(url.contains("Worker/Logout")){//้ๅบ
NiceDialog.init()
.setLayoutId(R.layout.exit_dialog)
.setConvertListener(new ViewConvertListener() {
@Override
protected void convertView(ViewHolder holder, final BaseNiceDialog dialog) {
TextView hesitate = holder.getView(R.id.tv_hesitate);
TextView exit = holder.getView(R.id.tv_exit);
hesitate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
exit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getContext(), MyloginActivity.class));
stowMainInfcss.StowMainInfc();
}
});
}
})
.setDimAmount(0.3f)
.setShowBottom(false)
.setAnimStyle(R.style.PracticeModeAnimation)
.setOutCancel(false) //่งฆๆธๅค้จๆฏๅฆๅๆถ
.show(getChildFragmentManager());
}else if (url.contains("Worker/MyCourse")){
Log.e("urlssss",url);
Intent intent=new Intent(getContext(), WebActivity.class);
intent.putExtra(KEY_URL,url);
intent.putExtra(KEY_TITLE,mTitle);
startActivity(intent);
} else {
Log.e("else",url);
Intent intent=new Intent(getContext(), WebActivity.class);
intent.putExtra(KEY_URL,url);
intent.putExtra(KEY_TITLE,mTitle);
startActivity(intent);
}
return true;
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
int code = errorCode / 100;
if (code == 2) {
webView.setVisibility(View.VISIBLE);
super.onReceivedError(view, errorCode, description, failingUrl);
} else {
showEmpty();
}
}
});
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
mTitle=title;
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
if (newProgress == 100) {//ๅ ่ฝฝ็ฝ้กตๅฎๆฏ
mBaseNiceDialog.dismiss();
}
// progressBar.setProgress(newProgress);
// if (newProgress == 100) {
// progressBar.setVisibility(View.INVISIBLE);
// } else {
// progressBar.setVisibility(View.VISIBLE);
// }
}
});
initWebSettings();
}
private void showEmpty() {
webView.setVisibility(View.INVISIBLE);
}
private void initWebSettings() {
WebSettings webSettings = webView.getSettings();
//5.0ไปฅไธๅผๅฏๆททๅๆจกๅผๅ ่ฝฝ
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
webSettings.setLoadWithOverviewMode(true);
webSettings.setUseWideViewPort(true);
//ๅ
่ฎธjsไปฃ็
webSettings.setJavaScriptEnabled(true);
webSettings.setAllowFileAccessFromFileURLs(true);
//็ฆ็จๆพ็ผฉ
webSettings.setDisplayZoomControls(false);
webSettings.setBuiltInZoomControls(false);
//็ฆ็จๆๅญ็ผฉๆพ
webSettings.setTextZoom(100);
//่ชๅจๅ ่ฝฝๅพ็
webSettings.setLoadsImagesAutomatically(true);
}
// @Override
// public void onBackPressed() {
// if (webView.canGoBack()) {
// webView.goBack();
// } else {
// super.onBackPressed();
// }
// }
@Override
public void onDestroyView() {
if (webView.canGoBack()) {
webView.goBack();
} else {
super.onDestroyView();
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (webView != null) {
//้ๆพ่ตๆบ
webView.destroy();
webView = null;
}
}
/**
* ๆพ็คบloading
*/
public void showLoading() {
NiceDialog.init()
.setLayoutId(R.layout.dialog_loading_layout)
.setConvertListener(new ViewConvertListener() {
@Override
protected void convertView(ViewHolder holder, BaseNiceDialog dialog) {
mBaseNiceDialog = dialog;
}
})
.setOutCancel(false)
.setWidth(48)
.setHeight(48)
.setShowBottom(false)
.show(getChildFragmentManager());
}
}
| [
"1273258724@qq.com"
] | 1273258724@qq.com |
101e905a945834d10c3dbd72dafe65b52e264008 | e07639ace33e209ca6bc85fb0a756e3d2be8f813 | /app/src/main/java/com/jpauwels/classselection/MainActivity.java | e7615fedb5705bb931af02fafba9d9968f916f8a | [] | no_license | johnpauwels74/ClassSelection | e6e348fcc9cb3373ac023830fbc87587545c5a7c | 1dd10738f04564fe911192274c2f7a98131d13d7 | refs/heads/master | 2021-08-22T07:26:27.900545 | 2017-11-13T19:24:54 | 2017-11-13T19:24:54 | 110,591,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.jpauwels.classselection;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"johnpauwels74@gmail.com"
] | johnpauwels74@gmail.com |
4f2e8dd61b47beaacd8f77a7e65fdef43dd40b66 | 66ed843adbeed5c6bb3b679642b1070ce52a8019 | /test/edu/kit/pp/minijava/TokenHelper.java | e473f098d7874b81140ba27f6bed7c7b371f6940 | [] | no_license | helmonaut/MiniJava | b70f5172215f339089a6cd12bbeb012a2444f283 | 7ac37b8e14754956feffae5ea29b60f3cda03330 | refs/heads/master | 2021-01-20T13:48:46.763518 | 2011-05-06T16:44:27 | 2011-05-06T16:44:27 | 1,659,480 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package edu.kit.pp.minijava;
import edu.kit.pp.minijava.tokens.*;
public abstract class TokenHelper {
public static Token I() {
return I("generated_identifier");
}
public static Token I(String s) {
return new Identifier(s);
}
public static Token O(String s) {
return new Operator(s);
}
public static Token K(String s) {
return new Keyword(s);
}
public static Token IL(String s) {
return new IntegerLiteral(s);
}
public static Token EOF() {
return new Eof();
}
}
| [
"tim.habermaas@gmail.com"
] | tim.habermaas@gmail.com |
54fd3645ad7e05c41e2798c29d696a27b824a7eb | 67adfb08fd4b684cb43faa9846dcab29a2ed8092 | /CalculatorModule/src/main/java/ua/goit/calculator/operators/floatOperators/AddFloatOperator.java | 3298c00eac3d0cdcca87dee49acd3a807f6dd4f1 | [] | no_license | uazori/JavaEE | f696a551123ac91119cee7f7c8314a56bfdfefcf | 0acf2843123570bf015e1b601cb8156e8b837630 | refs/heads/master | 2020-12-25T20:53:54.774790 | 2016-06-18T17:59:30 | 2016-06-18T17:59:30 | 53,727,377 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package ua.goit.calculator.operators.floatOperators;
import ua.goit.calculator.operators.Operator;
import ua.goit.calculator.task.CalculatorTask;
/**
* Created by Vadim on 27.04.2016.
*/
public class AddFloatOperator extends FloatConverter implements Operator {
@Override
public String Calculate(CalculatorTask task) {
super.ConvertOperands(task);
return String.valueOf(super.operand1 + super.operand2);
}
}
| [
"uazori@gmail.com"
] | uazori@gmail.com |
2adae08ba3a784a84642f5aa99d1ea6c6821b5cc | ea16de2020ab8fdefc8327a906f7aa79c65e4ad4 | /src/main/java/com/hellogood/http/vo/AreaVO.java | 1a80d3c239dbdac51b76af2b473df3efdb119646 | [] | no_license | scaukejian/hellogood_admin | 3cca6d4f8572e967c6d47b6afe097663201c80fd | f5754d1e55e1f322085805d9446077666f696485 | refs/heads/master | 2021-09-07T18:21:26.784742 | 2018-02-27T08:19:46 | 2018-02-27T08:19:46 | 104,710,472 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package com.hellogood.http.vo;
import com.hellogood.domain.Area;
import com.hellogood.exception.BusinessException;
import com.hellogood.utils.BeaUtils;
public class AreaVO {
private Integer id;
private Integer code;
private String name;
private String pinyinName;
private Integer parentId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getPinyinName() {
return pinyinName;
}
public void setPinyinName(String pinyinName) {
this.pinyinName = pinyinName == null ? null : pinyinName.trim();
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public void vo2Domain(Area area){
try {
BeaUtils.copyProperties(area, this);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("่ทๅๅๅธไฟกๆฏๅคฑ่ดฅ๏ผ");
}
}
public void domain2VO(Area area){
try{
BeaUtils.copyProperties(this, area);
}catch(Exception e){
e.printStackTrace();
throw new BusinessException("่ทๅๅๅธไฟกๆฏๅคฑ่ดฅ๏ผ");
}
}
}
| [
"954657344@qq.com"
] | 954657344@qq.com |
46a0f58db0e89b60aa7b86d04111c4fa2ce7bd4b | 8020f160665d98adf3dd36621283aa0faa56fcb1 | /src/main/java/com/isa/spring/boot/actuator/services/counter/ServiceWithCounterImpl.java | fe03086fba3b1dd64e08c590617867b4b9ce72d3 | [] | no_license | isaolmez/spring-boot-actuator-samples | 7b8d063b1526c6f0466aa9186641721e8fc2fe0b | faaa0a7861bed3a3c31e5cc593155d3bbff5a667 | refs/heads/master | 2021-01-19T17:44:02.368783 | 2017-04-15T10:17:52 | 2017-04-15T10:17:52 | 88,339,171 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | package com.isa.spring.boot.actuator.services.counter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.metrics.CounterService;
import org.springframework.stereotype.Service;
@Service
public class ServiceWithCounterImpl implements ServiceWithCounter {
private final CounterService counterService;
@Autowired
public ServiceWithCounterImpl(CounterService counterService) {
this.counterService = counterService;
}
@Override
public String get() {
counterService.increment("customCounter");
return "Hello";
}
}
| [
"isaolmez@gmail.com"
] | isaolmez@gmail.com |
62bad1bf28af8d951821ca926b9f60daa355b82e | 5c5e27be24ebc9727fa0bffe6ed17425156e06a3 | /eomcs-java-io/src/main/java/com/eomcs/io/ex10/Exam04_1.java | 4b0d0351c3c5670c0927b00f868dcf107aafc58c | [] | no_license | top9148/eomcs-java | c49afc0e1303333e87967d148e6be7db47676a6c | b2d72450b249ae1ca02565db2957cb7b7c75a04a | refs/heads/master | 2020-06-17T11:32:26.840763 | 2019-05-23T08:31:17 | 2019-05-23T08:31:17 | 195,911,452 | 1 | 0 | null | 2019-07-09T01:41:50 | 2019-07-09T01:41:50 | null | UTF-8 | Java | false | false | 927 | java | // Java I/O API ์ฌ์ฉํ๊ธฐ - serialize์ transient ๋ณ๊ฒฝ์
package com.eomcs.io.ex10;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
public class Exam04_1 {
public static void main(String[] args) throws Exception {
FileOutputStream fileOut = new FileOutputStream("temp/test9_5.data");
BufferedOutputStream bufOut = new BufferedOutputStream(fileOut);
ObjectOutputStream out = new ObjectOutputStream(bufOut);
Score s = new Score();
s.name = "ํ๊ธธ๋";
s.kor = 99;
s.eng = 80;
s.math = 92;
s.compute();
out.writeObject(s);
out.close();
}
}
// ์ฉ์ด ์ ๋ฆฌ!
// Serialize : ๊ฐ์ฒด ===> ๋ฐ์ดํธ ๋ฐฐ์ด (marshalling ์ด๋ผ๊ณ ๋ ๋ถ๋ฅธ๋ค.)
// Deserialize : ๋ฐ์ดํธ ๋ฐฐ์ด ===> ๊ฐ์ฒด (unmarshalling ์ด๋ผ๊ณ ๋ ๋ถ๋ฅธ๋ค.)
//
| [
"jinyoung.eom@gmail.com"
] | jinyoung.eom@gmail.com |
45a40c38207ac103c0e2936abda2dd8b04755240 | 8f71cdac280aa8e694f5fa3e414612a2fe52117c | /chapter_002/src/main/java/ru/job4j/tracker/Item.java | cdf8f733ae62c5c0becab72725f3b715db71e498 | [] | no_license | BelovolAndrey/job4j | c13798989f54e9909623beabfefcfad83993d139 | 452708a0dd995069857afd1b7c9a29dd42707665 | refs/heads/master | 2021-07-23T21:24:50.790544 | 2020-04-13T08:50:58 | 2020-04-13T08:50:58 | 224,821,067 | 0 | 0 | null | 2020-10-13T17:50:44 | 2019-11-29T09:27:32 | Java | UTF-8 | Java | false | false | 574 | java | package ru.job4j.tracker;
public class Item implements Comparable<Item> {
private String id;
private String name;
public Item(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int compareTo(Item next) {
return Integer.compare(Integer.valueOf(id), Integer.valueOf(next.id));
}
} | [
"belovol.andrey@gmail.com"
] | belovol.andrey@gmail.com |
a254656496f94a4ea383524f5aa7bdd104eb3994 | f0a6419979c85219c241fe95eb518d64336e118d | /Mytest/src/sorts/Sorts.java | 1087cfba3c8e368ba0cac9eaaaf027b759640714 | [] | no_license | Dwti/adhoc | e47f5fe4147de8325e0122e3d5ffeb397c2e9971 | e155a36c5f9ac3fc2f97d8af31ab63361af685a4 | refs/heads/master | 2020-03-13T06:20:52.847919 | 2018-04-25T12:20:33 | 2018-04-25T12:20:33 | 131,002,669 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,454 | java | package sorts;
public class Sorts {
public Sorts() {
}
/*
* ๅฟซ้ๆๅบ
* ๆๆณ๏ผ้่ฟไธ่ถๆๅบๅฐๅพ
ๆๅบ่ฎฐๅฝๅๅฒๆ็ฌ็ซ็ไธค้จๅ๏ผๅ
ถไธญไธ้จๅ่ฎฐๅฝ็ๅ
ณ้ฎๅญๅๆฏๅฆไธ้จๅๅ
ณ้ฎๅญๅฐ๏ผ
* ๅๅๅซๅฏน่ฟไธค้จๅ็ปง็ปญ่ฟ่กๆๅบ๏ผ็ดๅฐๆดไธชๅบๅๆๅบใ
* ๆถ้ดๅคๆๅบฆ๏ผๅนณๅnlog2n,ๆๅฅฝ๏ผnlog2n๏ผๆๅn^2
* ็ฉบ้ดๅคๆๅบฆ๏ผnlog2n
* ็จณๅฎๆง๏ผไธ็จณๅฎ
*/
int[] quickSort(int []a,int low,int hight){
if(low<hight) {
int middle=getMiddle(a, low, hight);
quickSort(a, 0, middle-1);
quickSort(a, middle+1, hight);
}
return a;
}
int getMiddle(int a[],int low,int hight){
int temp=a[low];//ๅๅปบไธไธชไธดๆถ็ๅ้๏ผๅญๆพๆพๅบ็ๅบๅๆฐ
while(low<hight) {
while(low<hight && temp<=a[hight]) {
hight--;
}
a[low]=a[hight];
while(low<hight && temp>=a[low]) {
low++;
}
a[hight]=a[low];
}
a[low]=temp;
return hight;
}
/*ๅๆณกๆๅบ
* ๆ่ทฏ๏ผๅจ่ฆๆๅบ็ไธ็ปๆฐไธญ๏ผๅฏนๅฝๅ่ฟๆชๆๅฅฝๅบ็่ๅดๅ
็ๅ
จ้จๆฐ๏ผ่ชไธ่ไธๅฏน็ธ้ป็ไธคไธชๆฐไพๆฌก่ฟ่กๆฏ่พๅ่ฐๆด๏ผ
* ่ฎฉ่พๅคง็ๆฐๅพไธๆฒ๏ผ่พๅฐ็ๅพไธๅใๅณ๏ผๆฏๅฝไธค็ธ้ป็ๆฐๆฏ่พๅๅ็ฐๅฎไปฌ็ๆๅบไธๆๅบ่ฆๆฑ็ธๅๆถ๏ผๅฐฑๅฐๅฎไปฌไบๆขใ
* ๆถ้ดๅคๆๅบฆ๏ผๅนณๅn^2,ๆๅฅฝ๏ผn๏ผๆๅn^2
* ็ฉบ้ดๅคๆๅบฆ๏ผ1
* ็จณๅฎๆง๏ผ็จณๅฎ
* */
int [] bubbleSort(int []a){
for(int i=0;i<a.length;i++) {
for(int j=0;j<a.length-1-i;j++) {
int temp;
if(a[j]>a[j+1]) {
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
return a;
}
/*้ๆฉๆๅบ
* ๆ่ทฏ๏ผๅจ่ฆๆๅบ็ไธ็ปๆฐไธญ๏ผ้ๅบๆๅฐ๏ผๆ่
ๆๅคง๏ผ็ไธไธชๆฐไธ็ฌฌ1ไธชไฝ็ฝฎ็ๆฐไบคๆข๏ผ
* ็ถๅๅจๅฉไธ็ๆฐๅฝไธญๅๆพๆๅฐ๏ผๆ่
ๆๅคง๏ผ็ไธ็ฌฌ2ไธชไฝ็ฝฎ็ๆฐไบคๆข๏ผ
* ไพๆฌก็ฑปๆจ๏ผ็ดๅฐ็ฌฌn-1ไธชๅ
็ด ๏ผๅๆฐ็ฌฌไบไธชๆฐ๏ผๅ็ฌฌnไธชๅ
็ด ๏ผๆๅไธไธชๆฐ๏ผๆฏ่พไธบๆญขใ
* ๆถ้ดๅคๆๅบฆ๏ผๅนณๅn^2,ๆๅฅฝ๏ผn^2๏ผๆๅn^2
* ็ฉบ้ดๅคๆๅบฆ๏ผ1
* ็จณๅฎๆง๏ผไธ็จณๅฎ
* */
int[] selectSort(int []a) {
int temp;
int index;
for(int i=0;i<a.length;i++) {
temp=a[i];
index=i;
for(int j=i+1;j<a.length;j++) {
if(a[j]<temp) {
temp=a[j];
index=j;
}
}
a[index]=a[i];
a[i]=temp;
}
return null;
}
int[] selectSort1(int []a) {
int index;
int temp;
for(int i=0;i<a.length;i++) {
temp=a[i];
for(int j=i+1;j<a.length;j++){
if(a[j]<temp) {
index=j;
}
}
}
return null;
}
/*ๅ ๆๅบ
* ๆ่ทฏ๏ผๅๅงๆถๆ่ฆๆๅบ็nไธชๆฐ็ๅบๅ็ไฝๆฏไธๆฃต้กบๅบๅญๅจ็ไบๅๆ ๏ผไธ็ปดๆฐ็ปๅญๅจไบๅๆ ๏ผ
* ๏ผ่ฐๆดๅฎไปฌ็ๅญๅจๅบ๏ผไฝฟไนๆไธบไธไธชๅ ๏ผๅฐๅ ้กถๅ
็ด ่พๅบ๏ผๅพๅฐn ไธชๅ
็ด ไธญๆๅฐ(ๆๆๅคง)็ๅ
็ด ๏ผ
* ่ฟๆถๅ ็ๆ น่็น็ๆฐๆๅฐ๏ผๆ่
ๆๅคง๏ผใ็ถๅๅฏนๅ้ข(n-1)ไธชๅ
็ด ้ๆฐ่ฐๆดไฝฟไนๆไธบๅ ๏ผ
* ่พๅบๅ ้กถๅ
็ด ๏ผๅพๅฐn ไธชๅ
็ด ไธญๆฌกๅฐ(ๆๆฌกๅคง)็ๅ
็ด ใ
* ไพๆญค็ฑปๆจ๏ผ็ดๅฐๅชๆไธคไธช่็น็ๅ ๏ผๅนถๅฏนๅฎไปฌไฝไบคๆข๏ผๆๅๅพๅฐๆnไธช่็น็ๆๅบๅบๅใ็งฐ่ฟไธช่ฟ็จไธบๅ ๆๅบใ
* ๆถ้ดๅคๆๅบฆ๏ผๅนณๅnlog2n,ๆๅฅฝ๏ผnlog2n๏ผๆๅnlog2n
* ็ฉบ้ดๅคๆๅบฆ๏ผ1
* ็จณๅฎๆง๏ผไธ็จณๅฎ
*
* */
//1.ๅปบ็ซๅ ๏ผไบคๆขๅ ้กถไธๆๅไธไธชๅถๅญ่็น
int[] heapSort(int []a) {
//ๅพช็ฏๅๅปบๅ
for(int i=0;i<a.length-1;i++) {
buildMaxHeap(a,a.length-1-i);
//ไบคๆขๅ ้กถๅๆๅไธไธชๅ
็ด
swap(a,0,a.length-1-i);
}
return a;
}
//ไบคๆข็ๆนๆณ
private void swap(int[] a, int i, int j) {
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
//ๅๅปบๅคง้กถๅ ,ไป0ๅฐlastIndexๅปบ็ซๅคง้กถๅ
private void buildMaxHeap(int[] a, int lastIndex) {
//ไปlastIndexๅค่็น็็ถ่็นๅผๅง
for(int i=(lastIndex-1)/2;i>=0;i--) {
//k็จๆฅไฟๅญๆญฃๅจๅคๆญ็่็น
int k=i;
//ๅฆๆๅฝๅK่็น็ๅญ่็นๅญๅจ
while(k*2+1<=lastIndex) {
//K่็น็ๅทฆๅญ่็น็็ดขๅผ
int biggerIndex=k*2+1;
//ๅฆๆbiggerIndexๅฐไบlastIndex๏ผ่ฏดๆK่็นๅญๅจๅณๅญ่็น๏ผๅณbiggerIndex+1ไปฃ่กจ็k่็น็ๅณๅญ่็น
if(biggerIndex<lastIndex) {
//ๅฆๆๅณๅญ่็นๅคงไบๅทฆๅญๅ ็น
if(a[biggerIndex]<a[biggerIndex+1]) {
//biggerIndex่ฟๆถๅๅบ่ฏฅ่ฎฐๅฝ่พๅคง่ชๅทฑ็น็็ดขๅผ๏ผbiggerIndex่ฟๆถๅ้่ฆ+1
biggerIndex=biggerIndex+1;
}
}
//ๅฆๆk่็น็ๅผๅฐไบ่พๅคง่็น็ๅผ๏ผๅฐฑไบคๆขไปไปฌ
if(a[k]<a[biggerIndex]) {
swap(a, k, biggerIndex);
//ๅฐbiggerIndex่ฆๅผ็ปk,ๅผๅงwhileๅพช็ฏ็ไธไธๆฌกๅพช็ฏ๏ผ้ๆฐไฟ่ฏk่็น็ๅผๅคงไบๅ
ถๅทฆๅณๅญ่็น็ๅผ
k=biggerIndex;
}else {
break;
}
}
}
}
/*็ดๆฅๆๅ
ฅๆๅบ
* ๆ่ทฏ๏ผๅฐไธไธช่ฎฐๅฝๆๅ
ฅๅฐๅทฒๆๅบๅฅฝ็ๆๅบ่กจไธญ๏ผไป่ๅพๅฐไธไธชๆฐ๏ผ่ฎฐๅฝๆฐๅข1็ๆๅบ่กจใ
* ๅณ๏ผๅ
ๅฐๅบๅ็็ฌฌ1ไธช่ฎฐๅฝ็ๆๆฏไธไธชๆๅบ็ๅญๅบๅ๏ผ็ถๅไป็ฌฌ2ไธช่ฎฐๅฝ้ไธช่ฟ่กๆๅ
ฅ๏ผ็ด่ณๆดไธชๅบๅๆๅบไธบๆญขใ
* ่ฆ็น๏ผ่ฎพ็ซๅจๅ
ต๏ผไฝไธบไธดๆถๅญๅจๅๅคๆญๆฐ็ป่พน็ไน็จใ
* ๆถ้ดๅคๆๅบฆ๏ผๅนณๅn^2,ๆๅฅฝ๏ผn๏ผๆๅn^2
* ็ฉบ้ดๅคๆๅบฆ๏ผ1
* ็จณๅฎๆง๏ผ็จณๅฎ
* */
int []insertSort(int []a){
int temp;//้่ฆๆๅ
ฅ็ๆฐ
for(int i=1;i<a.length;i++) {
temp=a[i];
int j=i-1;//ๅทฒ็ปๆๅฅฝๅบ็ๅ
็ด ็ไธชๆฐ
while(j>=0&&a[j]>temp) {
a[j+1]=a[j];
j--;
}
a[j+1]=temp;
}
return a;
}
/*shellๆๅบ
* ๆ่ทฏ๏ผๅฐๆดไธชๅพ
ๆๅบ็่ฎฐๅฝๅบๅๅๅฒๆไธบ่ฅๅนฒๅญๅบๅๅๅซ่ฟ่ก็ดๆฅๆๅ
ฅๆๅบ๏ผ
* ๅพ
ๆดไธชๅบๅไธญ็่ฎฐๅฝโๅบๆฌๆๅบโๆถ๏ผๅๅฏนๅ
จไฝ่ฎฐๅฝ่ฟ่กไพๆฌก็ดๆฅๆๅ
ฅๆๅบใ
* ๆถ้ดๅคๆๅบฆ๏ผๅนณๅn^2,ๆๅฅฝ๏ผn๏ผๆๅn^
* ็ฉบ้ดๅคๆๅบฆ๏ผ1
* ็จณๅฎๆง๏ผไธ็จณๅฎ
*
* */
int [] shellSort(int a[]) {
//dๆฏๅข้
int d=a.length/2;
//ๅฆๆdๅคงไบ1
while(d>=1) {
//ๅฏนๆ็
งๅข้ๅ็็ป๏ผ่ฟ่กๆๅ
ฅๆๅบ
shellInsertSort(a,d);
//ๅฏน็ปๅ็็ปๅๆฌกๅ็ป
d=d/2;
}
return a;
}
private void shellInsertSort(int[] a, int d) {
for(int i=d;i<a.length;i++) {
if(a[i]<a[i-d]) {
int j;
int temp=a[i];
a[i]=a[i-d];
//้่ฟๅพช็ฏ๏ผ้ไธชๅ็งปไธไฝๆพๅฐ่ฆๆๅ
ฅ็ไฝ็ฝฎใ
for( j=i-d;j>=0&&temp<a[j];j=j-d) {
a[j+d]=a[j];
}
a[j+d]=temp;
}
}
}
}
| [
"sunpeng@yanxiu.com"
] | sunpeng@yanxiu.com |
7e70eb8584dc4d5274c55b5f85fcae6becb19e30 | 9e79822e401621377471d18b3294896f9f40c47e | /Project1/src/tk/Project1/server/Message.java | 95fa4f276916a33794a5b5b2cc28a0a0fdaf6e33 | [] | no_license | Qwertzimus/Project1 | ad576052d090d196c1f72657539c87ed542a56d9 | 34d07eccc08fceda7407c81652888fdc2d357077 | refs/heads/master | 2021-05-26T12:27:41.696903 | 2013-06-03T04:47:11 | 2013-06-03T04:47:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | package tk.Project1.server;
public class Message {
public static final short PING = 0, COMMAND = 1,TEXT=2;
}
| [
"terminatorlink1996@googlemail.com"
] | terminatorlink1996@googlemail.com |
33b03872ccb0c7a6db2a9a29ea0555d01c3e2304 | 1e892b9303b3bb5b714966f6f3c6b4ede103517c | /src/main/java/com/arun/interviewquedtions/BiDecimalExample.java | cbe75cbc32e17cd896ea2910f5e07ebd7115c06d | [] | no_license | arun786/JavaWS | 6dcd377f5c7a6a2fcdf503d79ec702fecc559394 | efda643bba971fe238d4b8049eebba214d5d93dc | refs/heads/master | 2020-06-13T03:11:50.711247 | 2017-07-13T07:22:31 | 2017-07-13T07:22:31 | 75,457,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,130 | java | package com.arun.interviewquedtions;
import java.math.BigDecimal;
public class BiDecimalExample {
public static void main(String[] args) {
/* for financial calculation we should be using bigdecimal */
double amount1 = 4.15;
double amount2 = 5.16;
System.out.println("the difference between 2 will be " + (amount2 - amount1));
/*
* o/p will be the difference between 2 will be 1.0099999999999998
*/
BigDecimal amount3 = new BigDecimal("4.15");
BigDecimal amount4 = new BigDecimal("5.16");
System.out.println("the difference will be as " + amount4.subtract(amount3));
/*
* o/p will be the difference will be as 1.01, its better to use
* Bigdecimal
*/
/*
* But if we use overloaded constructor for BigDecimal, we will have the
* same problem
*/
BigDecimal amount5 = new BigDecimal(4.15);
BigDecimal amount6 = new BigDecimal(5.16);
System.out.println("the difference will be as " + amount6.subtract(amount5));
/*
* o/p will be the difference will be as
* 1.0099999999999997868371792719699442386627197265625
*/
}
}
| [
"adwiti1975@gmail.com"
] | adwiti1975@gmail.com |
1e24473e38eb0640498a6722543c61ed6e49cac6 | 03fd5c6b56ab31115216802841fe663926409fed | /lrecyclerview/src/main/java/com/baigu/lrecyclerview/progressindicator/indicators/BallTrianglePathIndicator.java | f74f8118aa12e681588c68f8b27911e4eef04087 | [] | no_license | wbq501/tby | dccfe8637edbd0f8db1a179293ba6e044168febd | db881aed32ee9f19131e04f6b257d4bc8b116c8b | refs/heads/master | 2020-03-18T13:56:00.487498 | 2018-06-22T03:37:33 | 2018-06-22T03:37:33 | 134,817,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,082 | java | package com.baigu.lrecyclerview.progressindicator.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.animation.LinearInterpolator;
import com.baigu.lrecyclerview.progressindicator.Indicator;
import java.util.ArrayList;
/**
* Created by Jack on 2015/10/19.
*/
public class BallTrianglePathIndicator extends Indicator {
float[] translateX=new float[3],translateY=new float[3];
@Override
public void draw(Canvas canvas, Paint paint) {
paint.setStrokeWidth(3);
paint.setStyle(Paint.Style.STROKE);
for (int i = 0; i < 3; i++) {
canvas.save();
canvas.translate(translateX[i], translateY[i]);
canvas.drawCircle(0, 0, getWidth() / 10, paint);
canvas.restore();
}
}
@Override
public ArrayList<ValueAnimator> onCreateAnimators() {
ArrayList<ValueAnimator> animators=new ArrayList<>();
float startX=getWidth()/5;
float startY=getWidth()/5;
for (int i = 0; i < 3; i++) {
final int index=i;
ValueAnimator translateXAnim= ValueAnimator.ofFloat(getWidth()/2,getWidth()-startX,startX,getWidth()/2);
if (i==1){
translateXAnim= ValueAnimator.ofFloat(getWidth()-startX,startX,getWidth()/2,getWidth()-startX);
}else if (i==2){
translateXAnim= ValueAnimator.ofFloat(startX,getWidth()/2,getWidth()-startX,startX);
}
ValueAnimator translateYAnim= ValueAnimator.ofFloat(startY,getHeight()-startY,getHeight()-startY,startY);
if (i==1){
translateYAnim= ValueAnimator.ofFloat(getHeight()-startY,getHeight()-startY,startY,getHeight()-startY);
}else if (i==2){
translateYAnim= ValueAnimator.ofFloat(getHeight()-startY,startY,getHeight()-startY,getHeight()-startY);
}
translateXAnim.setDuration(2000);
translateXAnim.setInterpolator(new LinearInterpolator());
translateXAnim.setRepeatCount(-1);
addUpdateListener(translateXAnim,new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
translateX [index]= (float) animation.getAnimatedValue();
postInvalidate();
}
});
translateYAnim.setDuration(2000);
translateYAnim.setInterpolator(new LinearInterpolator());
translateYAnim.setRepeatCount(-1);
addUpdateListener(translateYAnim,new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
translateY [index]= (float) animation.getAnimatedValue();
postInvalidate();
}
});
animators.add(translateXAnim);
animators.add(translateYAnim);
}
return animators;
}
}
| [
"749937855@qq.com"
] | 749937855@qq.com |
c0bcfc616caf40658e7ff9a384329ec2deda4b92 | 725252036d9ea34b58cd340623441065057314c9 | /spring-cloud/gateway/src/main/java/org/wyyt/springcloud/gateway/controller/RouteController.java | 14cff9f564c565744464ee2e7d164328b08ad7b1 | [] | no_license | ZhangNingPegasus/middleware | 7fd7565cd2aac0fee026b5696c9b5021ab753119 | 46428f43c31523786c03f10ee00949f6bc13ce19 | refs/heads/master | 2023-06-26T17:55:57.485006 | 2021-08-01T03:10:29 | 2021-08-01T03:10:29 | 303,567,345 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,813 | java | package org.wyyt.springcloud.gateway.controller;
import org.springframework.cloud.gateway.route.RouteDefinition;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wyyt.springcloud.gateway.anno.Auth;
import org.wyyt.springcloud.gateway.entity.BaseEntity;
import org.wyyt.springcloud.gateway.service.DynamicRouteService;
import org.wyyt.tool.rpc.Result;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.stream.Collectors;
/**
* the controller of Dynamic Routing
* <p>
*
* @author Ning.Zhang(Pegasus)
* *****************************************************************
* Name Action Time Description *
* Ning.Zhang Initialize 02/14/2021 Initialize *
* *****************************************************************
*/
@RestController
@RequestMapping("route")
public class RouteController {
private final DynamicRouteService dynamicRouteService;
public RouteController(final DynamicRouteService dynamicRouteService) {
this.dynamicRouteService = dynamicRouteService;
}
@Auth
@PostMapping("refresh")
public synchronized Mono<Result<Void>> refresh(final Mono<BaseEntity> data) {
return data.flatMap(d -> {
this.dynamicRouteService.refresh();
return Mono.just(Result.ok());
});
}
@Auth
@PostMapping(value = "listRoutes")
public Mono<Result<List<String>>> listRoutes(final Mono<BaseEntity> data) {
return data.flatMap(d -> Mono.just(Result.ok(this.dynamicRouteService.listRouteDefinition().values().stream().map(RouteDefinition::toString).collect(Collectors.toList()))));
}
} | [
"349409664@qq.com"
] | 349409664@qq.com |
eee1ce82ec7b40f828dcf10218b4205cd390ed48 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Chart/20/org/jfree/chart/plot/XYPlot_getDomainAxisForDataset_3148.java | 77291f2f5d58ed509afb58c6457b3152b53adb8c | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 5,530 | java |
org jfree chart plot
gener plot data form pair plot
data link dataset xydataset
code plot xyplot code make link item render xyitemrender draw point
plot render chart type
produc
link org jfree chart chart factori chartfactori method
creat pre configur chart
plot xyplot plot axi plot valueaxisplot
return domain axi dataset
param index dataset index
axi
axi valueaxi domain axi dataset getdomainaxisfordataset index
index index dataset count getdatasetcount
illeg argument except illegalargumentexcept index index
bound
axi valueaxi axi valueaxi
integ axi index axisindex integ dataset domain axi map datasettodomainaxismap
integ index
axi index axisindex
axi valueaxi domain axi getdomainaxi axi index axisindex intvalu
axi valueaxi domain axi getdomainaxi
axi valueaxi
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
83cf2ab0b817f4e04d677790299b19aa905946f6 | 144c99466cfb085f2015ec2dc2e67c54f1af1443 | /guyue-hive/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java | fc60e99f6714647c5a1d7fa19b8f5789b708851d | [] | no_license | guyuetftb/guyue-parents | 8c999c9ee510c141f4ddf31ee98d74e00d9287c7 | d15bd256e70c10819f86d018d7a3e7cc5c513005 | refs/heads/master | 2023-05-24T08:18:48.921990 | 2023-05-15T03:03:42 | 2023-05-15T03:03:42 | 132,435,187 | 3 | 3 | null | 2022-11-16T08:28:50 | 2018-05-07T09:05:27 | Java | UTF-8 | Java | false | false | 44,289 | 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.hive.service.cli.thrift;
import static com.google.common.base.Preconditions.checkArgument;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.security.auth.login.LoginException;
import org.apache.hadoop.hive.common.ServerUtils;
import org.apache.hadoop.hive.common.log.ProgressMonitor;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.hadoop.hive.shims.HadoopShims.KerberosNameShim;
import org.apache.hadoop.hive.shims.ShimLoader;
import org.apache.hive.service.AbstractService;
import org.apache.hive.service.ServiceException;
import org.apache.hive.service.ServiceUtils;
import org.apache.hive.service.auth.HiveAuthFactory;
import org.apache.hive.service.auth.TSetIpAddressProcessor;
import org.apache.hive.service.cli.CLIService;
import org.apache.hive.service.cli.FetchOrientation;
import org.apache.hive.service.cli.FetchType;
import org.apache.hive.service.cli.GetInfoType;
import org.apache.hive.service.cli.GetInfoValue;
import org.apache.hive.service.cli.HiveSQLException;
import org.apache.hive.service.cli.JobProgressUpdate;
import org.apache.hive.service.cli.OperationHandle;
import org.apache.hive.service.cli.OperationStatus;
import org.apache.hive.service.cli.OperationType;
import org.apache.hive.service.cli.ProgressMonitorStatusMapper;
import org.apache.hive.service.cli.RowSet;
import org.apache.hive.service.cli.SessionHandle;
import org.apache.hive.service.cli.TableSchema;
import org.apache.hive.service.cli.TezProgressMonitorStatusMapper;
import org.apache.hive.service.cli.operation.Operation;
import org.apache.hive.service.cli.session.SessionManager;
import org.apache.hive.service.rpc.thrift.TCLIService;
import org.apache.hive.service.rpc.thrift.TCancelDelegationTokenReq;
import org.apache.hive.service.rpc.thrift.TCancelDelegationTokenResp;
import org.apache.hive.service.rpc.thrift.TCancelOperationReq;
import org.apache.hive.service.rpc.thrift.TCancelOperationResp;
import org.apache.hive.service.rpc.thrift.TCloseOperationReq;
import org.apache.hive.service.rpc.thrift.TCloseOperationResp;
import org.apache.hive.service.rpc.thrift.TCloseSessionReq;
import org.apache.hive.service.rpc.thrift.TCloseSessionResp;
import org.apache.hive.service.rpc.thrift.TExecuteStatementReq;
import org.apache.hive.service.rpc.thrift.TExecuteStatementResp;
import org.apache.hive.service.rpc.thrift.TFetchResultsReq;
import org.apache.hive.service.rpc.thrift.TFetchResultsResp;
import org.apache.hive.service.rpc.thrift.TGetCatalogsReq;
import org.apache.hive.service.rpc.thrift.TGetCatalogsResp;
import org.apache.hive.service.rpc.thrift.TGetColumnsReq;
import org.apache.hive.service.rpc.thrift.TGetColumnsResp;
import org.apache.hive.service.rpc.thrift.TGetCrossReferenceReq;
import org.apache.hive.service.rpc.thrift.TGetCrossReferenceResp;
import org.apache.hive.service.rpc.thrift.TGetDelegationTokenReq;
import org.apache.hive.service.rpc.thrift.TGetDelegationTokenResp;
import org.apache.hive.service.rpc.thrift.TGetFunctionsReq;
import org.apache.hive.service.rpc.thrift.TGetFunctionsResp;
import org.apache.hive.service.rpc.thrift.TGetInfoReq;
import org.apache.hive.service.rpc.thrift.TGetInfoResp;
import org.apache.hive.service.rpc.thrift.TGetOperationStatusReq;
import org.apache.hive.service.rpc.thrift.TGetOperationStatusResp;
import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysReq;
import org.apache.hive.service.rpc.thrift.TGetPrimaryKeysResp;
import org.apache.hive.service.rpc.thrift.TGetResultSetMetadataReq;
import org.apache.hive.service.rpc.thrift.TGetResultSetMetadataResp;
import org.apache.hive.service.rpc.thrift.TGetSchemasReq;
import org.apache.hive.service.rpc.thrift.TGetSchemasResp;
import org.apache.hive.service.rpc.thrift.TGetTableTypesReq;
import org.apache.hive.service.rpc.thrift.TGetTableTypesResp;
import org.apache.hive.service.rpc.thrift.TGetTablesReq;
import org.apache.hive.service.rpc.thrift.TGetTablesResp;
import org.apache.hive.service.rpc.thrift.TGetTypeInfoReq;
import org.apache.hive.service.rpc.thrift.TGetTypeInfoResp;
import org.apache.hive.service.rpc.thrift.TJobExecutionStatus;
import org.apache.hive.service.rpc.thrift.TOpenSessionReq;
import org.apache.hive.service.rpc.thrift.TOpenSessionResp;
import org.apache.hive.service.rpc.thrift.TProgressUpdateResp;
import org.apache.hive.service.rpc.thrift.TProtocolVersion;
import org.apache.hive.service.rpc.thrift.TRenewDelegationTokenReq;
import org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp;
import org.apache.hive.service.rpc.thrift.TStatus;
import org.apache.hive.service.rpc.thrift.TStatusCode;
import org.apache.hive.service.server.HiveServer2;
import org.apache.thrift.TException;
import org.apache.thrift.server.ServerContext;
import org.apache.thrift.server.TServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ThriftCLIService.
*/
public abstract class ThriftCLIService extends AbstractService implements TCLIService.Iface, Runnable {
public static final Logger LOG = LoggerFactory.getLogger(ThriftCLIService.class.getName());
static final String LOG_GY_PREFIX = " MY_TEST .... ";
static final String LOG_GY_BEGIN = " Beginninggggggggggg ";
static final String LOG_GY_END = " Endingggggggggggggg ";
protected CLIService cliService;
private static final TStatus OK_STATUS = new TStatus(TStatusCode.SUCCESS_STATUS);
protected static HiveAuthFactory hiveAuthFactory;
protected int portNum;
protected InetAddress serverIPAddress;
protected String hiveHost;
protected TServer server;
protected org.eclipse.jetty.server.Server httpServer;
private boolean isStarted = false;
protected boolean isEmbedded = false;
protected HiveConf hiveConf;
protected int minWorkerThreads;
protected int maxWorkerThreads;
protected long workerKeepAliveTime;
protected ThreadLocal<ServerContext> currentServerContext;
static class ThriftCLIServerContext implements ServerContext {
private SessionHandle sessionHandle = null;
public void setSessionHandle(SessionHandle sessionHandle) {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " \t 000 ===> ThriftCLIServerContext.setSessionHandle() ");
LOG.info(LOG_GY_PREFIX + " \t ===> ThriftCLIServerContext.setSessionHandle() sessionHandle = " + sessionHandle);
this.sessionHandle = sessionHandle;
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " \t 999 ===> ThriftCLIServerContext.setSessionHandle() ");
}
public SessionHandle getSessionHandle() {
return sessionHandle;
}
}
public ThriftCLIService(CLIService service,
String serviceName) {
super(serviceName);
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 ThriftCLIService(CLIService, serviceName) ");
LOG.info(LOG_GY_PREFIX + " 1 \t ThriftCLIService(CLIService, serviceName) service = " + service.getClass().getName());
this.cliService = service;
currentServerContext = new ThreadLocal<ServerContext>();
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 ThriftCLIService(CLIService, serviceName) ");
}
@Override
public synchronized void init(HiveConf hiveConf) {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " init(hiveConf) ");
this.hiveConf = hiveConf;
String hiveHost = System.getenv("HIVE_SERVER2_THRIFT_BIND_HOST");
if (hiveHost == null) {
hiveHost = hiveConf.getVar(ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST);
}
try {
serverIPAddress = ServerUtils.getHostAddress(hiveHost);
} catch (UnknownHostException e) {
throw new ServiceException(e);
}
// Initialize common server configs needed in both binary & http modes
String portString;
// HTTP mode
if (HiveServer2.isHTTPTransportMode(hiveConf)) {
workerKeepAliveTime =
hiveConf.getTimeVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_WORKER_KEEPALIVE_TIME,
TimeUnit.SECONDS);
portString = System.getenv("HIVE_SERVER2_THRIFT_HTTP_PORT");
if (portString != null) {
portNum = Integer.parseInt(portString);
} else {
portNum = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_PORT);
}
}
// Binary mode
else {
workerKeepAliveTime =
hiveConf.getTimeVar(ConfVars.HIVE_SERVER2_THRIFT_WORKER_KEEPALIVE_TIME, TimeUnit.SECONDS);
portString = System.getenv("HIVE_SERVER2_THRIFT_PORT");
if (portString != null) {
portNum = Integer.parseInt(portString);
} else {
portNum = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_PORT);
}
}
minWorkerThreads = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_MIN_WORKER_THREADS);
maxWorkerThreads = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_MAX_WORKER_THREADS);
super.init(hiveConf);
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " init(hiveConf) ");
}
@Override
public synchronized void start() {
super.start();
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " start() ++++++++++++++++++++++++++++++++++++++++++++++++ ");
if (!isStarted && !isEmbedded) {
new Thread(this).start();
isStarted = true;
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " start() ++++++++++++++++++++++++++++++++++++++++++++++++ ");
}
@Override
public synchronized void stop() {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 stop() ");
if (isStarted && !isEmbedded) {
if (server != null) {
server.stop();
LOG.info("Thrift server has stopped");
}
if ((httpServer != null) && httpServer.isStarted()) {
try {
httpServer.stop();
LOG.info("Http server has stopped");
} catch (Exception e) {
LOG.error("Error stopping Http server: ", e);
}
}
isStarted = false;
}
super.stop();
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 stop() ");
}
public int getPortNumber() {
return portNum;
}
public InetAddress getServerIPAddress() {
return serverIPAddress;
}
@Override
public TGetDelegationTokenResp GetDelegationToken(TGetDelegationTokenReq req)
throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetDelegationToken(TGetDelegationTokenReq) ");
TGetDelegationTokenResp resp = new TGetDelegationTokenResp();
if (hiveAuthFactory == null || !hiveAuthFactory.isSASLKerberosUser()) {
resp.setStatus(unsecureTokenErrorStatus());
} else {
try {
String token = cliService.getDelegationToken(
new SessionHandle(req.getSessionHandle()),
hiveAuthFactory, req.getOwner(), req.getRenewer());
resp.setDelegationToken(token);
resp.setStatus(OK_STATUS);
} catch (HiveSQLException e) {
LOG.error("Error obtaining delegation token", e);
TStatus tokenErrorStatus = HiveSQLException.toTStatus(e);
tokenErrorStatus.setSqlState("42000");
resp.setStatus(tokenErrorStatus);
}
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetDelegationToken() ");
return resp;
}
@Override
public TCancelDelegationTokenResp CancelDelegationToken(TCancelDelegationTokenReq req)
throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 CancelDelegationToken(TCancelDelegationTokenReq) ");
TCancelDelegationTokenResp resp = new TCancelDelegationTokenResp();
if (hiveAuthFactory == null || !hiveAuthFactory.isSASLKerberosUser()) {
resp.setStatus(unsecureTokenErrorStatus());
} else {
try {
cliService.cancelDelegationToken(new SessionHandle(req.getSessionHandle()),
hiveAuthFactory, req.getDelegationToken());
resp.setStatus(OK_STATUS);
} catch (HiveSQLException e) {
LOG.error("Error canceling delegation token", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 CancelDelegationToken(TCancelDelegationTokenReq) ");
return resp;
}
@Override
public TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req)
throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 RenewDelegationToken(TRenewDelegationTokenReq) ");
TRenewDelegationTokenResp resp = new TRenewDelegationTokenResp();
if (hiveAuthFactory == null || !hiveAuthFactory.isSASLKerberosUser()) {
resp.setStatus(unsecureTokenErrorStatus());
} else {
try {
cliService.renewDelegationToken(new SessionHandle(req.getSessionHandle()),
hiveAuthFactory, req.getDelegationToken());
resp.setStatus(OK_STATUS);
} catch (HiveSQLException e) {
LOG.error("Error obtaining renewing token", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 RenewDelegationToken(TRenewDelegationTokenReq) ");
return resp;
}
private TStatus unsecureTokenErrorStatus() {
TStatus errorStatus = new TStatus(TStatusCode.ERROR_STATUS);
errorStatus.setErrorMessage("Delegation token only supported over remote " +
"client with kerberos authentication");
return errorStatus;
}
@Override
public TOpenSessionResp OpenSession(TOpenSessionReq req) throws TException {
// TODO lipeng ๆ นๆฎ ็ฎๅๆต่ฏ, ่ฟๆฏ hiveserver2 ็จๅบ็ๅๅง ๅ
ฅๅฃ
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " \t 000 OpenSession(TOpenSessionReq req) Client protocol version: " + req.getClient_protocol());
TOpenSessionResp resp = new TOpenSessionResp();
try {
Map<String, String> openConf = req.getConfiguration();
SessionHandle sessionHandle = getSessionHandle(req, resp);
resp.setSessionHandle(sessionHandle.toTSessionHandle());
Map<String, String> configurationMap = new HashMap<String, String>();
// Set the updated fetch size from the server into the configuration map for the client
HiveConf sessionConf = cliService.getSessionConf(sessionHandle);
configurationMap.put(
HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE.varname,
Integer.toString(sessionConf != null ?
sessionConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE) :
hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE)));
resp.setConfiguration(configurationMap);
resp.setStatus(OK_STATUS);
ThriftCLIServerContext context =
(ThriftCLIServerContext) currentServerContext.get();
if (context != null) {
context.setSessionHandle(sessionHandle);
}
} catch (Exception e) {
LOG.warn("Error opening session: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " \t 999 OpenSession(TOpenSessionReq req) Client protocol version: " + req.getClient_protocol());
return resp;
}
private String getIpAddress() {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 getIpAddress() ");
String clientIpAddress;
// Http transport mode.
// We set the thread local ip address, in ThriftHttpServlet.
if (cliService.getHiveConf().getVar(
ConfVars.HIVE_SERVER2_TRANSPORT_MODE).equalsIgnoreCase("http")) {
clientIpAddress = SessionManager.getIpAddress();
} else {
if (hiveAuthFactory != null && hiveAuthFactory.isSASLWithKerberizedHadoop()) {
clientIpAddress = hiveAuthFactory.getIpAddress();
}
// NOSASL
else {
clientIpAddress = TSetIpAddressProcessor.getUserIpAddress();
}
}
LOG.debug("Client's IP Address: " + clientIpAddress);
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 getIpAddress() ");
return clientIpAddress;
}
/**
* Returns the effective username.
* 1. If hive.server2.allow.user.substitution = false: the username of the connecting user
* 2. If hive.server2.allow.user.substitution = true: the username of the end user,
* that the connecting user is trying to proxy for.
* This includes a check whether the connecting user is allowed to proxy for the end user.
*
* @param req
*
* @return
*
* @throws HiveSQLException
*/
private String getUserName(TOpenSessionReq req) throws HiveSQLException, IOException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 getUserName(TOpenSessionReq) ");
String userName = null;
if (hiveAuthFactory != null && hiveAuthFactory.isSASLWithKerberizedHadoop()) {
userName = hiveAuthFactory.getRemoteUser();
}
// NOSASL
if (userName == null) {
userName = TSetIpAddressProcessor.getUserName();
}
// Http transport mode.
// We set the thread local username, in ThriftHttpServlet.
if (cliService.getHiveConf().getVar(
ConfVars.HIVE_SERVER2_TRANSPORT_MODE).equalsIgnoreCase("http")) {
userName = SessionManager.getUserName();
}
if (userName == null) {
userName = req.getUsername();
}
userName = getShortName(userName);
String effectiveClientUser = getProxyUser(userName, req.getConfiguration(), getIpAddress());
LOG.debug("Client's username: " + effectiveClientUser);
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 getUserName() ");
return effectiveClientUser;
}
private String getShortName(String userName) throws IOException {
String ret = null;
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 getShortName(userName) ");
if (userName != null) {
if (hiveAuthFactory != null && hiveAuthFactory.isSASLKerberosUser()) {
// KerberosName.getShorName can only be used for kerberos user, but not for the user
// logged in via other authentications such as LDAP
KerberosNameShim fullKerberosName = ShimLoader.getHadoopShims().getKerberosNameShim(userName);
ret = fullKerberosName.getShortName();
} else {
int indexOfDomainMatch = ServiceUtils.indexOfDomainMatch(userName);
ret = (indexOfDomainMatch <= 0) ? userName : userName.substring(0, indexOfDomainMatch);
}
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 getShortName(userName) ");
return ret;
}
/**
* Create a session handle
*
* @param req
* @param res
*
* @return
*
* @throws HiveSQLException
* @throws LoginException
* @throws IOException
*/
SessionHandle getSessionHandle(TOpenSessionReq req,
TOpenSessionResp res)
throws HiveSQLException, LoginException, IOException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 getSessionHandle(TOpenSessionReq,TOpenSessionResp) ");
String userName = getUserName(req);
String ipAddress = getIpAddress();
TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION,
req.getClient_protocol());
SessionHandle sessionHandle;
if (cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS) &&
(userName != null)) {
String delegationTokenStr = getDelegationToken(userName);
sessionHandle = cliService.openSessionWithImpersonation(protocol, userName,
req.getPassword(), ipAddress, req.getConfiguration(), delegationTokenStr);
} else {
sessionHandle = cliService.openSession(protocol, userName, req.getPassword(),
ipAddress, req.getConfiguration());
}
res.setServerProtocolVersion(protocol);
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 getSessionHandle(TOpenSessionReq,TOpenSessionResp) ");
return sessionHandle;
}
private double getProgressedPercentage(OperationHandle opHandle) throws HiveSQLException {
checkArgument(OperationType.EXECUTE_STATEMENT.equals(opHandle.getOperationType()));
Operation operation = cliService.getSessionManager().getOperationManager().getOperation(opHandle);
SessionState state = operation.getParentSession().getSessionState();
ProgressMonitor monitor = state.getProgressMonitor();
return monitor == null ? 0.0 : monitor.progressedPercentage();
}
private String getDelegationToken(String userName)
throws HiveSQLException, LoginException, IOException {
try {
return cliService.getDelegationTokenFromMetaStore(userName);
} catch (UnsupportedOperationException e) {
// The delegation token is not applicable in the given deployment mode
// such as HMS is not kerberos secured
}
return null;
}
private TProtocolVersion getMinVersion(TProtocolVersion... versions) {
TProtocolVersion[] values = TProtocolVersion.values();
int current = values[values.length - 1].getValue();
for (TProtocolVersion version : versions) {
if (current > version.getValue()) {
current = version.getValue();
}
}
for (TProtocolVersion version : values) {
if (version.getValue() == current) {
return version;
}
}
throw new IllegalArgumentException("never");
}
@Override
public TCloseSessionResp CloseSession(TCloseSessionReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 CloseSession(TCloseSessionReq) ");
TCloseSessionResp resp = new TCloseSessionResp();
try {
SessionHandle sessionHandle = new SessionHandle(req.getSessionHandle());
cliService.closeSession(sessionHandle);
resp.setStatus(OK_STATUS);
ThriftCLIServerContext context =
(ThriftCLIServerContext) currentServerContext.get();
if (context != null) {
context.setSessionHandle(null);
}
} catch (Exception e) {
LOG.warn("Error closing session: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 CloseSession(TCloseSessionReq) ");
return resp;
}
@Override
public TGetInfoResp GetInfo(TGetInfoReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetInfo(TGetInfoReq) ");
TGetInfoResp resp = new TGetInfoResp();
try {
GetInfoValue getInfoValue =
cliService.getInfo(new SessionHandle(req.getSessionHandle()),
GetInfoType.getGetInfoType(req.getInfoType()));
resp.setInfoValue(getInfoValue.toTGetInfoValue());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting info: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetInfo(TGetInfoReq) ");
return resp;
}
@Override
public TExecuteStatementResp ExecuteStatement(TExecuteStatementReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 ExecuteStatement(TExecuteStatementReq) 00000000000000000000000000000000000000000000000000000000000000000000000000");
TExecuteStatementResp resp = new TExecuteStatementResp();
try {
SessionHandle sessionHandle = new SessionHandle(req.getSessionHandle());
LOG.info(LOG_GY_PREFIX + " \t 0 ExecuteStatement(TExecuteStatementReq) sessionHandle = " + sessionHandle.getClass().getName());
String statement = req.getStatement();
LOG.info(LOG_GY_PREFIX + " \t 1 ExecuteStatement(TExecuteStatementReq) statement = " + statement);
Map<String, String> confOverlay = req.getConfOverlay();
Boolean runAsync = req.isRunAsync();
LOG.info(LOG_GY_PREFIX + " \t 2 ExecuteStatement(TExecuteStatementReq) runAsync = " + runAsync);
long queryTimeout = req.getQueryTimeout();
LOG.info(LOG_GY_PREFIX + " \t 3 ExecuteStatement(TExecuteStatementReq) queryTimeout = " + queryTimeout);
OperationHandle operationHandle =
runAsync ? cliService.executeStatementAsync(sessionHandle, statement, confOverlay, queryTimeout)
: cliService.executeStatement(sessionHandle, statement, confOverlay, queryTimeout);
LOG.info(LOG_GY_PREFIX + " \t 4 ExecuteStatement(TExecuteStatementReq) operationHandle = " + operationHandle.getClass().getName());
LOG.info(LOG_GY_PREFIX + " \t 5 ExecuteStatement(TExecuteStatementReq) operationHandle.toString = " + operationHandle.toString());
LOG.info(LOG_GY_PREFIX + " \t 6 ExecuteStatement(TExecuteStatementReq) operationHandle.toTOperationHandle.toString = " + operationHandle.toTOperationHandle().toString());
resp.setOperationHandle(operationHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
// Note: it's rather important that this (and other methods) catch Exception, not Throwable;
// in combination with HiveSessionProxy.invoke code, perhaps unintentionally, it used
// to also catch all errors; and now it allows OOMs only to propagate.
LOG.warn("Error executing statement: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 ExecuteStatement(TExecuteStatementReq) 999999999999999999999999999999999999999999999999999999999999999999999999999999999 ");
return resp;
}
@Override
public TGetTypeInfoResp GetTypeInfo(TGetTypeInfoReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetTypeInfo(TGetTypeInfoReq) ");
TGetTypeInfoResp resp = new TGetTypeInfoResp();
try {
OperationHandle operationHandle = cliService.getTypeInfo(new SessionHandle(req.getSessionHandle()));
resp.setOperationHandle(operationHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting type info: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetTypeInfo(TGetTypeInfoReq) ");
return resp;
}
@Override
public TGetCatalogsResp GetCatalogs(TGetCatalogsReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetCatalogs(TGetCatalogsReq) ");
TGetCatalogsResp resp = new TGetCatalogsResp();
try {
OperationHandle opHandle = cliService.getCatalogs(new SessionHandle(req.getSessionHandle()));
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting catalogs: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetCatalogs(TGetCatalogsReq) ");
return resp;
}
@Override
public TGetSchemasResp GetSchemas(TGetSchemasReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetSchemas(TGetSchemasReq) ");
TGetSchemasResp resp = new TGetSchemasResp();
try {
OperationHandle opHandle = cliService.getSchemas(
new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting schemas: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetSchemas(TGetSchemasReq) ");
return resp;
}
@Override
public TGetTablesResp GetTables(TGetTablesReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetTables(TGetTablesReq) ");
TGetTablesResp resp = new TGetTablesResp();
try {
OperationHandle opHandle = cliService
.getTables(new SessionHandle(req.getSessionHandle()), req.getCatalogName(),
req.getSchemaName(), req.getTableName(), req.getTableTypes());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting tables: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetTables(TGetTablesReq) ");
return resp;
}
@Override
public TGetTableTypesResp GetTableTypes(TGetTableTypesReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetTableTypes(TGetTableTypesReq) ");
TGetTableTypesResp resp = new TGetTableTypesResp();
try {
OperationHandle opHandle = cliService.getTableTypes(new SessionHandle(req.getSessionHandle()));
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting table types: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetTableTypes(TGetTableTypesReq) ");
return resp;
}
@Override
public TGetColumnsResp GetColumns(TGetColumnsReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetColumns(TGetColumnsReq) ");
TGetColumnsResp resp = new TGetColumnsResp();
try {
OperationHandle opHandle = cliService.getColumns(
new SessionHandle(req.getSessionHandle()),
req.getCatalogName(),
req.getSchemaName(),
req.getTableName(),
req.getColumnName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting columns: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetColumns(TGetColumnsReq) ");
return resp;
}
@Override
public TGetFunctionsResp GetFunctions(TGetFunctionsReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetFunctions(TGetFunctionsReq) ");
TGetFunctionsResp resp = new TGetFunctionsResp();
try {
OperationHandle opHandle = cliService.getFunctions(
new SessionHandle(req.getSessionHandle()), req.getCatalogName(),
req.getSchemaName(), req.getFunctionName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting functions: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetFunctions(TGetFunctionsReq) ");
return resp;
}
@Override
public TGetOperationStatusResp GetOperationStatus(TGetOperationStatusReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetOperationStatus(TGetOperationStatusReq) ");
TGetOperationStatusResp resp = new TGetOperationStatusResp();
OperationHandle operationHandle = new OperationHandle(req.getOperationHandle());
try {
OperationStatus operationStatus =
cliService.getOperationStatus(operationHandle, req.isGetProgressUpdate());
resp.setOperationState(operationStatus.getState().toTOperationState());
HiveSQLException opException = operationStatus.getOperationException();
resp.setTaskStatus(operationStatus.getTaskStatus());
resp.setOperationStarted(operationStatus.getOperationStarted());
resp.setOperationCompleted(operationStatus.getOperationCompleted());
resp.setHasResultSet(operationStatus.getHasResultSet());
JobProgressUpdate progressUpdate = operationStatus.jobProgressUpdate();
ProgressMonitorStatusMapper mapper = ProgressMonitorStatusMapper.DEFAULT;
if ("tez".equals(hiveConf.getVar(ConfVars.HIVE_EXECUTION_ENGINE))) {
mapper = new TezProgressMonitorStatusMapper();
}
TJobExecutionStatus executionStatus =
mapper.forStatus(progressUpdate.status);
resp.setProgressUpdateResponse(new TProgressUpdateResp(
progressUpdate.headers(),
progressUpdate.rows(),
progressUpdate.progressedPercentage,
executionStatus,
progressUpdate.footerSummary,
progressUpdate.startTimeMillis
));
if (opException != null) {
resp.setSqlState(opException.getSQLState());
resp.setErrorCode(opException.getErrorCode());
resp.setErrorMessage(org.apache.hadoop.util.StringUtils.
stringifyException(opException));
} else if (executionStatus == TJobExecutionStatus.NOT_AVAILABLE
&& OperationType.EXECUTE_STATEMENT.equals(operationHandle.getOperationType())) {
resp.getProgressUpdateResponse().setProgressedPercentage(
getProgressedPercentage(operationHandle));
}
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting operation status: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetOperationStatus(TGetOperationStatusReq) ");
return resp;
}
@Override
public TCancelOperationResp CancelOperation(TCancelOperationReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 CancelOperation(TCancelOperationReq) ");
TCancelOperationResp resp = new TCancelOperationResp();
try {
cliService.cancelOperation(new OperationHandle(req.getOperationHandle()));
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error cancelling operation: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 CancelOperation(TCancelOperationReq) ");
return resp;
}
@Override
public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 CloseOperation(TCloseOperationReq) ");
TCloseOperationResp resp = new TCloseOperationResp();
try {
cliService.closeOperation(new OperationHandle(req.getOperationHandle()));
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error closing operation: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 CloseOperation(TCloseOperationReq) ");
return resp;
}
@Override
public TGetResultSetMetadataResp GetResultSetMetadata(TGetResultSetMetadataReq req)
throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetResultSetMetadata(TGetResultSetMetadataReq) ");
TGetResultSetMetadataResp resp = new TGetResultSetMetadataResp();
try {
TableSchema schema = cliService.getResultSetMetadata(new OperationHandle(req.getOperationHandle()));
resp.setSchema(schema.toTTableSchema());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting result set metadata: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetResultSetMetadata(TGetResultSetMetadataReq) ");
return resp;
}
@Override
public TFetchResultsResp FetchResults(TFetchResultsReq req) throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 FetchResults(TFetchResultsReq req) ");
TFetchResultsResp resp = new TFetchResultsResp();
try {
// Set fetch size
int maxFetchSize = hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_MAX_FETCH_SIZE);
if (req.getMaxRows() > maxFetchSize) {
req.setMaxRows(maxFetchSize);
}
// TODO lipeng
// ThriftCLIService.FetchResults -> CLIService.fetchResults
RowSet rowSet = cliService.fetchResults(
new OperationHandle(req.getOperationHandle()),
FetchOrientation.getFetchOrientation(req.getOrientation()),
req.getMaxRows(),
FetchType.getFetchType(req.getFetchType()));
resp.setResults(rowSet.toTRowSet());
resp.setHasMoreRows(false);
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error fetching results: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 FetchResults(TFetchResultsReq req) ");
return resp;
}
@Override
public TGetPrimaryKeysResp GetPrimaryKeys(TGetPrimaryKeysReq req)
throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetPrimaryKeys(TGetPrimaryKeysReq) ");
TGetPrimaryKeysResp resp = new TGetPrimaryKeysResp();
try {
OperationHandle opHandle = cliService.getPrimaryKeys(
new SessionHandle(req.getSessionHandle()), req.getCatalogName(),
req.getSchemaName(), req.getTableName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting functions: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetPrimaryKeys(TGetPrimaryKeysReq) ");
return resp;
}
@Override
public TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req)
throws TException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 GetCrossReference(TGetCrossReferenceReq) ");
TGetCrossReferenceResp resp = new TGetCrossReferenceResp();
try {
OperationHandle opHandle = cliService.getCrossReference(
new SessionHandle(req.getSessionHandle()), req.getParentCatalogName(),
req.getParentSchemaName(), req.getParentTableName(),
req.getForeignCatalogName(), req.getForeignSchemaName(), req.getForeignTableName());
resp.setOperationHandle(opHandle.toTOperationHandle());
resp.setStatus(OK_STATUS);
} catch (Exception e) {
LOG.warn("Error getting functions: ", e);
resp.setStatus(HiveSQLException.toTStatus(e));
}
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 GetCrossReference(TGetCrossReferenceReq) ");
return resp;
}
@Override
public abstract void run();
/**
* If the proxy user name is provided then check privileges to substitute the user.
*
* @param realUser
* @param sessionConf
* @param ipAddress
*
* @return
*
* @throws HiveSQLException
*/
private String getProxyUser(String realUser,
Map<String, String> sessionConf,
String ipAddress) throws HiveSQLException {
LOG.info(LOG_GY_PREFIX + LOG_GY_BEGIN + " 000 getProxyUser(realUser, sessionConf, ipAddress) ");
String proxyUser = null;
// Http transport mode.
// We set the thread local proxy username, in ThriftHttpServlet.
if (cliService.getHiveConf().getVar(
ConfVars.HIVE_SERVER2_TRANSPORT_MODE).equalsIgnoreCase("http")) {
proxyUser = SessionManager.getProxyUserName();
LOG.debug("Proxy user from query string: " + proxyUser);
}
if (proxyUser == null && sessionConf != null && sessionConf.containsKey(HiveAuthFactory.HS2_PROXY_USER)) {
String proxyUserFromThriftBody = sessionConf.get(HiveAuthFactory.HS2_PROXY_USER);
LOG.debug("Proxy user from thrift body: " + proxyUserFromThriftBody);
proxyUser = proxyUserFromThriftBody;
}
if (proxyUser == null) {
return realUser;
}
// check whether substitution is allowed
if (!hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ALLOW_USER_SUBSTITUTION)) {
throw new HiveSQLException("Proxy user substitution is not allowed");
}
// If there's no authentication, then directly substitute the user
if (HiveAuthFactory.AuthTypes.NONE.toString().
equalsIgnoreCase(hiveConf.getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION))) {
return proxyUser;
}
// Verify proxy user privilege of the realUser for the proxyUser
HiveAuthFactory.verifyProxyAccess(realUser, proxyUser, ipAddress, hiveConf);
LOG.debug("Verified proxy user: " + proxyUser);
LOG.info(LOG_GY_PREFIX + LOG_GY_END + " 999 getProxyUser(realUser, sessionConf, ipAddress) ");
return proxyUser;
}
}
| [
"lipeng02@missfresh.cn"
] | lipeng02@missfresh.cn |
2a8225d72426874420874222fef51639a31919b6 | 8361bf5c73adddfbc45a1078a1f8344277c1c9f9 | /src/org/minima/system/input/functions/send.java | c01e2e7df8eb0dd24224018c3eeb6fadd8619378 | [
"Apache-2.0"
] | permissive | glowkeeper/Minima | c4ee472afe8f373a0e4f7e6003ffb95958c483d8 | aa503faf971f1baa9cd0fbc3dbb7d24e4291e432 | refs/heads/master | 2023-07-12T00:56:59.811620 | 2021-08-16T16:13:21 | 2021-08-16T16:13:21 | 265,194,447 | 0 | 0 | Apache-2.0 | 2020-05-19T08:48:24 | 2020-05-19T08:48:23 | null | UTF-8 | Java | false | false | 1,221 | java | package org.minima.system.input.functions;
import org.minima.system.brains.ConsensusHandler;
import org.minima.system.input.CommandFunction;
import org.minima.utils.messages.Message;
public class send extends CommandFunction{
public send() {
super("send");
setHelp("[amount] [address] (tokenid|tokenid statevars)", "Send Minima or Tokens to a certain address.", "");
}
@Override
public void doFunction(String[] zInput) throws Exception {
//The details
String amount = zInput[1];
String address = zInput[2];
String tokenid = "0x00";
String state = "";
//Is token ID Specified..
if(zInput.length>3) {
tokenid = zInput[3];
}
//Are the state vars specified
if(zInput.length>4) {
state = zInput[4];
}
//Create a message
Message sender = getResponseMessage(ConsensusHandler.CONSENSUS_CREATETRANS);
sender.addString("address", address);
sender.addString("amount", amount);
sender.addString("tokenid", tokenid);
sender.addString("state", state);
//Send it to the miner..
getMainHandler().getConsensusHandler().PostMessage(sender);
}
@Override
public CommandFunction getNewFunction() {
// TODO Auto-generated method stub
return new send();
}
}
| [
"patrickcerri@gmail.com"
] | patrickcerri@gmail.com |
96e3cd1b11189896fbc2adad390e5d7e69bb11cd | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_374/Testnull_37393.java | 084db0801c9a02f789e93684c4960a16a2cab250 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 308 | java | package org.gradle.test.performancenull_374;
import static org.junit.Assert.*;
public class Testnull_37393 {
private final Productionnull_37393 production = new Productionnull_37393("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
999a879b04ed954759f45c8a98d2294f17f53697 | 1114bf308197726e965c2bc3c545d4c4c88502ab | /src/mypack/ComparatorExmp.java | 5eae66614fd4463d8478814f0c86ec911ce8ff0a | [] | no_license | palchandu/Learn | e882127416d92edad85f9560b55847464e6001fc | e6cf47486fca662f5573845a3afb9cd7a9e25ba8 | refs/heads/master | 2021-05-04T05:40:16.394544 | 2018-02-05T18:18:31 | 2018-02-05T18:18:31 | 120,343,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package mypack;
import java.util.*;
public class ComparatorExmp {
public static void main(String []args)
{
Book b1,b2,b3;
b1=new Book("PHP",300.00);
b2=new Book("Java",500.00);
b3=new Book("AngularJs",600.00);
TreeSet<Book> s=new TreeSet<Book>(new MyComparator());
s.add(b1);
s.add(b2);
s.add(b3);
Iterator<Book> it=s.iterator();
Book b;
while(it.hasNext())
{
b=it.next();
System.out.println(b.getTitle()+" "+b.getPrice());
}
}
}
| [
"chandu2013pal@gmail.com"
] | chandu2013pal@gmail.com |
8dbca1be4b47d45192bddc02ca583ab24ad79d05 | 26f1760834fca474a074384fc16e14c3196bc507 | /lab7in/lab7in/TestDatabaseServer.java | 3fa08d474b23f8bf4e129a15bbfdbe8a1117694b | [] | no_license | LinMatthewTiger/SoftwareEnginneringProjects | c83641c7017891c55e484fc804e4ae01cc7d0fc1 | 7e5241fd4d4fe7f92eb7a691e0a943f1cd868f1e | refs/heads/master | 2020-07-16T01:28:11.171667 | 2019-11-23T18:34:28 | 2019-11-23T18:34:28 | 205,691,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | package lab7in;
import java.sql.SQLException;
import java.util.ArrayList;
public class TestDatabaseServer {
public static void main(String[] args) {
// TODO Auto-generated method stub
// Make sure there are 2 command line arguments.
if (args.length < 2)
{
System.out.println("This program requires 2 command line arguments.");
return;
}
// Get the command line arguments.
String command = args[0];
String type = args[1];
// Create the database object.
Database database = new Database();
// Execute a query if Q was specified.
if (type.equals("Q"))
{
// Do the query.
ArrayList<String> result = database.query(command);
// Print the result.
if (result != null)
{
for (String row : result)
{
System.out.println(row);
}
}
else
{
System.out.println("Error executing query.");
}
}
// Execute DML if D was specified.
else if (type.equals("D"))
{
// Run the DML.
try
{
database.executeDML(command);
}
catch(SQLException sql)
{
System.out.println("Error executing DML.");
}
}
}
}
| [
"mlin4@cub.uca.edu"
] | mlin4@cub.uca.edu |
4abcd1dbd2dad518d0a85da37252a56b31a27b1d | 4dda2b528aa7d7e56a85b612e930531f57e810b3 | /app/src/main/java/com/HyKj/UKeBao/model/bean/RecycleViewBaen.java | 360ec5b957cefa01b3d7272125a787e93e3832bc | [] | no_license | qianggezaicunjin/UKeBao | d80cc5fcdfc872ea19326afda34409468a4da37a | cd8f4d4c60d1a844f685202e4f80e5a33f5c4e97 | refs/heads/master | 2021-01-10T23:06:05.066975 | 2016-12-21T03:21:18 | 2016-12-21T03:21:20 | 70,440,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,198 | java | package com.HyKj.UKeBao.model.bean;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import java.util.List;
/**
* ็จไบBindingAdapterไธญ็girdviewๆนๆณ็ๆฐๆฎๅญๅจ
* Created by Administrator on 2016/10/11.
*/
public class RecycleViewBaen {
public int num;
public Context mContext;
public RecyclerView.Adapter adapter;
public int mode;
public RecyclerView.Adapter getAdapter() {
return adapter;
}
public int getMode() {
return mode;
}
public void setMode(int mode) {
this.mode = mode;
}
public void setAdapter(RecyclerView.Adapter adapter) {
this.adapter = adapter;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public Context getmContext() {
return mContext;
}
public void setmContext(Context mContext) {
this.mContext = mContext;
}
@Override
public String toString() {
return "RecycleViewBaen{" +
"mContext=" + mContext +
", num=" + num +
", mode='" + mode + '\'' +
'}';
}
}
| [
"498133565@qq.com"
] | 498133565@qq.com |
57f934c3f5f5c3cd677c7780d868b1cdfc00fde9 | 94a0dbf676d5249d7a9aa3b6137d7c06690183c1 | /app/src/main/java/com/petm/property/enums/EnumBusinessType.java | 5d896caa1e8d314a67a8e2224c30400c2f652b77 | [] | no_license | JuxinWang/MantotoCN-PetM-Android | 544ddf203eefb7ab248ff6a34807b7eeb8061b69 | b7edab9cf6225c82565e0cf4ba619ef7422b5f1c | refs/heads/master | 2020-04-14T17:01:11.543852 | 2016-09-30T09:22:43 | 2016-09-30T09:22:43 | 68,000,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.petm.property.enums;
public enum EnumBusinessType {
NULL(0, "็ฉบๆฐๆฎ"),
PET(1, "ๅฎ ็ฉๅบ"),
REPAIR(2, "ๅฎถๅบญ็ปดไฟฎ");
private int type;
private String desc;
EnumBusinessType(int type, String desc) {
this.type = type;
this.desc = desc;
}
public int getType() {
return type;
}
public String getDesc() {
return this.desc;
}
}
| [
"liudongdong_922@163.com"
] | liudongdong_922@163.com |
f2d6b5677bb7d48938a5f8668fd3420bd85896ee | 71f3e192dbb74b00e56c828aab29ff191e3e1d47 | /Chapter Five/src/exercises/ThreeHeads.java | 21eab54017793c62a6da58c186d1f196d024fd49 | [] | no_license | moeinp/building-java-programs-4th-edition | f5763f5fbb6ed1fa7e6beb993d0cd3d4b74289d3 | f5fe3934d5e1544a1e30f026bfe21b197f1500cd | refs/heads/master | 2020-10-01T03:58:05.405934 | 2020-01-17T17:34:42 | 2020-01-17T17:34:42 | 227,449,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package exercises;
import java.util.Random;
public class ThreeHeads {
public static void main(String[] args) {
threeHeads();
}
public static void threeHeads() {
Random ran = new Random();
int count = 0;
while (count < 3) {
boolean random = ran.nextBoolean();
if(random) {
System.out.print("H ");
count += 1;
}else {
System.out.print("T ");
count = 0;
}
}
System.out.println();
System.out.println("Three heads in a row!");
}
}
| [
"moeined@gmail.com"
] | moeined@gmail.com |
93d1c433c32236491dc52e54c81bdf6aee4a05b5 | 98532ac71ed7f3bf35ce66870c9c1148d2c45cd2 | /MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapUtils.java | a88e5aeda5940d6e8a7b2a754d0248b9d09d6987 | [] | no_license | androidresource/mapbox-custom | 50f50dc2a79bea1059b48f19d21872358c814c7a | a590687cea51b03498eaf70c7cd4c2f63b634b40 | refs/heads/master | 2021-01-19T00:10:50.128984 | 2016-12-16T20:48:19 | 2016-12-16T20:48:19 | 84,385,015 | 1 | 0 | null | 2017-03-09T01:44:39 | 2017-03-09T01:44:39 | null | UTF-8 | Java | false | false | 349 | java | package com.mapbox.mapboxsdk.maps;
/**
* Utility class to bypass package visibility
*/
public class MapboxMapUtils {
public static void setDirection(MapView mapView, float direction) {
mapView.setBearing(direction);
}
public static void setTilt(MapView mapView, float tilt) {
mapView.setTilt((double) tilt);
}
}
| [
"hongchangpz@gmail.com"
] | hongchangpz@gmail.com |
5dd5afc75fb5f02d382903868cf0c95d40f7566e | 534e54ed1e63fa4d36401b0b9871f9e184399131 | /src/main/java/com/gf/onlyforhebe/entity/Items.java | 3538bdc9678ff5545f54d187c1dd93e6c274c98c | [] | no_license | gfhejun/xstream-demo | 42e8ac8b093de76a909e6e9fe57bfbc9e8fe058d | 596aade099400bc68654c328ba7965c562473d1a | refs/heads/master | 2021-06-01T00:52:20.644686 | 2016-06-23T01:42:15 | 2016-06-23T01:42:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java | package com.gf.onlyforhebe.entity;
import java.util.List;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import lombok.Data;
@XStreamAlias(value="Items")
public @Data class Items {
@XStreamImplicit //ๅป้คListๆๅคๅฑ็ๆ ็ญพ๏ผ็ดๆฅๆพ็คบ้้ข็<Item></Item>
private List<Item> items;
public void print(Items i){
items = i.getItems();
for (Item item : items){
StringBuilder sb = new StringBuilder();
String type = item.getType();
sb.append("item id=");
sb.append(item.getId());
sb.append(";type=");
sb.append(type);
sb.append(";description=");
sb.append(item.getDescription());
if (type.equals("content")){
sb.append(";item content=");
sb.append(item.getContent());
}else{
sb.append(";item link=");
sb.append(item.getLink());
List<Attachment> list = item.getAttachmentList();
for (Attachment attachment : list){
sb.append(";attachment name=" + attachment.getName());
sb.append(";size=" + attachment.getSize());
sb.append(";path=" + attachment.getPath());
}
}
System.out.println(sb.toString());
}
}
}
| [
"342552254@qq.com"
] | 342552254@qq.com |
a51880cc63d96636c240f086d5a3360d9ce06d9d | e1f8c5bfa1140afd4a45b030599d0b29dc22b635 | /javarush/test/level30/lesson15/big01/client/BotClient.java | 5b33e250e720ac51a2e112f7dde2afd0c78439b7 | [] | no_license | behemoth-13/repository01 | 050822f554ac000e5d10595a2c8f8b35198a73b5 | a913ff56e2a1e9110862e926fcf99efcb5fc93b2 | refs/heads/master | 2021-01-12T11:52:03.883520 | 2017-02-11T13:46:52 | 2017-02-11T13:46:52 | 69,594,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,826 | java | package com.javarush.test.level30.lesson15.big01.client;
import com.javarush.test.level30.lesson15.big01.ConsoleHelper;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/**
* Created by Alex on 16.09.2016.
*/
public class BotClient extends Client
{
public static void main(String[] args)
{
BotClient bot = new BotClient();
bot.run();
}
private static int botCount = 0;
@Override
protected boolean shouldSentTextFromConsole()
{
return false;
}
@Override
protected String getUserName()
{
if (botCount == 99)
botCount = 0;
return "date_bot_" + botCount++;
}
@Override
protected SocketThread getSocketThread()
{
return new BotSocketThread();
}
public class BotSocketThread extends SocketThread{
@Override
protected void clientMainLoop() throws IOException, ClassNotFoundException
{
sendTextMessage("ะัะธะฒะตั ัะฐัะธะบั. ะฏ ะฑะพั. ะะพะฝะธะผะฐั ะบะพะผะฐะฝะดั: ะดะฐัะฐ, ะดะตะฝั, ะผะตััั, ะณะพะด, ะฒัะตะผั, ัะฐั, ะผะธะฝััั, ัะตะบัะฝะดั.");
super.clientMainLoop();
}
@Override
protected void processIncomingMessage(String message)
{
ConsoleHelper.writeMessage(message);
String senderName = "";
String senderMessageText;
if (message.contains(": ")) {
senderName = message.substring(0, message.indexOf(": "));
senderMessageText = message.substring(message.indexOf(": ") + 2);
}
else {
senderMessageText = message;
}
Calendar calendar = Calendar.getInstance();
SimpleDateFormat simpleDateFormat = null;
switch(senderMessageText){
case "ะดะฐัะฐ": simpleDateFormat = new SimpleDateFormat("d.MM.YYYY"); break;
case "ะดะตะฝั": simpleDateFormat = new SimpleDateFormat("d"); break;
case "ะผะตััั": simpleDateFormat = new SimpleDateFormat("MMMM"); break;
case "ะณะพะด": simpleDateFormat = new SimpleDateFormat("YYYY"); break;
case "ะฒัะตะผั": simpleDateFormat = new SimpleDateFormat("H:mm:ss"); break;
case "ัะฐั": simpleDateFormat = new SimpleDateFormat("H"); break;
case "ะผะธะฝััั": simpleDateFormat = new SimpleDateFormat("m"); break;
case "ัะตะบัะฝะดั": simpleDateFormat = new SimpleDateFormat("s"); break;
}
if (simpleDateFormat != null)
{
sendTextMessage("ะะฝัะพัะผะฐัะธั ะดะปั " + senderName + ": " + simpleDateFormat.format(calendar.getTime()));
}
}
}
}
| [
"behemoth-13@yandex.ru"
] | behemoth-13@yandex.ru |
76fb29e2eeaaf405b5027ee88c12a6eaf0792326 | 892f265d3e1e74ae538347c77498501f2b4b7f75 | /src/main/java/com/sda/enums/Main.java | 3418996a7277889e794c7f45b247603512ad8529 | [] | no_license | IanaNeaga/object-oriented | 203f8e3ddbe1772abcf8a4e7b1662db5937d4853 | 16c1c4e7a2c19dd229ae8ee0df4fa9efeb92ca6d | refs/heads/master | 2020-07-19T01:03:24.211051 | 2019-09-04T15:08:43 | 2019-09-04T15:08:43 | 206,347,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,370 | java | package com.sda.enums;
import java.util.LinkedList;
import java.util.List;
public class Main {
public static void main(String[] args) {
Highway a1=new Highway(LengthUnit.KILOMETER,110);
Highway a2=new Highway(LengthUnit.CENTIMETER,300_000_000);
Highway a16=new Highway(LengthUnit.METER,1);
List<Highway> highways = new LinkedList<>();
highways.add(a1);
highways.add(a2);
highways.add(a16);
for(Highway temp:highways){
switch(temp.getUnit()){
case METER:
System.out.println("A16 has "+temp.getLength()*0.001+" km");
break;
case KILOMETER:
System.out.println("A1 has "+temp.getLength()+" km");
break;
case CENTIMETER:
System.out.println("A2 has "+temp.getLength()*0.000001+" km");
break;
default:
System.out.println("Unit not recognized.");
}
}
printEnumValues();
}
//Obtinem toate valorile enumului apeland metoda
//values() mostenita din clasa Enum.(java.lang)
static void printEnumValues(){
LengthUnit[] units = LengthUnit.values();
for(LengthUnit temp:units){
System.out.println(temp);
}
}
}
| [
"neagaiana@gmail.com"
] | neagaiana@gmail.com |
6450e982fc4bab13e0dddf1306885e972ba79af1 | ee125d5c5b4a078e344a9ead486b84e11d23d00f | /src/main/java/top/mrzhao/entity/Task.java | afab04110ec7b555ebb931ec8cd7f4179559ac90 | [] | no_license | lazyZy/sign | 23d290c79d98af99357643e615360888e3216ccb | cddd0c33ed526d20348c3d8e5c9285d8578390f5 | refs/heads/master | 2020-03-17T20:52:39.247646 | 2018-05-23T08:39:56 | 2018-05-23T08:39:56 | 133,932,598 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,528 | java | package top.mrzhao.entity;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table task
*
* @mbg.generated do_not_delete_during_merge
*/
@Component
public class Task {
/**
* Database Column Remarks:
* ไปปๅกid
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.task_id
*
* @mbg.generated
*/
private Integer taskId;
/**
* Database Column Remarks:
* ไปปๅกๅ็งฐ
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.task_name
*
* @mbg.generated
*/
private String taskName;
/**
* Database Column Remarks:
* ไปปๅกๆๅฑ้จ้จid(0ไธบๆๆ้จ้จ๏ผ
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.task_department_id
*
* @mbg.generated
*/
private Integer taskDepartmentId;
/**
* Database Column Remarks:
* ่ด่ดฃไบบid
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.task_charge_id
*
* @mbg.generated
*/
private Integer taskChargeId;
/**
* Database Column Remarks:
* ไปปๅกๅ
ๅฎน
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.task_content
*
* @mbg.generated
*/
private String taskContent;
/**
* Database Column Remarks:
* ไปปๅก็ถๆ๏ผ1ๆญฃๅจ็ๆ๏ผ0ๅทฒๅๆญข๏ผ-1ๅทฒๅบ้ค๏ผ
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.task_status
*
* @mbg.generated
*/
private Byte taskStatus;
/**
* Database Column Remarks:
* ไปปๅกๅจๆ๏ผๅไฝ/ๅฐๆถ๏ผ
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.task_cycle
*
* @mbg.generated
*/
private Integer taskCycle;
/**
* Database Column Remarks:
* ๅๅปบๆถ้ด
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
* Database Column Remarks:
* ไฟฎๆนๆถ้ด
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column task.modify_time
*
* @mbg.generated
*/
private Date modifyTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.task_id
*
* @return the value of task.task_id
*
* @mbg.generated
*/
public Integer getTaskId() {
return taskId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.task_id
*
* @param taskId the value for task.task_id
*
* @mbg.generated
*/
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.task_name
*
* @return the value of task.task_name
*
* @mbg.generated
*/
public String getTaskName() {
return taskName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.task_name
*
* @param taskName the value for task.task_name
*
* @mbg.generated
*/
public void setTaskName(String taskName) {
this.taskName = taskName == null ? null : taskName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.task_department_id
*
* @return the value of task.task_department_id
*
* @mbg.generated
*/
public Integer getTaskDepartmentId() {
return taskDepartmentId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.task_department_id
*
* @param taskDepartmentId the value for task.task_department_id
*
* @mbg.generated
*/
public void setTaskDepartmentId(Integer taskDepartmentId) {
this.taskDepartmentId = taskDepartmentId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.task_charge_id
*
* @return the value of task.task_charge_id
*
* @mbg.generated
*/
public Integer getTaskChargeId() {
return taskChargeId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.task_charge_id
*
* @param taskChargeId the value for task.task_charge_id
*
* @mbg.generated
*/
public void setTaskChargeId(Integer taskChargeId) {
this.taskChargeId = taskChargeId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.task_content
*
* @return the value of task.task_content
*
* @mbg.generated
*/
public String getTaskContent() {
return taskContent;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.task_content
*
* @param taskContent the value for task.task_content
*
* @mbg.generated
*/
public void setTaskContent(String taskContent) {
this.taskContent = taskContent == null ? null : taskContent.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.task_status
*
* @return the value of task.task_status
*
* @mbg.generated
*/
public Byte getTaskStatus() {
return taskStatus;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.task_status
*
* @param taskStatus the value for task.task_status
*
* @mbg.generated
*/
public void setTaskStatus(Byte taskStatus) {
this.taskStatus = taskStatus;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.task_cycle
*
* @return the value of task.task_cycle
*
* @mbg.generated
*/
public Integer getTaskCycle() {
return taskCycle;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.task_cycle
*
* @param taskCycle the value for task.task_cycle
*
* @mbg.generated
*/
public void setTaskCycle(Integer taskCycle) {
this.taskCycle = taskCycle;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.create_time
*
* @return the value of task.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.create_time
*
* @param createTime the value for task.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column task.modify_time
*
* @return the value of task.modify_time
*
* @mbg.generated
*/
public Date getModifyTime() {
return modifyTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column task.modify_time
*
* @param modifyTime the value for task.modify_time
*
* @mbg.generated
*/
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
} | [
"746234304@qq.com"
] | 746234304@qq.com |
3d6db7befa2da5a90df7a66295e9571f441ae9c5 | 3cf37052ae9467d6d206de54c16634fc747edd0d | /part03-Part03_24.IsItTrue/src/main/java/IsItTrue.java | 1a9e8d8f22472da5a3052707e225e20c4c48fcf5 | [] | no_license | rwu8/mooc-java-programming-i | 0a01d583bd77527977afb4a0481863bb700ed3ee | 3bd52e707ba711e8aae091a697bee18fa0511e04 | refs/heads/master | 2022-12-17T00:13:48.649782 | 2020-09-12T05:28:29 | 2020-09-12T05:28:29 | 293,649,153 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java |
import java.util.Scanner;
public class IsItTrue {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
if (input.equals("true")) {
System.out.println("You got it right!");
} else {
System.out.println("Try again!");
}
}
}
| [
"M@rw-mba.local"
] | M@rw-mba.local |
04176cc602f37e8527708a97651c59d039dde690 | 7eda476618d27af577e4d09a69a023ac8113cc53 | /walkinggroup-last_iteration_final_submission/app/src/main/java/com/example/mashu/walkinggroup/controller/view/member/info/activity/display/data/DisplayGroupMembers.java | 187b001d8007156ebd437f842136fb8ebd70e1e6 | [] | no_license | mightymallow/Walking-Group | 0e752c02508a660b202375bd5550924ff76ea464 | 47e45840c7c18acdc3e12c842d738d756609cabc | refs/heads/master | 2022-12-07T07:15:23.159919 | 2020-08-19T07:19:43 | 2020-08-19T07:19:43 | 288,662,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,589 | java | package com.example.mashu.walkinggroup.controller.view.member.info.activity.display.data;
import android.app.Activity;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.example.mashu.walkinggroup.R;
import com.example.mashu.walkinggroup.controller.account.monitoring.activities.common.AccountMonitorListAdapter;
import com.example.mashu.walkinggroup.model.Group;
import com.example.mashu.walkinggroup.model.user.User;
import com.example.mashu.walkinggroup.proxy.ProxyBuilder;
import com.example.mashu.walkinggroup.proxy.ProxyManager;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
/**
* The DisplayGroupMembers class is responsible for setting
* up the views for the group members of the clicked group
* in the ViewMemberInfoActivity.
*/
public class DisplayGroupMembers {
private Activity activity;
private double destinationLatitude;
private double destinationLongitude;
private List<User> validUsersToDisplay;
private Group clickedGroup;
public DisplayGroupMembers(Activity activity, double destinationLatitude, double destinationLongitude) {
this.activity = activity;
this.destinationLatitude = destinationLatitude;
this.destinationLongitude = destinationLongitude;
this.validUsersToDisplay = new ArrayList<>();
}
public void retrieveAllGroupsFromServer() {
Call<List<Group>> caller = ProxyManager.getProxy(activity).getGroups();
ProxyBuilder.callProxy(activity, caller, this::onAllGroupsReceivedFromServer);
}
private void onAllGroupsReceivedFromServer(List<Group> allGroupsReceivedFromServer) {
validUsersToDisplay = new ArrayList<>();
for (Group group: allGroupsReceivedFromServer){
if(group.accessDestinationLatitude() == destinationLatitude &&
group.accessDestinationLongitude() == destinationLongitude){
clickedGroup = group;
retrieveAllMembersOfClickedGroupFromServer();
break;
}
}
}
private void retrieveAllMembersOfClickedGroupFromServer() {
Call<List<User>> caller = ProxyManager.getProxy(activity).getGroupMembers(clickedGroup.getId());
ProxyBuilder.callProxy(activity, caller, this::onGroupMembersReceived);
}
private void onGroupMembersReceived(List<User> groupMembersReceived) {
validUsersToDisplay.addAll(groupMembersReceived);
if(clickedGroup.getLeader() != null){
Call<User> caller = ProxyManager.getProxy(activity).getUserById(clickedGroup.getLeader().getId());
ProxyBuilder.callProxy(activity, caller, this::onGroupLeaderWithFullDataReceived);
} else {
setupListViewForClickedGroupMembersAndLeader();
}
}
private void onGroupLeaderWithFullDataReceived(User groupLeaderWithFullDataReceived) {
validUsersToDisplay.add(groupLeaderWithFullDataReceived);
setupListViewForClickedGroupMembersAndLeader();
}
private void setupListViewForClickedGroupMembersAndLeader() {
ListView viewUserInfoListView = activity.findViewById(R.id.view_user_info_listView);
ArrayAdapter<User> adapter = new AccountMonitorListAdapter(activity, validUsersToDisplay);
AccountMonitorListAdapter.populateListView(viewUserInfoListView, adapter);
DisplayGroupMemberMonitors displayMonitors = new DisplayGroupMemberMonitors(activity, validUsersToDisplay);
displayMonitors.setupListViewForClickedGroupMemberAndLeaderMonitors();
}
} | [
"mightymallow14@gmail.com"
] | mightymallow14@gmail.com |
f6c38a1fb90e03c6a5034297b39f3856f4768a1b | b859b6d10229354be4e23521619f357f64b15d9a | /AndroidStudioProjects/Mom'sBirthdayCard/app/src/main/java/com/example/teena/momsbirthdaycard/CustomSwipeAdapter.java | 786dce469a81c190cde8253717cba75dc9c3cfb2 | [] | no_license | sashafierce/Mom-s-Birthday-Card-App | 48554de6433d065699a58f25d9d0f1a10d8c6a87 | 320486f514bc55de36b57b27d46f30a841e8117a | refs/heads/master | 2021-01-16T22:09:25.913000 | 2017-04-01T03:56:57 | 2017-04-01T03:56:57 | 62,200,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package com.example.teena.momsbirthdaycard;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* Created by Teena on 6/28/2016.
*/
public class CustomSwipeAdapter extends PagerAdapter {
private int[] image_resources = { R.drawable.mom ,R.drawable.b, R.drawable.d , R.drawable.e };
private Context ctx;
private LayoutInflater layoutInflater;
public CustomSwipeAdapter(Context ctx)
{
this.ctx = ctx;
}
@Override
public int getCount() {
return image_resources.length;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return (view == (LinearLayout)object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
layoutInflater = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View item_view = layoutInflater.inflate(R.layout.swipe_layout , container , false) ;
ImageView imageView = (ImageView)item_view.findViewById(R.id.image_view);
TextView textView = (TextView)item_view.findViewById(R.id.image_count);
imageView.setImageResource(image_resources[position]);
container.addView(item_view);
return item_view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((LinearLayout)object);
}
}
| [
"ab.tenass@gmail.com"
] | ab.tenass@gmail.com |
4101b06a3a92457ae3473d5a14867868f35f7235 | dfbc143422bb1aa5a9f34adf849a927e90f70f7b | /Contoh Project/video walp/android/support/v7/widget/helper/ItemTouchUIUtil.java | 10a71aaa2e06f3546fa4b4e1f5249a1fbeb671ae | [] | no_license | IrfanRZ44/Set-Wallpaper | 82a656acbf99bc94010e4f74383a4269e312a6f6 | 046b89cab1de482a9240f760e8bcfce2b24d6622 | refs/heads/master | 2020-05-18T11:18:14.749232 | 2019-05-01T04:17:54 | 2019-05-01T04:17:54 | 184,367,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | java | package android.support.v7.widget.helper;
import android.graphics.Canvas;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public abstract interface ItemTouchUIUtil
{
public abstract void clearView(View paramView);
public abstract void onDraw(Canvas paramCanvas, RecyclerView paramRecyclerView, View paramView, float paramFloat1, float paramFloat2, int paramInt, boolean paramBoolean);
public abstract void onDrawOver(Canvas paramCanvas, RecyclerView paramRecyclerView, View paramView, float paramFloat1, float paramFloat2, int paramInt, boolean paramBoolean);
public abstract void onSelected(View paramView);
}
/* Location: C:\Users\IrfanRZ\Desktop\video walp\classes_dex2jar.jar
* Qualified Name: android.support.v7.widget.helper.ItemTouchUIUtil
* JD-Core Version: 0.7.0.1
*/ | [
"irfan.rozal44@gmail.com"
] | irfan.rozal44@gmail.com |
b4c9a65b07ac51eac9bbc04600256bf82896c4f4 | 56c036982a2241f1e4d7d3b941ca4c064da77c19 | /problem/fafatouch/FafaMain.java | 408e094dd19952e7df93e3ea402feaba6100e3bb | [] | no_license | CharlsSong/BasicJavaStart | 370a211a623d611e4be1c7355e745a0530c5be54 | e45f3a4aeaeefe45e2b9fb3b32518ef61cb0f59e | refs/heads/master | 2020-11-26T19:59:03.021704 | 2020-04-10T00:21:50 | 2020-04-10T00:21:50 | 229,193,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,191 | java | package problem.fafatouch;
import java.util.Scanner;
public class FafaMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// ๋ฉ์ธ๋ฉ๋ด๋ฅผ ์ ์ฅํ๋ 5์นธ์ง๋ฆฌ ๋ฐฐ์ด ์์ฑ
String[][] mainMenu = new String[5][2];
// [5][2]
// [5]๋ ๋ฉ๋ด
// [2]๋ ๋ฉ๋ด์ด๋ฆ/๋ฉ๋ด๊ฐ๊ฒฉ
mainMenu[0][0] = "ํํ๋ฒ๊ฑฐ";
mainMenu[1][0] = "๋งฅ์นํจ๋ฒ๊ฑฐ";
mainMenu[2][0] = "์ํผ์น์ฆ๋ฒ๊ฑฐ";
mainMenu[3][0] = "์ธ์ด๋ถ๊ณ ๊ธฐ๋ฒ๊ฑฐ";
mainMenu[4][0] = "๋น
๋งฅ๋ฒ๊ฑฐ";
mainMenu[0][1] = "4500";
mainMenu[1][1] = "5500";
mainMenu[2][1] = "6000";
mainMenu[3][1] = "4700";
mainMenu[4][1] = "5500";
// {"ํํ๋ฒ๊ฑฐ","๋งฅ์นํจ๋ฒ๊ฑฐ","์ํผ์น์ฆ๋ฒ๊ฑฐ","์ธ์ด๋ถ๊ณ ๊ธฐ๋ฒ๊ฑฐ","๋น
๋งฅ๋ฒ๊ฑฐ"};
// ์ฌ์ด๋๋ฉ๋ด๋ฅผ ์ ์ฅํ๋ 5์นธ์ง๋ฆฌ ๋ฐฐ์ด ์์ฑ
String[][] sideMenu = new String[5][2];
sideMenu[0][0] = "๊ฐ์ํ๊น";
sideMenu[1][0] = "์๋
๊ฐ์";
sideMenu[2][0] = "์น์ฆ์คํฑ";
sideMenu[3][0] = "๋งฅ๋๊ฒ";
sideMenu[4][0] = "์ค์ํธ์ฝ";
sideMenu[0][1] = "1500";
sideMenu[1][1] = "2000";
sideMenu[2][1] = "2000";
sideMenu[3][1] = "2500";
sideMenu[4][1] = "1700";
// {"๊ฐ์ํ๊น","์๋
๊ฐ์","์น์ฆ์คํฑ","๋งฅ๋๊ฒ","์ค์ํธ์ฝ"};
// ์๋ฃ๋ฉ๋ด๋ฅผ ์ ์ฅํ๋ 5์นธ์ง๋ฆฌ ๋ฐฐ์ด ์์ฑ
String[][] drinkMenu = new String[5][2];
drinkMenu[0][0] = "์ฝ์นด์ฝ๋ผ";
drinkMenu[1][0] = "์คํ๋ผ์ดํธ";
drinkMenu[2][0] = "๋ง์ดํด๋";
drinkMenu[3][0] = "์ค๋ ์ง์ฅฌ์ค";
drinkMenu[4][0] = "์ด์ฝ์์ดํฌ";
drinkMenu[0][1] = "2000";
drinkMenu[1][1] = "2000";
drinkMenu[2][1] = "2000";
drinkMenu[3][1] = "3000";
drinkMenu[4][1] = "2500";
// {"์ฝ์นด์ฝ๋ผ","์คํ๋ผ์ดํธ","๋ง์ดํด๋","์ค๋ ์ง์ฅฌ์ค","์ด์ฝ์์ดํฌ"};
while (true) {
System.out.println("โโโโโโโโโโโโโโโโโโโโโโโโโโ");
System.out.println("โโโ ํํํฐ์น ์ฃผ๋ฌธํ๋ก๊ทธ๋จ");
System.out.println("โโโ ==๋ฉ์ธ๋ฉ๋ด==");
System.out.println("โโโ 1.ํํ๋ฒ๊ฑฐ");
System.out.println("โโโ 2.๋งฅ์นํจ๋ฒ๊ฑฐ");
System.out.println("โโโ 3.์ํผ์น์ฆ๋ฒ๊ฑฐ");
System.out.println("โโโ 4.์ธ์ด๋ถ๊ณ ๊ธฐ๋ฒ๊ฑฐ");
System.out.println("โโโ 5.๋น
๋งฅ๋ฒ๊ฑฐ");
System.out.print("โโโ ๋ฒํธ>> ");
// ์ฌ์ฉ์๊ฐ ์ฃผ๋ฌธํ ๋ฉ์ธ๋ฉ๋ด ๋ฒํธ!
int mainNum = sc.nextInt();
System.out.println("โโโ ==์ฌ์ด๋๋ฉ๋ด==");
System.out.println("โโโ 1.๊ฐ์ํ๊น");
System.out.println("โโโ 2.์๋
๊ฐ์");
System.out.println("โโโ 3.์น์ฆ์คํฑ");
System.out.println("โโโ 4.๋งฅ๋๊ฒ");
System.out.println("โโโ 5.์ค์ํธ์ฝ");
System.out.print("โโโ ๋ฒํธ>> ");
// ์ฌ์ฉ์๊ฐ ์ฃผ๋ฌธํ ๋ฉ์ธ๋ฉ๋ด ๋ฒํธ!
int sideNum = sc.nextInt();
System.out.println("โโโ ==์๋ฃ==");
System.out.println("โโโ 1.์ฝ์นด์ฝ๋ผ");
System.out.println("โโโ 2.์คํ๋ผ์ดํธ");
System.out.println("โโโ 3.๋ง์ดํด๋");
System.out.println("โโโ 4.์ค๋ ์ง์ฅฌ์ค");
System.out.println("โโโ 5.์ด์ฝ์์ดํฌ");
System.out.print("โโโ ๋ฒํธ>> ");
// ์ฌ์ฉ์๊ฐ ์ฃผ๋ฌธํ ๋ฉ์ธ๋ฉ๋ด ๋ฒํธ!
int drinkNum = sc.nextInt();
// ์ถ๋ ฅ!!
// Integer.getInteger()
// Integer intChgStr = new Integer();
int total = Integer.parseInt(mainMenu[mainNum - 1][1]) + Integer.parseInt(sideMenu[sideNum - 1][1])
+ Integer.parseInt(drinkMenu[drinkNum - 1][1]);
System.out.println("โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ");
System.out.println("โโโ ๊ณ ๊ฐ๋๊ป์ ์ฃผ๋ฌธํ์ ๋ฉ๋ด๋");
System.out.println("โโโ 1) " + mainMenu[mainNum - 1][0] + " : " + mainMenu[mainNum - 1][1]);
System.out.println("โโโ 2) " + sideMenu[sideNum - 1][0] + " : " + sideMenu[sideNum - 1][1]);
System.out.println("โโโ 3) " + drinkMenu[drinkNum - 1][0] + " : " + drinkMenu[drinkNum - 1][1]);
System.out.println("โโโ ์
๋๋ค.");
System.out.println("โโโ ํฉ๊ณ : " + total + " ์");
System.out.print("์ฃผ๋ฌธํ์๊ฒ ์ต๋๊น?(y/n)");
// ์ํฐํค๋ 2๊ฐ์ง ๊ธฐ๋ฅ์ ๊ฐ์ง๊ณ ์์
// 1.์
๋ ฅ๊ธฐ๋ฅ
// 2.ํ์ค๊ฐํ(\n)
// JAVA์์ ์ํฐ๋ฅผ ์
๋ ฅํ๋ฉด 1๋ฒ๊ณผ 2๋ฒ์ด ์คํ ๋จ.
// sc.nextInt()๋ ์ ์๊ฐ๋ง ๋ฐ๊ธฐ ๋๋ฌธ์ ํ์ค๊ฐํ
// ์ฝ๋๋ฅผ ๋ฌด์ํ์ง๋ง sc.nextLine()์ ๋ฌธ์์ด์
// ์
๋ ฅ๋ฐ์ ํ์ค๊ฐํ์ฝ๋๋ฅผ ์
๋ ฅ์ผ๋ก ๋ฐ์...
// sc.nextLine()์ ์ฌ์ฉํด์ ํ์ค๊ฐํ์
๋ ฅ์
// ๋์ ๋ฐ์์ฃผ๋๋ถ๋ถ์ด ํ์ํจ!!
sc.nextLine(); // ๊ฐํ๊ฐ์ฒ๋ฆฌ์ฉ
while (true) {
String order = sc.nextLine();
System.out.println(order);
order.toLowerCase(); // ๋ฌธ์์ด์ ๋ถ ์๋ฌธ์์ฒ๋ฆฌ
// order.toUpperCase(); // ๋ฌธ์์ด์ ๋ถ ๋๋ฌธ์์ฒ๋ฆฌ
int money = 0;
if (order.equals("y")) {
while (true) {
// ๊ฒฐ์ฌ๊ธ์ก ์
๋ ฅ
System.out.println("โโ ๊ฒฐ์ ๊ธ์ก>> ");
// ์ฌ์ฉ์ ์ง๋ถ๊ธ์ก
money = sc.nextInt();
if (total > money) {
System.out.println("๊ธ์ก์ด ๋ถ์กฑํฉ๋๋ค.");
System.out
.println("ํฉ๊ณ : " + total + "์ - ์ง๋ถ๊ธ์ก : " + money + "์ = " + (total - money) + "์");
continue;
} else {
if (total < money) {
System.out.println("๊ฑฐ์ค๋ฆ ๋ " + (money - total) + "์ ์
๋๋ค.");
} else {
System.out.println("์ ํํ " + total + "์ ๋ฐ์์ต๋๋ค.");
}
// ์ง๋ถ๊ธ์ก == ๊ฒฐ์ ๊ธ์ก
// ์ง๋ถ๊ธ์ก > ๊ฒฐ์ ๊ธ์ก(๊ฑฐ์ค๋ฆ๋ ์ฃผ๊ณ )
System.out.println("๊ฒฐ์ ์๋ฃ! ๊ณ ๊ฐ๋ ๋ง์๊ฒ ๋์ธ์:)");
break;
}
}
break;
} else if (order.equals("n")) {
// ์์คํ
์ ์ฒ์์ผ๋ก ๋์๊ฐ์ธ์!
// main(args);
continue;
} else {
System.out.println("โโ y or n์ ์
๋ ฅํด์ฃผ์ธ์.");
System.out.println("โโโ ํฉ๊ณ : " + total + " ์");
System.out.print("์ฃผ๋ฌธํ์๊ฒ ์ต๋๊น?(y/n)");
}
}
}
// sc.close(); // SCanner ์์ ๋ฐ๋ฉ
}
}
| [
"kcumero@hanmail.net"
] | kcumero@hanmail.net |
74016ad21641efe55759432c64bae30d8207e9cf | bfa473bf0b12c5adc830d89c4eece764981eca92 | /aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/SecurityGroupIdentifier.java | f88c10610e8dabd3848dc545931ceb0c01c0d7e7 | [
"Apache-2.0"
] | permissive | nksabertooth/aws-sdk-java | de515f2544cdcf0d16977f06281bd6488e19be96 | 4734de6fb0f80fe5768a6587aad3b9d0eaec388f | refs/heads/master | 2021-09-02T14:09:26.653186 | 2018-01-03T01:27:36 | 2018-01-03T01:27:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,917 | java | /*
* Copyright 2012-2018 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.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
* <p>
* Describes a security group.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/SecurityGroupIdentifier" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SecurityGroupIdentifier implements Serializable, Cloneable {
/**
* <p>
* The ID of the security group.
* </p>
*/
private String groupId;
/**
* <p>
* The name of the security group.
* </p>
*/
private String groupName;
/**
* <p>
* The ID of the security group.
* </p>
*
* @param groupId
* The ID of the security group.
*/
public void setGroupId(String groupId) {
this.groupId = groupId;
}
/**
* <p>
* The ID of the security group.
* </p>
*
* @return The ID of the security group.
*/
public String getGroupId() {
return this.groupId;
}
/**
* <p>
* The ID of the security group.
* </p>
*
* @param groupId
* The ID of the security group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SecurityGroupIdentifier withGroupId(String groupId) {
setGroupId(groupId);
return this;
}
/**
* <p>
* The name of the security group.
* </p>
*
* @param groupName
* The name of the security group.
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* <p>
* The name of the security group.
* </p>
*
* @return The name of the security group.
*/
public String getGroupName() {
return this.groupName;
}
/**
* <p>
* The name of the security group.
* </p>
*
* @param groupName
* The name of the security group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SecurityGroupIdentifier withGroupName(String groupName) {
setGroupName(groupName);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getGroupId() != null)
sb.append("GroupId: ").append(getGroupId()).append(",");
if (getGroupName() != null)
sb.append("GroupName: ").append(getGroupName());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SecurityGroupIdentifier == false)
return false;
SecurityGroupIdentifier other = (SecurityGroupIdentifier) obj;
if (other.getGroupId() == null ^ this.getGroupId() == null)
return false;
if (other.getGroupId() != null && other.getGroupId().equals(this.getGroupId()) == false)
return false;
if (other.getGroupName() == null ^ this.getGroupName() == null)
return false;
if (other.getGroupName() != null && other.getGroupName().equals(this.getGroupName()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
hashCode = prime * hashCode + ((getGroupName() == null) ? 0 : getGroupName().hashCode());
return hashCode;
}
@Override
public SecurityGroupIdentifier clone() {
try {
return (SecurityGroupIdentifier) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
1b2ef44b66e7b334e486821a14f0e559f9cf2299 | 349179d1f3652fb73b246aa5fb3597a60989e632 | /StockCollector/src/HistoricalData.java | 696ab2d8e163c74bd305601acf5ed7bf84fe4532 | [] | no_license | benaapp/IBJts | 7bf97f7bb4884852e4c9ad9b81098d040eab3eea | b056de8ca20c4bf03555116cb80f4e18e1449f41 | refs/heads/master | 2021-01-19T12:18:51.305238 | 2016-10-05T04:56:00 | 2016-10-05T04:56:00 | 70,031,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,490 | java | // Import Java utilities
import java.util.Vector;
// Import File writer
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
// Import IB API
import com.ib.client.Contract;
import com.ib.client.ContractDetails;
import com.ib.client.EClientSocket;
import com.ib.client.EWrapper;
import com.ib.client.Execution;
import com.ib.client.Order;
import com.ib.client.OrderState;
import com.ib.client.TagValue;
import com.ib.client.CommissionReport;
import com.ib.client.UnderComp;
/**
* Created by lixiz on 10/3/16.
*/
public class HistoricalData implements EWrapper {
// Keep track of the next Order ID
private int nextOrderID = 0;
private int reqId = 0;
// The IB API Client Socket object
private EClientSocket client = null;
// port number
private int port = 7496;
// connect id
private int connectId = 999;
// write data into the file
private String path = "";
private File file;
private FileWriter fileWriter;
public void writeIntoFile(String str) {
try {
fileWriter.write(str);
} catch(IOException e) {
error(e);
}
}
/**
* get connection with the IB server
*/
public void getConnection() {
client = new EClientSocket (this);
client.eConnect (null, port, connectId);
try {
while (! (client.isConnected()));
}
catch (Exception e) {
error(e);
}
}
/**
* reqId should be uniq for each API call
* @return
*/
public int getReqId() {
reqId++;
return reqId;
}
public HistoricalData() {
getConnection();
// create a file writer
/*
try {
file = new File(path);
fileWriter = new FileWriter(file);
} catch (IOException e) {
error(e);
}*/
String symbol = "UVXY"; // symbol of stock
// Use the format yyyymmdd hh:mm:ss tmz, where the time zone is allowed (optionally) after a space at the end.
String endTime = "20120128 12:00:00";
// format <Int> <type>; type: S (seconds), D (days), W (weeks), M (months), Y (years)
String duration = "1 D";
// 1,5,15,30 sec; 1,2,3,5,15,30 min; 1 hour; 1 day
String barSize = "1 hour";
// TRADES, MIDPOINT, BID, ASK, BID_ASK, HISTORICAL_VOLATILITY, OPTION_IMPLIED_VOLATILITY
String whatToShow = "TRADES";
// 0 - all; 1 - regular trading hours
int useRTH = 0;
// return date format 1 - yyyymmdd{space}{space}hh:mm:dd;
// 2 - long integer specifying the number of seconds since 1/1/1970 GMT
int dateFormat = 1;
// TODO:
// for loop for the stock endTime to get the data
// the endTime should be from 20120101 to now!
getHistoricalData(symbol, endTime, duration, barSize, whatToShow, useRTH, dateFormat);
/* Write into File
try {
fileWriter.flush();
fileWriter.close();
} catch (IOException e) {
error(e);
}*/
}
public void getHistoricalData(String symbol, String endTime, String duration, String barSize, String whatToShow, int useRTH, int dateFormat) {
Contract contract = ContractFactory.GenericStockContract(symbol);
// Create a TagValue list for chartOptions
Vector<TagValue> chartOptions = new Vector<TagValue>();
// Make a call to start off data historical retrieval
client.reqHistoricalData(getReqId(), contract, endTime, duration, barSize, whatToShow, useRTH, dateFormat, chartOptions);
}
/**
* HistoricalData function get the data back and do whatever you want
* @param reqId The reqID passed in at the call to reqHistoricalData
* @param date The date (and time) for the data bar
* @param open the OHLC prices for the data bar.
* @param high the OHLC prices for the data bar.
* @param low the OHLC prices for the data bar.
* @param close the OHLC prices for the data bar.
* @param volume The total volume of trades (or quoted size) that occurred during the data bar.
* @param count The number of trades (or quotes) that occurred during the data bar.
* @param WAP The volume weighted average price (VWAP) during the bar.
* @param hasGaps true if data used to create the bar has gaps in it.
*/
public void historicalData(int reqId, String date, double open,
double high, double low, double close, int volume, int count,
double WAP, boolean hasGaps)
{
// Display Historical data
try
{
if (!date.contains("finished")) {
String str = date + " " + open + " " + high + " " + low + " " + close + " " + volume;
System.out.println(str);
// write Into File
//writeIntoFile(str);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
//---------------- unimplemented methods --------------
public void bondContractDetails(int reqId, ContractDetails contractDetails) {}
public void contractDetails(int reqId, ContractDetails contractDetails) {}
public void contractDetailsEnd(int reqId) {}
public void fundamentalData(int reqId, String data) {}
public void bondContractDetails(ContractDetails contractDetails) {}
public void contractDetails(ContractDetails contractDetails) {}
public void currentTime(long time) {}
public void displayGroupList(int requestId, String contraftInfo) {}
public void displayGroupUpdated(int requestId, String contractInfo) {}
public void verifyCompleted(boolean completed, String contractInfo) {}
public void verifyMessageAPI(String message) {}
public void execDetails(int orderId, Contract contract, Execution execution) {}
public void execDetailsEnd(int reqId) {}
public void managedAccounts(String accountsList) {}
public void commissionReport(CommissionReport cr) {}
public void position(String account, Contract contract, int pos, double avgCost) {}
public void positionEnd() {}
public void accountSummary(int reqId, String account, String tag, String value, String currency) {}
public void accountSummaryEnd(int reqId) {}
public void accountDownloadEnd(String accountName) {}
public void openOrder(int orderId, Contract contract, Order order,
OrderState orderState) {}
public void openOrderEnd() {}
public void orderStatus(int orderId, String status, int filled,
int remaining, double avgFillPrice, int permId, int parentId,
double lastFillPrice, int clientId, String whyHeld) {}
public void receiveFA (int faDataType, String xml) {}
public void scannerData(int reqId, int rank,
ContractDetails contractDetails, String distance, String benchmark,
String projection, String legsStr) {}
public void scannerDataEnd(int reqId) {}
public void scannerParameters(String xml) {}
public void tickPrice(int orderId, int field, double price,
int canAutoExecute) {}
public void tickEFP(int symbolId, int tickType, double basisPoints,
String formattedBasisPoints, double impliedFuture, int holdDays,
String futureExpiry, double dividendImpact, double dividendsToExpiry) {}
public void tickGeneric(int symbolId, int tickType, double value) {}
public void tickOptionComputation( int tickerId, int field,
double impliedVol, double delta, double optPrice,
double pvDividend, double gamma, double vega,
double theta, double undPrice) {}
public void deltaNeutralValidation(int reqId, UnderComp underComp) {}
public void updateAccountTime(String timeStamp) {}
public void updateAccountValue(String key, String value, String currency,
String accountName) {}
public void updateMktDepth(int symbolId, int position, int operation,
int side, double price, int size) {}
public void updateMktDepthL2(int symbolId, int position,
String marketMaker, int operation, int side, double price, int size) {}
public void updateNewsBulletin(int msgId, int msgType, String message,
String origExchange) {}
public void updatePortfolio(Contract contract, int position,
double marketPrice, double marketValue, double averageCost,
double unrealizedPNL, double realizedPNL, String accountName) {}
public void marketDataType(int reqId, int marketDataType) {}
public void tickSnapshotEnd(int tickerId) {}
public void connectionClosed() {}
public void realtimeBar(int reqId, long time, double open, double high,
double low, double close, long volume, double wap, int count) {}
public void tickSize(int orderId, int field, int size) {}
public void tickString(int orderId, int tickType, String value) {}
//---------------------- Help functions ------------------
public void error(Exception e) {
// Print out a stack trace for the exception
e.printStackTrace ();
}
public void error(String str) {
// Print out the error message
System.err.println (str);
}
public void error(int id, int errorCode, String errorMsg) {
// Overloaded error event (from IB) with their own error
// codes and messages
System.err.println ("error: " + id + "," + errorCode + "," + errorMsg);
}
public void nextValidId (int orderId) {
// Return the next valid OrderID
nextOrderID = orderId;
}
public static void main (String args[])
{
try
{
// Create an instance
// At this time a connection will be made
// and the request for historical data will happen
HistoricalData myData = new HistoricalData();
}
catch (Exception e)
{
e.printStackTrace ();
}
}
} | [
"lixiz@amazon.com"
] | lixiz@amazon.com |
4a4e3a34918b15a42c15ea80fa4911846c4017c1 | e3f61935248fd24622049c5fa181c6e14cc0b93e | /TownGraphManagerTest_STUDENT.java | cc4a0d342b529cdb370dfd870572197c6028dd48 | [] | no_license | nabossey/Town | e92747314022d4ad32ee02492edc15d575f9c214 | 01e2fcb3923227ee4d9e6b78c1d95d60ddd685b3 | refs/heads/main | 2023-01-22T04:47:11.495057 | 2020-11-30T21:18:33 | 2020-11-30T21:18:33 | 317,348,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,533 | java | import static org.junit.Assert.*;
import java.util.ArrayList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class TownGraphManagerTest_STUDENT {
private TownGraphManagerInterface studentGraph;
private String[] townStudent;
@Before
public void setUp() throws Exception {
studentGraph = new TownGraphManager();
townStudent = new String[12];
for (int i = 1; i < 12; i++) {
townStudent[i] = "Town" + i;
studentGraph.addTown(townStudent[i]);
}
studentGraph.addRoad(townStudent[1], townStudent[2], 2, "Road9");
studentGraph.addRoad(townStudent[1], townStudent[3], 4, "Road12");
studentGraph.addRoad(townStudent[1], townStudent[5], 6, "Road7");
studentGraph.addRoad(townStudent[3], townStudent[7], 1, "Road3");
studentGraph.addRoad(townStudent[3], townStudent[8], 2, "Road8");
studentGraph.addRoad(townStudent[4], townStudent[8], 3, "Road6");
studentGraph.addRoad(townStudent[6], townStudent[9], 3, "Road2");
studentGraph.addRoad(townStudent[9], townStudent[10], 4, "Road11");
studentGraph.addRoad(townStudent[8], townStudent[10], 2, "Road10");
studentGraph.addRoad(townStudent[5], townStudent[10], 5, "Road4");
studentGraph.addRoad(townStudent[10], townStudent[11], 3, "Road1");
studentGraph.addRoad(townStudent[2], townStudent[11], 6, "Road5");
}
@After
public void tearDown() throws Exception {
studentGraph = null;
}
@Test
public void testAddRoad() {
ArrayList<String> roads = studentGraph.allRoads();
assertEquals("Road1", roads.get(0));
assertEquals("Road10", roads.get(1));
assertEquals("Road11", roads.get(2));
assertEquals("Road12", roads.get(3));
studentGraph.addRoad(townStudent[4], townStudent[11], 1,"Road13");
roads = studentGraph.allRoads();
assertEquals("Road1", roads.get(0));
assertEquals("Road10", roads.get(1));
assertEquals("Road11", roads.get(2));
assertEquals("Road12", roads.get(3));
assertEquals("Road13", roads.get(4));
}
@Test
public void testGetRoad() {
assertEquals("Road5", studentGraph.getRoad(townStudent[2], townStudent[11]));
assertEquals("Road3", studentGraph.getRoad(townStudent[3], townStudent[7]));
}
@Test
public void testAddTown() {
assertEquals(false, studentGraph.containsTown("Town12"));
studentGraph.addTown("Town12");
assertEquals(true, studentGraph.containsTown("Town12"));
}
@Test
public void testContainsTown() {
assertEquals(true, studentGraph.containsTown("Town2"));
assertEquals(false, studentGraph.containsTown("Town12"));
}
@Test
public void testContainsRoadConnection() {
assertEquals(true, studentGraph.containsRoadConnection(townStudent[2], townStudent[11]));
assertEquals(false, studentGraph.containsRoadConnection(townStudent[3], townStudent[5]));
}
@Test
public void testAllRoads() {
ArrayList<String> roads = studentGraph.allRoads();
assertEquals("Road1", roads.get(0));
assertEquals("Road10", roads.get(1));
assertEquals("Road11", roads.get(2));
assertEquals("Road8", roads.get(10));
assertEquals("Road9", roads.get(11));
}
@Test
public void testDeleteRoadConnection() {
assertEquals(true, studentGraph.containsRoadConnection(townStudent[2], townStudent[11]));
studentGraph.deleteRoadConnection(townStudent[2], townStudent[11], "Road5");
assertEquals(false, studentGraph.containsRoadConnection(townStudent[2], townStudent[11]));
}
@Test
public void testDeleteTown() {
assertEquals(true, studentGraph.containsTown("Town2"));
studentGraph.deleteTown(townStudent[2]);
assertEquals(false, studentGraph.containsTown("Town2"));
}
@Test
public void testAllTowns() {
ArrayList<String> roads = studentGraph.allTowns();
assertEquals("Town1", roads.get(0));
assertEquals("Town10", roads.get(1));
assertEquals("Town11", roads.get(2));
assertEquals("Town2", roads.get(3));
assertEquals("Town8", roads.get(9));
}
@Test
public void testGetPath() {
ArrayList<String> path = studentGraph.getPath(townStudent[1],townStudent[11]);
assertNotNull(path);
assertTrue(path.size() > 0);
assertEquals("Town1 via Road9 to Town2 2 miles",path.get(0).trim());
assertEquals("Town2 via Road5 to Town11 6 miles",path.get(1).trim());
assertEquals("Total miles: 8 miles",path.get(2).trim());
}
@Test
public void testGetPathA() {
ArrayList<String> path = studentGraph.getPath(townStudent[1],townStudent[10]);
assertNotNull(path);
assertTrue(path.size() > 0);
assertEquals("Town1 via Road12 to Town3 4 miles",path.get(0).trim());
assertEquals("Town3 via Road8 to Town8 2 miles",path.get(1).trim());
assertEquals("Town8 via Road10 to Town10 2 miles",path.get(2).trim());
assertEquals("Total miles: 8 miles",path.get(3).trim());
}
@Test
public void testGetPathB() {
ArrayList<String> path = studentGraph.getPath(townStudent[1],townStudent[6]);
assertNotNull(path);
assertTrue(path.size() > 0);
assertEquals("Town1 via Road12 to Town3 4 miles",path.get(0).trim());
assertEquals("Town3 via Road8 to Town8 2 miles",path.get(1).trim());
assertEquals("Town8 via Road10 to Town10 2 miles",path.get(2).trim());
assertEquals("Town10 via Road11 to Town9 4 miles",path.get(3).trim());
assertEquals("Town9 via Road2 to Town6 3 miles",path.get(4).trim());
assertEquals("Total miles: 15 miles",path.get(5).trim());
}
} | [
"noreply@github.com"
] | nabossey.noreply@github.com |
9b727e4dc24334043f9a2619fe121d6f981d8ebc | 5ccb2886bdf8d2147caab9908b15ea9ce7576939 | /src/jeuoie/Test.java | fbfaa00af289ce8625c426fbc4937187b1bd5e15 | [] | no_license | Thanh680/JeuOie | b5edf65a470c5458ea8135f37ac3eb7c068ab53e | 3ef7e2a85cfbdea2c2400ee1ab898a6ebac13851 | refs/heads/main | 2023-06-17T21:44:41.662383 | 2021-06-30T20:15:26 | 2021-06-30T20:15:26 | 381,822,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,761 | 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 jeuoie;
import java.util.Scanner;
/**
*
* @author tnguyen15
*/
public class Test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//String p ;
int max = 6, min = 1;
int Pion = 0;
int Recul;
int dee1 = 0;
int dee2 = 0;
boolean Oie = false;
Scanner sc=new Scanner(System.in);
while(Pion != 63){
System.out.println("Appuyez sur Entrรฉe pour lancer le dรฉโฆ") ;
dee1 = sc.nextInt();
System.out.println("Appuyez sur Entrรฉe pour lancer le dรฉโฆ") ;
dee2 = sc.nextInt();
System.out.print("Premier dee : "+dee1);
System.out.println(" Deuxieme dee : "+dee2);
Pion = Pion + dee1 + dee2;
if (Pion > 63){
Recul = Pion - 63;
Pion = 63 - Recul ;
System.out.println("Le joueur a recule a la case "+Pion);
System.out.println();
}else{
while (Pion%9 == 0){
Pion = Pion + dee1 + dee2;
System.out.println("Le joueur est tombe sur la case Oie ");
System.out.println("Le joueur avance a la case "+Pion);
System.out.println();
Oie = true;
}
if (!Oie){
System.out.println("Le joueur a avance a la case "+Pion);
System.out.println();
}
}
Oie = false;
}
System.out.println("Le joueur a fini la partie");
}
}
| [
"nguyenthanhdanh680@gmail.com"
] | nguyenthanhdanh680@gmail.com |
f3fceb834cbf6c11f442f42b9f9f8512e6758d27 | 603f08c4734a9f0b5d6289461fda692570e79323 | /app/src/main/java/com/wonderslab/baseprojectskeleton/data/user/source/local/UserLocalDataStore.java | c98fb52935584bdd641ae57701e5aeef1ac740cd | [] | no_license | Ekalips/BaseProjectSkeleton | cf5d81a3dc612e297212298b3b412a64359d72fc | 6e190b088fbf0c2a5614323939b5e2dcff300830 | refs/heads/master | 2021-07-03T19:39:20.623720 | 2017-09-25T16:25:11 | 2017-09-25T16:25:11 | 104,484,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package com.wonderslab.baseprojectskeleton.data.user.source.local;
import com.wonderslab.baseprojectskeleton.data.user.UserDataSource;
import com.wonderslab.baseprojectskeleton.data.user.source.entity.LocalUserEntity;
import com.wonderslab.baseprojectskeleton.data.user.source.entity.User;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.objectbox.Box;
/**
* Created by Ekalips on 9/22/17.
*/
@Singleton
public class UserLocalDataStore implements UserDataSource {
@Inject
public UserLocalDataStore(Box<LocalUserEntity> localUserEntityBox) {
}
@Override
public User getCurrentUser() {
return null;
}
@Override
public void saveCurrentUser(User user) {
}
}
| [
"djqrj96@gmail.com"
] | djqrj96@gmail.com |
be3ec64edebc39b7cfb0e95afea0884d6477f675 | e623384be49ad937707b931d1a8e81c63ad6e281 | /src/main/java/com/sda/spring/model/Task.java | 780214e17310edb75254f7a8f88a63e9d8fa3c42 | [] | no_license | mkarczewski85/poormans-springboot-jsp | 9e6e307b722836a5ee5e2b3f73639847d2a6ab00 | d8776dd1bf88b4eea3d11e4f5c924b7c4896a97e | refs/heads/master | 2021-07-24T02:49:17.189691 | 2017-10-27T18:52:14 | 2017-10-27T18:52:14 | 108,427,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,530 | java | package com.sda.spring.model;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.time.LocalDateTime;
@Entity
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private String comment;
private Integer priority;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private LocalDateTime deadline;
private LocalDateTime dateCreated;
public Task() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
public LocalDateTime getDeadline() {
return deadline;
}
public void setDeadline(LocalDateTime deadline) {
this.deadline = deadline;
}
public LocalDateTime getDateCreated() {
return dateCreated;
}
public void setDateCreated(LocalDateTime dateCreated) {
this.dateCreated = dateCreated;
}
}
| [
"m.karczewski1985@gmail.com"
] | m.karczewski1985@gmail.com |
f2d97882ae08637869324d20d72108c6fdc244f5 | 12b6d5e26ea2471ffcdb1c48bbeae1e03011f3ca | /c2d-processor/src/test/java/com/chendayu/c2d/processor/app/User.java | 5fe6e0d16e990375045c56b98ca272a7d77a5b7d | [] | no_license | chendy560/c2d | 96f7317087b4374e90f7af1ba5b7a61ce646c924 | 065634cffcac24640127478479e5fce4c011018a | refs/heads/master | 2021-07-15T10:43:57.992962 | 2020-03-23T14:22:14 | 2020-03-23T14:22:14 | 170,520,152 | 5 | 1 | null | 2019-09-21T17:27:37 | 2019-02-13T14:19:37 | Java | UTF-8 | Java | false | false | 831 | java | package com.chendayu.c2d.processor.app;
import java.util.List;
import com.chendayu.c2d.processor.DocIgnore;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* ็จๆท๏ผๅฐฑๆฏ็จๆท
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class User extends IdEntity {
/**
* ็จๆทๅ
*/
@JsonProperty("username")
private String name;
/**
* ๅนด้พ
*/
private Integer age;
/**
* ๅบ่ฏฅๆฏไธไธช่ทๅไธๅฐ็ไธ่ฅฟ
*/
@JsonIgnore
private Object youCannotSeeMe;
@DocIgnore
private String ignoreMe;
/**
* ๆฏๅ็น็ๅผๅ
ฐๅ
นๅข
*/
private List<User> friends;
/**
* ๅฎ ็ฉไปฌ
*/
private List<Pet> pets;
}
| [
"chendy560@foxmail.com"
] | chendy560@foxmail.com |
eeb85a1290747ae8a6a34fe1ea7323d2b4e613d0 | fb92c220fadbaa692cb049ab087c9728d9175b46 | /src/com/yaroslav/factoryMethod/DigitalWatchMaker.java | f32f05f84024664510bd6f14d142b482fb09d59e | [] | no_license | StarovoytYaroslav/PatternsStudy | 856cc52042f1399f00316e0c0f78f1e49feece93 | cdef94f7020d2bab16289a93ffdcf1aa3ed1d4cf | refs/heads/master | 2022-05-12T14:23:59.645032 | 2020-01-15T14:26:07 | 2020-01-15T14:26:07 | 234,099,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package com.yaroslav.factoryMethod;
public class DigitalWatchMaker implements WatchMaker {
@Override
public Watch createWatch() {
return new DigitalWatch();
}
}
| [
"Starovoyt.yaroslav@gmail.com"
] | Starovoyt.yaroslav@gmail.com |
af1de499d74eb3f9638ee48b91c3b05e9ebe9ed9 | de3a388ff2b99257486eed6e191cfab3ea57cc57 | /src/main/java/com/pakmall/domain/OrderDetailListVO.java | 5d67ecd46070873129a19913f21d4f1f3a6c7969 | [] | no_license | rbdudek86/pakmall | 9238daa97885007ef776bfe59f788d28dacd8858 | 99f8ab019610ced875c7d5227ef9e3bd7afcd9af | refs/heads/master | 2023-06-26T08:26:10.241393 | 2021-07-16T13:20:08 | 2021-07-16T13:20:08 | 366,240,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.pakmall.domain;
import lombok.Data;
@Data
public class OrderDetailListVO {
// o.odr_code, p.pdt_num, o.odr_amount, o.odr_price, p.pdt_name, p.pdt_img
private long odr_code;
private long pdt_num;
private int odr_amount;
private int odr_price;
private String pdt_name;
private String pdt_img;
}
| [
"kyuyoungpark@localhost"
] | kyuyoungpark@localhost |
c276dcc608c426e29625e852f5fbe1fdf6ccaab0 | 95861400cdb5bd544ac570de0c1d414bbed3773d | /src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/MagicModifierCrop.java | 077519400c9239846136f2cb278836b7dda2dc86 | [
"BSD-3-Clause",
"MIT"
] | permissive | bartimaeusnek/crops-plus-plus | 8b741bbdf206141155ada102d4de0cab249c9a3d | 7bebadcf8f52c997314aac9f49ff46b1dc9c1e9b | refs/heads/master | 2023-01-07T11:59:41.926003 | 2020-04-17T15:53:37 | 2020-04-17T15:53:37 | 111,786,656 | 3 | 6 | NOASSERTION | 2020-10-22T03:22:25 | 2017-11-23T09:01:23 | Java | UTF-8 | Java | false | false | 2,484 | java | package com.github.bartimaeusnek.cropspp.crops.cpp;
import com.github.bartimaeusnek.cropspp.ConfigValues;
import com.github.bartimaeusnek.cropspp.crops.TC.PrimordialPearlBerryCrop;
import com.github.bartimaeusnek.cropspp.items.CppItems;
import ic2.api.crops.ICropTile;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.util.Collections;
import java.util.List;
public class MagicModifierCrop extends PrimordialPearlBerryCrop {
public MagicModifierCrop() {
super();
}
@Override
public String name() {
return "Magical Nightshade";
}
@Override
public int tier() {
return 13;
}
@Override
public boolean canCross(ICropTile crop) {
return crop.getSize() == this.maxSize();
}
@Override
public ItemStack getSeeds(ICropTile crop) {
return crop.generateSeeds(crop.getCrop(), crop.getGrowth(), crop.getGain(), crop.getResistance(), crop.getScanLevel());
}
@Override
public List<String> getCropInformation() {
return Collections.singletonList("Needs a block of Ichorium below to fully mature.");
}
@Override
public int growthDuration(ICropTile crop) {
if (ConfigValues.debug)
return 1;
else {
return ConfigValues.PrimordialBerryGroth / 16;
}
}
@Override
public float dropGainChance() {
return (float) ((float) ((Math.pow(0.95, (float) tier())) * ConfigValues.BerryGain) * (ConfigValues.PrimordialBerryGain * 1.5));
}
@Override
public int getEmittedLight(ICropTile crop) {
if (crop.getSize() == 4)
return 4;
else return 0;
}
@Override
public boolean canGrow(ICropTile crop) {
boolean ret = false;
if (crop.getSize() < 3)
ret = true;
else if ((crop.getSize() == 3 && crop.isBlockBelow("blockIchorium")) || (crop.getSize() == 3 && !OreDictionary.doesOreNameExist("blockIchorium")))
ret = true;
return ret;
}
@Override
public byte getSizeAfterHarvest(ICropTile crop) {
return 1;
}
@Override
public ItemStack getDisplayItem() {
return new ItemStack(CppItems.Modifier, 1, 1);
}
@Override
public ItemStack getGain(ICropTile crop) {
return new ItemStack(CppItems.Modifier, 1, 1);
}
@Override
public String discoveredBy() {
return "bartimaeusnek";
}
}
| [
"33183715+bartimaeusnek@users.noreply.github.com"
] | 33183715+bartimaeusnek@users.noreply.github.com |
2c1d14b564af309bb7ed2012721a64c5d2b38a82 | 9d1808d2c551475c33729f1da7ab606e680c539c | /src/Persoon.java | 9a8af91fe0f9a8431e15c043ef995c5affb64cc7 | [] | no_license | Lanott69/kantine-project | 103ef73dbe864b6ac35583e51ba4980fe2d37385 | 01813aeee1729dcda742edc974b594d1719f9a4c | refs/heads/master | 2022-12-07T20:13:25.708992 | 2020-08-26T18:00:28 | 2020-08-26T18:00:28 | 267,470,151 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,260 | java |
/**
* Write a description of class Persoon here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Persoon
{
private int bsn;
private String voornaam;
private String achternaam;
private int dag;
private int maand;
private int jaar;
private char geslacht;
public Persoon(int bsn, String voornaam, String achternaam, int geboorteDag, int geboorteMaand, int geboorteJaar, char geslacht)
{
this.bsn = bsn;
this.voornaam = voornaam;
this.achternaam = achternaam;
this.dag = geboorteDag;
this.maand = geboorteMaand;
this.jaar = geboorteJaar;
setGeslacht(geslacht);
}
public Persoon()
{
this.bsn = 0;
this.voornaam = "";
this.achternaam = "";
this.dag = 0;
this.maand = 0;
this.jaar = 0;
geslacht = 'U';
}
private void setBsn(int bsn)
{
this.bsn = bsn;
}
private void setNaam(String voornaam, String achternaam)
{
this.voornaam = voornaam;
this.achternaam = achternaam;
}
private void setGeboortedatum(int geboorteDag, int geboorteMaand, int geboorteJaar)
{
this.dag = geboorteDag;
this.maand = geboorteMaand;
this.jaar = geboorteJaar;
}
private void setGeslacht(char geslacht)
{
if(geslacht == 'M' || geslacht == 'V' || geslacht == 'X')
{
this.geslacht = geslacht;
}
else
{
System.out.println("onmogelijk geslacht");
}
}
public int getBsn()
{
return bsn;
}
public String getNaam()
{
return voornaam + achternaam;
}
public String getGeboortedatum()
{
Datum geboorteDatum = new Datum(dag, maand, jaar);
if(dag == 0 && maand == 0 && jaar == 0)
{
return "Onbekend";
}
else
{
return geboorteDatum.getDatumAsString();
}
}
public char getGeslacht()
{
return geslacht;
}
public String toString()
{
return bsn + "\n" + getNaam() + "\n" + getGeboortedatum() + "\n" + geslacht;
}
}
| [
"noreply@github.com"
] | Lanott69.noreply@github.com |
6e746502c13156c320ce47a67c3c18193024444e | 8e6842f63ddacdae587da6a80d722fb2cf562277 | /app/src/main/java/hozorghiyab/activities/Setting.java | 55065e69f941a90caa251dd1c518b45d2988d09c | [] | no_license | keyon2019/HozorGhiyab | 658226074a924d720cf91bf71e28b33c08f23c20 | ecfb65c96fb970f29893633f02b15a18c159e0f3 | refs/heads/master | 2023-01-01T20:22:48.729004 | 2020-10-17T17:20:44 | 2020-10-17T17:20:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,810 | java | package hozorghiyab.activities;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.hozorghiyab.R;
public class Setting extends AppCompatActivity {
SharedPreferences sharedPreferences;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_act);
androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
actionBar.hide();
//Change StatusBar color:
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.parseColor("#31678a"));
ImageView imgBack = findViewById(R.id.imgBackInSettingPage);
imgBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
sharedPreferences = Setting.this.getSharedPreferences("file", Setting.this.MODE_PRIVATE);
final String phoneNumber = sharedPreferences.getString("user", "");
final String password = sharedPreferences.getString("pass", "");
final String name = sharedPreferences.getString("name", "");
EditText etName = findViewById(R.id.etNameInSettingPage);
EditText etPhoneNumber = findViewById(R.id.etPhoneNumberInSettingPage);
EditText etPassword = findViewById(R.id.etPassInSettingPage);
etName.setText(name);
etPhoneNumber.setText(phoneNumber);
etPassword.setText(password);
TextView txExit= findViewById(R.id.txExitFromAccount);
txExit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sharedPreferences = Setting.this.getSharedPreferences("file", Setting.this.MODE_PRIVATE);
sharedPreferences.edit().remove("name").commit();
sharedPreferences.edit().remove("user").commit();
sharedPreferences.edit().remove("pass").commit();
//Intent intent = new Intent(Setting.this, CityDetailACT.class);
//startActivity(intent);
finish();
}
});
}
public void onBackPressed() {
finish();
}
}
| [
"mahdi120012@gmail.com"
] | mahdi120012@gmail.com |
7c8b70dddccf352da01b0cd9f7c5e4c1d7ae77d9 | ec5f07692d2fd380c0fe48b39024ce12d4ca9dbd | /src/com/OOBDeviceTest/StressTest/CheckDCACService.java | d024a0055e8628318b6996b7c05652be8f1fe72d | [] | no_license | limigit/OOBDeviceTestgitgui | d272fdc8e4fde995a56edb75403e541830bd7e60 | 873222840f1e6020446fa5d9580c7aade6664333 | refs/heads/master | 2020-04-02T15:08:17.260725 | 2014-03-20T10:59:43 | 2014-03-20T10:59:43 | 17,939,187 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,513 | java | package com.OOBDeviceTest.StressTest;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.os.IBinder;
public class CheckDCACService extends Service {
private IntentFilter mIntentFilter;
private String AcstatusString = "";
private boolean mIsAcIn = false;;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
registerReceiver(mIntentReceiver, mIntentFilter);
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(mIntentReceiver);
}
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
int plugType = intent.getIntExtra("plugged", 0);
Intent dischargeIntent = new Intent("android.intent.action.AC_STATE");
if (plugType > 0) {
mIsAcIn = true;
} else {
mIsAcIn = false;
}
dischargeIntent.putExtra("state", mIsAcIn);
context.sendBroadcast(dischargeIntent);
}
}
};
}
| [
"limi@bitland.com.cn"
] | limi@bitland.com.cn |
e76f2dad709cb1a43d650dbe9fc65b0ac1b10579 | 5e46b24b22e845872a3cb739915fcdd591fff11a | /shells/security-speed-shell/src/main/java/org/xipki/security/speed/p11/cmd/SpeedP11ECKeyGenCmd.java | 9e98c1ad350b25e7cbb1a9cdd76adbb87b652d38 | [
"Apache-2.0"
] | permissive | burakkoprulu/xipki | 18a3b2a33d207c9e4b70a2e392684140d5a93857 | 6c0981909bd5acf565ca46415442b7aab2bdad37 | refs/heads/master | 2020-03-08T08:54:33.086528 | 2018-04-03T15:53:26 | 2018-04-03T15:53:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,577 | java | /*
*
* Copyright (c) 2013 - 2018 Lijun Liao
*
* 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.xipki.security.speed.p11.cmd;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.xipki.common.LoadExecutor;
import org.xipki.console.karaf.completer.ECCurveNameCompleter;
import org.xipki.security.speed.p11.P11ECKeyGenLoadTest;
/**
* TODO.
* @author Lijun Liao
* @since 2.0.0
*/
@Command(scope = "xi", name = "speed-ec-gen-p11",
description = "performance test of PKCS#11 EC key generation")
@Service
// CHECKSTYLE:SKIP
public class SpeedP11ECKeyGenCmd extends SpeedP11Action {
@Option(name = "--curve", required = true,
description = "EC curve name\n(required)")
@Completion(ECCurveNameCompleter.class)
private String curveName;
@Override
protected LoadExecutor getTester() throws Exception {
return new P11ECKeyGenLoadTest(getSlot(), curveName);
}
}
| [
"lijun.liao@gmail.com"
] | lijun.liao@gmail.com |
a23606dde1bc05397c9f985466303200f943e371 | ddb071fe1e067fe73a4856ee76dc548bc5682263 | /core/src/test/java/com/globalmentor/net/HTTPTest.java | 3a03f7922b085a0ea9ef00a711d367f73695a598 | [] | no_license | globalmentor/globalmentor-base | 058b7b13d44fa8c1772fdb8d6621f0e0897e3b8e | b2b390565ff907ffa438cb4253edc3e6c417a06a | refs/heads/main | 2023-08-17T23:55:33.728310 | 2023-08-09T14:09:46 | 2023-08-09T14:09:46 | 184,111,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,032 | java | /*
* Copyright ยฉ 2022 GlobalMentor, Inc. <https://www.globalmentor.com/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.globalmentor.net;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
/**
* Tests of {@link HTTP}.
* @author Garret Wilson
*/
public class HTTPTest {
/** @see HTTP.ResponseClass#forStatusCode(int) */
@Test
void testResponseClassForStatusCode() {
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(-123));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(-1));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(0));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(1));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(50));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(99));
assertThat(HTTP.ResponseClass.forStatusCode(100), is(HTTP.ResponseClass.INFORMATIONAL));
assertThat(HTTP.ResponseClass.forStatusCode(101), is(HTTP.ResponseClass.INFORMATIONAL));
assertThat(HTTP.ResponseClass.forStatusCode(123), is(HTTP.ResponseClass.INFORMATIONAL));
assertThat(HTTP.ResponseClass.forStatusCode(199), is(HTTP.ResponseClass.INFORMATIONAL));
assertThat(HTTP.ResponseClass.forStatusCode(200), is(HTTP.ResponseClass.SUCCESSFUL));
assertThat(HTTP.ResponseClass.forStatusCode(299), is(HTTP.ResponseClass.SUCCESSFUL));
assertThat(HTTP.ResponseClass.forStatusCode(300), is(HTTP.ResponseClass.REDIRECTION));
assertThat(HTTP.ResponseClass.forStatusCode(399), is(HTTP.ResponseClass.REDIRECTION));
assertThat(HTTP.ResponseClass.forStatusCode(400), is(HTTP.ResponseClass.CLIENT_ERROR));
assertThat(HTTP.ResponseClass.forStatusCode(499), is(HTTP.ResponseClass.CLIENT_ERROR));
assertThat(HTTP.ResponseClass.forStatusCode(500), is(HTTP.ResponseClass.SERVER_ERROR));
assertThat(HTTP.ResponseClass.forStatusCode(599), is(HTTP.ResponseClass.SERVER_ERROR));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(600));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(699));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(999));
assertThrows(IllegalArgumentException.class, () -> HTTP.ResponseClass.forStatusCode(1000));
}
}
| [
"garret@globalmentor.com"
] | garret@globalmentor.com |
d9bc838c0f37bd7e7fb13319c287702f6e71ba13 | a7830300e4d87f2662268e01592febccb7193dfc | /app/src/main/java/jurgen/example/myloader/MainActivity.java | 1de961859bb919a74267c1aa11059bffd16c5d49 | [] | no_license | jurgenirgo/MyLoader | 18a6212ba9a83a09fddd3685f3629cef215427df | 4d651949bec5eafda22164aae368d228cad80555 | refs/heads/master | 2020-07-10T11:17:48.758604 | 2019-08-25T05:33:50 | 2019-08-25T05:33:50 | 204,250,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,613 | java | package jurgen.example.myloader;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;
import java.util.ResourceBundle;
public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor>, AdapterView.OnItemClickListener {
public static final String TAG = "ContactApp";
ListView lvContact;
ProgressBar progressBar;
private ContactAdapter mAdapter;
private final int CONTACT_REQUEST_CODE = 101;
private final int CALL_REQUEST_CODE = 102;
private final int CONTACT_LOAD = 110;
private final int CONTACT_SELECT = 120;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lvContact = findViewById(R.id.lv_contact);
progressBar = findViewById(R.id.progress_bar);
lvContact.setVisibility(View.INVISIBLE);
progressBar.setVisibility(View.GONE);
mAdapter = new ContactAdapter(MainActivity.this, null, true);
lvContact.setAdapter(mAdapter);
lvContact.setOnItemClickListener(this);
if (PermissionManager.isGranted(this, Manifest.permission.READ_CONTACTS)) {
getSupportLoaderManager().initLoader(CONTACT_LOAD, null, this);
} else {
PermissionManager.check(this, Manifest.permission.READ_CONTACTS, CONTACT_REQUEST_CODE);
}
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
CursorLoader mCursorLoader = null;
if (id == CONTACT_LOAD) {
progressBar.setVisibility(View.VISIBLE);
String[] projectionFields = new String[]{
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.PHOTO_URI};
mCursorLoader = new CursorLoader(MainActivity.this,
ContactsContract.Contacts.CONTENT_URI,
projectionFields,
ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1",
null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");
} else if (id == CONTACT_SELECT) {
String[] phoneProjectionFields = new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER};
mCursorLoader = new CursorLoader(MainActivity.this,
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
phoneProjectionFields,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ? AND " +
ContactsContract.CommonDataKinds.Phone.TYPE + " = " +
ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE + " AND " +
ContactsContract.CommonDataKinds.Phone.HAS_PHONE_NUMBER + "=1",
new String[]{args.getString("id")},
null);
}
return mCursorLoader;
}
@SuppressLint("MissingPermission")
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
Log.d(TAG, "LoadFinished");
if (loader.getId() == CONTACT_LOAD) {
if (data.getCount() > 0) {
lvContact.setVisibility(View.VISIBLE);
mAdapter.swapCursor(data);
}
progressBar.setVisibility(View.GONE);
} else if (loader.getId() == CONTACT_SELECT) {
String contactNumber = null;
if (data.moveToFirst()) {
contactNumber = data.getString(data.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
}
if (PermissionManager.isGranted(this, Manifest.permission.CALL_PHONE)) {
Intent dialIntent = new Intent(Intent.ACTION_CALL,
Uri.parse("tel:" + contactNumber));
startActivity(dialIntent);
} else {
PermissionManager.check(this, Manifest.permission.CALL_PHONE, CALL_REQUEST_CODE);
}
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
if (loader.getId() == CONTACT_LOAD) {
progressBar.setVisibility(View.GONE);
mAdapter.swapCursor(null);
Log.d(TAG, "LoaderReset");
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Cursor cursor = (Cursor) parent.getAdapter().getItem(position);
long mContactId = cursor.getLong(0);
Log.d(TAG, "Position : " + position + " " + mContactId);
getPhoneNumber(String.valueOf(mContactId));
}
private void getPhoneNumber(String contactID) {
Bundle bundle = new Bundle();
bundle.putString("id", contactID);
getSupportLoaderManager().restartLoader(CONTACT_SELECT, bundle, this);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == CONTACT_REQUEST_CODE) {
if (grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
getSupportLoaderManager().initLoader(CONTACT_LOAD, null, this);
Toast.makeText(this, "Contact permission diterima", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Contact permission ditolak", Toast.LENGTH_SHORT).show();
}
}
} else if (requestCode == CALL_REQUEST_CODE) {
if (grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "Call permission diterima", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Call permission ditolak", Toast.LENGTH_SHORT).show();
}
}
}
}
}
| [
"jurgenirgof@gmail.com"
] | jurgenirgof@gmail.com |
cd56a190b48ce2bbced8a05183e9866e427c2d1f | 2b4a0086be242258a3d9408bb549c2de098abefa | /main/main.pubsub/src/test/java/org/jmicro/pubsub/test/TestPubSubServer.java | 3c5b3af97a2c2bd0e2507bf18b38c337fb275307 | [
"Apache-2.0"
] | permissive | mynewworldyyl/jmicro | e9dfc240501488297e01898e90b90b62147ee343 | fa68c0315e4cea4d178ac0d9701eb6ac5f31bbe7 | refs/heads/master | 2023-08-03T02:39:37.486258 | 2023-07-30T16:10:45 | 2023-07-30T16:10:45 | 150,057,499 | 8 | 2 | null | 2023-03-04T09:02:50 | 2018-09-24T05:15:46 | Java | UTF-8 | Java | false | false | 1,405 | java | package org.jmicro.pubsub.test;
import org.junit.Assert;
import org.junit.Test;
import cn.jmicro.api.pubsub.PubSubManager;
import cn.jmicro.pubsub.PubSubServer;
import cn.jmicro.test.JMicroBaseTestCase;
public class TestPubSubServer extends JMicroBaseTestCase{
protected String[] getArgs() {
return new String[] {"-DinstanceName=TestPubSubServer"};
}
@Test
public void testSubscribe() {
PubSubServer s = of.get(PubSubServer.class);
//boolean succ = s.subcribe(TOPIC, helloTopicMethodKey(), new HashMap<String,String>());
//Assert.assertTrue(succ);
}
@Test
public void testunSubscribe() {
testSubscribe();
//Assert.assertTrue(of.get(PubSubServer.class).unsubcribe(TOPIC, helloTopicMethodKey(), new HashMap<String,String>()));
}
@Test
public void testPublishString() {
of.get(PubSubServer.class).publishString(TOPIC, "Hello pubsub server")
.success((rst,cxt)->{
Assert.assertTrue(PubSubManager.PUB_OK == rst.getData());
});
this.waitForReady(1);
}
@Test
public void testPublishString100() {
for(int i = 0; i < 100; i++ ) {
this.waitForReady(0.2F);
of.get(PubSubServer.class).publishString(TOPIC, "Hello pubsub server"+i)
.success((rst,cxt)->{
Assert.assertTrue(PubSubManager.PUB_OK == rst.getData());
});
//Assert.assertTrue(PubSubManager.PUB_OK == of.get(PubSubServer.class).publishString(TOPIC, "Hello pubsub server"+i));
}
}
}
| [
"mynewworldyyl@gmail.com"
] | mynewworldyyl@gmail.com |
4b61cfc5ebeee381a686918d25ef5b13e92854a7 | c8152f635c475df3f999940eb4d5b8608489039d | /app/src/test/java/com/batchmates/android/makingrestcalls/ExampleUnitTest.java | 8cf8a44ce5862a501449a12a30cb38d7ad65eca1 | [] | no_license | rosatorichard/MakingRestCalls | 0d2452128aa99a561e8fb8b6d739ef77492a20d2 | 10f1f7917e88f1db38998f6e156d12b2e5704d0a | refs/heads/master | 2021-01-01T18:52:43.915372 | 2017-07-26T19:23:35 | 2017-07-26T19:23:35 | 98,458,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package com.batchmates.android.makingrestcalls;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"rosatorichard@gmail.com"
] | rosatorichard@gmail.com |
e4656e7382621b0eb04ef06e9649d76c8b63a6a4 | 95f63a1297c8782d147b95501741676b53bbf48a | /app/src/main/java/com/dvipersquad/heybeach/beaches/BeachesContract.java | 1f253c9911855622c55670df5d4ac04d00b36fc7 | [] | no_license | astulnikov/hey-beach | 8c2aec262f8a00d2c2f096c466fc208d98270262 | 390aab97e13a7a452fc2de52b01c3e986b1d7d91 | refs/heads/master | 2020-04-07T08:55:01.888048 | 2018-11-14T14:57:13 | 2018-11-14T14:57:13 | 158,233,257 | 0 | 0 | null | 2018-11-19T14:03:50 | 2018-11-19T14:03:49 | null | UTF-8 | Java | false | false | 650 | java | package com.dvipersquad.heybeach.beaches;
import com.dvipersquad.heybeach.BasePresenter;
import com.dvipersquad.heybeach.BaseView;
import com.dvipersquad.heybeach.data.Beach;
import java.util.List;
public interface BeachesContract {
interface View extends BaseView<Presenter> {
void showImages(List<Beach> beaches);
void showLoadingImagesError();
void showUserProfileUI();
void showUserLoginUI();
void toggleLoadingIndicator(boolean active);
}
interface Presenter extends BasePresenter {
void loadImages();
void openUserProfile();
void loadNextPage();
}
}
| [
"meneses.brahyam@gmail.com"
] | meneses.brahyam@gmail.com |
8f89eeec8afef4e31614b75736170e4573dcb7d1 | 89379c5785b6669ddd3500be0f7b85d9d257426e | /src/Alias.java | 419bab4d31aa51072cb39fcf53fd817b743e5b90 | [] | no_license | markxueyuan/algorithm | bb82e565474765bf40f93b6e5e4b4b64f8154c68 | 4e9d4ff0ff004f7dbfb4f989de21a9d7e03329e1 | refs/heads/master | 2020-05-27T20:17:45.778179 | 2015-03-15T13:38:16 | 2015-03-15T13:38:16 | 18,030,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java |
public class Alias {
public static void main(String[] args){
int[] a = new int[10];
a[2] = 1234;
int[] b = a;
b[2] = 3456;
StdOut.println(a[2]);
StdOut.println(b[2]);
StdOut.println(a[3]);
}
}
| [
"ziyaajiang@gmail.com"
] | ziyaajiang@gmail.com |
2a3afe846a061457a1484bf9d9ea1ab59b881e11 | d5ba68032ed8166aa3f7985b05b5a83e2a0365e2 | /src/test/java/pageObjects/PaymentPage.java | b3faa2d41031657011d09f43286856fce068daa3 | [] | no_license | siddumaranur/GitAmazon | 0bdb11096cb3f7114c3de0d3d6fe794bb6d28ed9 | 549fb9d25ea525d31efd1bd41f41bd62369ec099 | refs/heads/master | 2022-12-17T08:16:28.069201 | 2020-09-23T15:13:06 | 2020-09-23T15:13:06 | 297,867,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,006 | java | package pageObjects;
import org.openqa.selenium.By;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
public class PaymentPage {
public static AndroidDriver<MobileElement> driver;
public PaymentPage(AndroidDriver<MobileElement> driver)
{
this.driver=driver;
}
public static By chkADDDebit=By.xpath("//android.widget.TextView[@text='Add Debit/Credit/ATM Card']");
public static By TxtCardHolderName=By.xpath("//android.widget.EditText[@text='Kiran']");
public static By TxtCardNo=By.id("pp-wVYT7P-104");
public static By drpSelectMonth=By.id("pp-wVYT7P-108");
public static By drpClickMonth=By.id("//android.view.View[@text='4']");
public static By drpSelectYear=By.id("pp-wVYT7P-109");
public static By drpClickYear=By.id("//android.view.View[@text='2022']");
public static By btnAddCardr=By.id("//android.widget.Button[@text='Add your card']");
public static By btnContinue=By.xpath("//android.widget.Button[@text='Continue']");
}
| [
"siddumaranur999@gmail.com"
] | siddumaranur999@gmail.com |
fff2925c0586fdf56d8a36e31ccbab787ac40a3d | 476a204391833c3b270c05fa54bad859ba395c9a | /src/main/java/it/smartcommunitylab/gamification/tnsmartweek/web/FormController.java | 757b9c48d0244d414dc18587ba316e930368e2e8 | [
"Apache-2.0"
] | permissive | smartcommunitylab/demo-scw-game | 4643357ed7a020231642ad9311104ad19b81643d | 9fb9b7fa3af5fef185faee9b9dce993c590b872d | refs/heads/master | 2022-12-22T20:57:13.334462 | 2018-04-11T13:55:32 | 2018-04-11T13:55:32 | 126,174,773 | 0 | 0 | Apache-2.0 | 2022-12-14T20:34:04 | 2018-03-21T12:24:51 | Java | UTF-8 | Java | false | false | 2,594 | java | package it.smartcommunitylab.gamification.tnsmartweek.web;
import java.util.List;
import java.util.Map;
import javax.validation.Valid;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import it.smartcommunitylab.gamification.tnsmartweek.service.DataManager;
import it.smartcommunitylab.gamification.tnsmartweek.service.GameEngineClient;
@Controller
@ConfigurationProperties(prefix = "form")
public class FormController {
private static final Logger logger = LogManager.getLogger(FormController.class);
private String googleKey;
private List<String> teams;
@Autowired
private GameEngineClient engineClient;
@RequestMapping("/")
public String form(Map<String, Object> model) {
model.put("trip", new Trip());
model.put("teams", teams);
model.put("googleKey", googleKey);
return "form";
}
@PostMapping("/submission")
public String process(@Valid @ModelAttribute Trip trip, BindingResult errors, Model model,
RedirectAttributes redirectAttrs) {
if (!errors.hasErrors()) {
logger.info("trip for team {}: participants: {}, distance: {}", trip.getSelectedTeam(),
trip.getParticipants(), trip.getDistance());
engineClient.formAction(trip.getSelectedTeam(), trip.getParticipants(),
DataManager.convertToMeters(trip.getDistance()));
} else {
logger.info("Validation errors during form submission");
model.addAttribute("teams", teams);
model.addAttribute("googleKey", googleKey);
return "form";
}
redirectAttrs.addFlashAttribute("submission", true);
return "redirect:/";
}
public String getGoogleKey() {
return googleKey;
}
public void setGoogleKey(String googleKey) {
this.googleKey = googleKey;
}
public List<String> getTeams() {
return teams;
}
public void setTeams(List<String> teams) {
this.teams = teams;
}
}
| [
"mirko.perillo@gmail.com"
] | mirko.perillo@gmail.com |
2b2a073fb66e5c498fce7db1521cdd59b349bab8 | 28e74371a07683e30b73bb6c411fbdac342c531c | /src/com/zangal/configuration/SecurityWebApplicationInitializer.java | ea181d2db51af4598f98d2548aa51d8e57a3c329 | [] | no_license | cvr11/Zangal | 4129b0d2af14a909eea91b15147fa0db22da9534 | 9f8c24342f4a42019789813abcc1024517b3b523 | refs/heads/master | 2021-09-15T07:56:29.404682 | 2018-05-28T20:16:53 | 2018-05-28T20:16:53 | 118,974,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package com.zangal.configuration;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
/**
* @author Q
*
*/
public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
}
| [
"venkat90001@gmail.com"
] | venkat90001@gmail.com |
d2ab31d5459447b5a74eab5a49dbbe1fbdc696b7 | 82239258f3a60beff575c0dcc9541a186019ad86 | /app/src/main/java/com/jiang/aaassit/Adapter/UserListAdapter.java | 32fe3f5720e895b67413e0973220bf0bcb401f42 | [] | no_license | SparrowC/AAAssit | 77fa9fc142c915d4cd9377c68487571776ff80ab | 4e23d172705bf623eb8c18aec913d9b1ecfcdbc6 | refs/heads/master | 2021-01-01T19:35:28.553812 | 2015-10-17T03:39:50 | 2015-10-17T03:39:50 | 42,248,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,470 | java | package com.jiang.aaassit.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.jiang.aaassit.DataBase.Beans.ModelUser;
import com.jiang.aaassit.R;
import java.util.List;
/**
* Created by Kun on 2015/9/14.
*/
public class UserListAdapter extends BaseAdapter {
private List<ModelUser> mModelUsers;
private Context mContext;
public UserListAdapter(Context context, List<ModelUser> modelUsers) {
mContext = context;
mModelUsers = modelUsers;
}
@Override
public int getCount() {
return mModelUsers.size();
}
@Override
public Object getItem(int position) {
return mModelUsers.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView;
if (convertView==null)
{
convertView= LayoutInflater.from(mContext).inflate(R.layout.user_list_item,null);
textView= (TextView) convertView.findViewById(R.id.lvUserItemText);
convertView.setTag(textView);
}else {
textView= (TextView) convertView.getTag();
}
textView.setText(mModelUsers.get(position).getName());
return convertView;
}
}
| [
"kun.j@foxmail.com"
] | kun.j@foxmail.com |
65eae5b6e5fcc1fe998261a0ff3796d364d7985c | 1ea93f52d410abcb6e619c3d816b670b436c6f9c | /src/main/java/inner/peace/common/utils/StringUtil.java | b1f277243400989efab216b45e387f16db9a98d6 | [] | no_license | shuguang123/rpc | b400b9e5ef510109775698ffee2f351740ecec46 | 8d62f6f84fdd48a6032b51ed71b433126a34a8cf | refs/heads/master | 2022-11-29T05:11:18.820436 | 2022-11-12T06:54:22 | 2022-11-12T06:54:22 | 124,158,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package inner.peace.common.utils;
import org.apache.commons.lang3.StringUtils;
/**
* StringUtil
*
* @author
* @create 2018-01-27 14:01
**/
public class StringUtil {
/**
* ๅคๆญๅญ็ฌฆไธฒๆฏๅฆไธบ็ฉบ
*/
public static boolean isEmpty(String str) {
if (str != null) {
str = str.trim();
}
return StringUtils.isEmpty(str);
}
/**
* ๅคๆญๅญ็ฌฆไธฒๆฏๅฆ้็ฉบ
*/
public static boolean isNotEmpty(String str) {
return !isEmpty(str);
}
/**
* ๅๅฒๅบๅฎๆ ผๅผ็ๅญ็ฌฆไธฒ
*/
public static String[] split(String str, String separator) {
return StringUtils.splitByWholeSeparator(str, separator);
}
}
| [
"18271454167@163.com"
] | 18271454167@163.com |
c991fed1eb08abb19c6a106e3a589f473917218c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/23/23_54103eb3f9fb6e1fd4d1b83c784a23b80323ec75/AppsCustomizeTabHost/23_54103eb3f9fb6e1fd4d1b83c784a23b80323ec75_AppsCustomizeTabHost_t.java | 2dd80266c0ddc320307a990237c451727b35722c | [] | 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 | 13,460 | java | /*
* Copyright (C) 2011 The Android Open Source Project
*
* 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.android.launcher2;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.TextView;
import com.android.launcher.R;
public class AppsCustomizeTabHost extends TabHost implements LauncherTransitionable,
TabHost.OnTabChangeListener {
static final String LOG_TAG = "AppsCustomizeTabHost";
private static final String APPS_TAB_TAG = "APPS";
private static final String WIDGETS_TAB_TAG = "WIDGETS";
private final LayoutInflater mLayoutInflater;
private ViewGroup mTabs;
private ViewGroup mTabsContainer;
private AppsCustomizePagedView mAppsCustomizePane;
private boolean mSuppressContentCallback = false;
private ImageView mAnimationBuffer;
private boolean mInTransition;
private boolean mResetAfterTransition;
public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
mLayoutInflater = LayoutInflater.from(context);
}
/**
* Convenience methods to select specific tabs. We want to set the content type immediately
* in these cases, but we note that we still call setCurrentTabByTag() so that the tab view
* reflects the new content (but doesn't do the animation and logic associated with changing
* tabs manually).
*/
private void setContentTypeImmediate(AppsCustomizePagedView.ContentType type) {
onTabChangedStart();
onTabChangedEnd(type);
}
void selectAppsTab() {
setContentTypeImmediate(AppsCustomizePagedView.ContentType.Applications);
setCurrentTabByTag(APPS_TAB_TAG);
}
void selectWidgetsTab() {
setContentTypeImmediate(AppsCustomizePagedView.ContentType.Widgets);
setCurrentTabByTag(WIDGETS_TAB_TAG);
}
/**
* Setup the tab host and create all necessary tabs.
*/
@Override
protected void onFinishInflate() {
// Setup the tab host
setup();
final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
final TabWidget tabs = (TabWidget) findViewById(com.android.internal.R.id.tabs);
final AppsCustomizePagedView appsCustomizePane = (AppsCustomizePagedView)
findViewById(R.id.apps_customize_pane_content);
mTabs = tabs;
mTabsContainer = tabsContainer;
mAppsCustomizePane = appsCustomizePane;
mAnimationBuffer = (ImageView) findViewById(R.id.animation_buffer);
if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();
// Configure the tabs content factory to return the same paged view (that we change the
// content filter on)
TabContentFactory contentFactory = new TabContentFactory() {
public View createTabContent(String tag) {
return appsCustomizePane;
}
};
// Create the tabs
TextView tabView;
String label;
label = mContext.getString(R.string.all_apps_button_label);
tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
tabView.setText(label);
tabView.setContentDescription(label);
addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
label = mContext.getString(R.string.widgets_tab_label);
tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
tabView.setText(label);
tabView.setContentDescription(label);
addTab(newTabSpec(WIDGETS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
setOnTabChangedListener(this);
// Setup the key listener to jump between the last tab view and the market icon
AppsCustomizeTabKeyEventListener keyListener = new AppsCustomizeTabKeyEventListener();
View lastTab = tabs.getChildTabViewAt(tabs.getTabCount() - 1);
lastTab.setOnKeyListener(keyListener);
View shopButton = findViewById(R.id.market_button);
shopButton.setOnKeyListener(keyListener);
// Hide the tab bar until we measure
mTabsContainer.setAlpha(0f);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
boolean remeasureTabWidth = (mTabs.getLayoutParams().width <= 0);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// Set the width of the tab list to the content width
if (remeasureTabWidth) {
int contentWidth = mAppsCustomizePane.getPageContentWidth();
if (contentWidth > 0) {
// Set the width and show the tab bar (if we have a loading graphic, we can switch
// it off here)
mTabs.getLayoutParams().width = contentWidth;
post(new Runnable() {
public void run() {
mTabs.requestLayout();
mTabsContainer.setAlpha(1f);
}
});
}
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// Intercept all touch events up to the bottom of the AppsCustomizePane so they do not fall
// through to the workspace and trigger showWorkspace()
if (event.getY() < mAppsCustomizePane.getBottom()) {
return true;
}
return super.onTouchEvent(event);
}
private void onTabChangedStart() {
mAppsCustomizePane.hideScrollingIndicator(false);
}
private void reloadCurrentPage() {
if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.flashScrollingIndicator();
}
mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
mAppsCustomizePane.requestFocus();
}
private void onTabChangedEnd(AppsCustomizePagedView.ContentType type) {
mAppsCustomizePane.setContentType(type);
}
@Override
public void onTabChanged(String tabId) {
final AppsCustomizePagedView.ContentType type = getContentTypeForTabTag(tabId);
if (mSuppressContentCallback) {
mSuppressContentCallback = false;
return;
}
// Animate the changing of the tab content by fading pages in and out
final Resources res = getResources();
final int duration = res.getInteger(R.integer.config_tabTransitionDuration);
// We post a runnable here because there is a delay while the first page is loading and
// the feedback from having changed the tab almost feels better than having it stick
post(new Runnable() {
@Override
public void run() {
if (mAppsCustomizePane.getMeasuredWidth() <= 0 ||
mAppsCustomizePane.getMeasuredHeight() <= 0) {
reloadCurrentPage();
return;
}
// Setup the animation buffer
Bitmap b = Bitmap.createBitmap(mAppsCustomizePane.getMeasuredWidth(),
mAppsCustomizePane.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
mAppsCustomizePane.draw(c);
mAppsCustomizePane.setAlpha(0f);
mAnimationBuffer.setImageBitmap(b);
mAnimationBuffer.setAlpha(1f);
mAnimationBuffer.setVisibility(View.VISIBLE);
c.setBitmap(null);
b = null;
// Toggle the new content
onTabChangedStart();
onTabChangedEnd(type);
// Animate the transition
ObjectAnimator outAnim = ObjectAnimator.ofFloat(mAnimationBuffer, "alpha", 0f);
outAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimationBuffer.setVisibility(View.GONE);
mAnimationBuffer.setImageBitmap(null);
}
});
ObjectAnimator inAnim = ObjectAnimator.ofFloat(mAppsCustomizePane, "alpha", 1f);
inAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
reloadCurrentPage();
}
});
AnimatorSet animSet = new AnimatorSet();
animSet.playTogether(outAnim, inAnim);
animSet.setDuration(duration);
animSet.start();
}
});
}
public void setCurrentTabFromContent(AppsCustomizePagedView.ContentType type) {
mSuppressContentCallback = true;
setCurrentTabByTag(getTabTagForContentType(type));
}
/**
* Returns the content type for the specified tab tag.
*/
public AppsCustomizePagedView.ContentType getContentTypeForTabTag(String tag) {
if (tag.equals(APPS_TAB_TAG)) {
return AppsCustomizePagedView.ContentType.Applications;
} else if (tag.equals(WIDGETS_TAB_TAG)) {
return AppsCustomizePagedView.ContentType.Widgets;
}
return AppsCustomizePagedView.ContentType.Applications;
}
/**
* Returns the tab tag for a given content type.
*/
public String getTabTagForContentType(AppsCustomizePagedView.ContentType type) {
if (type == AppsCustomizePagedView.ContentType.Applications) {
return APPS_TAB_TAG;
} else if (type == AppsCustomizePagedView.ContentType.Widgets) {
return WIDGETS_TAB_TAG;
}
return APPS_TAB_TAG;
}
/**
* Disable focus on anything under this view in the hierarchy if we are not visible.
*/
@Override
public int getDescendantFocusability() {
if (getVisibility() != View.VISIBLE) {
return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
return super.getDescendantFocusability();
}
void reset() {
if (mInTransition) {
// Defer to after the transition to reset
mResetAfterTransition = true;
} else {
// Reset immediately
mAppsCustomizePane.reset();
}
}
/* LauncherTransitionable overrides */
@Override
public void onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace) {
mInTransition = true;
// isHardwareAccelerated() checks if we're attached to a window and if that
// window is HW accelerated-- we were sometimes not attached to a window
// and buildLayer was throwing an IllegalStateException
if (animation != null && isHardwareAccelerated()) {
// Turn on hardware layers for performance
setLayerType(LAYER_TYPE_HARDWARE, null);
// force building the layer at the beginning of the animation, so you don't get a
// blip early in the animation
buildLayer();
}
if (!toWorkspace && !LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.showScrollingIndicator(false);
}
if (mResetAfterTransition) {
mAppsCustomizePane.reset();
mResetAfterTransition = false;
}
}
@Override
public void onLauncherTransitionEnd(Launcher l, Animator animation, boolean toWorkspace) {
mInTransition = false;
if (animation != null) {
setLayerType(LAYER_TYPE_NONE, null);
}
if (!toWorkspace) {
// Dismiss the cling if necessary
l.dismissWorkspaceCling(null);
if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.hideScrollingIndicator(false);
}
}
}
boolean isTransitioning() {
return mInTransition;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
39463419d152e5b0a94b6fbb5e710a2f8ecafd06 | 04596846612650b3829ee1dfd6ddac28d95d2192 | /Eclipseๆไปถๅผๅๅญฆไน ็ฌ่ฎฐ-ๆบไปฃ็ 1่ณ24็ซ /chapter23/ch23/rcpdev.contact.ui/src/rcpdev/contact/ui/views/search/provider/SearchContactContentProvider.java | b048a15db2bc8d5ff7725972ed7dc74a95133a40 | [] | no_license | syc759630420/eclipsePluginStudyNoteSourceCode | c313566203761b7e55cfeea56725064d5d65b659 | c64355a1853be57984f78edb6b50facb9c8f32c7 | refs/heads/master | 2023-03-16T20:32:43.820490 | 2018-10-24T14:33:42 | 2018-10-24T14:33:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package rcpdev.contact.ui.views.search.provider;
import rcpdev.contact.ui.common.provider.AbstractContentProvider;
import rcpdev.contact.ui.views.search.SearchResultBean;
public class SearchContactContentProvider extends AbstractContentProvider {
public Object[] getElements(Object inputElement) {
SearchResultBean input = (SearchResultBean) inputElement;
if (input.getResult() == null)
return new Object[] {};
return input.getResult().toArray();
}
}
| [
"gaohailong@gaohailongdeMacBook-Pro.local"
] | gaohailong@gaohailongdeMacBook-Pro.local |
d91b658e741acda04d3f3d22c798b7167a6dfdd6 | ad8765f732293642be75a5e7dd11b8631f24107a | /src/main/java/com/wangchao/mmall/service/SysAclServiceImpl.java | 6807420392b9a4f34f5d2e5df7dd2176fa8786dd | [] | no_license | wangchao123321/mmall-permission | 7a022e846fb34c641c23068e542be8b5f3ed7844 | e88762a1b89ea1017dae958b1f2984ec69243905 | refs/heads/master | 2020-03-24T11:17:52.918356 | 2018-08-06T13:41:19 | 2018-08-06T13:41:19 | 142,681,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,511 | java | package com.wangchao.mmall.service;
import com.google.common.base.Preconditions;
import com.wangchao.mmall.beans.PageQuery;
import com.wangchao.mmall.beans.PageResult;
import com.wangchao.mmall.common.RequestHolder;
import com.wangchao.mmall.dao.SysAclMapper;
import com.wangchao.mmall.exception.ParamException;
import com.wangchao.mmall.model.SysAcl;
import com.wangchao.mmall.param.AclParam;
import com.wangchao.mmall.util.BeanValidator;
import com.wangchao.mmall.util.IpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Service
public class SysAclServiceImpl implements SysAclService{
@Autowired
private SysAclMapper sysAclMapper;
@Autowired
private SysLogService sysLogService;
@Override
public void save(AclParam param) {
BeanValidator.check(param);
if(checkExist(param.getAclModuleId(),param.getName(),param.getId())){
throw new ParamException("ๅฝๅๆ้ๆจกๅไธ้ขๅญๅจ็ธๅๅ็งฐ็ๆ้็น");
}
SysAcl acl = SysAcl.builder().name(param.getName()).aciModuleId(param.getAclModuleId()).url(param.getUrl())
.type(param.getType()).status(param.getStatus()).seq(param.getSeq()).remark(param.getRemark()).build();
// acl.setCode(generateCode());
acl.setOperator(RequestHolder.getCurrentUser().getUsername());
acl.setOperatorTime(new Date());
acl.setOperatorIp(IpUtil.getRemoteIp(RequestHolder.getCurrentRequest()));
sysAclMapper.insertSelective(acl);
sysLogService.saveAclLog(null, acl);
}
@Override
public void update(AclParam param) {
BeanValidator.check(param);
if(checkExist(param.getAclModuleId(),param.getName(),param.getId())){
throw new ParamException("ๅฝๅๆ้ๆจกๅไธ้ขๅญๅจ็ธๅๅ็งฐ็ๆ้็น");
}
SysAcl before = sysAclMapper.selectByPrimaryKey(param.getId());
Preconditions.checkNotNull(before, "ๅพ
ๆดๆฐ็ๆ้็นไธๅญๅจ");
SysAcl after = SysAcl.builder().id(param.getId()).name(param.getName()).aciModuleId(param.getAclModuleId()).url(param.getUrl())
.type(param.getType()).status(param.getStatus()).seq(param.getSeq()).remark(param.getRemark()).build();
after.setOperator(RequestHolder.getCurrentUser().getUsername());
after.setOperatorTime(new Date());
after.setOperatorIp(IpUtil.getRemoteIp(RequestHolder.getCurrentRequest()));
sysAclMapper.updateByPrimaryKeySelective(after);
sysLogService.saveAclLog(before, after);
}
@Override
public PageResult<SysAcl> getPageByAclModuleId(int aclModuleId, PageQuery query) {
BeanValidator.check(query);
int count=sysAclMapper.countByAclModuleId(aclModuleId);
if(count > 0){
List<SysAcl> aclList=sysAclMapper.getPageByAclModuleId(aclModuleId,query);
return PageResult.<SysAcl>builder().data(aclList).total(count).build();
}
return PageResult.<SysAcl>builder().build();
}
private boolean checkExist(int aclModuleId,String name,Integer id){
return sysAclMapper.countByNameAndAclModuleId(aclModuleId,name,id) > 0;
}
public String generateCode() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
return dateFormat.format(new Date()) + "_" + (int)(Math.random() * 100);
}
}
| [
"244067166@qq.com"
] | 244067166@qq.com |
1b27593d6a12570d795caeefbc208162571198b9 | 6e949d17adc95460425f043d5b70cb14bd13ef95 | /service-fishing/src/main/java/com/tongzhu/fishing/redis/DistributedLockTemplate.java | a5ae3334bd41870a62e47f8e1515b6bf1a5d813b | [] | no_license | HuangRicher/tree | ca1397d6a74eb5d8e49697934c1077beb415d704 | 88d314cac28d3eea820addcd392ff2d01a74f320 | refs/heads/master | 2020-05-21T06:08:50.365919 | 2019-05-15T05:49:39 | 2019-05-15T05:49:39 | 185,935,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package com.tongzhu.fishing.redis;
import java.util.concurrent.TimeUnit;
/**
* ๅๅธๅผ้ๆไฝๆจกๆฟ
*/
public interface DistributedLockTemplate {
/**
* ไฝฟ็จๅๅธๅผ้๏ผไฝฟ็จ้้ป่ฎค่ถ
ๆถๆถ้ดใ
*
* @param callback
* @return
*/
public <T> T lock(DistributedLockCallback<T> callback);
/**
* ไฝฟ็จๅๅธๅผ้ใ่ชๅฎไน้็่ถ
ๆถๆถ้ด
*
* @param callback
* @param leaseTime ้่ถ
ๆถๆถ้ดใ่ถ
ๆถๅ่ชๅจ้ๆพ้ใ
* @param timeUnit
* @return
*/
public <T> T lock(DistributedLockCallback<T> callback, long leaseTime, TimeUnit timeUnit);
}
| [
"huangweibiao@instoms.cn"
] | huangweibiao@instoms.cn |
e75ffc0615f6bbee64cdd5a9ee404a17b1208e62 | a0157465927eeac3296deac94ab3f45db50f365f | /modules/base/impl/src/main/java/org/picketlink/internal/el/ELEvaluationContext.java | a93afca3018ca41fd5389b1c2c154848a18505b8 | [
"Apache-2.0"
] | permissive | gastaldi/picketlink | cb988192862e4d5976beb1603e6373432423f76a | 99f125c10cd1bf950573d5002e89b63f482b47cf | refs/heads/master | 2021-01-18T02:02:22.448040 | 2014-11-07T16:12:35 | 2014-11-07T16:12:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,269 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2012, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.picketlink.internal.el;
import org.picketlink.Identity;
import org.picketlink.idm.PartitionManager;
/**
* <p>{@link java.lang.ThreadLocal} used to share a execution context when invoking EL functions defined by {@link ELFunctionMethods}.</p>
*
* TODO: check if EL does not provide something similar so we can avoid this.
*
* @author Pedro Igor
*/
class ELEvaluationContext {
private static final ThreadLocal<ELEvaluationContext> evaluationContext = new ThreadLocal<ELEvaluationContext>() {
@Override
protected ELEvaluationContext initialValue() {
return new ELEvaluationContext();
}
};
private Identity identity;
private PartitionManager partitionManager;
static ELEvaluationContext get() {
return evaluationContext.get();
}
static void release() {
evaluationContext.remove();
}
void setIdentity(Identity identity) {
this.identity = identity;
}
Identity getIdentity() {
return identity;
}
void setPartitionManager(PartitionManager partitionManager) {
this.partitionManager = partitionManager;
}
PartitionManager getPartitionManager() {
return this.partitionManager;
}
}
| [
"pigor.craveiro@gmail.com"
] | pigor.craveiro@gmail.com |
70d2d4951799108068edcbe257ca3db0be355991 | 58a4e7d70d5540117951d25acbe73dd2dc9b0834 | /src/Maps/Moba.java | f2a73160742c21abadaec9f82517da8d02574db8 | [] | no_license | nikolaytsvyatkov/SoftwareUniversity-FundamentalsModule | 970c004d43ec9be3a8e92f75833545363803e356 | c6096debc1cf10c37e1706e8282944a28bc2990d | refs/heads/master | 2021-07-01T10:56:37.366316 | 2020-12-12T17:00:20 | 2020-12-12T17:00:20 | 198,618,268 | 0 | 0 | null | 2020-12-12T17:00:21 | 2019-07-24T11:02:42 | Java | UTF-8 | Java | false | false | 4,040 | java | package Maps;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
public class Moba{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Map<String, Map<String, Integer>> map = new LinkedHashMap<>();
//name, posiiton, skills
Map<String, Integer> totalSkills = new LinkedHashMap<>();
while (true) {
String command = input.nextLine();
if (command.equals("Season end")) {
break;
}
if (command.contains(" -> ")) {
String[] strings = command.split(" -> ");
Map<String, Integer> map1 = map.get(strings[0]);
if (map1 == null) {
map1 = new LinkedHashMap<>();
}
if (!map1.containsKey(strings[1])) {
map1.put(strings[1], Integer.parseInt(strings[2]));
} else {
int current = map1.get(strings[1]);
if (current < Integer.parseInt(strings[2])) {
map1.put(strings[1], Integer.parseInt(strings[2]));
}
}
map.put(strings[0], map1);
} else if (command.contains("vs")) {
String[] strings = command.split(" vs ");
boolean flag = false;
if (map.containsKey(strings[0]) && map.containsKey(strings[1])) {
Map<String, Integer> name1 = map.get(strings[0]);
Map<String, Integer> name2 = map.get(strings[1]);
int total1 = 0;
int total2 = 0;
for (Map.Entry<String, Integer> entry : name1.entrySet()) {
String currentPos = entry.getKey();
if (name2.containsKey(currentPos)) {
flag = true;
break;
}
}
if (flag) {
for (Map.Entry<String, Integer> entry : name1.entrySet()) {
total1 += entry.getValue();
}
for (Map.Entry<String, Integer> entry : name2.entrySet()) {
total2 += entry.getValue();
}
if (total1 > total2) {
map.remove(strings[1]);
} else if (total2 > total1) {
map.remove(strings[0]);
}
}
}
}
}
for (Map.Entry<String, Map<String, Integer>> entry : map.entrySet()) {
Map<String, Integer> map1 = entry.getValue();
int sum = 0;
for (Map.Entry<String, Integer> entry1 : map1.entrySet()) {
sum += entry1.getValue();
}
if (!totalSkills.containsKey(entry.getKey())) {
totalSkills.put(entry.getKey(), sum);
} else {
totalSkills.put(entry.getKey(), totalSkills.get(entry.getKey()) + sum);
}
}
totalSkills.entrySet().stream().sorted((a, b)->{
int result = Integer.compare(b.getValue(), a.getValue());
if (result == 0) {
result = a.getKey().compareTo(b.getKey());
}
return result;
}).forEach(e->{
Map<String, Integer> map1 = map.get(e.getKey());
System.out.printf("%s: %d skill%n",e.getKey(), e.getValue());
map1.entrySet().stream().sorted((a, b) ->{
int result = Integer.compare(b.getValue(), a.getValue());
if (result == 0) {
result = a.getKey().compareTo(b.getKey());
}
return result;
}).forEach(a ->{
System.out.printf("- %s <::> %d%n",a.getKey(),a.getValue());
});
});
}
} | [
"nikolay.tsvyatkov99@gmail.com"
] | nikolay.tsvyatkov99@gmail.com |
8c4d7c903e61d7d60292c00c2b03a91572380cdd | f75b6875369d5e1b063f87b73895fdabf253c4f0 | /blog-service/src/main/java/com/zuoxiaolong/blog/service/WebBlogService.java | f468e1a11758a607d34386f9d7f3f7805bf767be | [
"Apache-2.0"
] | permissive | yfbzxf/everyone-java-blog | 700f19e14b9a3f0051f90edb86684d03096042f1 | 532c46753668a3a91c99906cf1eade00b2134a20 | refs/heads/master | 2021-01-18T05:35:22.139856 | 2016-07-05T16:38:21 | 2016-07-05T16:38:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,465 | java | /*
* Copyright 2002-2016 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.
*/
package com.zuoxiaolong.blog.service;
import com.zuoxiaolong.blog.common.orm.DropDownPage;
import com.zuoxiaolong.blog.model.dto.UserBlogInfo;
import com.zuoxiaolong.blog.model.persistent.BlogConfig;
import com.zuoxiaolong.blog.model.persistent.UserArticle;
import java.util.List;
/**
* ็จๆทๅๅฎขไธชไบบไธป้กตไธๅกๆฅๅฃ
*
* @author linjiedeng
* @author youboren
* @date 16/5/14 ไธๅ7:49
* @since 1.0.0
*/
public interface WebBlogService {
UserBlogInfo selectUserBlogInfoByUsername(String username, String pageSize, String offset);
int updateBlogConfig(BlogConfig blogConfig);
BlogConfig selectBlogConfigByWebUserId(Integer webUserId);
/**
* ่ทๅๆ็ไธชไบบๅๅฎข
* @param userId
* @return
*/
List<UserArticle> getMyBlogByUserId(Integer userId, String pageSize, String offset);
}
| [
"150349407@qq.com"
] | 150349407@qq.com |
2d82c45982d6cbf1dbfe3c760976a1e3cb3d91bf | 065172e655842a969345e91cd0a0ba12c878e5b8 | /Android-authoritative-programming-guide/Chapter-Five/GeoQuiz/app/src/main/java/com/example/a13306/geoquiz/QuizActivity.java | 15af98dc36342c42212dd31dff097f4d0ac4f2ea | [] | no_license | YouChowMein/Android | bdb1263af39c0021156d59f864d1a7c7f857e400 | 7710c974b6fec9ebc10b836153bfdf001a50ace1 | refs/heads/master | 2020-03-17T02:43:46.680719 | 2018-12-23T03:35:25 | 2018-12-23T03:35:25 | 133,202,660 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,898 | java | package com.example.a13306.geoquiz;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class QuizActivity extends AppCompatActivity {
private Button mTrueButton;
private Button mFalseButton;
private Button mNextButton;
private Button mCheatButton;
private TextView mQuestionTextView;
private static final int REQUEST_CODE_CHEAT=0;
private boolean mIsCheater;
private Question[] mQuestionBank = new Question[] {
new Question(R.string.question_australia, true),
new Question(R.string.question_oceans, true),
new Question(R.string.question_mideast, false),
new Question(R.string.question_africa, false),
new Question(R.string.question_americas, true),
new Question(R.string.question_asia, true),
};
private int mCurrentIndex = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz);
mQuestionTextView = (TextView) findViewById(R.id.question_text_view);
mTrueButton = (Button) findViewById(R.id.true_button);
mTrueButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
checkAnswer(true);
}
});
mFalseButton = (Button) findViewById(R.id.false_button);
mFalseButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
checkAnswer(false);
}
});
mNextButton = (Button) findViewById(R.id.next_button);
mNextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length;
mIsCheater=false;
updateQuestion();
}
});
mCheatButton=findViewById(R.id.cheat_button);
mCheatButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Start CheatActivity
// Intent intent=new Intent(QuizActivity.this,CheatActivity.class);
boolean answerIsTrue=mQuestionBank[mCurrentIndex].isAnswerTrue();
Intent intent=CheatActivity.newIntent(QuizActivity.this,answerIsTrue);
// startActivity(intent);
startActivityForResult(intent,REQUEST_CODE_CHEAT);
}
});
updateQuestion();
}
@Override
protected void onActivityResult(int requestCode,int resultCode,Intent data){
if(resultCode!=Activity.RESULT_OK){
return;
}
if(requestCode==REQUEST_CODE_CHEAT){
if(data==null){
return;
}
mIsCheater=CheatActivity.wasAnswerShown(data);
}
}
private void updateQuestion() {
int question = mQuestionBank[mCurrentIndex].getTextResId();
mQuestionTextView.setText(question);
}
private void checkAnswer(boolean userPressedTrue) {
boolean answerIsTrue = mQuestionBank[mCurrentIndex].isAnswerTrue();
int messageResId = 0;
if(mIsCheater){
messageResId=R.string.judgment_toast;
}else {
if (userPressedTrue == answerIsTrue) {
messageResId = R.string.correct_toast;
} else {
messageResId = R.string.incorrect_toast;
}
}
Toast.makeText(this, messageResId, Toast.LENGTH_SHORT)
.show();
}
}
| [
"1330676845@qq.com"
] | 1330676845@qq.com |
28473804d662c9f25dd472e7a70a81b810d2b562 | db58fc0889abffb465c7eab21ea3813eededbde1 | /bodySoleWellnessCenter/src/com/caseytoews/bodysoleapp/models/bodyservice/BodyServiceListModel.java | ac74c0194cda4035f33bd385efc19999672ec2d6 | [] | no_license | ctoewsdev/java-crm | df0c8dbf6bcff28f013267f27aceb024eb19e7a0 | c3454defa56dd27af31c4cef909dc60956d344ad | refs/heads/master | 2020-06-17T01:10:23.406443 | 2019-07-08T06:43:19 | 2019-07-08T06:43:19 | 195,751,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,731 | java | /**
* Project: bodySoleWellnessCenter
* Date: Dec 1, 2018
* Time: 9:43:21 AM
*/
package com.caseytoews.bodysoleapp.models.bodyservice;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractListModel;
import com.caseytoews.bodysoleapp.domain.sales.BodyService;
public class BodyServiceListModel extends AbstractListModel<BodyServiceListItem> {
private static final long serialVersionUID = 1L;
private List<BodyServiceListItem> serviceItems;
public BodyServiceListModel() {
serviceItems = new ArrayList<>();
}
public void setServices(List<BodyService> services) {
for (BodyService service : services) {
serviceItems.add(new BodyServiceListItem(service));
}
}
@Override
public int getSize() {
return serviceItems == null ? 0 : serviceItems.size();
}
@Override
public BodyServiceListItem getElementAt(int index) {
return serviceItems.get(index);
}
public void add(BodyService service) {
add(-1, service);
}
public void add(int index, BodyService service) {
BodyServiceListItem item = new BodyServiceListItem(service);
if (index == -1) {
serviceItems.add(item);
index = serviceItems.size() - 1;
} else {
serviceItems.add(index, item);
}
fireContentsChanged(this, index, index);
}
public void update(int index, BodyServiceListItem item) {
serviceItems.set(index, item);
fireContentsChanged(this, index, index);
}
/**
* Removes the first (lowest-indexed) occurrence of the argument from this list.
*/
public boolean remove(BodyServiceListItem item) {
int index = serviceItems.indexOf(item);
boolean removed = serviceItems.remove(item);
if (index >= 0) {
fireIntervalRemoved(this, index, index);
}
return removed;
}
}
| [
"caseytoews@telus.net"
] | caseytoews@telus.net |
1b853efb5a767a159dd83f5c0f936feb7291aa40 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-f5660.java | 60bf0103fef569a89916a81011ba97250148bd82 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
5672691907735 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
dcc4de5fee3bac33b2f0df8df0b640fe946b8a71 | 77e256ea43b8b6f3bab52f167fe3b5eb3eb186d0 | /Java-IO-and-Networks/ChattingAppRMI/src/main/java/client/utilities/MessageSendingThread.java | 5d8cbde0a38f5d7a2eaf71f87698cd3868886eb1 | [] | no_license | hadeerelnaggar/ITI-Work | 25b693524bab26ec9cf3ce7bf436620cc9991c0f | 23763667d4ae1c5c9a39332f5f6baaf9756ae9a5 | refs/heads/master | 2023-03-14T11:17:13.423264 | 2021-03-08T20:28:05 | 2021-03-08T20:28:05 | 345,781,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package client.utilities;
import serverRemote.ChatServerInt;
import java.rmi.RemoteException;
public class MessageSendingThread extends Thread {
ChatServerInt chatServer;
String message;
public MessageSendingThread(ChatServerInt chatServer,String message){
this.chatServer = chatServer;
this.message = message;
}
@Override
public void run() {
try {
chatServer.tellOther(message);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
| [
"hadeerelnaggar@hotmail.com"
] | hadeerelnaggar@hotmail.com |
0a404570c5002552d5ee2a73fd1f6492cf7704d9 | a2a300e9667e50f65eed948f87a11411f13d5126 | /learnMore-java/src/main/java/com/learn/test/TestModel.java | c01f0a99cae4e36b264fa55ba7e627f2cb83bd9f | [
"Apache-2.0"
] | permissive | ThansksJava/learnMore | a6182dd04cc682483d400c9e721941f7dd92115d | b1e279c060c85d077c5a42e9ea7c1cbcbbcb39e1 | refs/heads/master | 2023-01-14T09:55:40.470264 | 2022-12-30T04:11:32 | 2023-01-04T03:17:46 | 159,468,977 | 0 | 0 | Apache-2.0 | 2023-01-04T03:18:33 | 2018-11-28T08:31:50 | Java | UTF-8 | Java | false | false | 386 | java | package com.learn.test;
/**
* @author fengjie
* @version 1.0
* @date Created in 2019/1/3 16:20
*/
public class TestModel {
private String name;
public TestModel() {
}
public TestModel(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"luckyjiefeng@163.com"
] | luckyjiefeng@163.com |
8437b9150c2ccd968442dc2fd5f92c7e07aed36e | defb85ce2a3ba3539f927a699d626a330aa6b954 | /interactive_engine/src/v2/src/main/java/com/alibaba/maxgraph/v2/frontend/compiler/exception/RetryGremlinException.java | dbf1847dba19a6445fecea0d0e2ffbf1cbbdf77c | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-elastic-license-2018",
"LicenseRef-scancode-other-permissive"
] | permissive | MJY-HUST/GraphScope | c96d2f8a15f25fc1cc1f3e3d71097ac71819afce | d2ab25976edb4cae3e764c53102ded688a56a08c | refs/heads/main | 2023-08-17T00:30:38.113834 | 2021-07-15T16:27:05 | 2021-07-15T16:27:05 | 382,337,023 | 0 | 0 | Apache-2.0 | 2021-07-02T12:17:46 | 2021-07-02T12:17:46 | null | UTF-8 | Java | false | false | 907 | java | /**
* Copyright 2020 Alibaba Group Holding Limited.
*
* 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.alibaba.maxgraph.v2.frontend.compiler.exception;
public class RetryGremlinException extends Exception {
public RetryGremlinException(Throwable t) {
super(t);
}
public RetryGremlinException(String message, Throwable t) {
super(message, t);
}
}
| [
"noreply@github.com"
] | MJY-HUST.noreply@github.com |
faad4b5892ca493352a6f84d995d9b0f466fa831 | ce66e84e882d4319c454c645e124f1930ced5145 | /src/main/java/ch/zhaw/itmania/tiles/LavaTile.java | 35403a9fcf081fe67e0ebe49ca6588a212467be5 | [] | no_license | ungerpeter/it-mania-game | 06cb0a16d76b99e4e70f9318bdbbe5ca8eede83f | fc9d4833c3821b49432059671aaa6317e889baf4 | refs/heads/master | 2021-01-09T05:47:15.905821 | 2017-02-03T15:04:16 | 2017-02-03T15:04:16 | 80,833,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package ch.zhaw.itmania.tiles;
import ch.zhaw.itmania.entities.Entity;
import ch.zhaw.itmania.entities.creatures.Creature;
import ch.zhaw.itmania.gfx.Assets;
/**
* ch.zhaw.itmania.tiles
* Created by Peter Unger on 12.12.2015.
*/
public class LavaTile extends Tile {
public LavaTile(int id) {
super(Assets.LAVA_TILE, id);
}
@Override
public void onTouch(Entity entity) {
if(entity instanceof Creature) {
((Creature) entity).setHealth(0);
}
}
}
| [
"ungerpet@students.zhaw.ch"
] | ungerpet@students.zhaw.ch |
7198ebe4574d0cbe28443033e494f02073c41944 | f2d5ead5cbcc1ed2963164c8bba3a9b2ea27fc3e | /src/com/carlo/starter/MyStarter.java | 4d113afd3a9fc377acd17db0a1760b9b0098e03a | [
"BSD-3-Clause"
] | permissive | carl0967/AIWolfBayesPlayer | 44f0b7844e9a8c333ad40abbc266a4541cd27116 | 453e8b2c1d6edcedb451aa7d9d635c8b481a5bf7 | refs/heads/master | 2021-01-10T13:30:48.489179 | 2016-02-23T06:48:34 | 2016-02-23T06:48:34 | 46,911,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,548 | java | package com.carlo.starter;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.aiwolf.common.data.*;
import org.aiwolf.common.net.GameSetting;
import org.aiwolf.common.util.CalendarTools;
import org.aiwolf.kajiClient.LearningPlayer.*;
import org.aiwolf.server.*;
import org.aiwolf.server.net.DirectConnectServer;
import org.aiwolf.server.net.GameServer;
import org.aiwolf.server.util.FileGameLogger;
import org.aiwolf.server.util.GameLogger;
import com.carlo.bayes.player.BayesPlayer;
import com.yy.player.*;
public class MyStarter {
/**
* ๅๅ ใจใผใธใงใณใใฎๆฐ
* ๅคงไผใฏ15
* 10ไบบใงๅ
จๅฝน่ทใใ
*/
static protected int PLAYER_NUM = 15;
/**
* 1ๅใฎๅฎ่กใง่กใใฒใผใ ๆฐ
*/
static protected int GAME_NUM = 1;
public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
//ๆไบบๅดๅๅฉๆฐ
int villagerWinNum = 0;
//ไบบ็ผๅดๅๅฉๆฐ
int werewolfWinNum = 0;
for(int i = 0;i<GAME_NUM;i++){
List<Player> playerList = new ArrayList<Player>();
for(int j=0;j<PLAYER_NUM;j++){
//playerList.add(new KajiRoleAssignPlayer()); //ใใใงไฝๆใใใจใผใธใงใณใใๆๅฎ
playerList.add(new BayesPlayer());
}
GameServer gameServer = new DirectConnectServer(playerList);
GameSetting gameSetting = GameSetting.getDefaultGame(PLAYER_NUM);
AIWolfGame game = new AIWolfGame(gameSetting, gameServer);
game.setShowConsoleLog(true);
//ใญใฐ
String timeString = CalendarTools.toDateTime(System.currentTimeMillis()).replaceAll("[\\s-/:]", "");
File logFile = new File(String.format("%s/aiwolfGame%s_%d.log", "./log/", timeString,villagerWinNum+werewolfWinNum));
try {
game.setGameLogger(new FileGameLogger(logFile));
} catch (IOException e) {
// TODO ่ชๅ็ๆใใใ catch ใใญใใฏ
e.printStackTrace();
}
game.setRand(new Random(gameSetting.getRandomSeed()));
game.start();
if(game.getWinner() == Team.VILLAGER){
villagerWinNum++;
}else{
werewolfWinNum++;
}
/*
System.out.println("print all role");
for(Agent agent:game.getGameData().getAgentList()){
Map<Agent, Role> map=game.getGameData().getGameInfo().getRoleMap();
System.out.println(agent+""+map.get(agent));
}
*/
}
System.out.println("ๆไบบๅดๅๅฉ:" + villagerWinNum + " ไบบ็ผๅดๅๅฉ๏ผ" + werewolfWinNum);
}
}
| [
"yblueycarlo1967@gmail.com"
] | yblueycarlo1967@gmail.com |
5312ff74ba8f5553de03af467e45f2be3012cc60 | c95aa158a145c5484ed0dd6dbb3293643ca313a7 | /src/main/java/com/gojek/beast/config/ProtoMappingConfig.java | 3040a1dc7f18f8431dc468c3960c5c87d4ab096d | [
"Apache-2.0"
] | permissive | kevinbheda/beast | 5e3fec9b41902d24acce6c6a7b03a87899475f0b | 761413cc4a20db881648d936fc62a1a820003e06 | refs/heads/master | 2021-01-02T05:32:10.309648 | 2020-02-10T12:56:12 | 2020-02-10T12:56:12 | 239,511,065 | 0 | 0 | Apache-2.0 | 2020-02-10T12:52:12 | 2020-02-10T12:52:11 | null | UTF-8 | Java | false | false | 365 | java | package com.gojek.beast.config;
import org.aeonbits.owner.Mutable;
public interface ProtoMappingConfig extends Mutable {
@Key("PROTO_COLUMN_MAPPING")
@ConverterClass(ProtoIndexToFieldMapConverter.class)
ColumnMapping getProtoColumnMapping();
@DefaultValue("false")
@Key("ENABLE_AUTO_SCHEMA_UPDATE")
Boolean isAutoSchemaUpdateEnabled();
}
| [
"maulik.soneji@go-jek.com"
] | maulik.soneji@go-jek.com |
7dd28a22f6f66172742967c9d1959b44fde9b38d | bf117a44c34f4341b41e43e4e11752a9332008f1 | /src/Adapter/Adaptee.java | f93b85017abc279d3b5fb364ad1aa8fa112efbb8 | [] | no_license | coder-zhw/DesignPattern | c0e4cace55ce545e3d6da8335f1e26d11bca781a | f1c174aa5773786e3488b05c80609cc49f31c900 | refs/heads/master | 2016-09-12T23:51:53.815437 | 2016-05-14T13:33:48 | 2016-05-14T13:33:48 | 59,119,817 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 242 | java | package Adapter;
/**
* ๅฎไนไธไธชๅทฒ็ปๅญๅจ็ๆฅๅฃ๏ผ่ฟไธชๆฅๅฃ้่ฆ้้
ใ
* @author Administrator
*
*/
public class Adaptee {
public void adapteeMethod() {
System.out.println("Adaptee method!");
}
}
| [
"coder.zhw@qq.com"
] | coder.zhw@qq.com |
8c12cb0abcae237265d0516167d85c2f5c1a2855 | 11622501f403df318ad5436cbda22b3454ca2358 | /tusharroy/src/main/java/com/interview/tusharroy/tree/ConstructFullTreeFromPreOrderPostOrder.java | 5e3587092f44cd84d75822a97177cee744812ec2 | [] | no_license | aanush/copy-of-mission-peace | fe13d6bcfb84c1657e15e578643eb93945a5a047 | 4da7e551bea04b7335cece08f73f598bf579b438 | refs/heads/master | 2020-03-14T14:02:48.514727 | 2018-04-30T21:00:25 | 2018-04-30T21:00:25 | 131,645,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | package com.interview.tusharroy.tree;
/**
* http://www.geeksforgeeks.org/full-and-complete-binary-tree-from-given-preorder-and-postorder-traversals/
* Full tree is a tree with all nodes with either 0 or 2 child. Never has 1 child.
* Test cases
* Empty tree
* Tree with big on left side
* Tree with big on right side
*/
public class ConstructFullTreeFromPreOrderPostOrder {
public static void main(String args[]) {
ConstructFullTreeFromPreOrderPostOrder cft = new ConstructFullTreeFromPreOrderPostOrder();
int preorder[] = {1, 2, 3, 6, 7, 8, 9};
int postorder[] = {2, 6, 8, 9, 7, 3, 1};
Node root = cft.constructTree(preorder, postorder);
TreeTraversals tt = new TreeTraversals();
tt.inOrder(root);
tt.preOrder(root);
tt.postOrder(root);
}
public Node constructTree(int preorder[], int postorder[]) {
return constructTree(preorder, postorder, 0, postorder.length - 2, 0);
}
private Node constructTree(int preorder[], int postorder[], int low, int high, int index) {
if (low > high || index >= preorder.length - 1) {
Node node = new Node();
node.data = preorder[index];
return node;
}
Node node = new Node();
node.data = preorder[index];
int i = 0;
for (i = low; i <= high; i++) {
if (preorder[index + 1] == postorder[i]) {
break;
}
}
node.left = constructTree(preorder, postorder, low, i - 1, index + 1);
node.right = constructTree(preorder, postorder, i + 1, high - 1, index + i - low + 2);
return node;
}
}
| [
"anish.anushang@outlook.com"
] | anish.anushang@outlook.com |
a377469cd8307b650ec8ebe13bae3708e98109ea | 356bbc61656ba529901766cd6b1696c281ab6938 | /jpl/src/ch14/ex06/ShowMessage.java | 760fb42e43a7a90dd17cadf7502f3c2bf25ca155 | [] | no_license | TakatoMatsumoto/java-training | 79b00356975b061625ca2d55fa4fe44a34717138 | 8a228f429fbd293b1909e74fe7b33e2023a27664 | refs/heads/master | 2020-07-02T02:43:02.020092 | 2020-01-16T15:46:05 | 2020-01-16T15:46:05 | 201,390,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | /*
* ็ทด็ฟๅ้ก14.6 p.311
* 15็ง้้ใงใกใใปใผใธใ่กจ็คบใใๅฅใฎในใฌใใใๆใกใๅฎ่ก้ๅงใใใฎ็ต้ๆ้ใ่กจ็คบใใใใญใฐใฉใ ใไฝๆใใชใใใ
* ใกใใปใผใธ่กจ็คบในใฌใใใฏใๆ้่กจ็คบในใฌใใใใ1็ง็ต้ใใๆฏใซ้็ฅใใใใใใซใใชใใใ
* ๆ้่กจ็คบในใฌใใใไฟฎๆญฃใใใใจใชใใ7็ง้้ใง็ฐใชใใกใใปใผใธใ่กจ็คบใใๅฅใฎในใฌใใใ่ฟฝๅ ใใชใใใ
*/
package ch14.ex06;
import java.util.Date;
public class ShowMessage implements Runnable
{
String message;
long messageInterval;
long showedTime = 0;
ShowTime showTimeObj;
public ShowMessage(ShowTime obj, long messageInterval, String message)
{
this.showTimeObj = obj;
this.messageInterval = messageInterval;
this.message = message;
showedTime = new Date().getTime();
}
public void run()
{
while (true)
{
try
{
showedTime = showTimeObj.showMessage(messageInterval, message, showedTime);
}
catch (Exception e)
{
System.out.println(e);
}
}
}
}
| [
"takato.matsumoto0114@gmail.com"
] | takato.matsumoto0114@gmail.com |
72cdcd688d5b1eb9b94966711ce9a3536093c81a | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/kylin/learning/4993/ContentReader.java | 0a372ac2d0d126a71d1245f758d14cdb5ac34bb4 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,644 | 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.kylin.common.persistence;
import java.io.DataInputStream;
import java.io.IOException;
import org.apache.commons.io.IOUtils;
public class ContentReader<T extends RootPersistentEntity> {
final private Serializer<T> serializer;
public ContentReader(Serializer<T> serializer) {
this.serializer = serializer;
}
public T readContent(RawResource res) throws IOException {
if (res == null)
return null;
DataInputStream din = new DataInputStream(res.content());
try {
T r = serializer.deserialize(din);
if (r != null) {
r.setLastModified(res.lastModified());
}
return r; } finally {
IOUtils.closeQuietly(din);
IOUtils.closeQuietly(res.content());
}
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
b45b990c2c18f5912997416d82ba706c2098477b | 490e2dfba14f8ee1fef5f6f9f87b29bd1cf947c8 | /aliyun-java-sdk-rds/src/main/java/com/aliyuncs/rds/model/v20140815/DescribeSQLDiagnosisListResponse.java | 69cb578bb5218ae66d6d56cf2aabd618f1620b9c | [
"Apache-2.0"
] | permissive | qiuxiaolan/aliyun-openapi-java-sdk | 256af327f2109bb81112c5bf65ef6512a783f541 | 06b689398fcc04f59f2ace574b029d8b309db8a4 | refs/heads/master | 2021-07-01T18:53:44.077695 | 2017-09-22T15:35:30 | 2017-09-22T15:35:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,597 | 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 com.aliyuncs.rds.model.v20140815;
import java.util.List;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.rds.transform.v20140815.DescribeSQLDiagnosisListResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class DescribeSQLDiagnosisListResponse extends AcsResponse {
private String requestId;
private List<SQLDiag> sQLDiagList;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public List<SQLDiag> getSQLDiagList() {
return this.sQLDiagList;
}
public void setSQLDiagList(List<SQLDiag> sQLDiagList) {
this.sQLDiagList = sQLDiagList;
}
public static class SQLDiag {
private String sQLDiagId;
private String startTime;
private String endTime;
private Integer status;
private Integer progress;
public String getSQLDiagId() {
return this.sQLDiagId;
}
public void setSQLDiagId(String sQLDiagId) {
this.sQLDiagId = sQLDiagId;
}
public String getStartTime() {
return this.startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return this.endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getProgress() {
return this.progress;
}
public void setProgress(Integer progress) {
this.progress = progress;
}
}
@Override
public DescribeSQLDiagnosisListResponse getInstance(UnmarshallerContext context) {
return DescribeSQLDiagnosisListResponseUnmarshaller.unmarshall(this, context);
}
}
| [
"ling.wu@alibaba-inc.com"
] | ling.wu@alibaba-inc.com |
c7713fedeb27366118b887262aa5a4c3d85894bc | 62b0062cbe8d317a06b4f64ac03d0aa5c56589db | /src/main/java/com/sannsyn/dca/vaadin/widgets/operations/controller/component/aggregates/form/view/DCAAggregateInfoComponent.java | 385b59cdd4e3de1dbf6217325c88444d74bb4aba | [] | no_license | mashiuruab/dca | c0812aa65a285640d6957d359a4a577215934137 | b41237c998aa19c9799fa0b9ae402165637ba6c5 | refs/heads/master | 2020-04-17T02:23:17.764054 | 2019-01-17T00:14:14 | 2019-01-17T00:14:14 | 166,131,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,616 | java | package com.sannsyn.dca.vaadin.widgets.operations.controller.component.aggregates.form.view;
import com.sannsyn.dca.vaadin.component.custom.field.DCAError;
import com.sannsyn.dca.vaadin.component.custom.field.DCALabel;
import com.sannsyn.dca.vaadin.widgets.operations.controller.model.aggregates.info.DCAAggregateInfo;
import com.vaadin.ui.CssLayout;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
/**
* Created by mashiur on 4/29/16.
*/
public class DCAAggregateInfoComponent extends DCAAggregateViewComponent {
private static final Logger logger = LoggerFactory.getLogger(DCAAggregateInfoComponent.class);
public DCAAggregateInfoComponent() {
this.setStyleName("aggregate-info-container");
}
public void onNext(DCAAggregateInfo dcaAggregateInfo) {
try {
String updates = String.format("%s/%s", dcaAggregateInfo.getUpdatesDone().isEmpty() ? "0" : dcaAggregateInfo.getUpdatesDone(),
dcaAggregateInfo.getUpdatesSubmitted().isEmpty() ? "0" : dcaAggregateInfo.getUpdatesSubmitted());
String memoryConsumed = dcaAggregateInfo.getMemoryConsumed().isEmpty() ? "0" : dcaAggregateInfo.getMemoryConsumed();
CssLayout aggregateInfoUpdates = new CssLayout();
aggregateInfoUpdates.setStyleName("aggregate-info");
aggregateInfoUpdates.addComponent(new DCALabel("<span>Aggregate Info</span>", "header dca-widget-title"));
aggregateInfoUpdates.addComponent(createViewItem("item-row", "Updates: ", updates));
long consumedMemoryInByte = Long.parseLong(memoryConsumed);
String memorySize = readableFileSize(consumedMemoryInByte);
aggregateInfoUpdates.addComponent(createViewItem("item-row", "Memory consumed: ", memorySize));
addComponentAsLast(aggregateInfoUpdates, this);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private static String readableFileSize(long size) {
if(size <= 0) return "0";
final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" };
int digitGroups = (int) (Math.log10(size)/Math.log10(1024));
return new DecimalFormat("#,##0.#").format(size/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
}
public void onError(Throwable throwable) {
throwable.printStackTrace();
logger.error("Error : ", throwable.getMessage());
addComponentAsLast(new DCAError("Error Happened While fetching Aggregate Info"), this);
}
}
| [
"mashiur2005@gmail.com"
] | mashiur2005@gmail.com |
9a5a8cb86d09d1af95f73aa6d78e927be76ae4f4 | 0f61286b0c13447b3a76c24c0d8818521fd97f8b | /src/Proy.java | aac88391f2fcad0f685a9f625e43890322a97f0d | [] | no_license | ADOCR/ProyectoProgra2017 | 4b159b1b04ddf2dd44b1d9730f75f89a5716fd3a | 03bef3d06e7d8d8e6c739b4cd2e63fd1fb83967b | refs/heads/master | 2021-08-29T21:15:35.402970 | 2017-11-16T02:32:09 | 2017-11-16T02:32:09 | 110,737,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,762 | java | public class Proy{
Nodo primero;
Nodo segundo;
Nodo tercero;
Nodo cuarto;
Nodo quinto;
Nodo sexto;
public Proy(){
primero=null;
}
public void insertar(int f, int c, char ficha ){//crea nuevo nodo en memo y ubiva en 1 posision de lista
Nodo nuevo =new Nodo(f, c, ficha );
nuevo.sig=primero;
primero=nuevo;
}
public void crearsig(int f, int c, char ficha ){//crea nuevo nodo en memo y ubiva en 1 posision de lista
Nodo nuevo =new Nodo(f, c, ficha );
Nodo aux = primero;
if (primero==null) {
insertar(f, c, ficha );
}else {
while(true){
if (aux.sig==null) {
aux.sig=nuevo;
break;
}
aux=aux.sig;
}
}
}
public void imprimirLista(){// todo esta en una lista rectas enlasada imprme cuando solo el ultimo esta en null
Nodo aux= primero;
int i=2 ;
while (aux!=null) {
if(aux.getColumna()!=8){
if (aux.getFila()==i && aux.getColumna()==1) {
i++;
System.out.println(" ");
}
aux.mostrar();
}
aux=aux.sig;
}
System.out.println("Fin de lista");
}
/**
*Metodo de crear nodos con parametros i,j para identificarlos
*
*/
public void crearnodo7(){
int i=1;
int j=1;
while(i!=6){
while (j!=8) {//crea 7 nodos [1,x<8] en columna
crearsig(i,j,' ');
j++;
}
i++;
j=1;
while (j!=8) {//crea 7 nodos [i<7,j<8] en fila aumenta
crearsig(i,j,' ');
j++;
}
}
}
/**
*metodo que la lista enlasada simple que creamos la enlazamos en matriz a mano
*/
public void separar(){
Nodo aux= primero;
int i=1 ;
while (aux!=null) {
if(aux.getColumna()==7){
if (aux.getFila()==1) {
segundo=aux.sig;//separo
primero.abaj=segundo;//1col
primero.sig.abaj=segundo.sig;//2col
primero.sig.sig.abaj=segundo.sig.sig;//3col
primero.sig.sig.sig.abaj=segundo.sig.sig.sig;//4col
primero.sig.sig.sig.sig.abaj=segundo.sig.sig.sig.sig;//5col
primero.sig.sig.sig.sig.sig.abaj=segundo.sig.sig.sig.sig.sig;//6col
primero.sig.sig.sig.sig.sig.sig.abaj=segundo.sig.sig.sig.sig.sig.sig;//7col
i++;
}else if (aux.getFila()==2) {
tercero=aux.sig;//enlaso 3
segundo.abaj=tercero;//1col
segundo.sig.abaj=tercero.sig;//2col
segundo.sig.sig.abaj=tercero.sig.sig;//3col
segundo.sig.sig.sig.abaj=tercero.sig.sig.sig;//4col
segundo.sig.sig.sig.sig.abaj=tercero.sig.sig.sig.sig;//5col
segundo.sig.sig.sig.sig.sig.abaj=tercero.sig.sig.sig.sig.sig;//6col
segundo.sig.sig.sig.sig.sig.sig.abaj=tercero.sig.sig.sig.sig.sig.sig;//7col
i++;
}else if (aux.getFila()==3) {
cuarto=aux.sig;//separo
tercero.abaj=cuarto;//1col
tercero.sig.abaj=cuarto.sig;//2col
tercero.sig.sig.abaj=cuarto.sig.sig;//3col
tercero.sig.sig.sig.abaj=cuarto.sig.sig.sig;//4col
tercero.sig.sig.sig.sig.abaj=cuarto.sig.sig.sig.sig;//5col
tercero.sig.sig.sig.sig.sig.abaj=cuarto.sig.sig.sig.sig.sig;//6col
tercero.sig.sig.sig.sig.sig.sig.abaj=cuarto.sig.sig.sig.sig.sig.sig;//7col
i++;
}else if (aux.getFila()==4) {
quinto=aux.sig;//separo
cuarto.abaj=quinto;//1col
cuarto.sig.abaj=quinto.sig;//2col
cuarto.sig.sig.abaj=quinto.sig.sig;//3col
cuarto.sig.sig.sig.abaj=quinto.sig.sig.sig;//4col
cuarto.sig.sig.sig.sig.abaj=quinto.sig.sig.sig.sig;//5colh
cuarto.sig.sig.sig.sig.sig.abaj=quinto.sig.sig.sig.sig.sig;//6colh
cuarto.sig.sig.sig.sig.sig.sig.abaj=quinto.sig.sig.sig.sig.sig.sig;//7colh
i++;
}else if(aux.getFila()==5) {
sexto=aux.sig;//separa
quinto.abaj=sexto;//1 col
quinto.sig.abaj=sexto.sig;//2col
quinto.sig.sig.abaj=sexto.sig.sig;//3col
quinto.sig.sig.sig.abaj=sexto.sig.sig.sig;//4col
quinto.sig.sig.sig.sig.abaj=sexto.sig.sig.sig.sig;//5col
quinto.sig.sig.sig.sig.sig.abaj=sexto.sig.sig.sig.sig.sig;//6col
quinto.sig.sig.sig.sig.sig.sig.abaj=sexto.sig.sig.sig.sig.sig.sig;//7col
i++;
}else if(aux.getFila()==6){
sexto.abaj=null;//1col
sexto.sig.abaj=null;//2 col
sexto.sig.sig.abaj=null;//3col
sexto.sig.sig.sig.abaj=null;//4col
sexto.sig.sig.sig.sig.abaj=null;//5col
sexto.sig.sig.sig.sig.sig.abaj=null;//6col
sexto.sig.sig.sig.sig.sig.sig.abaj=null;//7col
i++;
}
}
aux=aux.sig;
}
primero.sig.sig.sig.sig.sig.sig.sig=null;
segundo.sig.sig.sig.sig.sig.sig.sig=null;
tercero.sig.sig.sig.sig.sig.sig.sig=null;
cuarto.sig.sig.sig.sig.sig.sig.sig=null;
quinto.sig.sig.sig.sig.sig.sig.sig=null;
}
public void imprimirEspesifico(){// todo esta en una lista rectas enlasada primero segun tercer....
Nodo aux= sexto;
int i=2 ;
while (aux!=null) {
aux.mostrar();
aux=aux.sig;
}
}
public void imprimir1columna(){// primera colum hacia abajo
Nodo aux= primero.sig.sig.sig.sig.sig.sig;
int i=2 ;
while (aux!=null) {
aux.mostrar();
aux=aux.abaj;
}
}
public void agregarF(int col, char ficha){
Nodo aux= primero;
while (aux!=null) {
if (aux.getColumna()==col) {// se ubica en la columna
Nodo aux1 =aux;
while (aux1!=null) {// recorre hacia abajo
if (aux1.getFila()==1&&aux1.getFicha()!=' ') {// poner otra condicion que deje repetir otra ficga
System.out.println(" se lleno elija otra comul ");
agregarF(1, 'A');
return;
}else if (aux1.abaj==null && aux1.getFicha()==' ') {
aux1.setFicha(ficha);
return;
}else if (aux1.getFicha()==' '&& aux1.abaj.getFicha()!=' ' ) {
aux1.setFicha(ficha);
return;
}
aux1=aux1.abaj;
}
}
aux=aux.sig;
}
}
public void imprimirbien(){
Nodo aux=primero;
Nodo aux1=aux;
int i=2 ;
while (aux1!=null) {
while (aux!=null) {
aux.mostrar();
aux=aux.sig;
}
System.out.println(" ");
aux1=aux1.abaj;
aux=aux1;
}
}
public static void main(String[] args) {
Proy objeto = new Proy();
objeto.crearnodo7();
objeto.separar();
// objeto.imprimirLista(); esta ya no sirbe porque apunta anull
//objeto.imprimirbien(); imptime bien depues de referenciar a null
objeto.imprimirbien();
objeto.agregarF(2, 'A');
objeto.agregarF(2, 'A');
objeto.agregarF(2, 'A');
objeto.agregarF(2, 'A');
objeto.agregarF(2, 'A');
objeto.agregarF(2, 'A');
objeto.agregarF(2, 'R');
//objeto.agregarF(2, 'P');
//objeto.agregarF(7, 'R');
System.out.println(" imprimirbien");
objeto.imprimirbien();
System.out.println(" ");
}
}
| [
"adonis@adonis-Inspiron-3442"
] | adonis@adonis-Inspiron-3442 |
d5ee34a9db90d7734e57890d2f6c5c6535fff10e | 3d702b49025b97efa3fbd7bbaa348aeba278fb84 | /2desemzeppp/src/connectionTest/computer.java | b93d5714b95f84754a52497cdb654ce3fe548dd8 | [] | no_license | WoutV/Indigo | 4fbb1a74a7f8cf5a4ba6e881ec5ccc70ccee3640 | dacd58330b2dfc38d03041d9ff198bbefa8fa457 | refs/heads/master | 2021-03-19T06:38:56.927761 | 2014-05-14T08:02:38 | 2014-05-14T08:02:38 | 13,383,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,990 | java | package connectionTest;
import gui.GuiMain;
import org.opencv.core.Core;
import map.Map;
import navigation.Dispatch;
import connection.ReceiverClient;
import connection.SenderClient;
public class computer {
public static void main(String[] args){
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
String fileName = "/field.csv";
Map map = new Map(fileName);
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GuiMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GuiMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GuiMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GuiMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
GuiMain gui = new GuiMain();
gui.setVisible(true);
gui.enableAllButtons();
gui.setMap(fileName);
gui.setOwnLocation(200, 200);
SenderClient sender = new SenderClient("localhost",5673);
ReceiverClient receiver = new ReceiverClient(gui,"localhost",5673);
Thread receiverclientthread = new Thread(receiver);
receiverclientthread.start();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sender.sendTransfer("Pi go up", "test.test");
}
}
| [
"sunil_tandan@hotmail.com"
] | sunil_tandan@hotmail.com |
5e1992d92eb45fe87362fc805120fe66ba4e33c5 | 6a167c502daebecfd0a1395b4e556000052c222f | /gwt28-ol3-wrapper/src/main/java/ol/source/Xyz.java | 470066f1b1535e76fed1f314942eb05000369c39 | [
"Apache-2.0"
] | permissive | danmoldo/OpenLayers3GWT2.8Wrapper | 3a7dd55d72160e5f0d2168808806ced00b363128 | 1dccb216ca4c2254b960d98b4c1d68a44123b395 | refs/heads/master | 2021-01-10T12:48:28.677361 | 2018-06-11T10:58:42 | 2018-06-11T10:58:42 | 47,361,722 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package ol.source;
import jsinterop.annotations.JsType;
/**
* @author Dan Moldovan
*/
@JsType(isNative = true)
public interface Xyz extends TileImage {
void setUrl(String url);
}
| [
"RO100073@LUT-DKZMZ52.main.intgin.net"
] | RO100073@LUT-DKZMZ52.main.intgin.net |
7d56ec50b1ed7e7d68d6245f99681e557ff3e979 | 15dcc37c0196f9d07f8516bc011f588e2f2fb4e3 | /4_Android_program/Hello/src/tusion/hello/HelloActivity.java | 22100bd03b154319375ce26f4d41ae793b019c0d | [] | no_license | FreyrChen/tucan_Linux_practice | 91e9b695c7314bcd63b7fdff81b7ee4ef79521e3 | 833f793372f33bc78b18b2186d9041aa98a53ad6 | refs/heads/master | 2021-05-29T18:27:27.431116 | 2014-08-13T10:00:50 | 2014-08-13T10:00:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package tusion.hello;
import android.app.Activity;
import android.os.Bundle;
public class HelloActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
} | [
"tusion@163.com"
] | tusion@163.com |
c3ac6f1b83f7144b46abf23fa0a28b258e0fbe7f | 0ead616bd4fa12f0d8ed7dd49a746951ff0c23df | /test/endterm/UDP/entermUDPClient.java | 2920860cb07d754ecf545a56bc02b619cd8591e9 | [] | no_license | v4nkzz2911/Network_Programing_2021 | 225f54b19508ea16c24f747305c2f99e79ee4709 | 1af0fea81aa20f01e1e818ff460ae548b85264d6 | refs/heads/master | 2023-07-03T01:06:07.526926 | 2021-08-08T11:36:14 | 2021-08-08T11:36:14 | 340,866,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,507 | 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 endterm.UDP;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Scanner;
/**
*
* @author er1nzz
*/
public class entermUDPClient {
public static void main(String[] args) throws SocketException, UnknownHostException, IOException {
DatagramSocket client = new DatagramSocket();
InetAddress IP = InetAddress.getLocalHost();
byte[] buffer = new byte[1024];
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("Chแป sแป ฤiแปn tiรชu thแปฅ: ");
int sd = sc.nextInt();
buffer = new byte[1024];
buffer = ("Chแป sแป ฤiแปn tiรชu thแปฅ:"+sd).getBytes();
DatagramPacket consumPacket = new DatagramPacket(buffer, buffer.length, IP,10);
client.send(consumPacket);
buffer = new byte[1024];
DatagramPacket pricePacket = new DatagramPacket(buffer, buffer.length);
client.receive(pricePacket);
System.out.println("Hoรก ฤฦกn cแปงa bแบกn: "+new String(pricePacket.getData(),0,pricePacket.getLength()));
}
}
}
| [
"vietanhtm@gmail.com"
] | vietanhtm@gmail.com |
a361c4af3c5a6e278e2a51be34b3872d708110b0 | 2e481dde80e511d297778159de1b312f94a1ac6b | /src/dynamite/datalog/parser/DatalogParser.java | 5bb92a1523d37169bc34ddb3b9e50afb7a342536 | [] | no_license | utopia-group/dynamite | a2632cac6594f609d043b5af4aa41e4f641eaa6b | 04e15ceb5e96516d8e78ef443a316192726c51c5 | refs/heads/master | 2022-12-19T08:48:10.075476 | 2020-09-19T05:35:16 | 2020-09-19T05:35:16 | 296,793,744 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,731 | java | // Generated from scripts/Datalog.g4 by ANTLR 4.7.1
package dynamite.datalog.parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class DatalogParser extends Parser {
static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
WS=1, INPUT=2, OUTPUT=3, RELATION=4, TYPE=5, CAT=6, COMMA=7, PERIOD=8,
Q_MARK=9, LEFT_PAREN=10, RIGHT_PAREN=11, COLON=12, COLON_DASH=13, MULTIPLY=14,
ADD=15, EQ=16, NE=17, LT=18, LE=19, GT=20, GE=21, INT=22, STRING=23, ID=24;
public static final int
RULE_program = 0, RULE_decls = 1, RULE_decl = 2, RULE_inputDecl = 3, RULE_outputDecl = 4,
RULE_paramMap = 5, RULE_entry = 6, RULE_relationDecl = 7, RULE_attrs = 8,
RULE_attr = 9, RULE_typeDecl = 10, RULE_rules = 11, RULE_datalogRule = 12,
RULE_heads = 13, RULE_relPred = 14, RULE_expList = 15, RULE_exp = 16,
RULE_cat = 17, RULE_bodies = 18, RULE_datalogPred = 19, RULE_biPred = 20,
RULE_op = 21, RULE_facts = 22, RULE_fact = 23;
public static final String[] ruleNames = {
"program", "decls", "decl", "inputDecl", "outputDecl", "paramMap", "entry",
"relationDecl", "attrs", "attr", "typeDecl", "rules", "datalogRule", "heads",
"relPred", "expList", "exp", "cat", "bodies", "datalogPred", "biPred",
"op", "facts", "fact"
};
private static final String[] _LITERAL_NAMES = {
null, null, "'.input'", "'.output'", "'.decl'", "'.type'", "'cat'", "','",
"'.'", "'?'", "'('", "')'", "':'", "':-'", "'*'", "'+'", "'='", "'!='",
"'<'", "'<='", "'>'", "'>='"
};
private static final String[] _SYMBOLIC_NAMES = {
null, "WS", "INPUT", "OUTPUT", "RELATION", "TYPE", "CAT", "COMMA", "PERIOD",
"Q_MARK", "LEFT_PAREN", "RIGHT_PAREN", "COLON", "COLON_DASH", "MULTIPLY",
"ADD", "EQ", "NE", "LT", "LE", "GT", "GE", "INT", "STRING", "ID"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "Datalog.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public DatalogParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class ProgramContext extends ParserRuleContext {
public DeclsContext decls() {
return getRuleContext(DeclsContext.class,0);
}
public RulesContext rules() {
return getRuleContext(RulesContext.class,0);
}
public FactsContext facts() {
return getRuleContext(FactsContext.class,0);
}
public ProgramContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_program; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitProgram(this);
else return visitor.visitChildren(this);
}
}
public final ProgramContext program() throws RecognitionException {
ProgramContext _localctx = new ProgramContext(_ctx, getState());
enterRule(_localctx, 0, RULE_program);
try {
enterOuterAlt(_localctx, 1);
{
setState(48);
decls();
setState(49);
rules();
setState(50);
facts();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DeclsContext extends ParserRuleContext {
public List<DeclContext> decl() {
return getRuleContexts(DeclContext.class);
}
public DeclContext decl(int i) {
return getRuleContext(DeclContext.class,i);
}
public DeclsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_decls; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitDecls(this);
else return visitor.visitChildren(this);
}
}
public final DeclsContext decls() throws RecognitionException {
DeclsContext _localctx = new DeclsContext(_ctx, getState());
enterRule(_localctx, 2, RULE_decls);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(55);
_errHandler.sync(this);
_la = _input.LA(1);
while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INPUT) | (1L << OUTPUT) | (1L << RELATION) | (1L << TYPE))) != 0)) {
{
{
setState(52);
decl();
}
}
setState(57);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DeclContext extends ParserRuleContext {
public InputDeclContext inputDecl() {
return getRuleContext(InputDeclContext.class,0);
}
public OutputDeclContext outputDecl() {
return getRuleContext(OutputDeclContext.class,0);
}
public RelationDeclContext relationDecl() {
return getRuleContext(RelationDeclContext.class,0);
}
public TypeDeclContext typeDecl() {
return getRuleContext(TypeDeclContext.class,0);
}
public DeclContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_decl; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitDecl(this);
else return visitor.visitChildren(this);
}
}
public final DeclContext decl() throws RecognitionException {
DeclContext _localctx = new DeclContext(_ctx, getState());
enterRule(_localctx, 4, RULE_decl);
try {
setState(62);
_errHandler.sync(this);
switch (_input.LA(1)) {
case INPUT:
enterOuterAlt(_localctx, 1);
{
setState(58);
inputDecl();
}
break;
case OUTPUT:
enterOuterAlt(_localctx, 2);
{
setState(59);
outputDecl();
}
break;
case RELATION:
enterOuterAlt(_localctx, 3);
{
setState(60);
relationDecl();
}
break;
case TYPE:
enterOuterAlt(_localctx, 4);
{
setState(61);
typeDecl();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class InputDeclContext extends ParserRuleContext {
public TerminalNode INPUT() { return getToken(DatalogParser.INPUT, 0); }
public TerminalNode ID() { return getToken(DatalogParser.ID, 0); }
public ParamMapContext paramMap() {
return getRuleContext(ParamMapContext.class,0);
}
public InputDeclContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_inputDecl; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitInputDecl(this);
else return visitor.visitChildren(this);
}
}
public final InputDeclContext inputDecl() throws RecognitionException {
InputDeclContext _localctx = new InputDeclContext(_ctx, getState());
enterRule(_localctx, 6, RULE_inputDecl);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(64);
match(INPUT);
setState(65);
match(ID);
setState(67);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==LEFT_PAREN) {
{
setState(66);
paramMap();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class OutputDeclContext extends ParserRuleContext {
public TerminalNode OUTPUT() { return getToken(DatalogParser.OUTPUT, 0); }
public TerminalNode ID() { return getToken(DatalogParser.ID, 0); }
public ParamMapContext paramMap() {
return getRuleContext(ParamMapContext.class,0);
}
public OutputDeclContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_outputDecl; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitOutputDecl(this);
else return visitor.visitChildren(this);
}
}
public final OutputDeclContext outputDecl() throws RecognitionException {
OutputDeclContext _localctx = new OutputDeclContext(_ctx, getState());
enterRule(_localctx, 8, RULE_outputDecl);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(69);
match(OUTPUT);
setState(70);
match(ID);
setState(72);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==LEFT_PAREN) {
{
setState(71);
paramMap();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ParamMapContext extends ParserRuleContext {
public TerminalNode LEFT_PAREN() { return getToken(DatalogParser.LEFT_PAREN, 0); }
public List<EntryContext> entry() {
return getRuleContexts(EntryContext.class);
}
public EntryContext entry(int i) {
return getRuleContext(EntryContext.class,i);
}
public TerminalNode RIGHT_PAREN() { return getToken(DatalogParser.RIGHT_PAREN, 0); }
public List<TerminalNode> COMMA() { return getTokens(DatalogParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(DatalogParser.COMMA, i);
}
public ParamMapContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_paramMap; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitParamMap(this);
else return visitor.visitChildren(this);
}
}
public final ParamMapContext paramMap() throws RecognitionException {
ParamMapContext _localctx = new ParamMapContext(_ctx, getState());
enterRule(_localctx, 10, RULE_paramMap);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(74);
match(LEFT_PAREN);
setState(75);
entry();
setState(80);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(76);
match(COMMA);
setState(77);
entry();
}
}
setState(82);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(83);
match(RIGHT_PAREN);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class EntryContext extends ParserRuleContext {
public List<TerminalNode> ID() { return getTokens(DatalogParser.ID); }
public TerminalNode ID(int i) {
return getToken(DatalogParser.ID, i);
}
public TerminalNode EQ() { return getToken(DatalogParser.EQ, 0); }
public TerminalNode STRING() { return getToken(DatalogParser.STRING, 0); }
public EntryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_entry; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitEntry(this);
else return visitor.visitChildren(this);
}
}
public final EntryContext entry() throws RecognitionException {
EntryContext _localctx = new EntryContext(_ctx, getState());
enterRule(_localctx, 12, RULE_entry);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(85);
match(ID);
setState(86);
match(EQ);
setState(87);
_la = _input.LA(1);
if ( !(_la==STRING || _la==ID) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class RelationDeclContext extends ParserRuleContext {
public TerminalNode RELATION() { return getToken(DatalogParser.RELATION, 0); }
public TerminalNode ID() { return getToken(DatalogParser.ID, 0); }
public TerminalNode LEFT_PAREN() { return getToken(DatalogParser.LEFT_PAREN, 0); }
public AttrsContext attrs() {
return getRuleContext(AttrsContext.class,0);
}
public TerminalNode RIGHT_PAREN() { return getToken(DatalogParser.RIGHT_PAREN, 0); }
public RelationDeclContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relationDecl; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitRelationDecl(this);
else return visitor.visitChildren(this);
}
}
public final RelationDeclContext relationDecl() throws RecognitionException {
RelationDeclContext _localctx = new RelationDeclContext(_ctx, getState());
enterRule(_localctx, 14, RULE_relationDecl);
try {
enterOuterAlt(_localctx, 1);
{
setState(89);
match(RELATION);
setState(90);
match(ID);
setState(91);
match(LEFT_PAREN);
setState(92);
attrs();
setState(93);
match(RIGHT_PAREN);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AttrsContext extends ParserRuleContext {
public List<AttrContext> attr() {
return getRuleContexts(AttrContext.class);
}
public AttrContext attr(int i) {
return getRuleContext(AttrContext.class,i);
}
public List<TerminalNode> COMMA() { return getTokens(DatalogParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(DatalogParser.COMMA, i);
}
public AttrsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_attrs; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitAttrs(this);
else return visitor.visitChildren(this);
}
}
public final AttrsContext attrs() throws RecognitionException {
AttrsContext _localctx = new AttrsContext(_ctx, getState());
enterRule(_localctx, 16, RULE_attrs);
int _la;
try {
setState(104);
_errHandler.sync(this);
switch (_input.LA(1)) {
case ID:
enterOuterAlt(_localctx, 1);
{
setState(95);
attr();
setState(100);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(96);
match(COMMA);
setState(97);
attr();
}
}
setState(102);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
break;
case RIGHT_PAREN:
enterOuterAlt(_localctx, 2);
{
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AttrContext extends ParserRuleContext {
public List<TerminalNode> ID() { return getTokens(DatalogParser.ID); }
public TerminalNode ID(int i) {
return getToken(DatalogParser.ID, i);
}
public TerminalNode COLON() { return getToken(DatalogParser.COLON, 0); }
public AttrContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_attr; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitAttr(this);
else return visitor.visitChildren(this);
}
}
public final AttrContext attr() throws RecognitionException {
AttrContext _localctx = new AttrContext(_ctx, getState());
enterRule(_localctx, 18, RULE_attr);
try {
enterOuterAlt(_localctx, 1);
{
setState(106);
match(ID);
setState(107);
match(COLON);
setState(108);
match(ID);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class TypeDeclContext extends ParserRuleContext {
public TerminalNode TYPE() { return getToken(DatalogParser.TYPE, 0); }
public TerminalNode ID() { return getToken(DatalogParser.ID, 0); }
public TypeDeclContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_typeDecl; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitTypeDecl(this);
else return visitor.visitChildren(this);
}
}
public final TypeDeclContext typeDecl() throws RecognitionException {
TypeDeclContext _localctx = new TypeDeclContext(_ctx, getState());
enterRule(_localctx, 20, RULE_typeDecl);
try {
enterOuterAlt(_localctx, 1);
{
setState(110);
match(TYPE);
setState(111);
match(ID);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class RulesContext extends ParserRuleContext {
public List<DatalogRuleContext> datalogRule() {
return getRuleContexts(DatalogRuleContext.class);
}
public DatalogRuleContext datalogRule(int i) {
return getRuleContext(DatalogRuleContext.class,i);
}
public RulesContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_rules; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitRules(this);
else return visitor.visitChildren(this);
}
}
public final RulesContext rules() throws RecognitionException {
RulesContext _localctx = new RulesContext(_ctx, getState());
enterRule(_localctx, 22, RULE_rules);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(116);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
setState(113);
datalogRule();
}
}
}
setState(118);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DatalogRuleContext extends ParserRuleContext {
public HeadsContext heads() {
return getRuleContext(HeadsContext.class,0);
}
public TerminalNode COLON_DASH() { return getToken(DatalogParser.COLON_DASH, 0); }
public BodiesContext bodies() {
return getRuleContext(BodiesContext.class,0);
}
public TerminalNode PERIOD() { return getToken(DatalogParser.PERIOD, 0); }
public DatalogRuleContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_datalogRule; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitDatalogRule(this);
else return visitor.visitChildren(this);
}
}
public final DatalogRuleContext datalogRule() throws RecognitionException {
DatalogRuleContext _localctx = new DatalogRuleContext(_ctx, getState());
enterRule(_localctx, 24, RULE_datalogRule);
try {
enterOuterAlt(_localctx, 1);
{
setState(119);
heads();
setState(120);
match(COLON_DASH);
setState(121);
bodies();
setState(122);
match(PERIOD);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class HeadsContext extends ParserRuleContext {
public List<RelPredContext> relPred() {
return getRuleContexts(RelPredContext.class);
}
public RelPredContext relPred(int i) {
return getRuleContext(RelPredContext.class,i);
}
public List<TerminalNode> COMMA() { return getTokens(DatalogParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(DatalogParser.COMMA, i);
}
public HeadsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_heads; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitHeads(this);
else return visitor.visitChildren(this);
}
}
public final HeadsContext heads() throws RecognitionException {
HeadsContext _localctx = new HeadsContext(_ctx, getState());
enterRule(_localctx, 26, RULE_heads);
int _la;
try {
setState(133);
_errHandler.sync(this);
switch (_input.LA(1)) {
case ID:
enterOuterAlt(_localctx, 1);
{
setState(124);
relPred();
setState(129);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(125);
match(COMMA);
setState(126);
relPred();
}
}
setState(131);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
break;
case COLON_DASH:
enterOuterAlt(_localctx, 2);
{
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class RelPredContext extends ParserRuleContext {
public TerminalNode ID() { return getToken(DatalogParser.ID, 0); }
public TerminalNode LEFT_PAREN() { return getToken(DatalogParser.LEFT_PAREN, 0); }
public ExpListContext expList() {
return getRuleContext(ExpListContext.class,0);
}
public TerminalNode RIGHT_PAREN() { return getToken(DatalogParser.RIGHT_PAREN, 0); }
public RelPredContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relPred; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitRelPred(this);
else return visitor.visitChildren(this);
}
}
public final RelPredContext relPred() throws RecognitionException {
RelPredContext _localctx = new RelPredContext(_ctx, getState());
enterRule(_localctx, 28, RULE_relPred);
try {
enterOuterAlt(_localctx, 1);
{
setState(135);
match(ID);
setState(136);
match(LEFT_PAREN);
setState(137);
expList();
setState(138);
match(RIGHT_PAREN);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ExpListContext extends ParserRuleContext {
public List<ExpContext> exp() {
return getRuleContexts(ExpContext.class);
}
public ExpContext exp(int i) {
return getRuleContext(ExpContext.class,i);
}
public List<TerminalNode> COMMA() { return getTokens(DatalogParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(DatalogParser.COMMA, i);
}
public ExpListContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expList; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitExpList(this);
else return visitor.visitChildren(this);
}
}
public final ExpListContext expList() throws RecognitionException {
ExpListContext _localctx = new ExpListContext(_ctx, getState());
enterRule(_localctx, 30, RULE_expList);
int _la;
try {
setState(149);
_errHandler.sync(this);
switch (_input.LA(1)) {
case CAT:
case INT:
case STRING:
case ID:
enterOuterAlt(_localctx, 1);
{
setState(140);
exp();
setState(145);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(141);
match(COMMA);
setState(142);
exp();
}
}
setState(147);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
break;
case RIGHT_PAREN:
enterOuterAlt(_localctx, 2);
{
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ExpContext extends ParserRuleContext {
public CatContext cat() {
return getRuleContext(CatContext.class,0);
}
public TerminalNode ID() { return getToken(DatalogParser.ID, 0); }
public TerminalNode INT() { return getToken(DatalogParser.INT, 0); }
public TerminalNode STRING() { return getToken(DatalogParser.STRING, 0); }
public ExpContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_exp; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitExp(this);
else return visitor.visitChildren(this);
}
}
public final ExpContext exp() throws RecognitionException {
ExpContext _localctx = new ExpContext(_ctx, getState());
enterRule(_localctx, 32, RULE_exp);
try {
setState(155);
_errHandler.sync(this);
switch (_input.LA(1)) {
case CAT:
enterOuterAlt(_localctx, 1);
{
setState(151);
cat();
}
break;
case ID:
enterOuterAlt(_localctx, 2);
{
setState(152);
match(ID);
}
break;
case INT:
enterOuterAlt(_localctx, 3);
{
setState(153);
match(INT);
}
break;
case STRING:
enterOuterAlt(_localctx, 4);
{
setState(154);
match(STRING);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class CatContext extends ParserRuleContext {
public TerminalNode CAT() { return getToken(DatalogParser.CAT, 0); }
public TerminalNode LEFT_PAREN() { return getToken(DatalogParser.LEFT_PAREN, 0); }
public List<ExpContext> exp() {
return getRuleContexts(ExpContext.class);
}
public ExpContext exp(int i) {
return getRuleContext(ExpContext.class,i);
}
public TerminalNode COMMA() { return getToken(DatalogParser.COMMA, 0); }
public TerminalNode RIGHT_PAREN() { return getToken(DatalogParser.RIGHT_PAREN, 0); }
public CatContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_cat; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitCat(this);
else return visitor.visitChildren(this);
}
}
public final CatContext cat() throws RecognitionException {
CatContext _localctx = new CatContext(_ctx, getState());
enterRule(_localctx, 34, RULE_cat);
try {
enterOuterAlt(_localctx, 1);
{
setState(157);
match(CAT);
setState(158);
match(LEFT_PAREN);
setState(159);
exp();
setState(160);
match(COMMA);
setState(161);
exp();
setState(162);
match(RIGHT_PAREN);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class BodiesContext extends ParserRuleContext {
public List<DatalogPredContext> datalogPred() {
return getRuleContexts(DatalogPredContext.class);
}
public DatalogPredContext datalogPred(int i) {
return getRuleContext(DatalogPredContext.class,i);
}
public List<TerminalNode> COMMA() { return getTokens(DatalogParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(DatalogParser.COMMA, i);
}
public BodiesContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_bodies; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitBodies(this);
else return visitor.visitChildren(this);
}
}
public final BodiesContext bodies() throws RecognitionException {
BodiesContext _localctx = new BodiesContext(_ctx, getState());
enterRule(_localctx, 36, RULE_bodies);
int _la;
try {
setState(173);
_errHandler.sync(this);
switch (_input.LA(1)) {
case CAT:
case INT:
case STRING:
case ID:
enterOuterAlt(_localctx, 1);
{
setState(164);
datalogPred();
setState(169);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(165);
match(COMMA);
setState(166);
datalogPred();
}
}
setState(171);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
break;
case PERIOD:
enterOuterAlt(_localctx, 2);
{
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DatalogPredContext extends ParserRuleContext {
public BiPredContext biPred() {
return getRuleContext(BiPredContext.class,0);
}
public RelPredContext relPred() {
return getRuleContext(RelPredContext.class,0);
}
public DatalogPredContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_datalogPred; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitDatalogPred(this);
else return visitor.visitChildren(this);
}
}
public final DatalogPredContext datalogPred() throws RecognitionException {
DatalogPredContext _localctx = new DatalogPredContext(_ctx, getState());
enterRule(_localctx, 38, RULE_datalogPred);
try {
setState(177);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(175);
biPred();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(176);
relPred();
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class BiPredContext extends ParserRuleContext {
public List<ExpContext> exp() {
return getRuleContexts(ExpContext.class);
}
public ExpContext exp(int i) {
return getRuleContext(ExpContext.class,i);
}
public OpContext op() {
return getRuleContext(OpContext.class,0);
}
public BiPredContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_biPred; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitBiPred(this);
else return visitor.visitChildren(this);
}
}
public final BiPredContext biPred() throws RecognitionException {
BiPredContext _localctx = new BiPredContext(_ctx, getState());
enterRule(_localctx, 40, RULE_biPred);
try {
enterOuterAlt(_localctx, 1);
{
setState(179);
exp();
setState(180);
op();
setState(181);
exp();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class OpContext extends ParserRuleContext {
public TerminalNode EQ() { return getToken(DatalogParser.EQ, 0); }
public TerminalNode NE() { return getToken(DatalogParser.NE, 0); }
public TerminalNode LT() { return getToken(DatalogParser.LT, 0); }
public TerminalNode LE() { return getToken(DatalogParser.LE, 0); }
public TerminalNode GT() { return getToken(DatalogParser.GT, 0); }
public TerminalNode GE() { return getToken(DatalogParser.GE, 0); }
public OpContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_op; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitOp(this);
else return visitor.visitChildren(this);
}
}
public final OpContext op() throws RecognitionException {
OpContext _localctx = new OpContext(_ctx, getState());
enterRule(_localctx, 42, RULE_op);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(183);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << EQ) | (1L << NE) | (1L << LT) | (1L << LE) | (1L << GT) | (1L << GE))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class FactsContext extends ParserRuleContext {
public List<FactContext> fact() {
return getRuleContexts(FactContext.class);
}
public FactContext fact(int i) {
return getRuleContext(FactContext.class,i);
}
public FactsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_facts; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitFacts(this);
else return visitor.visitChildren(this);
}
}
public final FactsContext facts() throws RecognitionException {
FactsContext _localctx = new FactsContext(_ctx, getState());
enterRule(_localctx, 44, RULE_facts);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(188);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==ID) {
{
{
setState(185);
fact();
}
}
setState(190);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class FactContext extends ParserRuleContext {
public RelPredContext relPred() {
return getRuleContext(RelPredContext.class,0);
}
public TerminalNode PERIOD() { return getToken(DatalogParser.PERIOD, 0); }
public FactContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_fact; }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DatalogVisitor ) return ((DatalogVisitor<? extends T>)visitor).visitFact(this);
else return visitor.visitChildren(this);
}
}
public final FactContext fact() throws RecognitionException {
FactContext _localctx = new FactContext(_ctx, getState());
enterRule(_localctx, 46, RULE_fact);
try {
enterOuterAlt(_localctx, 1);
{
setState(191);
relPred();
setState(192);
match(PERIOD);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\32\u00c5\4\2\t\2"+
"\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\3\2\3\2\3\2\3\2\3\3\7\38\n\3\f\3\16\3;\13\3\3\4\3\4\3\4\3\4\5\4A\n\4"+
"\3\5\3\5\3\5\5\5F\n\5\3\6\3\6\3\6\5\6K\n\6\3\7\3\7\3\7\3\7\7\7Q\n\7\f"+
"\7\16\7T\13\7\3\7\3\7\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n"+
"\3\n\7\ne\n\n\f\n\16\nh\13\n\3\n\5\nk\n\n\3\13\3\13\3\13\3\13\3\f\3\f"+
"\3\f\3\r\7\ru\n\r\f\r\16\rx\13\r\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3"+
"\17\7\17\u0082\n\17\f\17\16\17\u0085\13\17\3\17\5\17\u0088\n\17\3\20\3"+
"\20\3\20\3\20\3\20\3\21\3\21\3\21\7\21\u0092\n\21\f\21\16\21\u0095\13"+
"\21\3\21\5\21\u0098\n\21\3\22\3\22\3\22\3\22\5\22\u009e\n\22\3\23\3\23"+
"\3\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\7\24\u00aa\n\24\f\24\16\24\u00ad"+
"\13\24\3\24\5\24\u00b0\n\24\3\25\3\25\5\25\u00b4\n\25\3\26\3\26\3\26\3"+
"\26\3\27\3\27\3\30\7\30\u00bd\n\30\f\30\16\30\u00c0\13\30\3\31\3\31\3"+
"\31\3\31\2\2\32\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\2\4"+
"\3\2\31\32\3\2\22\27\2\u00c1\2\62\3\2\2\2\49\3\2\2\2\6@\3\2\2\2\bB\3\2"+
"\2\2\nG\3\2\2\2\fL\3\2\2\2\16W\3\2\2\2\20[\3\2\2\2\22j\3\2\2\2\24l\3\2"+
"\2\2\26p\3\2\2\2\30v\3\2\2\2\32y\3\2\2\2\34\u0087\3\2\2\2\36\u0089\3\2"+
"\2\2 \u0097\3\2\2\2\"\u009d\3\2\2\2$\u009f\3\2\2\2&\u00af\3\2\2\2(\u00b3"+
"\3\2\2\2*\u00b5\3\2\2\2,\u00b9\3\2\2\2.\u00be\3\2\2\2\60\u00c1\3\2\2\2"+
"\62\63\5\4\3\2\63\64\5\30\r\2\64\65\5.\30\2\65\3\3\2\2\2\668\5\6\4\2\67"+
"\66\3\2\2\28;\3\2\2\29\67\3\2\2\29:\3\2\2\2:\5\3\2\2\2;9\3\2\2\2<A\5\b"+
"\5\2=A\5\n\6\2>A\5\20\t\2?A\5\26\f\2@<\3\2\2\2@=\3\2\2\2@>\3\2\2\2@?\3"+
"\2\2\2A\7\3\2\2\2BC\7\4\2\2CE\7\32\2\2DF\5\f\7\2ED\3\2\2\2EF\3\2\2\2F"+
"\t\3\2\2\2GH\7\5\2\2HJ\7\32\2\2IK\5\f\7\2JI\3\2\2\2JK\3\2\2\2K\13\3\2"+
"\2\2LM\7\f\2\2MR\5\16\b\2NO\7\t\2\2OQ\5\16\b\2PN\3\2\2\2QT\3\2\2\2RP\3"+
"\2\2\2RS\3\2\2\2SU\3\2\2\2TR\3\2\2\2UV\7\r\2\2V\r\3\2\2\2WX\7\32\2\2X"+
"Y\7\22\2\2YZ\t\2\2\2Z\17\3\2\2\2[\\\7\6\2\2\\]\7\32\2\2]^\7\f\2\2^_\5"+
"\22\n\2_`\7\r\2\2`\21\3\2\2\2af\5\24\13\2bc\7\t\2\2ce\5\24\13\2db\3\2"+
"\2\2eh\3\2\2\2fd\3\2\2\2fg\3\2\2\2gk\3\2\2\2hf\3\2\2\2ik\3\2\2\2ja\3\2"+
"\2\2ji\3\2\2\2k\23\3\2\2\2lm\7\32\2\2mn\7\16\2\2no\7\32\2\2o\25\3\2\2"+
"\2pq\7\7\2\2qr\7\32\2\2r\27\3\2\2\2su\5\32\16\2ts\3\2\2\2ux\3\2\2\2vt"+
"\3\2\2\2vw\3\2\2\2w\31\3\2\2\2xv\3\2\2\2yz\5\34\17\2z{\7\17\2\2{|\5&\24"+
"\2|}\7\n\2\2}\33\3\2\2\2~\u0083\5\36\20\2\177\u0080\7\t\2\2\u0080\u0082"+
"\5\36\20\2\u0081\177\3\2\2\2\u0082\u0085\3\2\2\2\u0083\u0081\3\2\2\2\u0083"+
"\u0084\3\2\2\2\u0084\u0088\3\2\2\2\u0085\u0083\3\2\2\2\u0086\u0088\3\2"+
"\2\2\u0087~\3\2\2\2\u0087\u0086\3\2\2\2\u0088\35\3\2\2\2\u0089\u008a\7"+
"\32\2\2\u008a\u008b\7\f\2\2\u008b\u008c\5 \21\2\u008c\u008d\7\r\2\2\u008d"+
"\37\3\2\2\2\u008e\u0093\5\"\22\2\u008f\u0090\7\t\2\2\u0090\u0092\5\"\22"+
"\2\u0091\u008f\3\2\2\2\u0092\u0095\3\2\2\2\u0093\u0091\3\2\2\2\u0093\u0094"+
"\3\2\2\2\u0094\u0098\3\2\2\2\u0095\u0093\3\2\2\2\u0096\u0098\3\2\2\2\u0097"+
"\u008e\3\2\2\2\u0097\u0096\3\2\2\2\u0098!\3\2\2\2\u0099\u009e\5$\23\2"+
"\u009a\u009e\7\32\2\2\u009b\u009e\7\30\2\2\u009c\u009e\7\31\2\2\u009d"+
"\u0099\3\2\2\2\u009d\u009a\3\2\2\2\u009d\u009b\3\2\2\2\u009d\u009c\3\2"+
"\2\2\u009e#\3\2\2\2\u009f\u00a0\7\b\2\2\u00a0\u00a1\7\f\2\2\u00a1\u00a2"+
"\5\"\22\2\u00a2\u00a3\7\t\2\2\u00a3\u00a4\5\"\22\2\u00a4\u00a5\7\r\2\2"+
"\u00a5%\3\2\2\2\u00a6\u00ab\5(\25\2\u00a7\u00a8\7\t\2\2\u00a8\u00aa\5"+
"(\25\2\u00a9\u00a7\3\2\2\2\u00aa\u00ad\3\2\2\2\u00ab\u00a9\3\2\2\2\u00ab"+
"\u00ac\3\2\2\2\u00ac\u00b0\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ae\u00b0\3\2"+
"\2\2\u00af\u00a6\3\2\2\2\u00af\u00ae\3\2\2\2\u00b0\'\3\2\2\2\u00b1\u00b4"+
"\5*\26\2\u00b2\u00b4\5\36\20\2\u00b3\u00b1\3\2\2\2\u00b3\u00b2\3\2\2\2"+
"\u00b4)\3\2\2\2\u00b5\u00b6\5\"\22\2\u00b6\u00b7\5,\27\2\u00b7\u00b8\5"+
"\"\22\2\u00b8+\3\2\2\2\u00b9\u00ba\t\3\2\2\u00ba-\3\2\2\2\u00bb\u00bd"+
"\5\60\31\2\u00bc\u00bb\3\2\2\2\u00bd\u00c0\3\2\2\2\u00be\u00bc\3\2\2\2"+
"\u00be\u00bf\3\2\2\2\u00bf/\3\2\2\2\u00c0\u00be\3\2\2\2\u00c1\u00c2\5"+
"\36\20\2\u00c2\u00c3\7\n\2\2\u00c3\61\3\2\2\2\239@EJRfjv\u0083\u0087\u0093"+
"\u0097\u009d\u00ab\u00af\u00b3\u00be";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
} | [
"yuepeng.ypwang@gmail.com"
] | yuepeng.ypwang@gmail.com |
990a7605848671d652bf0bb36192df0ecaef3127 | 7c8515d4e3020a50eb9e2521708bcb62d134cc0b | /src/main/java/com/tapestry/components/Layout.java | 641e3471dbb1a6d1f219486e88d9f57fdc39ad60 | [] | no_license | SahilSoniKane/sampleapplication | d72d81ed282f972e48c434426a4f738f9df60047 | e05416d28c26f94ae3614b2bf534b6b672aaae7c | refs/heads/master | 2023-07-22T19:29:32.266261 | 2021-09-05T19:08:38 | 2021-09-05T19:08:38 | 399,834,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | package com.tapestry.components;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import java.time.LocalDate;
/**
* Layout component for pages of application test-project.
*/
@Import(module="bootstrap/collapse")
public class Layout
{
@Inject
private ComponentResources resources;
/**
* The page title, for the <title> element and the <h1> element.
*/
@Property
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
private String title;
@Property
private String pageName;
@Property
@Inject
@Symbol(SymbolConstants.APPLICATION_VERSION)
private String appVersion;
public String getClassForPageName()
{
return resources.getPageName().equalsIgnoreCase(pageName)
? "active"
: null;
}
public String[] getPageNames()
{
return new String[]{"Index", "Employees", "NewEmployee", "Login"};
}
public int getYear()
{
return LocalDate.now().getYear();
}
}
| [
"sahilsoni94600@gmail.com"
] | sahilsoni94600@gmail.com |
bc6d8cb91df315ac48a1106357b2c0153f06ba90 | 1ad6cd48d86b0b496d58848731dd7447ae18690f | /src/test/java/library/repositories/UserRepositoryTest.java | e8d0409f0ee84c09b45f674f2104410725030235 | [] | no_license | jaskier93/LibraryService | 1e177227355b8bf07cad1d70396ea9d88444a215 | 6e379241a2029030ea358b10c3983943facca58a | refs/heads/master | 2022-05-28T08:00:35.805920 | 2019-09-18T21:57:02 | 2019-09-18T21:57:02 | 183,672,118 | 0 | 0 | null | 2022-05-20T21:03:05 | 2019-04-26T17:52:29 | Java | UTF-8 | Java | false | false | 1,763 | java | package library.repositories;
import library.TestUtils;
import library.models.User;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDate;
import static org.junit.Assert.*;
@SpringBootTest
@RunWith(SpringRunner.class)
public class UserRepositoryTest {
@Autowired
private final UserRepository userRepository = null;
@Autowired
private final JdbcTemplate jdbcTemplate = null;
@After
public void after() {
jdbcTemplate.update("delete from user where last_name='XXXYYYZZZ'");
}
//test passed!
@Test
public void userRepositoryTest() {
LocalDate today = LocalDate.now();
User user = TestUtils.createUser();
userRepository.save(user);
User user1 = TestUtils.createUser();
userRepository.save(user1);
User user2 = TestUtils.createUser();
user2.setDateOfBirth(today.minusYears(16));
userRepository.save(user2);
User userFromBase = userRepository.getOne(user.getId());
assertEquals(user.getId(), userFromBase.getId());
assertNotEquals(user2.getId(), userFromBase.getId());
assertFalse(userRepository.findUserByLastName("XXXYYYZZZ").isEmpty());
assertTrue(userRepository.findUserByLastName("sdfsdfsdffsd").isEmpty());
// assertEquals(2, userRepository.findAdultUsers(today.minusYears(18)).size()); //libranian i user1 sฤ
doroลli
assertEquals(user, userRepository.findUserById(user.getId()));
}
}
| [
"smg7@o2.pl"
] | smg7@o2.pl |
74241b0a442abd39b2bc14be88891854e14df48b | 96c01449311c2352e0baf33ef3f486d238bfa482 | /src/Data/InputValues.java | 1b89dc5289114c1b91eb49e1d87d5917f1502e25 | [] | no_license | arnaldo-infinite/recall_assist | d2cc35cc9cd9f42b7be37dc161e387b965f40406 | 9469877f37562466478fdb6c02d2ce43d29c18b0 | refs/heads/master | 2021-07-05T19:33:02.707391 | 2017-09-25T10:09:21 | 2017-09-25T10:09:21 | 103,589,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,690 | 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 Data;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class InputValues
{
String RID;
String Date;
double tWS [];
double tWC [];
ConnectionClass objCon = new ConnectionClass();
DateManager dmanager = new DateManager();
Connection con;
public InputValues (String Date) throws ParseException
{
this.Date=Date;
fillinput(this.Date);
}
private void fillinput (String DateValue)
{
int count=0;
String Day1=DateValue+"%";
try
{
con=objCon.getConnection();
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
// PreparedStatement stat1=con.prepareStatement("select RID,Words_Score from recordings where (RID like '"+Day1+"' OR RID like '"+Day2+"' OR RID like '"+Day3+"' OR RID like '"+Day4+"' OR RID like '"+Day5+"' OR RID like '"+Day6+"') AND Words_Score='"+WordScore+"'");
ResultSet rst1=stmt.executeQuery("select RID,Words_Score,No_Words from word where RID like '"+Day1+"' order by RID asc");
while(rst1.next())
{
count++;
}
tWS = new double[count];
tWC= new double[count];
rst1.beforeFirst();
count=0;
while(rst1.next())
{
tWS[count] =Double.parseDouble(rst1.getString("Words_Score"));
tWC[count]=Double.parseDouble(rst1.getString("No_Words"));
count++;
}
}
catch(Exception e )
{
JOptionPane.showMessageDialog(null,"Error When Searching Occurance 2 "+e.toString());
}
finally
{
try
{
con.close();
}
catch (SQLException ex)
{
JOptionPane.showMessageDialog(null,"Error When Searching Occurance 3 "+ex.toString());
}
}
}
public double [] gettWC()
{
return this.tWC;
}
public double [] gettWS()
{
return this.tWS;
}
}
| [
"User@ArnaldoPC"
] | User@ArnaldoPC |
cd99e433f5c9bc58a036ec92da816d5bbce0d3a5 | 0ca53935a4a733bf0389c1de0abb2cbe57d68b11 | /nukkit/src/main/java/pl/projectcode/pocketsectors/nukkit/packet/PacketPermissionBroadcastMessage.java | 44ccf1db4cc7391bfccdb876811ff6f303852e54 | [
"MIT"
] | permissive | ProjectCode-PL/PocketSectors | 04feb8346cfd6f1fe8d3e89e5b29b06984486ced | 8c98447725f450d92be4e33c057aee1be32b069c | refs/heads/master | 2023-06-30T15:52:29.603347 | 2021-08-04T13:33:43 | 2021-08-04T13:33:43 | 392,696,050 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package pl.projectcode.pocketsectors.nukkit.packet;
import lombok.AllArgsConstructor;
import lombok.Getter;
import pl.projectcode.pocketsectors.common.packet.Packet;
@AllArgsConstructor
@Getter
public class PacketPermissionBroadcastMessage extends Packet {
private final String permission;
private final String message;
}
| [
"strixu155@gmail.com"
] | strixu155@gmail.com |
e85a092372cca214a9f87bbecc95d9882ee58b26 | f10bb9304d2683d2808335187d9977a5d9439480 | /src/main/java/es/mityc/javasign/xml/refs/ObjectToSign.java | e1d81d5f9854bf858f177fb50018a74b76e04fce | [] | no_license | douglascrp/MITyCLibXADES-sinadura | 4daacd52c4c4b51beb6a832a2cc8d9d96bb38fb0 | f1602fe5077f708ef5d851b85c722cba8c95b7bb | refs/heads/master | 2020-03-25T01:11:41.772525 | 2018-08-11T13:45:51 | 2018-08-11T13:45:51 | 142,208,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,907 | java | /**
* LICENCIA LGPL:
*
* Esta librerรญa es Software Libre; Usted puede redistribuirlo y/o modificarlo
* bajo los tรฉrminos de la GNU Lesser General Public License (LGPL)
* tal y como ha sido publicada por la Free Software Foundation; o
* bien la versiรณn 2.1 de la Licencia, o (a su elecciรณn) cualquier versiรณn posterior.
*
* Esta librerรญa se distribuye con la esperanza de que sea รบtil, pero SIN NINGUNA
* GARANTรA; tampoco las implรญcitas garantรญas de MERCANTILIDAD o ADECUACIรN A UN
* PROPรSITO PARTICULAR. Consulte la GNU Lesser General Public License (LGPL) para mรกs
* detalles
*
* Usted debe recibir una copia de la GNU Lesser General Public License (LGPL)
* junto con esta librerรญa; si no es asรญ, escriba a la Free Software Foundation Inc.
* 51 Franklin Street, 5ยบ Piso, Boston, MA 02110-1301, USA.
*
*/
package es.mityc.javasign.xml.refs;
import java.net.URI;
import es.mityc.firmaJava.libreria.xades.elementos.xades.ObjectIdentifier;
/**
* Contiene un objeto que se firmarรก e informaciรณn de apoyo.
*
* @author Ministerio de Industria, Turismo y Comercio
* @version 1.0
*/
public class ObjectToSign {
private AbstractObjectToSign objectToSign;
private String id;
// Informaciรณn adicional
private String description = null;
private ObjectIdentifier objectIdentifier = null;
private ExtraObjectData extraData = null;
/**
* Permite pasar un objeto a firmar, junto con la informaciรณn sobre dicho objeto a firmar.
*
* @param objectToSign .- Objeto a firmar
* @param desc .- Descripciรณn del objeto a firmar
* @param id .- Objecto identificador del objeto descrito
* @param mimeType .- Tipo MIME del objeto descrito
* @param encoding .- Codificaciรณn en la firma del objeto descrito
*/
public ObjectToSign(AbstractObjectToSign objectToSign, String desc, ObjectIdentifier id,
String mimeType, URI encoding) {
this.objectToSign = objectToSign;
this.description = desc;
this.objectIdentifier = id;
this.extraData = new ExtraObjectData(mimeType, encoding);
}
public void setObjectToSign(AbstractObjectToSign objectToSign) {
this.objectToSign = objectToSign;
}
public AbstractObjectToSign getObjectToSign() {
return this.objectToSign;
}
public String getDescription() {
return description;
}
public void setDescription(String descripcion) {
this.description = descripcion;
}
public ObjectIdentifier getObjectIdentifier() {
return objectIdentifier;
}
public void setObjectIdentifier(ObjectIdentifier identificador) {
this.objectIdentifier = identificador;
}
public String getMimeType() {
return extraData.getMimeType();
}
public URI getEncoding() {
return extraData.getEncoding();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
| [
"13552393+guszylk@users.noreply.github.com"
] | 13552393+guszylk@users.noreply.github.com |
1affa3ee7404d20f827bfee01636f2095e7feba1 | 2da75acbae5a2ade218061e05d81fa7db7cff019 | /src/test/java/com/jhipster/tfg/web/rest/LogsResourceIntTest.java | f23b77ea0bffd81db0fe4cfdc7293245fa6cc649 | [] | no_license | BertosAccion/jhipsterTFG | 38f53884b54a0da0b1290ba6619336618dfd6c9d | 71d34503ffa8287e303804c95e2d8f9fff52ae04 | refs/heads/master | 2020-05-03T04:09:12.140337 | 2019-04-11T14:59:29 | 2019-04-11T14:59:29 | 178,414,144 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,363 | java | package com.jhipster.tfg.web.rest;
import com.jhipster.tfg.TfgTest1App;
import com.jhipster.tfg.web.rest.vm.LoggerVM;
import ch.qos.logback.classic.AsyncAppender;
import ch.qos.logback.classic.LoggerContext;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Test class for the LogsResource REST controller.
*
* @see LogsResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TfgTest1App.class)
public class LogsResourceIntTest {
private MockMvc restLogsMockMvc;
@Before
public void setup() {
LogsResource logsResource = new LogsResource();
this.restLogsMockMvc = MockMvcBuilders
.standaloneSetup(logsResource)
.build();
}
@Test
public void getAllLogs() throws Exception {
restLogsMockMvc.perform(get("/management/logs"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
}
@Test
public void changeLogs() throws Exception {
LoggerVM logger = new LoggerVM();
logger.setLevel("INFO");
logger.setName("ROOT");
restLogsMockMvc.perform(put("/management/logs")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(logger)))
.andExpect(status().isNoContent());
}
@Test
public void testLogstashAppender() {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
assertThat(context.getLogger("ROOT").getAppender("ASYNC_LOGSTASH")).isInstanceOf(AsyncAppender.class);
}
}
| [
"adiaz@serbatic.es"
] | adiaz@serbatic.es |
5deaee12e5a296a7fbfc698663d8830ba27819f7 | e77a541a6e5d48f830d48a7338ff4aceef8d15f6 | /core/src/main/java/org/kuali/kra/service/impl/NotificationModuleRoleServiceImpl.java | ddca6628f618c92cb478bc6987e9f962ac4a73e9 | [] | no_license | r351574nc3/kc-release | a9c4f78b922005ecbfbc9aba36366e0c90f72857 | d5b9ad58e906dbafa553de777207ef5cd4addc54 | refs/heads/master | 2021-01-02T15:33:46.583309 | 2012-03-17T05:38:02 | 2012-03-17T05:38:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,283 | java | /*
* Copyright 2005-2010 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
*
* 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.kuali.kra.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.kuali.kra.common.notification.bo.NotificationModuleRole;
import org.kuali.kra.service.NotificationModuleRoleService;
import org.kuali.rice.kns.service.BusinessObjectService;
public class NotificationModuleRoleServiceImpl implements NotificationModuleRoleService {
private BusinessObjectService businessObjectService;
@Override
public List<NotificationModuleRole> getModuleRolesByModuleName(String moduleName) {
Map<String, Object> fieldValues = new HashMap<String, Object>();
fieldValues.put("moduleCode", moduleName);
List<NotificationModuleRole> moduleRoles =
(List<NotificationModuleRole>)getBusinessObjectService().findMatching(NotificationModuleRole.class, fieldValues);
return moduleRoles;
}
@Override
public String getModuleRolesForAjaxCall(String moduleName) {
String resultStr = "";
List<NotificationModuleRole> moduleRoles = getModuleRolesByModuleName(moduleName);
if (CollectionUtils.isNotEmpty(moduleRoles)) {
for (NotificationModuleRole moduleRole : moduleRoles) {
resultStr += moduleRole.getRoleName() + ",";
}
}
return resultStr;
}
public BusinessObjectService getBusinessObjectService() {
return businessObjectService;
}
public void setBusinessObjectService(BusinessObjectService businessObjectService) {
this.businessObjectService = businessObjectService;
}
}
| [
"r351574nc3@gmail.com"
] | r351574nc3@gmail.com |
f9feb338f1e3f6dddf77d0d204c6c6f647295a57 | 48912f21c2ddb53cbdc922b21afb253779e9b1e9 | /05_mvc2Webproject/src/ajax/controller/AjaxTest3Servlet.java | e71f6e570992f397dd4505d0def3ddf36a645159 | [] | no_license | Dyd-hi/Web-study | 478d89237eb445ee38affaa10d4d2c34b7f2c73c | 1aa8247b28fbddb23849199e7ed563a385b1e413 | refs/heads/main | 2023-04-25T04:20:13.050826 | 2021-05-14T11:28:14 | 2021-05-14T11:28:14 | 363,112,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,528 | java | package ajax.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class AjaxTest3Servlet
*/
@WebServlet(name = "AjaxTest3", urlPatterns = { "/ajaxTest3" })
public class AjaxTest3Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AjaxTest3Servlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
int first = Integer.parseInt(request.getParameter("first"));
int second = Integer.parseInt(request.getParameter("second"));
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.print(first + second);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"yc@DESKTOP-8IOB16R"
] | yc@DESKTOP-8IOB16R |
bfba5cad128dc9e8c8760035c3dbd6e29312e0eb | 21bf8f27dc5d1e3d70c9346528b66e529cae2270 | /src/main/java/com/example/testexample/TestExampleApplication.java | 1bfdb303ffd15088397a63ef81681ee93b726db1 | [] | no_license | IVZ2020/Test_PST_Labs | 2229f9e92075c76cd4960ed5a1431ffd1aa96208 | 9ce2c851b7b2a66fcdc6691397e493ba64014583 | refs/heads/master | 2023-08-01T10:56:08.644195 | 2021-09-17T11:32:21 | 2021-09-17T11:32:21 | 407,511,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 802 | java | package com.example.testexample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {
"com.example.testexample.configuration"}
)
public class TestExampleApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(TestExampleApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(TestExampleApplication.class, args);
}
}
| [
"you@example.com"
] | you@example.com |
04e47c1f1ce7ebea406737e5e8b71c71d07de945 | 1722fd6624daf4c4db77df2085459f93d735eee9 | /JavaEx/src/com/javaex/network/echoserver/Server.java | 49918a7581d90c132a31426a4165a8c4e4ba7d78 | [] | no_license | EEMO22/JavaEx | c5ed93f6d8da883fbee246a8a6518e97a64bf09a | 9c118e56b47d917a143df6231586e6882035e21c | refs/heads/master | 2023-07-22T21:47:43.832637 | 2021-09-07T07:04:53 | 2021-09-07T07:04:53 | 386,480,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | package com.javaex.network.echoserver;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
public class Server {
public static void main(String[] args) {
// ์๋ฒ ์์ผ
ServerSocket serverSocket = null;
try {
// ๋ฐ์ธ๋: ์ฃผ์์ ํฌํธ ์ฐ๊ฒฐ
serverSocket = new ServerSocket();
// ๋ชจ๋ ip์ 10000 ํฌํธ ํ์ฉ
InetSocketAddress ip = new InetSocketAddress("119.197.78.15", 10000);
serverSocket.bind(ip);
System.out.println("<์๋ฒ ์์>");
System.out.println("[์ฐ๊ฒฐ์ ๊ธฐ๋ค๋ฆฝ๋๋ค.]");
// ํด๋ผ์ด์ธํธ ์ฐ๊ฒฐ ๋๊ธฐ
while(true) {
Socket socket = serverSocket.accept(); // ์ฐ๊ฒฐ ๋๊ธฐ
Thread thread = new ServerThread(socket);
// ์ฐ๋ ๋ ์์
thread.start();
}
// ํ์ฒ๋ฆฌ
// System.out.println("=========");
// System.out.println("<์๋ฒ ์ข
๋ฃ>");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
serverSocket.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"battlemech@naver.com"
] | battlemech@naver.com |
3b0516c81fc6d4c598d40bd3ac9e5f803970fbc6 | d500204e2aa06f2053870b6f4f67c9853e7136c3 | /app/src/test/java/com/dablaze/notekeeper/ExampleUnitTest.java | 565654a27e9cc595f089e94da047bc5ec9767781 | [] | no_license | Dablaze-ufc/NoteKeeper2 | 05b6ded32281d073a668ebda18441a420bc489ac | 5a88e04f6669e5249eac34d7ea143ac4387ddb15 | refs/heads/master | 2020-06-27T19:33:59.715078 | 2019-08-01T10:31:51 | 2019-08-01T10:31:51 | 200,030,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.dablaze.notekeeper;
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);
}
} | [
"you@example.com"
] | you@example.com |
0cce58ff91835a0ad4a78429f06eeff3ee13dadb | a45db7cc564c784e50279185544d2d2214b55435 | /precipitated/src/main/java/precipitated/will/temp/JingXiAddress.java | 19c1ebada9493d3cff59408424c3a00f78db7f23 | [] | no_license | 198812345678/backup | c99964163eecd28c4be7a9b517f101fa393f4ad9 | 3c648376d19d23903ca55200aa4714a08bd664a0 | refs/heads/master | 2021-06-04T08:50:51.047039 | 2017-08-02T14:35:49 | 2017-08-02T14:35:49 | 34,398,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,749 | java | package precipitated.will.temp;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* Created by will.wang on 2016/5/19.
*/
public class JingXiAddress {
public static void main(String[] args) throws IOException {
File fileLeft = new File("F:\\oneDrive\\backup\\precipitated\\src\\main\\resources\\jingxileft.txt");
List<String> leftLines = Files.readLines(fileLeft, Charsets.UTF_8);
File fileRight = new File("F:\\oneDrive\\backup\\precipitated\\src\\main\\resources\\jingxiRight.txt");
List<String> rightLines = Files.readLines(fileRight, Charsets.UTF_8);
List<String> leftLinesNoSpace = Lists.newArrayList();
for (String leftLine : leftLines) {
leftLine = leftLine.replaceAll("\\s", "");
leftLinesNoSpace.add(leftLine);
}
List<String> rightLinesNoSpace = Lists.newArrayList();
for (String rightLine : rightLines) {
rightLine = rightLine.replaceAll("\\s", "");
rightLinesNoSpace.add(rightLine);
}
List<String> leftLinesBck = Lists.newArrayList(leftLinesNoSpace);
List<String> rightLinesBck = Lists.newArrayList(rightLinesNoSpace);
leftLinesBck.removeAll(rightLinesNoSpace);
rightLinesBck.removeAll(leftLinesNoSpace);
// for (String line : leftLinesBck) {
// System.out.println(line);
// }
System.out.println("==================================");
for (String line : rightLinesBck) {
System.out.println(line);
}
}
}
| [
"will.wang@qunar.com"
] | will.wang@qunar.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.