blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5455e976eaf1e6375c5592fbea1e80fc06176fbc | c8462064c2b4165d67e07ed297e16e1aab53dce5 | /data-structure/Linked-Lists/delete-a-node/Solution.java | a6490c95ad0c8daf4197c6df21b72ae4b1ccdec9 | [] | no_license | yvesmendes/hackerrank-solutions | dbb61a01eb27ec82f361890f822b537bbdee27ba | 160e72e6e30d49a8c3e27c01b1f22eb23af888cf | refs/heads/master | 2022-12-12T13:10:26.882092 | 2020-08-26T13:01:53 | 2020-08-26T13:01:53 | 283,165,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,927 | java | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
static class SinglyLinkedListNode {
public int data;
public SinglyLinkedListNode next;
public SinglyLinkedListNode(int nodeData) {
this.data = nodeData;
this.next = null;
}
}
static class SinglyLinkedList {
public SinglyLinkedListNode head;
public SinglyLinkedListNode tail;
public SinglyLinkedList() {
this.head = null;
this.tail = null;
}
public void insertNode(int nodeData) {
SinglyLinkedListNode node = new SinglyLinkedListNode(nodeData);
if (this.head == null) {
this.head = node;
} else {
this.tail.next = node;
}
this.tail = node;
}
}
public static void printSinglyLinkedList(SinglyLinkedListNode node, String sep, BufferedWriter bufferedWriter) throws IOException {
while (node != null) {
bufferedWriter.write(String.valueOf(node.data));
node = node.next;
if (node != null) {
bufferedWriter.write(sep);
}
}
}
// Complete the deleteNode function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode next;
* }
*
*/
static SinglyLinkedListNode deleteNode(SinglyLinkedListNode head, int position) {
if(position == 1){
head.next = head.next.next;
}else if(position == 0){
head = head.next;
}else{
deleteNode(head.next, position-1);
}
return head;
}
private static final Scanner scanner = new Scanner(System.in);
| [
"yvesgalvao@gmail.com"
] | yvesgalvao@gmail.com |
e43bf6fa4a5b92bbc473ecf634d1cbd604ca638f | 2d0af5cdc6634ac7747afe4ef59f0e86cd356d97 | /app/src/main/java/com/marmikbq/charlie/charlieproject271218/map_grg.java | af788ed7a991dc37add2d0a37ff150de97aaede8 | [] | no_license | marmikp/Book-My-Garage | 9107c40a243d67c1f0f8c95a4979b48a6a202793 | 490d720521657a6a848b8dffb55b375fff176789 | refs/heads/master | 2020-05-30T11:26:54.774326 | 2019-06-30T05:09:32 | 2019-06-30T05:09:32 | 189,702,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,812 | java | package com.marmikbq.charlie.charlieproject271218;
import android.Manifest;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.location.Location;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class map_grg extends AppCompatActivity implements OnMapReadyCallback {
GoogleMap gmap;
MarkerOptions options = new MarkerOptions();
ArrayList<String> latlngs = new ArrayList<>();
int i = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_grg);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map_list);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(final GoogleMap mMap) {
final String url = getString(R.string.ip_address) + "getAllLocation.php";
Log.d("url", url);
if (ActivityCompat.checkSelfPermission(map_grg.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
mMap.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(Location location) {
CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude()));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(9);
if (i == 0) {
mMap.moveCamera(center);
mMap.animateCamera(zoom);
i++;
}
}
});
StringRequest jsObjRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
Log.d("latlang", response);
JSONObject jsonObj = new JSONObject(response);
if (jsonObj.getInt("status") == 1) {
for (int i = 0; i < jsonObj.length(); i++) {
String str = jsonObj.getString(String.valueOf(i));
String[] str1 = str.split(",");
double let = Double.parseDouble(str1[0]);
double lang = Double.parseDouble(str1[1]);
LatLng latLng = new LatLng(let, lang);
Log.d("latlang", String.valueOf(let));
options.position(latLng);
mMap.addMarker(options);
}
Log.d("latlang","abc");
}
} catch (JSONException e) {
Log.d("response: ",e.toString());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("error", error.toString());
}
});
Volley.newRequestQueue(this).add(jsObjRequest);
}
}
| [
"marmikp5897@gmail.com"
] | marmikp5897@gmail.com |
ab2009c245c9308088a65c5dacc1fdf111c26496 | 31d2308e5940248111cda7990c3f3143640b4457 | /ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java | 8954bbb109371fface4e161f8f10bf570aac2d20 | [
"MIT"
] | permissive | hunterllb/RuoYi | 39f22fe44f93752ad891d0b8cf074302e846a52e | 28387c46e2d9d7a5172f312a953f7b4d1b9a60c6 | refs/heads/master | 2022-04-28T08:24:40.750871 | 2022-03-09T02:01:11 | 2022-03-09T02:01:11 | 220,368,095 | 0 | 0 | MIT | 2019-11-08T02:12:20 | 2019-11-08T02:12:18 | null | UTF-8 | Java | false | false | 2,484 | java | package com.ruoyi.common.exception.file;
import java.util.Arrays;
import org.apache.commons.fileupload.FileUploadException;
/**
* 文件上传 误异常类
*
* @author ruoyi
*/
public class InvalidExtensionException extends FileUploadException
{
private static final long serialVersionUID = 1L;
private String[] allowedExtension;
private String extension;
private String filename;
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
{
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
this.allowedExtension = allowedExtension;
this.extension = extension;
this.filename = filename;
}
public String[] getAllowedExtension()
{
return allowedExtension;
}
public String getExtension()
{
return extension;
}
public String getFilename()
{
return filename;
}
public static class InvalidImageExtensionException extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
}
public static class InvalidFlashExtensionException extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
}
public static class InvalidMediaExtensionException extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
}
public static class InvalidVideoExtensionException extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename)
{
super(allowedExtension, extension, filename);
}
}
}
| [
"yzz_ivy@163.com"
] | yzz_ivy@163.com |
ed3536559ed46f630e55f14a21c43688e5784bb5 | 271f1e8ae17b8ea10721f04125440a229633954a | /Mini_pro/src/unittests/Point3D_Test.java | 31b73728eaff63730219359cad83001f9c01cb9c | [] | no_license | weinbergA/miniProjectJava | 30e2217dcfda2fc056dae56f2c4fa5920784328c | 7d96065faf20e1e8b85585975cf3298e567b8c6e | refs/heads/master | 2020-03-15T18:21:36.824281 | 2018-05-06T19:31:57 | 2018-05-06T19:31:57 | 125,711,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package unittests;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import primitives.Point3D;
public class Point3D_Test {
Point3D p1 = new Point3D(1, 2, 3);
Point3D p2 = new Point3D(-4, -3, -2);
@Test
public void distanceTest() {
assertTrue(p1.distance(p2) == Math.sqrt(75));
}
}
| [
"you@example.com"
] | you@example.com |
5ec048f15c5a2f4d5776810bf77c5e943f6b413b | 4a01b592169c2ce7ec1b6676873e3a295a4cd892 | /TheNameStat/app/src/test/java/com/example/lakshaysharma/thenamestat/ExampleUnitTest.java | 8eb8520b0fa7a7c7df60ff0dbdbc2a53c6134a78 | [] | no_license | lakshay994/Android_HandsOn_Stanford | abec257cc2580a9bda000fe1146e0a5a4593af79 | 63ae4b26b9ecd8e44d3e1884e6168e9f658ef8e2 | refs/heads/master | 2020-03-21T14:24:39.476382 | 2018-06-25T22:16:19 | 2018-06-25T22:16:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.example.lakshaysharma.thenamestat;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"lakshay.sharma994@gmail.com"
] | lakshay.sharma994@gmail.com |
7fd676254297551fcefd49e2c25f2ae4d595fe6d | 887d6d71bb86493181bd2032081a03dfde4cbae1 | /src/codeexam/passed/tecent/Main2.java | 28be09fd4816ca9a6dfa262a5a230d7f4048c6e0 | [] | no_license | zzaoen/code4master | b8ec02b4697b89f1b451f15f760e0768e7733854 | 4a0d789fb20b72dce947175cf8a408853cfa02b7 | refs/heads/master | 2020-03-15T16:52:41.965595 | 2018-10-19T12:23:21 | 2018-10-19T12:23:21 | 132,245,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,217 | java | package codeexam.passed.tecent;
import java.util.*;
/*
* author: Bruce Zhao
* email : zhzh402@163.com
* date : 9/16/2018 9:59 AM
* desc :
*/
/*
4 3
2 1
3 2
4 3
*/
public class Main2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n, m;
n = scanner.nextInt();
m = scanner.nextInt();
scanner.nextLine();
int[][] arr = new int[m][2];
for(int i = 0; i < m; i++){
arr[i][0] = scanner.nextInt();
arr[i][1] = scanner.nextInt();
scanner.nextLine();
}
ArrayList<int[]> list = new ArrayList<>();
for(int i = 0; i < m; i++){
int x = arr[i][0];
int y = arr[i][1];
list.add(new int[]{x, y});
while(true) {
int next = getNext(y, arr);
if(next == x || next == -1){
break;
}
int[] tmpArr = new int[2];
tmpArr[0] = x;
tmpArr[1] = next;
list.add(tmpArr);
y = next;
}
}
//System.out.println(list);
int[][] res = new int[n][2];
for(int i = 0; i < list.size(); i++){
System.out.println(list.get(i)[0] + " " + list.get(i)[1]);
int x = list.get(i)[0];
int y = list.get(i)[1];
res[x-1][0]++;
res[y-1][1]++;
}
int count = 0;
for(int i = 0; i < m; i++){
if(res[i][0] < res[i][1])
count++;
}
System.out.println(count);
// for()
/*HashMap<Integer, Integer> map = new HashMap<>();
for(int i = 0; i < list.size(); i++){
int[] ints = list.get(i);
if(map.get(ints[0]) == null){
map.put(ints[0], 1);
}else{
map.put(ints[0], map.get(ints[0]) + 1);
}
}*/
return;
}
private static int getNext(int y, int[][] arr) {
for(int i = 0; i < arr.length; i++){
if(arr[i][0] == y){
return arr[i][1];
}
}
return -1;
}
}
| [
"zhzh402@163.com"
] | zhzh402@163.com |
1c4bc98db821998d5476f5b5aa33fe812fe131ee | dfb658178b17e922cf4995bce4d4b8b094dac816 | /ggsm-api/src/main/java/net/dgg/cloud/entity/baiduhawkeye/EntityResult.java | 3a3b89bb9896d18d06d9f019b18dac4f1e0884be | [] | no_license | Mrtianzhao/first-0730 | 27b4f17919d89a64add4058abceeb85bc707b2c4 | aef4458cc9cca0cfa8f44287f5fafcd5b594090b | refs/heads/master | 2020-03-24T16:54:50.369406 | 2018-07-30T08:03:04 | 2018-07-30T08:03:04 | 142,842,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,909 | java | package net.dgg.cloud.entity.baiduhawkeye;
/**
* @author ytz
* @date 2018/5/18.
* @desc 实体
*/
public class EntityResult {
/**
* entity名称,其唯一标识 string
*/
private String entity_name;
/**
* entity 可读性描述 string
*/
private String entity_desc;
/**
* entity属性修改时间 格式化时间 该时间为服务端时间
*/
private String modify_time;
/**
* entity创建时间 格式化时间 该时间为服务端时间
*/
private String create_time;
/**
* 开发者自定义的entity属性信息 string 只有当开发者为entity创建了自定义属性字段,且赋过值,才会返回。
*/
private String column_key;
/**
* 最新的轨迹点信息
*/
private LatestLocation latest_location;
public String getEntity_name() {
return entity_name;
}
public void setEntity_name(String entity_name) {
this.entity_name = entity_name;
}
public String getEntity_desc() {
return entity_desc;
}
public void setEntity_desc(String entity_desc) {
this.entity_desc = entity_desc;
}
public String getModify_time() {
return modify_time;
}
public void setModify_time(String modify_time) {
this.modify_time = modify_time;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getColumn_key() {
return column_key;
}
public void setColumn_key(String column_key) {
this.column_key = column_key;
}
public LatestLocation getLatest_location() {
return latest_location;
}
public void setLatest_location(LatestLocation latest_location) {
this.latest_location = latest_location;
}
}
| [
"mrtianzhao@163.com"
] | mrtianzhao@163.com |
c35f337c3c72dd12f506dda1f3beb65ea4b1e2df | 7af29653da33ae838a080fd28c29b28d5eb5f846 | /Hibernate/T5/12库悦凯/上机作业/hibernateT05/Test/com/qhit/lh/gr3/kyk/t4/EmpTest.java | 3c7e2706526687e739ba25a35bf3702a4ea27b09 | [] | no_license | kyk927/16GR3 | b1c964d6c8d786634069613cac36663cf69897b8 | 21b27ce204bca89e0324dca687e2d53e1e8bb5af | refs/heads/master | 2021-09-08T20:44:25.558879 | 2018-03-12T04:50:58 | 2018-03-12T04:50:58 | 111,626,875 | 0 | 0 | null | 2017-11-22T02:33:07 | 2017-11-22T02:33:06 | null | GB18030 | Java | false | false | 2,048 | java | /**
*
*/
package com.qhit.lh.gr3.kyk.t4;
import java.util.List;
import org.junit.Test;
import com.qhit.lh.gr3.kyk.t4.bean.Dept;
import com.qhit.lh.gr3.kyk.t4.bean.Emp;
import com.qhit.lh.gr3.kyk.t4.bean.User;
import com.qhit.lh.gr3.kyk.t4.service.BaseService;
import com.qhit.lh.gr3.kyk.t4.service.impl.BaseServiceImpl;
/**
* @author 库悦凯 TODO 2017年12月11日上午10:23:30
*/
public class EmpTest {
private BaseService baseService = new BaseServiceImpl();
/**
* 添加
* */
@Test
public void add() {
// 声明员工对象
Emp emp = new Emp();
emp.setEname("asd");
emp.setBirthday("2017-10-10");
emp.setSex("m");
// 分配一个账户
User user = new User();
user.setUname("aya");
user.setUpwd("123456");
// 建立一对一关系
emp.setUser(user);// 指定当前员工的账户
user.setEmp(emp);// 指定当前账户所属员工
//分配所属部门
Dept dept = new Dept();
dept = (Dept) baseService.getObjectById(dept, 2);
//建立多对一关系
emp.setDept(dept);
// 数据操作
baseService.add(emp);
}
/**
* 删除
* */
@Test
public void delete() {
// 声明并实例化对象
Emp emp = new Emp();
emp = (Emp) baseService.getObjectById(emp, 6);
// 数据操作
baseService.delete(emp);
}
/**
* 修改
* */
@Test
public void update() {
// 声明员工对象
Emp emp = new Emp();
emp = (Emp) baseService.getObjectById(emp, 5);
emp.setEname("123");
User user = emp.getUser();
user.setUname("456");
// 建立一对一关系
emp.setUser(user);// 指定当前员工的账户
user.setEmp(emp);// 指定当前账户所属员工
//修改所属部门
Dept dept = new Dept();
dept = (Dept) baseService.getObjectById(dept, 1);
// 数据操作
baseService.update(emp);
}
/**
* 查询
* */
@Test
public void query() {
// 声明并实例化对象
List<Object> list = baseService.getAll("from Emp");
// 数据操作
for (Object object : list) {
Emp emp = (Emp) object;
System.out.println(emp.toString());
}
}
}
| [
"kyk927@foxmail.com"
] | kyk927@foxmail.com |
1753538fd4ab3e3bab2e841dfb7c1d6edb5c2c90 | 092c6abac15b8de82cd854791f7f92efda5a898d | /imood-judy-ad-register/src/main/java/com/dexlace/register/RegisterApplication.java | a77432959fcc7783eea1c5385530906b2fc9b648 | [] | no_license | dexlace/imood-judy-ad | cfdb3a0591e09e595f7c13ed25c86190c72b7f98 | bfbd9753ca17450cc0c02006c320897e4f2bd0f6 | refs/heads/master | 2023-06-10T08:40:14.748841 | 2021-06-30T04:06:37 | 2021-06-30T04:06:37 | 381,570,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package com.dexlace.register;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* @Author: xiaogongbing
* @Description:
* @Date: 2021/5/18
*/
@EnableEurekaServer
@SpringBootApplication
public class RegisterApplication {
public static void main(String[] args) {
SpringApplication.run(RegisterApplication.class,args);
}
}
| [
"13265317096@163.com"
] | 13265317096@163.com |
50f1461fc0c3fe4b3d7efd54f27e263023831088 | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/HBase/2520_2.java | 29ad7d8df0a6f262e3ed53f8ad8a467906acfdc8 | [
"MIT"
] | permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 688 | java | //,temp,THBaseService.java,7537,7548,temp,THBaseService.java,6633,6644
//,2
public class xxx {
public void onComplete(Void o) {
deleteTable_result result = new deleteTable_result();
try {
fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
} catch (org.apache.thrift.transport.TTransportException e) {
_LOGGER.error("TTransportException writing to internal frame buffer", e);
fb.close();
} catch (java.lang.Exception e) {
_LOGGER.error("Exception writing to internal frame buffer", e);
onError(e);
}
}
}; | [
"sgholami@uwaterloo.ca"
] | sgholami@uwaterloo.ca |
cc89682b99f201851950dab61ac9d1ea1d901a86 | 9e1b3d87a41f662dda21d21fdaadc68651967e21 | /crash_collect/src/main/java/com/emporia/common/util/crash/AlarmSenderService.java | 04671186db5934cc4e33ea8ae0e6c6f385ce5495 | [] | no_license | nzsdyun/CrashCollect | 27dc823f14af72ec1b9623448d44a2ce4df9d05c | c89b93927a3f383ea6ee7b90fe7bdbf38eb5a86b | refs/heads/master | 2021-01-13T08:00:21.282395 | 2016-10-21T01:45:55 | 2016-10-21T01:45:55 | 71,519,450 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,324 | java | package com.emporia.common.util.crash;
import android.app.AlarmManager;
import android.app.IntentService;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.os.SystemClock;
import com.emporia.common.util.NetworkUtils;
/**
* use intentService to crash file for testing, testing every 8 hours, service running in a separate thread
* @author sky
*/
public class AlarmSenderService extends IntentService {
private AlarmManager alarmManager;
private PendingIntent checkPendingIntent;
/**
* Creates an IntentService. Invoked by your subclass's constructor.
*/
public AlarmSenderService() {
super("AlarmSenderService");
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
protected void onHandleIntent(Intent intent) {
if (NetworkUtils.isConnect(this) &&
CrashCollect.getInstance().isSend(
CrashExceptionHandler.getIntance().getCrashFileDir())) {
NetworkUtils.NetworkType networkType = NetworkUtils.getNetworkType(this);
if (!CrashCollect.getInstance().isOnlyWifiSend()) {
CrashCollect.getInstance().send();
} else {
if (networkType == NetworkUtils.NetworkType.WIFI) {
CrashCollect.getInstance().send();
}
}
}
//check every 8 hours
alarmManager.cancel(checkPendingIntent);
long hours = CrashCollect.getInstance().checkSendTimeInterval();
long triggerAtTime = SystemClock.elapsedRealtime() + hours;
Intent i = new Intent(this, AlarmSenderReceiver.class);
checkPendingIntent = PendingIntent.getBroadcast(this, 0, i, 0);
alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, checkPendingIntent);
}
@Override
public void onCreate() {
super.onCreate();
alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
}
/** start AlarmSenderService service */
public static void startService(Context context) {
Intent senderService = new Intent(context.getApplicationContext(), AlarmSenderService.class);
context.startService(senderService);
}
}
| [
"1799058367@qq.com"
] | 1799058367@qq.com |
bea0ccf3b12591b74d50af596905386252401a80 | c4b77a336b7eed3501fc67adbe2e3804414af6e2 | /src/com/zhanglong/sg/service/PayService.java | 417e791cd7c3a67393c9e2550679784eab55b5f2 | [] | no_license | joshua86z/java-jsonrpc-game1 | 0fdd87a24f14e899aa15ec3cb62775ef1a5bced0 | ae6bc13e790168613aa7f10ac08e088e46d794e3 | refs/heads/master | 2021-08-27T15:37:19.281990 | 2015-10-21T02:18:54 | 2015-10-21T02:18:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,749 | java | package com.zhanglong.sg.service;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.zhanglong.sg.dao.BasePayShopDao;
import com.zhanglong.sg.dao.OrderDao;
import com.zhanglong.sg.entity.BasePayShop;
import com.zhanglong.sg.entity.Order;
import com.zhanglong.sg.entity.Role;
import com.zhanglong.sg.result.Result;
@Service
public class PayService extends BaseService {
@Resource
private OrderDao orderDao;
@Resource
private BasePayShopDao basePayShopDao;
public Object list() throws Exception {
int roleId = this.roleId();
List<BasePayShop> list = this.basePayShopDao.findAll();
List<BasePayShop> list2 = new ArrayList<BasePayShop>();
List<Integer> orders = this.orderDao.group(roleId);
Role role = this.roleDao.findOne(roleId);
boolean find1RMB = false;
for (int money : orders) {
if (money == 10) {
find1RMB = true;
}
}
for (BasePayShop basePayShop : list) {
BasePayShop item = basePayShop.clone();
if (find1RMB) {
if (item.getMoney() == 10) {
continue;
}
}
if (item.getType() == BasePayShop.M_CARD) {
int vipTime = role.cardTime;
int time = vipTime - (int)(System.currentTimeMillis() / 1000l);
if (time > 0) {
item.setDesc("月卡生效中,剩余 " + (int)Math.ceil(time / (86400d)) + " 天");
}
} else {
boolean find = false;
for (Integer money : orders) {
if (money == (int)item.getMoney()) {
find = true;
break;
}
}
if (!find) {
item.setDesc("另赠" + (int)item.getGold() + "元宝(限赠1次)");
}
}
list2.add(item);
}
return this.success(list2);
}
public Object firstIcon() throws Exception {
int roleId = this.roleId();
int count = this.orderDao.after6(roleId);
boolean bool = true;
if (count > 0) {
bool = false;
}
Result result = new Result();
result.setValue("first", bool);
return this.success(result.toMap());
}
public Object order(int id) throws Exception {
BasePayShop basePayShop = this.basePayShopDao.findOne(id);
if (basePayShop == null) {
return returnError(this.lineNum(), "参数出错");
}
Order order = new Order();
order.setUserId(this.userId());
order.setServerId(this.serverId());
order.setRoleId(this.roleId());
order.setType(basePayShop.getType());
order.setMoney(basePayShop.getMoney());
order.setGold(basePayShop.getGold());
order.setAddGold(basePayShop.getAddGold());
order.setDesc("");
this.orderDao.create(order);
return this.success(order.getId());
}
}
| [
"fhbzyc@gmail.com"
] | fhbzyc@gmail.com |
ded5ffb3bdf76b6b602698e56ddf9f920f62b690 | 9417528f9ac863334a2d0c9a93b93ca8b95e5b3a | /app/src/main/java/id/ac/polinema/notesapp/fragments/NoteFragment.java | 8727c87477fc35e5934cba534a21b692ed9c8b27 | [] | no_license | syahrinka/SQLite | f29f5739a61d01ea130218b80064df309f2f218f | a7761d9b91c85344eed90fa0de5f83e35bc58df5 | refs/heads/master | 2020-05-09T12:45:13.045704 | 2019-04-13T04:41:28 | 2019-04-13T04:41:28 | 181,118,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,396 | java | package id.ac.polinema.notesapp.fragments;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import id.ac.polinema.notesapp.Constant;
import id.ac.polinema.notesapp.R;
import id.ac.polinema.notesapp.adapters.NoteAdapter;
/**
* A simple {@link Fragment} subclass.
*/
public class NoteFragment extends Fragment {
private static final String TAG = NoteFragment.class.getSimpleName();
private RecyclerView recyclerView;
private NoteAdapter adapter;
private OnNoteFragmentListener listener;
public NoteFragment() {
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_note, container, false);
recyclerView = view.findViewById(R.id.rv_notes);
ImageButton fab = view.findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onAddButtonClicked();
}
}
});
adapter = new NoteAdapter(getContext());
recyclerView.setAdapter(adapter);
listener.onNotesLoad(adapter);
displayAsGrid();
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_note, menu);
super.onCreateOptionsMenu(menu, inflater);
}
private void displayAsList() {
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
adapter.setLayout(Constant.LAYOUT_MODE_LIST);
}
private void displayAsGrid() {
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(), 2);
recyclerView.setLayoutManager(layoutManager);
adapter.setLayout(Constant.LAYOUT_MODE_GRID);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_show_list:
displayAsList();
return true;
case R.id.action_show_grid:
displayAsGrid();
return true;
case R.id.action_logout:
Log.i(TAG, "Logout click");
if (listener != null) {
listener.onLogoutMenuClicked();
}
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnNoteFragmentListener) {
listener = (OnNoteFragmentListener) context;
} else {
throw new RuntimeException(context.toString()
+ "must implement OnNoteFragmentListener");
}
}
@Override
public void onDetach() {
super.onDetach();
listener = null;
}
public interface OnNoteFragmentListener {
void onNotesLoad(NoteAdapter adapter);
void onAddButtonClicked();
void onLogoutMenuClicked();
}
}
| [
"syahrinkusuma30@gmail.com"
] | syahrinkusuma30@gmail.com |
27af586b9bf087ce2e5030adb72c26fb0bd3f09e | 5fea7aa14b5db9be014439121ee7404b61c004aa | /src/com/tms/collab/messaging/ui/Line.java | 947b7406135886c6003a026c62f81b6a63453358 | [] | no_license | fairul7/eamms | d7ae6c841e9732e4e401280de7e7d33fba379835 | a4ed0495c0d183f109be20e04adbf53e19925a8c | refs/heads/master | 2020-07-06T06:14:46.330124 | 2013-05-31T04:18:19 | 2013-05-31T04:18:19 | 28,168,318 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,371 | java | package com.tms.collab.messaging.ui;
import kacang.ui.Event;
import kacang.ui.Forward;
import kacang.ui.Widget;
/**
* A Line widget, representing the <hr> in html tag.
*/
public class Line extends Widget {
private String align;
private String clazz;
private Boolean noShade = Boolean.FALSE;
private String dir;
private String lang;
private String onclick;
private String ondbclick;
private String onkeydown;
private String onkeypress;
private String onkeyup;
private String onmousedown;
private String onmouseover;
private String onmouseup;
private String size;
private String style;
private String width;
private String title;
public Line(String name) {
super(name);
}
/**
* @see kacang.ui.Widget#getDefaultTemplate()
*/
public String getDefaultTemplate() {
return "line";
}
/**
* @see kacang.ui.Widget#actionPerformed(kacang.ui.Event)
*/
public Forward actionPerformed(Event evt) {
return super.actionPerformed(evt);
}
// getters / setters ===================================================
public String getAlign() {
return align;
}
public void setAlign(String align) {
this.align = align;
}
public String getClazz() {
return clazz;
}
public void setClazz(String clazz) {
this.clazz = clazz;
}
public String getDir() {
return dir;
}
public void setDir(String dir) {
this.dir = dir;
}
public String getLang() {
return lang;
}
public void setLang(String lang) {
this.lang = lang;
}
public Boolean getNoshade() {
return noShade;
}
public void setNoshade(Boolean noShade) {
this.noShade = noShade;
}
public String getOnclick() {
return onclick;
}
public void setOnclick(String onclick) {
this.onclick = onclick;
}
public String getOndbclick() {
return ondbclick;
}
public void setOndbclick(String ondbclick) {
this.ondbclick = ondbclick;
}
public String getOnkeydown() {
return onkeydown;
}
public void setOnkeydown(String onkeydown) {
this.onkeydown = onkeydown;
}
public String getOnkeypress() {
return onkeypress;
}
public void setOnkeypress(String onkeypress) {
this.onkeypress = onkeypress;
}
public String getOnkeyup() {
return onkeyup;
}
public void setOnkeyup(String onkeyup) {
this.onkeyup = onkeyup;
}
public String getOnmousedown() {
return onmousedown;
}
public void setOnmousedown(String onmousedown) {
this.onmousedown = onmousedown;
}
public String getOnmouseover() {
return onmouseover;
}
public void setOnmouseover(String onmouseover) {
this.onmouseover = onmouseover;
}
public String getOnmouseup() {
return onmouseup;
}
public void setOnmouseup(String onmouseup) {
this.onmouseup = onmouseup;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getWidth() {
return width;
}
public void setWidth(String width) {
this.width = width;
}
}
| [
"fairul@a9c4ac11-bb59-4888-a949-8c1c6fc09797"
] | fairul@a9c4ac11-bb59-4888-a949-8c1c6fc09797 |
dc40eef30fcd64f49b02200916456b3997c1a1ad | 4a62df68473121be04215d3daad6d56ad07bb076 | /app/src/main/java/com/example/buiderdream/apehire/utils/JudgeUtils.java | 8d0b9490d07b3744602ec26dca5fa4381a263316 | [] | no_license | yuzelli/ApeHire | 5e01196438b0b02af46dc56a8974ab3d0d23bcd1 | 45d02d13e0d6d4138b1bf95aba4f2dbe5446f983 | refs/heads/master | 2020-06-14T00:13:11.096278 | 2017-03-11T13:36:41 | 2017-03-11T13:36:41 | 75,541,436 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.example.buiderdream.apehire.utils;
import android.content.Context;
import android.content.SharedPreferences;
import com.example.buiderdream.apehire.constants.ConstantUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static android.content.Context.MODE_PRIVATE;
/**
* Created by 51644 on 2017/2/9.
* @author 李秉龙
*/
public class JudgeUtils {
/**
* 验证电话号码是否符合格式
* @return true or false
*/
public static boolean isPhoneEnable(String strPhone,String passWord) {
boolean b = false;
if (strPhone.length() == 11) {
Pattern pattern = null;
Matcher matcher = null;
pattern = Pattern.compile("^[1][3,4,5,8][0-9]{9}$"); // 验证手机号
matcher = pattern.matcher(strPhone);
b = matcher.matches();
}
if (passWord.length()>16){
b=false;
}
return b;
}
public static boolean getUserType(Context context){
SharedPreferences pref = context.getSharedPreferences("date",MODE_PRIVATE);
return pref.getBoolean(ConstantUtils.LOCATION_USER_TYPE,true);
}
public static void saveUserType(Context context,boolean flag){
SharedPreferences.Editor editor = context.getSharedPreferences("date",MODE_PRIVATE).edit();
editor.putBoolean(ConstantUtils.LOCATION_USER_TYPE, flag);
editor.commit();
}
}
| [
"516440912@qq.com"
] | 516440912@qq.com |
d147ab648d762dd9c8232a1cbeacf4dbb23fe6c2 | 66af07a10a9c66b68411934a269e966901217d31 | /gulimall-coupon/src/main/java/com/icon/gulimall/coupon/service/impl/SeckillSessionServiceImpl.java | 093e28f389be07935d3656542d96d4f3e0b98c2a | [
"Apache-2.0"
] | permissive | yanking99/gulimall | a6a3b38dcec23a54b95e840c669071a40bb5acd7 | cc080292cba3762633d76b259a622f8237789410 | refs/heads/main | 2023-03-02T13:02:15.333153 | 2021-01-31T15:02:56 | 2021-01-31T15:02:56 | 334,425,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | package com.icon.gulimall.coupon.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.icon.common.utils.PageUtils;
import com.icon.common.utils.Query;
import com.icon.gulimall.coupon.dao.SeckillSessionDao;
import com.icon.gulimall.coupon.entity.SeckillSessionEntity;
import com.icon.gulimall.coupon.service.SeckillSessionService;
@Service("seckillSessionService")
public class SeckillSessionServiceImpl extends ServiceImpl<SeckillSessionDao, SeckillSessionEntity> implements SeckillSessionService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SeckillSessionEntity> page = this.page(
new Query<SeckillSessionEntity>().getPage(params),
new QueryWrapper<SeckillSessionEntity>()
);
return new PageUtils(page);
}
} | [
"13250226651@163.com"
] | 13250226651@163.com |
fab34bcb3f5f8332d8db7aeba7563dcd931d8ec1 | 5ac79770afb69a0c8c48d1b92adfd58a90063855 | /src/com/example/algo/twopointer/TwoSum.java | ee4fa8e802444fd545a6215794bcc030af91b1aa | [] | no_license | ashishlahoti/java-interview-programs | 83dac7f567551dcbfb2159602dbf0b7c32302bb2 | e49c009e44f81b56bbebc60da597de2134783c23 | refs/heads/master | 2022-10-14T23:58:20.749880 | 2022-09-23T05:29:35 | 2022-09-23T05:29:35 | 195,247,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,394 | java | package com.example.algo.twopointer;
import java.util.*;
public class TwoSum {
public static void main(String[] args) {
int[] numbers = new int[] { -3, 2, 3, 3, 6, 8, 15 };
System.out.println(twoSum_getElements(numbers, 6));
System.out.println(twoSum_getIndex(numbers, 6));
}
public static List<Integer> twoSum_getIndex(int[] numbers, int target){
Map<Integer, Integer> map = new HashMap<>();
for(int i=0; i< numbers.length; i++){
map.put(numbers[i], i);
}
for(int i=0; i< numbers.length; i++){
int remaining = target - numbers[i];
if(map.containsKey(remaining) && map.get(remaining) != i){
return new ArrayList<>(Arrays.asList(i, map.get(remaining)));
}
}
return new ArrayList<>();
}
public static List<Integer> twoSum_getElements(int[] numbers, int target) {
Arrays.sort(numbers);
int start = 0;
int end = numbers.length - 1;
while (start < end) {
int total = numbers[start] + numbers[end];
if (total == target) {
return new ArrayList<>(Arrays.asList(numbers[start], numbers[end]));
} else if (total > target) {
end--;
} else {
start++;
}
}
return new ArrayList<>();
}
}
| [
"lahoti.ashish20@gmail.com"
] | lahoti.ashish20@gmail.com |
d220daed5538ce40bb04d3801bede08958913310 | 105ff2705396d603b30760cb6e393e2e80e30793 | /internet_Architec/templates/thymeleaf-gtvt/src/main/java/com/asynclife/clonegod/App.java | 3e2c202368112728d8627f7ab970ad55ebd84064 | [] | no_license | clonegod/x01-lang-java | cfa878ccc0e86cace906d47b9c2a3085732fc835 | 640bdd04a47abf97189e761acd020f7d5a0f55e6 | refs/heads/master | 2020-03-13T15:00:36.761781 | 2018-06-06T16:03:32 | 2018-06-06T16:03:32 | 131,169,227 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package com.asynclife.clonegod;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class App {
public static void main(String[] args) throws Exception {
SpringApplication app = new SpringApplication();
app.setWebEnvironment(true);
SpringApplication.run(App.class, args);
System.out.println("App start running...");
}
}
| [
"asynclife@163.com"
] | asynclife@163.com |
ba6de151979517bf83fc3dcfb5adecb94a9f245b | ef49b2bf76afcd2da90562249dc6f536fb9b5ec6 | /src/com/company/leetcode/before/_6.java | fc3d2ceac08534d2e1f9acf46823bc89bffa87a3 | [] | no_license | rjpacket/JavaAlgorithm | 5f675b7041a8e7e1b51eb1096269cd0a9cd53ef1 | e9cd152c0ef9e326d0b1eb1adba9e1d1ed6c480e | refs/heads/master | 2020-03-11T14:29:27.509536 | 2019-04-10T11:54:10 | 2019-04-10T11:54:10 | 130,056,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,851 | java | package com.company.leetcode.before;
/**
* 将字符串 "PAYPALISHIRING" 以Z字形排列成给定的行数:
* <p>
* P A H N
* A P L S I I G
* Y I R
* 之后从左往右,逐行读取字符:"PAHNAPLSIIGYIR"
* <p>
* 实现一个将字符串进行指定行数变换的函数:
* <p>
* string convert(string s, int numRows);
* 示例 1:
* <p>
* 输入: s = "PAYPALISHIRING", numRows = 3
* 输出: "PAHNAPLSIIGYIR"
* 示例 2:
* <p>
* 输入: s = "PAYPALISHIRING", numRows = 4
* 输出: "PINALSIGYAHRPI"
* 解释:
* <p>
* P I N
* A L S I G
* Y A H R
* P I
* Created by An on 2018/4/19.
*/
public class _6 {
public static void main(String[] args) {
System.out.println(convert("AB", 1));
}
public static String convert(String s, int numRows) {
if (numRows == 1) {
return s;
}
int length = s.length();
String a[][] = new String[numRows][length];
M:
for (int i = 0, j = 0, k = 0; i < length; ) {
for (int l = 0; l < numRows; l++) {
if (i >= length) {
break M;
}
a[j][k] = String.valueOf(s.charAt(i));
j++;
i++;
}
j -= 2;
k++;
for (int l = 0; l < numRows - 2; l++) {
if (i >= length) {
break M;
}
a[j][k] = String.valueOf(s.charAt(i));
j--;
k++;
i++;
}
}
String result = "";
for (int i = 0; i < numRows; i++) {
for (int j = 0; j < length; j++) {
if (a[i][j] != null) {
result += a[i][j];
}
}
}
return result;
}
}
| [
"jimbo922@163.com"
] | jimbo922@163.com |
7ea7d4f8c8032dc9e70024002f3828efb7054e71 | 06bdaca2b038e0178e6170271905e219dca35206 | /src/additionTask/Teacher.java | d47e8daedcfc4086d432d1c47936734b60d8f53e | [] | no_license | SerhiiDanmark/JavaEssentialLess6_HW | 54cf5019fc9a15cccac32293cf71cf4b5c42da48 | 96d9f7b01c6061b9768a3b9c39a4ad2da70708fa | refs/heads/master | 2023-02-22T20:39:56.196423 | 2021-01-29T17:08:58 | 2021-01-29T17:08:58 | 334,210,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package additionTask;
public class Teacher {
String name;
String patronimic;
Teacher (String name, String patronimic){
this.name = name;
this.patronimic = patronimic;
}
public String getName() {
return name;
}
public String getPatronimic() {
return patronimic;
}
}
| [
"sergiitrus@gmail.com"
] | sergiitrus@gmail.com |
e480dfe88a7845de18ce2fbca334420ae9e661bf | 170ddb887157313f192ac3459eb0861ddbd36e42 | /app/src/main/java/com/hammersmith/cammembercard/model/MemberCard.java | bed33dd679f8e8ece9a5a9720c3bd8d53ccce54a | [] | no_license | Chanthuon168/CamMemberCard | 224a0b77d69d96454e9f2e9c20739dabedfa59a7 | e020632444ff64795a078277506ebbb6c105c204 | refs/heads/master | 2021-01-18T22:39:45.447043 | 2017-12-05T04:09:22 | 2017-12-05T04:09:23 | 72,593,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,031 | java | package com.hammersmith.cammembercard.model;
import android.icu.text.SymbolTable;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/**
* Created by Chan Thuon on 11/22/2016.
*/
public class MemberCard implements Serializable{
@SerializedName("id")
private int id;
@SerializedName("md_id")
private int merId;
@SerializedName("img_card")
private String ImgCard;
@SerializedName("img_merchandise")
private String imgMerchandise;
@SerializedName("name")
private String name;
@SerializedName("rating")
private String rating;
@SerializedName("address")
private String address;
@SerializedName("exp")
private String expDate;
@SerializedName("status")
private String status;
@SerializedName("count")
private String count;
@SerializedName("social_link")
private String socialLink;
@SerializedName("size_status")
private String sizeStats;
@SerializedName("outlet")
private String outlet;
public MemberCard() {
}
public MemberCard(String socialLink) {
this.socialLink = socialLink;
}
public int getMerId() {
return merId;
}
public void setMerId(int merId) {
this.merId = merId;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImgMerchandise() {
return imgMerchandise;
}
public void setImgMerchandise(String imgMerchandise) {
this.imgMerchandise = imgMerchandise;
}
public String getImgCard() {
return ImgCard;
}
public void setImgCard(String imgCard) {
ImgCard = imgCard;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getExpDate() {
return expDate;
}
public void setExpDate(String expDate) {
this.expDate = expDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
public String getSocialLink() {
return socialLink;
}
public void setSocialLink(String socialLink) {
this.socialLink = socialLink;
}
public String getSizeStats() {
return sizeStats;
}
public void setSizeStats(String sizeStats) {
this.sizeStats = sizeStats;
}
public String getRating() {
return rating;
}
public void setRating(String rating) {
this.rating = rating;
}
public String getOutlet() {
return outlet;
}
public void setOutlet(String outlet) {
this.outlet = outlet;
}
}
| [
"chanthuonsreng@gmail.com"
] | chanthuonsreng@gmail.com |
bdb8c109f6fd316084e086f775b8537fcc56b3d3 | f28c2f844467f02ce500f4ff84febcfe94667f2c | /src/test/java/TwitterCollectorTest.java | f3913c74139d4c421f25e1f293c2e31ed8ccaa85 | [] | no_license | MichaelFouche/LetsMine | f7394a7724e3b63d7b937b3f44fb727527ffe943 | aa6ae49b3443f3c94ad5bbba6c5d66bd9ad90f2b | refs/heads/master | 2020-04-10T21:48:22.853074 | 2016-12-31T13:56:23 | 2016-12-31T13:56:23 | 64,610,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,359 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import com.mycompany.letsmine.TwitterCollector;
import com.mycompany.letsmine.controller.DataController;
import com.mycompany.letsmine.model.TweetData;
import com.mycompany.letsmine.model.User;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
*
* @author michaelfouche
*/
public class TwitterCollectorTest {
private ApplicationContext context;
private TwitterCollector twitterCollector;
private User user;
public TwitterCollectorTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
//
@Test
public void getConnection(){
}
@Test
public void userProfile() {
context = new ClassPathXmlApplicationContext("beans.xml");
twitterCollector = (TwitterCollector) context.getBean("TwitterCollector");
String userName = twitterCollector.retrieveUserProfile();
System.out.println("userName "+userName);
assertNotNull(userName);
}
@Test
public void testRetrieveTweet(){
context = new ClassPathXmlApplicationContext("beans.xml");
twitterCollector = (TwitterCollector) context.getBean("TwitterCollector");
String hashtag = "Takealot";
String lat = "-33.7342304";
String lng = "18.9621091";
int radius = 5000;
String query = "Test";
List<TweetData> tweetDataList = twitterCollector.retrieveTweetFromTwitter(hashtag, lat, lng, radius, query);
assertTrue(tweetDataList.size()>0);
System.out.println("tweetDataList.size() "+ tweetDataList.size());
}
}
| [
"mfouche@impactradius.com"
] | mfouche@impactradius.com |
1c5c4bab3db30c578cd9355d241b3413ac74411b | 794453a0e134c3dab3f21aebd72b98c0c013dd54 | /자바스크립트/TestTV/src/RandomWalk_201712111.java | feb41afd899ed1fc0fe476268c495cdaedeb56a5 | [] | no_license | ccho11/201712111-cho | 411826e5b6e9d9741b861148b4a0427146d05b68 | a1f3549773d191e313fd4c8aef6c2f98388839e3 | refs/heads/master | 2023-02-19T05:17:59.246916 | 2020-12-16T08:53:31 | 2020-12-16T08:53:31 | 321,921,378 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 688 | java |
public class RandomWalk_201712111 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int dir;
boolean[][] tile = new boolean[10][10];
int x=5,y=5;
for(int step=0; step<20; step++) {
dir=(int)(Math.random()*4);
if(dir==0 && x<9)
x++;
else if(dir==1 && x>0)
x--;
else if(dir==2 && y<9)
y++;
else if(y>0)
y--;
tile[y][x]=true;
for(int i=0; i<10; i++) {
for(int j=0; j<10; j++) {
if(tile[j][i]==true)
System.out.print(" #");
else
System.out.print(" .");
}
System.out.println(" " +(step+1)+"À϶§");
}
System.out.println("-------------------");
}
}
}
| [
"roakd3973@naver.com"
] | roakd3973@naver.com |
4fca1ca5b55e9bdb5197f02ffa1818532cbfc9ad | 4a20de1d81a38a4dd647a58edc4e4345c610ae04 | /app/src/main/java/com/yiqu/iyijiayi/StubActivityNoSoft.java | db7c42adbf9d9856799ebc2b9cc408b28f0b49b2 | [] | no_license | 1227228155/yiqu | 02d840ba1f97f596a8400098903580ee543b27a0 | 9690486db2f5b8f6d94fada01eb1b2081fa4cfee | refs/heads/master | 2020-06-28T03:04:57.119313 | 2017-05-13T09:24:19 | 2017-05-13T09:24:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.yiqu.iyijiayi;
import android.os.Bundle;
import android.view.WindowManager;
public class StubActivityNoSoft extends StubActivity {
@Override
protected void init(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.init(savedInstanceState);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
}
| [
"414119510@qq.com"
] | 414119510@qq.com |
d82c38973e1a5a562fbb6c7efe01758a4b00932c | 6e20485b4932c52bf464248d2cc5568aa3e48f5e | /day32/src/gui/Test35.java | ae6dc2b05bb9c171ef906516b5fdb8d4af2e3696 | [] | no_license | dpfla8628/kh_test | 17716c2f9c9a0e97d1cf5c0f319e570d38d9db96 | f60edebffe7c30e6a088b8c636259fb3552e0975 | refs/heads/master | 2023-03-23T10:18:48.863533 | 2021-03-22T15:07:02 | 2021-03-22T15:07:02 | 301,330,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,250 | java |
//카드 뒤집기 정답 만들어보기
package gui;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
class MyButton extends JButton{
private boolean press;
private int value;
private ImageIcon front;
public MyButton(int value,ImageIcon front) {
this.value = value;
this.front=front;
display();
}
public int getValue() {
return this.value;
}
public void setPress(boolean press) {
this.press = press;
display();
}
public boolean isPress() {
return this.press;
}
public void toggle() {
this.press = !this.press;
display();
}
public void display() {
if(press) {
setIcon(front);
}
else {
setIcon(front);
setBackground(Color.black);
}
}
}
//나만의 창 클래스 템플릿(기본폼)
class MyFrame35 extends JFrame{
//멤버 변수 : 필요한 컴포넌트를 정의
//- 모든 컴포넌트를 배치할 수 있는 ContentPane을 생성(JPanel)
private JPanel root = new JPanel();
//아이콘(Icon) : 이미지의 종류이긴 하지만 컴포넌트에 집어넣는 형태로 특화된 이미지
// // - 크기변경이 불가능하며 바꾸고 싶다면 Image로 변환하여 조정한 뒤 다시 되돌려야 한다
// private ImageIcon icon1 = new ImageIcon("image/icon0.png");
// private ImageIcon icon2 = new ImageIcon("image/icon1.png");
private List<MyButton> list = new ArrayList<>();
private int row=2;
private int col=3;
//멤버 메소드 : 배치기능
public void place() {
//root를 Frame의 ContentPane으로 설정
// - 이제부터는 모든 컴포넌트는 this가 아니라 root에 추가
this.setContentPane(root);
root.setLayout(new GridLayout(row,col));
for(int i=0; i<row*col; i++) {
ImageIcon front = new ImageIcon("image/icon"+(i/2)+".png");
MyButton bt = new MyButton((i/2),front);//0,0,1,1
bt.setFont(new Font("굴림",Font.BOLD,50));
list.add(bt);
}
Collections.shuffle(list);//셔플을 사용하려면 리스트를 이용하자
for(MyButton bt : list) {
root.add(bt);
}
}
//첫번째 버튼만큼은 기억하고 있어야하니까 따로 변수 선언해준다
private MyButton first;
//멤버 메소드 : 이벤트 설정
public void event() {
//목표 : 버튼을 누르면 아이콘이 나타났다 사라졌다 하도록 구현
//e.getactionCommand() : 버튼의 글자를 불러온다
//e.getSource() : 버튼을 불러온다
//숫자랑 이미지랑 같이 나오는 문제점을 해결해보자!
//버튼클래스를 확장해서 값을 변수로 추가해보자
ActionListener listener = e ->{
MyButton target = (MyButton)e.getSource();//다운캐스팅
target.setPress(true);
if(first==null) {
//System.out.println("첫번째 버튼");
first=target;
}
else {
//System.out.println("두번째 버튼");
// 1.같은 버튼을 누른게 아니라면 2.텍스트 값이 같다면
if(first!=target && first.getValue() == target.getValue()) {//똑같은 버튼을 눌렀다면) {
first.setEnabled(false);//첫번째 버튼 잠금
target.setEnabled(false);//두번째 버튼잠금
}
else {
first.setPress(false);
target.setPress(false);
}
first=null;
}
};
for(MyButton bt : list) {
bt.addActionListener(listener);
}
}
//멤버 메소드 : 메뉴 설정
public void menu() {
}
//생성자 : 창에 대한 설정
public MyFrame35() {
this.place();
this.menu();
this.event();
this.setTitle("GUI 예제 35");
this.setLocation(100, 100);
this.setSize(400, 500);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(true);
this.setVisible(true);
}
}
public class Test35 {
public static void main(String[] args) {
//main에 더이상 모든 코드를 적지 않겠다
MyFrame35 frame = new MyFrame35();
}
} | [
"YR@DESKTOP-HIAR6MN"
] | YR@DESKTOP-HIAR6MN |
0ae82c14e4446f815201d9df1e59b6e9fb99410a | ae7aa2dcd4644b04f6fa93d42c8d41526eb8a05e | /webservice/src/main/java/com/excilys/computerdatabase/webservice/ComputerResource.java | dee4c6acc593fa3c11541487eaa06d6a93552ac8 | [] | no_license | vgalloy/computer-database | 03bf3b2337dab5507e3f9880b552bae3df0ab9c8 | 47d7a2b1150d83e81f3f3549d7f8f2cd1b8ddbe9 | refs/heads/master | 2021-01-21T12:49:43.764243 | 2016-05-27T19:10:39 | 2016-05-27T19:10:39 | 32,086,663 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.excilys.computerdatabase.webservice;
import com.excilys.computerdatabase.dto.model.ComputerDto;
/**
* @author Vincent Galloy
* The Interface ComputerResource.
*/
public interface ComputerResource extends CommonResource<ComputerDto> {
}
| [
"vgalloy@excilys.com"
] | vgalloy@excilys.com |
988dec17334a29237fe51b6ef0cdf0f89f17376d | 7a9f4f67610d14532895312750626641ff753e06 | /bbmap/current/structures/ListNum.java | 444ad80b6d909e99065379c76e46c61e1354d2d6 | [
"BSD-3-Clause-LBNL"
] | permissive | IanGBrennan/mitoGenome_Assembly | 8f716cc8ec3ab05c84593e20c5d762aba4021200 | ab056905b8c639af403a6915902ddd70a3bede45 | refs/heads/master | 2022-05-15T04:13:54.579254 | 2022-05-04T06:47:11 | 2022-05-04T06:47:11 | 130,643,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,706 | java | package structures;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
import shared.Shared;
import stream.Read;
public final class ListNum<K extends Serializable> implements Serializable, Iterable<K> {
/**
*
*/
private static final long serialVersionUID = -7509242172010729386L;
public ListNum(ArrayList<K> list_, long id_){
list=list_;
id=id_;
if(GEN_RANDOM_NUMBERS && list!=null){
for(K k : list){
if(k!=null){
((Read)k).rand=randy.nextDouble();
}
}
}
}
public final int size(){
return list==null ? 0 : list.size();
}
@Override
public String toString(){return list==null ? "ln.list=null" : list.toString();}
public final boolean isEmpty() {return list==null || list.isEmpty();}
public final K get(int i){return list.get(i);}
public final K set(int i, K k){return list.set(i, k);}
public final K remove(int i){return list.remove(i);}
public final void add(K k){list.add(k);}
public final void clear(){list.clear();}
@Override
public Iterator<K> iterator() {return list==null ? null : list.iterator();}
public final ArrayList<K> list;
public final long id;
public static synchronized void setDeterministicRandomSeed(long seed_){
if(seed_>=0){seed=seed_;}
else{seed=System.nanoTime()+(long)(Math.random()*10000000);}
}
public static synchronized void setDeterministicRandom(boolean b){
GEN_RANDOM_NUMBERS=b;
if(b){
randy=Shared.threadLocalRandom(seed);
seed++;
}
}
public static boolean deterministicRandom(){
return GEN_RANDOM_NUMBERS;
}
private static boolean GEN_RANDOM_NUMBERS=false;
private static Random randy;
private static long seed=0;
}
| [
"ian.brennan@anu.edu.au"
] | ian.brennan@anu.edu.au |
f32b5b4bcaad890495d64b75c8a8bacd53933d4e | e36b75567821bf1b6bf88b2494b53e71e66e09bb | /app/src/main/java/com/example/lab3/InfoPageActivity.java | e11f327e71ec80b464acc4f08a55a618cfabcd96 | [] | no_license | FruteL/Android_lab3_ListView | fafe7fe589fb3d8f7d9ea929c2d3435f7782d325 | 45571bdd1f745fad37f972669566842f8383db59 | refs/heads/master | 2021-04-18T14:41:35.643094 | 2020-03-24T20:05:25 | 2020-03-24T20:05:25 | 249,554,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,216 | java | package com.example.lab3;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
public class InfoPageActivity extends AppCompatActivity {
//Привязка элементов ЮИ
@BindView(R.id.infoDate)
TextView date;
@BindView(R.id.infoName)
TextView name;
@BindView(R.id.infoGanre)
TextView ganre;
@BindView(R.id.infoInfo)
TextView info;
@BindView(R.id.imageView2)
ImageView image;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info_page);
ButterKnife.bind(this);
//Назначение и отображение данных
name.setText(getIntent().getStringExtra("name"));
ganre.setText("Жанр: " + getIntent().getStringExtra("ganre"));
date.setText("Создание группы: " + getIntent().getStringExtra("date"));
info.setText(getIntent().getStringExtra("info"));
image.setImageResource(getIntent().getIntExtra("avatar", 0));
}
}
| [
"50375650+FruteL@users.noreply.github.com"
] | 50375650+FruteL@users.noreply.github.com |
355c295d34a932a5399cb11494800487c8809159 | f5f05d8fb678cb48cf7560d462012345cf184fea | /android/app/src/main/java/com/mvp/MainApplication.java | d35b1f4a577b899a16717a15a28e0d83eabd5e56 | [
"MIT"
] | permissive | heiseish/MVP | 054f196750678ba259d1e3e6d6baec77fac4d1c5 | 46c92788fe158550576dbedca199b1a9b1c78bfe | refs/heads/master | 2021-10-27T04:31:30.531696 | 2017-05-15T02:19:13 | 2017-05-15T02:19:13 | 90,938,130 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,040 | java | package com.mvp;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"dtrnggiang@gmail.com"
] | dtrnggiang@gmail.com |
00e13881e6949e1727b809a9284892c9fdf93e33 | 12bd98d34991e5525d302365a556a58ef3701d0f | /HeuristicPlayer.java | 3eceeb95bfdc8a377154dec990f21270e123a615 | [] | no_license | giannishorgos/University-Project | 4de7c6d11c7e97df1f277a7fdef7985649349a80 | 1d2f0f15b3d891cc475e52757f05db00b1cde03a | refs/heads/master | 2023-02-04T21:00:30.264462 | 2020-12-20T20:14:15 | 2020-12-20T20:14:15 | 310,521,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,252 | java | //import Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class HeuristicPlayer extends Player {
private ArrayList<Integer[]> path;
private double movepoints; // the points he collects
private int[] supplydistance; // is an array of 4 integers because holds the distance for supplies in the four directions
private int[] minosdistance; // is an array of 4 integers because holds the distance for supplies in the four directions
// constructors
public HeuristicPlayer(){
super();
path = new ArrayList<Integer[]>();
movepoints = 0;
supplydistance = new int[4];
minosdistance = new int[4];
}
public HeuristicPlayer(int playerId, String name, Board board, int score, int x, int y) {
super( playerId, name, board, score, x, y);
path = new ArrayList<Integer[]>();
movepoints = 0;
supplydistance = new int[4];
minosdistance = new int[4];
}
/*
* @description calculates the points as is at the current tile and calls recursively his self on the next tile with the
* same dice and increases the n by one. In that way, the function caluculates the points until n = 3, 3 tiles
* away for the initial current position
*
* @param currentPos: the current position of the player
* dice: the four directions 0: UP, 1: RIGHT 2: DOWN, 3: LEFT
* minosTile: the tile ID of the tile where minotaurus is
* n: tiles away for the initial current position
*
* @return the points based on the supplies he founds, the distance for minotaurus and if there are walls along his way
*
*/
public double evaluate(int currentPos, int dice, int minosTile, int n) {
double sum = 0;
switch( dice){
case 0: // UP
if( board.tiles[currentPos].isUp()) {
sum -=2;
break;
}
for( int i=0; i<board.getS(); i++) {
if( board.supplies[i].getSupplyTileId() == currentPos + board.getN()) {
sum += 3;
supplydistance[dice] = n;
}
}
if( minosTile == currentPos + board.getN()) {
sum -= 6;
minosdistance[dice] = n;
}
n++;
if( n<4) { // n can gets values from 1 to 3 cause the player can see only 3 tiles ahead from him
/* divides the points that collects with n (tiles away from the player) so player gets
* more points if the supply is near him and fewer if the supply is far away. After this
* we add the points in the movepoints.
*/
movepoints += evaluate( currentPos + board.getN(), dice, minosTile, n) / (float)n;
}
break;
case 1: // RIGHT
if( board.tiles[currentPos].isRight()) {
sum -=2;
break;
}
for( int i=0; i<board.getS(); i++) {
if( board.supplies[i].getSupplyTileId() == currentPos + 1) {
sum += 3;
supplydistance[dice] = n;
}
}
if( minosTile == currentPos + 1) {
sum -= 6;
minosdistance[dice] = n;
}
n++;
if( n<4) { // n can gets values from 1 to 3 cause the player can see only 3 tiles ahead from him
/* divides the points that collects with n (tiles away from the player) so player gets
* more points if the supply is near him and fewer if the supply is far away. After this
* we add the points in the movepoints.
*/
movepoints += evaluate( currentPos + 1, dice, minosTile, n) / (float)n;
}
break;
case 2: //DOWN
if( board.tiles[currentPos].isDown()) {
sum -=2;
break;
}
for( int i=0; i<board.getS(); i++) {
if( board.supplies[i].getSupplyTileId() == currentPos - board.getN()) {
sum += 3;
supplydistance[dice] = n;
}
}
if( minosTile == currentPos - board.getN()) {
sum -= 6;
minosdistance[dice] = n;
}
n++;
if(n<4) { // n can gets values from 1 to 3 cause the player can see only 3 tiles ahead from him
/* divides the points that collects with n (tiles away from the player) so player gets
* more points if the supply is near him and fewer if the supply is far away. After this
* we add the points in the movepoints.
*/
movepoints += evaluate( currentPos - board.getN(), dice, minosTile, n) / (float)n;
}
break;
case 3: //LEFT
if( board.tiles[currentPos].isLeft()) {
sum -= 2;
break;
}
for( int i=0; i<board.getS(); i++) {
if( board.supplies[i].getSupplyTileId() == currentPos - 1) {
sum += 3;
supplydistance[dice] = n;
}
}
if( minosTile == currentPos - 1) {
sum -= 6;
minosdistance[dice] = n;
}
n++;
if(n < 4) { // n can gets values from 1 to 3 cause the player can see only 3 tiles ahead from him
/* divides the points that collects with n (tiles away from the player) so player gets
* more points if the supply is near him and fewer if the supply is far away. After this
* we add the points in the movepoints.
*/
movepoints += evaluate( currentPos - 1, dice, minosTile, n) / (float)n;
}
break;
}
return sum + movepoints;
}
/*
* @description this functions calls the evaluate for all four directions and saves the results in a map.
* Then finds the biggest value in the map and return the direction that corresponds with the biggest value
*
* @param currentPos: the current position of the player
* minosTile: the tile ID of the tile where minotaurus is
*
* @return an integer for 0 to 3 which corresponds to the four directions 0: UP, 1: RIGHT, 2: DOWN, 3: LEFT
*/
public int getNextMove(int currentPos, int minosTile) {
Map <String, Double> availableMoves = new HashMap<String, Double>();
movepoints = 0; // erase the previous values for movepoints
availableMoves.put("Up", evaluate(currentPos, 0, minosTile, 1));
movepoints = 0;
availableMoves.put("Right", evaluate(currentPos, 1, minosTile, 1));
movepoints = 0;
availableMoves.put("Down", evaluate(currentPos, 2, minosTile, 1));
movepoints = 0;
availableMoves.put("Left", evaluate(currentPos, 3, minosTile, 1));
// checks if the same as last move and if it is, decreases the points in that direction so the player avoid to go in that direction again
if( path.size() != 0) {
switch( path.get(path.size() -1)[0]) {
case 0:
availableMoves.replace("Down", availableMoves.get("Down"), availableMoves.get("Down") -1);
break;
case 1:
availableMoves.replace("Left", availableMoves.get("Left"), availableMoves.get("Left") -1);
break;
case 2:
availableMoves.replace("Up", availableMoves.get("Up"), availableMoves.get("Up") -1);
break;
case 3:
availableMoves.replace("Right", availableMoves.get("Right"), availableMoves.get("Right") -1);
break;
}
}
double max=-99999;
String key = "";
// finds the max value in the map
for( String srt: availableMoves.keySet()) {
if( availableMoves.get(srt) > max) {
max = availableMoves.get(srt);
key = srt;
}
}
// return an integer that corresponds with the directions with the biggest value
switch( key){
case "Up":
path.add(new Integer[] { 0, supplydistance[0]==1 ? 1 : 0, supplydistance[0], minosdistance[0]});
clearArray();
return 0;
case "Right":
path.add(new Integer[] { 1, supplydistance[1]==1 ? 1 : 0, supplydistance[1], minosdistance[1]});
clearArray();
return 1;
case "Down":
path.add(new Integer[] { 2, supplydistance[2]==1 ? 1 : 0, supplydistance[2], minosdistance[2]});
clearArray();
return 2;
default:
path.add(new Integer[] { 3, supplydistance[3]==1 ? 1 : 0, supplydistance[3], minosdistance[3]});
clearArray();
return 3;
}
}
/*
* @description: in that functions the players are moving randomly
*
* @param id: the current Tile Id of the tile where the player is
* minosTile: the tile ID of the tile where minotaurus is
*
* @return: an array of integers who contains, the new tileId where the player is moved, the x,y coordinates
* of the player and the supplyId of the supply that Thessus collected or -1 if there isn't any supply collected
*/
int[] move(int id, int minosTile) {
int bestMove = getNextMove( id, minosTile);
switch (bestMove) {
case 0:
if (board.tiles[id].isUp()) {
System.out.println("Tries to move up, hits a wall.");
} else {
x++;
tileid = x * board.getN() + y;
System.out.println("Moves up.");
}
break;
case 1:
if (board.tiles[id].isRight()) {
System.out.println("Tries to move right, hits a wall.");
} else {
y++;
tileid = x * board.getN() + y;
System.out.println("Moves right.");
}
break;
case 2:
if (board.tiles[id].isDown()) {
System.out.println("Tries to move down, hits a wall.");
} else {
x--;
tileid = x * board.getN() + y;
System.out.println("Moves down.");
}
break;
case 3:
if (board.tiles[id].isLeft()) {
System.out.println("Tries to move left, hits a wall.");
} else {
y--;
tileid = x * board.getN() + y;
System.out.println("Moves left.");
}
break;
}
/*Checks if there is any supply on the tile where Thesseus is (with playerId = 1), and if there is any,
* increases the score by one and changes the supply coordinates and Supply Tile Id to -1 and in that way
* the supply is disappearing from the board*/
int Sid=-1; //the id of the supply
if (playerId == 1) {
for (int i = 0; i < board.getS(); i++) {
if (board.supplies[i].getSupplyTileId() == x * board.getN() + y) {
Sid = board.supplies[i].getSupplyId();
System.out.println("Collected supply No:" + Sid);
board.supplies[i].setX(-1);
board.supplies[i].setY(-1);
board.supplies[i].setSupplyTileId(-1);
score++;
}
}
}
int[] temp = {x * board.getN() + y, x, y, Sid};
return temp;
}
/*
* @description when the game finishes, print a resume of the player's moves that contains
* the direction of the move, if he collects a supply, the distance for supplies or the Minotaurus
* and the totals supplies he collects, all that for every round
*/
public void statistics() {
int timesUp=0, timesRight=0, timesDown=0, timesLeft=0, suppliesCollected=0;
for( int i=0; i< path.size(); i++ ) {
System.out.println( "\nRound: " +i);
switch( path.get(i)[0]) {
case 0:
System.out.print("Player moved Up.");
timesUp++;
break;
case 1:
System.out.print("Player moved Right.");
timesRight++;
break;
case 2:
System.out.print("Player moved Down.");
timesDown++;
break;
case 3:
System.out.print("Player moved Left.");
timesLeft++;
break;
}
if( path.get(i)[1] == 1) {
suppliesCollected++;
System.out.print(" He collected a supply. Supplies Collected: " + suppliesCollected + ".");
}
if( path.get(i)[2] == 0) {
System.out.print(" But he can't spot a supply.");
}
else {
System.out.print(" Closest supply is " + path.get(i)[2] + " tiles away.");
}
if( path.get(i)[3] == 0) {
System.out.print(" He can't spot Minotauros.");
}
else {
System.out.print(" Minotauros is " + path.get(i)[3] + " tiles away.");
}
}
System.out.println("\nTimes the player moved up: " + timesUp);
System.out.println("Times the player moved right: " + timesRight);
System.out.println("Times the player moved down: " + timesDown);
System.out.println("Times the player moved left: " + timesLeft);
}
/*
* @description clears the arrays supplydistance and minosdistance from previous values
*/
public void clearArray() {
for(int i = 0; i < 4; i++) {
supplydistance[i] = 0;
minosdistance[i] = 0;
}
}
}
| [
"giannis.21.osfp@gmail.com"
] | giannis.21.osfp@gmail.com |
1d5c72896b3d26208796d94ad2d8a4fd08d38381 | 05f93af3af103472b2b54b5b1031787dbde3ce7c | /src/xiang_music_player/NeuQuant.java | ee801728abe313b8b7aa7cad8f78ab398c4ff68f | [] | no_license | Feynman1999/xiang_music_player | 212f9902feed57ead89648e1687755a9759826ac | b0a135b2e97ca661aa77907858368118c6a20980 | refs/heads/master | 2020-04-04T22:49:47.005974 | 2018-11-06T07:17:42 | 2018-11-06T07:17:42 | 156,337,366 | 7 | 3 | null | null | null | null | UTF-8 | Java | false | false | 12,690 | java | package xiang_music_player;
/* NeuQuant Neural-Net Quantization Algorithm
* ------------------------------------------
*
* Copyright (c) 1994 Anthony Dekker
*
* NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994.
* See "Kohonen neural networks for optimal colour quantization"
* in "Network: Computation in Neural Systems" Vol. 5 (1994) pp 351-367.
* for a discussion of the algorithm.
*
* Any party obtaining a copy of these files from the author, directly or
* indirectly, is granted, free of charge, a full and unrestricted irrevocable,
* world-wide, paid up, royalty-free, nonexclusive right and license to deal
* in this software and documentation files (the "Software"), including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons who receive
* copies from any such party to do so, with the only requirement being
* that this copyright notice remain intact.
*/
// Ported to Java 12/00 K Weiner
public class NeuQuant {
protected static final int netsize = 256; /* number of colours used */
/* four primes near 500 - assume no image has a length so large */
/* that it is divisible by all four primes */
protected static final int prime1 = 499;
protected static final int prime2 = 491;
protected static final int prime3 = 487;
protected static final int prime4 = 503;
protected static final int minpicturebytes = (3 * prime4);
/* minimum size for input image */
/* Program Skeleton
----------------
[select samplefac in range 1..30]
[read image from input file]
pic = (unsigned char*) malloc(3*width*height);
initnet(pic,3*width*height,samplefac);
learn();
unbiasnet();
[write output image header, using writecolourmap(f)]
inxbuild();
write output image using inxsearch(b,g,r) */
/* Network Definitions
------------------- */
protected static final int maxnetpos = (netsize - 1);
protected static final int netbiasshift = 4; /* bias for colour values */
protected static final int ncycles = 100; /* no. of learning cycles */
/* defs for freq and bias */
protected static final int intbiasshift = 16; /* bias for fractions */
protected static final int intbias = (((int) 1) << intbiasshift);
protected static final int gammashift = 10; /* gamma = 1024 */
protected static final int gamma = (((int) 1) << gammashift);
protected static final int betashift = 10;
protected static final int beta = (intbias >> betashift); /* beta = 1/1024 */
protected static final int betagamma =
(intbias << (gammashift - betashift));
/* defs for decreasing radius factor */
protected static final int initrad = (netsize >> 3); /* for 256 cols, radius starts */
protected static final int radiusbiasshift = 6; /* at 32.0 biased by 6 bits */
protected static final int radiusbias = (((int) 1) << radiusbiasshift);
protected static final int initradius = (initrad * radiusbias); /* and decreases by a */
protected static final int radiusdec = 30; /* factor of 1/30 each cycle */
/* defs for decreasing alpha factor */
protected static final int alphabiasshift = 10; /* alpha starts at 1.0 */
protected static final int initalpha = (((int) 1) << alphabiasshift);
protected int alphadec; /* biased by 10 bits */
/* radbias and alpharadbias used for radpower calculation */
protected static final int radbiasshift = 8;
protected static final int radbias = (((int) 1) << radbiasshift);
protected static final int alpharadbshift = (alphabiasshift + radbiasshift);
protected static final int alpharadbias = (((int) 1) << alpharadbshift);
/* Types and Global Variables
-------------------------- */
protected byte[] thepicture; /* the input image itself */
protected int lengthcount; /* lengthcount = H*W*3 */
protected int samplefac; /* sampling factor 1..30 */
// typedef int pixel[4]; /* BGRc */
protected int[][] network; /* the network itself - [netsize][4] */
protected int[] netindex = new int[256];
/* for network lookup - really 256 */
protected int[] bias = new int[netsize];
/* bias and freq arrays for learning */
protected int[] freq = new int[netsize];
protected int[] radpower = new int[initrad];
/* radpower for precomputation */
/* Initialise network in range (0,0,0) to (255,255,255) and set parameters
----------------------------------------------------------------------- */
public NeuQuant(byte[] thepic, int len, int sample) {
int i;
int[] p;
thepicture = thepic;
lengthcount = len;
samplefac = sample;
network = new int[netsize][];
for (i = 0; i < netsize; i++) {
network[i] = new int[4];
p = network[i];
p[0] = p[1] = p[2] = (i << (netbiasshift + 8)) / netsize;
freq[i] = intbias / netsize; /* 1/netsize */
bias[i] = 0;
}
}
public byte[] colorMap() {
byte[] map = new byte[3 * netsize];
int[] index = new int[netsize];
for (int i = 0; i < netsize; i++)
index[network[i][3]] = i;
int k = 0;
for (int i = 0; i < netsize; i++) {
int j = index[i];
map[k++] = (byte) (network[j][0]);
map[k++] = (byte) (network[j][1]);
map[k++] = (byte) (network[j][2]);
}
return map;
}
/* Insertion sort of network and building of netindex[0..255] (to do after unbias)
------------------------------------------------------------------------------- */
public void inxbuild() {
int i, j, smallpos, smallval;
int[] p;
int[] q;
int previouscol, startpos;
previouscol = 0;
startpos = 0;
for (i = 0; i < netsize; i++) {
p = network[i];
smallpos = i;
smallval = p[1]; /* index on g */
/* find smallest in i..netsize-1 */
for (j = i + 1; j < netsize; j++) {
q = network[j];
if (q[1] < smallval) { /* index on g */
smallpos = j;
smallval = q[1]; /* index on g */
}
}
q = network[smallpos];
/* swap p (i) and q (smallpos) entries */
if (i != smallpos) {
j = q[0];
q[0] = p[0];
p[0] = j;
j = q[1];
q[1] = p[1];
p[1] = j;
j = q[2];
q[2] = p[2];
p[2] = j;
j = q[3];
q[3] = p[3];
p[3] = j;
}
/* smallval entry is now in position i */
if (smallval != previouscol) {
netindex[previouscol] = (startpos + i) >> 1;
for (j = previouscol + 1; j < smallval; j++)
netindex[j] = i;
previouscol = smallval;
startpos = i;
}
}
netindex[previouscol] = (startpos + maxnetpos) >> 1;
for (j = previouscol + 1; j < 256; j++)
netindex[j] = maxnetpos; /* really 256 */
}
/* Main Learning Loop
------------------ */
public void learn() {
int i, j, b, g, r;
int radius, rad, alpha, step, delta, samplepixels;
byte[] p;
int pix, lim;
if (lengthcount < minpicturebytes)
samplefac = 1;
alphadec = 30 + ((samplefac - 1) / 3);
p = thepicture;
pix = 0;
lim = lengthcount;
samplepixels = lengthcount / (3 * samplefac);
delta = samplepixels / ncycles;
alpha = initalpha;
radius = initradius;
rad = radius >> radiusbiasshift;
if (rad <= 1)
rad = 0;
for (i = 0; i < rad; i++)
radpower[i] =
alpha * (((rad * rad - i * i) * radbias) / (rad * rad));
//fprintf(stderr,"beginning 1D learning: initial radius=%d/n", rad);
if (lengthcount < minpicturebytes)
step = 3;
else if ((lengthcount % prime1) != 0)
step = 3 * prime1;
else {
if ((lengthcount % prime2) != 0)
step = 3 * prime2;
else {
if ((lengthcount % prime3) != 0)
step = 3 * prime3;
else
step = 3 * prime4;
}
}
i = 0;
while (i < samplepixels) {
b = (p[pix + 0] & 0xff) << netbiasshift;
g = (p[pix + 1] & 0xff) << netbiasshift;
r = (p[pix + 2] & 0xff) << netbiasshift;
j = contest(b, g, r);
altersingle(alpha, j, b, g, r);
if (rad != 0)
alterneigh(rad, j, b, g, r); /* alter neighbours */
pix += step;
if (pix >= lim)
pix -= lengthcount;
i++;
if (delta == 0)
delta = 1;
if (i % delta == 0) {
alpha -= alpha / alphadec;
radius -= radius / radiusdec;
rad = radius >> radiusbiasshift;
if (rad <= 1)
rad = 0;
for (j = 0; j < rad; j++)
radpower[j] =
alpha * (((rad * rad - j * j) * radbias) / (rad * rad));
}
}
//fprintf(stderr,"finished 1D learning: final alpha=%f !/n",((float)alpha)/initalpha);
}
/* Search for BGR values 0..255 (after net is unbiased) and return colour index
---------------------------------------------------------------------------- */
public int map(int b, int g, int r) {
int i, j, dist, a, bestd;
int[] p;
int best;
bestd = 1000; /* biggest possible dist is 256*3 */
best = -1;
i = netindex[g]; /* index on g */
j = i - 1; /* start at netindex[g] and work outwards */
while ((i < netsize) || (j >= 0)) {
if (i < netsize) {
p = network[i];
dist = p[1] - g; /* inx key */
if (dist >= bestd)
i = netsize; /* stop iter */
else {
i++;
if (dist < 0)
dist = -dist;
a = p[0] - b;
if (a < 0)
a = -a;
dist += a;
if (dist < bestd) {
a = p[2] - r;
if (a < 0)
a = -a;
dist += a;
if (dist < bestd) {
bestd = dist;
best = p[3];
}
}
}
}
if (j >= 0) {
p = network[j];
dist = g - p[1]; /* inx key - reverse dif */
if (dist >= bestd)
j = -1; /* stop iter */
else {
j--;
if (dist < 0)
dist = -dist;
a = p[0] - b;
if (a < 0)
a = -a;
dist += a;
if (dist < bestd) {
a = p[2] - r;
if (a < 0)
a = -a;
dist += a;
if (dist < bestd) {
bestd = dist;
best = p[3];
}
}
}
}
}
return (best);
}
public byte[] process() {
learn();
unbiasnet();
inxbuild();
return colorMap();
}
/* Unbias network to give byte values 0..255 and record position i to prepare for sort
----------------------------------------------------------------------------------- */
public void unbiasnet() {
int i, j;
for (i = 0; i < netsize; i++) {
network[i][0] >>= netbiasshift;
network[i][1] >>= netbiasshift;
network[i][2] >>= netbiasshift;
network[i][3] = i; /* record colour no */
}
}
/* Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
--------------------------------------------------------------------------------- */
protected void alterneigh(int rad, int i, int b, int g, int r) {
int j, k, lo, hi, a, m;
int[] p;
lo = i - rad;
if (lo < -1)
lo = -1;
hi = i + rad;
if (hi > netsize)
hi = netsize;
j = i + 1;
k = i - 1;
m = 1;
while ((j < hi) || (k > lo)) {
a = radpower[m++];
if (j < hi) {
p = network[j++];
try {
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
} catch (Exception e) {
} // prevents 1.3 miscompilation
}
if (k > lo) {
p = network[k--];
try {
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
} catch (Exception e) {
}
}
}
}
/* Move neuron i towards biased (b,g,r) by factor alpha
---------------------------------------------------- */
protected void altersingle(int alpha, int i, int b, int g, int r) {
/* alter hit neuron */
int[] n = network[i];
n[0] -= (alpha * (n[0] - b)) / initalpha;
n[1] -= (alpha * (n[1] - g)) / initalpha;
n[2] -= (alpha * (n[2] - r)) / initalpha;
}
/* Search for biased BGR values
---------------------------- */
protected int contest(int b, int g, int r) {
/* finds closest neuron (min dist) and updates freq */
/* finds best neuron (min dist-bias) and returns position */
/* for frequently chosen neurons, freq[i] is high and bias[i] is negative */
/* bias[i] = gamma*((1/netsize)-freq[i]) */
int i, dist, a, biasdist, betafreq;
int bestpos, bestbiaspos, bestd, bestbiasd;
int[] n;
bestd = ~(((int) 1) << 31);
bestbiasd = bestd;
bestpos = -1;
bestbiaspos = bestpos;
for (i = 0; i < netsize; i++) {
n = network[i];
dist = n[0] - b;
if (dist < 0)
dist = -dist;
a = n[1] - g;
if (a < 0)
a = -a;
dist += a;
a = n[2] - r;
if (a < 0)
a = -a;
dist += a;
if (dist < bestd) {
bestd = dist;
bestpos = i;
}
biasdist = dist - ((bias[i]) >> (intbiasshift - netbiasshift));
if (biasdist < bestbiasd) {
bestbiasd = biasdist;
bestbiaspos = i;
}
betafreq = (freq[i] >> betashift);
freq[i] -= betafreq;
bias[i] += (betafreq << gammashift);
}
freq[bestpos] += beta;
bias[bestpos] -= betagamma;
return (bestbiaspos);
}
} | [
"chenyx.cs@gmail.com"
] | chenyx.cs@gmail.com |
895846b132c4f458b9f0f30e50797fd9c765b0d5 | 1b607ec3c4dc0bd5ff6130f441d0045f173fc2cb | /src/main/java/test/java/TestMyBatis.java | 60e55ec397f5a6f64cfdf63eb75399cae0aaec62 | [] | no_license | jjxxff20000/wangmd | cbbbe5ff0622e82c27fb0bb02595ce92bbbba851 | 058bc5aa2c3295ff48243150c0f018d4c3e4f890 | refs/heads/master | 2021-01-18T08:33:07.356166 | 2017-03-08T09:44:49 | 2017-03-08T09:44:49 | 84,305,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package test.java;
import javax.annotation.Resource;
import com.wangjie.spring.model.User;
import com.wangjie.spring.service.UserService;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.alibaba.fastjson.JSON;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring-mybatis.xml" })
public class TestMyBatis {
private static Logger logger = Logger.getLogger(TestMyBatis.class);
@Resource
private UserService userService;
@Test
public void test() {
User user = userService.getUserById(2);
logger.info(JSON.toJSONString(user));
}
}
| [
"15810415279@163.com"
] | 15810415279@163.com |
af026ac0d3ea7fe053b1cb3dd96b51f573601cc7 | f3cb06dbe4e38081b3d183854904fdbcb46a6612 | /Code/Framework/org.deltaecore.feature.configuration.resource.deconfiguration/src/org/deltaecore/feature/configuration/resource/deconfiguration/analysis/DEVersionSelectionFeatureReferenceResolver.java | 9b7736e9829c5b5b40d0b4e65a14d4e62284c3cd | [
"Apache-2.0"
] | permissive | chseidl/deltaecore | 0e042d575f02de3f87e7c153a6710efb0c23870c | d1dee57f60a7e5be823c83a934c7736da1ac2c48 | refs/heads/main | 2023-06-17T07:23:41.572338 | 2021-07-08T16:04:32 | 2021-07-08T16:04:32 | 331,638,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | /**
* <copyright>
* </copyright>
*
*
*/
package org.deltaecore.feature.configuration.resource.deconfiguration.analysis;
import java.util.Map;
import org.deltaecore.feature.DEFeature;
import org.deltaecore.feature.configuration.DEVersionSelection;
import org.deltaecore.feature.configuration.resource.deconfiguration.IDeconfigurationReferenceResolveResult;
import org.deltaecore.feature.configuration.resource.deconfiguration.IDeconfigurationReferenceResolver;
import org.deltaecore.feature.configuration.util.DEConfigurationResolverUtil;
import org.deltaecore.feature.util.DEFeatureResolverUtil;
import org.eclipse.emf.ecore.EReference;
public class DEVersionSelectionFeatureReferenceResolver implements IDeconfigurationReferenceResolver<DEVersionSelection, DEFeature> {
public void resolve(String identifier, DEVersionSelection container, EReference reference, int position, boolean resolveFuzzy, final IDeconfigurationReferenceResolveResult<DEFeature> result) {
DEFeature feature = DEConfigurationResolverUtil.resolveFeature(identifier, container);
if (feature != null) {
result.addMapping(identifier, feature);
}
}
public String deResolve(DEFeature feature, DEVersionSelection container, EReference reference) {
return DEFeatureResolverUtil.deresolveFeature(feature);
}
public void setOptions(Map<?,?> options) {
// save options in a field or leave method empty if this resolver does not depend
// on any option
}
}
| [
"chse@itu.dk"
] | chse@itu.dk |
60a598cd626e95987b282d5e94c0d2ab06b0377c | 8d1bfea7c95e7ded4052d39b779f2f40deca38ac | /src/main/java/com/jaeksoft/opensearchserver/GraphQLSchemaBuilder.java | 2782e5c5d41870ee0cca4b3f5145c1c538d83da9 | [
"Apache-2.0"
] | permissive | naveenann/opensearchserver | 96d7ab2098dbbbac0b7011c056a1662a0f4317c6 | 8f381680fabc11a838c0afd54b74d401ec04434c | refs/heads/master | 2022-09-17T17:59:03.772289 | 2022-06-03T02:55:21 | 2022-06-03T02:55:21 | 20,827,329 | 0 | 0 | Apache-2.0 | 2022-09-16T21:08:30 | 2014-06-14T07:21:53 | Java | UTF-8 | Java | false | false | 27,454 | java | /*
* Copyright 2017-2021 Emmanuel Keller / Jaeksoft
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jaeksoft.opensearchserver;
import com.qwazr.search.analysis.SmartAnalyzerSet;
import com.qwazr.search.query.QueryParserOperator;
import com.qwazr.utils.StringUtils;
import graphql.GraphQL;
import static graphql.Scalars.GraphQLBoolean;
import static graphql.Scalars.GraphQLFloat;
import static graphql.Scalars.GraphQLInt;
import static graphql.Scalars.GraphQLString;
import graphql.schema.DataFetcher;
import static graphql.schema.FieldCoordinates.coordinates;
import graphql.schema.GraphQLArgument;
import static graphql.schema.GraphQLArgument.newArgument;
import graphql.schema.GraphQLCodeRegistry;
import static graphql.schema.GraphQLCodeRegistry.newCodeRegistry;
import graphql.schema.GraphQLEnumType;
import static graphql.schema.GraphQLEnumType.newEnum;
import graphql.schema.GraphQLFieldDefinition;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import graphql.schema.GraphQLInputObjectField;
import static graphql.schema.GraphQLInputObjectField.newInputObjectField;
import graphql.schema.GraphQLInputObjectType;
import static graphql.schema.GraphQLInputObjectType.newInputObject;
import graphql.schema.GraphQLList;
import graphql.schema.GraphQLNonNull;
import graphql.schema.GraphQLObjectType;
import static graphql.schema.GraphQLObjectType.newObject;
import graphql.schema.GraphQLSchema;
import graphql.schema.GraphQLUnionType;
import static graphql.schema.GraphQLUnionType.newUnionType;
import graphql.schema.TypeResolver;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class GraphQLSchemaBuilder {
private final static String indexDocumentPrefix = "Index";
private final static String indexDocumentSuffix = "Document";
private final static String queryDocumentPrefix = "Query";
private final static String queryDocumentSuffix = "Document";
private final GraphQLFunctions functions;
private final List<GraphQLFieldDefinition> rootQueries;
private final List<GraphQLFieldDefinition> rootMutations;
private final GraphQLCodeRegistry.Builder codeRegistry;
private final IndexContext indexContext;
private final FieldContext fieldContext;
private final QueryContext queryContext;
private static <T extends Enum<T>> GraphQLEnumType createEnum(String name, String description, T... values) {
final GraphQLEnumType.Builder builder = newEnum()
.name(name)
.description(description);
for (final T value : values) {
builder.value(value.name());
}
return builder.build();
}
GraphQLSchemaBuilder(final GraphQLFunctions functions) {
this.functions = functions;
rootQueries = new ArrayList();
rootMutations = new ArrayList();
codeRegistry = newCodeRegistry();
indexContext = new IndexContext();
fieldContext = new FieldContext();
queryContext = new QueryContext();
}
public GraphQL build() {
indexContext.build();
fieldContext.build();
queryContext.build();
for (GraphQLFunctions.Index index : functions.getIndexList(null, 0, Integer.MAX_VALUE)) {
final String sourceIndexName = index.name.trim();
final String capitalizedIndexName = StringUtils.capitalize(sourceIndexName);
final List<GraphQLFunctions.Field> fields = functions.getFieldList(sourceIndexName);
indexContext.buildPerIndex(sourceIndexName, capitalizedIndexName, fields);
queryContext.buildPerIndex(sourceIndexName, capitalizedIndexName, fields);
}
final GraphQLSchema.Builder builder = GraphQLSchema.newSchema();
builder.query(newObject()
.name("Query")
.description("root queries")
.fields(rootQueries)
.build());
builder.mutation(newObject()
.name("Mutation")
.description("root mutations")
.fields(rootMutations)
.build());
final GraphQLSchema schema = builder.codeRegistry(codeRegistry.build()).build();
return GraphQL.newGraphQL(schema).build();
}
private class IndexContext {
private final static String INDEX_NAME_DESCRIPTION = "The name of the index";
private final GraphQLArgument indexNameArgument;
private IndexContext() {
indexNameArgument = newArgument()
.name("indexName")
.description(INDEX_NAME_DESCRIPTION)
.type(GraphQLNonNull.nonNull(GraphQLString))
.build();
}
private void createIndexFunctions() {
final GraphQLObjectType indexType = newObject()
.name("Index")
.description("An index")
.field(newFieldDefinition()
.name("name")
.description(INDEX_NAME_DESCRIPTION)
.type(GraphQLNonNull.nonNull(GraphQLString)))
.field(newFieldDefinition()
.name("id")
.description("The unique id of the index")
.type(GraphQLNonNull.nonNull(GraphQLString)))
.build();
final GraphQLFieldDefinition createIndexFunc = newFieldDefinition()
.name("createIndex")
.argument(indexNameArgument)
.type(GraphQLBoolean)
.build();
codeRegistry.dataFetcher(
coordinates("Mutation", "createIndex"),
functions::createIndex);
rootMutations.add(createIndexFunc);
final GraphQLFieldDefinition deleteIndexFunc = newFieldDefinition()
.name("deleteIndex")
.argument(indexNameArgument)
.type(GraphQLBoolean)
.build();
codeRegistry.dataFetcher(
coordinates("Mutation", "deleteIndex"),
functions::deleteIndex);
rootMutations.add(deleteIndexFunc);
final GraphQLFieldDefinition indexListFunc = newFieldDefinition()
.name("getIndexes")
.argument(
newArgument()
.name("keywords")
.description("Filter the index list ")
.type(GraphQLString)
.build())
.type(GraphQLList.list(indexType))
.build();
codeRegistry.dataFetcher(
coordinates("Query", "getIndexes"),
functions::getIndexes);
rootQueries.add(indexListFunc);
}
private void build() {
createIndexFunctions();
}
private void buildPerIndex(String sourceIndexName, String capitalizedIndexName, List<GraphQLFunctions.Field> fields) {
final GraphQLInputObjectType.Builder indexDocumentBuilder = newInputObject()
.name(indexDocumentPrefix + capitalizedIndexName + indexDocumentSuffix)
.description("A document following the schema of the index \"" + sourceIndexName + "\"");
for (final GraphQLFunctions.Field field : fields) {
indexDocumentBuilder.field(newInputObjectField()
.name(field.name)
.type(field.getGraphScalarType())
.build());
}
final GraphQLInputObjectType indexDocument = indexDocumentBuilder.build();
if (indexDocument.getFields().isEmpty())
return;
final String ingestFunctionName = "ingest" + capitalizedIndexName;
final GraphQLFieldDefinition ingestDocuments = newFieldDefinition()
.name(ingestFunctionName)
.description("Ingest a document into \"" + sourceIndexName + "\"")
.argument(newArgument().name("docs").type(GraphQLList.list(indexDocument)))
.type(GraphQLBoolean)
.build();
rootMutations.add(ingestDocuments);
codeRegistry.dataFetcher(
coordinates("Mutation", ingestFunctionName),
(DataFetcher<?>) env -> functions.ingestDocuments(sourceIndexName, env));
}
}
private class FieldContext {
private final GraphQLFieldDefinition fieldNameField;
private final GraphQLArgument fieldNameArgument;
private final GraphQLFieldDefinition indexedFieldField;
private final GraphQLArgument indexedArgument;
private final GraphQLFieldDefinition sortableFieldField;
private final GraphQLArgument sortableArgument;
private final GraphQLFieldDefinition storedFieldField;
private final GraphQLFieldDefinition facetFieldField;
private final GraphQLArgument storedArgument;
private final GraphQLArgument facetArgument;
private FieldContext() {
// Field name
final String fieldNameDescription = "The name of the field";
fieldNameField = newFieldDefinition()
.name("name")
.description(fieldNameDescription)
.type(GraphQLNonNull.nonNull(GraphQLString)).build();
fieldNameArgument = newArgument()
.name("fieldName")
.description(fieldNameDescription)
.type(GraphQLNonNull.nonNull(GraphQLString))
.build();
// Field Indexed
final String indexedDescription = "Define if the field can be used im queries";
indexedFieldField = newFieldDefinition()
.name("indexed")
.description(indexedDescription)
.type(GraphQLBoolean).build();
indexedArgument = newArgument()
.name("indexed")
.description(indexedDescription)
.type(GraphQLBoolean)
.build();
// Field Sortable
final String sortableDescription = "Define if the field can be used to sort the result";
sortableFieldField = newFieldDefinition()
.name("sortable")
.description(sortableDescription)
.type(GraphQLBoolean).build();
sortableArgument = newArgument()
.name("sortable")
.description(sortableDescription)
.type(GraphQLBoolean)
.build();
// Field Stored
final String storedDescription = "Define if the field content can be returned";
storedFieldField = newFieldDefinition()
.name("stored")
.description(storedDescription)
.type(GraphQLBoolean).build();
storedArgument = newArgument()
.name("stored")
.description(storedDescription)
.type(GraphQLBoolean)
.build();
// Field facet
final String facetDescription = "Define if the field can be used in a facet";
facetFieldField = newFieldDefinition()
.name("facet")
.description(facetDescription)
.type(GraphQLBoolean).build();
facetArgument = newArgument()
.name("facet")
.description(facetDescription)
.type(GraphQLBoolean)
.build();
}
private GraphQLObjectType createTextField() {
final String textAnalyzerDescription = "The text analyzer applied to the content";
final GraphQLEnumType textAnalyzerEnum = createEnum("TextAnalyzer", "Text analyzer", SmartAnalyzerSet.values());
final GraphQLFieldDefinition textAnalyzerField = newFieldDefinition()
.name("textAnalyzer")
.description(textAnalyzerDescription)
.type(textAnalyzerEnum)
.build();
final GraphQLObjectType textField = newObject()
.name("TextField")
.description("A text field")
.fields(List.of(fieldNameField, textAnalyzerField, sortableFieldField, storedFieldField, facetFieldField))
.build();
final GraphQLArgument textAnalyzerArgument = newArgument()
.name("textAnalyzer")
.description(textAnalyzerDescription)
.type(textAnalyzerEnum)
.build();
final GraphQLFieldDefinition setTextFieldFunc = newFieldDefinition()
.name("setTextField")
.description("Create or update a text field")
.arguments(List.of(indexContext.indexNameArgument, fieldNameArgument, textAnalyzerArgument, sortableArgument, storedArgument, facetArgument))
.type(GraphQLBoolean)
.build();
codeRegistry.dataFetcher(
coordinates("Mutation", "setTextField"),
functions::setTextField);
rootMutations.add(setTextFieldFunc);
return textField;
}
private GraphQLObjectType createIntegerField() {
final String integerDescription = "A 32 bits integer field. Whole numbers from -2,147,483,648 to 2,147,483,647.";
final GraphQLObjectType integerField = newObject()
.name("IntegerField")
.description(integerDescription)
.fields(List.of(fieldNameField, indexedFieldField, sortableFieldField, storedFieldField))
.build();
final GraphQLFieldDefinition setIntegerFieldFunc = newFieldDefinition()
.name("setIntegerField")
.description("Create or update a 32 bits integer field. Whole numbers from -2,147,483,648 to 2,147,483,647.")
.arguments(List.of(indexContext.indexNameArgument, fieldNameArgument, indexedArgument, sortableArgument, storedArgument))
.type(GraphQLBoolean)
.build();
rootMutations.add(setIntegerFieldFunc);
codeRegistry.dataFetcher(
coordinates("Mutation", "setIntegerField"),
functions::setIntegerField);
return integerField;
}
private GraphQLObjectType createFloatField() {
final String floatDescription = "A 32 bits decimal field for fractional numbers. Sufficient for storing 6 to 7 decimal digits.";
final GraphQLObjectType floatField = newObject()
.name("FloatField")
.description(floatDescription)
.fields(List.of(fieldNameField, indexedFieldField, sortableFieldField, storedFieldField))
.build();
final GraphQLFieldDefinition setFloatFieldFunc = newFieldDefinition()
.name("setFloatField")
.description("Create or update a 32 bits decimal field. Sufficient for storing 6 to 7 decimal digits.")
.arguments(List.of(indexContext.indexNameArgument, fieldNameArgument, indexedArgument, sortableArgument, storedArgument))
.type(GraphQLBoolean)
.build();
rootMutations.add(setFloatFieldFunc);
codeRegistry.dataFetcher(
coordinates("Mutation", "setFloatField"),
functions::setFloatField);
return floatField;
}
private void createFieldList(GraphQLObjectType textField,
GraphQLObjectType integerField,
GraphQLObjectType floatField) {
final GraphQLUnionType unionFieldType = newUnionType()
.name("Field")
.possibleTypes(textField, integerField, floatField)
.build();
final GraphQLFieldDefinition fieldListFunc = newFieldDefinition()
.name("getFields")
.argument(indexContext.indexNameArgument)
.type(GraphQLList.list(unionFieldType))
.build();
rootQueries.add(fieldListFunc);
final Map<Class<? extends GraphQLFunctions.Field>, GraphQLObjectType> fieldTypeClassMap = Map.of(
GraphQLFunctions.TextField.class, textField,
GraphQLFunctions.IntegerField.class, integerField,
GraphQLFunctions.FloatField.class, floatField
);
final TypeResolver fieldTypeResolver = env -> fieldTypeClassMap.get(env.getObject().getClass());
codeRegistry
.typeResolver(unionFieldType, fieldTypeResolver)
.dataFetcher(
coordinates("Query", "getFields"),
functions::getFields);
// Field deletion
final GraphQLFieldDefinition deleteFieldFunc = newFieldDefinition()
.name("deleteField")
.description("Delete a field")
.arguments(List.of(indexContext.indexNameArgument, fieldNameArgument))
.type(GraphQLBoolean)
.build();
rootMutations.add(deleteFieldFunc);
codeRegistry.dataFetcher(
coordinates("Mutation", "deleteField"),
functions::deleteField);
}
private void build() {
final GraphQLObjectType textField = createTextField();
final GraphQLObjectType integerField = createIntegerField();
final GraphQLObjectType floatField = createFloatField();
createFieldList(textField, integerField, floatField);
}
}
private class QueryContext {
private GraphQLInputObjectType standardQueryParserInputType;
private GraphQLInputObjectType multiFieldQueryParserInputType;
private GraphQLInputObjectType simpleQueryParserInputType;
private GraphQLInputObjectType fieldBoost;
private void build() {
fieldBoost = GraphQLInputObjectType.newInputObject()
.name("FieldBoost")
.field(newInputObjectField().name("field").type(GraphQLString).build())
.field(newInputObjectField().name("boost").type(GraphQLFloat).build())
.build();
final List<GraphQLInputObjectField> commonQueryParserInputFields = buildCommonQueryInputFields();
final List<GraphQLInputObjectField> commonClassicQueryParserInputFields = buildCommonClassicQueryInputFields();
standardQueryParserInputType = GraphQLInputObjectType.newInputObject()
.name("StandardQueryParserParameters")
.description("StandardQueryParser parameters")
.fields(commonQueryParserInputFields)
.fields(commonClassicQueryParserInputFields)
.build();
multiFieldQueryParserInputType = GraphQLInputObjectType.newInputObject()
.name("MultiFieldQueryParserParameters")
.description("StandardQueryParser parameters")
.fields(commonQueryParserInputFields)
.fields(commonClassicQueryParserInputFields)
.field(newInputObjectField().name("fields").type(GraphQLList.list(GraphQLString)))
.field(newInputObjectField().name("fieldBoosts").type(GraphQLList.list(fieldBoost)))
.build();
final GraphQLInputObjectType.Builder simpleQueryParserInputTypeBuilder = GraphQLInputObjectType.newInputObject()
.name("SimpleQueryParserParameters")
.description("SimpleQueryParser parameters")
.fields(commonQueryParserInputFields)
.field(newInputObjectField().name("fieldBoosts").type(GraphQLList.list(fieldBoost)));
for (GraphQLFunctions.SimpleOperator operator : GraphQLFunctions.SimpleOperator.values()) {
simpleQueryParserInputTypeBuilder.field(
newInputObjectField()
.name(operator.name())
.type(GraphQLBoolean)
.build());
}
simpleQueryParserInputType = simpleQueryParserInputTypeBuilder.build();
}
private List<GraphQLInputObjectField> buildCommonQueryInputFields() {
return List.of(
newInputObjectField()
.name("queryString")
.type(GraphQLString)
.build(),
newInputObjectField()
.name("enableGraphQueries")
.type(GraphQLBoolean)
.build(),
newInputObjectField()
.name("enablePositionIncrements")
.type(GraphQLBoolean)
.build(),
newInputObjectField()
.name("autoGenerateMultiTermSynonymsPhraseQuery")
.type(GraphQLBoolean)
.build());
}
private List<GraphQLInputObjectField> buildCommonClassicQueryInputFields() {
return List.of(
newInputObjectField()
.name("allowLeadingWildcard")
.type(GraphQLBoolean)
.build(),
newInputObjectField()
.name("autoGeneratePhraseQuery")
.type(GraphQLBoolean)
.build(),
newInputObjectField()
.name("fuzzyMinSim")
.type(GraphQLFloat)
.build(),
newInputObjectField()
.name("fuzzyPrefixLength")
.type(GraphQLInt)
.build(),
newInputObjectField()
.name("splitOnWhitespace")
.type(GraphQLBoolean)
.build(),
newInputObjectField()
.name("maxDeterminizedStates")
.type(GraphQLInt)
.build(),
newInputObjectField()
.name("defaultOperator")
.type(createEnum("QueryOperator", "Query operator", QueryParserOperator.values()))
.build(),
newInputObjectField()
.name("phraseSlop")
.type(GraphQLInt)
.build());
}
private void createSimpleQuery(String capitalizedIndexName, String sourceIndexName, GraphQLObjectType queryResultType) {
final String queryFunctionName = "simpleQuery" + capitalizedIndexName;
final GraphQLFieldDefinition.Builder builder = newFieldDefinition()
.name(queryFunctionName)
.description("Simple query from \"" + sourceIndexName + "\"")
.argument(newArgument().name("params").type(simpleQueryParserInputType))
.type(queryResultType);
queryParams(builder);
rootQueries.add(builder.build());
codeRegistry.dataFetcher(
coordinates("Query", queryFunctionName),
(DataFetcher<?>) env -> functions.searchWithSimpleQueryParser(sourceIndexName, env));
}
private void createMultiFieldQuery(String capitalizedIndexName, String sourceIndexName, GraphQLObjectType queryResultType) {
final String queryFunctionName = "multiFieldQuery" + capitalizedIndexName;
final GraphQLFieldDefinition.Builder builder = newFieldDefinition()
.name(queryFunctionName)
.description("Multi-field query from \"" + sourceIndexName + "\"")
.argument(newArgument().name("params").type(multiFieldQueryParserInputType))
.type(queryResultType);
queryParams(builder);
rootQueries.add(builder.build());
codeRegistry.dataFetcher(
coordinates("Query", queryFunctionName),
(DataFetcher<?>) env -> functions.searchWithMultiFieldQueryParser(sourceIndexName, env));
}
private void queryParams(GraphQLFieldDefinition.Builder builder) {
builder
.argument(newArgument().name("start").type(GraphQLInt).build())
.argument(newArgument().name("rows").type(GraphQLInt).build());
// .argument(newArgument().name("returnedFields").type(GraphQLList.list(GraphQLString)).build());
}
private void createStandardQuery(String capitalizedIndexName, String sourceIndexName, GraphQLObjectType queryResultType) {
final String queryFunctionName = "standardFieldQuery" + capitalizedIndexName;
final GraphQLFieldDefinition.Builder builder = newFieldDefinition()
.name(queryFunctionName)
.description("Standard query from \"" + sourceIndexName + "\"")
.argument(newArgument().name("params").type(standardQueryParserInputType))
.type(queryResultType);
queryParams(builder);
rootQueries.add(builder.build());
codeRegistry.dataFetcher(
coordinates("Query", queryFunctionName),
(DataFetcher<?>) env -> functions.searchWithStandardQueryParser(sourceIndexName, env));
}
private void buildPerIndex(String sourceIndexName, String capitalizedIndexName, List<GraphQLFunctions.Field> fields) {
if (fields == null || fields.isEmpty())
return;
final GraphQLObjectType.Builder queryDocumentTypeBuilder = newObject()
.name(queryDocumentPrefix + capitalizedIndexName + queryDocumentSuffix)
.description("A document following the schema of the index \"" + sourceIndexName + "\"");
for (final GraphQLFunctions.Field field : fields) {
queryDocumentTypeBuilder.field(newFieldDefinition()
.name(field.name)
.type(field.getGraphScalarType())
.build());
}
final GraphQLObjectType queryDocumentType = queryDocumentTypeBuilder.build();
final GraphQLObjectType queryResultType = newObject()
.name("QueryResult" + capitalizedIndexName)
.field(newFieldDefinition().name("totalHits").type(GraphQLNonNull.nonNull(GraphQLInt)).build())
.field(newFieldDefinition().name("documents").type(GraphQLNonNull.nonNull(GraphQLList.list(queryDocumentType))))
.build();
createSimpleQuery(capitalizedIndexName, sourceIndexName, queryResultType);
createMultiFieldQuery(capitalizedIndexName, sourceIndexName, queryResultType);
createStandardQuery(capitalizedIndexName, sourceIndexName, queryResultType);
}
}
}
| [
"ekeller@open-search-server.com"
] | ekeller@open-search-server.com |
35547d4b6288b8f090d31f9d82d0fd1a16e6889d | c73de4360b45a7b3cd6de5bcaa771f4e161106e6 | /src/main/java/tasks/Task.java | c4c662f286747be90ca717f779f526e23b5361db | [] | no_license | loycatherine/duke | 564ff4eaabc4214040550a172c8070408b893014 | c4e61cff09c1522fa579b429564b80d99e056b06 | refs/heads/master | 2020-12-13T16:51:29.725209 | 2020-02-20T04:51:42 | 2020-02-20T04:51:42 | 234,476,583 | 0 | 0 | null | 2020-02-24T14:51:09 | 2020-01-17T05:22:34 | Java | UTF-8 | Java | false | false | 1,379 | java | package tasks;
/**
* Represents a task that needs to be completed.
* It contains a description of the task,
* and a boolean isDone that states if the task is completed or not.
*/
public class Task {
protected String description;
protected boolean isDone;
protected String note;
public Task(String description) {
this.description = description;
this.isDone = false;
}
public String getStatusIcon() {
return (isDone ? "[\u2713]": "[\u2718]"); //return tick or X symbols
//return (isDone ? "[✓]" : "[✗]");
}
public int getStatusNum() {
return (isDone ? 1 : 0);
}
public String getTaskType() {
return "";
}
public boolean contains(String keyword) {
return this.description.contains(keyword);
}
public void setNote(String note) {
this.note = note;
}
public String getNote() {
return this.note;
}
public void setStatus(String status) {
this.isDone = (!status.equals("0"));
}
public String getDescription() {
return this.description;
}
public void markDone() {
this.isDone = true;
}
public String toString() {
return getStatusIcon() + " " + getDescription();
}
public String saveString() {
return getStatusNum() + " | " + getDescription();
}
}
| [
"catherineloy99@gmail.com"
] | catherineloy99@gmail.com |
931bbdd2b011dbfda28efa7be66be77950a1afc5 | ca19e1bd4de0f58166bcbb2920fd05affa753814 | /src/xyz/hui_yi/keywords/servlet/CompanyInfoServlet.java | 740ef6c7299a50b88a98cff4d5007b6bf876cff7 | [] | no_license | li-fengjie/keyword | be501e6497f65dd51c7301f8ce1b2203ffd6edc1 | bea6986469c79b2d6030e4bc07facacc728c92f4 | refs/heads/master | 2020-12-11T10:22:18.772474 | 2020-01-26T05:07:35 | 2020-01-26T05:07:35 | 233,821,179 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,649 | java | package xyz.hui_yi.keywords.servlet;
import net.sf.json.JSONObject;
import xyz.hui_yi.keywords.bean.CompanyPageBean;
import xyz.hui_yi.keywords.dao.CompanyDao;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Servlet implementation class InfoServlet
*/
@WebServlet("/companyInfo")
public class CompanyInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public CompanyInfoServlet() {
super();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
private CompanyDao companyDao=new CompanyDao();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
CompanyPageBean companyBeans =companyDao.queryCompanyPageBean();
System.out.println(companyBeans);
if(companyBeans != null) {
JSONObject jsonObject= JSONObject.fromObject(companyBeans);
// response.setContentType("text/html;charset=utf-8");
response.setContentType("application/json; charset=utf-8");
response.getWriter().print(jsonObject.toString());
// response.getWriter().print("error");
}else {
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"li-fengjie@qq.com"
] | li-fengjie@qq.com |
e40a28710e7f36e881294d6866f0c3d8fa410fcd | dc4afb311cdf3550c4429617cbbd92402d92f3f0 | /Qa14HomeWork_005/HomeWork005.java | 1306fa9ce436c74c86eb1af002920a23fdc31f72 | [] | no_license | 61swan/Qa14HomeWorkJava | 39486dce9368b408fa7f8aae6377ff4a9115d659 | c219a7816bd0754ec2db0ec47d05098df0efdc74 | refs/heads/master | 2020-08-16T12:37:53.025546 | 2019-11-30T18:43:48 | 2019-11-30T18:43:48 | 215,502,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,616 | java | package Qa14HomeWork_005;
import java.util.Scanner;
public class HomeWork005 {
public static void main(String[] args) {
// Первое задание
//1. Ввести число, и определить – чётное оно, или нет.
System.out.println("\nПервое задание");
System.out.println("Введите число: ");
Scanner scanner = new Scanner(System.in);
double number = scanner.nextDouble();
// if (number % 2 > 0) {
// System.out.println(number + "- нечетное число.");
// }
// if (number % 2 == 0) {
// System.out.println(number + "- четное число.");
// }
if (number % 2 == 0) {
System.out.println(number + "- четное число.");
}
else {
System.out.println(number + "- нечетное число.");
}
//Второе задание
//2. Ввести три числа и найти наименьшее среди них.
System.out.println("");
System.out.println("\nВторое задание");
System.out.println("Введите первое число: ");
double number01 = scanner.nextDouble();
System.out.println("Введите второе число: ");
double number02 = scanner.nextDouble();
System.out.println("Введите третье число: ");
double number03 = scanner.nextDouble();
double maxNumber;
if (number01 > number02) {
maxNumber = number01;
}
else {
maxNumber = number02;
}
if (maxNumber < number03) {
maxNumber = number03;
}
System.out.println(maxNumber + "- максимальное число.");
//Третье задание
//3. Ввести число, и выяснить - положительное оно, отрицательное, или равно нулю?
System.out.println("");
System.out.println("\nТретье задание");
System.out.println("Введите число: ");
double numberSmolBig = scanner.nextDouble();
if (numberSmolBig < 0) {
System.out.println("Введенное число меньше нуля.");
}
else if (0 < numberSmolBig) {
System.out.println("Введенное число больше нуля.");
}
else if (numberSmolBig == 0) {
System.out.println("Введенное число равно нулю.");
}
//Четвертое задание
//4. Реализовать калькулятор. Вводятся 2 любых вещественных числа в переменные a и b. Необходимо вывести на экран меню с пунктами:
//1) a + b
//2) a – b
//3) a * b
//4) a / b
//5) a % b
//При выборе соответствующего пункта меню происходит вывод результата вычисления (должна быть проверка деления на 0!)
System.out.println("");
System.out.println("\nЧетвертое задание");
System.out.println("Введите первое число (a): ");
int numberA = scanner.nextInt();
System.out.println("Введите второе число (b): ");
int numberB = scanner.nextInt();
System.out.println("1) " + numberA + " + " + numberB + "\n" +
"2) " + numberA + " – " + numberB + "\n" +
"3) " + numberA + " * " + numberB + "\n" +
"4) " + numberA + " / " + numberB + "\n" +
"5) " + numberA + " % " + numberB + "");
System.out.println("Введите число от одного до пяти, которому соответсвует действие, котрое Вы хотите совершить с ранее введенными Вами числами " + numberA + " и " + numberB + ": ");
int numberFrom1To5 = scanner.nextInt();
while (numberFrom1To5 < 1 || numberFrom1To5 >5) {
if (numberFrom1To5 < 1) {
System.out.println("Введенное Вами число меньше 1.");
}
if (numberFrom1To5 > 1) {
System.out.println("Введенное Вами число больше 5.");
}
numberFrom1To5 = scanner.nextInt();
}
if (numberFrom1To5 == 1) {
System.out.println("Значение выбранной Вами операции - " + (numberA + numberB));
}
else if (numberFrom1To5 == 2) {
System.out.println("Значение выбранной Вами операции: " + (numberA - numberB));
}
else if (numberFrom1To5 == 3) {
System.out.println("Значение выбранной Вами операции: " + (numberA * numberB));
}
else if (numberFrom1To5 == 4) {
System.out.println("Значение выбранной Вами операции: " + (numberA / numberB));
}
else if (numberFrom1To5 == 5) {
System.out.println("Значение выбранной Вами операции: " + (numberA % numberB));
}
//Пятое задание
//5. Ввести с клавиатуры символ. Определить, чем он является: цифрой, буквой или знаком пунктуации.
System.out.println("");
System.out.println("\nПятое задание");
System.out.println("Введите с клавиатуры один символ: ");
char symbol = scanner.next().charAt(0);
if (symbol >= 'A' && symbol <= 'Z') {
System.out.println("Это большая строчная буква.");
} else if (symbol >= 'a' && symbol <= 'z') {
System.out.println("Это малая строчная буква.");
} else if (symbol >= '0' && symbol <= '9') {
System.out.println("Это цифра");
} else if (symbol == ',' || symbol == '.' || symbol == ':' || symbol == ';' || symbol == '!' || symbol == '?' || symbol == '"' || symbol == '-' || symbol == '(' || symbol == ')' ) {
System.out.println("Это знак пунктуации.");
}
//Шестое задание
//6. Ввести с клавиатуры число и проверить, принадлежит ли это число диапазону от N до M (включительно).
System.out.println("");
System.out.println("\nШестое задание");
System.out.println("Введите первое, самое меньшее число из диапозона чисел (M): ");
int numberM = scanner.nextInt();
System.out.println("Введите второе, самое большее число из диапозона чисел (N): ");
int numberN = scanner.nextInt();
while (numberN < numberM) {
System.out.println("Второе число (N) не может быть меньше первого (M). Введите второе, большее число из диапозона чисел (N): ");
numberN = scanner.nextInt();
}
System.out.println("Введите третье число, прианадлежность которого к введенному диапазану чисел должна быть проверена: ");
int numberDiapazon = scanner.nextInt();
if (numberDiapazon >= numberM && numberDiapazon <= numberN) {
System.out.println("Введенное Вами число находится в указанном диапазоне чисел (M-N).");
}
else {
System.out.println("Введенное Вами число находится за пределами указанного диапазона чисел (M-N).");
}
//Седьмое задание
//7. Написать программу для проверки кратности числа X числу Y (оба числа вводятся с клавиатуры).
System.out.println("");
System.out.println("\nСедьмое задание");
System.out.println("Введите Х, число кратность которого числу Y будет проверяться: ");
int numberX = scanner.nextInt();
System.out.println("Введите число Y: ");
int numberY = scanner.nextInt();
while (numberY == 0) {
System.out.println("Делить на ноль нельязя. Введите число Y: ");
numberY = scanner.nextInt();
}
if ((numberX % numberY) > 0) {
System.out.println("Число " + numberX + " не кратно числу " + numberY + ".");
}
else if ((numberX % numberY) == 0) {
System.out.println("Число " + numberX + " кратно числу " + numberY + ".");
}
//Восьмое задание
//8. Ввести число и определить кратно ли оно 3, 5, и 7 одновременно.
System.out.println("");
System.out.println("\nВосьмое задание");
System.out.println("Введите число, одновременная кратность которого числу 3,5,7 будет проверяться: ");
int number357 = scanner.nextInt();
if ((number357 % 3) == 0 && (number357 % 5) == 0 && (number357 % 7) == 0) {
System.out.println("Число " + number357 + " одновременно кратно числам 3,5,7.");
}
else {
System.out.println("Число " + number357 + " одновременно не кратно числам 3,5,7.");
}
//Девятое задание
//9. Показать модуль введённого числа.
System.out.println("");
System.out.println("\nДевятое задание");
System.out.println("Введите число, модуль которого нужно показать: ");
double numberModul = scanner.nextDouble();
if (numberModul >= 0) {
System.out.println("Модуль числа " + numberModul + " равен " + numberModul + ".");
}
else if (numberModul < 0) {
System.out.println("Модуль числа " + numberModul + " равен " + (0 - numberModul) + ".");
}
//Десятое задание
//10. Вводится целое число (не более 4 разрядов!). Определить количество цифр в нём.
System.out.println("");
System.out.println("\nДесятое задание");
System.out.println("Введите число в котором не более чем 4 разряда: ");
int number4Digits = scanner.nextInt();
int isNumber4Digits = (int) Math.ceil(Math.log10(number4Digits));
while (isNumber4Digits > 4) {
System.out.println("Введенное число содержит больше чем 4 разряда. Введите число в котором не более чем 4 разряда: ");
number4Digits = scanner.nextInt();
isNumber4Digits = (int) Math.ceil(Math.log10(number4Digits));
}
System.out.println("В числе " + number4Digits + " - " + isNumber4Digits + " цифры."); // При введении единицы - баг в виде колличества цифр 0.
if ((number4Digits / 1000) > 0) {
System.out.println ("В числе " + number4Digits + "- 4 цифры.");
}
else if ((number4Digits / 100 % 10) > 0) {
System.out.println ("В числе " + number4Digits + "- 3 цифры.");
}
else if ((number4Digits / 10 % 10) > 0) {
System.out.println ("В числе " + number4Digits + " - 2 цифры.");
}
else {
System.out.println ("В числе " + number4Digits + " - 1 цифра.");
}
//Одинадцатое задание
//11. Ввести с клавиатуры пятизначное число и определить, является ли оно палиндромом (т.е. одинаково читается в обоих направлениях - например, 12321 будет палиндромом, а 12345 – не палиндром).
System.out.println("");
System.out.println("\nОдинадцатое задание");
System.out.println("Введите пятизначное число: ");
int number5Digits = scanner.nextInt();
int isNumber5Digits = (int) Math.ceil(Math.log10(number5Digits));
while (isNumber5Digits != 5) {
System.out.println("Введенное число не является пятизначным. Число " + number5Digits + "- " + isNumber5Digits + " значное. Введите число в котором не более чем 4 разряда: ");
number5Digits = scanner.nextInt();
isNumber5Digits = (int) Math.ceil(Math.log10(number5Digits));
}
int D1number5Digits = number5Digits / 10000;
int D2number5Digits = number5Digits / 1000 % 10;
int D4number5Digits = number5Digits / 10 % 10;
int D5number5Digits = number5Digits % 10;
if (D1number5Digits == D5number5Digits && D2number5Digits == D4number5Digits) {
System.out.println ("Число " + number5Digits + "- палиандром.");
}
else {
System.out.println ("Число " + number5Digits + "- не палиандром.");
}
//Двенадцатое задание
//12. Пользователь задаёт координаты верхнего левого, и нижнего правого угла прямоугольника, а также координаты точки (X,Y) в декартовой системе координат. Принадлежит ли точка этому прямоугольнику?
System.out.println("");
System.out.println("\nДвенадцатое задание");
System.out.println("Введите число Х1, - координату верхнего левого угла прямоугольника по вертикальной оси Х: ");
int numberX1 = scanner.nextInt();
System.out.println("Введите число Y1, - координату верхнего левого угла прямоугольника по горизонтальной оси Y: ");
int numberY1 = scanner.nextInt();
System.out.println("Введите число Х2, - координату нижнего правого угла прямоугольника по вертикальной оси Х: ");
int numberX2 = scanner.nextInt();
while (numberX1 <= numberX2) {
System.out.println("Координата правого нижнего угла прямоугольника (Х2) не может быть выше по вертикальной оси Х от координаты левого верхнего угла прямоугольника (Х1).\nВведите число Х2, - координату нижнего правого угла прямоугльника по вертикальной оси Х: ");
numberX2 = scanner.nextInt();
}
System.out.println("Введите число Y2, - координату нижнего правого угла прямоугольника по горизонтальной оси Y: ");
int numberY2 = scanner.nextInt();
while (numberY1 >= numberY2) {
System.out.println("Координата правого нижнего угла прямоугольника (Y2) не может быть с лева по горизонтальной оси Y от координаты левого верхнего угла прямоугольника (Y1).\nВведите число Y2, - координату нижнего правого угла прямоугльника по горизонтальной оси Y: ");
numberY2 = scanner.nextInt();
}
System.out.println("Введите число Х, - координату точки по вертикальной оси Х: ");
int numberXcheck = scanner.nextInt();
System.out.println("Введите число Y, - координату точки по горизонтальной оси Y: ");
int numberYcheck = scanner.nextInt();
if (numberXcheck >= numberX2 && numberXcheck <= numberX1 && numberYcheck >= numberY1 && numberYcheck <= numberY2) {
System.out.println("Введенная точка с координатами " + numberXcheck + " по оси Х и координатами " + numberYcheck + " по оси Y принадлежит прямоугольнику.");
}
else {
System.out.println("Введенная точка с координатами " + numberXcheck + " по оси Х и координатами " + numberYcheck + " по оси Y не принадлежит прямоугольнику.");
}
//Тринадцатое задание
//13. Найти максимальное значение среди 4 переменных, используя тернарный оператор.
System.out.println("");
System.out.println("\nТринадцатое задание");
System.out.println("Введите число А: ");
int aNumber = scanner.nextInt();
System.out.println("Введите число B: ");
int bNumber = scanner.nextInt();
System.out.println("Введите число C: ");
int cNumber = scanner.nextInt();
System.out.println("Введите число D: ");
int dNumber = scanner.nextInt();
int maxABCD = aNumber > bNumber ? (aNumber > cNumber ? aNumber : cNumber): (bNumber > cNumber ? bNumber : cNumber);
maxABCD = (maxABCD > dNumber ? maxABCD : dNumber);
System.out.println("Максимальное число: " + maxABCD);
}
}
| [
"61swan@gmail.com"
] | 61swan@gmail.com |
f1807489b0fe096a4bfdfe695f4fd500d50e5107 | f08256664e46e5ac1466f5c67dadce9e19b4e173 | /sources/org/joda/time/p699tz/ZoneInfoProvider.java | a2670fa446338be62d0f684e3b92b85bb7b228a6 | [] | no_license | IOIIIO/DisneyPlusSource | 5f981420df36bfbc3313756ffc7872d84246488d | 658947960bd71c0582324f045a400ae6c3147cc3 | refs/heads/master | 2020-09-30T22:33:43.011489 | 2019-12-11T22:27:58 | 2019-12-11T22:27:58 | 227,382,471 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 8,605 | java | package org.joda.time.p699tz;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.SoftReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import org.joda.time.DateTimeZone;
/* renamed from: org.joda.time.tz.ZoneInfoProvider */
public class ZoneInfoProvider implements Provider {
private final File iFileDir;
/* access modifiers changed from: private */
public final ClassLoader iLoader;
private final String iResourcePath;
private final Set<String> iZoneInfoKeys;
private final Map<String, Object> iZoneInfoMap;
public ZoneInfoProvider() throws IOException {
this(DateTimeZone.DEFAULT_TZ_DATA_PATH);
}
/* JADX WARNING: Removed duplicated region for block: B:19:0x002c A[SYNTHETIC, Splitter:B:19:0x002c] */
/* JADX WARNING: Removed duplicated region for block: B:24:0x0032 A[SYNTHETIC, Splitter:B:24:0x0032] */
/* Code decompiled incorrectly, please refer to instructions dump. */
private org.joda.time.DateTimeZone loadZoneData(java.lang.String r6) {
/*
r5 = this;
r0 = 0
java.io.InputStream r1 = r5.openResource(r6) // Catch:{ IOException -> 0x0020, all -> 0x001d }
org.joda.time.DateTimeZone r2 = org.joda.time.p699tz.DateTimeZoneBuilder.readFrom(r1, r6) // Catch:{ IOException -> 0x001b }
java.util.Map<java.lang.String, java.lang.Object> r3 = r5.iZoneInfoMap // Catch:{ IOException -> 0x001b }
java.lang.ref.SoftReference r4 = new java.lang.ref.SoftReference // Catch:{ IOException -> 0x001b }
r4.<init>(r2) // Catch:{ IOException -> 0x001b }
r3.put(r6, r4) // Catch:{ IOException -> 0x001b }
if (r1 == 0) goto L_0x0018
r1.close() // Catch:{ IOException -> 0x0018 }
L_0x0018:
return r2
L_0x0019:
r6 = move-exception
goto L_0x0030
L_0x001b:
r2 = move-exception
goto L_0x0022
L_0x001d:
r6 = move-exception
r1 = r0
goto L_0x0030
L_0x0020:
r2 = move-exception
r1 = r0
L_0x0022:
r5.uncaughtException(r2) // Catch:{ all -> 0x0019 }
java.util.Map<java.lang.String, java.lang.Object> r2 = r5.iZoneInfoMap // Catch:{ all -> 0x0019 }
r2.remove(r6) // Catch:{ all -> 0x0019 }
if (r1 == 0) goto L_0x002f
r1.close() // Catch:{ IOException -> 0x002f }
L_0x002f:
return r0
L_0x0030:
if (r1 == 0) goto L_0x0035
r1.close() // Catch:{ IOException -> 0x0035 }
L_0x0035:
throw r6
*/
throw new UnsupportedOperationException("Method not decompiled: org.joda.time.p699tz.ZoneInfoProvider.loadZoneData(java.lang.String):org.joda.time.DateTimeZone");
}
private static Map<String, Object> loadZoneInfoMap(InputStream inputStream) throws IOException {
ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
DataInputStream dataInputStream = new DataInputStream(inputStream);
try {
readZoneInfoMap(dataInputStream, concurrentHashMap);
concurrentHashMap.put("UTC", new SoftReference(DateTimeZone.UTC));
return concurrentHashMap;
} finally {
try {
dataInputStream.close();
} catch (IOException unused) {
}
}
}
private InputStream openResource(String str) throws IOException {
File file = this.iFileDir;
if (file != null) {
return new FileInputStream(new File(file, str));
}
final String concat = this.iResourcePath.concat(str);
InputStream inputStream = (InputStream) AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
public InputStream run() {
if (ZoneInfoProvider.this.iLoader != null) {
return ZoneInfoProvider.this.iLoader.getResourceAsStream(concat);
}
return ClassLoader.getSystemResourceAsStream(concat);
}
});
if (inputStream != null) {
return inputStream;
}
StringBuilder sb = new StringBuilder(40);
sb.append("Resource not found: \"");
sb.append(concat);
sb.append("\" ClassLoader: ");
ClassLoader classLoader = this.iLoader;
sb.append(classLoader != null ? classLoader.toString() : "system");
throw new IOException(sb.toString());
}
private static void readZoneInfoMap(DataInputStream dataInputStream, Map<String, Object> map) throws IOException {
int readUnsignedShort = dataInputStream.readUnsignedShort();
String[] strArr = new String[readUnsignedShort];
int i = 0;
for (int i2 = 0; i2 < readUnsignedShort; i2++) {
strArr[i2] = dataInputStream.readUTF().intern();
}
int readUnsignedShort2 = dataInputStream.readUnsignedShort();
while (i < readUnsignedShort2) {
try {
map.put(strArr[dataInputStream.readUnsignedShort()], strArr[dataInputStream.readUnsignedShort()]);
i++;
} catch (ArrayIndexOutOfBoundsException unused) {
throw new IOException("Corrupt zone info map");
}
}
}
public Set<String> getAvailableIDs() {
return this.iZoneInfoKeys;
}
public DateTimeZone getZone(String str) {
if (str == null) {
return null;
}
Object obj = this.iZoneInfoMap.get(str);
if (obj == null) {
return null;
}
if (obj instanceof SoftReference) {
DateTimeZone dateTimeZone = (DateTimeZone) ((SoftReference) obj).get();
if (dateTimeZone != null) {
return dateTimeZone;
}
return loadZoneData(str);
} else if (str.equals(obj)) {
return loadZoneData(str);
} else {
return getZone((String) obj);
}
}
/* access modifiers changed from: protected */
public void uncaughtException(Exception exc) {
exc.printStackTrace();
}
public ZoneInfoProvider(File file) throws IOException {
if (file == null) {
throw new IllegalArgumentException("No file directory provided");
} else if (!file.exists()) {
StringBuilder sb = new StringBuilder();
sb.append("File directory doesn't exist: ");
sb.append(file);
throw new IOException(sb.toString());
} else if (file.isDirectory()) {
this.iFileDir = file;
this.iResourcePath = null;
this.iLoader = null;
this.iZoneInfoMap = loadZoneInfoMap(openResource("ZoneInfoMap"));
this.iZoneInfoKeys = Collections.unmodifiableSortedSet(new TreeSet(this.iZoneInfoMap.keySet()));
} else {
StringBuilder sb2 = new StringBuilder();
sb2.append("File doesn't refer to a directory: ");
sb2.append(file);
throw new IOException(sb2.toString());
}
}
public ZoneInfoProvider(String str) throws IOException {
this(str, null, false);
}
public ZoneInfoProvider(String str, ClassLoader classLoader) throws IOException {
this(str, classLoader, true);
}
private ZoneInfoProvider(String str, ClassLoader classLoader, boolean z) throws IOException {
if (str != null) {
if (!str.endsWith("/")) {
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append('/');
str = sb.toString();
}
this.iFileDir = null;
this.iResourcePath = str;
if (classLoader == null && !z) {
classLoader = ZoneInfoProvider.class.getClassLoader();
}
this.iLoader = classLoader;
this.iZoneInfoMap = loadZoneInfoMap(openResource("ZoneInfoMap"));
this.iZoneInfoKeys = Collections.unmodifiableSortedSet(new TreeSet(this.iZoneInfoMap.keySet()));
return;
}
throw new IllegalArgumentException("No resource path provided");
}
}
| [
"101110@vivaldi.net"
] | 101110@vivaldi.net |
75498d056bc2173c66070d6eec23f4d17c749b22 | 6fd6e28aa2975e9bc5b1d086525d314c8d139402 | /src/test/java/com/teedjay/rest/resources/UsersResourceIT.java | 69d5fc9facf3b74f4c658c4b41cfabb0bc47bbd1 | [] | no_license | teedjay/playground-rest | 345c10813c91e968d1e4134be5ce0f894c1f1e59 | 2e9cffc8c8ebe5ecc7faeb2e5c99e4b781f95d92 | refs/heads/master | 2021-05-16T11:29:40.399352 | 2017-11-08T09:08:13 | 2017-11-08T09:08:13 | 105,017,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,605 | java | package com.teedjay.rest.resources;
import com.teedjay.rest.JAXRSConfig;
import com.teedjay.rest.factories.CrazyServiceFactory;
import com.teedjay.rest.factories.CrazyServiceMockFactory;
import com.teedjay.rest.services.TextService;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.Filters;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
import java.net.URL;
/**
* Integration test using Arquillian (embedded Payara container configured in pom.xml)
*
* @author thore johnsen
*/
@RunWith(Arquillian.class)
public class UsersResourceIT {
@ArquillianResource
private URL deploymentURL;
@Deployment(testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap
.create(WebArchive.class)
.addPackage(CrazyServiceFactory.class.getPackage())
.addPackage(ExampleResource.class.getPackage())
.addPackage(TextService.class.getPackage())
.addClasses(JAXRSConfig.class)
.filter(Filters.exclude(CrazyServiceMockFactory.class))
;
}
@Test
@RunAsClient
public void printCurrentDeploymentConfiguration() throws Exception {
if (deploymentURL == null) {
System.out.println("DeploymentURL was null, expected http://localhost:8181/6a437b3f-fbf7-482d-b49f-a731e68d270a/");
} else {
System.out.printf("DeploymentURL : %s and external form = %s\n", deploymentURL.toString(), deploymentURL.toExternalForm());
}
// Thread.sleep(2 * 60 * 1000); // uncomment this to get 2 minutes of free testing using postman / browser
}
@Test
@RunAsClient
public void getKnownUserByName() {
String url = deploymentURL.toString() + "rest/users/teedjay";
get(url).then().assertThat().
statusCode(200).
body("name", is("teedjay"),
"age", is(17),
"address", is("myaddress"),
"text", is("knownuser"));
}
/**
* The create user resource expects JSON only, make sure that posting XML fails.
* Payara should return 415 unsupported media type
*/
@Test
@RunAsClient
public void createUserWithIllegalMediaType() {
String url = deploymentURL.toExternalForm() + "rest/users";
given().
contentType("application/xml").
when().
post(url).
then().
statusCode(415);
}
/**
* Smoke test to make sure that bean validation works when create user is called.
* It is not necessary to test all bean validation variants as these are tested
* already using fast and simple unit tests.
* @see UserTest#checkAllConstraints()
*
* Payara returns http 400 status and a default web page containing the text :
* "The request sent by the client was syntactically incorrect."
*/
@Test
@RunAsClient
public void createUserWithIllegalConstraints() {
String url = deploymentURL.toExternalForm() + "rest/users";
User userToBeCreated = new User("kompis", 33, "address more than 10 chars", "new user");
given().
accept("application/json").
contentType("application/json").
body(userToBeCreated).
log().all().
when().
post(url).
then().
statusCode(400).
body(containsString("The request sent by the client was syntactically incorrect."));
}
/**
* When creating users we expect http 201 created and a location header pointing to the new resource, eg
* Location=http://localhost:8181/d4c1b452-9575-490b-a015-e3e27aeceae9/rest/users/kompis
*/
@Test
@RunAsClient
public void createUser() {
String url = deploymentURL.toExternalForm() + "rest/users";
User userToBeCreated = new User("kompis", 33, "oslo", "new user");
given().
accept("application/json").
contentType("application/json").
body(userToBeCreated).
when().
post(url).
then().
statusCode(201).
header("location", endsWith("rest/users/kompis"));
}
} | [
"thore.johnsen@evry.com"
] | thore.johnsen@evry.com |
6cb8a0c069044ce959ed626955638456e2ce9856 | bbe10639bb9c8f32422122c993530959534560e1 | /delivery/app-release_source_from_JADX/com/google/android/gms/common/internal/zzaa.java | e07b9dca1e507f413c78e4192c450b8da84a58e3 | [
"Apache-2.0"
] | permissive | ANDROFAST/delivery_articulos | dae74482e41b459963186b6e7e3d6553999c5706 | ddcc8b06d7ea2895ccda2e13c179c658703fec96 | refs/heads/master | 2020-04-07T15:13:18.470392 | 2018-11-21T02:15:19 | 2018-11-21T02:15:19 | 158,476,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,068 | java | package com.google.android.gms.common.internal;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.common.internal.safeparcel.zza;
import com.google.android.gms.common.internal.safeparcel.zzb;
public class zzaa implements Creator<SignInButtonConfig> {
static void zza(SignInButtonConfig signInButtonConfig, Parcel parcel, int i) {
int zzav = zzb.zzav(parcel);
zzb.zzc(parcel, 1, signInButtonConfig.mVersionCode);
zzb.zzc(parcel, 2, signInButtonConfig.zzqL());
zzb.zzc(parcel, 3, signInButtonConfig.zzqM());
zzb.zza(parcel, 4, signInButtonConfig.zzqN(), i, false);
zzb.zzI(parcel, zzav);
}
public /* synthetic */ Object createFromParcel(Parcel x0) {
return zzar(x0);
}
public /* synthetic */ Object[] newArray(int x0) {
return zzca(x0);
}
public SignInButtonConfig zzar(Parcel parcel) {
int i = 0;
int zzau = zza.zzau(parcel);
Scope[] scopeArr = null;
int i2 = 0;
int i3 = 0;
while (parcel.dataPosition() < zzau) {
int zzat = zza.zzat(parcel);
switch (zza.zzcc(zzat)) {
case 1:
i3 = zza.zzg(parcel, zzat);
break;
case 2:
i2 = zza.zzg(parcel, zzat);
break;
case 3:
i = zza.zzg(parcel, zzat);
break;
case 4:
scopeArr = (Scope[]) zza.zzb(parcel, zzat, Scope.CREATOR);
break;
default:
zza.zzb(parcel, zzat);
break;
}
}
if (parcel.dataPosition() == zzau) {
return new SignInButtonConfig(i3, i2, i, scopeArr);
}
throw new zza.zza("Overread allowed size end=" + zzau, parcel);
}
public SignInButtonConfig[] zzca(int i) {
return new SignInButtonConfig[i];
}
}
| [
"cespedessanchezalex@gmail.com"
] | cespedessanchezalex@gmail.com |
80ce799ba1b2fb9de0f433c2aa1f38a2daaa8a5c | 0c0ee31254469fdc4643c807b12b05ee1aa28f34 | /src/org/sc205/view/GameRenderer.java | 5e8f21419e351c83794eb93b353422a35ebab21d | [] | no_license | hbrednek/islsScore | cc7dbec4f58999bf16794e364eeec5730cf5d880 | 7f64140981c25f3d0d2d2a645023af63dc33a982 | refs/heads/master | 2021-06-06T17:59:01.087203 | 2020-05-26T00:09:00 | 2020-05-26T00:09:00 | 1,565,462 | 0 | 0 | null | 2020-05-26T00:03:44 | 2011-04-04T03:52:59 | Java | UTF-8 | Java | false | false | 5,319 | java | /*
* Copyright 2011 Michael R. Elliott <mre@m79.net>.
*
* 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.
* under the License.
*/
package org.sc205.view;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.font.TextLayout;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import org.sc205.controller.DeclareWinner;
import org.sc205.model.Game;
import org.sc205.model.GameSet;
import org.sc205.model.Partnership;
import org.sc205.model.Partnership.Affiliation;
/**
*
* @author mre
*/
public class GameRenderer extends ScoreBox.Renderer {
public GameRenderer( ScoreBox scoreBox, Game game ) {
super( scoreBox );
this.game = game;
}
@Override
public void mouseClicked( MouseEvent me ) {
super.mouseClicked( me );
switch (game.getStatus()) {
case AVAILABLE:
startGame();
break;
case IN_PROGRESS:
case PLAYED:
setWinner();
break;
default:
break;
}
}
private void setPlayedConflict( Game.Status from, Game.Status to ) {
final Partnership amCan = game.getTeam( Affiliation.AMERICAN );
final Partnership euro = game.getTeam( Affiliation.EUROPEAN );
for (Game iteratedGame: GameSet.instance().allGames())
if (iteratedGame.getStatus() == from
&& (iteratedGame.getTeam( Affiliation.EUROPEAN ) == euro
|| iteratedGame.getTeam( Affiliation.AMERICAN ) == amCan)) {
iteratedGame.setStatus( to );
iteratedGame.getScoreBox().repaint();
}
}
private void startGame() {
game.start();
setPlayedConflict( Game.Status.AVAILABLE, Game.Status.SCHEDULE_CONFLICT );
GameSet.instance().scheduleNextGame();
scoreBox.repaint();
}
private void setWinner() {
DeclareWinner dw = new DeclareWinner( null, true );
dw.setGame( game );
dw.setVisible( true );
}
private class Repainter extends TimerTask {
@Override
public void run() {
scoreBox.repaint();
}
}
@Override
public void paint( ScoreBox scoreBox, Graphics2D gg ) {
super.paint( scoreBox, gg );
bounds = scoreBox.getBounds();
bounds.x = bounds.y = 0;
switch (game.getStatus()) {
case SCHEDULE_CONFLICT:
gg.setColor( ScoreBox.SCHEDULE_CONFLICT );
gg.fill( bounds );
break;
case AVAILABLE:
gg.setColor( game.isNext()
? ScoreBox.ON_DECK : ScoreBox.UNSCHEDULED );
gg.fill( bounds );
break;
case IN_PROGRESS:
gg.setColor( ScoreBox.IN_PROGRESS );
gg.fill( bounds );
final long startSec = game.getStart().getTime() / 1000;
final long elapsed = System.currentTimeMillis() / 1000 - startSec;
final long seconds = elapsed % 60;
final long minutes = elapsed / 60;
String timeString = String.format( "%d:%02d", minutes, seconds );
final float glyphHeight = 0.25f * w;
Font font =
new Font( "Sans-serif", Font.BOLD, Math.round( glyphHeight ) );
TextLayout tl = new TextLayout(
timeString, font, gg.getFontRenderContext() );
gg.setColor( Color.WHITE );
final Rectangle2D textBounds = tl.getBounds();
int x,
y;
x = (int)Math.round( w / 2f - textBounds.getWidth() / 2f );
y = (int)Math.round( h / 2f + textBounds.getHeight() / 2f );
tl.draw( gg, x, y );
if (repainter == null) {
repainter = new Repainter();
TIMER.schedule( repainter, 300L, 300L );
}
break;
case PLAYED:
paintWinner( scoreBox, gg );
break;
case UNAVAILABLE:
paintTooManyGames( scoreBox, gg );
break;
}
paintBoundary( scoreBox, gg );
}
private void paintTooManyGames( ScoreBox scoreBox, Graphics2D gg ) {
gg.setColor( Color.BLACK );
gg.fill( bounds );
return;
}
private void paintWinner( ScoreBox scoreBox, Graphics2D gg ) {
final Partnership part = game.getWinner();
final Affiliation winner = part.affiliation;
gg.drawImage( IP.get( winner, w, h ), null, 0, 0 );
}
private TimerTask repainter = null;
private Rectangle bounds;
private Game game;
final private static Timer TIMER = new Timer();
final private static ImageProvider IP = ImageProvider.instance();
}
| [
"mre@m79.net"
] | mre@m79.net |
25dbd0a8a752c75d72a33a3c8d65dc307564a09c | eb7ad66a86eb1600910e9a5bee0303a405536ae7 | /app/src/androidTest/java/com/turath/masael/ExampleInstrumentedTest.java | dcb6e8a3ee60dcc4409ac425251e25a6123c070b | [] | no_license | FatimaAli-k/Masael | ab0e6b5a823aa7434d159fea87a0ed4dc6d92cdb | f4f009e86deca5ae9c8ca519390e893614ee3f46 | refs/heads/master | 2022-10-02T18:34:32.907967 | 2020-06-09T08:54:00 | 2020-06-09T08:54:00 | 270,968,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package com.turath.masael;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.turath.masael", appContext.getPackageName());
}
}
| [
"capt.fatimaali@gmail.com"
] | capt.fatimaali@gmail.com |
2d20123dfb4c8feb4cfed270954ebe1dc364490b | 40eeda945764a0f061188d90e3c84e82693b9e12 | /src/com/sunsheen/jfids/studio/wther/diagram/compiler/util/TransactionCodeUtil.java | be444000d5dc45f7fa1f5fa53f797256880231e3 | [] | no_license | zhouf/wther.diagram | f004ca8ace45cceb65345d568b1b9711bc14c935 | 6508d0a63c79f48b1543f191fef5a48c8d4b28b7 | refs/heads/master | 2021-01-20T18:53:05.000033 | 2016-07-23T15:08:07 | 2016-07-23T15:08:07 | 63,996,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,234 | java | package com.sunsheen.jfids.studio.wther.diagram.compiler.util;
/**
* 这是生成JAVA事务相关代码的一个类
* @author zhoufeng
* Date:2013-12-18
*/
public class TransactionCodeUtil {
private static String varPrefix = "idsSession";
private static String sessionVarName = "";
public static void setSessionVarName(String varName) {
sessionVarName = varName;
}
public static String getSessionVarName() {
return sessionVarName;
}
public static String getTransactionBeginCode(String arg,boolean isTransfer){
StringBuilder sb = new StringBuilder();
// session变量名的处理,如果有传入变量名,则使用变量名,如果没有传入,则自动生成一个
if(arg!=null && !arg.isEmpty()){
setSessionVarName(arg);
}else{
genSessionVarName();
}
sb.append("\n");
//sb.append("com.sunsheen.jfids.system.database.IdsSession ").append(getSessionVarName()).append(" = com.sunsheen.jfids.util.IdsDataBaseUtil.");
sb.append("IdsSession ").append(getSessionVarName()).append(" = IdsDataBaseUtil.");
if(isTransfer){
sb.append("getHibernateSession");
}else{
sb.append("getStatelessHibernateSession");
}
sb.append("();").append("\n");
sb.append(getSessionVarName()).append(".beginTransaction();").append("\n");
return sb.toString();
}
public static String getTransactionCommitCode(String arg){
StringBuilder sb = new StringBuilder();
sb.append("\t").append(getSessionVarName()).append(".commit();").append("\n");
sb.append("\tSystem.out.println(\"").append(getSessionVarName()).append("事务提交commit\");").append("\n");
//sb.append("\tretmsg=\"SUCC\";").append("\n");
return sb.toString();
}
public static String getTransactionRollbackCode(String arg){
StringBuilder sb = new StringBuilder();
sb.append(getSessionVarName()).append(".rollback();").append("\n");
sb.append("\tSystem.out.println(\"").append(getSessionVarName()).append("事务回滚rollback\");").append("\n");
//sb.append("retmsg=\"ERROR\";").append("\n");
return sb.toString();
}
//返回SESSION变量名
private static void genSessionVarName(){
// sessionVarName = varPrefix + (new Random()).nextInt(1000);
sessionVarName = varPrefix;
// return "";
}
}
| [
"zhouf_t@sohu.com"
] | zhouf_t@sohu.com |
48a16937826ae4f8797445ba925b0cd8a1b1563f | f319ca2889a00a8e01b6a0d48e86d012115c85f5 | /src/test/java/com/wang/jmonkey/test/modules/ieg/ImportSchoolParam.java | 9002871b2858b38dce8c2a3c72128b7405895903 | [] | no_license | hejiawang/ieg | 016fa29b7559971cbc87bf78bb9063869082d8e8 | 9f48ee0f1ca61dc09d1ea6432a8372751957a75b | refs/heads/master | 2022-07-06T20:54:50.481108 | 2019-12-18T11:47:24 | 2019-12-18T11:47:24 | 182,397,642 | 0 | 1 | null | 2022-06-17T02:07:18 | 2019-04-20T11:29:38 | Java | UTF-8 | Java | false | false | 1,193 | java | package com.wang.jmonkey.test.modules.ieg;
import com.wang.jmonkey.common.utils.poi.annotation.ExcelField;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class ImportSchoolParam {
/**
* 批次代码 专科批7 本科批3
*/
@ExcelField(title="pcdm", align=2)
private String pcdm;
/**
* 科类代码 1是文史 5是理科
*/
@ExcelField(title="kldm", align=2)
private String kldm;
/**
* 投档单位
*/
@ExcelField(title="tddw", align=2)
private String tddw;
/**
* 投档单位名称
*/
@ExcelField(title="tddwmc", align=2)
private String tddwmc;
/**
* 院校代码
*/
@ExcelField(title="yxdh", align=2)
private String yxdh;
/**
* 专业代码
*/
@ExcelField(title="zydh", align=2)
private String zydh;
/**
* 专业名称
*/
@ExcelField(title="zymc", align=2)
private String zymc;
/**
* 原计划数
*/
@ExcelField(title="yjhs", align=2)
private String yjhs;
/**
* 录取数
*/
@ExcelField(title="lqs", align=2)
private String lqs;
}
| [
"952327407@qq.com"
] | 952327407@qq.com |
ced9efb35d0fb40fea227c12f92a355dd36ff5cc | 14f5bd82e986793cb4d455af7d2cc4751afc5608 | /src/main/java/com/arbade/gjc/service/LeaderboardService.java | bbee469a63658fb15cf7ba2e03ab1f1f8b0989d5 | [] | no_license | yurtseveronr/case | 6caea26f30ed3ce768b2eee7c80577d1627d1472 | 79070e018927398a167904620c282dccdad9ea89 | refs/heads/master | 2023-09-03T15:53:54.863595 | 2021-11-03T12:52:20 | 2021-11-03T12:52:20 | 423,768,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | package com.arbade.gjc.service;
import com.arbade.gjc.mapper.LeaderboardMapper;
import com.arbade.gjc.model.entity.Leaderboard;
import com.arbade.gjc.repository.LeaderboardRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class LeaderboardService {
private final LeaderboardRepository leaderboardRepository;
public LeaderboardService(LeaderboardRepository leaderboardRepository) {
this.leaderboardRepository = leaderboardRepository;
}
public List<Leaderboard> getLeaderboard() {
List<Leaderboard> leaderboards = leaderboardRepository.findAllByOrderByPointsDesc();
for (int i = 0; i < leaderboards.size(); i++) {
leaderboards.get(i).setRank(i + 1);
}
return leaderboards;
}
public List<Leaderboard> getLeaderboardByCountry(String country) {
List<Leaderboard> leaderboards = leaderboardRepository.findAllByCountryOrderByPointsDesc(country);
for (int i = 0; i < leaderboards.size(); i++) {
leaderboards.get(i).setRank(i + 1);
}
return leaderboards;
}
}
| [
"yurtseveronr@gmail.comgit config --global user.email yurtseveronr@gmail.com"
] | yurtseveronr@gmail.comgit config --global user.email yurtseveronr@gmail.com |
72227690f4c0da289991da7e313764d93a58da96 | a00326c0e2fc8944112589cd2ad638b278f058b9 | /src/main/java/000/136/434/CWE369_Divide_by_Zero__int_database_modulo_01.java | ecd9ba4ce04be46152455dedf1c7d588e423ccad | [] | no_license | Lanhbao/Static-Testing-for-Juliet-Test-Suite | 6fd3f62713be7a084260eafa9ab221b1b9833be6 | b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68 | refs/heads/master | 2020-08-24T13:34:04.004149 | 2019-10-25T09:26:00 | 2019-10-25T09:26:00 | 216,822,684 | 0 | 1 | null | 2019-11-08T09:51:54 | 2019-10-22T13:37:13 | Java | UTF-8 | Java | false | false | 7,643 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE369_Divide_by_Zero__int_database_modulo_01.java
Label Definition File: CWE369_Divide_by_Zero__int.label.xml
Template File: sources-sinks-01.tmpl.java
*/
/*
* @description
* CWE: 369 Divide by zero
* BadSource: database Read data from a database
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: modulo
* GoodSink: Check for zero before modulo
* BadSink : Modulo by a value that may be zero
* Flow Variant: 01 Baseline
*
* */
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
public class CWE369_Divide_by_Zero__int_database_modulo_01 extends AbstractTestCase
{
public void bad() throws Throwable
{
int data;
data = Integer.MIN_VALUE; /* Initialize data */
/* Read data from a database */
{
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try
{
/* setup the connection */
connection = IO.getDBConnection();
/* prepare and execute a (hardcoded) query */
preparedStatement = connection.prepareStatement("select name from users where id=0");
resultSet = preparedStatement.executeQuery();
/* POTENTIAL FLAW: Read data from a database query resultset */
String stringNumber = resultSet.getString(1);
if (stringNumber != null) /* avoid NPD incidental warnings */
{
try
{
data = Integer.parseInt(stringNumber.trim());
}
catch (NumberFormatException exceptNumberFormat)
{
IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat);
}
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error with SQL statement", exceptSql);
}
finally
{
/* Close database objects */
try
{
if (resultSet != null)
{
resultSet.close();
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", exceptSql);
}
try
{
if (preparedStatement != null)
{
preparedStatement.close();
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error closing PreparedStatement", exceptSql);
}
try
{
if (connection != null)
{
connection.close();
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error closing Connection", exceptSql);
}
}
}
/* POTENTIAL FLAW: Zero modulus will cause an issue. An integer division will
result in an exception. */
IO.writeLine("100%" + data + " = " + (100 % data) + "\n");
}
public void good() throws Throwable
{
goodG2B();
goodB2G();
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B() throws Throwable
{
int data;
/* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */
data = 2;
/* POTENTIAL FLAW: Zero modulus will cause an issue. An integer division will
result in an exception. */
IO.writeLine("100%" + data + " = " + (100 % data) + "\n");
}
/* goodB2G() - use badsource and goodsink */
private void goodB2G() throws Throwable
{
int data;
data = Integer.MIN_VALUE; /* Initialize data */
/* Read data from a database */
{
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try
{
/* setup the connection */
connection = IO.getDBConnection();
/* prepare and execute a (hardcoded) query */
preparedStatement = connection.prepareStatement("select name from users where id=0");
resultSet = preparedStatement.executeQuery();
/* POTENTIAL FLAW: Read data from a database query resultset */
String stringNumber = resultSet.getString(1);
if (stringNumber != null) /* avoid NPD incidental warnings */
{
try
{
data = Integer.parseInt(stringNumber.trim());
}
catch (NumberFormatException exceptNumberFormat)
{
IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat);
}
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error with SQL statement", exceptSql);
}
finally
{
/* Close database objects */
try
{
if (resultSet != null)
{
resultSet.close();
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", exceptSql);
}
try
{
if (preparedStatement != null)
{
preparedStatement.close();
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error closing PreparedStatement", exceptSql);
}
try
{
if (connection != null)
{
connection.close();
}
}
catch (SQLException exceptSql)
{
IO.logger.log(Level.WARNING, "Error closing Connection", exceptSql);
}
}
}
/* FIX: test for a zero modulus */
if (data != 0)
{
IO.writeLine("100%" + data + " = " + (100 % data) + "\n");
}
else
{
IO.writeLine("This would result in a modulo by zero");
}
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"anhtluet12@gmail.com"
] | anhtluet12@gmail.com |
c4fb8cf1b4b141aa5de69315f6cab163561c346b | 3d191f403e8439c36b3184413064b9e59463fbcc | /test/level18/lesson10/home10/Solution.java | bdb4ac0041a9b0f78df457fe24d4bc86f94b5055 | [] | no_license | baltber/Javarush | 5e5a8a477da0110771feca3b9f0a39d5e8f6cb46 | 76c3368b656eeeb13d0b111b7060fb491adb1b9a | refs/heads/master | 2021-01-12T10:21:55.012051 | 2016-12-26T06:32:00 | 2016-12-26T06:32:00 | 76,435,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,309 | java | package com.javarush.test.level18.lesson10.home10;
/* Собираем файл
Собираем файл из кусочков
Считывать с консоли имена файлов
Каждый файл имеет имя: [someName].partN. Например, Lion.avi.part1, Lion.avi.part2, ..., Lion.avi.part37.
Имена файлов подаются в произвольном порядке. Ввод заканчивается словом "end"
В папке, где находятся все прочтенные файлы, создать файл без приставки [.partN]. Например, Lion.avi
В него переписать все байты из файлов-частей используя буфер.
Файлы переписывать в строгой последовательности, сначала первую часть, потом вторую, ..., в конце - последнюю.
Закрыть потоки. Не использовать try-with-resources
*/
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws IOException{
ArrayList<String> list = new ArrayList<String>();
ArrayList<byte []> listbuf = new ArrayList <byte []> ();
Scanner sc = new Scanner(System.in);
String fileName1="";
File file2 = null;
while (!(fileName1 = sc.nextLine()).equals("end")){
list.add(fileName1);
String fileName2 = fileName1.replaceFirst("\\.part.","");
file2 = new File(fileName2);
file2.createNewFile();
}
sc.close();
Collections.sort(list);
for(int i=0; i<list.size(); i++){
FileInputStream in = new FileInputStream(list.get(i));
byte[] buf = new byte[in.available()];
in.read(buf);
listbuf.add(buf);
in.close();
}
FileOutputStream outputStream = new FileOutputStream(file2);
for(int i=0; i<listbuf.size(); i++)
{
outputStream.write(listbuf.get(i));
}
outputStream.close();
}
}
| [
"D:\\MAIL"
] | D:\MAIL |
bca9df12fafee6ccc423041baf8d8847a0362977 | 1278ad27f89b31b085a74bb0add38bbea59ed10c | /src/main/java/com/example/serverdemo/config/RabbitMQConfig.java | 3b1ea94330bc3f32568252597930083d0e25041e | [] | no_license | zhengxiaomao/server-demo | c12a7209f85718cbe127ada32d5ef372e67f05cc | 5165361e764e80a968dcc66c5b0e5066938196b6 | refs/heads/master | 2023-02-17T09:16:45.953835 | 2021-01-18T13:56:22 | 2021-01-18T13:56:22 | 330,398,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,409 | java | package com.example.serverdemo.config;
import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitMQConfig {
//交换机名称
public static final String ITEM_TOPIC_EXCHANGE_CPU = "item_topic_cpu";
public static final String ITEM_TOPIC_EXCHANGE_MEM = "item_topic_mem";
//队列名称
public static final String ITEM_QUEUE_CPU = "item_queue_cpu";
public static final String ITEM_QUEUE_MEM = "item_queue_mem";
public static final String ITEM_QUEUE_DISK = "item_queue_disk";
public static final String ITEM_QUEUE_NET = "item_queue_net";
public static final String ITEM__TOPIC_CPU_ROUTINGKEY="cpu_metrics";
public static final String ITEM__TOPIC_MEM_ROUTINGKEY="mem_metrics";
//声明交换机
@Bean("itemTopicExchangeCpu")
public Exchange topicExchangeCpu(){
return ExchangeBuilder.topicExchange(ITEM_TOPIC_EXCHANGE_CPU).durable(true).build();
}
@Bean("itemTopicExchangeMem")
public Exchange topicExchangeMem(){
return ExchangeBuilder.topicExchange(ITEM_TOPIC_EXCHANGE_MEM).durable(true).build();
}
//声明队列
@Bean("itemQueueCPU")
public Queue itemQueueCpu(){
return QueueBuilder.durable(ITEM_QUEUE_CPU).build();
}
@Bean("itemQueueMem")
public Queue itemQueueMem(){
return QueueBuilder.durable(ITEM_QUEUE_MEM).build();
}
@Bean("itemQueueNet")
public Queue itemQueueNet(){
return QueueBuilder.durable(ITEM_QUEUE_NET).build();
}
@Bean("itemQueueDisk")
public Queue itemQueueDisk(){
return QueueBuilder.durable(ITEM_QUEUE_DISK).build();
}
//绑定队列和交换机
@Bean
public Binding itemQueueExchange(@Qualifier("itemQueueCPU") Queue queue,
@Qualifier("itemTopicExchangeCpu") Exchange exchange){
return BindingBuilder.bind(queue).to(exchange).with(ITEM__TOPIC_CPU_ROUTINGKEY).noargs();
}
@Bean
public Binding itemQueueExchangeMem(@Qualifier("itemQueueMem") Queue queue,
@Qualifier("itemTopicExchangeMem") Exchange exchange){
return BindingBuilder.bind(queue).to(exchange).with(ITEM__TOPIC_MEM_ROUTINGKEY).noargs();
}
} | [
"976132880@qq.com"
] | 976132880@qq.com |
b9000f794dfed0cd60d6f066c699a7647603a8d5 | 90df191343d4b33a0627c71cbf717535f68627eb | /src/main/java/com/lx/weixin/httpClient/FileUploadUtil.java | 65d9d0d3955958a992a4b8deb6ae7f268e3d29c1 | [] | no_license | zhangguangyong/weixin_demo | 9b1c28bcea9ac06c063d5a4971b93f5f28ce7315 | 4040b375d736cad2065db1610ad73f8d93a143e4 | refs/heads/master | 2021-01-12T08:14:52.485098 | 2016-03-08T14:55:40 | 2016-03-08T14:55:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,068 | java | package com.lx.weixin.httpClient;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
/**
* 文件上传servlet
*/
public class FileUploadUtil extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* 文件上传
* @param filePath 文件上传路径
*/
public void fileUpload(HttpServletRequest request, String filePath, String uploadPath) {
try {
DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
fileItemFactory.setSizeThreshold(4069); // 设置缓冲区大小,这里是4kb
fileItemFactory.setRepository(new File(filePath)); // 设置缓冲区目录
ServletFileUpload fileUpload = new ServletFileUpload(fileItemFactory);
fileUpload.setSizeMax(4194304); // 限制文件大小最大为4M
List<FileItem> fileItems = fileUpload.parseRequest(request);
Iterator<FileItem> iterator = fileItems.iterator();
while(iterator.hasNext()) {
FileItem fileItem = iterator.next();
String fileName = fileItem.getName();
if(fileName != null) {
File fullFile = new File(fileItem.getName());
File saveFile = new File(uploadPath, fullFile.getName());
fileItem.write(saveFile);
}
}
System.out.println("upload succeed");
} catch (FileUploadException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @param request
* @param response
* @param uploadPath
*/
public void processUpload(HttpServletRequest request, HttpServletResponse response, String uploadPath) {
File uploadFile = new File(uploadPath);
if (!uploadFile.exists()) {
uploadFile.mkdirs();
}
System.out.println("Come on, baby .......");
try {
request.setCharacterEncoding("utf-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
response.setCharacterEncoding("utf-8");
//response.setContentLength((int) uploadFile.length()); //服务端在处理之后,可以在Header中设置返回给客户端的简单信息。如果返回客户端是一个流的话,流的大小必须提前设置!
//检测是不是存在上传文件
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(isMultipart){
DiskFileItemFactory factory = new DiskFileItemFactory();
//指定在内存中缓存数据大小,单位为byte,这里设为1Mb
factory.setSizeThreshold(1024*1024);
//设置一旦文件大小超过getSizeThreshold()的值时数据存放在硬盘的目录
factory.setRepository(new File("D:\\test"));
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// 指定单个上传文件的最大尺寸,单位:字节,这里设为50Mb
upload.setFileSizeMax(50 * 1024 * 1024);
//指定一次上传多个文件的总尺寸,单位:字节,这里设为50Mb
upload.setSizeMax(50 * 1024 * 1024);
upload.setHeaderEncoding("UTF-8");
List<FileItem> items = null;
try {
items = upload.parseRequest(request); // 解析request请求
} catch (FileUploadException e) {
e.printStackTrace();
}
if(items!=null){
Iterator<FileItem> iter = items.iterator(); //解析表单项目
while (iter.hasNext()) {
FileItem item = iter.next();
if (item.isFormField()) { //如果是普通表单属性
String name = item.getFieldName(); //相当于input的name属性 <input type="text" name="content">
String value = item.getString(); //input的value属性
System.out.println("属性:" + name + " 属性值:" + value);
} else { //如果是上传文件
String fieldName = item.getFieldName(); //属性名
String fileName = item.getName(); //上传文件路径
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);// 获得上传文件的文件名
try {
item.write(new File(uploadPath, fileName));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
response.addHeader("token", "hello");
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String uploadPath = "";
String filePath = "";
fileUpload(request, filePath, uploadPath);
}
}
| [
"412506897@qq.com"
] | 412506897@qq.com |
cb489abe12888f72cefb5474c8497e8d1c4f698a | 69345eb30548dca0901d35314830c6239488ee74 | /bizleap-ds/bizleap-ds-loader/src/main/java/com/bizleap/training/ds/loader/impl/CompanySaverImpl.java | 75484eddf6c728267677791c07107a73ee969f05 | [] | no_license | BizleapIntern/ayeayekhaingds | bad786a50721d64b819057f81bd8614752fb0c4f | 1e98c73b782518af89f574ab0cfde73df6b9bca7 | refs/heads/master | 2020-03-18T05:54:36.342220 | 2018-05-23T10:41:10 | 2018-05-23T10:41:10 | 134,367,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | java | package com.bizleap.training.ds.loader.impl;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bizleap.common.domain.utils.Printer;
import com.bizleap.commons.domain.Company;
import com.bizleap.commons.domain.exception.ServiceUnavailableException;
import com.bizleap.training.ds.loader.CompanySaver;
import com.bizleap.training.ds.service.CompanyService;
import com.bizleap.training.ds.service.dao.impl.AbstractDaoImpl;
@Service("companySaver")
public class CompanySaverImpl implements CompanySaver {
private static Logger logger = Logger.getLogger(CompanySaverImpl.class);
private static Printer printer = new Printer(logger);
@Autowired
// AbstractDaoImpl abstractDaoImpl;
CompanyService companyService;
List<Company> companyList;
@Override
public void savePass1() throws ServiceUnavailableException, IOException {
printer.line2(companyList.toString());
for (Company company : getCompanyList()) {
printer.line("About to save"+ company);
companyService.saveCompany(company);
printer.line("Company Successfully saved.");
}
}
public List<Company> getCompanyList() {
return companyList;
}
@Override
public void setCompanyList(List<Company> companyList) {
this.companyList = companyList;
}
}
| [
"bizleapinternship@gmail.com"
] | bizleapinternship@gmail.com |
7517d85b0767b848f32be001204a80198d9d8337 | 75562394b7bd8e99db61378bdab63e680abf9774 | /app/src/mock/java/com/khangtoh/android/testing/notes/util/FakeImageFileImpl.java | b4d39e3c4a7f81c233bb402a4261654ce9137839 | [
"Apache-2.0"
] | permissive | khangtoh/gdgdevfest-demo | e1777b90f04e0b8aab75f0e290d8ba821869a406 | b94dc593f36f3b5544a89d216c56a868eeaaae6b | refs/heads/master | 2021-01-13T14:19:28.133277 | 2016-11-05T02:59:40 | 2016-11-05T02:59:40 | 72,811,749 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | /*
* Copyright 2015, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.khangtoh.android.testing.notes.util;
import java.io.IOException;
/**
* Fake implementation of {@link ImageFile} to inject a fake image in a hermetic test.
*/
public class FakeImageFileImpl extends ImageFileImpl {
@Override
public void create(String name, String extension) throws IOException {
// Do nothing
}
@Override
public String getPath() {
return "file:///android_asset/atsl-logo.png";
}
@Override
public boolean exists() {
return true;
}
}
| [
"khang@picocandy.com"
] | khang@picocandy.com |
ddecbf1203fce55b02ab9951c1837c455a92f613 | b4605cb18467c3cd0665e5e732d76fd11da07805 | /src/main/java/org/ozoneplatform/service/ListingService.java | c0acc826926954f606f8ea0bee586879f85d5c53 | [] | no_license | rpokorny/jaxrs-dtos-test | baf1ce2bb03e82ee66353f761f20549c1527e39a | ab019eb5808666aea98ccae8998f7113fed41ad9 | refs/heads/master | 2016-09-08T05:04:03.207265 | 2014-07-23T15:10:27 | 2014-07-23T15:10:27 | 22,084,734 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package org.ozoneplatform.service;
import org.springframework.stereotype.Service;
import org.ozoneplatform.entity.Listing;
@Service
public class ListingService extends AbstractEntityService<Listing> {
ListingService() {
super(Listing.class);
}
}
| [
"ross.pokorny@nextcentury.com"
] | ross.pokorny@nextcentury.com |
258f5b8cf44df239a8a4a7a9aa5b1adef7c01dc0 | 69ec2ce61fdb31b5f084bfbb13e378734c14c686 | /org.osgi.test.cases.framework.secure/src/org/osgi/test/cases/framework/secure/classloading/tb6c/Activator.java | 2cc737ec457d9353a375802c99abceb23189757b | [
"Apache-2.0"
] | permissive | henrykuijpers/osgi | f23750269f2817cb60e797bbafc29183e1bae272 | 063c29cb12eadaab59df75dfa967978c8052c4da | refs/heads/main | 2023-02-02T08:51:39.266433 | 2020-12-23T12:57:12 | 2020-12-23T12:57:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,673 | java | /*
* Copyright (c) OSGi Alliance (2004, 2016). All Rights Reserved.
*
* Implementation of certain elements of the OSGi Specification may be subject
* to third party intellectual property rights, including without limitation,
* patent rights (such a third party may or may not be a member of the OSGi
* Alliance). The OSGi Alliance is not responsible and shall not be held
* responsible in any manner for identifying or failing to identify any or all
* such third party intellectual property rights.
*
* This document and the information contained herein are provided on an "AS IS"
* basis and THE OSGI ALLIANCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
* HEREIN WILL NOT INFRINGE ANY RIGHTS AND ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL THE
* OSGI ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF
* USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR
* EXEMPLARY, INCIDENTIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN
* CONNECTION WITH THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
*
* All Company, brand and product names may be trademarks that are the sole
* property of their respective owners. All rights reserved.
*/
package org.osgi.test.cases.framework.secure.classloading.tb6c;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.test.cases.framework.secure.classloading.exports.service.SomeService;
/**
* This bundle activator is used to register some services
*
* @author left
* @author $Id$
*/
public class Activator implements BundleActivator {
private ServiceRegistration<SomeService> sr;
/**
* Creates a new instance of Activator
*/
public Activator() {
}
/**
* Start the bundle and register the service.
*
* @param context the bundle context
* @throws Exception if some problem occur
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
sr = context.registerService(SomeService.class,
new SomeServiceImpl(context.getBundle()), null);
}
/**
* Stop the bundle and unregister the service
*
* @param context the bundle context
* @throws Exception if some problem occur
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
sr.unregister();
}
}
| [
"hargrave@us.ibm.com"
] | hargrave@us.ibm.com |
0af587d1b9c288765dd932482ab3ba2738557ade | e52d4743824df64085fa782b7fc2245e9ee564b0 | /core-persistence/src/main/java/com/red/persistence/service/LoginAttemptBlocker.java | 4ff7654640fb22b7b37960f939a585b71968684f | [] | no_license | redzi/engineerTh | 6de854d8c494293023d07a832d4c0456af05ef18 | 100b45a5ee502250d44ee22a7fb576893f12a26c | refs/heads/master | 2020-12-24T16:24:04.540495 | 2016-05-14T16:01:28 | 2016-05-14T16:01:28 | 33,371,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.red.persistence.service;
/**
* Created by tom on 2015-05-02.
*/
public interface LoginAttemptBlocker
{
void loginSuccessful(String key);
public void loginFailed(String key);
public boolean isBlocked(String key);
}
| [
"redzi44@gmail.com"
] | redzi44@gmail.com |
c678a543680b7a04e54f140baac953a16d78f1e3 | 64db7bdca1ba3d7478a747944a82e53b55407338 | /In_The_Dark/core/src/com/mygdx/spaceshooter/models/Grass.java | 97487c4d8b9bcf4e68a25e080bc16599facee9db | [] | no_license | ahlebnikov1995/Project-X | 4519d2f89e93421cc502c41a48295ef444b2eb7f | adc5fa1f2413437b4dacc92e6794ea2039d91f4b | refs/heads/main | 2023-06-27T14:44:47.318995 | 2021-07-30T09:18:44 | 2021-07-30T09:18:44 | 347,471,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,120 | java | package com.mygdx.spaceshooter.models;
import com.badlogic.gdx.graphics.Texture;
import com.mygdx.spaceshooter.screens.GameScreen;
public class Grass extends GameObject {
Texture v1;
Texture v2;
Texture v3;
Texture curTexture;
public Grass(float y, float x, Texture v1, Texture v2, Texture v3){
super(x,y,GameScreen.SCR_WIDTH,GameScreen.SCR_HEIGHT,true,0,0);
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.setRandomCurTexture();
}
public void setRandomCurTexture(){
int x = (int) Math.floor(Math.random()*3);
if(x == 0) this.curTexture = v1;
if(x == 1) this.curTexture = v2;
if(x == 2) this.curTexture = v3;
}
@Override
public void move() {
super.move();
if (this.getX() < - this.getWidth() || this.getX() > GameScreen.SCR_WIDTH || this.getY() < - this.getHeight() || this.getY() > GameScreen.SCR_HEIGHT)
this.setAlive(false);
if(this.getVy() <= 0) {
if (this.getY() <= - this.getHeight()){
this.setY (this.getY() + 2f * this.getHeight());//- this.getHeight()/30f); // звёзды вниз
this.setRandomCurTexture();
}
}
if(this.getVx() <= 0) {
if (this.getX() <= - this.getWidth()) {
this.setX( this.getX() + 2f * this.getWidth()); //- this.getWidth()/30f); // звезды влево
this.setRandomCurTexture();
}
}
if(this.getVy() >= 0) {
if (this.getY() >= this.getHeight()){
this.setY( this.getY() - 2f * this.getHeight()); // + this.getHeight()/30f); // звезды вверх
this.setRandomCurTexture();
}
}
if(this.getVx() >= 0) {
if (this.getX() >= this.getWidth()) {
this.setX(this.getX() - 2f * this.getWidth()); // + this.getWidth()/30f); // звёзды вправо
this.setRandomCurTexture();
}
}
}
public Texture getCurTexture() {
return curTexture;
}
}
| [
"72694799+ahlebnikov1995@users.noreply.github.com"
] | 72694799+ahlebnikov1995@users.noreply.github.com |
60d358b91d46b06ff88b4e0887a6f120613b97bf | 0d02b41e08b9d2a04507633a950999fccd270714 | /src/ood/practices/package-info.java | 3bcad4b53324409f705b617bb6a79665f7111d60 | [] | no_license | macchicken/designpatterns | 8ce5c33453ee2a61953b59521331ced2c14191b2 | 7e7dd1e57aeaa372c689a5ba2a9634d1614a9b52 | refs/heads/master | 2021-01-10T07:44:59.810574 | 2015-12-01T01:40:01 | 2015-12-01T01:40:01 | 47,156,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 62 | java | /**
*
*/
/**
* @author Barry
*
*/
package ood.practices; | [
"log525lg100@gmail.com"
] | log525lg100@gmail.com |
9b919e72d638404c75d5526146a5d01afa9907c9 | 04cd093ef7d26b67dc9fe2b9981caeb4ec238bce | /src/main/java/com/github/tj123/jhi1/repository/package-info.java | 5159cf7a6c6e1427044be47c4f1af095b8eccbb7 | [] | no_license | tj123/jhi1 | d52e0069a1d78d02134875879c3c411310279896 | 6e754e0255893cd32ebffebe0061a0a22f841c69 | refs/heads/master | 2021-01-20T04:12:24.850578 | 2017-04-28T02:43:20 | 2017-04-28T02:43:20 | 89,657,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 83 | java | /**
* Spring Data JPA repositories.
*/
package com.github.tj123.jhi1.repository;
| [
"tang123jian@126.com"
] | tang123jian@126.com |
4b9e566756e747bbceead55d1b58dc972c2bdd29 | 6c66b93a9a031e6af6bb50efcb8057dabd067d07 | /FirebaseIntegration/backend/build/tmp/appengineEndpointsExpandClientLibs/myApi-v1-java.zip-unzipped/myApi/src/main/java/com/example/jaibock/myapplication/backend/myApi/model/MyBean.java | b9be498101e2936fd5bb5bb2aee0341d4ceb0b06 | [
"Apache-2.0"
] | permissive | jpolarinakis/group-task-app | c2921ff6d574e3343ac04d9f44b20f8aa5adf85b | c391c7567072d73ac57357436655f54ccf349f4e | refs/heads/master | 2021-01-12T13:40:26.634282 | 2016-12-01T02:08:49 | 2016-12-01T02:08:49 | 69,217,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,938 | java | /*
* 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.
*/
/*
* This code was generated by https://github.com/google/apis-client-generator/
* (build: 2016-10-17 16:43:55 UTC)
* on 2016-11-30 at 03:00:15 UTC
* Modify at your own risk.
*/
package com.example.jaibock.myapplication.backend.myApi.model;
/**
* Model definition for MyBean.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the myApi. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class MyBean extends com.google.api.client.json.GenericJson {
/**
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String data;
/**
* @return value or {@code null} for none
*/
public java.lang.String getData() {
return data;
}
/**
* @param data data or {@code null} for none
*/
public MyBean setData(java.lang.String data) {
this.data = data;
return this;
}
@Override
public MyBean set(String fieldName, Object value) {
return (MyBean) super.set(fieldName, value);
}
@Override
public MyBean clone() {
return (MyBean) super.clone();
}
}
| [
"jaibock@hotmail.com"
] | jaibock@hotmail.com |
6717fa4e83b2f4ea75508e6b0d5d14fa15f1ca8d | 942ba333d8909d52929c62568b4b8b3a2f8d4977 | /app/src/main/java/in/paraman/restsample/model/Sample.java | f3d44ed56dd2b0b9d62bbcc8fea52d1ab3e2f84a | [] | no_license | paramitapal/RecyclerViewSample | d3e14c923214f2e7325dca5bd9cfaf27b0e9dd0b | 36fc9e56de86fa329de37bd5ff24759a5aa76aa0 | refs/heads/master | 2020-03-26T04:41:34.748470 | 2018-08-13T01:59:43 | 2018-08-13T01:59:43 | 144,516,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package in.paraman.restsample.model;
public class Sample {
private String text;
private String imageUrl;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
}
| [
"pal.paramita91@gmail.com"
] | pal.paramita91@gmail.com |
c170d900161cf087d545172a6f7cfc85b729b105 | 5505488ccb3109ce0c4cb2d673cd1d4099114582 | /Ch01/src/ch02/service/UserNotFoundException.java | cfea2231a1c1199d228189aecf1e9d795a7ab49f | [] | no_license | BangJinHyeok/Test0 | 9b2081314ab3a3443a458a1e98755e95eda91d56 | e7b61e98cbd1cd10a697b5d635b971509a65958e | refs/heads/master | 2023-01-13T21:33:28.818724 | 2020-10-05T02:17:03 | 2020-10-05T02:17:03 | 301,167,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116 | java | package ch02.service;
@SuppressWarnings("serial")
public class UserNotFoundException extends RuntimeException {
}
| [
"bang1541sky@gmail.com"
] | bang1541sky@gmail.com |
9bff82969ec6a2555cba0bef7bca17597518163a | 643412c979e3d93a94d40469490da6ff27a8039d | /app/src/main/java/com/abantaoj/tweeter/ui/login/LoginActivity.java | da28db13f7b6247abe2568d5d8d4b487887baaba | [
"Apache-2.0"
] | permissive | jonabantao/tweeter | 8b75a6f4f4bd1c23afd15f0894fd3a702e47411e | 95d2a6a5f6dd4f42ed2e8471469ccd8faae02522 | refs/heads/main | 2022-12-30T12:33:46.129033 | 2020-10-17T01:32:49 | 2020-10-17T01:32:49 | 301,030,360 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | package com.abantaoj.tweeter.ui.login;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.abantaoj.tweeter.R;
import com.abantaoj.tweeter.services.TwitterClient;
import com.abantaoj.tweeter.ui.timeline.TimelineActivity;
import com.codepath.oauth.OAuthLoginActionBarActivity;
public class LoginActivity extends OAuthLoginActionBarActivity<TwitterClient> {
final String TAG = this.getClass().getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
findViewById(R.id.login_button).setOnClickListener(v -> getClient().connect());
}
@Override
public void onLoginSuccess() {
Log.d(TAG, "login success");
Intent intent = new Intent(this, TimelineActivity.class);
startActivity(intent);
}
@Override
public void onLoginFailure(Exception e) {
Log.e(TAG, "login failed", e);
Toast.makeText(this, getString(R.string.login_failed), Toast.LENGTH_SHORT).show();
}
} | [
"jonabantao@gmail.com"
] | jonabantao@gmail.com |
24450f685b40d56d8a79b8975449b5c689c00c49 | 6a7d06b6b9093e0ac936f52861ebfc436c725d05 | /clase7/Veterinaria.java | b59116ff79177df22ac20330e7108d33c86c0518 | [] | no_license | locchiato/clases-poo | 5dc03bc0587422486560417d84603e9738d938e7 | 796a0b7fb7fc6dd1ce3dcaeb0fc0c03fde1140e3 | refs/heads/master | 2023-06-24T16:05:21.696598 | 2021-08-01T02:32:59 | 2021-08-01T02:32:59 | 372,693,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 949 | java | package clase7;
public class Veterinaria {
public static void main(String[] args) {
String arrayNombres[] = {"Manchitas", "Nemo", "Silvestre", "Manuelita", "Gardel"};
int arrayEdades[] = {2, 1, 3, 12, 1};
String arrayCantidadAlimento[] = {"2 kilos y medio", "140 gramos", "medio kilo", "300 gramos", "350 gramos"};
String arraySonidos[] = {"guau guau", "glu glu", "miau miau", "Pehuajo", "chuick chuick"};
for (int i = 0; i < arrayEdades.length; i++) {
mostrarDatos(arrayNombres[i], arrayEdades[i],
arrayCantidadAlimento[i], i==3, arraySonidos[i]);
}
}
static void mostrarDatos(String nombre, int edad, String cantidad, boolean esLugar, String sonido) {
System.out.println(nombre + " tiene " + edad + " años ");
System.out.println(nombre + " come " + cantidad +
(esLugar ? " y vive en " : " y hace ") + sonido);
}
}
| [
"leandro.occhiato@gmail.com"
] | leandro.occhiato@gmail.com |
58a85e9898dd7a866915cf81f4eb72b4aa7092e5 | 5fdd9cf2d33fee48d343cf0d2fa37f2a40c0b372 | /online_edu_service/src/main/java/com/atguigu/edu/controller/EduTeacherController.java | a32d8b557b925cb5bbe3c567c59be9b08784fad3 | [] | no_license | hahagioi998/online_edu_parent | 4c88d6eab54388e2c602dc620c69a3984a4fe798 | 51e9bab41404aa273450cc989cb03cb70200921b | refs/heads/master | 2023-05-12T23:59:07.369124 | 2020-05-11T11:18:57 | 2020-05-11T11:18:57 | 485,859,282 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,243 | java | package com.atguigu.edu.controller;
import com.atguigu.edu.entity.EduTeacher;
import com.atguigu.edu.service.EduTeacherService;
import com.atguigu.request.TeacherConditon;
import com.atguigu.response.RetVal;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 讲师 前端控制器
* </p>
*
* @author zhangqiang
* @since 2020-04-10
*/
@RestController
@RequestMapping("/edu/teacher")
@CrossOrigin
public class EduTeacherController {
@Autowired
private EduTeacherService teacherService;
//1.查询所有讲师
@GetMapping
public RetVal getAllTeacher() /**throws EduException */ {
// try {
// int a=1/0;
// }catch (Exception e){
// throw new EduException();
// }
List<EduTeacher> teacherList = teacherService.list(null);
return RetVal.success().data("teacherList",teacherList);
}
//2.删除讲师功能
@DeleteMapping("{id}")
public RetVal deleteTeacherById(@PathVariable("id") String id){
boolean result = teacherService.removeById(id);
if(result){
return RetVal.success();
}else{
return RetVal.error();
}
}
//3.讲师分页查询
@GetMapping("queryTeacherPage/{pageNum}/{pageSize}")
public RetVal queryTeacherPage(@PathVariable long pageNum,@PathVariable long pageSize){
Page<EduTeacher> teacherPage = new Page<>(pageNum,pageSize);
teacherService.page(teacherPage, null);
//总记录数
long total = teacherPage.getTotal();
List<EduTeacher> teacherList = teacherPage.getRecords();
return RetVal.success().data("total",total).data("rows",teacherList);
}
//4.讲师分页查询 带条件
@GetMapping("queryTeacherPageByCondition/{pageNum}/{pageSize}")
public RetVal queryTeacherPageByCondition(@PathVariable long pageNum,@PathVariable long pageSize,
TeacherConditon teacherConditon){
Page<EduTeacher> teacherPage = new Page<>(pageNum,pageSize);
teacherService.queryTeacherPageByCondition(teacherPage,teacherConditon);
//总记录数
long total = teacherPage.getTotal();
List<EduTeacher> teacherList = teacherPage.getRecords();
return RetVal.success().data("total",total).data("rows",teacherList);
}
//5.添加讲师
@PostMapping
public RetVal saveTeacher(EduTeacher teacher){
boolean result = teacherService.save(teacher);
if(result){
return RetVal.success();
}else{
return RetVal.error();
}
}
//6.根据id查询讲师
@GetMapping("{id}")
public RetVal queryTeacherById(@PathVariable String id){
EduTeacher teacher = teacherService.getById(id);
return RetVal.success().data("teacher",teacher);
}
//7.更新讲师
@PutMapping
public RetVal updateTeacher(EduTeacher teacher){
boolean result = teacherService.updateById(teacher);
if(result){
return RetVal.success();
}else{
return RetVal.error();
}
}
}
| [
"18235757166@163.com"
] | 18235757166@163.com |
c762958a6b55c8405ed814814caff8fece32fd35 | 1ce518b09521578e26e79a1beef350e7485ced8c | /source/app/src/main/java/com/google/gson/internal/p.java | 3cd1d7bce74ecbcf9374f32d079cf7d105b8e9ce | [] | no_license | yash2710/AndroidStudioProjects | 7180eb25e0f83d3f14db2713cd46cd89e927db20 | e8ba4f5c00664f9084f6154f69f314c374551e51 | refs/heads/master | 2021-01-10T01:15:07.615329 | 2016-04-03T09:19:01 | 2016-04-03T09:19:01 | 55,338,306 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,679 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.google.gson.internal;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
// Referenced classes of package com.google.gson.internal:
// Excluder
final class p extends TypeAdapter
{
private TypeAdapter a;
private boolean b;
private boolean c;
private Gson d;
private TypeToken e;
private Excluder f;
p(Excluder excluder, boolean flag, boolean flag1, Gson gson, TypeToken typetoken)
{
f = excluder;
b = flag;
c = flag1;
d = gson;
e = typetoken;
super();
}
private TypeAdapter a()
{
TypeAdapter typeadapter = a;
if (typeadapter != null)
{
return typeadapter;
} else
{
TypeAdapter typeadapter1 = d.getDelegateAdapter(f, e);
a = typeadapter1;
return typeadapter1;
}
}
public final Object read(JsonReader jsonreader)
{
if (b)
{
jsonreader.skipValue();
return null;
} else
{
return a().read(jsonreader);
}
}
public final void write(JsonWriter jsonwriter, Object obj)
{
if (c)
{
jsonwriter.nullValue();
return;
} else
{
a().write(jsonwriter, obj);
return;
}
}
}
| [
"13bce123@nirmauni.ac.in"
] | 13bce123@nirmauni.ac.in |
0c7e57b819c13d244df56fbdde7ab63a1dc14067 | 261354cfb9111edd9a78b5cabaca64af9687628c | /src/main/java/com/megacrit/cardcrawl/mod/replay/modifiers/ChaoticModifier.java | 8d33f2ff7fe1333fe7bfa8fe2167b585fba05aa2 | [] | no_license | The-Evil-Pickle/Replay-the-Spire | 1c9258bd664ba0ff41f79d57180a090c502cdca3 | 1fcb4cedafa61f32b3d9c3bab2d6a687f9cbe718 | refs/heads/master | 2022-11-14T15:56:19.255784 | 2022-11-01T13:30:14 | 2022-11-01T13:30:14 | 122,853,479 | 39 | 19 | null | 2022-11-01T13:30:15 | 2018-02-25T16:26:38 | Java | UTF-8 | Java | false | false | 757 | java | package com.megacrit.cardcrawl.mod.replay.modifiers;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.daily.mods.AbstractDailyMod;
import com.megacrit.cardcrawl.helpers.ImageMaster;
import com.megacrit.cardcrawl.localization.RunModStrings;
public class ChaoticModifier extends AbstractDailyMod
{
public static final String ID = "replay:Chaotic";
private static final RunModStrings modStrings = CardCrawlGame.languagePack.getRunModString(ID);
public static final String NAME = modStrings.NAME;
public static final String DESC = modStrings.DESCRIPTION;
public ChaoticModifier() {
super(ID, NAME, DESC, null, true);
this.img = ImageMaster.loadImage("images/relics/cursedBlood.png");
}
} | [
"tobiaskipps@gmail.com"
] | tobiaskipps@gmail.com |
8ab5b70a6124315ccacf61ae03afe7e478633f82 | 21e4610f13e51f27f4fa2968927ad9532884852a | /src/main/java/model/Pawn.java | f1f1692af3e10b152d91e1256e37af8a77db6999 | [] | no_license | mbogaz/chess_ai | 542eed8dd74c1b5bceae751c60e0f6c31321b43e | c81f7fe042268e3ce64aeb652235ac1169c1050e | refs/heads/master | 2022-11-18T11:01:04.469456 | 2020-07-20T10:50:04 | 2020-07-20T10:50:04 | 281,060,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package model;
import type.Side;
public class Pawn extends Piece {
public Pawn(Side side) {
super(side);
}
public String getDisplayName() {
return "P";
}
}
| [
"mbogaz93@gmail.com"
] | mbogaz93@gmail.com |
1a79c84416c9592a05ffa2672cf3757e6762c19d | d32ee6461c5e726ee0c0b1ef48c89076fbb28650 | /src/_09_obedient_robot/obidient_robot.java | d7bf2352691676966b3804831bb8634e1a091825 | [] | no_license | League-Level0-Student/level-0-module-5-DerekHSA | 5821283525b9798a1e678c298a4b5905e0c424fb | fb3bb7586070ac5a9a207addf18d2b630690434f | refs/heads/master | 2021-01-26T10:43:51.773650 | 2020-03-19T21:10:05 | 2020-03-19T21:10:05 | 243,409,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,785 | java | package _09_obedient_robot;
import javax.swing.JOptionPane;
import org.jointheleague.graphical.robot.Robot;
public class obidient_robot {
static Robot Jojo = new Robot("batman");
public static void main(String[] args) {
Jojo.setSpeed(1000);
Jojo.setPenWidth(1000);
String Shape=JOptionPane.showInputDialog("What shape do you want?");
String Color=JOptionPane.showInputDialog("What color do you want your shape to be?");
if (Color.equalsIgnoreCase("blue")) {
Jojo.setPenColor(0, 0, 100);
}else if (Color.equalsIgnoreCase("red")){
Jojo.setPenColor(255, 0 ,0);
}else if (Color.equalsIgnoreCase("Yellow")){
Jojo.setPenColor(255, 255 ,0);
}else if (Color.equalsIgnoreCase("green")){
Jojo.setPenColor(0, 255 ,0);
}else if (Color.equalsIgnoreCase("purple")){
Jojo.setPenColor(148, 0 ,211);
}else if (Color.equalsIgnoreCase("orange")){
Jojo.setPenColor(255, 165 ,0);
}else if (Color.equalsIgnoreCase("white")){
Jojo.setPenColor(255, 255 ,255);
}else if (Color.equalsIgnoreCase("black")){
Jojo.setPenColor(0, 0 ,0);
}
if(Shape.equalsIgnoreCase("Circle")) {
drawCircle();
}else if(Shape.equalsIgnoreCase("Square")) {
drawSquare();
}else if(Shape.equalsIgnoreCase("Triangle")) {
drawTriangle();
}
}
public static void drawCircle() {
for (int i = 0; i < 36; i++) {
Jojo.penDown();
Jojo.move(10);
Jojo.turn(10);
}
}
public static void drawTriangle() {
Jojo.penDown();
Jojo.turn(31);
Jojo.move(150);
Jojo.turn(120);
Jojo.move(150);
Jojo.turn(120);
Jojo.move(150);
}
public static void drawSquare() {
Jojo.penDown();
Jojo.move(100);
Jojo.turn(90);
Jojo.move(100);
Jojo.turn(90);
Jojo.move(100);
Jojo.turn(90);
Jojo.move(100);
}
}
| [
"55466846+DerekHSA@users.noreply.github.com"
] | 55466846+DerekHSA@users.noreply.github.com |
340d4800500cd728a703f5f5ae88db6a46abd1f7 | f7c967d88838c4b79b679165d17ef59ffe1c02ba | /DichFighter/core/src/com/mygdx/game/Enemy.java | 9e26418f6d1d14af0c5de6b81f483ab426317cf6 | [] | no_license | IlyaSolodilov/Projects | 8c20a42f0d34b70e11f8b1dafd421bbf9d22155a | 78d262018f943dfcf0310f8610812e627955e154 | refs/heads/main | 2023-07-19T06:55:23.722200 | 2021-09-13T17:53:35 | 2021-09-13T17:53:35 | 400,252,494 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,773 | java | package com.mygdx.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
public class Enemy {
private Texture texture;
private Texture textureHp;
private float x;
private float y;
private float angle;
private float speed;
private float scale;
private float hp;
private float hpMax;
float damageEffectTimer;
public double dmg;
private int dmgrange;
private Texture robertTexture;
private Texture robertWinTexture;
public boolean isAlive() {
return hp > 0;
}
private DichFighter game;
public float getX() {
return x;
}
public float getY() {
return y;
}
public Enemy(DichFighter game) {
this.texture = new Texture("warrior.png");
this.textureHp = new Texture("hpbar.png");
this.robertTexture = new Texture("robert.png");
this.robertWinTexture = new Texture("robertwin.png");
this.x = 200;
this.y = 90;
this.angle = 0.0f;
this.speed = 240;
this.hpMax = 10.0f;
this.hp = 10.0f;
this.game = game;
this.dmgrange = 100;
}
public void dmg(){
hp -= dmg;
}
public void update(float dt){
damageEffectTimer -= dt;
if (damageEffectTimer < 0.0f) {
damageEffectTimer = 0.0f;
}
float dst = (float) Math.sqrt((game.getFighter().getX() - this.x) * (game.getFighter().getX() - this.x) + (game.getFighter().getY() - this.y) * (game.getFighter().getY() - this.y));
if (Gdx.input.isKeyPressed(Input.Keys.D)) {
x += speed * dt;
}
if (Gdx.input.isKeyPressed(Input.Keys.A)) {
x -= speed * dt;
}
if (Gdx.input.isKeyPressed(Input.Keys.D)) {
x += speed * MathUtils.cosDeg(angle) * dt;
if (x > Gdx.graphics.getWidth() - 40 * scale) {
x = Gdx.graphics.getWidth() - 40 * scale;
}
if (x < 0.0f + 40 * scale) {
x = +40.0f * scale;
}
}
if (Gdx.input.isKeyPressed(Input.Keys.A)) {
x -= speed * MathUtils.cosDeg(angle) * dt * 2.0f;
}
if (Gdx.input.isKeyJustPressed(Input.Keys.K)) {
hp -= dmg;
if (dst > dmgrange) {
dmg = 0;
} else {
dmg = 0.5;
}
}
if (Gdx.input.isKeyPressed(Input.Keys.G)){
dmg = 0.2;
}
}
public void render(SpriteBatch batch) {
if (damageEffectTimer > 0) {
batch.setColor(1, 1 - damageEffectTimer, 1 - damageEffectTimer, 1);
}
batch.draw(texture, x - 20, y - 20, 65, 104, 130, 209, 1, 1, angle, 0, 0, 130, 209, false, false);
batch.setColor(1, 1, 1, 1);
batch.setColor(0.1f, 0.0f, 0.0f, 1.0f);
batch.draw(textureHp, x - 25, y + 125, 30, 107, 160, 120, 1, 1, angle, 0, 0, 160, 120, false, false);
batch.setColor(0.7f, 1.0f, 0.0f, 1.0f);
batch.draw(textureHp, x - 25, y + 125, 0, 0, (int) ((float) hp / hpMax * 160), 120);
batch.setColor(1, 1, 1, 1);
if (hp < 0){
batch.draw(robertWinTexture,300,300);
}
}
public void recreate() {
x = 200;
y = 90;
angle = 0.0f;
hp = hpMax;
}
public void dispose() {
texture.dispose();
}
}
| [
"ilyas.solodilov@gmail.com"
] | ilyas.solodilov@gmail.com |
ace9e2b9c717d42617a50ec0dc535c7eae219b97 | 48bdafdce36e8acbce3c7ded63c680038f96e2aa | /optimalpay-lib/java-common-src/com/optimalpayments/customervault/Status.java | 11099e15011c0b38eae22a3589f2529844448091 | [] | no_license | OptimalPayments/Android_SDK | d12f172ce8679b269f2136cd5f1d557dded7b275 | 6b6b69b7c30141faf264d1f9b4d15d558eb56480 | refs/heads/master | 2020-12-03T01:55:10.170317 | 2015-10-07T05:18:25 | 2015-10-07T05:18:25 | 43,756,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | package com.optimalpayments.customervault;
/**
* Created by Asawari.Vaidya on 26-06-2015.
*/
public enum Status {
INITIAL,
ACTIVE
} // end of enum Status
| [
"asawari.vaidya@PD390-6FGSWQ1.OPUSCORP.COM"
] | asawari.vaidya@PD390-6FGSWQ1.OPUSCORP.COM |
9775a9feb8a48372eaed64945c6fe00958256480 | fd0ce1e4ff1994326438f9092bfbafdc077ed488 | /src/main/java/com/tati/tata/model/entities/Menu.java | e031a74e42ccf0dfc24099cb59b6349c47904811 | [] | no_license | lpath78/tata | 127ef31e291fdb66d4e348d9fae855ffa81b0e6e | fa6809062272b705d68d4914632daa884e888ba3 | refs/heads/master | 2022-12-16T09:29:50.565813 | 2020-09-16T11:20:41 | 2020-09-16T11:20:41 | 295,969,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package com.tati.tata.model.entities;
import com.tati.tata.model.references.TypeMenu;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
@Entity
@NoArgsConstructor
@Table(name = "MENU")
@SuppressWarnings("serial")
public class Menu extends AbstractEntityGeneral{
@Getter
@Setter
@Enumerated(EnumType.STRING)
private TypeMenu typeMenu;
@Getter
@Setter
@OneToOne(cascade = CascadeType.MERGE)
private Burger burger;
@Getter
@Setter
@OneToOne(cascade = CascadeType.MERGE)
private Soda soda;
@Getter
@Setter
@OneToOne(cascade = CascadeType.MERGE)
private Accompagnement accompagnement;
@Getter
@Setter
@OneToOne(cascade = CascadeType.MERGE)
private Sauce sauce;
}
| [
"valgames@icloud.com"
] | valgames@icloud.com |
38eb7fc3e99cc02e44c618233a1757dfbcd63c96 | f7a40de5e51ecb60a273e19f939a41d00ff7df45 | /android/app/src/main/java/com/inso/plugin/manager/AppController.java | 75bdd5cf7c1b3a2d5ef4ce334825611659ea561f | [] | no_license | ftc300/inso | 50d35294990945916a9733a76a0847fc96fc183d | b08071da4de3068bec2289df11c34fe35d855447 | refs/heads/master | 2022-01-05T01:32:23.982350 | 2019-06-05T03:19:08 | 2019-06-05T03:19:08 | 164,582,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package com.inso.plugin.manager;
import android.app.Application;
import com.google.gson.Gson;
import com.inso.plugin.basic.BasicAct;
import java.util.LinkedList;
import java.util.List;
/**
* Created by chendong on 2017/3/30.
*/
public class AppController extends Application {
private List<BasicAct> mList = new LinkedList<>();
private static AppController instance;
public static Gson gson ;
private AppController() {
}
public synchronized static AppController getInstance() {
if (null == instance) {
instance = new AppController();
}
return instance;
}
public synchronized static Gson getGson() {
if (null == gson) {
gson = new Gson();
}
return gson;
}
// add Activity
public void addActivity(BasicAct activity) {
mList.add(activity);
}
// remove Activity
public void removeActivity(BasicAct activity) {
mList.remove(activity);
}
public void exit() {
try {
for (BasicAct activity : mList) {
if (activity != null)
activity.finish();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
System.gc();
}
}
| [
"cd@inshowlife.com"
] | cd@inshowlife.com |
7a3ab25cfac675f4b18ccbc439f8ba8e848c371f | c35a2d055117ae1ff9b50b047dda78bb4c17a6a7 | /optimus-ai-image-analyzer/src/test/java/org/optimus/image/analyzer/ImageFileAnalyzerTest.java | 69d2e1e752aa02340443ff37ef2263bb92b9be86 | [] | no_license | blogbees/optimus-ai | 1056f6e225f6c3290f1b99d27bb34f8d0243eaef | b7a42515eaf17ba44236c65c062dc9112ac657ba | refs/heads/master | 2020-03-17T22:31:39.460643 | 2018-06-01T20:48:51 | 2018-06-01T20:48:51 | 134,007,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 723 | java | package org.optimus.image.analyzer;
import java.io.File;
import java.util.Map;
import org.junit.Test;
import org.optimus.ai.system.analyzers.Analyzer;
import junit.framework.TestCase;
/**
* Unit test for simple App.
*/
public class ImageFileAnalyzerTest
extends TestCase
{
@Test
public void testImageFile() throws Exception{
Analyzer<File , Map<String, Object>> analyzer = new ImageFileAnalyzer();
File file = new File("src/test/resources/image_with_text.jpg");
Map<String, Object> imageDetails = analyzer.analyze(file);
assertNotNull(imageDetails);
assertNotNull(imageDetails.get("height"));
assertNotNull(imageDetails.get("width"));
assertNotNull(imageDetails.get("colorspace_name"));
}
}
| [
"satishraj.j@gmail.com"
] | satishraj.j@gmail.com |
9744cb158b8251993942ac5ff9d0e9a3b50394da | 6986a02e6ce7ca0ee2ad7889bf403df6ced957d6 | /src/main/java/jkumensa/parser/ex/MensaDateParsingException.java | d6e71f303d81465e00ae27421f216d989f708ab2 | [
"Apache-2.0"
] | permissive | Nithanim/mensaparser | 4fd5528eae074e1a76e3be61e1de28fc7a8f46d5 | c9ef3890ca7beefe23806561389b553c7807c50c | refs/heads/master | 2021-05-01T20:04:02.409891 | 2019-02-25T02:21:12 | 2019-02-25T02:23:35 | 120,959,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package jkumensa.parser.ex;
public class MensaDateParsingException extends MensaParsingException {
public MensaDateParsingException(String message) {
super(message);
}
public MensaDateParsingException(String message, Throwable cause) {
super(message, cause);
}
public MensaDateParsingException(Throwable cause) {
super(cause);
}
}
| [
"git@nithanim.me"
] | git@nithanim.me |
577286f64ce3741e94ed5adf9625f28dc242c960 | 551c91da88580f7eda0e55bad619bef8c5caa596 | /app/src/main/java/global/kz/test/di/PerActivity.java | b6b18086fd540721308c75270484b499d7897d9b | [] | no_license | Tomas13/TestGlobalInnovations | 7680a788201aeb9ee3f751c83bfe110ca6231f08 | ea5d3661991270494352e14b8cf3c09e8257c3d2 | refs/heads/master | 2021-01-23T10:20:34.652392 | 2020-01-26T07:42:08 | 2020-01-26T07:42:08 | 93,052,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | /*
* Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://mindorks.com/license/apache-v2
*
* 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 global.kz.test.di;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;
/**
* Created by janisharali on 27/01/17.
*/
@Scope
@Retention(RetentionPolicy.RUNTIME)
public @interface PerActivity {
}
| [
"tomas.mapoter@gmail.com"
] | tomas.mapoter@gmail.com |
4a250796876e91e345ac7a70dc7fd1b0933cf410 | df1891d0475af6386c6e177b564fb22826d0d6e2 | /M9N3/src/com/rocket/domain/Propulsor.java | dd260fa976355fa39538f61bbe7532f758310793 | [] | no_license | pperezcode/ITA_M9 | 2279756de6f65b180695ff62553467e265f8fa42 | 4d831722d3a484de65aba4910505fe5687ee410e | refs/heads/master | 2023-08-18T11:27:56.140356 | 2021-10-03T16:42:37 | 2021-10-03T16:42:37 | 413,093,259 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,634 | java | package com.rocket.domain;
import com.rocket.application.ExcedintPotenciaMaxException;
public class Propulsor {
protected String codiCoet;
protected int idPropulsor;
protected int potenciaAct;
protected int potenciaObj;
protected int potenciaMax;
public Propulsor(String codiCoet, int idPropulsor, int potMaxima) throws ExcedintPotenciaMaxException{
// Validem que no es sobrepassi la potència màxima
if (potenciaAct > potMaxima)
throw new ExcedintPotenciaMaxException("La potència actual no pot sobrepassar la potència màxima: " + potenciaMax);
if (potenciaObj > potenciaMax)
throw new ExcedintPotenciaMaxException("La potència objectiu és superior a la potència màxima!");
this.codiCoet = codiCoet;
this.idPropulsor = idPropulsor;
this.potenciaMax = potMaxima;
potenciaAct = 0; // Inicialitzem la potència actual a 0
}
// Getters i Setters
public String getCodiCoet() {
return codiCoet;
}
public int getIdPropulsor() {
return idPropulsor;
}
public int getPotenciaAct() {
return potenciaAct;
}
public void setPotenciaAct(int potenciaAct) {
this.potenciaAct = potenciaAct;
}
public int getPotenciaObj() {
return potenciaObj;
}
public void setPotenciaObj(int potenciaObj) {
this.potenciaObj = potenciaObj;
}
public int getPotenciaMax() {
return potenciaMax;
}
public void setPotenciaMax(int potenciaMax) {
this.potenciaMax = potenciaMax;
}
@Override
public String toString() {
return codiCoet + "-" + idPropulsor + ", potenciaAct=" + potenciaAct + ", potenciaObj=" + potenciaObj
+ ", potenciaMax=" + potenciaMax;
}
}
| [
"patri@DESKTOP-SCNG0T2"
] | patri@DESKTOP-SCNG0T2 |
198f43c89fbbe4919f10d5038cf35adb65ec46ed | ceaead2b65fc96deb7417eeb934721a68c24a648 | /src/main/java/com/design/factory/AppleFactory.java | 1cc350b287e1f21e120609c3dc68c333ec88fdbf | [] | no_license | Polarisys/DesignMode | 9dfbd5d5983a8e6a7363e706b9fce6b9987de4ce | 83dc90cf810452110d8fc01bb205c72a90b1ab12 | refs/heads/master | 2022-12-04T17:57:14.467947 | 2020-08-22T08:02:16 | 2020-08-22T08:02:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package com.design.factory;
/**
* @anthor Tolaris
* @date 2020/4/14 - 17:25
*/
public class AppleFactory implements PhoneFactory {
@Override
public Phone getPhone() {
return new ApplePhone();
}
}
| [
"mjhzxy@outlook.com"
] | mjhzxy@outlook.com |
eb3a8d598a6856d1324a688e05b382dbcc0e8926 | 948c1e7945cd30314dd00d7962d8e3786b83432d | /src/main/java/com/rmb/test/TestApi/configs/LdapConfiguration.java | b1aa739c344bd79b3b817871a1e4493d9d517df8 | [] | no_license | gaffy94/RMBTEST | 49b20e75de6c2072e4a5930d1a6588253496d928 | ec281b4ce4ff97be3effbd8fbc3e92f04af0294b | refs/heads/dev | 2023-07-08T09:53:43.984513 | 2019-12-03T13:33:03 | 2019-12-03T13:33:03 | 225,596,566 | 0 | 0 | null | 2023-06-20T18:32:05 | 2019-12-03T10:49:30 | Java | UTF-8 | Java | false | false | 1,023 | java | package com.rmb.test.TestApi.configs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.core.support.LdapContextSource;
@Configuration
public class LdapConfiguration {
@Autowired
Environment env;
@Bean
public LdapContextSource contextSource () {
LdapContextSource contextSource= new LdapContextSource();
contextSource.setUrl(env.getRequiredProperty("ldap.url"));
contextSource.setBase(env.getRequiredProperty("ldap.base"));
contextSource.setUserDn(env.getRequiredProperty("ldap.username"));
contextSource.setPassword(env.getRequiredProperty("ldap.password"));
return contextSource;
}
@Bean
public LdapTemplate ldapTemplate() {
return new LdapTemplate(contextSource());
}
}
| [
"gkasumu@ecobank.com"
] | gkasumu@ecobank.com |
835dbd0e2ca1f9c33b999cd1446e4a2172707566 | 047dd7e2b2171e81edd5fad6e98ce5d852a54ad6 | /JavaTheHardWay/RudeQuestions.java | 0ca45b3d9a4624006cc6e370a4579cc817fa30be | [] | no_license | RyanH5/SDPre | a707eedd9063dc75fbd143fc3d1a8d5d08ae5fbb | 7b8423c2e5a419a30cbb16a8034db2612e96a2c1 | refs/heads/master | 2020-05-16T21:47:24.879156 | 2019-05-08T04:18:55 | 2019-05-08T04:18:55 | 183,317,044 | 0 | 0 | null | 2019-05-08T04:18:56 | 2019-04-24T22:45:22 | HTML | UTF-8 | Java | false | false | 966 | java | import java.util.Scanner;
public class RudeQuestions {
public static void main(String[] args) {
String name;
int age;
double weight, income;
Scanner keyboard = new Scanner(System.in);
System.out.println("Hello. What is your name?");
name = keyboard.next();
System.out.println("Hi, " + name + " how old are you?");
age = keyboard.nextInt();
System.out.println( "So you're " + age + ", eh? That's not very old." );
System.out.print( "How much do you weigh, " + name + "? " );
weight = keyboard.nextDouble();
System.out.println( weight + "! Better keep that quiet!!" );
System.out.print("Finally, what's your income, " + name + "? " );
income = keyboard.nextDouble();
System.out.print( "Hopefully that is " + income + " per hour" );
System.out.println( " and not per year!" );
System.out.print( "Well, thanks for answering my rude questions, " );
System.out.println( name + "." );
}
}
| [
"harrington.ryana@gmail.com"
] | harrington.ryana@gmail.com |
562adbeda0c3222eb4e82643d270a1966de61616 | 022742f0db39af1fc607f01b053b3d98366d5ad0 | /CommerceReferenceStore/Store/EStore/src/Java/atg/projects/store/droplet/EscapeJS.java | 5c7489c488f49b2708ad89f3de0f36c24906f979 | [] | no_license | bigdatashrikant/CRSRepository | 368d3fc3d412545f2fc23459c3b06039c9439fbe | d76833d1f9ece936bcc33800ad61ecdcc781bbde | refs/heads/master | 2020-04-27T17:00:07.221216 | 2019-03-08T09:09:21 | 2019-03-08T09:09:21 | 174,500,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,781 | java | /*<ORACLECOPYRIGHT>
* Copyright (C) 1994-2014 Oracle and/or its affiliates. All rights reserved.
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
* UNIX is a registered trademark of The Open Group.
*
* This software and related documentation are provided under a license agreement
* containing restrictions on use and disclosure and are protected by intellectual property laws.
* Except as expressly permitted in your license agreement or allowed by law, you may not use, copy,
* reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish,
* or display any part, in any form, or by any means. Reverse engineering, disassembly,
* or decompilation of this software, unless required by law for interoperability, is prohibited.
*
* The information contained herein is subject to change without notice and is not warranted to be error-free.
* If you find any errors, please report them to us in writing.
*
* U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S.
* Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable
* Federal Acquisition Regulation and agency-specific supplemental regulations.
* As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and
* license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the
* Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License
* (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
*
* This software or hardware is developed for general use in a variety of information management applications.
* It is not developed or intended for use in any inherently dangerous applications, including applications that
* may create a risk of personal injury. If you use this software or hardware in dangerous applications,
* then you shall be responsible to take all appropriate fail-safe, backup, redundancy,
* and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any
* damages caused by use of this software or hardware in dangerous applications.
*
* This software or hardware and documentation may provide access to or information on content,
* products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and
* expressly disclaim all warranties of any kind with respect to third-party content, products, and services.
* Oracle Corporation and its affiliates will not be responsible for any loss, costs,
* or damages incurred due to your access to or use of third-party content, products, or services.
</ORACLECOPYRIGHT>*/
package atg.projects.store.droplet;
import java.io.IOException;
import javax.servlet.ServletException;
import atg.nucleus.naming.ParameterName;
import atg.servlet.DynamoHttpServletRequest;
import atg.servlet.DynamoHttpServletResponse;
import atg.servlet.DynamoServlet;
/**
* This droplet is escaped apostrophe with \'.
*
* @author ATG
* @version $Id: //hosting-blueprint/B2CBlueprint/version/11.1/EStore/src/atg/projects/store/droplet/EscapeJS.java#2 $
*/
public class EscapeJS extends DynamoServlet {
/** Class version string. */
public static final String CLASS_VERSION = "$Id: //hosting-blueprint/B2CBlueprint/version/11.1/EStore/src/atg/projects/store/droplet/EscapeJS.java#2 $$Change: 877954 $";
/** Input parameter name value. */
public static final ParameterName VALUE = ParameterName.getParameterName("value");
public static final String OUTPUT_VALUE = "escapedValue";
/** The oparam name rendered once during processing.*/
public static final String OPARAM_OUTPUT = "output";
/**
* Replaced all occurrences of apostrophe with '\
* @param pReq the request to be processed
* @param pRes the response object for this request
* @throws ServletException an application specific error occurred processing this request
* @throws IOException an error occurred reading data from the request or writing data to the response.
*/
public void service(DynamoHttpServletRequest pReq, DynamoHttpServletResponse pRes) throws ServletException, IOException {
Object value = pReq.getObjectParameter(VALUE);
String escapedValue = null;
if(value instanceof String) {
escapedValue = ((String)value).replaceAll("\'", "\\\\'");
}
pReq.setParameter(OUTPUT_VALUE, escapedValue);
pReq.serviceLocalParameter(OPARAM_OUTPUT, pReq, pRes);
}
}
| [
"bigdata.shrikant@gmail.com"
] | bigdata.shrikant@gmail.com |
9fac1354046d04739dc552192d2532be6efb6427 | efaab7bbdf9d7eb591d0f8c125865f2d35d7b385 | /src/com/algha/boshuk/adapter/CricleAdapter.java | aecff06a2c82ed68720f6e254e2b0483a1014d08 | [] | no_license | algha/Boshuk-Android | 1880a6c7b1a4e1bcf8fc3eb4af822fd20c5d7540 | 38209c694a651520a277d9f4dc70f6053404a4e9 | refs/heads/master | 2021-08-28T03:34:25.911700 | 2017-12-11T06:05:10 | 2017-12-11T06:05:10 | 113,758,992 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,113 | java | package com.algha.boshuk.adapter;
import java.util.ArrayList;
import com.algha.boshuk.R;
import com.algha.boshuk.widget.MyTextView;
import android.app.Activity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
public class CricleAdapter extends BaseAdapter {
private ArrayList<String> list;
private Activity activity;
public CricleAdapter(Activity activity) {
super();
list = new ArrayList<String>();
for (int i = 0; i < 20; i++) {
list.add("this is str: " + i);
}
this.activity = activity;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}
@Override
public String getItem(int position) {
// TODO Auto-generated method stub
return list.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public static class ViewHolder {
public ImageView avatar;
public LinearLayout content;
public MyTextView follow_button;
public MyTextView name;
public MyTextView time_place;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder view;
LayoutInflater inflator = activity.getLayoutInflater();
if (convertView == null) {
view = new ViewHolder();
convertView = inflator.inflate(R.layout.layout_cricle_item, null);
view.avatar = (ImageView) convertView.findViewById(R.id.avatar);
view.follow_button = (MyTextView) convertView.findViewById(R.id.follow_button);
view.name = (MyTextView) convertView.findViewById(R.id.name);
view.time_place = (MyTextView) convertView.findViewById(R.id.time_place);
view.content = (LinearLayout) convertView.findViewById(R.id.content);
convertView.setTag(view);
} else {
view = (ViewHolder) convertView.getTag();
view.content.removeAllViews();
}
view.follow_button.setText("ئەگەشكەن");
view.name.setText("ئائىشە مۇھەممەد");
view.time_place.setText("01-17 12:10 شىنجاڭ ئۈرۈمچى");
view.content.addView(setTextView("ئەمدى ياپۇنىيەگە ئىچىم ئاغرىپ قىلىۋاتىدۇيا . ئەمەلىيەتتە تەڭسىز شەرتنامە ئەمەسكەنغۇ ئۇ . چىدىماسلىق دىسە مۇشۇنى دىسە بولىدىكەن ئەمدى ياپۇنىيەگە ئىچىم ئاغرىپ قىلىۋاتىدۇيا . ئەمەلىيەتتە تەڭسىز شەرتنامە ئەمەسكەنغۇ ئۇ . چىدىماسلىق دىسە مۇشۇنى دىسە بولىدىكەن "));
return convertView;
}
public MyTextView setTextView(String text) {
MyTextView textView = new MyTextView(activity);
textView.setText(text);
textView.setTextSize(14);
textView.setGravity(Gravity.RIGHT);
textView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
return textView;
}
}
| [
"algha@outlook.com"
] | algha@outlook.com |
8b111f26b48061629fb2b3f18f3808e83df5b29f | 1fc6412873e6b7f6df6c9333276cd4aa729c259f | /CoreJava/src/com/corejava7/awt/GBC.java | 56c1c52290ee98f0e3c507a6a7ed1c70f388124e | [] | no_license | youzhibicheng/ThinkingJava | dbe9bec5b17e46c5c781a98f90e883078ebbd996 | 5390a57100ae210dc57bea445750c50b0bfa8fc4 | refs/heads/master | 2021-01-01T05:29:01.183768 | 2016-05-10T01:07:58 | 2016-05-10T01:07:58 | 58,379,014 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,698 | java | package com.corejava7.awt;
/*
GBC - A convenience class to tame the GridBagLayout
Copyright (C) 2002 Cay S. Horstmann (http://horstmann.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.awt.*;
/**
This class simplifies the use of the GridBagConstraints
class.
*/
public class GBC extends GridBagConstraints
{
/**
Constructs a GBC with a given gridx and gridy position and
all other grid bag constraint values set to the default.
@param gridx the gridx position
@param gridy the gridy position
*/
public GBC(int gridx, int gridy)
{
this.gridx = gridx;
this.gridy = gridy;
}
/**
Constructs a GBC with given gridx, gridy, gridwidth, gridheight
and all other grid bag constraint values set to the default.
@param gridx the gridx position
@param gridy the gridy position
@param gridwidth the cell span in x-direction
@param gridheight the cell span in y-direction
*/
public GBC(int gridx, int gridy, int gridwidth, int gridheight)
{
this.gridx = gridx;
this.gridy = gridy;
this.gridwidth = gridwidth;
this.gridheight = gridheight;
}
/**
Sets the anchor.
@param anchor the anchor value
@return this object for further modification
*/
public GBC setAnchor(int anchor)
{
this.anchor = anchor;
return this;
}
/**
Sets the fill direction.
@param fill the fill direction
@return this object for further modification
*/
public GBC setFill(int fill)
{
this.fill = fill;
return this;
}
/**
Sets the cell weights.
@param weightx the cell weight in x-direction
@param weighty the cell weight in y-direction
@return this object for further modification
*/
public GBC setWeight(double weightx, double weighty)
{
this.weightx = weightx;
this.weighty = weighty;
return this;
}
/**
Sets the insets of this cell.
@param distance the spacing to use in all directions
@return this object for further modification
*/
public GBC setInsets(int distance)
{
this.insets = new Insets(distance, distance, distance, distance);
return this;
}
/**
Sets the insets of this cell.
@param top the spacing to use on top
@param left the spacing to use to the left
@param bottom the spacing to use on the bottom
@param right the spacing to use to the right
@return this object for further modification
*/
public GBC setInsets(int top, int left, int bottom, int right)
{
this.insets = new Insets(top, left, bottom, right);
return this;
}
/**
Sets the internal padding
@param ipadx the internal padding in x-direction
@param ipady the internal padding in y-direction
@return this object for further modification
*/
public GBC setIpad(int ipadx, int ipady)
{
this.ipadx = ipadx;
this.ipady = ipady;
return this;
}
}
| [
"youzhibicheng@163.com"
] | youzhibicheng@163.com |
aa2adc0789f3869ef31b07c09a600ebbbde18382 | 6a89281347e99d3a2ddc157b9bcfed2ca542f2a0 | /src/chapter2/test8/test3/ThreadB.java | be9b9dd28c55f073e48ad665ecfff5a3f5a79510 | [] | no_license | QingboTian/Java-Muliti-thread-Programming-Learning | 4a7ba4a98f090e1cbd5e67d7ba89edcbf3af6952 | e49ab57bd65a76488b45caef82feaf69e593fbb5 | refs/heads/master | 2020-06-01T22:56:38.065691 | 2019-06-23T03:10:34 | 2019-06-23T03:10:34 | 190,958,072 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package chapter2.test8.test3;
public class ThreadB extends Thread{
private MyObject object;
public ThreadB(MyObject object) {
super();
this.object = object;
}
@Override
public void run() {
super.run();
object.objMethod();
}
}
| [
"tqb82965236@163.com"
] | tqb82965236@163.com |
aba75de9f583713953aa4ea8c7c633180803082d | d54cc14cd058d20f27c56107b88d76cc27d4fd29 | /leopard-boot-data-parent/leopard-boot-redis/src/main/java/io/leopard/redis/autoconfigure/RedisAutoConfiguration.java | ab6559f25f4877198c68e5ae24667ff874628591 | [
"Apache-2.0"
] | permissive | ailu5949/leopard-boot | a59cea1a03b1b41712d29cf4091be76dca8316a7 | 33201a2962821475772a53ddce64f7f823f62242 | refs/heads/master | 2020-04-02T09:28:01.286249 | 2018-10-23T08:46:00 | 2018-10-23T08:46:00 | 154,294,038 | 1 | 0 | Apache-2.0 | 2018-10-23T08:46:20 | 2018-10-23T08:46:20 | null | UTF-8 | Java | false | false | 1,187 | java | package io.leopard.redis.autoconfigure;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import io.leopard.redis.Redis;
import io.leopard.redis.RedisImpl;
@Configuration
// @ConfigurationProperties(prefix = "zhaotong.redis")
@ConditionalOnProperty(prefix = "app.redis", name = "host", matchIfMissing = false)
@EnableConfigurationProperties(RedisProperties.class)
public class RedisAutoConfiguration {
// @Bean
// @ConfigurationProperties(prefix = "app.redis")
// public RedisProperties config() {
// DataSourceProperties ddd;
// RedisProperties config = new RedisProperties();
// return config;
// }
@Bean(name = "redis", initMethod = "init", destroyMethod = "destroy")
public Redis redis(RedisProperties redisConfig) {
String server = redisConfig.parseServer();
RedisImpl redis = new RedisImpl();
redis.setServer(server);
if (redisConfig.getMaxActive() != null) {
redis.setMaxActive(redisConfig.getMaxActive());
}
return redis;
}
} | [
"tanhaichao@gmail.com"
] | tanhaichao@gmail.com |
e061347b8f40af21b3e4bf3918393c48590438be | 596fbc6482d14af5e98f8e04fc9db47a24a49916 | /LoginService/src/main/java/com/drumbeat/service/login/drumsdk/kalle/DrumInterceptor.java | d471c1b709b7cd33f3fedb4ef5457864573115a7 | [] | no_license | githubAtom/LoginServiceP | 7879508e733a9bbb36ced9c1a19379c9dea4df3a | ec8c0e0bcddc3cf39a184da256f581483982c08b | refs/heads/master | 2020-12-05T21:07:58.917266 | 2020-01-07T05:14:52 | 2020-01-07T05:14:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,831 | java | package com.drumbeat.service.login.drumsdk.kalle;
import com.blankj.utilcode.util.LogUtils;
import com.yanzhenjie.kalle.Request;
import com.yanzhenjie.kalle.RequestBody;
import com.yanzhenjie.kalle.Response;
import com.yanzhenjie.kalle.StringBody;
import com.yanzhenjie.kalle.UrlBody;
import com.yanzhenjie.kalle.connect.Interceptor;
import com.yanzhenjie.kalle.connect.http.Chain;
import java.io.IOException;
/**
* @author Thomas
* @date 2019/7/26
* @updatelog
*/
public class DrumInterceptor implements Interceptor {
private final String mTag;
private final boolean isEnable;
public DrumInterceptor(String tag, boolean isEnable) {
this.mTag = tag;
this.isEnable = isEnable;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
if (isEnable) {
Response response = chain.proceed(request);
String url = request.url().toString();
StringBuilder log = new StringBuilder();
log.append("请求接口:").append(url);
log.append("\n请求方法:").append(request.method().name());
if (request.method().allowBody()) {
RequestBody body = request.body();
if (body instanceof StringBody || body instanceof UrlBody) {
String params = body.toString();
// log.append("\n请求参数:").append(new String(EncodeUtils.base64Decode(params)));
log.append("\n请求参数:").append(params);
log.append("\n请求内容:").append(body.toString());
}
}
LogUtils.iTag(mTag, log.toString());
return response;
} else {
return chain.proceed(request);
}
}
}
| [
"124937028@qq.com"
] | 124937028@qq.com |
2c0b0c7ca9bea16555dfd164607034d0e3643e69 | 69eeebde7b774a7236e4715207739dcb83300cb4 | /hu.bme.mit.mealymodel.xtext.parent/hu.bme.mit.mealymodel.xtext/src-gen/hu/bme/mit/mealymodel/parser/antlr/internal/InternalMealyDslParser.java | 4411ac38bd1e7abf17f8e23a4531000863202b84 | [] | no_license | aronbsz/automatalearning | c4cefd57d2f692eb9ef738ecb562b3de2087c760 | 9b15ceb492c6ab36fd545b71a3d453e1a907b5b5 | refs/heads/master | 2021-07-24T09:43:49.116170 | 2020-07-16T09:28:39 | 2020-07-16T09:28:39 | 180,773,156 | 0 | 0 | null | 2020-10-13T21:42:05 | 2019-04-11T10:56:21 | Java | UTF-8 | Java | false | false | 43,160 | java | package hu.bme.mit.mealymodel.parser.antlr.internal;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.parser.impl.*;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
import hu.bme.mit.mealymodel.services.MealyDslGrammarAccess;
import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalMealyDslParser extends AbstractInternalAntlrParser {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_STRING", "RULE_ID", "RULE_INT", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'MealyMachine'", "'{'", "'initialState'", "'states'", "','", "'}'", "'inputAlphabet'", "'outputAlphabet'", "'transitions'", "'State'", "'Alphabet'", "'characters'", "'Transition'", "'input'", "'output'", "'sourceState'", "'targetState'"
};
public static final int RULE_STRING=4;
public static final int RULE_SL_COMMENT=8;
public static final int T__19=19;
public static final int T__15=15;
public static final int T__16=16;
public static final int T__17=17;
public static final int T__18=18;
public static final int T__11=11;
public static final int T__12=12;
public static final int T__13=13;
public static final int T__14=14;
public static final int EOF=-1;
public static final int RULE_ID=5;
public static final int RULE_WS=9;
public static final int RULE_ANY_OTHER=10;
public static final int T__26=26;
public static final int T__27=27;
public static final int RULE_INT=6;
public static final int T__22=22;
public static final int RULE_ML_COMMENT=7;
public static final int T__23=23;
public static final int T__24=24;
public static final int T__25=25;
public static final int T__20=20;
public static final int T__21=21;
// delegates
// delegators
public InternalMealyDslParser(TokenStream input) {
this(input, new RecognizerSharedState());
}
public InternalMealyDslParser(TokenStream input, RecognizerSharedState state) {
super(input, state);
}
public String[] getTokenNames() { return InternalMealyDslParser.tokenNames; }
public String getGrammarFileName() { return "InternalMealyDsl.g"; }
private MealyDslGrammarAccess grammarAccess;
public InternalMealyDslParser(TokenStream input, MealyDslGrammarAccess grammarAccess) {
this(input);
this.grammarAccess = grammarAccess;
registerRules(grammarAccess.getGrammar());
}
@Override
protected String getFirstRuleName() {
return "MealyMachine";
}
@Override
protected MealyDslGrammarAccess getGrammarAccess() {
return grammarAccess;
}
// $ANTLR start "entryRuleMealyMachine"
// InternalMealyDsl.g:64:1: entryRuleMealyMachine returns [EObject current=null] : iv_ruleMealyMachine= ruleMealyMachine EOF ;
public final EObject entryRuleMealyMachine() throws RecognitionException {
EObject current = null;
EObject iv_ruleMealyMachine = null;
try {
// InternalMealyDsl.g:64:53: (iv_ruleMealyMachine= ruleMealyMachine EOF )
// InternalMealyDsl.g:65:2: iv_ruleMealyMachine= ruleMealyMachine EOF
{
newCompositeNode(grammarAccess.getMealyMachineRule());
pushFollow(FOLLOW_1);
iv_ruleMealyMachine=ruleMealyMachine();
state._fsp--;
current =iv_ruleMealyMachine;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleMealyMachine"
// $ANTLR start "ruleMealyMachine"
// InternalMealyDsl.g:71:1: ruleMealyMachine returns [EObject current=null] : (otherlv_0= 'MealyMachine' otherlv_1= '{' otherlv_2= 'initialState' ( (lv_initialState_3_0= ruleState ) ) otherlv_4= 'states' otherlv_5= '{' ( (lv_states_6_0= ruleState ) ) (otherlv_7= ',' ( (lv_states_8_0= ruleState ) ) )* otherlv_9= '}' otherlv_10= 'inputAlphabet' ( (lv_inputAlphabet_11_0= ruleAlphabet ) ) otherlv_12= 'outputAlphabet' ( (lv_outputAlphabet_13_0= ruleAlphabet ) ) otherlv_14= 'transitions' otherlv_15= '{' ( (lv_transitions_16_0= ruleTransition ) ) (otherlv_17= ',' ( (lv_transitions_18_0= ruleTransition ) ) )* otherlv_19= '}' otherlv_20= '}' ) ;
public final EObject ruleMealyMachine() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_5=null;
Token otherlv_7=null;
Token otherlv_9=null;
Token otherlv_10=null;
Token otherlv_12=null;
Token otherlv_14=null;
Token otherlv_15=null;
Token otherlv_17=null;
Token otherlv_19=null;
Token otherlv_20=null;
EObject lv_initialState_3_0 = null;
EObject lv_states_6_0 = null;
EObject lv_states_8_0 = null;
EObject lv_inputAlphabet_11_0 = null;
EObject lv_outputAlphabet_13_0 = null;
EObject lv_transitions_16_0 = null;
EObject lv_transitions_18_0 = null;
enterRule();
try {
// InternalMealyDsl.g:77:2: ( (otherlv_0= 'MealyMachine' otherlv_1= '{' otherlv_2= 'initialState' ( (lv_initialState_3_0= ruleState ) ) otherlv_4= 'states' otherlv_5= '{' ( (lv_states_6_0= ruleState ) ) (otherlv_7= ',' ( (lv_states_8_0= ruleState ) ) )* otherlv_9= '}' otherlv_10= 'inputAlphabet' ( (lv_inputAlphabet_11_0= ruleAlphabet ) ) otherlv_12= 'outputAlphabet' ( (lv_outputAlphabet_13_0= ruleAlphabet ) ) otherlv_14= 'transitions' otherlv_15= '{' ( (lv_transitions_16_0= ruleTransition ) ) (otherlv_17= ',' ( (lv_transitions_18_0= ruleTransition ) ) )* otherlv_19= '}' otherlv_20= '}' ) )
// InternalMealyDsl.g:78:2: (otherlv_0= 'MealyMachine' otherlv_1= '{' otherlv_2= 'initialState' ( (lv_initialState_3_0= ruleState ) ) otherlv_4= 'states' otherlv_5= '{' ( (lv_states_6_0= ruleState ) ) (otherlv_7= ',' ( (lv_states_8_0= ruleState ) ) )* otherlv_9= '}' otherlv_10= 'inputAlphabet' ( (lv_inputAlphabet_11_0= ruleAlphabet ) ) otherlv_12= 'outputAlphabet' ( (lv_outputAlphabet_13_0= ruleAlphabet ) ) otherlv_14= 'transitions' otherlv_15= '{' ( (lv_transitions_16_0= ruleTransition ) ) (otherlv_17= ',' ( (lv_transitions_18_0= ruleTransition ) ) )* otherlv_19= '}' otherlv_20= '}' )
{
// InternalMealyDsl.g:78:2: (otherlv_0= 'MealyMachine' otherlv_1= '{' otherlv_2= 'initialState' ( (lv_initialState_3_0= ruleState ) ) otherlv_4= 'states' otherlv_5= '{' ( (lv_states_6_0= ruleState ) ) (otherlv_7= ',' ( (lv_states_8_0= ruleState ) ) )* otherlv_9= '}' otherlv_10= 'inputAlphabet' ( (lv_inputAlphabet_11_0= ruleAlphabet ) ) otherlv_12= 'outputAlphabet' ( (lv_outputAlphabet_13_0= ruleAlphabet ) ) otherlv_14= 'transitions' otherlv_15= '{' ( (lv_transitions_16_0= ruleTransition ) ) (otherlv_17= ',' ( (lv_transitions_18_0= ruleTransition ) ) )* otherlv_19= '}' otherlv_20= '}' )
// InternalMealyDsl.g:79:3: otherlv_0= 'MealyMachine' otherlv_1= '{' otherlv_2= 'initialState' ( (lv_initialState_3_0= ruleState ) ) otherlv_4= 'states' otherlv_5= '{' ( (lv_states_6_0= ruleState ) ) (otherlv_7= ',' ( (lv_states_8_0= ruleState ) ) )* otherlv_9= '}' otherlv_10= 'inputAlphabet' ( (lv_inputAlphabet_11_0= ruleAlphabet ) ) otherlv_12= 'outputAlphabet' ( (lv_outputAlphabet_13_0= ruleAlphabet ) ) otherlv_14= 'transitions' otherlv_15= '{' ( (lv_transitions_16_0= ruleTransition ) ) (otherlv_17= ',' ( (lv_transitions_18_0= ruleTransition ) ) )* otherlv_19= '}' otherlv_20= '}'
{
otherlv_0=(Token)match(input,11,FOLLOW_3);
newLeafNode(otherlv_0, grammarAccess.getMealyMachineAccess().getMealyMachineKeyword_0());
otherlv_1=(Token)match(input,12,FOLLOW_4);
newLeafNode(otherlv_1, grammarAccess.getMealyMachineAccess().getLeftCurlyBracketKeyword_1());
otherlv_2=(Token)match(input,13,FOLLOW_5);
newLeafNode(otherlv_2, grammarAccess.getMealyMachineAccess().getInitialStateKeyword_2());
// InternalMealyDsl.g:91:3: ( (lv_initialState_3_0= ruleState ) )
// InternalMealyDsl.g:92:4: (lv_initialState_3_0= ruleState )
{
// InternalMealyDsl.g:92:4: (lv_initialState_3_0= ruleState )
// InternalMealyDsl.g:93:5: lv_initialState_3_0= ruleState
{
newCompositeNode(grammarAccess.getMealyMachineAccess().getInitialStateStateParserRuleCall_3_0());
pushFollow(FOLLOW_6);
lv_initialState_3_0=ruleState();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getMealyMachineRule());
}
set(
current,
"initialState",
lv_initialState_3_0,
"hu.bme.mit.mealymodel.MealyDsl.State");
afterParserOrEnumRuleCall();
}
}
otherlv_4=(Token)match(input,14,FOLLOW_3);
newLeafNode(otherlv_4, grammarAccess.getMealyMachineAccess().getStatesKeyword_4());
otherlv_5=(Token)match(input,12,FOLLOW_5);
newLeafNode(otherlv_5, grammarAccess.getMealyMachineAccess().getLeftCurlyBracketKeyword_5());
// InternalMealyDsl.g:118:3: ( (lv_states_6_0= ruleState ) )
// InternalMealyDsl.g:119:4: (lv_states_6_0= ruleState )
{
// InternalMealyDsl.g:119:4: (lv_states_6_0= ruleState )
// InternalMealyDsl.g:120:5: lv_states_6_0= ruleState
{
newCompositeNode(grammarAccess.getMealyMachineAccess().getStatesStateParserRuleCall_6_0());
pushFollow(FOLLOW_7);
lv_states_6_0=ruleState();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getMealyMachineRule());
}
add(
current,
"states",
lv_states_6_0,
"hu.bme.mit.mealymodel.MealyDsl.State");
afterParserOrEnumRuleCall();
}
}
// InternalMealyDsl.g:137:3: (otherlv_7= ',' ( (lv_states_8_0= ruleState ) ) )*
loop1:
do {
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==15) ) {
alt1=1;
}
switch (alt1) {
case 1 :
// InternalMealyDsl.g:138:4: otherlv_7= ',' ( (lv_states_8_0= ruleState ) )
{
otherlv_7=(Token)match(input,15,FOLLOW_5);
newLeafNode(otherlv_7, grammarAccess.getMealyMachineAccess().getCommaKeyword_7_0());
// InternalMealyDsl.g:142:4: ( (lv_states_8_0= ruleState ) )
// InternalMealyDsl.g:143:5: (lv_states_8_0= ruleState )
{
// InternalMealyDsl.g:143:5: (lv_states_8_0= ruleState )
// InternalMealyDsl.g:144:6: lv_states_8_0= ruleState
{
newCompositeNode(grammarAccess.getMealyMachineAccess().getStatesStateParserRuleCall_7_1_0());
pushFollow(FOLLOW_7);
lv_states_8_0=ruleState();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getMealyMachineRule());
}
add(
current,
"states",
lv_states_8_0,
"hu.bme.mit.mealymodel.MealyDsl.State");
afterParserOrEnumRuleCall();
}
}
}
break;
default :
break loop1;
}
} while (true);
otherlv_9=(Token)match(input,16,FOLLOW_8);
newLeafNode(otherlv_9, grammarAccess.getMealyMachineAccess().getRightCurlyBracketKeyword_8());
otherlv_10=(Token)match(input,17,FOLLOW_9);
newLeafNode(otherlv_10, grammarAccess.getMealyMachineAccess().getInputAlphabetKeyword_9());
// InternalMealyDsl.g:170:3: ( (lv_inputAlphabet_11_0= ruleAlphabet ) )
// InternalMealyDsl.g:171:4: (lv_inputAlphabet_11_0= ruleAlphabet )
{
// InternalMealyDsl.g:171:4: (lv_inputAlphabet_11_0= ruleAlphabet )
// InternalMealyDsl.g:172:5: lv_inputAlphabet_11_0= ruleAlphabet
{
newCompositeNode(grammarAccess.getMealyMachineAccess().getInputAlphabetAlphabetParserRuleCall_10_0());
pushFollow(FOLLOW_10);
lv_inputAlphabet_11_0=ruleAlphabet();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getMealyMachineRule());
}
set(
current,
"inputAlphabet",
lv_inputAlphabet_11_0,
"hu.bme.mit.mealymodel.MealyDsl.Alphabet");
afterParserOrEnumRuleCall();
}
}
otherlv_12=(Token)match(input,18,FOLLOW_9);
newLeafNode(otherlv_12, grammarAccess.getMealyMachineAccess().getOutputAlphabetKeyword_11());
// InternalMealyDsl.g:193:3: ( (lv_outputAlphabet_13_0= ruleAlphabet ) )
// InternalMealyDsl.g:194:4: (lv_outputAlphabet_13_0= ruleAlphabet )
{
// InternalMealyDsl.g:194:4: (lv_outputAlphabet_13_0= ruleAlphabet )
// InternalMealyDsl.g:195:5: lv_outputAlphabet_13_0= ruleAlphabet
{
newCompositeNode(grammarAccess.getMealyMachineAccess().getOutputAlphabetAlphabetParserRuleCall_12_0());
pushFollow(FOLLOW_11);
lv_outputAlphabet_13_0=ruleAlphabet();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getMealyMachineRule());
}
set(
current,
"outputAlphabet",
lv_outputAlphabet_13_0,
"hu.bme.mit.mealymodel.MealyDsl.Alphabet");
afterParserOrEnumRuleCall();
}
}
otherlv_14=(Token)match(input,19,FOLLOW_3);
newLeafNode(otherlv_14, grammarAccess.getMealyMachineAccess().getTransitionsKeyword_13());
otherlv_15=(Token)match(input,12,FOLLOW_12);
newLeafNode(otherlv_15, grammarAccess.getMealyMachineAccess().getLeftCurlyBracketKeyword_14());
// InternalMealyDsl.g:220:3: ( (lv_transitions_16_0= ruleTransition ) )
// InternalMealyDsl.g:221:4: (lv_transitions_16_0= ruleTransition )
{
// InternalMealyDsl.g:221:4: (lv_transitions_16_0= ruleTransition )
// InternalMealyDsl.g:222:5: lv_transitions_16_0= ruleTransition
{
newCompositeNode(grammarAccess.getMealyMachineAccess().getTransitionsTransitionParserRuleCall_15_0());
pushFollow(FOLLOW_7);
lv_transitions_16_0=ruleTransition();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getMealyMachineRule());
}
add(
current,
"transitions",
lv_transitions_16_0,
"hu.bme.mit.mealymodel.MealyDsl.Transition");
afterParserOrEnumRuleCall();
}
}
// InternalMealyDsl.g:239:3: (otherlv_17= ',' ( (lv_transitions_18_0= ruleTransition ) ) )*
loop2:
do {
int alt2=2;
int LA2_0 = input.LA(1);
if ( (LA2_0==15) ) {
alt2=1;
}
switch (alt2) {
case 1 :
// InternalMealyDsl.g:240:4: otherlv_17= ',' ( (lv_transitions_18_0= ruleTransition ) )
{
otherlv_17=(Token)match(input,15,FOLLOW_12);
newLeafNode(otherlv_17, grammarAccess.getMealyMachineAccess().getCommaKeyword_16_0());
// InternalMealyDsl.g:244:4: ( (lv_transitions_18_0= ruleTransition ) )
// InternalMealyDsl.g:245:5: (lv_transitions_18_0= ruleTransition )
{
// InternalMealyDsl.g:245:5: (lv_transitions_18_0= ruleTransition )
// InternalMealyDsl.g:246:6: lv_transitions_18_0= ruleTransition
{
newCompositeNode(grammarAccess.getMealyMachineAccess().getTransitionsTransitionParserRuleCall_16_1_0());
pushFollow(FOLLOW_7);
lv_transitions_18_0=ruleTransition();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getMealyMachineRule());
}
add(
current,
"transitions",
lv_transitions_18_0,
"hu.bme.mit.mealymodel.MealyDsl.Transition");
afterParserOrEnumRuleCall();
}
}
}
break;
default :
break loop2;
}
} while (true);
otherlv_19=(Token)match(input,16,FOLLOW_13);
newLeafNode(otherlv_19, grammarAccess.getMealyMachineAccess().getRightCurlyBracketKeyword_17());
otherlv_20=(Token)match(input,16,FOLLOW_2);
newLeafNode(otherlv_20, grammarAccess.getMealyMachineAccess().getRightCurlyBracketKeyword_18());
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleMealyMachine"
// $ANTLR start "entryRuleState"
// InternalMealyDsl.g:276:1: entryRuleState returns [EObject current=null] : iv_ruleState= ruleState EOF ;
public final EObject entryRuleState() throws RecognitionException {
EObject current = null;
EObject iv_ruleState = null;
try {
// InternalMealyDsl.g:276:46: (iv_ruleState= ruleState EOF )
// InternalMealyDsl.g:277:2: iv_ruleState= ruleState EOF
{
newCompositeNode(grammarAccess.getStateRule());
pushFollow(FOLLOW_1);
iv_ruleState=ruleState();
state._fsp--;
current =iv_ruleState;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleState"
// $ANTLR start "ruleState"
// InternalMealyDsl.g:283:1: ruleState returns [EObject current=null] : ( () otherlv_1= 'State' ( (lv_name_2_0= ruleEString ) ) ) ;
public final EObject ruleState() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
AntlrDatatypeRuleToken lv_name_2_0 = null;
enterRule();
try {
// InternalMealyDsl.g:289:2: ( ( () otherlv_1= 'State' ( (lv_name_2_0= ruleEString ) ) ) )
// InternalMealyDsl.g:290:2: ( () otherlv_1= 'State' ( (lv_name_2_0= ruleEString ) ) )
{
// InternalMealyDsl.g:290:2: ( () otherlv_1= 'State' ( (lv_name_2_0= ruleEString ) ) )
// InternalMealyDsl.g:291:3: () otherlv_1= 'State' ( (lv_name_2_0= ruleEString ) )
{
// InternalMealyDsl.g:291:3: ()
// InternalMealyDsl.g:292:4:
{
current = forceCreateModelElement(
grammarAccess.getStateAccess().getStateAction_0(),
current);
}
otherlv_1=(Token)match(input,20,FOLLOW_14);
newLeafNode(otherlv_1, grammarAccess.getStateAccess().getStateKeyword_1());
// InternalMealyDsl.g:302:3: ( (lv_name_2_0= ruleEString ) )
// InternalMealyDsl.g:303:4: (lv_name_2_0= ruleEString )
{
// InternalMealyDsl.g:303:4: (lv_name_2_0= ruleEString )
// InternalMealyDsl.g:304:5: lv_name_2_0= ruleEString
{
newCompositeNode(grammarAccess.getStateAccess().getNameEStringParserRuleCall_2_0());
pushFollow(FOLLOW_2);
lv_name_2_0=ruleEString();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getStateRule());
}
set(
current,
"name",
lv_name_2_0,
"hu.bme.mit.mealymodel.MealyDsl.EString");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleState"
// $ANTLR start "entryRuleAlphabet"
// InternalMealyDsl.g:325:1: entryRuleAlphabet returns [EObject current=null] : iv_ruleAlphabet= ruleAlphabet EOF ;
public final EObject entryRuleAlphabet() throws RecognitionException {
EObject current = null;
EObject iv_ruleAlphabet = null;
try {
// InternalMealyDsl.g:325:49: (iv_ruleAlphabet= ruleAlphabet EOF )
// InternalMealyDsl.g:326:2: iv_ruleAlphabet= ruleAlphabet EOF
{
newCompositeNode(grammarAccess.getAlphabetRule());
pushFollow(FOLLOW_1);
iv_ruleAlphabet=ruleAlphabet();
state._fsp--;
current =iv_ruleAlphabet;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleAlphabet"
// $ANTLR start "ruleAlphabet"
// InternalMealyDsl.g:332:1: ruleAlphabet returns [EObject current=null] : (otherlv_0= 'Alphabet' otherlv_1= '{' otherlv_2= 'characters' otherlv_3= '{' ( (lv_characters_4_0= ruleEString ) ) (otherlv_5= ',' ( (lv_characters_6_0= ruleEString ) ) )* otherlv_7= '}' otherlv_8= '}' ) ;
public final EObject ruleAlphabet() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_3=null;
Token otherlv_5=null;
Token otherlv_7=null;
Token otherlv_8=null;
AntlrDatatypeRuleToken lv_characters_4_0 = null;
AntlrDatatypeRuleToken lv_characters_6_0 = null;
enterRule();
try {
// InternalMealyDsl.g:338:2: ( (otherlv_0= 'Alphabet' otherlv_1= '{' otherlv_2= 'characters' otherlv_3= '{' ( (lv_characters_4_0= ruleEString ) ) (otherlv_5= ',' ( (lv_characters_6_0= ruleEString ) ) )* otherlv_7= '}' otherlv_8= '}' ) )
// InternalMealyDsl.g:339:2: (otherlv_0= 'Alphabet' otherlv_1= '{' otherlv_2= 'characters' otherlv_3= '{' ( (lv_characters_4_0= ruleEString ) ) (otherlv_5= ',' ( (lv_characters_6_0= ruleEString ) ) )* otherlv_7= '}' otherlv_8= '}' )
{
// InternalMealyDsl.g:339:2: (otherlv_0= 'Alphabet' otherlv_1= '{' otherlv_2= 'characters' otherlv_3= '{' ( (lv_characters_4_0= ruleEString ) ) (otherlv_5= ',' ( (lv_characters_6_0= ruleEString ) ) )* otherlv_7= '}' otherlv_8= '}' )
// InternalMealyDsl.g:340:3: otherlv_0= 'Alphabet' otherlv_1= '{' otherlv_2= 'characters' otherlv_3= '{' ( (lv_characters_4_0= ruleEString ) ) (otherlv_5= ',' ( (lv_characters_6_0= ruleEString ) ) )* otherlv_7= '}' otherlv_8= '}'
{
otherlv_0=(Token)match(input,21,FOLLOW_3);
newLeafNode(otherlv_0, grammarAccess.getAlphabetAccess().getAlphabetKeyword_0());
otherlv_1=(Token)match(input,12,FOLLOW_15);
newLeafNode(otherlv_1, grammarAccess.getAlphabetAccess().getLeftCurlyBracketKeyword_1());
otherlv_2=(Token)match(input,22,FOLLOW_3);
newLeafNode(otherlv_2, grammarAccess.getAlphabetAccess().getCharactersKeyword_2());
otherlv_3=(Token)match(input,12,FOLLOW_14);
newLeafNode(otherlv_3, grammarAccess.getAlphabetAccess().getLeftCurlyBracketKeyword_3());
// InternalMealyDsl.g:356:3: ( (lv_characters_4_0= ruleEString ) )
// InternalMealyDsl.g:357:4: (lv_characters_4_0= ruleEString )
{
// InternalMealyDsl.g:357:4: (lv_characters_4_0= ruleEString )
// InternalMealyDsl.g:358:5: lv_characters_4_0= ruleEString
{
newCompositeNode(grammarAccess.getAlphabetAccess().getCharactersEStringParserRuleCall_4_0());
pushFollow(FOLLOW_7);
lv_characters_4_0=ruleEString();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getAlphabetRule());
}
add(
current,
"characters",
lv_characters_4_0,
"hu.bme.mit.mealymodel.MealyDsl.EString");
afterParserOrEnumRuleCall();
}
}
// InternalMealyDsl.g:375:3: (otherlv_5= ',' ( (lv_characters_6_0= ruleEString ) ) )*
loop3:
do {
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0==15) ) {
alt3=1;
}
switch (alt3) {
case 1 :
// InternalMealyDsl.g:376:4: otherlv_5= ',' ( (lv_characters_6_0= ruleEString ) )
{
otherlv_5=(Token)match(input,15,FOLLOW_14);
newLeafNode(otherlv_5, grammarAccess.getAlphabetAccess().getCommaKeyword_5_0());
// InternalMealyDsl.g:380:4: ( (lv_characters_6_0= ruleEString ) )
// InternalMealyDsl.g:381:5: (lv_characters_6_0= ruleEString )
{
// InternalMealyDsl.g:381:5: (lv_characters_6_0= ruleEString )
// InternalMealyDsl.g:382:6: lv_characters_6_0= ruleEString
{
newCompositeNode(grammarAccess.getAlphabetAccess().getCharactersEStringParserRuleCall_5_1_0());
pushFollow(FOLLOW_7);
lv_characters_6_0=ruleEString();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getAlphabetRule());
}
add(
current,
"characters",
lv_characters_6_0,
"hu.bme.mit.mealymodel.MealyDsl.EString");
afterParserOrEnumRuleCall();
}
}
}
break;
default :
break loop3;
}
} while (true);
otherlv_7=(Token)match(input,16,FOLLOW_13);
newLeafNode(otherlv_7, grammarAccess.getAlphabetAccess().getRightCurlyBracketKeyword_6());
otherlv_8=(Token)match(input,16,FOLLOW_2);
newLeafNode(otherlv_8, grammarAccess.getAlphabetAccess().getRightCurlyBracketKeyword_7());
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleAlphabet"
// $ANTLR start "entryRuleTransition"
// InternalMealyDsl.g:412:1: entryRuleTransition returns [EObject current=null] : iv_ruleTransition= ruleTransition EOF ;
public final EObject entryRuleTransition() throws RecognitionException {
EObject current = null;
EObject iv_ruleTransition = null;
try {
// InternalMealyDsl.g:412:51: (iv_ruleTransition= ruleTransition EOF )
// InternalMealyDsl.g:413:2: iv_ruleTransition= ruleTransition EOF
{
newCompositeNode(grammarAccess.getTransitionRule());
pushFollow(FOLLOW_1);
iv_ruleTransition=ruleTransition();
state._fsp--;
current =iv_ruleTransition;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleTransition"
// $ANTLR start "ruleTransition"
// InternalMealyDsl.g:419:1: ruleTransition returns [EObject current=null] : (otherlv_0= 'Transition' otherlv_1= '{' otherlv_2= 'input' ( (lv_input_3_0= ruleEString ) ) otherlv_4= 'output' ( (lv_output_5_0= ruleEString ) ) otherlv_6= 'sourceState' ( ( ruleEString ) ) otherlv_8= 'targetState' ( ( ruleEString ) ) otherlv_10= '}' ) ;
public final EObject ruleTransition() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_6=null;
Token otherlv_8=null;
Token otherlv_10=null;
AntlrDatatypeRuleToken lv_input_3_0 = null;
AntlrDatatypeRuleToken lv_output_5_0 = null;
enterRule();
try {
// InternalMealyDsl.g:425:2: ( (otherlv_0= 'Transition' otherlv_1= '{' otherlv_2= 'input' ( (lv_input_3_0= ruleEString ) ) otherlv_4= 'output' ( (lv_output_5_0= ruleEString ) ) otherlv_6= 'sourceState' ( ( ruleEString ) ) otherlv_8= 'targetState' ( ( ruleEString ) ) otherlv_10= '}' ) )
// InternalMealyDsl.g:426:2: (otherlv_0= 'Transition' otherlv_1= '{' otherlv_2= 'input' ( (lv_input_3_0= ruleEString ) ) otherlv_4= 'output' ( (lv_output_5_0= ruleEString ) ) otherlv_6= 'sourceState' ( ( ruleEString ) ) otherlv_8= 'targetState' ( ( ruleEString ) ) otherlv_10= '}' )
{
// InternalMealyDsl.g:426:2: (otherlv_0= 'Transition' otherlv_1= '{' otherlv_2= 'input' ( (lv_input_3_0= ruleEString ) ) otherlv_4= 'output' ( (lv_output_5_0= ruleEString ) ) otherlv_6= 'sourceState' ( ( ruleEString ) ) otherlv_8= 'targetState' ( ( ruleEString ) ) otherlv_10= '}' )
// InternalMealyDsl.g:427:3: otherlv_0= 'Transition' otherlv_1= '{' otherlv_2= 'input' ( (lv_input_3_0= ruleEString ) ) otherlv_4= 'output' ( (lv_output_5_0= ruleEString ) ) otherlv_6= 'sourceState' ( ( ruleEString ) ) otherlv_8= 'targetState' ( ( ruleEString ) ) otherlv_10= '}'
{
otherlv_0=(Token)match(input,23,FOLLOW_3);
newLeafNode(otherlv_0, grammarAccess.getTransitionAccess().getTransitionKeyword_0());
otherlv_1=(Token)match(input,12,FOLLOW_16);
newLeafNode(otherlv_1, grammarAccess.getTransitionAccess().getLeftCurlyBracketKeyword_1());
otherlv_2=(Token)match(input,24,FOLLOW_14);
newLeafNode(otherlv_2, grammarAccess.getTransitionAccess().getInputKeyword_2());
// InternalMealyDsl.g:439:3: ( (lv_input_3_0= ruleEString ) )
// InternalMealyDsl.g:440:4: (lv_input_3_0= ruleEString )
{
// InternalMealyDsl.g:440:4: (lv_input_3_0= ruleEString )
// InternalMealyDsl.g:441:5: lv_input_3_0= ruleEString
{
newCompositeNode(grammarAccess.getTransitionAccess().getInputEStringParserRuleCall_3_0());
pushFollow(FOLLOW_17);
lv_input_3_0=ruleEString();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getTransitionRule());
}
set(
current,
"input",
lv_input_3_0,
"hu.bme.mit.mealymodel.MealyDsl.EString");
afterParserOrEnumRuleCall();
}
}
otherlv_4=(Token)match(input,25,FOLLOW_14);
newLeafNode(otherlv_4, grammarAccess.getTransitionAccess().getOutputKeyword_4());
// InternalMealyDsl.g:462:3: ( (lv_output_5_0= ruleEString ) )
// InternalMealyDsl.g:463:4: (lv_output_5_0= ruleEString )
{
// InternalMealyDsl.g:463:4: (lv_output_5_0= ruleEString )
// InternalMealyDsl.g:464:5: lv_output_5_0= ruleEString
{
newCompositeNode(grammarAccess.getTransitionAccess().getOutputEStringParserRuleCall_5_0());
pushFollow(FOLLOW_18);
lv_output_5_0=ruleEString();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getTransitionRule());
}
set(
current,
"output",
lv_output_5_0,
"hu.bme.mit.mealymodel.MealyDsl.EString");
afterParserOrEnumRuleCall();
}
}
otherlv_6=(Token)match(input,26,FOLLOW_14);
newLeafNode(otherlv_6, grammarAccess.getTransitionAccess().getSourceStateKeyword_6());
// InternalMealyDsl.g:485:3: ( ( ruleEString ) )
// InternalMealyDsl.g:486:4: ( ruleEString )
{
// InternalMealyDsl.g:486:4: ( ruleEString )
// InternalMealyDsl.g:487:5: ruleEString
{
if (current==null) {
current = createModelElement(grammarAccess.getTransitionRule());
}
newCompositeNode(grammarAccess.getTransitionAccess().getSourceStateStateCrossReference_7_0());
pushFollow(FOLLOW_19);
ruleEString();
state._fsp--;
afterParserOrEnumRuleCall();
}
}
otherlv_8=(Token)match(input,27,FOLLOW_14);
newLeafNode(otherlv_8, grammarAccess.getTransitionAccess().getTargetStateKeyword_8());
// InternalMealyDsl.g:505:3: ( ( ruleEString ) )
// InternalMealyDsl.g:506:4: ( ruleEString )
{
// InternalMealyDsl.g:506:4: ( ruleEString )
// InternalMealyDsl.g:507:5: ruleEString
{
if (current==null) {
current = createModelElement(grammarAccess.getTransitionRule());
}
newCompositeNode(grammarAccess.getTransitionAccess().getTargetStateStateCrossReference_9_0());
pushFollow(FOLLOW_13);
ruleEString();
state._fsp--;
afterParserOrEnumRuleCall();
}
}
otherlv_10=(Token)match(input,16,FOLLOW_2);
newLeafNode(otherlv_10, grammarAccess.getTransitionAccess().getRightCurlyBracketKeyword_10());
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleTransition"
// $ANTLR start "entryRuleEString"
// InternalMealyDsl.g:529:1: entryRuleEString returns [String current=null] : iv_ruleEString= ruleEString EOF ;
public final String entryRuleEString() throws RecognitionException {
String current = null;
AntlrDatatypeRuleToken iv_ruleEString = null;
try {
// InternalMealyDsl.g:529:47: (iv_ruleEString= ruleEString EOF )
// InternalMealyDsl.g:530:2: iv_ruleEString= ruleEString EOF
{
newCompositeNode(grammarAccess.getEStringRule());
pushFollow(FOLLOW_1);
iv_ruleEString=ruleEString();
state._fsp--;
current =iv_ruleEString.getText();
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleEString"
// $ANTLR start "ruleEString"
// InternalMealyDsl.g:536:1: ruleEString returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (this_STRING_0= RULE_STRING | this_ID_1= RULE_ID ) ;
public final AntlrDatatypeRuleToken ruleEString() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token this_STRING_0=null;
Token this_ID_1=null;
enterRule();
try {
// InternalMealyDsl.g:542:2: ( (this_STRING_0= RULE_STRING | this_ID_1= RULE_ID ) )
// InternalMealyDsl.g:543:2: (this_STRING_0= RULE_STRING | this_ID_1= RULE_ID )
{
// InternalMealyDsl.g:543:2: (this_STRING_0= RULE_STRING | this_ID_1= RULE_ID )
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0==RULE_STRING) ) {
alt4=1;
}
else if ( (LA4_0==RULE_ID) ) {
alt4=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt4) {
case 1 :
// InternalMealyDsl.g:544:3: this_STRING_0= RULE_STRING
{
this_STRING_0=(Token)match(input,RULE_STRING,FOLLOW_2);
current.merge(this_STRING_0);
newLeafNode(this_STRING_0, grammarAccess.getEStringAccess().getSTRINGTerminalRuleCall_0());
}
break;
case 2 :
// InternalMealyDsl.g:552:3: this_ID_1= RULE_ID
{
this_ID_1=(Token)match(input,RULE_ID,FOLLOW_2);
current.merge(this_ID_1);
newLeafNode(this_ID_1, grammarAccess.getEStringAccess().getIDTerminalRuleCall_1());
}
break;
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleEString"
// Delegated rules
public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000001000L});
public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000002000L});
public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000100000L});
public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000004000L});
public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x0000000000018000L});
public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000020000L});
public static final BitSet FOLLOW_9 = new BitSet(new long[]{0x0000000000200000L});
public static final BitSet FOLLOW_10 = new BitSet(new long[]{0x0000000000040000L});
public static final BitSet FOLLOW_11 = new BitSet(new long[]{0x0000000000080000L});
public static final BitSet FOLLOW_12 = new BitSet(new long[]{0x0000000000800000L});
public static final BitSet FOLLOW_13 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_14 = new BitSet(new long[]{0x0000000000000030L});
public static final BitSet FOLLOW_15 = new BitSet(new long[]{0x0000000000400000L});
public static final BitSet FOLLOW_16 = new BitSet(new long[]{0x0000000001000000L});
public static final BitSet FOLLOW_17 = new BitSet(new long[]{0x0000000002000000L});
public static final BitSet FOLLOW_18 = new BitSet(new long[]{0x0000000004000000L});
public static final BitSet FOLLOW_19 = new BitSet(new long[]{0x0000000008000000L});
} | [
"abarcsa@gmail.com"
] | abarcsa@gmail.com |
faab375f9d78529417f0d6a34603e875905df471 | 0e16abe4ce7331fdfc927c9713bdd58d9b9d8025 | /company/src/main/java/com/codejoys/company/entity/Titles.java | cad5fa17c7438731356542c81628d3b08faed19b | [] | no_license | RchengANDLengwen/SsmFrame | 9e431de25afa90559fbd42d23b34b49dbb1d587d | 95f49a7c2b6e07c4e1880e2a4158974a2f861ec9 | refs/heads/master | 2022-06-22T06:14:41.241489 | 2019-08-24T12:27:15 | 2019-08-24T12:27:15 | 204,153,778 | 0 | 0 | null | 2022-06-21T01:44:19 | 2019-08-24T12:23:27 | Java | UTF-8 | Java | false | false | 4,333 | java | package com.codejoys.company.entity;
import java.io.Serializable;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table titles
*/
public class Titles implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column titles.emp_no
*
* @mbg.generated
*/
private Integer empNo;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column titles.title
*
* @mbg.generated
*/
private String title;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column titles.from_date
*
* @mbg.generated
*/
private Date fromDate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column titles.to_date
*
* @mbg.generated
*/
private Date toDate;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table titles
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column titles.emp_no
*
* @return the value of titles.emp_no
*
* @mbg.generated
*/
public Integer getEmpNo() {
return empNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column titles.emp_no
*
* @param empNo the value for titles.emp_no
*
* @mbg.generated
*/
public void setEmpNo(Integer empNo) {
this.empNo = empNo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column titles.title
*
* @return the value of titles.title
*
* @mbg.generated
*/
public String getTitle() {
return title;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column titles.title
*
* @param title the value for titles.title
*
* @mbg.generated
*/
public void setTitle(String title) {
this.title = title;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column titles.from_date
*
* @return the value of titles.from_date
*
* @mbg.generated
*/
public Date getFromDate() {
return fromDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column titles.from_date
*
* @param fromDate the value for titles.from_date
*
* @mbg.generated
*/
public void setFromDate(Date fromDate) {
this.fromDate = fromDate;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column titles.to_date
*
* @return the value of titles.to_date
*
* @mbg.generated
*/
public Date getToDate() {
return toDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column titles.to_date
*
* @param toDate the value for titles.to_date
*
* @mbg.generated
*/
public void setToDate(Date toDate) {
this.toDate = toDate;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table titles
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", empNo=").append(empNo);
sb.append(", title=").append(title);
sb.append(", fromDate=").append(fromDate);
sb.append(", toDate=").append(toDate);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | [
"1023172029@qq.com"
] | 1023172029@qq.com |
633ffe91fc929e20280bfc031005cc1040168493 | 03f1e8e3fcc7737d16a8b5925b141e4b4e432cfb | /BankAppSpringMVC_51830046/src/com/bankapp/web/forms/TransferBean.java | 1e9df4e999174006ee839f9aed282787848938a9 | [] | no_license | AlnaJoshi/Projects_Mode1and2_51830046 | eb1fa1adce62cba3d23b4b5eaf6f6e5732af38ab | e84cd757a4734b6f0c05327e5c8e194ed4f29ddf | refs/heads/master | 2020-09-21T11:20:57.005508 | 2019-11-29T05:16:57 | 2019-11-29T05:16:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package com.bankapp.web.forms;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
public class TransferBean {
@NotNull(message="from account can not be lelf blank")
private Integer fromAccount;
@NotNull(message="to account not be lelf blank")
private Integer toAccount;
@NotNull(message="amount can not be lelf blank")
@Max(message="value should be less then 200000", value=200000)
@Min(message="value should be more then 500", value=500)
private Double amount;
public Integer getFromAccount() {
return fromAccount;
}
public void setFromAccount(Integer fromAccount) {
this.fromAccount = fromAccount;
}
public Integer getToAccount() {
return toAccount;
}
public void setToAccount(Integer toAccount) {
this.toAccount = toAccount;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
}
| [
"alnajoshy5@gmail.com"
] | alnajoshy5@gmail.com |
8fa318b04fb48bb001a4bc7a9e53ad4c34013632 | 90d483216b2988b365c7d1af226e1ce36d3fbfef | /app/src/main/java/com/sdiablofix/dt/sdiablofix/fragment/BatchSaleIn.java | 65300739866811b7d84fb253db82127f9116b9a5 | [] | no_license | LonelyPriest/SDiabloFix | 73a3b772f196ba539f4940c4fdf3c6679974bdb8 | 202b01fa8b1323d62cbba4c1c8f77fa641ca3fb6 | refs/heads/master | 2021-11-26T00:21:36.057201 | 2021-11-16T04:49:35 | 2021-11-16T04:49:35 | 105,298,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | java | package com.sdiablofix.dt.sdiablofix.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.sdiablofix.dt.sdiablofix.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link BatchSaleIn#newInstance} factory method to
* create an instance of this fragment.
*/
public class BatchSaleIn extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public BatchSaleIn() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment BatchSaleIn.
*/
// TODO: Rename and change types and number of parameters
public static BatchSaleIn newInstance(String param1, String param2) {
BatchSaleIn fragment = new BatchSaleIn();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_batch_sale_in, container, false);
}
}
| [
"buxianhui@buxianhuideiMac.local"
] | buxianhui@buxianhuideiMac.local |
45f405af6130fb2744be54967c02f511b5ecbb9c | 6c324818f5bdd47465f7531c30af698f3e6e87f0 | /src/main/java/com/sample/soap/xml/dm/ServiceFault.java | d42e5a84bdea0b5bbc01434f6242edf75f77a8c6 | [] | no_license | nandpoot23/SpringBootMapStructSoapService | 7ff00efbd25a20a50df5b278ac9262f61017451b | 1f82cbaebbae5eda8a2a9d61fb34c25ba782eb80 | refs/heads/master | 2021-01-01T20:32:48.865380 | 2017-07-31T12:13:13 | 2017-07-31T12:13:13 | 98,884,743 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.sample.soap.xml.dm;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceFault", propOrder = { "messages" })
public class ServiceFault {
protected MessagesType messages;
public MessagesType getMessages() {
return messages;
}
public void setMessages(MessagesType messages) {
this.messages = messages;
}
}
| [
"mlahariya@xavient.com"
] | mlahariya@xavient.com |
b85784f49382e021e7d123baf273ce944bfe3fe1 | 78a19c0ed7bf9a3e71d99b1ac8a91963f0223c90 | /dac/backend/src/main/java/com/dremio/dac/server/tokens/TokenManagerImpl.java | 6720b74f88b856110964e104b38c2ea42316fd00 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | kstirman/dremio-oss | de46edac556628c83ee719990705cd60e9060be6 | 57889fbaab05512b62dc2a305fd5524693fb29a2 | refs/heads/master | 2021-06-26T15:04:19.182039 | 2017-08-14T23:44:41 | 2017-08-15T21:38:45 | 103,543,189 | 0 | 0 | null | 2017-09-14T14:33:41 | 2017-09-14T14:33:41 | null | UTF-8 | Java | false | false | 7,686 | java | /*
* Copyright (C) 2017 Dremio Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dremio.dac.server.tokens;
import static com.google.common.base.Preconditions.checkArgument;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import javax.inject.Provider;
import com.dremio.config.DremioConfig;
import com.dremio.dac.proto.model.tokens.SessionState;
import com.dremio.dac.server.DacConfig;
import com.dremio.datastore.KVStore;
import com.dremio.datastore.KVStoreProvider;
import com.dremio.service.scheduler.Schedule;
import com.dremio.service.scheduler.SchedulerService;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.cache.RemovalListener;
import com.google.common.cache.RemovalNotification;
import com.google.common.collect.Sets;
/**
* Token manager implementation.
*/
public class TokenManagerImpl implements TokenManager {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TokenManagerImpl.class);
private static final long TOKEN_EXPIRATION_MILLIS = TimeUnit.MILLISECONDS.convert(30, TimeUnit.HOURS);
private final SecureRandom generator = new SecureRandom();
private final Provider<KVStoreProvider> kvProvider;
private final Provider<SchedulerService> schedulerService;
private final boolean isMaster;
private final int cacheSize;
private final int cacheExpiration;
private KVStore<String, SessionState> tokenStore;
private LoadingCache<String, SessionState> tokenCache;
public TokenManagerImpl(final Provider<KVStoreProvider> kvProvider,
final Provider<SchedulerService> schedulerService,
final boolean isMaster,
final DacConfig config) {
this(kvProvider,
schedulerService,
isMaster,
config.getConfig().getInt(DremioConfig.WEB_TOKEN_CACHE_SIZE),
config.getConfig().getInt(DremioConfig.WEB_TOKEN_CACHE_EXPIRATION));
}
@VisibleForTesting
TokenManagerImpl(final Provider<KVStoreProvider> kvProvider,
final Provider<SchedulerService> schedulerService,
final boolean isMaster,
final int cacheSize,
final int cacheExpiration) {
this.kvProvider = kvProvider;
this.schedulerService = schedulerService;
this.isMaster = isMaster;
this.cacheSize = cacheSize;
this.cacheExpiration = cacheExpiration;
}
@Override
public void start() {
this.tokenStore = kvProvider.get().getStore(TokenStoreCreator.class);
this.tokenCache = CacheBuilder.newBuilder()
.maximumSize(cacheSize)
// so a token is fetched from the store ever so often
.expireAfterWrite(cacheExpiration, TimeUnit.MINUTES)
.removalListener(new RemovalListener<String, SessionState>() {
@Override
public void onRemoval(RemovalNotification<String, SessionState> notification) {
if (!notification.wasEvicted()) {
// TODO: broadcast this message to other coordinators; for now, cache on each coordinator could allow
// an invalid token to be used for up to "expiration"
tokenStore.delete(notification.getKey());
}
}
})
.build(new CacheLoader<String, SessionState>() {
@Override
public SessionState load(String key) {
return tokenStore.get(key);
}
});
if (isMaster) {
final Schedule everyDay = Schedule.Builder.everyDays(1).build();
schedulerService.get().schedule(everyDay, new RemoveExpiredTokens());
}
}
@Override
public void close() {
}
// From https://stackoverflow.com/questions/41107/how-to-generate-a-random-alpha-numeric-string
// ... This works by choosing 130 bits from a cryptographically secure random bit generator, and encoding
// them in base-32. 128 bits is considered to be cryptographically strong, but each digit in a base 32
// number can encode 5 bits, so 128 is rounded up to the next multiple of 5 ... Why 32? Because 32 = 2^5;
// each character will represent exactly 5 bits, and 130 bits can be evenly divided into characters.
private String newToken() {
return new BigInteger(130, generator).toString(32);
}
@VisibleForTesting
TokenDetails createToken(final String username, final String clientAddress, final long issuedAt,
final long expiresAt) {
final String token = newToken();
final SessionState state = new SessionState()
.setUsername(username)
.setClientAddress(clientAddress)
.setIssuedAt(issuedAt)
.setExpiresAt(expiresAt);
tokenStore.put(token, state);
tokenCache.put(token, state);
logger.trace("Created token: {}", token);
return TokenDetails.of(token, username, expiresAt);
}
@Override
public TokenDetails createToken(final String username, final String clientAddress) {
final long now = System.currentTimeMillis();
final long expires = now + TOKEN_EXPIRATION_MILLIS;
return createToken(username, clientAddress, now, expires);
}
private SessionState getSessionState(final String token) {
checkArgument(token != null, "invalid token");
final SessionState value;
try {
value = tokenCache.getUnchecked(token);
} catch (CacheLoader.InvalidCacheLoadException ignored) {
throw new IllegalArgumentException("invalid token");
}
return value;
}
@Override
public TokenDetails validateToken(final String token) throws IllegalArgumentException {
final SessionState value = getSessionState(token);
if (System.currentTimeMillis() >= value.getExpiresAt()) {
tokenCache.invalidate(token); // removes from the store as well
throw new IllegalArgumentException("token expired");
}
logger.trace("Validated token: {}", token);
return TokenDetails.of(token, value.getUsername(), value.getExpiresAt());
}
@Override
public void invalidateToken(final String token) {
logger.trace("Invalidate token: {}", token);
tokenCache.invalidate(token); // removes from the store as well
}
@VisibleForTesting
KVStore<String, SessionState> getTokenStore() {
return tokenStore;
}
/**
* Periodically removes expired tokens. When a user abandons a session, that token maybe left behind.
* Since the token may never be accessed in the future, this task cleans up the store. This task must run
* only on master coordinator.
*/
class RemoveExpiredTokens implements Runnable {
@Override
public void run() {
final long now = System.currentTimeMillis();
final Set<String> expiredTokens = Sets.newHashSet();
for (final Map.Entry<String, SessionState> entry : tokenStore.find()) {
if (now >= entry.getValue().getExpiresAt()) {
expiredTokens.add(entry.getKey());
}
}
for (final String token : expiredTokens) {
tokenStore.delete(token);
}
}
}
}
| [
"jacques@dremio.com"
] | jacques@dremio.com |
42e44a28fc093adcd0331889fd11830e67c4c93c | cbea23d5e087a862edcf2383678d5df7b0caab67 | /aws-java-sdk-devopsguru/src/main/java/com/amazonaws/services/devopsguru/model/UpdateTagCollectionFilter.java | 8ce7523b4802ae064c15d7365dbd96922083944d | [
"Apache-2.0"
] | permissive | phambryan/aws-sdk-for-java | 66a614a8bfe4176bf57e2bd69f898eee5222bb59 | 0f75a8096efdb4831da8c6793390759d97a25019 | refs/heads/master | 2021-12-14T21:26:52.580137 | 2021-12-03T22:50:27 | 2021-12-03T22:50:27 | 4,263,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,995 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.devopsguru.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* A new collection of Amazon Web Services resources that are defined by an Amazon Web Services tag or tag
* <i>key</i>/<i>value</i> pair.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/UpdateTagCollectionFilter"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateTagCollectionFilter implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* An Amazon Web Services tag <i>key</i> that is used to identify the Amazon Web Services resources that DevOps Guru
* analyzes. All Amazon Web Services resources in your account and Region tagged with this <i>key</i> make up your
* DevOps Guru application and analysis boundary.
* </p>
* <important>
* <p>
* The string used for a <i>key</i> in a tag that you use to define your resource coverage must begin with the
* prefix <code>Devops-guru-</code>. The tag <i>key</i> might be <code>Devops-guru-deployment-application</code> or
* <code>Devops-guru-rds-application</code>. While <i>keys</i> are case-sensitive, the case of <i>key</i> characters
* don't matter to DevOps Guru. For example, DevOps Guru works with a <i>key</i> named <code>devops-guru-rds</code>
* and a <i>key</i> named <code>DevOps-Guru-RDS</code>. Possible <i>key</i>/<i>value</i> pairs in your application
* might be <code>Devops-Guru-production-application/RDS</code> or
* <code>Devops-Guru-production-application/containers</code>.
* </p>
* </important>
*/
private String appBoundaryKey;
/**
* <p>
* The values in an Amazon Web Services tag collection.
* </p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for example,
* <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and <i>value</i> are the
* tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty string. Like tag <i>keys</i>,
* tag <i>values</i> are case-sensitive. You can specify a maximum of 256 characters for a tag value.
* </p>
*/
private java.util.List<String> tagValues;
/**
* <p>
* An Amazon Web Services tag <i>key</i> that is used to identify the Amazon Web Services resources that DevOps Guru
* analyzes. All Amazon Web Services resources in your account and Region tagged with this <i>key</i> make up your
* DevOps Guru application and analysis boundary.
* </p>
* <important>
* <p>
* The string used for a <i>key</i> in a tag that you use to define your resource coverage must begin with the
* prefix <code>Devops-guru-</code>. The tag <i>key</i> might be <code>Devops-guru-deployment-application</code> or
* <code>Devops-guru-rds-application</code>. While <i>keys</i> are case-sensitive, the case of <i>key</i> characters
* don't matter to DevOps Guru. For example, DevOps Guru works with a <i>key</i> named <code>devops-guru-rds</code>
* and a <i>key</i> named <code>DevOps-Guru-RDS</code>. Possible <i>key</i>/<i>value</i> pairs in your application
* might be <code>Devops-Guru-production-application/RDS</code> or
* <code>Devops-Guru-production-application/containers</code>.
* </p>
* </important>
*
* @param appBoundaryKey
* An Amazon Web Services tag <i>key</i> that is used to identify the Amazon Web Services resources that
* DevOps Guru analyzes. All Amazon Web Services resources in your account and Region tagged with this
* <i>key</i> make up your DevOps Guru application and analysis boundary.</p> <important>
* <p>
* The string used for a <i>key</i> in a tag that you use to define your resource coverage must begin with
* the prefix <code>Devops-guru-</code>. The tag <i>key</i> might be
* <code>Devops-guru-deployment-application</code> or <code>Devops-guru-rds-application</code>. While
* <i>keys</i> are case-sensitive, the case of <i>key</i> characters don't matter to DevOps Guru. For
* example, DevOps Guru works with a <i>key</i> named <code>devops-guru-rds</code> and a <i>key</i> named
* <code>DevOps-Guru-RDS</code>. Possible <i>key</i>/<i>value</i> pairs in your application might be
* <code>Devops-Guru-production-application/RDS</code> or
* <code>Devops-Guru-production-application/containers</code>.
* </p>
*/
public void setAppBoundaryKey(String appBoundaryKey) {
this.appBoundaryKey = appBoundaryKey;
}
/**
* <p>
* An Amazon Web Services tag <i>key</i> that is used to identify the Amazon Web Services resources that DevOps Guru
* analyzes. All Amazon Web Services resources in your account and Region tagged with this <i>key</i> make up your
* DevOps Guru application and analysis boundary.
* </p>
* <important>
* <p>
* The string used for a <i>key</i> in a tag that you use to define your resource coverage must begin with the
* prefix <code>Devops-guru-</code>. The tag <i>key</i> might be <code>Devops-guru-deployment-application</code> or
* <code>Devops-guru-rds-application</code>. While <i>keys</i> are case-sensitive, the case of <i>key</i> characters
* don't matter to DevOps Guru. For example, DevOps Guru works with a <i>key</i> named <code>devops-guru-rds</code>
* and a <i>key</i> named <code>DevOps-Guru-RDS</code>. Possible <i>key</i>/<i>value</i> pairs in your application
* might be <code>Devops-Guru-production-application/RDS</code> or
* <code>Devops-Guru-production-application/containers</code>.
* </p>
* </important>
*
* @return An Amazon Web Services tag <i>key</i> that is used to identify the Amazon Web Services resources that
* DevOps Guru analyzes. All Amazon Web Services resources in your account and Region tagged with this
* <i>key</i> make up your DevOps Guru application and analysis boundary.</p> <important>
* <p>
* The string used for a <i>key</i> in a tag that you use to define your resource coverage must begin with
* the prefix <code>Devops-guru-</code>. The tag <i>key</i> might be
* <code>Devops-guru-deployment-application</code> or <code>Devops-guru-rds-application</code>. While
* <i>keys</i> are case-sensitive, the case of <i>key</i> characters don't matter to DevOps Guru. For
* example, DevOps Guru works with a <i>key</i> named <code>devops-guru-rds</code> and a <i>key</i> named
* <code>DevOps-Guru-RDS</code>. Possible <i>key</i>/<i>value</i> pairs in your application might be
* <code>Devops-Guru-production-application/RDS</code> or
* <code>Devops-Guru-production-application/containers</code>.
* </p>
*/
public String getAppBoundaryKey() {
return this.appBoundaryKey;
}
/**
* <p>
* An Amazon Web Services tag <i>key</i> that is used to identify the Amazon Web Services resources that DevOps Guru
* analyzes. All Amazon Web Services resources in your account and Region tagged with this <i>key</i> make up your
* DevOps Guru application and analysis boundary.
* </p>
* <important>
* <p>
* The string used for a <i>key</i> in a tag that you use to define your resource coverage must begin with the
* prefix <code>Devops-guru-</code>. The tag <i>key</i> might be <code>Devops-guru-deployment-application</code> or
* <code>Devops-guru-rds-application</code>. While <i>keys</i> are case-sensitive, the case of <i>key</i> characters
* don't matter to DevOps Guru. For example, DevOps Guru works with a <i>key</i> named <code>devops-guru-rds</code>
* and a <i>key</i> named <code>DevOps-Guru-RDS</code>. Possible <i>key</i>/<i>value</i> pairs in your application
* might be <code>Devops-Guru-production-application/RDS</code> or
* <code>Devops-Guru-production-application/containers</code>.
* </p>
* </important>
*
* @param appBoundaryKey
* An Amazon Web Services tag <i>key</i> that is used to identify the Amazon Web Services resources that
* DevOps Guru analyzes. All Amazon Web Services resources in your account and Region tagged with this
* <i>key</i> make up your DevOps Guru application and analysis boundary.</p> <important>
* <p>
* The string used for a <i>key</i> in a tag that you use to define your resource coverage must begin with
* the prefix <code>Devops-guru-</code>. The tag <i>key</i> might be
* <code>Devops-guru-deployment-application</code> or <code>Devops-guru-rds-application</code>. While
* <i>keys</i> are case-sensitive, the case of <i>key</i> characters don't matter to DevOps Guru. For
* example, DevOps Guru works with a <i>key</i> named <code>devops-guru-rds</code> and a <i>key</i> named
* <code>DevOps-Guru-RDS</code>. Possible <i>key</i>/<i>value</i> pairs in your application might be
* <code>Devops-Guru-production-application/RDS</code> or
* <code>Devops-Guru-production-application/containers</code>.
* </p>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateTagCollectionFilter withAppBoundaryKey(String appBoundaryKey) {
setAppBoundaryKey(appBoundaryKey);
return this;
}
/**
* <p>
* The values in an Amazon Web Services tag collection.
* </p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for example,
* <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and <i>value</i> are the
* tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty string. Like tag <i>keys</i>,
* tag <i>values</i> are case-sensitive. You can specify a maximum of 256 characters for a tag value.
* </p>
*
* @return The values in an Amazon Web Services tag collection.</p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for
* example, <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and
* <i>value</i> are the tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty
* string. Like tag <i>keys</i>, tag <i>values</i> are case-sensitive. You can specify a maximum of 256
* characters for a tag value.
*/
public java.util.List<String> getTagValues() {
return tagValues;
}
/**
* <p>
* The values in an Amazon Web Services tag collection.
* </p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for example,
* <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and <i>value</i> are the
* tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty string. Like tag <i>keys</i>,
* tag <i>values</i> are case-sensitive. You can specify a maximum of 256 characters for a tag value.
* </p>
*
* @param tagValues
* The values in an Amazon Web Services tag collection.</p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for
* example, <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and
* <i>value</i> are the tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty
* string. Like tag <i>keys</i>, tag <i>values</i> are case-sensitive. You can specify a maximum of 256
* characters for a tag value.
*/
public void setTagValues(java.util.Collection<String> tagValues) {
if (tagValues == null) {
this.tagValues = null;
return;
}
this.tagValues = new java.util.ArrayList<String>(tagValues);
}
/**
* <p>
* The values in an Amazon Web Services tag collection.
* </p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for example,
* <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and <i>value</i> are the
* tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty string. Like tag <i>keys</i>,
* tag <i>values</i> are case-sensitive. You can specify a maximum of 256 characters for a tag value.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setTagValues(java.util.Collection)} or {@link #withTagValues(java.util.Collection)} if you want to
* override the existing values.
* </p>
*
* @param tagValues
* The values in an Amazon Web Services tag collection.</p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for
* example, <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and
* <i>value</i> are the tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty
* string. Like tag <i>keys</i>, tag <i>values</i> are case-sensitive. You can specify a maximum of 256
* characters for a tag value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateTagCollectionFilter withTagValues(String... tagValues) {
if (this.tagValues == null) {
setTagValues(new java.util.ArrayList<String>(tagValues.length));
}
for (String ele : tagValues) {
this.tagValues.add(ele);
}
return this;
}
/**
* <p>
* The values in an Amazon Web Services tag collection.
* </p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for example,
* <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and <i>value</i> are the
* tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty string. Like tag <i>keys</i>,
* tag <i>values</i> are case-sensitive. You can specify a maximum of 256 characters for a tag value.
* </p>
*
* @param tagValues
* The values in an Amazon Web Services tag collection.</p>
* <p>
* The tag's <i>value</i> is an optional field used to associate a string with the tag <i>key</i> (for
* example, <code>111122223333</code>, <code>Production</code>, or a team name). The <i>key</i> and
* <i>value</i> are the tag's <i>key</i> pair. Omitting the tag <i>value</i> is the same as using an empty
* string. Like tag <i>keys</i>, tag <i>values</i> are case-sensitive. You can specify a maximum of 256
* characters for a tag value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateTagCollectionFilter withTagValues(java.util.Collection<String> tagValues) {
setTagValues(tagValues);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAppBoundaryKey() != null)
sb.append("AppBoundaryKey: ").append(getAppBoundaryKey()).append(",");
if (getTagValues() != null)
sb.append("TagValues: ").append(getTagValues());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UpdateTagCollectionFilter == false)
return false;
UpdateTagCollectionFilter other = (UpdateTagCollectionFilter) obj;
if (other.getAppBoundaryKey() == null ^ this.getAppBoundaryKey() == null)
return false;
if (other.getAppBoundaryKey() != null && other.getAppBoundaryKey().equals(this.getAppBoundaryKey()) == false)
return false;
if (other.getTagValues() == null ^ this.getTagValues() == null)
return false;
if (other.getTagValues() != null && other.getTagValues().equals(this.getTagValues()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAppBoundaryKey() == null) ? 0 : getAppBoundaryKey().hashCode());
hashCode = prime * hashCode + ((getTagValues() == null) ? 0 : getTagValues().hashCode());
return hashCode;
}
@Override
public UpdateTagCollectionFilter clone() {
try {
return (UpdateTagCollectionFilter) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.devopsguru.model.transform.UpdateTagCollectionFilterMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
a00bf61d37cb62e7a1ef8026e7c0d17954e5aa6f | 81425c163a4d70c0420cc3897757ec21369ed7bb | /src/algo/MaxCircle.java | 2910b08b264905185b453b2a32bfdaadbb7a1f76 | [] | no_license | hustxq/leetcode | caede1cabb05423cfe68bd8996775c594890001f | f717474168fa705f0cdbb162bdf4d4d060d93ab4 | refs/heads/master | 2021-06-19T09:36:07.855866 | 2021-01-14T09:28:24 | 2021-01-14T09:28:24 | 142,976,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,116 | java | package algo;
import java.util.Stack;
/**
* Created by sse on 2017/9/15.
*/
public class MaxCircle {
static int num;
static int[] ids;
public static void main(String[] args) {
// input
num = 6;
ids = new int[] {0,2,3,2,};
// 每个编号为起点
for (int i = 1; i < num; i++) {
findMax(i);
}
System.out.println("max:"+max);
}
static int max = 0;
public static void findMax(int s){
boolean[] vis = new boolean[num];
// int p = 0;
Stack<Integer> stack = new Stack<>();
stack.push(s);
while (!stack.empty() && num!=stack.size()){
int lover = ids[stack.peek()];
// 首尾成环后 比较人数
if (lover == s){
max = Math.max(max , stack.size());
return;
}else if (vis[lover]){ // 不是首尾的环,剔除
// stack.pop();
return;
}else { //没有遍历过
stack.push(lover);
vis[lover] = true;
}
}
}
}
| [
"26315874@qq.com"
] | 26315874@qq.com |
27a1ab43721e129ca2292a9cea82be6d798ce1e8 | e2bc4687fbf3acb373c7a7980869d730f65352e3 | /src/com/company/BankAccount.java | 1757cd8718c76fa665806fb783661fc188735257 | [] | no_license | AndrewJBateman/java-section15-challenge1 | 8affcfcdb1fae99179a89d0e99767b8b16ec0ed8 | b2fa0ba8f9f2c1b7e29dd8debd1d417968555bb3 | refs/heads/main | 2023-06-27T23:46:31.784650 | 2021-07-28T06:59:51 | 2021-07-28T06:59:51 | 383,378,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,061 | java | package com.company;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class BankAccount {
private double balance;
private String accountNumber;
private Lock lock;
public BankAccount(String accountNumber, double initialBalance) {
this.accountNumber = accountNumber;
this.balance = initialBalance;
this.lock = new ReentrantLock();
}
// public synchronized void deposit(double amount) {
// balance += amount;
// }
//
// public synchronized void withdraw(double amount) {
// balance -= amount;
// }
public void deposit(double amount) {
boolean status = false;
try {
if(lock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
balance += amount;
status = true;
} finally {
lock.unlock();
}
} else {
System.out.println("Could not get the lock");
}
} catch(InterruptedException e) {
// do something here
}
System.out.println("Transaction status = " + status + ", balance is: " + balance);
}
public void withdraw(double amount) {
boolean status = false;
try {
if(lock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
balance -= amount;
status = true;
} finally {
lock.unlock();
}
} else {
System.out.println("Could not get the lock");
}
} catch(InterruptedException e) {
// do something here
}
System.out.println("Transaction status = " + status + ", balance is: " + balance);
}
public String getAccountNumber() {
return accountNumber;
}
public void printAccountNumber() {
System.out.println("Account number = " + accountNumber);
}
}
| [
"gomezbateman@yahoo.com"
] | gomezbateman@yahoo.com |
d831c4aa0c5fee3eb20078672d7ed20abda33ce4 | dcf364388de89d752b353a5a11917709a5f2ddb0 | /app/src/main/java/ashiqur/goriberfitbit/rest_api/service/ApiInterface.java | 3b61b34028b4fe46c75f93da6d98c091e62cc094 | [] | no_license | ashiqursuperfly/FitnessTracker-CSEHackathon2019 | bbe2192a4564351f2303ebb8c30298902f43a655 | 2310b09cb194d2cdd25acd73cadf60b741e34786 | refs/heads/master | 2020-04-18T11:51:12.920172 | 2019-01-26T12:24:42 | 2019-01-26T12:24:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package ashiqur.goriberfitbit.rest_api.service;
import ashiqur.goriberfitbit.rest_api.api_models.CustomResponse;
import ashiqur.goriberfitbit.rest_api.api_models.Leaderboard;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
public interface ApiInterface {
@GET("leaderboard/")
Call<Leaderboard> getLeaderboard();
@POST("api/token/")
Call<CustomResponse> login(@Body RequestBody requestBody);
@POST("api/token/refresh/")
Call<CustomResponse> getAccessToken(@Body RequestBody requestBody);
@POST("signup/")
Call<CustomResponse> signup(@Body RequestBody requestBody);
@POST("data/session/")
Call<CustomResponse> pushMotionData(@Body RequestBody requestBody);
@POST("data/heart/")
Call<CustomResponse> pushHeartBeatData(@Body RequestBody requestBody);
}
| [
"33751187+ashiqursuperfly@users.noreply.github.com"
] | 33751187+ashiqursuperfly@users.noreply.github.com |
6357466556c294b6972e7a0961549a5736124022 | 8ad91bde8b4b8c3f76e555119cafecd942549933 | /schlep-core/src/main/java/com/netflix/schlep/mapper/DefaultSerializerProvider.java | bd4943ad64f700bc84753bf02d8a96672e292ac2 | [
"Apache-2.0"
] | permissive | DoctoralDisaster/schlep | c2d1635501fc50e23fa783e6476feadc3b567e59 | f51ecec1ca5769850871b8aa4f23e025c347f669 | refs/heads/master | 2021-01-22T03:25:40.094569 | 2013-10-09T18:04:40 | 2013-10-09T18:04:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.netflix.schlep.mapper;
import com.netflix.schlep.mapper.jackson.JacksonSerializerProvider;
public class DefaultSerializerProvider extends BaseSerializerProvider {
public DefaultSerializerProvider() {
this.setDefaultSerializerProvider(new JacksonSerializerProvider());
}
}
| [
"elandau@yahoo.com"
] | elandau@yahoo.com |
785c4fa15cd8b1daaeae626a458900eab576dbb9 | f7420c9afb04573b1272a48faae6cec7939c3302 | /hds-framework-model/src/main/java/com/zhishulian/framework/domain/ucenter/XcTeacher.java | 54dc3c17ad981d68812089a03326a4b5fe947e37 | [] | no_license | yangyang8/HybridDistributedSystem | d6119b8142abc727994fe498b1783e6cee72d327 | d9f3f454389d82c103a6a9874f7570d93166658a | refs/heads/master | 2022-12-14T01:15:36.444754 | 2019-06-17T03:22:31 | 2019-06-17T03:23:07 | 192,268,081 | 1 | 0 | null | 2022-11-24T06:26:41 | 2019-06-17T03:21:19 | Java | UTF-8 | Java | false | false | 744 | java | package com.zhishulian.framework.domain.ucenter;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
/**
* Created by admin on 2018/2/10.
*/
@Data
@ToString
@Entity
@Table(name="xc_teacher")
@GenericGenerator(name = "jpa-assigned", strategy = "assigned")
public class XcTeacher implements Serializable {
private static final long serialVersionUID = -916357110051689786L;
@Id
@GeneratedValue(generator = "jpa-assigned")
@Column(length = 32)
private String id;
private String name;
private String pic;
private String intro;
private String resume;
@Column(name="user_id")
private String userId;
}
| [
"3123199442@qq.com"
] | 3123199442@qq.com |
b6598e206f120771413d23215ad65a49567fd66b | 9c9c0a6cd542d5b1c2329209abf144249e275609 | /src/java/com/zimbra/qa/selenium/projects/ajax/tests/calendar/mountpoints/viewer/actions/ShowOriginal.java | 3045a1f791c936924d4ccaad25263be409a45235 | [] | no_license | jiteshsojitra/zm-selenium | 8e55ed108d08784485d22e03884f3d63571b44e2 | 4ed342c33433907a49d698c967a4eb24b435eb80 | refs/heads/develop | 2019-07-11T14:28:27.951485 | 2018-04-13T10:05:02 | 2018-04-13T10:05:02 | 91,348,171 | 0 | 0 | null | 2017-05-15T14:35:48 | 2017-05-15T14:35:48 | null | UTF-8 | Java | false | false | 5,638 | java | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2013, 2014, 2015, 2016 Synacor, Inc.
*
* 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,
* version 2 of the License.
*
* 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 <https://www.gnu.org/licenses/>.
* ***** END LICENSE BLOCK *****
*/
package com.zimbra.qa.selenium.projects.ajax.tests.calendar.mountpoints.viewer.actions;
import java.util.Calendar;
import org.testng.annotations.Test;
import com.zimbra.qa.selenium.framework.items.*;
import com.zimbra.qa.selenium.framework.ui.*;
import com.zimbra.qa.selenium.framework.util.*;
import com.zimbra.qa.selenium.projects.ajax.core.AjaxCore;
import com.zimbra.qa.selenium.projects.ajax.pages.SeparateWindow;
public class ShowOriginal extends AjaxCore {
public ShowOriginal() {
logger.info("New "+ ShowOriginal.class.getCanonicalName());
super.startingPage = app.zPageCalendar;
}
@Test (description = "Grantee views show original of the appointment from grantor's calendar",
groups = { "functional", "L2" })
public void ShowOriginal_01() throws HarnessException {
String apptSubject = ConfigProperties.getUniqueString();
String apptContent = ConfigProperties.getUniqueString();
String foldername = "folder" + ConfigProperties.getUniqueString();
String mountpointname = "mountpoint" + ConfigProperties.getUniqueString();
String windowUrl = "service/home/~/";
Calendar now = Calendar.getInstance();
ZDate startUTC = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 10, 0, 0);
ZDate endUTC = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 11, 0, 0);
FolderItem calendarFolder = FolderItem.importFromSOAP(ZimbraAccount.Account4(), FolderItem.SystemFolder.Calendar);
// Create a folder to share
ZimbraAccount.Account4().soapSend(
"<CreateFolderRequest xmlns='urn:zimbraMail'>"
+ "<folder name='" + foldername + "' l='" + calendarFolder.getId() + "' view='appointment'/>"
+ "</CreateFolderRequest>");
FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.Account4(), foldername);
// Share it
ZimbraAccount.Account4().soapSend(
"<FolderActionRequest xmlns='urn:zimbraMail'>"
+ "<action id='"+ folder.getId() +"' op='grant'>"
+ "<grant d='"+ app.zGetActiveAccount().EmailAddress +"' gt='usr' perm='r' view='appointment'/>"
+ "</action>"
+ "</FolderActionRequest>");
// Mount it
app.zGetActiveAccount().soapSend(
"<CreateMountpointRequest xmlns='urn:zimbraMail'>"
+ "<link l='1' name='"+ mountpointname +"' rid='"+ folder.getId() +"' zid='"+ ZimbraAccount.Account4().ZimbraId +"' view='appointment' color='5'/>"
+ "</CreateMountpointRequest>");
// Create appointment
ZimbraAccount.Account4().soapSend(
"<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
+ "<m l='"+ folder.getId() +"' >"
+ "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"+ apptSubject +"'>"
+ "<s d='"+ startUTC.toTimeZone(ZTimeZone.getLocalTimeZone().getID()).toYYYYMMDDTHHMMSS() +"' tz='"+ ZTimeZone.getLocalTimeZone().getID() +"'/>"
+ "<e d='"+ endUTC.toTimeZone(ZTimeZone.getLocalTimeZone().getID()).toYYYYMMDDTHHMMSS() +"' tz='"+ ZTimeZone.getLocalTimeZone().getID() +"'/>"
+ "<or a='"+ ZimbraAccount.Account4().EmailAddress +"'/>"
+ "<at role='REQ' ptst='NE' rsvp='1' a='" + app.zGetActiveAccount().EmailAddress + "'/>"
+ "</inv>"
+ "<e a='"+ app.zGetActiveAccount().EmailAddress +"' t='t'/>"
+ "<su>"+ apptSubject +"</su>"
+ "<mp content-type='text/plain'>"
+ "<content>" + apptContent + "</content>"
+ "</mp>"
+ "</m>"
+ "</CreateAppointmentRequest>");
// Verify appointment exists in current view
ZAssert.assertTrue(app.zPageCalendar.zVerifyAppointmentExists(apptSubject), "Verify appointment displayed in current view");
// Mark ON to mounted calendar folder and select the appointment
app.zTreeCalendar.zMarkOnOffCalendarFolder("Calendar");
app.zTreeCalendar.zMarkOnOffCalendarFolder(mountpointname);
// Appointment show original
SeparateWindow window = (SeparateWindow)app.zPageCalendar.zListItem(Action.A_RIGHTCLICK,Button.O_SHOW_ORIGINAL_MENU, apptSubject);
try {
window.zSetWindowTitle(windowUrl);
ZAssert.assertTrue(window.zIsWindowOpen(windowUrl),"Verify the window is opened and switch to it");
SleepUtil.sleepMedium();
// Verify show original window content
String body = window.sGetBodyText();
ZAssert.assertStringContains(body, apptSubject, "Verify subject in show original");
ZAssert.assertStringContains(body, apptContent, "Verify content in show original");
ZAssert.assertStringContains(body, "BEGIN:VCALENDAR", "Verify BEGIN header in show original");
ZAssert.assertStringContains(body, "END:VCALENDAR", "Verify END header in show original");
ZAssert.assertStringContains(body, "ORGANIZER:mailto:" + ZimbraAccount.Account4().EmailAddress, "Verify organizer value in show original");
} finally {
app.zPageMain.zCloseWindow(window, windowUrl, app);
}
}
}
| [
"jitesh.sojitra@synacor.com"
] | jitesh.sojitra@synacor.com |
6b6d80a53a7b57a975ec1f3e4df282bfc5926920 | 99b4a46e54bf9013bb833fd6a63eadf7b6cba1c9 | /app/src/main/java/mobo/andro/apps/ohmagiccamera/CollageMaker/fragments/CollageFifteen.java | a763a2cf6431393894327ba3d8a249f50b31690b | [] | no_license | esaman1/ohmagiccamera | 910186858acf9e10a408861b50bfb1ed93adcc01 | 973c7696cb852a5c0c7b3a15d35e7294dcaf059e | refs/heads/master | 2022-03-18T08:27:42.399050 | 2019-11-12T03:43:46 | 2019-11-12T03:43:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,514 | java | package mobo.andro.apps.ohmagiccamera.CollageMaker.fragments;
import android.app.Fragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build.VERSION;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import org.wysaid.view.ImageGLSurfaceView;
import org.wysaid.view.ImageGLSurfaceView.OnSurfaceCreatedCallback;
import java.io.IOException;
import mobo.andro.apps.ohmagiccamera.CollageMaker.CollageInterface;
import mobo.andro.apps.ohmagiccamera.CollageMaker.GLFilterImageView;
import mobo.andro.apps.ohmagiccamera.CollageMaker.ImageGalleryActivity;
import mobo.andro.apps.ohmagiccamera.CollageMaker.ImageUtils;
import mobo.andro.apps.ohmagiccamera.CollageMaker.MainActivity;
import mobo.andro.apps.ohmagiccamera.CollageMaker.MultiTouchListener;
import mobo.andro.apps.ohmagiccamera.CollageMaker.MultiTouchListener.TouchCallbackListener;
import mobo.andro.apps.ohmagiccamera.CollageMaker.RoundCornerFrameLayout;
import mobo.andro.apps.ohmagiccamera.R;
import mobo.andro.apps.ohmagiccamera.editormodule.PhotoEditor;
public class CollageFifteen extends Fragment implements CollageInterface, OnTouchListener, OnClickListener, TouchCallbackListener {
private int curPadding = 0;
private int curRadius = 0;
private View div1;
private View div2;
private View div3;
private View div4;
int extraCount = 1;
private FrameLayout fl1;
private FrameLayout fl2;
private FrameLayout fl3;
private FrameLayout fl4;
private FrameLayout fl5;
private View focusedView;
private boolean forShowOffOnly;
private GestureDetector gdetector;
private GLFilterImageView img1;
private GLFilterImageView img2;
private GLFilterImageView img3;
private GLFilterImageView img4;
private GLFilterImageView img5;
private PopupWindow mPopupWindow;
private RelativeLayout rl1;
private RelativeLayout rl2;
private RelativeLayout rl3;
private RelativeLayout rl4;
private RelativeLayout rl5;
private RelativeLayout rl6;
private RelativeLayout rl7;
private float tX = 0.0f;
private float tY = 0.0f;
private View view;
/* renamed from: mobo.andro.apps.camera.CollageMaker.fragments.CollageFifteen$3 */
class C04393 implements Runnable {
C04393() {
}
public void run() {
CollageFifteen.this.setGridPadding(CollageFifteen.this.curPadding);
}
}
/* renamed from: mobo.andro.apps.camera.CollageMaker.fragments.CollageFifteen$4 */
class C04404 extends SimpleOnGestureListener {
C04404() {
}
public boolean onDoubleTap(MotionEvent e) {
if (CollageFifteen.this.mPopupWindow != null) {
if (CollageFifteen.this.mPopupWindow.isShowing()) {
CollageFifteen.this.mPopupWindow.dismiss();
}
int rawX = (int) e.getRawX();
int rawY = (int) e.getRawY();
RelativeLayout main_rel = (RelativeLayout) CollageFifteen.this.view.findViewById(R.id.main_rel);
int[] posXY = new int[2];
main_rel.getLocationOnScreen(posXY);
CollageFifteen.this.mPopupWindow.showAtLocation(main_rel, 51, rawX + posXY[0], rawY + posXY[1]);
}
return true;
}
public void onLongPress(MotionEvent e) {
super.onLongPress(e);
}
public boolean onDoubleTapEvent(MotionEvent e) {
return true;
}
public boolean onDown(MotionEvent e) {
return true;
}
}
/* renamed from: mobo.andro.apps.camera.CollageMaker.fragments.CollageFifteen$5 */
class C04415 implements OnClickListener {
C04415() {
}
public void onClick(View view) {
CollageFifteen.this.mPopupWindow.dismiss();
CollageFifteen.this.onGalleryButtonClick(FragmentsManager.REQUEST_GALLERY_ONDOUBLECLICK);
}
}
/* renamed from: mobo.andro.apps.camera.CollageMaker.fragments.CollageFifteen$6 */
class C04426 implements OnClickListener {
C04426() {
}
public void onClick(View view) {
CollageFifteen.this.mPopupWindow.dismiss();
Bitmap bitmap = CollageFifteen.this.getStoredBitmap(CollageFifteen.this.focusedView);
PhotoEditor.bitmap = bitmap.copy(bitmap.getConfig(), true);
Intent intentEditor = new Intent(CollageFifteen.this.getActivity(), PhotoEditor.class);
intentEditor.setAction("android.intent.action.MAIN");
CollageFifteen.this.startActivityForResult(intentEditor, FragmentsManager.REQUEST_EDITOR);
}
}
/* renamed from: mobo.andro.apps.camera.CollageMaker.fragments.CollageFifteen$7 */
class C04437 implements OnClickListener {
C04437() {
}
public void onClick(View view) {
CollageFifteen.this.mPopupWindow.dismiss();
}
}
public static CollageFifteen newInstance(boolean b) {
CollageFifteen fragment = new CollageFifteen();
Bundle args = new Bundle();
args.putBoolean("forShowOffOnly", b);
fragment.setArguments(args);
return fragment;
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_collage_15, container, false);
}
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
this.view = view;
this.curPadding = getActivity().getResources().getInteger(R.integer.default_padding);
this.forShowOffOnly = getArguments().getBoolean("forShowOffOnly");
this.rl1 = (RelativeLayout) view.findViewById(R.id.rl1);
this.rl2 = (RelativeLayout) view.findViewById(R.id.rl2);
this.rl3 = (RelativeLayout) view.findViewById(R.id.rl3);
this.rl4 = (RelativeLayout) view.findViewById(R.id.rl4);
this.rl5 = (RelativeLayout) view.findViewById(R.id.rl5);
this.rl6 = (RelativeLayout) view.findViewById(R.id.rl6);
this.rl7 = (RelativeLayout) view.findViewById(R.id.rl7);
this.fl1 = (FrameLayout) view.findViewById(R.id.fl1);
this.fl2 = (FrameLayout) view.findViewById(R.id.fl2);
this.fl3 = (FrameLayout) view.findViewById(R.id.fl3);
this.fl4 = (FrameLayout) view.findViewById(R.id.fl4);
this.fl5 = (FrameLayout) view.findViewById(R.id.fl5);
this.img1 = (GLFilterImageView) view.findViewById(R.id.img1);
this.img2 = (GLFilterImageView) view.findViewById(R.id.img2);
this.img3 = (GLFilterImageView) view.findViewById(R.id.img3);
this.img4 = (GLFilterImageView) view.findViewById(R.id.img4);
this.img5 = (GLFilterImageView) view.findViewById(R.id.img5);
this.div1 = view.findViewById(R.id.div1);
this.div2 = view.findViewById(R.id.div2);
this.div3 = view.findViewById(R.id.div3);
this.div4 = view.findViewById(R.id.div4);
if (!this.forShowOffOnly) {
this.div1.setOnTouchListener(this);
this.div2.setOnTouchListener(this);
this.div3.setOnTouchListener(this);
this.div4.setOnTouchListener(this);
this.img1.setOnClickListener(this);
this.img2.setOnClickListener(this);
this.img3.setOnClickListener(this);
this.img4.setOnClickListener(this);
this.img5.setOnClickListener(this);
ImageUtils.blinkMe(getActivity(), this.div1);
}
super.onViewCreated(view, savedInstanceState);
view.post(new Runnable() {
public void run() {
CollageFifteen.this.optimizeLayout(view);
}
});
initGd();
if (ImageGalleryActivity.selectedBitmaps.size() > 0) {
setImageBitmap((Bitmap) ImageGalleryActivity.selectedBitmaps.get(0), this.img1);
createGLViewForImage(view, this.img1, (Bitmap) ImageGalleryActivity.selectedBitmaps.get(0));
}
if (ImageGalleryActivity.selectedBitmaps.size() > 1) {
setImageBitmap((Bitmap) ImageGalleryActivity.selectedBitmaps.get(1), this.img2);
createGLViewForImage(view, this.img2, (Bitmap) ImageGalleryActivity.selectedBitmaps.get(1));
}
if (ImageGalleryActivity.selectedBitmaps.size() > 2) {
setImageBitmap((Bitmap) ImageGalleryActivity.selectedBitmaps.get(2), this.img3);
createGLViewForImage(view, this.img3, (Bitmap) ImageGalleryActivity.selectedBitmaps.get(2));
}
if (ImageGalleryActivity.selectedBitmaps.size() > 3) {
setImageBitmap((Bitmap) ImageGalleryActivity.selectedBitmaps.get(3), this.img4);
createGLViewForImage(view, this.img4, (Bitmap) ImageGalleryActivity.selectedBitmaps.get(3));
}
if (ImageGalleryActivity.selectedBitmaps.size() > 4) {
setImageBitmap((Bitmap) ImageGalleryActivity.selectedBitmaps.get(4), this.img5);
createGLViewForImage(view, this.img5, (Bitmap) ImageGalleryActivity.selectedBitmaps.get(4));
}
initPopupWindow();
}
private void createGLViewForImage(View view, final GLFilterImageView img, final Bitmap bitmap) {
if (!this.forShowOffOnly) {
final ImageGLSurfaceView mainImageView = new ImageGLSurfaceView(getActivity());
mainImageView.setId(((int) System.currentTimeMillis()) + this.extraCount);
this.extraCount++;
mainImageView.setSurfaceCreatedCallback(new OnSurfaceCreatedCallback() {
/* renamed from: mobo.andro.apps.camera.CollageMaker.fragments.CollageFifteen$2$1 */
class C04371 implements Runnable {
C04371() {
}
public void run() {
img.setImageGLSurfaceView(mainImageView);
img.setGLBitmap(bitmap);
img.setFilterConfig(CollageFifteen.this.img1.getmCurConfig());
FrameLayout parent = (FrameLayout) img.getParent();
int w = parent.getWidth();
int h = parent.getHeight();
int[] resizeDim = ImageUtils.getResizeDim((float) bitmap.getWidth(), (float) bitmap.getHeight(), w, h);
img.setImageBitmap(bitmap);
img.getLayoutParams().width = resizeDim[0];
img.getLayoutParams().height = resizeDim[1];
float scale = ((float) w) / ((float) resizeDim[0]) > ((float) h) / ((float) resizeDim[1]) ? ((float) w) / ((float) resizeDim[0]) : ((float) h) / ((float) resizeDim[1]);
img.setScaleX(scale);
img.setScaleY(scale);
}
}
public void surfaceCreated() {
if (ImageGalleryActivity.selectedBitmaps.size() > 0) {
CollageFifteen.this.getActivity().runOnUiThread(new C04371());
}
}
});
((RelativeLayout) view.findViewById(R.id.glview_container)).addView(mainImageView);
}
}
private void optimizeLayout(View view) {
RelativeLayout main_rel = (RelativeLayout) view.findViewById(R.id.main_rel);
main_rel.getLayoutParams().width = MainActivity.screenWidth;
main_rel.getLayoutParams().height = MainActivity.screenWidth;
main_rel.invalidate();
ImageUtils.optimizeView(this.rl1, 0.0f, 0.0f, Dimensions.S_3P, Dimensions.MATCH_PARENT);
ImageUtils.optimizeView(this.rl2, (float) Dimensions.S_3P, 0.0f, Dimensions.S_3P, Dimensions.MATCH_PARENT);
ImageUtils.optimizeView(this.rl3, (float) (Dimensions.S_3P * 2), 0.0f, Dimensions.S_3P, Dimensions.MATCH_PARENT);
ImageUtils.optimizeView(this.rl4, 0.0f, 0.0f, Dimensions.MATCH_PARENT, Dimensions.S_2P);
ImageUtils.optimizeView(this.rl5, 0.0f, (float) Dimensions.S_2P, Dimensions.MATCH_PARENT, Dimensions.S_2P);
ImageUtils.optimizeView(this.rl6, 0.0f, 0.0f, Dimensions.MATCH_PARENT, Dimensions.S_2P);
ImageUtils.optimizeView(this.rl7, 0.0f, (float) Dimensions.S_2P, Dimensions.MATCH_PARENT, Dimensions.S_2P);
view.post(new C04393());
}
public void setCornerRadius(int radius) {
this.curRadius = radius;
((RoundCornerFrameLayout) this.fl1).setCornerRadius(radius);
((RoundCornerFrameLayout) this.fl2).setCornerRadius(radius);
((RoundCornerFrameLayout) this.fl3).setCornerRadius(radius);
((RoundCornerFrameLayout) this.fl4).setCornerRadius(radius);
((RoundCornerFrameLayout) this.fl5).setCornerRadius(radius);
}
public void setGridPadding(int padding) {
this.curPadding = ImageUtils.dpToPx(getActivity(), padding);
LayoutParams lp1 = (LayoutParams) this.fl1.getLayoutParams();
lp1.setMargins(this.curPadding, this.curPadding, this.curPadding / 2, this.curPadding / 2);
LayoutParams lp2 = (LayoutParams) this.fl2.getLayoutParams();
lp2.setMargins(this.curPadding, this.curPadding / 2, this.curPadding / 2, this.curPadding);
LayoutParams lp3 = (LayoutParams) this.fl3.getLayoutParams();
lp3.setMargins(this.curPadding / 2, this.curPadding, this.curPadding / 2, this.curPadding);
LayoutParams lp4 = (LayoutParams) this.fl4.getLayoutParams();
lp4.setMargins(this.curPadding / 2, this.curPadding, this.curPadding, this.curPadding / 2);
LayoutParams lp5 = (LayoutParams) this.fl5.getLayoutParams();
lp5.setMargins(this.curPadding / 2, this.curPadding / 2, this.curPadding, this.curPadding);
this.fl1.setLayoutParams(lp1);
this.fl2.setLayoutParams(lp2);
this.fl3.setLayoutParams(lp3);
this.fl4.setLayoutParams(lp4);
this.fl5.setLayoutParams(lp5);
if (padding < 20) {
this.curPadding = ImageUtils.dpToPx(getActivity(), 20);
}
this.div1.getLayoutParams().width = this.curPadding;
this.div2.getLayoutParams().width = this.curPadding;
this.div3.getLayoutParams().height = this.curPadding;
this.div4.getLayoutParams().height = this.curPadding;
this.div1.setX((float) (this.rl1.getWidth() - (this.curPadding / 2)));
this.div2.setX((this.rl2.getX() + ((float) this.rl2.getWidth())) - ((float) (this.curPadding / 2)));
this.div3.setY((float) (this.rl4.getHeight() - (this.curPadding / 2)));
this.div4.setY((float) (this.rl6.getHeight() - (this.curPadding / 2)));
}
public void setEffectProgress(int progress, int maxProgress) {
}
public int setEffectConfigIndex(int index) {
return index;
}
public void setFilterConfig(String config) {
this.img1.setFilterConfig(config);
this.img2.setFilterConfig(config);
this.img3.setFilterConfig(config);
this.img4.setFilterConfig(config);
this.img5.setFilterConfig(config);
}
public void setFilterProgress(float filterProgress) {
this.img1.setFilterProgress(filterProgress);
this.img2.setFilterProgress(filterProgress);
this.img3.setFilterProgress(filterProgress);
this.img4.setFilterProgress(filterProgress);
this.img5.setFilterProgress(filterProgress);
}
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case 0:
view.bringToFront();
view.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.divColor));
this.tX = motionEvent.getX();
this.tY = motionEvent.getY();
break;
case 1:
view.setBackgroundColor(0);
break;
case 2:
float x = motionEvent.getX();
int dx = (int) (this.tX - x);
int dy = (int) (this.tY - motionEvent.getY());
Log.i("movetest", "tX : " + this.tX + " x : " + x + " dx : " + dx);
view.bringToFront();
if (view.getId() != R.id.div1 || (view.getX() - ((float) dx)) + ((float) view.getWidth()) > this.div2.getX() + ((float) this.div2.getWidth()) || view.getX() - ((float) dx) < 0.0f) {
if (view.getId() != R.id.div2 || (view.getX() - ((float) dx)) + ((float) view.getWidth()) > this.rl3.getX() + ((float) this.rl3.getWidth()) || view.getX() - ((float) dx) < this.div1.getX()) {
if (view.getId() != R.id.div3 || (view.getY() - ((float) dy)) + ((float) view.getHeight()) > this.rl5.getY() + ((float) this.rl5.getHeight()) || view.getY() - ((float) dy) < 0.0f) {
if (view.getId() == R.id.div4 && (view.getY() - ((float) dy)) + ((float) view.getHeight()) <= this.rl7.getY() + ((float) this.rl7.getHeight()) && view.getY() - ((float) dy) >= 0.0f) {
this.rl6.getLayoutParams().height -= dy;
if (this.rl6.getLayoutParams().height >= 0) {
this.rl6.setVisibility(View.VISIBLE);
} else {
this.rl6.setVisibility(View.GONE);
}
this.rl7.getLayoutParams().height += dy;
if (this.rl7.getLayoutParams().height >= 0) {
this.rl7.setVisibility(View.VISIBLE);
} else {
this.rl7.setVisibility(View.GONE);
}
Log.i("movetest", "rl1 : " + this.rl1.getLayoutParams().height + " rl2 : " + this.rl2.getLayoutParams().height);
this.rl7.setY(this.rl7.getY() - ((float) dy));
view.setY(view.getY() - ((float) dy));
view.requestLayout();
view.postInvalidate();
break;
}
}
this.rl4.getLayoutParams().height -= dy;
if (this.rl4.getLayoutParams().height >= 0) {
this.rl4.setVisibility(View.VISIBLE);
} else {
this.rl4.setVisibility(View.GONE);
}
this.rl5.getLayoutParams().height += dy;
if (this.rl5.getLayoutParams().height >= 0) {
this.rl5.setVisibility(View.VISIBLE);
} else {
this.rl5.setVisibility(View.GONE);
}
Log.i("movetest", "rl1 : " + this.rl1.getLayoutParams().height + " rl2 : " + this.rl2.getLayoutParams().height);
this.rl5.setY(this.rl5.getY() - ((float) dy));
view.setY(view.getY() - ((float) dy));
view.requestLayout();
view.postInvalidate();
break;
}
this.rl2.getLayoutParams().width -= dx;
if (this.rl2.getLayoutParams().width >= 0) {
this.rl2.setVisibility(View.VISIBLE);
} else {
this.rl2.setVisibility(View.GONE);
}
this.rl3.getLayoutParams().width += dx;
if (this.rl3.getLayoutParams().width >= 0) {
this.rl3.setVisibility(View.VISIBLE);
} else {
this.rl3.setVisibility(View.GONE);
}
this.rl3.setX(this.rl3.getX() - ((float) dx));
view.setX(view.getX() - ((float) dx));
view.requestLayout();
view.postInvalidate();
break;
}
this.rl1.getLayoutParams().width -= dx;
if (this.rl1.getLayoutParams().width >= 0) {
this.rl1.setVisibility(View.VISIBLE);
} else {
this.rl1.setVisibility(View.GONE);
}
this.rl2.getLayoutParams().width += dx;
if (this.rl2.getLayoutParams().width >= 0) {
this.rl2.setVisibility(View.VISIBLE);
} else {
this.rl2.setVisibility(View.GONE);
}
Log.i("movetest", "rl1 : " + this.rl1.getLayoutParams().width + " rl2 : " + this.rl2.getLayoutParams().width);
this.rl2.setX(this.rl2.getX() - ((float) dx));
view.setX(view.getX() - ((float) dx));
break;
}
return true;
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.img1:
this.focusedView = this.img1;
onGalleryButtonClick(FragmentsManager.REQUEST_GALLERY_ONCLICK);
return;
case R.id.img2:
this.focusedView = this.img2;
onGalleryButtonClick(FragmentsManager.REQUEST_GALLERY_ONCLICK);
return;
case R.id.img3:
this.focusedView = this.img3;
onGalleryButtonClick(FragmentsManager.REQUEST_GALLERY_ONCLICK);
return;
case R.id.img4:
this.focusedView = this.img4;
onGalleryButtonClick(FragmentsManager.REQUEST_GALLERY_ONCLICK);
return;
case R.id.img5:
this.focusedView = this.img5;
onGalleryButtonClick(FragmentsManager.REQUEST_GALLERY_ONCLICK);
return;
default:
return;
}
}
private void onGalleryButtonClick(int reqCode) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction("android.intent.action.PICK");
startActivityForResult(Intent.createChooser(intent, getResources().getString(R.string.select_picture)), reqCode);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == -1) {
Bitmap bitmap;
if (requestCode == FragmentsManager.REQUEST_GALLERY_ONCLICK) {
try {
bitmap = ImageUtils.getResampleImageBitmap(data.getData(), getActivity(), MainActivity.screenWidth);
ImageGalleryActivity.selectedBitmaps.add(bitmap);
setImageBitmap(bitmap, (ImageView) this.focusedView);
createGLViewForImage(this.view, (GLFilterImageView) this.focusedView, bitmap);
} catch (IOException e) {
e.printStackTrace();
}
}
if (requestCode == FragmentsManager.REQUEST_GALLERY_ONDOUBLECLICK) {
try {
bitmap = ImageUtils.getResampleImageBitmap(data.getData(), getActivity(), MainActivity.screenWidth);
storeBitmap(this.focusedView, bitmap);
createGLViewForImage(this.view, (GLFilterImageView) this.focusedView, bitmap);
} catch (IOException e2) {
e2.printStackTrace();
}
}
if (requestCode == FragmentsManager.REQUEST_EDITOR) {
bitmap = PhotoEditor.resultBitmap.copy(PhotoEditor.resultBitmap.getConfig(), true);
storeBitmap(this.focusedView, bitmap);
createGLViewForImage(this.view, (GLFilterImageView) this.focusedView, bitmap);
}
}
}
private void setImageBitmap(Bitmap bitmap, ImageView img) {
img.setImageBitmap(bitmap);
img.getLayoutParams().width = Dimensions.MATCH_PARENT;
img.getLayoutParams().height = Dimensions.MATCH_PARENT;
if (this.forShowOffOnly) {
img.setScaleType(ScaleType.CENTER_CROP);
return;
}
img.setScaleType(ScaleType.FIT_CENTER);
img.setOnTouchListener(new MultiTouchListener().enableRotation(true).setOnTouchCallbackListener(this).setGestureListener(this.gdetector));
}
public void onTouchCallback(View v) {
this.focusedView = v;
}
public void onTouchUpCallback(View v) {
}
private void initGd() {
this.gdetector = new GestureDetector(getActivity(), new C04404());
}
private void initPopupWindow() {
View customView = ((LayoutInflater) getActivity().getSystemService("layout_inflater")).inflate(R.layout.popup_dialog, null);
this.mPopupWindow = new PopupWindow(customView, -2, -2);
if (VERSION.SDK_INT >= 21) {
this.mPopupWindow.setElevation(5.0f);
}
TextView delete = (TextView) customView.findViewById(R.id.delete);
TextView cancel = (TextView) customView.findViewById(R.id.cancel);
((TextView) customView.findViewById(R.id.open)).setOnClickListener(new C04415());
delete.setOnClickListener(new C04426());
cancel.setOnClickListener(new C04437());
}
private void storeBitmap(View view, Bitmap bitmap) {
if (view == this.img1) {
ImageGalleryActivity.selectedBitmaps.set(0, bitmap);
}
if (view == this.img2) {
ImageGalleryActivity.selectedBitmaps.set(1, bitmap);
}
if (view == this.img3) {
ImageGalleryActivity.selectedBitmaps.set(2, bitmap);
}
if (view == this.img4) {
ImageGalleryActivity.selectedBitmaps.set(3, bitmap);
}
if (view == this.img5) {
ImageGalleryActivity.selectedBitmaps.set(4, bitmap);
}
}
private Bitmap getStoredBitmap(View view) {
Bitmap bitmap = null;
if (view == this.img1) {
bitmap = (Bitmap) ImageGalleryActivity.selectedBitmaps.get(0);
}
if (view == this.img2) {
bitmap = (Bitmap) ImageGalleryActivity.selectedBitmaps.get(1);
}
if (view == this.img3) {
bitmap = (Bitmap) ImageGalleryActivity.selectedBitmaps.get(2);
}
if (view == this.img4) {
bitmap = (Bitmap) ImageGalleryActivity.selectedBitmaps.get(3);
}
if (view == this.img5) {
bitmap = (Bitmap) ImageGalleryActivity.selectedBitmaps.get(4);
}
return bitmap.copy(bitmap.getConfig(), true);
}
}
| [
"wangjie970912@163.com"
] | wangjie970912@163.com |
9422290416b7189d45d95bb88a564fca37b84521 | f003322c7d2bc743975918fbd4607ad49469f6e9 | /src/main/java/com/zjhs/hstx/biz/business/controller/UserInfoController.java | 74b7860668efc7a230c641170bd93e1b79b08eb8 | [] | no_license | qcm89757/hstx | baa0b43bd30a61ac5e2c0eef5a5acfa3e6a79f0a | f6aa36c13fa1d8c3e3f97b0a8cde1095b30da6b3 | refs/heads/master | 2022-07-02T21:09:56.218463 | 2019-10-05T04:37:56 | 2019-10-05T04:37:56 | 211,829,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,347 | java | package com.zjhs.hstx.biz.business.controller;
import com.zjhs.hstx.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author mybatisPlusTool
* @since 2019-10-03
*/
@Api("控制器")
@RestController
@RequestMapping("/business/user-info")
public class UserInfoController {
@ApiOperation("新增")
@PostMapping("/add")
public Result add() {
return new Result<>();
}
@ApiOperation("删除")
@GetMapping("/del")
public Result delete() {
return new Result<>();
}
@ApiOperation("修改")
@PostMapping("/update")
public Result update() {
return new Result<>();
}
@ApiOperation("详情")
@GetMapping("/details")
public Result get() {
return new Result<>();
}
@ApiOperation("列表")
@GetMapping("/list")
public Result getList() {
return new Result<>();
}
@ApiOperation("分页列表")
@PostMapping("/paged")
public Result getPagedList() {
return new Result<>();
}
}
| [
"qcm89757@163.com"
] | qcm89757@163.com |
be340ca901ddc3054af2b4cc93d98563b4459142 | 131ec771ff471de138f72e0ea5c069caee0e9c8c | /src/main/java/top/fanfpy/app/mapper/BaizhuAdminMapper.java | e9826b985dad78375e7dbf98a28bcf63d0d44258 | [] | no_license | xiatian98/AppForfanfpy | bd364bfc3045e32acbb4cdfef8fad8c3183c42a4 | 23dd20502615379210e8cd244f5e78b9fcb2c6c4 | refs/heads/master | 2023-04-17T02:51:30.588526 | 2021-05-08T07:45:30 | 2021-05-08T07:45:30 | 365,450,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 283 | java | package top.fanfpy.app.mapper;
import top.fanfpy.app.entity.BaizhuAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author znn
* @since 2021-04-26
*/
public interface BaizhuAdminMapper extends BaseMapper<BaizhuAdmin> {
}
| [
"522516416@qq.com"
] | 522516416@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.