blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
sequence | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
sequence | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
058d85721faba78d12d4f2d766996c34c3196002 | 31,756,988,197,598 | 9dda630a9848f3649a06a1166f391944b8cc78c5 | /src/main/java/com/robotzero/gamefx/renderengine/model/Color.java | f1049c35cb83a5d3725042ae93b07209949607c6 | [
"Apache-2.0"
] | permissive | robotzero/gamefx | https://github.com/robotzero/gamefx | db3404dcbbf33b6e73a8bbbdde05e9f07e3e56dd | 9bda94c00948d34c5548e4c71b832f0a0a7afd98 | refs/heads/master | 2022-06-26T18:49:53.959000 | 2020-08-26T12:34:30 | 2020-08-26T12:34:30 | 205,686,889 | 0 | 0 | Apache-2.0 | false | 2022-06-20T22:44:08 | 2019-09-01T14:20:42 | 2020-08-26T12:35:07 | 2022-06-20T22:44:08 | 442 | 0 | 0 | 2 | Java | false | false | package com.robotzero.gamefx.renderengine.model;
import org.joml.Vector3f;
import org.joml.Vector4f;
public final class Color {
public static final Color WHITE = new Color(1f, 1f, 1f);
public static final Color BLACK = new Color(0f, 0f, 0f);
public static final Color RED = new Color(1f, 0f, 0f);
public static final Color GREEN = new Color(0f, 1f, 0f);
public static final Color BLUE = new Color(0f, 0f, 1f);
/** This value specifies the red component. */
private float red;
/** This value specifies the green component. */
private float green;
/** This value specifies the blue component. */
private float blue;
/** This value specifies the transparency. */
private float alpha;
/** The default color is black. */
public Color() {
this(0f, 0f, 0f);
}
/**
* Creates a RGB-Color with an alpha value of 1.
*
* @param red The red component. Range from 0f to 1f.
* @param green The green component. Range from 0f to 1f.
* @param blue The blue component. Range from 0f to 1f.
*/
public Color(float red, float green, float blue) {
this(red, green, blue, 1f);
}
/**
* Creates a RGBA-Color.
*
* @param red The red component. Range from 0f to 1f.
* @param green The green component. Range from 0f to 1f.
* @param blue The blue component. Range from 0f to 1f.
* @param alpha The transparency. Range from 0f to 1f.
*/
public Color(float red, float green, float blue, float alpha) {
setRed(red);
setGreen(green);
setBlue(blue);
setAlpha(alpha);
}
/**
* Creates a RGB-Color with an alpha value of 1.
*
* @param red The red component. Range from 0 to 255.
* @param green The green component. Range from 0 to 255.
* @param blue The blue component. Range from 0 to 255.
*/
public Color(int red, int green, int blue) {
this(red, green, blue, 1f);
}
/**
* Creates a RGBA-Color.
*
* @param red The red component. Range from 0 to 255.
* @param green The green component. Range from 0 to 255.
* @param blue The blue component. Range from 0 to 255.
* @param alpha The transparency. Range from 0 to 255.
*/
public Color(int red, int green, int blue, int alpha) {
setRed(red);
setGreen(green);
setBlue(blue);
setAlpha(alpha);
}
/**
* Returns the red component.
*
* @return The red component.
*/
public float getRed() {
return red;
}
/**
* Sets the red component.
*
* @param red The red component. Range from 0f to 1f.
*/
public void setRed(float red) {
if (red < 0f) {
red = 0f;
}
if (red > 1f) {
red = 1f;
}
this.red = red;
}
/**
* Sets the red component.
*
* @param red The red component. Range from 0 to 255.
*/
public void setRed(int red) {
setRed(red / 255f);
}
/**
* Returns the green component.
*
* @return The green component.
*/
public float getGreen() {
return green;
}
/**
* Sets the green component.
*
* @param green The green component. Range from 0f to 1f.
*/
public void setGreen(float green) {
if (green < 0f) {
green = 0f;
}
if (green > 1f) {
green = 1f;
}
this.green = green;
}
/**
* Sets the green component.
*
* @param green The green component. Range from 0 to 255.
*/
public void setGreen(int green) {
setGreen(green / 255f);
}
/**
* Returns the blue component.
*
* @return The blue component.
*/
public float getBlue() {
return blue;
}
/**
* Sets the blue component.
*
* @param blue The blue component. Range from 0f to 1f.
*/
public void setBlue(float blue) {
if (blue < 0f) {
blue = 0f;
}
if (blue > 1f) {
blue = 1f;
}
this.blue = blue;
}
/**
* Sets the blue component.
*
* @param blue The blue component. Range from 0 to 255.
*/
public void setBlue(int blue) {
setBlue(blue / 255f);
}
/**
* Returns the transparency.
*
* @return The transparency.
*/
public float getAlpha() {
return alpha;
}
/**
* Sets the transparency.
*
* @param alpha The transparency. Range from 0f to 1f.
*/
public void setAlpha(float alpha) {
if (alpha < 0f) {
alpha = 0f;
}
if (alpha > 1f) {
alpha = 1f;
}
this.alpha = alpha;
}
/**
* Sets the transparency.
*
* @param alpha The transparency. Range from 0 to 255.
*/
public void setAlpha(int alpha) {
setAlpha(alpha / 255f);
}
/**
* Returns the color as a (x,y,z)-Vector.
*
* @return The color as vec3.
*/
public Vector3f toVector3f() {
return new Vector3f(red, green, blue);
}
/**
* Returns the color as a (x,y,z,w)-Vector.
*
* @return The color as vec4.
*/
public Vector4f toVector4f() {
return new Vector4f(red, green, blue, alpha);
}
} | UTF-8 | Java | 5,417 | java | Color.java | Java | [] | null | [] | package com.robotzero.gamefx.renderengine.model;
import org.joml.Vector3f;
import org.joml.Vector4f;
public final class Color {
public static final Color WHITE = new Color(1f, 1f, 1f);
public static final Color BLACK = new Color(0f, 0f, 0f);
public static final Color RED = new Color(1f, 0f, 0f);
public static final Color GREEN = new Color(0f, 1f, 0f);
public static final Color BLUE = new Color(0f, 0f, 1f);
/** This value specifies the red component. */
private float red;
/** This value specifies the green component. */
private float green;
/** This value specifies the blue component. */
private float blue;
/** This value specifies the transparency. */
private float alpha;
/** The default color is black. */
public Color() {
this(0f, 0f, 0f);
}
/**
* Creates a RGB-Color with an alpha value of 1.
*
* @param red The red component. Range from 0f to 1f.
* @param green The green component. Range from 0f to 1f.
* @param blue The blue component. Range from 0f to 1f.
*/
public Color(float red, float green, float blue) {
this(red, green, blue, 1f);
}
/**
* Creates a RGBA-Color.
*
* @param red The red component. Range from 0f to 1f.
* @param green The green component. Range from 0f to 1f.
* @param blue The blue component. Range from 0f to 1f.
* @param alpha The transparency. Range from 0f to 1f.
*/
public Color(float red, float green, float blue, float alpha) {
setRed(red);
setGreen(green);
setBlue(blue);
setAlpha(alpha);
}
/**
* Creates a RGB-Color with an alpha value of 1.
*
* @param red The red component. Range from 0 to 255.
* @param green The green component. Range from 0 to 255.
* @param blue The blue component. Range from 0 to 255.
*/
public Color(int red, int green, int blue) {
this(red, green, blue, 1f);
}
/**
* Creates a RGBA-Color.
*
* @param red The red component. Range from 0 to 255.
* @param green The green component. Range from 0 to 255.
* @param blue The blue component. Range from 0 to 255.
* @param alpha The transparency. Range from 0 to 255.
*/
public Color(int red, int green, int blue, int alpha) {
setRed(red);
setGreen(green);
setBlue(blue);
setAlpha(alpha);
}
/**
* Returns the red component.
*
* @return The red component.
*/
public float getRed() {
return red;
}
/**
* Sets the red component.
*
* @param red The red component. Range from 0f to 1f.
*/
public void setRed(float red) {
if (red < 0f) {
red = 0f;
}
if (red > 1f) {
red = 1f;
}
this.red = red;
}
/**
* Sets the red component.
*
* @param red The red component. Range from 0 to 255.
*/
public void setRed(int red) {
setRed(red / 255f);
}
/**
* Returns the green component.
*
* @return The green component.
*/
public float getGreen() {
return green;
}
/**
* Sets the green component.
*
* @param green The green component. Range from 0f to 1f.
*/
public void setGreen(float green) {
if (green < 0f) {
green = 0f;
}
if (green > 1f) {
green = 1f;
}
this.green = green;
}
/**
* Sets the green component.
*
* @param green The green component. Range from 0 to 255.
*/
public void setGreen(int green) {
setGreen(green / 255f);
}
/**
* Returns the blue component.
*
* @return The blue component.
*/
public float getBlue() {
return blue;
}
/**
* Sets the blue component.
*
* @param blue The blue component. Range from 0f to 1f.
*/
public void setBlue(float blue) {
if (blue < 0f) {
blue = 0f;
}
if (blue > 1f) {
blue = 1f;
}
this.blue = blue;
}
/**
* Sets the blue component.
*
* @param blue The blue component. Range from 0 to 255.
*/
public void setBlue(int blue) {
setBlue(blue / 255f);
}
/**
* Returns the transparency.
*
* @return The transparency.
*/
public float getAlpha() {
return alpha;
}
/**
* Sets the transparency.
*
* @param alpha The transparency. Range from 0f to 1f.
*/
public void setAlpha(float alpha) {
if (alpha < 0f) {
alpha = 0f;
}
if (alpha > 1f) {
alpha = 1f;
}
this.alpha = alpha;
}
/**
* Sets the transparency.
*
* @param alpha The transparency. Range from 0 to 255.
*/
public void setAlpha(int alpha) {
setAlpha(alpha / 255f);
}
/**
* Returns the color as a (x,y,z)-Vector.
*
* @return The color as vec3.
*/
public Vector3f toVector3f() {
return new Vector3f(red, green, blue);
}
/**
* Returns the color as a (x,y,z,w)-Vector.
*
* @return The color as vec4.
*/
public Vector4f toVector4f() {
return new Vector4f(red, green, blue, alpha);
}
} | 5,417 | 0.536829 | 0.513568 | 232 | 22.353449 | 19.583488 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357759 | false | false | 4 |
6bf723a66b6ee256fc5a87b734ec1a6808f9c86f | 4,088,808,915,694 | aa18da71e3822425e0d556b1abb8ab66d93b90cb | /yunxiaoxian/src/main/java/com/yxx/controller/GoodsController.java | ed271342ae2f016a397d8e26842116c2f2c01aee | [
"MIT"
] | permissive | markeNick/yxx | https://github.com/markeNick/yxx | 2daf4fe82ba2d80a3081ac4e61c0ba3744744086 | 5fc9e8e88122d367b3ee70936b3c0dacadc9e653 | refs/heads/master | 2022-12-27T08:14:06.048000 | 2020-03-12T15:48:58 | 2020-03-12T15:48:58 | 242,372,577 | 0 | 0 | MIT | false | 2022-12-16T00:46:41 | 2020-02-22T16:22:23 | 2020-03-12T15:49:01 | 2022-12-16T00:46:41 | 2,072 | 0 | 0 | 12 | Java | false | false | package com.yxx.controller;
import com.alibaba.fastjson.JSONObject;
import com.yxx.pojo.*;
import com.yxx.service.CollectionService;
import com.yxx.service.GoodsService;
import com.yxx.service.MessageService;
import com.yxx.service.ReplyService;
import com.yxx.util.Base64Util;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
@Controller
public class GoodsController {
private static Logger logger = LoggerFactory.getLogger(GoodsController.class);
@Autowired
private GoodsService goodsService;
@Autowired
private CollectionService collectionService;
@Autowired
private ReplyService replyService;
@Autowired
private MessageService messageService;
//搜索框 根据商品描述和页码模糊查询商品信息
@GetMapping("selectGoodsByGoodsDescribe")
@ResponseBody
public JSONObject selectGoodsByGoodsDescribe(@ModelAttribute("goods") Goods goods, String goodsDescribe, Integer currentPage) throws UnsupportedEncodingException {
/* if(goodsDescribe!=null){//解决搜索信息中文乱码
goods.setGoodsDescribe(new String(goodsDescribe.getBytes("ISO-8859-1"),"UTF-8"));
}*/
JSONObject json = new JSONObject();
List<GoodsCustom> goodslist = null;//商品信息集合
Integer maxpage = null;//最大页数
Integer count = null;//总记录数
if (currentPage != null) {//假如发送了页码,返回后续页的数据
goods.setCurrentPage((currentPage - 1) * 10);
try {
goodslist = goodsService.selectGoodsByGoodsDescribe(goods);//查询相应所有商品信息
} catch (Exception e) {
logger.error("selectGoodsByGoodsDescribe--> error:{}:", e);
}
} else {//假如没发送页码,返回第一页的数据
goods.setCurrentPage(0);
try {
goodslist = goodsService.selectGoodsByGoodsDescribe(goods);//查询相应所有商品信息
} catch (Exception e) {
logger.error("selectGoodsByGoodsDescribe--> error:{}:", e);
}
}
try {
count = goodsService.selectCountByGoods(goods);//查询相应所有商品信息总记录数
} catch (Exception e) {
logger.error("selectCountByGoods--> error:{}:", e);
}
if (count != null) {
if (count / 10 == 0 && count % 10 > 0) {//1-9条记录数
maxpage = 1;
} else if (count / 10 > 0 && count % 10 > 0) {//不能被10整除的记录数
maxpage = (count / 10) + 1;
} else if (count / 10 > 0 && count % 10 == 0) {//能被10整除的记录数
maxpage = count / 10;
}
} else {//0条记录数
maxpage = 0;
}
if (goodslist != null && goodslist.size() > 0 && maxpage != 0) {//假如查询到信息,返回
json.put("goodslist", goodslist);//商品信息
json.put("maxpage", maxpage);//最大页数
json.put("count", count);//总纪录数
} else {//没查询到,返回null
json.put("goodslist", null);
}
return json;
}
//返回 单个商品详细信息和留言回复
@RequestMapping("/selectOneGoodsDetailMessage")
@ResponseBody
public JSONObject selectOneGoodsDetailMessage(@ModelAttribute("goods") Goods goods,
@RequestParam("goodsId") Integer goodsId,
@RequestParam("openID") String openID,
@RequestParam("currentPage") Integer currentPage) {
GoodsCustom goodsmessage = null;
List<Collection> collections = null;
JSONObject json = new JSONObject();
try {
goodsmessage = goodsService.selectOneGoodsByGoodsId(goods);//查询商品信息
} catch (Exception e) {
logger.error("selectOneGoodsByGoodsId--> error:{}:", e);
}
if (goodsmessage != null) {
json.put("goodsmessage", goodsmessage);
try {
collections = collectionService.selectCollectionByGoodsIDAndOpenID(openID, goodsId);//查询是否收藏
} catch (Exception e) {
logger.error("selectCollectionByGoodsIDAndOpenID--> error:{}:", e);
}
if (collections.size() > 0) {
json.put("collected", true);
} else {
json.put("collected", false);
}
} else {//假如没查到或者商品id为null,返回null
json.put("goodsmessage", null);
return json;
}
//查询留言回复信息
List<String> numberList=null;
try {//查询留言框编号集合
if(currentPage==null){
numberList = messageService.selectMessageNumberByGoodsIDAndOpenID(goodsId, null,0);
}else {
numberList = messageService.selectMessageNumberByGoodsIDAndOpenID(goodsId, null,(currentPage-1)*6);
}
}catch (Exception e){
logger.error("selectMessageNumberByGoodsIDAndOpenID--> error:{}:", e);
}
if(numberList!=null&&numberList.size()>0){
List<List<Reply>> replylist=new ArrayList<List<Reply>>();//存查询出来的多个List<Reply>
for (String number:numberList){
List<Reply> replies=null;
try {//根据留言框编号查询留言信息
replies = replyService.selectDetailForOneReply(number,null,0);
}catch (Exception e){
logger.error("selectReplyDetailByMessageNumber--> error:{}:", e);
}
if(replies!=null&&replies.size()>0){
replylist.add(replies);
}
}
json.put("replylist",replylist);
}else {//假如没有留言
json.put("replylist",new ArrayList<List<Reply>>());
}
return json;
}
//查询我卖的商品
@PostMapping("selectAllMySaleGoods")
@ResponseBody
public JSONObject selectAllMySaleGoods(String openID, Integer currentPage) {
JSONObject json = new JSONObject();
List<OrderCustom> mysalelist = null;
try {
if (currentPage != null) {//查询我卖出的商品信息
mysalelist = goodsService.selectAllMySaleGoods(openID, (currentPage - 1) * 10);
} else {
mysalelist = goodsService.selectAllMySaleGoods(openID, 0);
}
} catch (Exception e) {
logger.error("selectAllMySaleGoods--> error:{}:", e);
}
if (mysalelist != null && mysalelist.size() != 0) {//假如查询到我卖出的商品返回
json.put("mysalelist", mysalelist);
return json;
} else {//没查询到我卖出的商品返回空
json.put("mysalelist", null);
return json;
}
}
//查询我买的商品
@PostMapping("selectAllMyBuyGoods")
@ResponseBody
public JSONObject selectAllMyBuyGoods(String openID, Integer currentPage) {
JSONObject json = new JSONObject();
List<OrderCustom> mybuylist = null;
try {
if (currentPage != null) {//查询我买的商品信息
mybuylist = goodsService.selectAllMyBuyGoods(openID, (currentPage - 1) * 10);
} else {
mybuylist = goodsService.selectAllMyBuyGoods(openID, 0);
}
} catch (Exception e) {
logger.error("selectAllMyBuyGoods--> error:{}:", e);
}
if (mybuylist != null && mybuylist.size() != 0) {//假如查询到我买的商品返回
json.put("mybuylist", mybuylist);
return json;
} else {//没查询到我买的商品返回空
json.put("mybuylist", null);
return json;
}
}
//我发布的商品信息
@PostMapping("selectAllMyPublishGoods")
@ResponseBody
public JSONObject selectAllMyPublishGoods(String openID, Integer currentPage) {
JSONObject json = new JSONObject();
List<Goods> mypublishlist = null;
try {
if (currentPage != null) {//查询我发布的商品信息
mypublishlist = goodsService.selectAllMyPublishGoods(openID, (currentPage - 1) * 10);
} else {
mypublishlist = goodsService.selectAllMyPublishGoods(openID, 0);
}
} catch (Exception e) {
logger.error("selectAllMyPublishGoods--> error:{}:", e);
}
if (mypublishlist != null && mypublishlist.size() != 0) {//假如查询到我发布的商品返回
json.put("mypublishlist", mypublishlist);
return json;
} else {//没查询到我发布的商品返回空
json.put("mypublishlist", null);
return json;
}
}
//上传商品
@PostMapping("uploadGoods")
@ResponseBody
public JSONObject uploadGoods(@ModelAttribute("goods") Goods goods, String[] myfile,
@RequestParam(value = "openID", required = true) String openID) {
JSONObject json = new JSONObject();
//获取随机数
Random rand = new Random();
//拼接url
StringBuffer newNames = new StringBuffer();
// 存储图片的物理路径
String file_path = "//opt//pic";
Integer stringSize = myfile.length;
// 解析Base64
for (String file : myfile) {//校验
String dataPrefix;
String suffix;
if (file == null || "".equals(file)) {
json.put("error", "上传失败,上传图片数据为空!");
json.put("status", false);
return json;
} else {
String[] d = file.split("base64+");
if (d != null && d.length == 2) {
dataPrefix = d[0];////data:img/jpg;base64
} else {
json.put("error", "上传失败,数据不合法!");
json.put("status", false);
return json;
}
}
if ("data:image/jpeg;".equalsIgnoreCase(dataPrefix)) {//data:image/jpeg;base64,base64编码的jpeg图片数据
suffix = ".jpg";
} else if ("data:image/jpg;".equalsIgnoreCase(dataPrefix)) {//data:image/jpeg;base64,base64编码的jpg图片数据
suffix = ".jpg";
} else if ("data:image/x-icon;".equalsIgnoreCase(dataPrefix)) {//data:image/x-icon;base64,base64编码的icon图片数据
suffix = ".ico";
} else if ("data:image/gif;".equalsIgnoreCase(dataPrefix)) {//data:image/gif;base64,base64编码的gif图片数据
suffix = ".gif";
} else if ("data:image/png;".equalsIgnoreCase(dataPrefix)) {//data:image/png;base64,base64编码的png图片数据
suffix = ".png";
} else {
json.put("error", "上传图片格式不合法!");
json.put("status", false);
return json;
}
// 解析Base64 重新命名
MultipartFile multipartFile = Base64Util.base64ToMultipart(file);
//将内存中的数据写入磁盘
String transName;
transName = (rand.nextInt(9999999) + 100000) + openID +
multipartFile.getName().replaceAll(".+\\.", System.currentTimeMillis() + ".");
newNames.append(transName + ",");
// 将内存中的数据写入磁盘
File newName = new File(file_path + "/" + transName);
try {
multipartFile.transferTo(newName);
} catch (IOException e) {
logger.error("IOException", e.getMessage());
json.put("error", "图片存入服务器失败!");
json.put("status", false);
return json;
}
}
// 上传图片
goods.setImage(newNames.toString().substring(0, newNames.toString().length() - 1));
goods.setStatus(0);
//获取系统时间
Date createTime = new java.sql.Date(new java.util.Date().getTime());
goods.setCreateTime(createTime);
boolean flag = false;
flag = goodsService.uploadGoods(goods);
if (flag == false) {
json.put("status", false);
return json;
}
json.put("status", true);
return json;
}
}
| UTF-8 | Java | 13,178 | java | GoodsController.java | Java | [] | null | [] | package com.yxx.controller;
import com.alibaba.fastjson.JSONObject;
import com.yxx.pojo.*;
import com.yxx.service.CollectionService;
import com.yxx.service.GoodsService;
import com.yxx.service.MessageService;
import com.yxx.service.ReplyService;
import com.yxx.util.Base64Util;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
@Controller
public class GoodsController {
private static Logger logger = LoggerFactory.getLogger(GoodsController.class);
@Autowired
private GoodsService goodsService;
@Autowired
private CollectionService collectionService;
@Autowired
private ReplyService replyService;
@Autowired
private MessageService messageService;
//搜索框 根据商品描述和页码模糊查询商品信息
@GetMapping("selectGoodsByGoodsDescribe")
@ResponseBody
public JSONObject selectGoodsByGoodsDescribe(@ModelAttribute("goods") Goods goods, String goodsDescribe, Integer currentPage) throws UnsupportedEncodingException {
/* if(goodsDescribe!=null){//解决搜索信息中文乱码
goods.setGoodsDescribe(new String(goodsDescribe.getBytes("ISO-8859-1"),"UTF-8"));
}*/
JSONObject json = new JSONObject();
List<GoodsCustom> goodslist = null;//商品信息集合
Integer maxpage = null;//最大页数
Integer count = null;//总记录数
if (currentPage != null) {//假如发送了页码,返回后续页的数据
goods.setCurrentPage((currentPage - 1) * 10);
try {
goodslist = goodsService.selectGoodsByGoodsDescribe(goods);//查询相应所有商品信息
} catch (Exception e) {
logger.error("selectGoodsByGoodsDescribe--> error:{}:", e);
}
} else {//假如没发送页码,返回第一页的数据
goods.setCurrentPage(0);
try {
goodslist = goodsService.selectGoodsByGoodsDescribe(goods);//查询相应所有商品信息
} catch (Exception e) {
logger.error("selectGoodsByGoodsDescribe--> error:{}:", e);
}
}
try {
count = goodsService.selectCountByGoods(goods);//查询相应所有商品信息总记录数
} catch (Exception e) {
logger.error("selectCountByGoods--> error:{}:", e);
}
if (count != null) {
if (count / 10 == 0 && count % 10 > 0) {//1-9条记录数
maxpage = 1;
} else if (count / 10 > 0 && count % 10 > 0) {//不能被10整除的记录数
maxpage = (count / 10) + 1;
} else if (count / 10 > 0 && count % 10 == 0) {//能被10整除的记录数
maxpage = count / 10;
}
} else {//0条记录数
maxpage = 0;
}
if (goodslist != null && goodslist.size() > 0 && maxpage != 0) {//假如查询到信息,返回
json.put("goodslist", goodslist);//商品信息
json.put("maxpage", maxpage);//最大页数
json.put("count", count);//总纪录数
} else {//没查询到,返回null
json.put("goodslist", null);
}
return json;
}
//返回 单个商品详细信息和留言回复
@RequestMapping("/selectOneGoodsDetailMessage")
@ResponseBody
public JSONObject selectOneGoodsDetailMessage(@ModelAttribute("goods") Goods goods,
@RequestParam("goodsId") Integer goodsId,
@RequestParam("openID") String openID,
@RequestParam("currentPage") Integer currentPage) {
GoodsCustom goodsmessage = null;
List<Collection> collections = null;
JSONObject json = new JSONObject();
try {
goodsmessage = goodsService.selectOneGoodsByGoodsId(goods);//查询商品信息
} catch (Exception e) {
logger.error("selectOneGoodsByGoodsId--> error:{}:", e);
}
if (goodsmessage != null) {
json.put("goodsmessage", goodsmessage);
try {
collections = collectionService.selectCollectionByGoodsIDAndOpenID(openID, goodsId);//查询是否收藏
} catch (Exception e) {
logger.error("selectCollectionByGoodsIDAndOpenID--> error:{}:", e);
}
if (collections.size() > 0) {
json.put("collected", true);
} else {
json.put("collected", false);
}
} else {//假如没查到或者商品id为null,返回null
json.put("goodsmessage", null);
return json;
}
//查询留言回复信息
List<String> numberList=null;
try {//查询留言框编号集合
if(currentPage==null){
numberList = messageService.selectMessageNumberByGoodsIDAndOpenID(goodsId, null,0);
}else {
numberList = messageService.selectMessageNumberByGoodsIDAndOpenID(goodsId, null,(currentPage-1)*6);
}
}catch (Exception e){
logger.error("selectMessageNumberByGoodsIDAndOpenID--> error:{}:", e);
}
if(numberList!=null&&numberList.size()>0){
List<List<Reply>> replylist=new ArrayList<List<Reply>>();//存查询出来的多个List<Reply>
for (String number:numberList){
List<Reply> replies=null;
try {//根据留言框编号查询留言信息
replies = replyService.selectDetailForOneReply(number,null,0);
}catch (Exception e){
logger.error("selectReplyDetailByMessageNumber--> error:{}:", e);
}
if(replies!=null&&replies.size()>0){
replylist.add(replies);
}
}
json.put("replylist",replylist);
}else {//假如没有留言
json.put("replylist",new ArrayList<List<Reply>>());
}
return json;
}
//查询我卖的商品
@PostMapping("selectAllMySaleGoods")
@ResponseBody
public JSONObject selectAllMySaleGoods(String openID, Integer currentPage) {
JSONObject json = new JSONObject();
List<OrderCustom> mysalelist = null;
try {
if (currentPage != null) {//查询我卖出的商品信息
mysalelist = goodsService.selectAllMySaleGoods(openID, (currentPage - 1) * 10);
} else {
mysalelist = goodsService.selectAllMySaleGoods(openID, 0);
}
} catch (Exception e) {
logger.error("selectAllMySaleGoods--> error:{}:", e);
}
if (mysalelist != null && mysalelist.size() != 0) {//假如查询到我卖出的商品返回
json.put("mysalelist", mysalelist);
return json;
} else {//没查询到我卖出的商品返回空
json.put("mysalelist", null);
return json;
}
}
//查询我买的商品
@PostMapping("selectAllMyBuyGoods")
@ResponseBody
public JSONObject selectAllMyBuyGoods(String openID, Integer currentPage) {
JSONObject json = new JSONObject();
List<OrderCustom> mybuylist = null;
try {
if (currentPage != null) {//查询我买的商品信息
mybuylist = goodsService.selectAllMyBuyGoods(openID, (currentPage - 1) * 10);
} else {
mybuylist = goodsService.selectAllMyBuyGoods(openID, 0);
}
} catch (Exception e) {
logger.error("selectAllMyBuyGoods--> error:{}:", e);
}
if (mybuylist != null && mybuylist.size() != 0) {//假如查询到我买的商品返回
json.put("mybuylist", mybuylist);
return json;
} else {//没查询到我买的商品返回空
json.put("mybuylist", null);
return json;
}
}
//我发布的商品信息
@PostMapping("selectAllMyPublishGoods")
@ResponseBody
public JSONObject selectAllMyPublishGoods(String openID, Integer currentPage) {
JSONObject json = new JSONObject();
List<Goods> mypublishlist = null;
try {
if (currentPage != null) {//查询我发布的商品信息
mypublishlist = goodsService.selectAllMyPublishGoods(openID, (currentPage - 1) * 10);
} else {
mypublishlist = goodsService.selectAllMyPublishGoods(openID, 0);
}
} catch (Exception e) {
logger.error("selectAllMyPublishGoods--> error:{}:", e);
}
if (mypublishlist != null && mypublishlist.size() != 0) {//假如查询到我发布的商品返回
json.put("mypublishlist", mypublishlist);
return json;
} else {//没查询到我发布的商品返回空
json.put("mypublishlist", null);
return json;
}
}
//上传商品
@PostMapping("uploadGoods")
@ResponseBody
public JSONObject uploadGoods(@ModelAttribute("goods") Goods goods, String[] myfile,
@RequestParam(value = "openID", required = true) String openID) {
JSONObject json = new JSONObject();
//获取随机数
Random rand = new Random();
//拼接url
StringBuffer newNames = new StringBuffer();
// 存储图片的物理路径
String file_path = "//opt//pic";
Integer stringSize = myfile.length;
// 解析Base64
for (String file : myfile) {//校验
String dataPrefix;
String suffix;
if (file == null || "".equals(file)) {
json.put("error", "上传失败,上传图片数据为空!");
json.put("status", false);
return json;
} else {
String[] d = file.split("base64+");
if (d != null && d.length == 2) {
dataPrefix = d[0];////data:img/jpg;base64
} else {
json.put("error", "上传失败,数据不合法!");
json.put("status", false);
return json;
}
}
if ("data:image/jpeg;".equalsIgnoreCase(dataPrefix)) {//data:image/jpeg;base64,base64编码的jpeg图片数据
suffix = ".jpg";
} else if ("data:image/jpg;".equalsIgnoreCase(dataPrefix)) {//data:image/jpeg;base64,base64编码的jpg图片数据
suffix = ".jpg";
} else if ("data:image/x-icon;".equalsIgnoreCase(dataPrefix)) {//data:image/x-icon;base64,base64编码的icon图片数据
suffix = ".ico";
} else if ("data:image/gif;".equalsIgnoreCase(dataPrefix)) {//data:image/gif;base64,base64编码的gif图片数据
suffix = ".gif";
} else if ("data:image/png;".equalsIgnoreCase(dataPrefix)) {//data:image/png;base64,base64编码的png图片数据
suffix = ".png";
} else {
json.put("error", "上传图片格式不合法!");
json.put("status", false);
return json;
}
// 解析Base64 重新命名
MultipartFile multipartFile = Base64Util.base64ToMultipart(file);
//将内存中的数据写入磁盘
String transName;
transName = (rand.nextInt(9999999) + 100000) + openID +
multipartFile.getName().replaceAll(".+\\.", System.currentTimeMillis() + ".");
newNames.append(transName + ",");
// 将内存中的数据写入磁盘
File newName = new File(file_path + "/" + transName);
try {
multipartFile.transferTo(newName);
} catch (IOException e) {
logger.error("IOException", e.getMessage());
json.put("error", "图片存入服务器失败!");
json.put("status", false);
return json;
}
}
// 上传图片
goods.setImage(newNames.toString().substring(0, newNames.toString().length() - 1));
goods.setStatus(0);
//获取系统时间
Date createTime = new java.sql.Date(new java.util.Date().getTime());
goods.setCreateTime(createTime);
boolean flag = false;
flag = goodsService.uploadGoods(goods);
if (flag == false) {
json.put("status", false);
return json;
}
json.put("status", true);
return json;
}
}
| 13,178 | 0.560681 | 0.550814 | 316 | 37.487343 | 27.797239 | 167 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.734177 | false | false | 4 |
bb88702ad00c20f6b65bb6b128e7b7e8a8943041 | 4,638,564,707,452 | cdf71f9bb8e2147216733d5fb37a9b8e991c1de1 | /OOP/warGameImplementation/Card.java | c6dbf37a98093fc8a9940d255a3d928e2f22960f | [] | no_license | petkata/ItTalents | https://github.com/petkata/ItTalents | 5a14a8138fc13dd0af17ec624de9495e337b172c | 46ebaaa405a4c5351c90cc47a077c431c3b86836 | refs/heads/master | 2021-01-10T05:33:31.374000 | 2016-02-20T18:04:23 | 2016-02-20T18:04:23 | 44,908,773 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package warGameImplementation;
public class Card {
private String strength;
private String suit;
private int power;
public Card(String strength, String suit) {
this.strength = strength;
this.suit = suit;
}
void setPower(int power) {
this.power = power;
}
public String printInfo() {
return strength + " " + suit;
}
public boolean warWith(Card c2) {
return this.power == c2.power;
}
public boolean greater(Card c2) {
return this.power > c2.power;
}
}
| UTF-8 | Java | 488 | java | Card.java | Java | [] | null | [] | package warGameImplementation;
public class Card {
private String strength;
private String suit;
private int power;
public Card(String strength, String suit) {
this.strength = strength;
this.suit = suit;
}
void setPower(int power) {
this.power = power;
}
public String printInfo() {
return strength + " " + suit;
}
public boolean warWith(Card c2) {
return this.power == c2.power;
}
public boolean greater(Card c2) {
return this.power > c2.power;
}
}
| 488 | 0.678279 | 0.670082 | 30 | 15.266666 | 14.097123 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.366667 | false | false | 4 |
57a667e853c618257a7a11eae7f7afac3c1ecab6 | 20,151,986,578,537 | 82c90caf086d55b7969449ff3485713f9be02793 | /ehome-report/ehome-report-service/src/main/java/report/java/echarts/series/Gauge.java | bc16bf20d0f16b1572363f42bbea1db0c316cac2 | [] | no_license | hebbaixue99/ehome-report | https://github.com/hebbaixue99/ehome-report | 0c3ff5c1575f84b2cfa292dfe4b7ad0e197c5b6b | c37dc2ee59209d455c8b125040520c2f13c250c0 | refs/heads/master | 2020-03-30T07:36:01.480000 | 2018-09-30T09:13:47 | 2018-09-30T09:31:23 | 150,951,723 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package report.java.echarts.series;
import report.java.echarts.Label;
import report.java.echarts.Title;
import report.java.echarts.axis.AxisTick;
import report.java.echarts.axis.SplitLine;
import report.java.echarts.code.SeriesType;
import report.java.echarts.series.gauge.Detail;
import report.java.echarts.series.gauge.Pointer;
public class Gauge extends Series<Gauge>
{
private Object[] center;
private Object radius;
private Integer startAngle;
private Integer endAngle;
private Integer min;
private Integer max;
private Integer precision;
private Integer splitNumber;
private Line axisLine;
private AxisTick axisTick;
private Label axisLabel;
private SplitLine splitLine;
private Pointer pointer;
private Title title;
private Detail detail;
public Gauge()
{
type(SeriesType.gauge);
}
public Gauge(String name)
{
super(name);
type(SeriesType.gauge);
}
public Object[] center()
{
return this.center;
}
public Gauge center(Object[] center)
{
this.center = center;
return this;
}
public Object radius()
{
return this.radius;
}
public Gauge axisLine(Line axisLine)
{
this.axisLine = axisLine;
return this;
}
public Gauge axisTick(AxisTick axisTick)
{
this.axisTick = axisTick;
return this;
}
public Gauge axisLabel(Label axisLabel)
{
this.axisLabel = axisLabel;
return this;
}
public Gauge splitLine(SplitLine splitLine)
{
this.splitLine = splitLine;
return this;
}
public Gauge pointer(Pointer pointer)
{
this.pointer = pointer;
return this;
}
public Gauge title(Title title)
{
this.title = title;
return this;
}
public Gauge detail(Detail detail)
{
this.detail = detail;
return this;
}
public Gauge center(Object width, Object height)
{
this.center = new Object[] { width, height };
return this;
}
public Gauge radius(Object radius)
{
this.radius = radius;
return this;
}
public Gauge radius(Object width, Object height)
{
this.radius = new Object[] { width, height };
return this;
}
public Integer startAngle()
{
return this.startAngle;
}
public Gauge startAngle(Integer startAngle)
{
this.startAngle = startAngle;
return this;
}
public Integer endAngle()
{
return this.endAngle;
}
public Gauge endAngle(Integer endAngle)
{
this.endAngle = endAngle;
return this;
}
public Integer min()
{
return this.min;
}
public Gauge min(Integer min)
{
this.min = min;
return this;
}
public Integer max()
{
return this.max;
}
public Gauge max(Integer max)
{
this.max = max;
return this;
}
public Integer precision()
{
return this.precision;
}
public Gauge precision(Integer precision)
{
this.precision = precision;
return this;
}
public Integer splitNumber()
{
return this.splitNumber;
}
public Gauge splitNumber(Integer splitNumber)
{
this.splitNumber = splitNumber;
return this;
}
public Line axisLine()
{
if (this.axisLine == null) {
this.axisLine = new Line();
}
return this.axisLine;
}
public AxisTick axisTick()
{
if (this.axisTick == null) {
this.axisTick = new AxisTick();
}
return this.axisTick;
}
public Label axisLabel()
{
if (this.axisLabel == null) {
this.axisLabel = new Label();
}
return this.axisLabel;
}
public SplitLine splitLine()
{
if (this.splitLine == null) {
this.splitLine = new SplitLine();
}
return this.splitLine;
}
public Pointer pointer()
{
if (this.pointer == null) {
this.pointer = new Pointer();
}
return this.pointer;
}
public Title title()
{
if (this.title == null) {
this.title = new Title();
}
return this.title;
}
public Detail detail()
{
if (this.detail == null) {
this.detail = new Detail();
}
return this.detail;
}
public Object[] getCenter()
{
return this.center;
}
public void setCenter(Object[] center)
{
this.center = center;
}
public Object getRadius()
{
return this.radius;
}
public void setRadius(Object radius)
{
this.radius = radius;
}
public Line getAxisLine()
{
return this.axisLine;
}
public void setAxisLine(Line axisLine)
{
this.axisLine = axisLine;
}
public AxisTick getAxisTick()
{
return this.axisTick;
}
public void setAxisTick(AxisTick axisTick)
{
this.axisTick = axisTick;
}
public Label getAxisLabel()
{
return this.axisLabel;
}
public void setAxisLabel(Label axisLabel)
{
this.axisLabel = axisLabel;
}
public SplitLine getSplitLine()
{
return this.splitLine;
}
public void setSplitLine(SplitLine splitLine)
{
this.splitLine = splitLine;
}
public Pointer getPointer()
{
return this.pointer;
}
public void setPointer(Pointer pointer)
{
this.pointer = pointer;
}
public Title getTitle()
{
return this.title;
}
public void setTitle(Title title)
{
this.title = title;
}
public Detail getDetail()
{
return this.detail;
}
public void setDetail(Detail detail)
{
this.detail = detail;
}
public Integer getStartAngle()
{
return this.startAngle;
}
public void setStartAngle(Integer startAngle)
{
this.startAngle = startAngle;
}
public Integer getEndAngle()
{
return this.endAngle;
}
public void setEndAngle(Integer endAngle)
{
this.endAngle = endAngle;
}
public Integer getMin()
{
return this.min;
}
public void setMin(Integer min)
{
this.min = min;
}
public Integer getMax()
{
return this.max;
}
public void setMax(Integer max)
{
this.max = max;
}
public Integer getPrecision()
{
return this.precision;
}
public void setPrecision(Integer precision)
{
this.precision = precision;
}
public Integer getSplitNumber()
{
return this.splitNumber;
}
public void setSplitNumber(Integer splitNumber)
{
this.splitNumber = splitNumber;
}
}
/*
* Qualified Name: report.java.echarts.series.Gauge
*
*/ | UTF-8 | Java | 6,631 | java | Gauge.java | Java | [] | null | [] | package report.java.echarts.series;
import report.java.echarts.Label;
import report.java.echarts.Title;
import report.java.echarts.axis.AxisTick;
import report.java.echarts.axis.SplitLine;
import report.java.echarts.code.SeriesType;
import report.java.echarts.series.gauge.Detail;
import report.java.echarts.series.gauge.Pointer;
public class Gauge extends Series<Gauge>
{
private Object[] center;
private Object radius;
private Integer startAngle;
private Integer endAngle;
private Integer min;
private Integer max;
private Integer precision;
private Integer splitNumber;
private Line axisLine;
private AxisTick axisTick;
private Label axisLabel;
private SplitLine splitLine;
private Pointer pointer;
private Title title;
private Detail detail;
public Gauge()
{
type(SeriesType.gauge);
}
public Gauge(String name)
{
super(name);
type(SeriesType.gauge);
}
public Object[] center()
{
return this.center;
}
public Gauge center(Object[] center)
{
this.center = center;
return this;
}
public Object radius()
{
return this.radius;
}
public Gauge axisLine(Line axisLine)
{
this.axisLine = axisLine;
return this;
}
public Gauge axisTick(AxisTick axisTick)
{
this.axisTick = axisTick;
return this;
}
public Gauge axisLabel(Label axisLabel)
{
this.axisLabel = axisLabel;
return this;
}
public Gauge splitLine(SplitLine splitLine)
{
this.splitLine = splitLine;
return this;
}
public Gauge pointer(Pointer pointer)
{
this.pointer = pointer;
return this;
}
public Gauge title(Title title)
{
this.title = title;
return this;
}
public Gauge detail(Detail detail)
{
this.detail = detail;
return this;
}
public Gauge center(Object width, Object height)
{
this.center = new Object[] { width, height };
return this;
}
public Gauge radius(Object radius)
{
this.radius = radius;
return this;
}
public Gauge radius(Object width, Object height)
{
this.radius = new Object[] { width, height };
return this;
}
public Integer startAngle()
{
return this.startAngle;
}
public Gauge startAngle(Integer startAngle)
{
this.startAngle = startAngle;
return this;
}
public Integer endAngle()
{
return this.endAngle;
}
public Gauge endAngle(Integer endAngle)
{
this.endAngle = endAngle;
return this;
}
public Integer min()
{
return this.min;
}
public Gauge min(Integer min)
{
this.min = min;
return this;
}
public Integer max()
{
return this.max;
}
public Gauge max(Integer max)
{
this.max = max;
return this;
}
public Integer precision()
{
return this.precision;
}
public Gauge precision(Integer precision)
{
this.precision = precision;
return this;
}
public Integer splitNumber()
{
return this.splitNumber;
}
public Gauge splitNumber(Integer splitNumber)
{
this.splitNumber = splitNumber;
return this;
}
public Line axisLine()
{
if (this.axisLine == null) {
this.axisLine = new Line();
}
return this.axisLine;
}
public AxisTick axisTick()
{
if (this.axisTick == null) {
this.axisTick = new AxisTick();
}
return this.axisTick;
}
public Label axisLabel()
{
if (this.axisLabel == null) {
this.axisLabel = new Label();
}
return this.axisLabel;
}
public SplitLine splitLine()
{
if (this.splitLine == null) {
this.splitLine = new SplitLine();
}
return this.splitLine;
}
public Pointer pointer()
{
if (this.pointer == null) {
this.pointer = new Pointer();
}
return this.pointer;
}
public Title title()
{
if (this.title == null) {
this.title = new Title();
}
return this.title;
}
public Detail detail()
{
if (this.detail == null) {
this.detail = new Detail();
}
return this.detail;
}
public Object[] getCenter()
{
return this.center;
}
public void setCenter(Object[] center)
{
this.center = center;
}
public Object getRadius()
{
return this.radius;
}
public void setRadius(Object radius)
{
this.radius = radius;
}
public Line getAxisLine()
{
return this.axisLine;
}
public void setAxisLine(Line axisLine)
{
this.axisLine = axisLine;
}
public AxisTick getAxisTick()
{
return this.axisTick;
}
public void setAxisTick(AxisTick axisTick)
{
this.axisTick = axisTick;
}
public Label getAxisLabel()
{
return this.axisLabel;
}
public void setAxisLabel(Label axisLabel)
{
this.axisLabel = axisLabel;
}
public SplitLine getSplitLine()
{
return this.splitLine;
}
public void setSplitLine(SplitLine splitLine)
{
this.splitLine = splitLine;
}
public Pointer getPointer()
{
return this.pointer;
}
public void setPointer(Pointer pointer)
{
this.pointer = pointer;
}
public Title getTitle()
{
return this.title;
}
public void setTitle(Title title)
{
this.title = title;
}
public Detail getDetail()
{
return this.detail;
}
public void setDetail(Detail detail)
{
this.detail = detail;
}
public Integer getStartAngle()
{
return this.startAngle;
}
public void setStartAngle(Integer startAngle)
{
this.startAngle = startAngle;
}
public Integer getEndAngle()
{
return this.endAngle;
}
public void setEndAngle(Integer endAngle)
{
this.endAngle = endAngle;
}
public Integer getMin()
{
return this.min;
}
public void setMin(Integer min)
{
this.min = min;
}
public Integer getMax()
{
return this.max;
}
public void setMax(Integer max)
{
this.max = max;
}
public Integer getPrecision()
{
return this.precision;
}
public void setPrecision(Integer precision)
{
this.precision = precision;
}
public Integer getSplitNumber()
{
return this.splitNumber;
}
public void setSplitNumber(Integer splitNumber)
{
this.splitNumber = splitNumber;
}
}
/*
* Qualified Name: report.java.echarts.series.Gauge
*
*/ | 6,631 | 0.604735 | 0.604735 | 392 | 14.920918 | 14.88378 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.295918 | false | false | 4 |
4141c13907be7d2a85f52f66840fd77b2a2fed23 | 23,106,924,068,786 | 48db0ea589d04503ff6d2f9040decdf15805e0da | /Demo/Mall/src/main/java/com/Danny/Mall/mbg/model/UmsAdminPermissionRelation.java | 4f0210d9b96e40bf747851712449ddae1b0fb815 | [] | no_license | dannyCaiHaoming/JavaLanguage | https://github.com/dannyCaiHaoming/JavaLanguage | 641e178110f4a248c6754c43e870d56b8a5c0722 | 8afcdcb01c0eb44e6790135d102d7346981d1d6f | refs/heads/main | 2023-03-05T02:56:29.753000 | 2021-02-20T11:26:26 | 2021-02-20T11:26:26 | 326,982,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.Danny.Mall.mbg.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
public class UmsAdminPermissionRelation implements Serializable {
private Long id;
private Long admin_id;
private Long permission_id;
private Integer type;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAdmin_id() {
return admin_id;
}
public void setAdmin_id(Long admin_id) {
this.admin_id = admin_id;
}
public Long getPermission_id() {
return permission_id;
}
public void setPermission_id(Long permission_id) {
this.permission_id = permission_id;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", admin_id=").append(admin_id);
sb.append(", permission_id=").append(permission_id);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | UTF-8 | Java | 1,455 | java | UmsAdminPermissionRelation.java | Java | [] | null | [] | package com.Danny.Mall.mbg.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
public class UmsAdminPermissionRelation implements Serializable {
private Long id;
private Long admin_id;
private Long permission_id;
private Integer type;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAdmin_id() {
return admin_id;
}
public void setAdmin_id(Long admin_id) {
this.admin_id = admin_id;
}
public Long getPermission_id() {
return permission_id;
}
public void setPermission_id(Long permission_id) {
this.permission_id = permission_id;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", admin_id=").append(admin_id);
sb.append(", permission_id=").append(permission_id);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | 1,455 | 0.603436 | 0.602749 | 63 | 22.111111 | 19.407993 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.507937 | false | false | 4 |
9f1e4fa2a799e01b1a34db1542d8a5a3f0cae734 | 15,796,889,773,931 | 7ac44dd2ab05851a9717d77655c61bdab5d80526 | /my-microService/f1-permission/src/main/java/com/jb/organization/constant/DeptJmsType.java | cc09dbe21998eca42d866347c78667819643091c | [] | no_license | goldenxinxing/study | https://github.com/goldenxinxing/study | 792ffe7ef57b1e100d0785265a028d513b70818a | 1d34162463b78b8e11ee77fb85a6ad5de185cef8 | refs/heads/master | 2018-12-19T01:33:44.824000 | 2018-09-15T06:36:23 | 2018-09-15T06:36:23 | 148,875,628 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C), 北京中恒博瑞数字电力技术有限公司,保留所有权利.
* FileName: DeptJmsType.java
* History:
* <author> <time> <version> <desc>
* 许策 2013-7-9上午11:05:05 V1.0 部门枚举常量
*/
package com.jb.organization.constant;
/**
* @Package: com.jb.sys.service.impl.jms.constant<br>
* @ClassName: DeptJmsType<br>
* @Description: 部门枚举常量<br>
*/
public enum DeptJmsType {
build, success, fault
}
| UTF-8 | Java | 521 | java | DeptJmsType.java | Java | [] | null | [] | /*
* Copyright (C), 北京中恒博瑞数字电力技术有限公司,保留所有权利.
* FileName: DeptJmsType.java
* History:
* <author> <time> <version> <desc>
* 许策 2013-7-9上午11:05:05 V1.0 部门枚举常量
*/
package com.jb.organization.constant;
/**
* @Package: com.jb.sys.service.impl.jms.constant<br>
* @ClassName: DeptJmsType<br>
* @Description: 部门枚举常量<br>
*/
public enum DeptJmsType {
build, success, fault
}
| 521 | 0.585034 | 0.553288 | 17 | 24.941177 | 22.327694 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false | 4 |
7ac271a5a58f0d927f12544ea715780cdf81f8ef | 4,939,212,423,386 | aa35bcc9f61d65240882a1d4f5a971edd0c75658 | /pawddit/model/src/main/java/ar/edu/itba/pawddit/model/VoteCommentPK.java | c41de76def395961fffc020ed89cb8062414a55b | [] | no_license | matiheimann/tp-paw | https://github.com/matiheimann/tp-paw | 22cb8634da81cf56bca8778cb9625c10ce8229c3 | d4f991d7e92f73b9eb1fe1d07531eb79beabbae0 | refs/heads/master | 2022-12-24T21:30:05.968000 | 2019-07-10T21:11:52 | 2019-07-10T21:11:52 | 200,428,164 | 0 | 2 | null | false | 2022-12-16T07:46:36 | 2019-08-03T22:58:38 | 2019-08-03T23:00:46 | 2022-12-16T07:46:33 | 1,089 | 0 | 2 | 16 | Java | false | false | package ar.edu.itba.pawddit.model;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Embeddable
public class VoteCommentPK implements Serializable {
private static final long serialVersionUID = 1L;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "userid")
private User user;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "commentid")
private Comment comment;
/* package */ VoteCommentPK() {
// Just for Hibernate, we love you!
}
public VoteCommentPK(final User user, final Comment comment) {
this.user = user;
this.comment = comment;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Comment getComment() {
return comment;
}
public void setComment(Comment comment) {
this.comment = comment;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass())
return false;
VoteCommentPK that = (VoteCommentPK) o;
return Objects.equals(user, that.user) &&
Objects.equals(comment, that.comment);
}
@Override
public int hashCode() {
return Objects.hash(user, comment);
}
}
| UTF-8 | Java | 1,424 | java | VoteCommentPK.java | Java | [] | null | [] | package ar.edu.itba.pawddit.model;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Embeddable
public class VoteCommentPK implements Serializable {
private static final long serialVersionUID = 1L;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "userid")
private User user;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "commentid")
private Comment comment;
/* package */ VoteCommentPK() {
// Just for Hibernate, we love you!
}
public VoteCommentPK(final User user, final Comment comment) {
this.user = user;
this.comment = comment;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Comment getComment() {
return comment;
}
public void setComment(Comment comment) {
this.comment = comment;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass())
return false;
VoteCommentPK that = (VoteCommentPK) o;
return Objects.equals(user, that.user) &&
Objects.equals(comment, that.comment);
}
@Override
public int hashCode() {
return Objects.hash(user, comment);
}
}
| 1,424 | 0.676966 | 0.676264 | 66 | 20.575758 | 18.584827 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.045455 | false | false | 4 |
2586ead35a3391539ddd68fe90d24a9ae6d4093f | 4,939,212,421,824 | 05254ee9b0c7b834faf2badc8441b6052097b976 | /Exceptions/src/ru/itpark/unchecked/MainArithmeticException.java | 7535a9d3f465243e54eed4cf05c1bc71744d5318 | [] | no_license | MarselSidikov/JAVA_IT_PARK_WORK | https://github.com/MarselSidikov/JAVA_IT_PARK_WORK | 400380280945f854da7cd3c1401cc8f93809df3b | 6b72549532eaa6d5c8bca3d6bcef042090c28241 | refs/heads/master | 2021-01-20T08:37:13.590000 | 2017-07-08T17:57:20 | 2017-07-08T17:57:20 | 83,909,899 | 3 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.itpark.unchecked;
import java.util.Scanner;
public class MainArithmeticException {
public static int div(int a, int b) {
if (b == 0) {
throw new ArithmeticException("НА НОЛЬ ДЕЛИШЬ!!");
} else {
return a / b;
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("Введите, пожалуйста, два числа");
int a = scanner.nextInt();
int b = scanner.nextInt();
try {
int result = div(a, b);
System.out.println(result);
} catch (ArithmeticException e) {
System.err.println("Деление на ноль в " + e.getStackTrace()[0]);
}
}
}
}
| UTF-8 | Java | 860 | java | MainArithmeticException.java | Java | [] | null | [] | package ru.itpark.unchecked;
import java.util.Scanner;
public class MainArithmeticException {
public static int div(int a, int b) {
if (b == 0) {
throw new ArithmeticException("НА НОЛЬ ДЕЛИШЬ!!");
} else {
return a / b;
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("Введите, пожалуйста, два числа");
int a = scanner.nextInt();
int b = scanner.nextInt();
try {
int result = div(a, b);
System.out.println(result);
} catch (ArithmeticException e) {
System.err.println("Деление на ноль в " + e.getStackTrace()[0]);
}
}
}
}
| 860 | 0.515451 | 0.512979 | 31 | 25.096775 | 21.682987 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.483871 | false | false | 4 |
3de91c89f83b211177671d052216f0e0ff843944 | 29,128,468,240,690 | cfe0816ad0865f21d57ef311d18fe503737c3703 | /Debug-Me/QuizMasterTest.java | 0be823d4ff7a4cc0375cbdf2fead89c95ff1e809 | [
"MIT"
] | permissive | bucioj/cs-code-practice | https://github.com/bucioj/cs-code-practice | 08a4737a067515bac6b7234e0b75bf9d47df1347 | 2a69004193df95191a76382529ea97aa3caef19c | refs/heads/master | 2021-09-07T05:11:51.849000 | 2018-02-17T22:06:15 | 2018-02-17T22:06:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import junit.framework.TestCase;
/**
* You do not need to modify this file.
* However, it is worthwhile reading the test input and expected output for each test case
* @author angrave
*
*/
public class QuizMasterTest extends TestCase {
public static void testMichiganStudent() {
String input = "48502\n2\n1\n2\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:0\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testMichiganStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public static void testIllinoisStudent() {
String input = "61802\n1\n1\n1\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:40\nCongratulations!\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testIllinoisStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public static void testMichiganPhDStudent() {
String input = "48502\n1\n1\n1\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:40\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testMichiganPhDStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public static void testWisconsinStudent() {
String input = "53701\n1\n2\n3\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:20\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testWisconsinStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public void testAuthorship() {
boolean success = CheckInputOutput.checkAuthorship("QuizMaster.java");
if (!success)
fail("Fix @authorship");
}
public void tearDown() {
CheckInputOutput.resetInputOutput();
}
}
| UTF-8 | Java | 4,961 | java | QuizMasterTest.java | Java | [
{
"context": " and expected output for each test case\n * @author angrave\n *\n */\npublic class QuizMasterTest extends TestCa",
"end": 188,
"score": 0.9995925426483154,
"start": 181,
"tag": "USERNAME",
"value": "angrave"
}
] | null | [] |
import junit.framework.TestCase;
/**
* You do not need to modify this file.
* However, it is worthwhile reading the test input and expected output for each test case
* @author angrave
*
*/
public class QuizMasterTest extends TestCase {
public static void testMichiganStudent() {
String input = "48502\n2\n1\n2\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:0\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testMichiganStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public static void testIllinoisStudent() {
String input = "61802\n1\n1\n1\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:40\nCongratulations!\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testIllinoisStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public static void testMichiganPhDStudent() {
String input = "48502\n1\n1\n1\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:40\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testMichiganPhDStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public static void testWisconsinStudent() {
String input = "53701\n1\n2\n3\n1\n";
String requiredOutput =
"Please enter your zip code.\n" +
"Which University CS Department was recently awarded $208 million to develop the worlds fastest computer?\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. MIT\n" +
"Which University CS Department designed and built the pioneering ILLIAC series?\n" +
"1. Illinois\n" +
"2. Wisconsin\n" +
"3. Berkeley\n" +
"Which University released 'Mosaic' - the first multimedia cross-platform browser?\n" +
"(Mosaic's source code was later licensed to Microsoft and Netscape Communications)\n" +
"1. Illinois\n" +
"2. Michigan\n" +
"3. Wisconsin\n" +
"True/False? Variables have four things: a type, name, value and a memory location.\n" +
"1. True\n" +
"2. False\n" +
"You scored:20\n";
CheckInputOutput.setInputCaptureOutput(input);
QuizMaster.main(new String[0]);
int line = CheckInputOutput.checkCompleteOutput(requiredOutput,"testWisconsinStudent");
if (line > 0)
fail("Review incorrect output on line " + line);
}
public void testAuthorship() {
boolean success = CheckInputOutput.checkAuthorship("QuizMaster.java");
if (!success)
fail("Fix @authorship");
}
public void tearDown() {
CheckInputOutput.resetInputOutput();
}
}
| 4,961 | 0.685144 | 0.663576 | 137 | 35.20438 | 30.893066 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.547445 | false | false | 4 |
7927108388fc0592ea410e3d1786e57515c6ba69 | 27,084,063,785,288 | 935ba695d6e44e744b01aafcc111604c24a26eab | /src/main/java/Port.java | 012b4eeb848822530f340806070f452fe47ca313 | [] | no_license | wcallag3/network-costing-tool | https://github.com/wcallag3/network-costing-tool | 1e4568cb3b25e58cf1226471098d8de897590024 | 5ab2f1f7831bf60dced5f808ac93a2fa557f3097 | refs/heads/master | 2016-09-26T11:35:51.621000 | 2015-04-08T16:34:30 | 2015-04-08T16:34:30 | 32,047,071 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main.java;
import java.text.DecimalFormat;
public class Port {
private double trafficConsumed;
private double portCapacity;
private double portUtilizationPercent;
public Port(double portCapacity)
{
this.portCapacity = portCapacity;
portUtilizationPercent = 0;
trafficConsumed = 0;
}
// Getters
public double getTrafficConsumed()
{
return trafficConsumed;
}
public double getPortCapacity()
{
return portCapacity;
}
public double getPortUtilizationPercent()
{
return portUtilizationPercent;
}
public boolean isFree()
{
if(portUtilizationPercent != 100.00)
{
return true;
}
else
{
return false;
}
}
// Setters
public void setTrafficConsumed(double totalTraffic)
{
double temp;
trafficConsumed = totalTraffic;
temp = (trafficConsumed/portCapacity)*100.00;
portUtilizationPercent = Utilities.RoundTo2Decimals(temp);
}
public void setPortUtilizationPercent(double percent)
{
double temp;
portUtilizationPercent = percent;
temp = portCapacity*(portUtilizationPercent/100.00);
trafficConsumed = Utilities.RoundTo2Decimals(temp);
}
public void addTrafficToPort(double toAdd)
{
double totalTraffic = trafficConsumed + toAdd;
setTrafficConsumed(totalTraffic);
}
public void updatePortCapacity(double newCapacity)
{
portCapacity = newCapacity;
portUtilizationPercent = trafficConsumed/portCapacity;
}
}
| UTF-8 | Java | 1,417 | java | Port.java | Java | [] | null | [] | package main.java;
import java.text.DecimalFormat;
public class Port {
private double trafficConsumed;
private double portCapacity;
private double portUtilizationPercent;
public Port(double portCapacity)
{
this.portCapacity = portCapacity;
portUtilizationPercent = 0;
trafficConsumed = 0;
}
// Getters
public double getTrafficConsumed()
{
return trafficConsumed;
}
public double getPortCapacity()
{
return portCapacity;
}
public double getPortUtilizationPercent()
{
return portUtilizationPercent;
}
public boolean isFree()
{
if(portUtilizationPercent != 100.00)
{
return true;
}
else
{
return false;
}
}
// Setters
public void setTrafficConsumed(double totalTraffic)
{
double temp;
trafficConsumed = totalTraffic;
temp = (trafficConsumed/portCapacity)*100.00;
portUtilizationPercent = Utilities.RoundTo2Decimals(temp);
}
public void setPortUtilizationPercent(double percent)
{
double temp;
portUtilizationPercent = percent;
temp = portCapacity*(portUtilizationPercent/100.00);
trafficConsumed = Utilities.RoundTo2Decimals(temp);
}
public void addTrafficToPort(double toAdd)
{
double totalTraffic = trafficConsumed + toAdd;
setTrafficConsumed(totalTraffic);
}
public void updatePortCapacity(double newCapacity)
{
portCapacity = newCapacity;
portUtilizationPercent = trafficConsumed/portCapacity;
}
}
| 1,417 | 0.743825 | 0.730416 | 79 | 16.936708 | 18.444128 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.594937 | false | false | 4 |
2081381be68c0f1821f3f10834143d2389d66958 | 18,519,899,006,772 | 1d9b20e84384f06d20ce7d86fffca926b723ae74 | /ProvaTecnicas/src/Controllers/CidadesController.java | 931c3e0be478bb35b2c2bec71a6c1289c0d5b0b0 | [] | no_license | GustavoSMelo/PlaygroundLab | https://github.com/GustavoSMelo/PlaygroundLab | 5eb8ce901423286c3ba99fb1d76f4198c30ca762 | 7289aedb1a775b9f7d8f7de018f74146fd0c5381 | refs/heads/master | 2023-01-23T19:04:07.712000 | 2021-05-18T01:51:41 | 2021-05-18T01:51:41 | 249,887,400 | 1 | 0 | null | false | 2023-01-09T23:03:11 | 2020-03-25T04:33:14 | 2021-07-24T02:14:04 | 2023-01-09T23:03:11 | 10,656 | 1 | 0 | 11 | PHP | false | false | package Controllers;
import java.util.ArrayList;
import java.sql.*;
import Config.Config;
public final class CidadesController {
Config conf = new Config();
public ArrayList<String> index(String sigla){
Connection con = conf.getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try{
ps = con.prepareStatement("SELECT * FROM cidade WHERE sigla = ?");
ps.setString(1, sigla);
rs = ps.executeQuery();
ArrayList<String> city = new ArrayList<>();
while(rs.next()){
city.add(rs.getString("nome"));
}
return city;
}catch(SQLException err){
throw new RuntimeException("Error in get all cities with this state ");
}finally{
conf.closeConnection(con, ps, rs);
}
}
}
| UTF-8 | Java | 917 | java | CidadesController.java | Java | [] | null | [] | package Controllers;
import java.util.ArrayList;
import java.sql.*;
import Config.Config;
public final class CidadesController {
Config conf = new Config();
public ArrayList<String> index(String sigla){
Connection con = conf.getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try{
ps = con.prepareStatement("SELECT * FROM cidade WHERE sigla = ?");
ps.setString(1, sigla);
rs = ps.executeQuery();
ArrayList<String> city = new ArrayList<>();
while(rs.next()){
city.add(rs.getString("nome"));
}
return city;
}catch(SQLException err){
throw new RuntimeException("Error in get all cities with this state ");
}finally{
conf.closeConnection(con, ps, rs);
}
}
}
| 917 | 0.539804 | 0.538713 | 33 | 26.787878 | 20.386801 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575758 | false | false | 4 |
329c9d47e89337b16d593c10528563836a539b9f | 32,744,830,679,915 | c5ea9bf9e2b4a6ab81d98acaeec2e1302f80b4b7 | /src/main/java/progetto/view/commandline/IExecutible.java | 585ab309f3af9d570bf3fc5539fa6e6bbd8493a3 | [] | no_license | michelegatti5/Sagrada | https://github.com/michelegatti5/Sagrada | a8a903a7748a0eb6eb2e1cb10fef2b07d3fa5d21 | 5c4c373ccccd0c28f4415faa0c32178c6fca9acd | refs/heads/master | 2020-09-25T19:20:30.991000 | 2019-12-05T11:00:15 | 2019-12-05T11:00:15 | 226,068,716 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package progetto.view.commandline;
/**
* Use to communicate with stream processor
* @author Federica
*/
public interface IExecutible {
/**
*
* @param params input
* @return evaluated string
*/
String execute(String params);
}
| UTF-8 | Java | 240 | java | IExecutible.java | Java | [
{
"context": "se to communicate with stream processor\n * @author Federica\n */\npublic interface IExecutible {\n\t/**\n\t *\n\t * @",
"end": 103,
"score": 0.9997437596321106,
"start": 95,
"tag": "NAME",
"value": "Federica"
}
] | null | [] | package progetto.view.commandline;
/**
* Use to communicate with stream processor
* @author Federica
*/
public interface IExecutible {
/**
*
* @param params input
* @return evaluated string
*/
String execute(String params);
}
| 240 | 0.695833 | 0.695833 | 14 | 16.142857 | 14.520218 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 4 |
0522a214c17e0d83a6f5aa549939ca222dfa116c | 26,534,308,021,800 | 78a9cc86a7462533685acecd02d260016e5e88da | /src/MaximumLevelSumOfABinaryTree.java | 36ce8ae22cd85e9df3e8a17202bbad0a365a594d | [] | no_license | AkshatShukla/LeetCode | https://github.com/AkshatShukla/LeetCode | 7fdf7bd3d7cbaee32ab5a871673734f1cfac49db | 05e1db768bc83e1cc1c092a0b93f63b19666cf32 | refs/heads/master | 2020-05-07T11:34:00.045000 | 2019-10-12T22:31:25 | 2019-10-12T22:31:25 | 180,466,256 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.LinkedList;
import java.util.Queue;
public class MaximumLevelSumOfABinaryTree {
public static int maxLevelSum(TreeNode root) {
// do BFS and update the max at each level
int maxSum = Integer.MIN_VALUE;
int ans = 0;
if (root == null) {
return 0;
}
Queue<TreeNode> queue = new LinkedList<>();
queue.offer(root);
int level = 0;
while (!queue.isEmpty()) {
int levelNodes = queue.size();
int levelSum = 0;
for (int i = 0; i < levelNodes; i++) {
TreeNode currNode = queue.poll();
levelSum += currNode.val;
if (currNode.left != null) {
queue.offer(currNode.left);
}
if (currNode.right != null) {
queue.offer(currNode.right);
}
}
level++;
if (levelSum > maxSum) {
maxSum = levelSum;
ans = level;
}
}
return ans;
}
public static void main(String[] args) {
TreeNode one = new TreeNode(1);
TreeNode seven = new TreeNode(7);
TreeNode zero = new TreeNode(0);
TreeNode seven1 = new TreeNode(7);
TreeNode eight = new TreeNode(-8);
one.left = seven;
one.right = zero;
seven.left = seven1;
seven.right = eight;
System.out.println(maxLevelSum(one));
/*
Level 1 sum = 1.
Level 2 sum = 7 + 0 = 7.
Level 3 sum = 7 + -8 = -1.
So we return the level with the maximum sum which is level 2.
*/
}
}
| UTF-8 | Java | 1,690 | java | MaximumLevelSumOfABinaryTree.java | Java | [] | null | [] | import java.util.LinkedList;
import java.util.Queue;
public class MaximumLevelSumOfABinaryTree {
public static int maxLevelSum(TreeNode root) {
// do BFS and update the max at each level
int maxSum = Integer.MIN_VALUE;
int ans = 0;
if (root == null) {
return 0;
}
Queue<TreeNode> queue = new LinkedList<>();
queue.offer(root);
int level = 0;
while (!queue.isEmpty()) {
int levelNodes = queue.size();
int levelSum = 0;
for (int i = 0; i < levelNodes; i++) {
TreeNode currNode = queue.poll();
levelSum += currNode.val;
if (currNode.left != null) {
queue.offer(currNode.left);
}
if (currNode.right != null) {
queue.offer(currNode.right);
}
}
level++;
if (levelSum > maxSum) {
maxSum = levelSum;
ans = level;
}
}
return ans;
}
public static void main(String[] args) {
TreeNode one = new TreeNode(1);
TreeNode seven = new TreeNode(7);
TreeNode zero = new TreeNode(0);
TreeNode seven1 = new TreeNode(7);
TreeNode eight = new TreeNode(-8);
one.left = seven;
one.right = zero;
seven.left = seven1;
seven.right = eight;
System.out.println(maxLevelSum(one));
/*
Level 1 sum = 1.
Level 2 sum = 7 + 0 = 7.
Level 3 sum = 7 + -8 = -1.
So we return the level with the maximum sum which is level 2.
*/
}
}
| 1,690 | 0.485799 | 0.472189 | 56 | 29.178572 | 15.882501 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.535714 | false | false | 4 |
62d18caa1fadf7bd02330510c3e5a778af97e41e | 21,758,304,369,907 | e3b5370b4024ff0f8477e3f8351baabedeb4577f | /ChessGUI.java | ee8731dc558855dc7d817e283fb326f77eb9c83d | [] | no_license | jacelaquerre/GameOfChess | https://github.com/jacelaquerre/GameOfChess | 1e1faec9498fc213db9c47920a52d61673c1edbb | 399cc4f0b81318fd66ff568cb5b143794faf7154 | refs/heads/master | 2021-04-18T09:34:31.571000 | 2020-04-27T19:23:11 | 2020-04-27T19:23:11 | 249,530,296 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
Chess Game GUI
Interactive display for Chess game
*/
import javafx.application.Application;
import javafx.scene.paint.Paint;
import javafx.scene.text.TextAlignment;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.input.MouseEvent;
import javafx.event.EventHandler;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.geometry.Pos;
import javafx.geometry.Insets;
import javafx.scene.paint.Color;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import javafx.util.Duration;
import java.util.ArrayList;
// TODO: Find out why second scene is moved off center and correct it
public class ChessGUI extends Application {
private Game game; // The game
private GridPane gameBoard; // grid of boxes
private VBox whiteTimer, blackTimer, entryPane;
private HBox computerGame, playerGame;
private Text whiteTime, blackTime;
private Text whiteLabel, blackLabel;
private Text endingMessage;
private int wMins = 10, wSecs = 0, bMins = 10, bSecs = 0;
private Timeline whiteClockTimeline, blackClockTimeline, aiMove;
private ArrayList<BoxPane> selected;
private Scene gameScene, activeScene;
private Boolean p1vp2; // Whether or not the game is player 1 vs. player 2
private Piece.Color choice; // color user chooses to play as
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Chess Game");
/* ******************************* Entry Scene ******************************************* */
Text computerGameLabel = new Text("Player 1\nvs.\nComputer");
Text playerGameLabel = new Text("Player 1\nvs.\nPlayer 2");
computerGameLabel.setTextAlignment(TextAlignment.CENTER);
computerGameLabel.setFont(new Font(20));
computerGameLabel.setFill(Paint.valueOf("#eeeeee"));
playerGameLabel.setTextAlignment(TextAlignment.CENTER);
playerGameLabel.setFont(new Font(20));
playerGameLabel.setFill(Paint.valueOf("#eeeeee"));
Text entryTitle = new Text(" New Game? ");
entryTitle.setFont(new Font(50));
entryTitle.setFill(Paint.valueOf("#35414a"));
computerGame = new HBox();
computerGame.setAlignment(Pos.CENTER);
computerGame.setStyle("-fx-background-color: #35414a;");
computerGame.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
computerGame.setStyle("-fx-background-color: #6d7c7b;" + "-fx-border-color: #d88888;" + "-fx-border-width: 5");
}
});
computerGame.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
computerGame.setStyle("-fx-background-color: #35414a;");
}
});
playerGame = new HBox();
playerGame.setAlignment(Pos.CENTER);
playerGame.setStyle("-fx-background-color: #35414a;");
playerGame.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
playerGame.setStyle("-fx-background-color: #6d7c7b;" + "-fx-border-color: #d88888;" + "-fx-border-width: 5");
}
});
playerGame.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
playerGame.setStyle("-fx-background-color: #35414a;");
}
});
computerGame.getChildren().add(computerGameLabel);
playerGame.getChildren().add(playerGameLabel);
computerGame.setPadding(new Insets(10,10,10,10));
computerGame.setMinSize(120,120);
playerGame.setPadding(new Insets(10,10,10,10));
playerGame.setMinSize(120,120);
HBox buttons = new HBox(30);
buttons.setAlignment(Pos.CENTER);
buttons.setPadding(new Insets(10,10,10,10));
buttons.getChildren().addAll(computerGame, playerGame);
computerGame.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
p1vp2 = false;
Text prompt = new Text("");
prompt.setFont(new Font(50));
prompt.setTextAlignment(TextAlignment.CENTER);
HBox blackBox = new HBox();
blackBox.setAlignment(Pos.CENTER);
blackBox.setStyle("-fx-background-color: black;");
Text blackL = new Text("Black?");
blackL.setTextAlignment(TextAlignment.CENTER);
blackL.setFont(new Font(30));
blackL.setStyle("-fx-fill: white;");
blackBox.getChildren().add(blackL);
blackBox.setPadding(new Insets(10, 10, 10, 10));
blackBox.setMinSize(120, 120);
blackBox.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
blackBox.setStyle("-fx-background-color: grey;");
//blackL.setStyle("-fx-fill: black;");
}
});
blackBox.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
blackBox.setStyle("-fx-background-color: black;");
//blackL.setStyle("-fx-fill: white;");
}
});
blackBox.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
primaryStage.setScene(gameScene);
primaryStage.centerOnScreen();
activeScene = gameScene;
choice = Piece.Color.BLACK;
aiMove.play();
whiteClockTimeline.play();
}
});
HBox whiteBox = new HBox();
whiteBox.setAlignment(Pos.CENTER);
whiteBox.setStyle("-fx-background-color: white");
Text whiteL = new Text("White?");
whiteL.setTextAlignment(TextAlignment.CENTER);
whiteL.setFont(new Font(30));
whiteL.setStyle("-fx-fill: black;");
whiteBox.getChildren().add(whiteL);
whiteBox.setPadding(new Insets(10, 10, 10, 10));
whiteBox.setMinSize(120, 120);
whiteBox.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
whiteBox.setStyle("-fx-background-color: grey;");
}
});
whiteBox.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
whiteBox.setStyle("-fx-background-color: white;");
}
});
whiteBox.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
primaryStage.setScene(gameScene);
primaryStage.centerOnScreen();
activeScene = gameScene;
choice = Piece.Color.WHITE;
aiMove.play();
whiteClockTimeline.play();
}
});
buttons.getChildren().clear();
buttons.getChildren().addAll(blackBox, whiteBox);
entryPane.getChildren().clear();
entryPane.getChildren().addAll(prompt, buttons);
}
});
playerGame.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
p1vp2 = true;
primaryStage.setScene(gameScene);
primaryStage.centerOnScreen();
activeScene = gameScene;
whiteClockTimeline.play();
}
});
entryPane = new VBox(30);
entryPane.setStyle("-fx-background-color: #ffe7d9;");
entryPane.getChildren().addAll(entryTitle, buttons);
//entryPane.setMinSize(200,200);
Scene entryScene = new Scene(entryPane);
activeScene = entryScene;
/* ******************************* Main Scene ******************************************* */
// Set up Panes
// main layout
BorderPane main = new BorderPane();
VBox extra = new VBox(30);
extra.setStyle("-fx-background-color: #4f5a69;");
extra.setMinWidth(200);
extra.setPadding(new Insets(20, 20, 20, 20));
main.setLeft(extra);
VBox buttonPane = new VBox(30);
buttonPane.setPadding(new Insets(20,20,20,20));
buttonPane.setStyle("-fx-background-color: #7b5954;");
main.setRight(buttonPane);
gameBoard = new GridPane();
gameBoard.setStyle("-fx-background-color:#392f2a;" + "-fx-border-color: #392f2a;" + "-fx-border-width: 10;");
// Initialize game and draw Board
game = new Game();
drawBoard();
selected = new ArrayList<>();
main.setCenter(gameBoard);
// New Game Button
Button newGameBtn = new Button("New Game");
newGameBtn.setOnAction(this::newGame);
buttonPane.getChildren().add(newGameBtn);
// End Game Button
Button endGameBtn = new Button("End Game");
endGameBtn.setOnMouseClicked(this::handleEnd);
buttonPane.getChildren().add(endGameBtn);
// Set up timers
whiteTime = new Text("10:00");
whiteClockTimeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
changeTime(whiteTime, Piece.Color.WHITE);
checkPlayerStatus();
}
}));
whiteClockTimeline.setCycleCount(Timeline.INDEFINITE);
whiteClockTimeline.setAutoReverse(false);
whiteTimer = new VBox(10);
whiteTimer.setAlignment(Pos.CENTER);
whiteTimer.setPadding(new Insets(5,5,5,5));
whiteLabel = new Text("Player 1");
whiteTimer.getChildren().addAll(whiteLabel, whiteTime);
blackTime = new Text("10:00");
blackClockTimeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
changeTime(blackTime, Piece.Color.BLACK);
checkPlayerStatus();
}
}));
blackClockTimeline.setCycleCount(Timeline.INDEFINITE);
blackClockTimeline.setAutoReverse(false);
blackTimer = new VBox(10);
blackTimer.setAlignment(Pos.CENTER);
blackTimer.setPadding(new Insets(5,5,5,5));
blackLabel = new Text("Player 2");
blackTimer.getChildren().addAll(blackLabel, blackTime);
HBox timers = new HBox(10);
timers.setAlignment(Pos.CENTER);
timers.setStyle("-fx-background-color: #d1e5eb;" + "-fx-border-width:5;" + "-fx-border-color: #727a87;");
timers.setPadding(new Insets(10, 10, 10, 10));
timers.getChildren().addAll(whiteTimer, blackTimer);
extra.getChildren().add(timers);
checkPlayerStatus();
aiMove = new Timeline(new KeyFrame(Duration.seconds(5), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (choice == Piece.Color.WHITE && game.getCurrentTurn().getColor() == Piece.Color.BLACK) {
int[] move = game.getAiMove("b");
game.playerMove(game.getBlackPlayer(), game.getBoard().getBox(move[0], move[1]), game.getBoard().getBox(move[2], move[3]));
for (Node p : gameBoard.getChildren()) {
BoxPane bp = (BoxPane) (p);
if (bp.getCol() == move[1] && bp.getRow() == move[0]) {
bp.updated();
} else if (bp.getCol() == move[3] && bp.getRow() == move[2]) {
bp.updated();
}
}
}
if (choice == Piece.Color.BLACK && game.getCurrentTurn().getColor() == Piece.Color.WHITE) {
int[] move = game.getAiMove("w");
game.playerMove(game.getWhitePlayer(), game.getBoard().getBox(move[0], move[1]), game.getBoard().getBox(move[2], move[3]));
for (Node p : gameBoard.getChildren()) {
BoxPane bp = (BoxPane) (p);
if (bp.getCol() == move[1] && bp.getRow() == move[0]) {
bp.updated();
} else if (bp.getCol() == move[3] && bp.getRow() == move[2]) {
bp.updated();
}
}
}
}
}));
aiMove.setCycleCount(Timeline.INDEFINITE);
aiMove.setAutoReverse(false);
gameScene = new Scene(main);
HBox ending = new HBox();
endingMessage = new Text("");
endingMessage.setTextAlignment(TextAlignment.CENTER);
ending.getChildren().add(endingMessage);
ending.setAlignment(Pos.CENTER);
main.setBottom(ending);
// complete setup
primaryStage.setScene(activeScene);
primaryStage.centerOnScreen();
primaryStage.show();
}
/**
* Event handling for user clicking Box
* User should only be able to select one tile. Once another tile is clicked, if it is a valid move,
* the current piece moves there
*/
public void handleClick(MouseEvent e) {
if (activeScene == gameScene && (p1vp2 || choice == game.getCurrentTurn().getColor())) {
BoxPane bp = (BoxPane) (e.getSource());
// allow a user to un-select the piece
if (bp.isSelected()) {
bp.setSelected(false);
selected.remove(bp);
}
// if color of piece aligns with current team and no other piece is selected allow click
else if (bp.getBox().getPiece() != null && selected.isEmpty()) {
if (bp.getBox().getPiece().getColor() == Piece.Color.WHITE && game.getCurrentTurn() == game.getWhitePlayer()) {
bp.setSelected(true);
selected.add(bp);
} else if (bp.getBox().getPiece().getColor() == Piece.Color.BLACK && game.getCurrentTurn() == game.getBlackPlayer()) {
bp.setSelected(true);
selected.add(bp);
}
}
// if box is empty or holds an opponent piece check to see if it is a valid move
else if ((bp.getBox().getPiece() == null || bp.getBox().getPiece().getColor() != game.getCurrentTurn().getColor()) && !selected.isEmpty()) {
boolean ans = game.playerMove(game.getCurrentTurn(), selected.get(0).getBox(), bp.getBox());
if (ans) {
selected.get(0).setSelected(false);
selected.get(0).updated();
selected.clear();
bp.updated();
}
}
// Check if piece is the same color as previously selected piece, if so remove past piece from selected and select new piece
else if (!selected.isEmpty() && selected.get(0).getBox().getPiece().getColor() == bp.getBox().getPiece().getColor()) {
selected.get(0).setSelected(false);
selected.clear();
selected.add(bp);
bp.setSelected(true);
}
}
//TODO once user has ability to choose color adjust message
if (game.getStatus() == Game.GameMode.BLACK_WIN) {
endingMessage.setText("Black Team Won!");
handleEnd(e);
} else if (game.getStatus() == Game.GameMode.WHITE_WIN) {
endingMessage.setText("White Team Won!");
handleEnd(e);
} else if (game.getStatus() == Game.GameMode.TIE) {
endingMessage.setText("Tie Game!");
handleEnd(e);
}
}
// Event handling for timer running out or ending game
public void handleEnd(MouseEvent e){
for(Node pane : gameBoard.getChildren()) {
pane.setOnMouseClicked(null);
}
if(game.getStatus() == Game.GameMode.ACTIVE){
endingMessage.setText("You Quit the Game!");
}
aiMove.pause();
blackClockTimeline.pause();
whiteClockTimeline.pause();
}
// Event Handling for press of new game
public void newGame(ActionEvent e){
game = new Game();
drawBoard();
bMins = 10;
bSecs = 0;
wMins = 10;
wSecs = 0;
whiteTime.setText("10:00");
blackTime.setText("10:00");
whiteClockTimeline.play();
aiMove.play();
blackClockTimeline.pause();
endingMessage.setText("");
}
public void changeTime(Text txt, Piece.Color team) {
if (team == Piece.Color.WHITE){
if(wSecs == 0) {
--wMins;
wSecs = 60;
}
txt.setText(((wMins/10 == 0 ? "0" : "")+ wMins) + ":" + (((wSecs/10) == 0) ? "0" : "") + --wSecs);
if(wMins == 0 && wSecs == 0){
game.setStatus(Game.GameMode.BLACK_WIN);
whiteClockTimeline.stop();
}
}
else {
if(bSecs == 0) {
--bMins;
bSecs = 60;
}
txt.setText(((bMins/10 == 0 ? "0" : "")+ bMins) + ":" + (((bSecs/10) == 0) ? "0" : "") + --bSecs);
if(bMins == 0 && bSecs == 0){
game.setStatus(Game.GameMode.WHITE_WIN);
blackClockTimeline.stop();
}
}
}
/**
* Checks and alters which timer is running based on the current player
* TODO: Fix timer so that it only starts when the user gets to the game board
*/
public void checkPlayerStatus(){
if(activeScene == gameScene && game.getCurrentTurn() == game.getWhitePlayer()){
blackTimer.setStyle("-fx-background-color: #d1e5eb;");
blackLabel.setStrokeWidth(0);
blackTime.setFont(new Font(13));
whiteTimer.setStyle("-fx-background-color: #ec8f90;" + "-fx-border-width:2;"+"-fx-border-color: #e1577a;");
whiteLabel.setStroke(Color.BLACK);
whiteLabel.setStrokeWidth(.5);
whiteTime.setFont(new Font(15));
blackClockTimeline.pause();
whiteClockTimeline.play();
}
else if(activeScene == gameScene && game.getCurrentTurn() == game.getBlackPlayer()){
whiteTimer.setStyle("-fx-background-color: #d1e5eb;");
whiteLabel.setStrokeWidth(0);
whiteTime.setFont(new Font(13));
blackTimer.setStyle("-fx-background-color: #ec8f90;" + "-fx-border-width:2;"+"-fx-border-color: #e1577a;");
blackLabel.setStroke(Color.BLACK);
blackLabel.setStrokeWidth(.5);
blackTime.setFont(new Font(15));
whiteClockTimeline.pause();
blackClockTimeline.play();
}
}
// Draws the board
public void drawBoard() {
gameBoard.getChildren().clear(); // clears the board
for (int r = 0; r < 8; ++r) {
for (int c = 0; c <8; c++) {
BoxPane bp = new BoxPane(game.getBoard(),r,c);
bp.setOnMouseClicked(this::handleClick);
gameBoard.add(bp,r,c);
}
}
}
public static void main(String [] args)
{
launch(args);
}
}
| UTF-8 | Java | 20,573 | java | ChessGUI.java | Java | [] | null | [] | /*
Chess Game GUI
Interactive display for Chess game
*/
import javafx.application.Application;
import javafx.scene.paint.Paint;
import javafx.scene.text.TextAlignment;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.input.MouseEvent;
import javafx.event.EventHandler;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.geometry.Pos;
import javafx.geometry.Insets;
import javafx.scene.paint.Color;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import javafx.util.Duration;
import java.util.ArrayList;
// TODO: Find out why second scene is moved off center and correct it
public class ChessGUI extends Application {
private Game game; // The game
private GridPane gameBoard; // grid of boxes
private VBox whiteTimer, blackTimer, entryPane;
private HBox computerGame, playerGame;
private Text whiteTime, blackTime;
private Text whiteLabel, blackLabel;
private Text endingMessage;
private int wMins = 10, wSecs = 0, bMins = 10, bSecs = 0;
private Timeline whiteClockTimeline, blackClockTimeline, aiMove;
private ArrayList<BoxPane> selected;
private Scene gameScene, activeScene;
private Boolean p1vp2; // Whether or not the game is player 1 vs. player 2
private Piece.Color choice; // color user chooses to play as
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Chess Game");
/* ******************************* Entry Scene ******************************************* */
Text computerGameLabel = new Text("Player 1\nvs.\nComputer");
Text playerGameLabel = new Text("Player 1\nvs.\nPlayer 2");
computerGameLabel.setTextAlignment(TextAlignment.CENTER);
computerGameLabel.setFont(new Font(20));
computerGameLabel.setFill(Paint.valueOf("#eeeeee"));
playerGameLabel.setTextAlignment(TextAlignment.CENTER);
playerGameLabel.setFont(new Font(20));
playerGameLabel.setFill(Paint.valueOf("#eeeeee"));
Text entryTitle = new Text(" New Game? ");
entryTitle.setFont(new Font(50));
entryTitle.setFill(Paint.valueOf("#35414a"));
computerGame = new HBox();
computerGame.setAlignment(Pos.CENTER);
computerGame.setStyle("-fx-background-color: #35414a;");
computerGame.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
computerGame.setStyle("-fx-background-color: #6d7c7b;" + "-fx-border-color: #d88888;" + "-fx-border-width: 5");
}
});
computerGame.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
computerGame.setStyle("-fx-background-color: #35414a;");
}
});
playerGame = new HBox();
playerGame.setAlignment(Pos.CENTER);
playerGame.setStyle("-fx-background-color: #35414a;");
playerGame.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
playerGame.setStyle("-fx-background-color: #6d7c7b;" + "-fx-border-color: #d88888;" + "-fx-border-width: 5");
}
});
playerGame.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
playerGame.setStyle("-fx-background-color: #35414a;");
}
});
computerGame.getChildren().add(computerGameLabel);
playerGame.getChildren().add(playerGameLabel);
computerGame.setPadding(new Insets(10,10,10,10));
computerGame.setMinSize(120,120);
playerGame.setPadding(new Insets(10,10,10,10));
playerGame.setMinSize(120,120);
HBox buttons = new HBox(30);
buttons.setAlignment(Pos.CENTER);
buttons.setPadding(new Insets(10,10,10,10));
buttons.getChildren().addAll(computerGame, playerGame);
computerGame.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
p1vp2 = false;
Text prompt = new Text("");
prompt.setFont(new Font(50));
prompt.setTextAlignment(TextAlignment.CENTER);
HBox blackBox = new HBox();
blackBox.setAlignment(Pos.CENTER);
blackBox.setStyle("-fx-background-color: black;");
Text blackL = new Text("Black?");
blackL.setTextAlignment(TextAlignment.CENTER);
blackL.setFont(new Font(30));
blackL.setStyle("-fx-fill: white;");
blackBox.getChildren().add(blackL);
blackBox.setPadding(new Insets(10, 10, 10, 10));
blackBox.setMinSize(120, 120);
blackBox.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
blackBox.setStyle("-fx-background-color: grey;");
//blackL.setStyle("-fx-fill: black;");
}
});
blackBox.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
blackBox.setStyle("-fx-background-color: black;");
//blackL.setStyle("-fx-fill: white;");
}
});
blackBox.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
primaryStage.setScene(gameScene);
primaryStage.centerOnScreen();
activeScene = gameScene;
choice = Piece.Color.BLACK;
aiMove.play();
whiteClockTimeline.play();
}
});
HBox whiteBox = new HBox();
whiteBox.setAlignment(Pos.CENTER);
whiteBox.setStyle("-fx-background-color: white");
Text whiteL = new Text("White?");
whiteL.setTextAlignment(TextAlignment.CENTER);
whiteL.setFont(new Font(30));
whiteL.setStyle("-fx-fill: black;");
whiteBox.getChildren().add(whiteL);
whiteBox.setPadding(new Insets(10, 10, 10, 10));
whiteBox.setMinSize(120, 120);
whiteBox.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
whiteBox.setStyle("-fx-background-color: grey;");
}
});
whiteBox.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
whiteBox.setStyle("-fx-background-color: white;");
}
});
whiteBox.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
primaryStage.setScene(gameScene);
primaryStage.centerOnScreen();
activeScene = gameScene;
choice = Piece.Color.WHITE;
aiMove.play();
whiteClockTimeline.play();
}
});
buttons.getChildren().clear();
buttons.getChildren().addAll(blackBox, whiteBox);
entryPane.getChildren().clear();
entryPane.getChildren().addAll(prompt, buttons);
}
});
playerGame.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
p1vp2 = true;
primaryStage.setScene(gameScene);
primaryStage.centerOnScreen();
activeScene = gameScene;
whiteClockTimeline.play();
}
});
entryPane = new VBox(30);
entryPane.setStyle("-fx-background-color: #ffe7d9;");
entryPane.getChildren().addAll(entryTitle, buttons);
//entryPane.setMinSize(200,200);
Scene entryScene = new Scene(entryPane);
activeScene = entryScene;
/* ******************************* Main Scene ******************************************* */
// Set up Panes
// main layout
BorderPane main = new BorderPane();
VBox extra = new VBox(30);
extra.setStyle("-fx-background-color: #4f5a69;");
extra.setMinWidth(200);
extra.setPadding(new Insets(20, 20, 20, 20));
main.setLeft(extra);
VBox buttonPane = new VBox(30);
buttonPane.setPadding(new Insets(20,20,20,20));
buttonPane.setStyle("-fx-background-color: #7b5954;");
main.setRight(buttonPane);
gameBoard = new GridPane();
gameBoard.setStyle("-fx-background-color:#392f2a;" + "-fx-border-color: #392f2a;" + "-fx-border-width: 10;");
// Initialize game and draw Board
game = new Game();
drawBoard();
selected = new ArrayList<>();
main.setCenter(gameBoard);
// New Game Button
Button newGameBtn = new Button("New Game");
newGameBtn.setOnAction(this::newGame);
buttonPane.getChildren().add(newGameBtn);
// End Game Button
Button endGameBtn = new Button("End Game");
endGameBtn.setOnMouseClicked(this::handleEnd);
buttonPane.getChildren().add(endGameBtn);
// Set up timers
whiteTime = new Text("10:00");
whiteClockTimeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
changeTime(whiteTime, Piece.Color.WHITE);
checkPlayerStatus();
}
}));
whiteClockTimeline.setCycleCount(Timeline.INDEFINITE);
whiteClockTimeline.setAutoReverse(false);
whiteTimer = new VBox(10);
whiteTimer.setAlignment(Pos.CENTER);
whiteTimer.setPadding(new Insets(5,5,5,5));
whiteLabel = new Text("Player 1");
whiteTimer.getChildren().addAll(whiteLabel, whiteTime);
blackTime = new Text("10:00");
blackClockTimeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
changeTime(blackTime, Piece.Color.BLACK);
checkPlayerStatus();
}
}));
blackClockTimeline.setCycleCount(Timeline.INDEFINITE);
blackClockTimeline.setAutoReverse(false);
blackTimer = new VBox(10);
blackTimer.setAlignment(Pos.CENTER);
blackTimer.setPadding(new Insets(5,5,5,5));
blackLabel = new Text("Player 2");
blackTimer.getChildren().addAll(blackLabel, blackTime);
HBox timers = new HBox(10);
timers.setAlignment(Pos.CENTER);
timers.setStyle("-fx-background-color: #d1e5eb;" + "-fx-border-width:5;" + "-fx-border-color: #727a87;");
timers.setPadding(new Insets(10, 10, 10, 10));
timers.getChildren().addAll(whiteTimer, blackTimer);
extra.getChildren().add(timers);
checkPlayerStatus();
aiMove = new Timeline(new KeyFrame(Duration.seconds(5), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (choice == Piece.Color.WHITE && game.getCurrentTurn().getColor() == Piece.Color.BLACK) {
int[] move = game.getAiMove("b");
game.playerMove(game.getBlackPlayer(), game.getBoard().getBox(move[0], move[1]), game.getBoard().getBox(move[2], move[3]));
for (Node p : gameBoard.getChildren()) {
BoxPane bp = (BoxPane) (p);
if (bp.getCol() == move[1] && bp.getRow() == move[0]) {
bp.updated();
} else if (bp.getCol() == move[3] && bp.getRow() == move[2]) {
bp.updated();
}
}
}
if (choice == Piece.Color.BLACK && game.getCurrentTurn().getColor() == Piece.Color.WHITE) {
int[] move = game.getAiMove("w");
game.playerMove(game.getWhitePlayer(), game.getBoard().getBox(move[0], move[1]), game.getBoard().getBox(move[2], move[3]));
for (Node p : gameBoard.getChildren()) {
BoxPane bp = (BoxPane) (p);
if (bp.getCol() == move[1] && bp.getRow() == move[0]) {
bp.updated();
} else if (bp.getCol() == move[3] && bp.getRow() == move[2]) {
bp.updated();
}
}
}
}
}));
aiMove.setCycleCount(Timeline.INDEFINITE);
aiMove.setAutoReverse(false);
gameScene = new Scene(main);
HBox ending = new HBox();
endingMessage = new Text("");
endingMessage.setTextAlignment(TextAlignment.CENTER);
ending.getChildren().add(endingMessage);
ending.setAlignment(Pos.CENTER);
main.setBottom(ending);
// complete setup
primaryStage.setScene(activeScene);
primaryStage.centerOnScreen();
primaryStage.show();
}
/**
* Event handling for user clicking Box
* User should only be able to select one tile. Once another tile is clicked, if it is a valid move,
* the current piece moves there
*/
public void handleClick(MouseEvent e) {
if (activeScene == gameScene && (p1vp2 || choice == game.getCurrentTurn().getColor())) {
BoxPane bp = (BoxPane) (e.getSource());
// allow a user to un-select the piece
if (bp.isSelected()) {
bp.setSelected(false);
selected.remove(bp);
}
// if color of piece aligns with current team and no other piece is selected allow click
else if (bp.getBox().getPiece() != null && selected.isEmpty()) {
if (bp.getBox().getPiece().getColor() == Piece.Color.WHITE && game.getCurrentTurn() == game.getWhitePlayer()) {
bp.setSelected(true);
selected.add(bp);
} else if (bp.getBox().getPiece().getColor() == Piece.Color.BLACK && game.getCurrentTurn() == game.getBlackPlayer()) {
bp.setSelected(true);
selected.add(bp);
}
}
// if box is empty or holds an opponent piece check to see if it is a valid move
else if ((bp.getBox().getPiece() == null || bp.getBox().getPiece().getColor() != game.getCurrentTurn().getColor()) && !selected.isEmpty()) {
boolean ans = game.playerMove(game.getCurrentTurn(), selected.get(0).getBox(), bp.getBox());
if (ans) {
selected.get(0).setSelected(false);
selected.get(0).updated();
selected.clear();
bp.updated();
}
}
// Check if piece is the same color as previously selected piece, if so remove past piece from selected and select new piece
else if (!selected.isEmpty() && selected.get(0).getBox().getPiece().getColor() == bp.getBox().getPiece().getColor()) {
selected.get(0).setSelected(false);
selected.clear();
selected.add(bp);
bp.setSelected(true);
}
}
//TODO once user has ability to choose color adjust message
if (game.getStatus() == Game.GameMode.BLACK_WIN) {
endingMessage.setText("Black Team Won!");
handleEnd(e);
} else if (game.getStatus() == Game.GameMode.WHITE_WIN) {
endingMessage.setText("White Team Won!");
handleEnd(e);
} else if (game.getStatus() == Game.GameMode.TIE) {
endingMessage.setText("Tie Game!");
handleEnd(e);
}
}
// Event handling for timer running out or ending game
public void handleEnd(MouseEvent e){
for(Node pane : gameBoard.getChildren()) {
pane.setOnMouseClicked(null);
}
if(game.getStatus() == Game.GameMode.ACTIVE){
endingMessage.setText("You Quit the Game!");
}
aiMove.pause();
blackClockTimeline.pause();
whiteClockTimeline.pause();
}
// Event Handling for press of new game
public void newGame(ActionEvent e){
game = new Game();
drawBoard();
bMins = 10;
bSecs = 0;
wMins = 10;
wSecs = 0;
whiteTime.setText("10:00");
blackTime.setText("10:00");
whiteClockTimeline.play();
aiMove.play();
blackClockTimeline.pause();
endingMessage.setText("");
}
public void changeTime(Text txt, Piece.Color team) {
if (team == Piece.Color.WHITE){
if(wSecs == 0) {
--wMins;
wSecs = 60;
}
txt.setText(((wMins/10 == 0 ? "0" : "")+ wMins) + ":" + (((wSecs/10) == 0) ? "0" : "") + --wSecs);
if(wMins == 0 && wSecs == 0){
game.setStatus(Game.GameMode.BLACK_WIN);
whiteClockTimeline.stop();
}
}
else {
if(bSecs == 0) {
--bMins;
bSecs = 60;
}
txt.setText(((bMins/10 == 0 ? "0" : "")+ bMins) + ":" + (((bSecs/10) == 0) ? "0" : "") + --bSecs);
if(bMins == 0 && bSecs == 0){
game.setStatus(Game.GameMode.WHITE_WIN);
blackClockTimeline.stop();
}
}
}
/**
* Checks and alters which timer is running based on the current player
* TODO: Fix timer so that it only starts when the user gets to the game board
*/
public void checkPlayerStatus(){
if(activeScene == gameScene && game.getCurrentTurn() == game.getWhitePlayer()){
blackTimer.setStyle("-fx-background-color: #d1e5eb;");
blackLabel.setStrokeWidth(0);
blackTime.setFont(new Font(13));
whiteTimer.setStyle("-fx-background-color: #ec8f90;" + "-fx-border-width:2;"+"-fx-border-color: #e1577a;");
whiteLabel.setStroke(Color.BLACK);
whiteLabel.setStrokeWidth(.5);
whiteTime.setFont(new Font(15));
blackClockTimeline.pause();
whiteClockTimeline.play();
}
else if(activeScene == gameScene && game.getCurrentTurn() == game.getBlackPlayer()){
whiteTimer.setStyle("-fx-background-color: #d1e5eb;");
whiteLabel.setStrokeWidth(0);
whiteTime.setFont(new Font(13));
blackTimer.setStyle("-fx-background-color: #ec8f90;" + "-fx-border-width:2;"+"-fx-border-color: #e1577a;");
blackLabel.setStroke(Color.BLACK);
blackLabel.setStrokeWidth(.5);
blackTime.setFont(new Font(15));
whiteClockTimeline.pause();
blackClockTimeline.play();
}
}
// Draws the board
public void drawBoard() {
gameBoard.getChildren().clear(); // clears the board
for (int r = 0; r < 8; ++r) {
for (int c = 0; c <8; c++) {
BoxPane bp = new BoxPane(game.getBoard(),r,c);
bp.setOnMouseClicked(this::handleClick);
gameBoard.add(bp,r,c);
}
}
}
public static void main(String [] args)
{
launch(args);
}
}
| 20,573 | 0.551305 | 0.535167 | 491 | 40.894093 | 27.828047 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.816701 | false | false | 4 |
6f6f6cb91d8b8d86c225d634fc9c1a2efb7e3835 | 21,758,304,370,162 | c51c1d63a72e59a528a6926365959f357628e0c0 | /src/main/java/com/inventive/core/web/client/command/RegisterUserResult.java | 4b3a858e72c563e487d0142c1cc332bc56d8dab4 | [] | no_license | grantlittle/coreweb | https://github.com/grantlittle/coreweb | daba3d6c61844d6d8acd433fe24dd1a18e19ea9a | f3c77500877288b61ab191544906483945991ad9 | refs/heads/master | 2016-08-05T14:43:31.549000 | 2014-08-15T00:03:12 | 2014-08-15T00:03:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package com.inventive.core.web.client.command;
import java.util.ArrayList;
import com.inventive.core.web.client.dtos.GwtUser;
/**
* @author <a href="mailto:grant.little@inventivesoftware.com.au">Grant Little</a>
*
*/
public class RegisterUserResult implements Result {
private GwtUser user;
private ArrayList<String> messages;
@SuppressWarnings("unused")
private RegisterUserResult() {}
public RegisterUserResult(GwtUser user, ArrayList<String> messages) {
super();
this.user = user;
this.messages = messages;
}
public GwtUser getUser() {
return user;
}
public ArrayList<String> getMessages() {
return messages;
}
}
| UTF-8 | Java | 668 | java | RegisterUserResult.java | Java | [
{
"context": "ent.dtos.GwtUser;\n\n/**\n * @author <a href=\"mailto:grant.little@inventivesoftware.com.au\">Grant Little</a>\n *\n */\npublic class RegisterUse",
"end": 209,
"score": 0.9999337792396545,
"start": 172,
"tag": "EMAIL",
"value": "grant.little@inventivesoftware.com.au"
},
{
"context": "ef=\"mailto:grant.little@inventivesoftware.com.au\">Grant Little</a>\n *\n */\npublic class RegisterUserResult implem",
"end": 223,
"score": 0.9998583793640137,
"start": 211,
"tag": "NAME",
"value": "Grant Little"
}
] | null | [] | /**
*
*/
package com.inventive.core.web.client.command;
import java.util.ArrayList;
import com.inventive.core.web.client.dtos.GwtUser;
/**
* @author <a href="mailto:<EMAIL>"><NAME></a>
*
*/
public class RegisterUserResult implements Result {
private GwtUser user;
private ArrayList<String> messages;
@SuppressWarnings("unused")
private RegisterUserResult() {}
public RegisterUserResult(GwtUser user, ArrayList<String> messages) {
super();
this.user = user;
this.messages = messages;
}
public GwtUser getUser() {
return user;
}
public ArrayList<String> getMessages() {
return messages;
}
}
| 632 | 0.714072 | 0.714072 | 40 | 15.7 | 20.907175 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false | 4 |
f1737e0eae265b86ab9e6065fabf23da844a4e91 | 24,180,665,933,244 | 9d4e6aa5827b4ce7fc44f473367c370a655da5b1 | /android/Scout/app/src/main/java/pt/ulisboa/tecnico/cycleourcity/scout/offloading/profiling/exceptions/EnergyPropertyNotSupportedException.java | 92e3a3d88d026f2f8bce39512506768526e5cd93 | [] | no_license | rodrigojmlourenco/Scout | https://github.com/rodrigojmlourenco/Scout | 22f20454f119d2acb9082dcd75c776500098894c | 2683c94c4566110681abe54677d41403f55d94fe | refs/heads/master | 2021-05-01T19:38:18.113000 | 2015-09-21T20:51:10 | 2015-09-21T20:51:10 | 31,719,178 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pt.ulisboa.tecnico.cycleourcity.scout.offloading.profiling.exceptions;
/**
* Created by rodrigo.jm.lourenco on 29/05/2015.
*/
public class EnergyPropertyNotSupportedException extends Exception {
private String message;
public EnergyPropertyNotSupportedException(String propertyName){
this.message = "The device's BatteryManager is does not support "+propertyName+ " profiling.";
}
}
| UTF-8 | Java | 416 | java | EnergyPropertyNotSupportedException.java | Java | [
{
"context": "ffloading.profiling.exceptions;\n\n/**\n * Created by rodrigo.jm.lourenco on 29/05/2015.\n */\npublic class EnergyPropertyNot",
"end": 117,
"score": 0.9964106678962708,
"start": 98,
"tag": "NAME",
"value": "rodrigo.jm.lourenco"
}
] | null | [] | package pt.ulisboa.tecnico.cycleourcity.scout.offloading.profiling.exceptions;
/**
* Created by rodrigo.jm.lourenco on 29/05/2015.
*/
public class EnergyPropertyNotSupportedException extends Exception {
private String message;
public EnergyPropertyNotSupportedException(String propertyName){
this.message = "The device's BatteryManager is does not support "+propertyName+ " profiling.";
}
}
| 416 | 0.764423 | 0.745192 | 13 | 31 | 35.431408 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | false | false | 4 |
28b24b2e210aea993e9770c5c4d93728d3a51688 | 16,114,717,329,387 | 2c9d27c8b468298626949fbfe678b288e772a3d1 | /config/src/main/java/de/codecrafter47/taboverlay/config/dsl/PlayerSetConfiguration.java | 3b6bd6adf17848fd1b17e4cecff80dde220011f7 | [] | no_license | CodeCrafter47/TabOverlayCommon | https://github.com/CodeCrafter47/TabOverlayCommon | bec7808d0394cb8f40c5e489a14d485898345923 | 75e4529f58d0bf1d8ace537af7d5a49bbc2e8308 | refs/heads/master | 2023-02-03T00:32:38.594000 | 2023-01-21T16:15:55 | 2023-01-26T08:54:24 | 147,844,876 | 2 | 3 | null | false | 2023-01-26T08:54:25 | 2018-09-07T15:53:57 | 2022-06-21T22:19:35 | 2023-01-26T08:54:24 | 832 | 1 | 3 | 4 | Java | false | false | /*
* Copyright (C) 2020 Florian Stober
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.codecrafter47.taboverlay.config.dsl;
import de.codecrafter47.taboverlay.config.dsl.yaml.MarkedPropertyBase;
import de.codecrafter47.taboverlay.config.dsl.yaml.MarkedStringProperty;
import de.codecrafter47.taboverlay.config.expression.template.ExpressionTemplate;
import de.codecrafter47.taboverlay.config.template.PlayerSetTemplate;
import de.codecrafter47.taboverlay.config.template.TemplateCreationContext;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.yaml.snakeyaml.error.Mark;
import java.util.Optional;
@Getter
@Setter
@NoArgsConstructor
public class PlayerSetConfiguration extends MarkedPropertyBase {
private MarkedStringProperty filter;
private Visibility hiddenPlayers = null;
private transient boolean fixMark;
public PlayerSetConfiguration(String expression) {
this.filter = new MarkedStringProperty(expression);
this.fixMark = true;
}
@Override
public void setStartMark(Mark startMark) {
super.setStartMark(startMark);
if (fixMark) {
filter.setStartMark(startMark);
}
}
public PlayerSetTemplate toTemplate(TemplateCreationContext tcc) {
TemplateCreationContext childContext = tcc.clone();
childContext.setPlayerAvailable(true);
ExpressionTemplate predicate = tcc.getExpressionEngine().compile(childContext, filter.getValue(), filter.getStartMark());
return PlayerSetTemplate.builder()
.predicate(predicate)
.hiddenPlayersVisibility(Optional.ofNullable(hiddenPlayers).orElse(tcc.getDefaultHiddenPlayerVisibility()))
.build();
}
public enum Visibility {
VISIBLE, VISIBLE_TO_ADMINS, INVISIBLE;
}
}
| UTF-8 | Java | 2,497 | java | PlayerSetConfiguration.java | Java | [
{
"context": "/*\n * Copyright (C) 2020 Florian Stober\n *\n * This program is free software: you can ",
"end": 43,
"score": 0.9998660087585449,
"start": 29,
"tag": "NAME",
"value": "Florian Stober"
}
] | null | [] | /*
* Copyright (C) 2020 <NAME>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.codecrafter47.taboverlay.config.dsl;
import de.codecrafter47.taboverlay.config.dsl.yaml.MarkedPropertyBase;
import de.codecrafter47.taboverlay.config.dsl.yaml.MarkedStringProperty;
import de.codecrafter47.taboverlay.config.expression.template.ExpressionTemplate;
import de.codecrafter47.taboverlay.config.template.PlayerSetTemplate;
import de.codecrafter47.taboverlay.config.template.TemplateCreationContext;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.yaml.snakeyaml.error.Mark;
import java.util.Optional;
@Getter
@Setter
@NoArgsConstructor
public class PlayerSetConfiguration extends MarkedPropertyBase {
private MarkedStringProperty filter;
private Visibility hiddenPlayers = null;
private transient boolean fixMark;
public PlayerSetConfiguration(String expression) {
this.filter = new MarkedStringProperty(expression);
this.fixMark = true;
}
@Override
public void setStartMark(Mark startMark) {
super.setStartMark(startMark);
if (fixMark) {
filter.setStartMark(startMark);
}
}
public PlayerSetTemplate toTemplate(TemplateCreationContext tcc) {
TemplateCreationContext childContext = tcc.clone();
childContext.setPlayerAvailable(true);
ExpressionTemplate predicate = tcc.getExpressionEngine().compile(childContext, filter.getValue(), filter.getStartMark());
return PlayerSetTemplate.builder()
.predicate(predicate)
.hiddenPlayersVisibility(Optional.ofNullable(hiddenPlayers).orElse(tcc.getDefaultHiddenPlayerVisibility()))
.build();
}
public enum Visibility {
VISIBLE, VISIBLE_TO_ADMINS, INVISIBLE;
}
}
| 2,489 | 0.731678 | 0.72487 | 71 | 34.169014 | 31.293245 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.450704 | false | false | 4 |
be22234285691d3639a9f6958aa48db78958c9ea | 3,513,283,280,613 | bfe31fdaaafa7d775a33635ec135656da70da1e9 | /core/src/main/java/dev/triumphteam/gui/components/nbt/LegacyNbt.java | 31863fdd1e3785237775e42d9ece48b883199179 | [
"MIT"
] | permissive | TriumphTeam/gui | https://github.com/TriumphTeam/gui | 8a00e14607b54ef42da28ad6d5a877a0a7168346 | 98fc432d7357c5188de122cf6352f9e6a7fef0de | refs/heads/master | 2023-05-27T03:22:29.906000 | 2023-05-05T10:50:05 | 2023-05-05T10:50:05 | 233,151,248 | 8 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* MIT License
*
* Copyright (c) 2021 TriumphTeam
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package dev.triumphteam.gui.components.nbt;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Objects;
/**
* Class to set / get NBT tags from items.
* I hate this class.
*/
public final class LegacyNbt implements NbtWrapper {
public static final String PACKAGE_NAME = Bukkit.getServer().getClass().getPackage().getName();
public static final String NMS_VERSION = PACKAGE_NAME.substring(PACKAGE_NAME.lastIndexOf(46) + 1);
private static Method getStringMethod;
private static Method setStringMethod;
private static Method setBooleanMethod;
private static Method hasTagMethod;
private static Method getTagMethod;
private static Method setTagMethod;
private static Method removeTagMethod;
private static Method asNMSCopyMethod;
private static Method asBukkitCopyMethod;
private static Constructor<?> nbtCompoundConstructor;
static {
try {
getStringMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("getString", String.class);
removeTagMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("remove", String.class);
setStringMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("setString", String.class, String.class);
setBooleanMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("setBoolean", String.class, boolean.class);
hasTagMethod = Objects.requireNonNull(getNMSClass("ItemStack")).getMethod("hasTag");
getTagMethod = Objects.requireNonNull(getNMSClass("ItemStack")).getMethod("getTag");
setTagMethod = Objects.requireNonNull(getNMSClass("ItemStack")).getMethod("setTag", getNMSClass("NBTTagCompound"));
nbtCompoundConstructor = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getDeclaredConstructor();
asNMSCopyMethod = Objects.requireNonNull(getCraftItemStackClass()).getMethod("asNMSCopy", ItemStack.class);
asBukkitCopyMethod = Objects.requireNonNull(getCraftItemStackClass()).getMethod("asBukkitCopy", getNMSClass("ItemStack"));
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
/**
* Sets an NBT tag to the an {@link ItemStack}.
*
* @param itemStack The current {@link ItemStack} to be set.
* @param key The NBT key to use.
* @param value The tag value to set.
* @return An {@link ItemStack} that has NBT set.
*/
@Override
public ItemStack setString(@NotNull final ItemStack itemStack, final String key, final String value) {
if (itemStack.getType() == Material.AIR) return itemStack;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
setString(itemCompound, key, value);
setTag(nmsItemStack, itemCompound);
return asBukkitCopy(nmsItemStack);
}
/**
* Removes a tag from an {@link ItemStack}.
*
* @param itemStack The current {@link ItemStack} to be remove.
* @param key The NBT key to remove.
* @return An {@link ItemStack} that has the tag removed.
*/
@Override
public ItemStack removeTag(@NotNull final ItemStack itemStack, final String key) {
if (itemStack.getType() == Material.AIR) return itemStack;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
remove(itemCompound, key);
setTag(nmsItemStack, itemCompound);
return asBukkitCopy(nmsItemStack);
}
/**
* Sets a boolean to the {@link ItemStack}.
* Mainly used for setting an item to be unbreakable on older versions.
*
* @param itemStack The {@link ItemStack} to set the boolean to.
* @param key The key to use.
* @param value The boolean value.
* @return An {@link ItemStack} with a boolean value set.
*/
@Override
public ItemStack setBoolean(@NotNull final ItemStack itemStack, final String key, final boolean value) {
if (itemStack.getType() == Material.AIR) return itemStack;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
setBoolean(itemCompound, key, value);
setTag(nmsItemStack, itemCompound);
return asBukkitCopy(nmsItemStack);
}
/**
* Gets the NBT tag based on a given key.
*
* @param itemStack The {@link ItemStack} to get from.
* @param key The key to look for.
* @return The tag that was stored in the {@link ItemStack}.
*/
@Nullable
@Override
public String getString(@NotNull final ItemStack itemStack, final String key) {
if (itemStack.getType() == Material.AIR) return null;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
return getString(itemCompound, key);
}
/**
* Mimics the itemCompound#setString method.
*
* @param itemCompound The ItemCompound.
* @param key The key to add.
* @param value The value to add.
*/
private static void setString(final Object itemCompound, final String key, final String value) {
try {
setStringMethod.invoke(itemCompound, key, value);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
private static void setBoolean(final Object itemCompound, final String key, final boolean value) {
try {
setBooleanMethod.invoke(itemCompound, key, value);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
/**
* Mimics the itemCompound#remove method.
*
* @param itemCompound The ItemCompound.
* @param key The key to remove.
*/
private static void remove(final Object itemCompound, final String key) {
try {
removeTagMethod.invoke(itemCompound, key);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
/**
* Mimics the itemCompound#getString method.
*
* @param itemCompound The ItemCompound.
* @param key The key to get from.
* @return A string with the value from the key.
*/
private static String getString(final Object itemCompound, final String key) {
try {
return (String) getStringMethod.invoke(itemCompound, key);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the nmsItemStack#hasTag method.
*
* @param nmsItemStack the NMS ItemStack to check from.
* @return True or false depending if it has tag or not.
*/
private static boolean hasTag(final Object nmsItemStack) {
try {
return (boolean) hasTagMethod.invoke(nmsItemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return false;
}
}
/**
* Mimics the nmsItemStack#getTag method.
*
* @param nmsItemStack The NMS ItemStack to get from.
* @return The tag compound.
*/
public static Object getTag(final Object nmsItemStack) {
try {
return getTagMethod.invoke(nmsItemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the nmsItemStack#setTag method.
*
* @param nmsItemStack the NMS ItemStack to set the tag to.
* @param itemCompound The item compound to set.
*/
private static void setTag(final Object nmsItemStack, final Object itemCompound) {
try {
setTagMethod.invoke(nmsItemStack, itemCompound);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
/**
* Mimics the new NBTTagCompound instantiation.
*
* @return The new NBTTagCompound.
*/
private static Object newNBTTagCompound() {
try {
return nbtCompoundConstructor.newInstance();
} catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the CraftItemStack#asNMSCopy method.
*
* @param itemStack The ItemStack to make NMS copy.
* @return An NMS copy of the ItemStack.
*/
public static Object asNMSCopy(final ItemStack itemStack) {
try {
return asNMSCopyMethod.invoke(null, itemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the CraftItemStack#asBukkitCopy method.
*
* @param nmsItemStack The NMS ItemStack to turn into {@link ItemStack}.
* @return The new {@link ItemStack}.
*/
public static ItemStack asBukkitCopy(final Object nmsItemStack) {
try {
return (ItemStack) asBukkitCopyMethod.invoke(null, nmsItemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Gets the NMS class from class name.
*
* @return The NMS class.
*/
private static Class<?> getNMSClass(final String className) {
try {
return Class.forName("net.minecraft.server." + NMS_VERSION + "." + className);
} catch (ClassNotFoundException e) {
return null;
}
}
/**
* Gets the NMS craft {@link ItemStack} class from class name.
*
* @return The NMS craft {@link ItemStack} class.
*/
private static Class<?> getCraftItemStackClass() {
try {
return Class.forName("org.bukkit.craftbukkit." + NMS_VERSION + ".inventory.CraftItemStack");
} catch (ClassNotFoundException e) {
return null;
}
}
} | UTF-8 | Java | 11,518 | java | LegacyNbt.java | Java | [
{
"context": "/**\n * MIT License\n *\n * Copyright (c) 2021 TriumphTeam\n *\n * Permission is hereby granted, free of charg",
"end": 55,
"score": 0.9993354082107544,
"start": 44,
"tag": "USERNAME",
"value": "TriumphTeam"
}
] | null | [] | /**
* MIT License
*
* Copyright (c) 2021 TriumphTeam
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package dev.triumphteam.gui.components.nbt;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Objects;
/**
* Class to set / get NBT tags from items.
* I hate this class.
*/
public final class LegacyNbt implements NbtWrapper {
public static final String PACKAGE_NAME = Bukkit.getServer().getClass().getPackage().getName();
public static final String NMS_VERSION = PACKAGE_NAME.substring(PACKAGE_NAME.lastIndexOf(46) + 1);
private static Method getStringMethod;
private static Method setStringMethod;
private static Method setBooleanMethod;
private static Method hasTagMethod;
private static Method getTagMethod;
private static Method setTagMethod;
private static Method removeTagMethod;
private static Method asNMSCopyMethod;
private static Method asBukkitCopyMethod;
private static Constructor<?> nbtCompoundConstructor;
static {
try {
getStringMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("getString", String.class);
removeTagMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("remove", String.class);
setStringMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("setString", String.class, String.class);
setBooleanMethod = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getMethod("setBoolean", String.class, boolean.class);
hasTagMethod = Objects.requireNonNull(getNMSClass("ItemStack")).getMethod("hasTag");
getTagMethod = Objects.requireNonNull(getNMSClass("ItemStack")).getMethod("getTag");
setTagMethod = Objects.requireNonNull(getNMSClass("ItemStack")).getMethod("setTag", getNMSClass("NBTTagCompound"));
nbtCompoundConstructor = Objects.requireNonNull(getNMSClass("NBTTagCompound")).getDeclaredConstructor();
asNMSCopyMethod = Objects.requireNonNull(getCraftItemStackClass()).getMethod("asNMSCopy", ItemStack.class);
asBukkitCopyMethod = Objects.requireNonNull(getCraftItemStackClass()).getMethod("asBukkitCopy", getNMSClass("ItemStack"));
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
/**
* Sets an NBT tag to the an {@link ItemStack}.
*
* @param itemStack The current {@link ItemStack} to be set.
* @param key The NBT key to use.
* @param value The tag value to set.
* @return An {@link ItemStack} that has NBT set.
*/
@Override
public ItemStack setString(@NotNull final ItemStack itemStack, final String key, final String value) {
if (itemStack.getType() == Material.AIR) return itemStack;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
setString(itemCompound, key, value);
setTag(nmsItemStack, itemCompound);
return asBukkitCopy(nmsItemStack);
}
/**
* Removes a tag from an {@link ItemStack}.
*
* @param itemStack The current {@link ItemStack} to be remove.
* @param key The NBT key to remove.
* @return An {@link ItemStack} that has the tag removed.
*/
@Override
public ItemStack removeTag(@NotNull final ItemStack itemStack, final String key) {
if (itemStack.getType() == Material.AIR) return itemStack;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
remove(itemCompound, key);
setTag(nmsItemStack, itemCompound);
return asBukkitCopy(nmsItemStack);
}
/**
* Sets a boolean to the {@link ItemStack}.
* Mainly used for setting an item to be unbreakable on older versions.
*
* @param itemStack The {@link ItemStack} to set the boolean to.
* @param key The key to use.
* @param value The boolean value.
* @return An {@link ItemStack} with a boolean value set.
*/
@Override
public ItemStack setBoolean(@NotNull final ItemStack itemStack, final String key, final boolean value) {
if (itemStack.getType() == Material.AIR) return itemStack;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
setBoolean(itemCompound, key, value);
setTag(nmsItemStack, itemCompound);
return asBukkitCopy(nmsItemStack);
}
/**
* Gets the NBT tag based on a given key.
*
* @param itemStack The {@link ItemStack} to get from.
* @param key The key to look for.
* @return The tag that was stored in the {@link ItemStack}.
*/
@Nullable
@Override
public String getString(@NotNull final ItemStack itemStack, final String key) {
if (itemStack.getType() == Material.AIR) return null;
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = hasTag(nmsItemStack) ? getTag(nmsItemStack) : newNBTTagCompound();
return getString(itemCompound, key);
}
/**
* Mimics the itemCompound#setString method.
*
* @param itemCompound The ItemCompound.
* @param key The key to add.
* @param value The value to add.
*/
private static void setString(final Object itemCompound, final String key, final String value) {
try {
setStringMethod.invoke(itemCompound, key, value);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
private static void setBoolean(final Object itemCompound, final String key, final boolean value) {
try {
setBooleanMethod.invoke(itemCompound, key, value);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
/**
* Mimics the itemCompound#remove method.
*
* @param itemCompound The ItemCompound.
* @param key The key to remove.
*/
private static void remove(final Object itemCompound, final String key) {
try {
removeTagMethod.invoke(itemCompound, key);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
/**
* Mimics the itemCompound#getString method.
*
* @param itemCompound The ItemCompound.
* @param key The key to get from.
* @return A string with the value from the key.
*/
private static String getString(final Object itemCompound, final String key) {
try {
return (String) getStringMethod.invoke(itemCompound, key);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the nmsItemStack#hasTag method.
*
* @param nmsItemStack the NMS ItemStack to check from.
* @return True or false depending if it has tag or not.
*/
private static boolean hasTag(final Object nmsItemStack) {
try {
return (boolean) hasTagMethod.invoke(nmsItemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return false;
}
}
/**
* Mimics the nmsItemStack#getTag method.
*
* @param nmsItemStack The NMS ItemStack to get from.
* @return The tag compound.
*/
public static Object getTag(final Object nmsItemStack) {
try {
return getTagMethod.invoke(nmsItemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the nmsItemStack#setTag method.
*
* @param nmsItemStack the NMS ItemStack to set the tag to.
* @param itemCompound The item compound to set.
*/
private static void setTag(final Object nmsItemStack, final Object itemCompound) {
try {
setTagMethod.invoke(nmsItemStack, itemCompound);
} catch (IllegalAccessException | InvocationTargetException ignored) {
}
}
/**
* Mimics the new NBTTagCompound instantiation.
*
* @return The new NBTTagCompound.
*/
private static Object newNBTTagCompound() {
try {
return nbtCompoundConstructor.newInstance();
} catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the CraftItemStack#asNMSCopy method.
*
* @param itemStack The ItemStack to make NMS copy.
* @return An NMS copy of the ItemStack.
*/
public static Object asNMSCopy(final ItemStack itemStack) {
try {
return asNMSCopyMethod.invoke(null, itemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Mimics the CraftItemStack#asBukkitCopy method.
*
* @param nmsItemStack The NMS ItemStack to turn into {@link ItemStack}.
* @return The new {@link ItemStack}.
*/
public static ItemStack asBukkitCopy(final Object nmsItemStack) {
try {
return (ItemStack) asBukkitCopyMethod.invoke(null, nmsItemStack);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* Gets the NMS class from class name.
*
* @return The NMS class.
*/
private static Class<?> getNMSClass(final String className) {
try {
return Class.forName("net.minecraft.server." + NMS_VERSION + "." + className);
} catch (ClassNotFoundException e) {
return null;
}
}
/**
* Gets the NMS craft {@link ItemStack} class from class name.
*
* @return The NMS craft {@link ItemStack} class.
*/
private static Class<?> getCraftItemStackClass() {
try {
return Class.forName("org.bukkit.craftbukkit." + NMS_VERSION + ".inventory.CraftItemStack");
} catch (ClassNotFoundException e) {
return null;
}
}
} | 11,518 | 0.662962 | 0.662355 | 313 | 35.801918 | 32.840389 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472843 | false | false | 4 |
ef775f8f34358e9b940d0ef3317429dc680bed1a | 8,607,114,493,022 | 017ace39aa4eea143434fb31559f8a9d0bd49e8a | /ifp-common/src/main/java/com/cib/ifp/common/util/EnumUtils.java | 3330ed9da1d21f5d68be68c7aa4a4b697d4f7206 | [] | no_license | valefor/ifp | https://github.com/valefor/ifp | 088d3d57cd921026ae2bf8cb488b0dc8489d2a5a | 63eb9687b6f2b54e8a65a1ef05808a3d967a185a | refs/heads/master | 2016-08-03T10:20:31.105000 | 2016-05-09T10:18:07 | 2016-05-09T10:18:07 | 51,059,052 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cib.ifp.common.util;
import java.util.ArrayList;
import java.util.List;
import com.cib.ifp.common.enm.EnumCodable;
public class EnumUtils {
public static <T extends Enum<T>> T getByCode(Class<T> enumClass, String code) {
for (T o : enumClass.getEnumConstants()) {
if (o instanceof EnumCodable) {
EnumCodable ec = (EnumCodable) o;
if (ec.getCode().equals(code)) {
return o;
}
}
}
return null;
}
public static <T extends Enum<T>> List<String> getEnumValues(Class<T> enumClass) {
List<String> enumList = new ArrayList<String>();
for (T o : enumClass.getEnumConstants()) {
enumList.add(o.name());
}
return enumList;
}
}
| UTF-8 | Java | 707 | java | EnumUtils.java | Java | [] | null | [] | package com.cib.ifp.common.util;
import java.util.ArrayList;
import java.util.List;
import com.cib.ifp.common.enm.EnumCodable;
public class EnumUtils {
public static <T extends Enum<T>> T getByCode(Class<T> enumClass, String code) {
for (T o : enumClass.getEnumConstants()) {
if (o instanceof EnumCodable) {
EnumCodable ec = (EnumCodable) o;
if (ec.getCode().equals(code)) {
return o;
}
}
}
return null;
}
public static <T extends Enum<T>> List<String> getEnumValues(Class<T> enumClass) {
List<String> enumList = new ArrayList<String>();
for (T o : enumClass.getEnumConstants()) {
enumList.add(o.name());
}
return enumList;
}
}
| 707 | 0.647808 | 0.647808 | 29 | 22.379311 | 22.861523 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.931034 | false | false | 4 |
e8e9a38865d83a831b56327666e43f7319cf24e3 | 5,446,018,560,294 | d2e38c2923b053959afedc6962e6e0a2eb52c659 | /cdi/src/main/java/org/uberfire/client/screens/miscfeatures/QConEvent.java | a92a817d6e72376eb845f280d87435c6f5070ea2 | [] | no_license | ederign/qconrio2014 | https://github.com/ederign/qconrio2014 | d8582dc66db1de4182692673b66dbd86731977d6 | 8832646877ac5aed7ab266c5b4aa9e44d7d07353 | refs/heads/master | 2016-09-06T16:32:58.827000 | 2014-09-21T21:55:55 | 2014-09-21T21:55:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.uberfire.client.screens.miscfeatures;
import org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;
public class QConEvent {
private final ChangeTitleWidgetEvent changeTitleWidgetEvent;
public QConEvent( ChangeTitleWidgetEvent changeTitleWidgetEvent ) {
this.changeTitleWidgetEvent = changeTitleWidgetEvent;
}
}
| UTF-8 | Java | 354 | java | QConEvent.java | Java | [] | null | [] | package org.uberfire.client.screens.miscfeatures;
import org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;
public class QConEvent {
private final ChangeTitleWidgetEvent changeTitleWidgetEvent;
public QConEvent( ChangeTitleWidgetEvent changeTitleWidgetEvent ) {
this.changeTitleWidgetEvent = changeTitleWidgetEvent;
}
}
| 354 | 0.80791 | 0.80791 | 12 | 28.5 | 29.72513 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 4 |
b1426a30143842c025d354056512e86d548073ae | 188,978,621,256 | ebe9c5ebde3d3c95235b3e82cd43dcc15c9a3fb6 | /projekt aplikacji/Project_SM2/app/src/main/java/kamiltm/project_sm/training/NewTrainingActivity.java | 03883eea63d1af54be051f4e6db0e57fdb2b2c43 | [] | no_license | xThauma/Aplikacja-Mobilna-Do-Trening-w-I-Diet | https://github.com/xThauma/Aplikacja-Mobilna-Do-Trening-w-I-Diet | c3378b14485fdf4a25f694bba678cb4fe466033a | 0ece2da133bce585a65d1f858f501dbe191ab229 | refs/heads/master | 2021-01-16T03:38:36.831000 | 2020-02-25T09:55:07 | 2020-02-25T09:55:07 | 242,964,944 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kamiltm.project_sm.training;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import com.android.volley.Request;
import com.android.volley.toolbox.JsonArrayRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import kamiltm.project_sm.R;
import kamiltm.project_sm.connectors.DateState;
import kamiltm.project_sm.constants.Constants;
import kamiltm.project_sm.user.RequestHandler;
import kamiltm.project_sm.user.SharedPrefManager;
public class NewTrainingActivity extends AppCompatActivity {
private Button add_training_btn, go_back_btn;
private String s_reps, s_series, s_name, date;
private EditText name_et, reps_et, series_et;
private Date datee;
private final Integer USER_ID = SharedPrefManager.getInstance(this).getId();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.training_add_fragment);
initViews();
handleInput();
}
public void handleInput() {
datee = DateState.dateState;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
date = sdf.format(datee);
go_back_btn.setOnClickListener(e -> {
finish();
});
add_training_btn.setOnClickListener(e -> {
s_name = name_et.getText().toString();
s_reps = reps_et.getText().toString();
s_series = series_et.getText().toString();
checkString(s_name, name_et);
checkString(s_reps, reps_et);
checkString(s_series, series_et);
postData(USER_ID, date);
});
}
public void postData(Integer users_id, String date) {
String url = Constants.URL_INSERT_TRAINING_DATA + "?id_users=" + users_id + "&date=" + date + "&name=" + s_name + "&reps=" + s_reps + "&series=" + s_series;
Log.d("Url: ", url);
JsonArrayRequest jsonObjectRequest = new JsonArrayRequest(Request.Method.GET, url, null, response -> {
}, error -> {
Log.d("ERROR", " " + error.toString());
});
RequestHandler.getInstance(this).addToRequestQueue(jsonObjectRequest);
AlertDialog.Builder adb = new AlertDialog.Builder(this);
adb.setTitle(getString(R.string.added));
adb.setMessage(getString(R.string.exercise_with_name) + " " + s_name + " " + getString(R.string.has_been_added_to_the_database));
adb.setPositiveButton("Ok", (dialog, which) -> {
finish();
});
adb.show();
}
public void checkString(String name, EditText editText) {
if (TextUtils.isEmpty(name)) {
editText.setError(getResources().getString(R.string.emptySearchEditText));
return;
}
}
public void initViews() {
add_training_btn = findViewById(R.id.add_training_btnADD);
go_back_btn = findViewById(R.id.go_trainings_btn);
name_et = findViewById(R.id.exercise_name_et);
reps_et = findViewById(R.id.number_of_reps_et);
series_et = findViewById(R.id.number_of_series_et);
}
}
| UTF-8 | Java | 3,318 | java | NewTrainingActivity.java | Java | [] | null | [] | package kamiltm.project_sm.training;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import com.android.volley.Request;
import com.android.volley.toolbox.JsonArrayRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import kamiltm.project_sm.R;
import kamiltm.project_sm.connectors.DateState;
import kamiltm.project_sm.constants.Constants;
import kamiltm.project_sm.user.RequestHandler;
import kamiltm.project_sm.user.SharedPrefManager;
public class NewTrainingActivity extends AppCompatActivity {
private Button add_training_btn, go_back_btn;
private String s_reps, s_series, s_name, date;
private EditText name_et, reps_et, series_et;
private Date datee;
private final Integer USER_ID = SharedPrefManager.getInstance(this).getId();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.training_add_fragment);
initViews();
handleInput();
}
public void handleInput() {
datee = DateState.dateState;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
date = sdf.format(datee);
go_back_btn.setOnClickListener(e -> {
finish();
});
add_training_btn.setOnClickListener(e -> {
s_name = name_et.getText().toString();
s_reps = reps_et.getText().toString();
s_series = series_et.getText().toString();
checkString(s_name, name_et);
checkString(s_reps, reps_et);
checkString(s_series, series_et);
postData(USER_ID, date);
});
}
public void postData(Integer users_id, String date) {
String url = Constants.URL_INSERT_TRAINING_DATA + "?id_users=" + users_id + "&date=" + date + "&name=" + s_name + "&reps=" + s_reps + "&series=" + s_series;
Log.d("Url: ", url);
JsonArrayRequest jsonObjectRequest = new JsonArrayRequest(Request.Method.GET, url, null, response -> {
}, error -> {
Log.d("ERROR", " " + error.toString());
});
RequestHandler.getInstance(this).addToRequestQueue(jsonObjectRequest);
AlertDialog.Builder adb = new AlertDialog.Builder(this);
adb.setTitle(getString(R.string.added));
adb.setMessage(getString(R.string.exercise_with_name) + " " + s_name + " " + getString(R.string.has_been_added_to_the_database));
adb.setPositiveButton("Ok", (dialog, which) -> {
finish();
});
adb.show();
}
public void checkString(String name, EditText editText) {
if (TextUtils.isEmpty(name)) {
editText.setError(getResources().getString(R.string.emptySearchEditText));
return;
}
}
public void initViews() {
add_training_btn = findViewById(R.id.add_training_btnADD);
go_back_btn = findViewById(R.id.go_trainings_btn);
name_et = findViewById(R.id.exercise_name_et);
reps_et = findViewById(R.id.number_of_reps_et);
series_et = findViewById(R.id.number_of_series_et);
}
}
| 3,318 | 0.652803 | 0.652502 | 96 | 33.5625 | 29.496403 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8125 | false | false | 4 |
7b4ecb72c0bfc27fd161518db2ae08456c1d735c | 35,948,876,274,829 | 5fc5852b408a231afab98dcc075a9185a83af9be | /src/main/java/com/example/localtest/smartstoreapi/product/type/AddressBookListType.java | 6be8f72fe1b63ccb7f9815b02c1f2ec5973f0fd5 | [] | no_license | 921126sh/smart-store | https://github.com/921126sh/smart-store | d5d5f22f75a06fde48fe1316c8c18eee6f7a219e | 411250d8672be3eae46cc194ae452b447b41a924 | refs/heads/master | 2023-05-09T15:00:02.094000 | 2021-05-31T05:05:05 | 2021-05-31T05:05:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.localtest.smartstoreapi.product.type;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>AddressBookListType complex type에 대한 Java 클래스입니다.
*
* <p>다음 스키마 단편이 이 클래스에 포함되는 필요한 콘텐츠를 지정합니다.
*
* <pre>
* <complexType name="AddressBookListType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="AddressBook" type="{http://shopn.platform.nhncorp.com/}AddressBookReturnType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AddressBookListType", propOrder = {
"addressBook"
})
public class AddressBookListType {
@XmlElement(name = "AddressBook")
protected List<AddressBookReturnType> addressBook;
/**
* Gets the value of the addressBook property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the addressBook property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAddressBook().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AddressBookReturnType }
*
*
*/
public List<AddressBookReturnType> getAddressBook() {
if (addressBook == null) {
addressBook = new ArrayList<AddressBookReturnType>();
}
return this.addressBook;
}
}
| UTF-8 | Java | 2,033 | java | AddressBookListType.java | Java | [] | null | [] |
package com.example.localtest.smartstoreapi.product.type;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>AddressBookListType complex type에 대한 Java 클래스입니다.
*
* <p>다음 스키마 단편이 이 클래스에 포함되는 필요한 콘텐츠를 지정합니다.
*
* <pre>
* <complexType name="AddressBookListType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="AddressBook" type="{http://shopn.platform.nhncorp.com/}AddressBookReturnType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AddressBookListType", propOrder = {
"addressBook"
})
public class AddressBookListType {
@XmlElement(name = "AddressBook")
protected List<AddressBookReturnType> addressBook;
/**
* Gets the value of the addressBook property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the addressBook property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAddressBook().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AddressBookReturnType }
*
*
*/
public List<AddressBookReturnType> getAddressBook() {
if (addressBook == null) {
addressBook = new ArrayList<AddressBookReturnType>();
}
return this.addressBook;
}
}
| 2,033 | 0.654062 | 0.650996 | 68 | 27.764706 | 26.869576 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 4 |
004a7813c1d8af91d0810ee7c56d6ea90cbbc921 | 8,572,754,756,292 | 947edc58e161933b70d595242d4663a6d0e68623 | /pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/CtcdSalarytypeController.java | 7c5a491e753ad5efce419796b365bc7b45266623 | [] | no_license | jieke360/pig6 | https://github.com/jieke360/pig6 | 5a5de28b0e4785ff8872e7259fc46d1f5286d4d9 | 8413feed8339fab804b11af8d3fbab406eb80b68 | refs/heads/master | 2023-02-04T12:39:34.279000 | 2020-12-31T03:57:43 | 2020-12-31T03:57:43 | 325,705,631 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.admin.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.admin.entity.CtcdSalarykind;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
import com.pig4cloud.pigx.admin.entity.CtcdSalarytype;
import com.pig4cloud.pigx.admin.service.CtcdSalarytypeService;
import com.pig4cloud.pigx.common.security.service.PigxUser;
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 薪资类型
*
* @author gaoxiao
* @date 2020-06-11 14:00:23
*/
@RestController
@AllArgsConstructor
@RequestMapping("/ctcdsalarytype" )
@Api(value = "ctcdsalarytype", tags = "薪资类型管理")
public class CtcdSalarytypeController {
private final CtcdSalarytypeService ctcdSalarytypeService;
/**
* 分页查询
* @param page 分页对象
* @param ctcdSalarytype 薪资类型
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
public R getCtcdSalarytypePage(Page page, CtcdSalarytype ctcdSalarytype) {
return R.ok(ctcdSalarytypeService.page(page, Wrappers.query(ctcdSalarytype)));
}
/**
* 薪资类型
* @param ctcdSalarytype
* @ctcdSalarytype
*/
@ApiOperation(value = "查询所有", notes = "查询所有")
@PostMapping("/getAllCtcdSalarytype" )
public R getAllCtcdSalarytype( CtcdSalarytype ctcdSalarytype) {
PigxUser pigxUser = SecurityUtils.getUser();
String corpcode = pigxUser.getCorpcode();
if(StringUtils.isEmpty(ctcdSalarytype)){
ctcdSalarytype = new CtcdSalarytype();
}
ctcdSalarytype.setCorpcode(corpcode);
return R.ok(ctcdSalarytypeService.list(Wrappers.query(ctcdSalarytype)));
}
/**
* 通过id查询薪资类型
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
public R getById(@PathVariable("id" ) Integer id) {
return R.ok(ctcdSalarytypeService.getById(id));
}
/**
* 新增薪资类型 @PreAuthorize("@pms.hasPermission('admin_ctcdsalarytype_add')" )
* @param ctcdSalarytype 薪资类型
* @return R
*/
@ApiOperation(value = "新增薪资类型", notes = "新增薪资类型")
@SysLog("新增薪资类型" )
@PostMapping("/save")
public R save(@RequestBody CtcdSalarytype ctcdSalarytype) {
PigxUser pigxUser = SecurityUtils.getUser();
String corpcode = pigxUser.getCorpcode();
QueryWrapper<CtcdSalarytype> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("title",ctcdSalarytype.getTitle());
queryWrapper.eq("corpcode",pigxUser.getCorpcode());
List list = ctcdSalarytypeService.list(queryWrapper);
if(list.size()>0){
return R.failed("名称重复,请核实!");
}
ctcdSalarytype.setCorpcode(corpcode);
ctcdSalarytype.setCorpid(pigxUser.getCorpid());
return R.ok(ctcdSalarytypeService.save(ctcdSalarytype));
}
/**
* 修改薪资类型 @PreAuthorize("@pms.hasPermission('admin_ctcdsalarytype_edit')" )
* @param ctcdSalarytype 薪资类型
* @return R
*/
@ApiOperation(value = "修改薪资类型", notes = "修改薪资类型")
@SysLog("修改薪资类型" )
@PostMapping("/updateById")
public R updateById(@RequestBody CtcdSalarytype ctcdSalarytype) {
PigxUser pigxUser = SecurityUtils.getUser();
String corpcode = pigxUser.getCorpcode();
QueryWrapper<CtcdSalarytype> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("title",ctcdSalarytype.getTitle());
queryWrapper.eq("corpcode",corpcode);
queryWrapper.ne("id",ctcdSalarytype.getId());
List list = ctcdSalarytypeService.list(queryWrapper);
if(list.size()>0){
return R.failed("名称重复,请核实!");
}
UpdateWrapper<CtcdSalarytype> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("corpcode",corpcode);
updateWrapper.eq("id",ctcdSalarytype.getId());
return R.ok(ctcdSalarytypeService.update(ctcdSalarytype,updateWrapper));
}
/**
* 通过id删除薪资类型
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除薪资类型", notes = "通过id删除薪资类型")
@SysLog("通过id删除薪资类型" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('admin_ctcdsalarytype_del')" )
public R removeById(@PathVariable Integer id) {
return R.ok(ctcdSalarytypeService.removeById(id));
}
}
| UTF-8 | Java | 5,805 | java | CtcdSalarytypeController.java | Java | [
{
"context": "/*\n * Copyright (c) 2018-2025, lengleng All rights reserved.\n *\n * Redistribution and use",
"end": 42,
"score": 0.7867026925086975,
"start": 34,
"tag": "NAME",
"value": "lengleng"
},
{
"context": "hout specific prior written permission.\n * Author: lengleng (wangiegie@gmail.com)\n */\n\npackage com.pig4cloud.",
"end": 785,
"score": 0.6866014003753662,
"start": 777,
"tag": "NAME",
"value": "lengleng"
},
{
"context": "ic prior written permission.\n * Author: lengleng (wangiegie@gmail.com)\n */\n\npackage com.pig4cloud.pigx.admin.controller",
"end": 806,
"score": 0.9999215602874756,
"start": 787,
"tag": "EMAIL",
"value": "wangiegie@gmail.com"
},
{
"context": "import java.util.List;\n\n\n/**\n * 薪资类型\n *\n * @author gaoxiao\n * @date 2020-06-11 14:00:23\n */\n@RestController\n",
"end": 1848,
"score": 0.99869704246521,
"start": 1841,
"tag": "USERNAME",
"value": "gaoxiao"
}
] | null | [] | /*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (<EMAIL>)
*/
package com.pig4cloud.pigx.admin.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.admin.entity.CtcdSalarykind;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
import com.pig4cloud.pigx.admin.entity.CtcdSalarytype;
import com.pig4cloud.pigx.admin.service.CtcdSalarytypeService;
import com.pig4cloud.pigx.common.security.service.PigxUser;
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 薪资类型
*
* @author gaoxiao
* @date 2020-06-11 14:00:23
*/
@RestController
@AllArgsConstructor
@RequestMapping("/ctcdsalarytype" )
@Api(value = "ctcdsalarytype", tags = "薪资类型管理")
public class CtcdSalarytypeController {
private final CtcdSalarytypeService ctcdSalarytypeService;
/**
* 分页查询
* @param page 分页对象
* @param ctcdSalarytype 薪资类型
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
public R getCtcdSalarytypePage(Page page, CtcdSalarytype ctcdSalarytype) {
return R.ok(ctcdSalarytypeService.page(page, Wrappers.query(ctcdSalarytype)));
}
/**
* 薪资类型
* @param ctcdSalarytype
* @ctcdSalarytype
*/
@ApiOperation(value = "查询所有", notes = "查询所有")
@PostMapping("/getAllCtcdSalarytype" )
public R getAllCtcdSalarytype( CtcdSalarytype ctcdSalarytype) {
PigxUser pigxUser = SecurityUtils.getUser();
String corpcode = pigxUser.getCorpcode();
if(StringUtils.isEmpty(ctcdSalarytype)){
ctcdSalarytype = new CtcdSalarytype();
}
ctcdSalarytype.setCorpcode(corpcode);
return R.ok(ctcdSalarytypeService.list(Wrappers.query(ctcdSalarytype)));
}
/**
* 通过id查询薪资类型
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
public R getById(@PathVariable("id" ) Integer id) {
return R.ok(ctcdSalarytypeService.getById(id));
}
/**
* 新增薪资类型 @PreAuthorize("@pms.hasPermission('admin_ctcdsalarytype_add')" )
* @param ctcdSalarytype 薪资类型
* @return R
*/
@ApiOperation(value = "新增薪资类型", notes = "新增薪资类型")
@SysLog("新增薪资类型" )
@PostMapping("/save")
public R save(@RequestBody CtcdSalarytype ctcdSalarytype) {
PigxUser pigxUser = SecurityUtils.getUser();
String corpcode = pigxUser.getCorpcode();
QueryWrapper<CtcdSalarytype> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("title",ctcdSalarytype.getTitle());
queryWrapper.eq("corpcode",pigxUser.getCorpcode());
List list = ctcdSalarytypeService.list(queryWrapper);
if(list.size()>0){
return R.failed("名称重复,请核实!");
}
ctcdSalarytype.setCorpcode(corpcode);
ctcdSalarytype.setCorpid(pigxUser.getCorpid());
return R.ok(ctcdSalarytypeService.save(ctcdSalarytype));
}
/**
* 修改薪资类型 @PreAuthorize("@pms.hasPermission('admin_ctcdsalarytype_edit')" )
* @param ctcdSalarytype 薪资类型
* @return R
*/
@ApiOperation(value = "修改薪资类型", notes = "修改薪资类型")
@SysLog("修改薪资类型" )
@PostMapping("/updateById")
public R updateById(@RequestBody CtcdSalarytype ctcdSalarytype) {
PigxUser pigxUser = SecurityUtils.getUser();
String corpcode = pigxUser.getCorpcode();
QueryWrapper<CtcdSalarytype> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("title",ctcdSalarytype.getTitle());
queryWrapper.eq("corpcode",corpcode);
queryWrapper.ne("id",ctcdSalarytype.getId());
List list = ctcdSalarytypeService.list(queryWrapper);
if(list.size()>0){
return R.failed("名称重复,请核实!");
}
UpdateWrapper<CtcdSalarytype> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("corpcode",corpcode);
updateWrapper.eq("id",ctcdSalarytype.getId());
return R.ok(ctcdSalarytypeService.update(ctcdSalarytype,updateWrapper));
}
/**
* 通过id删除薪资类型
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除薪资类型", notes = "通过id删除薪资类型")
@SysLog("通过id删除薪资类型" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('admin_ctcdsalarytype_del')" )
public R removeById(@PathVariable Integer id) {
return R.ok(ctcdSalarytypeService.removeById(id));
}
}
| 5,793 | 0.725945 | 0.71992 | 155 | 34.335484 | 25.169176 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.941935 | false | false | 4 |
4d52ba09f706bb57e2fb8c37a9788aa500b39149 | 4,269,197,521,434 | d0c1a89d3e10e95265d0e35b322051d2b413b7f5 | /src/main/java/seedu/address/logic/commands/AssignCommand.java | 15aa9952ae274e64f4cc345cb82771692e0806cd | [
"MIT"
] | permissive | AY2021S1-CS2103T-T12-4/tp | https://github.com/AY2021S1-CS2103T-T12-4/tp | 34dcce7bea4af1840136c864bf273d428452d9c4 | 3cfa2c12485aade43ffefc40a13e2a826cacf1b3 | refs/heads/master | 2023-03-16T14:59:49.795000 | 2021-03-12T07:42:39 | 2021-03-12T07:42:39 | 293,088,999 | 1 | 5 | NOASSERTION | true | 2021-03-12T07:42:40 | 2020-09-05T14:13:07 | 2020-11-09T15:50:52 | 2021-03-12T07:42:39 | 31,853 | 1 | 5 | 0 | Java | false | false | package seedu.address.logic.commands;
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DURATION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TIME;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import seedu.address.commons.core.Messages;
import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.appointment.Date;
import seedu.address.model.appointment.Time;
import seedu.address.model.patient.Patient;
/**
* Assigns an appointment to an existing patient.
*/
public class AssignCommand extends Command {
public static final String COMMAND_WORD = "assign";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Assigns an appointment to an existing patient.\n"
+ "Parameters: "
+ "PATIENT_INDEX (must be a positive integer) "
+ PREFIX_DATE + "DATE "
+ PREFIX_TIME + "TIME "
+ "[" + PREFIX_DURATION + "DURATION] (minute in unit) \n"
+ "Example: " + COMMAND_WORD + " "
+ "1 "
+ PREFIX_DATE + "12-Dec-2021 "
+ PREFIX_TIME + "4:00PM"
+ PREFIX_DURATION + "30";
public static final String MESSAGE_SUCCESS = "New Appointment added: %1$s";
public static final String ASSIGNMENT_OVERLAP = "This time slot is occupied";
public static final String DATE_MISSING = "The date of appointment is missing";
public static final String TIME_MISSING = "The time of appointment is missing";
private final Index targetIndex;
private final DurationSupporter durationSupporter;
/**
* Creates an AssignCommand to add a new {@code Appointment}
*
* @param targetIndex index of the patient in the list.
* @param durationSupporter details of an appointment.
*/
public AssignCommand(Index targetIndex, DurationSupporter durationSupporter) {
requireAllNonNull(targetIndex, durationSupporter);
this.targetIndex = targetIndex;
this.durationSupporter = new DurationSupporter(durationSupporter);
}
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
List<Patient> lastShownPatientList = model.getFilteredPatientList();
if (targetIndex.getZeroBased() >= lastShownPatientList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PATIENT_DISPLAYED_INDEX);
}
Patient patient = lastShownPatientList.get(targetIndex.getZeroBased());
Appointment appointment = createAppointment(patient, durationSupporter);
if (model.hasOverlappingAppointment(appointment)) {
throw new CommandException(ASSIGNMENT_OVERLAP);
}
model.addAppointment(appointment);
model.commitAppointmentBook();
model.commitPatientBook();
return new CommandResult(String.format(MESSAGE_SUCCESS, appointment));
}
/**
* Creates and returns an {@code Appointment} with merged details of {@code patient}
* and {@code assignAppointmentBuilder}
*/
private static Appointment createAppointment(Patient patient, DurationSupporter durationSupporter) {
assert patient != null;
assert durationSupporter.getDate().isPresent();
assert durationSupporter.getTime().isPresent();
assert durationSupporter.getDuration().isPresent();
Date assignedDate = durationSupporter.getDate().get();
Time startTime = durationSupporter.getTime().get();
Duration assignedDuration = durationSupporter.getDuration().get();
Time endTime = new Time(startTime.getTime().plus(assignedDuration));
return new Appointment(assignedDate, startTime, endTime, patient);
}
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof AssignCommand // instanceof handles nulls
&& targetIndex.equals(((AssignCommand) other).targetIndex)
&& durationSupporter.equals(((AssignCommand) other).durationSupporter)); // state check
}
/**
* An assistant class to help parse the parameters of an {@code AssignCommand}.
*/
public static class DurationSupporter extends DateTimeLoader {
private Duration duration = Appointment.DEFAULT_DURATION;
public DurationSupporter() {}
/**
* Copies constructor.
*/
public DurationSupporter(DurationSupporter toCopy) {
setAppointmentDate(toCopy.getDate().get());
setAppointmentTime(toCopy.getTime().get());
setAppointmentDuration(toCopy.getDuration().get());
}
/**
* Sets {@code AppointmentDuration} of this {@code DurationSupporter}.
*/
public void setAppointmentDuration(Duration duration) {
this.duration = duration;
}
/**
* Gets {@code AppointmentDuration} of this {@code DurationSupporter}.
*/
public Optional<Duration> getDuration() {
return Optional.ofNullable(duration);
}
/**
* Gets {@code Time} of the start of this {@code DurationSupporter}
*/
public Optional<Time> getStartTime(Time end) {
return Optional.of(new Time(end.getTime().minus(duration)));
}
/**
* Gets {@code Time} of the end of this {@code DurationSupporter}
*/
public Optional<Time> getEndTime(Time start) {
return Optional.of(new Time(start.getTime().plus(duration)));
}
@Override
public boolean equals(Object other) {
// short circuit if same object
if (other == this) {
return true;
}
// instanceof handles nulls
if (!(other instanceof DurationSupporter)) {
return false;
}
// state check
DurationSupporter supporter = (DurationSupporter) other;
return getDate().equals(supporter.getDate())
&& getTime().equals(supporter.getTime())
&& getDuration().equals(supporter.getDuration());
}
}
}
| UTF-8 | Java | 6,582 | java | AssignCommand.java | Java | [] | null | [] | package seedu.address.logic.commands;
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DURATION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TIME;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import seedu.address.commons.core.Messages;
import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.appointment.Date;
import seedu.address.model.appointment.Time;
import seedu.address.model.patient.Patient;
/**
* Assigns an appointment to an existing patient.
*/
public class AssignCommand extends Command {
public static final String COMMAND_WORD = "assign";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Assigns an appointment to an existing patient.\n"
+ "Parameters: "
+ "PATIENT_INDEX (must be a positive integer) "
+ PREFIX_DATE + "DATE "
+ PREFIX_TIME + "TIME "
+ "[" + PREFIX_DURATION + "DURATION] (minute in unit) \n"
+ "Example: " + COMMAND_WORD + " "
+ "1 "
+ PREFIX_DATE + "12-Dec-2021 "
+ PREFIX_TIME + "4:00PM"
+ PREFIX_DURATION + "30";
public static final String MESSAGE_SUCCESS = "New Appointment added: %1$s";
public static final String ASSIGNMENT_OVERLAP = "This time slot is occupied";
public static final String DATE_MISSING = "The date of appointment is missing";
public static final String TIME_MISSING = "The time of appointment is missing";
private final Index targetIndex;
private final DurationSupporter durationSupporter;
/**
* Creates an AssignCommand to add a new {@code Appointment}
*
* @param targetIndex index of the patient in the list.
* @param durationSupporter details of an appointment.
*/
public AssignCommand(Index targetIndex, DurationSupporter durationSupporter) {
requireAllNonNull(targetIndex, durationSupporter);
this.targetIndex = targetIndex;
this.durationSupporter = new DurationSupporter(durationSupporter);
}
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
List<Patient> lastShownPatientList = model.getFilteredPatientList();
if (targetIndex.getZeroBased() >= lastShownPatientList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PATIENT_DISPLAYED_INDEX);
}
Patient patient = lastShownPatientList.get(targetIndex.getZeroBased());
Appointment appointment = createAppointment(patient, durationSupporter);
if (model.hasOverlappingAppointment(appointment)) {
throw new CommandException(ASSIGNMENT_OVERLAP);
}
model.addAppointment(appointment);
model.commitAppointmentBook();
model.commitPatientBook();
return new CommandResult(String.format(MESSAGE_SUCCESS, appointment));
}
/**
* Creates and returns an {@code Appointment} with merged details of {@code patient}
* and {@code assignAppointmentBuilder}
*/
private static Appointment createAppointment(Patient patient, DurationSupporter durationSupporter) {
assert patient != null;
assert durationSupporter.getDate().isPresent();
assert durationSupporter.getTime().isPresent();
assert durationSupporter.getDuration().isPresent();
Date assignedDate = durationSupporter.getDate().get();
Time startTime = durationSupporter.getTime().get();
Duration assignedDuration = durationSupporter.getDuration().get();
Time endTime = new Time(startTime.getTime().plus(assignedDuration));
return new Appointment(assignedDate, startTime, endTime, patient);
}
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof AssignCommand // instanceof handles nulls
&& targetIndex.equals(((AssignCommand) other).targetIndex)
&& durationSupporter.equals(((AssignCommand) other).durationSupporter)); // state check
}
/**
* An assistant class to help parse the parameters of an {@code AssignCommand}.
*/
public static class DurationSupporter extends DateTimeLoader {
private Duration duration = Appointment.DEFAULT_DURATION;
public DurationSupporter() {}
/**
* Copies constructor.
*/
public DurationSupporter(DurationSupporter toCopy) {
setAppointmentDate(toCopy.getDate().get());
setAppointmentTime(toCopy.getTime().get());
setAppointmentDuration(toCopy.getDuration().get());
}
/**
* Sets {@code AppointmentDuration} of this {@code DurationSupporter}.
*/
public void setAppointmentDuration(Duration duration) {
this.duration = duration;
}
/**
* Gets {@code AppointmentDuration} of this {@code DurationSupporter}.
*/
public Optional<Duration> getDuration() {
return Optional.ofNullable(duration);
}
/**
* Gets {@code Time} of the start of this {@code DurationSupporter}
*/
public Optional<Time> getStartTime(Time end) {
return Optional.of(new Time(end.getTime().minus(duration)));
}
/**
* Gets {@code Time} of the end of this {@code DurationSupporter}
*/
public Optional<Time> getEndTime(Time start) {
return Optional.of(new Time(start.getTime().plus(duration)));
}
@Override
public boolean equals(Object other) {
// short circuit if same object
if (other == this) {
return true;
}
// instanceof handles nulls
if (!(other instanceof DurationSupporter)) {
return false;
}
// state check
DurationSupporter supporter = (DurationSupporter) other;
return getDate().equals(supporter.getDate())
&& getTime().equals(supporter.getTime())
&& getDuration().equals(supporter.getDuration());
}
}
}
| 6,582 | 0.653601 | 0.651626 | 175 | 36.611427 | 29.628132 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 4 |
8701cb333ea0dd76872d031f507357df35546905 | 21,955,872,858,903 | edb159b83a4cbad1c4ec66eca1d6de6294a99f7e | /smartmon-falcon/src/main/java/smartmon/falcon/controller/vo/HostGroupModifyVo.java | 479dc72c05bb9bca3e397daa6375f2bfce77c0bd | [] | no_license | java404/recode | https://github.com/java404/recode | 4c36dbacd3f87ed1cf55e64cf7d185a2639ef494 | b11a0b2ff12697d90922af7749ee282821623d45 | refs/heads/master | 2022-10-18T23:58:20.269000 | 2020-06-04T10:17:01 | 2020-06-04T10:17:01 | 258,482,172 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package smartmon.falcon.controller.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Set;
import lombok.Data;
@Data
@ApiModel(value = "host group modify model")
public class HostGroupModifyVo {
@ApiModelProperty(value = "group id", position = 1)
private String groupId;
@ApiModelProperty(value = "hostNames", position = 2)
private Set<String> hostNames;
}
| UTF-8 | Java | 427 | java | HostGroupModifyVo.java | Java | [] | null | [] | package smartmon.falcon.controller.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Set;
import lombok.Data;
@Data
@ApiModel(value = "host group modify model")
public class HostGroupModifyVo {
@ApiModelProperty(value = "group id", position = 1)
private String groupId;
@ApiModelProperty(value = "hostNames", position = 2)
private Set<String> hostNames;
}
| 427 | 0.76815 | 0.763466 | 15 | 27.333334 | 18.492041 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 4 |
173d3d23902161509482db4a6760a29beb78aff7 | 16,544,214,057,156 | 7ec96ecf1f9c1aecab3884c4c8f335dc62743616 | /csx-b2b-sss-service/src/main/java/com/yh/csx/sss/service/impl/SssSourceBillServiceImpl.java | 334a904f8a01b36b3d272b6776cb3a5b2faf1909 | [] | no_license | tomdev2008/csx-b2b-sss | https://github.com/tomdev2008/csx-b2b-sss | 1ab276b849137d4ce06f82332f399d50c7936f42 | 9ec040ebd6ae5ad42ba98e41769faa5f5dd8b328 | refs/heads/master | 2023-03-18T09:16:25.350000 | 2020-01-10T02:17:17 | 2020-01-10T02:17:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yh.csx.sss.service.impl;
import com.yh.csx.bsf.core.base.mapper.Mapper;
import com.yh.csx.sss.core.easyexcel.EasyExcelExecutor;
import com.yh.csx.sss.core.easyexcel.ExportSheetDetail;
import com.yh.csx.sss.service.excel.SssSourceBillExcel;
import com.yh.csx.sss.dao.repository.SssSourceBillRepository;
import com.yh.csx.sss.dao.model.entity.SssSourceBillDO;
import com.yh.csx.sss.service.request.SssSourceBillRequest;
import com.yh.csx.sss.service.response.SssSourceBillResponse;
import com.yh.csx.sss.service.SssSourceBillService;
import com.baomidou.mybatisplus.plugins.Page;
import java.util.ArrayList;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 客户对账来源单添加校验
* @author zhangLong
* @since 2020-01-09 21:25:30
*/
@Service
public class SssSourceBillServiceImpl implements SssSourceBillService{
@Resource
private SssSourceBillRepository sssSourceBillRepository;
@Override
public Page<SssSourceBillDO> loadPage( SssSourceBillRequest sssSourceBillRequest ) {
return sssSourceBillRepository.selectPage( sssSourceBillRequest.page(), sssSourceBillRequest.queryWrapper());
}
@Override
public List<SssSourceBillDO> loadList( SssSourceBillRequest sssSourceBillRequest ) {
return sssSourceBillRepository.selectList(sssSourceBillRequest.queryWrapper());
}
@Override
public SssSourceBillDO loadDetail( Long id ) {
return sssSourceBillRepository.selectById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveSssSourceBill( SssSourceBillRequest sssSourceBillRequest ) {
sssSourceBillRepository.insert(Mapper.map(sssSourceBillRequest, SssSourceBillDO.class));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateSssSourceBill( SssSourceBillRequest sssSourceBillRequest ) {
sssSourceBillRepository.update(Mapper.map(sssSourceBillRequest, SssSourceBillDO.class), sssSourceBillRequest.queryWrapper());
}
@Override
public void exportSssSourceBill( SssSourceBillRequest sssSourceBillRequest ) {
final List<SssSourceBillDO> list = sssSourceBillRepository
.selectList(sssSourceBillRequest.queryWrapper());
final List<ExportSheetDetail<SssSourceBillExcel, SssSourceBillDO>> exportSheetDetails = new ArrayList<>();
final ExportSheetDetail<SssSourceBillExcel, SssSourceBillDO> exportExportSheetDetail =
new ExportSheetDetail<>(SssSourceBillExcel.class, list, "",null, 0);
exportSheetDetails.add(exportExportSheetDetail);
EasyExcelExecutor.exportMoreSheet( "客户对账来源单", exportSheetDetails);
}
} | UTF-8 | Java | 2,820 | java | SssSourceBillServiceImpl.java | Java | [
{
"context": "rt java.util.List;\n\n\n/**\n * 客户对账来源单添加校验\n * @author zhangLong\n * @since 2020-01-09 21:25:30\n */\n@Service\npublic",
"end": 831,
"score": 0.9609847664833069,
"start": 822,
"tag": "NAME",
"value": "zhangLong"
}
] | null | [] | package com.yh.csx.sss.service.impl;
import com.yh.csx.bsf.core.base.mapper.Mapper;
import com.yh.csx.sss.core.easyexcel.EasyExcelExecutor;
import com.yh.csx.sss.core.easyexcel.ExportSheetDetail;
import com.yh.csx.sss.service.excel.SssSourceBillExcel;
import com.yh.csx.sss.dao.repository.SssSourceBillRepository;
import com.yh.csx.sss.dao.model.entity.SssSourceBillDO;
import com.yh.csx.sss.service.request.SssSourceBillRequest;
import com.yh.csx.sss.service.response.SssSourceBillResponse;
import com.yh.csx.sss.service.SssSourceBillService;
import com.baomidou.mybatisplus.plugins.Page;
import java.util.ArrayList;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 客户对账来源单添加校验
* @author zhangLong
* @since 2020-01-09 21:25:30
*/
@Service
public class SssSourceBillServiceImpl implements SssSourceBillService{
@Resource
private SssSourceBillRepository sssSourceBillRepository;
@Override
public Page<SssSourceBillDO> loadPage( SssSourceBillRequest sssSourceBillRequest ) {
return sssSourceBillRepository.selectPage( sssSourceBillRequest.page(), sssSourceBillRequest.queryWrapper());
}
@Override
public List<SssSourceBillDO> loadList( SssSourceBillRequest sssSourceBillRequest ) {
return sssSourceBillRepository.selectList(sssSourceBillRequest.queryWrapper());
}
@Override
public SssSourceBillDO loadDetail( Long id ) {
return sssSourceBillRepository.selectById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveSssSourceBill( SssSourceBillRequest sssSourceBillRequest ) {
sssSourceBillRepository.insert(Mapper.map(sssSourceBillRequest, SssSourceBillDO.class));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateSssSourceBill( SssSourceBillRequest sssSourceBillRequest ) {
sssSourceBillRepository.update(Mapper.map(sssSourceBillRequest, SssSourceBillDO.class), sssSourceBillRequest.queryWrapper());
}
@Override
public void exportSssSourceBill( SssSourceBillRequest sssSourceBillRequest ) {
final List<SssSourceBillDO> list = sssSourceBillRepository
.selectList(sssSourceBillRequest.queryWrapper());
final List<ExportSheetDetail<SssSourceBillExcel, SssSourceBillDO>> exportSheetDetails = new ArrayList<>();
final ExportSheetDetail<SssSourceBillExcel, SssSourceBillDO> exportExportSheetDetail =
new ExportSheetDetail<>(SssSourceBillExcel.class, list, "",null, 0);
exportSheetDetails.add(exportExportSheetDetail);
EasyExcelExecutor.exportMoreSheet( "客户对账来源单", exportSheetDetails);
}
} | 2,820 | 0.775862 | 0.770474 | 70 | 38.785713 | 34.722942 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542857 | false | false | 4 |
d71770ed55fddefa4bd9fb6c422f043025b0e676 | 38,044,820,308,952 | 7a863dcd56f688de36920d69656dae7e1900f7f9 | /src/main/java/io/zipcoder/casino/card/games/Blackjack.java | 56c55f7230f19259ce1a05ea9814eb59d3f8d960 | [] | no_license | fdhulmes/casino-sim | https://github.com/fdhulmes/casino-sim | b3abc81206a99ca5f0f7e560e2086400d092a5d3 | 201c85f05d0a491246385b7d1b2350cd628474b1 | refs/heads/master | 2022-12-22T02:57:56.278000 | 2020-09-18T00:20:46 | 2020-09-18T00:20:46 | 296,471,095 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.zipcoder.casino.card.games;
import io.zipcoder.casino.*;
import io.zipcoder.casino.card.utilities.Card;
import io.zipcoder.casino.card.utilities.CardGame;
import io.zipcoder.casino.card.utilities.CardRank;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Blackjack extends CardGame implements GamblingGame {
private Map<Player, Integer> playerBets;
private Console console = new Console(System.in, System.out);
public Blackjack(Player player) {
super(2, player);
playerBets = new HashMap<>();
}
public void dealCard(Player player) {
Card card = deck.draw();
console.print(player.toString()+" has drawn a "+ card.toString()+"\n");
playerHands.get(player).add(card);
}
public Integer countHand(Player player) {
Integer currentValue = 0;
Boolean hasAce = false;
for(Card card: playerHands.get(player)){
currentValue += cardValueCalculator(card);
if(card.getRank() == CardRank.ACE){
hasAce = true;
}
}
if(currentValue > 21 && hasAce){
currentValue -=10;
}
return currentValue;
}
public Boolean getPlayerChoice() {
console.print("Would you like another card? yes/no");
while(true) {
String userInput = console.getStringInput("");
if (userInput.toLowerCase().equals("yes")) {
return true;
} else if (userInput.toLowerCase().equals("no")) {
return false;
} else {
console.print("Please enter \"yes\" or \"no\"");
}
}
}
public Boolean playerBust(Player player) {
if(countHand(player) > 21){
console.println("Oh no! "+player.toString()+" went bust!");
playerBets.replace(player,-1);
pauseForReadability();
return true;
} else {
return false;
}
}
private void dealerTurn(){
console.println("Dealer hand: "+showHand(dealer));
while(countHand(dealer) <=16){
dealCard(dealer);
pauseForReadability();
}
if(playerBust(dealer)){
playerBets.replace(dealer,-1);
}
}
public void takeBet() {
Integer wager = console.getIntegerInput("Please place your wager:");
if(wager <= ((GamblingPlayer) this.activePlayer).getBalance()) {
((GamblingPlayer) this.activePlayer).withdraw(wager);
playerBets.put(activePlayer, wager);
playerBets.put(dealer, wager);
} else {
console.println("Insufficient funds!");
takeBet();
}
}
public void payout() {
int winnings = playerBets.get(activePlayer)*2;
((GamblingPlayer) this.activePlayer).deposit(winnings);
}
public void payBack() {
int wager = playerBets.get(activePlayer);
((GamblingPlayer) this.activePlayer).deposit(wager);
}
public void play() {
console.println(printGameRules());
takeBet();
console.println("Dealer has a "+ playerHands.get(dealer).get(0));
pauseForReadability();
while(gameState){
nextTurn();
}
if(playerTwentyOne()){
payout();
} else if(playerBets.get(activePlayer) >= 0) {
dealerTurn();
if(determineWinner()){
payout();
}
}
exit();
}
public void nextTurn() {
console.println("Your hand: "+showHand(activePlayer));
Boolean choice = getPlayerChoice();
if(choice){
dealCard(activePlayer);
} else {
gameState = false;
}
if(playerBust(activePlayer)){
gameState = false;
}
}
public Boolean playerTwentyOne(){
if(countHand(activePlayer).equals(21)){
console.println(activePlayer.toString() + " wins! You won " + playerBets.get(activePlayer) * 2);
return true;
}
return false;
}
private Boolean determineWinner() {
if ((countHand(activePlayer) > countHand(dealer)) || (playerBets.get(dealer) < 0)) {
console.println(activePlayer.toString() + " wins! You won " + playerBets.get(activePlayer) * 2);
pauseForReadability();
return true;
} else if(countHand(activePlayer) == countHand(dealer)){
console.println("Game ends in a draw.");
payBack();
return false;
}else{
console.println("Dealer wins.");
pauseForReadability();
return false;
}
}
public int cardValueCalculator(Card card){
int returnValue;
switch (card.getRank()){
case ACE:
returnValue = 11;
break;
case TWO:
returnValue = 2;
break;
case THREE:
returnValue = 3;
break;
case FOUR:
returnValue = 4;
break;
case FIVE:
returnValue = 5;
break;
case SIX:
returnValue = 6;
break;
case SEVEN:
returnValue = 7;
break;
case EIGHT:
returnValue = 8;
break;
case NINE:
returnValue = 9;
break;
case TEN:
returnValue = 10;
break;
case JACK:
returnValue = 10;
break;
case QUEEN:
returnValue = 10;
break;
case KING:
returnValue = 10;
break;
default:
returnValue = 0;
}
return returnValue;
}
public Boolean checkGameState() {
return gameState;
}
public String printGameRules() {
String rules = "* The goal of the game is to beat the dealer's hand without going over 21\n" +
"* You and the dealer start with two cards. One of the dealer's cards is hidden until their turn.\n"+
"* You can ask for additional cards until you want to stop or you go over 21.\n"+
"* Cards Two through Ten are face value. Face cards are worth 10. Aces are worth 1 or 11.\n\n";
return rules;
}
private void pauseForReadability(){
try{
Thread.sleep(1000);
} catch (InterruptedException e){
Logger logger = Logger.getLogger(Casino.class.getName());
logger.log(Level.INFO, e.toString());
}
}
public void exit() {
console.println("Thank you for playing blackjack!");
pauseForReadability();
}
}
| UTF-8 | Java | 6,988 | java | Blackjack.java | Java | [
{
"context": ") {\n console.println(\"Thank you for playing blackjack!\");\n pauseForReadability();\n }\n}\n",
"end": 6944,
"score": 0.6733119487762451,
"start": 6935,
"tag": "NAME",
"value": "blackjack"
}
] | null | [] | package io.zipcoder.casino.card.games;
import io.zipcoder.casino.*;
import io.zipcoder.casino.card.utilities.Card;
import io.zipcoder.casino.card.utilities.CardGame;
import io.zipcoder.casino.card.utilities.CardRank;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Blackjack extends CardGame implements GamblingGame {
private Map<Player, Integer> playerBets;
private Console console = new Console(System.in, System.out);
public Blackjack(Player player) {
super(2, player);
playerBets = new HashMap<>();
}
public void dealCard(Player player) {
Card card = deck.draw();
console.print(player.toString()+" has drawn a "+ card.toString()+"\n");
playerHands.get(player).add(card);
}
public Integer countHand(Player player) {
Integer currentValue = 0;
Boolean hasAce = false;
for(Card card: playerHands.get(player)){
currentValue += cardValueCalculator(card);
if(card.getRank() == CardRank.ACE){
hasAce = true;
}
}
if(currentValue > 21 && hasAce){
currentValue -=10;
}
return currentValue;
}
public Boolean getPlayerChoice() {
console.print("Would you like another card? yes/no");
while(true) {
String userInput = console.getStringInput("");
if (userInput.toLowerCase().equals("yes")) {
return true;
} else if (userInput.toLowerCase().equals("no")) {
return false;
} else {
console.print("Please enter \"yes\" or \"no\"");
}
}
}
public Boolean playerBust(Player player) {
if(countHand(player) > 21){
console.println("Oh no! "+player.toString()+" went bust!");
playerBets.replace(player,-1);
pauseForReadability();
return true;
} else {
return false;
}
}
private void dealerTurn(){
console.println("Dealer hand: "+showHand(dealer));
while(countHand(dealer) <=16){
dealCard(dealer);
pauseForReadability();
}
if(playerBust(dealer)){
playerBets.replace(dealer,-1);
}
}
public void takeBet() {
Integer wager = console.getIntegerInput("Please place your wager:");
if(wager <= ((GamblingPlayer) this.activePlayer).getBalance()) {
((GamblingPlayer) this.activePlayer).withdraw(wager);
playerBets.put(activePlayer, wager);
playerBets.put(dealer, wager);
} else {
console.println("Insufficient funds!");
takeBet();
}
}
public void payout() {
int winnings = playerBets.get(activePlayer)*2;
((GamblingPlayer) this.activePlayer).deposit(winnings);
}
public void payBack() {
int wager = playerBets.get(activePlayer);
((GamblingPlayer) this.activePlayer).deposit(wager);
}
public void play() {
console.println(printGameRules());
takeBet();
console.println("Dealer has a "+ playerHands.get(dealer).get(0));
pauseForReadability();
while(gameState){
nextTurn();
}
if(playerTwentyOne()){
payout();
} else if(playerBets.get(activePlayer) >= 0) {
dealerTurn();
if(determineWinner()){
payout();
}
}
exit();
}
public void nextTurn() {
console.println("Your hand: "+showHand(activePlayer));
Boolean choice = getPlayerChoice();
if(choice){
dealCard(activePlayer);
} else {
gameState = false;
}
if(playerBust(activePlayer)){
gameState = false;
}
}
public Boolean playerTwentyOne(){
if(countHand(activePlayer).equals(21)){
console.println(activePlayer.toString() + " wins! You won " + playerBets.get(activePlayer) * 2);
return true;
}
return false;
}
private Boolean determineWinner() {
if ((countHand(activePlayer) > countHand(dealer)) || (playerBets.get(dealer) < 0)) {
console.println(activePlayer.toString() + " wins! You won " + playerBets.get(activePlayer) * 2);
pauseForReadability();
return true;
} else if(countHand(activePlayer) == countHand(dealer)){
console.println("Game ends in a draw.");
payBack();
return false;
}else{
console.println("Dealer wins.");
pauseForReadability();
return false;
}
}
public int cardValueCalculator(Card card){
int returnValue;
switch (card.getRank()){
case ACE:
returnValue = 11;
break;
case TWO:
returnValue = 2;
break;
case THREE:
returnValue = 3;
break;
case FOUR:
returnValue = 4;
break;
case FIVE:
returnValue = 5;
break;
case SIX:
returnValue = 6;
break;
case SEVEN:
returnValue = 7;
break;
case EIGHT:
returnValue = 8;
break;
case NINE:
returnValue = 9;
break;
case TEN:
returnValue = 10;
break;
case JACK:
returnValue = 10;
break;
case QUEEN:
returnValue = 10;
break;
case KING:
returnValue = 10;
break;
default:
returnValue = 0;
}
return returnValue;
}
public Boolean checkGameState() {
return gameState;
}
public String printGameRules() {
String rules = "* The goal of the game is to beat the dealer's hand without going over 21\n" +
"* You and the dealer start with two cards. One of the dealer's cards is hidden until their turn.\n"+
"* You can ask for additional cards until you want to stop or you go over 21.\n"+
"* Cards Two through Ten are face value. Face cards are worth 10. Aces are worth 1 or 11.\n\n";
return rules;
}
private void pauseForReadability(){
try{
Thread.sleep(1000);
} catch (InterruptedException e){
Logger logger = Logger.getLogger(Casino.class.getName());
logger.log(Level.INFO, e.toString());
}
}
public void exit() {
console.println("Thank you for playing blackjack!");
pauseForReadability();
}
}
| 6,988 | 0.529336 | 0.521895 | 232 | 29.120689 | 22.635857 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512931 | false | false | 4 |
8327575556185f521848bcaa43c6e5318f570c31 | 35,536,559,419,606 | e82c1473b49df5114f0332c14781d677f88f363f | /MED-CLOUD/med-data/src/main/java/nta/med/data/model/ihis/nuro/NUR2016Q00GrdPatientListInfo.java | 1381418ad991858c01f549067aa0eda478dd6414 | [] | no_license | zhiji6/mih | https://github.com/zhiji6/mih | fa1d2279388976c901dc90762bc0b5c30a2325fc | 2714d15853162a492db7ea8b953d5b863c3a8000 | refs/heads/master | 2023-08-16T18:35:19.836000 | 2017-12-28T09:33:19 | 2017-12-28T09:33:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nta.med.data.model.ihis.nuro;
import java.util.Date;
/**
* @author DEV-TiepNM
*/
public class NUR2016Q00GrdPatientListInfo {
private String bunho;
private String patientName;
private String address;
private Date birth;
private String suname;
private String surname2;
private String sex;
private String tel;
private String linkEmr;
public NUR2016Q00GrdPatientListInfo(String bunho, String patientName, String address, Date birth, String suname,
String surname2, String sex, String tel, String linkEmr) {
this.bunho = bunho;
this.patientName = patientName;
this.address = address;
this.birth = birth;
this.suname = suname;
this.surname2 = surname2;
this.sex = sex;
this.tel = tel;
this.linkEmr = linkEmr;
}
public String getBunho() {
return bunho;
}
public void setBunho(String bunho) {
this.bunho = bunho;
}
public String getSuname() {
return suname;
}
public void setSuname(String suname) {
this.suname = suname;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public String getPatientName() {
return patientName;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
public String getSurname2() {
return surname2;
}
public void setSurname2(String surname2) {
this.surname2 = surname2;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getLinkEmr() {
return linkEmr;
}
public void setLinkEmr(String linkEmr) {
this.linkEmr = linkEmr;
}
}
| UTF-8 | Java | 1,817 | java | NUR2016Q00GrdPatientListInfo.java | Java | [
{
"context": "ihis.nuro;\n\nimport java.util.Date;\n\n/**\n * @author DEV-TiepNM\n */\npublic class NUR2016Q00GrdPatientListInfo {\n\t",
"end": 88,
"score": 0.9996587634086609,
"start": 78,
"tag": "USERNAME",
"value": "DEV-TiepNM"
},
{
"context": "kEmr) {\n\t\tthis.bunho = bunho;\n\t\tthis.patientName = patientName;\n\t\tthis.address = address;\n\t\tthis.birth = birth;\n",
"end": 583,
"score": 0.8410409092903137,
"start": 572,
"tag": "NAME",
"value": "patientName"
},
{
"context": "d setSurname2(String surname2) {\n\t\tthis.surname2 = surname2;\n\t}\n\n\tpublic String getSex() {\n\t\treturn se",
"end": 1478,
"score": 0.575428307056427,
"start": 1477,
"tag": "USERNAME",
"value": "s"
}
] | null | [] | package nta.med.data.model.ihis.nuro;
import java.util.Date;
/**
* @author DEV-TiepNM
*/
public class NUR2016Q00GrdPatientListInfo {
private String bunho;
private String patientName;
private String address;
private Date birth;
private String suname;
private String surname2;
private String sex;
private String tel;
private String linkEmr;
public NUR2016Q00GrdPatientListInfo(String bunho, String patientName, String address, Date birth, String suname,
String surname2, String sex, String tel, String linkEmr) {
this.bunho = bunho;
this.patientName = patientName;
this.address = address;
this.birth = birth;
this.suname = suname;
this.surname2 = surname2;
this.sex = sex;
this.tel = tel;
this.linkEmr = linkEmr;
}
public String getBunho() {
return bunho;
}
public void setBunho(String bunho) {
this.bunho = bunho;
}
public String getSuname() {
return suname;
}
public void setSuname(String suname) {
this.suname = suname;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public String getPatientName() {
return patientName;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
public String getSurname2() {
return surname2;
}
public void setSurname2(String surname2) {
this.surname2 = surname2;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getLinkEmr() {
return linkEmr;
}
public void setLinkEmr(String linkEmr) {
this.linkEmr = linkEmr;
}
}
| 1,817 | 0.705008 | 0.6929 | 104 | 16.471153 | 17.195683 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.442308 | false | false | 4 |
5de2fb625db919f4b4958114d295f5f75bb3f929 | 7,249,904,819,782 | 2fba56d7c8d12ffe8acc66e9c5235c753958b66d | /src/test/java/net/openhft/chronicle/bytes/ref/BinaryLongReferenceTest.java | 9770181bbf6c963708dd77571bcbd44977cb543c | [
"Apache-2.0"
] | permissive | OpenHFT/Chronicle-Bytes | https://github.com/OpenHFT/Chronicle-Bytes | 121cd47f44d69d0b19272b4c72ddeafc6482bccb | 6aad9f286fada951c1c15929a4b3bf94539c8966 | refs/heads/ea | 2023-09-05T23:38:12.132000 | 2023-08-31T14:44:04 | 2023-08-31T14:44:04 | 31,261,671 | 387 | 101 | Apache-2.0 | false | 2023-09-05T08:57:05 | 2015-02-24T13:39:36 | 2023-08-24T15:20:30 | 2023-09-05T08:57:04 | 8,041 | 364 | 85 | 9 | Java | false | false | /*
* Copyright (c) 2016-2022 chronicle.software
*
* https://chronicle.software
*
* 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 net.openhft.chronicle.bytes.ref;
import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.bytes.BytesTestCommon;
import net.openhft.chronicle.bytes.MappedBytesStore;
import net.openhft.chronicle.bytes.MappedFile;
import net.openhft.chronicle.core.io.IOTools;
import net.openhft.chronicle.core.io.ReferenceOwner;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.*;
public class BinaryLongReferenceTest extends BytesTestCommon {
@Test
public void test() {
@NotNull BytesStore nbs = BytesStore.nativeStoreWithFixedCapacity(32);
try (@NotNull BinaryLongReference ref = new BinaryLongReference()) {
ref.bytesStore(nbs, 16, 8);
assertEquals(0, ref.getValue());
ref.addAtomicValue(1);
assertEquals(1, ref.getVolatileValue());
ref.addValue(-2);
assertEquals("value: -1", ref.toString());
assertFalse(ref.compareAndSwapValue(0, 1));
assertTrue(ref.compareAndSwapValue(-1, 2));
assertEquals(8, ref.maxSize());
assertEquals(16, ref.offset());
assertEquals(nbs, ref.bytesStore());
assertEquals(0L, nbs.readLong(0));
assertEquals(0L, nbs.readLong(8));
assertEquals(2L, nbs.readLong(16));
assertEquals(0L, nbs.readLong(24));
ref.setValue(10);
assertEquals(10L, nbs.readLong(16));
ref.setOrderedValue(20);
Thread.yield();
assertEquals(20L, nbs.readVolatileLong(16));
}
nbs.releaseLast();
}
@Test
public void testCanAssignByteStoreWithExistingOffsetNotInRange() throws IOException {
final File tempFile = IOTools.createTempFile("testCanAssignByteStoreWithExistingOffsetNotInRange");
final ReferenceOwner referenceOwner = ReferenceOwner.temporary("test");
try (final MappedFile mappedFile = MappedFile.mappedFile(tempFile, 4096)) {
MappedBytesStore bytes = mappedFile.acquireByteStore(referenceOwner, 8192);
try (final BinaryLongReference blr = new BinaryLongReference()) {
blr.bytesStore(bytes, 8192, 8);
blr.setValue(1234);
assertEquals(1234, blr.getValue());
} finally {
bytes.release(referenceOwner);
}
}
}
} | UTF-8 | Java | 3,112 | java | BinaryLongReferenceTest.java | Java | [] | null | [] | /*
* Copyright (c) 2016-2022 chronicle.software
*
* https://chronicle.software
*
* 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 net.openhft.chronicle.bytes.ref;
import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.bytes.BytesTestCommon;
import net.openhft.chronicle.bytes.MappedBytesStore;
import net.openhft.chronicle.bytes.MappedFile;
import net.openhft.chronicle.core.io.IOTools;
import net.openhft.chronicle.core.io.ReferenceOwner;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.*;
public class BinaryLongReferenceTest extends BytesTestCommon {
@Test
public void test() {
@NotNull BytesStore nbs = BytesStore.nativeStoreWithFixedCapacity(32);
try (@NotNull BinaryLongReference ref = new BinaryLongReference()) {
ref.bytesStore(nbs, 16, 8);
assertEquals(0, ref.getValue());
ref.addAtomicValue(1);
assertEquals(1, ref.getVolatileValue());
ref.addValue(-2);
assertEquals("value: -1", ref.toString());
assertFalse(ref.compareAndSwapValue(0, 1));
assertTrue(ref.compareAndSwapValue(-1, 2));
assertEquals(8, ref.maxSize());
assertEquals(16, ref.offset());
assertEquals(nbs, ref.bytesStore());
assertEquals(0L, nbs.readLong(0));
assertEquals(0L, nbs.readLong(8));
assertEquals(2L, nbs.readLong(16));
assertEquals(0L, nbs.readLong(24));
ref.setValue(10);
assertEquals(10L, nbs.readLong(16));
ref.setOrderedValue(20);
Thread.yield();
assertEquals(20L, nbs.readVolatileLong(16));
}
nbs.releaseLast();
}
@Test
public void testCanAssignByteStoreWithExistingOffsetNotInRange() throws IOException {
final File tempFile = IOTools.createTempFile("testCanAssignByteStoreWithExistingOffsetNotInRange");
final ReferenceOwner referenceOwner = ReferenceOwner.temporary("test");
try (final MappedFile mappedFile = MappedFile.mappedFile(tempFile, 4096)) {
MappedBytesStore bytes = mappedFile.acquireByteStore(referenceOwner, 8192);
try (final BinaryLongReference blr = new BinaryLongReference()) {
blr.bytesStore(bytes, 8192, 8);
blr.setValue(1234);
assertEquals(1234, blr.getValue());
} finally {
bytes.release(referenceOwner);
}
}
}
} | 3,112 | 0.667416 | 0.64428 | 79 | 38.405064 | 25.969563 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.848101 | false | false | 4 |
37a9756e35c2fa1bad145a83fed03a53a4fe053f | 24,180,665,943,902 | 4b09fdd056798254ba818e043b94d43531ecec57 | /union/MianClass.java | 6eefe4dcde4cc077554aa2331c2f0eda55023f6b | [] | no_license | astrotycoon/learn-java | https://github.com/astrotycoon/learn-java | 68fdadc39593a34cb20f85411607dbd6ad97a1bb | 1fce61fb6ac7a91584518ab251a169f32951b310 | refs/heads/master | 2016-09-06T21:31:58.730000 | 2012-03-09T10:01:21 | 2012-03-09T10:01:21 | 3,447,095 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class MianClass {
public static void main(String args[]) {
Circle circle = new Circle();
circle.printArea(100);
Rectangle rect = new Rectangle();
rect.printArea(100, 65);
}
}
| UTF-8 | Java | 193 | java | MianClass.java | Java | [] | null | [] | public class MianClass {
public static void main(String args[]) {
Circle circle = new Circle();
circle.printArea(100);
Rectangle rect = new Rectangle();
rect.printArea(100, 65);
}
}
| 193 | 0.683938 | 0.642487 | 8 | 23 | 13.546217 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.875 | false | false | 4 |
057befd93115035bb8de4e8af088b27476c09ced | 28,381,143,927,700 | 51934a954934c21cae6a8482a6f5e6c3b3bd5c5a | /output/c168fd95d9584d94a4802e8bde84af2a.java | f2956d22ecc116f3fa1a01e494b02de157b243de | [
"MIT",
"Apache-2.0"
] | permissive | comprakt/comprakt-fuzz-tests | https://github.com/comprakt/comprakt-fuzz-tests | e8c954d94b4f4615c856fd3108010011610a5f73 | c0082d105d7c54ad31ab4ea461c3b8319358eaaa | refs/heads/master | 2021-09-25T15:29:58.589000 | 2018-10-23T17:33:46 | 2018-10-23T17:33:46 | 154,370,249 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Lci0v93uR {
public int IkSGA;
public int y2Td1tGG () throws n0i2jK {
if ( new void[ ( !622823627.FH7z8OVrdCcm)[ !( true[ !( T5vHAT3mRFA_ud.aHziSzT93FmT4d).uN]).eQl3]][ ( 92442225.Gb6ZgRFn()).IvtdDzrCtmsc3i()]) if ( 13[ -b0p1.lvsX2IjyJeC]) if ( this.WYa1) {
return;
}else {
k0JU[] FUO;
}
int[][] QhmigAbY = this.Jek() = !!--!-!!Zh()[ this[ !-!P771P().Y_28ywcCnMxx]];
int[] OZmFEDtjaU5E;
while ( ZJSpGa.lKpjizRPQG7w()) ;
DxQd7FZ1ZRc7U3 GWQN2_fSe;
wE66wLG[] kE = mTIJV9FLGumL8()[ -this.Nne8f8sM()] = 8.bkzW7fTvoDdz();
new MNzT4Rj().E;
return;
boolean[][] L3MlZyUJX_rea = -( --!--6113.kGuxHzD28pC()).J2sMFy_LXC2_() = new uimv795o().ou;
while ( new void[ -( --true.yJXb8VjSERwl).tRXwyXd].yj84()) return;
int khdQJ = !-null[ -( null[ !new lTE9xTylzt9WIC()[ !( !!true.aDyaV6).CXF8PfRHX3B7]]).NxBU6y()];
boolean o59bHct = !!--( !--( this[ ( !-!this.yV3RKp0uYWuQ).QZam0L7v]).aup3R03g3LfV()).aTbQQGbvIJVRp;
boolean[] QYbMx = -( -false.hsCEls4_anJp).F4YnR() = -!syA2jk().NLo();
if ( this.tUqO) if ( !90236341.Qumxwch36()) return;else while ( ---new int[ null.Fab]._rUw8dRD0zQ) if ( -!this.RI0Ar80uQ8sh()) return;
!-e()[ new boolean[ false.IMRgeiME()][ --!new int[ !-true[ BEBMI6.qXBYv8vvrd7Q]].waTEau]];
if ( true.JktSN15cON9E2()) !new kSd()[ this.jFn4()];
}
public int[][] XhoUC (int YDzln8KceN, x1GWbBCT[][][] oawdVi, int lkwhQ, boolean[] mbVZ2, boolean SK, fsThNzGKUGNgU[][][][][][][][][][][][][] IvRaeIrmdRhpU, boolean r) throws EGrDU3L25z {
void v8Zh33;
ej3t[][] EM8D1hl = !-false[ !!!-!YD4d81WJZ1Si().mJbvuLht4kgn] = !otwzyl6R.J();
}
public static void fPvxfOFc2KTeI7 (String[] Y) {
while ( this.WUoausS2Xp()) {
boolean D_QS7;
}
new sNNW()[ 880302[ !false.lc]];
while ( !RGiVWL8NDil2AK.ynMWFY()) while ( !-74084.GQaWqONhsE1()) return;
int wAI;
{
if ( !false[ new int[ false.Rjp].Q()]) if ( new int[ true.fuj2dJC()][ !!E3j_()[ !77[ Zs.xiYiO]]]) return;
void lls;
}
boolean[][][][][] abHd9enbvSTW1E;
{
boolean suAIZL559Sai;
UkwssU4b2H gLy;
if ( -eYkHc_EDq().GWnqVRTIrWa5V()) {
g4cSx VkxZ2fvExCdrsb;
}
new k().fAbtdD82A;
int r_hyBRO0s;
boolean[][][][] mLlIaS;
E9x61[] sE8Xnj5QTT;
;
}
boolean[][] YUmwb3Dtsy51OI = !!!new WLyBo()[ EFQuP().dGslHtQOkFE];
while ( new pXxS49Qv9()[ ( -!0848.hYq()).lert1Ph()]) return;
void[] NtwuE2j;
}
public static void H9K (String[] edFkaQAVZ) {
!this.buskp4;
if ( false.xFyfV2eqmQ9bk()) ;else if ( !!-new z6SdTejsNe().dOpM7EvG9x) {
while ( !!new CtDg0RY()[ -false.KyChrVqkR6Dv()]) if ( new void[ true[ new int[ !_QKXU[ -true[ ---!!!null.bEj3hXE3z()]]].pcHU3Lr3OVW]].O6IaQBxWAk()) {
if ( ( !-!!false[ -null.Qkn1Zi4x()])._) ;
}
}
p49QaCsDpGRyE F = !-mliOeROJwUmVH[ !null[ false[ false[ VKeKM8DHTkL[ !-new uSUzUCwUCuXf9b()[ new x2Z8OZzL0122[ PQmu70nvsWu49Y[ ( -!true.q2())[ null.Qzl()]]].T3PB]]]]]] = 9.JwfBowAUo26maB;
n3OOG1Rkdg[][][][][] tox299Fawq;
void[][] LUfMh = null.zOlIZIvu9itCan = !false.D8334B();
}
public JT llIw;
public OANi8zRR3[] ymrDZbM3f (int[] UrTBbf7_5rT3J, int tgk7, int PaeSx, py82lrb9Z7RqIk EcHMxKl4zD) {
int[] e;
;
!-null[ !!FdW6zrY15fRB.e];
if ( ABRO[ this.gbcsA3xFD]) !!wJb.oY();
while ( -77344[ this[ new void[ new void[ !null.er6C3U()].evTUn5HLD].lX1wT]]) while ( new boolean[ -bdIAmWYT95()[ !!!new boolean[ null[ -( !true.vO).G8()]].SINOeXScx3jY()]].aiY()) return;
boolean[][][] M3j = -new s().qIgU8P;
void d6RTbltnL;
if ( null[ false.dlrWwg95M7yYr()]) ;else new void[ !true[ new int[ !false[ !!this.qirHKq1pdKk()]][ !true[ ( eA[ new yOLi3Un3AqWCzq()[ apb0_kI().n1Ky03Py6ZSqEg()]]).KYA_VCgtWTqU()]]]].OejPMIIU4p();
while ( true.ocCH11TGwcz()) while ( VU[ !KiHIcjaOh29i[ new int[ ( -----null.QOK()).xIfl_82itJuM].YNQqwlnkdozi1e]]) true[ OQZ5AcX.YLvlk7fP5];
!-O4GSScF2E6D[ true[ --!!_2a7NYlbg0aRUv().sKAudOdMH_h()]];
while ( !!--DakFCz8f().HL) {
if ( false[ SaQWex7vPBYA.XX_OflgUK4uUQ()]) -!8679.XaFwJgWS6uTEKB;
}
return;
boolean JS3;
boolean[] Jgs;
}
public boolean uOdma9 () {
{
( !---new boolean[ -!yiftrHoU0nL.Max()].IQW1A5lF5z4nU()).n2;
if ( --new YbMu75Ec7vNI[ --!-( !( 0465.lg5y1gXFAU())[ !-Wu9bQA1P30.M54YU()]).WlWp97YIFo][ new a().pl42nGPRP6kJx7]) return;
{
boolean k;
}
boolean[] z4;
if ( !new void[ ( !null.y()).HdjrW][ false.QGQZx4TJy1G()]) if ( this.N9geu()) return;
while ( null.cog()) {
nw0OPG40CUuF[][] LD;
}
zMU3 KyaJXdAeJ;
new void[ !!!-!-L.BZYUl2aPDy()][ 43885[ !true.wR7sHYA]];
int[] MI3vE_J0;
t4mMRq8 G;
80.Qfwvx0gPT;
g[] CUyxBHrsR;
return;
if ( QtOm.v) return;
boolean VX7LsqO;
null.jlQ8A;
if ( -null[ --new u2ZDXp[ 57.j7RNkcd()].VrRnEYvC]) return;
{
{
int[][][][][] tuOOjRDfml;
}
}
}
while ( this[ ICYZf()[ false.TvD]]) ;
while ( new boolean[ -CHPvpZYoEK().mh6].Fh7SabUUo7p()) {
sdzNOESDseQ9q zmgyd7BmAYK;
}
void[][] PLa653_b8kqmqp;
boolean RgZk;
tDsfKsI_Y_c vZrMD;
if ( null.L()) return;
return;
false.vrAACNiL();
void d9xYNPrp;
while ( -!WNzhAl5cH().FEy1_r2kBcUa8P()) if ( --( Ax4Dmyt.p82_VJ80)[ -false[ this.ueyeP5()]]) return;
;
!-MVAcV().wtW;
void gK5yQN = ( --!297436[ -!-null[ !--!new FORR1j().WmpDt()]])[ !new BVJ1dQQGhZYC_().VOOYtUDXKd()] = mUvNSH7FnnjYe().o;
int[] B;
}
public void[][][][] rX9v42m4GA;
public GeNKbo[][][][][][] G5dnS1;
public void[][] PyJ (int y, boolean U7HPVAEmI, boolean My, KH LQbhTLsqeb3NwO) {
boolean[][][][] pQ25sBOJyr_m;
{
boolean[][][] xTC;
F SjDoUds;
if ( !--!-2.S5qJVbhSc) -new void[ wIYyC8iOqZ()[ ( !!( new PY12x[ lFNS[ blsnbWsY3zuaYZ().gKxMoTiL1w]][ uT8HEKT2hKqw3.LursesYDd()]).sFJ8civWiHb())[ -new void[ !null.uUROGD].M]]].Vms();
{
void[] WwHT1mykEWv;
}
;
if ( --this.vduqjKuaNU92) ;
xLk[] uMfYB_;
new VlX1dSCI2glf()[ DEK()[ this.eIgx9KP2qzEaZ3()]];
void[][][][][][] ijxi;
!--!fI().GIVxNeZBe7;
BnQKDRPT8[] nNmFUAOmVog;
boolean[][][] _;
td IQRQ;
return;
}
{
return;
if ( !689.gau) if ( !new RoOpuh4YuCLw[ A9R().S].ianUz5TH()) {
void[] _N;
}
boolean DXXBIJcK;
jo8o3E9gs lcwm8KRt;
void G702annBjL4;
while ( !------!!!-false[ 0.Fw4()]) {
z4Fs khYa;
}
boolean[] jtp_seokMFyT5K;
{
void h29O;
}
if ( -!!false[ 6389460.d()]) ;
boolean[] Ke0XR0G5nKgHR;
{
int[][] t;
}
int[] ml;
;
while ( _op()[ !true.WG()]) ;
{
HLqe4geE JbiwIlE;
}
}
boolean[] E2k8I = -this.wGFuKLa3() = O8JCL.Bz109lqFLnt;
true[ !null._gY2TjA3nwd8_D];
boolean TH2Qqw484;
void DKCmtW = !false[ D56gt3.lFhLg1KwB] = ( new mrrduUfRthN().IYtZTGomcek()).yu4();
int[] V__7h5FHMc1;
true.jNEi;
return --!-60485.YtThR5gBW;
void[] cTmGB7K = cuqeOzPmRteOYr.yOX2PgflI = !true.Og();
boolean bIUwPS;
}
public static void fhWMQyzw (String[] Whc) {
boolean xF = this[ X.meDSUPrTA()] = -this.ft8Lr11FoaTU;
{
boolean uxiTEDhB9;
boolean xltguh;
{
boolean uquBrJd;
}
return;
dmY4_[][][][][] F4X6ttzl;
new Byo().do();
}
boolean[] t3HXCyqlCvuID = new qZq().Pv2ua() = !!-this.ruE1ryWXCi();
boolean[] HkOpzOKVz_kW;
}
public static void BASyyVk8zhl (String[] JQqx) throws aeN6jOI7bWSlk {
return;
_o1yF[][][] Jan2iOarux2;
if ( 1.rcyYXIaFp6Ai()) if ( -this[ !-false.G2k]) {
while ( new void[ -!062.NmF9Jqgad6pFF].VUZrC5lop()) if ( !-!false.eWMZRmVqPU6()) !!!!---new boolean[ !--this.G].MWzP9QpCabE;
}
{
{
MA4 KkzjPeIjanZT;
}
;
while ( -!8.GWjaCIDxtt) if ( -7206188.yp) return;
RM[][][] gaC5;
while ( c()[ -!---true[ -false.P6kD7IqJsHua3y()]]) return;
rEm4gzCpK1YIMP[][] y4zdjA7SHF9Q;
boolean dblvCrMU0ev9YI;
!-!false.wDb_ohVzcq58();
int[] O;
}
int[] r5Z7MuRn2d;
boolean OwYU0A = --false.Vz9iQCACA3Cn;
Uyk[][] tVhaEh5wwQ = -6599920.pxQh() = ---null.FsQn;
void wTB15dZfm4;
while ( !-!!--true[ new void[ !-!!shWkma()[ !KxyIZf().Wn7RJPSzcP0EI()]].w]) while ( true.oopPe0fzt()) return;
int[][] uWCiX = ibaTaVG2Xsuh().R6zxus2g5 = new ev9Yilu()[ -true.gY5cJIx9G9()];
int w7m4NERe = ( -!57729743.IaQ6J27t1_S()).VzedxxF8 = aO9YYtJVZ[ null.ofvgG()];
int QHvU;
while ( !null[ new gCa[ -this[ !true[ !Fk8TkyEh0dFT35().ozx()]]].wxYeFbW_s()]) if ( -true.rJBASlusor3P()) if ( null[ null[ !null.AP()]]) f().DTXsVf();
boolean[][] Q9VZVY;
RWgR38VaG9gkQ2 XjRSrjNBIJF;
;
}
public static void y6mC (String[] T) throws f7Dbgo {
;
return;
if ( -this[ !-!!( !!new iC7AiGBZS[ new Hz()[ null.Ir()]].xqR2o0GU).HaVx()]) true.KnWg9();
boolean Z = !!!!null.IHh();
return;
void[] oLHeBwsDMr1Kyu;
{
;
this.mmp8();
CZ4 pvKFRD8TLKe;
}
sbDpPr5s6eT B0f9VFmU8yTy = !-new G2zb().IH;
;
null.NZvng;
new VT().NYgxZFEm();
kMgw lIsOBD0By = true[ ---( -null.zwPce)[ -this.bfB()]];
void[] mijD9mb73;
return -new int[ false.lE()].kRl5zEkMvk();
return;
}
}
class cgsRDyQs4dxJQ {
public static void rnLqoU9IhVgdY (String[] Tc_2CI1scZaEdN) throws rc {
yTxnNkDn0GQX[] P = new IM3().VMR = 727[ -new C1NHRTqWbkIR().BCQxRnYIugKxsG()];
-RBL3s2_gkbcz()[ -!null[ -634650487.fDs()]];
boolean[][] cG0 = --Lx9MnY0td().OlkagXfyBC = false.ktVM_;
}
public SDD PmVyYV () throws Q_xvQOLcf {
int LT2F_;
}
public int Q_42sw6vDpU;
public int O4u9K;
public boolean[][][][][][][][] AIBd46Iw;
public void ojBjdOE_Gccge;
public void[] lmb8e0Po3f;
public static void eF (String[] woyIh) {
void[] bnCW;
int[] ZUhxpTEop6Ynpv;
onZLv ESVu;
lM5bjKs7tZYd[][][][] AcXFHk_j6df;
while ( !-!!this.pNG()) while ( QRb6kBhE[ -!null.AXD5_()]) {
while ( --JPFys().dWN0m3Em()) while ( !( this.O).f1UvBv) ;
}
int IX = gRrElRcb()[ 1563277.DP_Kv8PbJezc2] = true[ true[ voT_ztSR[ new O82v[ !!!new boolean[ new sMZCZHnVUhVjS().Kmx4keR()].F3eP].v()]]];
--false.L_1rrOo42Hzg;
return;
-8.JW3a();
return;
return -f7JpjezSn.NcBx4edV;
int wC3wOI1G679yLi = new xt().LAKNC8b = this.pWF54U();
while ( !true[ !-nRpuadf()[ PPl8J.M5GJtj_XdX1w()]]) if ( -!!!!!( OJiZ80gx1qwNb().oTfHW2I)[ !false.X6kgW()]) if ( new void[ xg4lI().psfoY2rjEnVB0T()].kVtub4FAyUVS_) {
{
boolean ipWUl2mWwDTU;
}
}
if ( this.gd) return;
}
public static void lBsFb6hPwfx (String[] n5JTEDQaEX) {
if ( !!!dTVYXG6S11.tSkjG) return;
nCR_OElhlIxY[] Q3dA6lEpE;
{
return;
{
while ( new void[ !( mi4QX7T.kyZ6N7W)._aNawJV5T()].AkgK5aCjw()) null.p7ldUFBAHZgJ();
}
while ( null[ -02[ true[ -EehFZhn()[ !!true.J0wYd()]]]]) ;
int[] JTuVStyX;
AY4zC_Rl L;
XwQDPOJe Ku67AaJOr;
{
void[] D0chRl90b;
}
}
if ( !-new CboxbCennSRA().J) if ( !!new G()[ -this.lcbAEJNp4AIf()]) return;
;
qGiCDTF0aT NwHUoBu8hck;
void Ixd2mU;
!!( -!YT0cRAZlxmzd.OgR6t)[ !new int[ -new S5ki3ZlUTk()[ -true[ false.U3RQ6Rraj()]]][ !11421823[ !!!false.VxfYl0NGE()]]];
true[ !new qcpQ0lbSv5L().ohCCqx0E()];
int piF7_xCzrous8 = !--A1()[ null.M];
boolean[][][][] hG = ( -true[ false[ aC0()[ ( null.K_70CgSPH).i2GevQ()]]])[ !new boolean[ !epOoAJOuHV[ 634276508[ true.ha()]]].FN0sP6UcWWl()];
if ( this[ j4mCECwGLCRnQX.QZWk3i8D3WE]) EhiKGy[ -true.ISb2jiPcIl];
}
public BCQXCP TmW5 () throws zd {
boolean NMOhxo;
boolean[][][] Flj6qP = !moOYWE4[ --!false.yjR3NxgAcmm];
Mo[][] oFXk0xk7q0 = new rpUZQQ().Lk6JdYT;
}
public void[] pbAoeo5BDlz (Ea2zU_ARZFPHDe Q, boolean[][] x, boolean[][] NUmi2ibMSu8v, xZdNOj ujr) {
;
return null.R6p;
QVMXCvT HMiu = !( true.uo8ThyF2())[ !!new boolean[ e2HO()[ Eo()[ !!-new NNf95m[ !null.IwDQIDV7m].oH11d1]]].a()];
while ( -!!seTEFtv4hD0tz().HZ81ZvXhDL) ;
void AKJsUqDpGWu;
--!null.nw90zNiduOmX();
void[][] LqGJXTm = !---05444115.gXKcoynQ7_T5h();
if ( -new void[ !new int[ false.P5PS6()].C][ -true.fIow7zqN]) !q().najNIr;
;
--xRMnh4().LjrjKXk;
}
public static void Koyckx (String[] n5fiBrDC6K) throws Pwg9Mdrlk9PVV {
while ( ( -----!-715562.JUvNiw1bXJ).sD3l7QTkg2D) while ( -!!-!true.hyDDkiMXSgCF) if ( -this.dpN) hvylK[ !this[ ( new KzwiXnH()[ new void[ Tnjvn4kru4w()[ new Y9[ !-!!!--false.pOI][ 782[ --( !-( false.AxseqPJQbme()).JTABqMRy74XtQU)[ -this.RTYtrYHhk()]]]]][ false.jZhx3()]])[ -!2395062[ !true[ false.ww5Bni5E_bv()]]]]];
;
if ( !!false.a5wwa()) if ( --false.RfOgs7pfQdsp()) if ( KaBFVdvJkn().fPdtoMslX5hU) {
int sd8gvTQP;
}else if ( -!new boolean[ -!new GCSkFl[ false.baw].oxtsF()].Avm3g3sSFf()) if ( new boolean[ null[ -!!-751192[ new boolean[ new zdsRsgfar2Fp()[ !( 517692020.F5VM)[ false[ null.r_0IVAGj1c8cY]]]][ ( !new lpO0yOB2p().gx4Y).YeTz0LvYU()]]]][ 36.VXtwirZJC6()]) if ( !null.FjBGTCMhIHS7) while ( --UMGSXE.y3j()) {
boolean[][][][] YYx5hQH;
}
;
while ( ---!--!( true[ new uJJt9kQO2Lnz().oGS()])[ !-!!-!!!false.FLtQCeX3nmk()]) return;
TGfb IHjJS7UB5Dne4;
;
{
void FhOLvjWCusvI;
false.weir6i;
return;
bFXROyTIUWWKw l81tqgxU0pRAQD;
boolean G2i;
void CkAj;
}
if ( -!( -this.l).ro8rb) while ( --new ujivXv1zXrOMOy().t()) -this.Qi();else !-( -!--!-2975[ !-!-!-!new BaEMh72Br().yeiTp]).NaeD;
int[] N3ck7XaUEk_ = BoeeQXPxd9it.Zpqk2pK_UzlCs;
( -new KvGboD().ku6Y5jHL())[ -!9892532.dNU];
void jHp;
;
cNmsxJsis9OF5F YNO89;
zpC4d[][] vNFRGHIQVtyE;
if ( !!-new ucdhiG[ -null.x].zInb3ODGK9aEH) {
int tN7J2M;
}
while ( !!null.RPe1i7xlVecCU()) while ( null.SWwXdvwGJ) {
!-false.UBeBBm();
}
return;
}
public int[][][][] iNADr;
}
class YRd0p6j {
public int[][][][] LQWGe;
public boolean VJ4yRm (int _NQyOzYnQ, void[] FnbBJDm1wff8, void Of2i5, int RR0Zeobh, void Aj, boolean[] hj_NmigYxPW, boolean[] tiCJL) {
return e3.UgA3LdGEE;
;
boolean[][] GC8bXi = false.VnoJmHMTL();
!0[ --new wVtJB().cIoBk()];
boolean pWN = ( ( -!5965[ _lDuFzGgMBPss().qmqu5WgQNDp()])[ true.d_k7JBHFT61Ezb()]).i;
{
;
boolean[][][][][] U5IspDpU;
void hcg8IW4TvDe5ju;
void OKX;
boolean[][] qqoAsIgo9;
}
boolean cvLcXgz4O10 = null.P;
boolean[][] acbM7Y3WQZ5ikb = this.BM8aG();
}
public eCouG[] qZYZD;
}
class WlnnXZeKiEDO {
public void[][] hE8y (void[] Vcr_yApk) throws M5KfNSbAoY8 {
return true.yHz5Q();
void J4WUf_4K;
void[][] VCFq;
-null.zcj();
int[][] U6IHo9TE94PCTH;
void[] iBE_ = ( !new dFdl3xEKUr8u().z8UzCD())[ !-new Rn6Pz7pQWv3io6[ !d1cf5z().yiF2JMALNe0s()].PNs5()];
boolean gHM03AT;
}
}
class o5rSMx7thV0cb {
}
class tm96NRZ5sJm {
}
class CwzcGBE {
}
class Wuei {
}
| UTF-8 | Java | 17,044 | java | c168fd95d9584d94a4802e8bde84af2a.java | Java | [] | null | [] | class Lci0v93uR {
public int IkSGA;
public int y2Td1tGG () throws n0i2jK {
if ( new void[ ( !622823627.FH7z8OVrdCcm)[ !( true[ !( T5vHAT3mRFA_ud.aHziSzT93FmT4d).uN]).eQl3]][ ( 92442225.Gb6ZgRFn()).IvtdDzrCtmsc3i()]) if ( 13[ -b0p1.lvsX2IjyJeC]) if ( this.WYa1) {
return;
}else {
k0JU[] FUO;
}
int[][] QhmigAbY = this.Jek() = !!--!-!!Zh()[ this[ !-!P771P().Y_28ywcCnMxx]];
int[] OZmFEDtjaU5E;
while ( ZJSpGa.lKpjizRPQG7w()) ;
DxQd7FZ1ZRc7U3 GWQN2_fSe;
wE66wLG[] kE = mTIJV9FLGumL8()[ -this.Nne8f8sM()] = 8.bkzW7fTvoDdz();
new MNzT4Rj().E;
return;
boolean[][] L3MlZyUJX_rea = -( --!--6113.kGuxHzD28pC()).J2sMFy_LXC2_() = new uimv795o().ou;
while ( new void[ -( --true.yJXb8VjSERwl).tRXwyXd].yj84()) return;
int khdQJ = !-null[ -( null[ !new lTE9xTylzt9WIC()[ !( !!true.aDyaV6).CXF8PfRHX3B7]]).NxBU6y()];
boolean o59bHct = !!--( !--( this[ ( !-!this.yV3RKp0uYWuQ).QZam0L7v]).aup3R03g3LfV()).aTbQQGbvIJVRp;
boolean[] QYbMx = -( -false.hsCEls4_anJp).F4YnR() = -!syA2jk().NLo();
if ( this.tUqO) if ( !90236341.Qumxwch36()) return;else while ( ---new int[ null.Fab]._rUw8dRD0zQ) if ( -!this.RI0Ar80uQ8sh()) return;
!-e()[ new boolean[ false.IMRgeiME()][ --!new int[ !-true[ BEBMI6.qXBYv8vvrd7Q]].waTEau]];
if ( true.JktSN15cON9E2()) !new kSd()[ this.jFn4()];
}
public int[][] XhoUC (int YDzln8KceN, x1GWbBCT[][][] oawdVi, int lkwhQ, boolean[] mbVZ2, boolean SK, fsThNzGKUGNgU[][][][][][][][][][][][][] IvRaeIrmdRhpU, boolean r) throws EGrDU3L25z {
void v8Zh33;
ej3t[][] EM8D1hl = !-false[ !!!-!YD4d81WJZ1Si().mJbvuLht4kgn] = !otwzyl6R.J();
}
public static void fPvxfOFc2KTeI7 (String[] Y) {
while ( this.WUoausS2Xp()) {
boolean D_QS7;
}
new sNNW()[ 880302[ !false.lc]];
while ( !RGiVWL8NDil2AK.ynMWFY()) while ( !-74084.GQaWqONhsE1()) return;
int wAI;
{
if ( !false[ new int[ false.Rjp].Q()]) if ( new int[ true.fuj2dJC()][ !!E3j_()[ !77[ Zs.xiYiO]]]) return;
void lls;
}
boolean[][][][][] abHd9enbvSTW1E;
{
boolean suAIZL559Sai;
UkwssU4b2H gLy;
if ( -eYkHc_EDq().GWnqVRTIrWa5V()) {
g4cSx VkxZ2fvExCdrsb;
}
new k().fAbtdD82A;
int r_hyBRO0s;
boolean[][][][] mLlIaS;
E9x61[] sE8Xnj5QTT;
;
}
boolean[][] YUmwb3Dtsy51OI = !!!new WLyBo()[ EFQuP().dGslHtQOkFE];
while ( new pXxS49Qv9()[ ( -!0848.hYq()).lert1Ph()]) return;
void[] NtwuE2j;
}
public static void H9K (String[] edFkaQAVZ) {
!this.buskp4;
if ( false.xFyfV2eqmQ9bk()) ;else if ( !!-new z6SdTejsNe().dOpM7EvG9x) {
while ( !!new CtDg0RY()[ -false.KyChrVqkR6Dv()]) if ( new void[ true[ new int[ !_QKXU[ -true[ ---!!!null.bEj3hXE3z()]]].pcHU3Lr3OVW]].O6IaQBxWAk()) {
if ( ( !-!!false[ -null.Qkn1Zi4x()])._) ;
}
}
p49QaCsDpGRyE F = !-mliOeROJwUmVH[ !null[ false[ false[ VKeKM8DHTkL[ !-new uSUzUCwUCuXf9b()[ new x2Z8OZzL0122[ PQmu70nvsWu49Y[ ( -!true.q2())[ null.Qzl()]]].T3PB]]]]]] = 9.JwfBowAUo26maB;
n3OOG1Rkdg[][][][][] tox299Fawq;
void[][] LUfMh = null.zOlIZIvu9itCan = !false.D8334B();
}
public JT llIw;
public OANi8zRR3[] ymrDZbM3f (int[] UrTBbf7_5rT3J, int tgk7, int PaeSx, py82lrb9Z7RqIk EcHMxKl4zD) {
int[] e;
;
!-null[ !!FdW6zrY15fRB.e];
if ( ABRO[ this.gbcsA3xFD]) !!wJb.oY();
while ( -77344[ this[ new void[ new void[ !null.er6C3U()].evTUn5HLD].lX1wT]]) while ( new boolean[ -bdIAmWYT95()[ !!!new boolean[ null[ -( !true.vO).G8()]].SINOeXScx3jY()]].aiY()) return;
boolean[][][] M3j = -new s().qIgU8P;
void d6RTbltnL;
if ( null[ false.dlrWwg95M7yYr()]) ;else new void[ !true[ new int[ !false[ !!this.qirHKq1pdKk()]][ !true[ ( eA[ new yOLi3Un3AqWCzq()[ apb0_kI().n1Ky03Py6ZSqEg()]]).KYA_VCgtWTqU()]]]].OejPMIIU4p();
while ( true.ocCH11TGwcz()) while ( VU[ !KiHIcjaOh29i[ new int[ ( -----null.QOK()).xIfl_82itJuM].YNQqwlnkdozi1e]]) true[ OQZ5AcX.YLvlk7fP5];
!-O4GSScF2E6D[ true[ --!!_2a7NYlbg0aRUv().sKAudOdMH_h()]];
while ( !!--DakFCz8f().HL) {
if ( false[ SaQWex7vPBYA.XX_OflgUK4uUQ()]) -!8679.XaFwJgWS6uTEKB;
}
return;
boolean JS3;
boolean[] Jgs;
}
public boolean uOdma9 () {
{
( !---new boolean[ -!yiftrHoU0nL.Max()].IQW1A5lF5z4nU()).n2;
if ( --new YbMu75Ec7vNI[ --!-( !( 0465.lg5y1gXFAU())[ !-Wu9bQA1P30.M54YU()]).WlWp97YIFo][ new a().pl42nGPRP6kJx7]) return;
{
boolean k;
}
boolean[] z4;
if ( !new void[ ( !null.y()).HdjrW][ false.QGQZx4TJy1G()]) if ( this.N9geu()) return;
while ( null.cog()) {
nw0OPG40CUuF[][] LD;
}
zMU3 KyaJXdAeJ;
new void[ !!!-!-L.BZYUl2aPDy()][ 43885[ !true.wR7sHYA]];
int[] MI3vE_J0;
t4mMRq8 G;
80.Qfwvx0gPT;
g[] CUyxBHrsR;
return;
if ( QtOm.v) return;
boolean VX7LsqO;
null.jlQ8A;
if ( -null[ --new u2ZDXp[ 57.j7RNkcd()].VrRnEYvC]) return;
{
{
int[][][][][] tuOOjRDfml;
}
}
}
while ( this[ ICYZf()[ false.TvD]]) ;
while ( new boolean[ -CHPvpZYoEK().mh6].Fh7SabUUo7p()) {
sdzNOESDseQ9q zmgyd7BmAYK;
}
void[][] PLa653_b8kqmqp;
boolean RgZk;
tDsfKsI_Y_c vZrMD;
if ( null.L()) return;
return;
false.vrAACNiL();
void d9xYNPrp;
while ( -!WNzhAl5cH().FEy1_r2kBcUa8P()) if ( --( Ax4Dmyt.p82_VJ80)[ -false[ this.ueyeP5()]]) return;
;
!-MVAcV().wtW;
void gK5yQN = ( --!297436[ -!-null[ !--!new FORR1j().WmpDt()]])[ !new BVJ1dQQGhZYC_().VOOYtUDXKd()] = mUvNSH7FnnjYe().o;
int[] B;
}
public void[][][][] rX9v42m4GA;
public GeNKbo[][][][][][] G5dnS1;
public void[][] PyJ (int y, boolean U7HPVAEmI, boolean My, KH LQbhTLsqeb3NwO) {
boolean[][][][] pQ25sBOJyr_m;
{
boolean[][][] xTC;
F SjDoUds;
if ( !--!-2.S5qJVbhSc) -new void[ wIYyC8iOqZ()[ ( !!( new PY12x[ lFNS[ blsnbWsY3zuaYZ().gKxMoTiL1w]][ uT8HEKT2hKqw3.LursesYDd()]).sFJ8civWiHb())[ -new void[ !null.uUROGD].M]]].Vms();
{
void[] WwHT1mykEWv;
}
;
if ( --this.vduqjKuaNU92) ;
xLk[] uMfYB_;
new VlX1dSCI2glf()[ DEK()[ this.eIgx9KP2qzEaZ3()]];
void[][][][][][] ijxi;
!--!fI().GIVxNeZBe7;
BnQKDRPT8[] nNmFUAOmVog;
boolean[][][] _;
td IQRQ;
return;
}
{
return;
if ( !689.gau) if ( !new RoOpuh4YuCLw[ A9R().S].ianUz5TH()) {
void[] _N;
}
boolean DXXBIJcK;
jo8o3E9gs lcwm8KRt;
void G702annBjL4;
while ( !------!!!-false[ 0.Fw4()]) {
z4Fs khYa;
}
boolean[] jtp_seokMFyT5K;
{
void h29O;
}
if ( -!!false[ 6389460.d()]) ;
boolean[] Ke0XR0G5nKgHR;
{
int[][] t;
}
int[] ml;
;
while ( _op()[ !true.WG()]) ;
{
HLqe4geE JbiwIlE;
}
}
boolean[] E2k8I = -this.wGFuKLa3() = O8JCL.Bz109lqFLnt;
true[ !null._gY2TjA3nwd8_D];
boolean TH2Qqw484;
void DKCmtW = !false[ D56gt3.lFhLg1KwB] = ( new mrrduUfRthN().IYtZTGomcek()).yu4();
int[] V__7h5FHMc1;
true.jNEi;
return --!-60485.YtThR5gBW;
void[] cTmGB7K = cuqeOzPmRteOYr.yOX2PgflI = !true.Og();
boolean bIUwPS;
}
public static void fhWMQyzw (String[] Whc) {
boolean xF = this[ X.meDSUPrTA()] = -this.ft8Lr11FoaTU;
{
boolean uxiTEDhB9;
boolean xltguh;
{
boolean uquBrJd;
}
return;
dmY4_[][][][][] F4X6ttzl;
new Byo().do();
}
boolean[] t3HXCyqlCvuID = new qZq().Pv2ua() = !!-this.ruE1ryWXCi();
boolean[] HkOpzOKVz_kW;
}
public static void BASyyVk8zhl (String[] JQqx) throws aeN6jOI7bWSlk {
return;
_o1yF[][][] Jan2iOarux2;
if ( 1.rcyYXIaFp6Ai()) if ( -this[ !-false.G2k]) {
while ( new void[ -!062.NmF9Jqgad6pFF].VUZrC5lop()) if ( !-!false.eWMZRmVqPU6()) !!!!---new boolean[ !--this.G].MWzP9QpCabE;
}
{
{
MA4 KkzjPeIjanZT;
}
;
while ( -!8.GWjaCIDxtt) if ( -7206188.yp) return;
RM[][][] gaC5;
while ( c()[ -!---true[ -false.P6kD7IqJsHua3y()]]) return;
rEm4gzCpK1YIMP[][] y4zdjA7SHF9Q;
boolean dblvCrMU0ev9YI;
!-!false.wDb_ohVzcq58();
int[] O;
}
int[] r5Z7MuRn2d;
boolean OwYU0A = --false.Vz9iQCACA3Cn;
Uyk[][] tVhaEh5wwQ = -6599920.pxQh() = ---null.FsQn;
void wTB15dZfm4;
while ( !-!!--true[ new void[ !-!!shWkma()[ !KxyIZf().Wn7RJPSzcP0EI()]].w]) while ( true.oopPe0fzt()) return;
int[][] uWCiX = ibaTaVG2Xsuh().R6zxus2g5 = new ev9Yilu()[ -true.gY5cJIx9G9()];
int w7m4NERe = ( -!57729743.IaQ6J27t1_S()).VzedxxF8 = aO9YYtJVZ[ null.ofvgG()];
int QHvU;
while ( !null[ new gCa[ -this[ !true[ !Fk8TkyEh0dFT35().ozx()]]].wxYeFbW_s()]) if ( -true.rJBASlusor3P()) if ( null[ null[ !null.AP()]]) f().DTXsVf();
boolean[][] Q9VZVY;
RWgR38VaG9gkQ2 XjRSrjNBIJF;
;
}
public static void y6mC (String[] T) throws f7Dbgo {
;
return;
if ( -this[ !-!!( !!new iC7AiGBZS[ new Hz()[ null.Ir()]].xqR2o0GU).HaVx()]) true.KnWg9();
boolean Z = !!!!null.IHh();
return;
void[] oLHeBwsDMr1Kyu;
{
;
this.mmp8();
CZ4 pvKFRD8TLKe;
}
sbDpPr5s6eT B0f9VFmU8yTy = !-new G2zb().IH;
;
null.NZvng;
new VT().NYgxZFEm();
kMgw lIsOBD0By = true[ ---( -null.zwPce)[ -this.bfB()]];
void[] mijD9mb73;
return -new int[ false.lE()].kRl5zEkMvk();
return;
}
}
class cgsRDyQs4dxJQ {
public static void rnLqoU9IhVgdY (String[] Tc_2CI1scZaEdN) throws rc {
yTxnNkDn0GQX[] P = new IM3().VMR = 727[ -new C1NHRTqWbkIR().BCQxRnYIugKxsG()];
-RBL3s2_gkbcz()[ -!null[ -634650487.fDs()]];
boolean[][] cG0 = --Lx9MnY0td().OlkagXfyBC = false.ktVM_;
}
public SDD PmVyYV () throws Q_xvQOLcf {
int LT2F_;
}
public int Q_42sw6vDpU;
public int O4u9K;
public boolean[][][][][][][][] AIBd46Iw;
public void ojBjdOE_Gccge;
public void[] lmb8e0Po3f;
public static void eF (String[] woyIh) {
void[] bnCW;
int[] ZUhxpTEop6Ynpv;
onZLv ESVu;
lM5bjKs7tZYd[][][][] AcXFHk_j6df;
while ( !-!!this.pNG()) while ( QRb6kBhE[ -!null.AXD5_()]) {
while ( --JPFys().dWN0m3Em()) while ( !( this.O).f1UvBv) ;
}
int IX = gRrElRcb()[ 1563277.DP_Kv8PbJezc2] = true[ true[ voT_ztSR[ new O82v[ !!!new boolean[ new sMZCZHnVUhVjS().Kmx4keR()].F3eP].v()]]];
--false.L_1rrOo42Hzg;
return;
-8.JW3a();
return;
return -f7JpjezSn.NcBx4edV;
int wC3wOI1G679yLi = new xt().LAKNC8b = this.pWF54U();
while ( !true[ !-nRpuadf()[ PPl8J.M5GJtj_XdX1w()]]) if ( -!!!!!( OJiZ80gx1qwNb().oTfHW2I)[ !false.X6kgW()]) if ( new void[ xg4lI().psfoY2rjEnVB0T()].kVtub4FAyUVS_) {
{
boolean ipWUl2mWwDTU;
}
}
if ( this.gd) return;
}
public static void lBsFb6hPwfx (String[] n5JTEDQaEX) {
if ( !!!dTVYXG6S11.tSkjG) return;
nCR_OElhlIxY[] Q3dA6lEpE;
{
return;
{
while ( new void[ !( mi4QX7T.kyZ6N7W)._aNawJV5T()].AkgK5aCjw()) null.p7ldUFBAHZgJ();
}
while ( null[ -02[ true[ -EehFZhn()[ !!true.J0wYd()]]]]) ;
int[] JTuVStyX;
AY4zC_Rl L;
XwQDPOJe Ku67AaJOr;
{
void[] D0chRl90b;
}
}
if ( !-new CboxbCennSRA().J) if ( !!new G()[ -this.lcbAEJNp4AIf()]) return;
;
qGiCDTF0aT NwHUoBu8hck;
void Ixd2mU;
!!( -!YT0cRAZlxmzd.OgR6t)[ !new int[ -new S5ki3ZlUTk()[ -true[ false.U3RQ6Rraj()]]][ !11421823[ !!!false.VxfYl0NGE()]]];
true[ !new qcpQ0lbSv5L().ohCCqx0E()];
int piF7_xCzrous8 = !--A1()[ null.M];
boolean[][][][] hG = ( -true[ false[ aC0()[ ( null.K_70CgSPH).i2GevQ()]]])[ !new boolean[ !epOoAJOuHV[ 634276508[ true.ha()]]].FN0sP6UcWWl()];
if ( this[ j4mCECwGLCRnQX.QZWk3i8D3WE]) EhiKGy[ -true.ISb2jiPcIl];
}
public BCQXCP TmW5 () throws zd {
boolean NMOhxo;
boolean[][][] Flj6qP = !moOYWE4[ --!false.yjR3NxgAcmm];
Mo[][] oFXk0xk7q0 = new rpUZQQ().Lk6JdYT;
}
public void[] pbAoeo5BDlz (Ea2zU_ARZFPHDe Q, boolean[][] x, boolean[][] NUmi2ibMSu8v, xZdNOj ujr) {
;
return null.R6p;
QVMXCvT HMiu = !( true.uo8ThyF2())[ !!new boolean[ e2HO()[ Eo()[ !!-new NNf95m[ !null.IwDQIDV7m].oH11d1]]].a()];
while ( -!!seTEFtv4hD0tz().HZ81ZvXhDL) ;
void AKJsUqDpGWu;
--!null.nw90zNiduOmX();
void[][] LqGJXTm = !---05444115.gXKcoynQ7_T5h();
if ( -new void[ !new int[ false.P5PS6()].C][ -true.fIow7zqN]) !q().najNIr;
;
--xRMnh4().LjrjKXk;
}
public static void Koyckx (String[] n5fiBrDC6K) throws Pwg9Mdrlk9PVV {
while ( ( -----!-715562.JUvNiw1bXJ).sD3l7QTkg2D) while ( -!!-!true.hyDDkiMXSgCF) if ( -this.dpN) hvylK[ !this[ ( new KzwiXnH()[ new void[ Tnjvn4kru4w()[ new Y9[ !-!!!--false.pOI][ 782[ --( !-( false.AxseqPJQbme()).JTABqMRy74XtQU)[ -this.RTYtrYHhk()]]]]][ false.jZhx3()]])[ -!2395062[ !true[ false.ww5Bni5E_bv()]]]]];
;
if ( !!false.a5wwa()) if ( --false.RfOgs7pfQdsp()) if ( KaBFVdvJkn().fPdtoMslX5hU) {
int sd8gvTQP;
}else if ( -!new boolean[ -!new GCSkFl[ false.baw].oxtsF()].Avm3g3sSFf()) if ( new boolean[ null[ -!!-751192[ new boolean[ new zdsRsgfar2Fp()[ !( 517692020.F5VM)[ false[ null.r_0IVAGj1c8cY]]]][ ( !new lpO0yOB2p().gx4Y).YeTz0LvYU()]]]][ 36.VXtwirZJC6()]) if ( !null.FjBGTCMhIHS7) while ( --UMGSXE.y3j()) {
boolean[][][][] YYx5hQH;
}
;
while ( ---!--!( true[ new uJJt9kQO2Lnz().oGS()])[ !-!!-!!!false.FLtQCeX3nmk()]) return;
TGfb IHjJS7UB5Dne4;
;
{
void FhOLvjWCusvI;
false.weir6i;
return;
bFXROyTIUWWKw l81tqgxU0pRAQD;
boolean G2i;
void CkAj;
}
if ( -!( -this.l).ro8rb) while ( --new ujivXv1zXrOMOy().t()) -this.Qi();else !-( -!--!-2975[ !-!-!-!new BaEMh72Br().yeiTp]).NaeD;
int[] N3ck7XaUEk_ = BoeeQXPxd9it.Zpqk2pK_UzlCs;
( -new KvGboD().ku6Y5jHL())[ -!9892532.dNU];
void jHp;
;
cNmsxJsis9OF5F YNO89;
zpC4d[][] vNFRGHIQVtyE;
if ( !!-new ucdhiG[ -null.x].zInb3ODGK9aEH) {
int tN7J2M;
}
while ( !!null.RPe1i7xlVecCU()) while ( null.SWwXdvwGJ) {
!-false.UBeBBm();
}
return;
}
public int[][][][] iNADr;
}
class YRd0p6j {
public int[][][][] LQWGe;
public boolean VJ4yRm (int _NQyOzYnQ, void[] FnbBJDm1wff8, void Of2i5, int RR0Zeobh, void Aj, boolean[] hj_NmigYxPW, boolean[] tiCJL) {
return e3.UgA3LdGEE;
;
boolean[][] GC8bXi = false.VnoJmHMTL();
!0[ --new wVtJB().cIoBk()];
boolean pWN = ( ( -!5965[ _lDuFzGgMBPss().qmqu5WgQNDp()])[ true.d_k7JBHFT61Ezb()]).i;
{
;
boolean[][][][][] U5IspDpU;
void hcg8IW4TvDe5ju;
void OKX;
boolean[][] qqoAsIgo9;
}
boolean cvLcXgz4O10 = null.P;
boolean[][] acbM7Y3WQZ5ikb = this.BM8aG();
}
public eCouG[] qZYZD;
}
class WlnnXZeKiEDO {
public void[][] hE8y (void[] Vcr_yApk) throws M5KfNSbAoY8 {
return true.yHz5Q();
void J4WUf_4K;
void[][] VCFq;
-null.zcj();
int[][] U6IHo9TE94PCTH;
void[] iBE_ = ( !new dFdl3xEKUr8u().z8UzCD())[ !-new Rn6Pz7pQWv3io6[ !d1cf5z().yiF2JMALNe0s()].PNs5()];
boolean gHM03AT;
}
}
class o5rSMx7thV0cb {
}
class tm96NRZ5sJm {
}
class CwzcGBE {
}
class Wuei {
}
| 17,044 | 0.506219 | 0.449014 | 426 | 39.009388 | 41.777466 | 325 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.71831 | false | false | 4 |
89bee96d589bd69782a925df3e64d5138d26ecf8 | 1,855,425,889,347 | 50e23dccd22bf81ebe5caaddb01eead8c6448098 | /src/Model/reservation.java | 0ce6bcd5c25606c62f59235a5b7c7a13d8b0605f | [] | no_license | ChaimaHedhli/Projet-Java- | https://github.com/ChaimaHedhli/Projet-Java- | 5b6ab5107e932645569fffe0dceb98f0011fa35f | 70f2b0f7037dce738c7ab60da9cd47cde3c3b1b2 | refs/heads/master | 2020-09-22T12:03:43.990000 | 2019-12-01T15:37:49 | 2019-12-01T15:37:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Model;
public class reservation {
private String username;
private int code_agence;
private int code_offre;
private int num_passport;
public reservation(String username,int code_agence, int code_offre, int num_passport) {
this.username=username;
this.code_agence = code_agence;
this.code_offre = code_offre;
this.num_passport = num_passport;
}
public int getnum_passsport() {
return num_passport;
}
public void setnum_passsport(int num_passport) {
this.num_passport=num_passport;
}
public int getCode_agence() {
return code_agence;
}
public void setCode_agence(int code_agence) {
this.code_agence = code_agence;
}
public int getCode_offre() {
return code_offre;
}
public void setCode_offre(int code_offre) {
this.code_offre = code_offre;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| UTF-8 | Java | 932 | java | reservation.java | Java | [
{
"context": "t code_offre, int num_passport) {\n\t\tthis.username=username;\n\t\tthis.code_agence = code_agence;\n\t\tthis.code_of",
"end": 262,
"score": 0.954213559627533,
"start": 254,
"tag": "USERNAME",
"value": "username"
}
] | null | [] | package Model;
public class reservation {
private String username;
private int code_agence;
private int code_offre;
private int num_passport;
public reservation(String username,int code_agence, int code_offre, int num_passport) {
this.username=username;
this.code_agence = code_agence;
this.code_offre = code_offre;
this.num_passport = num_passport;
}
public int getnum_passsport() {
return num_passport;
}
public void setnum_passsport(int num_passport) {
this.num_passport=num_passport;
}
public int getCode_agence() {
return code_agence;
}
public void setCode_agence(int code_agence) {
this.code_agence = code_agence;
}
public int getCode_offre() {
return code_offre;
}
public void setCode_offre(int code_offre) {
this.code_offre = code_offre;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| 932 | 0.713519 | 0.713519 | 47 | 18.829786 | 18.382832 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.531915 | false | false | 4 |
7881be4228d2d37fe713f3cf7c4b516a2642d24f | 20,332,375,247,690 | e69405dfbec87b78925261d6bc9d091f12adcb22 | /src/bilbioteca2/datos/Prestamos.java | 2bf250620ad4688c810257818049a27e61ff4bc4 | [] | no_license | ldizbarros/Biblioteca2 | https://github.com/ldizbarros/Biblioteca2 | 5b6bc1c15322f1d27ea1d30c0fe4991f300d0305 | 24bfe6726d0aa52f6a9888be513738c19f5e049f | refs/heads/master | 2020-03-19T10:22:08.691000 | 2018-06-07T10:21:54 | 2018-06-07T10:21:54 | 136,364,191 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package bilbioteca2.datos;
public class Prestamos {
private int codPrestamo;
private int codUsuario;
private String libro;
private String fechaPrestamo;
private String fechaDevolucion;
private int aumento;
private boolean devuelto;
public Prestamos() {
}
public Prestamos(int codPrestamo,int codUsuario, String libro, String fechaPrestamo, String fechaDevolucion, int aumento, boolean devuelto) {
this.codPrestamo = codPrestamo;
this.codUsuario = codUsuario;
this.libro = libro;
this.fechaPrestamo = fechaPrestamo;
this.fechaDevolucion = fechaDevolucion;
this.aumento = aumento;
this.devuelto=devuelto;
}
public int getCodPrestamo() {
return codPrestamo;
}
public int getCodUsuario() {
return codUsuario;
}
public String getLibro() {
return libro;
}
public String getFechaPrestamo() {
return fechaPrestamo;
}
public String getFechaDevolucion() {
return fechaDevolucion;
}
public int getAumento() {
return aumento;
}
public boolean isDevuelto() {
return devuelto;
}
public void setCodPrestamo(int codPrestamo) {
this.codPrestamo = codPrestamo;
}
public void setCodUsuario(int codUsuario) {
this.codUsuario = codUsuario;
}
public void setLibro(String libro) {
this.libro = libro;
}
public void setFechaPrestamo(String fechaPrestamo) {
this.fechaPrestamo = fechaPrestamo;
}
public void setFechaDevolucion(String fechaDevolucion) {
this.fechaDevolucion = fechaDevolucion;
}
public void setAumento(int aumento) {
this.aumento = aumento;
}
public void setDevuelto(boolean devuelto) {
this.devuelto = devuelto;
}
}
| UTF-8 | Java | 1,931 | java | Prestamos.java | Java | [] | null | [] | package bilbioteca2.datos;
public class Prestamos {
private int codPrestamo;
private int codUsuario;
private String libro;
private String fechaPrestamo;
private String fechaDevolucion;
private int aumento;
private boolean devuelto;
public Prestamos() {
}
public Prestamos(int codPrestamo,int codUsuario, String libro, String fechaPrestamo, String fechaDevolucion, int aumento, boolean devuelto) {
this.codPrestamo = codPrestamo;
this.codUsuario = codUsuario;
this.libro = libro;
this.fechaPrestamo = fechaPrestamo;
this.fechaDevolucion = fechaDevolucion;
this.aumento = aumento;
this.devuelto=devuelto;
}
public int getCodPrestamo() {
return codPrestamo;
}
public int getCodUsuario() {
return codUsuario;
}
public String getLibro() {
return libro;
}
public String getFechaPrestamo() {
return fechaPrestamo;
}
public String getFechaDevolucion() {
return fechaDevolucion;
}
public int getAumento() {
return aumento;
}
public boolean isDevuelto() {
return devuelto;
}
public void setCodPrestamo(int codPrestamo) {
this.codPrestamo = codPrestamo;
}
public void setCodUsuario(int codUsuario) {
this.codUsuario = codUsuario;
}
public void setLibro(String libro) {
this.libro = libro;
}
public void setFechaPrestamo(String fechaPrestamo) {
this.fechaPrestamo = fechaPrestamo;
}
public void setFechaDevolucion(String fechaDevolucion) {
this.fechaDevolucion = fechaDevolucion;
}
public void setAumento(int aumento) {
this.aumento = aumento;
}
public void setDevuelto(boolean devuelto) {
this.devuelto = devuelto;
}
}
| 1,931 | 0.620922 | 0.620404 | 80 | 22.137501 | 22.071896 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 4 |
c3536d0d854ed8306bde90a700383c0a88ba3e98 | 36,378,372,999,895 | 7a1914ab0d4f6c28ebeeb8ee581aa846629a17fb | /src/main/java/com/lc/web/resource/service/TreeService.java | df5d64e7cad5d36dddd600d4a060c9a93381b73f | [] | no_license | 472542625/llsssboot | https://github.com/472542625/llsssboot | 7b2592885376c16aa30df796003e08c4a7a10b7f | 9720bc088deb453b946bba84f770a405e71d40cd | refs/heads/master | 2020-05-25T04:46:08.395000 | 2019-05-20T12:19:20 | 2019-05-20T12:19:20 | 187,634,050 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lc.web.resource.service;
import com.lc.web.resource.entity.Coordinate;
import com.lc.web.resource.entity.Tree;
import java.util.List;
import java.util.Map;
public interface TreeService {
Tree listpointBygid(int gid);
List<Tree> listFyPoint();
void addpoint(Tree point);
List<Tree> listPointTreespecies();
List<Tree> listPointgrowingPotential();
void updatepoint(Tree point);
void deletePointBygid(int gid);
List<Coordinate> listDaxingCoordinate();
Coordinate listDaxingCoordinateByid(int coordinateid);
// //根据树龄查询
public List<Tree> listPointBytreeage(Map<String, Object> map);
// //根据树高查询
public List<Tree> listPointBytreeheight(Map<String, Object> map);
// /承包人
public List<Tree> listPointByContractor(String contractor);
// /树名
public List<Tree> listPointBytreespecies(String treespecies);
// 得到所有树种名称
public List<String> listtreespecies();
public List<String> listVillage();
//可视化通用查询
List<Tree> listPointByArea(Tree tree);
List<Tree> listPointById(String id);
List<Tree> selectTreeByCondtion(Tree tree);
String findTreespeciesByTreeid(Integer treeid);
}
| UTF-8 | Java | 1,184 | java | TreeService.java | Java | [] | null | [] | package com.lc.web.resource.service;
import com.lc.web.resource.entity.Coordinate;
import com.lc.web.resource.entity.Tree;
import java.util.List;
import java.util.Map;
public interface TreeService {
Tree listpointBygid(int gid);
List<Tree> listFyPoint();
void addpoint(Tree point);
List<Tree> listPointTreespecies();
List<Tree> listPointgrowingPotential();
void updatepoint(Tree point);
void deletePointBygid(int gid);
List<Coordinate> listDaxingCoordinate();
Coordinate listDaxingCoordinateByid(int coordinateid);
// //根据树龄查询
public List<Tree> listPointBytreeage(Map<String, Object> map);
// //根据树高查询
public List<Tree> listPointBytreeheight(Map<String, Object> map);
// /承包人
public List<Tree> listPointByContractor(String contractor);
// /树名
public List<Tree> listPointBytreespecies(String treespecies);
// 得到所有树种名称
public List<String> listtreespecies();
public List<String> listVillage();
//可视化通用查询
List<Tree> listPointByArea(Tree tree);
List<Tree> listPointById(String id);
List<Tree> selectTreeByCondtion(Tree tree);
String findTreespeciesByTreeid(Integer treeid);
}
| 1,184 | 0.7625 | 0.7625 | 51 | 20.960785 | 21.134453 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.980392 | false | false | 4 |
455ad413d509f60f7774b32b4a23698126bd0ec6 | 30,760,555,812,757 | 2606af43262b5167ceb2a0ae7bd36a1429305bc9 | /src/main/java/com/qy/sp/fee/modules/piplecode/legao/LegaoOrder.java | 180949f0c702564722b1977d099168326de6f302 | [] | no_license | maxkai/SPFee | https://github.com/maxkai/SPFee | 531a20d7e0a8979ff366b5571ac2fbec7850a62e | fce01f54aefc7e2f7052d51637cf2d851412c845 | refs/heads/master | 2022-08-30T11:28:20.629000 | 2022-08-08T09:04:27 | 2022-08-08T09:04:27 | 93,017,579 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qy.sp.fee.modules.piplecode.legao;
import com.qy.sp.fee.dto.TOrder;
public class LegaoOrder extends TOrder {
private String smsVertifyUrl;//验证接口
private String verifyCode;//验证码
private String DSOrderId;//东硕外部orderId
public String getSmsVertifyUrl() {
return smsVertifyUrl;
}
public void setSmsVertifyUrl(String smsVertifyUrl) {
this.smsVertifyUrl = smsVertifyUrl;
}
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
public String getDSOrderId() {
return DSOrderId;
}
public void setDSOrderId(String dSOrderId) {
DSOrderId = dSOrderId;
}
}
| UTF-8 | Java | 686 | java | LegaoOrder.java | Java | [] | null | [] | package com.qy.sp.fee.modules.piplecode.legao;
import com.qy.sp.fee.dto.TOrder;
public class LegaoOrder extends TOrder {
private String smsVertifyUrl;//验证接口
private String verifyCode;//验证码
private String DSOrderId;//东硕外部orderId
public String getSmsVertifyUrl() {
return smsVertifyUrl;
}
public void setSmsVertifyUrl(String smsVertifyUrl) {
this.smsVertifyUrl = smsVertifyUrl;
}
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
public String getDSOrderId() {
return DSOrderId;
}
public void setDSOrderId(String dSOrderId) {
DSOrderId = dSOrderId;
}
}
| 686 | 0.762048 | 0.762048 | 28 | 22.714285 | 17.535387 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.392857 | false | false | 4 |
b5382f0d88d1b0bcfb50b53b4ac9ec5521a9e2a9 | 2,774,548,931,286 | 22178a6a0266ac3f825ed9ef5d94c13ff586c7a3 | /android/com/valvesoftware/source2launcher/applauncher.java | 626ac1781528130bcb5cfaa6802dc592ea173f9b | [] | no_license | SteamDatabase/GameTracking-Underlords-Android | https://github.com/SteamDatabase/GameTracking-Underlords-Android | 276450a9ea5b37c02e7aed9d10cca7616c9b7388 | 84000d682e37d6ecb5cbbf3e11f02bd28d892f44 | refs/heads/master | 2021-06-16T04:48:07.313000 | 2021-05-11T21:51:09 | 2021-05-11T21:51:09 | 193,230,550 | 9 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.valvesoftware.source2launcher;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import com.valvesoftware.Activity;
import com.valvesoftware.Application;
public class applauncher extends Activity {
private static final String k_sSpewPackageName = "com.valvesoftware.source2launcher.applauncher";
private static Context s_context;
protected static native void queueSteamLoginWithAccessCode(String str, String str2);
public boolean IsLaunchActivity() {
return true;
}
/* access modifiers changed from: protected */
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (!isTaskRoot()) {
Intent intent = getIntent();
String action = intent.getAction();
if (intent != null && intent.hasCategory("android.intent.category.LAUNCHER") && action != null && action.equals("android.intent.action.MAIN")) {
Log.i("com.valvesoftware.applauncher", "Not task root, finish the activity.");
finish();
}
}
getWindow().getDecorView().setSystemUiVisibility(6);
if (Build.VERSION.SDK_INT >= 28) {
getWindow().getAttributes().layoutInDisplayCutoutMode = 1;
}
Application.WakeForDebugging(this);
s_context = this;
application GetInstance = application.GetInstance();
if (GetInstance != null) {
GetInstance.setupCommonUI(this);
}
getWindow().addFlags(128);
HandleSteamLogin();
application application = (application) Application.GetInstance();
if (application.HasInstallFinished()) {
application.LaunchMainActivity(true, this);
finish();
}
}
public void onResume() {
super.onResume();
application application = (application) Application.GetInstance();
if (Build.VERSION.SDK_INT >= 24 && Build.VERSION.SDK_INT <= 25 && application == null) {
forceRestart();
} else if (!application.HasInstallStarted()) {
Log.i("com.valvesoftware.applauncher", "We have read/write access");
StartInstallProcess();
}
}
/* access modifiers changed from: protected */
public void StartInstallProcess() {
Log.i("com.valvesoftware.StartInstallProcess", "Attempting install");
Application.GetInstance().TryInstall(this, true);
}
private static void forceRestart() {
Log.i("com.valvesoftware.applauncher", "Forcing restart.");
Context context = s_context;
if (context == null) {
Log.i("com.valvesoftware.applauncher", "null context, unable to force restart.");
return;
}
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(s_context.getPackageName());
if (launchIntentForPackage != null) {
launchIntentForPackage.addFlags(268435456);
Log.i("com.valvesoftware.applauncher", "Queue activity restart.");
s_context.startActivity(launchIntentForPackage);
Context context2 = s_context;
if (context2 instanceof android.app.Activity) {
((android.app.Activity) context2).finish();
}
Log.i("com.valvesoftware.applauncher", "Exit process.");
Runtime.getRuntime().exit(0);
return;
}
Log.e("com.valvesoftware.applauncher", "Could not getLaunchIntentForPackage().");
return;
}
Log.e("com.valvesoftware.applauncher", "Could not getPackageManager().");
}
private void HandleSteamLogin() {
Application.SteamLoginInfo_t GetSteamLoginFromIntentUrl = Application.GetSteamLoginFromIntentUrl(getIntent());
if (GetSteamLoginFromIntentUrl != null && Application.GetInstance().HasInstallFinished()) {
queueSteamLoginWithAccessCode(GetSteamLoginFromIntentUrl.authority, GetSteamLoginFromIntentUrl.accessCode);
}
}
}
| UTF-8 | Java | 4,288 | java | applauncher.java | Java | [] | null | [] | package com.valvesoftware.source2launcher;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import com.valvesoftware.Activity;
import com.valvesoftware.Application;
public class applauncher extends Activity {
private static final String k_sSpewPackageName = "com.valvesoftware.source2launcher.applauncher";
private static Context s_context;
protected static native void queueSteamLoginWithAccessCode(String str, String str2);
public boolean IsLaunchActivity() {
return true;
}
/* access modifiers changed from: protected */
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (!isTaskRoot()) {
Intent intent = getIntent();
String action = intent.getAction();
if (intent != null && intent.hasCategory("android.intent.category.LAUNCHER") && action != null && action.equals("android.intent.action.MAIN")) {
Log.i("com.valvesoftware.applauncher", "Not task root, finish the activity.");
finish();
}
}
getWindow().getDecorView().setSystemUiVisibility(6);
if (Build.VERSION.SDK_INT >= 28) {
getWindow().getAttributes().layoutInDisplayCutoutMode = 1;
}
Application.WakeForDebugging(this);
s_context = this;
application GetInstance = application.GetInstance();
if (GetInstance != null) {
GetInstance.setupCommonUI(this);
}
getWindow().addFlags(128);
HandleSteamLogin();
application application = (application) Application.GetInstance();
if (application.HasInstallFinished()) {
application.LaunchMainActivity(true, this);
finish();
}
}
public void onResume() {
super.onResume();
application application = (application) Application.GetInstance();
if (Build.VERSION.SDK_INT >= 24 && Build.VERSION.SDK_INT <= 25 && application == null) {
forceRestart();
} else if (!application.HasInstallStarted()) {
Log.i("com.valvesoftware.applauncher", "We have read/write access");
StartInstallProcess();
}
}
/* access modifiers changed from: protected */
public void StartInstallProcess() {
Log.i("com.valvesoftware.StartInstallProcess", "Attempting install");
Application.GetInstance().TryInstall(this, true);
}
private static void forceRestart() {
Log.i("com.valvesoftware.applauncher", "Forcing restart.");
Context context = s_context;
if (context == null) {
Log.i("com.valvesoftware.applauncher", "null context, unable to force restart.");
return;
}
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(s_context.getPackageName());
if (launchIntentForPackage != null) {
launchIntentForPackage.addFlags(268435456);
Log.i("com.valvesoftware.applauncher", "Queue activity restart.");
s_context.startActivity(launchIntentForPackage);
Context context2 = s_context;
if (context2 instanceof android.app.Activity) {
((android.app.Activity) context2).finish();
}
Log.i("com.valvesoftware.applauncher", "Exit process.");
Runtime.getRuntime().exit(0);
return;
}
Log.e("com.valvesoftware.applauncher", "Could not getLaunchIntentForPackage().");
return;
}
Log.e("com.valvesoftware.applauncher", "Could not getPackageManager().");
}
private void HandleSteamLogin() {
Application.SteamLoginInfo_t GetSteamLoginFromIntentUrl = Application.GetSteamLoginFromIntentUrl(getIntent());
if (GetSteamLoginFromIntentUrl != null && Application.GetInstance().HasInstallFinished()) {
queueSteamLoginWithAccessCode(GetSteamLoginFromIntentUrl.authority, GetSteamLoginFromIntentUrl.accessCode);
}
}
}
| 4,288 | 0.638526 | 0.63223 | 103 | 40.631069 | 32.059105 | 156 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.679612 | false | false | 4 |
e1d2e0ecea163607d499ed5b8cf2f7494af680bd | 5,480,378,310,968 | d07b81b285630b663e56705218032e7fb528b5c2 | /src/main/java/com/kerbart/checkpoint/model/Tournee.java | 3ac3c14258b27ee6ce0573213ed18e87bb615fbc | [] | no_license | kerbart/checkpoint | https://github.com/kerbart/checkpoint | e38962d6a363f35b46c1bb08def7f6b791e711c6 | e6e16b689adfe13e5b2a785bbfd157afcbc4a0e2 | refs/heads/master | 2021-04-09T11:31:01.364000 | 2016-07-04T14:06:56 | 2016-07-04T14:06:56 | 60,535,793 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kerbart.checkpoint.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import com.kerbart.checkpoint.helper.TokenHelper;
@Entity
public class Tournee implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "tournee_id")
Long id;
@Column
String name;
@Column
@Temporal(TemporalType.TIME)
Date dateCreation;
@Column
String token;
@ManyToOne
Cabinet cabinet;
public Tournee() {
super();
this.token = TokenHelper.generateToken();
}
public Tournee(String name) {
this();
this.name = name;
}
public Tournee(Cabinet cabinet, String name) {
this(name);
this.cabinet = cabinet;
}
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 Cabinet getCabinet() {
return cabinet;
}
public void setCabinet(Cabinet cabinet) {
this.cabinet = cabinet;
}
public Date getDateCreation() {
return dateCreation;
}
public void setDateCreation(Date dateCreation) {
this.dateCreation = dateCreation;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
| UTF-8 | Java | 1,756 | java | Tournee.java | Java | [] | null | [] | package com.kerbart.checkpoint.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import com.kerbart.checkpoint.helper.TokenHelper;
@Entity
public class Tournee implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "tournee_id")
Long id;
@Column
String name;
@Column
@Temporal(TemporalType.TIME)
Date dateCreation;
@Column
String token;
@ManyToOne
Cabinet cabinet;
public Tournee() {
super();
this.token = TokenHelper.generateToken();
}
public Tournee(String name) {
this();
this.name = name;
}
public Tournee(Cabinet cabinet, String name) {
this(name);
this.cabinet = cabinet;
}
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 Cabinet getCabinet() {
return cabinet;
}
public void setCabinet(Cabinet cabinet) {
this.cabinet = cabinet;
}
public Date getDateCreation() {
return dateCreation;
}
public void setDateCreation(Date dateCreation) {
this.dateCreation = dateCreation;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
| 1,756 | 0.64123 | 0.64123 | 92 | 18.086956 | 15.952819 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.369565 | false | false | 4 |
7fe0ee651419fa390f8904db32abea0e701c0ff6 | 27,925,877,407,895 | f4b00bf27b99ddea4bfb1e23be7e014f10a91e77 | /src/main/java/com/example/rockclass/vo/ClassRoundVo.java | 40b9672545a2fbc415ba30a19a68cbe9687bd104 | [] | no_license | Ogurimuio/rockClass-OOAD | https://github.com/Ogurimuio/rockClass-OOAD | 0000d52fa75294f151c38eabca05182a9a561ba7 | 4d007a4b4d4e724ab190261d6473dc170985f63f | refs/heads/master | 2020-04-24T18:56:15.240000 | 2019-02-23T09:08:36 | 2019-02-23T09:08:36 | 172,195,928 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.rockclass.vo;
public class ClassRoundVo {
Long id;
Byte enrollNum;
Byte classSerial;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Byte getEnrollNum() {
return enrollNum;
}
public void setEnrollNum(Byte enrollNum) {
this.enrollNum = enrollNum;
}
public Byte getClassSerial() {
return classSerial;
}
public void setClassSerial(Byte classSerial) {
this.classSerial = classSerial;
}
}
| UTF-8 | Java | 560 | java | ClassRoundVo.java | Java | [] | null | [] | package com.example.rockclass.vo;
public class ClassRoundVo {
Long id;
Byte enrollNum;
Byte classSerial;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Byte getEnrollNum() {
return enrollNum;
}
public void setEnrollNum(Byte enrollNum) {
this.enrollNum = enrollNum;
}
public Byte getClassSerial() {
return classSerial;
}
public void setClassSerial(Byte classSerial) {
this.classSerial = classSerial;
}
}
| 560 | 0.601786 | 0.601786 | 33 | 15.969697 | 15.382959 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.30303 | false | false | 4 |
c6c1008c21af17be3c6bf6247e5a37ea75795a30 | 36,112,085,045,103 | 7909c9056540482210186fdc03dedca3d4df2c46 | /java/com/parrot/drone/sdkcore/arsdk/ArsdkFeatureCamera.java | a00b3c7a2f5e43e0935adde75e63f257509d37a4 | [] | no_license | elpiel/arsdk-java-generated | https://github.com/elpiel/arsdk-java-generated | 07de84a5d8166fd60d17f61444981d5070099879 | d8290e277e48665ef1bf41e109898921cd2fe9c1 | refs/heads/master | 2023-01-01T09:54:56.089000 | 2020-10-28T07:48:53 | 2020-10-28T07:48:53 | 307,936,035 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /** Generated, do not edit ! */
package com.parrot.drone.sdkcore.arsdk;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.parrot.drone.sdkcore.arsdk.command.ArsdkCommand;
import com.parrot.drone.sdkcore.ulog.ULog;
import static com.parrot.drone.sdkcore.arsdk.Logging.TAG;
import android.util.SparseArray;
import java.util.function.Consumer;
import java.util.EnumSet;
/**
* Camera feature command/event interface.
*/
public class ArsdkFeatureCamera {
/**
* Camera model.
*/
public enum Model {
/**
* Main camera, for photo and/or video.
*/
MAIN(0),
/**
* Thermal camera, for photo and/or video.
*/
THERMAL(1),
/**
* Thermal-blended camera, Visible and Thermal stream are blended, for photo and/or video.
*/
THERMAL_BLENDED(2);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Model fromValue(int value) {
return MAP.get(value, null);
}
private Model(int value) {
this.value = value;
}
private static final SparseArray<Model> MAP;
static {
MAP = new SparseArray<>();
for (Model e: values())
MAP.put(e.value, e);
}
}
/**
* Indicate if a feature is supported by the drone.
*/
public enum Supported {
/**
* Not Supported.
*/
NOT_SUPPORTED(0),
/**
* Supported.
*/
SUPPORTED(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Supported fromValue(int value) {
return MAP.get(value, null);
}
private Supported(int value) {
this.value = value;
}
private static final SparseArray<Supported> MAP;
static {
MAP = new SparseArray<>();
for (Supported e: values())
MAP.put(e.value, e);
}
}
/**
* Indicate if a feature is available in current mode/configuration.
*/
public enum Availability {
/**
* Not Available.
*/
NOT_AVAILABLE(0),
/**
* Available.
*/
AVAILABLE(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Availability fromValue(int value) {
return MAP.get(value, null);
}
private Availability(int value) {
this.value = value;
}
private static final SparseArray<Availability> MAP;
static {
MAP = new SparseArray<>();
for (Availability e: values())
MAP.put(e.value, e);
}
}
/**
* Feature current state.
*/
public enum State {
/**
* Feature is not currently active.
*/
INACTIVE(0),
/**
* Feature is currently active.
*/
ACTIVE(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static State fromValue(int value) {
return MAP.get(value, null);
}
private State(int value) {
this.value = value;
}
private static final SparseArray<State> MAP;
static {
MAP = new SparseArray<>();
for (State e: values())
MAP.put(e.value, e);
}
}
/**
* Exposure mode.
*/
public enum ExposureMode {
/**
* Automatic shutter speed and iso, balanced.
*/
AUTOMATIC(0),
/**
* Automatic shutter speed and iso, prefer increasing iso sensitivity over using low shutter speed. This mode
* provides better results when the drone is moving dynamically.
*/
AUTOMATIC_PREFER_ISO_SENSITIVITY(1),
/**
* Automatic shutter speed and iso, prefer reducing shutter speed over using high iso sensitivity. This mode
* provides better results when the drone is moving slowly.
*/
AUTOMATIC_PREFER_SHUTTER_SPEED(2),
/**
* Manual iso sensitivity, automatic shutter speed.
*/
MANUAL_ISO_SENSITIVITY(3),
/**
* Manual shutter speed, automatic iso.
*/
MANUAL_SHUTTER_SPEED(4),
/**
* Manual iso sensitivity and shutter speed.
*/
MANUAL(5);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static ExposureMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<ExposureMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 6) {
ULog.e(TAG, "Unsupported ExposureMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<ExposureMode> fromBitfield(int bitfield) {
EnumSet<ExposureMode> enums = EnumSet.noneOf(ExposureMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull ExposureMode... enums) {
int bitField = 0;
for (ExposureMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private ExposureMode(int value) {
this.value = value;
}
private static final SparseArray<ExposureMode> MAP;
static {
MAP = new SparseArray<>();
for (ExposureMode e: values())
MAP.put(e.value, e);
}
}
/**
* The shutter speed in seconds.
*/
public enum ShutterSpeed {
/**
* 1/10000 sec.
*/
SHUTTER_1_OVER_10000(0),
/**
* 1/8000 sec.
*/
SHUTTER_1_OVER_8000(1),
/**
* 1/6400 sec.
*/
SHUTTER_1_OVER_6400(2),
/**
* 1/5000 sec.
*/
SHUTTER_1_OVER_5000(3),
/**
* 1/4000 sec.
*/
SHUTTER_1_OVER_4000(4),
/**
* 1/3200 sec.
*/
SHUTTER_1_OVER_3200(5),
/**
* 1/2500 sec.
*/
SHUTTER_1_OVER_2500(6),
/**
* 1/2000 sec.
*/
SHUTTER_1_OVER_2000(7),
/**
* 1/1600 sec.
*/
SHUTTER_1_OVER_1600(8),
/**
* 1/1250 sec.
*/
SHUTTER_1_OVER_1250(9),
/**
* 1/1000 sec.
*/
SHUTTER_1_OVER_1000(10),
/**
* 1/800 sec.
*/
SHUTTER_1_OVER_800(11),
/**
* 1/640 sec.
*/
SHUTTER_1_OVER_640(12),
/**
* 1/500 sec.
*/
SHUTTER_1_OVER_500(13),
/**
* 1/400 sec.
*/
SHUTTER_1_OVER_400(14),
/**
* 1/320 sec.
*/
SHUTTER_1_OVER_320(15),
/**
* 1/240 sec.
*/
SHUTTER_1_OVER_240(16),
/**
* 1/200 sec.
*/
SHUTTER_1_OVER_200(17),
/**
* 1/160 sec.
*/
SHUTTER_1_OVER_160(18),
/**
* 1/120 sec.
*/
SHUTTER_1_OVER_120(19),
/**
* 1/100 sec.
*/
SHUTTER_1_OVER_100(20),
/**
* 1/80 sec.
*/
SHUTTER_1_OVER_80(21),
/**
* 1/60 sec.
*/
SHUTTER_1_OVER_60(22),
/**
* 1/50 sec.
*/
SHUTTER_1_OVER_50(23),
/**
* 1/40 sec.
*/
SHUTTER_1_OVER_40(24),
/**
* 1/30 sec.
*/
SHUTTER_1_OVER_30(25),
/**
* 1/25 sec.
*/
SHUTTER_1_OVER_25(26),
/**
* 1/15 sec.
*/
SHUTTER_1_OVER_15(27),
/**
* 1/10 sec.
*/
SHUTTER_1_OVER_10(28),
/**
* 1/8 sec.
*/
SHUTTER_1_OVER_8(29),
/**
* 1/6 sec.
*/
SHUTTER_1_OVER_6(30),
/**
* 1/4 sec.
*/
SHUTTER_1_OVER_4(31),
/**
* 1/3 sec.
*/
SHUTTER_1_OVER_3(32),
/**
* 1/2 sec.
*/
SHUTTER_1_OVER_2(33),
/**
* 1/1.5 sec.
*/
SHUTTER_1_OVER_1_5(34),
/**
* 1 sec.
*/
SHUTTER_1(35);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static ShutterSpeed fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(long bitfield) {
return (bitfield & (1L << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(long bitfield, @NonNull Consumer<ShutterSpeed> func) {
while (bitfield != 0) {
int value = Long.numberOfTrailingZeros(bitfield);
if (value >= 36) {
ULog.e(TAG, "Unsupported ShutterSpeed bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1L << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<ShutterSpeed> fromBitfield(long bitfield) {
EnumSet<ShutterSpeed> enums = EnumSet.noneOf(ShutterSpeed.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static long toBitField(@NonNull ShutterSpeed... enums) {
long bitField = 0;
for (ShutterSpeed e : enums)
bitField |= 1L << e.value;
return bitField;
}
private ShutterSpeed(int value) {
this.value = value;
}
private static final SparseArray<ShutterSpeed> MAP;
static {
MAP = new SparseArray<>();
for (ShutterSpeed e: values())
MAP.put(e.value, e);
}
}
/**
* ISO Sensitivity levels.
*/
public enum IsoSensitivity {
/**
* ISO 50.
*/
ISO_50(0),
/**
* ISO 64.
*/
ISO_64(1),
/**
* ISO 80.
*/
ISO_80(2),
/**
* ISO 100.
*/
ISO_100(3),
/**
* ISO 125.
*/
ISO_125(4),
/**
* ISO 160.
*/
ISO_160(5),
/**
* ISO 200.
*/
ISO_200(6),
/**
* ISO 250.
*/
ISO_250(7),
/**
* ISO 320.
*/
ISO_320(8),
/**
* ISO 400.
*/
ISO_400(9),
/**
* ISO 500.
*/
ISO_500(10),
/**
* ISO 640.
*/
ISO_640(11),
/**
* ISO 800.
*/
ISO_800(12),
/**
* ISO 1200.
*/
ISO_1200(13),
/**
* ISO 1600.
*/
ISO_1600(14),
/**
* ISO 2500.
*/
ISO_2500(15),
/**
* ISO 3200.
*/
ISO_3200(16);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static IsoSensitivity fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<IsoSensitivity> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 17) {
ULog.e(TAG, "Unsupported IsoSensitivity bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<IsoSensitivity> fromBitfield(int bitfield) {
EnumSet<IsoSensitivity> enums = EnumSet.noneOf(IsoSensitivity.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull IsoSensitivity... enums) {
int bitField = 0;
for (IsoSensitivity e : enums)
bitField |= 1 << e.value;
return bitField;
}
private IsoSensitivity(int value) {
this.value = value;
}
private static final SparseArray<IsoSensitivity> MAP;
static {
MAP = new SparseArray<>();
for (IsoSensitivity e: values())
MAP.put(e.value, e);
}
}
/**
* Exposure compensation.
*/
public enum EvCompensation {
/**
* -3.00 EV.
*/
EV_MINUS_3_00(0),
/**
* -2.67 EV.
*/
EV_MINUS_2_67(1),
/**
* -2.33 EV.
*/
EV_MINUS_2_33(2),
/**
* -2.00 EV.
*/
EV_MINUS_2_00(3),
/**
* -1.67 EV.
*/
EV_MINUS_1_67(4),
/**
* -1.33 EV.
*/
EV_MINUS_1_33(5),
/**
* -1.00 EV.
*/
EV_MINUS_1_00(6),
/**
* -0.67 EV.
*/
EV_MINUS_0_67(7),
/**
* -0.33 EV.
*/
EV_MINUS_0_33(8),
/**
* 0.00 EV.
*/
EV_0_00(9),
/**
* 0.33 EV.
*/
EV_0_33(10),
/**
* 0.67 EV.
*/
EV_0_67(11),
/**
* 1.00 EV.
*/
EV_1_00(12),
/**
* 1.33 EV.
*/
EV_1_33(13),
/**
* 1.67 EV.
*/
EV_1_67(14),
/**
* 2.00 EV.
*/
EV_2_00(15),
/**
* 2.33 EV.
*/
EV_2_33(16),
/**
* 2.67 EV.
*/
EV_2_67(17),
/**
* 3.00 EV.
*/
EV_3_00(18);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static EvCompensation fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<EvCompensation> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 19) {
ULog.e(TAG, "Unsupported EvCompensation bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<EvCompensation> fromBitfield(int bitfield) {
EnumSet<EvCompensation> enums = EnumSet.noneOf(EvCompensation.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull EvCompensation... enums) {
int bitField = 0;
for (EvCompensation e : enums)
bitField |= 1 << e.value;
return bitField;
}
private EvCompensation(int value) {
this.value = value;
}
private static final SparseArray<EvCompensation> MAP;
static {
MAP = new SparseArray<>();
for (EvCompensation e: values())
MAP.put(e.value, e);
}
}
/**
* The white balance mode.
*/
public enum WhiteBalanceMode {
/**
* Automatic Estimation of White Balance scales.
*/
AUTOMATIC(0),
/**
* Candle preset.
*/
CANDLE(1),
/**
* Sunset preset.
*/
SUNSET(2),
/**
* Incandescent light preset.
*/
INCANDESCENT(3),
/**
* Warm white fluorescent light preset.
*/
WARM_WHITE_FLUORESCENT(4),
/**
* Halogen light preset.
*/
HALOGEN(5),
/**
* Fluorescent light preset.
*/
FLUORESCENT(6),
/**
* Cool white fluorescent light preset.
*/
COOL_WHITE_FLUORESCENT(7),
/**
* Flash light preset.
*/
FLASH(8),
/**
* Daylight preset.
*/
DAYLIGHT(9),
/**
* Sunny preset.
*/
SUNNY(10),
/**
* Cloudy preset.
*/
CLOUDY(11),
/**
* Snow preset.
*/
SNOW(12),
/**
* Hazy preset.
*/
HAZY(13),
/**
* Shaded preset.
*/
SHADED(14),
/**
* Green foliage preset.
*/
GREEN_FOLIAGE(15),
/**
* Blue sky preset.
*/
BLUE_SKY(16),
/**
* Custom white balance value.
*/
CUSTOM(17);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static WhiteBalanceMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<WhiteBalanceMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 18) {
ULog.e(TAG, "Unsupported WhiteBalanceMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<WhiteBalanceMode> fromBitfield(int bitfield) {
EnumSet<WhiteBalanceMode> enums = EnumSet.noneOf(WhiteBalanceMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull WhiteBalanceMode... enums) {
int bitField = 0;
for (WhiteBalanceMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private WhiteBalanceMode(int value) {
this.value = value;
}
private static final SparseArray<WhiteBalanceMode> MAP;
static {
MAP = new SparseArray<>();
for (WhiteBalanceMode e: values())
MAP.put(e.value, e);
}
}
/**
* The white balance temperature.
*/
public enum WhiteBalanceTemperature {
/**
* 1500 K.
*/
T_1500(0),
/**
* 1750 K.
*/
T_1750(1),
/**
* 2000 K.
*/
T_2000(2),
/**
* 2250 K.
*/
T_2250(3),
/**
* 2500 K.
*/
T_2500(4),
/**
* 2750 K.
*/
T_2750(5),
/**
* 3000 K.
*/
T_3000(6),
/**
* 3250 K.
*/
T_3250(7),
/**
* 3500 K.
*/
T_3500(8),
/**
* 3750 K.
*/
T_3750(9),
/**
* 4000 K.
*/
T_4000(10),
/**
* 4250 K.
*/
T_4250(11),
/**
* 4500 K.
*/
T_4500(12),
/**
* 4750 K.
*/
T_4750(13),
/**
* 5000 K.
*/
T_5000(14),
/**
* 5250 K.
*/
T_5250(15),
/**
* 5500 K.
*/
T_5500(16),
/**
* 5750 K.
*/
T_5750(17),
/**
* 6000 K.
*/
T_6000(18),
/**
* 6250 K.
*/
T_6250(19),
/**
* 6500 K.
*/
T_6500(20),
/**
* 6750 K.
*/
T_6750(21),
/**
* 7000 K.
*/
T_7000(22),
/**
* 7250 K.
*/
T_7250(23),
/**
* 7500 K.
*/
T_7500(24),
/**
* 7750 K.
*/
T_7750(25),
/**
* 8000 K.
*/
T_8000(26),
/**
* 8250 K.
*/
T_8250(27),
/**
* 8500 K.
*/
T_8500(28),
/**
* 8750 K.
*/
T_8750(29),
/**
* 9000 K.
*/
T_9000(30),
/**
* 9250 K.
*/
T_9250(31),
/**
* 9500 K.
*/
T_9500(32),
/**
* 9750 K.
*/
T_9750(33),
/**
* 10000 K.
*/
T_10000(34),
/**
* 10250 K.
*/
T_10250(35),
/**
* 10500 K.
*/
T_10500(36),
/**
* 10750 K.
*/
T_10750(37),
/**
* 11000 K.
*/
T_11000(38),
/**
* 11250 K.
*/
T_11250(39),
/**
* 11500 K.
*/
T_11500(40),
/**
* 11750 K.
*/
T_11750(41),
/**
* 12000 K.
*/
T_12000(42),
/**
* 12250 K.
*/
T_12250(43),
/**
* 12500 K.
*/
T_12500(44),
/**
* 12750 K.
*/
T_12750(45),
/**
* 13000 K.
*/
T_13000(46),
/**
* 13250 K.
*/
T_13250(47),
/**
* 13500 K.
*/
T_13500(48),
/**
* 13750 K.
*/
T_13750(49),
/**
* 14000 K.
*/
T_14000(50),
/**
* 14250 K.
*/
T_14250(51),
/**
* 14500 K.
*/
T_14500(52),
/**
* 14750 K.
*/
T_14750(53),
/**
* 15000 K.
*/
T_15000(54);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static WhiteBalanceTemperature fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(long bitfield) {
return (bitfield & (1L << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(long bitfield, @NonNull Consumer<WhiteBalanceTemperature> func) {
while (bitfield != 0) {
int value = Long.numberOfTrailingZeros(bitfield);
if (value >= 55) {
ULog.e(TAG, "Unsupported WhiteBalanceTemperature bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1L << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<WhiteBalanceTemperature> fromBitfield(long bitfield) {
EnumSet<WhiteBalanceTemperature> enums = EnumSet.noneOf(WhiteBalanceTemperature.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static long toBitField(@NonNull WhiteBalanceTemperature... enums) {
long bitField = 0;
for (WhiteBalanceTemperature e : enums)
bitField |= 1L << e.value;
return bitField;
}
private WhiteBalanceTemperature(int value) {
this.value = value;
}
private static final SparseArray<WhiteBalanceTemperature> MAP;
static {
MAP = new SparseArray<>();
for (WhiteBalanceTemperature e: values())
MAP.put(e.value, e);
}
}
/**
* Images style.
*/
public enum Style {
/**
* Natural look style.
*/
STANDARD(0),
/**
* Parrot Log, produce flat and desaturated images, best for post-processing.
*/
PLOG(1),
/**
* Intense style: bright colors, warm shade, high contrast.
*/
INTENSE(2),
/**
* Pastel style: soft colors, cold shade, low contrast.
*/
PASTEL(3);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Style fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<Style> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 4) {
ULog.e(TAG, "Unsupported Style bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<Style> fromBitfield(int bitfield) {
EnumSet<Style> enums = EnumSet.noneOf(Style.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull Style... enums) {
int bitField = 0;
for (Style e : enums)
bitField |= 1 << e.value;
return bitField;
}
private Style(int value) {
this.value = value;
}
private static final SparseArray<Style> MAP;
static {
MAP = new SparseArray<>();
for (Style e: values())
MAP.put(e.value, e);
}
}
/**
* Camera mode.
*/
public enum CameraMode {
/**
* Camera is in recording mode.
*/
RECORDING(0),
/**
* Camera is in photo mode.
*/
PHOTO(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static CameraMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<CameraMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 2) {
ULog.e(TAG, "Unsupported CameraMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<CameraMode> fromBitfield(int bitfield) {
EnumSet<CameraMode> enums = EnumSet.noneOf(CameraMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull CameraMode... enums) {
int bitField = 0;
for (CameraMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private CameraMode(int value) {
this.value = value;
}
private static final SparseArray<CameraMode> MAP;
static {
MAP = new SparseArray<>();
for (CameraMode e: values())
MAP.put(e.value, e);
}
}
/**
* .
*/
public enum RecordingMode {
/**
* Standard mode.
*/
STANDARD(0),
/**
* Create an accelerated video by dropping some frame at a user specified rate define by `hyperlapse_value`.
*/
HYPERLAPSE(1),
/**
* Record x2 or x4 slowed-down videos.
*/
SLOW_MOTION(2),
/**
* Record high-framerate videos (playback speed is x1).
*/
HIGH_FRAMERATE(3);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static RecordingMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<RecordingMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 4) {
ULog.e(TAG, "Unsupported RecordingMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<RecordingMode> fromBitfield(int bitfield) {
EnumSet<RecordingMode> enums = EnumSet.noneOf(RecordingMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull RecordingMode... enums) {
int bitField = 0;
for (RecordingMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private RecordingMode(int value) {
this.value = value;
}
private static final SparseArray<RecordingMode> MAP;
static {
MAP = new SparseArray<>();
for (RecordingMode e: values())
MAP.put(e.value, e);
}
}
/**
* .
*/
public enum PhotoMode {
/**
* Single shot mode.
*/
SINGLE(0),
/**
* Bracketing mode. Takes a burst of 3 or 5 frames with a different exposure.
*/
BRACKETING(1),
/**
* Burst mode. Takes burst of frames.
*/
BURST(2),
/**
* Time-lapse mode. Takes frames at a regular time interval.
*/
TIME_LAPSE(3),
/**
* GPS-lapse mode. Takse frames at a regular GPS position interval.
*/
GPS_LAPSE(4);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<PhotoMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 5) {
ULog.e(TAG, "Unsupported PhotoMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<PhotoMode> fromBitfield(int bitfield) {
EnumSet<PhotoMode> enums = EnumSet.noneOf(PhotoMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull PhotoMode... enums) {
int bitField = 0;
for (PhotoMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private PhotoMode(int value) {
this.value = value;
}
private static final SparseArray<PhotoMode> MAP;
static {
MAP = new SparseArray<>();
for (PhotoMode e: values())
MAP.put(e.value, e);
}
}
/**
* Video resolution.
*/
public enum Resolution {
/**
* 4096x2160 pixels (4k cinema).
*/
RES_DCI_4K(0),
/**
* 3840x2160 pixels (UHD).
*/
RES_UHD_4K(1),
/**
* 2704x1524 pixels.
*/
RES_2_7K(2),
/**
* 1920x1080 pixels (Full HD).
*/
RES_1080P(3),
/**
* 1280x720 pixels (HD).
*/
RES_720P(4),
/**
* 856x480 pixels.
*/
RES_480P(5),
/**
* 1440x1080 pixels (SD).
*/
RES_1080P_SD(6),
/**
* 960x720 pixels (SD).
*/
RES_720P_SD(7),
/**
* 7680x4320 pixels (UHD).
*/
RES_UHD_8K(8),
/**
* 5120x2880 pixels.
*/
RES_5K(9);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Resolution fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<Resolution> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 10) {
ULog.e(TAG, "Unsupported Resolution bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<Resolution> fromBitfield(int bitfield) {
EnumSet<Resolution> enums = EnumSet.noneOf(Resolution.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull Resolution... enums) {
int bitField = 0;
for (Resolution e : enums)
bitField |= 1 << e.value;
return bitField;
}
private Resolution(int value) {
this.value = value;
}
private static final SparseArray<Resolution> MAP;
static {
MAP = new SparseArray<>();
for (Resolution e: values())
MAP.put(e.value, e);
}
}
/**
* Video recording frame rate.
*/
public enum Framerate {
/**
* 23.97 fps.
*/
FPS_24(0),
/**
* 25 fps.
*/
FPS_25(1),
/**
* 29.97 fps.
*/
FPS_30(2),
/**
* 47.952 fps.
*/
FPS_48(3),
/**
* 50 fps.
*/
FPS_50(4),
/**
* 59.94 fps.
*/
FPS_60(5),
/**
* 95.88 fps.
*/
FPS_96(6),
/**
* 100 fps.
*/
FPS_100(7),
/**
* 119.88 fps.
*/
FPS_120(8),
/**
* 9 fps. For thermal only, capture triggered by thermal sensor.
*/
FPS_9(9),
/**
* 15 fps.
*/
FPS_15(10),
/**
* 20 fps.
*/
FPS_20(11),
/**
* 191.81 fps.
*/
FPS_192(12),
/**
* 200 fps.
*/
FPS_200(13),
/**
* 239.76 fps.
*/
FPS_240(14),
/**
* 10 fps. For thermal only, capture triggered by thermal sensor.
*/
FPS_10(15),
/**
* 8.57 fps. For thermal only, capture triggered by thermal sensor.
*/
FPS_8_6(16);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Framerate fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<Framerate> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 17) {
ULog.e(TAG, "Unsupported Framerate bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<Framerate> fromBitfield(int bitfield) {
EnumSet<Framerate> enums = EnumSet.noneOf(Framerate.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull Framerate... enums) {
int bitField = 0;
for (Framerate e : enums)
bitField |= 1 << e.value;
return bitField;
}
private Framerate(int value) {
this.value = value;
}
private static final SparseArray<Framerate> MAP;
static {
MAP = new SparseArray<>();
for (Framerate e: values())
MAP.put(e.value, e);
}
}
/**
* The photo format.
*/
public enum PhotoFormat {
/**
* Sensor full resolution, not dewarped.
*/
FULL_FRAME(0),
/**
* Rectilinear projection, dewarped.
*/
RECTILINEAR(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoFormat fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<PhotoFormat> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 2) {
ULog.e(TAG, "Unsupported PhotoFormat bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<PhotoFormat> fromBitfield(int bitfield) {
EnumSet<PhotoFormat> enums = EnumSet.noneOf(PhotoFormat.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull PhotoFormat... enums) {
int bitField = 0;
for (PhotoFormat e : enums)
bitField |= 1 << e.value;
return bitField;
}
private PhotoFormat(int value) {
this.value = value;
}
private static final SparseArray<PhotoFormat> MAP;
static {
MAP = new SparseArray<>();
for (PhotoFormat e: values())
MAP.put(e.value, e);
}
}
/**
* The photo format.
*/
public enum PhotoFileFormat {
/**
* photo recorded in JPEG format.
*/
JPEG(0),
/**
* photo recorded in DNG format.
*/
DNG(1),
/**
* photo recorded in both DNG and JPEG format.
*/
DNG_JPEG(2);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoFileFormat fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<PhotoFileFormat> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 3) {
ULog.e(TAG, "Unsupported PhotoFileFormat bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<PhotoFileFormat> fromBitfield(int bitfield) {
EnumSet<PhotoFileFormat> enums = EnumSet.noneOf(PhotoFileFormat.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull PhotoFileFormat... enums) {
int bitField = 0;
for (PhotoFileFormat e : enums)
bitField |= 1 << e.value;
return bitField;
}
private PhotoFileFormat(int value) {
this.value = value;
}
private static final SparseArray<PhotoFileFormat> MAP;
static {
MAP = new SparseArray<>();
for (PhotoFileFormat e: values())
MAP.put(e.value, e);
}
}
/**
* Anti-flicker mode.
*/
public enum AntiflickerMode {
/**
* Anti-flicker off.
*/
OFF(0),
/**
* Auto detect.
*/
AUTO(1),
/**
* force the exposure time to be an integer multiple of 10ms.
*/
MODE_50HZ(2),
/**
* force the exposure time to be an integer multiple of 8.33ms.
*/
MODE_60HZ(3);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static AntiflickerMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<AntiflickerMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 4) {
ULog.e(TAG, "Unsupported AntiflickerMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<AntiflickerMode> fromBitfield(int bitfield) {
EnumSet<AntiflickerMode> enums = EnumSet.noneOf(AntiflickerMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull AntiflickerMode... enums) {
int bitField = 0;
for (AntiflickerMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private AntiflickerMode(int value) {
this.value = value;
}
private static final SparseArray<AntiflickerMode> MAP;
static {
MAP = new SparseArray<>();
for (AntiflickerMode e: values())
MAP.put(e.value, e);
}
}
/**
* Values for hyperlapse mode.
*/
public enum HyperlapseValue {
/**
* Record 1 of 15 frames.
*/
RATIO_15(0),
/**
* Record 1 of 30 frames.
*/
RATIO_30(1),
/**
* Record 1 of 60 frames.
*/
RATIO_60(2),
/**
* Record 1 of 120 frames.
*/
RATIO_120(3),
/**
* Record 1 of 240 frames.
*/
RATIO_240(4);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static HyperlapseValue fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<HyperlapseValue> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 5) {
ULog.e(TAG, "Unsupported HyperlapseValue bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<HyperlapseValue> fromBitfield(int bitfield) {
EnumSet<HyperlapseValue> enums = EnumSet.noneOf(HyperlapseValue.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull HyperlapseValue... enums) {
int bitField = 0;
for (HyperlapseValue e : enums)
bitField |= 1 << e.value;
return bitField;
}
private HyperlapseValue(int value) {
this.value = value;
}
private static final SparseArray<HyperlapseValue> MAP;
static {
MAP = new SparseArray<>();
for (HyperlapseValue e: values())
MAP.put(e.value, e);
}
}
/**
* Values for burst photo mode.
*/
public enum BurstValue {
/**
* Record 14 picture over 4 second.
*/
BURST_14_OVER_4S(0),
/**
* Record 14 picture over 2 second.
*/
BURST_14_OVER_2S(1),
/**
* Record 14 picture over 1 second.
*/
BURST_14_OVER_1S(2),
/**
* Record 10 picture over 4 second.
*/
BURST_10_OVER_4S(3),
/**
* Record 10 picture over 2 second.
*/
BURST_10_OVER_2S(4),
/**
* Record 10 picture over 1 second.
*/
BURST_10_OVER_1S(5),
/**
* Record 4 picture over 4 second.
*/
BURST_4_OVER_4S(6),
/**
* Record 4 picture over 2 second.
*/
BURST_4_OVER_2S(7),
/**
* Record 4 picture over 1 second.
*/
BURST_4_OVER_1S(8);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static BurstValue fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<BurstValue> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 9) {
ULog.e(TAG, "Unsupported BurstValue bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<BurstValue> fromBitfield(int bitfield) {
EnumSet<BurstValue> enums = EnumSet.noneOf(BurstValue.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull BurstValue... enums) {
int bitField = 0;
for (BurstValue e : enums)
bitField |= 1 << e.value;
return bitField;
}
private BurstValue(int value) {
this.value = value;
}
private static final SparseArray<BurstValue> MAP;
static {
MAP = new SparseArray<>();
for (BurstValue e: values())
MAP.put(e.value, e);
}
}
/**
* Bracketing mode preset.
*/
public enum BracketingPreset {
/**
* 3 frames, with EV compensation of [-1 EV, 0 EV, +1 EV].
*/
PRESET_1EV(0),
/**
* 3 frames, with EV compensation of [-2 EV, 0 EV, +2 EV].
*/
PRESET_2EV(1),
/**
* 3 frames, with EV compensation of [-3 EV, 0 EV, +3 EV].
*/
PRESET_3EV(2),
/**
* 5 frames, with EV compensation of [-2 EV, -1 EV, 0 EV, +1 EV, +2 EV].
*/
PRESET_1EV_2EV(3),
/**
* 5 frames, with EV compensation of [-3 EV, -1 EV, 0 EV, +1 EV, +3 EV].
*/
PRESET_1EV_3EV(4),
/**
* 5 frames, with EV compensation of [-3 EV, -2 EV, 0 EV, +2 EV, +3 EV].
*/
PRESET_2EV_3EV(5),
/**
* 7 frames, with EV compensation of [-3 EV, -2 EV, -1 EV, 0 EV, +1 EV, +2 EV, +3 EV].
*/
PRESET_1EV_2EV_3EV(6);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static BracketingPreset fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<BracketingPreset> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 7) {
ULog.e(TAG, "Unsupported BracketingPreset bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<BracketingPreset> fromBitfield(int bitfield) {
EnumSet<BracketingPreset> enums = EnumSet.noneOf(BracketingPreset.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull BracketingPreset... enums) {
int bitField = 0;
for (BracketingPreset e : enums)
bitField |= 1 << e.value;
return bitField;
}
private BracketingPreset(int value) {
this.value = value;
}
private static final SparseArray<BracketingPreset> MAP;
static {
MAP = new SparseArray<>();
for (BracketingPreset e: values())
MAP.put(e.value, e);
}
}
/**
* Video stream mode.
*/
public enum StreamingMode {
/**
* Minimize latency with average reliability (best for piloting).
*/
LOW_LATENCY(0),
/**
* Maximize the reliability with an average latency (best when streaming quality is important but not the
* latency).
*/
HIGH_RELIABILITY(1),
/**
* Maximize the reliability using a framerate decimation with an average latency (best when streaming quality is
* important but not the latency).
*/
HIGH_RELIABILITY_LOW_FRAMERATE(2);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static StreamingMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<StreamingMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 3) {
ULog.e(TAG, "Unsupported StreamingMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<StreamingMode> fromBitfield(int bitfield) {
EnumSet<StreamingMode> enums = EnumSet.noneOf(StreamingMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull StreamingMode... enums) {
int bitField = 0;
for (StreamingMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private StreamingMode(int value) {
this.value = value;
}
private static final SparseArray<StreamingMode> MAP;
static {
MAP = new SparseArray<>();
for (StreamingMode e: values())
MAP.put(e.value, e);
}
}
/**
* Result for command `take_photo`.
*/
public enum PhotoResult {
/**
* Taking a new photo.
*/
TAKING_PHOTO(0),
/**
* A photo has been taken.
*/
PHOTO_TAKEN(1),
/**
* A photo has been saved to the file system.
*/
PHOTO_SAVED(2),
/**
* Error taking photo: not enough space in storage.
*/
ERROR_NO_STORAGE_SPACE(3),
/**
* Error taking photo: wrong state.
*/
ERROR_BAD_STATE(4),
/**
* Error taking photo: generic error.
*/
ERROR(5);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoResult fromValue(int value) {
return MAP.get(value, null);
}
private PhotoResult(int value) {
this.value = value;
}
private static final SparseArray<PhotoResult> MAP;
static {
MAP = new SparseArray<>();
for (PhotoResult e: values())
MAP.put(e.value, e);
}
}
/**
* Start/Stop recording result.
*/
public enum RecordingResult {
/**
* Recording started.
*/
STARTED(0),
/**
* Recording stopped.
*/
STOPPED(1),
/**
* Recording stopped because storage is full.
*/
STOPPED_NO_STORAGE_SPACE(2),
/**
* Recording stopped because storage write speed is too slow.
*/
STOPPED_STORAGE_TOO_SLOW(3),
/**
* Error starting recording: wrong state.
*/
ERROR_BAD_STATE(4),
/**
* Error starting or during recording.
*/
ERROR(5),
/**
* Recording stopped because of internal reconfiguration.
*/
STOPPED_RECONFIGURED(6);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static RecordingResult fromValue(int value) {
return MAP.get(value, null);
}
private RecordingResult(int value) {
this.value = value;
}
private static final SparseArray<RecordingResult> MAP;
static {
MAP = new SparseArray<>();
for (RecordingResult e: values())
MAP.put(e.value, e);
}
}
/**
* Zoom control mode.
*/
public enum ZoomControlMode {
/**
* Zoom is set by giving a level.
*/
LEVEL(0),
/**
* Zoom is set by giving a velocity.
*/
VELOCITY(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static ZoomControlMode fromValue(int value) {
return MAP.get(value, null);
}
private ZoomControlMode(int value) {
this.value = value;
}
private static final SparseArray<ZoomControlMode> MAP;
static {
MAP = new SparseArray<>();
for (ZoomControlMode e: values())
MAP.put(e.value, e);
}
}
/**
* Auto Exposure metering mode.
*/
public enum AutoExposureMeteringMode {
/**
* Default Auto Exposure metering mode.
*/
STANDARD(0),
/**
* Auto Exposure metering mode which favours the center top of the matrix.
*/
CENTER_TOP(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static AutoExposureMeteringMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<AutoExposureMeteringMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 2) {
ULog.e(TAG, "Unsupported AutoExposureMeteringMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<AutoExposureMeteringMode> fromBitfield(int bitfield) {
EnumSet<AutoExposureMeteringMode> enums = EnumSet.noneOf(AutoExposureMeteringMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull AutoExposureMeteringMode... enums) {
int bitField = 0;
for (AutoExposureMeteringMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private AutoExposureMeteringMode(int value) {
this.value = value;
}
private static final SparseArray<AutoExposureMeteringMode> MAP;
static {
MAP = new SparseArray<>();
for (AutoExposureMeteringMode e: values())
MAP.put(e.value, e);
}
}
/** Feature uid. */
public static final int UID = 0x8F00;
/** Uid of camera_capabilities event. */;
public static final int CAMERA_CAPABILITIES_UID = 0x0001;
/** Uid of recording_capabilities event. */;
public static final int RECORDING_CAPABILITIES_UID = 0x0002;
/** Uid of photo_capabilities event. */;
public static final int PHOTO_CAPABILITIES_UID = 0x0003;
/** Uid of antiflicker_capabilities event. */;
public static final int ANTIFLICKER_CAPABILITIES_UID = 0x0004;
/** Uid of exposure_settings event. */;
public static final int EXPOSURE_SETTINGS_UID = 0x0009;
/** Uid of exposure event. */;
public static final int EXPOSURE_UID = 0x000A;
/** Uid of white_balance event. */;
public static final int WHITE_BALANCE_UID = 0x000D;
/** Uid of ev_compensation event. */;
public static final int EV_COMPENSATION_UID = 0x000F;
/** Uid of antiflicker_mode event. */;
public static final int ANTIFLICKER_MODE_UID = 0x0011;
/** Uid of style event. */;
public static final int STYLE_UID = 0x0014;
/** Uid of zoom_level event. */;
public static final int ZOOM_LEVEL_UID = 0x0016;
/** Uid of zoom_info event. */;
public static final int ZOOM_INFO_UID = 0x0017;
/** Uid of max_zoom_speed event. */;
public static final int MAX_ZOOM_SPEED_UID = 0x0018;
/** Uid of zoom_velocity_quality_degradation event. */;
public static final int ZOOM_VELOCITY_QUALITY_DEGRADATION_UID = 0x001A;
/** Uid of hdr_setting event. */;
public static final int HDR_SETTING_UID = 0x001D;
/** Uid of hdr event. */;
public static final int HDR_UID = 0x001E;
/** Uid of camera_mode event. */;
public static final int CAMERA_MODE_UID = 0x0020;
/** Uid of recording_mode event. */;
public static final int RECORDING_MODE_UID = 0x0022;
/** Uid of photo_mode event. */;
public static final int PHOTO_MODE_UID = 0x0024;
/** Uid of streaming_mode event. */;
public static final int STREAMING_MODE_UID = 0x0026;
/** Uid of photo_progress event. */;
public static final int PHOTO_PROGRESS_UID = 0x0028;
/** Uid of photo_state event. */;
public static final int PHOTO_STATE_UID = 0x0029;
/** Uid of recording_progress event. */;
public static final int RECORDING_PROGRESS_UID = 0x002C;
/** Uid of recording_state event. */;
public static final int RECORDING_STATE_UID = 0x002D;
/** Uid of autorecord event. */;
public static final int AUTORECORD_UID = 0x002F;
/** Uid of camera_states event. */;
public static final int CAMERA_STATES_UID = 0x0031;
/** Uid of next_photo_delay event. */;
public static final int NEXT_PHOTO_DELAY_UID = 0x0033;
/** Uid of alignment_offsets event. */;
public static final int ALIGNMENT_OFFSETS_UID = 0x0034;
/**
* Decodes a command.
*
* @param command : command to decode
* @param callback: callback receiving decoded events
*/
public static void decode(@NonNull ArsdkCommand command, @NonNull Callback callback) {
nativeDecode(command.getNativePtr(), callback);
}
/** Callback receiving decoded events. */
public interface Callback {
/**
* Describes camera supported capabilities.
*
* @param camId: id of the camera. Camera id is unique and persistent: the same camera model on a same drone
* model always has the same id. Main/Built-in camera has id zero.
* @param model: Camera model.
* @param exposureModesBitField: Supported exposure modes.
* @param exposureLockSupported: Exposure lock support.
* @param exposureRoiLockSupported: Exposure lock on ROI support.
* @param evCompensationsBitField: Supported ev compensation values. Empty if ev_compensation is not supported.
* @param whiteBalanceModesBitField: Supported white balances modes.
* @param customWhiteBalanceTemperaturesBitField: Supported white balance temperature for "custom" white balance
* mode. Empty if "custom" mode is not supported.
* @param whiteBalanceLockSupported: White balance lock support.
* @param stylesBitField: Supported image styles.
* @param cameraModesBitField: Supported camera modes.
* @param hyperlapseValuesBitField: Supported values for hyperlapse recording mode. Empty of hyperlapse
* recording mode is not supported.
* @param bracketingPresetsBitField: Supported values for bracketing photo mode. Empty of bracketing photo mode
* is not supported.
* @param burstValuesBitField: Supported values for burst photo mode. Empty of burst photo mode is not
* supported.
* @param streamingModesBitField: Supported streaming modes, Empty if streaming is not supported.
* @param timelapseIntervalMin: Minimal time-lapse capture interval, in seconds.
* @param gpslapseIntervalMin: Minimal GPS-lapse capture interval, in meters.
* @param autoExposureMeteringModesBitField: Supported auto exposure metering modes
*/
public default void onCameraCapabilities(int camId, @Nullable Model model, int exposureModesBitField, @Nullable Supported exposureLockSupported, @Nullable Supported exposureRoiLockSupported, long evCompensationsBitField, int whiteBalanceModesBitField, long customWhiteBalanceTemperaturesBitField, @Nullable Supported whiteBalanceLockSupported, int stylesBitField, int cameraModesBitField, int hyperlapseValuesBitField, int bracketingPresetsBitField, int burstValuesBitField, int streamingModesBitField, float timelapseIntervalMin, float gpslapseIntervalMin, int autoExposureMeteringModesBitField) {}
/**
* Describe recording capabilities. Each entry of this list gives valid resolutions/framerates pair for the
* listed modes and if HDR is supported in this configuration. The same mode can be in multiple entries.
*
* @param id: Setting id. U8 msb is cam_id of the related camera.
* @param recordingModesBitField: Recording modes this capability applies to.
* @param resolutionsBitField: Supported resolutions in specified modes and framerates.
* @param frameratesBitField: Supported framerates in specified modes and resolutions.
* @param hdr: Indicate if hdr is supported in this configuration.
* @param listFlagsBitField: List flags.
*/
public default void onRecordingCapabilities(int id, int recordingModesBitField, int resolutionsBitField, int frameratesBitField, @Nullable Supported hdr, int listFlagsBitField) {}
/**
* Describe photo capabilities. Each entry of this list gives a valid format/fileformat pair for the listed
* modes and if HDR is supported in this configuration. The same mode can be in multiple entries.
*
* @param id: Setting id. U8 msb is cam_id of the related camera.
* @param photoModesBitField: Photo modes this capability applies to.
* @param photoFormatsBitField: Supported photo formats in specified modes and file formats (DNG file will
* always be full-frame, regardless of this setting).
* @param photoFileFormatsBitField: Supported photo file formats in specified modes and formats.
* @param hdr: Indicate if hdr is supported in this configuration.
* @param listFlagsBitField: List flags.
*/
public default void onPhotoCapabilities(int id, int photoModesBitField, int photoFormatsBitField, int photoFileFormatsBitField, @Nullable Supported hdr, int listFlagsBitField) {}
/**
* Describe anti-flickering. Antiflickering is global for all cameras
*
* @param supportedModesBitField: Supported anti-flicker mode.
*/
public default void onAntiflickerCapabilities(int supportedModesBitField) {}
/**
* Notify current exposure settings. This can be different from the actually used exposure values notified by
* event [exposure](#143-10) if the mode is not `manual`.
*
* @param camId: Id of the camera.
* @param mode: Exposure mode as set by command "set_exposure_mode".
* @param manualShutterSpeed: Shutter speed as set by command "set_manual_shutter_speed".
* @param manualShutterSpeedCapabilitiesBitField: Supported shutter speeds for current photo or recording
* configuration. Empty if "manual" or "manual_shutter_speed" exposure modes are not supported.
* @param manualIsoSensitivity: ISO sensitivity level as set by command "set_manual_iso_sensitivity".
* @param manualIsoSensitivityCapabilitiesBitField: Supported manual iso sensitivity for current photo or
* recording configuration. Empty if "manual" or "manual_iso_sensitivity" exposure modes are not supported.
* @param maxIsoSensitivity: Maximum ISO sensitivity level as set by command "set_max_iso_sensitivity".
* @param maxIsoSensitivitiesCapabilitiesBitField: Supported max iso sensitivity for current photo or recording
* configuration. Empty if setting max iso sensitivity is not supported.
* @param meteringMode: Auto Exposure metering mode.
*/
public default void onExposureSettings(int camId, @Nullable ExposureMode mode, @Nullable ShutterSpeed manualShutterSpeed, long manualShutterSpeedCapabilitiesBitField, @Nullable IsoSensitivity manualIsoSensitivity, long manualIsoSensitivityCapabilitiesBitField, @Nullable IsoSensitivity maxIsoSensitivity, long maxIsoSensitivitiesCapabilitiesBitField, @Nullable AutoExposureMeteringMode meteringMode) {}
/**
* Notify of actual exposure values (different from [exposure_settings](#143-9) values when one of the setting
* is in automatic mode).
*
* @param camId: Id of the camera.
* @param shutterSpeed: Effective shutter speed.
* @param isoSensitivity: Effective ISO sensitivity level.
* @param lock: Auto exposure lock state.
* @param lockRoiX: Auto exposure lock ROI center on x axis, between 0 and 1, relative to streaming image width,
* less than 0 if exposure is not locked with on a ROI.
* @param lockRoiY: Auto exposure lock ROI center on y axis, between 0 and 1, relative to streaming image
* height, less than if exposure is not locked with on a ROI.
* @param lockRoiWidth: Auto exposure lock ROI width, between 0 and 1, relative to streaming image width, less
* than if exposure is not locked with on a ROI.
* @param lockRoiHeight: Auto exposure lock ROI height, between 0 and 1, relative to streaming image height less
* than if exposure is not locked with on a ROI.
*/
public default void onExposure(int camId, @Nullable ShutterSpeed shutterSpeed, @Nullable IsoSensitivity isoSensitivity, @Nullable State lock, float lockRoiX, float lockRoiY, float lockRoiWidth, float lockRoiHeight) {}
/**
* Notify of actual white balance mode
*
* @param camId: Id of the camera.
* @param mode: Actual white balance mode.
* @param temperature: Actual white balance temperature if the mode `custom`, invalid else.
* @param lock: White balance lock state.
*/
public default void onWhiteBalance(int camId, @Nullable WhiteBalanceMode mode, @Nullable WhiteBalanceTemperature temperature, @Nullable State lock) {}
/**
* Notify of actual EV compensation
*
* @param camId: Id of the camera.
* @param value: Actual EV compensation value.
*/
public default void onEvCompensation(int camId, @Nullable EvCompensation value) {}
/**
* Notify of actual anti-flicker mode
*
* @param mode: Anti-flicker mode as set by [set_antiflicker_mode](#143-16).
* @param value: Actual anti-flicker value selected by the drone. When `mode` is `auto`, indicate the actual
* anti-flicker value selected by the drone. (50hz or 60hz) In all other modes, this is the same that `mode`
*/
public default void onAntiflickerMode(@Nullable AntiflickerMode mode, @Nullable AntiflickerMode value) {}
/**
* Notify current style and its saturation, contrast and sharpness values.
*
* @param camId: Id of the camera.
* @param style: Active style.
* @param saturation: Actual saturation value for this style.
* @param saturationMin: Minimum supported value for style saturation.
* @param saturationMax: Maximum supported value for style saturation.
* @param contrast: Actual contrast value for this style.
* @param contrastMin: Minimum supported value for style contrast.
* @param contrastMax: Maximum supported value for style contrast.
* @param sharpness: Actual sharpness value for this style.
* @param sharpnessMin: Minimum supported value for style sharpness.
* @param sharpnessMax: Maximum supported value for style sharpness.
*/
public default void onStyle(int camId, @Nullable Style style, int saturation, int saturationMin, int saturationMax, int contrast, int contrastMin, int contrastMax, int sharpness, int sharpnessMin, int sharpnessMax) {}
/**
* Current camera zoom level.
*
* @param camId: Id of the camera.
* @param level: Actual zoom level. Ignored if `available` is `not_available`.
*/
public default void onZoomLevel(int camId, float level) {}
/**
* Zoom information. This event is never sent if the device doesn't have a zoom.
*
* @param camId: Id of the camera.
* @param available: Tells if zoom is available in the current configuration.
* @param highQualityMaximumLevel: Maximum zoom level without degrading image quality. Ignored if `available` is
* `not_available`.
* @param maximumLevel: Maximum zoom level with image quality degradation. Ignored if `available` is
* `not_available`. Same value than `high_quality_maximum_level` if there is no digital zoom with quality
* degradation.
*/
public default void onZoomInfo(int camId, @Nullable Availability available, float highQualityMaximumLevel, float maximumLevel) {}
/**
* Max zoom speed setting. This setting contains the range and the current value. All values are expressed as
* the tangent of the angle in degrees per seconds.
*
* @param camId: Id of the camera.
* @param min: Minimal bound of the max zoom speed range. Expressed as a tan(deg) / sec.
* @param max: Maximal bound of the max zoom speed range Expressed as a tan(deg) / sec.
* @param current: Current max zoom speed. Expressed as a tan(deg) / sec.
*/
public default void onMaxZoomSpeed(int camId, float min, float max, float current) {}
/**
* Whether zoom change by indicating a velocity is allowed to go on a zoom level that degrades video quality. If
* not allowed, zoom level will stop at the level given by the `high_quality_maximum_level` of the
* [Zoom](143-20) event.
*
* @param camId: Id of the camera.
* @param allowed: 1 if quality degradation is allowed, 0 otherwise.
*/
public default void onZoomVelocityQualityDegradation(int camId, int allowed) {}
/**
* Notify of camera HDR setting.
*
* @param camId: Id of the camera.
* @param value: Actual HDR setting value.
*/
public default void onHdrSetting(int camId, @Nullable State value) {}
/**
* Tells if HDR is available and if it's currently active.
*
* @param camId: Id of the camera.
* @param available: Tells if HDR is available in current configuration.
* @param state: Actual HDR state.
*/
public default void onHdr(int camId, @Nullable Availability available, @Nullable State state) {}
/**
* Notify of camera mode
*
* @param camId: Id of the camera.
* @param mode: Camera mode.
*/
public default void onCameraMode(int camId, @Nullable CameraMode mode) {}
/**
* Notify of camera recording mode
*
* @param camId: Id of the camera.
* @param mode: Camera camera recording mode.
* @param resolution: Recording resolution.
* @param framerate: Recording framerate.
* @param hyperlapse: Hyperlapse value when the recording mode is hyperlapse. Invalid in other modes.
* @param bitrate: Recording bitrate for current configuration (bits/s). Zero if unavailable.
*/
public default void onRecordingMode(int camId, @Nullable RecordingMode mode, @Nullable Resolution resolution, @Nullable Framerate framerate, @Nullable HyperlapseValue hyperlapse, long bitrate) {}
/**
* Notify of camera photo mode
*
* @param camId: Id of the camera.
* @param mode: Camera photo mode.
* @param format: Actual format.
* @param fileFormat: Actual photo file format.
* @param burst: Actual burst value when the photo mode is burst. Invalid in other modes.
* @param bracketing: Actual bracketing value when the photo mode is bracketing. Invalid in other modes.
* @param captureInterval: Actual time-lapse interval value (in seconds) when the photo mode is time_lapse.
* Actual GPS-lapse interval value (in meters) when the photo mode is gps_lapse. Ignored in other modes.
*/
public default void onPhotoMode(int camId, @Nullable PhotoMode mode, @Nullable PhotoFormat format, @Nullable PhotoFileFormat fileFormat, @Nullable BurstValue burst, @Nullable BracketingPreset bracketing, float captureInterval) {}
/**
* Notify of actual streaming mode setting.
*
* @param camId: Id of the camera.
* @param value: Actual streaming mode setting.
*/
public default void onStreamingMode(int camId, @Nullable StreamingMode value) {}
/**
* Sent as progress and result of [take_photo](#143-39) command. This event is not sent during the connection.
*
* @param camId: Id of the camera.
* @param result: Progress or result value: - `taking_photo` indicate that the camera starts taking photo (or
* multiple photos when mode is `burst` or `bracketing`). - `photo_taken` indicate that one photo has been taken
* and is about be saved to disk. In `bracketing` mode, this event is sent when the last photo of the bracketing
* sequence has been taken. In `burst` mode this event is sent after each photo but maximum every 100ms. -
* `photo_saved` indicate the media containing the photo has been saved to disk. In `burst` or `bracketing`
* mode, indicate that all photos of the burst or bracketing sequence have been saved to disk. Other results are
* errors.
* @param photoCount: Only valid when result is `photo_taken`, indicate the number of photo taken in the
* sequence.
* @param mediaId: Only valid when result is `photo_saved`, indicate the media id containing taken photo(s).
*/
public default void onPhotoProgress(int camId, @Nullable PhotoResult result, int photoCount, String mediaId) {}
/**
* Current photo camera state. Indicates if the camera is ready to take a photo.
*
* @param camId: Id of the camera.
* @param available: Tell if photo feature is available in current mode.
* @param state: Tell if photo feature is currently active.
*/
public default void onPhotoState(int camId, @Nullable Availability available, @Nullable State state) {}
/**
* Sent when recording state change. This event is not sent during the connection.
*
* @param camId: Id of the camera.
* @param result: Current recording result. Indicate if recording has started/stopped.
* @param mediaId: Recorded media_id. Only valid when result is `stopped` or `stopped_no_storage_space`.
*/
public default void onRecordingProgress(int camId, @Nullable RecordingResult result, String mediaId) {}
/**
* Current recording state. Indicates if the camera is currently recording.
*
* @param camId: Id of the camera.
* @param available: Tell if recording feature is available in current mode.
* @param state: Current recording state.
* @param startTimestamp: If state is `active`, the timestamp if the start of the recording, in milliseconds
* since 00:00:00 UTC on 1 January 1970.
*/
public default void onRecordingState(int camId, @Nullable Availability available, @Nullable State state, long startTimestamp) {}
/**
*
* @param camId: Id of the camera.
* @param state: Auto-record state.
*/
public default void onAutorecord(int camId, @Nullable State state) {}
/**
* Current camera state. Indicates which cameras are currently active.
*
* @param activeCameras: Bitfield showing which cameras are active. A camera is active when the bit
* corresponding to its cam_id is 1. A camera is inactive when the bit corresponding to its cam_id is 0.
*/
public default void onCameraStates(long activeCameras) {}
/**
* Remaining time or distance before next photo.
*
* @param mode: Selected mode: only `time_lapse` and `gps_lapse` are supported
* @param remaining: In time_lapse photo_mode: remaining time in seconds before next photo In gps_lapse
* photo_mode: remaining distance in meters before next photo
*/
public default void onNextPhotoDelay(@Nullable PhotoMode mode, float remaining) {}
/**
*
* @param camId: Id of the camera.
* @param minBoundYaw: Lower bound of the alignment offset that can be set on the yaw axis, in degrees
* @param maxBoundYaw: Upper bound of the alignment offset that can be set on the yaw axis, in degrees
* @param currentYaw: Current alignment offset applied to the yaw axis, in degrees
* @param minBoundPitch: Lower bound of the alignment offset that can be set on the pitch axis, in degrees
* @param maxBoundPitch: Upper bound of the alignment offset that can be set on the pitch axis, in degrees
* @param currentPitch: Current alignment offset applied to the pitch axis, in degrees
* @param minBoundRoll: Lower bound of the alignment offset that can be set on the roll axis, in degrees
* @param maxBoundRoll: Upper bound of the alignment offset that can be set on the roll axis, in degrees
* @param currentRoll: Current alignment offset applied to the roll axis, in degrees
*/
public default void onAlignmentOffsets(int camId, float minBoundYaw, float maxBoundYaw, float currentYaw, float minBoundPitch, float maxBoundPitch, float currentPitch, float minBoundRoll, float maxBoundRoll, float currentRoll) {}
}
private static void cameraCapabilities(Callback cb, int camId, int model, int exposureModesBitField, int exposureLockSupported, int exposureRoiLockSupported, long evCompensationsBitField, int whiteBalanceModesBitField, long customWhiteBalanceTemperaturesBitField, int whiteBalanceLockSupported, int stylesBitField, int cameraModesBitField, int hyperlapseValuesBitField, int bracketingPresetsBitField, int burstValuesBitField, int streamingModesBitField, float timelapseIntervalMin, float gpslapseIntervalMin, int autoExposureMeteringModesBitField) {
ArsdkFeatureCamera.Model enumModel = ArsdkFeatureCamera.Model.fromValue(model);
if (enumModel == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Model value " + model);
ArsdkFeatureCamera.Supported enumExposurelocksupported = ArsdkFeatureCamera.Supported.fromValue(exposureLockSupported);
if (enumExposurelocksupported == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + exposureLockSupported);
ArsdkFeatureCamera.Supported enumExposureroilocksupported = ArsdkFeatureCamera.Supported.fromValue(exposureRoiLockSupported);
if (enumExposureroilocksupported == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + exposureRoiLockSupported);
ArsdkFeatureCamera.Supported enumWhitebalancelocksupported = ArsdkFeatureCamera.Supported.fromValue(whiteBalanceLockSupported);
if (enumWhitebalancelocksupported == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + whiteBalanceLockSupported);
try {
cb.onCameraCapabilities(camId, enumModel, exposureModesBitField, enumExposurelocksupported, enumExposureroilocksupported, evCompensationsBitField, whiteBalanceModesBitField, customWhiteBalanceTemperaturesBitField, enumWhitebalancelocksupported, stylesBitField, cameraModesBitField, hyperlapseValuesBitField, bracketingPresetsBitField, burstValuesBitField, streamingModesBitField, timelapseIntervalMin, gpslapseIntervalMin, autoExposureMeteringModesBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.camera_capabilities [cam_id: " + camId + ", model: " + model + ", exposure_modes: " + exposureModesBitField + ", exposure_lock_supported: " + exposureLockSupported + ", exposure_roi_lock_supported: " + exposureRoiLockSupported + ", ev_compensations: " + evCompensationsBitField + ", white_balance_modes: " + whiteBalanceModesBitField + ", custom_white_balance_temperatures: " + customWhiteBalanceTemperaturesBitField + ", white_balance_lock_supported: " + whiteBalanceLockSupported + ", styles: " + stylesBitField + ", camera_modes: " + cameraModesBitField + ", hyperlapse_values: " + hyperlapseValuesBitField + ", bracketing_presets: " + bracketingPresetsBitField + ", burst_values: " + burstValuesBitField + ", streaming_modes: " + streamingModesBitField + ", timelapse_interval_min: " + timelapseIntervalMin + ", gpslapse_interval_min: " + gpslapseIntervalMin + ", auto_exposure_metering_modes: " + autoExposureMeteringModesBitField + "]", e);
}
}
private static void recordingCapabilities(Callback cb, int id, int recordingModesBitField, int resolutionsBitField, int frameratesBitField, int hdr, int listFlagsBitField) {
ArsdkFeatureCamera.Supported enumHdr = ArsdkFeatureCamera.Supported.fromValue(hdr);
if (enumHdr == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + hdr);
try {
cb.onRecordingCapabilities(id, recordingModesBitField, resolutionsBitField, frameratesBitField, enumHdr, listFlagsBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_capabilities [id: " + id + ", recording_modes: " + recordingModesBitField + ", resolutions: " + resolutionsBitField + ", framerates: " + frameratesBitField + ", hdr: " + hdr + ", list_flags: " + listFlagsBitField + "]", e);
}
}
private static void photoCapabilities(Callback cb, int id, int photoModesBitField, int photoFormatsBitField, int photoFileFormatsBitField, int hdr, int listFlagsBitField) {
ArsdkFeatureCamera.Supported enumHdr = ArsdkFeatureCamera.Supported.fromValue(hdr);
if (enumHdr == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + hdr);
try {
cb.onPhotoCapabilities(id, photoModesBitField, photoFormatsBitField, photoFileFormatsBitField, enumHdr, listFlagsBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_capabilities [id: " + id + ", photo_modes: " + photoModesBitField + ", photo_formats: " + photoFormatsBitField + ", photo_file_formats: " + photoFileFormatsBitField + ", hdr: " + hdr + ", list_flags: " + listFlagsBitField + "]", e);
}
}
private static void antiflickerCapabilities(Callback cb, int supportedModesBitField) {
try {
cb.onAntiflickerCapabilities(supportedModesBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.antiflicker_capabilities [supported_modes: " + supportedModesBitField + "]", e);
}
}
private static void exposureSettings(Callback cb, int camId, int mode, int manualShutterSpeed, long manualShutterSpeedCapabilitiesBitField, int manualIsoSensitivity, long manualIsoSensitivityCapabilitiesBitField, int maxIsoSensitivity, long maxIsoSensitivitiesCapabilitiesBitField, int meteringMode) {
ArsdkFeatureCamera.ExposureMode enumMode = ArsdkFeatureCamera.ExposureMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.ExposureMode value " + mode);
ArsdkFeatureCamera.ShutterSpeed enumManualshutterspeed = ArsdkFeatureCamera.ShutterSpeed.fromValue(manualShutterSpeed);
if (enumManualshutterspeed == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.ShutterSpeed value " + manualShutterSpeed);
ArsdkFeatureCamera.IsoSensitivity enumManualisosensitivity = ArsdkFeatureCamera.IsoSensitivity.fromValue(manualIsoSensitivity);
if (enumManualisosensitivity == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.IsoSensitivity value " + manualIsoSensitivity);
ArsdkFeatureCamera.IsoSensitivity enumMaxisosensitivity = ArsdkFeatureCamera.IsoSensitivity.fromValue(maxIsoSensitivity);
if (enumMaxisosensitivity == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.IsoSensitivity value " + maxIsoSensitivity);
ArsdkFeatureCamera.AutoExposureMeteringMode enumMeteringmode = ArsdkFeatureCamera.AutoExposureMeteringMode.fromValue(meteringMode);
if (enumMeteringmode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.AutoExposureMeteringMode value " + meteringMode);
try {
cb.onExposureSettings(camId, enumMode, enumManualshutterspeed, manualShutterSpeedCapabilitiesBitField, enumManualisosensitivity, manualIsoSensitivityCapabilitiesBitField, enumMaxisosensitivity, maxIsoSensitivitiesCapabilitiesBitField, enumMeteringmode);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.exposure_settings [cam_id: " + camId + ", mode: " + mode + ", manual_shutter_speed: " + manualShutterSpeed + ", manual_shutter_speed_capabilities: " + manualShutterSpeedCapabilitiesBitField + ", manual_iso_sensitivity: " + manualIsoSensitivity + ", manual_iso_sensitivity_capabilities: " + manualIsoSensitivityCapabilitiesBitField + ", max_iso_sensitivity: " + maxIsoSensitivity + ", max_iso_sensitivities_capabilities: " + maxIsoSensitivitiesCapabilitiesBitField + ", metering_mode: " + meteringMode + "]", e);
}
}
private static void exposure(Callback cb, int camId, int shutterSpeed, int isoSensitivity, int lock, float lockRoiX, float lockRoiY, float lockRoiWidth, float lockRoiHeight) {
ArsdkFeatureCamera.ShutterSpeed enumShutterspeed = ArsdkFeatureCamera.ShutterSpeed.fromValue(shutterSpeed);
if (enumShutterspeed == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.ShutterSpeed value " + shutterSpeed);
ArsdkFeatureCamera.IsoSensitivity enumIsosensitivity = ArsdkFeatureCamera.IsoSensitivity.fromValue(isoSensitivity);
if (enumIsosensitivity == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.IsoSensitivity value " + isoSensitivity);
ArsdkFeatureCamera.State enumLock = ArsdkFeatureCamera.State.fromValue(lock);
if (enumLock == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + lock);
try {
cb.onExposure(camId, enumShutterspeed, enumIsosensitivity, enumLock, lockRoiX, lockRoiY, lockRoiWidth, lockRoiHeight);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.exposure [cam_id: " + camId + ", shutter_speed: " + shutterSpeed + ", iso_sensitivity: " + isoSensitivity + ", lock: " + lock + ", lock_roi_x: " + lockRoiX + ", lock_roi_y: " + lockRoiY + ", lock_roi_width: " + lockRoiWidth + ", lock_roi_height: " + lockRoiHeight + "]", e);
}
}
private static void whiteBalance(Callback cb, int camId, int mode, int temperature, int lock) {
ArsdkFeatureCamera.WhiteBalanceMode enumMode = ArsdkFeatureCamera.WhiteBalanceMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.WhiteBalanceMode value " + mode);
ArsdkFeatureCamera.WhiteBalanceTemperature enumTemperature = ArsdkFeatureCamera.WhiteBalanceTemperature.fromValue(temperature);
if (enumTemperature == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.WhiteBalanceTemperature value " + temperature);
ArsdkFeatureCamera.State enumLock = ArsdkFeatureCamera.State.fromValue(lock);
if (enumLock == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + lock);
try {
cb.onWhiteBalance(camId, enumMode, enumTemperature, enumLock);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.white_balance [cam_id: " + camId + ", mode: " + mode + ", temperature: " + temperature + ", lock: " + lock + "]", e);
}
}
private static void evCompensation(Callback cb, int camId, int value) {
ArsdkFeatureCamera.EvCompensation enumValue = ArsdkFeatureCamera.EvCompensation.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.EvCompensation value " + value);
try {
cb.onEvCompensation(camId, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.ev_compensation [cam_id: " + camId + ", value: " + value + "]", e);
}
}
private static void antiflickerMode(Callback cb, int mode, int value) {
ArsdkFeatureCamera.AntiflickerMode enumMode = ArsdkFeatureCamera.AntiflickerMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.AntiflickerMode value " + mode);
ArsdkFeatureCamera.AntiflickerMode enumValue = ArsdkFeatureCamera.AntiflickerMode.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.AntiflickerMode value " + value);
try {
cb.onAntiflickerMode(enumMode, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.antiflicker_mode [mode: " + mode + ", value: " + value + "]", e);
}
}
private static void style(Callback cb, int camId, int style, int saturation, int saturationMin, int saturationMax, int contrast, int contrastMin, int contrastMax, int sharpness, int sharpnessMin, int sharpnessMax) {
ArsdkFeatureCamera.Style enumStyle = ArsdkFeatureCamera.Style.fromValue(style);
if (enumStyle == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Style value " + style);
try {
cb.onStyle(camId, enumStyle, saturation, saturationMin, saturationMax, contrast, contrastMin, contrastMax, sharpness, sharpnessMin, sharpnessMax);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.style [cam_id: " + camId + ", style: " + style + ", saturation: " + saturation + ", saturation_min: " + saturationMin + ", saturation_max: " + saturationMax + ", contrast: " + contrast + ", contrast_min: " + contrastMin + ", contrast_max: " + contrastMax + ", sharpness: " + sharpness + ", sharpness_min: " + sharpnessMin + ", sharpness_max: " + sharpnessMax + "]", e);
}
}
private static void zoomLevel(Callback cb, int camId, float level) {
try {
cb.onZoomLevel(camId, level);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.zoom_level [cam_id: " + camId + ", level: " + level + "]", e);
}
}
private static void zoomInfo(Callback cb, int camId, int available, float highQualityMaximumLevel, float maximumLevel) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
try {
cb.onZoomInfo(camId, enumAvailable, highQualityMaximumLevel, maximumLevel);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.zoom_info [cam_id: " + camId + ", available: " + available + ", high_quality_maximum_level: " + highQualityMaximumLevel + ", maximum_level: " + maximumLevel + "]", e);
}
}
private static void maxZoomSpeed(Callback cb, int camId, float min, float max, float current) {
try {
cb.onMaxZoomSpeed(camId, min, max, current);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.max_zoom_speed [cam_id: " + camId + ", min: " + min + ", max: " + max + ", current: " + current + "]", e);
}
}
private static void zoomVelocityQualityDegradation(Callback cb, int camId, int allowed) {
try {
cb.onZoomVelocityQualityDegradation(camId, allowed);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.zoom_velocity_quality_degradation [cam_id: " + camId + ", allowed: " + allowed + "]", e);
}
}
private static void hdrSetting(Callback cb, int camId, int value) {
ArsdkFeatureCamera.State enumValue = ArsdkFeatureCamera.State.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + value);
try {
cb.onHdrSetting(camId, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.hdr_setting [cam_id: " + camId + ", value: " + value + "]", e);
}
}
private static void hdr(Callback cb, int camId, int available, int state) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onHdr(camId, enumAvailable, enumState);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.hdr [cam_id: " + camId + ", available: " + available + ", state: " + state + "]", e);
}
}
private static void cameraMode(Callback cb, int camId, int mode) {
ArsdkFeatureCamera.CameraMode enumMode = ArsdkFeatureCamera.CameraMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.CameraMode value " + mode);
try {
cb.onCameraMode(camId, enumMode);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.camera_mode [cam_id: " + camId + ", mode: " + mode + "]", e);
}
}
private static void recordingMode(Callback cb, int camId, int mode, int resolution, int framerate, int hyperlapse, long bitrate) {
ArsdkFeatureCamera.RecordingMode enumMode = ArsdkFeatureCamera.RecordingMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.RecordingMode value " + mode);
ArsdkFeatureCamera.Resolution enumResolution = ArsdkFeatureCamera.Resolution.fromValue(resolution);
if (enumResolution == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Resolution value " + resolution);
ArsdkFeatureCamera.Framerate enumFramerate = ArsdkFeatureCamera.Framerate.fromValue(framerate);
if (enumFramerate == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Framerate value " + framerate);
ArsdkFeatureCamera.HyperlapseValue enumHyperlapse = ArsdkFeatureCamera.HyperlapseValue.fromValue(hyperlapse);
if (enumHyperlapse == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.HyperlapseValue value " + hyperlapse);
try {
cb.onRecordingMode(camId, enumMode, enumResolution, enumFramerate, enumHyperlapse, bitrate);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_mode [cam_id: " + camId + ", mode: " + mode + ", resolution: " + resolution + ", framerate: " + framerate + ", hyperlapse: " + hyperlapse + ", bitrate: " + bitrate + "]", e);
}
}
private static void photoMode(Callback cb, int camId, int mode, int format, int fileFormat, int burst, int bracketing, float captureInterval) {
ArsdkFeatureCamera.PhotoMode enumMode = ArsdkFeatureCamera.PhotoMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoMode value " + mode);
ArsdkFeatureCamera.PhotoFormat enumFormat = ArsdkFeatureCamera.PhotoFormat.fromValue(format);
if (enumFormat == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoFormat value " + format);
ArsdkFeatureCamera.PhotoFileFormat enumFileformat = ArsdkFeatureCamera.PhotoFileFormat.fromValue(fileFormat);
if (enumFileformat == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoFileFormat value " + fileFormat);
ArsdkFeatureCamera.BurstValue enumBurst = ArsdkFeatureCamera.BurstValue.fromValue(burst);
if (enumBurst == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.BurstValue value " + burst);
ArsdkFeatureCamera.BracketingPreset enumBracketing = ArsdkFeatureCamera.BracketingPreset.fromValue(bracketing);
if (enumBracketing == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.BracketingPreset value " + bracketing);
try {
cb.onPhotoMode(camId, enumMode, enumFormat, enumFileformat, enumBurst, enumBracketing, captureInterval);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_mode [cam_id: " + camId + ", mode: " + mode + ", format: " + format + ", file_format: " + fileFormat + ", burst: " + burst + ", bracketing: " + bracketing + ", capture_interval: " + captureInterval + "]", e);
}
}
private static void streamingMode(Callback cb, int camId, int value) {
ArsdkFeatureCamera.StreamingMode enumValue = ArsdkFeatureCamera.StreamingMode.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.StreamingMode value " + value);
try {
cb.onStreamingMode(camId, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.streaming_mode [cam_id: " + camId + ", value: " + value + "]", e);
}
}
private static void photoProgress(Callback cb, int camId, int result, int photoCount, String mediaId) {
ArsdkFeatureCamera.PhotoResult enumResult = ArsdkFeatureCamera.PhotoResult.fromValue(result);
if (enumResult == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoResult value " + result);
try {
cb.onPhotoProgress(camId, enumResult, photoCount, mediaId);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_progress [cam_id: " + camId + ", result: " + result + ", photo_count: " + photoCount + ", media_id: " + mediaId + "]", e);
}
}
private static void photoState(Callback cb, int camId, int available, int state) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onPhotoState(camId, enumAvailable, enumState);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_state [cam_id: " + camId + ", available: " + available + ", state: " + state + "]", e);
}
}
private static void recordingProgress(Callback cb, int camId, int result, String mediaId) {
ArsdkFeatureCamera.RecordingResult enumResult = ArsdkFeatureCamera.RecordingResult.fromValue(result);
if (enumResult == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.RecordingResult value " + result);
try {
cb.onRecordingProgress(camId, enumResult, mediaId);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_progress [cam_id: " + camId + ", result: " + result + ", media_id: " + mediaId + "]", e);
}
}
private static void recordingState(Callback cb, int camId, int available, int state, long startTimestamp) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onRecordingState(camId, enumAvailable, enumState, startTimestamp);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_state [cam_id: " + camId + ", available: " + available + ", state: " + state + ", start_timestamp: " + startTimestamp + "]", e);
}
}
private static void autorecord(Callback cb, int camId, int state) {
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onAutorecord(camId, enumState);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.autorecord [cam_id: " + camId + ", state: " + state + "]", e);
}
}
private static void cameraStates(Callback cb, long activeCameras) {
try {
cb.onCameraStates(activeCameras);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.camera_states [active_cameras: " + activeCameras + "]", e);
}
}
private static void nextPhotoDelay(Callback cb, int mode, float remaining) {
ArsdkFeatureCamera.PhotoMode enumMode = ArsdkFeatureCamera.PhotoMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoMode value " + mode);
try {
cb.onNextPhotoDelay(enumMode, remaining);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.next_photo_delay [mode: " + mode + ", remaining: " + remaining + "]", e);
}
}
private static void alignmentOffsets(Callback cb, int camId, float minBoundYaw, float maxBoundYaw, float currentYaw, float minBoundPitch, float maxBoundPitch, float currentPitch, float minBoundRoll, float maxBoundRoll, float currentRoll) {
try {
cb.onAlignmentOffsets(camId, minBoundYaw, maxBoundYaw, currentYaw, minBoundPitch, maxBoundPitch, currentPitch, minBoundRoll, maxBoundRoll, currentRoll);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.alignment_offsets [cam_id: " + camId + ", min_bound_yaw: " + minBoundYaw + ", max_bound_yaw: " + maxBoundYaw + ", current_yaw: " + currentYaw + ", min_bound_pitch: " + minBoundPitch + ", max_bound_pitch: " + maxBoundPitch + ", current_pitch: " + currentPitch + ", min_bound_roll: " + minBoundRoll + ", max_bound_roll: " + maxBoundRoll + ", current_roll: " + currentRoll + "]", e);
}
}
/**
* Sets exposure mode, shutter speed, iso sensitivity and maximum iso sensitivity.
*
* @param camId: Id of the camera.
* @param mode: Requested exposure mode: Auto, Manual Shutter Speed, Manual ISO or Manual.
* @param shutterSpeed: Requested shutter speed, ignored if mode is not Manual Shutter Speed or Manual.
* @param isoSensitivity: Requested ISO sensitivity level, ignored if mode is not Manual ISO or Manual.
* @param maxIsoSensitivity: Requested maximum ISO sensitivity level, ignored is not Auto. This value define the
* maximum iso sensitivity the autoexposure engine can use to adjust exposure.
* @param meteringMode: Auto Exposure metering mode, ignored if mode is Manual
*/
public static ArsdkCommand encodeSetExposureSettings(int camId, @NonNull ExposureMode mode, @NonNull ShutterSpeed shutterSpeed, @NonNull IsoSensitivity isoSensitivity, @NonNull IsoSensitivity maxIsoSensitivity, @NonNull AutoExposureMeteringMode meteringMode) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetExposureSettings(cmd.getNativePtr(), camId, mode.value, shutterSpeed.value, isoSensitivity.value, maxIsoSensitivity.value, meteringMode.value);
return cmd;
}
/**
* Lock shutter speed and iso sensitivity to current values. Valid for all exposure modes exepted `manual`. Auto
* exposure lock is automatically removed when the exposure mode is changed.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeLockExposure(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeLockExposure(cmd.getNativePtr(), camId);
return cmd;
}
/**
* Lock shutter speed and iso sensitivity optimized on a specific region. Valid for all exposure modes exepted
* `manual` Auto exposure lock is automatically removed when the exposure mode is changed.
*
* @param camId: Id of the camera.
* @param roiCenterX: ROI center on x axis. between 0 and 1, relative to streaming image width.
* @param roiCenterY: ROI center on y axis. between 0 and 1, relative to streaming image height.
*/
public static ArsdkCommand encodeLockExposureOnRoi(int camId, float roiCenterX, float roiCenterY) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeLockExposureOnRoi(cmd.getNativePtr(), camId, roiCenterX, roiCenterY);
return cmd;
}
/**
* Valid when exposure is locked.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeUnlockExposure(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeUnlockExposure(cmd.getNativePtr(), camId);
return cmd;
}
/**
* Change the white balance mode and custom temperature.
*
* @param camId: Id of the camera.
* @param mode: Requested white balance mode.
* @param temperature: Requested white balance temperature when mode is `custom`. Ignored else.
*/
public static ArsdkCommand encodeSetWhiteBalance(int camId, @NonNull WhiteBalanceMode mode, @NonNull WhiteBalanceTemperature temperature) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetWhiteBalance(cmd.getNativePtr(), camId, mode.value, temperature.value);
return cmd;
}
/**
* Lock/unlock white balance to current value. Valid when white balance mode not `custom`. White balance lock is
* automatically removed when the white balance mode is changed.
*
* @param camId: Id of the camera.
* @param state: Requested lock state.
*/
public static ArsdkCommand encodeSetWhiteBalanceLock(int camId, @NonNull State state) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetWhiteBalanceLock(cmd.getNativePtr(), camId, state.value);
return cmd;
}
/**
* Change the EV compensation value.
*
* @param camId: Id of the camera.
* @param value: Requested EV compensation value.
*/
public static ArsdkCommand encodeSetEvCompensation(int camId, @NonNull EvCompensation value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetEvCompensation(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Change the anti-flicker mode.
*
* @param mode: Requested anti-flicker mode.
*/
public static ArsdkCommand encodeSetAntiflickerMode(@NonNull AntiflickerMode mode) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetAntiflickerMode(cmd.getNativePtr(), mode.value);
return cmd;
}
/**
* Change the active style.
*
* @param camId: Id of the camera.
* @param style: Style to activate.
*/
public static ArsdkCommand encodeSetStyle(int camId, @NonNull Style style) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetStyle(cmd.getNativePtr(), camId, style.value);
return cmd;
}
/**
* Change style saturation, contrast and sharpness of the current active style.
*
* @param camId: Id of the camera.
* @param saturation: Requested saturation value for this style.
* @param contrast: Requested contrast value for this style.
* @param sharpness: Requested sharpness value for this style.
*/
public static ArsdkCommand encodeSetStyleParams(int camId, int saturation, int contrast, int sharpness) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetStyleParams(cmd.getNativePtr(), camId, saturation, contrast, sharpness);
return cmd;
}
/**
*
* @param camId: id of the camera.
* @param controlMode: Mode of changing the zoom. This parameter will characterize following parameters units.
* @param target: Zoom target. Units depend on the `control_mode` value: - `level`: value is in zoom level -
* `velocity`, value is in signed ratio (from -1 to 1) of the [MaxZoomSpeed](#143-24) `current` parameter. Negative
* values will produce a zoom out, positive values produce a zoom in.
*/
public static ArsdkCommand encodeSetZoomTarget(int camId, @NonNull ZoomControlMode controlMode, float target) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetZoomTarget(cmd.getNativePtr(), camId, controlMode.value, target);
return cmd;
}
/**
* Set the max zoom speed setting. You can get bounds using [MaxZoomSpeed](#143-25).
*
* @param camId: Id of the camera.
* @param max: Desired current max zoom speed. Should lay between the bounds given by [MaxZoomSpeed](#143-25).
* Expressed as a tan(deg) / sec.
*/
public static ArsdkCommand encodeSetMaxZoomSpeed(int camId, float max) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetMaxZoomSpeed(cmd.getNativePtr(), camId, max);
return cmd;
}
/**
* Set the max zoom velocity.
*
* @param camId: Id of the camera.
* @param allow: 1 to allow quality degradation, 0 otherwise.
*/
public static ArsdkCommand encodeSetZoomVelocityQualityDegradation(int camId, int allow) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetZoomVelocityQualityDegradation(cmd.getNativePtr(), camId, allow);
return cmd;
}
/**
* Change HDR setting. if HDR setting is `active`, HDR will be used when supported in active configuration.
*
* @param camId: Id of the camera.
* @param value: Requested HDR setting value.
*/
public static ArsdkCommand encodeSetHdrSetting(int camId, @NonNull State value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetHdrSetting(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Change camera mode.
*
* @param camId: Id of the camera.
* @param value: Requested camera mode.
*/
public static ArsdkCommand encodeSetCameraMode(int camId, @NonNull CameraMode value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetCameraMode(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Change recording mode and parameters to be used when the camera is in mode recording. Note that if the camera is
* in photo modes, actual camera mode is not changed, new recording mode and parameters are saved and are apply when
* the camera mode is changed to `recording`.
*
* @param camId: Id of the camera.
* @param mode: Requested camera recording mode.
* @param resolution: Requested recording resolution.
* @param framerate: Requested recording framerate.
* @param hyperlapse: Requested hyperlapse value when the recording mode is hyperlapse. Ignored in other modes
*/
public static ArsdkCommand encodeSetRecordingMode(int camId, @NonNull RecordingMode mode, @NonNull Resolution resolution, @NonNull Framerate framerate, @NonNull HyperlapseValue hyperlapse) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetRecordingMode(cmd.getNativePtr(), camId, mode.value, resolution.value, framerate.value, hyperlapse.value);
return cmd;
}
/**
* Change photo mode and parameters to be used when the camera is in mode photo. Note that if the camera is in
* recording modes, actual camera mode is not changed, new photo mode and parameters are saved and are apply when
* the camera mode is changed to `photo`.
*
* @param camId: Id of the camera.
* @param mode: Requested camera photo mode.
* @param format: Requested photo format.
* @param fileFormat: Requested photo file format.
* @param burst: Requested burst value when the photo mode is burst. Ignored in other modes.
* @param bracketing: Requested bracketing value when the photo mode is bracketing. Ignored in other modes.
* @param captureInterval: Requested time-lapse interval value (in seconds) when the photo mode is time_lapse.
* Requested GPS-lapse interval value (in meters) when the photo mode is gps_lapse. Ignored in other modes.
*/
public static ArsdkCommand encodeSetPhotoMode(int camId, @NonNull PhotoMode mode, @NonNull PhotoFormat format, @NonNull PhotoFileFormat fileFormat, @NonNull BurstValue burst, @NonNull BracketingPreset bracketing, float captureInterval) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetPhotoMode(cmd.getNativePtr(), camId, mode.value, format.value, fileFormat.value, burst.value, bracketing.value, captureInterval);
return cmd;
}
/**
* Change streaming mode setting.
*
* @param camId: Id of the camera.
* @param value: New streaming mode.
*/
public static ArsdkCommand encodeSetStreamingMode(int camId, @NonNull StreamingMode value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetStreamingMode(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Take a photo. Can be sent when `photo_state` is `available`.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeTakePhoto(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeTakePhoto(cmd.getNativePtr(), camId);
return cmd;
}
/**
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeStartRecording(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeStartRecording(cmd.getNativePtr(), camId);
return cmd;
}
/**
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeStopRecording(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeStopRecording(cmd.getNativePtr(), camId);
return cmd;
}
/**
* When auto-record is enabled, if the drone is in recording mode, recording starts when taking-off and stops after
* landing.
*
* @param camId: Id of the camera.
* @param state: Requested auto-record state.
*/
public static ArsdkCommand encodeSetAutorecord(int camId, @NonNull State state) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetAutorecord(cmd.getNativePtr(), camId, state.value);
return cmd;
}
/**
*
* @param camId: id of the camera.
*/
public static ArsdkCommand encodeResetZoom(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeResetZoom(cmd.getNativePtr(), camId);
return cmd;
}
/**
* Stops an ongoing photos capture. Only for `time_lapse` and `gps_lapse` `photo_mode`. Only when `photo_state` is
* `available` and `active`.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeStopPhoto(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeStopPhoto(cmd.getNativePtr(), camId);
return cmd;
}
/**
*
* @param camId: Id of the camera.
* @param yaw: Alignment offset, in degrees, that should be applied to the yaw axis. This value will be clamped
* between [alignment_offsets](#143-52) min_bound_yaw and max_bound_yaw
* @param pitch: Alignment offset, in degrees, that should be applied to the pitch axis. This value will be clamped
* between [alignment_offsets](#143-52) min_bound_pitch and max_bound_pitch
* @param roll: Alignment offset, in degrees, that should be applied to the roll axis. This value will be clamped
* between [alignment_offsets](#143-52) min_bound_roll and max_bound_roll
*/
public static ArsdkCommand encodeSetAlignmentOffsets(int camId, float yaw, float pitch, float roll) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetAlignmentOffsets(cmd.getNativePtr(), camId, yaw, pitch, roll);
return cmd;
}
/**
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeResetAlignmentOffsets(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeResetAlignmentOffsets(cmd.getNativePtr(), camId);
return cmd;
}
private static native int nativeDecode(long nativeCmd, Callback callback);
private static native void nativeClassInit();
static { nativeClassInit(); }
private static native int nativeEncodeSetExposureSettings(long nativeCmd, int cam_id, int mode, int shutter_speed, int iso_sensitivity, int max_iso_sensitivity, int metering_mode);
private static native int nativeEncodeLockExposure(long nativeCmd, int cam_id);
private static native int nativeEncodeLockExposureOnRoi(long nativeCmd, int cam_id, float roi_center_x, float roi_center_y);
private static native int nativeEncodeUnlockExposure(long nativeCmd, int cam_id);
private static native int nativeEncodeSetWhiteBalance(long nativeCmd, int cam_id, int mode, int temperature);
private static native int nativeEncodeSetWhiteBalanceLock(long nativeCmd, int cam_id, int state);
private static native int nativeEncodeSetEvCompensation(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeSetAntiflickerMode(long nativeCmd, int mode);
private static native int nativeEncodeSetStyle(long nativeCmd, int cam_id, int style);
private static native int nativeEncodeSetStyleParams(long nativeCmd, int cam_id, int saturation, int contrast, int sharpness);
private static native int nativeEncodeSetZoomTarget(long nativeCmd, int cam_id, int control_mode, float target);
private static native int nativeEncodeSetMaxZoomSpeed(long nativeCmd, int cam_id, float max);
private static native int nativeEncodeSetZoomVelocityQualityDegradation(long nativeCmd, int cam_id, int allow);
private static native int nativeEncodeSetHdrSetting(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeSetCameraMode(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeSetRecordingMode(long nativeCmd, int cam_id, int mode, int resolution, int framerate, int hyperlapse);
private static native int nativeEncodeSetPhotoMode(long nativeCmd, int cam_id, int mode, int format, int file_format, int burst, int bracketing, float capture_interval);
private static native int nativeEncodeSetStreamingMode(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeTakePhoto(long nativeCmd, int cam_id);
private static native int nativeEncodeStartRecording(long nativeCmd, int cam_id);
private static native int nativeEncodeStopRecording(long nativeCmd, int cam_id);
private static native int nativeEncodeSetAutorecord(long nativeCmd, int cam_id, int state);
private static native int nativeEncodeResetZoom(long nativeCmd, int cam_id);
private static native int nativeEncodeStopPhoto(long nativeCmd, int cam_id);
private static native int nativeEncodeSetAlignmentOffsets(long nativeCmd, int cam_id, float yaw, float pitch, float roll);
private static native int nativeEncodeResetAlignmentOffsets(long nativeCmd, int cam_id);
}
| UTF-8 | Java | 150,005 | java | ArsdkFeatureCamera.java | Java | [] | null | [] | /** Generated, do not edit ! */
package com.parrot.drone.sdkcore.arsdk;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.parrot.drone.sdkcore.arsdk.command.ArsdkCommand;
import com.parrot.drone.sdkcore.ulog.ULog;
import static com.parrot.drone.sdkcore.arsdk.Logging.TAG;
import android.util.SparseArray;
import java.util.function.Consumer;
import java.util.EnumSet;
/**
* Camera feature command/event interface.
*/
public class ArsdkFeatureCamera {
/**
* Camera model.
*/
public enum Model {
/**
* Main camera, for photo and/or video.
*/
MAIN(0),
/**
* Thermal camera, for photo and/or video.
*/
THERMAL(1),
/**
* Thermal-blended camera, Visible and Thermal stream are blended, for photo and/or video.
*/
THERMAL_BLENDED(2);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Model fromValue(int value) {
return MAP.get(value, null);
}
private Model(int value) {
this.value = value;
}
private static final SparseArray<Model> MAP;
static {
MAP = new SparseArray<>();
for (Model e: values())
MAP.put(e.value, e);
}
}
/**
* Indicate if a feature is supported by the drone.
*/
public enum Supported {
/**
* Not Supported.
*/
NOT_SUPPORTED(0),
/**
* Supported.
*/
SUPPORTED(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Supported fromValue(int value) {
return MAP.get(value, null);
}
private Supported(int value) {
this.value = value;
}
private static final SparseArray<Supported> MAP;
static {
MAP = new SparseArray<>();
for (Supported e: values())
MAP.put(e.value, e);
}
}
/**
* Indicate if a feature is available in current mode/configuration.
*/
public enum Availability {
/**
* Not Available.
*/
NOT_AVAILABLE(0),
/**
* Available.
*/
AVAILABLE(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Availability fromValue(int value) {
return MAP.get(value, null);
}
private Availability(int value) {
this.value = value;
}
private static final SparseArray<Availability> MAP;
static {
MAP = new SparseArray<>();
for (Availability e: values())
MAP.put(e.value, e);
}
}
/**
* Feature current state.
*/
public enum State {
/**
* Feature is not currently active.
*/
INACTIVE(0),
/**
* Feature is currently active.
*/
ACTIVE(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static State fromValue(int value) {
return MAP.get(value, null);
}
private State(int value) {
this.value = value;
}
private static final SparseArray<State> MAP;
static {
MAP = new SparseArray<>();
for (State e: values())
MAP.put(e.value, e);
}
}
/**
* Exposure mode.
*/
public enum ExposureMode {
/**
* Automatic shutter speed and iso, balanced.
*/
AUTOMATIC(0),
/**
* Automatic shutter speed and iso, prefer increasing iso sensitivity over using low shutter speed. This mode
* provides better results when the drone is moving dynamically.
*/
AUTOMATIC_PREFER_ISO_SENSITIVITY(1),
/**
* Automatic shutter speed and iso, prefer reducing shutter speed over using high iso sensitivity. This mode
* provides better results when the drone is moving slowly.
*/
AUTOMATIC_PREFER_SHUTTER_SPEED(2),
/**
* Manual iso sensitivity, automatic shutter speed.
*/
MANUAL_ISO_SENSITIVITY(3),
/**
* Manual shutter speed, automatic iso.
*/
MANUAL_SHUTTER_SPEED(4),
/**
* Manual iso sensitivity and shutter speed.
*/
MANUAL(5);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static ExposureMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<ExposureMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 6) {
ULog.e(TAG, "Unsupported ExposureMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<ExposureMode> fromBitfield(int bitfield) {
EnumSet<ExposureMode> enums = EnumSet.noneOf(ExposureMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull ExposureMode... enums) {
int bitField = 0;
for (ExposureMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private ExposureMode(int value) {
this.value = value;
}
private static final SparseArray<ExposureMode> MAP;
static {
MAP = new SparseArray<>();
for (ExposureMode e: values())
MAP.put(e.value, e);
}
}
/**
* The shutter speed in seconds.
*/
public enum ShutterSpeed {
/**
* 1/10000 sec.
*/
SHUTTER_1_OVER_10000(0),
/**
* 1/8000 sec.
*/
SHUTTER_1_OVER_8000(1),
/**
* 1/6400 sec.
*/
SHUTTER_1_OVER_6400(2),
/**
* 1/5000 sec.
*/
SHUTTER_1_OVER_5000(3),
/**
* 1/4000 sec.
*/
SHUTTER_1_OVER_4000(4),
/**
* 1/3200 sec.
*/
SHUTTER_1_OVER_3200(5),
/**
* 1/2500 sec.
*/
SHUTTER_1_OVER_2500(6),
/**
* 1/2000 sec.
*/
SHUTTER_1_OVER_2000(7),
/**
* 1/1600 sec.
*/
SHUTTER_1_OVER_1600(8),
/**
* 1/1250 sec.
*/
SHUTTER_1_OVER_1250(9),
/**
* 1/1000 sec.
*/
SHUTTER_1_OVER_1000(10),
/**
* 1/800 sec.
*/
SHUTTER_1_OVER_800(11),
/**
* 1/640 sec.
*/
SHUTTER_1_OVER_640(12),
/**
* 1/500 sec.
*/
SHUTTER_1_OVER_500(13),
/**
* 1/400 sec.
*/
SHUTTER_1_OVER_400(14),
/**
* 1/320 sec.
*/
SHUTTER_1_OVER_320(15),
/**
* 1/240 sec.
*/
SHUTTER_1_OVER_240(16),
/**
* 1/200 sec.
*/
SHUTTER_1_OVER_200(17),
/**
* 1/160 sec.
*/
SHUTTER_1_OVER_160(18),
/**
* 1/120 sec.
*/
SHUTTER_1_OVER_120(19),
/**
* 1/100 sec.
*/
SHUTTER_1_OVER_100(20),
/**
* 1/80 sec.
*/
SHUTTER_1_OVER_80(21),
/**
* 1/60 sec.
*/
SHUTTER_1_OVER_60(22),
/**
* 1/50 sec.
*/
SHUTTER_1_OVER_50(23),
/**
* 1/40 sec.
*/
SHUTTER_1_OVER_40(24),
/**
* 1/30 sec.
*/
SHUTTER_1_OVER_30(25),
/**
* 1/25 sec.
*/
SHUTTER_1_OVER_25(26),
/**
* 1/15 sec.
*/
SHUTTER_1_OVER_15(27),
/**
* 1/10 sec.
*/
SHUTTER_1_OVER_10(28),
/**
* 1/8 sec.
*/
SHUTTER_1_OVER_8(29),
/**
* 1/6 sec.
*/
SHUTTER_1_OVER_6(30),
/**
* 1/4 sec.
*/
SHUTTER_1_OVER_4(31),
/**
* 1/3 sec.
*/
SHUTTER_1_OVER_3(32),
/**
* 1/2 sec.
*/
SHUTTER_1_OVER_2(33),
/**
* 1/1.5 sec.
*/
SHUTTER_1_OVER_1_5(34),
/**
* 1 sec.
*/
SHUTTER_1(35);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static ShutterSpeed fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(long bitfield) {
return (bitfield & (1L << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(long bitfield, @NonNull Consumer<ShutterSpeed> func) {
while (bitfield != 0) {
int value = Long.numberOfTrailingZeros(bitfield);
if (value >= 36) {
ULog.e(TAG, "Unsupported ShutterSpeed bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1L << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<ShutterSpeed> fromBitfield(long bitfield) {
EnumSet<ShutterSpeed> enums = EnumSet.noneOf(ShutterSpeed.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static long toBitField(@NonNull ShutterSpeed... enums) {
long bitField = 0;
for (ShutterSpeed e : enums)
bitField |= 1L << e.value;
return bitField;
}
private ShutterSpeed(int value) {
this.value = value;
}
private static final SparseArray<ShutterSpeed> MAP;
static {
MAP = new SparseArray<>();
for (ShutterSpeed e: values())
MAP.put(e.value, e);
}
}
/**
* ISO Sensitivity levels.
*/
public enum IsoSensitivity {
/**
* ISO 50.
*/
ISO_50(0),
/**
* ISO 64.
*/
ISO_64(1),
/**
* ISO 80.
*/
ISO_80(2),
/**
* ISO 100.
*/
ISO_100(3),
/**
* ISO 125.
*/
ISO_125(4),
/**
* ISO 160.
*/
ISO_160(5),
/**
* ISO 200.
*/
ISO_200(6),
/**
* ISO 250.
*/
ISO_250(7),
/**
* ISO 320.
*/
ISO_320(8),
/**
* ISO 400.
*/
ISO_400(9),
/**
* ISO 500.
*/
ISO_500(10),
/**
* ISO 640.
*/
ISO_640(11),
/**
* ISO 800.
*/
ISO_800(12),
/**
* ISO 1200.
*/
ISO_1200(13),
/**
* ISO 1600.
*/
ISO_1600(14),
/**
* ISO 2500.
*/
ISO_2500(15),
/**
* ISO 3200.
*/
ISO_3200(16);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static IsoSensitivity fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<IsoSensitivity> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 17) {
ULog.e(TAG, "Unsupported IsoSensitivity bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<IsoSensitivity> fromBitfield(int bitfield) {
EnumSet<IsoSensitivity> enums = EnumSet.noneOf(IsoSensitivity.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull IsoSensitivity... enums) {
int bitField = 0;
for (IsoSensitivity e : enums)
bitField |= 1 << e.value;
return bitField;
}
private IsoSensitivity(int value) {
this.value = value;
}
private static final SparseArray<IsoSensitivity> MAP;
static {
MAP = new SparseArray<>();
for (IsoSensitivity e: values())
MAP.put(e.value, e);
}
}
/**
* Exposure compensation.
*/
public enum EvCompensation {
/**
* -3.00 EV.
*/
EV_MINUS_3_00(0),
/**
* -2.67 EV.
*/
EV_MINUS_2_67(1),
/**
* -2.33 EV.
*/
EV_MINUS_2_33(2),
/**
* -2.00 EV.
*/
EV_MINUS_2_00(3),
/**
* -1.67 EV.
*/
EV_MINUS_1_67(4),
/**
* -1.33 EV.
*/
EV_MINUS_1_33(5),
/**
* -1.00 EV.
*/
EV_MINUS_1_00(6),
/**
* -0.67 EV.
*/
EV_MINUS_0_67(7),
/**
* -0.33 EV.
*/
EV_MINUS_0_33(8),
/**
* 0.00 EV.
*/
EV_0_00(9),
/**
* 0.33 EV.
*/
EV_0_33(10),
/**
* 0.67 EV.
*/
EV_0_67(11),
/**
* 1.00 EV.
*/
EV_1_00(12),
/**
* 1.33 EV.
*/
EV_1_33(13),
/**
* 1.67 EV.
*/
EV_1_67(14),
/**
* 2.00 EV.
*/
EV_2_00(15),
/**
* 2.33 EV.
*/
EV_2_33(16),
/**
* 2.67 EV.
*/
EV_2_67(17),
/**
* 3.00 EV.
*/
EV_3_00(18);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static EvCompensation fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<EvCompensation> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 19) {
ULog.e(TAG, "Unsupported EvCompensation bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<EvCompensation> fromBitfield(int bitfield) {
EnumSet<EvCompensation> enums = EnumSet.noneOf(EvCompensation.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull EvCompensation... enums) {
int bitField = 0;
for (EvCompensation e : enums)
bitField |= 1 << e.value;
return bitField;
}
private EvCompensation(int value) {
this.value = value;
}
private static final SparseArray<EvCompensation> MAP;
static {
MAP = new SparseArray<>();
for (EvCompensation e: values())
MAP.put(e.value, e);
}
}
/**
* The white balance mode.
*/
public enum WhiteBalanceMode {
/**
* Automatic Estimation of White Balance scales.
*/
AUTOMATIC(0),
/**
* Candle preset.
*/
CANDLE(1),
/**
* Sunset preset.
*/
SUNSET(2),
/**
* Incandescent light preset.
*/
INCANDESCENT(3),
/**
* Warm white fluorescent light preset.
*/
WARM_WHITE_FLUORESCENT(4),
/**
* Halogen light preset.
*/
HALOGEN(5),
/**
* Fluorescent light preset.
*/
FLUORESCENT(6),
/**
* Cool white fluorescent light preset.
*/
COOL_WHITE_FLUORESCENT(7),
/**
* Flash light preset.
*/
FLASH(8),
/**
* Daylight preset.
*/
DAYLIGHT(9),
/**
* Sunny preset.
*/
SUNNY(10),
/**
* Cloudy preset.
*/
CLOUDY(11),
/**
* Snow preset.
*/
SNOW(12),
/**
* Hazy preset.
*/
HAZY(13),
/**
* Shaded preset.
*/
SHADED(14),
/**
* Green foliage preset.
*/
GREEN_FOLIAGE(15),
/**
* Blue sky preset.
*/
BLUE_SKY(16),
/**
* Custom white balance value.
*/
CUSTOM(17);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static WhiteBalanceMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<WhiteBalanceMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 18) {
ULog.e(TAG, "Unsupported WhiteBalanceMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<WhiteBalanceMode> fromBitfield(int bitfield) {
EnumSet<WhiteBalanceMode> enums = EnumSet.noneOf(WhiteBalanceMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull WhiteBalanceMode... enums) {
int bitField = 0;
for (WhiteBalanceMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private WhiteBalanceMode(int value) {
this.value = value;
}
private static final SparseArray<WhiteBalanceMode> MAP;
static {
MAP = new SparseArray<>();
for (WhiteBalanceMode e: values())
MAP.put(e.value, e);
}
}
/**
* The white balance temperature.
*/
public enum WhiteBalanceTemperature {
/**
* 1500 K.
*/
T_1500(0),
/**
* 1750 K.
*/
T_1750(1),
/**
* 2000 K.
*/
T_2000(2),
/**
* 2250 K.
*/
T_2250(3),
/**
* 2500 K.
*/
T_2500(4),
/**
* 2750 K.
*/
T_2750(5),
/**
* 3000 K.
*/
T_3000(6),
/**
* 3250 K.
*/
T_3250(7),
/**
* 3500 K.
*/
T_3500(8),
/**
* 3750 K.
*/
T_3750(9),
/**
* 4000 K.
*/
T_4000(10),
/**
* 4250 K.
*/
T_4250(11),
/**
* 4500 K.
*/
T_4500(12),
/**
* 4750 K.
*/
T_4750(13),
/**
* 5000 K.
*/
T_5000(14),
/**
* 5250 K.
*/
T_5250(15),
/**
* 5500 K.
*/
T_5500(16),
/**
* 5750 K.
*/
T_5750(17),
/**
* 6000 K.
*/
T_6000(18),
/**
* 6250 K.
*/
T_6250(19),
/**
* 6500 K.
*/
T_6500(20),
/**
* 6750 K.
*/
T_6750(21),
/**
* 7000 K.
*/
T_7000(22),
/**
* 7250 K.
*/
T_7250(23),
/**
* 7500 K.
*/
T_7500(24),
/**
* 7750 K.
*/
T_7750(25),
/**
* 8000 K.
*/
T_8000(26),
/**
* 8250 K.
*/
T_8250(27),
/**
* 8500 K.
*/
T_8500(28),
/**
* 8750 K.
*/
T_8750(29),
/**
* 9000 K.
*/
T_9000(30),
/**
* 9250 K.
*/
T_9250(31),
/**
* 9500 K.
*/
T_9500(32),
/**
* 9750 K.
*/
T_9750(33),
/**
* 10000 K.
*/
T_10000(34),
/**
* 10250 K.
*/
T_10250(35),
/**
* 10500 K.
*/
T_10500(36),
/**
* 10750 K.
*/
T_10750(37),
/**
* 11000 K.
*/
T_11000(38),
/**
* 11250 K.
*/
T_11250(39),
/**
* 11500 K.
*/
T_11500(40),
/**
* 11750 K.
*/
T_11750(41),
/**
* 12000 K.
*/
T_12000(42),
/**
* 12250 K.
*/
T_12250(43),
/**
* 12500 K.
*/
T_12500(44),
/**
* 12750 K.
*/
T_12750(45),
/**
* 13000 K.
*/
T_13000(46),
/**
* 13250 K.
*/
T_13250(47),
/**
* 13500 K.
*/
T_13500(48),
/**
* 13750 K.
*/
T_13750(49),
/**
* 14000 K.
*/
T_14000(50),
/**
* 14250 K.
*/
T_14250(51),
/**
* 14500 K.
*/
T_14500(52),
/**
* 14750 K.
*/
T_14750(53),
/**
* 15000 K.
*/
T_15000(54);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static WhiteBalanceTemperature fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(long bitfield) {
return (bitfield & (1L << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(long bitfield, @NonNull Consumer<WhiteBalanceTemperature> func) {
while (bitfield != 0) {
int value = Long.numberOfTrailingZeros(bitfield);
if (value >= 55) {
ULog.e(TAG, "Unsupported WhiteBalanceTemperature bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1L << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<WhiteBalanceTemperature> fromBitfield(long bitfield) {
EnumSet<WhiteBalanceTemperature> enums = EnumSet.noneOf(WhiteBalanceTemperature.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static long toBitField(@NonNull WhiteBalanceTemperature... enums) {
long bitField = 0;
for (WhiteBalanceTemperature e : enums)
bitField |= 1L << e.value;
return bitField;
}
private WhiteBalanceTemperature(int value) {
this.value = value;
}
private static final SparseArray<WhiteBalanceTemperature> MAP;
static {
MAP = new SparseArray<>();
for (WhiteBalanceTemperature e: values())
MAP.put(e.value, e);
}
}
/**
* Images style.
*/
public enum Style {
/**
* Natural look style.
*/
STANDARD(0),
/**
* Parrot Log, produce flat and desaturated images, best for post-processing.
*/
PLOG(1),
/**
* Intense style: bright colors, warm shade, high contrast.
*/
INTENSE(2),
/**
* Pastel style: soft colors, cold shade, low contrast.
*/
PASTEL(3);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Style fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<Style> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 4) {
ULog.e(TAG, "Unsupported Style bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<Style> fromBitfield(int bitfield) {
EnumSet<Style> enums = EnumSet.noneOf(Style.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull Style... enums) {
int bitField = 0;
for (Style e : enums)
bitField |= 1 << e.value;
return bitField;
}
private Style(int value) {
this.value = value;
}
private static final SparseArray<Style> MAP;
static {
MAP = new SparseArray<>();
for (Style e: values())
MAP.put(e.value, e);
}
}
/**
* Camera mode.
*/
public enum CameraMode {
/**
* Camera is in recording mode.
*/
RECORDING(0),
/**
* Camera is in photo mode.
*/
PHOTO(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static CameraMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<CameraMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 2) {
ULog.e(TAG, "Unsupported CameraMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<CameraMode> fromBitfield(int bitfield) {
EnumSet<CameraMode> enums = EnumSet.noneOf(CameraMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull CameraMode... enums) {
int bitField = 0;
for (CameraMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private CameraMode(int value) {
this.value = value;
}
private static final SparseArray<CameraMode> MAP;
static {
MAP = new SparseArray<>();
for (CameraMode e: values())
MAP.put(e.value, e);
}
}
/**
* .
*/
public enum RecordingMode {
/**
* Standard mode.
*/
STANDARD(0),
/**
* Create an accelerated video by dropping some frame at a user specified rate define by `hyperlapse_value`.
*/
HYPERLAPSE(1),
/**
* Record x2 or x4 slowed-down videos.
*/
SLOW_MOTION(2),
/**
* Record high-framerate videos (playback speed is x1).
*/
HIGH_FRAMERATE(3);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static RecordingMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<RecordingMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 4) {
ULog.e(TAG, "Unsupported RecordingMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<RecordingMode> fromBitfield(int bitfield) {
EnumSet<RecordingMode> enums = EnumSet.noneOf(RecordingMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull RecordingMode... enums) {
int bitField = 0;
for (RecordingMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private RecordingMode(int value) {
this.value = value;
}
private static final SparseArray<RecordingMode> MAP;
static {
MAP = new SparseArray<>();
for (RecordingMode e: values())
MAP.put(e.value, e);
}
}
/**
* .
*/
public enum PhotoMode {
/**
* Single shot mode.
*/
SINGLE(0),
/**
* Bracketing mode. Takes a burst of 3 or 5 frames with a different exposure.
*/
BRACKETING(1),
/**
* Burst mode. Takes burst of frames.
*/
BURST(2),
/**
* Time-lapse mode. Takes frames at a regular time interval.
*/
TIME_LAPSE(3),
/**
* GPS-lapse mode. Takse frames at a regular GPS position interval.
*/
GPS_LAPSE(4);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<PhotoMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 5) {
ULog.e(TAG, "Unsupported PhotoMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<PhotoMode> fromBitfield(int bitfield) {
EnumSet<PhotoMode> enums = EnumSet.noneOf(PhotoMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull PhotoMode... enums) {
int bitField = 0;
for (PhotoMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private PhotoMode(int value) {
this.value = value;
}
private static final SparseArray<PhotoMode> MAP;
static {
MAP = new SparseArray<>();
for (PhotoMode e: values())
MAP.put(e.value, e);
}
}
/**
* Video resolution.
*/
public enum Resolution {
/**
* 4096x2160 pixels (4k cinema).
*/
RES_DCI_4K(0),
/**
* 3840x2160 pixels (UHD).
*/
RES_UHD_4K(1),
/**
* 2704x1524 pixels.
*/
RES_2_7K(2),
/**
* 1920x1080 pixels (Full HD).
*/
RES_1080P(3),
/**
* 1280x720 pixels (HD).
*/
RES_720P(4),
/**
* 856x480 pixels.
*/
RES_480P(5),
/**
* 1440x1080 pixels (SD).
*/
RES_1080P_SD(6),
/**
* 960x720 pixels (SD).
*/
RES_720P_SD(7),
/**
* 7680x4320 pixels (UHD).
*/
RES_UHD_8K(8),
/**
* 5120x2880 pixels.
*/
RES_5K(9);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Resolution fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<Resolution> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 10) {
ULog.e(TAG, "Unsupported Resolution bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<Resolution> fromBitfield(int bitfield) {
EnumSet<Resolution> enums = EnumSet.noneOf(Resolution.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull Resolution... enums) {
int bitField = 0;
for (Resolution e : enums)
bitField |= 1 << e.value;
return bitField;
}
private Resolution(int value) {
this.value = value;
}
private static final SparseArray<Resolution> MAP;
static {
MAP = new SparseArray<>();
for (Resolution e: values())
MAP.put(e.value, e);
}
}
/**
* Video recording frame rate.
*/
public enum Framerate {
/**
* 23.97 fps.
*/
FPS_24(0),
/**
* 25 fps.
*/
FPS_25(1),
/**
* 29.97 fps.
*/
FPS_30(2),
/**
* 47.952 fps.
*/
FPS_48(3),
/**
* 50 fps.
*/
FPS_50(4),
/**
* 59.94 fps.
*/
FPS_60(5),
/**
* 95.88 fps.
*/
FPS_96(6),
/**
* 100 fps.
*/
FPS_100(7),
/**
* 119.88 fps.
*/
FPS_120(8),
/**
* 9 fps. For thermal only, capture triggered by thermal sensor.
*/
FPS_9(9),
/**
* 15 fps.
*/
FPS_15(10),
/**
* 20 fps.
*/
FPS_20(11),
/**
* 191.81 fps.
*/
FPS_192(12),
/**
* 200 fps.
*/
FPS_200(13),
/**
* 239.76 fps.
*/
FPS_240(14),
/**
* 10 fps. For thermal only, capture triggered by thermal sensor.
*/
FPS_10(15),
/**
* 8.57 fps. For thermal only, capture triggered by thermal sensor.
*/
FPS_8_6(16);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static Framerate fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<Framerate> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 17) {
ULog.e(TAG, "Unsupported Framerate bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<Framerate> fromBitfield(int bitfield) {
EnumSet<Framerate> enums = EnumSet.noneOf(Framerate.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull Framerate... enums) {
int bitField = 0;
for (Framerate e : enums)
bitField |= 1 << e.value;
return bitField;
}
private Framerate(int value) {
this.value = value;
}
private static final SparseArray<Framerate> MAP;
static {
MAP = new SparseArray<>();
for (Framerate e: values())
MAP.put(e.value, e);
}
}
/**
* The photo format.
*/
public enum PhotoFormat {
/**
* Sensor full resolution, not dewarped.
*/
FULL_FRAME(0),
/**
* Rectilinear projection, dewarped.
*/
RECTILINEAR(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoFormat fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<PhotoFormat> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 2) {
ULog.e(TAG, "Unsupported PhotoFormat bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<PhotoFormat> fromBitfield(int bitfield) {
EnumSet<PhotoFormat> enums = EnumSet.noneOf(PhotoFormat.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull PhotoFormat... enums) {
int bitField = 0;
for (PhotoFormat e : enums)
bitField |= 1 << e.value;
return bitField;
}
private PhotoFormat(int value) {
this.value = value;
}
private static final SparseArray<PhotoFormat> MAP;
static {
MAP = new SparseArray<>();
for (PhotoFormat e: values())
MAP.put(e.value, e);
}
}
/**
* The photo format.
*/
public enum PhotoFileFormat {
/**
* photo recorded in JPEG format.
*/
JPEG(0),
/**
* photo recorded in DNG format.
*/
DNG(1),
/**
* photo recorded in both DNG and JPEG format.
*/
DNG_JPEG(2);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoFileFormat fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<PhotoFileFormat> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 3) {
ULog.e(TAG, "Unsupported PhotoFileFormat bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<PhotoFileFormat> fromBitfield(int bitfield) {
EnumSet<PhotoFileFormat> enums = EnumSet.noneOf(PhotoFileFormat.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull PhotoFileFormat... enums) {
int bitField = 0;
for (PhotoFileFormat e : enums)
bitField |= 1 << e.value;
return bitField;
}
private PhotoFileFormat(int value) {
this.value = value;
}
private static final SparseArray<PhotoFileFormat> MAP;
static {
MAP = new SparseArray<>();
for (PhotoFileFormat e: values())
MAP.put(e.value, e);
}
}
/**
* Anti-flicker mode.
*/
public enum AntiflickerMode {
/**
* Anti-flicker off.
*/
OFF(0),
/**
* Auto detect.
*/
AUTO(1),
/**
* force the exposure time to be an integer multiple of 10ms.
*/
MODE_50HZ(2),
/**
* force the exposure time to be an integer multiple of 8.33ms.
*/
MODE_60HZ(3);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static AntiflickerMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<AntiflickerMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 4) {
ULog.e(TAG, "Unsupported AntiflickerMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<AntiflickerMode> fromBitfield(int bitfield) {
EnumSet<AntiflickerMode> enums = EnumSet.noneOf(AntiflickerMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull AntiflickerMode... enums) {
int bitField = 0;
for (AntiflickerMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private AntiflickerMode(int value) {
this.value = value;
}
private static final SparseArray<AntiflickerMode> MAP;
static {
MAP = new SparseArray<>();
for (AntiflickerMode e: values())
MAP.put(e.value, e);
}
}
/**
* Values for hyperlapse mode.
*/
public enum HyperlapseValue {
/**
* Record 1 of 15 frames.
*/
RATIO_15(0),
/**
* Record 1 of 30 frames.
*/
RATIO_30(1),
/**
* Record 1 of 60 frames.
*/
RATIO_60(2),
/**
* Record 1 of 120 frames.
*/
RATIO_120(3),
/**
* Record 1 of 240 frames.
*/
RATIO_240(4);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static HyperlapseValue fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<HyperlapseValue> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 5) {
ULog.e(TAG, "Unsupported HyperlapseValue bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<HyperlapseValue> fromBitfield(int bitfield) {
EnumSet<HyperlapseValue> enums = EnumSet.noneOf(HyperlapseValue.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull HyperlapseValue... enums) {
int bitField = 0;
for (HyperlapseValue e : enums)
bitField |= 1 << e.value;
return bitField;
}
private HyperlapseValue(int value) {
this.value = value;
}
private static final SparseArray<HyperlapseValue> MAP;
static {
MAP = new SparseArray<>();
for (HyperlapseValue e: values())
MAP.put(e.value, e);
}
}
/**
* Values for burst photo mode.
*/
public enum BurstValue {
/**
* Record 14 picture over 4 second.
*/
BURST_14_OVER_4S(0),
/**
* Record 14 picture over 2 second.
*/
BURST_14_OVER_2S(1),
/**
* Record 14 picture over 1 second.
*/
BURST_14_OVER_1S(2),
/**
* Record 10 picture over 4 second.
*/
BURST_10_OVER_4S(3),
/**
* Record 10 picture over 2 second.
*/
BURST_10_OVER_2S(4),
/**
* Record 10 picture over 1 second.
*/
BURST_10_OVER_1S(5),
/**
* Record 4 picture over 4 second.
*/
BURST_4_OVER_4S(6),
/**
* Record 4 picture over 2 second.
*/
BURST_4_OVER_2S(7),
/**
* Record 4 picture over 1 second.
*/
BURST_4_OVER_1S(8);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static BurstValue fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<BurstValue> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 9) {
ULog.e(TAG, "Unsupported BurstValue bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<BurstValue> fromBitfield(int bitfield) {
EnumSet<BurstValue> enums = EnumSet.noneOf(BurstValue.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull BurstValue... enums) {
int bitField = 0;
for (BurstValue e : enums)
bitField |= 1 << e.value;
return bitField;
}
private BurstValue(int value) {
this.value = value;
}
private static final SparseArray<BurstValue> MAP;
static {
MAP = new SparseArray<>();
for (BurstValue e: values())
MAP.put(e.value, e);
}
}
/**
* Bracketing mode preset.
*/
public enum BracketingPreset {
/**
* 3 frames, with EV compensation of [-1 EV, 0 EV, +1 EV].
*/
PRESET_1EV(0),
/**
* 3 frames, with EV compensation of [-2 EV, 0 EV, +2 EV].
*/
PRESET_2EV(1),
/**
* 3 frames, with EV compensation of [-3 EV, 0 EV, +3 EV].
*/
PRESET_3EV(2),
/**
* 5 frames, with EV compensation of [-2 EV, -1 EV, 0 EV, +1 EV, +2 EV].
*/
PRESET_1EV_2EV(3),
/**
* 5 frames, with EV compensation of [-3 EV, -1 EV, 0 EV, +1 EV, +3 EV].
*/
PRESET_1EV_3EV(4),
/**
* 5 frames, with EV compensation of [-3 EV, -2 EV, 0 EV, +2 EV, +3 EV].
*/
PRESET_2EV_3EV(5),
/**
* 7 frames, with EV compensation of [-3 EV, -2 EV, -1 EV, 0 EV, +1 EV, +2 EV, +3 EV].
*/
PRESET_1EV_2EV_3EV(6);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static BracketingPreset fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<BracketingPreset> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 7) {
ULog.e(TAG, "Unsupported BracketingPreset bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<BracketingPreset> fromBitfield(int bitfield) {
EnumSet<BracketingPreset> enums = EnumSet.noneOf(BracketingPreset.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull BracketingPreset... enums) {
int bitField = 0;
for (BracketingPreset e : enums)
bitField |= 1 << e.value;
return bitField;
}
private BracketingPreset(int value) {
this.value = value;
}
private static final SparseArray<BracketingPreset> MAP;
static {
MAP = new SparseArray<>();
for (BracketingPreset e: values())
MAP.put(e.value, e);
}
}
/**
* Video stream mode.
*/
public enum StreamingMode {
/**
* Minimize latency with average reliability (best for piloting).
*/
LOW_LATENCY(0),
/**
* Maximize the reliability with an average latency (best when streaming quality is important but not the
* latency).
*/
HIGH_RELIABILITY(1),
/**
* Maximize the reliability using a framerate decimation with an average latency (best when streaming quality is
* important but not the latency).
*/
HIGH_RELIABILITY_LOW_FRAMERATE(2);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static StreamingMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<StreamingMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 3) {
ULog.e(TAG, "Unsupported StreamingMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<StreamingMode> fromBitfield(int bitfield) {
EnumSet<StreamingMode> enums = EnumSet.noneOf(StreamingMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull StreamingMode... enums) {
int bitField = 0;
for (StreamingMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private StreamingMode(int value) {
this.value = value;
}
private static final SparseArray<StreamingMode> MAP;
static {
MAP = new SparseArray<>();
for (StreamingMode e: values())
MAP.put(e.value, e);
}
}
/**
* Result for command `take_photo`.
*/
public enum PhotoResult {
/**
* Taking a new photo.
*/
TAKING_PHOTO(0),
/**
* A photo has been taken.
*/
PHOTO_TAKEN(1),
/**
* A photo has been saved to the file system.
*/
PHOTO_SAVED(2),
/**
* Error taking photo: not enough space in storage.
*/
ERROR_NO_STORAGE_SPACE(3),
/**
* Error taking photo: wrong state.
*/
ERROR_BAD_STATE(4),
/**
* Error taking photo: generic error.
*/
ERROR(5);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static PhotoResult fromValue(int value) {
return MAP.get(value, null);
}
private PhotoResult(int value) {
this.value = value;
}
private static final SparseArray<PhotoResult> MAP;
static {
MAP = new SparseArray<>();
for (PhotoResult e: values())
MAP.put(e.value, e);
}
}
/**
* Start/Stop recording result.
*/
public enum RecordingResult {
/**
* Recording started.
*/
STARTED(0),
/**
* Recording stopped.
*/
STOPPED(1),
/**
* Recording stopped because storage is full.
*/
STOPPED_NO_STORAGE_SPACE(2),
/**
* Recording stopped because storage write speed is too slow.
*/
STOPPED_STORAGE_TOO_SLOW(3),
/**
* Error starting recording: wrong state.
*/
ERROR_BAD_STATE(4),
/**
* Error starting or during recording.
*/
ERROR(5),
/**
* Recording stopped because of internal reconfiguration.
*/
STOPPED_RECONFIGURED(6);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static RecordingResult fromValue(int value) {
return MAP.get(value, null);
}
private RecordingResult(int value) {
this.value = value;
}
private static final SparseArray<RecordingResult> MAP;
static {
MAP = new SparseArray<>();
for (RecordingResult e: values())
MAP.put(e.value, e);
}
}
/**
* Zoom control mode.
*/
public enum ZoomControlMode {
/**
* Zoom is set by giving a level.
*/
LEVEL(0),
/**
* Zoom is set by giving a velocity.
*/
VELOCITY(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static ZoomControlMode fromValue(int value) {
return MAP.get(value, null);
}
private ZoomControlMode(int value) {
this.value = value;
}
private static final SparseArray<ZoomControlMode> MAP;
static {
MAP = new SparseArray<>();
for (ZoomControlMode e: values())
MAP.put(e.value, e);
}
}
/**
* Auto Exposure metering mode.
*/
public enum AutoExposureMeteringMode {
/**
* Default Auto Exposure metering mode.
*/
STANDARD(0),
/**
* Auto Exposure metering mode which favours the center top of the matrix.
*/
CENTER_TOP(1);
/** Internal arsdk value. */
public final int value;
/**
* Obtains an enum from its internal arsdk value.
*
* @param value arsdk enum internal value
*
* @returns the corresponding enum in case it exists, otherwise {@code null}
*/
@Nullable
public static AutoExposureMeteringMode fromValue(int value) {
return MAP.get(value, null);
}
/**
* Tells whether this enum value is armed in a given bitfield.
*
* @param bitfield bitfield to process
*
* @returns {@code true} if this enum is in specified bitfield, otherwise {@code false}
*/
public boolean inBitField(int bitfield) {
return (bitfield & (1 << value)) != 0;
}
/**
* Applies a function to each armed enum value in a given bitfield.
*
* @param bitfield bitfield to process
* @param func function to call with each armed enum value
*/
public static void each(int bitfield, @NonNull Consumer<AutoExposureMeteringMode> func) {
while (bitfield != 0) {
int value = Integer.numberOfTrailingZeros(bitfield);
if (value >= 2) {
ULog.e(TAG, "Unsupported AutoExposureMeteringMode bitfield value " + value);
break;
}
func.accept(fromValue(value));
bitfield ^= 1 << value;
}
}
/**
* Extracts armed enum value(s) from a given bitfield.
*
* @param bitfield bitfield to process
*
* @return a set containing enum value(s) armed in the specified bitfield
*/
@NonNull
public static EnumSet<AutoExposureMeteringMode> fromBitfield(int bitfield) {
EnumSet<AutoExposureMeteringMode> enums = EnumSet.noneOf(AutoExposureMeteringMode.class);
each(bitfield, enums::add);
return enums;
}
/**
* Encodes a set of enum value(s) to a bitfield.
*
* @param enums enums to arm in the bitfield
*
* @return a bitfield where specified enum value(s) are armed
*/
public static int toBitField(@NonNull AutoExposureMeteringMode... enums) {
int bitField = 0;
for (AutoExposureMeteringMode e : enums)
bitField |= 1 << e.value;
return bitField;
}
private AutoExposureMeteringMode(int value) {
this.value = value;
}
private static final SparseArray<AutoExposureMeteringMode> MAP;
static {
MAP = new SparseArray<>();
for (AutoExposureMeteringMode e: values())
MAP.put(e.value, e);
}
}
/** Feature uid. */
public static final int UID = 0x8F00;
/** Uid of camera_capabilities event. */;
public static final int CAMERA_CAPABILITIES_UID = 0x0001;
/** Uid of recording_capabilities event. */;
public static final int RECORDING_CAPABILITIES_UID = 0x0002;
/** Uid of photo_capabilities event. */;
public static final int PHOTO_CAPABILITIES_UID = 0x0003;
/** Uid of antiflicker_capabilities event. */;
public static final int ANTIFLICKER_CAPABILITIES_UID = 0x0004;
/** Uid of exposure_settings event. */;
public static final int EXPOSURE_SETTINGS_UID = 0x0009;
/** Uid of exposure event. */;
public static final int EXPOSURE_UID = 0x000A;
/** Uid of white_balance event. */;
public static final int WHITE_BALANCE_UID = 0x000D;
/** Uid of ev_compensation event. */;
public static final int EV_COMPENSATION_UID = 0x000F;
/** Uid of antiflicker_mode event. */;
public static final int ANTIFLICKER_MODE_UID = 0x0011;
/** Uid of style event. */;
public static final int STYLE_UID = 0x0014;
/** Uid of zoom_level event. */;
public static final int ZOOM_LEVEL_UID = 0x0016;
/** Uid of zoom_info event. */;
public static final int ZOOM_INFO_UID = 0x0017;
/** Uid of max_zoom_speed event. */;
public static final int MAX_ZOOM_SPEED_UID = 0x0018;
/** Uid of zoom_velocity_quality_degradation event. */;
public static final int ZOOM_VELOCITY_QUALITY_DEGRADATION_UID = 0x001A;
/** Uid of hdr_setting event. */;
public static final int HDR_SETTING_UID = 0x001D;
/** Uid of hdr event. */;
public static final int HDR_UID = 0x001E;
/** Uid of camera_mode event. */;
public static final int CAMERA_MODE_UID = 0x0020;
/** Uid of recording_mode event. */;
public static final int RECORDING_MODE_UID = 0x0022;
/** Uid of photo_mode event. */;
public static final int PHOTO_MODE_UID = 0x0024;
/** Uid of streaming_mode event. */;
public static final int STREAMING_MODE_UID = 0x0026;
/** Uid of photo_progress event. */;
public static final int PHOTO_PROGRESS_UID = 0x0028;
/** Uid of photo_state event. */;
public static final int PHOTO_STATE_UID = 0x0029;
/** Uid of recording_progress event. */;
public static final int RECORDING_PROGRESS_UID = 0x002C;
/** Uid of recording_state event. */;
public static final int RECORDING_STATE_UID = 0x002D;
/** Uid of autorecord event. */;
public static final int AUTORECORD_UID = 0x002F;
/** Uid of camera_states event. */;
public static final int CAMERA_STATES_UID = 0x0031;
/** Uid of next_photo_delay event. */;
public static final int NEXT_PHOTO_DELAY_UID = 0x0033;
/** Uid of alignment_offsets event. */;
public static final int ALIGNMENT_OFFSETS_UID = 0x0034;
/**
* Decodes a command.
*
* @param command : command to decode
* @param callback: callback receiving decoded events
*/
public static void decode(@NonNull ArsdkCommand command, @NonNull Callback callback) {
nativeDecode(command.getNativePtr(), callback);
}
/** Callback receiving decoded events. */
public interface Callback {
/**
* Describes camera supported capabilities.
*
* @param camId: id of the camera. Camera id is unique and persistent: the same camera model on a same drone
* model always has the same id. Main/Built-in camera has id zero.
* @param model: Camera model.
* @param exposureModesBitField: Supported exposure modes.
* @param exposureLockSupported: Exposure lock support.
* @param exposureRoiLockSupported: Exposure lock on ROI support.
* @param evCompensationsBitField: Supported ev compensation values. Empty if ev_compensation is not supported.
* @param whiteBalanceModesBitField: Supported white balances modes.
* @param customWhiteBalanceTemperaturesBitField: Supported white balance temperature for "custom" white balance
* mode. Empty if "custom" mode is not supported.
* @param whiteBalanceLockSupported: White balance lock support.
* @param stylesBitField: Supported image styles.
* @param cameraModesBitField: Supported camera modes.
* @param hyperlapseValuesBitField: Supported values for hyperlapse recording mode. Empty of hyperlapse
* recording mode is not supported.
* @param bracketingPresetsBitField: Supported values for bracketing photo mode. Empty of bracketing photo mode
* is not supported.
* @param burstValuesBitField: Supported values for burst photo mode. Empty of burst photo mode is not
* supported.
* @param streamingModesBitField: Supported streaming modes, Empty if streaming is not supported.
* @param timelapseIntervalMin: Minimal time-lapse capture interval, in seconds.
* @param gpslapseIntervalMin: Minimal GPS-lapse capture interval, in meters.
* @param autoExposureMeteringModesBitField: Supported auto exposure metering modes
*/
public default void onCameraCapabilities(int camId, @Nullable Model model, int exposureModesBitField, @Nullable Supported exposureLockSupported, @Nullable Supported exposureRoiLockSupported, long evCompensationsBitField, int whiteBalanceModesBitField, long customWhiteBalanceTemperaturesBitField, @Nullable Supported whiteBalanceLockSupported, int stylesBitField, int cameraModesBitField, int hyperlapseValuesBitField, int bracketingPresetsBitField, int burstValuesBitField, int streamingModesBitField, float timelapseIntervalMin, float gpslapseIntervalMin, int autoExposureMeteringModesBitField) {}
/**
* Describe recording capabilities. Each entry of this list gives valid resolutions/framerates pair for the
* listed modes and if HDR is supported in this configuration. The same mode can be in multiple entries.
*
* @param id: Setting id. U8 msb is cam_id of the related camera.
* @param recordingModesBitField: Recording modes this capability applies to.
* @param resolutionsBitField: Supported resolutions in specified modes and framerates.
* @param frameratesBitField: Supported framerates in specified modes and resolutions.
* @param hdr: Indicate if hdr is supported in this configuration.
* @param listFlagsBitField: List flags.
*/
public default void onRecordingCapabilities(int id, int recordingModesBitField, int resolutionsBitField, int frameratesBitField, @Nullable Supported hdr, int listFlagsBitField) {}
/**
* Describe photo capabilities. Each entry of this list gives a valid format/fileformat pair for the listed
* modes and if HDR is supported in this configuration. The same mode can be in multiple entries.
*
* @param id: Setting id. U8 msb is cam_id of the related camera.
* @param photoModesBitField: Photo modes this capability applies to.
* @param photoFormatsBitField: Supported photo formats in specified modes and file formats (DNG file will
* always be full-frame, regardless of this setting).
* @param photoFileFormatsBitField: Supported photo file formats in specified modes and formats.
* @param hdr: Indicate if hdr is supported in this configuration.
* @param listFlagsBitField: List flags.
*/
public default void onPhotoCapabilities(int id, int photoModesBitField, int photoFormatsBitField, int photoFileFormatsBitField, @Nullable Supported hdr, int listFlagsBitField) {}
/**
* Describe anti-flickering. Antiflickering is global for all cameras
*
* @param supportedModesBitField: Supported anti-flicker mode.
*/
public default void onAntiflickerCapabilities(int supportedModesBitField) {}
/**
* Notify current exposure settings. This can be different from the actually used exposure values notified by
* event [exposure](#143-10) if the mode is not `manual`.
*
* @param camId: Id of the camera.
* @param mode: Exposure mode as set by command "set_exposure_mode".
* @param manualShutterSpeed: Shutter speed as set by command "set_manual_shutter_speed".
* @param manualShutterSpeedCapabilitiesBitField: Supported shutter speeds for current photo or recording
* configuration. Empty if "manual" or "manual_shutter_speed" exposure modes are not supported.
* @param manualIsoSensitivity: ISO sensitivity level as set by command "set_manual_iso_sensitivity".
* @param manualIsoSensitivityCapabilitiesBitField: Supported manual iso sensitivity for current photo or
* recording configuration. Empty if "manual" or "manual_iso_sensitivity" exposure modes are not supported.
* @param maxIsoSensitivity: Maximum ISO sensitivity level as set by command "set_max_iso_sensitivity".
* @param maxIsoSensitivitiesCapabilitiesBitField: Supported max iso sensitivity for current photo or recording
* configuration. Empty if setting max iso sensitivity is not supported.
* @param meteringMode: Auto Exposure metering mode.
*/
public default void onExposureSettings(int camId, @Nullable ExposureMode mode, @Nullable ShutterSpeed manualShutterSpeed, long manualShutterSpeedCapabilitiesBitField, @Nullable IsoSensitivity manualIsoSensitivity, long manualIsoSensitivityCapabilitiesBitField, @Nullable IsoSensitivity maxIsoSensitivity, long maxIsoSensitivitiesCapabilitiesBitField, @Nullable AutoExposureMeteringMode meteringMode) {}
/**
* Notify of actual exposure values (different from [exposure_settings](#143-9) values when one of the setting
* is in automatic mode).
*
* @param camId: Id of the camera.
* @param shutterSpeed: Effective shutter speed.
* @param isoSensitivity: Effective ISO sensitivity level.
* @param lock: Auto exposure lock state.
* @param lockRoiX: Auto exposure lock ROI center on x axis, between 0 and 1, relative to streaming image width,
* less than 0 if exposure is not locked with on a ROI.
* @param lockRoiY: Auto exposure lock ROI center on y axis, between 0 and 1, relative to streaming image
* height, less than if exposure is not locked with on a ROI.
* @param lockRoiWidth: Auto exposure lock ROI width, between 0 and 1, relative to streaming image width, less
* than if exposure is not locked with on a ROI.
* @param lockRoiHeight: Auto exposure lock ROI height, between 0 and 1, relative to streaming image height less
* than if exposure is not locked with on a ROI.
*/
public default void onExposure(int camId, @Nullable ShutterSpeed shutterSpeed, @Nullable IsoSensitivity isoSensitivity, @Nullable State lock, float lockRoiX, float lockRoiY, float lockRoiWidth, float lockRoiHeight) {}
/**
* Notify of actual white balance mode
*
* @param camId: Id of the camera.
* @param mode: Actual white balance mode.
* @param temperature: Actual white balance temperature if the mode `custom`, invalid else.
* @param lock: White balance lock state.
*/
public default void onWhiteBalance(int camId, @Nullable WhiteBalanceMode mode, @Nullable WhiteBalanceTemperature temperature, @Nullable State lock) {}
/**
* Notify of actual EV compensation
*
* @param camId: Id of the camera.
* @param value: Actual EV compensation value.
*/
public default void onEvCompensation(int camId, @Nullable EvCompensation value) {}
/**
* Notify of actual anti-flicker mode
*
* @param mode: Anti-flicker mode as set by [set_antiflicker_mode](#143-16).
* @param value: Actual anti-flicker value selected by the drone. When `mode` is `auto`, indicate the actual
* anti-flicker value selected by the drone. (50hz or 60hz) In all other modes, this is the same that `mode`
*/
public default void onAntiflickerMode(@Nullable AntiflickerMode mode, @Nullable AntiflickerMode value) {}
/**
* Notify current style and its saturation, contrast and sharpness values.
*
* @param camId: Id of the camera.
* @param style: Active style.
* @param saturation: Actual saturation value for this style.
* @param saturationMin: Minimum supported value for style saturation.
* @param saturationMax: Maximum supported value for style saturation.
* @param contrast: Actual contrast value for this style.
* @param contrastMin: Minimum supported value for style contrast.
* @param contrastMax: Maximum supported value for style contrast.
* @param sharpness: Actual sharpness value for this style.
* @param sharpnessMin: Minimum supported value for style sharpness.
* @param sharpnessMax: Maximum supported value for style sharpness.
*/
public default void onStyle(int camId, @Nullable Style style, int saturation, int saturationMin, int saturationMax, int contrast, int contrastMin, int contrastMax, int sharpness, int sharpnessMin, int sharpnessMax) {}
/**
* Current camera zoom level.
*
* @param camId: Id of the camera.
* @param level: Actual zoom level. Ignored if `available` is `not_available`.
*/
public default void onZoomLevel(int camId, float level) {}
/**
* Zoom information. This event is never sent if the device doesn't have a zoom.
*
* @param camId: Id of the camera.
* @param available: Tells if zoom is available in the current configuration.
* @param highQualityMaximumLevel: Maximum zoom level without degrading image quality. Ignored if `available` is
* `not_available`.
* @param maximumLevel: Maximum zoom level with image quality degradation. Ignored if `available` is
* `not_available`. Same value than `high_quality_maximum_level` if there is no digital zoom with quality
* degradation.
*/
public default void onZoomInfo(int camId, @Nullable Availability available, float highQualityMaximumLevel, float maximumLevel) {}
/**
* Max zoom speed setting. This setting contains the range and the current value. All values are expressed as
* the tangent of the angle in degrees per seconds.
*
* @param camId: Id of the camera.
* @param min: Minimal bound of the max zoom speed range. Expressed as a tan(deg) / sec.
* @param max: Maximal bound of the max zoom speed range Expressed as a tan(deg) / sec.
* @param current: Current max zoom speed. Expressed as a tan(deg) / sec.
*/
public default void onMaxZoomSpeed(int camId, float min, float max, float current) {}
/**
* Whether zoom change by indicating a velocity is allowed to go on a zoom level that degrades video quality. If
* not allowed, zoom level will stop at the level given by the `high_quality_maximum_level` of the
* [Zoom](143-20) event.
*
* @param camId: Id of the camera.
* @param allowed: 1 if quality degradation is allowed, 0 otherwise.
*/
public default void onZoomVelocityQualityDegradation(int camId, int allowed) {}
/**
* Notify of camera HDR setting.
*
* @param camId: Id of the camera.
* @param value: Actual HDR setting value.
*/
public default void onHdrSetting(int camId, @Nullable State value) {}
/**
* Tells if HDR is available and if it's currently active.
*
* @param camId: Id of the camera.
* @param available: Tells if HDR is available in current configuration.
* @param state: Actual HDR state.
*/
public default void onHdr(int camId, @Nullable Availability available, @Nullable State state) {}
/**
* Notify of camera mode
*
* @param camId: Id of the camera.
* @param mode: Camera mode.
*/
public default void onCameraMode(int camId, @Nullable CameraMode mode) {}
/**
* Notify of camera recording mode
*
* @param camId: Id of the camera.
* @param mode: Camera camera recording mode.
* @param resolution: Recording resolution.
* @param framerate: Recording framerate.
* @param hyperlapse: Hyperlapse value when the recording mode is hyperlapse. Invalid in other modes.
* @param bitrate: Recording bitrate for current configuration (bits/s). Zero if unavailable.
*/
public default void onRecordingMode(int camId, @Nullable RecordingMode mode, @Nullable Resolution resolution, @Nullable Framerate framerate, @Nullable HyperlapseValue hyperlapse, long bitrate) {}
/**
* Notify of camera photo mode
*
* @param camId: Id of the camera.
* @param mode: Camera photo mode.
* @param format: Actual format.
* @param fileFormat: Actual photo file format.
* @param burst: Actual burst value when the photo mode is burst. Invalid in other modes.
* @param bracketing: Actual bracketing value when the photo mode is bracketing. Invalid in other modes.
* @param captureInterval: Actual time-lapse interval value (in seconds) when the photo mode is time_lapse.
* Actual GPS-lapse interval value (in meters) when the photo mode is gps_lapse. Ignored in other modes.
*/
public default void onPhotoMode(int camId, @Nullable PhotoMode mode, @Nullable PhotoFormat format, @Nullable PhotoFileFormat fileFormat, @Nullable BurstValue burst, @Nullable BracketingPreset bracketing, float captureInterval) {}
/**
* Notify of actual streaming mode setting.
*
* @param camId: Id of the camera.
* @param value: Actual streaming mode setting.
*/
public default void onStreamingMode(int camId, @Nullable StreamingMode value) {}
/**
* Sent as progress and result of [take_photo](#143-39) command. This event is not sent during the connection.
*
* @param camId: Id of the camera.
* @param result: Progress or result value: - `taking_photo` indicate that the camera starts taking photo (or
* multiple photos when mode is `burst` or `bracketing`). - `photo_taken` indicate that one photo has been taken
* and is about be saved to disk. In `bracketing` mode, this event is sent when the last photo of the bracketing
* sequence has been taken. In `burst` mode this event is sent after each photo but maximum every 100ms. -
* `photo_saved` indicate the media containing the photo has been saved to disk. In `burst` or `bracketing`
* mode, indicate that all photos of the burst or bracketing sequence have been saved to disk. Other results are
* errors.
* @param photoCount: Only valid when result is `photo_taken`, indicate the number of photo taken in the
* sequence.
* @param mediaId: Only valid when result is `photo_saved`, indicate the media id containing taken photo(s).
*/
public default void onPhotoProgress(int camId, @Nullable PhotoResult result, int photoCount, String mediaId) {}
/**
* Current photo camera state. Indicates if the camera is ready to take a photo.
*
* @param camId: Id of the camera.
* @param available: Tell if photo feature is available in current mode.
* @param state: Tell if photo feature is currently active.
*/
public default void onPhotoState(int camId, @Nullable Availability available, @Nullable State state) {}
/**
* Sent when recording state change. This event is not sent during the connection.
*
* @param camId: Id of the camera.
* @param result: Current recording result. Indicate if recording has started/stopped.
* @param mediaId: Recorded media_id. Only valid when result is `stopped` or `stopped_no_storage_space`.
*/
public default void onRecordingProgress(int camId, @Nullable RecordingResult result, String mediaId) {}
/**
* Current recording state. Indicates if the camera is currently recording.
*
* @param camId: Id of the camera.
* @param available: Tell if recording feature is available in current mode.
* @param state: Current recording state.
* @param startTimestamp: If state is `active`, the timestamp if the start of the recording, in milliseconds
* since 00:00:00 UTC on 1 January 1970.
*/
public default void onRecordingState(int camId, @Nullable Availability available, @Nullable State state, long startTimestamp) {}
/**
*
* @param camId: Id of the camera.
* @param state: Auto-record state.
*/
public default void onAutorecord(int camId, @Nullable State state) {}
/**
* Current camera state. Indicates which cameras are currently active.
*
* @param activeCameras: Bitfield showing which cameras are active. A camera is active when the bit
* corresponding to its cam_id is 1. A camera is inactive when the bit corresponding to its cam_id is 0.
*/
public default void onCameraStates(long activeCameras) {}
/**
* Remaining time or distance before next photo.
*
* @param mode: Selected mode: only `time_lapse` and `gps_lapse` are supported
* @param remaining: In time_lapse photo_mode: remaining time in seconds before next photo In gps_lapse
* photo_mode: remaining distance in meters before next photo
*/
public default void onNextPhotoDelay(@Nullable PhotoMode mode, float remaining) {}
/**
*
* @param camId: Id of the camera.
* @param minBoundYaw: Lower bound of the alignment offset that can be set on the yaw axis, in degrees
* @param maxBoundYaw: Upper bound of the alignment offset that can be set on the yaw axis, in degrees
* @param currentYaw: Current alignment offset applied to the yaw axis, in degrees
* @param minBoundPitch: Lower bound of the alignment offset that can be set on the pitch axis, in degrees
* @param maxBoundPitch: Upper bound of the alignment offset that can be set on the pitch axis, in degrees
* @param currentPitch: Current alignment offset applied to the pitch axis, in degrees
* @param minBoundRoll: Lower bound of the alignment offset that can be set on the roll axis, in degrees
* @param maxBoundRoll: Upper bound of the alignment offset that can be set on the roll axis, in degrees
* @param currentRoll: Current alignment offset applied to the roll axis, in degrees
*/
public default void onAlignmentOffsets(int camId, float minBoundYaw, float maxBoundYaw, float currentYaw, float minBoundPitch, float maxBoundPitch, float currentPitch, float minBoundRoll, float maxBoundRoll, float currentRoll) {}
}
private static void cameraCapabilities(Callback cb, int camId, int model, int exposureModesBitField, int exposureLockSupported, int exposureRoiLockSupported, long evCompensationsBitField, int whiteBalanceModesBitField, long customWhiteBalanceTemperaturesBitField, int whiteBalanceLockSupported, int stylesBitField, int cameraModesBitField, int hyperlapseValuesBitField, int bracketingPresetsBitField, int burstValuesBitField, int streamingModesBitField, float timelapseIntervalMin, float gpslapseIntervalMin, int autoExposureMeteringModesBitField) {
ArsdkFeatureCamera.Model enumModel = ArsdkFeatureCamera.Model.fromValue(model);
if (enumModel == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Model value " + model);
ArsdkFeatureCamera.Supported enumExposurelocksupported = ArsdkFeatureCamera.Supported.fromValue(exposureLockSupported);
if (enumExposurelocksupported == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + exposureLockSupported);
ArsdkFeatureCamera.Supported enumExposureroilocksupported = ArsdkFeatureCamera.Supported.fromValue(exposureRoiLockSupported);
if (enumExposureroilocksupported == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + exposureRoiLockSupported);
ArsdkFeatureCamera.Supported enumWhitebalancelocksupported = ArsdkFeatureCamera.Supported.fromValue(whiteBalanceLockSupported);
if (enumWhitebalancelocksupported == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + whiteBalanceLockSupported);
try {
cb.onCameraCapabilities(camId, enumModel, exposureModesBitField, enumExposurelocksupported, enumExposureroilocksupported, evCompensationsBitField, whiteBalanceModesBitField, customWhiteBalanceTemperaturesBitField, enumWhitebalancelocksupported, stylesBitField, cameraModesBitField, hyperlapseValuesBitField, bracketingPresetsBitField, burstValuesBitField, streamingModesBitField, timelapseIntervalMin, gpslapseIntervalMin, autoExposureMeteringModesBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.camera_capabilities [cam_id: " + camId + ", model: " + model + ", exposure_modes: " + exposureModesBitField + ", exposure_lock_supported: " + exposureLockSupported + ", exposure_roi_lock_supported: " + exposureRoiLockSupported + ", ev_compensations: " + evCompensationsBitField + ", white_balance_modes: " + whiteBalanceModesBitField + ", custom_white_balance_temperatures: " + customWhiteBalanceTemperaturesBitField + ", white_balance_lock_supported: " + whiteBalanceLockSupported + ", styles: " + stylesBitField + ", camera_modes: " + cameraModesBitField + ", hyperlapse_values: " + hyperlapseValuesBitField + ", bracketing_presets: " + bracketingPresetsBitField + ", burst_values: " + burstValuesBitField + ", streaming_modes: " + streamingModesBitField + ", timelapse_interval_min: " + timelapseIntervalMin + ", gpslapse_interval_min: " + gpslapseIntervalMin + ", auto_exposure_metering_modes: " + autoExposureMeteringModesBitField + "]", e);
}
}
private static void recordingCapabilities(Callback cb, int id, int recordingModesBitField, int resolutionsBitField, int frameratesBitField, int hdr, int listFlagsBitField) {
ArsdkFeatureCamera.Supported enumHdr = ArsdkFeatureCamera.Supported.fromValue(hdr);
if (enumHdr == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + hdr);
try {
cb.onRecordingCapabilities(id, recordingModesBitField, resolutionsBitField, frameratesBitField, enumHdr, listFlagsBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_capabilities [id: " + id + ", recording_modes: " + recordingModesBitField + ", resolutions: " + resolutionsBitField + ", framerates: " + frameratesBitField + ", hdr: " + hdr + ", list_flags: " + listFlagsBitField + "]", e);
}
}
private static void photoCapabilities(Callback cb, int id, int photoModesBitField, int photoFormatsBitField, int photoFileFormatsBitField, int hdr, int listFlagsBitField) {
ArsdkFeatureCamera.Supported enumHdr = ArsdkFeatureCamera.Supported.fromValue(hdr);
if (enumHdr == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Supported value " + hdr);
try {
cb.onPhotoCapabilities(id, photoModesBitField, photoFormatsBitField, photoFileFormatsBitField, enumHdr, listFlagsBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_capabilities [id: " + id + ", photo_modes: " + photoModesBitField + ", photo_formats: " + photoFormatsBitField + ", photo_file_formats: " + photoFileFormatsBitField + ", hdr: " + hdr + ", list_flags: " + listFlagsBitField + "]", e);
}
}
private static void antiflickerCapabilities(Callback cb, int supportedModesBitField) {
try {
cb.onAntiflickerCapabilities(supportedModesBitField);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.antiflicker_capabilities [supported_modes: " + supportedModesBitField + "]", e);
}
}
private static void exposureSettings(Callback cb, int camId, int mode, int manualShutterSpeed, long manualShutterSpeedCapabilitiesBitField, int manualIsoSensitivity, long manualIsoSensitivityCapabilitiesBitField, int maxIsoSensitivity, long maxIsoSensitivitiesCapabilitiesBitField, int meteringMode) {
ArsdkFeatureCamera.ExposureMode enumMode = ArsdkFeatureCamera.ExposureMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.ExposureMode value " + mode);
ArsdkFeatureCamera.ShutterSpeed enumManualshutterspeed = ArsdkFeatureCamera.ShutterSpeed.fromValue(manualShutterSpeed);
if (enumManualshutterspeed == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.ShutterSpeed value " + manualShutterSpeed);
ArsdkFeatureCamera.IsoSensitivity enumManualisosensitivity = ArsdkFeatureCamera.IsoSensitivity.fromValue(manualIsoSensitivity);
if (enumManualisosensitivity == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.IsoSensitivity value " + manualIsoSensitivity);
ArsdkFeatureCamera.IsoSensitivity enumMaxisosensitivity = ArsdkFeatureCamera.IsoSensitivity.fromValue(maxIsoSensitivity);
if (enumMaxisosensitivity == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.IsoSensitivity value " + maxIsoSensitivity);
ArsdkFeatureCamera.AutoExposureMeteringMode enumMeteringmode = ArsdkFeatureCamera.AutoExposureMeteringMode.fromValue(meteringMode);
if (enumMeteringmode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.AutoExposureMeteringMode value " + meteringMode);
try {
cb.onExposureSettings(camId, enumMode, enumManualshutterspeed, manualShutterSpeedCapabilitiesBitField, enumManualisosensitivity, manualIsoSensitivityCapabilitiesBitField, enumMaxisosensitivity, maxIsoSensitivitiesCapabilitiesBitField, enumMeteringmode);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.exposure_settings [cam_id: " + camId + ", mode: " + mode + ", manual_shutter_speed: " + manualShutterSpeed + ", manual_shutter_speed_capabilities: " + manualShutterSpeedCapabilitiesBitField + ", manual_iso_sensitivity: " + manualIsoSensitivity + ", manual_iso_sensitivity_capabilities: " + manualIsoSensitivityCapabilitiesBitField + ", max_iso_sensitivity: " + maxIsoSensitivity + ", max_iso_sensitivities_capabilities: " + maxIsoSensitivitiesCapabilitiesBitField + ", metering_mode: " + meteringMode + "]", e);
}
}
private static void exposure(Callback cb, int camId, int shutterSpeed, int isoSensitivity, int lock, float lockRoiX, float lockRoiY, float lockRoiWidth, float lockRoiHeight) {
ArsdkFeatureCamera.ShutterSpeed enumShutterspeed = ArsdkFeatureCamera.ShutterSpeed.fromValue(shutterSpeed);
if (enumShutterspeed == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.ShutterSpeed value " + shutterSpeed);
ArsdkFeatureCamera.IsoSensitivity enumIsosensitivity = ArsdkFeatureCamera.IsoSensitivity.fromValue(isoSensitivity);
if (enumIsosensitivity == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.IsoSensitivity value " + isoSensitivity);
ArsdkFeatureCamera.State enumLock = ArsdkFeatureCamera.State.fromValue(lock);
if (enumLock == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + lock);
try {
cb.onExposure(camId, enumShutterspeed, enumIsosensitivity, enumLock, lockRoiX, lockRoiY, lockRoiWidth, lockRoiHeight);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.exposure [cam_id: " + camId + ", shutter_speed: " + shutterSpeed + ", iso_sensitivity: " + isoSensitivity + ", lock: " + lock + ", lock_roi_x: " + lockRoiX + ", lock_roi_y: " + lockRoiY + ", lock_roi_width: " + lockRoiWidth + ", lock_roi_height: " + lockRoiHeight + "]", e);
}
}
private static void whiteBalance(Callback cb, int camId, int mode, int temperature, int lock) {
ArsdkFeatureCamera.WhiteBalanceMode enumMode = ArsdkFeatureCamera.WhiteBalanceMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.WhiteBalanceMode value " + mode);
ArsdkFeatureCamera.WhiteBalanceTemperature enumTemperature = ArsdkFeatureCamera.WhiteBalanceTemperature.fromValue(temperature);
if (enumTemperature == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.WhiteBalanceTemperature value " + temperature);
ArsdkFeatureCamera.State enumLock = ArsdkFeatureCamera.State.fromValue(lock);
if (enumLock == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + lock);
try {
cb.onWhiteBalance(camId, enumMode, enumTemperature, enumLock);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.white_balance [cam_id: " + camId + ", mode: " + mode + ", temperature: " + temperature + ", lock: " + lock + "]", e);
}
}
private static void evCompensation(Callback cb, int camId, int value) {
ArsdkFeatureCamera.EvCompensation enumValue = ArsdkFeatureCamera.EvCompensation.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.EvCompensation value " + value);
try {
cb.onEvCompensation(camId, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.ev_compensation [cam_id: " + camId + ", value: " + value + "]", e);
}
}
private static void antiflickerMode(Callback cb, int mode, int value) {
ArsdkFeatureCamera.AntiflickerMode enumMode = ArsdkFeatureCamera.AntiflickerMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.AntiflickerMode value " + mode);
ArsdkFeatureCamera.AntiflickerMode enumValue = ArsdkFeatureCamera.AntiflickerMode.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.AntiflickerMode value " + value);
try {
cb.onAntiflickerMode(enumMode, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.antiflicker_mode [mode: " + mode + ", value: " + value + "]", e);
}
}
private static void style(Callback cb, int camId, int style, int saturation, int saturationMin, int saturationMax, int contrast, int contrastMin, int contrastMax, int sharpness, int sharpnessMin, int sharpnessMax) {
ArsdkFeatureCamera.Style enumStyle = ArsdkFeatureCamera.Style.fromValue(style);
if (enumStyle == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Style value " + style);
try {
cb.onStyle(camId, enumStyle, saturation, saturationMin, saturationMax, contrast, contrastMin, contrastMax, sharpness, sharpnessMin, sharpnessMax);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.style [cam_id: " + camId + ", style: " + style + ", saturation: " + saturation + ", saturation_min: " + saturationMin + ", saturation_max: " + saturationMax + ", contrast: " + contrast + ", contrast_min: " + contrastMin + ", contrast_max: " + contrastMax + ", sharpness: " + sharpness + ", sharpness_min: " + sharpnessMin + ", sharpness_max: " + sharpnessMax + "]", e);
}
}
private static void zoomLevel(Callback cb, int camId, float level) {
try {
cb.onZoomLevel(camId, level);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.zoom_level [cam_id: " + camId + ", level: " + level + "]", e);
}
}
private static void zoomInfo(Callback cb, int camId, int available, float highQualityMaximumLevel, float maximumLevel) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
try {
cb.onZoomInfo(camId, enumAvailable, highQualityMaximumLevel, maximumLevel);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.zoom_info [cam_id: " + camId + ", available: " + available + ", high_quality_maximum_level: " + highQualityMaximumLevel + ", maximum_level: " + maximumLevel + "]", e);
}
}
private static void maxZoomSpeed(Callback cb, int camId, float min, float max, float current) {
try {
cb.onMaxZoomSpeed(camId, min, max, current);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.max_zoom_speed [cam_id: " + camId + ", min: " + min + ", max: " + max + ", current: " + current + "]", e);
}
}
private static void zoomVelocityQualityDegradation(Callback cb, int camId, int allowed) {
try {
cb.onZoomVelocityQualityDegradation(camId, allowed);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.zoom_velocity_quality_degradation [cam_id: " + camId + ", allowed: " + allowed + "]", e);
}
}
private static void hdrSetting(Callback cb, int camId, int value) {
ArsdkFeatureCamera.State enumValue = ArsdkFeatureCamera.State.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + value);
try {
cb.onHdrSetting(camId, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.hdr_setting [cam_id: " + camId + ", value: " + value + "]", e);
}
}
private static void hdr(Callback cb, int camId, int available, int state) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onHdr(camId, enumAvailable, enumState);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.hdr [cam_id: " + camId + ", available: " + available + ", state: " + state + "]", e);
}
}
private static void cameraMode(Callback cb, int camId, int mode) {
ArsdkFeatureCamera.CameraMode enumMode = ArsdkFeatureCamera.CameraMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.CameraMode value " + mode);
try {
cb.onCameraMode(camId, enumMode);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.camera_mode [cam_id: " + camId + ", mode: " + mode + "]", e);
}
}
private static void recordingMode(Callback cb, int camId, int mode, int resolution, int framerate, int hyperlapse, long bitrate) {
ArsdkFeatureCamera.RecordingMode enumMode = ArsdkFeatureCamera.RecordingMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.RecordingMode value " + mode);
ArsdkFeatureCamera.Resolution enumResolution = ArsdkFeatureCamera.Resolution.fromValue(resolution);
if (enumResolution == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Resolution value " + resolution);
ArsdkFeatureCamera.Framerate enumFramerate = ArsdkFeatureCamera.Framerate.fromValue(framerate);
if (enumFramerate == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Framerate value " + framerate);
ArsdkFeatureCamera.HyperlapseValue enumHyperlapse = ArsdkFeatureCamera.HyperlapseValue.fromValue(hyperlapse);
if (enumHyperlapse == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.HyperlapseValue value " + hyperlapse);
try {
cb.onRecordingMode(camId, enumMode, enumResolution, enumFramerate, enumHyperlapse, bitrate);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_mode [cam_id: " + camId + ", mode: " + mode + ", resolution: " + resolution + ", framerate: " + framerate + ", hyperlapse: " + hyperlapse + ", bitrate: " + bitrate + "]", e);
}
}
private static void photoMode(Callback cb, int camId, int mode, int format, int fileFormat, int burst, int bracketing, float captureInterval) {
ArsdkFeatureCamera.PhotoMode enumMode = ArsdkFeatureCamera.PhotoMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoMode value " + mode);
ArsdkFeatureCamera.PhotoFormat enumFormat = ArsdkFeatureCamera.PhotoFormat.fromValue(format);
if (enumFormat == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoFormat value " + format);
ArsdkFeatureCamera.PhotoFileFormat enumFileformat = ArsdkFeatureCamera.PhotoFileFormat.fromValue(fileFormat);
if (enumFileformat == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoFileFormat value " + fileFormat);
ArsdkFeatureCamera.BurstValue enumBurst = ArsdkFeatureCamera.BurstValue.fromValue(burst);
if (enumBurst == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.BurstValue value " + burst);
ArsdkFeatureCamera.BracketingPreset enumBracketing = ArsdkFeatureCamera.BracketingPreset.fromValue(bracketing);
if (enumBracketing == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.BracketingPreset value " + bracketing);
try {
cb.onPhotoMode(camId, enumMode, enumFormat, enumFileformat, enumBurst, enumBracketing, captureInterval);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_mode [cam_id: " + camId + ", mode: " + mode + ", format: " + format + ", file_format: " + fileFormat + ", burst: " + burst + ", bracketing: " + bracketing + ", capture_interval: " + captureInterval + "]", e);
}
}
private static void streamingMode(Callback cb, int camId, int value) {
ArsdkFeatureCamera.StreamingMode enumValue = ArsdkFeatureCamera.StreamingMode.fromValue(value);
if (enumValue == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.StreamingMode value " + value);
try {
cb.onStreamingMode(camId, enumValue);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.streaming_mode [cam_id: " + camId + ", value: " + value + "]", e);
}
}
private static void photoProgress(Callback cb, int camId, int result, int photoCount, String mediaId) {
ArsdkFeatureCamera.PhotoResult enumResult = ArsdkFeatureCamera.PhotoResult.fromValue(result);
if (enumResult == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoResult value " + result);
try {
cb.onPhotoProgress(camId, enumResult, photoCount, mediaId);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_progress [cam_id: " + camId + ", result: " + result + ", photo_count: " + photoCount + ", media_id: " + mediaId + "]", e);
}
}
private static void photoState(Callback cb, int camId, int available, int state) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onPhotoState(camId, enumAvailable, enumState);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.photo_state [cam_id: " + camId + ", available: " + available + ", state: " + state + "]", e);
}
}
private static void recordingProgress(Callback cb, int camId, int result, String mediaId) {
ArsdkFeatureCamera.RecordingResult enumResult = ArsdkFeatureCamera.RecordingResult.fromValue(result);
if (enumResult == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.RecordingResult value " + result);
try {
cb.onRecordingProgress(camId, enumResult, mediaId);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_progress [cam_id: " + camId + ", result: " + result + ", media_id: " + mediaId + "]", e);
}
}
private static void recordingState(Callback cb, int camId, int available, int state, long startTimestamp) {
ArsdkFeatureCamera.Availability enumAvailable = ArsdkFeatureCamera.Availability.fromValue(available);
if (enumAvailable == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.Availability value " + available);
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onRecordingState(camId, enumAvailable, enumState, startTimestamp);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.recording_state [cam_id: " + camId + ", available: " + available + ", state: " + state + ", start_timestamp: " + startTimestamp + "]", e);
}
}
private static void autorecord(Callback cb, int camId, int state) {
ArsdkFeatureCamera.State enumState = ArsdkFeatureCamera.State.fromValue(state);
if (enumState == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.State value " + state);
try {
cb.onAutorecord(camId, enumState);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.autorecord [cam_id: " + camId + ", state: " + state + "]", e);
}
}
private static void cameraStates(Callback cb, long activeCameras) {
try {
cb.onCameraStates(activeCameras);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.camera_states [active_cameras: " + activeCameras + "]", e);
}
}
private static void nextPhotoDelay(Callback cb, int mode, float remaining) {
ArsdkFeatureCamera.PhotoMode enumMode = ArsdkFeatureCamera.PhotoMode.fromValue(mode);
if (enumMode == null) ULog.e(TAG, "Unsupported ArsdkFeatureCamera.PhotoMode value " + mode);
try {
cb.onNextPhotoDelay(enumMode, remaining);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.next_photo_delay [mode: " + mode + ", remaining: " + remaining + "]", e);
}
}
private static void alignmentOffsets(Callback cb, int camId, float minBoundYaw, float maxBoundYaw, float currentYaw, float minBoundPitch, float maxBoundPitch, float currentPitch, float minBoundRoll, float maxBoundRoll, float currentRoll) {
try {
cb.onAlignmentOffsets(camId, minBoundYaw, maxBoundYaw, currentYaw, minBoundPitch, maxBoundPitch, currentPitch, minBoundRoll, maxBoundRoll, currentRoll);
} catch (ArsdkCommand.RejectedEventException e) {
ULog.e(TAG, "Rejected event: camera.alignment_offsets [cam_id: " + camId + ", min_bound_yaw: " + minBoundYaw + ", max_bound_yaw: " + maxBoundYaw + ", current_yaw: " + currentYaw + ", min_bound_pitch: " + minBoundPitch + ", max_bound_pitch: " + maxBoundPitch + ", current_pitch: " + currentPitch + ", min_bound_roll: " + minBoundRoll + ", max_bound_roll: " + maxBoundRoll + ", current_roll: " + currentRoll + "]", e);
}
}
/**
* Sets exposure mode, shutter speed, iso sensitivity and maximum iso sensitivity.
*
* @param camId: Id of the camera.
* @param mode: Requested exposure mode: Auto, Manual Shutter Speed, Manual ISO or Manual.
* @param shutterSpeed: Requested shutter speed, ignored if mode is not Manual Shutter Speed or Manual.
* @param isoSensitivity: Requested ISO sensitivity level, ignored if mode is not Manual ISO or Manual.
* @param maxIsoSensitivity: Requested maximum ISO sensitivity level, ignored is not Auto. This value define the
* maximum iso sensitivity the autoexposure engine can use to adjust exposure.
* @param meteringMode: Auto Exposure metering mode, ignored if mode is Manual
*/
public static ArsdkCommand encodeSetExposureSettings(int camId, @NonNull ExposureMode mode, @NonNull ShutterSpeed shutterSpeed, @NonNull IsoSensitivity isoSensitivity, @NonNull IsoSensitivity maxIsoSensitivity, @NonNull AutoExposureMeteringMode meteringMode) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetExposureSettings(cmd.getNativePtr(), camId, mode.value, shutterSpeed.value, isoSensitivity.value, maxIsoSensitivity.value, meteringMode.value);
return cmd;
}
/**
* Lock shutter speed and iso sensitivity to current values. Valid for all exposure modes exepted `manual`. Auto
* exposure lock is automatically removed when the exposure mode is changed.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeLockExposure(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeLockExposure(cmd.getNativePtr(), camId);
return cmd;
}
/**
* Lock shutter speed and iso sensitivity optimized on a specific region. Valid for all exposure modes exepted
* `manual` Auto exposure lock is automatically removed when the exposure mode is changed.
*
* @param camId: Id of the camera.
* @param roiCenterX: ROI center on x axis. between 0 and 1, relative to streaming image width.
* @param roiCenterY: ROI center on y axis. between 0 and 1, relative to streaming image height.
*/
public static ArsdkCommand encodeLockExposureOnRoi(int camId, float roiCenterX, float roiCenterY) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeLockExposureOnRoi(cmd.getNativePtr(), camId, roiCenterX, roiCenterY);
return cmd;
}
/**
* Valid when exposure is locked.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeUnlockExposure(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeUnlockExposure(cmd.getNativePtr(), camId);
return cmd;
}
/**
* Change the white balance mode and custom temperature.
*
* @param camId: Id of the camera.
* @param mode: Requested white balance mode.
* @param temperature: Requested white balance temperature when mode is `custom`. Ignored else.
*/
public static ArsdkCommand encodeSetWhiteBalance(int camId, @NonNull WhiteBalanceMode mode, @NonNull WhiteBalanceTemperature temperature) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetWhiteBalance(cmd.getNativePtr(), camId, mode.value, temperature.value);
return cmd;
}
/**
* Lock/unlock white balance to current value. Valid when white balance mode not `custom`. White balance lock is
* automatically removed when the white balance mode is changed.
*
* @param camId: Id of the camera.
* @param state: Requested lock state.
*/
public static ArsdkCommand encodeSetWhiteBalanceLock(int camId, @NonNull State state) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetWhiteBalanceLock(cmd.getNativePtr(), camId, state.value);
return cmd;
}
/**
* Change the EV compensation value.
*
* @param camId: Id of the camera.
* @param value: Requested EV compensation value.
*/
public static ArsdkCommand encodeSetEvCompensation(int camId, @NonNull EvCompensation value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetEvCompensation(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Change the anti-flicker mode.
*
* @param mode: Requested anti-flicker mode.
*/
public static ArsdkCommand encodeSetAntiflickerMode(@NonNull AntiflickerMode mode) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetAntiflickerMode(cmd.getNativePtr(), mode.value);
return cmd;
}
/**
* Change the active style.
*
* @param camId: Id of the camera.
* @param style: Style to activate.
*/
public static ArsdkCommand encodeSetStyle(int camId, @NonNull Style style) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetStyle(cmd.getNativePtr(), camId, style.value);
return cmd;
}
/**
* Change style saturation, contrast and sharpness of the current active style.
*
* @param camId: Id of the camera.
* @param saturation: Requested saturation value for this style.
* @param contrast: Requested contrast value for this style.
* @param sharpness: Requested sharpness value for this style.
*/
public static ArsdkCommand encodeSetStyleParams(int camId, int saturation, int contrast, int sharpness) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetStyleParams(cmd.getNativePtr(), camId, saturation, contrast, sharpness);
return cmd;
}
/**
*
* @param camId: id of the camera.
* @param controlMode: Mode of changing the zoom. This parameter will characterize following parameters units.
* @param target: Zoom target. Units depend on the `control_mode` value: - `level`: value is in zoom level -
* `velocity`, value is in signed ratio (from -1 to 1) of the [MaxZoomSpeed](#143-24) `current` parameter. Negative
* values will produce a zoom out, positive values produce a zoom in.
*/
public static ArsdkCommand encodeSetZoomTarget(int camId, @NonNull ZoomControlMode controlMode, float target) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetZoomTarget(cmd.getNativePtr(), camId, controlMode.value, target);
return cmd;
}
/**
* Set the max zoom speed setting. You can get bounds using [MaxZoomSpeed](#143-25).
*
* @param camId: Id of the camera.
* @param max: Desired current max zoom speed. Should lay between the bounds given by [MaxZoomSpeed](#143-25).
* Expressed as a tan(deg) / sec.
*/
public static ArsdkCommand encodeSetMaxZoomSpeed(int camId, float max) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetMaxZoomSpeed(cmd.getNativePtr(), camId, max);
return cmd;
}
/**
* Set the max zoom velocity.
*
* @param camId: Id of the camera.
* @param allow: 1 to allow quality degradation, 0 otherwise.
*/
public static ArsdkCommand encodeSetZoomVelocityQualityDegradation(int camId, int allow) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetZoomVelocityQualityDegradation(cmd.getNativePtr(), camId, allow);
return cmd;
}
/**
* Change HDR setting. if HDR setting is `active`, HDR will be used when supported in active configuration.
*
* @param camId: Id of the camera.
* @param value: Requested HDR setting value.
*/
public static ArsdkCommand encodeSetHdrSetting(int camId, @NonNull State value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetHdrSetting(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Change camera mode.
*
* @param camId: Id of the camera.
* @param value: Requested camera mode.
*/
public static ArsdkCommand encodeSetCameraMode(int camId, @NonNull CameraMode value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetCameraMode(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Change recording mode and parameters to be used when the camera is in mode recording. Note that if the camera is
* in photo modes, actual camera mode is not changed, new recording mode and parameters are saved and are apply when
* the camera mode is changed to `recording`.
*
* @param camId: Id of the camera.
* @param mode: Requested camera recording mode.
* @param resolution: Requested recording resolution.
* @param framerate: Requested recording framerate.
* @param hyperlapse: Requested hyperlapse value when the recording mode is hyperlapse. Ignored in other modes
*/
public static ArsdkCommand encodeSetRecordingMode(int camId, @NonNull RecordingMode mode, @NonNull Resolution resolution, @NonNull Framerate framerate, @NonNull HyperlapseValue hyperlapse) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetRecordingMode(cmd.getNativePtr(), camId, mode.value, resolution.value, framerate.value, hyperlapse.value);
return cmd;
}
/**
* Change photo mode and parameters to be used when the camera is in mode photo. Note that if the camera is in
* recording modes, actual camera mode is not changed, new photo mode and parameters are saved and are apply when
* the camera mode is changed to `photo`.
*
* @param camId: Id of the camera.
* @param mode: Requested camera photo mode.
* @param format: Requested photo format.
* @param fileFormat: Requested photo file format.
* @param burst: Requested burst value when the photo mode is burst. Ignored in other modes.
* @param bracketing: Requested bracketing value when the photo mode is bracketing. Ignored in other modes.
* @param captureInterval: Requested time-lapse interval value (in seconds) when the photo mode is time_lapse.
* Requested GPS-lapse interval value (in meters) when the photo mode is gps_lapse. Ignored in other modes.
*/
public static ArsdkCommand encodeSetPhotoMode(int camId, @NonNull PhotoMode mode, @NonNull PhotoFormat format, @NonNull PhotoFileFormat fileFormat, @NonNull BurstValue burst, @NonNull BracketingPreset bracketing, float captureInterval) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetPhotoMode(cmd.getNativePtr(), camId, mode.value, format.value, fileFormat.value, burst.value, bracketing.value, captureInterval);
return cmd;
}
/**
* Change streaming mode setting.
*
* @param camId: Id of the camera.
* @param value: New streaming mode.
*/
public static ArsdkCommand encodeSetStreamingMode(int camId, @NonNull StreamingMode value) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetStreamingMode(cmd.getNativePtr(), camId, value.value);
return cmd;
}
/**
* Take a photo. Can be sent when `photo_state` is `available`.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeTakePhoto(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeTakePhoto(cmd.getNativePtr(), camId);
return cmd;
}
/**
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeStartRecording(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeStartRecording(cmd.getNativePtr(), camId);
return cmd;
}
/**
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeStopRecording(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeStopRecording(cmd.getNativePtr(), camId);
return cmd;
}
/**
* When auto-record is enabled, if the drone is in recording mode, recording starts when taking-off and stops after
* landing.
*
* @param camId: Id of the camera.
* @param state: Requested auto-record state.
*/
public static ArsdkCommand encodeSetAutorecord(int camId, @NonNull State state) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetAutorecord(cmd.getNativePtr(), camId, state.value);
return cmd;
}
/**
*
* @param camId: id of the camera.
*/
public static ArsdkCommand encodeResetZoom(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeResetZoom(cmd.getNativePtr(), camId);
return cmd;
}
/**
* Stops an ongoing photos capture. Only for `time_lapse` and `gps_lapse` `photo_mode`. Only when `photo_state` is
* `available` and `active`.
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeStopPhoto(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeStopPhoto(cmd.getNativePtr(), camId);
return cmd;
}
/**
*
* @param camId: Id of the camera.
* @param yaw: Alignment offset, in degrees, that should be applied to the yaw axis. This value will be clamped
* between [alignment_offsets](#143-52) min_bound_yaw and max_bound_yaw
* @param pitch: Alignment offset, in degrees, that should be applied to the pitch axis. This value will be clamped
* between [alignment_offsets](#143-52) min_bound_pitch and max_bound_pitch
* @param roll: Alignment offset, in degrees, that should be applied to the roll axis. This value will be clamped
* between [alignment_offsets](#143-52) min_bound_roll and max_bound_roll
*/
public static ArsdkCommand encodeSetAlignmentOffsets(int camId, float yaw, float pitch, float roll) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeSetAlignmentOffsets(cmd.getNativePtr(), camId, yaw, pitch, roll);
return cmd;
}
/**
*
* @param camId: Id of the camera.
*/
public static ArsdkCommand encodeResetAlignmentOffsets(int camId) {
ArsdkCommand cmd = ArsdkCommand.Pool.DEFAULT.obtain();
nativeEncodeResetAlignmentOffsets(cmd.getNativePtr(), camId);
return cmd;
}
private static native int nativeDecode(long nativeCmd, Callback callback);
private static native void nativeClassInit();
static { nativeClassInit(); }
private static native int nativeEncodeSetExposureSettings(long nativeCmd, int cam_id, int mode, int shutter_speed, int iso_sensitivity, int max_iso_sensitivity, int metering_mode);
private static native int nativeEncodeLockExposure(long nativeCmd, int cam_id);
private static native int nativeEncodeLockExposureOnRoi(long nativeCmd, int cam_id, float roi_center_x, float roi_center_y);
private static native int nativeEncodeUnlockExposure(long nativeCmd, int cam_id);
private static native int nativeEncodeSetWhiteBalance(long nativeCmd, int cam_id, int mode, int temperature);
private static native int nativeEncodeSetWhiteBalanceLock(long nativeCmd, int cam_id, int state);
private static native int nativeEncodeSetEvCompensation(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeSetAntiflickerMode(long nativeCmd, int mode);
private static native int nativeEncodeSetStyle(long nativeCmd, int cam_id, int style);
private static native int nativeEncodeSetStyleParams(long nativeCmd, int cam_id, int saturation, int contrast, int sharpness);
private static native int nativeEncodeSetZoomTarget(long nativeCmd, int cam_id, int control_mode, float target);
private static native int nativeEncodeSetMaxZoomSpeed(long nativeCmd, int cam_id, float max);
private static native int nativeEncodeSetZoomVelocityQualityDegradation(long nativeCmd, int cam_id, int allow);
private static native int nativeEncodeSetHdrSetting(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeSetCameraMode(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeSetRecordingMode(long nativeCmd, int cam_id, int mode, int resolution, int framerate, int hyperlapse);
private static native int nativeEncodeSetPhotoMode(long nativeCmd, int cam_id, int mode, int format, int file_format, int burst, int bracketing, float capture_interval);
private static native int nativeEncodeSetStreamingMode(long nativeCmd, int cam_id, int value);
private static native int nativeEncodeTakePhoto(long nativeCmd, int cam_id);
private static native int nativeEncodeStartRecording(long nativeCmd, int cam_id);
private static native int nativeEncodeStopRecording(long nativeCmd, int cam_id);
private static native int nativeEncodeSetAutorecord(long nativeCmd, int cam_id, int state);
private static native int nativeEncodeResetZoom(long nativeCmd, int cam_id);
private static native int nativeEncodeStopPhoto(long nativeCmd, int cam_id);
private static native int nativeEncodeSetAlignmentOffsets(long nativeCmd, int cam_id, float yaw, float pitch, float roll);
private static native int nativeEncodeResetAlignmentOffsets(long nativeCmd, int cam_id);
}
| 150,005 | 0.571001 | 0.557448 | 4,433 | 32.838257 | 42.065231 | 994 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.443718 | false | false | 4 |
aae29c6baca8c283da60d01728d3cda0342cb558 | 17,824,114,335,994 | cc68c3e51e8c4dfc3eb22ca6fca1796e2c5d9abf | /model/src/main/java/annotations/projeto/PontoContarTipoTransacao.java | d5a014964871ec47334baa47f227949e6f6ec167 | [] | no_license | aadsp/web | https://github.com/aadsp/web | 31e542c7e5b7ca11c2fba6598db1a40eb793975e | 7b0383f2b622d71c6391891a7e01a3d9f694de35 | refs/heads/master | 2020-04-06T07:00:36.142000 | 2016-08-25T21:13:58 | 2016-08-25T21:13:58 | 53,283,630 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package annotations.projeto;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import interfaces.IAnnotations;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import model.projeto.PontoContarTipoTransacaoModel;
@Entity
@Table(name = "PROJETO.PONTO_CONTAR_TIPO_TRANSACAO")
public class PontoContarTipoTransacao implements Serializable, IAnnotations
{
@Id
@GeneratedValue
@Column(name = "ID_contarTipoTransacao")
private Integer ID;
@OneToOne
@JoinColumn(name = "ID_tipoTransacaoTipo")
private PontoTipoTransacaoTipo tipoTransacao;
@OneToOne
@JoinColumn(name = "ID_projeto")
private Projeto projeto;
@Column(name = "valorTipoTransacao")
private int valorTipoTransacao;
@Column(name = "descricaoTipoTransacao", length = 100)
private String descricaoTipoTransacao;
@Column(name = "valorTED")
private int valorTED;
@Column(name = "descricaoTED", length = 100)
private String descricaoTED;
@Column(name = "valorTAR")
private int valorTAR;
@Column(name = "descricaoTAR", length = 100)
private String descricaoTAR;
public Integer getID()
{
return ID;
}
public void setID(Integer ID)
{
this.ID = ID;
}
public PontoTipoTransacaoTipo getTipoTransacao()
{
return tipoTransacao;
}
public void setTipoTransacao(PontoTipoTransacaoTipo tipoTransacao)
{
this.tipoTransacao = tipoTransacao;
}
public Projeto getProjeto()
{
return projeto;
}
public void setProjeto(Projeto projeto)
{
this.projeto = projeto;
}
public int getValorTED()
{
return valorTED;
}
public void setValorTED(int valorTED)
{
this.valorTED = valorTED;
}
public String getDescricaoTED()
{
return descricaoTED;
}
public void setDescricaoTED(String descricaoTED)
{
this.descricaoTED = descricaoTED;
}
public int getValorTAR()
{
return valorTAR;
}
public void setValorTAR(int valorTAR)
{
this.valorTAR = valorTAR;
}
public String getDescricaoTAR()
{
return descricaoTAR;
}
public void setDescricaoTAR(String descricaoTAR)
{
this.descricaoTAR = descricaoTAR;
}
public int getValorTipoTransacao()
{
return valorTipoTransacao;
}
public void setValorTipoTransacao(int valorTipoTransacao)
{
this.valorTipoTransacao = valorTipoTransacao;
}
public String getDescricaoTipoTransacao()
{
return descricaoTipoTransacao;
}
public void setDescricaoTipoTransacao(String descricaoTipoTransacao)
{
this.descricaoTipoTransacao = descricaoTipoTransacao;
}
@Override
public void cadastrar()
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
model.salvar(this);
}
@Override
public void excluir()
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
model.excluir(this);
}
@Override
public void editar()
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
model.atualizar(this);
}
public List<PontoContarTipoTransacao> listar() throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.listar();
}
public List<PontoContarTipoTransacao> listarPorProjeto() throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.listarPorProjeto(this);
}
public PontoContarTipoTransacao consultarPorID() throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.consultarPorID(this);
}
public List<PontoContarTipoTransacao> listarPorFiltro(String filtro) throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.listarPorFiltro(filtro);
}
}
| UTF-8 | Java | 4,306 | java | PontoContarTipoTransacao.java | Java | [] | null | [] | package annotations.projeto;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import interfaces.IAnnotations;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import model.projeto.PontoContarTipoTransacaoModel;
@Entity
@Table(name = "PROJETO.PONTO_CONTAR_TIPO_TRANSACAO")
public class PontoContarTipoTransacao implements Serializable, IAnnotations
{
@Id
@GeneratedValue
@Column(name = "ID_contarTipoTransacao")
private Integer ID;
@OneToOne
@JoinColumn(name = "ID_tipoTransacaoTipo")
private PontoTipoTransacaoTipo tipoTransacao;
@OneToOne
@JoinColumn(name = "ID_projeto")
private Projeto projeto;
@Column(name = "valorTipoTransacao")
private int valorTipoTransacao;
@Column(name = "descricaoTipoTransacao", length = 100)
private String descricaoTipoTransacao;
@Column(name = "valorTED")
private int valorTED;
@Column(name = "descricaoTED", length = 100)
private String descricaoTED;
@Column(name = "valorTAR")
private int valorTAR;
@Column(name = "descricaoTAR", length = 100)
private String descricaoTAR;
public Integer getID()
{
return ID;
}
public void setID(Integer ID)
{
this.ID = ID;
}
public PontoTipoTransacaoTipo getTipoTransacao()
{
return tipoTransacao;
}
public void setTipoTransacao(PontoTipoTransacaoTipo tipoTransacao)
{
this.tipoTransacao = tipoTransacao;
}
public Projeto getProjeto()
{
return projeto;
}
public void setProjeto(Projeto projeto)
{
this.projeto = projeto;
}
public int getValorTED()
{
return valorTED;
}
public void setValorTED(int valorTED)
{
this.valorTED = valorTED;
}
public String getDescricaoTED()
{
return descricaoTED;
}
public void setDescricaoTED(String descricaoTED)
{
this.descricaoTED = descricaoTED;
}
public int getValorTAR()
{
return valorTAR;
}
public void setValorTAR(int valorTAR)
{
this.valorTAR = valorTAR;
}
public String getDescricaoTAR()
{
return descricaoTAR;
}
public void setDescricaoTAR(String descricaoTAR)
{
this.descricaoTAR = descricaoTAR;
}
public int getValorTipoTransacao()
{
return valorTipoTransacao;
}
public void setValorTipoTransacao(int valorTipoTransacao)
{
this.valorTipoTransacao = valorTipoTransacao;
}
public String getDescricaoTipoTransacao()
{
return descricaoTipoTransacao;
}
public void setDescricaoTipoTransacao(String descricaoTipoTransacao)
{
this.descricaoTipoTransacao = descricaoTipoTransacao;
}
@Override
public void cadastrar()
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
model.salvar(this);
}
@Override
public void excluir()
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
model.excluir(this);
}
@Override
public void editar()
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
model.atualizar(this);
}
public List<PontoContarTipoTransacao> listar() throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.listar();
}
public List<PontoContarTipoTransacao> listarPorProjeto() throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.listarPorProjeto(this);
}
public PontoContarTipoTransacao consultarPorID() throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.consultarPorID(this);
}
public List<PontoContarTipoTransacao> listarPorFiltro(String filtro) throws Exception
{
PontoContarTipoTransacaoModel model = new PontoContarTipoTransacaoModel();
return model.listarPorFiltro(filtro);
}
}
| 4,306 | 0.685787 | 0.683697 | 181 | 22.790054 | 23.253115 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.314917 | false | false | 4 |
f4a91ee23bbb190ec6e68ad5564ae0857f7f825c | 36,816,459,671,646 | 7f47b09a15ca63ba04cd405d302b31694d5dd744 | /src/core/src/com/towerdefense/game/util/Collideable.java | e392d16c6935a6505e799ea7a122edfe86eabd4c | [] | no_license | elziniel/PL8 | https://github.com/elziniel/PL8 | 460eec6647f35517892c11856e9e8deba355746a | b6b1d8672e92167ec6f175ba27f6292953ec36f7 | refs/heads/master | 2021-01-21T10:37:57.925000 | 2017-02-28T19:16:21 | 2017-02-28T19:16:21 | 83,462,413 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.towerdefense.game.util;
import com.badlogic.gdx.math.Rectangle;
public class Collideable {
public static final int
TURRET = 0x1,
FLOOR = 0x1 << 1,
ENTRY = 0x1 << 2,
EXIT = 0x1 << 3,
ENEMY = 0x1 << 4,
BULLET = 0x1 << 5,
WALL = 0x1 << 6;
public int maskThis = 0;
public int maskOther = 0;
public Collideable(int myself, int others){
maskThis = myself;
maskOther = others;
}
public boolean isCollidingWith(Collideable other){
return (this.maskOther & other.maskThis) != 0;
}
}
| UTF-8 | Java | 673 | java | Collideable.java | Java | [] | null | [] | package com.towerdefense.game.util;
import com.badlogic.gdx.math.Rectangle;
public class Collideable {
public static final int
TURRET = 0x1,
FLOOR = 0x1 << 1,
ENTRY = 0x1 << 2,
EXIT = 0x1 << 3,
ENEMY = 0x1 << 4,
BULLET = 0x1 << 5,
WALL = 0x1 << 6;
public int maskThis = 0;
public int maskOther = 0;
public Collideable(int myself, int others){
maskThis = myself;
maskOther = others;
}
public boolean isCollidingWith(Collideable other){
return (this.maskOther & other.maskThis) != 0;
}
}
| 673 | 0.51263 | 0.478455 | 30 | 21.433332 | 18.019773 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 4 |
6b3de44b356d32731ff2dc440f90866df5e2b66d | 35,364,760,736,531 | 7be39a236cd65d915a3bf57fa6181ed641e59d2b | /src/main/java/spittr/web/ViewName.java | 2d930bddfc778c4c932c9c53fe8457270338d298 | [] | no_license | yudequan/SpringMVC | https://github.com/yudequan/SpringMVC | fad8849b37d4b19bad4d8845982abfc261301477 | 91d0f19a4add684561283d0b70488ff1a4e3d7c0 | refs/heads/master | 2021-01-21T05:23:03.922000 | 2017-02-26T07:18:31 | 2017-02-26T07:18:31 | 83,179,650 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package spittr.web;
/**
* Created by yudequan on 24/02/2017.
*/
public enum ViewName
{
SPITTLES("spittles"), SPITTLE("spittle"), HOME("home"), REGISTER("register"), PROFILE("profile");
private String name;
ViewName(String name)
{
this.name = name;
}
String getName()
{
return this.name;
}
}
| UTF-8 | Java | 742 | java | ViewName.java | Java | [
{
"context": " arcu.\n */\n\npackage spittr.web;\n\n/**\n * Created by yudequan on 24/02/2017.\n */\npublic enum ViewName\n{\n SPI",
"end": 444,
"score": 0.9996574521064758,
"start": 436,
"tag": "USERNAME",
"value": "yudequan"
}
] | null | [] | /*
* Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package spittr.web;
/**
* Created by yudequan on 24/02/2017.
*/
public enum ViewName
{
SPITTLES("spittles"), SPITTLE("spittle"), HOME("home"), REGISTER("register"), PROFILE("profile");
private String name;
ViewName(String name)
{
this.name = name;
}
String getName()
{
return this.name;
}
}
| 742 | 0.687332 | 0.671159 | 29 | 24.586206 | 31.605888 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.344828 | false | false | 4 |
ab468ab84252bdfd0d524b2315f199db80f34419 | 6,287,832,166,167 | 120718ab48803c257a9f136e87faad40a3d81e9f | /Rohan's_Empire/src/com/lti/payroll/Employee.java | ef2c09fa80c2d52d48fbc8b51de7f12bddb270e3 | [] | no_license | Rohan1919/javaworkspace | https://github.com/Rohan1919/javaworkspace | dc5bb057fb3a2827acf9115f69f6a9a25dea475f | d1e7a5c2bca2cb5bcbca337f063e403c292fc4f5 | refs/heads/master | 2021-01-06T14:01:46.454000 | 2020-02-18T12:20:38 | 2020-02-18T12:20:38 | 241,351,800 | 0 | 0 | null | false | 2020-10-13T19:38:46 | 2020-02-18T12:09:26 | 2020-02-18T12:17:16 | 2020-10-13T19:38:45 | 52,705 | 0 | 0 | 2 | JavaScript | false | false | package com.lti.payroll;
import java.time.LocalDate;
public class Employee {
private int psno;
private String name;
private LocalDate dateOfJoining;
private double salary;
public Employee() {
// TODO Auto-generated constructor stub
}
public Employee(int psno, String name, LocalDate dateOfJoining, double salary) {
super();
this.psno = psno;
this.name = name;
this.dateOfJoining = dateOfJoining;
this.salary = salary;
}
public int getPsno() {
return psno;
}
public void setPsno(int psno) {
this.psno = psno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDate getDateOfJoining() {
return dateOfJoining;
}
public void setDateofjoining(LocalDate dateOfJoining) {
this.dateOfJoining = dateOfJoining;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
}
| UTF-8 | Java | 952 | java | Employee.java | Java | [] | null | [] | package com.lti.payroll;
import java.time.LocalDate;
public class Employee {
private int psno;
private String name;
private LocalDate dateOfJoining;
private double salary;
public Employee() {
// TODO Auto-generated constructor stub
}
public Employee(int psno, String name, LocalDate dateOfJoining, double salary) {
super();
this.psno = psno;
this.name = name;
this.dateOfJoining = dateOfJoining;
this.salary = salary;
}
public int getPsno() {
return psno;
}
public void setPsno(int psno) {
this.psno = psno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDate getDateOfJoining() {
return dateOfJoining;
}
public void setDateofjoining(LocalDate dateOfJoining) {
this.dateOfJoining = dateOfJoining;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
}
| 952 | 0.698529 | 0.698529 | 48 | 18.833334 | 16.80195 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 4 |
174c1d33045de274aa38a1d1a91f82419df7f94a | 33,251,636,862,048 | 3d681f695f7407b022b838c0c9af8eb8c108589c | /src/main/java/ro/siit/session11/bank/BankAccount.java | e12d9bc20a222eede961eb4c6db02e29e38961de | [
"Apache-2.0"
] | permissive | fiatfilip/java-national-7 | https://github.com/fiatfilip/java-national-7 | d62b46102a00075e92acb4876b3213aca2a44742 | 65dad6c5f732d8779b665c2b59ca7ad4f35296f7 | refs/heads/main | 2023-08-16T12:31:03.981000 | 2021-10-07T09:13:06 | 2021-10-07T09:13:06 | 379,660,625 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ro.siit.session11.bank;
import java.util.ArrayList;
import java.util.List;
public class BankAccount {
private String iban;
private Double balance;
private List<Card> attachedCards;
public BankAccount(String iban) {
this.iban = iban;
this.balance = 0.0;
this.attachedCards = new ArrayList<>();
}
public void attachCard(Card card) {
attachedCards.add(card);
}
public void addMoney(Double amount) {
if (amount > 0) {
balance += 0.9 * amount;
}
}
public void withdrawMoney(Double amount) {
if (amount > 0 && balance >= amount) {
balance -= amount;
}
}
public double getBalance() {
return balance;
}
public List<Card> getAttachedCards() {
return new ArrayList<>(attachedCards);
}
}
| UTF-8 | Java | 859 | java | BankAccount.java | Java | [] | null | [] | package ro.siit.session11.bank;
import java.util.ArrayList;
import java.util.List;
public class BankAccount {
private String iban;
private Double balance;
private List<Card> attachedCards;
public BankAccount(String iban) {
this.iban = iban;
this.balance = 0.0;
this.attachedCards = new ArrayList<>();
}
public void attachCard(Card card) {
attachedCards.add(card);
}
public void addMoney(Double amount) {
if (amount > 0) {
balance += 0.9 * amount;
}
}
public void withdrawMoney(Double amount) {
if (amount > 0 && balance >= amount) {
balance -= amount;
}
}
public double getBalance() {
return balance;
}
public List<Card> getAttachedCards() {
return new ArrayList<>(attachedCards);
}
}
| 859 | 0.585565 | 0.576251 | 42 | 19.452381 | 16.610672 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 4 |
939921de5d9e4b0a3f35b73f3247d66bde3e864d | 37,795,712,205,195 | cf46571706bcd6e9225424fc98d6ba644dbd554a | /MoveStoryManagementAndroid/app/src/main/java/com/netclover/etalk/MainApplication.java | 6866fcc541211cca367e61c961be5ba21d2bc674 | [] | no_license | WonseockKim/MoveStoryMangement | https://github.com/WonseockKim/MoveStoryMangement | 1330cee094e7f4edc8ae992b7c9f81d57bad2b99 | 6ecb74635530ed55e65b37a13972c4a0a028eeb5 | refs/heads/master | 2020-03-18T12:23:35.426000 | 2019-09-21T06:49:57 | 2019-09-21T06:49:57 | 134,723,819 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.netclover.etalk;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.support.multidex.MultiDex;
import com.netclover.etalk.model.ChattingRoom;
import com.netclover.etalk.model.Member;
import com.netclover.etalk.model.User;
import com.netclover.etalk.myUtils.CropImageUtil;
import com.netclover.etalk.myUtils.PreferOptions;
import com.netclover.etalk.utils.DeviceUtil;
import java.io.File;
import java.util.ArrayList;
/**
* Created by Wonseock.K on 2016-04-28.
*/
public class MainApplication extends Application {
public static PreferOptions mPreferOptions;
public static Member member;
public static int SDK_INT = 0;
// 개발시 폰번호
public static String developPhoneNumber = null;
public static File cropFile;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
@Override
public void onCreate() {
super.onCreate();
// LeakCanary.install(this);
// 갤럭시s3 테스트폰
// if(DeviceUtil.getDeviceId(getBaseContext()).equals("352260052939471"))
// developPhoneNumber = "01011111111";
//
// // 엘지G3 테스트폰
// if(DeviceUtil.getDeviceId(getBaseContext()).equals("353168063037178"))
// developPhoneNumber = "01022222222";
mPreferOptions = new PreferOptions(getApplicationContext());
// sdk 버젼
SDK_INT = Build.VERSION.SDK_INT;
// 자른 이미지 준비
readyCropImage();
}
// 이미지 자르는 OutStream 준비
private void readyCropImage() {
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
cropFile = new File(Environment.getExternalStorageDirectory(), CropImageUtil.TEMP_PHOTO_FILE_NAME);
} else {
cropFile = new File(getFilesDir(), CropImageUtil.TEMP_PHOTO_FILE_NAME);
}
}
}
| UTF-8 | Java | 2,070 | java | MainApplication.java | Java | [
{
"context": "le;\nimport java.util.ArrayList;\n\n/**\n * Created by Wonseock.K on 2016-04-28.\n */\npublic class MainApplication e",
"end": 544,
"score": 0.9987753033638,
"start": 534,
"tag": "USERNAME",
"value": "Wonseock.K"
}
] | null | [] | package com.netclover.etalk;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.support.multidex.MultiDex;
import com.netclover.etalk.model.ChattingRoom;
import com.netclover.etalk.model.Member;
import com.netclover.etalk.model.User;
import com.netclover.etalk.myUtils.CropImageUtil;
import com.netclover.etalk.myUtils.PreferOptions;
import com.netclover.etalk.utils.DeviceUtil;
import java.io.File;
import java.util.ArrayList;
/**
* Created by Wonseock.K on 2016-04-28.
*/
public class MainApplication extends Application {
public static PreferOptions mPreferOptions;
public static Member member;
public static int SDK_INT = 0;
// 개발시 폰번호
public static String developPhoneNumber = null;
public static File cropFile;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
@Override
public void onCreate() {
super.onCreate();
// LeakCanary.install(this);
// 갤럭시s3 테스트폰
// if(DeviceUtil.getDeviceId(getBaseContext()).equals("352260052939471"))
// developPhoneNumber = "01011111111";
//
// // 엘지G3 테스트폰
// if(DeviceUtil.getDeviceId(getBaseContext()).equals("353168063037178"))
// developPhoneNumber = "01022222222";
mPreferOptions = new PreferOptions(getApplicationContext());
// sdk 버젼
SDK_INT = Build.VERSION.SDK_INT;
// 자른 이미지 준비
readyCropImage();
}
// 이미지 자르는 OutStream 준비
private void readyCropImage() {
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
cropFile = new File(Environment.getExternalStorageDirectory(), CropImageUtil.TEMP_PHOTO_FILE_NAME);
} else {
cropFile = new File(getFilesDir(), CropImageUtil.TEMP_PHOTO_FILE_NAME);
}
}
}
| 2,070 | 0.684685 | 0.653153 | 75 | 25.639999 | 24.275442 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44 | false | false | 4 |
3cd6e57843482da1191fc42707c72be4ecd227e3 | 7,249,904,795,714 | 93b4c4568bf71caf8655ad9f3889bc372956333c | /First/src/main/BlockSort.java | dea92799b050c495bd6299ea3cda8d8163354e93 | [] | no_license | Straw1239/First | https://github.com/Straw1239/First | 415d18e848c44b05f3be3070d7264969d84a8ec6 | 192f73e975a415db8f32df4023785e848e251510 | refs/heads/master | 2021-01-19T00:58:23.635000 | 2018-03-24T20:08:47 | 2018-03-24T20:08:47 | 18,455,619 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main;
public class BlockSort
{
}
| UTF-8 | Java | 50 | java | BlockSort.java | Java | [] | null | [] | package main;
public class BlockSort
{
}
| 50 | 0.62 | 0.62 | 6 | 6.333333 | 8.319989 | 22 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 12 |
86d9246bf77887194b34cade63404e1377a3bfe3 | 13,941,463,901,797 | aa61698b53bb99a2fb258ffa60b9b1c7264b07e0 | /app/src/main/java/com/fenjiread/learner/activity/adapter/DayRegisterAdapter.java | c4c71cb04f97df7b3542d7181ca95b26fae24d47 | [] | no_license | Onperson/TestAnimationWxpay | https://github.com/Onperson/TestAnimationWxpay | 0b2e4c51cc56e651c1e66bcc5c903815363b4b3f | 47b3a31416da11f0ad3b866e903c1cbab9c1d05f | refs/heads/master | 2020-04-24T13:56:36.381000 | 2019-02-22T06:06:58 | 2019-02-22T06:06:58 | 172,004,450 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fenjiread.learner.activity.adapter;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fenjiread.learner.activity.model.RegisterItem;
import com.fenjiread.learner.R;
import java.util.ArrayList;
/**
* 每日签到的Adapter
* @author guotianhui
*/
public class DayRegisterAdapter extends BaseQuickAdapter<RegisterItem,BaseViewHolder> {
private final ArrayList<RegisterItem> mDataList;
public DayRegisterAdapter(int layoutResId, @Nullable ArrayList<RegisterItem> data) {
super(layoutResId, data);
this.mDataList = data;
}
@Override
protected void convert(BaseViewHolder helper, RegisterItem item) {
helper.setText(R.id.tv_register_day,item.getRegisterDay());
AppCompatTextView tvTowDot = helper.getView(R.id.view_line_one);
if(item.isRegister()){
helper.setImageResource(R.id.iv_register_image,R.drawable.ic_light_book);
}else{
helper.setImageResource(R.id.iv_register_image,R.drawable.ic_gray_book);
}
if(item.isShowTwoDot()){
tvTowDot.setVisibility(View.VISIBLE);
}else{
tvTowDot.setVisibility(View.GONE);
}
}
} | UTF-8 | Java | 1,376 | java | DayRegisterAdapter.java | Java | [
{
"context": "va.util.ArrayList;\n\n/**\n * 每日签到的Adapter\n * @author guotianhui\n */\npublic class DayRegisterAdapter extends BaseQ",
"end": 442,
"score": 0.9992762804031372,
"start": 432,
"tag": "USERNAME",
"value": "guotianhui"
}
] | null | [] | package com.fenjiread.learner.activity.adapter;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fenjiread.learner.activity.model.RegisterItem;
import com.fenjiread.learner.R;
import java.util.ArrayList;
/**
* 每日签到的Adapter
* @author guotianhui
*/
public class DayRegisterAdapter extends BaseQuickAdapter<RegisterItem,BaseViewHolder> {
private final ArrayList<RegisterItem> mDataList;
public DayRegisterAdapter(int layoutResId, @Nullable ArrayList<RegisterItem> data) {
super(layoutResId, data);
this.mDataList = data;
}
@Override
protected void convert(BaseViewHolder helper, RegisterItem item) {
helper.setText(R.id.tv_register_day,item.getRegisterDay());
AppCompatTextView tvTowDot = helper.getView(R.id.view_line_one);
if(item.isRegister()){
helper.setImageResource(R.id.iv_register_image,R.drawable.ic_light_book);
}else{
helper.setImageResource(R.id.iv_register_image,R.drawable.ic_gray_book);
}
if(item.isShowTwoDot()){
tvTowDot.setVisibility(View.VISIBLE);
}else{
tvTowDot.setVisibility(View.GONE);
}
}
} | 1,376 | 0.715227 | 0.714495 | 43 | 30.790697 | 28.051081 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.581395 | false | false | 12 |
be49148f8e3582d683e294d41279cb76ab16e4a1 | 17,721,035,109,518 | 328f9e9eef7a35ceccc86614f854c29dd41cafe3 | /src/projetopaint/Model/Retangulo.java | 650de76bd67e20de71fb02061620086c7f715abe | [] | no_license | MayaraMachado/ProjetoPaint | https://github.com/MayaraMachado/ProjetoPaint | 685c1e174dc529a1aecc844549890d9cd78fb343 | 3938829e22f538b64153bcb2ea975eead66d7a73 | refs/heads/master | 2021-01-18T20:16:31.273000 | 2017-11-20T21:23:03 | 2017-11-20T21:23:03 | 86,950,850 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 projetopaint.Model;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.io.BufferedWriter;
import java.io.IOException;
import projetopaint.View.View;
/**
* Classe Model, de acordo com o padrão MVC (Model View Controller). Essa classe
* especifica os atributos e comportamento dos objetos Retangulo exibidos na
* View (A interface gráfica de interação com o usuário).
*
* @author Mayara Machado
* @author Luiz Felipe Souza
*/
public class Retangulo extends Figuras2D {
private Rectangle ret;
/*
* Construtores do objeto
*/
/**
* Construtor vazio
*/
public Retangulo() {
}
/**
* Constrói um retângulo a partir do parâmetro passado
*
* @param r
* Retângulo a ser construído
*/
public Retangulo(Rectangle r) {
this.ret = r;
}
/**
* Constrói um retângulo com uma dada cor de linha (preto por padrão)
*
* @param r
* Retângulo a ser construído
* @param corLinha
* Cor do contorno da figura
*/
public Retangulo(Rectangle r, Color corLinha) {
this.ret = r;
this.setCorDeLinha(corLinha);
}
/**
*
* @param r
* Retângulo a ser construído
* @param corLinha
* Cor do contorno da figura
* @param cor
* Cor do preenchimento da figura
*/
public Retangulo(Rectangle r, Color corLinha, Color cor) {
this.ret = r;
this.setCorDeLinha(corLinha);
this.setCor(cor);
}
@Override
public void construirObject(Point startDrag, Point endDrag) {
int x = Math.min(startDrag.x, endDrag.x);
int y = Math.min(startDrag.y, endDrag.y);
int w = Math.abs(startDrag.x - endDrag.x);
int h = Math.abs(startDrag.y - endDrag.y);
Rectangle r = new Rectangle(x, y, w, h);
this.setRetangulo(r);
}
@Override
public void editarObject(Point startDrag, Point endDrag) {
int x = Math.min(startDrag.x, endDrag.x);
int y = Math.min(startDrag.y, endDrag.y);
int w = Math.abs(startDrag.x - endDrag.x);
int h = Math.abs(startDrag.y - endDrag.y);
Rectangle r = new Rectangle(x, y, w, h);
this.setRetangulo(r);
}
@Override
public boolean contemPonto(Point p) {
return this.getRetangulo().contains(p);
}
@Override
public void writetoFile(BufferedWriter b) throws IOException {
try {
b.write(getClass().getSimpleName() + ";");
b.write(getRetangulo().x + ";" + getRetangulo().y + ";" + getRetangulo().width + ";" + getRetangulo().height
+ ";");
b.write(getCorDeLinha().getRed() + ";" + getCorDeLinha().getGreen() + ";" + getCorDeLinha().getBlue()
+ ";");
if (getCor() == null) {
b.write("null" + ";" + "null" + ";" + "null");
} else {
b.write(getCor().getRed() + ";" + getCor().getGreen() + ";" + getCor().getBlue());
}
b.newLine();
b.flush();
b.close();
} catch (IOException e) {
View.mostrarErro("Escrita");
}
}
@Override
public void desenhar(Graphics g) {
int x = this.getRetangulo().x;
int y = this.getRetangulo().y;
int width = this.getRetangulo().width;
int height = this.getRetangulo().height;
if (getCor() == null) {
g.setColor(this.getCorDeLinha());
g.drawRect(x, y, width, height);
} else {
g.setColor(this.getCor());
g.fillRect(x, y, width, height);
g.drawRect(x, y, width, height);
}
}
@Override
public void redesenhar(int x, int y, int w, int h) {
Rectangle r = new Rectangle(x, y, w, h);
this.setRetangulo(r);
}
/*
* Métodos Acessores: getters e setters
*/
public Rectangle getRetangulo() {
return ret;
}
public void setRetangulo(Rectangle rect) {
this.ret = rect;
}
}
| UTF-8 | Java | 3,968 | java | Retangulo.java | Java | [
{
"context": "áfica de interação com o usuário).\r\n *\r\n * @author Mayara Machado\r\n * @author Luiz Felipe Souza\r\n */\r\npublic class ",
"end": 674,
"score": 0.9998771548271179,
"start": 660,
"tag": "NAME",
"value": "Mayara Machado"
},
{
"context": "uário).\r\n *\r\n * @author Mayara Machado\r\n * @author Luiz Felipe Souza\r\n */\r\npublic class Retangulo extends Figuras2D {\r",
"end": 704,
"score": 0.9998785257339478,
"start": 687,
"tag": "NAME",
"value": "Luiz Felipe Souza"
}
] | null | [] | /*
* 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 projetopaint.Model;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.io.BufferedWriter;
import java.io.IOException;
import projetopaint.View.View;
/**
* Classe Model, de acordo com o padrão MVC (Model View Controller). Essa classe
* especifica os atributos e comportamento dos objetos Retangulo exibidos na
* View (A interface gráfica de interação com o usuário).
*
* @author <NAME>
* @author <NAME>
*/
public class Retangulo extends Figuras2D {
private Rectangle ret;
/*
* Construtores do objeto
*/
/**
* Construtor vazio
*/
public Retangulo() {
}
/**
* Constrói um retângulo a partir do parâmetro passado
*
* @param r
* Retângulo a ser construído
*/
public Retangulo(Rectangle r) {
this.ret = r;
}
/**
* Constrói um retângulo com uma dada cor de linha (preto por padrão)
*
* @param r
* Retângulo a ser construído
* @param corLinha
* Cor do contorno da figura
*/
public Retangulo(Rectangle r, Color corLinha) {
this.ret = r;
this.setCorDeLinha(corLinha);
}
/**
*
* @param r
* Retângulo a ser construído
* @param corLinha
* Cor do contorno da figura
* @param cor
* Cor do preenchimento da figura
*/
public Retangulo(Rectangle r, Color corLinha, Color cor) {
this.ret = r;
this.setCorDeLinha(corLinha);
this.setCor(cor);
}
@Override
public void construirObject(Point startDrag, Point endDrag) {
int x = Math.min(startDrag.x, endDrag.x);
int y = Math.min(startDrag.y, endDrag.y);
int w = Math.abs(startDrag.x - endDrag.x);
int h = Math.abs(startDrag.y - endDrag.y);
Rectangle r = new Rectangle(x, y, w, h);
this.setRetangulo(r);
}
@Override
public void editarObject(Point startDrag, Point endDrag) {
int x = Math.min(startDrag.x, endDrag.x);
int y = Math.min(startDrag.y, endDrag.y);
int w = Math.abs(startDrag.x - endDrag.x);
int h = Math.abs(startDrag.y - endDrag.y);
Rectangle r = new Rectangle(x, y, w, h);
this.setRetangulo(r);
}
@Override
public boolean contemPonto(Point p) {
return this.getRetangulo().contains(p);
}
@Override
public void writetoFile(BufferedWriter b) throws IOException {
try {
b.write(getClass().getSimpleName() + ";");
b.write(getRetangulo().x + ";" + getRetangulo().y + ";" + getRetangulo().width + ";" + getRetangulo().height
+ ";");
b.write(getCorDeLinha().getRed() + ";" + getCorDeLinha().getGreen() + ";" + getCorDeLinha().getBlue()
+ ";");
if (getCor() == null) {
b.write("null" + ";" + "null" + ";" + "null");
} else {
b.write(getCor().getRed() + ";" + getCor().getGreen() + ";" + getCor().getBlue());
}
b.newLine();
b.flush();
b.close();
} catch (IOException e) {
View.mostrarErro("Escrita");
}
}
@Override
public void desenhar(Graphics g) {
int x = this.getRetangulo().x;
int y = this.getRetangulo().y;
int width = this.getRetangulo().width;
int height = this.getRetangulo().height;
if (getCor() == null) {
g.setColor(this.getCorDeLinha());
g.drawRect(x, y, width, height);
} else {
g.setColor(this.getCor());
g.fillRect(x, y, width, height);
g.drawRect(x, y, width, height);
}
}
@Override
public void redesenhar(int x, int y, int w, int h) {
Rectangle r = new Rectangle(x, y, w, h);
this.setRetangulo(r);
}
/*
* Métodos Acessores: getters e setters
*/
public Rectangle getRetangulo() {
return ret;
}
public void setRetangulo(Rectangle rect) {
this.ret = rect;
}
}
| 3,949 | 0.617215 | 0.616962 | 160 | 22.6875 | 22.506163 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false | 12 |
61eb093cdd8b1c171dc34c2534b8dac4d925b07d | 14,697,378,140,201 | fbe68a6fc9610c142967f432dbfba148499374ca | /src/main/java/me/project/periodictable/dao/repository/PeriodicTableRepository.java | c936bf23b82dabe4ad18246aea22283a82f3c74a | [] | no_license | Sanketp1997/periodic_table_apis | https://github.com/Sanketp1997/periodic_table_apis | 4f6ff70b9cbf40b360cf053fe93e6bfcc3c460a0 | 16115abea733aa08bde83ea61ca5f6dd06a670fb | refs/heads/master | 2021-05-22T18:40:52.996000 | 2020-04-08T07:23:52 | 2020-04-08T07:23:52 | 253,044,085 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.project.periodictable.dao.repository;
import me.project.periodictable.dao.beans.ElementBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by sanketp on 4/4/20
*/
@Repository
public interface PeriodicTableRepository extends JpaRepository<ElementBean,Integer>{
ElementBean getByAtomicNumber(Integer atomicNumber);
ElementBean getByName(String atomicName);
ElementBean getBySymbol(String symbol);
List<ElementBean> findAllByBondingType(String bondingType);
List<ElementBean> findAllByGroupBlock(String atomicGroup);
List<ElementBean> findAllByStandardState(String atomicState);
}
| UTF-8 | Java | 726 | java | PeriodicTableRepository.java | Java | [
{
"context": "sitory;\n\nimport java.util.List;\n\n/**\n * Created by sanketp on 4/4/20\n */\n@Repository\npublic interface Period",
"end": 267,
"score": 0.999710202217102,
"start": 260,
"tag": "USERNAME",
"value": "sanketp"
}
] | null | [] | package me.project.periodictable.dao.repository;
import me.project.periodictable.dao.beans.ElementBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by sanketp on 4/4/20
*/
@Repository
public interface PeriodicTableRepository extends JpaRepository<ElementBean,Integer>{
ElementBean getByAtomicNumber(Integer atomicNumber);
ElementBean getByName(String atomicName);
ElementBean getBySymbol(String symbol);
List<ElementBean> findAllByBondingType(String bondingType);
List<ElementBean> findAllByGroupBlock(String atomicGroup);
List<ElementBean> findAllByStandardState(String atomicState);
}
| 726 | 0.80854 | 0.80303 | 25 | 28.040001 | 27.838793 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.48 | false | false | 12 |
1ae14282d861a4b5094e8ba5a5519367aa1fae21 | 26,070,451,538,481 | 7e00a4518d89548da01a742bcd7e6e758d282d60 | /JavaProjectOnlineCart/src/Books.java | 198b612709230bcb36cb6adc4f9fbd16e7346499 | [] | no_license | JIN-007-GITHUB/Online-shopping-site-using-Java | https://github.com/JIN-007-GITHUB/Online-shopping-site-using-Java | a1ca85c47cdc8d3fff58fef52b8828144d1ff35d | 112c81bad94b152f46dc6cb4c7064ce97385504e | refs/heads/master | 2023-02-09T23:40:15.856000 | 2021-01-09T18:30:42 | 2021-01-09T18:30:42 | 327,998,643 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.InputMismatchException;
import java.util.Scanner;
public class Books {
public static void getBooks() {
Scanner sc = new Scanner(System.in);
System.out.println("******************************************************");
System.out.println("BOOKS");
System.out.println("1. Novels");
System.out.println("2. Fiction Book");
System.out.println("3. EBooks");
System.out.println("4. Home Page");
System.out.println("5. Exit");
System.out.println("select choice:");
try {
int choice = sc.nextInt();
switch (choice) {
case 1:
Novels.getNovels();
break;
case 2:
FictionBook.getFictionBook();
break;
case 3:
EBooks.getEBooks();
break;
case 4:
Category.getHomepage();
break;
case 5:
Exit.getExit();
break;
default:
System.out.println("chioce give option... try again!");
getBooks();
break;
}
} catch (InputMismatchException e) {
System.out.println("enter the correct choice");
getBooks();
}
}
} | UTF-8 | Java | 1,054 | java | Books.java | Java | [] | null | [] |
import java.util.InputMismatchException;
import java.util.Scanner;
public class Books {
public static void getBooks() {
Scanner sc = new Scanner(System.in);
System.out.println("******************************************************");
System.out.println("BOOKS");
System.out.println("1. Novels");
System.out.println("2. Fiction Book");
System.out.println("3. EBooks");
System.out.println("4. Home Page");
System.out.println("5. Exit");
System.out.println("select choice:");
try {
int choice = sc.nextInt();
switch (choice) {
case 1:
Novels.getNovels();
break;
case 2:
FictionBook.getFictionBook();
break;
case 3:
EBooks.getEBooks();
break;
case 4:
Category.getHomepage();
break;
case 5:
Exit.getExit();
break;
default:
System.out.println("chioce give option... try again!");
getBooks();
break;
}
} catch (InputMismatchException e) {
System.out.println("enter the correct choice");
getBooks();
}
}
} | 1,054 | 0.578748 | 0.56926 | 43 | 22.511627 | 16.630558 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.209302 | false | false | 12 |
b025d2d700a7e6388050cbea2c0defa43981816a | 12,266,426,637,572 | c9310ee88e696cf5e646e866b639d36417157df0 | /model/NJUTakeOut.Backend/src/main/java/njurestaurant/njutakeout/security/jwt/JwtServiceImpl.java | 4cb0eb6893f7fb173d4f2a7adcf091df07e4ad7e | [
"Apache-2.0"
] | permissive | 1158873864/website | https://github.com/1158873864/website | a467f8b4f13d966d09ded4937ead742404e131d3 | 91eec7d57c2a79339ba4481fabfce48ba729c8a8 | refs/heads/master | 2020-04-16T17:34:03.075000 | 2019-01-15T04:09:21 | 2019-01-15T04:09:21 | 165,780,521 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package njurestaurant.njutakeout.security.jwt;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import njurestaurant.njutakeout.entity.account.User;
import njurestaurant.njutakeout.publicdatas.account.Role;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class JwtServiceImpl implements JwtService {
@Value("${jwt.claimKey.username}")
private String claimKeyUsername;
@Value("${jwt.claimKey.authorities}")
private String claimKeyAuthorities;
@Value("${jwt.secret}")
private String secret;
@Override
public Claims getClaimsFromToken(String token) {
Claims claims;
try {
claims = Jwts.parser()
.setSigningKey(secret)
.parseClaimsJws(token)
.getBody();
} catch (Exception e) {
e.printStackTrace();
claims = null;
}
return claims;
}
@Override
public String getUsernameFromToken(String token) {
Claims claims = getClaimsFromToken(token);
return (String) claims.get(claimKeyUsername);
}
@Override
public JwtUser convertUserToJwtUser(User user) {
return new JwtUser(
user.getUsername(),
user.getPassword(),
mapToJwtRole(user.getRole())
);
}
private List<JwtRole> mapToJwtRole(Role role) {
List<Role> roles = new ArrayList<>();
roles.add(role);
return roles.stream()
.map(JwtRole::new)
.collect(Collectors.toList());
}
@Override
public Date generateExpirationDate(long expiration) {
return new Date(System.currentTimeMillis() + expiration * 1000);
}
@Override
public boolean validateToken(String authToken) {
Claims claims = getClaimsFromToken(authToken);
return new Date().getTime() <= claims.getExpiration().getTime();
}
@Override
public String generateToken(UserDetails userDetails, long expiration) {
Map<String, Object> claims = new HashMap<>();
claims.put(claimKeyUsername, userDetails.getUsername());
claims.put(claimKeyAuthorities, userDetails.getAuthorities());
return Jwts.builder()
.setClaims(claims)
.setExpiration(generateExpirationDate(expiration))
.signWith(SignatureAlgorithm.HS512, secret)
.compact();
}
}
| UTF-8 | Java | 2,677 | java | JwtServiceImpl.java | Java | [
{
"context": "\n return new JwtUser(\n user.getUsername(),\n user.getPassword(),\n ",
"end": 1468,
"score": 0.7638447880744934,
"start": 1457,
"tag": "USERNAME",
"value": "getUsername"
}
] | null | [] | package njurestaurant.njutakeout.security.jwt;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import njurestaurant.njutakeout.entity.account.User;
import njurestaurant.njutakeout.publicdatas.account.Role;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class JwtServiceImpl implements JwtService {
@Value("${jwt.claimKey.username}")
private String claimKeyUsername;
@Value("${jwt.claimKey.authorities}")
private String claimKeyAuthorities;
@Value("${jwt.secret}")
private String secret;
@Override
public Claims getClaimsFromToken(String token) {
Claims claims;
try {
claims = Jwts.parser()
.setSigningKey(secret)
.parseClaimsJws(token)
.getBody();
} catch (Exception e) {
e.printStackTrace();
claims = null;
}
return claims;
}
@Override
public String getUsernameFromToken(String token) {
Claims claims = getClaimsFromToken(token);
return (String) claims.get(claimKeyUsername);
}
@Override
public JwtUser convertUserToJwtUser(User user) {
return new JwtUser(
user.getUsername(),
user.getPassword(),
mapToJwtRole(user.getRole())
);
}
private List<JwtRole> mapToJwtRole(Role role) {
List<Role> roles = new ArrayList<>();
roles.add(role);
return roles.stream()
.map(JwtRole::new)
.collect(Collectors.toList());
}
@Override
public Date generateExpirationDate(long expiration) {
return new Date(System.currentTimeMillis() + expiration * 1000);
}
@Override
public boolean validateToken(String authToken) {
Claims claims = getClaimsFromToken(authToken);
return new Date().getTime() <= claims.getExpiration().getTime();
}
@Override
public String generateToken(UserDetails userDetails, long expiration) {
Map<String, Object> claims = new HashMap<>();
claims.put(claimKeyUsername, userDetails.getUsername());
claims.put(claimKeyAuthorities, userDetails.getAuthorities());
return Jwts.builder()
.setClaims(claims)
.setExpiration(generateExpirationDate(expiration))
.signWith(SignatureAlgorithm.HS512, secret)
.compact();
}
}
| 2,677 | 0.643631 | 0.641016 | 90 | 28.744444 | 22.252371 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433333 | false | false | 12 |
e9c50bb5907060a2323d75870a74110818c53af3 | 20,899,310,881,726 | bf469417a799fccc542619f0422dddfdc7e28225 | /src/main/java/com/lynx/messaging/enums/RegistrationResultCode.java | 6e0ad1f0cac014cbcc2b5a8802ea57dbc7038261 | [
"MIT"
] | permissive | 6o1/lynx-server | https://github.com/6o1/lynx-server | 36bc39af6d7e1f66b686b403215a92c9f8dad785 | 059c10abd36e2894ec4a1f0e1d7b6edc54c70945 | refs/heads/master | 2020-12-02T08:07:58.405000 | 2017-08-11T14:23:54 | 2017-08-11T14:23:54 | 96,773,030 | 2 | 1 | null | false | 2017-08-01T19:03:46 | 2017-07-10T12:05:47 | 2017-08-01T17:42:13 | 2017-08-01T19:03:45 | 6,396 | 2 | 1 | 0 | JavaScript | null | null | package com.lynx.messaging.enums;
public enum RegistrationResultCode {
REGISTRATION_SUCCESS(1), REGISTRATION_FAILURE(2);
private int id;
private RegistrationResultCode(int id) {
this.id = id;
}
public int getId() {
return id;
}
/**
* Provide mapping enums with a fixed ID in JPA (a more robust alternative
* to EnumType.String and EnumType.Ordinal)
*
* @param id
* @return related RegistrationResultCode enum
* @see http://blog.chris-ritchie.com/2013/09/mapping-enums-with-fixed-id-in
* -jpa.html
*
*/
public static RegistrationResultCode getType(Integer id) {
if (id == null) {
return null;
}
for (RegistrationResultCode type : RegistrationResultCode.values()) {
if (id.equals(type.getId())) {
return type;
}
}
throw new IllegalArgumentException("No matching type for id: " + id);
}
}
| UTF-8 | Java | 853 | java | RegistrationResultCode.java | Java | [] | null | [] | package com.lynx.messaging.enums;
public enum RegistrationResultCode {
REGISTRATION_SUCCESS(1), REGISTRATION_FAILURE(2);
private int id;
private RegistrationResultCode(int id) {
this.id = id;
}
public int getId() {
return id;
}
/**
* Provide mapping enums with a fixed ID in JPA (a more robust alternative
* to EnumType.String and EnumType.Ordinal)
*
* @param id
* @return related RegistrationResultCode enum
* @see http://blog.chris-ritchie.com/2013/09/mapping-enums-with-fixed-id-in
* -jpa.html
*
*/
public static RegistrationResultCode getType(Integer id) {
if (id == null) {
return null;
}
for (RegistrationResultCode type : RegistrationResultCode.values()) {
if (id.equals(type.getId())) {
return type;
}
}
throw new IllegalArgumentException("No matching type for id: " + id);
}
}
| 853 | 0.685815 | 0.676436 | 38 | 21.447369 | 24.033636 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.421053 | false | false | 12 |
ae5facecc5f53dccef9c799e5e165c9b98f44834 | 27,410,481,309,165 | 570ddf656d23b52574e561322bb9998acd56f7ba | /src/main/java/me/purrfectpanda/minecartspeed/EventListener.java | 0654ad60615c6062994938a0d638b5eb11e9a36f | [] | no_license | PurrfectPanda/minecartspeed | https://github.com/PurrfectPanda/minecartspeed | 764fad4990501de288e8a9e2a554bc7ef13e37f3 | 6554674f1918359ff6ff9b49d16326897ee9fa78 | refs/heads/main | 2023-03-29T20:06:25.974000 | 2021-04-05T17:53:43 | 2021-04-05T17:53:43 | 352,385,428 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.purrfectpanda.minecartspeed;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.entity.Minecart;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.vehicle.*;
public class EventListener implements Listener {
private static BlockFace[] Sides = {BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH};
private Minecartspeed Plugin;
public EventListener(Minecartspeed plugin)
{
Plugin = plugin;
}
@EventHandler
public void onVehicleMove(VehicleMoveEvent event)
{
if (!(event.getVehicle() instanceof Minecart))
{
return;
}
Minecart cart = (Minecart) event.getVehicle();
if (cart.getPassengers().isEmpty())
{
return;
}
Block cartBlock = cart.getWorld().getBlockAt(cart.getLocation());
for (BlockFace face : Sides)
{
Block sideBlock = cartBlock.getRelative(face);
BlockState blockState = sideBlock.getState();
if (blockState instanceof Sign) {
Sign sign = (Sign) blockState;
if (sign.getLine(0).equalsIgnoreCase("speed")) {
try {
String line2 = sign.getLine(1);
double speed = 0;
if (line2.equalsIgnoreCase("snail"))
{
speed = 0.5;
}
else if (line2.equalsIgnoreCase("slime"))
{
speed = 1;
}
else if (line2.equalsIgnoreCase("zoom"))
{
speed = 12;
}
else if (line2.equalsIgnoreCase("trappy"))
{
speed = 50;
}
else
{
speed = Double.parseDouble(sign.getLine(1));
}
// Minecraft operates with speed per tick, our speed is per second,
// and normal server frame rate is 20 ticks per second
speed /= 20;
cart.setMaxSpeed(speed);
cart.setVelocity(cart.getVelocity().normalize().multiply(speed));
} catch (NumberFormatException e) {
Plugin.getLogger().warning("Sign at " +
sideBlock.getLocation().toString() +
" has illegal speed: " + sign.getLine(1));
}
}
}
}
}
}
| UTF-8 | Java | 2,894 | java | EventListener.java | Java | [
{
"context": "package me.purrfectpanda.minecartspeed;\n\nimport org.bukkit.block.Bloc",
"end": 19,
"score": 0.6236119270324707,
"start": 14,
"tag": "USERNAME",
"value": "rfect"
},
{
"context": "package me.purrfectpanda.minecartspeed;\n\nimport org.bukkit.block.Block;\nim",
"end": 24,
"score": 0.6057226061820984,
"start": 20,
"tag": "USERNAME",
"value": "anda"
}
] | null | [] | package me.purrfectpanda.minecartspeed;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.entity.Minecart;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.vehicle.*;
public class EventListener implements Listener {
private static BlockFace[] Sides = {BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH};
private Minecartspeed Plugin;
public EventListener(Minecartspeed plugin)
{
Plugin = plugin;
}
@EventHandler
public void onVehicleMove(VehicleMoveEvent event)
{
if (!(event.getVehicle() instanceof Minecart))
{
return;
}
Minecart cart = (Minecart) event.getVehicle();
if (cart.getPassengers().isEmpty())
{
return;
}
Block cartBlock = cart.getWorld().getBlockAt(cart.getLocation());
for (BlockFace face : Sides)
{
Block sideBlock = cartBlock.getRelative(face);
BlockState blockState = sideBlock.getState();
if (blockState instanceof Sign) {
Sign sign = (Sign) blockState;
if (sign.getLine(0).equalsIgnoreCase("speed")) {
try {
String line2 = sign.getLine(1);
double speed = 0;
if (line2.equalsIgnoreCase("snail"))
{
speed = 0.5;
}
else if (line2.equalsIgnoreCase("slime"))
{
speed = 1;
}
else if (line2.equalsIgnoreCase("zoom"))
{
speed = 12;
}
else if (line2.equalsIgnoreCase("trappy"))
{
speed = 50;
}
else
{
speed = Double.parseDouble(sign.getLine(1));
}
// Minecraft operates with speed per tick, our speed is per second,
// and normal server frame rate is 20 ticks per second
speed /= 20;
cart.setMaxSpeed(speed);
cart.setVelocity(cart.getVelocity().normalize().multiply(speed));
} catch (NumberFormatException e) {
Plugin.getLogger().warning("Sign at " +
sideBlock.getLocation().toString() +
" has illegal speed: " + sign.getLine(1));
}
}
}
}
}
}
| 2,894 | 0.470629 | 0.463372 | 83 | 33.86747 | 24.54294 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421687 | false | false | 12 |
a3b2504e5f0dba6cc229cc082fed196e55b177d2 | 27,917,287,458,861 | c7ced385fcb4d0cda72c2a0f85d3c1aa0d9c702c | /app/src/main/java/com/ll/anr/anr/receiver/DynamicWithTaskReceiverA.java | 9d21a687e501aad60e1e0a7846450a5c9af8f0b0 | [] | no_license | LuLei2013/ANR | https://github.com/LuLei2013/ANR | d66f88f7820bb0ebe33fa53e601367aba3382c0a | 6977d1ad65ee6a2d43041389e602d6bd92de0240 | refs/heads/master | 2020-03-21T20:29:21.515000 | 2018-06-29T07:54:31 | 2018-06-29T07:54:31 | 139,010,339 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ll.anr.anr.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
public class DynamicWithTaskReceiverA extends BroadcastReceiver {
final static int FIVE_SECONDS = 5 * 1000;
@Override
public void onReceive(Context context, Intent intent) {
Log.e("Ruby", "DynamicWithTaskReceiverA onReceive begin");
try {
Thread.sleep(FIVE_SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
new Handler(Looper.getMainLooper()).post(
new Runnable() {
@Override
public void run() {
Log.e("Ruby", "DynamicWithTaskReceiverA task start");
try {
Thread.sleep(4 * FIVE_SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
Log.e("Ruby", "DynamicWithTaskReceiverA task end");
}
}
);
Log.e("Ruby", "DynamicWithTaskReceiverA onReceive end");
}
}
| UTF-8 | Java | 1,268 | java | DynamicWithTaskReceiverA.java | Java | [] | null | [] | package com.ll.anr.anr.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
public class DynamicWithTaskReceiverA extends BroadcastReceiver {
final static int FIVE_SECONDS = 5 * 1000;
@Override
public void onReceive(Context context, Intent intent) {
Log.e("Ruby", "DynamicWithTaskReceiverA onReceive begin");
try {
Thread.sleep(FIVE_SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
new Handler(Looper.getMainLooper()).post(
new Runnable() {
@Override
public void run() {
Log.e("Ruby", "DynamicWithTaskReceiverA task start");
try {
Thread.sleep(4 * FIVE_SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
Log.e("Ruby", "DynamicWithTaskReceiverA task end");
}
}
);
Log.e("Ruby", "DynamicWithTaskReceiverA onReceive end");
}
}
| 1,268 | 0.544953 | 0.540221 | 38 | 32.36842 | 21.976568 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.578947 | false | false | 12 |
5585304e057eb28867dd650e080bb0b25205b351 | 19,533,511,310,667 | 38de4f1bfc25a9b86f040907931a21d191c5229b | /src/test/java/com/test/GitProject_p/Git_Class.java | 8172907b42a11b2fc9c3b34b10c06ee86f78fdd3 | [] | no_license | devayanip/Git_new | https://github.com/devayanip/Git_new | cafb87c25418fbbf96f01eaa1bc34f7d32a2f817 | 22ee6b9341fc7be64556f875cf5319689f499eb2 | refs/heads/master | 2020-04-29T15:28:13.511000 | 2019-03-19T05:30:46 | 2019-03-19T05:30:46 | 176,229,089 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.test.GitProject_p;
import org.testng.annotations.Test;
import com.aventstack.extentreports.ExtentReporter;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.Theme;
import org.testng.annotations.BeforeTest;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
public class Git_Class
{
WebDriver driver;
ExtentHtmlReporter report;
ExtentReports e;
ExtentTest t;
@Test
public void sign() throws InterruptedException
{
WebElement signbutton=driver.findElement(By.xpath("//a[@title='Log in to your customer account']"));
signbutton.click();
WebElement email=driver.findElement(By.id("email_create"));
email.sendKeys("sam@gmail.com");
Thread.sleep(3000);
WebElement submit=driver.findElement(By.id("SubmitCreate"));
submit.click();
}
@BeforeTest
public void beforeTest()
{
report=new ExtentHtmlReporter("Resource/makereport.html");
report.config().setTheme(Theme.DARK);
report.config().setChartVisibilityOnOpen(true);
report.setAppendExisting(true);
e=new ExtentReports();
e.attachReporter(report);
t=e.createTest("newtest");
t.pass("Started test");
System.setProperty("webdriver.chrome.driver", "Resource/chromedriver.exe");
driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://automationpractice.com/index.php");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@AfterTest
public void afterTest()
{
t.info("Finished test");
driver.quit();
e.flush();
}
}
| UTF-8 | Java | 1,922 | java | Git_Class.java | Java | [
{
"context": "lement(By.id(\"email_create\"));\n\t email.sendKeys(\"sam@gmail.com\");\n\t \n\t Thread.sleep(3000);\n\t \n\t WebElement s",
"end": 1030,
"score": 0.9998853802680969,
"start": 1017,
"tag": "EMAIL",
"value": "sam@gmail.com"
}
] | null | [] | package com.test.GitProject_p;
import org.testng.annotations.Test;
import com.aventstack.extentreports.ExtentReporter;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.Theme;
import org.testng.annotations.BeforeTest;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
public class Git_Class
{
WebDriver driver;
ExtentHtmlReporter report;
ExtentReports e;
ExtentTest t;
@Test
public void sign() throws InterruptedException
{
WebElement signbutton=driver.findElement(By.xpath("//a[@title='Log in to your customer account']"));
signbutton.click();
WebElement email=driver.findElement(By.id("email_create"));
email.sendKeys("<EMAIL>");
Thread.sleep(3000);
WebElement submit=driver.findElement(By.id("SubmitCreate"));
submit.click();
}
@BeforeTest
public void beforeTest()
{
report=new ExtentHtmlReporter("Resource/makereport.html");
report.config().setTheme(Theme.DARK);
report.config().setChartVisibilityOnOpen(true);
report.setAppendExisting(true);
e=new ExtentReports();
e.attachReporter(report);
t=e.createTest("newtest");
t.pass("Started test");
System.setProperty("webdriver.chrome.driver", "Resource/chromedriver.exe");
driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://automationpractice.com/index.php");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@AfterTest
public void afterTest()
{
t.info("Finished test");
driver.quit();
e.flush();
}
}
| 1,916 | 0.734651 | 0.73153 | 76 | 24.289474 | 23.095804 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.065789 | false | false | 12 |
81764fcad6b9d0014abe2b3de6b01ebeee77ce37 | 16,320,875,739,244 | b7b4887847a6f16206a776536d08247848af04b4 | /RJRA/src/com/rjra/activty/newactivty/AwardRecommendActivity.java | 0a42aa071e5664a958e05addf482f79e8e225a33 | [] | no_license | JHoo1988/gdd | https://github.com/JHoo1988/gdd | 44338d3e91cec2f95cbaf07db25399fa162abd65 | 639a27155ba6c38612551630885d99e5dbe67c51 | refs/heads/master | 2016-06-12T08:38:58.394000 | 2016-04-13T09:44:52 | 2016-04-13T09:44:52 | 56,139,440 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rjra.activty.newactivty;
import java.util.ArrayList;
import java.util.List;
import roboguice.inject.ContentView;
import roboguice.inject.InjectView;
import roboguice.util.RoboAsyncTask;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.TextView;
import com.android.rjra.volley.listener.HttpBackListener;
import com.google.inject.Inject;
import com.rjra.UrlConstant;
import com.rjra.activty.MyRecommendDetailActivity;
import com.rjra.activty.SendSMSActivity;
import com.rjra.adapter.MyRecommendAdapter2;
import com.rjra.domain.ResultListEntity;
import com.rjra.domain.base.ResponseJosn;
import com.rjra.domain.bo.UserBo;
import com.rjra.domain.bo.UserRecommendBo;
import com.rjra.domain.bo.WalletIncomeWorkBountyBo;
import com.rjra.domain.bo.WorkBo;
import com.rjra.domain.bo.param.UserRecommendParam;
import com.rjra.eventbus.event.UserRecommendEvent;
import com.rjra.job.R;
import com.rjra.server.module.IRjRaServerStub;
import com.rjra.view.ActionSheetDialog;
import com.rjra.view.ActionSheetDialog.OnSheetItemClickListener;
import com.rjra.view.ActionSheetDialog.SheetItemColor;
import com.rjra.view.AlertDialog;
import com.umeng.analytics.MobclickAgent;
import de.greenrobot.event.EventBus;
/**
* 有奖推荐详情
*
* @author Administrator
*/
@ContentView(R.layout.activty_award_recommend_layout)
public class AwardRecommendActivity extends BaseListViewActivty implements OnClickListener, OnItemClickListener {
private final String mPageName = AwardRecommendActivity.class.getSimpleName();
private MyRecommendAdapter2 mListAdapter;
@InjectView(R.id.title_tv)
private TextView title_tv;
@InjectView(R.id.money_amount)
private TextView money_amount;
private TextView award_rule_tv;
private TextView award_num_tv;
@InjectView(R.id.award_btn)
private Button award_btn;
// 推荐奖金
private WorkBo workBo;
private UserRecommendParam param;
public static Intent creatIntent(Context context, WorkBo workBo) {
Intent intent = new Intent(context, AwardRecommendActivity.class);
intent.putExtra("workBo", workBo);
return intent;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
initViews();
initDate(workBo);
}
private void initDate(WorkBo work) {
String str = String.format(AwardRecommendActivity.this.getResources().getString(R.string.have_award_num), 0);
award_num_tv.setText(str);
if (null != work) {
if (null != work.getWorkBonus()) {
money_amount.setText(String.valueOf(work.getWorkBonus()));
} else {
money_amount.setText(String.valueOf(0));
}
// if(!TextUtils.isEmpty(work.getWorkRecommendRule())) {
// award_rule_tv.setText(work.getWorkRecommendRule());
// }
}
}
public void onEventMainThread(UserRecommendEvent event) {
if (event.isRefresh()) {
ptrFrameLayout.postDelayed(new Runnable() {
@Override
public void run() {
ptrFrameLayout.autoRefresh(true);
}
}, 150);
}
}
/**
* 初始化控件
*/
private void initViews() {
title_tv.setText("有奖推荐");
workBo = (WorkBo) getIntent().getSerializableExtra("workBo");
if (null != workBo) {
new GetWalletIncomeWorkBountyTask(context, workBo.getWorkId()).execute();
}
//View headView = LayoutInflater.from(this).inflate(R.layout.award_recommend_header, null);
award_rule_tv = (TextView)findViewById(R.id.award_rule_tv);
award_num_tv = (TextView)findViewById(R.id.award_num_tv);
mListAdapter = new MyRecommendAdapter2(context, new ArrayList<UserRecommendBo>());
mListView.setAdapter(mListAdapter);
mListView.setDivider(null);
//mListView.addHeaderView(headView);
award_btn.setOnClickListener(this);
mListView.setOnItemClickListener(this);
// 默认初始化mListView
ptrFrameLayout.postDelayed(new Runnable() {
@Override
public void run() {
ptrFrameLayout.autoRefresh(true);
}
}, 150);
// param = new UserRecommendParam();
// UserBo userBo = UrlConstant.getCurrentLoginUser(this);
// param.setRecommendUserId(userBo.getUserId().longValue());
// param.setPage(currentPagte);
// param.setSize(UrlConstant.LOADNUM);
// new GetUserRecommendTask(context, param).execute();
}
@Override
public void onBackPressed() {
finish();
super.onBackPressed();
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onPageStart(mPageName); // 统计页面
MobclickAgent.onResume(this); // 统计时长
}
public void onPause() {
super.onPause();
MobclickAgent.onPageEnd(mPageName); // 保证 onPageEnd 在onPause 之前调用,因为
// onPause 中会保存信息
MobclickAgent.onPause(this);
}
@Override
public void refreshData(HttpBackListener<ResponseJosn> responseListener) {
param = new UserRecommendParam();
if (null != UrlConstant.getCurrentLoginUser(this))
param.setRecommendUserId(UrlConstant.getCurrentLoginUser(this).getUserId().longValue());
if (null != workBo)
param.setRecommendWorkId(workBo.getWorkId());
param.setPage(currentPagte);
param.setSize(UrlConstant.LOADNUM);
new GetUserRecommendTask(context, param).execute();
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
if (null == mListAdapter || null == mListAdapter.getList() || mListAdapter.getList().size() <= 0) {
return;
}
// 跳转至招聘详情
//arg2 = arg2 - 1;
if (arg2 >= mListAdapter.getList().size()) {
arg2 = mListAdapter.getList().size() - 1;
}
if (arg2 <= 0) {
arg2 = 0;
}
/*
* mListAdapter.getList().get(arg2).setScanCount(mListAdapter.getList().get(arg2).getScanCount()+1);
* mListAdapter.notifyDataSetChanged();
*/
if (null != mListAdapter.getList() && null != mListAdapter.getList().get(arg2)) {
startActivity(MyRecommendDetailActivity.creatIntent(context, mListAdapter.getList().get(arg2)));
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.back_tv:
this.finish();
break;
case R.id.award_btn:
MobclickAgent.onEvent(context, "award_iwant_01");
// startActivityForResult(IWantRecommendActivity.creatIntent(context, workBo),0x55);
ActionSheetDialog dialog = new ActionSheetDialog(context);
dialog.builder().setCancelable(false).setCanceledOnTouchOutside(true);
dialog.addSheetItem("通讯录", SheetItemColor.Black, new OnSheetItemClickListener() {
@Override
public void onClick(int which) {
MobclickAgent.onEvent(context, "award_addressbook_02");
startActivityForResult(
SendSMSActivity.creatIntent(context, workBo, UrlConstant.getCurrentLoginUser(context)
.getUserId().intValue()), 0x55);
}
});
dialog.addSheetItem("历史推荐", SheetItemColor.Black, new OnSheetItemClickListener() {
@Override
public void onClick(int which) {
MobclickAgent.onEvent(context, "award_history_03");
UserBo userBo = UrlConstant.getCurrentLoginUser(context);
if (null != userBo) {
startActivityForResult(SendSMSActivity.creatIntent(context, workBo, userBo.getUserId()),
0x55);
} else {
new AlertDialog(context).builder().setTitle(getText(R.string.warning).toString())
.setMsg(getText(R.string.login_first).toString())
.setPositiveButton(getText(R.string.sure).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(context, LoginNewActivity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
startActivity(intent1);
}
}).setNegativeButton(getText(R.string.cancel).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
return;
}
}).show();
}
}
});
dialog.addSheetItem("手动输入", SheetItemColor.Black, new OnSheetItemClickListener() {
@Override
public void onClick(int which) {
MobclickAgent.onEvent(context, "award_input_04");
UserBo userBo = UrlConstant.getCurrentLoginUser(context);
if (null != userBo) {
startActivityForResult(
RecommendTalentActivity.creatIntent(context, workBo, userBo.getUserId()), 0x55);
} else {
new AlertDialog(context).builder().setTitle(getText(R.string.warning).toString())
.setMsg(getText(R.string.login_first).toString())
.setPositiveButton(getText(R.string.sure).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(context, LoginNewActivity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
startActivity(intent1);
}
}).setNegativeButton(getText(R.string.cancel).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
return;
}
}).show();
}
// startActivity(RecommendTalentActivity.creatIntent(context));
}
});
dialog.show();
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (null == data)
return;
if (requestCode == 0x55) {
boolean fresh = data.getBooleanExtra("refresh", false);
if (fresh) {
param = new UserRecommendParam();
if (null != UrlConstant.getCurrentLoginUser(this))
param.setRecommendUserId(UrlConstant.getCurrentLoginUser(this).getUserId().longValue());
if (null != workBo)
param.setRecommendWorkId(workBo.getWorkId());
param.setPage(currentPagte);
param.setSize(UrlConstant.LOADNUM);
new GetUserRecommendTask(context, param).execute();
}
}
}
class GetUserRecommendTask extends RoboAsyncTask<ResultListEntity<UserRecommendBo>> {
private UserRecommendParam param;
protected GetUserRecommendTask(Context context, UserRecommendParam param) {
super(context);
this.param = param;
}
@Override
public ResultListEntity<UserRecommendBo> call() throws Exception {
return ixmanServerStub.getAllUserRecommendByPager(param);
}
@Override
protected void onSuccess(final ResultListEntity<UserRecommendBo> t) throws Exception {
super.onSuccess(t);
runOnUiThread(new Runnable() {
public void run() {
ptrFrameLayout.refreshComplete();
if (currentPagte != 1 && (null==t ||null == t.getResultList() || t.getResultList().size() == 0)) {
mListView.setHasMore(false);
}
if (null != t && null != t.getResultList() && t.getResultList().size() > 0) {
if (currentPagte >= t.getPageCount()) {
mListView.setHasMore(false);
}
nodateTip.setVisibility(View.GONE);
String str = String.format(
AwardRecommendActivity.this.getResources().getString(R.string.have_award_num),
t.getRecordCount());
award_num_tv.setText(str);
if (null != mListAdapter) {
if (currentPagte == 1) {
mListAdapter.clear(t.getResultList());
} else {
mListAdapter.appendList(t.getResultList());
mListAdapter.notifyDataSetChanged();
}
} else {
mListAdapter = new MyRecommendAdapter2(context, t.getResultList());
mListView.setAdapter(mListAdapter);
}
} else {
if(currentPagte==1){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
nodateTip.setVisibility(View.VISIBLE);
}
}, 800);
}
}
mListView.onBottomComplete();
if (currentPagte == 1 && null != mListAdapter && null != mListAdapter.getList()
&& mListAdapter.getList().size() > 0)
mListView.setSelection(0);
}
});
}
@Override
protected void onException(Exception e) throws RuntimeException {
mListView.onBottomComplete();
ptrFrameLayout.refreshComplete();
super.onException(e);
}
}
class GetWalletIncomeWorkBountyTask extends RoboAsyncTask<List<WalletIncomeWorkBountyBo>> {
private long workId;
@Inject
private IRjRaServerStub stub;
public GetWalletIncomeWorkBountyTask(Context context, long workId) {
super(context);
this.workId = workId;
}
@Override
public List<WalletIncomeWorkBountyBo> call() throws Exception {
return stub.getWalletIncomeWorkBounty(workId);
}
@Override
protected void onException(Exception e) throws RuntimeException {
super.onException(e);
}
@Override
protected void onInterrupted(Exception e) {
super.onInterrupted(e);
}
@Override
protected void onSuccess(List<WalletIncomeWorkBountyBo> t) throws Exception {
super.onSuccess(t);
StringBuilder sb = new StringBuilder();
if (null != t && t.size() > 0) {
String name = "";
for (int i = 0; i < t.size(); i++) {
if (!TextUtils.isEmpty(t.get(i).getRuleName())) {
name = t.get(i).getRuleName();
if (name.contains("入职")) {
if(null!=t.get(i).getRuleNeedTime() && t.get(i).getRuleNeedTime().intValue()>0){
name = name + String.valueOf(t.get(i).getRuleNeedTime().intValue())+"天";
}
}
name = name + "奖励推荐人";
sb.append(name).append(": ").append(doubleTrans(t.get(i).getRuleRecommendMoney()))
.append(" 元 ");
if(null!=t.get(i).getRuleToRecommendMoney() && t.get(i).getRuleToRecommendMoney().intValue()>0){
sb.append(",奖励被推荐人");
sb.append(doubleTrans(t.get(i).getRuleToRecommendMoney()));
sb.append(" 元 ");
}
if (i < t.size() - 1)
sb.append("\n");
}
}
}
// String str = sb.toString().replace("已", "人才");
award_rule_tv.setText(sb.toString());
}
}
public static String doubleTrans(double num) {
if (Math.round(num) - num == 0) {
return String.valueOf((long) num);
}
return String.valueOf(num);
}
}
| UTF-8 | Java | 18,437 | java | AwardRecommendActivity.java | Java | [
{
"context": "obot.event.EventBus;\n\n/**\n * 有奖推荐详情\n * \n * @author Administrator\n */\n@ContentView(R.layout.activty_award_recommend",
"end": 1561,
"score": 0.9816257953643799,
"start": 1548,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package com.rjra.activty.newactivty;
import java.util.ArrayList;
import java.util.List;
import roboguice.inject.ContentView;
import roboguice.inject.InjectView;
import roboguice.util.RoboAsyncTask;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.TextView;
import com.android.rjra.volley.listener.HttpBackListener;
import com.google.inject.Inject;
import com.rjra.UrlConstant;
import com.rjra.activty.MyRecommendDetailActivity;
import com.rjra.activty.SendSMSActivity;
import com.rjra.adapter.MyRecommendAdapter2;
import com.rjra.domain.ResultListEntity;
import com.rjra.domain.base.ResponseJosn;
import com.rjra.domain.bo.UserBo;
import com.rjra.domain.bo.UserRecommendBo;
import com.rjra.domain.bo.WalletIncomeWorkBountyBo;
import com.rjra.domain.bo.WorkBo;
import com.rjra.domain.bo.param.UserRecommendParam;
import com.rjra.eventbus.event.UserRecommendEvent;
import com.rjra.job.R;
import com.rjra.server.module.IRjRaServerStub;
import com.rjra.view.ActionSheetDialog;
import com.rjra.view.ActionSheetDialog.OnSheetItemClickListener;
import com.rjra.view.ActionSheetDialog.SheetItemColor;
import com.rjra.view.AlertDialog;
import com.umeng.analytics.MobclickAgent;
import de.greenrobot.event.EventBus;
/**
* 有奖推荐详情
*
* @author Administrator
*/
@ContentView(R.layout.activty_award_recommend_layout)
public class AwardRecommendActivity extends BaseListViewActivty implements OnClickListener, OnItemClickListener {
private final String mPageName = AwardRecommendActivity.class.getSimpleName();
private MyRecommendAdapter2 mListAdapter;
@InjectView(R.id.title_tv)
private TextView title_tv;
@InjectView(R.id.money_amount)
private TextView money_amount;
private TextView award_rule_tv;
private TextView award_num_tv;
@InjectView(R.id.award_btn)
private Button award_btn;
// 推荐奖金
private WorkBo workBo;
private UserRecommendParam param;
public static Intent creatIntent(Context context, WorkBo workBo) {
Intent intent = new Intent(context, AwardRecommendActivity.class);
intent.putExtra("workBo", workBo);
return intent;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
initViews();
initDate(workBo);
}
private void initDate(WorkBo work) {
String str = String.format(AwardRecommendActivity.this.getResources().getString(R.string.have_award_num), 0);
award_num_tv.setText(str);
if (null != work) {
if (null != work.getWorkBonus()) {
money_amount.setText(String.valueOf(work.getWorkBonus()));
} else {
money_amount.setText(String.valueOf(0));
}
// if(!TextUtils.isEmpty(work.getWorkRecommendRule())) {
// award_rule_tv.setText(work.getWorkRecommendRule());
// }
}
}
public void onEventMainThread(UserRecommendEvent event) {
if (event.isRefresh()) {
ptrFrameLayout.postDelayed(new Runnable() {
@Override
public void run() {
ptrFrameLayout.autoRefresh(true);
}
}, 150);
}
}
/**
* 初始化控件
*/
private void initViews() {
title_tv.setText("有奖推荐");
workBo = (WorkBo) getIntent().getSerializableExtra("workBo");
if (null != workBo) {
new GetWalletIncomeWorkBountyTask(context, workBo.getWorkId()).execute();
}
//View headView = LayoutInflater.from(this).inflate(R.layout.award_recommend_header, null);
award_rule_tv = (TextView)findViewById(R.id.award_rule_tv);
award_num_tv = (TextView)findViewById(R.id.award_num_tv);
mListAdapter = new MyRecommendAdapter2(context, new ArrayList<UserRecommendBo>());
mListView.setAdapter(mListAdapter);
mListView.setDivider(null);
//mListView.addHeaderView(headView);
award_btn.setOnClickListener(this);
mListView.setOnItemClickListener(this);
// 默认初始化mListView
ptrFrameLayout.postDelayed(new Runnable() {
@Override
public void run() {
ptrFrameLayout.autoRefresh(true);
}
}, 150);
// param = new UserRecommendParam();
// UserBo userBo = UrlConstant.getCurrentLoginUser(this);
// param.setRecommendUserId(userBo.getUserId().longValue());
// param.setPage(currentPagte);
// param.setSize(UrlConstant.LOADNUM);
// new GetUserRecommendTask(context, param).execute();
}
@Override
public void onBackPressed() {
finish();
super.onBackPressed();
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onPageStart(mPageName); // 统计页面
MobclickAgent.onResume(this); // 统计时长
}
public void onPause() {
super.onPause();
MobclickAgent.onPageEnd(mPageName); // 保证 onPageEnd 在onPause 之前调用,因为
// onPause 中会保存信息
MobclickAgent.onPause(this);
}
@Override
public void refreshData(HttpBackListener<ResponseJosn> responseListener) {
param = new UserRecommendParam();
if (null != UrlConstant.getCurrentLoginUser(this))
param.setRecommendUserId(UrlConstant.getCurrentLoginUser(this).getUserId().longValue());
if (null != workBo)
param.setRecommendWorkId(workBo.getWorkId());
param.setPage(currentPagte);
param.setSize(UrlConstant.LOADNUM);
new GetUserRecommendTask(context, param).execute();
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
if (null == mListAdapter || null == mListAdapter.getList() || mListAdapter.getList().size() <= 0) {
return;
}
// 跳转至招聘详情
//arg2 = arg2 - 1;
if (arg2 >= mListAdapter.getList().size()) {
arg2 = mListAdapter.getList().size() - 1;
}
if (arg2 <= 0) {
arg2 = 0;
}
/*
* mListAdapter.getList().get(arg2).setScanCount(mListAdapter.getList().get(arg2).getScanCount()+1);
* mListAdapter.notifyDataSetChanged();
*/
if (null != mListAdapter.getList() && null != mListAdapter.getList().get(arg2)) {
startActivity(MyRecommendDetailActivity.creatIntent(context, mListAdapter.getList().get(arg2)));
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.back_tv:
this.finish();
break;
case R.id.award_btn:
MobclickAgent.onEvent(context, "award_iwant_01");
// startActivityForResult(IWantRecommendActivity.creatIntent(context, workBo),0x55);
ActionSheetDialog dialog = new ActionSheetDialog(context);
dialog.builder().setCancelable(false).setCanceledOnTouchOutside(true);
dialog.addSheetItem("通讯录", SheetItemColor.Black, new OnSheetItemClickListener() {
@Override
public void onClick(int which) {
MobclickAgent.onEvent(context, "award_addressbook_02");
startActivityForResult(
SendSMSActivity.creatIntent(context, workBo, UrlConstant.getCurrentLoginUser(context)
.getUserId().intValue()), 0x55);
}
});
dialog.addSheetItem("历史推荐", SheetItemColor.Black, new OnSheetItemClickListener() {
@Override
public void onClick(int which) {
MobclickAgent.onEvent(context, "award_history_03");
UserBo userBo = UrlConstant.getCurrentLoginUser(context);
if (null != userBo) {
startActivityForResult(SendSMSActivity.creatIntent(context, workBo, userBo.getUserId()),
0x55);
} else {
new AlertDialog(context).builder().setTitle(getText(R.string.warning).toString())
.setMsg(getText(R.string.login_first).toString())
.setPositiveButton(getText(R.string.sure).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(context, LoginNewActivity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
startActivity(intent1);
}
}).setNegativeButton(getText(R.string.cancel).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
return;
}
}).show();
}
}
});
dialog.addSheetItem("手动输入", SheetItemColor.Black, new OnSheetItemClickListener() {
@Override
public void onClick(int which) {
MobclickAgent.onEvent(context, "award_input_04");
UserBo userBo = UrlConstant.getCurrentLoginUser(context);
if (null != userBo) {
startActivityForResult(
RecommendTalentActivity.creatIntent(context, workBo, userBo.getUserId()), 0x55);
} else {
new AlertDialog(context).builder().setTitle(getText(R.string.warning).toString())
.setMsg(getText(R.string.login_first).toString())
.setPositiveButton(getText(R.string.sure).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(context, LoginNewActivity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
startActivity(intent1);
}
}).setNegativeButton(getText(R.string.cancel).toString(), new OnClickListener() {
@Override
public void onClick(View v) {
return;
}
}).show();
}
// startActivity(RecommendTalentActivity.creatIntent(context));
}
});
dialog.show();
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (null == data)
return;
if (requestCode == 0x55) {
boolean fresh = data.getBooleanExtra("refresh", false);
if (fresh) {
param = new UserRecommendParam();
if (null != UrlConstant.getCurrentLoginUser(this))
param.setRecommendUserId(UrlConstant.getCurrentLoginUser(this).getUserId().longValue());
if (null != workBo)
param.setRecommendWorkId(workBo.getWorkId());
param.setPage(currentPagte);
param.setSize(UrlConstant.LOADNUM);
new GetUserRecommendTask(context, param).execute();
}
}
}
class GetUserRecommendTask extends RoboAsyncTask<ResultListEntity<UserRecommendBo>> {
private UserRecommendParam param;
protected GetUserRecommendTask(Context context, UserRecommendParam param) {
super(context);
this.param = param;
}
@Override
public ResultListEntity<UserRecommendBo> call() throws Exception {
return ixmanServerStub.getAllUserRecommendByPager(param);
}
@Override
protected void onSuccess(final ResultListEntity<UserRecommendBo> t) throws Exception {
super.onSuccess(t);
runOnUiThread(new Runnable() {
public void run() {
ptrFrameLayout.refreshComplete();
if (currentPagte != 1 && (null==t ||null == t.getResultList() || t.getResultList().size() == 0)) {
mListView.setHasMore(false);
}
if (null != t && null != t.getResultList() && t.getResultList().size() > 0) {
if (currentPagte >= t.getPageCount()) {
mListView.setHasMore(false);
}
nodateTip.setVisibility(View.GONE);
String str = String.format(
AwardRecommendActivity.this.getResources().getString(R.string.have_award_num),
t.getRecordCount());
award_num_tv.setText(str);
if (null != mListAdapter) {
if (currentPagte == 1) {
mListAdapter.clear(t.getResultList());
} else {
mListAdapter.appendList(t.getResultList());
mListAdapter.notifyDataSetChanged();
}
} else {
mListAdapter = new MyRecommendAdapter2(context, t.getResultList());
mListView.setAdapter(mListAdapter);
}
} else {
if(currentPagte==1){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
nodateTip.setVisibility(View.VISIBLE);
}
}, 800);
}
}
mListView.onBottomComplete();
if (currentPagte == 1 && null != mListAdapter && null != mListAdapter.getList()
&& mListAdapter.getList().size() > 0)
mListView.setSelection(0);
}
});
}
@Override
protected void onException(Exception e) throws RuntimeException {
mListView.onBottomComplete();
ptrFrameLayout.refreshComplete();
super.onException(e);
}
}
class GetWalletIncomeWorkBountyTask extends RoboAsyncTask<List<WalletIncomeWorkBountyBo>> {
private long workId;
@Inject
private IRjRaServerStub stub;
public GetWalletIncomeWorkBountyTask(Context context, long workId) {
super(context);
this.workId = workId;
}
@Override
public List<WalletIncomeWorkBountyBo> call() throws Exception {
return stub.getWalletIncomeWorkBounty(workId);
}
@Override
protected void onException(Exception e) throws RuntimeException {
super.onException(e);
}
@Override
protected void onInterrupted(Exception e) {
super.onInterrupted(e);
}
@Override
protected void onSuccess(List<WalletIncomeWorkBountyBo> t) throws Exception {
super.onSuccess(t);
StringBuilder sb = new StringBuilder();
if (null != t && t.size() > 0) {
String name = "";
for (int i = 0; i < t.size(); i++) {
if (!TextUtils.isEmpty(t.get(i).getRuleName())) {
name = t.get(i).getRuleName();
if (name.contains("入职")) {
if(null!=t.get(i).getRuleNeedTime() && t.get(i).getRuleNeedTime().intValue()>0){
name = name + String.valueOf(t.get(i).getRuleNeedTime().intValue())+"天";
}
}
name = name + "奖励推荐人";
sb.append(name).append(": ").append(doubleTrans(t.get(i).getRuleRecommendMoney()))
.append(" 元 ");
if(null!=t.get(i).getRuleToRecommendMoney() && t.get(i).getRuleToRecommendMoney().intValue()>0){
sb.append(",奖励被推荐人");
sb.append(doubleTrans(t.get(i).getRuleToRecommendMoney()));
sb.append(" 元 ");
}
if (i < t.size() - 1)
sb.append("\n");
}
}
}
// String str = sb.toString().replace("已", "人才");
award_rule_tv.setText(sb.toString());
}
}
public static String doubleTrans(double num) {
if (Math.round(num) - num == 0) {
return String.valueOf((long) num);
}
return String.valueOf(num);
}
}
| 18,437 | 0.531289 | 0.527019 | 444 | 40.137386 | 30.151293 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.572072 | false | false | 12 |
e443be42ca46fd6be753606fb78dfa9e3214f9a0 | 16,638,703,365,870 | 01d8af978d1b0a17fc8754dde9b429e5adb14e8d | /question278_First_Bad_Version/FirstBadVersion.java | e6828d12c98701d9ca5649c1e5c40097381713fc | [] | no_license | zhangCabbage/leetcode | https://github.com/zhangCabbage/leetcode | a0e9944c08a8776f387f0eea8edf464174df8a91 | 46c7c6e3e12e51632d9f934dade854232c62d801 | refs/heads/master | 2020-04-04T04:12:53.696000 | 2017-08-16T14:06:44 | 2017-08-16T14:06:44 | 55,337,533 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package zhang.algorithm.leetcode.question278_First_Bad_Version;
/**
* Created by IntelliJ IDEA.
* User: zhang_MacPro
* Date: 16/8/12
* Time: 下午8:26
* To change this template use File | Settings | File Templates.
*/
public class FirstBadVersion {
/**
* <strong>result of test:</strong>
* 21 / 21 test cases passed
* Status: Accepted
* Runtime: 18 ms, bit 54.15%
*
* @param n
* @return
*/
public int firstBadVersion(int n) {
int left = 1;
int right = n;
while (left < right) {
// int mid = (int) (((long) left + right) >> 1);
int mid = left + (right - left) >> 1;
//use this way need not to consider that over the limit of int
if (isBadVersion(mid)) {
right = mid;
} else {
left = mid + 1;
}
}
return left;
}
/**
* this is more slow way!
*
* @param n
* @return
*/
public int firstBadVersion2(int n) {
int start = 1;
int end = n;
if (isBadVersion(start)) return start;
while (true) {
int mid = start + ((end - start) >> 1);
//attention this way + is prior than >>
int next = mid + 1;
if (mid == n) return n;
boolean res = isBadVersion(mid);
boolean nextRes = isBadVersion(next);
if (!res && nextRes) return next;
if (res) end = mid;
if (!nextRes) start = next;
}
}
private boolean isBadVersion(int version) {
return version < 3 ? false : true;
}
public static void main(String[] args) {
FirstBadVersion test = new FirstBadVersion();
int n = 3;
System.out.println(test.firstBadVersion(n));
}
}
| UTF-8 | Java | 1,832 | java | FirstBadVersion.java | Java | [
{
"context": "ersion;\n\n/**\n * Created by IntelliJ IDEA.\n * User: zhang_MacPro\n * Date: 16/8/12\n * Time: 下午8:26\n * To change thi",
"end": 119,
"score": 0.9993715286254883,
"start": 107,
"tag": "USERNAME",
"value": "zhang_MacPro"
}
] | null | [] | package zhang.algorithm.leetcode.question278_First_Bad_Version;
/**
* Created by IntelliJ IDEA.
* User: zhang_MacPro
* Date: 16/8/12
* Time: 下午8:26
* To change this template use File | Settings | File Templates.
*/
public class FirstBadVersion {
/**
* <strong>result of test:</strong>
* 21 / 21 test cases passed
* Status: Accepted
* Runtime: 18 ms, bit 54.15%
*
* @param n
* @return
*/
public int firstBadVersion(int n) {
int left = 1;
int right = n;
while (left < right) {
// int mid = (int) (((long) left + right) >> 1);
int mid = left + (right - left) >> 1;
//use this way need not to consider that over the limit of int
if (isBadVersion(mid)) {
right = mid;
} else {
left = mid + 1;
}
}
return left;
}
/**
* this is more slow way!
*
* @param n
* @return
*/
public int firstBadVersion2(int n) {
int start = 1;
int end = n;
if (isBadVersion(start)) return start;
while (true) {
int mid = start + ((end - start) >> 1);
//attention this way + is prior than >>
int next = mid + 1;
if (mid == n) return n;
boolean res = isBadVersion(mid);
boolean nextRes = isBadVersion(next);
if (!res && nextRes) return next;
if (res) end = mid;
if (!nextRes) start = next;
}
}
private boolean isBadVersion(int version) {
return version < 3 ? false : true;
}
public static void main(String[] args) {
FirstBadVersion test = new FirstBadVersion();
int n = 3;
System.out.println(test.firstBadVersion(n));
}
}
| 1,832 | 0.50547 | 0.488512 | 68 | 25.882353 | 18.506382 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382353 | false | false | 12 |
52437b2252bef941136f5283ef72668b4c2c587d | 24,103,356,507,012 | 8d926bcfa6255b40e92ec76733e2c7dd9703b10e | /src/main/java/cybersoft/javabackend/java12/gira/user/validation/validator/UniqueEmailValidator.java | 620bec1cb681ddb209c67d982d3c0d776713f591 | [] | no_license | tuanphanhcm/cybersoft-java12-gira | https://github.com/tuanphanhcm/cybersoft-java12-gira | 454367c571c42dd2f3899b3b7b8b71a184d69620 | a5be2df6d1f7cd91a9e08ed9139c4f02ffdab4ce | refs/heads/develop | 2023-08-21T17:44:03.610000 | 2021-08-29T10:28:44 | 2021-08-29T10:28:44 | 391,286,090 | 0 | 1 | null | false | 2021-08-29T10:28:44 | 2021-07-31T07:34:44 | 2021-08-29T07:01:45 | 2021-08-29T10:28:44 | 81 | 0 | 1 | 0 | Java | false | false | package cybersoft.javabackend.java12.gira.user.validation.validator;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import cybersoft.javabackend.java12.gira.common.util.ValidatorUtils;
import cybersoft.javabackend.java12.gira.user.service.UserService;
import cybersoft.javabackend.java12.gira.user.validation.annotation.UniqueEmail;
public class UniqueEmailValidator implements ConstraintValidator<UniqueEmail, String> {
private String message;
private UserService service;
public UniqueEmailValidator(UserService userService) {
service = userService;
}
@Override
public void initialize(UniqueEmail uniqueEmail) {
message = uniqueEmail.message();
}
@Override
public boolean isValid(String email, ConstraintValidatorContext context) {
if(email == null)
return false;
boolean isTaken = service.isTakenEmail(email);
if(!isTaken)
return true;
ValidatorUtils.addError(context, message);
return false;
}
}
| UTF-8 | Java | 999 | java | UniqueEmailValidator.java | Java | [] | null | [] | package cybersoft.javabackend.java12.gira.user.validation.validator;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import cybersoft.javabackend.java12.gira.common.util.ValidatorUtils;
import cybersoft.javabackend.java12.gira.user.service.UserService;
import cybersoft.javabackend.java12.gira.user.validation.annotation.UniqueEmail;
public class UniqueEmailValidator implements ConstraintValidator<UniqueEmail, String> {
private String message;
private UserService service;
public UniqueEmailValidator(UserService userService) {
service = userService;
}
@Override
public void initialize(UniqueEmail uniqueEmail) {
message = uniqueEmail.message();
}
@Override
public boolean isValid(String email, ConstraintValidatorContext context) {
if(email == null)
return false;
boolean isTaken = service.isTakenEmail(email);
if(!isTaken)
return true;
ValidatorUtils.addError(context, message);
return false;
}
}
| 999 | 0.797798 | 0.78979 | 37 | 26 | 27.077467 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.540541 | false | false | 12 |
3b8527ce189fdb6d4eb1fa18c00880cdd36e74f8 | 5,600,637,385,592 | a2f735100130babcc12a36bdfcc98e03b67d9b4b | /src/com/inwiss/springcrud/web/depose/DataImportController.java | 65c998c433d3d7a0e36a170ac9b29c9c1c34a4f1 | [] | no_license | raidery/ridex | https://github.com/raidery/ridex | 3a200e2763a1bb88a62ac9214bea6999c471d7e5 | 6daa0bd368dc5efa471e6837b985a73b53e63142 | refs/heads/master | 2016-08-04T04:25:23.726000 | 2013-09-23T01:40:38 | 2013-09-23T14:58:05 | 1,640,893 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Created on 2005-10-16
*/
package com.inwiss.springcrud.web.depose;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import com.inwiss.springcrud.command.RecordCommand;
import com.inwiss.springcrud.command.RecordSetCommand;
import com.inwiss.springcrud.metadata.ImportMeta;
import com.inwiss.springcrud.support.txtimport.ImportDataPersistentStrategy;
import com.inwiss.springcrud.web.controller.ControllerUtil;
/**
* @author <a href="mailto:ljglory@126.com">Lujie</a>
*/
public class DataImportController extends AbstractController
{
/**给Controller使用的工具对象*/
private ControllerUtil controllerUtil;
/**
* @see org.springframework.web.servlet.mvc.AbstractController#handleRequestInternal(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception
{
ImportMeta importMeta = controllerUtil.retrieveImportMetaByRequestParameter(request);
int nRecordCount = Integer.parseInt(request.getParameter("nrOfElements"));
RecordSetCommand command = new RecordSetCommand();
command.setRecords(new RecordCommand[nRecordCount]);
for ( int i = 0; i < nRecordCount; i++ )
command.getRecords()[i] = new RecordCommand();
/**
* Spring3.0.5
*/
ServletRequestDataBinder binder = new ServletRequestDataBinder(command);
binder.bind(request);
/**
* Spring1.2
*/
//BindUtils.bind(request, command, "");
ImportDataPersistentStrategy persistentStrategy = importMeta.getImportDataPersistentStrategy();
persistentStrategy.persistentImportData(command, importMeta);
System.out.println("I'm been called!");
return new ModelAndView("listRedirectView","crudMeta",importMeta.getCrudMeta());
}
/**
* @param controllerUtil The controllerUtil to set.
*/
public void setControllerUtil(ControllerUtil controllerUtil)
{
this.controllerUtil = controllerUtil;
}
}
| UTF-8 | Java | 2,372 | java | DataImportController.java | Java | [
{
"context": "er.ControllerUtil;\n/**\n * @author <a href=\"mailto:ljglory@126.com\">Lujie</a>\n */\npublic class DataImportController ",
"end": 688,
"score": 0.9999245405197144,
"start": 673,
"tag": "EMAIL",
"value": "ljglory@126.com"
},
{
"context": ";\n/**\n * @author <a href=\"mailto:ljglory@126.com\">Lujie</a>\n */\npublic class DataImportController extends",
"end": 695,
"score": 0.9979957938194275,
"start": 690,
"tag": "NAME",
"value": "Lujie"
}
] | null | [] | /*
* Created on 2005-10-16
*/
package com.inwiss.springcrud.web.depose;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import com.inwiss.springcrud.command.RecordCommand;
import com.inwiss.springcrud.command.RecordSetCommand;
import com.inwiss.springcrud.metadata.ImportMeta;
import com.inwiss.springcrud.support.txtimport.ImportDataPersistentStrategy;
import com.inwiss.springcrud.web.controller.ControllerUtil;
/**
* @author <a href="mailto:<EMAIL>">Lujie</a>
*/
public class DataImportController extends AbstractController
{
/**给Controller使用的工具对象*/
private ControllerUtil controllerUtil;
/**
* @see org.springframework.web.servlet.mvc.AbstractController#handleRequestInternal(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception
{
ImportMeta importMeta = controllerUtil.retrieveImportMetaByRequestParameter(request);
int nRecordCount = Integer.parseInt(request.getParameter("nrOfElements"));
RecordSetCommand command = new RecordSetCommand();
command.setRecords(new RecordCommand[nRecordCount]);
for ( int i = 0; i < nRecordCount; i++ )
command.getRecords()[i] = new RecordCommand();
/**
* Spring3.0.5
*/
ServletRequestDataBinder binder = new ServletRequestDataBinder(command);
binder.bind(request);
/**
* Spring1.2
*/
//BindUtils.bind(request, command, "");
ImportDataPersistentStrategy persistentStrategy = importMeta.getImportDataPersistentStrategy();
persistentStrategy.persistentImportData(command, importMeta);
System.out.println("I'm been called!");
return new ModelAndView("listRedirectView","crudMeta",importMeta.getCrudMeta());
}
/**
* @param controllerUtil The controllerUtil to set.
*/
public void setControllerUtil(ControllerUtil controllerUtil)
{
this.controllerUtil = controllerUtil;
}
}
| 2,364 | 0.726655 | 0.71944 | 66 | 34.696968 | 34.320667 | 167 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.651515 | false | false | 12 |
5ace1860c23e151381e377cf30d9f9639617565b | 29,214,367,593,495 | a340e5aad1479affeefeea89469c543438c59eea | /EducationCentralRegistration/EducationCentralRegistration-ejb/src/java/za/ac/ecr/dataobject/InstitutionTypeDO.java | 5aad8e1980f066b58bdf65dfb8bc2d30e07398ca | [] | no_license | tebogomabale/udu401t | https://github.com/tebogomabale/udu401t | 360a10e002947e9c371f01567fd66c81e7a1d874 | 91ca7dd198c043d875ac3454babced1c93469779 | refs/heads/master | 2020-07-24T18:15:48.546000 | 2019-10-07T19:01:40 | 2019-10-07T19:01:40 | 208,006,009 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package za.ac.ecr.dataobject;
import za.ac.ecr.artifact.DataObject;
import java.io.Serializable;
@DataObject
public class InstitutionTypeDO implements Serializable {
private Integer typeId;
private String name;
private String description;
public InstitutionTypeDO() {
}
public InstitutionTypeDO(Integer typeId) {
this.typeId = typeId;
}
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| UTF-8 | Java | 841 | java | InstitutionTypeDO.java | Java | [] | null | [] |
package za.ac.ecr.dataobject;
import za.ac.ecr.artifact.DataObject;
import java.io.Serializable;
@DataObject
public class InstitutionTypeDO implements Serializable {
private Integer typeId;
private String name;
private String description;
public InstitutionTypeDO() {
}
public InstitutionTypeDO(Integer typeId) {
this.typeId = typeId;
}
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| 841 | 0.636147 | 0.636147 | 46 | 17.26087 | 16.676506 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.282609 | false | false | 12 |
1b8450a84d2bbd6062f14ea5df3760b583530ee5 | 5,540,507,870,515 | 52865614bb057ad067dbf346251c9c751f5585bf | /src/main/java/core/easyparking/polimi/utils/object/responce/GetAdminResponce.java | 395429b687d1fbae727f32d1ff634245ccd283f6 | [] | no_license | comar16/easy-parking | https://github.com/comar16/easy-parking | afaaba20404f426e0a5b4e4b733f67111a223e4a | 737ba1bd781228c3e83ed717f84ebefffa559bb4 | refs/heads/master | 2023-08-11T08:00:57.858000 | 2021-08-31T16:05:13 | 2021-08-31T16:05:13 | 400,770,084 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package core.easyparking.polimi.utils.object.responce;
import core.easyparking.polimi.entity.Admin;
import core.easyparking.polimi.utils.object.staticvalues.Status;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class GetAdminResponce{
private String name;
private String surname;
private Long pcId;
private Status status;
public GetAdminResponce(Admin admin) {
this.name = admin.getName();
this.surname = admin.getSurname();
this.pcId = admin.getPcId();
this.status = admin.getStatus();
}
}
| UTF-8 | Java | 635 | java | GetAdminResponce.java | Java | [] | null | [] | package core.easyparking.polimi.utils.object.responce;
import core.easyparking.polimi.entity.Admin;
import core.easyparking.polimi.utils.object.staticvalues.Status;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class GetAdminResponce{
private String name;
private String surname;
private Long pcId;
private Status status;
public GetAdminResponce(Admin admin) {
this.name = admin.getName();
this.surname = admin.getSurname();
this.pcId = admin.getPcId();
this.status = admin.getStatus();
}
}
| 635 | 0.792126 | 0.792126 | 26 | 23.423077 | 16.462482 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.115385 | false | false | 12 |
57a5971204b09a45026e124d01c3f59e57b6856d | 25,159,918,482,802 | 7c873e4b9db36d785b3cc1a0749e9358ca0cb3c3 | /src/main/java/cn/finalabproject/smartdesklamp/smartdesklamp/model/Message.java | 55d086fad6a6e8bc281d2881359dea6c66b1de8c | [] | no_license | mike-zeng/smartdesklamp | https://github.com/mike-zeng/smartdesklamp | 27bdd176e7ca041aa84dd1e4265cee4ca33a17a5 | 3d0790a0f7b3690a0ad488f14dff2ae648d909ca | refs/heads/master | 2021-10-28T06:46:12.281000 | 2019-04-22T13:08:01 | 2019-04-22T13:08:01 | 163,193,276 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.finalabproject.smartdesklamp.smartdesklamp.model;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 定义一条消息
*/
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class Message{
public static final String EQUIPMENT="equipment";
public static final String USER="user";
private String type;
private EquipmentMessage equipmentMessage;
private UserMessage userMessage;
public String toString(){
ObjectMapper objectMapper=new ObjectMapper();
try {
return objectMapper.writeValueAsString(this);
}catch (Exception e){
e.printStackTrace();
}
return "{}";
}
} | UTF-8 | Java | 801 | java | Message.java | Java | [
{
"context": "\"equipment\";\n public static final String USER=\"user\";\n private String type;\n\n private Equipment",
"end": 416,
"score": 0.9617072343826294,
"start": 412,
"tag": "USERNAME",
"value": "user"
}
] | null | [] | package cn.finalabproject.smartdesklamp.smartdesklamp.model;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 定义一条消息
*/
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class Message{
public static final String EQUIPMENT="equipment";
public static final String USER="user";
private String type;
private EquipmentMessage equipmentMessage;
private UserMessage userMessage;
public String toString(){
ObjectMapper objectMapper=new ObjectMapper();
try {
return objectMapper.writeValueAsString(this);
}catch (Exception e){
e.printStackTrace();
}
return "{}";
}
} | 801 | 0.711027 | 0.711027 | 35 | 21.571428 | 18.760574 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
c58c2b5983d73c9bf8401af375dc3f26b0004196 | 26,998,164,477,831 | c8b99b5ed8939f397fbfdf4e7bb9bee7b0dae99e | /movieTicket/src/main/java/com/epam/Runner/Main.java | ba497f936e5be63ad078332212c3e61f6e250557 | [] | no_license | PrernaGandhi/Movie_Ticket | https://github.com/PrernaGandhi/Movie_Ticket | 314c9a07e6012e6cc8de5ffb8833a7574d6b4721 | 36c6378926a506fd8cfe448cd766b79e45685a21 | refs/heads/master | 2020-08-07T03:42:16.626000 | 2019-10-07T03:00:54 | 2019-10-07T03:00:54 | 213,283,641 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.epam.Runner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import com.epam.movieTicket.Location;
import com.epam.movieTicket.Movie;
import com.epam.movieTicket.MovieTicket;
import com.epam.movieTicket.Theater;
import com.epam.movieTicket.Timings;
import com.epam.utils.DefaultValue;
import com.epam.utils.Utils;
public class Main {
public static void main(String[] args) {
try {
createDatabase();
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(System.in));
Location location = getLocation(bufferedReader);
if (Utils.database.containsKey(location)) {
String movieSelected = selectMovie(bufferedReader, location);
String movieLangSelected = selectMovieLang(bufferedReader);
Movie movie = getMovie(movieSelected, movieLangSelected);
if (Utils.database.get(location).get(movie) != null) {
String theaterSelected = selectTheater(bufferedReader,
location, movie);
String screenNoSelected = selectScreen(bufferedReader);
Theater theater = getTheater(theaterSelected,
screenNoSelected);
if (Utils.database.get(location).get(movie).get(theater) != null) {
showAvailableTimings(location, movie, theater);
String timingsSelected = selectTime(bufferedReader);
Timings time = getTime(timingsSelected);
String priceSelected = getPrice(bufferedReader);
System.out
.println("The details of your selected show is "
+ location
+ " "
+ movie
+ " "
+ theater
+ " "
+ time
+ " Rs."
+ priceSelected);
} else {
System.out
.println("The theater and the screen number are currently unavailable");
}
} else {
System.err.println("The movie " + movieSelected
+ DefaultValue.OPEN_BRACE + movieLangSelected
+ DefaultValue.CLOSE_BRACE + " is not available");
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
private static Timings getTime(String timingsSelected) {
return new Timings(timingsSelected.trim()
.toUpperCase());
}
private static String getPrice(BufferedReader bufferedReader)
throws IOException {
System.out
.println("There are two types of seats available :Rs 100 , Rs 200\nEnter 100 or 200 for type of seat:");
String priceSelected = bufferedReader.readLine();
return priceSelected;
}
private static String selectTime(BufferedReader bufferedReader)
throws IOException {
System.out.println("Select your time");
String timingsSelected = bufferedReader.readLine();
return timingsSelected;
}
private static void showAvailableTimings(Location location, Movie movie,
Theater theater) {
System.out.println("The timings are");
System.out
.println(Utils.database.get(location).get(movie).get(theater));
}
private static Theater getTheater(String theaterSelected,
String screenNoSelected) {
return new Theater(theaterSelected.trim().toUpperCase(),
screenNoSelected.trim().toUpperCase());
}
private static String selectScreen(BufferedReader bufferedReader)
throws IOException {
System.out.println("Enter the screen number: ");
String screenNoSelected = bufferedReader.readLine();
return screenNoSelected;
}
private static String selectTheater(BufferedReader bufferedReader,
Location location, Movie movie) throws IOException {
System.out.println("The theaters available are: ");
System.out.println(Utils.database.get(location).get(movie).keySet());
String theaterSelected = bufferedReader.readLine();
return theaterSelected;
}
private static Movie getMovie(String movieSelected, String movieLangSelected) {
return new Movie(movieSelected.trim().toUpperCase(), movieLangSelected
.trim().toUpperCase());
}
private static String selectMovieLang(BufferedReader bufferedReader)
throws IOException {
System.out.println("Select the language");
String movieLangSelected = bufferedReader.readLine();
return movieLangSelected;
}
private static String selectMovie(BufferedReader bufferedReader,
Location location) throws IOException {
System.out
.println("The movies available for the current location is: ");
System.out.println(Utils.database.get(location).keySet());
String movieSelected = bufferedReader.readLine();
return movieSelected;
}
private static Location getLocation(BufferedReader bufferedReader)
throws IOException {
System.out.println("Choose any one location of the following:");
System.out.println(Utils.database.keySet());
String locationSelected = bufferedReader.readLine();
Location location = new Location(locationSelected.trim().toUpperCase());
return location;
}
private static void createDatabase() {
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("AMB")).setTime(new Timings("5PM-6PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("PVR")).setTime(new Timings("5PM-6PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("AMB")).setTime(new Timings("4PM-5PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("AMB", "2")).setTime(
new Timings("4PM-5PM")).build();
new MovieTicket.MovieTicketHelper(new Location("DELHI"), new Movie(
"JOKER"), new Theater("AMB")).setTime(new Timings("4PM-5PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("DELHI"), new Movie(
"JOKER", "RUS"), new Theater("PVR")).setTime(
new Timings("4PM-5PM")).build();
}
}
| UTF-8 | Java | 5,723 | java | Main.java | Java | [] | null | [] | package com.epam.Runner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import com.epam.movieTicket.Location;
import com.epam.movieTicket.Movie;
import com.epam.movieTicket.MovieTicket;
import com.epam.movieTicket.Theater;
import com.epam.movieTicket.Timings;
import com.epam.utils.DefaultValue;
import com.epam.utils.Utils;
public class Main {
public static void main(String[] args) {
try {
createDatabase();
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(System.in));
Location location = getLocation(bufferedReader);
if (Utils.database.containsKey(location)) {
String movieSelected = selectMovie(bufferedReader, location);
String movieLangSelected = selectMovieLang(bufferedReader);
Movie movie = getMovie(movieSelected, movieLangSelected);
if (Utils.database.get(location).get(movie) != null) {
String theaterSelected = selectTheater(bufferedReader,
location, movie);
String screenNoSelected = selectScreen(bufferedReader);
Theater theater = getTheater(theaterSelected,
screenNoSelected);
if (Utils.database.get(location).get(movie).get(theater) != null) {
showAvailableTimings(location, movie, theater);
String timingsSelected = selectTime(bufferedReader);
Timings time = getTime(timingsSelected);
String priceSelected = getPrice(bufferedReader);
System.out
.println("The details of your selected show is "
+ location
+ " "
+ movie
+ " "
+ theater
+ " "
+ time
+ " Rs."
+ priceSelected);
} else {
System.out
.println("The theater and the screen number are currently unavailable");
}
} else {
System.err.println("The movie " + movieSelected
+ DefaultValue.OPEN_BRACE + movieLangSelected
+ DefaultValue.CLOSE_BRACE + " is not available");
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
private static Timings getTime(String timingsSelected) {
return new Timings(timingsSelected.trim()
.toUpperCase());
}
private static String getPrice(BufferedReader bufferedReader)
throws IOException {
System.out
.println("There are two types of seats available :Rs 100 , Rs 200\nEnter 100 or 200 for type of seat:");
String priceSelected = bufferedReader.readLine();
return priceSelected;
}
private static String selectTime(BufferedReader bufferedReader)
throws IOException {
System.out.println("Select your time");
String timingsSelected = bufferedReader.readLine();
return timingsSelected;
}
private static void showAvailableTimings(Location location, Movie movie,
Theater theater) {
System.out.println("The timings are");
System.out
.println(Utils.database.get(location).get(movie).get(theater));
}
private static Theater getTheater(String theaterSelected,
String screenNoSelected) {
return new Theater(theaterSelected.trim().toUpperCase(),
screenNoSelected.trim().toUpperCase());
}
private static String selectScreen(BufferedReader bufferedReader)
throws IOException {
System.out.println("Enter the screen number: ");
String screenNoSelected = bufferedReader.readLine();
return screenNoSelected;
}
private static String selectTheater(BufferedReader bufferedReader,
Location location, Movie movie) throws IOException {
System.out.println("The theaters available are: ");
System.out.println(Utils.database.get(location).get(movie).keySet());
String theaterSelected = bufferedReader.readLine();
return theaterSelected;
}
private static Movie getMovie(String movieSelected, String movieLangSelected) {
return new Movie(movieSelected.trim().toUpperCase(), movieLangSelected
.trim().toUpperCase());
}
private static String selectMovieLang(BufferedReader bufferedReader)
throws IOException {
System.out.println("Select the language");
String movieLangSelected = bufferedReader.readLine();
return movieLangSelected;
}
private static String selectMovie(BufferedReader bufferedReader,
Location location) throws IOException {
System.out
.println("The movies available for the current location is: ");
System.out.println(Utils.database.get(location).keySet());
String movieSelected = bufferedReader.readLine();
return movieSelected;
}
private static Location getLocation(BufferedReader bufferedReader)
throws IOException {
System.out.println("Choose any one location of the following:");
System.out.println(Utils.database.keySet());
String locationSelected = bufferedReader.readLine();
Location location = new Location(locationSelected.trim().toUpperCase());
return location;
}
private static void createDatabase() {
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("AMB")).setTime(new Timings("5PM-6PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("PVR")).setTime(new Timings("5PM-6PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("AMB")).setTime(new Timings("4PM-5PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("HYDERABAD"), new Movie(
"JOKER"), new Theater("AMB", "2")).setTime(
new Timings("4PM-5PM")).build();
new MovieTicket.MovieTicketHelper(new Location("DELHI"), new Movie(
"JOKER"), new Theater("AMB")).setTime(new Timings("4PM-5PM"))
.build();
new MovieTicket.MovieTicketHelper(new Location("DELHI"), new Movie(
"JOKER", "RUS"), new Theater("PVR")).setTime(
new Timings("4PM-5PM")).build();
}
}
| 5,723 | 0.720951 | 0.716582 | 164 | 33.896343 | 25.287039 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.353658 | false | false | 12 |
200036ee659abb4dea684a434e2aaa2306c85ead | 13,838,384,629,613 | 062dfc5145d74e81ee711febe70697f4d82546ff | /neptune-gremlin-client/gremlin-client/src/main/java/software/amazon/neptune/cluster/EndpointsType.java | b916e427d3eb39c02cde1e1525e1cc6caf0d502c | [
"Apache-2.0"
] | permissive | vivgoyal-aws/amazon-neptune-tools | https://github.com/vivgoyal-aws/amazon-neptune-tools | e3ccdad895b138c0a585204610aee0606e26db88 | b81872022e9965e8a22b37cfed8d62bd9de6e017 | refs/heads/master | 2023-06-24T09:44:10.023000 | 2023-05-03T11:58:34 | 2023-05-03T11:58:34 | 371,186,064 | 0 | 0 | Apache-2.0 | true | 2021-05-26T23:56:19 | 2021-05-26T22:44:54 | 2021-05-26T22:44:55 | 2021-05-26T23:56:19 | 4,266 | 0 | 0 | 0 | null | false | false | /*
Copyright 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://www.apache.org/licenses/LICENSE-2.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 software.amazon.neptune.cluster;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public enum EndpointsType implements EndpointsSelector {
All {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
List<String> results = instances.stream()
.filter(NeptuneInstanceMetadata::isAvailable)
.map(NeptuneInstanceMetadata::getEndpoint)
.collect(Collectors.toList());
if (results.isEmpty()) {
logger.warn("Unable to get any endpoints so getting ReaderEndpoint instead");
return ReaderEndpoint.getEndpoints(clusterEndpoint, readerEndpoint, instances);
}
return results;
}
},
Primary {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
List<String> results = instances.stream()
.filter(NeptuneInstanceMetadata::isPrimary)
.filter(NeptuneInstanceMetadata::isAvailable)
.map(NeptuneInstanceMetadata::getEndpoint)
.collect(Collectors.toList());
if (results.isEmpty()) {
logger.warn("Unable to get Primary endpoint so getting ClusterEndpoint instead");
return ClusterEndpoint.getEndpoints(clusterEndpoint, readerEndpoint, instances);
}
return results;
}
},
ReadReplicas {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
List<String> results = instances.stream()
.filter(NeptuneInstanceMetadata::isReader)
.filter(NeptuneInstanceMetadata::isAvailable)
.map(NeptuneInstanceMetadata::getEndpoint)
.collect(Collectors.toList());
if (results.isEmpty()) {
logger.warn("Unable to get ReadReplicas endpoints so getting ReaderEndpoint instead");
return ReaderEndpoint.getEndpoints(clusterEndpoint, readerEndpoint, instances);
}
return results;
}
},
ClusterEndpoint {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
return Collections.singletonList(clusterEndpoint);
}
},
ReaderEndpoint {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
return Collections.singletonList(readerEndpoint);
}
};
private static final Logger logger = LoggerFactory.getLogger(EndpointsType.class);
}
| UTF-8 | Java | 4,151 | java | EndpointsType.java | Java | [] | null | [] | /*
Copyright 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://www.apache.org/licenses/LICENSE-2.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 software.amazon.neptune.cluster;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public enum EndpointsType implements EndpointsSelector {
All {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
List<String> results = instances.stream()
.filter(NeptuneInstanceMetadata::isAvailable)
.map(NeptuneInstanceMetadata::getEndpoint)
.collect(Collectors.toList());
if (results.isEmpty()) {
logger.warn("Unable to get any endpoints so getting ReaderEndpoint instead");
return ReaderEndpoint.getEndpoints(clusterEndpoint, readerEndpoint, instances);
}
return results;
}
},
Primary {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
List<String> results = instances.stream()
.filter(NeptuneInstanceMetadata::isPrimary)
.filter(NeptuneInstanceMetadata::isAvailable)
.map(NeptuneInstanceMetadata::getEndpoint)
.collect(Collectors.toList());
if (results.isEmpty()) {
logger.warn("Unable to get Primary endpoint so getting ClusterEndpoint instead");
return ClusterEndpoint.getEndpoints(clusterEndpoint, readerEndpoint, instances);
}
return results;
}
},
ReadReplicas {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
List<String> results = instances.stream()
.filter(NeptuneInstanceMetadata::isReader)
.filter(NeptuneInstanceMetadata::isAvailable)
.map(NeptuneInstanceMetadata::getEndpoint)
.collect(Collectors.toList());
if (results.isEmpty()) {
logger.warn("Unable to get ReadReplicas endpoints so getting ReaderEndpoint instead");
return ReaderEndpoint.getEndpoints(clusterEndpoint, readerEndpoint, instances);
}
return results;
}
},
ClusterEndpoint {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
return Collections.singletonList(clusterEndpoint);
}
},
ReaderEndpoint {
@Override
public Collection<String> getEndpoints(String clusterEndpoint,
String readerEndpoint,
Collection<NeptuneInstanceMetadata> instances) {
return Collections.singletonList(readerEndpoint);
}
};
private static final Logger logger = LoggerFactory.getLogger(EndpointsType.class);
}
| 4,151 | 0.593833 | 0.592387 | 103 | 39.300972 | 32.109592 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.456311 | false | false | 12 |
2e53068eb1c1adf6c085d7bb4fb1f5bebebe1fe4 | 27,101,243,647,932 | 57b7bd9d055705996e7b7287c6e714e962dce659 | /Project_Source_Code/StringService/src/main/java/com/data/stringdatatype/serviceimpl/StringDatatypeServiceImpl.java | 8ad4e83cd6c12721258a06157dc46e6a99fdc0fc | [] | no_license | achouhan93/Data-Wrecker | https://github.com/achouhan93/Data-Wrecker | a3c08aeb1530c79ea6a66cea98dca048c9d6ef41 | ec03f16eaa8a54dfdc2d064f8026a162ec72faa7 | refs/heads/master | 2023-05-02T19:36:14.257000 | 2020-02-16T21:27:05 | 2020-02-16T21:27:05 | 169,203,785 | 0 | 0 | null | false | 2023-04-14T17:17:24 | 2019-02-05T07:20:24 | 2020-02-16T21:27:23 | 2023-04-14T17:17:24 | 129,160 | 1 | 2 | 48 | Java | false | false | package com.data.stringdatatype.serviceimpl;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.data.stringdatatype.model.DatasetStats;
import com.data.stringdatatype.model.Dimensions;
import com.data.stringdatatype.model.PatternModel;
import com.data.stringdatatype.service.StringDataTypeService;
@Service
@Transactional
public class StringDatatypeServiceImpl implements StringDataTypeService {
private Dimensions dimensions;
private static final Logger LOGGER = LogManager.getLogger();
/*@Override
public Dimensions NullCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
dimensions = new Dimensions();
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
if(datasetStats.getProfilingInfo().getColumnStats().getNullCount() > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Completeness");
dimensions.setStatus(false);
dimensions.setReason("The number of null values exceeds threshold");
return dimensions;
} else {
dimensions.setDimensionName("Completeness");
dimensions.setStatus(true);
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked);
dimensions.setReason("The number of null values less than threshold");
return dimensions;
}
}*/
/*@Override
public Dimensions ConsistencyCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
dimensions = new Dimensions();
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
List<PatternModel> patternModel= new ArrayList<PatternModel>();
patternModel = datasetStats.getProfilingInfo().getPatternsIdentified();
int count = 0;
for(int i=0; i< patternModel.size();i++) {
if(!isConsistentValue(patternModel.get(i))) {
count = patternModel.get(i).getOccurance();
}
}
if(count > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Consistency");
dimensions.setStatus(false);
dimensions.setReason("The patterns identified are greater than the wrecking count ");
dimensions.setRemainingWreakingCount(0);
}else {
dimensions.setDimensionName("Consistency");
dimensions.setStatus(true);
dimensions.setReason("The patterns identified are less than the wrecking count ");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked - count);
}
return dimensions;
}*/
/*@Override
public Dimensions ValidityCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
String emailRegex = "^[a-z0-9+_.-]+@(.+)$";
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
dimensions = new Dimensions();
List<PatternModel> patternModel= new ArrayList<PatternModel>();
patternModel = datasetStats.getProfilingInfo().getPatternsIdentified();
int count = 0;
for(int i=0; i< patternModel.size();i++) {
if(!isValidString(patternModel.get(i))) {
count = patternModel.get(i).getOccurance();
}
}
if(count > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Validity");
dimensions.setStatus(false);
dimensions.setReason("The patterns identified are greater than the wrecking count ");
dimensions.setRemainingWreakingCount(0);
}else {
dimensions.setDimensionName("Validity");
dimensions.setStatus(true);
dimensions.setReason("The patterns identified are less than the wrecking count ");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked - count);
}
return dimensions;
}*/
@Override
public Dimensions AccuracyCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
dimensions = new Dimensions();
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
List<PatternModel> patternModel= new ArrayList<PatternModel>();
patternModel = datasetStats.getProfilingInfo().getPatternsIdentified();
int count = 0;
for(int i=0; i< patternModel.size();i++) {
if(!isAccurate(patternModel.get(i))) {
count = patternModel.get(i).getOccurance();
}
}
if(count > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Accuracy");
dimensions.setStatus(false);
dimensions.setReason("The patterns identified are greater than the wrecking count ");
dimensions.setRemainingWreakingCount(0);
}else {
dimensions.setDimensionName("Accuracy");
dimensions.setStatus(true);
dimensions.setReason("The patterns identified are less than the wrecking count ");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked - count);
}
return dimensions;
}
private int noOfRowsToBeWrecked(int wreckingPercentage, int rowCount, int colCount) {
int totalRowsCanBeWrecked = (wreckingPercentage * rowCount)/(100 * 2 * colCount) ;
return totalRowsCanBeWrecked;
}
private boolean isConsistentValue(PatternModel patternModel) {
String strValue =patternModel.getPattern().trim();
int spaceCount = strValue.length() - strValue.replaceAll(" ", "").length();
char[] stringArray = strValue.toCharArray();
int uppercaseCharcount = 0;
int lowercaseCount = 0;
for(int i=0; i< stringArray.length; i++) {
if(Character.isUpperCase(stringArray[i])) {
uppercaseCharcount++;
}else {
lowercaseCount++;
}
}
if((uppercaseCharcount + spaceCount + lowercaseCount) == strValue.length()) {
return true;
}else if(uppercaseCharcount > ( spaceCount + 1 ) ) {
return false;
} else {
return true;
}
}
private boolean isValidString(PatternModel patternModel) {
String specialCharsPattern = "-/@#$%^&_+=()";
String patternValue = patternModel.getPattern();
if(patternValue.matches("["+specialCharsPattern+"]")) {
return false;
}else {
return true;
}
}
private boolean isAccurate(PatternModel patternModel) {
String emailRegex = "^[a-z0-9+_.-]+@(.+)$";
String patternValue = patternModel.getPattern();
if(patternValue.matches(emailRegex)) {
return true;
}else if(patternValue == null || patternValue.trim().isEmpty()){
return false;
}else {
int count = 0;
char[] patternArray = patternValue.toCharArray();
for(int i=0; i < patternArray.length; i++) {
if (Character.toString(patternArray[i]).matches("[^A-Za-z0-9 ]")) {
count++;
}
}
if(count > 3) {
return false;
}else {
return true;
}
}
}
@Override
public Dimensions UniquenessCheck(DatasetStats datasetStats, int avgWreckingCount, int Colcount) {
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(avgWreckingCount, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
dimensions = new Dimensions();
dimensions.setDimensionName("Uniqueness");
dimensions.setStatus(true);
dimensions.setReason("Uniqueness is performed at the record level");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked);
return dimensions;
}
}
| UTF-8 | Java | 7,290 | java | StringDatatypeServiceImpl.java | Java | [] | null | [] | package com.data.stringdatatype.serviceimpl;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.data.stringdatatype.model.DatasetStats;
import com.data.stringdatatype.model.Dimensions;
import com.data.stringdatatype.model.PatternModel;
import com.data.stringdatatype.service.StringDataTypeService;
@Service
@Transactional
public class StringDatatypeServiceImpl implements StringDataTypeService {
private Dimensions dimensions;
private static final Logger LOGGER = LogManager.getLogger();
/*@Override
public Dimensions NullCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
dimensions = new Dimensions();
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
if(datasetStats.getProfilingInfo().getColumnStats().getNullCount() > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Completeness");
dimensions.setStatus(false);
dimensions.setReason("The number of null values exceeds threshold");
return dimensions;
} else {
dimensions.setDimensionName("Completeness");
dimensions.setStatus(true);
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked);
dimensions.setReason("The number of null values less than threshold");
return dimensions;
}
}*/
/*@Override
public Dimensions ConsistencyCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
dimensions = new Dimensions();
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
List<PatternModel> patternModel= new ArrayList<PatternModel>();
patternModel = datasetStats.getProfilingInfo().getPatternsIdentified();
int count = 0;
for(int i=0; i< patternModel.size();i++) {
if(!isConsistentValue(patternModel.get(i))) {
count = patternModel.get(i).getOccurance();
}
}
if(count > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Consistency");
dimensions.setStatus(false);
dimensions.setReason("The patterns identified are greater than the wrecking count ");
dimensions.setRemainingWreakingCount(0);
}else {
dimensions.setDimensionName("Consistency");
dimensions.setStatus(true);
dimensions.setReason("The patterns identified are less than the wrecking count ");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked - count);
}
return dimensions;
}*/
/*@Override
public Dimensions ValidityCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
String emailRegex = "^[a-z0-9+_.-]+@(.+)$";
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
dimensions = new Dimensions();
List<PatternModel> patternModel= new ArrayList<PatternModel>();
patternModel = datasetStats.getProfilingInfo().getPatternsIdentified();
int count = 0;
for(int i=0; i< patternModel.size();i++) {
if(!isValidString(patternModel.get(i))) {
count = patternModel.get(i).getOccurance();
}
}
if(count > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Validity");
dimensions.setStatus(false);
dimensions.setReason("The patterns identified are greater than the wrecking count ");
dimensions.setRemainingWreakingCount(0);
}else {
dimensions.setDimensionName("Validity");
dimensions.setStatus(true);
dimensions.setReason("The patterns identified are less than the wrecking count ");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked - count);
}
return dimensions;
}*/
@Override
public Dimensions AccuracyCheck(DatasetStats datasetStats, int wreckingPercentage, int Colcount) {
dimensions = new Dimensions();
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(wreckingPercentage, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
List<PatternModel> patternModel= new ArrayList<PatternModel>();
patternModel = datasetStats.getProfilingInfo().getPatternsIdentified();
int count = 0;
for(int i=0; i< patternModel.size();i++) {
if(!isAccurate(patternModel.get(i))) {
count = patternModel.get(i).getOccurance();
}
}
if(count > totalRowsCanBeWrecked) {
dimensions.setDimensionName("Accuracy");
dimensions.setStatus(false);
dimensions.setReason("The patterns identified are greater than the wrecking count ");
dimensions.setRemainingWreakingCount(0);
}else {
dimensions.setDimensionName("Accuracy");
dimensions.setStatus(true);
dimensions.setReason("The patterns identified are less than the wrecking count ");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked - count);
}
return dimensions;
}
private int noOfRowsToBeWrecked(int wreckingPercentage, int rowCount, int colCount) {
int totalRowsCanBeWrecked = (wreckingPercentage * rowCount)/(100 * 2 * colCount) ;
return totalRowsCanBeWrecked;
}
private boolean isConsistentValue(PatternModel patternModel) {
String strValue =patternModel.getPattern().trim();
int spaceCount = strValue.length() - strValue.replaceAll(" ", "").length();
char[] stringArray = strValue.toCharArray();
int uppercaseCharcount = 0;
int lowercaseCount = 0;
for(int i=0; i< stringArray.length; i++) {
if(Character.isUpperCase(stringArray[i])) {
uppercaseCharcount++;
}else {
lowercaseCount++;
}
}
if((uppercaseCharcount + spaceCount + lowercaseCount) == strValue.length()) {
return true;
}else if(uppercaseCharcount > ( spaceCount + 1 ) ) {
return false;
} else {
return true;
}
}
private boolean isValidString(PatternModel patternModel) {
String specialCharsPattern = "-/@#$%^&_+=()";
String patternValue = patternModel.getPattern();
if(patternValue.matches("["+specialCharsPattern+"]")) {
return false;
}else {
return true;
}
}
private boolean isAccurate(PatternModel patternModel) {
String emailRegex = "^[a-z0-9+_.-]+@(.+)$";
String patternValue = patternModel.getPattern();
if(patternValue.matches(emailRegex)) {
return true;
}else if(patternValue == null || patternValue.trim().isEmpty()){
return false;
}else {
int count = 0;
char[] patternArray = patternValue.toCharArray();
for(int i=0; i < patternArray.length; i++) {
if (Character.toString(patternArray[i]).matches("[^A-Za-z0-9 ]")) {
count++;
}
}
if(count > 3) {
return false;
}else {
return true;
}
}
}
@Override
public Dimensions UniquenessCheck(DatasetStats datasetStats, int avgWreckingCount, int Colcount) {
int totalRowsCanBeWrecked = noOfRowsToBeWrecked(avgWreckingCount, datasetStats.getProfilingInfo().getColumnStats().getRowCount(), Colcount);
dimensions = new Dimensions();
dimensions.setDimensionName("Uniqueness");
dimensions.setStatus(true);
dimensions.setReason("Uniqueness is performed at the record level");
dimensions.setRemainingWreakingCount(totalRowsCanBeWrecked);
return dimensions;
}
}
| 7,290 | 0.738683 | 0.734842 | 217 | 32.585255 | 32.429054 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.612903 | false | false | 12 |
ac583fe5d41e00440233a84f9d960e12ba6df016 | 24,696,061,955,220 | 90cf12c90693a25aa399807c20a43d7fda8c12d8 | /src/com/wzd/udp/UDPDemo.java | 523f57ca97f1d9673eee1474220bc53abeabae1b | [] | no_license | ZeDongW/Socket | https://github.com/ZeDongW/Socket | d71707edc8006fbe270adc34efd889c4acab4437 | 49a5d921d4748129abe600b1ce2d7918b92b3e0f | refs/heads/master | 2020-04-19T21:16:18.175000 | 2019-02-02T00:38:18 | 2019-02-02T00:38:18 | 168,436,780 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wzd.udp;
import java.io.IOException;
import java.net.*;
/**
* @author :ZeDongW
* @version : 1.0
* @ClassName : UDPDemo
* @description:UDP通信演示类
* @modified By:
* @date :Created in 2019/01/31/0031 7:44
*/
public class UDPDemo {
public static void main(String[] args) throws IOException {
//建立UDP服务
DatagramSocket datagramSocket = new DatagramSocket();
//准备数据
String data = "大家早上好!!!";
//将数据封装到数据包中
DatagramPacket datagramPacket = new DatagramPacket(data.getBytes(), 0, data.getBytes().length, InetAddress.getLocalHost(), 12001);
//调用UDP服务发送数据包
datagramSocket.send(datagramPacket);
//关闭连接
datagramSocket.close();
}
}
| UTF-8 | Java | 819 | java | UDPDemo.java | Java | [
{
"context": ".IOException;\nimport java.net.*;\n\n/**\n * @author :ZeDongW\n * @version : 1.0\n * @ClassName : UDPDemo\n *",
"end": 88,
"score": 0.5222403407096863,
"start": 86,
"tag": "NAME",
"value": "Ze"
},
{
"context": "OException;\nimport java.net.*;\n\n/**\n * @author :ZeDongW\n * @version : 1.0\n * @ClassName : UDPDemo\n * @des",
"end": 93,
"score": 0.7858814597129822,
"start": 88,
"tag": "USERNAME",
"value": "DongW"
}
] | null | [] | package com.wzd.udp;
import java.io.IOException;
import java.net.*;
/**
* @author :ZeDongW
* @version : 1.0
* @ClassName : UDPDemo
* @description:UDP通信演示类
* @modified By:
* @date :Created in 2019/01/31/0031 7:44
*/
public class UDPDemo {
public static void main(String[] args) throws IOException {
//建立UDP服务
DatagramSocket datagramSocket = new DatagramSocket();
//准备数据
String data = "大家早上好!!!";
//将数据封装到数据包中
DatagramPacket datagramPacket = new DatagramPacket(data.getBytes(), 0, data.getBytes().length, InetAddress.getLocalHost(), 12001);
//调用UDP服务发送数据包
datagramSocket.send(datagramPacket);
//关闭连接
datagramSocket.close();
}
}
| 819 | 0.64177 | 0.609959 | 27 | 25.777779 | 27.22789 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 12 |
71dc9fa5d1c1289487ae3b126e6adc49aadfc5bd | 37,151,467,111,653 | 55e3e64025487eda81b004763de40fb2952adab5 | /dw-mocker/src/main/java/com/baidu/gmall0715/mocker/util/RandomNum.java | 3ac22558f9bb8bac1cd7eed69c911d4530b0f41f | [] | no_license | MrXuSS/MyRepository | https://github.com/MrXuSS/MyRepository | 8da8312e02224db67153e96b8ca598407d02c83c | 5ccdb18df875d09379c81c1ca8daad8d74d2c319 | refs/heads/master | 2020-10-02T11:06:23.032000 | 2019-12-13T05:56:12 | 2019-12-13T05:56:12 | 227,762,790 | 0 | 0 | null | false | 2019-12-13T05:50:44 | 2019-12-13T05:24:56 | 2019-12-13T05:50:19 | 2019-12-13T05:50:42 | 0 | 0 | 0 | 1 | Java | false | false | package com.baidu.gmall0715.mocker.util;
import java.util.Random;
/**
* @author Mr.Xu
* @description:
* @create 2019-12-13 10:58
*/
public class RandomNum {
public static final int getRandInt(int fromNum,int toNum){
return fromNum+ new Random().nextInt(toNum-fromNum+1);
}
}
| UTF-8 | Java | 301 | java | RandomNum.java | Java | [
{
"context": "er.util;\n\nimport java.util.Random;\n\n/**\n * @author Mr.Xu\n * @description:\n * @create 2019-12-13 10:58\n */\n",
"end": 88,
"score": 0.9996749758720398,
"start": 83,
"tag": "NAME",
"value": "Mr.Xu"
}
] | null | [] | package com.baidu.gmall0715.mocker.util;
import java.util.Random;
/**
* @author Mr.Xu
* @description:
* @create 2019-12-13 10:58
*/
public class RandomNum {
public static final int getRandInt(int fromNum,int toNum){
return fromNum+ new Random().nextInt(toNum-fromNum+1);
}
}
| 301 | 0.674419 | 0.61794 | 14 | 20.428572 | 21.144787 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 12 |
066cd626e0ca53f8ffed51716575c28bd13baa37 | 4,939,212,444,739 | 8faf901338678fd4f0e0df9fba1308130501f466 | /src/main/java/com/quiz/casestudy/service/program/IProgramService.java | 60dbf014eb2413dbe4e841c9030d84c3d2138bfd | [] | no_license | nhlong9697/case-study-module-4 | https://github.com/nhlong9697/case-study-module-4 | 6a034450cd05a0ee3b048d263cae6ead6284fa28 | 2474d980d60bdbc66130eb7c622f4b25105015dc | refs/heads/master | 2022-12-03T15:59:44.779000 | 2020-08-04T07:20:29 | 2020-08-04T07:20:29 | 283,129,693 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.quiz.casestudy.service.program;
import com.quiz.casestudy.model.Program;
import com.quiz.casestudy.service.IService;
public interface IProgramService extends IService<Program> {
}
| UTF-8 | Java | 194 | java | IProgramService.java | Java | [] | null | [] | package com.quiz.casestudy.service.program;
import com.quiz.casestudy.model.Program;
import com.quiz.casestudy.service.IService;
public interface IProgramService extends IService<Program> {
}
| 194 | 0.824742 | 0.824742 | 7 | 26.714285 | 23.614246 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
aa99391a043a61a7713b8f0633d03114b374c060 | 4,758,823,815,566 | 8643a3eed82acddf80f93378fc1bca426bfd7a42 | /subprojects/snapshots/src/main/java/org/gradle/internal/snapshot/RegularFileSnapshot.java | 08261abbb4e781141888cef7bda6b4b657423bcb | [
"BSD-3-Clause",
"LGPL-2.1-or-later",
"LicenseRef-scancode-mit-old-style",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"LGPL-2.1-only",
"Apache-2.0",
"MPL-2.0",
"EPL-1.0"
] | permissive | gradle/gradle | https://github.com/gradle/gradle | f5666240739f96166647b20f9bc2d57e78f28ddf | 1fd0b632a437ae771718982ef2aa1c3b52ee2f0f | refs/heads/master | 2023-09-04T02:51:58.940000 | 2023-09-03T18:42:57 | 2023-09-03T18:42:57 | 302,322 | 15,005 | 4,911 | Apache-2.0 | false | 2023-09-14T21:08:58 | 2009-09-09T18:27:19 | 2023-09-14T20:25:45 | 2023-09-14T21:08:58 | 505,876 | 15,160 | 4,324 | 2,510 | Groovy | false | false | /*
* Copyright 2018 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 org.gradle.internal.snapshot;
import org.gradle.internal.file.FileMetadata;
import org.gradle.internal.file.FileType;
import org.gradle.internal.hash.HashCode;
import java.util.Optional;
/**
* A snapshot of a regular file.
*
* The snapshot includes the content hash of the file and its metadata.
*/
public class RegularFileSnapshot extends AbstractFileSystemLocationSnapshot implements FileSystemLeafSnapshot {
private final HashCode contentHash;
private final FileMetadata metadata;
public RegularFileSnapshot(String absolutePath, String name, HashCode contentHash, FileMetadata metadata) {
super(absolutePath, name, metadata.getAccessType());
this.contentHash = contentHash;
this.metadata = metadata;
}
@Override
public FileType getType() {
return FileType.RegularFile;
}
@Override
public HashCode getHash() {
return contentHash;
}
// Used by the Maven caching client. Do not remove
public FileMetadata getMetadata() {
return metadata;
}
@Override
public boolean isContentAndMetadataUpToDate(FileSystemLocationSnapshot other) {
return isContentUpToDate(other) && metadata.equals(((RegularFileSnapshot) other).metadata);
}
@Override
public boolean isContentUpToDate(FileSystemLocationSnapshot other) {
if (!(other instanceof RegularFileSnapshot)) {
return false;
}
return contentHash.equals(((RegularFileSnapshot) other).contentHash);
}
@Override
public void accept(FileSystemLocationSnapshotVisitor visitor) {
visitor.visitRegularFile(this);
}
@Override
public <T> T accept(FileSystemLocationSnapshotTransformer<T> transformer) {
return transformer.visitRegularFile(this);
}
@Override
public Optional<FileSystemNode> invalidate(VfsRelativePath targetPath, CaseSensitivity caseSensitivity, SnapshotHierarchy.NodeDiffListener diffListener) {
diffListener.nodeRemoved(this);
return Optional.empty();
}
@Override
public String toString() {
return String.format("%s@%s/%s", super.toString(), getHash(), getName());
}
}
| UTF-8 | Java | 2,814 | java | RegularFileSnapshot.java | Java | [] | null | [] | /*
* Copyright 2018 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 org.gradle.internal.snapshot;
import org.gradle.internal.file.FileMetadata;
import org.gradle.internal.file.FileType;
import org.gradle.internal.hash.HashCode;
import java.util.Optional;
/**
* A snapshot of a regular file.
*
* The snapshot includes the content hash of the file and its metadata.
*/
public class RegularFileSnapshot extends AbstractFileSystemLocationSnapshot implements FileSystemLeafSnapshot {
private final HashCode contentHash;
private final FileMetadata metadata;
public RegularFileSnapshot(String absolutePath, String name, HashCode contentHash, FileMetadata metadata) {
super(absolutePath, name, metadata.getAccessType());
this.contentHash = contentHash;
this.metadata = metadata;
}
@Override
public FileType getType() {
return FileType.RegularFile;
}
@Override
public HashCode getHash() {
return contentHash;
}
// Used by the Maven caching client. Do not remove
public FileMetadata getMetadata() {
return metadata;
}
@Override
public boolean isContentAndMetadataUpToDate(FileSystemLocationSnapshot other) {
return isContentUpToDate(other) && metadata.equals(((RegularFileSnapshot) other).metadata);
}
@Override
public boolean isContentUpToDate(FileSystemLocationSnapshot other) {
if (!(other instanceof RegularFileSnapshot)) {
return false;
}
return contentHash.equals(((RegularFileSnapshot) other).contentHash);
}
@Override
public void accept(FileSystemLocationSnapshotVisitor visitor) {
visitor.visitRegularFile(this);
}
@Override
public <T> T accept(FileSystemLocationSnapshotTransformer<T> transformer) {
return transformer.visitRegularFile(this);
}
@Override
public Optional<FileSystemNode> invalidate(VfsRelativePath targetPath, CaseSensitivity caseSensitivity, SnapshotHierarchy.NodeDiffListener diffListener) {
diffListener.nodeRemoved(this);
return Optional.empty();
}
@Override
public String toString() {
return String.format("%s@%s/%s", super.toString(), getHash(), getName());
}
}
| 2,814 | 0.717484 | 0.714641 | 88 | 30.977272 | 32.233162 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.409091 | false | false | 12 |
9ae9855f5531ae747856ae187a5b269df4729a41 | 37,211,596,660,290 | cb1afff8434b3cd594b63c2842b72022d885b61b | /src/main/java/com/goit/popov/math/floatp/OperationLongFloat.java | 8745ff446f179db80975dc0b82a5b474b22eebd2 | [] | no_license | Popov85/Math | https://github.com/Popov85/Math | 749f2a7739371030a4b466e75d7e1ee561f98e4c | 9b4dbe7407980364013bec2775e9b277ae284b64 | refs/heads/master | 2020-05-23T08:19:15.360000 | 2016-10-07T08:06:33 | 2016-10-07T08:06:33 | 70,226,917 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.goit.popov.math.floatp;
import com.goit.popov.math.OperationNumeric;
/**
* Created by Andrey on 30.09.2016.
*/
public class OperationLongFloat implements OperationNumeric<Float, Long, Float> {
public Float add(Long number1, Float number2) {
return number1+number2;
}
public Float subtract(Long number1, Float number2) {
return number1-number2;
}
public Float multiply(Long number1, Float number2) {
return number1*number2;
}
public Float divide(Long number1, Float number2) {
return number1/number2;
}
}
| UTF-8 | Java | 652 | java | OperationLongFloat.java | Java | [
{
"context": "it.popov.math.OperationNumeric;\n\n/**\n * Created by Andrey on 30.09.2016.\n */\npublic class OperationLongFloa",
"end": 107,
"score": 0.9996143579483032,
"start": 101,
"tag": "NAME",
"value": "Andrey"
}
] | null | [] | package com.goit.popov.math.floatp;
import com.goit.popov.math.OperationNumeric;
/**
* Created by Andrey on 30.09.2016.
*/
public class OperationLongFloat implements OperationNumeric<Float, Long, Float> {
public Float add(Long number1, Float number2) {
return number1+number2;
}
public Float subtract(Long number1, Float number2) {
return number1-number2;
}
public Float multiply(Long number1, Float number2) {
return number1*number2;
}
public Float divide(Long number1, Float number2) {
return number1/number2;
}
}
| 652 | 0.616564 | 0.579755 | 25 | 25.08 | 24.68833 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.48 | false | false | 12 |
275aebe57af1a9d6579951667d12b7b8205d391a | 34,694,745,849,594 | 158051d484828c2822f91201a8eed305ba756388 | /src/main/java/cn/bdqn/gaobingfa/design/strategy/Shopping.java | 3be901423f5d84987c05795a80ddef249e542371 | [] | no_license | shiyijun0/gaobingfa | https://github.com/shiyijun0/gaobingfa | da61211c46b16d2b786b1f389e6414a74f776604 | 8f5facf1d060601a251a7d80a123ecfd55749d6a | refs/heads/master | 2020-04-06T21:20:36.736000 | 2019-03-08T06:36:18 | 2019-03-08T06:36:27 | 157,800,373 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.bdqn.gaobingfa.design.strategy;
public abstract class Shopping {
private Fruits fruits;
public void setFruits(Fruits fruits) {
this.fruits = fruits;
}
public String sell(int price){
if(this.fruits==null)
return "没有水果可以卖";
return this.fruits.sell(price);
}
protected abstract void eate();
protected void wan(){
System.out.println("每个水果都可以玩");
}
public Shopping() {
}
}
| UTF-8 | Java | 497 | java | Shopping.java | Java | [] | null | [] | package cn.bdqn.gaobingfa.design.strategy;
public abstract class Shopping {
private Fruits fruits;
public void setFruits(Fruits fruits) {
this.fruits = fruits;
}
public String sell(int price){
if(this.fruits==null)
return "没有水果可以卖";
return this.fruits.sell(price);
}
protected abstract void eate();
protected void wan(){
System.out.println("每个水果都可以玩");
}
public Shopping() {
}
}
| 497 | 0.61242 | 0.61242 | 25 | 17.68 | 16.08408 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28 | false | false | 12 |
d62e9755d0deb1fa9cf9acf132a78340e517a4d2 | 19,275,813,261,352 | de8ff208942cc26fda1f12caa286dc13ca1c022a | /src/main/java/plusm/gp/discordbot/manager/events/MemberNickChangeListener.java | a8062963e9b271c101f9b61f04c00d4b01b2b960 | [] | no_license | getplusm/gp-discordbot | https://github.com/getplusm/gp-discordbot | 9301bc2e6b6e4b068547ab3d78ccc77a4dd231c4 | 63f07434734b230745a488fd4a37b573d943ab2f | refs/heads/master | 2023-04-25T07:54:49.546000 | 2021-05-20T09:46:56 | 2021-05-20T09:46:56 | 369,157,690 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package plusm.gp.discordbot.manager.events;
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.bukkit.Bukkit;
import plusm.gp.discordbot.utils.DiscordData;
import plusm.gp.playerdatamanager.utils.PlayerData;
import javax.annotation.Nonnull;
import java.util.UUID;
public class MemberNickChangeListener extends ListenerAdapter {
@Override
public void onGuildMemberUpdateNickname(@Nonnull final GuildMemberUpdateNicknameEvent e) {
if (e.getMember().getUser().isBot()) {
return;
}
if (!DiscordData.hasConnectedAccount(e.getMember().getId())) {
return;
}
final UUID uuid = DiscordData.getAccountOwner(e.getMember().getId());
final PlayerData data = PlayerData.getPlayerData(uuid);
if (data == null) {
return;
}
try {
if (e.getNewNickname() == null) {
e.getMember().modifyNickname(data.getLocalName(true)).complete();
} else if (!e.getNewNickname().contains(data.getLocalName(true))) {
e.getMember().modifyNickname(data.getLocalName(true)).complete();
}
if (Bukkit.getPlayer(uuid) != null && !e.getMember().getNickname().contains("[" + data.getID() + "]")) {
e.getMember().modifyNickname(e.getMember().getNickname() + " [" + data.getID() + "]").complete();
}
} catch (Exception ex) {
}
}
}
| UTF-8 | Java | 1,528 | java | MemberNickChangeListener.java | Java | [] | null | [] | package plusm.gp.discordbot.manager.events;
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.bukkit.Bukkit;
import plusm.gp.discordbot.utils.DiscordData;
import plusm.gp.playerdatamanager.utils.PlayerData;
import javax.annotation.Nonnull;
import java.util.UUID;
public class MemberNickChangeListener extends ListenerAdapter {
@Override
public void onGuildMemberUpdateNickname(@Nonnull final GuildMemberUpdateNicknameEvent e) {
if (e.getMember().getUser().isBot()) {
return;
}
if (!DiscordData.hasConnectedAccount(e.getMember().getId())) {
return;
}
final UUID uuid = DiscordData.getAccountOwner(e.getMember().getId());
final PlayerData data = PlayerData.getPlayerData(uuid);
if (data == null) {
return;
}
try {
if (e.getNewNickname() == null) {
e.getMember().modifyNickname(data.getLocalName(true)).complete();
} else if (!e.getNewNickname().contains(data.getLocalName(true))) {
e.getMember().modifyNickname(data.getLocalName(true)).complete();
}
if (Bukkit.getPlayer(uuid) != null && !e.getMember().getNickname().contains("[" + data.getID() + "]")) {
e.getMember().modifyNickname(e.getMember().getNickname() + " [" + data.getID() + "]").complete();
}
} catch (Exception ex) {
}
}
}
| 1,528 | 0.632853 | 0.631545 | 38 | 39.210526 | 32.849064 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 12 |
0f27466357927eff9d6b97da886bc05f85f93555 | 29,850,022,740,409 | 5fa3e6a8c9ab2691a3a5b1ca3a8c0ee061095792 | /src/main/java/top/feb13th/script/excel/engine/Engine.java | 48809ce25f63323ca32575e02a93c80db79146da | [
"Apache-2.0"
] | permissive | feb13th/excel-script | https://github.com/feb13th/excel-script | b8f31697c2860e1017a1da2792d92228ed0063fe | 51c613f0aea45879625b6c8c9f800ef2575ce1a2 | refs/heads/master | 2020-07-30T05:59:51.327000 | 2019-09-22T08:00:51 | 2019-09-22T08:00:51 | 210,110,779 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package top.feb13th.script.excel.engine;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* 引擎接口
*
* @author feb13th
* @date 2019/9/21 19:23
*/
public interface Engine {
/**
* 初始化
*
* @param url 连接字符串
* @param host 主机名
* @param port 端口
* @param database 数据库名称
* @return 连接的url
*/
String init(String url, String host, String port, String database);
/**
* 获取数据库连接
*
* @param url 连接字符串
* @param username 用户名
* @param password 密码
*/
default Connection getConnection(String url, String username, String password) {
Connection connection = null;
try {
connection = DriverManager
.getConnection(url, username, password);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return connection;
}
}
| UTF-8 | Java | 930 | java | Engine.java | Java | [
{
"context": " java.sql.SQLException;\n\n/**\n * 引擎接口\n *\n * @author feb13th\n * @date 2019/9/21 19:23\n */\npublic interface Eng",
"end": 165,
"score": 0.9996875524520874,
"start": 158,
"tag": "USERNAME",
"value": "feb13th"
},
{
"context": "连接\n *\n * @param url 连接字符串\n * @param username 用户名\n * @param password 密码\n */\n default Connectio",
"end": 499,
"score": 0.935051679611206,
"start": 496,
"tag": "USERNAME",
"value": "用户名"
},
{
"context": "字符串\n * @param username 用户名\n * @param password 密码\n */\n default Connection getConnection(String u",
"end": 523,
"score": 0.9917026162147522,
"start": 521,
"tag": "PASSWORD",
"value": "密码"
}
] | null | [] | package top.feb13th.script.excel.engine;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* 引擎接口
*
* @author feb13th
* @date 2019/9/21 19:23
*/
public interface Engine {
/**
* 初始化
*
* @param url 连接字符串
* @param host 主机名
* @param port 端口
* @param database 数据库名称
* @return 连接的url
*/
String init(String url, String host, String port, String database);
/**
* 获取数据库连接
*
* @param url 连接字符串
* @param username 用户名
* @param password 密码
*/
default Connection getConnection(String url, String username, String password) {
Connection connection = null;
try {
connection = DriverManager
.getConnection(url, username, password);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return connection;
}
}
| 930 | 0.640662 | 0.622931 | 45 | 17.799999 | 17.90543 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.355556 | false | false | 12 |
7abbe330ea48fad11baf57e101706aa490d724d8 | 29,850,022,742,354 | b599008f27f59dd8a2d8185860205b5414891836 | /src/main/java/com/neo/mapper/test1/CustomerInfoMapper.java | f36fe6f97f3f8c3e46576512d99fad14cac3e056 | [] | no_license | 82398485/spring-boot-mybatis-annotation-mulidatasource | https://github.com/82398485/spring-boot-mybatis-annotation-mulidatasource | cf10f5b6fbbec82f308c395bd775c3391a0abdaa | 3b78c7e2bc1c15f1c2e664eecac338b9dad4fbdf | refs/heads/master | 2018-12-22T03:26:48.160000 | 2018-10-19T09:40:22 | 2018-10-19T09:40:22 | 150,950,642 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.neo.mapper.test1;
import com.neo.entity.po.CustomerInfo;
import org.apache.ibatis.annotations.*;
import java.util.List;
public interface CustomerInfoMapper {
@Select("SELECT * FROM 客户信息")
@Results({
@Result(property = "userName", column = "名字"),
@Result(property = "weight", column = "体重"),
@Result(property = "age", column = "年龄")
})
List<CustomerInfo> getAll();
@Insert("INSERT INTO 客户信息(名字,体重,年龄) VALUES(#{userName}, #{weight}, #{age})")
void insert(CustomerInfo customerInfo);
@Delete("DELETE FROM 客户信息 WHERE 名字 =#{userName} and 体重=#{weight} and 年龄=#{age}")
void delete(CustomerInfo customerInfo);
@Insert("<script>"+
"insert into 客户信息(名字, 体重, 年龄) "
+ "values "
+ "<foreach collection =\"customerInfoList\" item=\"customerInfo\" index= \"index\" separator =\",\"> "
+ "(#{customerInfo.userName},#{customerInfo.weight},#{customerInfo.age}) "
+ "</foreach > "
+ "</script>")
void insertBatch(@Param(value = "customerInfoList") List<CustomerInfo> customerInfoList);
} | UTF-8 | Java | 1,106 | java | CustomerInfoMapper.java | Java | [
{
"context": " * FROM 客户信息\")\n\t@Results({\n\t\t\t@Result(property = \"userName\", column = \"名字\"),\n\t\t\t@Result(property = \"weight\"",
"end": 247,
"score": 0.840874969959259,
"start": 239,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | package com.neo.mapper.test1;
import com.neo.entity.po.CustomerInfo;
import org.apache.ibatis.annotations.*;
import java.util.List;
public interface CustomerInfoMapper {
@Select("SELECT * FROM 客户信息")
@Results({
@Result(property = "userName", column = "名字"),
@Result(property = "weight", column = "体重"),
@Result(property = "age", column = "年龄")
})
List<CustomerInfo> getAll();
@Insert("INSERT INTO 客户信息(名字,体重,年龄) VALUES(#{userName}, #{weight}, #{age})")
void insert(CustomerInfo customerInfo);
@Delete("DELETE FROM 客户信息 WHERE 名字 =#{userName} and 体重=#{weight} and 年龄=#{age}")
void delete(CustomerInfo customerInfo);
@Insert("<script>"+
"insert into 客户信息(名字, 体重, 年龄) "
+ "values "
+ "<foreach collection =\"customerInfoList\" item=\"customerInfo\" index= \"index\" separator =\",\"> "
+ "(#{customerInfo.userName},#{customerInfo.weight},#{customerInfo.age}) "
+ "</foreach > "
+ "</script>")
void insertBatch(@Param(value = "customerInfoList") List<CustomerInfo> customerInfoList);
} | 1,106 | 0.669591 | 0.668616 | 33 | 30.121212 | 28.870407 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.787879 | false | false | 12 |
c5b3773eeb54ac5f005e7cb1333cbd6c90bda3c2 | 26,001,732,056,011 | 6dee0d8a473dea1b50d1a10214c999881336e247 | /src/main/com/netapp/santricity/auth/ApiKeyAuth.java | f67fbdbb02b5fa6ce9414d93bdae5b2735112812 | [
"BSD-3-Clause-Clear"
] | permissive | NetApp/santricity-webapi-javasdk | https://github.com/NetApp/santricity-webapi-javasdk | e2eab1124a94547981dd36d470b5e7ad520e5127 | 42c8e8a4f661f5f417cb0375ec93a54677fe25f7 | refs/heads/master | 2020-05-20T11:55:29.162000 | 2017-10-05T20:35:03 | 2017-10-05T20:35:03 | 65,746,275 | 2 | 6 | null | false | 2017-10-05T20:35:04 | 2016-08-15T16:13:39 | 2017-08-31T12:09:06 | 2017-10-05T20:35:03 | 5,448 | 3 | 3 | 1 | Java | null | null | /**************************************************************************************************************************************************************
* The Clear BSD License
*
* Copyright (c) – 2016, NetApp, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* * Neither the name of NetApp, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*************************************************************************************************************************************************************/
package com.netapp.santricity.auth;
import com.netapp.santricity.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class com.ni.aa.client.codegen.lang.JavaNetappClientCodegen", date = "2017-10-04T15:06:02.675-05:00")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;
private String apiKey;
private String apiKeyPrefix;
public ApiKeyAuth(String location, String paramName) {
this.location = location;
this.paramName = paramName;
}
public String getLocation() {
return location;
}
public String getParamName() {
return paramName;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getApiKeyPrefix() {
return apiKeyPrefix;
}
public void setApiKeyPrefix(String apiKeyPrefix) {
this.apiKeyPrefix = apiKeyPrefix;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
if (apiKey == null) {
return;
}
String value;
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;
} else {
value = apiKey;
}
if (location == "query") {
queryParams.add(new Pair(paramName, value));
} else if (location == "header") {
headerParams.put(paramName, value);
}
}
}
| UTF-8 | Java | 3,427 | java | ApiKeyAuth.java | Java | [] | null | [] | /**************************************************************************************************************************************************************
* The Clear BSD License
*
* Copyright (c) – 2016, NetApp, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* * Neither the name of NetApp, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*************************************************************************************************************************************************************/
package com.netapp.santricity.auth;
import com.netapp.santricity.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class com.ni.aa.client.codegen.lang.JavaNetappClientCodegen", date = "2017-10-04T15:06:02.675-05:00")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;
private String apiKey;
private String apiKeyPrefix;
public ApiKeyAuth(String location, String paramName) {
this.location = location;
this.paramName = paramName;
}
public String getLocation() {
return location;
}
public String getParamName() {
return paramName;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getApiKeyPrefix() {
return apiKeyPrefix;
}
public void setApiKeyPrefix(String apiKeyPrefix) {
this.apiKeyPrefix = apiKeyPrefix;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
if (apiKey == null) {
return;
}
String value;
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;
} else {
value = apiKey;
}
if (location == "query") {
queryParams.add(new Pair(paramName, value));
} else if (location == "header") {
headerParams.put(paramName, value);
}
}
}
| 3,427 | 0.669489 | 0.66219 | 78 | 42.910255 | 103.158852 | 848 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.679487 | false | false | 12 |
dfd848d4e7a5a16b23fbcabb185adcc45a55af14 | 6,545,530,224,625 | cf05ded1829fca1188b2619eaa15415059b94333 | /yuanlinjinguan/kernel/common-biz/src/main/java/com/zjzmjr/core/common/biz/HolidayUtil.java | 3754f071fd0e341ea2e456b4ca46bc0b19e363d7 | [] | no_license | microspeed2018/project | https://github.com/microspeed2018/project | bf2499fa3c5508aed39ffd067c9f23808b3f6d59 | 06ac9129275b336543b2ba7fedc6b0b2e54d61d1 | refs/heads/master | 2021-04-27T20:00:13.985000 | 2018-02-28T07:18:00 | 2018-02-28T07:18:00 | 122,367,753 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zjzmjr.core.common.biz;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
import com.zjzmjr.common.util.DateUtil;
import com.zjzmjr.core.api.holiday.IHolidayFacade;
import com.zjzmjr.core.base.result.ResultEntry;
import com.zjzmjr.core.base.util.SpringContextUtil;
import com.zjzmjr.core.model.holiday.Holiday;
import com.zjzmjr.core.model.holiday.HolidayQuery;
/**
* 节假日工具类
*
* @author Administrator
* @version $Id: HolidayUtil.java, v 0.1 2016-10-12 下午2:13:54 Administrator Exp
* $
*/
public class HolidayUtil {
private static IHolidayFacade holidayFacade = SpringContextUtil.getBean("holidayFacade");
/**
* 节假日枚举类型
*
* @author oms
* @version $Id: HolidayUtil.java, v 0.1 2017-5-3 下午4:30:19 oms Exp $
*/
private enum HolidayTypeEnum {
REST_DAYS_WORK(0, "调休工作日"),
REST_DAY(1, "成功");
private Integer value;
private String message;
private HolidayTypeEnum(Integer value, String message) {
this.value = value;
this.message = message;
}
public Integer getValue() {
return value;
}
public String getMessage() {
return message;
}
public static HolidayTypeEnum getByValue(Integer value) {
if (value != null) {
for (HolidayTypeEnum enu : values()) {
if (enu.value.equals(value)) {
return enu;
}
}
}
return null;
}
}
/**
* 判断是否是周末
*
* @param date
* @return
*/
public static boolean isWeekend(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int weekday = cal.get(Calendar.DAY_OF_WEEK);
return weekday == Calendar.SATURDAY || weekday == Calendar.SUNDAY;
}
/**
* 判断是否是国家规定节假日
*
* @param date
* @return
*/
public static boolean isFestivals(Date date) {
HolidayQuery query = new HolidayQuery();
query.setHolidayTime(com.zjzmjr.core.base.util.DateUtil.format(date, com.zjzmjr.core.base.util.DateUtil.YYMMDD));
ResultEntry<Holiday> result = holidayFacade.queryHoliday(query);
if (result.isSuccess()) {
Holiday holiday = result.getT();
if (HolidayTypeEnum.REST_DAYS_WORK.getValue().equals(HolidayTypeEnum.getByValue(holiday.getFlag()))) {
return false;
} else {
return true;
}
}
return false;
}
/**
* 判断是否是休息日
*
* @param date
* @return
*/
public static boolean isHoliday(Date date) {
return isWeekend(date) || isFestivals(date);
}
/**
* 计算两个时间之间相差的小时数
*
* @param dateFrom
* @param dateTo
* @param incHoliday 是否包括节假日
* @param tailUp 不足一小时是否按一小时计算
* @return
*/
public static int getOffsetHours(Date dateFrom, Date dateTo, boolean incHoliday, boolean tailUp){
int offset = 0;
int amount = 0;
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateFrom);
while(!incHoliday && isHoliday(calendar.getTime())){
calendar.add(Calendar.DAY_OF_MONTH, 1);
dateFrom = DateUtil.getPureDay(calendar.getTime());
}
if(dateFrom.compareTo(dateTo) <= 0){
calendar.setTime(dateFrom);
do{
calendar.add(Calendar.DAY_OF_MONTH, 1);
if(incHoliday && isHoliday(calendar.getTime())){
amount += 24;
}else if(!isHoliday(calendar.getTime())){
amount += 24;
}
}while(calendar.getTime().compareTo(dateTo) <= 0);
calendar.add(Calendar.DAY_OF_MONTH, -1);
dateFrom = calendar.getTime();
amount = amount - 24;
offset = DateUtil.getOffsetHours(dateFrom, dateTo, tailUp);
}
return amount + offset;
}
public static void main(String[] args) {
Date dateFrom;
try {
dateFrom = DateUtil.parseDate("2017-07-29 11:20:20", "yyyy-MM-dd hh:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateFrom);
calendar.add(Calendar.DAY_OF_MONTH, 2);
Date dateTo = calendar.getTime();
System.out.println(getOffsetHours(dateFrom, dateTo, true, true));
} catch (ParseException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 4,807 | java | HolidayUtil.java | Java | [
{
"context": "oliday.HolidayQuery;\n\n/**\n * 节假日工具类\n * \n * @author Administrator\n * @version $Id: HolidayUtil.java, v 0.1 2016-10-",
"end": 452,
"score": 0.9382425546646118,
"start": 439,
"tag": "NAME",
"value": "Administrator"
},
{
"context": "\");\n\n /**\n * 节假日枚举类型\n * \n * @author oms\n * @version $Id: HolidayUtil.java, v 0.1 2017",
"end": 723,
"score": 0.9993476867675781,
"start": 720,
"tag": "USERNAME",
"value": "oms"
}
] | null | [] | package com.zjzmjr.core.common.biz;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
import com.zjzmjr.common.util.DateUtil;
import com.zjzmjr.core.api.holiday.IHolidayFacade;
import com.zjzmjr.core.base.result.ResultEntry;
import com.zjzmjr.core.base.util.SpringContextUtil;
import com.zjzmjr.core.model.holiday.Holiday;
import com.zjzmjr.core.model.holiday.HolidayQuery;
/**
* 节假日工具类
*
* @author Administrator
* @version $Id: HolidayUtil.java, v 0.1 2016-10-12 下午2:13:54 Administrator Exp
* $
*/
public class HolidayUtil {
private static IHolidayFacade holidayFacade = SpringContextUtil.getBean("holidayFacade");
/**
* 节假日枚举类型
*
* @author oms
* @version $Id: HolidayUtil.java, v 0.1 2017-5-3 下午4:30:19 oms Exp $
*/
private enum HolidayTypeEnum {
REST_DAYS_WORK(0, "调休工作日"),
REST_DAY(1, "成功");
private Integer value;
private String message;
private HolidayTypeEnum(Integer value, String message) {
this.value = value;
this.message = message;
}
public Integer getValue() {
return value;
}
public String getMessage() {
return message;
}
public static HolidayTypeEnum getByValue(Integer value) {
if (value != null) {
for (HolidayTypeEnum enu : values()) {
if (enu.value.equals(value)) {
return enu;
}
}
}
return null;
}
}
/**
* 判断是否是周末
*
* @param date
* @return
*/
public static boolean isWeekend(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int weekday = cal.get(Calendar.DAY_OF_WEEK);
return weekday == Calendar.SATURDAY || weekday == Calendar.SUNDAY;
}
/**
* 判断是否是国家规定节假日
*
* @param date
* @return
*/
public static boolean isFestivals(Date date) {
HolidayQuery query = new HolidayQuery();
query.setHolidayTime(com.zjzmjr.core.base.util.DateUtil.format(date, com.zjzmjr.core.base.util.DateUtil.YYMMDD));
ResultEntry<Holiday> result = holidayFacade.queryHoliday(query);
if (result.isSuccess()) {
Holiday holiday = result.getT();
if (HolidayTypeEnum.REST_DAYS_WORK.getValue().equals(HolidayTypeEnum.getByValue(holiday.getFlag()))) {
return false;
} else {
return true;
}
}
return false;
}
/**
* 判断是否是休息日
*
* @param date
* @return
*/
public static boolean isHoliday(Date date) {
return isWeekend(date) || isFestivals(date);
}
/**
* 计算两个时间之间相差的小时数
*
* @param dateFrom
* @param dateTo
* @param incHoliday 是否包括节假日
* @param tailUp 不足一小时是否按一小时计算
* @return
*/
public static int getOffsetHours(Date dateFrom, Date dateTo, boolean incHoliday, boolean tailUp){
int offset = 0;
int amount = 0;
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateFrom);
while(!incHoliday && isHoliday(calendar.getTime())){
calendar.add(Calendar.DAY_OF_MONTH, 1);
dateFrom = DateUtil.getPureDay(calendar.getTime());
}
if(dateFrom.compareTo(dateTo) <= 0){
calendar.setTime(dateFrom);
do{
calendar.add(Calendar.DAY_OF_MONTH, 1);
if(incHoliday && isHoliday(calendar.getTime())){
amount += 24;
}else if(!isHoliday(calendar.getTime())){
amount += 24;
}
}while(calendar.getTime().compareTo(dateTo) <= 0);
calendar.add(Calendar.DAY_OF_MONTH, -1);
dateFrom = calendar.getTime();
amount = amount - 24;
offset = DateUtil.getOffsetHours(dateFrom, dateTo, tailUp);
}
return amount + offset;
}
public static void main(String[] args) {
Date dateFrom;
try {
dateFrom = DateUtil.parseDate("2017-07-29 11:20:20", "yyyy-MM-dd hh:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateFrom);
calendar.add(Calendar.DAY_OF_MONTH, 2);
Date dateTo = calendar.getTime();
System.out.println(getOffsetHours(dateFrom, dateTo, true, true));
} catch (ParseException e) {
e.printStackTrace();
}
}
}
| 4,807 | 0.564805 | 0.552297 | 161 | 27.801243 | 24.580662 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.496894 | false | false | 12 |
9715de013291a573b03ff2dca4b0ae63ea843905 | 30,940,944,413,102 | a55f91349221a05e289d090602818ef751e2f9ca | /src/com/example/shapeme/TutorialScreen.java | ec2e161b2f82b51e81c0ed263c82fb1a4cd7d5a2 | [] | no_license | shapeme/shape_me | https://github.com/shapeme/shape_me | 7c93976b40fcd8259f8765fe4a4bef8084cd2503 | 0b7d3c6857912d859c716497602a6da90de7845f | refs/heads/master | 2020-05-17T13:49:53.049000 | 2013-12-01T21:55:42 | 2013-12-01T21:55:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.shapeme;
import java.util.List;
import com.badlogic.androidgames.framework.Game;
import com.badlogic.androidgames.framework.Graphics;
import com.badlogic.androidgames.framework.Screen;
import com.badlogic.androidgames.framework.Input.TouchEvent;
public class TutorialScreen extends Screen{
public TutorialScreen(Game game) {
super(game);
// TODO Auto-generated constructor stub
}
@Override
public void update(float deltaTime) {
// TODO Auto-generated method stub
/* Get the touch events. */
List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
for (int index = 0; index < touchEvents.size(); ++index) {
TouchEvent currentEvent = touchEvents.get(index);
/* Check if the back button was pressed. */
if (currentEvent.type == TouchEvent.TOUCH_UP && this.inBounds(currentEvent, 1700, 900, Assets.backButton.getWidth(), Assets.backButton.getHeight())) {
game.setScreen(new MainMenuScreen(game));
}
}
}
@Override
public void present(float deltaTime) {
// TODO Auto-generated method stub
Graphics g = game.getGraphics();
/* Draw the background. */
g.drawPixmap(Assets.tutorialScreenBackground, 0, 0);
/* Draw the buttons. */
g.drawPixmap(Assets.backButton, 1700, 900);
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 1,505 | java | TutorialScreen.java | Java | [] | null | [] | package com.example.shapeme;
import java.util.List;
import com.badlogic.androidgames.framework.Game;
import com.badlogic.androidgames.framework.Graphics;
import com.badlogic.androidgames.framework.Screen;
import com.badlogic.androidgames.framework.Input.TouchEvent;
public class TutorialScreen extends Screen{
public TutorialScreen(Game game) {
super(game);
// TODO Auto-generated constructor stub
}
@Override
public void update(float deltaTime) {
// TODO Auto-generated method stub
/* Get the touch events. */
List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
for (int index = 0; index < touchEvents.size(); ++index) {
TouchEvent currentEvent = touchEvents.get(index);
/* Check if the back button was pressed. */
if (currentEvent.type == TouchEvent.TOUCH_UP && this.inBounds(currentEvent, 1700, 900, Assets.backButton.getWidth(), Assets.backButton.getHeight())) {
game.setScreen(new MainMenuScreen(game));
}
}
}
@Override
public void present(float deltaTime) {
// TODO Auto-generated method stub
Graphics g = game.getGraphics();
/* Draw the background. */
g.drawPixmap(Assets.tutorialScreenBackground, 0, 0);
/* Draw the buttons. */
g.drawPixmap(Assets.backButton, 1700, 900);
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
}
| 1,505 | 0.714286 | 0.70299 | 63 | 22.888889 | 25.97197 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.650794 | false | false | 12 |
93e2181a53684c63a1f9f7d3d05797e01b059fa9 | 9,723,805,965,098 | 99441291629ab388540f8dead5ea4ed8a8343348 | /src/main/java/com/ex/ers/daos/DAO.java | dbe51c4e1ccc16705c6eacdbc2b7501c51bab228 | [] | no_license | ammckenzie1998/expense-reimbursements | https://github.com/ammckenzie1998/expense-reimbursements | b6f7e629d661ed2da1c30ec32b7b11ffe738a3f8 | 179b5eca4feba9fef7087a48116b4dc2e4e1d69a | refs/heads/main | 2023-02-04T05:51:18.704000 | 2020-12-29T00:01:31 | 2020-12-29T00:01:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ex.ers.daos;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
/**
* Abstract class containing fields to set up connection
*/
public abstract class DAO {
private static final Logger logger = LogManager.getLogger(DAO.class);
protected SessionFactory sessionFactory;
public DAO(){
configure();
}
protected void configure() {
Configuration config = new Configuration().configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(config.getProperties());
this.sessionFactory = config.buildSessionFactory(builder.build());
logger.debug("Configured session");
}
}
| UTF-8 | Java | 865 | java | DAO.java | Java | [] | null | [] | package com.ex.ers.daos;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
/**
* Abstract class containing fields to set up connection
*/
public abstract class DAO {
private static final Logger logger = LogManager.getLogger(DAO.class);
protected SessionFactory sessionFactory;
public DAO(){
configure();
}
protected void configure() {
Configuration config = new Configuration().configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(config.getProperties());
this.sessionFactory = config.buildSessionFactory(builder.build());
logger.debug("Configured session");
}
}
| 865 | 0.746821 | 0.744509 | 27 | 31.037037 | 30.318655 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false | 12 |
8a84f18b10394e7416bef877999649bd3ce9c5cf | 7,954,279,436,071 | 5b4a95757fb2e98c30c13d9832d6080a393dfad0 | /src/com/example/myapp/MyActivity.java | 52e228b4180d5d5da5a1568ecd27d332e25fdfa2 | [] | no_license | marty212/CodeRelayApp | https://github.com/marty212/CodeRelayApp | c32b455307dc75f6dbebbc95539c488ad20cd7a4 | 6453fe460b8ed0387c1a5f679a630467eed4b4bf | refs/heads/master | 2020-03-29T20:21:10.828000 | 2014-11-09T07:26:16 | 2014-11-09T07:26:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.myapp;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.FloatMath;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.net.URL;
public class MyActivity extends Activity implements SensorEventListener, LocationListener {
// Start with some variables
private SensorManager sensorMan;
private Sensor accelerometer;
private LocationManager locationManager;
static public MyActivity me;
private Challenge c = null;
private boolean done = false;
private String id;
private double distance = 9;
private Location prev = null;
private float[] mGravity;
private float mAccel;
private float mAccelCurrent;
private float mAccelLast;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
me = this;
setContentView(R.layout.question);
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
id = ((EditText)findViewById(R.id.userInput)).getText().toString();
setContentView(R.layout.main);
TextView text = (TextView) findViewById(R.id.test);
text.setText(id);
OpenUrl.text = text;
new OpenUrl().execute("http://coderelay.cloudapp.net:8182/receive/?id=" + id);
Button b2 = (Button) findViewById(R.id.challengeButton);
b2.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
new GetChallenge().execute("http://coderelay.cloudapp.net:8182/work/?id=" + id);
}
});
final Button b = (Button) findViewById(R.id.close);
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
me.finish();
}
});
}
});
/*
setContentView(R.layout.main);
sensorMan = (SensorManager)getSystemService(SENSOR_SERVICE);
accelerometer = sensorMan.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mAccel = 0.00f;
mAccelCurrent = SensorManager.GRAVITY_EARTH;
mAccelLast = SensorManager.GRAVITY_EARTH;
TextView text = (TextView)findViewById(R.id.test);
OpenUrl.text = text;
text.setText("");*/
//new OpenUrl().execute("http://localhost:8182/work/");
}
@Override
public void onResume() {
super.onResume();
/* sensorMan.registerListener(this, accelerometer,
SensorManager.SENSOR_DELAY_UI);*/
}
@Override
protected void onPause() {
super.onPause();
// sensorMan.unregisterListener(this);
}
@Override
public void onSensorChanged(SensorEvent event) {
/* if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
mGravity = event.values.clone();
// Shake detection
float x = mGravity[0];
float y = mGravity[1];
float z = mGravity[2];
mAccelLast = mAccelCurrent;
mAccelCurrent = FloatMath.sqrt(x * x + y * y + z * z);
float delta = mAccelCurrent - mAccelLast;
mAccel = mAccel * 0.9f + delta;
if (mAccel > 3 && !done) {
done = true;
TextView text = (TextView)findViewById(R.id.test);
text.setText("undoing any work stop");
new OpenUrl().execute("http://coderelay.cloudapp.net:8182/work/?id=0");
}
}*/
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// required method
}
@Override
public void onLocationChanged(Location location) {
if(prev != null)
{
distance += Math.abs(location.distanceTo(prev));
}
prev = location;
if(c.getLength() < distance)
{
clearChallenge();
locationManager.removeUpdates(me);
OpenUrl.text.setText("Challenge done");
distance = 0;
return;
}
OpenUrl.text.setText(String.valueOf(distance));
}
@Override
public void onProviderDisabled(String provider) {
/******** Called when User off Gps *********/
}
@Override
public void onProviderEnabled(String provider) {
/******** Called when User on Gps *********/
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
public void startChallenge(int i)
{
if(i == -1)
{
c = null;
return;
}
else if(c != null)
{
return;
}
c = Challenge.getChallenge(i);
switch(c)
{
case DISTANCE:
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 1, me);
TextView text = (TextView) findViewById(R.id.test);
text.setText("you have to go 100 meters");
break;
case PUSHUP:
}
}
public void clearChallenge()
{
new OpenUrl().execute("http://coderelay.cloudapp.net:8182/work/?id=" + id + "&clear=true");
startChallenge(-1);
}
}
| UTF-8 | Java | 6,224 | java | MyActivity.java | Java | [] | null | [] | package com.example.myapp;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.FloatMath;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.net.URL;
public class MyActivity extends Activity implements SensorEventListener, LocationListener {
// Start with some variables
private SensorManager sensorMan;
private Sensor accelerometer;
private LocationManager locationManager;
static public MyActivity me;
private Challenge c = null;
private boolean done = false;
private String id;
private double distance = 9;
private Location prev = null;
private float[] mGravity;
private float mAccel;
private float mAccelCurrent;
private float mAccelLast;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
me = this;
setContentView(R.layout.question);
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
id = ((EditText)findViewById(R.id.userInput)).getText().toString();
setContentView(R.layout.main);
TextView text = (TextView) findViewById(R.id.test);
text.setText(id);
OpenUrl.text = text;
new OpenUrl().execute("http://coderelay.cloudapp.net:8182/receive/?id=" + id);
Button b2 = (Button) findViewById(R.id.challengeButton);
b2.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
new GetChallenge().execute("http://coderelay.cloudapp.net:8182/work/?id=" + id);
}
});
final Button b = (Button) findViewById(R.id.close);
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
me.finish();
}
});
}
});
/*
setContentView(R.layout.main);
sensorMan = (SensorManager)getSystemService(SENSOR_SERVICE);
accelerometer = sensorMan.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mAccel = 0.00f;
mAccelCurrent = SensorManager.GRAVITY_EARTH;
mAccelLast = SensorManager.GRAVITY_EARTH;
TextView text = (TextView)findViewById(R.id.test);
OpenUrl.text = text;
text.setText("");*/
//new OpenUrl().execute("http://localhost:8182/work/");
}
@Override
public void onResume() {
super.onResume();
/* sensorMan.registerListener(this, accelerometer,
SensorManager.SENSOR_DELAY_UI);*/
}
@Override
protected void onPause() {
super.onPause();
// sensorMan.unregisterListener(this);
}
@Override
public void onSensorChanged(SensorEvent event) {
/* if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
mGravity = event.values.clone();
// Shake detection
float x = mGravity[0];
float y = mGravity[1];
float z = mGravity[2];
mAccelLast = mAccelCurrent;
mAccelCurrent = FloatMath.sqrt(x * x + y * y + z * z);
float delta = mAccelCurrent - mAccelLast;
mAccel = mAccel * 0.9f + delta;
if (mAccel > 3 && !done) {
done = true;
TextView text = (TextView)findViewById(R.id.test);
text.setText("undoing any work stop");
new OpenUrl().execute("http://coderelay.cloudapp.net:8182/work/?id=0");
}
}*/
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// required method
}
@Override
public void onLocationChanged(Location location) {
if(prev != null)
{
distance += Math.abs(location.distanceTo(prev));
}
prev = location;
if(c.getLength() < distance)
{
clearChallenge();
locationManager.removeUpdates(me);
OpenUrl.text.setText("Challenge done");
distance = 0;
return;
}
OpenUrl.text.setText(String.valueOf(distance));
}
@Override
public void onProviderDisabled(String provider) {
/******** Called when User off Gps *********/
}
@Override
public void onProviderEnabled(String provider) {
/******** Called when User on Gps *********/
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
public void startChallenge(int i)
{
if(i == -1)
{
c = null;
return;
}
else if(c != null)
{
return;
}
c = Challenge.getChallenge(i);
switch(c)
{
case DISTANCE:
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 1, me);
TextView text = (TextView) findViewById(R.id.test);
text.setText("you have to go 100 meters");
break;
case PUSHUP:
}
}
public void clearChallenge()
{
new OpenUrl().execute("http://coderelay.cloudapp.net:8182/work/?id=" + id + "&clear=true");
startChallenge(-1);
}
}
| 6,224 | 0.588368 | 0.581459 | 201 | 29.965174 | 24.264788 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512438 | false | false | 12 |
21688c5dbfc787e930e6c8bc1532b45e1c2f6c69 | 13,666,585,939,557 | e3dcebb3d6538a5c86688cfb09f9044423706d5a | /supermarket-store/src/main/java/com/ljb/controller/StoreCategoryController.java | f432797571e583261428e441955440355e55eabd | [] | no_license | longjinbing/supermarket | https://github.com/longjinbing/supermarket | cd5e8d58c42c5c8b5a731774c161df203575c25e | 4386128c589eb265c9ed00fa2918f28e3ebec38c | refs/heads/master | 2020-03-28T20:39:43.207000 | 2018-09-17T08:31:45 | 2018-09-17T08:31:45 | 149,091,382 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ljb.controller;
import java.util.List;
import java.util.Map;
import com.ljb.util.PageUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ljb.entity.StoreCategory;
import com.ljb.service.StoreCategoryService;
import com.ljb.util.R;
import com.ljb.annotation.Desc;
/**
* 商品分类Controller
*
* @author longjinbn
* @email 1106335838@qq.com
* @date 2018-09-15 18:06:42
*/
@RestController
@RequestMapping("storecategory")
@Desc(group="商品中心",name="商品分类",type=1,url="shop/storecategory.html")
public class StoreCategoryController extends AbstractController {
@Autowired
private StoreCategoryService storeCategoryService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("storecategory:list")
@Desc(name="商品分类列表",type=2)
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
return R.ok().put("data", new PageUtil(storeCategoryService.queryList(params)));
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("storecategory:info")
@Desc(name="查看商品分类",type=2)
public R info(@PathVariable("id") Integer id) {
StoreCategory storeCategory = storeCategoryService.queryObject(id);
return R.ok().put("storeCategory", storeCategory);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("storecategory:save")
@Desc(name="添加商品分类",type=2)
public R save(@RequestBody StoreCategory storeCategory) {
storeCategoryService.save(storeCategory);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("storecategory:update")
@Desc(name="修改商品分类",type=2)
public R update(@RequestBody StoreCategory storeCategory) {
storeCategoryService.update(storeCategory);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("storecategory:delete")
@Desc(name="删除商品分类",type=2)
public R delete(@RequestBody Integer[]ids) {
storeCategoryService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@Desc(name="商品分类导出",type=2)
@RequiresPermissions("storecategory:export")
public R queryAll(@RequestParam Map<String, Object> params) {
List<StoreCategory> list = storeCategoryService.queryAll(params);
return R.ok().put("data", list);
}
}
| UTF-8 | Java | 2,995 | java | StoreCategoryController.java | Java | [
{
"context": "otation.Desc;\n\n/**\n * 商品分类Controller\n *\n * @author longjinbn\n * @email 1106335838@qq.com\n * @date 2018-09-15 1",
"end": 721,
"score": 0.9991347789764404,
"start": 712,
"tag": "USERNAME",
"value": "longjinbn"
},
{
"context": " 商品分类Controller\n *\n * @author longjinbn\n * @email 1106335838@qq.com\n * @date 2018-09-15 18:06:42\n */\n@RestController\n",
"end": 749,
"score": 0.9997512102127075,
"start": 732,
"tag": "EMAIL",
"value": "1106335838@qq.com"
}
] | null | [] | package com.ljb.controller;
import java.util.List;
import java.util.Map;
import com.ljb.util.PageUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ljb.entity.StoreCategory;
import com.ljb.service.StoreCategoryService;
import com.ljb.util.R;
import com.ljb.annotation.Desc;
/**
* 商品分类Controller
*
* @author longjinbn
* @email <EMAIL>
* @date 2018-09-15 18:06:42
*/
@RestController
@RequestMapping("storecategory")
@Desc(group="商品中心",name="商品分类",type=1,url="shop/storecategory.html")
public class StoreCategoryController extends AbstractController {
@Autowired
private StoreCategoryService storeCategoryService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("storecategory:list")
@Desc(name="商品分类列表",type=2)
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
return R.ok().put("data", new PageUtil(storeCategoryService.queryList(params)));
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("storecategory:info")
@Desc(name="查看商品分类",type=2)
public R info(@PathVariable("id") Integer id) {
StoreCategory storeCategory = storeCategoryService.queryObject(id);
return R.ok().put("storeCategory", storeCategory);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("storecategory:save")
@Desc(name="添加商品分类",type=2)
public R save(@RequestBody StoreCategory storeCategory) {
storeCategoryService.save(storeCategory);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("storecategory:update")
@Desc(name="修改商品分类",type=2)
public R update(@RequestBody StoreCategory storeCategory) {
storeCategoryService.update(storeCategory);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("storecategory:delete")
@Desc(name="删除商品分类",type=2)
public R delete(@RequestBody Integer[]ids) {
storeCategoryService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@Desc(name="商品分类导出",type=2)
@RequiresPermissions("storecategory:export")
public R queryAll(@RequestParam Map<String, Object> params) {
List<StoreCategory> list = storeCategoryService.queryAll(params);
return R.ok().put("data", list);
}
}
| 2,985 | 0.686337 | 0.675448 | 104 | 26.375 | 23.022224 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.394231 | false | false | 12 |
59eab59b2ae2e8027704e9d7efe8b0c902435c03 | 20,761,871,910,449 | bd0d27b8599614609c909e10fe87b74aff849cd6 | /ec-mh/mh-entity/src/main/java/org/ec/mh/dto/MH0201/MH0201A05S01DTO.java | 093e77f5acd0c19feb287accf0b7082f84b93137 | [] | no_license | ShenJiProject/project | https://github.com/ShenJiProject/project | 620d72e93b050a497aaf5835aec328aba645ce05 | 069bc07924ff4e5d67e3862c468bac533517932f | refs/heads/master | 2020-03-31T02:07:32.232000 | 2018-11-23T12:11:17 | 2018-11-23T12:11:17 | 151,801,569 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.ec.mh.dto.MH0201;
import org.ec.utils.dto.ResponseDTO;
/**
* MH0201/A05 文章编辑数据获取: 附件
* 设计者: 张坤祥
* 更新日期: 2018/3/29
*/
public class MH0201A05S01DTO extends ResponseDTO {
/**
* 附件ID
*/
private Integer id;
/**
* 文件名
*/
private String fileName;
/**
* 文件类型
*/
private String fileType;
/**
* 文件路径
*/
private String filePath;
/**
* 获取 附件ID
* @return id 附件ID
*/
public Integer getId() {
return id;
}
/**
* 设置 附件ID
* @param id 附件ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取 文件名
* @return fileName 文件名
*/
public String getFileName() {
return fileName;
}
/**
* 设置 文件名
* @param fileName 文件名
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
* 获取 文件类型
* @return fileType 文件类型
*/
public String getFileType() {
return fileType;
}
/**
* 设置 文件类型
* @param fileType 文件类型
*/
public void setFileType(String fileType) {
this.fileType = fileType;
}
/**
* 获取 文件路径
* @return filePath 文件路径
*/
public String getFilePath() {
return filePath;
}
/**
* 设置 文件路径
* @param filePath 文件路径
*/
public void setFilePath(String filePath) {
this.filePath = filePath;
}
}
| UTF-8 | Java | 1,661 | java | MH0201A05S01DTO.java | Java | [
{
"context": "nseDTO;\n\n/**\n * MH0201/A05 文章编辑数据获取: 附件\n * 设计者: 张坤祥\n * 更新日期: 2018/3/29\n */\npublic class MH0201A05S01D",
"end": 113,
"score": 0.9997764825820923,
"start": 110,
"tag": "NAME",
"value": "张坤祥"
}
] | null | [] | package org.ec.mh.dto.MH0201;
import org.ec.utils.dto.ResponseDTO;
/**
* MH0201/A05 文章编辑数据获取: 附件
* 设计者: 张坤祥
* 更新日期: 2018/3/29
*/
public class MH0201A05S01DTO extends ResponseDTO {
/**
* 附件ID
*/
private Integer id;
/**
* 文件名
*/
private String fileName;
/**
* 文件类型
*/
private String fileType;
/**
* 文件路径
*/
private String filePath;
/**
* 获取 附件ID
* @return id 附件ID
*/
public Integer getId() {
return id;
}
/**
* 设置 附件ID
* @param id 附件ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取 文件名
* @return fileName 文件名
*/
public String getFileName() {
return fileName;
}
/**
* 设置 文件名
* @param fileName 文件名
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
* 获取 文件类型
* @return fileType 文件类型
*/
public String getFileType() {
return fileType;
}
/**
* 设置 文件类型
* @param fileType 文件类型
*/
public void setFileType(String fileType) {
this.fileType = fileType;
}
/**
* 获取 文件路径
* @return filePath 文件路径
*/
public String getFilePath() {
return filePath;
}
/**
* 设置 文件路径
* @param filePath 文件路径
*/
public void setFilePath(String filePath) {
this.filePath = filePath;
}
}
| 1,661 | 0.502399 | 0.485264 | 96 | 14.197917 | 12.684981 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.145833 | false | false | 12 |
4396ccf52752324d52b0db7ecb3b0d529d8c7e2e | 19,756,849,600,365 | 1ac3ba48161c2881e588908ebe3e2d87526c0302 | /src/main/java/cf/zandercraft/zceggify/events/EventManager.java | 4acdbfc393286f8ba264ad7d1decebc6329544ac | [
"MIT"
] | permissive | Zandercraft/ZCEggify | https://github.com/Zandercraft/ZCEggify | 28b58daba65716c88f324f06db23c068ba2e60c4 | 999bc66bac0867c0f31fb42c33ef5db61b71ae97 | refs/heads/master | 2021-01-08T12:21:53.237000 | 2020-04-24T00:53:33 | 2020-04-24T00:53:33 | 242,025,644 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cf.zandercraft.zceggify.events;
import cf.zandercraft.zceggify.*;
import cf.zandercraft.zceggify.events.custom.CreatureCaptureEvent;
import cf.zandercraft.zceggify.events.custom.CreatureReleaseEvent;
import cf.zandercraft.zceggify.items.CaptureEgg;
import java.util.Random;
import cf.zandercraft.zceggify.items.UniqueProjectileData;
import cf.zandercraft.zceggify.managers.EconomyManager;
import org.bukkit.*;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.*;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
public class EventManager implements Listener {
public void initialize() {
register(this);
if (Settings.townyHook) {
register(new TownyCaptureEvents());
}
}
private void register(Listener listener) {
Main.plugin.getServer().getPluginManager().registerEvents(listener, Main.plugin);
}
private void callEvent(Event event) {
Main.plugin.getServer().getPluginManager().callEvent(event);
}
@EventHandler
public void assignMetaDataOnLaunch(ProjectileLaunchEvent event) {
//
// Give the projectile meta data concerning the material type that is being launched!
//
//1) If a player is shooting a projectile.
if (!event.isCancelled() && event.getEntity() != null && event.getEntity().getShooter() != null &&
event.getEntity().getShooter() instanceof Player) {
Projectile projectile = event.getEntity();
//3) If its the correct project type, attach required meta data to projectile.
if (projectile != null && projectile.getType().name().equalsIgnoreCase(Settings.projectileCatcherMaterial.name())) {
if (UniqueProjectileData.isEnabled()) {
int indexOfProjectile = ((Player) projectile.getShooter()).getInventory().first(Settings.projectileCatcherMaterial);
ItemStack shot = ((Player) projectile.getShooter()).getInventory().getItem(indexOfProjectile);
if (UniqueProjectileData.isProjectile(shot)) {
FixedMetadataValue state = new FixedMetadataValue(Main.plugin, projectile.getType().name());
event.getEntity().setMetadata("type", state);
}
} else {
FixedMetadataValue state = new FixedMetadataValue(Main.plugin, projectile.getType().name());
event.getEntity().setMetadata("type", state);
}
}
}
}
@EventHandler
public void onChickenSpawn(ProjectileHitEvent event) {
//1) Check whether the projectile is an egg
if (event.getEntity() instanceof Egg) {
//2) If it meets the criteria to capture
if (event.getEntity().hasMetadata("type") &&
event.getEntity().getMetadata("type").get(0).asString().equalsIgnoreCase(Settings.projectileCatcherMaterial.name()) &&
event.getHitEntity() != null) {
//3) Do nothing
return;
} else {
//4) Manually spawn the chick
Random random = new Random(System.currentTimeMillis());
if (random.nextInt(8) == 0) {
//5) Spawn a chicken
Chicken chicken = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken.setBaby();
if (random.nextInt(32) == 0) {
//6) Make it 4
Chicken chicken2 = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken2.setBaby();
Chicken chicken3 = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken3.setBaby();
Chicken chicken4 = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken4.setBaby();
}
}
}
}
}
@EventHandler
public void onVanillaChickenSpawn(CreatureSpawnEvent event) {
//1) Check whether we are spawning a chicken from an egg
if (event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.EGG && event.getEntityType() == EntityType.CHICKEN) {
//2) Automatically cancel the event so we can manually trigger it above
event.setCancelled(true);
}
}
@EventHandler
public void captureEvent(EntityDamageByEntityEvent event) {
Player player = null;
LivingEntity livingEntity = null;
//1) Check for all capture initial requirements.
if (event.getEntity() instanceof LivingEntity && !(event.getEntity() instanceof Player)) {
livingEntity = (LivingEntity) event.getEntity();
// Check item used requirements (projectile or melee).
if (event.getDamager() instanceof Projectile && event.getDamager().hasMetadata("type") &&
event.getDamager().getMetadata("type").get(0).asString().equalsIgnoreCase(Settings.projectileCatcherMaterial.name()) &&
((Projectile) event.getDamager()).getShooter() instanceof Player) {
player = (Player) ((Projectile) event.getDamager()).getShooter();
} else if (Settings.meleeCapture && event.getDamager() instanceof Player
&& ((Player) event.getDamager()).getInventory().getItemInMainHand() != null
&& ((Player) event.getDamager()).getInventory().getItemInMainHand().getType() == Settings.projectileCatcherMaterial) {
player = ((Player) event.getDamager());
}
}
if (player != null) {
boolean success = attemptCapture(player, livingEntity);
if (success) {
event.setDamage(0);
}
}
}
private boolean attemptCapture(Player catcher, LivingEntity target) {
if (!Main.permissionManager.hasPermissionToCapture(catcher, target)) {
catcher.sendMessage(Language.PREFIX + "You do not have permission to capture this creature.");
return false;
}
if (Settings.griefPreventionHook &&
Main.griefPrevention.claimsEnabledForWorld(target.getWorld()) &&
Main.griefPrevention.allowBuild(catcher, target.getLocation()) != null) {
catcher.sendMessage(Language.PREFIX + "You do not have permission to capture creatures here.");
return false;
}
//4) Check if this is a disabled world.
if (Settings.isDisabledWorld(catcher.getWorld().getName())) {
catcher.sendMessage(Language.PREFIX + "You cannot capture a creature in this world!");
return false;
}
//5) Check if they have enough money/items.
if (!catcher.hasPermission(Main.permissionManager.NoCost) && Settings.costMode != Settings.CostMode.NONE) {
if (!EconomyManager.chargePlayer(catcher)) {
catcher.sendMessage(Language.PREFIX + "You do not have enough " +
(Settings.costMode == Settings.CostMode.ITEM ?
Settings.costMaterial.name() :
"money (" + Settings.costVault + " required)."));
return false;
}
}
//6) Setup capture event and run it.
CreatureCaptureEvent creatureCaptureEvent = new CreatureCaptureEvent(catcher, target);
callEvent(creatureCaptureEvent);
if (!creatureCaptureEvent.isCancelled()) {
//8) Capture Logic
CaptureEgg.captureLivingEntity(creatureCaptureEvent.getTargetEntity());
target.remove();
return true;
}
return false;
}
@EventHandler
public void preventUseEggOnOtherEntity(PlayerInteractEntityEvent event) {
if (event.getPlayer().getInventory().getItemInMainHand() != null && event.getHand() == EquipmentSlot.HAND
&& NBTManager.isSpawnEgg(event.getPlayer().getInventory().getItemInMainHand())) {
event.setCancelled(true);
}
}
@EventHandler
public void useSpawnEgg(PlayerInteractEvent event) {
if (event.getPlayer().getInventory().getItemInMainHand() != null &&
event.getHand() == EquipmentSlot.HAND) {
if (NBTManager.isSpawnEgg(event.getPlayer().getInventory().getItemInMainHand())) {
if (Settings.isDisabledWorld(event.getPlayer().getWorld().getName())) {
event.getPlayer().sendMessage(Language.PREFIX + "You cannot release a creature in this world!");
return;
}
if (!event.isCancelled() && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Location target = event.getClickedBlock().getLocation().clone().add(0.5, 0, 0.5);
if (event.getBlockFace() != BlockFace.UP) {
// Make a friendly location to spawn the entity.
Vector direction = event.getPlayer().getLocation().toVector().subtract(target.toVector());
direction = direction.normalize();
target = target.add(direction.multiply(2));
}
CreatureReleaseEvent creatureReleaseEvent = new CreatureReleaseEvent(event.getPlayer(), target);
callEvent(creatureReleaseEvent);
if (!creatureReleaseEvent.isCancelled()) {
// Release Logic
// 1) Spawn creature at target location and cancel event.
LivingEntity spawnedEntity = CaptureEgg.useSpawnItem(event.getPlayer().getInventory().getItemInMainHand(), target);
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.YELLOW + Main.plugin.getName() + ": " + ChatColor.BLUE + spawnedEntity.getType().name() + " successfully spawned!");
// 2) Remove itemstack from user, or reduce amount by 1.
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
if (event.getPlayer().getInventory().getItemInMainHand().getAmount() <= 1) {
event.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.AIR));
} else {
int nextAmount = event.getPlayer().getInventory().getItemInMainHand().getAmount() - 1;
event.getPlayer().getInventory().getItemInMainHand().setAmount(nextAmount);
}
}
}
} else if (event.getAction() == Action.RIGHT_CLICK_AIR) {
//1) Let's prepare to throw the egg. Here we have the unit vector.
Vector direction = event.getPlayer().getLocation().getDirection().clone().normalize();
//2) Spawn item-drop.
ItemStack toThrow = event.getPlayer().getInventory().getItemInMainHand().clone();
toThrow.setAmount(1);
final Item item = event.getPlayer().getWorld().dropItem(
event.getPlayer().getLocation().clone().add(0, 1, 0),
toThrow);
//3) Prevent pickup, set direction, set velocity
item.setPickupDelay(Integer.MAX_VALUE);
item.getLocation().setDirection(direction);
item.setVelocity(direction.clone().multiply(1.5f));
Main.plugin.getServer().getScheduler().runTaskLater(Main.plugin, () -> {
if (!item.isDead()) {
Location fixedLocation = new Location(item.getLocation().getWorld(),
item.getLocation().getBlockX() + 0.5f,
item.getLocation().getBlockY() + 0.5f,
item.getLocation().getBlockZ() + 0.5f);
CaptureEgg.useSpawnItem(item.getItemStack(), fixedLocation);
item.remove();
}
}, 60);
// 4) Remove itemstack from user, or reduce amount by 1.
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
if (event.getPlayer().getInventory().getItemInMainHand().getAmount() <= 1) {
event.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.AIR));
} else {
int nextAmount = event.getPlayer().getInventory().getItemInMainHand().getAmount() - 1;
event.getPlayer().getInventory().getItemInMainHand().setAmount(nextAmount);
}
}
}
}
}
}
} | UTF-8 | Java | 13,839 | java | EventManager.java | Java | [] | null | [] | package cf.zandercraft.zceggify.events;
import cf.zandercraft.zceggify.*;
import cf.zandercraft.zceggify.events.custom.CreatureCaptureEvent;
import cf.zandercraft.zceggify.events.custom.CreatureReleaseEvent;
import cf.zandercraft.zceggify.items.CaptureEgg;
import java.util.Random;
import cf.zandercraft.zceggify.items.UniqueProjectileData;
import cf.zandercraft.zceggify.managers.EconomyManager;
import org.bukkit.*;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.*;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
public class EventManager implements Listener {
public void initialize() {
register(this);
if (Settings.townyHook) {
register(new TownyCaptureEvents());
}
}
private void register(Listener listener) {
Main.plugin.getServer().getPluginManager().registerEvents(listener, Main.plugin);
}
private void callEvent(Event event) {
Main.plugin.getServer().getPluginManager().callEvent(event);
}
@EventHandler
public void assignMetaDataOnLaunch(ProjectileLaunchEvent event) {
//
// Give the projectile meta data concerning the material type that is being launched!
//
//1) If a player is shooting a projectile.
if (!event.isCancelled() && event.getEntity() != null && event.getEntity().getShooter() != null &&
event.getEntity().getShooter() instanceof Player) {
Projectile projectile = event.getEntity();
//3) If its the correct project type, attach required meta data to projectile.
if (projectile != null && projectile.getType().name().equalsIgnoreCase(Settings.projectileCatcherMaterial.name())) {
if (UniqueProjectileData.isEnabled()) {
int indexOfProjectile = ((Player) projectile.getShooter()).getInventory().first(Settings.projectileCatcherMaterial);
ItemStack shot = ((Player) projectile.getShooter()).getInventory().getItem(indexOfProjectile);
if (UniqueProjectileData.isProjectile(shot)) {
FixedMetadataValue state = new FixedMetadataValue(Main.plugin, projectile.getType().name());
event.getEntity().setMetadata("type", state);
}
} else {
FixedMetadataValue state = new FixedMetadataValue(Main.plugin, projectile.getType().name());
event.getEntity().setMetadata("type", state);
}
}
}
}
@EventHandler
public void onChickenSpawn(ProjectileHitEvent event) {
//1) Check whether the projectile is an egg
if (event.getEntity() instanceof Egg) {
//2) If it meets the criteria to capture
if (event.getEntity().hasMetadata("type") &&
event.getEntity().getMetadata("type").get(0).asString().equalsIgnoreCase(Settings.projectileCatcherMaterial.name()) &&
event.getHitEntity() != null) {
//3) Do nothing
return;
} else {
//4) Manually spawn the chick
Random random = new Random(System.currentTimeMillis());
if (random.nextInt(8) == 0) {
//5) Spawn a chicken
Chicken chicken = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken.setBaby();
if (random.nextInt(32) == 0) {
//6) Make it 4
Chicken chicken2 = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken2.setBaby();
Chicken chicken3 = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken3.setBaby();
Chicken chicken4 = (Chicken) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.CHICKEN);
chicken4.setBaby();
}
}
}
}
}
@EventHandler
public void onVanillaChickenSpawn(CreatureSpawnEvent event) {
//1) Check whether we are spawning a chicken from an egg
if (event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.EGG && event.getEntityType() == EntityType.CHICKEN) {
//2) Automatically cancel the event so we can manually trigger it above
event.setCancelled(true);
}
}
@EventHandler
public void captureEvent(EntityDamageByEntityEvent event) {
Player player = null;
LivingEntity livingEntity = null;
//1) Check for all capture initial requirements.
if (event.getEntity() instanceof LivingEntity && !(event.getEntity() instanceof Player)) {
livingEntity = (LivingEntity) event.getEntity();
// Check item used requirements (projectile or melee).
if (event.getDamager() instanceof Projectile && event.getDamager().hasMetadata("type") &&
event.getDamager().getMetadata("type").get(0).asString().equalsIgnoreCase(Settings.projectileCatcherMaterial.name()) &&
((Projectile) event.getDamager()).getShooter() instanceof Player) {
player = (Player) ((Projectile) event.getDamager()).getShooter();
} else if (Settings.meleeCapture && event.getDamager() instanceof Player
&& ((Player) event.getDamager()).getInventory().getItemInMainHand() != null
&& ((Player) event.getDamager()).getInventory().getItemInMainHand().getType() == Settings.projectileCatcherMaterial) {
player = ((Player) event.getDamager());
}
}
if (player != null) {
boolean success = attemptCapture(player, livingEntity);
if (success) {
event.setDamage(0);
}
}
}
private boolean attemptCapture(Player catcher, LivingEntity target) {
if (!Main.permissionManager.hasPermissionToCapture(catcher, target)) {
catcher.sendMessage(Language.PREFIX + "You do not have permission to capture this creature.");
return false;
}
if (Settings.griefPreventionHook &&
Main.griefPrevention.claimsEnabledForWorld(target.getWorld()) &&
Main.griefPrevention.allowBuild(catcher, target.getLocation()) != null) {
catcher.sendMessage(Language.PREFIX + "You do not have permission to capture creatures here.");
return false;
}
//4) Check if this is a disabled world.
if (Settings.isDisabledWorld(catcher.getWorld().getName())) {
catcher.sendMessage(Language.PREFIX + "You cannot capture a creature in this world!");
return false;
}
//5) Check if they have enough money/items.
if (!catcher.hasPermission(Main.permissionManager.NoCost) && Settings.costMode != Settings.CostMode.NONE) {
if (!EconomyManager.chargePlayer(catcher)) {
catcher.sendMessage(Language.PREFIX + "You do not have enough " +
(Settings.costMode == Settings.CostMode.ITEM ?
Settings.costMaterial.name() :
"money (" + Settings.costVault + " required)."));
return false;
}
}
//6) Setup capture event and run it.
CreatureCaptureEvent creatureCaptureEvent = new CreatureCaptureEvent(catcher, target);
callEvent(creatureCaptureEvent);
if (!creatureCaptureEvent.isCancelled()) {
//8) Capture Logic
CaptureEgg.captureLivingEntity(creatureCaptureEvent.getTargetEntity());
target.remove();
return true;
}
return false;
}
@EventHandler
public void preventUseEggOnOtherEntity(PlayerInteractEntityEvent event) {
if (event.getPlayer().getInventory().getItemInMainHand() != null && event.getHand() == EquipmentSlot.HAND
&& NBTManager.isSpawnEgg(event.getPlayer().getInventory().getItemInMainHand())) {
event.setCancelled(true);
}
}
@EventHandler
public void useSpawnEgg(PlayerInteractEvent event) {
if (event.getPlayer().getInventory().getItemInMainHand() != null &&
event.getHand() == EquipmentSlot.HAND) {
if (NBTManager.isSpawnEgg(event.getPlayer().getInventory().getItemInMainHand())) {
if (Settings.isDisabledWorld(event.getPlayer().getWorld().getName())) {
event.getPlayer().sendMessage(Language.PREFIX + "You cannot release a creature in this world!");
return;
}
if (!event.isCancelled() && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Location target = event.getClickedBlock().getLocation().clone().add(0.5, 0, 0.5);
if (event.getBlockFace() != BlockFace.UP) {
// Make a friendly location to spawn the entity.
Vector direction = event.getPlayer().getLocation().toVector().subtract(target.toVector());
direction = direction.normalize();
target = target.add(direction.multiply(2));
}
CreatureReleaseEvent creatureReleaseEvent = new CreatureReleaseEvent(event.getPlayer(), target);
callEvent(creatureReleaseEvent);
if (!creatureReleaseEvent.isCancelled()) {
// Release Logic
// 1) Spawn creature at target location and cancel event.
LivingEntity spawnedEntity = CaptureEgg.useSpawnItem(event.getPlayer().getInventory().getItemInMainHand(), target);
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.YELLOW + Main.plugin.getName() + ": " + ChatColor.BLUE + spawnedEntity.getType().name() + " successfully spawned!");
// 2) Remove itemstack from user, or reduce amount by 1.
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
if (event.getPlayer().getInventory().getItemInMainHand().getAmount() <= 1) {
event.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.AIR));
} else {
int nextAmount = event.getPlayer().getInventory().getItemInMainHand().getAmount() - 1;
event.getPlayer().getInventory().getItemInMainHand().setAmount(nextAmount);
}
}
}
} else if (event.getAction() == Action.RIGHT_CLICK_AIR) {
//1) Let's prepare to throw the egg. Here we have the unit vector.
Vector direction = event.getPlayer().getLocation().getDirection().clone().normalize();
//2) Spawn item-drop.
ItemStack toThrow = event.getPlayer().getInventory().getItemInMainHand().clone();
toThrow.setAmount(1);
final Item item = event.getPlayer().getWorld().dropItem(
event.getPlayer().getLocation().clone().add(0, 1, 0),
toThrow);
//3) Prevent pickup, set direction, set velocity
item.setPickupDelay(Integer.MAX_VALUE);
item.getLocation().setDirection(direction);
item.setVelocity(direction.clone().multiply(1.5f));
Main.plugin.getServer().getScheduler().runTaskLater(Main.plugin, () -> {
if (!item.isDead()) {
Location fixedLocation = new Location(item.getLocation().getWorld(),
item.getLocation().getBlockX() + 0.5f,
item.getLocation().getBlockY() + 0.5f,
item.getLocation().getBlockZ() + 0.5f);
CaptureEgg.useSpawnItem(item.getItemStack(), fixedLocation);
item.remove();
}
}, 60);
// 4) Remove itemstack from user, or reduce amount by 1.
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
if (event.getPlayer().getInventory().getItemInMainHand().getAmount() <= 1) {
event.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.AIR));
} else {
int nextAmount = event.getPlayer().getInventory().getItemInMainHand().getAmount() - 1;
event.getPlayer().getInventory().getItemInMainHand().setAmount(nextAmount);
}
}
}
}
}
}
} | 13,839 | 0.584002 | 0.579522 | 276 | 49.144928 | 38.88464 | 180 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.467391 | false | false | 12 |
fd35548e4df0e064bbe960cfa5f130b6573c1700 | 28,149,215,695,959 | 047672755b08ab0dcf90d29ac24c1d9d40c23774 | /app/src/main/java/net/cloudcentrik/wordplus/Answer.java | ce343e21182f591e86a38697979980e5c25d30c8 | [] | no_license | ismailfakir/Vocabuilder | https://github.com/ismailfakir/Vocabuilder | 429cd6df956b84e192f2986130f578e6d2e6e5a0 | 0e1c96a79ba09595e4d23aa992246428a4806cc8 | refs/heads/master | 2021-01-10T09:48:54.865000 | 2017-09-03T13:04:35 | 2017-09-03T13:04:35 | 48,715,833 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.cloudcentrik.wordplus;
/**
* Created by ismail on 13/01/17.
*/
import android.os.Parcel;
import android.os.Parcelable;
public class Answer implements Parcelable{
private int id;
private String question;
private String correctAnswer;
private String userAnswer;
private String result;
public Answer(){
}
public Answer(int id, String question, String correctAnswer, String userAnswer, String result) {
this.id = id;
this.question = question;
this.correctAnswer = correctAnswer;
this.userAnswer = userAnswer;
this.result = result;
}
public static Creator<Answer> getCREATOR() {
return CREATOR;
}
public String getUserAnswer() {
return userAnswer;
}
public void setUserAnswer(String userAnswer) {
this.userAnswer = userAnswer;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getCorrectAnswer() {
return correctAnswer;
}
public void setCorrectAnswer(String correctAnswer) {
this.correctAnswer = correctAnswer;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
@Override
public String toString() {
return "Answer{" +
"id=" + id +
", question='" + question + '\'' +
", correctAnswer='" + correctAnswer + '\'' +
", userAnswer='" + userAnswer + '\'' +
", result='" + result + '\'' +
'}';
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.id);
dest.writeString(this.question);
dest.writeString(this.correctAnswer);
dest.writeString(this.userAnswer);
dest.writeString(this.result);
}
protected Answer(Parcel in) {
this.id = in.readInt();
this.question = in.readString();
this.correctAnswer = in.readString();
this.userAnswer=in.readString();
this.result = in.readString();
}
public static final Creator<Answer> CREATOR = new Creator<Answer>() {
@Override
public Answer createFromParcel(Parcel source) {
return new Answer(source);
}
@Override
public Answer[] newArray(int size) {
return new Answer[size];
}
};
}
| UTF-8 | Java | 2,719 | java | Answer.java | Java | [
{
"context": "kage net.cloudcentrik.wordplus;\n\n/**\n * Created by ismail on 13/01/17.\n */\n\nimport android.os.Parcel;\nimpor",
"end": 60,
"score": 0.9995721578598022,
"start": 54,
"tag": "USERNAME",
"value": "ismail"
}
] | null | [] | package net.cloudcentrik.wordplus;
/**
* Created by ismail on 13/01/17.
*/
import android.os.Parcel;
import android.os.Parcelable;
public class Answer implements Parcelable{
private int id;
private String question;
private String correctAnswer;
private String userAnswer;
private String result;
public Answer(){
}
public Answer(int id, String question, String correctAnswer, String userAnswer, String result) {
this.id = id;
this.question = question;
this.correctAnswer = correctAnswer;
this.userAnswer = userAnswer;
this.result = result;
}
public static Creator<Answer> getCREATOR() {
return CREATOR;
}
public String getUserAnswer() {
return userAnswer;
}
public void setUserAnswer(String userAnswer) {
this.userAnswer = userAnswer;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getCorrectAnswer() {
return correctAnswer;
}
public void setCorrectAnswer(String correctAnswer) {
this.correctAnswer = correctAnswer;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
@Override
public String toString() {
return "Answer{" +
"id=" + id +
", question='" + question + '\'' +
", correctAnswer='" + correctAnswer + '\'' +
", userAnswer='" + userAnswer + '\'' +
", result='" + result + '\'' +
'}';
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.id);
dest.writeString(this.question);
dest.writeString(this.correctAnswer);
dest.writeString(this.userAnswer);
dest.writeString(this.result);
}
protected Answer(Parcel in) {
this.id = in.readInt();
this.question = in.readString();
this.correctAnswer = in.readString();
this.userAnswer=in.readString();
this.result = in.readString();
}
public static final Creator<Answer> CREATOR = new Creator<Answer>() {
@Override
public Answer createFromParcel(Parcel source) {
return new Answer(source);
}
@Override
public Answer[] newArray(int size) {
return new Answer[size];
}
};
}
| 2,719 | 0.578889 | 0.576315 | 119 | 21.84874 | 19.502914 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.403361 | false | false | 12 |
b39f952cb67530fb8007fd4b6eb8a77e11ad40d9 | 28,037,546,544,977 | 3f8b97b3fe034ca62f8cf4f615ad636b94c3768f | /src/com/LeetCode/reverseInt.java | 9f52c40f362f757df2822be47c2f99e45e2e195e | [] | no_license | bsextion/CodingPractice_Java | https://github.com/bsextion/CodingPractice_Java | 2aa97a3138d1dc44d52baa0f6f35b407944471a4 | 5679e03d0526a8030fa64293bd2bf5a4d8187996 | refs/heads/master | 2023-08-31T23:50:33.355000 | 2021-09-28T20:19:10 | 2021-09-28T20:19:10 | 411,427,878 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.LeetCode;
import java.util.LinkedList;
import java.util.Queue;
public class reverseInt {
public static int reverse(int x) {
boolean isPositive = x >= 0 ? true : false;
Queue<Integer> queue = new LinkedList<>();
int result = 0;
if (!isPositive){
x *= -1;
}
while (x > 0){
int rem = x % 10;
x = (x/10) ;
result = (result * 10) + rem;
}
if (!isPositive){
x *= -1;
}
return result;
}
public static void main(String[] args) {
reverse(28);
}
}
| UTF-8 | Java | 623 | java | reverseInt.java | Java | [] | null | [] | package com.LeetCode;
import java.util.LinkedList;
import java.util.Queue;
public class reverseInt {
public static int reverse(int x) {
boolean isPositive = x >= 0 ? true : false;
Queue<Integer> queue = new LinkedList<>();
int result = 0;
if (!isPositive){
x *= -1;
}
while (x > 0){
int rem = x % 10;
x = (x/10) ;
result = (result * 10) + rem;
}
if (!isPositive){
x *= -1;
}
return result;
}
public static void main(String[] args) {
reverse(28);
}
}
| 623 | 0.4687 | 0.447833 | 34 | 17.32353 | 15.334929 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382353 | false | false | 12 |
efe4ecc7fe813a27ba51181b2b24f54ead35d2f5 | 9,174,050,181,659 | f65f50632b47f3e32a09d998b79868bdc0860898 | /netty/src/main/java/zty/practise/netty/util/HttpTemplate.java | 237d7275d7deeddbfd0ad7b4bf264dfe2f600912 | [] | no_license | zhangtianyi123/netty | https://github.com/zhangtianyi123/netty | 56bcbe73aba24b5ca8df1b881f0716440bfced4e | 04a7428343a8954ae263e165f58a71e3fb46cc16 | refs/heads/master | 2020-07-06T18:37:42.172000 | 2019-08-30T08:50:24 | 2019-08-30T08:50:24 | 203,106,808 | 0 | 0 | null | false | 2019-11-02T17:02:47 | 2019-08-19T05:51:46 | 2019-08-30T08:50:49 | 2019-11-02T17:02:46 | 9 | 0 | 0 | 1 | Java | false | false | package zty.practise.netty.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service("httpTemplate")
public class HttpTemplate {
@Autowired
private RestTemplate restTemplate;
public void sendMessageToServer() {
// restTemplate.getForEntity("http://127.0.0.1:9201", String.class);
}
}
| UTF-8 | Java | 415 | java | HttpTemplate.java | Java | [
{
"context": "oServer() {\n//\t\trestTemplate.getForEntity(\"http://127.0.0.1:9201\", String.class);\n\t}\n\t\n}\n",
"end": 385,
"score": 0.9974147081375122,
"start": 376,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
] | null | [] | package zty.practise.netty.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service("httpTemplate")
public class HttpTemplate {
@Autowired
private RestTemplate restTemplate;
public void sendMessageToServer() {
// restTemplate.getForEntity("http://127.0.0.1:9201", String.class);
}
}
| 415 | 0.790361 | 0.766265 | 17 | 23.411764 | 22.98608 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.882353 | false | false | 12 |
33bc9f45ad54492f0eeb827d2ef36e7751092ec7 | 15,393,162,822,913 | 8c66ea1939a00af94bb76826fc8d472978704432 | /app/src/main/java/io/wyntr/peepster/models/Users.java | 7467ce74d8a31f0eb50c40fa8c18a183c3cdf04b | [
"MIT"
] | permissive | sagaratalatti/WyntrIsComing-master | https://github.com/sagaratalatti/WyntrIsComing-master | e579e3831fde63d3b7a274ac048f301438f6e8ec | 80e4344291a55a38945672f716a95ba0d985ef53 | refs/heads/master | 2021-01-22T19:22:25.477000 | 2017-03-20T09:32:15 | 2017-03-20T09:32:15 | 85,194,015 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.wyntr.peepster.models;
public class Users {
private String full_name;
private String profile_picture;
private String uid;
public Users() {
}
public Users(String full_name, String profile_picture, String uid) {
this.full_name = full_name;
this.profile_picture = profile_picture;
this.uid = uid;
}
public String getUid() {
return uid;
}
public String getFull_name() {
return full_name;
}
public String getProfile_picture() {
return profile_picture;
}
}
| UTF-8 | Java | 573 | java | Users.java | Java | [] | null | [] | package io.wyntr.peepster.models;
public class Users {
private String full_name;
private String profile_picture;
private String uid;
public Users() {
}
public Users(String full_name, String profile_picture, String uid) {
this.full_name = full_name;
this.profile_picture = profile_picture;
this.uid = uid;
}
public String getUid() {
return uid;
}
public String getFull_name() {
return full_name;
}
public String getProfile_picture() {
return profile_picture;
}
}
| 573 | 0.60733 | 0.60733 | 33 | 16.363636 | 17.759024 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 12 |
1306b9262a8bac7c40f85d953a676d50d19e0c14 | 16,904,991,310,460 | 50dd465f260b1d4b5b7a9aeb1f5a349e302daee5 | /jautomata/src/main/java/net/jhoogland/jautomata/operations/EpsilonRemoval.java | e9425d0ae954cfeb278ccc8e8f3ae1f0d2aef466 | [
"Apache-2.0"
] | permissive | Software-Hardware-Codesign/jautomata | https://github.com/Software-Hardware-Codesign/jautomata | 64c6db821a4d458116c5f4afb05ed2452ffea03a | e1d734fecfffdd8fccf5c6a8de11771bd51604d4 | refs/heads/master | 2023-08-28T18:38:58.075000 | 2017-07-18T04:49:33 | 2017-07-18T04:49:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.jhoogland.jautomata.operations;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import net.jhoogland.jautomata.Automaton;
import net.jhoogland.jautomata.SingleSourceShortestDistancesInterface;
import net.jhoogland.jautomata.semirings.Semiring;
/**
* <p>
* This is an implementation of the on-the-fly epsilon removal algorithm described in [1].
* The result of determinization is an automaton without null-transitions that is equivalent to its operand.
* </p>
* <p>
* [1] M. Mohri, Generic Epsilon-Removal Algorithm for Weighted Automata. 2000.
* </p>
*
* @author Jasper Hoogland
*
* @param <L>
* label type
*
* @param <K>
* the type over which the semiring is defined.
* (Boolean for regular automata and Double for weighted automata)
*/
public class EpsilonRemoval<L, K> extends UnaryOperation<L, L, K, K>
{
Map<Object, K> finalWeights;
Map<Object, Collection<Object>> transitionsOut;
Map<EpsilonRemovalTransition, K> transitionsWeights;
SingleSourceShortestDistancesInterface<K> shortestDistanceAlgorithm;
public EpsilonRemoval(Automaton<L, K> operand, SingleSourceShortestDistancesInterface<K> shortestDistanceAlgorithm)
{
super(operand, operand.semiring());
finalWeights = new HashMap<Object, K>();
transitionsOut = new HashMap<Object, Collection<Object>>();
transitionsWeights = new HashMap<EpsilonRemovalTransition, K>();
this.shortestDistanceAlgorithm = shortestDistanceAlgorithm;
}
public Collection<Object> transitionsOut(Object state)
{
if (! transitionsOut.containsKey(state)) computeProperties(state);
return this.transitionsOut.get(state);
}
public K finalWeight(Object state)
{
if (! transitionsOut.containsKey(state)) computeProperties(state);
return this.finalWeights.get(state);
}
public K transitionWeight(Object transition)
{
Object previousState = from(transition);
if (! transitionsOut.containsKey(previousState)) computeProperties(previousState);
return transitionsWeights.get(transition);
}
void computeProperties(Object state)
{
EpsilonAutomaton epsilonAutomaton = new EpsilonAutomaton(operand);
Map<Object, K> shortestDistances = shortestDistanceAlgorithm.computeShortestDistances(epsilonAutomaton, state);
Semiring<K> sr = semiring();
K finalWeight = sr.zero();
Collection<Object> transitionsOut = new ArrayList<Object>();
for (Entry<Object, K> e : shortestDistances.entrySet())
{
Object q = e.getKey();
finalWeight = sr.add(finalWeight, sr.multiply(e.getValue(), operand.finalWeight(q)));
for (Object t : operand.transitionsOut(q)) if (operand.label(t) != null)
{
EpsilonRemovalTransition transition = new EpsilonRemovalTransition(t, state);
transitionsOut.add(transition);
transitionsWeights.put(transition, sr.multiply(e.getValue(), operand.transitionWeight(t)));
}
}
this.transitionsOut.put(state, transitionsOut);
this.finalWeights.put(state, finalWeight);
}
public K initialWeight(Object state)
{
return operand.initialWeight(state);
}
public Object from(Object transition)
{
return ((EpsilonRemovalTransition) transition).previousState;
}
public Object to(Object transition)
{
return operand.to(((EpsilonRemovalTransition) transition).operandTransition);
}
public L label(Object transition)
{
return operand.label(((EpsilonRemovalTransition) transition).operandTransition);
}
@Override
public Comparator<Object> topologicalOrder()
{
return operand.topologicalOrder();
}
public class EpsilonAutomaton extends UnaryOperation<L, L, K, K>
{
public EpsilonAutomaton(Automaton<L, K> operand)
{
super(operand, operand.semiring());
}
@Override
public Collection<Object> transitionsOut(Object state)
{
Collection<Object> transitionsOut = new ArrayList<Object>();
for (Object t : operand.transitionsOut(state))
if (operand.label(t) == null)
transitionsOut.add(t);
return transitionsOut;
}
// @Override
// public Collection<Object> transitionsOut(Object state, L label)
// {
// if (label == null) return transitionsOut(state);
// else return Collections.emptyList();
// }
//
// @Override
// public Collection<L> labelsOut(Object state)
// {
// for (L label : operand.labelsOut(state))
// if (label == null) return Arrays.asList(null);
// return Collections.emptyList();
// }
public K initialWeight(Object state)
{
return operand.initialWeight(state);
}
public K finalWeight(Object state)
{
return operand.finalWeight(state);
}
public L label(Object transition)
{
return operand.label(transition);
}
public K transitionWeight(Object transition)
{
return operand.transitionWeight(transition);
}
}
public class EpsilonRemovalTransition
{
public Object operandTransition;
public Object previousState;
public EpsilonRemovalTransition(Object operandTransition, Object previousState)
{
this.operandTransition = operandTransition;
this.previousState = previousState;
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof EpsilonRemoval.EpsilonRemovalTransition)
{
@SuppressWarnings("rawtypes")
EpsilonRemovalTransition other = (EpsilonRemovalTransition) obj;
return (this.previousState == null ? other.previousState == null : this.previousState.equals(other.previousState))
&& (this.operandTransition == null ? other.operandTransition == null : this.operandTransition.equals(other.operandTransition));
}
else return false;
}
@Override
public int hashCode()
{
return super.hashCode() * (previousState == null ? 1 : previousState.hashCode());
}
@Override
public String toString()
{
return "EpsilonRemovalTransition(" + operandTransition + ", " + previousState + ")";
}
}
}
| UTF-8 | Java | 5,955 | java | EpsilonRemoval.java | Java | [
{
"context": "quivalent to its operand.\n * </p> \n * <p>\n * [1] M. Mohri, Generic Epsilon-Removal Algorithm for Weighted A",
"end": 617,
"score": 0.9997143745422363,
"start": 609,
"tag": "NAME",
"value": "M. Mohri"
},
{
"context": "or Weighted Automata. 2000.\n * </p>\n * \n * @author Jasper Hoogland\n *\n * @param <L>\n * label type\n * \n * @param <K>\n",
"end": 720,
"score": 0.9998764395713806,
"start": 705,
"tag": "NAME",
"value": "Jasper Hoogland"
}
] | null | [] | package net.jhoogland.jautomata.operations;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import net.jhoogland.jautomata.Automaton;
import net.jhoogland.jautomata.SingleSourceShortestDistancesInterface;
import net.jhoogland.jautomata.semirings.Semiring;
/**
* <p>
* This is an implementation of the on-the-fly epsilon removal algorithm described in [1].
* The result of determinization is an automaton without null-transitions that is equivalent to its operand.
* </p>
* <p>
* [1] <NAME>, Generic Epsilon-Removal Algorithm for Weighted Automata. 2000.
* </p>
*
* @author <NAME>
*
* @param <L>
* label type
*
* @param <K>
* the type over which the semiring is defined.
* (Boolean for regular automata and Double for weighted automata)
*/
public class EpsilonRemoval<L, K> extends UnaryOperation<L, L, K, K>
{
Map<Object, K> finalWeights;
Map<Object, Collection<Object>> transitionsOut;
Map<EpsilonRemovalTransition, K> transitionsWeights;
SingleSourceShortestDistancesInterface<K> shortestDistanceAlgorithm;
public EpsilonRemoval(Automaton<L, K> operand, SingleSourceShortestDistancesInterface<K> shortestDistanceAlgorithm)
{
super(operand, operand.semiring());
finalWeights = new HashMap<Object, K>();
transitionsOut = new HashMap<Object, Collection<Object>>();
transitionsWeights = new HashMap<EpsilonRemovalTransition, K>();
this.shortestDistanceAlgorithm = shortestDistanceAlgorithm;
}
public Collection<Object> transitionsOut(Object state)
{
if (! transitionsOut.containsKey(state)) computeProperties(state);
return this.transitionsOut.get(state);
}
public K finalWeight(Object state)
{
if (! transitionsOut.containsKey(state)) computeProperties(state);
return this.finalWeights.get(state);
}
public K transitionWeight(Object transition)
{
Object previousState = from(transition);
if (! transitionsOut.containsKey(previousState)) computeProperties(previousState);
return transitionsWeights.get(transition);
}
void computeProperties(Object state)
{
EpsilonAutomaton epsilonAutomaton = new EpsilonAutomaton(operand);
Map<Object, K> shortestDistances = shortestDistanceAlgorithm.computeShortestDistances(epsilonAutomaton, state);
Semiring<K> sr = semiring();
K finalWeight = sr.zero();
Collection<Object> transitionsOut = new ArrayList<Object>();
for (Entry<Object, K> e : shortestDistances.entrySet())
{
Object q = e.getKey();
finalWeight = sr.add(finalWeight, sr.multiply(e.getValue(), operand.finalWeight(q)));
for (Object t : operand.transitionsOut(q)) if (operand.label(t) != null)
{
EpsilonRemovalTransition transition = new EpsilonRemovalTransition(t, state);
transitionsOut.add(transition);
transitionsWeights.put(transition, sr.multiply(e.getValue(), operand.transitionWeight(t)));
}
}
this.transitionsOut.put(state, transitionsOut);
this.finalWeights.put(state, finalWeight);
}
public K initialWeight(Object state)
{
return operand.initialWeight(state);
}
public Object from(Object transition)
{
return ((EpsilonRemovalTransition) transition).previousState;
}
public Object to(Object transition)
{
return operand.to(((EpsilonRemovalTransition) transition).operandTransition);
}
public L label(Object transition)
{
return operand.label(((EpsilonRemovalTransition) transition).operandTransition);
}
@Override
public Comparator<Object> topologicalOrder()
{
return operand.topologicalOrder();
}
public class EpsilonAutomaton extends UnaryOperation<L, L, K, K>
{
public EpsilonAutomaton(Automaton<L, K> operand)
{
super(operand, operand.semiring());
}
@Override
public Collection<Object> transitionsOut(Object state)
{
Collection<Object> transitionsOut = new ArrayList<Object>();
for (Object t : operand.transitionsOut(state))
if (operand.label(t) == null)
transitionsOut.add(t);
return transitionsOut;
}
// @Override
// public Collection<Object> transitionsOut(Object state, L label)
// {
// if (label == null) return transitionsOut(state);
// else return Collections.emptyList();
// }
//
// @Override
// public Collection<L> labelsOut(Object state)
// {
// for (L label : operand.labelsOut(state))
// if (label == null) return Arrays.asList(null);
// return Collections.emptyList();
// }
public K initialWeight(Object state)
{
return operand.initialWeight(state);
}
public K finalWeight(Object state)
{
return operand.finalWeight(state);
}
public L label(Object transition)
{
return operand.label(transition);
}
public K transitionWeight(Object transition)
{
return operand.transitionWeight(transition);
}
}
public class EpsilonRemovalTransition
{
public Object operandTransition;
public Object previousState;
public EpsilonRemovalTransition(Object operandTransition, Object previousState)
{
this.operandTransition = operandTransition;
this.previousState = previousState;
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof EpsilonRemoval.EpsilonRemovalTransition)
{
@SuppressWarnings("rawtypes")
EpsilonRemovalTransition other = (EpsilonRemovalTransition) obj;
return (this.previousState == null ? other.previousState == null : this.previousState.equals(other.previousState))
&& (this.operandTransition == null ? other.operandTransition == null : this.operandTransition.equals(other.operandTransition));
}
else return false;
}
@Override
public int hashCode()
{
return super.hashCode() * (previousState == null ? 1 : previousState.hashCode());
}
@Override
public String toString()
{
return "EpsilonRemovalTransition(" + operandTransition + ", " + previousState + ")";
}
}
}
| 5,944 | 0.727288 | 0.726112 | 209 | 27.492823 | 29.573381 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.210526 | false | false | 12 |
0fdb202299b05841a3ce27a94d049d33a4e82162 | 15,676,630,668,305 | 49321daa3126552118051bc7dd8bd5b7bccffb53 | /src/com/mypackage/assessment/MyClassWithLambda.java | 849e5ec1bf9c37039b9c43956359270b180b1917 | [] | no_license | sathyee/TopGearAssessment | https://github.com/sathyee/TopGearAssessment | 657545bbb69102f074c2cb2500a161fa6cd67a47 | d97be539ade75c58f91a7a06ac0dec6612b33369 | refs/heads/master | 2020-04-04T18:12:38.476000 | 2018-11-05T03:19:03 | 2018-11-05T03:19:03 | 156,154,375 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mypackage.assessment;
import com.mypackage.assessment.bean.WordCount;
public class MyClassWithLambda {
private static int totalCount = 0;
public int getCount() {
return totalCount;
}
public static void main(String[] args) {
System.out.println("MyClassWithLambda...");
WordCount wordCount = (int ct) -> totalCount += ct;
MyClassWithLambda myClass = new MyClassWithLambda();
wordCount.count(4);
wordCount.count(5);
wordCount.count(2);
wordCount.count(6);
wordCount.count(3);
System.out.println("totalCount : " + totalCount);
}
}
| UTF-8 | Java | 612 | java | MyClassWithLambda.java | Java | [] | null | [] | package com.mypackage.assessment;
import com.mypackage.assessment.bean.WordCount;
public class MyClassWithLambda {
private static int totalCount = 0;
public int getCount() {
return totalCount;
}
public static void main(String[] args) {
System.out.println("MyClassWithLambda...");
WordCount wordCount = (int ct) -> totalCount += ct;
MyClassWithLambda myClass = new MyClassWithLambda();
wordCount.count(4);
wordCount.count(5);
wordCount.count(2);
wordCount.count(6);
wordCount.count(3);
System.out.println("totalCount : " + totalCount);
}
}
| 612 | 0.671569 | 0.661765 | 28 | 19.857143 | 18.759216 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.714286 | false | false | 12 |
7520a83e70237c8297c0782982d50bf02abaa10d | 2,241,972,973,179 | 44e28c55f2ffef2b581a181e7f74ed2f2d66ad3e | /src/edu/nju/desserthouse/action/schedule/SubmitScheduleAction.java | 470963909b0884d071dc8e8883db4541d6f6e09c | [] | no_license | bobo15850/DessertHouse | https://github.com/bobo15850/DessertHouse | 1cff7e45f6f0246a08b413e2ad4b7cbd08e1afbd | 856f35721e494af4192085546c9cdecc72e11b46 | refs/heads/master | 2021-01-17T06:41:57.011000 | 2016-03-17T02:32:26 | 2016-03-17T02:32:26 | 50,285,924 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.nju.desserthouse.action.schedule;
import java.util.List;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import edu.nju.desserthouse.action.BaseAction;
import edu.nju.desserthouse.model.Schedule;
import edu.nju.desserthouse.service.ScheduleService;
import edu.nju.desserthouse.util.UserBase;
public class SubmitScheduleAction extends BaseAction {
private static final long serialVersionUID = 5079889182337131165L;
private Schedule schedule;
private int shopId;
private List<Integer> productIdList;
@Autowired
private ScheduleService scheduleService;
@Override
@Action(
value = "submitSchedule",
results = { @Result(
name = SUCCESS,
location = "/schedule/targetShopSchedule.action?shopId=${shopId}&scheduleState=0",
type = "redirect") })
public String execute() throws Exception {
UserBase userBase = (UserBase) session.get("userBase");
int operatorId = userBase.getId();
scheduleService.addSchedule(schedule, productIdList, shopId, operatorId);
return SUCCESS;
}
public int getShopId() {
return shopId;
}
public void setShopId(int shopId) {
this.shopId = shopId;
}
public Schedule getSchedule() {
return schedule;
}
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
}
public List<Integer> getProductIdList() {
return productIdList;
}
public void setProductIdList(List<Integer> productIdList) {
this.productIdList = productIdList;
}
}
| UTF-8 | Java | 1,568 | java | SubmitScheduleAction.java | Java | [] | null | [] | package edu.nju.desserthouse.action.schedule;
import java.util.List;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import edu.nju.desserthouse.action.BaseAction;
import edu.nju.desserthouse.model.Schedule;
import edu.nju.desserthouse.service.ScheduleService;
import edu.nju.desserthouse.util.UserBase;
public class SubmitScheduleAction extends BaseAction {
private static final long serialVersionUID = 5079889182337131165L;
private Schedule schedule;
private int shopId;
private List<Integer> productIdList;
@Autowired
private ScheduleService scheduleService;
@Override
@Action(
value = "submitSchedule",
results = { @Result(
name = SUCCESS,
location = "/schedule/targetShopSchedule.action?shopId=${shopId}&scheduleState=0",
type = "redirect") })
public String execute() throws Exception {
UserBase userBase = (UserBase) session.get("userBase");
int operatorId = userBase.getId();
scheduleService.addSchedule(schedule, productIdList, shopId, operatorId);
return SUCCESS;
}
public int getShopId() {
return shopId;
}
public void setShopId(int shopId) {
this.shopId = shopId;
}
public Schedule getSchedule() {
return schedule;
}
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
}
public List<Integer> getProductIdList() {
return productIdList;
}
public void setProductIdList(List<Integer> productIdList) {
this.productIdList = productIdList;
}
}
| 1,568 | 0.767857 | 0.753827 | 59 | 25.576271 | 22.733685 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.576271 | false | false | 12 |
bd951b8288a05a2b9189e608f77f2996e3395d5e | 5,299,989,689,250 | 32b85bbe99d19d0466daaa240592488f56e863f8 | /bianchengsixiang/src/main/java/com/type/wide/tongpeifu/Fruit.java | 184cfe0fc27fa45c6d4edd08e27ddb99d62cd8d5 | [] | no_license | yujunhuisir/bianchengsixiang | https://github.com/yujunhuisir/bianchengsixiang | ee09f0fc609edbac7bda8623e008cdb1ae50dd40 | dd970820a30080d8380a6455682bc0977d421438 | refs/heads/master | 2020-04-02T21:22:41.396000 | 2018-10-26T07:47:43 | 2018-10-26T07:47:43 | 154,796,947 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.type.wide.tongpeifu;
public class Fruit {
}
| UTF-8 | Java | 63 | java | Fruit.java | Java | [] | null | [] | package com.type.wide.tongpeifu;
public class Fruit {
}
| 63 | 0.68254 | 0.68254 | 5 | 10.6 | 13.139255 | 32 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 12 |
799db541b05cd41cfb44115816ef687e39670e55 | 22,084,721,876,222 | bc35522b264a502aa8142d9b8482119d952459aa | /app/src/main/java/me/kirimin/mitsumine/network/api/ApiAccessor.java | 3302a0f8a05712c3e8e7212e6f0adfb6e3f39425 | [
"Apache-2.0"
] | permissive | oqrusk/mitsumine | https://github.com/oqrusk/mitsumine | cf3a489e12919b5a3394a9a20c859cdc54ce81ce | 9dc95df738df49f4836b13d6ba6e2aa6d5c81476 | refs/heads/master | 2020-12-26T22:44:51.181000 | 2015-03-08T14:04:18 | 2015-03-08T14:04:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.kirimin.mitsumine.network.api;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.RequestFuture;
import com.android.volley.toolbox.StringRequest;
import org.json.JSONObject;
import org.scribe.builder.ServiceBuilder;
import org.scribe.model.OAuthRequest;
import org.scribe.model.Response;
import org.scribe.model.Token;
import org.scribe.oauth.OAuthService;
import java.util.concurrent.ExecutionException;
import me.kirimin.mitsumine.model.Account;
import me.kirimin.mitsumine.network.ApiRequestException;
import me.kirimin.mitsumine.network.api.oauth.Consumer;
import me.kirimin.mitsumine.network.api.oauth.HatenaOAuthProvider;
import rx.Observable;
import rx.Subscriber;
class ApiAccessor {
static Observable<JSONObject> request(final RequestQueue requestQueue, final String url) {
return Observable.create(new Observable.OnSubscribe<JSONObject>() {
@Override
public void call(Subscriber<? super JSONObject> subscriber) {
RequestFuture<JSONObject> future = RequestFuture.newFuture();
requestQueue.add(new JsonObjectRequest(url, null, future, future));
try {
JSONObject response = future.get();
subscriber.onNext(response);
subscriber.onCompleted();
} catch (InterruptedException | ExecutionException e) {
subscriber.onError(new ApiRequestException(e.getMessage()));
}
}
});
}
static Observable<String> stringRequest(final RequestQueue requestQueue, final String url) {
return Observable.create(new Observable.OnSubscribe<String>() {
@Override
public void call(final Subscriber<? super String> subscriber) {
RequestFuture<String> future = RequestFuture.newFuture();
requestQueue.add(new StringRequest(url, future, future));
try {
String response = future.get();
subscriber.onNext(response);
subscriber.onCompleted();
} catch (InterruptedException | ExecutionException e) {
subscriber.onError(new ApiRequestException(e.getMessage()));
}
}
});
}
static Response oAuthRequest(Account account, OAuthRequest request) {
OAuthService oAuthService = new ServiceBuilder()
.provider(HatenaOAuthProvider.class)
.apiKey(Consumer.K)
.apiSecret(Consumer.S)
.build();
Token accessToken = new Token(account.token, account.tokenSecret);
oAuthService.signRequest(accessToken, request);
return request.send();
}
} | UTF-8 | Java | 2,834 | java | ApiAccessor.java | Java | [] | null | [] | package me.kirimin.mitsumine.network.api;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.RequestFuture;
import com.android.volley.toolbox.StringRequest;
import org.json.JSONObject;
import org.scribe.builder.ServiceBuilder;
import org.scribe.model.OAuthRequest;
import org.scribe.model.Response;
import org.scribe.model.Token;
import org.scribe.oauth.OAuthService;
import java.util.concurrent.ExecutionException;
import me.kirimin.mitsumine.model.Account;
import me.kirimin.mitsumine.network.ApiRequestException;
import me.kirimin.mitsumine.network.api.oauth.Consumer;
import me.kirimin.mitsumine.network.api.oauth.HatenaOAuthProvider;
import rx.Observable;
import rx.Subscriber;
class ApiAccessor {
static Observable<JSONObject> request(final RequestQueue requestQueue, final String url) {
return Observable.create(new Observable.OnSubscribe<JSONObject>() {
@Override
public void call(Subscriber<? super JSONObject> subscriber) {
RequestFuture<JSONObject> future = RequestFuture.newFuture();
requestQueue.add(new JsonObjectRequest(url, null, future, future));
try {
JSONObject response = future.get();
subscriber.onNext(response);
subscriber.onCompleted();
} catch (InterruptedException | ExecutionException e) {
subscriber.onError(new ApiRequestException(e.getMessage()));
}
}
});
}
static Observable<String> stringRequest(final RequestQueue requestQueue, final String url) {
return Observable.create(new Observable.OnSubscribe<String>() {
@Override
public void call(final Subscriber<? super String> subscriber) {
RequestFuture<String> future = RequestFuture.newFuture();
requestQueue.add(new StringRequest(url, future, future));
try {
String response = future.get();
subscriber.onNext(response);
subscriber.onCompleted();
} catch (InterruptedException | ExecutionException e) {
subscriber.onError(new ApiRequestException(e.getMessage()));
}
}
});
}
static Response oAuthRequest(Account account, OAuthRequest request) {
OAuthService oAuthService = new ServiceBuilder()
.provider(HatenaOAuthProvider.class)
.apiKey(Consumer.K)
.apiSecret(Consumer.S)
.build();
Token accessToken = new Token(account.token, account.tokenSecret);
oAuthService.signRequest(accessToken, request);
return request.send();
}
} | 2,834 | 0.65314 | 0.65314 | 71 | 38.929577 | 27.311106 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.676056 | false | false | 12 |
44a9be3786564225bb6fdcfa945682a65599a93a | 30,176,440,263,425 | 87236f148473d63acf79bac5eff5fc3e6e5f4a14 | /src/Front/Registro/Registro2Pag.java | f6c45a8c21908738facc53f3efb0e6d201c09feb | [] | no_license | Matiarriete/Netflix | https://github.com/Matiarriete/Netflix | 832c46398e5747cdef8eb2878257d16581c16922 | bc7726afdd82cb06368851e71ac9a7d4296a2cc5 | refs/heads/master | 2021-04-18T14:45:44.618000 | 2020-03-23T22:12:48 | 2020-03-23T22:12:48 | 249,554,918 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Front.Registro;
import java.awt.BorderLayout;
import Back.ITipoPlanDAO;
import Back.TipoPlanDAO;
import Front.CambiarPanel;
import Front.InicioSesion.InicioSesion1;
import java.awt.event.MouseEvent;
import static Front.Netflix.panelPrincipal1;
public class Registro2Pag extends javax.swing.JPanel {
private MouseEvent evt;
public Registro2Pag() {
initComponents();
if (i == 1) {
panelBasicoMouseClicked(evt);
} else {
if (i == 2) {
panelEstandarMouseClicked(evt);
} else {
panelPremiumMouseClicked(evt);
}
}
}
public static int i = 1;
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel4 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jToolBar1 = new javax.swing.JToolBar();
jPanel5 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
panelBasico = new javax.swing.JPanel();
lblBasico = new javax.swing.JLabel();
panelEstandar = new javax.swing.JPanel();
lblEstandar = new javax.swing.JLabel();
panelPremium = new javax.swing.JPanel();
lblPremium = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
lblPrecio1 = new javax.swing.JLabel();
lblPrecio2 = new javax.swing.JLabel();
lblPrecio3 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
lblHDEstandar = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
lblHDPremium = new javax.swing.JLabel();
lblHDBasico = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
lblUHDBasico = new javax.swing.JLabel();
lblUHDEstandar = new javax.swing.JLabel();
lblUHDPremium = new javax.swing.JLabel();
jSeparator3 = new javax.swing.JSeparator();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
lblCantPantBasico = new javax.swing.JLabel();
lblCantPantEstandar = new javax.swing.JLabel();
lblCantPantPremium = new javax.swing.JLabel();
jSeparator4 = new javax.swing.JSeparator();
jLabel22 = new javax.swing.JLabel();
lblVistaBasico = new javax.swing.JLabel();
lblVistaEstandar = new javax.swing.JLabel();
lblVistaPremium = new javax.swing.JLabel();
jSeparator5 = new javax.swing.JSeparator();
jLabel26 = new javax.swing.JLabel();
lblPeliculasBasico = new javax.swing.JLabel();
lblPeliculasEstandar = new javax.swing.JLabel();
lblPeliculasPremium = new javax.swing.JLabel();
jSeparator6 = new javax.swing.JSeparator();
jLabel30 = new javax.swing.JLabel();
lblCancelaPremium = new javax.swing.JLabel();
lblCancelaEstandar = new javax.swing.JLabel();
lblCancelaBasico = new javax.swing.JLabel();
lblComent1 = new javax.swing.JLabel();
lblComent2 = new javax.swing.JLabel();
panelContinuar = new javax.swing.JPanel();
jLabel36 = new javax.swing.JLabel();
jLabel4.setFont(new java.awt.Font("SansSerif", 0, 11)); // NOI18N
jLabel4.setText("PASO 1 DE 3");
jLabel15.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
jToolBar1.setRollover(true);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 375, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 32, Short.MAX_VALUE)
);
setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Logo_Netflix_opt.png")); // NOI18N
jLabel1.setText("jLabel1");
jLabel2.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
jLabel2.setText("Iniciar Sesión");
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 618, Short.MAX_VALUE)
.addComponent(jLabel2)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE))
.addContainerGap(19, Short.MAX_VALUE))
);
jLabel5.setFont(new java.awt.Font("SansSerif", 0, 11)); // NOI18N
jLabel5.setText("PASO 1 DE 3");
jLabel3.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
jLabel3.setText("Selecciona el plan ideal para ti");
jLabel6.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel6.setText("Cambia a un plan inferior o superior en cualquier momento");
panelBasico.setBackground(new java.awt.Color(255, 0, 0));
panelBasico.setEnabled(false);
panelBasico.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelBasicoMouseClicked(evt);
}
});
lblBasico.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
lblBasico.setForeground(new java.awt.Color(255, 255, 255));
lblBasico.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblBasico.setText("Básico");
javax.swing.GroupLayout panelBasicoLayout = new javax.swing.GroupLayout(panelBasico);
panelBasico.setLayout(panelBasicoLayout);
panelBasicoLayout.setHorizontalGroup(
panelBasicoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblBasico, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
);
panelBasicoLayout.setVerticalGroup(
panelBasicoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblBasico, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
);
panelEstandar.setBackground(new java.awt.Color(255, 0, 0));
panelEstandar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelEstandarMouseClicked(evt);
}
});
lblEstandar.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
lblEstandar.setForeground(new java.awt.Color(255, 255, 255));
lblEstandar.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblEstandar.setText("Éstandar");
javax.swing.GroupLayout panelEstandarLayout = new javax.swing.GroupLayout(panelEstandar);
panelEstandar.setLayout(panelEstandarLayout);
panelEstandarLayout.setHorizontalGroup(
panelEstandarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblEstandar, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
);
panelEstandarLayout.setVerticalGroup(
panelEstandarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblEstandar, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
);
panelPremium.setBackground(new java.awt.Color(255, 0, 0));
panelPremium.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelPremiumMouseClicked(evt);
}
});
lblPremium.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
lblPremium.setForeground(new java.awt.Color(255, 255, 255));
lblPremium.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblPremium.setText("Premium");
javax.swing.GroupLayout panelPremiumLayout = new javax.swing.GroupLayout(panelPremium);
panelPremium.setLayout(panelPremiumLayout);
panelPremiumLayout.setHorizontalGroup(
panelPremiumLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPremium, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
);
panelPremiumLayout.setVerticalGroup(
panelPremiumLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPremium, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
);
jLabel10.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel10.setText("Precio mensual (sin impuestos)");
ITipoPlanDAO tPDAO = new TipoPlanDAO();
lblPrecio1.setText(tPDAO.conexionPrecio(1));
lblPrecio1.setForeground(new java.awt.Color(255, 0, 0));
lblPrecio1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblPrecio2.setText(tPDAO.conexionPrecio(2));
lblPrecio2.setForeground(new java.awt.Color(255, 0, 0));
lblPrecio2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblPrecio3.setText(tPDAO.conexionPrecio(3));
lblPrecio3.setForeground(new java.awt.Color(255, 0, 0));
lblPrecio3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel11.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel11.setText("HD Disponible");
lblHDEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblHDPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblHDBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
jLabel13.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel13.setText("Ultra HD Disponible");
lblUHDBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
lblUHDEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
lblUHDPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
jLabel17.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel17.setText("Pantallas en las que puedes ver al mismo");
jLabel18.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel18.setText("tiempo");
lblCantPantBasico.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
lblCantPantBasico.setForeground(new java.awt.Color(255, 0, 0));
lblCantPantBasico.setText("1");
lblCantPantEstandar.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
lblCantPantEstandar.setForeground(new java.awt.Color(255, 0, 0));
lblCantPantEstandar.setText("2");
lblCantPantPremium.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
lblCantPantPremium.setForeground(new java.awt.Color(255, 0, 0));
lblCantPantPremium.setText("4");
jLabel22.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel22.setText("Ve en tu laptop, TV, teléfono y tablet");
lblVistaBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblVistaEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblVistaPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
jLabel26.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel26.setText("Películas y programas ilimitados");
lblPeliculasBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblPeliculasEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblPeliculasPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
jLabel30.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel30.setText("Cancela en cualquier momento");
lblCancelaPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblCancelaEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblCancelaBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblComent1.setText("La disponibilidad del contenido HD y Ultra HD depende de tu proveedor de servicios de internet y del dispositivo en uso.");
lblComent2.setText("No todo el contenido está disponible en HD o en Ultra HD.");
panelContinuar.setBackground(new java.awt.Color(255, 0, 0));
panelContinuar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelContinuarMouseClicked(evt);
}
});
jLabel36.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel36.setForeground(new java.awt.Color(255, 255, 255));
jLabel36.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel36.setText("CONTINUAR");
javax.swing.GroupLayout panelContinuarLayout = new javax.swing.GroupLayout(panelContinuar);
panelContinuar.setLayout(panelContinuarLayout);
panelContinuarLayout.setHorizontalGroup(
panelContinuarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelContinuarLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel36, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
.addContainerGap())
);
panelContinuarLayout.setVerticalGroup(
panelContinuarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContinuarLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel36)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelContinuar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(308, 308, 308))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(91, 91, 91)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jLabel3)
.addComponent(jLabel5))))
.addGap(0, 10, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(70, 70, 70)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 738, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 738, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(187, 187, 187)
.addComponent(lblUHDBasico)
.addGap(131, 131, 131)
.addComponent(lblUHDEstandar)
.addGap(122, 122, 122)
.addComponent(lblUHDPremium))
.addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel18)
.addComponent(jLabel17))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 134, Short.MAX_VALUE)
.addComponent(lblCantPantBasico)
.addGap(134, 134, 134)
.addComponent(lblCantPantEstandar)
.addGap(138, 138, 138)
.addComponent(lblCantPantPremium)
.addGap(40, 40, 40))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(131, 131, 131)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(panelBasico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPrecio1, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(46, 46, 46)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPrecio2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(46, 46, 46)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(panelPremium, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblPrecio3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblHDBasico)
.addGap(125, 125, 125)
.addComponent(lblHDEstandar)
.addGap(114, 114, 114)
.addComponent(lblHDPremium)
.addGap(31, 31, 31)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel22)
.addGap(158, 158, 158)
.addComponent(lblVistaBasico)
.addGap(114, 114, 114)
.addComponent(lblVistaEstandar)
.addGap(117, 117, 117)
.addComponent(lblVistaPremium))
.addComponent(jSeparator4)
.addComponent(jSeparator5)
.addComponent(lblComent1, javax.swing.GroupLayout.DEFAULT_SIZE, 738, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel26)
.addComponent(jLabel30))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblPeliculasBasico)
.addGap(114, 114, 114)
.addComponent(lblPeliculasEstandar)
.addGap(118, 118, 118)
.addComponent(lblPeliculasPremium))
.addGroup(layout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(lblCancelaBasico)
.addGap(112, 112, 112)
.addComponent(lblCancelaEstandar)
.addGap(119, 119, 119)
.addComponent(lblCancelaPremium)))
.addGap(28, 28, 28)))
.addComponent(lblComent2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel6)
.addGap(17, 17, 17)
.addComponent(panelBasico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(panelEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelPremium, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblPrecio2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblPrecio3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(lblPrecio1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblHDEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblHDBasico)
.addComponent(lblHDPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel13)
.addComponent(lblUHDBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblUHDEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblUHDPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCantPantBasico)
.addComponent(lblCantPantEstandar)
.addComponent(lblCantPantPremium))
.addGap(17, 17, 17)))
.addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblVistaBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblVistaEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblVistaPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel22))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel26)
.addComponent(lblPeliculasBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPeliculasEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPeliculasPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel30)
.addGroup(layout.createSequentialGroup()
.addGap(2, 2, 2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblCancelaBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblCancelaEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblCancelaPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addComponent(lblComent1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblComent2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
.addComponent(panelContinuar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32))
);
}// </editor-fold>//GEN-END:initComponents
private void panelBasicoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelBasicoMouseClicked
panelBasico.setBackground(new java.awt.Color(255, 0, 0));
lblCancelaBasico.setEnabled(true);
lblCancelaEstandar.setEnabled(false);
lblCancelaPremium.setEnabled(false);
lblCantPantBasico.setEnabled(true);
lblCantPantEstandar.setEnabled(false);
lblCantPantPremium.setEnabled(false);
lblHDBasico.setEnabled(true);
lblHDEstandar.setEnabled(false);
lblHDPremium.setEnabled(false);
lblUHDBasico.setEnabled(true);
lblUHDEstandar.setEnabled(false);
lblUHDPremium.setEnabled(false);
lblPeliculasBasico.setEnabled(true);
lblPeliculasEstandar.setEnabled(false);
lblPeliculasPremium.setEnabled(false);
lblPrecio1.setEnabled(true);
lblPrecio2.setEnabled(false);
lblPrecio3.setEnabled(false);
lblVistaBasico.setEnabled(true);
lblVistaEstandar.setEnabled(false);
lblVistaPremium.setEnabled(false);
panelEstandar.setBackground(new java.awt.Color(204, 0, 51));
panelPremium.setBackground(new java.awt.Color(204, 0, 51));
i = 1;
}//GEN-LAST:event_panelBasicoMouseClicked
private void panelEstandarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelEstandarMouseClicked
panelEstandar.setBackground(new java.awt.Color(255, 0, 0));
lblCancelaBasico.setEnabled(false);
lblCancelaEstandar.setEnabled(true);
lblCancelaPremium.setEnabled(false);
lblCantPantBasico.setEnabled(false);
lblCantPantEstandar.setEnabled(true);
lblCantPantPremium.setEnabled(false);
lblHDBasico.setEnabled(false);
lblHDEstandar.setEnabled(true);
lblHDPremium.setEnabled(false);
lblUHDBasico.setEnabled(false);
lblUHDEstandar.setEnabled(true);
lblUHDPremium.setEnabled(false);
lblPeliculasBasico.setEnabled(false);
lblPeliculasEstandar.setEnabled(true);
lblPeliculasPremium.setEnabled(false);
lblPrecio1.setEnabled(false);
lblPrecio2.setEnabled(true);
lblPrecio3.setEnabled(false);
lblVistaBasico.setEnabled(false);
lblVistaEstandar.setEnabled(true);
lblVistaPremium.setEnabled(false);
panelBasico.setBackground(new java.awt.Color(204, 0, 51));
panelPremium.setBackground(new java.awt.Color(204, 0, 51));
i = 2;
}//GEN-LAST:event_panelEstandarMouseClicked
private void panelPremiumMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelPremiumMouseClicked
panelPremium.setBackground(new java.awt.Color(255, 0, 0));
lblCancelaBasico.setEnabled(false);
lblCancelaEstandar.setEnabled(false);
lblCancelaPremium.setEnabled(true);
lblCantPantBasico.setEnabled(false);
lblCantPantEstandar.setEnabled(false);
lblCantPantPremium.setEnabled(true);
lblHDBasico.setEnabled(false);
lblHDEstandar.setEnabled(false);
lblHDPremium.setEnabled(true);
lblUHDBasico.setEnabled(false);
lblUHDEstandar.setEnabled(false);
lblUHDPremium.setEnabled(true);
lblPeliculasBasico.setEnabled(false);
lblPeliculasEstandar.setEnabled(false);
lblPeliculasPremium.setEnabled(true);
lblPrecio1.setEnabled(false);
lblPrecio2.setEnabled(false);
lblPrecio3.setEnabled(true);
lblVistaBasico.setEnabled(false);
lblVistaEstandar.setEnabled(false);
lblVistaPremium.setEnabled(true);
panelBasico.setBackground(new java.awt.Color(204, 0, 51));
panelEstandar.setBackground(new java.awt.Color(204, 0, 51));
i = 3;
}//GEN-LAST:event_panelPremiumMouseClicked
private void panelContinuarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelContinuarMouseClicked
Registro6Pag pag6 = new Registro6Pag();
if (pag6.plan == 1) {
Registro6Pag.cambio = 1;
CambiarPanel cambiar = new CambiarPanel(pag6);
} else {
Registro3Pag pag3 = new Registro3Pag();
CambiarPanel cambiar = new CambiarPanel(pag3);
}
}//GEN-LAST:event_panelContinuarMouseClicked
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked
InicioSesion1 ini = new InicioSesion1();
CambiarPanel cambio = new CambiarPanel(ini);
}//GEN-LAST:event_jLabel2MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel5;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JSeparator jSeparator4;
private javax.swing.JSeparator jSeparator5;
private javax.swing.JSeparator jSeparator6;
private javax.swing.JToolBar jToolBar1;
private javax.swing.JLabel lblBasico;
private javax.swing.JLabel lblCancelaBasico;
private javax.swing.JLabel lblCancelaEstandar;
private javax.swing.JLabel lblCancelaPremium;
private javax.swing.JLabel lblCantPantBasico;
private javax.swing.JLabel lblCantPantEstandar;
private javax.swing.JLabel lblCantPantPremium;
private javax.swing.JLabel lblComent1;
private javax.swing.JLabel lblComent2;
private javax.swing.JLabel lblEstandar;
private javax.swing.JLabel lblHDBasico;
private javax.swing.JLabel lblHDEstandar;
private javax.swing.JLabel lblHDPremium;
private javax.swing.JLabel lblPeliculasBasico;
private javax.swing.JLabel lblPeliculasEstandar;
private javax.swing.JLabel lblPeliculasPremium;
private javax.swing.JLabel lblPrecio1;
private javax.swing.JLabel lblPrecio2;
private javax.swing.JLabel lblPrecio3;
private javax.swing.JLabel lblPremium;
private javax.swing.JLabel lblUHDBasico;
private javax.swing.JLabel lblUHDEstandar;
private javax.swing.JLabel lblUHDPremium;
private javax.swing.JLabel lblVistaBasico;
private javax.swing.JLabel lblVistaEstandar;
private javax.swing.JLabel lblVistaPremium;
private javax.swing.JPanel panelBasico;
private javax.swing.JPanel panelContinuar;
private javax.swing.JPanel panelEstandar;
private javax.swing.JPanel panelPremium;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 41,366 | java | Registro2Pag.java | Java | [
{
"context": "l15.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 3711,
"score": 0.7003229856491089,
"start": 3706,
"tag": "NAME",
"value": "matia"
},
{
"context": "el1.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Logo",
"end": 4593,
"score": 0.7896678447723389,
"start": 4588,
"tag": "NAME",
"value": "matia"
},
{
"context": "dar.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 11693,
"score": 0.993456244468689,
"start": 11688,
"tag": "NAME",
"value": "matia"
},
{
"context": "ium.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 11845,
"score": 0.9880880117416382,
"start": 11840,
"tag": "NAME",
"value": "matia"
},
{
"context": "ico.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 11996,
"score": 0.9923014044761658,
"start": 11991,
"tag": "NAME",
"value": "matia"
},
{
"context": "ico.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 12343,
"score": 0.9946275949478149,
"start": 12338,
"tag": "NAME",
"value": "matia"
},
{
"context": "dar.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 12493,
"score": 0.9951852560043335,
"start": 12488,
"tag": "NAME",
"value": "matia"
},
{
"context": "ium.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 12642,
"score": 0.9921182990074158,
"start": 12637,
"tag": "NAME",
"value": "matia"
},
{
"context": "ico.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 13798,
"score": 0.99660325050354,
"start": 13793,
"tag": "NAME",
"value": "matia"
},
{
"context": "dar.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 13954,
"score": 0.9965431690216064,
"start": 13949,
"tag": "NAME",
"value": "matia"
},
{
"context": "ium.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 14109,
"score": 0.9966390132904053,
"start": 14104,
"tag": "NAME",
"value": "matia"
},
{
"context": "ico.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 14405,
"score": 0.9973733425140381,
"start": 14400,
"tag": "NAME",
"value": "matia"
},
{
"context": "dar.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 14565,
"score": 0.9941497445106506,
"start": 14560,
"tag": "NAME",
"value": "matia"
},
{
"context": "ium.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 14724,
"score": 0.9953217506408691,
"start": 14719,
"tag": "NAME",
"value": "matia"
},
{
"context": "ium.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 15015,
"score": 0.9959195852279663,
"start": 15010,
"tag": "NAME",
"value": "matia"
},
{
"context": "dar.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 15173,
"score": 0.9949450492858887,
"start": 15168,
"tag": "NAME",
"value": "matia"
},
{
"context": "ico.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\matia\\\\Desktop\\\\Imagenes Trabajo\\\\Trabajo Netflix\\\\Unti",
"end": 15329,
"score": 0.9946005344390869,
"start": 15324,
"tag": "NAME",
"value": "matia"
}
] | null | [] | package Front.Registro;
import java.awt.BorderLayout;
import Back.ITipoPlanDAO;
import Back.TipoPlanDAO;
import Front.CambiarPanel;
import Front.InicioSesion.InicioSesion1;
import java.awt.event.MouseEvent;
import static Front.Netflix.panelPrincipal1;
public class Registro2Pag extends javax.swing.JPanel {
private MouseEvent evt;
public Registro2Pag() {
initComponents();
if (i == 1) {
panelBasicoMouseClicked(evt);
} else {
if (i == 2) {
panelEstandarMouseClicked(evt);
} else {
panelPremiumMouseClicked(evt);
}
}
}
public static int i = 1;
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel4 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jToolBar1 = new javax.swing.JToolBar();
jPanel5 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
panelBasico = new javax.swing.JPanel();
lblBasico = new javax.swing.JLabel();
panelEstandar = new javax.swing.JPanel();
lblEstandar = new javax.swing.JLabel();
panelPremium = new javax.swing.JPanel();
lblPremium = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
lblPrecio1 = new javax.swing.JLabel();
lblPrecio2 = new javax.swing.JLabel();
lblPrecio3 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
lblHDEstandar = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
lblHDPremium = new javax.swing.JLabel();
lblHDBasico = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
lblUHDBasico = new javax.swing.JLabel();
lblUHDEstandar = new javax.swing.JLabel();
lblUHDPremium = new javax.swing.JLabel();
jSeparator3 = new javax.swing.JSeparator();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
lblCantPantBasico = new javax.swing.JLabel();
lblCantPantEstandar = new javax.swing.JLabel();
lblCantPantPremium = new javax.swing.JLabel();
jSeparator4 = new javax.swing.JSeparator();
jLabel22 = new javax.swing.JLabel();
lblVistaBasico = new javax.swing.JLabel();
lblVistaEstandar = new javax.swing.JLabel();
lblVistaPremium = new javax.swing.JLabel();
jSeparator5 = new javax.swing.JSeparator();
jLabel26 = new javax.swing.JLabel();
lblPeliculasBasico = new javax.swing.JLabel();
lblPeliculasEstandar = new javax.swing.JLabel();
lblPeliculasPremium = new javax.swing.JLabel();
jSeparator6 = new javax.swing.JSeparator();
jLabel30 = new javax.swing.JLabel();
lblCancelaPremium = new javax.swing.JLabel();
lblCancelaEstandar = new javax.swing.JLabel();
lblCancelaBasico = new javax.swing.JLabel();
lblComent1 = new javax.swing.JLabel();
lblComent2 = new javax.swing.JLabel();
panelContinuar = new javax.swing.JPanel();
jLabel36 = new javax.swing.JLabel();
jLabel4.setFont(new java.awt.Font("SansSerif", 0, 11)); // NOI18N
jLabel4.setText("PASO 1 DE 3");
jLabel15.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
jToolBar1.setRollover(true);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 375, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 32, Short.MAX_VALUE)
);
setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Logo_Netflix_opt.png")); // NOI18N
jLabel1.setText("jLabel1");
jLabel2.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
jLabel2.setText("Iniciar Sesión");
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 618, Short.MAX_VALUE)
.addComponent(jLabel2)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE))
.addContainerGap(19, Short.MAX_VALUE))
);
jLabel5.setFont(new java.awt.Font("SansSerif", 0, 11)); // NOI18N
jLabel5.setText("PASO 1 DE 3");
jLabel3.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
jLabel3.setText("Selecciona el plan ideal para ti");
jLabel6.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel6.setText("Cambia a un plan inferior o superior en cualquier momento");
panelBasico.setBackground(new java.awt.Color(255, 0, 0));
panelBasico.setEnabled(false);
panelBasico.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelBasicoMouseClicked(evt);
}
});
lblBasico.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
lblBasico.setForeground(new java.awt.Color(255, 255, 255));
lblBasico.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblBasico.setText("Básico");
javax.swing.GroupLayout panelBasicoLayout = new javax.swing.GroupLayout(panelBasico);
panelBasico.setLayout(panelBasicoLayout);
panelBasicoLayout.setHorizontalGroup(
panelBasicoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblBasico, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
);
panelBasicoLayout.setVerticalGroup(
panelBasicoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblBasico, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
);
panelEstandar.setBackground(new java.awt.Color(255, 0, 0));
panelEstandar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelEstandarMouseClicked(evt);
}
});
lblEstandar.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
lblEstandar.setForeground(new java.awt.Color(255, 255, 255));
lblEstandar.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblEstandar.setText("Éstandar");
javax.swing.GroupLayout panelEstandarLayout = new javax.swing.GroupLayout(panelEstandar);
panelEstandar.setLayout(panelEstandarLayout);
panelEstandarLayout.setHorizontalGroup(
panelEstandarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblEstandar, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
);
panelEstandarLayout.setVerticalGroup(
panelEstandarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblEstandar, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
);
panelPremium.setBackground(new java.awt.Color(255, 0, 0));
panelPremium.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelPremiumMouseClicked(evt);
}
});
lblPremium.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N
lblPremium.setForeground(new java.awt.Color(255, 255, 255));
lblPremium.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblPremium.setText("Premium");
javax.swing.GroupLayout panelPremiumLayout = new javax.swing.GroupLayout(panelPremium);
panelPremium.setLayout(panelPremiumLayout);
panelPremiumLayout.setHorizontalGroup(
panelPremiumLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPremium, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
);
panelPremiumLayout.setVerticalGroup(
panelPremiumLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPremium, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
);
jLabel10.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel10.setText("Precio mensual (sin impuestos)");
ITipoPlanDAO tPDAO = new TipoPlanDAO();
lblPrecio1.setText(tPDAO.conexionPrecio(1));
lblPrecio1.setForeground(new java.awt.Color(255, 0, 0));
lblPrecio1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblPrecio2.setText(tPDAO.conexionPrecio(2));
lblPrecio2.setForeground(new java.awt.Color(255, 0, 0));
lblPrecio2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblPrecio3.setText(tPDAO.conexionPrecio(3));
lblPrecio3.setForeground(new java.awt.Color(255, 0, 0));
lblPrecio3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel11.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel11.setText("HD Disponible");
lblHDEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblHDPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblHDBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
jLabel13.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel13.setText("Ultra HD Disponible");
lblUHDBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
lblUHDEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-2.png")); // NOI18N
lblUHDPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
jLabel17.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel17.setText("Pantallas en las que puedes ver al mismo");
jLabel18.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel18.setText("tiempo");
lblCantPantBasico.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
lblCantPantBasico.setForeground(new java.awt.Color(255, 0, 0));
lblCantPantBasico.setText("1");
lblCantPantEstandar.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
lblCantPantEstandar.setForeground(new java.awt.Color(255, 0, 0));
lblCantPantEstandar.setText("2");
lblCantPantPremium.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
lblCantPantPremium.setForeground(new java.awt.Color(255, 0, 0));
lblCantPantPremium.setText("4");
jLabel22.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel22.setText("Ve en tu laptop, TV, teléfono y tablet");
lblVistaBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblVistaEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblVistaPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
jLabel26.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel26.setText("Películas y programas ilimitados");
lblPeliculasBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblPeliculasEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblPeliculasPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
jLabel30.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel30.setText("Cancela en cualquier momento");
lblCancelaPremium.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblCancelaEstandar.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblCancelaBasico.setIcon(new javax.swing.ImageIcon("C:\\Users\\matia\\Desktop\\Imagenes Trabajo\\Trabajo Netflix\\Untitled-1_opt.png")); // NOI18N
lblComent1.setText("La disponibilidad del contenido HD y Ultra HD depende de tu proveedor de servicios de internet y del dispositivo en uso.");
lblComent2.setText("No todo el contenido está disponible en HD o en Ultra HD.");
panelContinuar.setBackground(new java.awt.Color(255, 0, 0));
panelContinuar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
panelContinuarMouseClicked(evt);
}
});
jLabel36.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel36.setForeground(new java.awt.Color(255, 255, 255));
jLabel36.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel36.setText("CONTINUAR");
javax.swing.GroupLayout panelContinuarLayout = new javax.swing.GroupLayout(panelContinuar);
panelContinuar.setLayout(panelContinuarLayout);
panelContinuarLayout.setHorizontalGroup(
panelContinuarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelContinuarLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel36, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
.addContainerGap())
);
panelContinuarLayout.setVerticalGroup(
panelContinuarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContinuarLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel36)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelContinuar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(308, 308, 308))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(91, 91, 91)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jLabel3)
.addComponent(jLabel5))))
.addGap(0, 10, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(70, 70, 70)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 738, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 738, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(187, 187, 187)
.addComponent(lblUHDBasico)
.addGap(131, 131, 131)
.addComponent(lblUHDEstandar)
.addGap(122, 122, 122)
.addComponent(lblUHDPremium))
.addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel18)
.addComponent(jLabel17))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 134, Short.MAX_VALUE)
.addComponent(lblCantPantBasico)
.addGap(134, 134, 134)
.addComponent(lblCantPantEstandar)
.addGap(138, 138, 138)
.addComponent(lblCantPantPremium)
.addGap(40, 40, 40))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(131, 131, 131)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(panelBasico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPrecio1, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(46, 46, 46)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPrecio2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(46, 46, 46)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(panelPremium, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblPrecio3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblHDBasico)
.addGap(125, 125, 125)
.addComponent(lblHDEstandar)
.addGap(114, 114, 114)
.addComponent(lblHDPremium)
.addGap(31, 31, 31)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel22)
.addGap(158, 158, 158)
.addComponent(lblVistaBasico)
.addGap(114, 114, 114)
.addComponent(lblVistaEstandar)
.addGap(117, 117, 117)
.addComponent(lblVistaPremium))
.addComponent(jSeparator4)
.addComponent(jSeparator5)
.addComponent(lblComent1, javax.swing.GroupLayout.DEFAULT_SIZE, 738, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel26)
.addComponent(jLabel30))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblPeliculasBasico)
.addGap(114, 114, 114)
.addComponent(lblPeliculasEstandar)
.addGap(118, 118, 118)
.addComponent(lblPeliculasPremium))
.addGroup(layout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(lblCancelaBasico)
.addGap(112, 112, 112)
.addComponent(lblCancelaEstandar)
.addGap(119, 119, 119)
.addComponent(lblCancelaPremium)))
.addGap(28, 28, 28)))
.addComponent(lblComent2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel6)
.addGap(17, 17, 17)
.addComponent(panelBasico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(panelEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelPremium, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblPrecio2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblPrecio3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(lblPrecio1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblHDEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblHDBasico)
.addComponent(lblHDPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel13)
.addComponent(lblUHDBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblUHDEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblUHDPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCantPantBasico)
.addComponent(lblCantPantEstandar)
.addComponent(lblCantPantPremium))
.addGap(17, 17, 17)))
.addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblVistaBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblVistaEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblVistaPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel22))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel26)
.addComponent(lblPeliculasBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPeliculasEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPeliculasPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel30)
.addGroup(layout.createSequentialGroup()
.addGap(2, 2, 2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblCancelaBasico, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblCancelaEstandar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblCancelaPremium, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addComponent(lblComent1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblComent2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
.addComponent(panelContinuar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32))
);
}// </editor-fold>//GEN-END:initComponents
private void panelBasicoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelBasicoMouseClicked
panelBasico.setBackground(new java.awt.Color(255, 0, 0));
lblCancelaBasico.setEnabled(true);
lblCancelaEstandar.setEnabled(false);
lblCancelaPremium.setEnabled(false);
lblCantPantBasico.setEnabled(true);
lblCantPantEstandar.setEnabled(false);
lblCantPantPremium.setEnabled(false);
lblHDBasico.setEnabled(true);
lblHDEstandar.setEnabled(false);
lblHDPremium.setEnabled(false);
lblUHDBasico.setEnabled(true);
lblUHDEstandar.setEnabled(false);
lblUHDPremium.setEnabled(false);
lblPeliculasBasico.setEnabled(true);
lblPeliculasEstandar.setEnabled(false);
lblPeliculasPremium.setEnabled(false);
lblPrecio1.setEnabled(true);
lblPrecio2.setEnabled(false);
lblPrecio3.setEnabled(false);
lblVistaBasico.setEnabled(true);
lblVistaEstandar.setEnabled(false);
lblVistaPremium.setEnabled(false);
panelEstandar.setBackground(new java.awt.Color(204, 0, 51));
panelPremium.setBackground(new java.awt.Color(204, 0, 51));
i = 1;
}//GEN-LAST:event_panelBasicoMouseClicked
private void panelEstandarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelEstandarMouseClicked
panelEstandar.setBackground(new java.awt.Color(255, 0, 0));
lblCancelaBasico.setEnabled(false);
lblCancelaEstandar.setEnabled(true);
lblCancelaPremium.setEnabled(false);
lblCantPantBasico.setEnabled(false);
lblCantPantEstandar.setEnabled(true);
lblCantPantPremium.setEnabled(false);
lblHDBasico.setEnabled(false);
lblHDEstandar.setEnabled(true);
lblHDPremium.setEnabled(false);
lblUHDBasico.setEnabled(false);
lblUHDEstandar.setEnabled(true);
lblUHDPremium.setEnabled(false);
lblPeliculasBasico.setEnabled(false);
lblPeliculasEstandar.setEnabled(true);
lblPeliculasPremium.setEnabled(false);
lblPrecio1.setEnabled(false);
lblPrecio2.setEnabled(true);
lblPrecio3.setEnabled(false);
lblVistaBasico.setEnabled(false);
lblVistaEstandar.setEnabled(true);
lblVistaPremium.setEnabled(false);
panelBasico.setBackground(new java.awt.Color(204, 0, 51));
panelPremium.setBackground(new java.awt.Color(204, 0, 51));
i = 2;
}//GEN-LAST:event_panelEstandarMouseClicked
private void panelPremiumMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelPremiumMouseClicked
panelPremium.setBackground(new java.awt.Color(255, 0, 0));
lblCancelaBasico.setEnabled(false);
lblCancelaEstandar.setEnabled(false);
lblCancelaPremium.setEnabled(true);
lblCantPantBasico.setEnabled(false);
lblCantPantEstandar.setEnabled(false);
lblCantPantPremium.setEnabled(true);
lblHDBasico.setEnabled(false);
lblHDEstandar.setEnabled(false);
lblHDPremium.setEnabled(true);
lblUHDBasico.setEnabled(false);
lblUHDEstandar.setEnabled(false);
lblUHDPremium.setEnabled(true);
lblPeliculasBasico.setEnabled(false);
lblPeliculasEstandar.setEnabled(false);
lblPeliculasPremium.setEnabled(true);
lblPrecio1.setEnabled(false);
lblPrecio2.setEnabled(false);
lblPrecio3.setEnabled(true);
lblVistaBasico.setEnabled(false);
lblVistaEstandar.setEnabled(false);
lblVistaPremium.setEnabled(true);
panelBasico.setBackground(new java.awt.Color(204, 0, 51));
panelEstandar.setBackground(new java.awt.Color(204, 0, 51));
i = 3;
}//GEN-LAST:event_panelPremiumMouseClicked
private void panelContinuarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelContinuarMouseClicked
Registro6Pag pag6 = new Registro6Pag();
if (pag6.plan == 1) {
Registro6Pag.cambio = 1;
CambiarPanel cambiar = new CambiarPanel(pag6);
} else {
Registro3Pag pag3 = new Registro3Pag();
CambiarPanel cambiar = new CambiarPanel(pag3);
}
}//GEN-LAST:event_panelContinuarMouseClicked
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked
InicioSesion1 ini = new InicioSesion1();
CambiarPanel cambio = new CambiarPanel(ini);
}//GEN-LAST:event_jLabel2MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel5;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JSeparator jSeparator4;
private javax.swing.JSeparator jSeparator5;
private javax.swing.JSeparator jSeparator6;
private javax.swing.JToolBar jToolBar1;
private javax.swing.JLabel lblBasico;
private javax.swing.JLabel lblCancelaBasico;
private javax.swing.JLabel lblCancelaEstandar;
private javax.swing.JLabel lblCancelaPremium;
private javax.swing.JLabel lblCantPantBasico;
private javax.swing.JLabel lblCantPantEstandar;
private javax.swing.JLabel lblCantPantPremium;
private javax.swing.JLabel lblComent1;
private javax.swing.JLabel lblComent2;
private javax.swing.JLabel lblEstandar;
private javax.swing.JLabel lblHDBasico;
private javax.swing.JLabel lblHDEstandar;
private javax.swing.JLabel lblHDPremium;
private javax.swing.JLabel lblPeliculasBasico;
private javax.swing.JLabel lblPeliculasEstandar;
private javax.swing.JLabel lblPeliculasPremium;
private javax.swing.JLabel lblPrecio1;
private javax.swing.JLabel lblPrecio2;
private javax.swing.JLabel lblPrecio3;
private javax.swing.JLabel lblPremium;
private javax.swing.JLabel lblUHDBasico;
private javax.swing.JLabel lblUHDEstandar;
private javax.swing.JLabel lblUHDPremium;
private javax.swing.JLabel lblVistaBasico;
private javax.swing.JLabel lblVistaEstandar;
private javax.swing.JLabel lblVistaPremium;
private javax.swing.JPanel panelBasico;
private javax.swing.JPanel panelContinuar;
private javax.swing.JPanel panelEstandar;
private javax.swing.JPanel panelPremium;
// End of variables declaration//GEN-END:variables
}
| 41,366 | 0.662186 | 0.6397 | 693 | 58.682541 | 40.105961 | 187 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.002886 | false | false | 12 |
4ec5f7e7fd840d3ea46682bf6b7ff34cc3d25441 | 25,013,889,578,158 | 9e2eaea95f99e961721f271602865d179baa7d53 | /bookStore_new/src/test/java/testItemrCF.java | fdfb1b3180095f2adb81a8714b5e06e13feb6339 | [] | no_license | liu-zhubj/BookRecommend | https://github.com/liu-zhubj/BookRecommend | 39515d4ac10c35bb019c620d88bd8fe500dcff1a | 2de9becf814e2a6745ee1a153b7232875337d169 | refs/heads/master | 2022-12-02T09:49:10.233000 | 2020-08-18T10:30:57 | 2020-08-18T10:30:57 | 288,412,716 | 62 | 11 | null | null | null | null | null | null | null | null | null | null | null | null | null | import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.eval.IRStatistics;
import org.apache.mahout.cf.taste.eval.RecommenderBuilder;
import org.apache.mahout.cf.taste.eval.RecommenderEvaluator;
import org.apache.mahout.cf.taste.eval.RecommenderIRStatsEvaluator;
import org.apache.mahout.cf.taste.impl.eval.AverageAbsoluteDifferenceRecommenderEvaluator;
import org.apache.mahout.cf.taste.impl.eval.GenericRecommenderIRStatsEvaluator;
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood;
import org.apache.mahout.cf.taste.impl.recommender.CachingRecommender;
import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender;
import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender;
import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity;
import org.apache.mahout.cf.taste.impl.similarity.UncenteredCosineSimilarity;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood;
import org.apache.mahout.cf.taste.recommender.Recommender;
import org.apache.mahout.cf.taste.similarity.ItemSimilarity;
import org.apache.mahout.cf.taste.similarity.UserSimilarity;
import java.io.File;
import java.io.IOException;
public class testItemrCF {
public static void main(String[] args) throws IOException, TasteException {
// 准备数据
File file = new File("C:\\Users\\lenovo\\Desktop\\my love\\bookStore_new\\ratings1.csv");
// 将数据加载到内存中
DataModel dataModel = new FileDataModel(file);//构造数据模型
// 推荐评估, 使用平均差值
RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
RecommenderIRStatsEvaluator statsEvaluator = new GenericRecommenderIRStatsEvaluator();
RecommenderBuilder builder = new RecommenderBuilder() {
public Recommender buildRecommender(DataModel dataModel) throws TasteException {
ItemSimilarity similarity = new UncenteredCosineSimilarity(dataModel);//计算内容相似度
return new GenericItemBasedRecommender(dataModel, similarity);//构造推荐引擎
}
};
// 用 70% 的数据用作训练, 剩下的 30% 用来测试
double score = evaluator.evaluate(builder, null, dataModel, 0.9, 1.0);
// 最后得出的评估值越小, 说明推荐结果越好
System.out.println("itemCF评估值:"+score);
IRStatistics stats = statsEvaluator.evaluate(builder, null, dataModel, null, 4, GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD, 1.0);
System.out.println("itemCF准确率:"+stats.getPrecision());
System.out.println("itemCF召回率:"+stats.getRecall());
}
}
| UTF-8 | Java | 2,944 | java | testItemrCF.java | Java | [
{
"context": "// 准备数据\r\n File file = new File(\"C:\\\\Users\\\\lenovo\\\\Desktop\\\\my love\\\\bookStore_new\\\\ratings1.csv\");",
"end": 1546,
"score": 0.8892114758491516,
"start": 1540,
"tag": "USERNAME",
"value": "lenovo"
}
] | null | [] | import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.eval.IRStatistics;
import org.apache.mahout.cf.taste.eval.RecommenderBuilder;
import org.apache.mahout.cf.taste.eval.RecommenderEvaluator;
import org.apache.mahout.cf.taste.eval.RecommenderIRStatsEvaluator;
import org.apache.mahout.cf.taste.impl.eval.AverageAbsoluteDifferenceRecommenderEvaluator;
import org.apache.mahout.cf.taste.impl.eval.GenericRecommenderIRStatsEvaluator;
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood;
import org.apache.mahout.cf.taste.impl.recommender.CachingRecommender;
import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender;
import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender;
import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity;
import org.apache.mahout.cf.taste.impl.similarity.UncenteredCosineSimilarity;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood;
import org.apache.mahout.cf.taste.recommender.Recommender;
import org.apache.mahout.cf.taste.similarity.ItemSimilarity;
import org.apache.mahout.cf.taste.similarity.UserSimilarity;
import java.io.File;
import java.io.IOException;
public class testItemrCF {
public static void main(String[] args) throws IOException, TasteException {
// 准备数据
File file = new File("C:\\Users\\lenovo\\Desktop\\my love\\bookStore_new\\ratings1.csv");
// 将数据加载到内存中
DataModel dataModel = new FileDataModel(file);//构造数据模型
// 推荐评估, 使用平均差值
RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
RecommenderIRStatsEvaluator statsEvaluator = new GenericRecommenderIRStatsEvaluator();
RecommenderBuilder builder = new RecommenderBuilder() {
public Recommender buildRecommender(DataModel dataModel) throws TasteException {
ItemSimilarity similarity = new UncenteredCosineSimilarity(dataModel);//计算内容相似度
return new GenericItemBasedRecommender(dataModel, similarity);//构造推荐引擎
}
};
// 用 70% 的数据用作训练, 剩下的 30% 用来测试
double score = evaluator.evaluate(builder, null, dataModel, 0.9, 1.0);
// 最后得出的评估值越小, 说明推荐结果越好
System.out.println("itemCF评估值:"+score);
IRStatistics stats = statsEvaluator.evaluate(builder, null, dataModel, null, 4, GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD, 1.0);
System.out.println("itemCF准确率:"+stats.getPrecision());
System.out.println("itemCF召回率:"+stats.getRecall());
}
}
| 2,944 | 0.752525 | 0.748196 | 50 | 53.400002 | 33.055107 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.96 | false | false | 12 |
378ec6ec3797c758bb8199b1e2fb425762747051 | 12,704,513,321,613 | e86480b45bc48b958e9b4b479bd643c7364c2f16 | /LambdaExpression/MyFunctionalInterface2.java | 1906fe164081393bb6bb3e5215921770f5844881 | [] | no_license | hansy0122/day13 | https://github.com/hansy0122/day13 | a198e780f4a5b817a7deb0b53757a55af5a6060a | e041e21c8fdf79594aff548287dff97fcfdf93ab | refs/heads/master | 2021-04-27T00:17:53.009000 | 2018-03-04T12:25:38 | 2018-03-04T12:25:38 | 123,787,945 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package day13.LambdaExpression;
public interface MyFunctionalInterface2 {
public void method(int x);
}
| UTF-8 | Java | 105 | java | MyFunctionalInterface2.java | Java | [] | null | [] | package day13.LambdaExpression;
public interface MyFunctionalInterface2 {
public void method(int x);
}
| 105 | 0.809524 | 0.780952 | 5 | 20 | 16.565023 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 12 |
7d117a5e6f161ed1da96c6ee78dd0389c851c2e6 | 27,814,208,217,845 | e047870136e1958ce80dad88fa931304ada49a1b | /eu.cessar.ct.core.security/src/eu/cessar/ct/core/security/license/LicenseHandler.java | 2bd046c334c406e85a54d946dade417d2f399cd5 | [] | no_license | ONagaty/SEA-ModellAR | https://github.com/ONagaty/SEA-ModellAR | f4994a628459a20b9be7af95d41d5e0ff8a21f77 | a0f6bdbb072503ea584d72f872f29a20ea98ade5 | refs/heads/main | 2023-06-04T07:07:02.900000 | 2021-06-19T20:54:47 | 2021-06-19T20:54:47 | 376,735,297 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eu.cessar.ct.core.security.license;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class LicenseHandler
{
/** Singleton */
private static LicenseHandler __instance = null;
/** License folder */
private static File _licenseFolder = null;
/** License map */
private Map<String, LicenseDef> licenseMap = null;
/**
* Return the local full host ID
*
* @return the local full host ID
*/
public static String getLocalFullHostID()
{
return HostID.getFullID();
}
/**
* Return the singleton
*
* @return the singleton
*/
public static LicenseHandler getInstance()
{
if (__instance == null)
{
__instance = new LicenseHandler();
}
return __instance;
}
/**
* Default constructor
*/
public LicenseHandler()
{
licenseMap = new HashMap<String, LicenseDef>();
}
/**
* Get the license folder
*
* @return the license folder
*/
public File getLicenseFolder()
{
return _licenseFolder;
}
/**
* Set the license folder. When the license folder is set, all license files present in that folder will be read.
* Any license already processed from other folder will be discarded.
*
* @param folder
* the license folder
* @throws InvalidLicenseException
*/
public void setLicenseFolder(File folder)
{
licenseMap.clear();
_licenseFolder = folder;
_readAllLicenses();
}
/**
* Search and install a license corresponding to a product in the license folder
*
* @param productName
* the product name
* @throws InvalidLicenseException
* if no valid license found
*/
public void installLicenseInFolder(String productName) throws InvalidLicenseException
{
_installLicenseInFolder(_licenseFolder, productName);
}
/**
* Search and install a license corresponding to a product in the specified folder
*
* @param folder
* the folder where to search the license
* @param productName
* the product name
* @throws InvalidLicenseException
* if no valid license found
*/
private void _installLicenseInFolder(File folder, String productName) throws InvalidLicenseException
{
if (folder == null)
{
throw new IllegalArgumentException("folder is null");
}
if (folder != null && folder.exists() && !folder.isDirectory())
{
throw new IllegalArgumentException(folder + " is not a directory");
}
// Find the license file
File licenseFile = _findLicenseInFolder(folder, productName);
if (licenseFile == null)
{
// No license found
throw new InvalidLicenseException("No license found for the product " + productName);
}
// Install the license for the product
_installLicense(productName, licenseFile);
}
/**
* Find a license file corresponding to a product in the specified folder
*
* @param folder
* the folder where to search the license
* @param productName
* the product name
* @return the license file, <code>null</code> if none
*/
private File _findLicenseInFolder(File folder, String productName)
{
File licFile = null;
if (folder != null && folder.isDirectory() && folder.exists())
{
// Get the default license file name
String lfName = LicenseDef._createDefaultLicenseFileName(productName);
if (lfName != null)
{
// Parse folder and search the license file corresponding to the product
File[] files = folder.listFiles();
for (int i = 0; i < files.length && licFile == null; i++)
{
File file = files[i];
if (lfName.equals(file.getName()))
{
licFile = file;
}
}
}
}
return licFile;
}
/**
* Find all license files in the specified folder
*
* @param folder
* the folder where to search the license
* @return the license files, newer null
*/
private File[] _findAllLicensesInFolder(File folder)
{
List<File> licFiles = new ArrayList<File>();
if (folder != null && folder.isDirectory() && folder.exists())
{
// Parse folder and search the license file corresponding to the product
File[] files = folder.listFiles();
for (int i = 0; i < files.length; i++)
{
File file = files[i];
if (file.getName().endsWith(ILicense.LICENSE_FILE_EXT))
{
licFiles.add(file);
}
}
}
return licFiles.toArray(new File[licFiles.size()]);
}
/**
* Check if a license corresponding to a product exists in the specified folder. Please note that the productName
* might be null and in this case the method will return true if there is at lease on license file inside
*
* @param folder
* the folder where to search the license
* @param productName
* the product name, might be null
* @return true if a license exist, otherwise false
*/
public boolean checkIfLicenseExistInFolder(File folder, String productName)
{
if (productName != null)
{
return _findLicenseInFolder(folder, productName) != null;
}
else
{
return _findAllLicensesInFolder(folder).length > 0;
}
}
/**
* Install license for a product in the license folder
*
* @param productName
* the product name, might be null and in this case the informations from licFile should be used
* @param licFile
* the file of the license to install
* @throws InvalidLicenseException
* if the license is invalid for the product
*/
public void installLicense(String productName, File licFile) throws InvalidLicenseException
{
findLicenseFolder();
_installLicense(_licenseFolder, productName, licFile);
}
public File findLicenseFolder()
{
String cessarLicFolderStr = System.getProperty(CessarOldLicenseHandler.CESSAR_LICENSE_FOLDER);
if (cessarLicFolderStr != null)
{
_licenseFolder = new File(cessarLicFolderStr);
if (!_licenseFolder.exists())
{
cessarLicFolderStr = System.getenv("ALLUSERSPROFILE")
+ "\\Application Data\\Conti Engineering\\CESSAR-CT\\";
_licenseFolder = new File(cessarLicFolderStr);
}
}
else
{
cessarLicFolderStr = System.getenv("ALLUSERSPROFILE")
+ "\\Application Data\\Conti Engineering\\CESSAR-CT\\";
_licenseFolder = new File(cessarLicFolderStr);
}
_licenseFolder = new File(cessarLicFolderStr);
return _licenseFolder;
}
/**
* Install license for a product in the specified folder
*
* @param folder
* the folder where to install the license
* @param productName
* the product name, might be null and in this case the informations from licFile should be used
* @param licFile
* the file of the license to install
* @throws InvalidLicenseException
* if the license is invalid for the product
*/
private void _installLicense(File folder, String productName, File licFile) throws InvalidLicenseException
{
if (folder != null && folder.exists() && !folder.isDirectory())
{
throw new IllegalArgumentException(folder + " is not a directory");
}
if (licFile == null)
{
throw new IllegalArgumentException("License file to install is null");
}
// Get current license for this productName
LicenseDef currentLicenseDef = null;
if (productName != null)
{
currentLicenseDef = _getLicenseDef(productName);
}
// Install the license for the product
LicenseDef newLicense = _installLicense(productName, licFile);
try
{
// Get the default license file name
String lfName = LicenseDef._createDefaultLicenseFileName(newLicense.getProduct().getName());
// Create folder if needed
if (folder != null)
{
folder.mkdirs();
}
// Copy
copyLicenseFile(licFile, new File(folder, lfName));
}
catch (IOException e)
{
// Keeping the current license
if (currentLicenseDef != null)
{
licenseMap.put(productName, currentLicenseDef);
}
throw new InvalidLicenseException("Error during the copy of the license file into " + folder.getPath()
+ " directory");
}
}
/**
* Copy <code>srcFile</code> to <code>destFile</code>
*
* @param srcFile
* the source file
* @param destFile
* the destination file
* @throws IOException
* if error during the copy
*/
public void copyLicenseFile(File srcFile, File destFile) throws IOException
{
FileInputStream fis = new FileInputStream(srcFile);
if (!destFile.canWrite())
{
destFile.setWritable(true);
}
FileOutputStream fos = new FileOutputStream(destFile);
try
{
FileChannel channelSrc = fis.getChannel();
FileChannel channelDest = fos.getChannel();
channelSrc.transferTo(0, channelSrc.size(), channelDest);
}
finally
{
try
{
fis.close();
}
catch (Exception e)
{}
try
{
fos.close();
}
catch (Exception e)
{}
}
}
/**
* Install license for a product
*
* @param productName
* the product name, if null the informations from licFile should be used.
* @param licFile
* the file of the license to install
* @return the installed license
* @throws InvalidLicenseException
* if the license is invalid for the product
*/
private LicenseDef _installLicense(String productName, File licFile) throws InvalidLicenseException
{
// Read and check license
LicenseDef license = _readLicenseDef(productName, licFile, false);
if (productName == null)
{
productName = license.getProduct().getName();
}
// License is valid
licenseMap.put(productName, license);
return license;
}
/**
* Read and install all license available under the current licenseFolder
*
* @throws InvalidLicenseException
*/
private void _readAllLicenses()
{
File[] licFiles = _findAllLicensesInFolder(_licenseFolder);
for (File licFile: licFiles)
{
String productName = licFile.getName();
// remove the extension from productName
productName = productName.substring(0, productName.length() - ILicense.LICENSE_FILE_EXT.length());
try
{
_installLicense(productName, licFile);
}
catch (InvalidLicenseException e)
{
// just report the error and skip this entry
InvalidLicenseException licexc = new InvalidLicenseException("Old license model not installed");
licexc.initCause(e);
// CessarPluginActivator.logWarning(licexc);
}
}
}
/**
* Read a license model for a given product
*
* @param productName
* the product name
* @param file
* the license model file to read
* @return the license model
* @throws InvalidLicenseException
* if error during the reading
*/
public LicenseDef readLicenseModel(String productName, File file) throws InvalidLicenseException
{
// Read and check license model
return _readLicenseDef(productName, file, true);
}
/**
* Read a license model for a given product
*
* @param productName
* the product name
* @param is
* the license model input stream to read
* @return the license model
* @throws InvalidLicenseException
* if error during the reading
*/
public LicenseDef readLicenseModel(String productName, InputStream is) throws InvalidLicenseException
{
// Read and check license model
return _readLicenseDef(productName, is, true);
}
/**
* Read a license for a given product
*
* @param productName
* the product name
* @param file
* the file to read
* @param modelFile
* true if the file is a license model file, otherwise false
* @return the license
* @throws InvalidLicenseException
* if error during the reading
*/
private LicenseDef _readLicenseDef(String productName, File file, boolean modelFile) throws InvalidLicenseException
{
LicenseDef license = null;
try
{
// Read the license
license = _readLicenseDef(productName, new FileInputStream(file), modelFile);
}
catch (IOException e)
{
throw new InvalidLicenseException(file + " doest not exist", e);
}
return license;
}
/**
* Read a license for a given product. If <code>modelFile</code> is <code>true</code>, the method returns a license
* model.
*
* @param productName
* the product name, can be null
* @param is
* the input stream to read
* @param modelFile
* true if the file is a license model file, otherwise false
* @return the license
* @throws InvalidLicenseException
* if error during the reading
*/
private LicenseDef _readLicenseDef(String productName, InputStream is, boolean modelFile)
throws InvalidLicenseException
{
LicenseDef license = null;
try
{
// Read license for the product
license = new LicenseDef(is, !modelFile);
// Check the license
_checkLicense(productName, license);
}
catch (InvalidLicenseException e)
{
throw e;
}
catch (Exception e)
{
throw new InvalidLicenseException("The license is invalid for the product " + productName + " [Cause : + "
+ e.getMessage() + "]", e);
}
return license;
}
/**
* Check the license
*
* @param license
* the license
* @throws InvalidLicenseException
* if the license is invalid
*/
private void _checkLicense(String productName, LicenseDef license) throws InvalidLicenseException
{
// Product name control
if (productName != null && !productName.equals(license.getProduct().getName()))
{
throw new InvalidLicenseException("The license is invalid for the product " + productName);
}
// HostId Control.
// Retrieve local host id based on the license file host id type :
// New : BIOS ID
// Old : Mac Address
// Linux : always Mac Address
int locHostID = license.isNewLicenseType() ? HostID.obtainHostID() : HostID.obtainOldHostID();
int licHostID = license.getHostID();
boolean hostIDBinded = license.getLicenseInfo().isHostIDBinded();
// Check Host ID if needed
if (licHostID != 0 && (licHostID != locHostID && hostIDBinded))
{
throw new InvalidLicenseException("The license for the product '" + productName
+ "' is invalid for the current HostId");
}
}
/**
* Uninstall the license corresponding to the product name.
*
* @param productName
* the product name
*/
public void uninstallLicense(String productName)
{
licenseMap.remove(productName);
}
/**
* Return the ILicense for the specified product
*
* @param productName
* the product name
* @return the ILicense if installed, otherwise null
*/
public ILicense getLicense(String productName)
{
return _getLicenseDef(productName);
}
/**
* Return the available licenses
*
* @return an array of available licenses, never null
*/
public ILicense[] getLicenses()
{
return licenseMap.values().toArray(new LicenseDef[0]);
}
/**
* Return the LicenseDef for the specified product
*
* @param productName
* the product name
* @return the LicenseDef if installed, otherwise null
*/
private LicenseDef _getLicenseDef(String productName)
{
return licenseMap.get(productName);
}
/**
* Return the product corresponding to the product name.
*
* @param productName
* the product name
* @return the product corresponding to the product name or null if no license installed for the product name
*/
public IProduct getLicenseProduct(String productName)
{
LicenseDef license = _getLicenseDef(productName);
IProduct product = null;
if (license != null)
{
product = license.getProduct();
}
return product;
}
/**
* Return the value of a module parameter corresponding to the product name.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @param parameter
* the parameter name
* @return the value of the parameter otherwise null
*/
public String getModuleParameterValue(String productName, String moduleName, String parameter)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _getModuleParameterValue(licenseDef, moduleName, parameter);
}
/**
* Return the value of a module parameter corresponding to the license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @param parameter
* the parameter name
* @return the value of the parameter otherwise null
*/
private String _getModuleParameterValue(LicenseDef licenseDef, String moduleName, String parameter)
{
String value = null;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
value = licenseDef.getParamValue(moduleName, parameter);
}
return value;
}
/**
* Get the expiration date for a given module of a given product name.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return the expiration date, otherwise null
*/
public ExpDate getModuleExpDate(String productName, String moduleName)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _getModuleExpDate(licenseDef, moduleName);
}
/**
* Get the expiration date for a given module of a given license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @return the expiration date, otherwise null
*/
private ExpDate _getModuleExpDate(LicenseDef licenseDef, String moduleName)
{
ExpDate expDate = null;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
expDate = licenseDef.getExpDate(moduleName);
}
return expDate;
}
/**
* Check the permission for a given module of a given product name.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return the permission
*/
public Permission getModulePermission(String productName, String moduleName)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _getModulePermission(licenseDef, moduleName);
}
/**
* Check the permission for a given module of a given license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @return the permission
*/
private Permission _getModulePermission(LicenseDef licenseDef, String moduleName)
{
Permission perm = Permission.NO;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
// Get the permission
perm = licenseDef.getMode(moduleName);
}
return perm;
}
/**
* Check if the module is expired for a given license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @return true if the module is expired, otherwise false
*/
public boolean moduleIsExpired(String productName, String moduleName)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _moduleIsExpired(licenseDef, moduleName);
}
/**
* Check if the module is expired for a given license.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return true if the module is expired, otherwise false
*/
private boolean _moduleIsExpired(LicenseDef licenseDef, String moduleName)
{
boolean res = false;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
ExpDate expDate = licenseDef.getExpDate(moduleName);
if (expDate != null)
{
res = expDate.expired();
}
}
return res;
}
/**
* Check if the specified module exists for the given product.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return true if the module is expired, otherwise false
*/
public boolean checkModuleExist(String productName, String moduleName)
{
boolean res = false;
LicenseDef licenseDef = _getLicenseDef(productName);
if (licenseDef != null)
{
try
{
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
res = true;
}
catch (Exception e)
{
res = false;
}
}
return res;
}
/**
* Check the validity of the given module for a given license
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @throws IllegalArgumentException
* if the module does not exist for the product
*/
private void _checkModuleValidity(LicenseDef licenseDef, String moduleName)
{
if (licenseDef != null)
{
int moduleIndex = licenseDef.getModuleIndex(moduleName);
int moduleCount = licenseDef._getModuleCount();
if (moduleIndex < 0 || moduleIndex >= moduleCount)
{
throw new IllegalArgumentException(moduleName + " is not a module of the product "
+ licenseDef.getProduct().getName());
}
}
}
/**
* Compare two versions
*
* @param version1
* the first version
* @param version2
* the second version
* @return a value <code>0</code> if equals, <br>
* a value less than <code>0</code> if the first version is less than the second version<br>
* a value greater than <code>0</code> if the first version is greater than the second version<br>
*/
public static int compareVersion(String version1, String version2)
{
return compareVersion(version1, version2, -1);
}
/**
* Compare two versions
*
* @param version1
* the first version
* @param version2
* the second version
* @param depthToCheck
* the depth of the version to check. A value less than <code>0</code> to check the whole version
* @return a value <code>0</code> if equals, <br>
* a value less than <code>0</code> if the first version is less than the second version<br>
* a value greater than <code>0</code> if the first version is greater than the second version<br>
*/
public static int compareVersion(String version1, String version2, int depthToCheck)
{
int res = 0;
if (version1 == version2)
{
res = 0;
}
else if (version1 == null)
{
res = -1;
}
else if (version2 == null)
{
res = 1;
}
else
{
String[] versionStr1 = version1.split("\\.");
String[] versionStr2 = version2.split("\\.");
if (depthToCheck >= 0)
{
if (versionStr1.length > depthToCheck)
{
String[] copyVersionStr = new String[depthToCheck];
System.arraycopy(versionStr1, 0, copyVersionStr, 0, depthToCheck);
versionStr1 = copyVersionStr;
}
if (versionStr2.length > depthToCheck)
{
String[] copyVersionStr = new String[depthToCheck];
System.arraycopy(versionStr2, 0, copyVersionStr, 0, depthToCheck);
versionStr2 = copyVersionStr;
}
}
for (int i = 0; i < versionStr1.length && res == 0; i++)
{
String v1 = versionStr1[i];
if (i < versionStr2.length)
{
String v2 = versionStr2[i];
res = v1.compareTo(v2);
}
else
{
res = 1;
}
}
if (res == 0)
{
if (versionStr1.length < versionStr2.length)
{
res = -1;
}
}
}
return res;
}
} | UTF-8 | Java | 23,099 | java | LicenseHandler.java | Java | [] | null | [] | package eu.cessar.ct.core.security.license;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class LicenseHandler
{
/** Singleton */
private static LicenseHandler __instance = null;
/** License folder */
private static File _licenseFolder = null;
/** License map */
private Map<String, LicenseDef> licenseMap = null;
/**
* Return the local full host ID
*
* @return the local full host ID
*/
public static String getLocalFullHostID()
{
return HostID.getFullID();
}
/**
* Return the singleton
*
* @return the singleton
*/
public static LicenseHandler getInstance()
{
if (__instance == null)
{
__instance = new LicenseHandler();
}
return __instance;
}
/**
* Default constructor
*/
public LicenseHandler()
{
licenseMap = new HashMap<String, LicenseDef>();
}
/**
* Get the license folder
*
* @return the license folder
*/
public File getLicenseFolder()
{
return _licenseFolder;
}
/**
* Set the license folder. When the license folder is set, all license files present in that folder will be read.
* Any license already processed from other folder will be discarded.
*
* @param folder
* the license folder
* @throws InvalidLicenseException
*/
public void setLicenseFolder(File folder)
{
licenseMap.clear();
_licenseFolder = folder;
_readAllLicenses();
}
/**
* Search and install a license corresponding to a product in the license folder
*
* @param productName
* the product name
* @throws InvalidLicenseException
* if no valid license found
*/
public void installLicenseInFolder(String productName) throws InvalidLicenseException
{
_installLicenseInFolder(_licenseFolder, productName);
}
/**
* Search and install a license corresponding to a product in the specified folder
*
* @param folder
* the folder where to search the license
* @param productName
* the product name
* @throws InvalidLicenseException
* if no valid license found
*/
private void _installLicenseInFolder(File folder, String productName) throws InvalidLicenseException
{
if (folder == null)
{
throw new IllegalArgumentException("folder is null");
}
if (folder != null && folder.exists() && !folder.isDirectory())
{
throw new IllegalArgumentException(folder + " is not a directory");
}
// Find the license file
File licenseFile = _findLicenseInFolder(folder, productName);
if (licenseFile == null)
{
// No license found
throw new InvalidLicenseException("No license found for the product " + productName);
}
// Install the license for the product
_installLicense(productName, licenseFile);
}
/**
* Find a license file corresponding to a product in the specified folder
*
* @param folder
* the folder where to search the license
* @param productName
* the product name
* @return the license file, <code>null</code> if none
*/
private File _findLicenseInFolder(File folder, String productName)
{
File licFile = null;
if (folder != null && folder.isDirectory() && folder.exists())
{
// Get the default license file name
String lfName = LicenseDef._createDefaultLicenseFileName(productName);
if (lfName != null)
{
// Parse folder and search the license file corresponding to the product
File[] files = folder.listFiles();
for (int i = 0; i < files.length && licFile == null; i++)
{
File file = files[i];
if (lfName.equals(file.getName()))
{
licFile = file;
}
}
}
}
return licFile;
}
/**
* Find all license files in the specified folder
*
* @param folder
* the folder where to search the license
* @return the license files, newer null
*/
private File[] _findAllLicensesInFolder(File folder)
{
List<File> licFiles = new ArrayList<File>();
if (folder != null && folder.isDirectory() && folder.exists())
{
// Parse folder and search the license file corresponding to the product
File[] files = folder.listFiles();
for (int i = 0; i < files.length; i++)
{
File file = files[i];
if (file.getName().endsWith(ILicense.LICENSE_FILE_EXT))
{
licFiles.add(file);
}
}
}
return licFiles.toArray(new File[licFiles.size()]);
}
/**
* Check if a license corresponding to a product exists in the specified folder. Please note that the productName
* might be null and in this case the method will return true if there is at lease on license file inside
*
* @param folder
* the folder where to search the license
* @param productName
* the product name, might be null
* @return true if a license exist, otherwise false
*/
public boolean checkIfLicenseExistInFolder(File folder, String productName)
{
if (productName != null)
{
return _findLicenseInFolder(folder, productName) != null;
}
else
{
return _findAllLicensesInFolder(folder).length > 0;
}
}
/**
* Install license for a product in the license folder
*
* @param productName
* the product name, might be null and in this case the informations from licFile should be used
* @param licFile
* the file of the license to install
* @throws InvalidLicenseException
* if the license is invalid for the product
*/
public void installLicense(String productName, File licFile) throws InvalidLicenseException
{
findLicenseFolder();
_installLicense(_licenseFolder, productName, licFile);
}
public File findLicenseFolder()
{
String cessarLicFolderStr = System.getProperty(CessarOldLicenseHandler.CESSAR_LICENSE_FOLDER);
if (cessarLicFolderStr != null)
{
_licenseFolder = new File(cessarLicFolderStr);
if (!_licenseFolder.exists())
{
cessarLicFolderStr = System.getenv("ALLUSERSPROFILE")
+ "\\Application Data\\Conti Engineering\\CESSAR-CT\\";
_licenseFolder = new File(cessarLicFolderStr);
}
}
else
{
cessarLicFolderStr = System.getenv("ALLUSERSPROFILE")
+ "\\Application Data\\Conti Engineering\\CESSAR-CT\\";
_licenseFolder = new File(cessarLicFolderStr);
}
_licenseFolder = new File(cessarLicFolderStr);
return _licenseFolder;
}
/**
* Install license for a product in the specified folder
*
* @param folder
* the folder where to install the license
* @param productName
* the product name, might be null and in this case the informations from licFile should be used
* @param licFile
* the file of the license to install
* @throws InvalidLicenseException
* if the license is invalid for the product
*/
private void _installLicense(File folder, String productName, File licFile) throws InvalidLicenseException
{
if (folder != null && folder.exists() && !folder.isDirectory())
{
throw new IllegalArgumentException(folder + " is not a directory");
}
if (licFile == null)
{
throw new IllegalArgumentException("License file to install is null");
}
// Get current license for this productName
LicenseDef currentLicenseDef = null;
if (productName != null)
{
currentLicenseDef = _getLicenseDef(productName);
}
// Install the license for the product
LicenseDef newLicense = _installLicense(productName, licFile);
try
{
// Get the default license file name
String lfName = LicenseDef._createDefaultLicenseFileName(newLicense.getProduct().getName());
// Create folder if needed
if (folder != null)
{
folder.mkdirs();
}
// Copy
copyLicenseFile(licFile, new File(folder, lfName));
}
catch (IOException e)
{
// Keeping the current license
if (currentLicenseDef != null)
{
licenseMap.put(productName, currentLicenseDef);
}
throw new InvalidLicenseException("Error during the copy of the license file into " + folder.getPath()
+ " directory");
}
}
/**
* Copy <code>srcFile</code> to <code>destFile</code>
*
* @param srcFile
* the source file
* @param destFile
* the destination file
* @throws IOException
* if error during the copy
*/
public void copyLicenseFile(File srcFile, File destFile) throws IOException
{
FileInputStream fis = new FileInputStream(srcFile);
if (!destFile.canWrite())
{
destFile.setWritable(true);
}
FileOutputStream fos = new FileOutputStream(destFile);
try
{
FileChannel channelSrc = fis.getChannel();
FileChannel channelDest = fos.getChannel();
channelSrc.transferTo(0, channelSrc.size(), channelDest);
}
finally
{
try
{
fis.close();
}
catch (Exception e)
{}
try
{
fos.close();
}
catch (Exception e)
{}
}
}
/**
* Install license for a product
*
* @param productName
* the product name, if null the informations from licFile should be used.
* @param licFile
* the file of the license to install
* @return the installed license
* @throws InvalidLicenseException
* if the license is invalid for the product
*/
private LicenseDef _installLicense(String productName, File licFile) throws InvalidLicenseException
{
// Read and check license
LicenseDef license = _readLicenseDef(productName, licFile, false);
if (productName == null)
{
productName = license.getProduct().getName();
}
// License is valid
licenseMap.put(productName, license);
return license;
}
/**
* Read and install all license available under the current licenseFolder
*
* @throws InvalidLicenseException
*/
private void _readAllLicenses()
{
File[] licFiles = _findAllLicensesInFolder(_licenseFolder);
for (File licFile: licFiles)
{
String productName = licFile.getName();
// remove the extension from productName
productName = productName.substring(0, productName.length() - ILicense.LICENSE_FILE_EXT.length());
try
{
_installLicense(productName, licFile);
}
catch (InvalidLicenseException e)
{
// just report the error and skip this entry
InvalidLicenseException licexc = new InvalidLicenseException("Old license model not installed");
licexc.initCause(e);
// CessarPluginActivator.logWarning(licexc);
}
}
}
/**
* Read a license model for a given product
*
* @param productName
* the product name
* @param file
* the license model file to read
* @return the license model
* @throws InvalidLicenseException
* if error during the reading
*/
public LicenseDef readLicenseModel(String productName, File file) throws InvalidLicenseException
{
// Read and check license model
return _readLicenseDef(productName, file, true);
}
/**
* Read a license model for a given product
*
* @param productName
* the product name
* @param is
* the license model input stream to read
* @return the license model
* @throws InvalidLicenseException
* if error during the reading
*/
public LicenseDef readLicenseModel(String productName, InputStream is) throws InvalidLicenseException
{
// Read and check license model
return _readLicenseDef(productName, is, true);
}
/**
* Read a license for a given product
*
* @param productName
* the product name
* @param file
* the file to read
* @param modelFile
* true if the file is a license model file, otherwise false
* @return the license
* @throws InvalidLicenseException
* if error during the reading
*/
private LicenseDef _readLicenseDef(String productName, File file, boolean modelFile) throws InvalidLicenseException
{
LicenseDef license = null;
try
{
// Read the license
license = _readLicenseDef(productName, new FileInputStream(file), modelFile);
}
catch (IOException e)
{
throw new InvalidLicenseException(file + " doest not exist", e);
}
return license;
}
/**
* Read a license for a given product. If <code>modelFile</code> is <code>true</code>, the method returns a license
* model.
*
* @param productName
* the product name, can be null
* @param is
* the input stream to read
* @param modelFile
* true if the file is a license model file, otherwise false
* @return the license
* @throws InvalidLicenseException
* if error during the reading
*/
private LicenseDef _readLicenseDef(String productName, InputStream is, boolean modelFile)
throws InvalidLicenseException
{
LicenseDef license = null;
try
{
// Read license for the product
license = new LicenseDef(is, !modelFile);
// Check the license
_checkLicense(productName, license);
}
catch (InvalidLicenseException e)
{
throw e;
}
catch (Exception e)
{
throw new InvalidLicenseException("The license is invalid for the product " + productName + " [Cause : + "
+ e.getMessage() + "]", e);
}
return license;
}
/**
* Check the license
*
* @param license
* the license
* @throws InvalidLicenseException
* if the license is invalid
*/
private void _checkLicense(String productName, LicenseDef license) throws InvalidLicenseException
{
// Product name control
if (productName != null && !productName.equals(license.getProduct().getName()))
{
throw new InvalidLicenseException("The license is invalid for the product " + productName);
}
// HostId Control.
// Retrieve local host id based on the license file host id type :
// New : BIOS ID
// Old : Mac Address
// Linux : always Mac Address
int locHostID = license.isNewLicenseType() ? HostID.obtainHostID() : HostID.obtainOldHostID();
int licHostID = license.getHostID();
boolean hostIDBinded = license.getLicenseInfo().isHostIDBinded();
// Check Host ID if needed
if (licHostID != 0 && (licHostID != locHostID && hostIDBinded))
{
throw new InvalidLicenseException("The license for the product '" + productName
+ "' is invalid for the current HostId");
}
}
/**
* Uninstall the license corresponding to the product name.
*
* @param productName
* the product name
*/
public void uninstallLicense(String productName)
{
licenseMap.remove(productName);
}
/**
* Return the ILicense for the specified product
*
* @param productName
* the product name
* @return the ILicense if installed, otherwise null
*/
public ILicense getLicense(String productName)
{
return _getLicenseDef(productName);
}
/**
* Return the available licenses
*
* @return an array of available licenses, never null
*/
public ILicense[] getLicenses()
{
return licenseMap.values().toArray(new LicenseDef[0]);
}
/**
* Return the LicenseDef for the specified product
*
* @param productName
* the product name
* @return the LicenseDef if installed, otherwise null
*/
private LicenseDef _getLicenseDef(String productName)
{
return licenseMap.get(productName);
}
/**
* Return the product corresponding to the product name.
*
* @param productName
* the product name
* @return the product corresponding to the product name or null if no license installed for the product name
*/
public IProduct getLicenseProduct(String productName)
{
LicenseDef license = _getLicenseDef(productName);
IProduct product = null;
if (license != null)
{
product = license.getProduct();
}
return product;
}
/**
* Return the value of a module parameter corresponding to the product name.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @param parameter
* the parameter name
* @return the value of the parameter otherwise null
*/
public String getModuleParameterValue(String productName, String moduleName, String parameter)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _getModuleParameterValue(licenseDef, moduleName, parameter);
}
/**
* Return the value of a module parameter corresponding to the license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @param parameter
* the parameter name
* @return the value of the parameter otherwise null
*/
private String _getModuleParameterValue(LicenseDef licenseDef, String moduleName, String parameter)
{
String value = null;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
value = licenseDef.getParamValue(moduleName, parameter);
}
return value;
}
/**
* Get the expiration date for a given module of a given product name.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return the expiration date, otherwise null
*/
public ExpDate getModuleExpDate(String productName, String moduleName)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _getModuleExpDate(licenseDef, moduleName);
}
/**
* Get the expiration date for a given module of a given license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @return the expiration date, otherwise null
*/
private ExpDate _getModuleExpDate(LicenseDef licenseDef, String moduleName)
{
ExpDate expDate = null;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
expDate = licenseDef.getExpDate(moduleName);
}
return expDate;
}
/**
* Check the permission for a given module of a given product name.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return the permission
*/
public Permission getModulePermission(String productName, String moduleName)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _getModulePermission(licenseDef, moduleName);
}
/**
* Check the permission for a given module of a given license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @return the permission
*/
private Permission _getModulePermission(LicenseDef licenseDef, String moduleName)
{
Permission perm = Permission.NO;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
// Get the permission
perm = licenseDef.getMode(moduleName);
}
return perm;
}
/**
* Check if the module is expired for a given license.
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @return true if the module is expired, otherwise false
*/
public boolean moduleIsExpired(String productName, String moduleName)
{
LicenseDef licenseDef = _getLicenseDef(productName);
return _moduleIsExpired(licenseDef, moduleName);
}
/**
* Check if the module is expired for a given license.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return true if the module is expired, otherwise false
*/
private boolean _moduleIsExpired(LicenseDef licenseDef, String moduleName)
{
boolean res = false;
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
if (licenseDef != null)
{
ExpDate expDate = licenseDef.getExpDate(moduleName);
if (expDate != null)
{
res = expDate.expired();
}
}
return res;
}
/**
* Check if the specified module exists for the given product.
*
* @param productName
* the product name
* @param moduleName
* the module name
* @return true if the module is expired, otherwise false
*/
public boolean checkModuleExist(String productName, String moduleName)
{
boolean res = false;
LicenseDef licenseDef = _getLicenseDef(productName);
if (licenseDef != null)
{
try
{
// Check module validity
_checkModuleValidity(licenseDef, moduleName);
res = true;
}
catch (Exception e)
{
res = false;
}
}
return res;
}
/**
* Check the validity of the given module for a given license
*
* @param licenseDef
* the license
* @param moduleName
* the module name
* @throws IllegalArgumentException
* if the module does not exist for the product
*/
private void _checkModuleValidity(LicenseDef licenseDef, String moduleName)
{
if (licenseDef != null)
{
int moduleIndex = licenseDef.getModuleIndex(moduleName);
int moduleCount = licenseDef._getModuleCount();
if (moduleIndex < 0 || moduleIndex >= moduleCount)
{
throw new IllegalArgumentException(moduleName + " is not a module of the product "
+ licenseDef.getProduct().getName());
}
}
}
/**
* Compare two versions
*
* @param version1
* the first version
* @param version2
* the second version
* @return a value <code>0</code> if equals, <br>
* a value less than <code>0</code> if the first version is less than the second version<br>
* a value greater than <code>0</code> if the first version is greater than the second version<br>
*/
public static int compareVersion(String version1, String version2)
{
return compareVersion(version1, version2, -1);
}
/**
* Compare two versions
*
* @param version1
* the first version
* @param version2
* the second version
* @param depthToCheck
* the depth of the version to check. A value less than <code>0</code> to check the whole version
* @return a value <code>0</code> if equals, <br>
* a value less than <code>0</code> if the first version is less than the second version<br>
* a value greater than <code>0</code> if the first version is greater than the second version<br>
*/
public static int compareVersion(String version1, String version2, int depthToCheck)
{
int res = 0;
if (version1 == version2)
{
res = 0;
}
else if (version1 == null)
{
res = -1;
}
else if (version2 == null)
{
res = 1;
}
else
{
String[] versionStr1 = version1.split("\\.");
String[] versionStr2 = version2.split("\\.");
if (depthToCheck >= 0)
{
if (versionStr1.length > depthToCheck)
{
String[] copyVersionStr = new String[depthToCheck];
System.arraycopy(versionStr1, 0, copyVersionStr, 0, depthToCheck);
versionStr1 = copyVersionStr;
}
if (versionStr2.length > depthToCheck)
{
String[] copyVersionStr = new String[depthToCheck];
System.arraycopy(versionStr2, 0, copyVersionStr, 0, depthToCheck);
versionStr2 = copyVersionStr;
}
}
for (int i = 0; i < versionStr1.length && res == 0; i++)
{
String v1 = versionStr1[i];
if (i < versionStr2.length)
{
String v2 = versionStr2[i];
res = v1.compareTo(v2);
}
else
{
res = 1;
}
}
if (res == 0)
{
if (versionStr1.length < versionStr2.length)
{
res = -1;
}
}
}
return res;
}
} | 23,099 | 0.674445 | 0.671674 | 945 | 23.444445 | 25.923643 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.819048 | false | false | 12 |
c7d07e891be4efa357e3e0506d1154fd4e5558ce | 31,018,253,862,279 | c62a8041a1e7d967edc1d3bb31e06ba66dea1ce1 | /src/main/java/hibernate/TestHibernate.java | 91787efcbf88ea24fa586842d1061c057e8e302e | [] | no_license | yantasheiko/HibernateExample | https://github.com/yantasheiko/HibernateExample | 5988a4441cbecfaadcbafae7eed1657558ca7133 | 2fb29a544c3694f7ff747e04bef0f3841df0d545 | refs/heads/master | 2020-03-19T06:35:34.794000 | 2018-06-04T19:24:05 | 2018-06-04T19:24:05 | 136,036,412 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hibernate;
import hibernate.*;
import org.hibernate.Session;
public class TestHibernate {
public static void main(String[] args) {
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
CarEntity car = new CarEntity();
car.setCarName("audi");
car.setCarModel("rs7");
session.save(car);
session.getTransaction().commit();
HibernateUtil.shutdown();
}
} | UTF-8 | Java | 496 | java | TestHibernate.java | Java | [
{
"context": "y car = new CarEntity(); \n car.setCarName(\"audi\"); \n car.setCarModel(\"rs7\"); \n \n se",
"end": 338,
"score": 0.9995797276496887,
"start": 334,
"tag": "NAME",
"value": "audi"
}
] | null | [] | package hibernate;
import hibernate.*;
import org.hibernate.Session;
public class TestHibernate {
public static void main(String[] args) {
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
CarEntity car = new CarEntity();
car.setCarName("audi");
car.setCarModel("rs7");
session.save(car);
session.getTransaction().commit();
HibernateUtil.shutdown();
}
} | 496 | 0.620968 | 0.618952 | 21 | 22.619047 | 19.592215 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false | 12 |
5e4ca7fc1e463798365671c0dbe62d74685b01f0 | 22,840,636,112,629 | 75328dc614c9c070ac74165677e1ebb473c16c7f | /app/src/main/java/com/example/mz23zx/deltaerpddrapk/ConduitPicklistQuantityActivity.java | a7e8b3a91c7c951e0e575ff8edf7f4a0b4d1d0ff | [] | no_license | c-aguilar/doaproyecto | https://github.com/c-aguilar/doaproyecto | 8372dea0aeb781b5ae95515b610fbdba4359ed05 | 9dc69f07e041a703612a86389e47fa6fb4070388 | refs/heads/main | 2023-08-15T13:55:58.560000 | 2021-09-18T05:57:22 | 2021-09-18T05:57:22 | 407,746,468 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.mz23zx.deltaerpddrapk;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class ConduitPicklistQuantityActivity extends AppCompatActivity {
Button q5_btn,q10_btn,q20_btn,q30_btn,q50_btn,q70_btn,q100_btn,q150_btn,q200_btn;
Button cancel_btn,confirm_btn;
EditText quantity_txt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_conduit_picklist_quantity);
q5_btn = (Button) findViewById(R.id.q5_btn);
q10_btn = (Button) findViewById(R.id.q10_btn);
q20_btn = (Button) findViewById(R.id.q20_btn);
q30_btn = (Button) findViewById(R.id.q30_btn);
q50_btn = (Button) findViewById(R.id.q50_btn);
q70_btn = (Button) findViewById(R.id.q70_btn);
q100_btn = (Button) findViewById(R.id.q100_btn);
q150_btn = (Button) findViewById(R.id.q150_btn);
q200_btn = (Button) findViewById(R.id.q200_btn);
cancel_btn = (Button) findViewById(R.id.cancel_btn);
confirm_btn = (Button) findViewById(R.id.ok_btn);
quantity_txt = (EditText) findViewById(R.id.quantity_txt);
q5_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(5);
}
});
q10_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(10);
}
});
q20_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(20);
}
});
q30_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(30);
}
});
q50_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(50);
}
});
q70_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(70);
}
});
q100_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(100);
}
});
q150_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(150);
}
});
q200_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(200);
}
});
cancel_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.putExtra("quantity", -1);
setResult(RESULT_CANCELED, intent);
finish();
}
});
confirm_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Integer quantity = -1;
if (GlobalFunctions.IsNumeric(quantity_txt.getText().toString()) == true) {
quantity = Integer.parseInt(quantity_txt.getText().toString());
if (quantity <= 200)
{
ReturnQuantity(quantity);
}
else
{
quantity_txt.setText("");
quantity_txt.requestFocus();
GlobalFunctions.PopUp("Error", "La cantidad no puede ser mayor a 200.", ConduitPicklistQuantityActivity.this);
}
}
else{
quantity_txt.setText("");
quantity_txt.requestFocus();
GlobalFunctions.PopUp("Error", "Cantidad incorrecta.", ConduitPicklistQuantityActivity.this);
}
}
});
}
private void ReturnQuantity(Integer quantity)
{
Intent intent = new Intent();
intent.putExtra("quantity", quantity);
setResult(RESULT_OK, intent);
finish();
}
} | UTF-8 | Java | 4,709 | java | ConduitPicklistQuantityActivity.java | Java | [
{
"context": "package com.example.mz23zx.deltaerpddrapk;\n\nimport android.content.Intent;\ni",
"end": 26,
"score": 0.9469634294509888,
"start": 20,
"tag": "USERNAME",
"value": "mz23zx"
}
] | null | [] | package com.example.mz23zx.deltaerpddrapk;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class ConduitPicklistQuantityActivity extends AppCompatActivity {
Button q5_btn,q10_btn,q20_btn,q30_btn,q50_btn,q70_btn,q100_btn,q150_btn,q200_btn;
Button cancel_btn,confirm_btn;
EditText quantity_txt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_conduit_picklist_quantity);
q5_btn = (Button) findViewById(R.id.q5_btn);
q10_btn = (Button) findViewById(R.id.q10_btn);
q20_btn = (Button) findViewById(R.id.q20_btn);
q30_btn = (Button) findViewById(R.id.q30_btn);
q50_btn = (Button) findViewById(R.id.q50_btn);
q70_btn = (Button) findViewById(R.id.q70_btn);
q100_btn = (Button) findViewById(R.id.q100_btn);
q150_btn = (Button) findViewById(R.id.q150_btn);
q200_btn = (Button) findViewById(R.id.q200_btn);
cancel_btn = (Button) findViewById(R.id.cancel_btn);
confirm_btn = (Button) findViewById(R.id.ok_btn);
quantity_txt = (EditText) findViewById(R.id.quantity_txt);
q5_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(5);
}
});
q10_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(10);
}
});
q20_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(20);
}
});
q30_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(30);
}
});
q50_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(50);
}
});
q70_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(70);
}
});
q100_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(100);
}
});
q150_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(150);
}
});
q200_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ReturnQuantity(200);
}
});
cancel_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.putExtra("quantity", -1);
setResult(RESULT_CANCELED, intent);
finish();
}
});
confirm_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Integer quantity = -1;
if (GlobalFunctions.IsNumeric(quantity_txt.getText().toString()) == true) {
quantity = Integer.parseInt(quantity_txt.getText().toString());
if (quantity <= 200)
{
ReturnQuantity(quantity);
}
else
{
quantity_txt.setText("");
quantity_txt.requestFocus();
GlobalFunctions.PopUp("Error", "La cantidad no puede ser mayor a 200.", ConduitPicklistQuantityActivity.this);
}
}
else{
quantity_txt.setText("");
quantity_txt.requestFocus();
GlobalFunctions.PopUp("Error", "Cantidad incorrecta.", ConduitPicklistQuantityActivity.this);
}
}
});
}
private void ReturnQuantity(Integer quantity)
{
Intent intent = new Intent();
intent.putExtra("quantity", quantity);
setResult(RESULT_OK, intent);
finish();
}
} | 4,709 | 0.544489 | 0.520917 | 136 | 33.632355 | 24.365118 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.573529 | false | false | 12 |
6502f0cf43e7dfb7e33f42c6b1be5356097ffd12 | 609,885,362,740 | 1857e5248a96a5a739bc4a65b4b29961489cba45 | /java/com/restaurante/harley/model/ProductInfo.java | b19efb3c363be6987bd33c805bd2f864931d020d | [] | no_license | wallano/adminappedido | https://github.com/wallano/adminappedido | ee58bdc5f771ff640f4d470d31bc2714e04a0fca | 8cab9a7d8c38487030cff2b6f2d812c2754cc76f | refs/heads/master | 2020-06-16T16:31:51.378000 | 2017-06-12T23:38:55 | 2017-06-12T23:38:55 | 94,149,573 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.restaurante.harley.model;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.restaurante.harley.entity.Product;
public class ProductInfo {
private String code;
private String name;
private double price;
private double cost;
private double iva;
private double ipoconsumo;
private String description;
private int unidades_Disponibles;
private String code_Categorie;
private String path;
private boolean newProduct=false;
private CommonsMultipartFile fileData;
public ProductInfo() {
}
public ProductInfo(Product product) {
this.code = product.getCode();
this.name = product.getName();
this.price = product.getPrice();
this.cost = product.getCost();
this.iva = product.getIva();
this.ipoconsumo = product.getIpoconsumo();
this.description = product.getDescription();
this.unidades_Disponibles = product.getUnidades_Disponibles();
this.code_Categorie = product.getCode_Categorie();
this.path = product.getPath();
}
public ProductInfo(String code, String name, double price, double cost,
double iva, double ipoconsumo, String description, int unidades_Disponibles,
String code_Categorie, String path) {
this.code = code;
this.name = name;
this.price = price;
this.cost = cost;
this.iva = iva;
this.ipoconsumo = ipoconsumo;
this.description = description;
this.unidades_Disponibles = unidades_Disponibles;
this.code_Categorie = code_Categorie;
this.path = path;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public double getIva() {
return iva;
}
public void setIva(double iva) {
this.iva = iva;
}
public double getIpoconsumo() {
return ipoconsumo;
}
public void setIpoconsumo(double ipoconsumo) {
this.ipoconsumo = ipoconsumo;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getUnidades_Disponibles() {
return unidades_Disponibles;
}
public void setUnidades_Disponibles(int unidades_Disponibles) {
this.unidades_Disponibles = unidades_Disponibles;
}
public String getCode_Categorie() {
return code_Categorie;
}
public void setCode_Categorie(String code_Categorie) {
this.code_Categorie = code_Categorie;
}
public CommonsMultipartFile getFileData() {
return fileData;
}
public void setFileData(CommonsMultipartFile fileData) {
this.fileData = fileData;
}
public boolean isNewProduct() {
return newProduct;
}
public void setNewProduct(boolean newProduct) {
this.newProduct = newProduct;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
| UTF-8 | Java | 3,546 | java | ProductInfo.java | Java | [] | null | [] | package com.restaurante.harley.model;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.restaurante.harley.entity.Product;
public class ProductInfo {
private String code;
private String name;
private double price;
private double cost;
private double iva;
private double ipoconsumo;
private String description;
private int unidades_Disponibles;
private String code_Categorie;
private String path;
private boolean newProduct=false;
private CommonsMultipartFile fileData;
public ProductInfo() {
}
public ProductInfo(Product product) {
this.code = product.getCode();
this.name = product.getName();
this.price = product.getPrice();
this.cost = product.getCost();
this.iva = product.getIva();
this.ipoconsumo = product.getIpoconsumo();
this.description = product.getDescription();
this.unidades_Disponibles = product.getUnidades_Disponibles();
this.code_Categorie = product.getCode_Categorie();
this.path = product.getPath();
}
public ProductInfo(String code, String name, double price, double cost,
double iva, double ipoconsumo, String description, int unidades_Disponibles,
String code_Categorie, String path) {
this.code = code;
this.name = name;
this.price = price;
this.cost = cost;
this.iva = iva;
this.ipoconsumo = ipoconsumo;
this.description = description;
this.unidades_Disponibles = unidades_Disponibles;
this.code_Categorie = code_Categorie;
this.path = path;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public double getIva() {
return iva;
}
public void setIva(double iva) {
this.iva = iva;
}
public double getIpoconsumo() {
return ipoconsumo;
}
public void setIpoconsumo(double ipoconsumo) {
this.ipoconsumo = ipoconsumo;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getUnidades_Disponibles() {
return unidades_Disponibles;
}
public void setUnidades_Disponibles(int unidades_Disponibles) {
this.unidades_Disponibles = unidades_Disponibles;
}
public String getCode_Categorie() {
return code_Categorie;
}
public void setCode_Categorie(String code_Categorie) {
this.code_Categorie = code_Categorie;
}
public CommonsMultipartFile getFileData() {
return fileData;
}
public void setFileData(CommonsMultipartFile fileData) {
this.fileData = fileData;
}
public boolean isNewProduct() {
return newProduct;
}
public void setNewProduct(boolean newProduct) {
this.newProduct = newProduct;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
| 3,546 | 0.629442 | 0.629442 | 153 | 21.17647 | 19.474844 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.856209 | false | false | 7 |
60c152c0343e81013cc9678d74121b0292f85035 | 12,197,707,183,853 | 4f50811352215515638ae650e1f6eb0dec1b6d20 | /MoveTheCircle2.java | 20147b066a4a5386ffec6d7885746978fcfe7a10 | [] | no_license | Ricecrispi/MoveTheCircle | https://github.com/Ricecrispi/MoveTheCircle | 5b914ddee513dfa42bf597e0fa87750606836196 | ef74ddf19296caa2048a40c8f56fe9bec6649c4e | refs/heads/master | 2016-09-08T00:21:18.902000 | 2013-08-02T02:44:23 | 2013-08-02T02:44:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.Timer;
import javax.swing.JPanel;
import java.awt.event.KeyListener;
import java.applet.*;
//program description: moves a circle around a scren
//arrow keys to moves around screen, space bar to stop moving
public class MoveTheCircle2{
/**
*
*/
private static final long serialVersionUID = 1L;
public MoveTheCircle2 () {
JFrame f = new JFrame ();
f.setSize(500, 500);
f.setResizable (false);
f.add (new DrawCircle());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
public class DrawCircle extends JPanel implements KeyListener, ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
int x = 100;
int y = 100;
int dx = 0;
int dy = 0;
Timer t = new Timer (1, this);
public DrawCircle (){
t.start ();
setBackground(Color.BLACK);
setFocusTraversalKeysEnabled(false);
addKeyListener(this);
setFocusable (true);
}
public void paintComponent (Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
super.paintComponent(g);
g.setColor(Color.WHITE);
g.fillOval(x, y, 50, 50);
}
public void actionPerformed(ActionEvent e) {
if (x + dx <= 0){
x = 500;
}
if (x + dx >= 500){
x = 0;
}
if (y + dy <= 0){
y = 478;
}
if (y + dy >= 478){
y = 0;
}
x +=dx;
y +=dy;
repaint();
}
//set movement
public void keyPressed(KeyEvent e) {
int event = e.getKeyCode();
if (event == KeyEvent.VK_RIGHT){
dx = 1;
dy = 0;
}
if (event == KeyEvent.VK_LEFT){
dx = -1;
dy = 0;
}
if (event == KeyEvent.VK_DOWN){
dx = 0;
dy = 1;
}
if (event == KeyEvent.VK_UP){
dx = 0;
dy = -1;
}
if (event == KeyEvent.VK_SPACE){
dx = 0;
dy = 0;
}
}
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
}
public static void main(String[] args) {
new MoveTheCircle2 ();
}
}
| UTF-8 | Java | 2,414 | java | MoveTheCircle2.java | Java | [] | null | [] | import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.Timer;
import javax.swing.JPanel;
import java.awt.event.KeyListener;
import java.applet.*;
//program description: moves a circle around a scren
//arrow keys to moves around screen, space bar to stop moving
public class MoveTheCircle2{
/**
*
*/
private static final long serialVersionUID = 1L;
public MoveTheCircle2 () {
JFrame f = new JFrame ();
f.setSize(500, 500);
f.setResizable (false);
f.add (new DrawCircle());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
public class DrawCircle extends JPanel implements KeyListener, ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
int x = 100;
int y = 100;
int dx = 0;
int dy = 0;
Timer t = new Timer (1, this);
public DrawCircle (){
t.start ();
setBackground(Color.BLACK);
setFocusTraversalKeysEnabled(false);
addKeyListener(this);
setFocusable (true);
}
public void paintComponent (Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
super.paintComponent(g);
g.setColor(Color.WHITE);
g.fillOval(x, y, 50, 50);
}
public void actionPerformed(ActionEvent e) {
if (x + dx <= 0){
x = 500;
}
if (x + dx >= 500){
x = 0;
}
if (y + dy <= 0){
y = 478;
}
if (y + dy >= 478){
y = 0;
}
x +=dx;
y +=dy;
repaint();
}
//set movement
public void keyPressed(KeyEvent e) {
int event = e.getKeyCode();
if (event == KeyEvent.VK_RIGHT){
dx = 1;
dy = 0;
}
if (event == KeyEvent.VK_LEFT){
dx = -1;
dy = 0;
}
if (event == KeyEvent.VK_DOWN){
dx = 0;
dy = 1;
}
if (event == KeyEvent.VK_UP){
dx = 0;
dy = -1;
}
if (event == KeyEvent.VK_SPACE){
dx = 0;
dy = 0;
}
}
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
}
public static void main(String[] args) {
new MoveTheCircle2 ();
}
}
| 2,414 | 0.61309 | 0.590307 | 127 | 18.007874 | 15.902506 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.598425 | false | false | 7 |
9f4be334b4fa040cca57fdd975c7cbf966e472d9 | 14,663,018,356,287 | 9ae7144784334a271208b237bfb6cc86a73104d0 | /BuildInfo-controller/src/main/java/org/tinygroup/buildinfo/action/exception/BusiException.java | 2362115fe2e2f175eccbc74b285e3276a6ac5ba8 | [] | no_license | wangsj11050/BuildInfo | https://github.com/wangsj11050/BuildInfo | d0977820ce24d20187ba9e21511f31a61bc7c3c3 | 352f3ea5e8e97e147cb360b0cf9daf503a4df1e8 | refs/heads/master | 2021-05-14T00:07:06.446000 | 2018-01-07T05:56:10 | 2018-01-07T06:00:44 | 116,532,379 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.tinygroup.buildinfo.action.exception;
import org.tinygroup.exception.BaseRuntimeException;
/**
*
*/
public class BusiException extends BaseRuntimeException{
private static final long serialVersionUID = 1L;
public BusiException(String errorCode,String errorMsg){
super(errorCode, errorMsg);
}
} | UTF-8 | Java | 317 | java | BusiException.java | Java | [] | null | [] |
package org.tinygroup.buildinfo.action.exception;
import org.tinygroup.exception.BaseRuntimeException;
/**
*
*/
public class BusiException extends BaseRuntimeException{
private static final long serialVersionUID = 1L;
public BusiException(String errorCode,String errorMsg){
super(errorCode, errorMsg);
}
} | 317 | 0.791798 | 0.788644 | 15 | 20.133333 | 23.896629 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.