blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
00bca87ba6168956999d69ec82814099a00a7116 | 22ff3bbd229915106d646b31c3598ef3e43a3f7f | /src/main/java/com/samarin/utils/json/MessageDeserializer.java | 2b38d03451b0648c7edfdf85da7edcb1487d0b1a | [] | no_license | alexvbg/TestTask | f0c508d6b40b3e74128489e95a597017668ded79 | 3bd7cccfc1005265e99e382a504d7a383aa79431 | refs/heads/master | 2020-04-18T02:09:22.628970 | 2019-01-27T15:05:16 | 2019-01-27T15:05:16 | 167,150,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 749 | java | package com.samarin.utils.json;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.samarin.websocket.model.Message;
import java.lang.reflect.Type;
public class MessageDeserializer implements JsonDeserializer<Message> {
@Override
public Message deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
JsonElement name = jsonElement.getAsJsonObject().get("name");
JsonElement msg = jsonElement.getAsJsonObject().get("msg");
return Message.builder().name(name.getAsString()).msg(msg.toString()).build();
}
}
| [
"[email protected]"
] | |
68484a6f5127867575687a228a6458a7b8813c5b | a4aecdec84415c6920cebc7d941424c2a55e662c | /SMNApi/src/main/java/com/vinhle/smn/api/model/response/UpdateBillReturnedResponse.java | b45dedaa07e1a0295307dce7bd3ef5d573e85b38 | [] | no_license | vinhle1001/smn | 9e873c1f9b63abb2115aad164f5ed54e5e7e78f9 | e5a5bdcc11e08ffcf5247bce4b81109c617c2819 | refs/heads/master | 2021-03-22T00:12:54.321407 | 2017-07-12T16:26:47 | 2017-07-12T16:26:47 | 95,195,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package com.vinhle.smn.api.model.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/**
* Created by VinhLe on 6/5/2017.
*/
public class UpdateBillReturnedResponse extends BaseResponse {
private List<UpdateBillReturnedDetailResponse> billReturnedDetailResponses;
public UpdateBillReturnedResponse(int code, String message) {
super(code, message);
}
public UpdateBillReturnedResponse(int code, String message, List<UpdateBillReturnedDetailResponse> billReturnedDetailResponses) {
super(code, message);
this.billReturnedDetailResponses = billReturnedDetailResponses;
}
@JsonProperty("bill_returned_details")
public List<UpdateBillReturnedDetailResponse> getBillReturnedDetailResponses() {
return billReturnedDetailResponses;
}
public void setBillReturnedDetailResponses(List<UpdateBillReturnedDetailResponse> billReturnedDetailResponses) {
this.billReturnedDetailResponses = billReturnedDetailResponses;
}
}
| [
"[email protected]"
] | |
7c0424e9851264b86c6a8ca2de15b7a1aff772d8 | 9d293700ec97033283166f4aa48238c9d9ba6afc | /emptask/src/com/deloitte/empl/beans/Emp.java | 450ea42de97db148a9e5458feceaf43a65cfd06e | [] | no_license | ashish001rathod/emptask | 65cc000c1f0467bda2ea94505acdb690deb52ded | 6fbcd145365b908103f06afe1c484c24e8cff2df | refs/heads/master | 2020-12-11T11:16:22.621225 | 2020-01-14T12:14:15 | 2020-01-14T12:14:15 | 233,833,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,494 | java | package com.deloitte.empl.beans;
public class Emp {
private int empno;
private String ename;
private String job;
private int mgr;
private String hiredate;
private double sal;
private double comm;
private int deptno;
public Emp() {
// TODO Auto-generated constructor stub
}
public Emp(int empno, String ename, String job, int mgr, String hiredate, double sal, double comm, int deptno) {
this.empno = empno;
this.ename = ename;
this.job = job;
this.mgr = mgr;
this.hiredate = hiredate;
this.sal = sal;
this.comm = comm;
this.deptno = deptno;
}
public int getEmpno() {
return empno;
}
public void setEmpno(int empno) {
this.empno = empno;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public int getMgr() {
return mgr;
}
public void setMgr(int mgr) {
this.mgr = mgr;
}
public String getHiredate() {
return hiredate;
}
public void setHiredate(String hiredate) {
this.hiredate = hiredate;
}
public double getSal() {
return sal;
}
public void setSal(double sal) {
this.sal = sal;
}
public double getComm() {
return comm;
}
public void setComm(double comm) {
this.comm = comm;
}
public int getDeptno() {
return deptno;
}
public void setDeptno(int deptno) {
this.deptno = deptno;
}
}
| [
"[email protected]"
] | |
c1cffde8d6023fe8de7bbddfa0583d57d30b020b | 0ebb62397005bc8e1208ba0f41338a0c1ab7f485 | /RoadRushFull/src/kysk/roadrush/full/vehicles/direction/TaxiDirection.java | 96bb0ec72a89354822aeaf93ed7aa900fd3afb0d | [] | no_license | vijaykolagani/Sample-Codes | c0cda8b6a9441c676697b283bbb20258c48ece29 | 01d05508b6b319f38dcbf82217bdb709915d3d7b | refs/heads/master | 2021-01-10T01:59:54.958186 | 2016-03-29T18:14:01 | 2016-03-29T18:20:22 | 54,812,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,901 | java | package kysk.roadrush.full.vehicles.direction;
import kysk.roadrush.full.vehicles.Taxi;
import android.graphics.Canvas;
public class TaxiDirection implements VehicleDirection {
private Taxi taxi;
private int track;
public TaxiDirection(Taxi taxi, int track) {
this.taxi = taxi;
this.track = track;
}
public void vehiclePath(int direction, int width, int height, Canvas canvas) {
switch (direction) {
case 0:
leftPath(0, width, height, canvas);
break;
case 1:
leftPath(1, width, height, canvas);
break;
case 2:
leftPath(2, width, height, canvas);
break;
case 3:
leftPath(3, width, height, canvas);
break;
case 4:
rightPath(0, width, height, canvas);
break;
case 5:
rightPath(1, width, height, canvas);
break;
case 6:
rightPath(2, width, height, canvas);
break;
case 7:
rightPath(3, width, height, canvas);
break;
case 8:
topPath(0, width, height, canvas);
break;
case 9:
topPath(1, width, height, canvas);
break;
case 10:
topPath(2, width, height, canvas);
break;
case 11:
topPath(3, width, height, canvas);
break;
case 12:
bottomPath(0, width, height, canvas);
break;
case 13:
bottomPath(1, width, height, canvas);
break;
case 14:
bottomPath(2, width, height, canvas);
break;
case 15:
bottomPath(3, width, height, canvas);
break;
}
}
public void rightPath(int path, int width, int height, Canvas canvas) {
taxi.setStartX(canvas.getWidth() + width);
switch (track) {
case 1:
case 2:
case 3:
switch (path) {
case 0:
taxi.setStartY(canvas.getHeight() / 2 + height / 2 + 10);
break;
case 1:
taxi.setStartY(canvas.getHeight() / 2 + 5);
break;
case 2:
taxi.setStartY(canvas.getHeight() / 2 - height / 2 - 2);
break;
case 3:
taxi.setStartY(canvas.getHeight() / 2 - height - 10);
break;
}
break;
case 4:
switch (path) {
case 0:
taxi.setStartY(canvas.getHeight() / 2 + 2 * height - 47);
break;
case 1:
taxi.setStartY(canvas.getHeight() / 2 + height / 2 + 5);
break;
case 2:
taxi.setStartY(canvas.getHeight() / 2 - height - 2);
break;
case 3:
taxi.setStartY(canvas.getHeight() / 2 - 2 * height + 25);
break;
}
break;
}
}
public void leftPath(int path, int width, int height, Canvas canvas) {
taxi.setStartX(0 - width);
switch (track) {
case 1:
case 2:
case 3:
switch (path) {
case 0:
taxi.setStartY(canvas.getHeight() / 2 + height / 2 + 10);
break;
case 1:
taxi.setStartY(canvas.getHeight() / 2 + 5);
break;
case 2:
taxi.setStartY(canvas.getHeight() / 2 - height / 2 - 2);
break;
case 3:
taxi.setStartY(canvas.getHeight() / 2 - height - 10);
break;
}
break;
case 4:
switch (path) {
case 0:
taxi.setStartY(canvas.getHeight() / 2 + 2 * height - 47);
break;
case 1:
taxi.setStartY(canvas.getHeight() / 2 + height / 2 + 5);
break;
case 2:
taxi.setStartY(canvas.getHeight() / 2 - height - 2);
break;
case 3:
taxi.setStartY(canvas.getHeight() / 2 - 2 * height + 25);
break;
}
break;
}
}
public void topPath(int path, int width, int height, Canvas canvas) {
taxi.setStartY(0 - height);
switch (track) {
case 1:
case 2:
switch (path) {
case 0:
taxi.setStartX(canvas.getWidth() / 2 - width - 20);
break;
case 1:
taxi.setStartX(canvas.getWidth() / 2 - width / 2 - 10);
break;
case 2:
taxi.setStartX(canvas.getWidth() / 2 + 10);
break;
case 3:
taxi.setStartX(canvas.getWidth() / 2 + width);
break;
}
break;
case 3:
case 4:
switch (path) {
case 0:
taxi.setStartX(canvas.getWidth() / 2 - 2 * width - 15);
break;
case 1:
taxi.setStartX(canvas.getWidth() / 2 - width - 25);
break;
case 2:
taxi.setStartX(canvas.getWidth() / 2 + width);
break;
case 3:
taxi.setStartX(canvas.getWidth() / 2 + 2 * width - 10);
break;
}
break;
}
}
public void bottomPath(int path, int width, int height, Canvas canvas) {
taxi.setStartY(canvas.getHeight() + height);
switch (track) {
case 1:
case 2:
switch (path) {
case 0:
taxi.setStartX(canvas.getWidth() / 2 - width - 20);
break;
case 1:
taxi.setStartX(canvas.getWidth() / 2 - width / 2 - 10);
break;
case 2:
taxi.setStartX(canvas.getWidth() / 2 + 10);
break;
case 3:
taxi.setStartX(canvas.getWidth() / 2 + width);
break;
}
break;
case 3:
case 4:
switch (path) {
case 0:
taxi.setStartX(canvas.getWidth() / 2 - 2 * width - 15);
break;
case 1:
taxi.setStartX(canvas.getWidth() / 2 - width - 25);
break;
case 2:
taxi.setStartX(canvas.getWidth() / 2 + width);
break;
case 3:
taxi.setStartX(canvas.getWidth() / 2 + 2 * width - 10);
break;
}
break;
}
}
}
| [
"[email protected]"
] | |
4812703141a34f7b32d61305646f375edaf76fb4 | f24645a466680b28dbea7a1a199c91b1ad132826 | /src/com/meer07/qiitamagazine/JsonParse.java | 368db4bbadbc788ecf5a0681e2fd663f3ccd658e | [] | no_license | hinaloe/QiitaReader | 6e98fa898920337710372b9c581d98b8cd48d929 | fc302075208357d7a8166403e0595929ef1b0607 | refs/heads/master | 2020-12-11T07:21:37.566820 | 2014-11-13T16:37:10 | 2014-11-13T16:37:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,763 | java | package com.meer07.qiitamagazine;
import java.util.List;
import android.os.AsyncTask;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
// Androidでは非同期通信以外はNG
public class JsonParse extends AsyncTask<String, Integer, List<NewPost>>{
private ListAdapter adapter;
public JsonParse(ListAdapter adapter) {
// TODO Auto-generated constructor stub
super();
this.adapter = adapter;
}
// Gsonを利用してNewPostクラスにparse
public List<NewPost> json_Parse(String path){
HttpRequest request = new HttpRequest();
String jsonString = request.Request(path);
Log.d("JSON",jsonString);
Gson gson = new Gson();
List<NewPost> timeline = gson.fromJson(jsonString,new TypeToken<List<NewPost>>(){}.getType());
return timeline;
}
// バックグラウンドで通信と第一段階のパース(リストにする)を行う
@Override
protected List<NewPost> doInBackground(String... params) {
// TODO Auto-generated method stub
String path = params[0];
Log.d("myapp", path);
List<NewPost> posts = json_Parse(path);
return posts;
}
// 第二段階のパースを行った後、アダプタにデータを追加する
@Override
protected void onPostExecute(List<NewPost> posts){
String tag = "";
if(posts != null){
for (int i = 0; i < posts.size(); i++) {
NewPost post = posts.get(i);
String title = new String(post.getTitle());
String url = new String(post.getURL());
String time = new String(post.getCreateTimes());
String stock = new String(post.getStock());
for (Tags tags : post.getTags()) {
tag = tags.getName();
}
String[] list = {title,url,tag,time,stock};
adapter.add(list);
}
}
}
}
| [
"[email protected]"
] | |
4f43ef0e2ea5836546cd982e55044decaf9fe99b | 5cfefced873b6b1090895017bbb115c0bfa7c464 | /Ch03/src/p71/IncreaseDecreaseOperatorExample.java | a0317d0f83ef63ac09ffbdce330cd54c9e1f2c30 | [] | no_license | jangbigom91/Java | 840ebe406e865747a1b5cb3fc6907b6ecaa6db9a | d166f56b3956f8052f63467a0cb574947b018e53 | refs/heads/master | 2022-12-31T18:42:43.438781 | 2020-10-27T01:09:23 | 2020-10-27T01:09:23 | 259,795,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package p71;
public class IncreaseDecreaseOperatorExample {
public static void main(String[] args) {
int x = 10;
int y = 10;
int z;
System.out.println("---------------");
x++;
++x;
System.out.println("x = "+x);
System.out.println("---------------");
y--;
--y;
System.out.println("y = "+y);
System.out.println("---------------");
z = x++;
System.out.println("z = "+z);
System.out.println("x = "+x);
System.out.println("---------------");
z = ++x;
System.out.println("z = "+z);
System.out.println("x = "+x);
System.out.println("---------------");
z = ++x + y++;
System.out.println("z = "+z);
System.out.println("x = "+x);
System.out.println("y = "+y);
}
}
| [
"[email protected]"
] | |
bbe1c5f6649d24edbe7235a8482f4e005f7899bc | 6f37baf30d68901652ed169e8e3b4cabeef3b3bd | /chapter_010/platformmachines/src/main/java/ru/rzaharov/models/Car.java | b4ec8860f7fbdfe6e32203fed9f8cf6c46a4a6f7 | [
"Apache-2.0"
] | permissive | ryslanzaharov/rzaharov | 6ded6903a79fa9b0fbd2887d569a086dfa67d49e | f57692ef7a91abbd084e366b63fd17f728f17bbb | refs/heads/master | 2022-11-24T10:56:21.357763 | 2019-12-07T13:28:24 | 2019-12-07T13:28:24 | 99,967,792 | 0 | 0 | Apache-2.0 | 2022-11-16T10:54:58 | 2017-08-10T21:53:59 | Java | UTF-8 | Java | false | false | 1,144 | java | package ru.rzaharov.models;
import lombok.Data;
import javax.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "car") @Data
public class Car {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "mark")
private String mark;
@Column(name = "model")
private String model;
@Column(name = "body_type")
private String body_type;
@Column(name = "price")
private Integer price;
@Column(name = "sale")
private String sale;
@ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
@JoinColumn(name = "engine_id")
private Engine engine;
@ManyToOne(cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER)
@JoinColumn(name = "user_id")
private User user;
@ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
@JoinColumn(name = "condition_id")
private Condition condition;
@Column(name = "photo")
private String photo;
@Column(name = "dates")
private Timestamp date;
public Car() {}
public Car(int id) {
this.id = id;
}
}
| [
"[email protected]"
] | |
dfd4c3be0f83851b4d8744bfa591054da2da28b5 | 94f2497ce8b26f7b0c28d225a5e685b6445479c9 | /src/functions/performingField/SetShip.java | d6a8e91a0bc9f116822960f2b5e19ae319544f31 | [] | no_license | AidarValshin/BattleShipGame | e207a02740d0863424dedd1bb3aa96f8f0e7974a | 146b0180c20e7a0e94ae09d5439e3833a5dcdca5 | refs/heads/master | 2022-12-17T08:14:34.174785 | 2020-09-05T15:38:05 | 2020-09-05T15:38:05 | 293,103,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,105 | java | package functions.performingField;
import structure.Field;
import structure.Ship;
public class SetShip {
public static boolean setShip(Field field, int x, int y, int axis, Ship ship) { //axis 1 - Field.getVertical(); 2 - gorizontal
if (x > -1 && y > -1) {
if (x < Field.getSizeField() && y < Field.getSizeField()) {
if (axis == Field.getHorizontal()) {
return setShipHorizontal(field.getField(), x, y, ship);
}
if (axis == Field.getVertical()) { //vertically
return setShipVertical(field.getField(), x, y, ship);
}
}
}
return false;
}
private static boolean setShipVertical(int[][] field, int x, int y, Ship ship) {
int max = y + ship.getLength() - 1;
if (max < Field.getSizeField()) {
int maxSide = max + 1;
if (max < 9) {
max++;
}
for (int i = y; i < max + 1; i++)
if (field[i][x] != Field.getClearCell()) {
return false;
}
if (y > 0 && field[y - 1][x] != Field.getClearCell()) {
return false;
}
if (x > 0) {
for (int i = y; i < maxSide; i++)
if (field[i][(x - 1)] != Field.getClearCell()) {
return false;
}
}
if (x < 9) {
for (int i = y; i < maxSide; i++)
if (field[i][x + 1] != Field.getClearCell()) {
return false;
}
}
for (int i = y; i < y + ship.getLength(); i++) {
field[i][x] = (ship.getNumberInField() + Field.getAddVertical());
}
return true;
}
return false;
}
private static boolean setShipHorizontal(int[][] field, int x, int y, Ship ship) {
int max = x + ship.getLength() - 1;
if (max < Field.getSizeField()) {
int maxSide = max + 1;
if (max < 9) {
max++;
}
for (int i = x; i < max + 1; i++)
if (field[y][i] != Field.getClearCell()) {
return false;
}
if (x > 0 && field[y][x - 1] != Field.getClearCell()) {
return false;
}
if (y > 0) {
if (max < 9)
for (int i = x; i < maxSide; i++)
if (field[y - 1][i] != Field.getClearCell()) {
return false;
}
}
if (y < 9) {
for (int i = x; i < maxSide; i++)
if (field[y + 1][i] != Field.getClearCell()) {
return false;
}
}
for (int i = x; i < x + ship.getLength(); i++) {
field[y][i] = ship.getNumberInField();
}
return true;
}
return false;
}
}
| [
"[email protected]"
] | |
df5c3658b723179699fd1857bd1271e03d28907b | c8df418e292665aebe71a700b37c7f5fc5e0081d | /Test/src/sort/Client.java | 71ce4f47ffb2457ef62cc1968e49c1ec79ccbfc0 | [] | no_license | ziew323/Design-Pattern | be5cd4dff0f0a4cb183861f9f70acc6606ba85bd | d255de35920753336f722bb3e6e5398594542f49 | refs/heads/master | 2021-01-10T01:47:56.053882 | 2017-05-05T10:21:41 | 2017-05-05T10:21:41 | 53,837,083 | 0 | 0 | null | 2016-11-21T01:39:00 | 2016-03-14T07:54:08 | Java | UTF-8 | Java | false | false | 218 | java | package sort;
public class Client {
public static void main(String[] args) {
int a[] = { 3, 8, 5, 7, 2, 4, 6, 1 };
SortUtil.print(a);
Sort.mergeSort(a);
SortUtil.print(a);
}
}
| [
"[email protected]"
] | |
2b8dafea4b1454f8e8df4889e24f1dfaa5dfac39 | 3712c486a9106ca759f3c12ed30aea881e01328b | /src/main/java/me/alextur/matlab/model/test/TestQuestion.java | 49c525a6eb0e26efe1e538952622f0b0c422163b | [] | no_license | Akirus/octave-web-app | a4096f2a74ad5552320c3c319c5246fcef932a14 | d9589f76bb469522046d3cee23812dbd0ee935a5 | refs/heads/master | 2021-09-14T12:23:48.994023 | 2018-05-13T19:21:26 | 2018-05-13T19:27:05 | 111,212,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package me.alextur.matlab.model.test;
import com.fasterxml.jackson.annotation.JsonIgnore;
import me.alextur.matlab.model.user.StudentGroup;
import javax.persistence.*;
import java.util.List;
@Entity
public class TestQuestion {
private Test test;
private Long id;
private List<TestVariant> variants;
private String content;
public String getContent() {
return content;
}
public void setContent(String pContent) {
content = pContent;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@ManyToOne
@JoinColumn(name = "test_id")
@JsonIgnore
public Test getTest() {
return test;
}
public void setTest(Test test) {
this.test = test;
}
@OneToMany(mappedBy = "testQuestion", fetch = FetchType.LAZY)
@JsonIgnore
public List<TestVariant> getVariants() {
return variants;
}
public void setVariants(List<TestVariant> variants) {
this.variants = variants;
}
}
| [
"[email protected]"
] | |
ef078f862f5624b527b5d03bdddcd0c6b4c170f2 | 602e8732331f9e3a092cd270f1546511644a38d5 | /ws-uprunning/src/main/java/utils/aws/HTTPHeaders.java | bf301043c9e0df38645b4ba1a4f36c865805cfc5 | [] | no_license | fabianormatias/web-services-soap | 9c8b5a03af544c6c9961c18fd631d9faa65e1aed | 86f99513584fd9f9bc3e4c0d94d121182d8ebe02 | refs/heads/master | 2021-01-09T21:46:52.027934 | 2015-12-17T18:20:42 | 2015-12-17T18:20:42 | 48,174,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,395 | java |
package utils.aws;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Header" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="Value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"header"
})
@XmlRootElement(name = "HTTPHeaders")
public class HTTPHeaders {
@XmlElement(name = "Header")
protected List<HTTPHeaders.Header> header;
/**
* Gets the value of the header property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the header property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getHeader().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link HTTPHeaders.Header }
*
*
*/
public List<HTTPHeaders.Header> getHeader() {
if (header == null) {
header = new ArrayList<HTTPHeaders.Header>();
}
return this.header;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="Value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class Header {
@XmlAttribute(name = "Name", required = true)
protected String name;
@XmlAttribute(name = "Value", required = true)
protected String value;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
}
}
| [
"[email protected]"
] | |
eb931e9f6fd0f250ce6e7d40b438d98359fd0ece | fc5d0758fc9404e0f74cd48e0965c9721d688e14 | /target/tomcat/work/Tomcat/localhost/mall/org/apache/jsp/WEB_002dINF/views/main_jsp.java | c74f1b9b8834d50bada2a6886e79d4a794d951b5 | [] | no_license | weathernet/mail | 3a36195bdeda0ef024298ecb35edb117fef3b6f8 | c1ebcb8af5a8c4adf66697c889b5dd2801cb298c | refs/heads/master | 2020-03-18T19:11:12.829105 | 2018-05-28T09:39:47 | 2018-05-28T09:39:47 | 135,139,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,508 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2018-05-28 06:53:38 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.WEB_002dINF.views;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class main_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
out.write("<title>主界面</title>\r\n");
out.write("<link type=\"text/css\" rel=\"stylesheet\" href=\"css/css.css\">\r\n");
out.write("<script src=\"js/jquery-1.9.1.min.js\"></script>\r\n");
out.write("<script src=\"js/index.js\"></script>\r\n");
out.write("</head>\r\n");
out.write("<body>主界面 欢迎用户: ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.user.name}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("<div class=\"box\">\r\n");
out.write("\t<!-- 存放大图的容器-->\r\n");
out.write("\t<div class=\"all\">\r\n");
out.write("\t\t<div class=\"top-img\">\r\n");
out.write("\t\t\t<div class=\"activeimg\">\r\n");
out.write("\t\t\t\t<img src=\"img/1.jpg\">\r\n");
out.write("\t\t\t\t<img src=\"img/2.jpg\">\r\n");
out.write("\t\t\t\t<img src=\"img/3.jpg\">\r\n");
out.write("\t\t\t\t<img src=\"img/4.jpg\">\r\n");
out.write("\t\t\t\t<img src=\"img/5.jpg\">\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t\t<div class=\"left\"><img src=\"img/left.png\"> </div>\r\n");
out.write("\t\t\t<div class=\"right\"><img src=\"img/right.png\"></div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t\t<!-- 存放缩略图的容器-->\r\n");
out.write("\t\t<div class=\"bot-img\">\r\n");
out.write("\t\t\t<ul>\r\n");
out.write("\t\t\t\t<li class=\"active\"><img src=\"img/1.jpg\"> </li>\r\n");
out.write("\t\t\t\t<li><img src=\"img/2.jpg\"> </li>\r\n");
out.write("\t\t\t\t<li><img src=\"img/3.jpg\"> </li>\r\n");
out.write("\t\t\t\t<li><img src=\"img/4.jpg\"> </li>\r\n");
out.write("\t\t\t\t<li><img src=\"img/5.jpg\"> </li>\r\n");
out.write("\t\t\t</ul>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t</div>\r\n");
out.write("</div>\r\n");
out.write("\r\n");
out.write("<div style=\"text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';\">\r\n");
out.write("\r\n");
out.write("</div>\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"Administrator@SKY-20180527WCX"
] | Administrator@SKY-20180527WCX |
89ca91418b8dfbb4027b6eee9230515f137c08b7 | 900a4bed90756232c19f0dedd5b76ee4685be07d | /src/test/java/org/springbyexample/aspectjLoadTimeWeaving/ProcessorTest.java | 9bc6f3c4d82aa829c63180a7e771d981302e6997 | [
"Apache-2.0"
] | permissive | karian7/ltw-not-working-since-junit-v4_7 | b9aed65ffd1db0e9965f26a1afc863aefbe4dbbd | ee38f4894f54b55333c0cf07e060d36543f621df | refs/heads/master | 2021-01-16T19:18:24.079527 | 2012-05-10T03:36:58 | 2012-05-10T03:36:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,086 | java | /*
* Copyright 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springbyexample.aspectjLoadTimeWeaving;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Tests processor for advice.
*
* Not the best test since it can only be seen in logging output.
*
* @author David Winterfeldt
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext.xml"})
public class ProcessorTest {
final Logger logger = LoggerFactory.getLogger(ProcessorTest.class);
@Autowired
private final Processor processor = null;
/**
* Tests processor from the Spring context.
*/
@Test
public void testProcessorFromContext() {
assertNotNull("Processor is null.", processor);
logger.debug("Running processor from Spring context.");
processor.process();
}
/**
* Tests processor created outside the Spring context.
*/
@Test
public void testProcessor() {
Processor processor = new Processor();
logger.debug("Running processor from outside the Spring context.");
processor.process();
}
}
| [
"[email protected]"
] | |
e70cd66f4bcea0c70598d3c3a08a4cc804e1ad52 | bf3991df248015702543905add240ac7596efacf | /spring-boot-nacos/nacos-spring/src/main/java/com/hzw/learn/nacos/nacosconfig/NacosConfiguration.java | ebd995338dfd0a4a2e6f0f6eb0581a0484d64516 | [] | no_license | ZhengweiHou/spring-boot-parent-hzw | d11d6e2561cdc426a7100ea1f8e7861fc15a962a | 980ad8cc94c9b828838dc3b8ec4cfb59a6f6615b | refs/heads/master | 2023-08-29T02:39:41.152579 | 2023-08-08T01:08:15 | 2023-08-08T01:08:15 | 121,196,260 | 1 | 2 | null | 2023-02-21T06:20:34 | 2018-02-12T03:39:47 | Java | UTF-8 | Java | false | false | 1,094 | java | package com.hzw.learn.nacos.nacosconfig;
import com.alibaba.nacos.api.annotation.NacosProperties;
import com.alibaba.nacos.spring.context.annotation.config.EnableNacosConfig;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import com.alibaba.nacos.spring.context.annotation.config.NacosValueAnnotationBeanPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
// nacos地址可以通过-D方式指定,如:-Dnacos.server-addr=127.0.0.1:8148 -Dnacos.namespace=test
@EnableNacosConfig(globalProperties = @NacosProperties(serverAddr = "127.0.0.1:8148",namespace = "test"))
//@EnableNacosConfig
@NacosPropertySource(dataId = "test",groupId = "test",autoRefreshed = true)
@NacosPropertySource(dataId = "test2",groupId = "test",autoRefreshed = true)
public class NacosConfiguration {
// @Bean
// public NacosValueAnnotationBeanPostProcessor nbabpp(){
// System.out.println("xxxxxxxxxxxx");
// return new NacosValueAnnotationBeanPostProcessor();
// }
}
| [
"[email protected]"
] | |
fd9e996ace5b542e07aef1f24e5e2955ada8d2f7 | 35a6cfebd3931c16ea6af650dbbc67c0a25151df | /ribbon/order-consumer/src/main/java/com/huan/study/vo/ProductVO.java | 70ec778d429d1e91683de89a1fee782d38421ae9 | [
"Apache-2.0"
] | permissive | Lilicheng123/spring-cloud-parent | 2f86eaf280161a0643615329655599265912bdd4 | 1e378eb1d2c19c91ec6a0a1a0438bb9bdd14a008 | refs/heads/master | 2022-02-13T06:57:53.517635 | 2018-08-28T09:22:44 | 2018-08-28T09:22:44 | 192,892,545 | 0 | 0 | Apache-2.0 | 2022-01-21T23:26:04 | 2019-06-20T09:38:39 | Java | UTF-8 | Java | false | false | 303 | java | package com.huan.study.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 商品实体类
*
* @author huan.fu
* @date 2018/5/28 - 16:30
*/
@Data
public class ProductVO {
private String productId;
private String productName;
private BigDecimal productPrice;
private Integer status;
}
| [
"[email protected]"
] | |
ab72c891ed8963b1f339f4d2a9ab7980754e58c7 | aa2d83e50224bfbdfca50e179d0df705cefe39c7 | /STADT.java | 13c1e09a46495f5a2dafd66ca6fec0ce3fd3a4e8 | [] | no_license | lisaG63/CS400P2 | 5fa196af4ee26ac1a2b9e29912bc9eca5183a0c1 | 43e7dec6ed5e6add7bb639fca7cd48b90aa9e065 | refs/heads/main | 2023-04-08T12:32:25.433503 | 2021-03-29T20:13:29 | 2021-03-29T20:13:29 | 352,771,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,587 | java | import java.util.List;
// DO NOT EDIT THIS INTERFACE IN ANY WAY -- DO NOT SUBMIT
/**
* Defines the additional operations required of student's BST class.
*
* @author Deb Deppeler ([email protected])
* @param <K> A Comparable type to be used as a key to an associated value.
* @param <V> A value associated with the given key.
*/
public interface STADT<K extends Comparable<K>,V> {
/**
* Returns the key that is in the root node of this BST.
* If root is null, returns null.
* @return key found at root node, or null
*/
K getKeyAtRoot() ;
/**
* Tries to find a node with a key that matches the specified key.
* If a matching node is found, it returns the returns the key that is in the left child.
* If the left child of the found node is null, returns null.
*
* @param key A key to search for
* @return The key that is in the left child of the found key
*
* @throws IllegalNullKeyException if key argument is null
* @throws KeyNotFoundException if key is not found in this BST
*/
K getKeyOfLeftChildOf(K key) throws IllegalNullKeyException, KeyNotFoundException;
/**
* Tries to find a node with a key that matches the specified key.
* If a matching node is found, it returns the returns the key that is in the right child.
* If the right child of the found node is null, returns null.
*
* @param key A key to search for
* @return The key that is in the right child of the found key
*
* @throws IllegalNullKeyException if key is null
* @throws KeyNotFoundException if key is not found in this BST
*/
K getKeyOfRightChildOf(K key) throws IllegalNullKeyException, KeyNotFoundException;
/**
* Returns the height of this BST.
* H is defined as the number of levels in the tree.
*
* If root is null, return 0
* If root is a leaf, return 1
* Else return 1 + max( height(root.left), height(root.right) )
*
* Examples:
* A BST with no keys, has a height of zero (0).
* A BST with one key, has a height of one (1).
* A BST with two keys, has a height of two (2).
* A BST with three keys, can be balanced with a height of two(2)
* or it may be linear with a height of three (3)
* ... and so on for tree with other heights
*
* @return the number of levels that contain keys in this BINARY SEARCH TREE
*/
int getHeight();
/**
* Returns the keys of the data structure in sorted order.
* In the case of binary search trees, the visit order is: L V R
*
* If the SearchTree is empty, an empty list is returned.
*
* @return List of Keys in-order
*/
List<K> getInOrderTraversal();
/**
* Returns the keys of the data structure in pre-order traversal order.
* In the case of binary search trees, the order is: V L R
*
* If the SearchTree is empty, an empty list is returned.
*
* @return List of Keys in pre-order
*/
List<K> getPreOrderTraversal();
/**
* Returns the keys of the data structure in post-order traversal order.
* In the case of binary search trees, the order is: L R V
*
* If the SearchTree is empty, an empty list is returned.
*
* @return List of Keys in post-order
*/
List<K> getPostOrderTraversal();
/**
* Returns the keys of the data structure in level-order traversal order.
*
* The root is first in the list, then the keys found in the next level down,
* and so on.
*
* If the SearchTree is empty, an empty list is returned.
*
* @return List of Keys in level-order
*/
List<K> getLevelOrderTraversal();
/**
* Add the key,value pair to the data structure and increase the number of keys.
* If key is null, throw IllegalNullKeyException;
* If key is already in data structure, throw DuplicateKeyException();
* Do not increase the num of keys in the structure, if key,value pair is not added.
*/
void insert(K key, V value) throws IllegalNullKeyException, DuplicateKeyException;
/**
* If key is found, remove the key,value pair from the data structure
* and decrease num keys, and return true.
* If key is not found, do not decrease the number of keys in the data structure.
* If key is null, throw IllegalNullKeyException
* If key is not found, return false.
*/
boolean remove(K key) throws IllegalNullKeyException;
/**
* Returns the value associated with the specified key
*
* Does not remove key or decrease number of keys
* If key is null, throw IllegalNullKeyException
* If key is not found, throw KeyNotFoundException().
*/
V get(K key) throws IllegalNullKeyException, KeyNotFoundException;
/**
* Returns true if the key is in the data structure
* If key is null, throw IllegalNullKeyException
* Returns false if key is not null and is not present
*/
boolean contains(K key) throws IllegalNullKeyException;
/**
* Returns the number of key,value pairs in the data structure
*/
int numKeys();
/**
* Print the tree.
*
* For our testing purposes: all keys that we insert in the tree
* will have a string length of exactly 2 characters.
* example: numbers 10-99, or strings aa - zz, or AA to ZZ
*
* This makes it easier for you to not worry about spacing issues.
*
* You can display in any of a variety of ways, but we should see
* a tree that we can identify left and right children of each node
*
* For example:
| |-------50
|-------40
| |-------35
30
|-------20
| |-------10
Look from bottom to top. Inorder traversal of above tree (10,20,30,35,40,50)
Or, you can display a tree of this kind.
30
/\
/ \
20 40
/ /\
/ / \
10 35 50
Or, you can come up with your own orientation pattern, like this.
10
20
30
35
40
50
The connecting lines are not required if we can interpret your tree.
*/
public void print();
} // [email protected]
| [
"[email protected]"
] | |
c59adbaa0542a6ed88ef0f2c1a684b2e0c63b14f | 1c18616fb66d5d0316beb2df68676029b405c3dd | /src/main/java/students/linda_junkina/lesson_4/level_2/task_5/Task5.java | d9f72699b9ec1ab079ac99a52cad10384c785da0 | [] | no_license | Vija-M/jg-java-1-online-spring-april-tuesday-2021 | edb4c73cc4a13bdaa132bccca6a1c6d0088b2d5d | 49817deb3052f24332442d2454932714915b50ad | refs/heads/main | 2023-07-14T03:16:12.145252 | 2021-08-24T16:20:50 | 2021-08-24T16:20:50 | 399,513,003 | 2 | 0 | null | 2021-08-24T15:17:35 | 2021-08-24T15:17:34 | null | UTF-8 | Java | false | false | 117 | java | package students.linda_junkina.lesson_4.level_2.task_5;
class Task5 {
int firstNumber;
int secondNumber;
}
| [
"[email protected]"
] | |
09e8998fd9d02c3dbb6fd0ba19ce60d9dd4defcc | e70ac110c26b4e2b950e3d877d748a48de03a576 | /sdk_core/src/main/java/com/pandaq/appcore/cache/DiskLruCache.java | 9930cd432971e1ce187fcf48619098e51cd7978d | [] | no_license | yxj1990/PandaMvp | 62182ad4de21be8237880f1cbbae1998489ea2b8 | ad228c7d72233aad453ecf625c131dd4f3dbccd5 | refs/heads/master | 2020-07-07T15:01:55.499844 | 2019-08-15T02:58:03 | 2019-08-15T02:58:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35,168 | java | package com.pandaq.appcore.cache;/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except duration 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 duration writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* A cache that uses a bounded amount of space on a filesystem. Each cache
* entry has a string key and a fixed number of values. Each key must match
* the regex <strong>[a-z0-9_-]{1,120}</strong>. Values are byte sequences,
* accessible as streams or files. Each value must be between {@code 0} and
* {@code Integer.MAX_VALUE} bytes duration length.
* <p>
* <p>The cache stores its data duration a directory on the filesystem. This
* directory must be exclusive to the cache; the cache may delete or overwrite
* files from its directory. It is an error for multiple processes to use the
* same cache directory at the same time.
* <p>
* <p>This cache limits the number of bytes that it will store on the
* filesystem. When the number of stored bytes exceeds the limit, the cache will
* remove entries duration the background until the limit is satisfied. The limit is
* not strict: the cache may temporarily exceed it while waiting for files to be
* deleted. The limit does not include filesystem overhead or the cache
* journal so space-sensitive applications should set a conservative limit.
* <p>
* <p>Clients call {@link #edit} to create or update the values of an entry. An
* entry may have only one editor at one time; if a value is not available to be
* edited then {@link #edit} will return null.
* <ul>
* <li>When an entry is being <strong>created</strong> it is necessary to
* supply a full set of values; the empty value should be used as a
* placeholder if necessary.
* <li>When an entry is being <strong>edited</strong>, it is not necessary
* to supply data for every value; values default to their previous
* value.
* </ul>
* Every {@link #edit} call must be matched by a call to {@link Editor#commit}
* or {@link Editor#abort}. Committing is atomic: a read observes the full set
* of values as they were before or after the commit, but never a mix of values.
* <p>
* <p>Clients call {@link #get} to read a snapshot of an entry. The read will
* observe the value at the time that {@link #get} was called. Updates and
* removals after the call do not impact ongoing reads.
* <p>
* <p>This class is tolerant of some I/O errors. If files are missing from the
* filesystem, the corresponding entries will be dropped from the cache. If
* an error occurs while writing a cache value, the edit will fail silently.
* Callers should handle other problems by catching {@code IOException} and
* responding appropriately.
*/
public final class DiskLruCache implements Closeable {
private static final String JOURNAL_FILE = "journal";
private static final String JOURNAL_FILE_TEMP = "journal.tmp";
private static final String JOURNAL_FILE_BACKUP = "journal.bkp";
private static final String MAGIC = "libcore.io.DiskLruCache";
private static final String VERSION_1 = "1";
private static final long ANY_SEQUENCE_NUMBER = -1;
private static final String STRING_KEY_PATTERN = "[a-z0-9_-]{1,120}";
private static final Pattern LEGAL_KEY_PATTERN = Pattern.compile(STRING_KEY_PATTERN);
private static final String CLEAN = "CLEAN";
private static final String DIRTY = "DIRTY";
private static final String REMOVE = "REMOVE";
private static final String READ = "READ";
/*
* This cache uses a journal file named "journal". A typical journal file
* looks like this:
* libcore.io.DiskLruCache
* 1
* 100
* 2
*
* CLEAN 3400330d1dfc7f3f7f4b8d4d803dfcf6 832 21054
* DIRTY 335c4c6028171cfddfbaae1a9c313c52
* CLEAN 335c4c6028171cfddfbaae1a9c313c52 3934 2342
* REMOVE 335c4c6028171cfddfbaae1a9c313c52
* DIRTY 1ab96a171faeeee38496d8b330771a7a
* CLEAN 1ab96a171faeeee38496d8b330771a7a 1600 234
* READ 335c4c6028171cfddfbaae1a9c313c52
* READ 3400330d1dfc7f3f7f4b8d4d803dfcf6
*
* The first five lines of the journal form its header. They are the
* constant string "libcore.io.DiskLruCache", the disk cache's version,
* the application's version, the value count, and a blank line.
*
* Each of the subsequent lines duration the file is a record of the state of a
* cache entry. Each line contains space-separated values: a state, a key,
* and optional state-specific values.
* o DIRTY lines track that an entry is actively being created or updated.
* Every successful DIRTY action should be followed by a CLEAN or REMOVE
* action. DIRTY lines without a matching CLEAN or REMOVE indicate that
* temporary files may need to be deleted.
* o CLEAN lines track a cache entry that has been successfully published
* and may be read. A publish line is followed by the lengths of each of
* its values.
* o READ lines track accesses for LRU.
* o REMOVE lines track entries that have been deleted.
*
* The journal file is appended to as cache operations occur. The journal may
* occasionally be compacted by dropping redundant lines. A temporary file named
* "journal.tmp" will be used during compaction; that file should be deleted if
* it exists when the cache is opened.
*/
private final File directory;
private final File journalFile;
private final File journalFileTmp;
private final File journalFileBackup;
private final int appVersion;
private long maxSize;
private final int valueCount;
private long size = 0;
private Writer journalWriter;
private final LinkedHashMap<String, Entry> lruEntries =
new LinkedHashMap<String, Entry>(0, 0.75f, true);
private int redundantOpCount;
/**
* To differentiate between old and current snapshots, each entry is given
* a sequence number each time an edit is committed. A snapshot is stale if
* its sequence number is not equal to its entry's sequence number.
*/
private long nextSequenceNumber = 0;
/**
* This cache uses a single background thread to evict entries.
*/
private final ThreadPoolExecutor executorService =
new ThreadPoolExecutor(0, 1, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
private final Callable<Void> cleanupCallable = new Callable<Void>() {
public Void call() throws Exception {
synchronized (DiskLruCache.this) {
if (journalWriter == null) {
return null; // Closed.
}
trimToSize();
if (journalRebuildRequired()) {
rebuildJournal();
redundantOpCount = 0;
}
}
return null;
}
};
private DiskLruCache(File directory, int appVersion, int valueCount, long maxSize) {
this.directory = directory;
this.appVersion = appVersion;
this.journalFile = new File(directory, JOURNAL_FILE);
this.journalFileTmp = new File(directory, JOURNAL_FILE_TEMP);
this.journalFileBackup = new File(directory, JOURNAL_FILE_BACKUP);
this.valueCount = valueCount;
this.maxSize = maxSize;
}
/**
* Opens the cache duration {@code directory}, creating a cache if none exists
* there.
*
* @param directory a writable directory
* @param valueCount the number of values per cache entry. Must be positive.
* @param maxSize the maximum number of bytes this cache should use to store
* @throws IOException if reading or writing the cache directory fails
*/
public static DiskLruCache open(File directory, int appVersion, int valueCount, long maxSize)
throws IOException {
if (maxSize <= 0) {
throw new IllegalArgumentException("maxSize <= 0");
}
if (valueCount <= 0) {
throw new IllegalArgumentException("valueCount <= 0");
}
// If a bkp file exists, use it instead.
File backupFile = new File(directory, JOURNAL_FILE_BACKUP);
if (backupFile.exists()) {
File journalFile = new File(directory, JOURNAL_FILE);
// If journal file also exists just delete backup file.
if (journalFile.exists()) {
backupFile.delete();
} else {
renameTo(backupFile, journalFile, false);
}
}
// Prefer to pick up where we left off.
DiskLruCache cache = new DiskLruCache(directory, appVersion, valueCount, maxSize);
if (cache.journalFile.exists()) {
try {
cache.readJournal();
cache.processJournal();
return cache;
} catch (IOException journalIsCorrupt) {
System.out
.println("DiskLruCache "
+ directory
+ " is corrupt: "
+ journalIsCorrupt.getMessage()
+ ", removing");
cache.delete();
}
}
// Create a new empty cache.
directory.mkdirs();
cache = new DiskLruCache(directory, appVersion, valueCount, maxSize);
cache.rebuildJournal();
return cache;
}
private void readJournal() throws IOException {
StrictLineReader reader = new StrictLineReader(new FileInputStream(journalFile), CacheUtils.US_ASCII);
try {
String magic = reader.readLine();
String version = reader.readLine();
String appVersionString = reader.readLine();
String valueCountString = reader.readLine();
String blank = reader.readLine();
if (!MAGIC.equals(magic)
|| !VERSION_1.equals(version)
|| !Integer.toString(appVersion).equals(appVersionString)
|| !Integer.toString(valueCount).equals(valueCountString)
|| !"".equals(blank)) {
throw new IOException("unexpected journal header: [" + magic + ", " + version + ", "
+ valueCountString + ", " + blank + "]");
}
int lineCount = 0;
while (true) {
try {
readJournalLine(reader.readLine());
lineCount++;
} catch (EOFException endOfJournal) {
break;
}
}
redundantOpCount = lineCount - lruEntries.size();
// If we ended on a truncated line, rebuild the journal before appending to it.
if (reader.hasUnterminatedLine()) {
rebuildJournal();
} else {
journalWriter = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(journalFile, true), CacheUtils.US_ASCII));
}
} finally {
CacheUtils.closeQuietly(reader);
}
}
private void readJournalLine(String line) throws IOException {
int firstSpace = line.indexOf(' ');
if (firstSpace == -1) {
throw new IOException("unexpected journal line: " + line);
}
int keyBegin = firstSpace + 1;
int secondSpace = line.indexOf(' ', keyBegin);
final String key;
if (secondSpace == -1) {
key = line.substring(keyBegin);
if (firstSpace == REMOVE.length() && line.startsWith(REMOVE)) {
lruEntries.remove(key);
return;
}
} else {
key = line.substring(keyBegin, secondSpace);
}
Entry entry = lruEntries.get(key);
if (entry == null) {
entry = new Entry(key);
lruEntries.put(key, entry);
}
if (secondSpace != -1 && firstSpace == CLEAN.length() && line.startsWith(CLEAN)) {
String[] parts = line.substring(secondSpace + 1).split(" ");
entry.readable = true;
entry.currentEditor = null;
entry.setLengths(parts);
} else if (secondSpace == -1 && firstSpace == DIRTY.length() && line.startsWith(DIRTY)) {
entry.currentEditor = new Editor(entry);
} else if (secondSpace == -1 && firstSpace == READ.length() && line.startsWith(READ)) {
// This work was already done by calling lruEntries.get().
} else {
throw new IOException("unexpected journal line: " + line);
}
}
/**
* Computes the initial size and collects garbage as a part of opening the
* cache. Dirty entries are assumed to be inconsistent and will be deleted.
*/
private void processJournal() throws IOException {
deleteIfExists(journalFileTmp);
for (Iterator<Entry> i = lruEntries.values().iterator(); i.hasNext(); ) {
Entry entry = i.next();
if (entry.currentEditor == null) {
for (int t = 0; t < valueCount; t++) {
size += entry.lengths[t];
}
} else {
entry.currentEditor = null;
for (int t = 0; t < valueCount; t++) {
deleteIfExists(entry.getCleanFile(t));
deleteIfExists(entry.getDirtyFile(t));
}
i.remove();
}
}
}
/**
* Creates a new journal that omits redundant information. This replaces the
* current journal if it exists.
*/
private synchronized void rebuildJournal() throws IOException {
if (journalWriter != null) {
journalWriter.close();
}
Writer writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(journalFileTmp), CacheUtils.US_ASCII));
try {
writer.write(MAGIC);
writer.write("\n");
writer.write(VERSION_1);
writer.write("\n");
writer.write(Integer.toString(appVersion));
writer.write("\n");
writer.write(Integer.toString(valueCount));
writer.write("\n");
writer.write("\n");
for (Entry entry : lruEntries.values()) {
if (entry.currentEditor != null) {
writer.write(DIRTY + ' ' + entry.key + '\n');
} else {
writer.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n');
}
}
} finally {
writer.close();
}
if (journalFile.exists()) {
renameTo(journalFile, journalFileBackup, true);
}
renameTo(journalFileTmp, journalFile, false);
journalFileBackup.delete();
journalWriter = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(journalFile, true), CacheUtils.US_ASCII));
}
private static void deleteIfExists(File file) throws IOException {
if (file.exists() && !file.delete()) {
throw new IOException();
}
}
private static void renameTo(File from, File to, boolean deleteDestination) throws IOException {
if (deleteDestination) {
deleteIfExists(to);
}
if (!from.renameTo(to)) {
throw new IOException();
}
}
/**
* Returns a snapshot of the entry named {@code key}, or null if it doesn't
* exist is not currently readable. If a value is returned, it is moved to
* the head of the LRU queue.
*/
public synchronized Snapshot get(String key) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (entry == null) {
return null;
}
if (!entry.readable) {
return null;
}
// Open all streams eagerly to guarantee that we see a single published
// snapshot. If we opened streams lazily then the streams could come
// from different edits.
InputStream[] ins = new InputStream[valueCount];
try {
for (int i = 0; i < valueCount; i++) {
ins[i] = new FileInputStream(entry.getCleanFile(i));
}
} catch (FileNotFoundException e) {
// A file must have been deleted manually!
for (int i = 0; i < valueCount; i++) {
if (ins[i] != null) {
CacheUtils.closeQuietly(ins[i]);
} else {
break;
}
}
return null;
}
redundantOpCount++;
journalWriter.append(READ + ' ' + key + '\n');
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return new Snapshot(key, entry.sequenceNumber, ins, entry.lengths);
}
/**
* Returns an editor for the entry named {@code key}, or null if another
* edit is duration progress.
*/
public Editor edit(String key) throws IOException {
return edit(key, ANY_SEQUENCE_NUMBER);
}
private synchronized Editor edit(String key, long expectedSequenceNumber) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (expectedSequenceNumber != ANY_SEQUENCE_NUMBER && (entry == null
|| entry.sequenceNumber != expectedSequenceNumber)) {
return null; // Snapshot is stale.
}
if (entry == null) {
entry = new Entry(key);
lruEntries.put(key, entry);
} else if (entry.currentEditor != null) {
return null; // Another edit is duration progress.
}
Editor editor = new Editor(entry);
entry.currentEditor = editor;
// Flush the journal before creating files to prevent file leaks.
journalWriter.write(DIRTY + ' ' + key + '\n');
journalWriter.flush();
return editor;
}
/**
* Returns the directory where this cache stores its data.
*/
public File getDirectory() {
return directory;
}
/**
* Returns the maximum number of bytes that this cache should use to store
* its data.
*/
public synchronized long getMaxSize() {
return maxSize;
}
/**
* Changes the maximum number of bytes the cache can store and queues a job
* to trim the existing store, if necessary.
*/
public synchronized void setMaxSize(long maxSize) {
this.maxSize = maxSize;
executorService.submit(cleanupCallable);
}
/**
* Returns the number of bytes currently being used to store the values duration
* this cache. This may be greater than the max size if a background
* deletion is pending.
*/
public synchronized long size() {
return size;
}
private synchronized void completeEdit(Editor editor, boolean success) throws IOException {
Entry entry = editor.entry;
if (entry.currentEditor != editor) {
throw new IllegalStateException();
}
// If this edit is creating the entry for the first time, every index must have a value.
if (success && !entry.readable) {
for (int i = 0; i < valueCount; i++) {
if (!editor.written[i]) {
editor.abort();
throw new IllegalStateException("Newly created entry didn't create value for index " + i);
}
if (!entry.getDirtyFile(i).exists()) {
editor.abort();
return;
}
}
}
for (int i = 0; i < valueCount; i++) {
File dirty = entry.getDirtyFile(i);
if (success) {
if (dirty.exists()) {
File clean = entry.getCleanFile(i);
dirty.renameTo(clean);
long oldLength = entry.lengths[i];
long newLength = clean.length();
entry.lengths[i] = newLength;
size = size - oldLength + newLength;
}
} else {
deleteIfExists(dirty);
}
}
redundantOpCount++;
entry.currentEditor = null;
if (entry.readable | success) {
entry.readable = true;
journalWriter.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n');
if (success) {
entry.sequenceNumber = nextSequenceNumber++;
}
} else {
lruEntries.remove(entry.key);
journalWriter.write(REMOVE + ' ' + entry.key + '\n');
}
journalWriter.flush();
if (size > maxSize || journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
}
/**
* We only rebuild the journal when it will halve the size of the journal
* and eliminate at least 2000 ops.
*/
private boolean journalRebuildRequired() {
final int redundantOpCompactThreshold = 2000;
return redundantOpCount >= redundantOpCompactThreshold //
&& redundantOpCount >= lruEntries.size();
}
/**
* Drops the entry for {@code key} if it exists and can be removed. Entries
* actively being edited cannot be removed.
*
* @return true if an entry was removed.
*/
public synchronized boolean remove(String key) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (entry == null || entry.currentEditor != null) {
return false;
}
for (int i = 0; i < valueCount; i++) {
File file = entry.getCleanFile(i);
if (file.exists() && !file.delete()) {
throw new IOException("failed to delete " + file);
}
size -= entry.lengths[i];
entry.lengths[i] = 0;
}
redundantOpCount++;
journalWriter.append(REMOVE + ' ' + key + '\n');
lruEntries.remove(key);
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return true;
}
/**
* Returns true if this cache has been closed.
*/
public synchronized boolean isClosed() {
return journalWriter == null;
}
private void checkNotClosed() {
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
}
/**
* Force buffered operations to the filesystem.
*/
public synchronized void flush() throws IOException {
checkNotClosed();
trimToSize();
journalWriter.flush();
}
/**
* Closes this cache. Stored values will remain on the filesystem.
*/
public synchronized void close() throws IOException {
if (journalWriter == null) {
return; // Already closed.
}
for (Entry entry : new ArrayList<Entry>(lruEntries.values())) {
if (entry.currentEditor != null) {
entry.currentEditor.abort();
}
}
trimToSize();
journalWriter.close();
journalWriter = null;
}
private void trimToSize() throws IOException {
while (size > maxSize) {
Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next();
remove(toEvict.getKey());
}
}
/**
* Closes the cache and deletes all of its stored values. This will delete
* all files duration the cache directory including files that weren't created by
* the cache.
*/
public void delete() throws IOException {
close();
CacheUtils.deleteContents(directory);
}
private void validateKey(String key) {
Matcher matcher = LEGAL_KEY_PATTERN.matcher(key);
if (!matcher.matches()) {
throw new IllegalArgumentException("keys must match regex "
+ STRING_KEY_PATTERN + ": \"" + key + "\"");
}
}
private static String inputStreamToString(InputStream in) throws IOException {
return CacheUtils.readFully(new InputStreamReader(in, CacheUtils.UTF_8));
}
/**
* A snapshot of the values for an entry.
*/
public final class Snapshot implements Closeable {
private final String key;
private final long sequenceNumber;
private final InputStream[] ins;
private final long[] lengths;
private Snapshot(String key, long sequenceNumber, InputStream[] ins, long[] lengths) {
this.key = key;
this.sequenceNumber = sequenceNumber;
this.ins = ins;
this.lengths = lengths;
}
/**
* Returns an editor for this snapshot's entry, or null if either the
* entry has changed since this snapshot was created or if another edit
* is duration progress.
*/
public Editor edit() throws IOException {
return DiskLruCache.this.edit(key, sequenceNumber);
}
/**
* Returns the unbuffered stream with the value for {@code index}.
*/
public InputStream getInputStream(int index) {
return ins[index];
}
/**
* Returns the string value for {@code index}.
*/
public String getString(int index) throws IOException {
return inputStreamToString(getInputStream(index));
}
/**
* Returns the byte length of the value for {@code index}.
*/
public long getLength(int index) {
return lengths[index];
}
public void close() {
for (InputStream in : ins) {
CacheUtils.closeQuietly(in);
}
}
}
private static final OutputStream NULL_OUTPUT_STREAM = new OutputStream() {
@Override
public void write(int b) throws IOException {
// Eat all writes silently. Nom nom.
}
};
/**
* Edits the values for an entry.
*/
public final class Editor {
private final Entry entry;
private final boolean[] written;
private boolean hasErrors;
private boolean committed;
private Editor(Entry entry) {
this.entry = entry;
this.written = (entry.readable) ? null : new boolean[valueCount];
}
/**
* Returns an unbuffered input stream to read the last committed value,
* or null if no value has been committed.
*/
public InputStream newInputStream(int index) throws IOException {
synchronized (DiskLruCache.this) {
if (entry.currentEditor != this) {
throw new IllegalStateException();
}
if (!entry.readable) {
return null;
}
try {
return new FileInputStream(entry.getCleanFile(index));
} catch (FileNotFoundException e) {
return null;
}
}
}
/**
* Returns the last committed value as a string, or null if no value
* has been committed.
*/
public String getString(int index) throws IOException {
InputStream in = newInputStream(index);
return in != null ? inputStreamToString(in) : null;
}
/**
* Returns a new unbuffered output stream to write the value at
* {@code index}. If the underlying output stream encounters errors
* when writing to the filesystem, this edit will be aborted when
* {@link #commit} is called. The returned output stream does not throw
* IOExceptions.
*/
public OutputStream newOutputStream(int index) throws IOException {
if (index < 0 || index >= valueCount) {
throw new IllegalArgumentException("Expected index " + index + " to "
+ "be greater than 0 and less than the maximum value count "
+ "of " + valueCount);
}
synchronized (DiskLruCache.this) {
if (entry.currentEditor != this) {
throw new IllegalStateException();
}
if (!entry.readable) {
written[index] = true;
}
File dirtyFile = entry.getDirtyFile(index);
FileOutputStream outputStream;
try {
outputStream = new FileOutputStream(dirtyFile);
} catch (FileNotFoundException e) {
// Attempt to recreate the cache directory.
directory.mkdirs();
try {
outputStream = new FileOutputStream(dirtyFile);
} catch (FileNotFoundException e2) {
// We are unable to recover. Silently eat the writes.
return NULL_OUTPUT_STREAM;
}
}
return new FaultHidingOutputStream(outputStream);
}
}
/**
* Sets the value at {@code index} to {@code value}.
*/
public void set(int index, String value) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(newOutputStream(index), CacheUtils.UTF_8);
writer.write(value);
} finally {
CacheUtils.closeQuietly(writer);
}
}
/**
* Commits this edit so it is visible to readers. This releases the
* edit lock so another edit may be started on the same key.
*/
public void commit() throws IOException {
if (hasErrors) {
completeEdit(this, false);
remove(entry.key); // The previous entry is stale.
} else {
completeEdit(this, true);
}
committed = true;
}
/**
* Aborts this edit. This releases the edit lock so another edit may be
* started on the same key.
*/
public void abort() throws IOException {
completeEdit(this, false);
}
public void abortUnlessCommitted() {
if (!committed) {
try {
abort();
} catch (IOException ignored) {
}
}
}
private class FaultHidingOutputStream extends FilterOutputStream {
private FaultHidingOutputStream(OutputStream out) {
super(out);
}
@Override
public void write(int oneByte) {
try {
out.write(oneByte);
} catch (IOException e) {
hasErrors = true;
}
}
@Override
public void write(byte[] buffer, int offset, int length) {
try {
out.write(buffer, offset, length);
} catch (IOException e) {
hasErrors = true;
}
}
@Override
public void close() {
try {
out.close();
} catch (IOException e) {
hasErrors = true;
}
}
@Override
public void flush() {
try {
out.flush();
} catch (IOException e) {
hasErrors = true;
}
}
}
}
private final class Entry {
private final String key;
/**
* Lengths of this entry's files.
*/
private final long[] lengths;
/**
* True if this entry has ever been published.
*/
private boolean readable;
/**
* The ongoing edit or null if this entry is not being edited.
*/
private Editor currentEditor;
/**
* The sequence number of the most recently committed edit to this entry.
*/
private long sequenceNumber;
private Entry(String key) {
this.key = key;
this.lengths = new long[valueCount];
}
public String getLengths() throws IOException {
StringBuilder result = new StringBuilder();
for (long size : lengths) {
result.append(' ').append(size);
}
return result.toString();
}
/**
* Set lengths using decimal numbers like "10123".
*/
private void setLengths(String[] strings) throws IOException {
if (strings.length != valueCount) {
throw invalidLengths(strings);
}
try {
for (int i = 0; i < strings.length; i++) {
lengths[i] = Long.parseLong(strings[i]);
}
} catch (NumberFormatException e) {
throw invalidLengths(strings);
}
}
private IOException invalidLengths(String[] strings) throws IOException {
throw new IOException("unexpected journal line: " + java.util.Arrays.toString(strings));
}
public File getCleanFile(int i) {
return new File(directory, key + "." + i);
}
public File getDirtyFile(int i) {
return new File(directory, key + "." + i + ".tmp");
}
}
}
| [
"[email protected]"
] | |
99a01ad7b8f499cfb088d702daea9134a61eb936 | bd1c198c0fcc44d64127d7fbf41135a5d9ba6b30 | /crocodile-main/src/main/java/cn/silently9527/crocodile/core/security/UserService.java | 4fd622e25589e933ff3dd04e258ec299188fe578 | [
"Apache-2.0"
] | permissive | silently9527/crocodile-mini | 448fcbaedee3d9b0bd326c73b5a281c02611f8c8 | 7e062cd358263300352392a0be3a2e0ca69e7681 | refs/heads/master | 2023-07-19T06:59:50.547948 | 2021-09-06T16:03:28 | 2021-09-06T16:03:28 | 403,252,956 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,308 | java | package cn.silently9527.crocodile.core.security;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.silently9527.crocodile.repository.databases.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.silently9527.crocodile.core.security.model.AuthUserInfo;
import cn.silently9527.crocodile.repository.databases.model.UserHasRole;
import cn.silently9527.crocodile.rest.model.param.user.UserAddParam;
import cn.silently9527.crocodile.rest.model.param.user.UserPageParam;
import cn.silently9527.crocodile.rest.model.param.user.UserUpdateParam;
import org.springframework.security.core.userdetails.UserDetailsService;
/**
* <p>
* 系统用户表 服务类
* </p>
*
* @author starblues
* @since 2020-12-31
*/
public interface UserService extends IService<User>, UserDetailsService {
/**
* 分页查询用户列表
* @param param 参数
* @return 分页结果
*/
IPage<UserHasRole> getPage(UserPageParam param);
/**
* 通过用户名获取用户
* @param username 用户名
* @return 用户
*/
User getByUsername(String username);
/**
* 得到当前认证后的用户信息
* @return AuthUserInfo
*/
AuthUserInfo getAuthUserInfo() throws Exception;
/**
* 添加用户
* @param param 添加用户参数
* @throws Exception 添加异常
*/
void addUser(UserAddParam param) throws Exception;
/**
* 修改用户
* @param param 更新用户参数
* @throws Exception 添加异常
*/
void updateUser(UserUpdateParam param) throws Exception;
/**
* 修改用户状态
* @param userId 用户id
* @param status 状态
* @throws Exception 更新状态异常
*/
void updateStatus(String userId, Integer status) throws Exception;
/**
* 重置用户密码
* @param userId 用户id
* @param newPassword 重置的新密码
* @throws Exception 重置密码异常
*/
void resetPassword(String userId, String newPassword) throws Exception;
/**
* 通过用户id删除用户
* @param userId 用户id
*/
void delete(String userId) throws Exception;
/**
* 得到超级管理员用户
* @return User
*/
User getSuperAdmin();
}
| [
"[email protected]"
] | |
09b5347b34f81a03c705cec2cb87e435d75f35bb | ac82c44a91362f66d49c9ffa2f798b9a47e75ab4 | /raml-parser-2/src/main/java/org/raml/v2/internal/impl/commons/nodes/TypesNode.java | 633cd0195a950ce1d1cab8e0f2be079f8663ec8d | [
"Apache-2.0"
] | permissive | raml-org/raml-java-parser | 0d07a5b61211dc4c7b255b3e05094f8577ce3cfb | d2935eb7eec3aee4b5badd644d51f14e09eadb3d | refs/heads/master | 2023-08-29T01:04:55.495293 | 2022-02-12T14:27:47 | 2022-02-12T14:27:47 | 11,036,770 | 148 | 135 | NOASSERTION | 2020-06-09T10:37:39 | 2013-06-28T20:09:34 | Java | UTF-8 | Java | false | false | 1,186 | java | /*
* Copyright 2013 (c) MuleSoft, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.raml.v2.internal.impl.commons.nodes;
import javax.annotation.Nonnull;
import org.raml.yagi.framework.nodes.KeyValueNodeImpl;
import org.raml.yagi.framework.nodes.Node;
public class TypesNode extends KeyValueNodeImpl implements OverlayableNode
{
public TypesNode()
{
}
public TypesNode(@Nonnull Node keyNode, @Nonnull Node valueNode)
{
super(keyNode, valueNode);
}
public TypesNode(TypesNode node)
{
super(node);
}
@Nonnull
@Override
public Node copy()
{
return new TypesNode(this);
}
}
| [
"[email protected]"
] | |
b6fa5c443f1f512e3d3f81feea377a5edc8f5c74 | a9e5d7839dd65ca9527b7ce554d1b965ba427ffc | /src/test/java/com/example/msformation/MsFormationApplicationTests.java | 8238639f83b046471de9cc3efd6c6c4f99a9a7a8 | [] | no_license | laiboumaima/Ms-formation | 66ad06490b61bb6ae347a559173cbe27b3dfbb6f | 8fa20a0f38ee5af56e2f7cc6a06b894124de93ca | refs/heads/master | 2023-06-20T16:30:07.385058 | 2021-07-28T18:05:09 | 2021-07-28T18:05:09 | 390,284,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.example.msformation;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MsFormationApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
aa3c44368734108ddff17892a448d0bb5db75651 | 63726a49e4b0719645d8ddf9898df726a274a654 | /gulimall-coupon/src/main/java/com/xl/gulimall/coupon/dao/SeckillPromotionDao.java | 8b657b1b270247149866776d9a61e8e4ccc207fd | [
"Apache-2.0"
] | permissive | bug10086/gulimall | d2ab2616cf111b5eb5bb2c6e1460a61edd901fd3 | efaadd555ca89895e8b77838d32308b070253136 | refs/heads/main | 2023-04-18T02:16:53.449546 | 2021-05-04T14:59:37 | 2021-05-04T14:59:37 | 353,539,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.xl.gulimall.coupon.dao;
import com.xl.gulimall.coupon.entity.SeckillPromotionEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 秒杀活动
*
* @author xilieao
* @email [email protected]
* @date 2021-04-01 18:16:54
*/
@Mapper
public interface SeckillPromotionDao extends BaseMapper<SeckillPromotionEntity> {
}
| [
"[email protected]"
] | |
471eee91f8f2796cc61aa08baaa81380d2054ad9 | e2ad2c2ed02a4a28304da8bd4d3c88e4db1c55f9 | /MPlayer/app/src/main/java/com/example/mahmud/mplayer/MainActivity.java | b41527f1a062912330ea2c0bb9292d40444fc6a7 | [] | no_license | Mahmud-CSE16/Android-Practices | 726c0e41d7df92a8763b45264aa9203cdb3e28f6 | 5099f10587cfa16cb575400dfc6e2bc242a9c35c | refs/heads/master | 2020-05-16T19:08:47.497720 | 2019-04-24T15:52:21 | 2019-04-24T15:52:21 | 183,250,029 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | java | package com.example.mahmud.mplayer;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.SeekBar;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
ArrayList<SongInfo> songs = new ArrayList<SongInfo>();
RecyclerView recyclerView;
SeekBar seekBar;
SongAdapter songAdapter;
MediaPlayer mediaPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recyclerViewId);
seekBar = findViewById(R.id.seekBarId);
SongInfo s = new SongInfo("cheap thrills","sia","");
songAdapter = new SongAdapter(this,songs);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),linearLayoutManager.getOrientation());
recyclerView.addItemDecoration(dividerItemDecoration);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(songAdapter);
mediaPlayer = new MediaPlayer();
}
}
| [
"[email protected]"
] | |
1ef15a0ba30987083a34630f4680e7060a18a160 | 21f6f37c5faab5c734a81051ff845a7e0e9d04b2 | /app/src/main/java/com/tochalumni/osat/osat/Person.java | aef1cc1d26020368a31e4a89187871d539abbed2 | [] | no_license | NikJoj/OSATapp | 179ce2dec19425497b4f639dc21f83f001f82118 | cc45c0e163e8acf732fa831aed41e0245d7978fe | refs/heads/master | 2021-08-23T04:15:02.601193 | 2017-12-03T07:28:31 | 2017-12-03T07:28:31 | 112,908,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,167 | java | package com.tochalumni.osat.osat;
/**
* Created by joji on 28/11/17.
*/
class Person {
private String fname;
private String lname;
private String pass;
private String stud;
private String insti;
private String phone;
private String email;
public String getFname() {
return fname;
}
public String getLname() {
return lname;
}
public String getPass() { return pass; }
public String getStud() {
return stud;
}
public String getInsti() {
return insti;
}
public String getPhone() {
return phone;
}
public String getEmail() {
return email;
}
public void setFname(String fname) {
this.fname = fname;
}
public void setLname(String lname) {
this.lname = lname;
}
public void setPass(String pass) { this.pass = pass; }
public void setStud(String stud) {
this.stud = stud;
}
public void setInsti(String insti) {
this.insti = insti;
}
public void setPhone(String phone) { this.phone = phone; }
public void setEmail(String email) { this.email = email; }
}
| [
"[email protected]"
] | |
28b4df36664e73714f36e9801457f304b01097d7 | 62a90cf15a106eebb35eef11c55a1ab43d2d07e6 | /measure/src/main/java/ru/hoticecream/measure/activities/MeasureActivity.java | 541d71467b0e9c3186fe8a9b3e8f182267cd1453 | [] | no_license | HotIceCream/ViewsSandbox | 006585dce9707dc30dc0fde277a4be2c14e0f577 | 8732b83d4aec20fbacc07fe72a34458a91a30326 | refs/heads/master | 2021-01-10T17:52:06.547205 | 2017-01-17T11:20:23 | 2017-01-17T11:20:23 | 44,447,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package ru.hoticecream.measure.activities;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import ru.hoticecream.measure.R;
public class MeasureActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_measure);
}
}
| [
"[email protected]"
] | |
0f349c072ba902f62ae9a025f977ad59e190fc8b | 9cc1e0d8167a81e5424d286f0c3810a9b068fa73 | /plume-mail/src/test/java/com/coreoz/plume/mail/MailerProviderTest.java | cbc71c7541689d957409c8fb318f6ca398f45125 | [
"Apache-2.0"
] | permissive | Coreoz/Plume | 8e290180cceb588e7e37a939f53274c09f5d3611 | e99e663f5a7f3dbcda50e5ad3559eecff974188a | refs/heads/master | 2023-08-30T05:40:32.932549 | 2023-08-25T11:48:49 | 2023-08-25T11:48:49 | 64,226,557 | 19 | 8 | Apache-2.0 | 2023-08-03T08:26:18 | 2016-07-26T14:10:42 | Java | UTF-8 | Java | false | false | 682 | java | package com.coreoz.plume.mail;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import com.google.common.collect.ImmutableMap;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
public class MailerProviderTest {
@Test
public void should_generate_well_form_property_file() {
Config config = ConfigFactory.parseMap(ImmutableMap.of(
"mail.\"javaxmail.debug\"", "true",
"mail.transportstrategy", "SMTP_SSL"
));
String properties = MailerProvider.readMailConfiguration(config);
Assertions.assertThat(properties).isEqualTo(
"simplejavamail.javaxmail.debug=true\n"
+ "simplejavamail.transportstrategy=SMTP_SSL"
);
}
}
| [
"[email protected]"
] | |
833795dd98c58d2199d8c965b91a8c5de0278df7 | f17370b95a3499f2fa7666d6e9cc43e1decc956f | /src/org/processmining/plugins/tsanalyzer/gui/TSTimeAnnotationGUI.java | 76a2fb6ea7701f88098a4a057af366663ff8136e | [] | no_license | keithlow18/TransitionSystems | 0349ccac01ced45d9a0bd744e0a1d6b9fcd1967d | 87d4fd8c0c360795d31af9682b5f679e278fd36e | refs/heads/master | 2021-01-10T08:48:03.203418 | 2015-11-27T00:47:29 | 2015-11-27T00:47:29 | 46,952,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,549 | java | /*
* Created on July. 02, 2007
*
* Author: Minseok Song (c) 2006 Technische Universiteit Eindhoven, Minseok Song
* all rights reserved
*
* LICENSE WARNING: This code has been created within the realm of an STW
* project. The question of under which license to publish this code, or whether
* to have it published openly at all, is still unclear. Before this code can be
* released in any form, be it binary or source code, this issue has to be
* clarified with the STW. Please do not add this file to any build or source
* export transferred to anybody outside the TM.IS group.
*/
package org.processmining.plugins.tsanalyzer.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import org.jgraph.event.GraphSelectionEvent;
import org.jgraph.event.GraphSelectionListener;
import org.jgraph.graph.GraphSelectionModel;
import org.processmining.framework.plugin.PluginContext;
import org.processmining.models.graphbased.AttributeMap;
import org.processmining.models.graphbased.ViewSpecificAttributeMap;
import org.processmining.models.graphbased.directed.DirectedGraphEdge;
import org.processmining.models.graphbased.directed.DirectedGraphNode;
import org.processmining.models.graphbased.directed.transitionsystem.State;
import org.processmining.models.graphbased.directed.transitionsystem.Transition;
import org.processmining.models.graphbased.directed.transitionsystem.payload.PayloadTransitionSystem;
import org.processmining.models.jgraph.ProMJGraphVisualizer;
import org.processmining.models.jgraph.elements.ProMGraphCell;
import org.processmining.models.jgraph.elements.ProMGraphEdge;
import org.processmining.models.jgraph.visualization.ProMJGraphPanel;
import org.processmining.plugins.tsanalyzer.Duration;
import org.processmining.plugins.tsanalyzer.StatisticsAnnotationProperty;
import org.processmining.plugins.tsanalyzer.TimeStateAnnotation;
import org.processmining.plugins.tsanalyzer.TimeTransitionAnnotation;
import org.processmining.plugins.tsanalyzer.TimeTransitionSystemAnnotation;
import com.fluxicon.slickerbox.components.AutoFocusButton;
public class TSTimeAnnotationGUI extends JPanel implements GuiNotificationTarget {
private static final long serialVersionUID = -3036511492888928964L;
public static String INTER = "inter";
public static String OVER = "overall";
private static final Color blueColor = new Color(56, 189, 255);;
private static final Color yellowColor = new Color(250, 250, 157);
private static final Color redColor = new Color(255, 102, 120);
// Performance objects
private JPanel splitPane;
private final JPanel menuPanel = new JPanel();
private JSplitPane chartPanel;
// protected GUIPropertyInteger bot = new GUIPropertyInteger("", 0, 0, 100);
// protected GUIPropertyInteger min = new GUIPropertyInteger("...Blue...", 60, 0, 100);
// protected GUIPropertyInteger max = new GUIPropertyInteger("...Yellow...", 80, 0, 100);
// protected GUIPropertyInteger top = new GUIPropertyInteger("...Red...", 100, 0, 100);
protected GUIPropertyListEnumeration colorBySort;
// private JSplitPane minSplit = null;
// private JSplitPane maxSplit = null;
// private JLabel blueLabel;
// private JLabel yellowLabel;
// private JLabel redLabel;
private TripleSlider slider;
private StatisticsAnnotationPanel table;
private final PayloadTransitionSystem<?> system;
private final TimeTransitionSystemAnnotation annotation;
private final ViewSpecificAttributeMap map;
private final ProMJGraphPanel graphVisPanel;
// private final PluginContext context;
public TSTimeAnnotationGUI(final PluginContext context, PayloadTransitionSystem<?> system,
TimeTransitionSystemAnnotation annotation) {
super();
this.system = system;
this.annotation = annotation;
map = new ViewSpecificAttributeMap();
// this.context = context;
graphVisPanel = ProMJGraphVisualizer.instance().visualizeGraph(context, system, map);
setLayout(new BorderLayout());
removeAll();
initGraphMenu();
buildMainMenuGui();
updateGUI();
}
public void initGraphMenu() {
table = new StatisticsAnnotationPanel();
splitPane = new JPanel(new BorderLayout());
chartPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
// Initially, the divider will split the 'real estate' 80/20.
chartPanel.setResizeWeight(0.8);
initColorBySort();
menuPanel.setLayout(new BorderLayout());
menuPanel.add(colorBySort.getPropertyPanel(), BorderLayout.WEST);
// menuPanel.add(bot.getPropertyPanel());
// bot.disable();
// menuPanel.add(min.getPropertyPanel());
// JLabel label = new JLabel("Yellow");
// label.setBackground(yellowColor);
// label.setOpaque(true);
// menuPanel.add(label);
// menuPanel.add(max.getPropertyPanel());
// menuPanel.add(top.getPropertyPanel());
// top.disable();
// maxSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// minSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// blueLabel = new JLabel("Blue (0% - 60%)");
// blueLabel.setBackground(blueColor);
// blueLabel.setOpaque(true);
// yellowLabel = new JLabel("Yellow (60% - 80%)");
// yellowLabel.setBackground(yellowColor);
// yellowLabel.setOpaque(true);
// redLabel = new JLabel("Red (80% - 100%)");
// redLabel.setBackground(redColor);
// redLabel.setOpaque(true);
// minSplit.setLeftComponent(blueLabel);
// minSplit.setRightComponent(yellowLabel);
// minSplit.setResizeWeight(0.75);
// minSplit.setBorder(null);
// maxSplit.setLeftComponent(minSplit);
// maxSplit.setRightComponent(redLabel);
// maxSplit.setResizeWeight(0.8);
// maxSplit.setBorder(null);
// int maxValue = (100*maxSplit.getDividerLocation())/maxSplit.getMaximumDividerLocation(); //max.getValue();
// int minValue = (maxValue*minSplit.getDividerLocation())/minSplit.getMaximumDividerLocation(); //min.getValue();
//
// if (maxValue <= 0) {
// maxValue = 80;
// }
// if (minValue <= 0) {
// minValue = 60;
// }
// blueLabel.setText("Blue (0% - " + minValue + "%)");
// yellowLabel.setText("Yellow (" + minValue + "% - " + maxValue + "%)");
// redLabel.setText("Red (" + maxValue + "% - 100%)");
slider = new TripleSlider();
slider.setValues(0.6, 0.2);
slider.setColor(0, blueColor);
slider.setColor(1, yellowColor);
slider.setColor(2, redColor);
menuPanel.add(slider, BorderLayout.CENTER);
JButton updateButton = new AutoFocusButton("Update");
updateButton.setOpaque(false);
updateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
updateGUI();
}
});
menuPanel.add(updateButton, BorderLayout.EAST);
splitPane.add(menuPanel, BorderLayout.NORTH);
adjustTimeScale();
}
private double getOverallTransitionMax() {
double overallEdgeMax = 0.0;
for (TimeTransitionAnnotation tran : annotation.getAllTransitionAnnotations()) {
StatisticsAnnotationProperty prop = tran.getDuration();
if (overallEdgeMax < getData(prop)) {
overallEdgeMax = getData(prop);
}
}
return overallEdgeMax;
}
private double getOverallStateMax() {
double overallMax = 0.0;
for (TimeStateAnnotation state : annotation.getAllStateAnnotations()) {
StatisticsAnnotationProperty prop = getTimeMap(state);
if (overallMax < getData(prop)) {
overallMax = getData(prop);
}
}
return overallMax;
}
public void buildMainMenuGui() {
removeAll();
this.add(splitPane, BorderLayout.CENTER);
revalidate();
this.repaint();
}
public void updateGUI() {
adjustTimeScale();
splitPane.remove(chartPanel);
// BVD: No need to do an update here as the system did not change
// ProMJGraphPanel graphVisPanel = ProMJGraphVisualizer.visualizeGraph(system, map);
// HV: The following three lines look stupid, but they serve a purpose: the refresh the graph.
double scale = graphVisPanel.getScale();
graphVisPanel.setScale(0.5 * scale);
graphVisPanel.setScale(scale);
chartPanel.setLeftComponent(graphVisPanel);
chartPanel.setRightComponent(table);
int divider = chartPanel.getDividerLocation();
chartPanel.validate();
splitPane.add(chartPanel, BorderLayout.CENTER);
GraphSelectionModel model = graphVisPanel.getGraph().getSelectionModel();
model.setSelectionMode(GraphSelectionModel.SINGLE_GRAPH_SELECTION);
model.addGraphSelectionListener(new GraphSelectionListener() {
public void valueChanged(GraphSelectionEvent evt) {
for (Object cell : evt.getCells()) {
if (evt.isAddedCell(cell)) {
if (cell instanceof ProMGraphCell) {
DirectedGraphNode node = ((ProMGraphCell) cell).getNode();
if (node instanceof State) {
State state = (State) node;
TimeStateAnnotation stateAnnotation = annotation.getStateAnnotation(state);
table.showStateAnnotation(stateAnnotation);
}
} else {
if (cell instanceof ProMGraphEdge) {
DirectedGraphEdge<?, ?> edge = ((ProMGraphEdge) cell).getEdge();
if (edge instanceof Transition) {
Transition transition = (Transition) edge;
TimeTransitionAnnotation transitionAnnotation = annotation
.getTransitionAnnotation(transition);
table.showTransitionAnnotation(transitionAnnotation);
}
}
}
}
}
}
});
validate();
chartPanel.setDividerLocation(divider);
}
protected void initColorBySort() {
ArrayList<String> colorByList = new ArrayList<String>();
for (String property : TimeStateAnnotation.getNamesOfProperties()) {
colorByList.add(property);
}
/*
* colorByList.add("Sojourn"); colorByList.add("Remaining");
* colorByList.add("Elapsed");
*/
colorBySort = new GUIPropertyListEnumeration("Color By:", "", colorByList, this, 150);
}
protected double getData(StatisticsAnnotationProperty stat) {
return stat.getValue().doubleValue();
}
private StatisticsAnnotationProperty getTimeMap(TimeStateAnnotation sa) {
/*
* if (colorBySort.getValue().equals("Sojourn")) { return
* sa.getSoujourn(); } else if
* (colorBySort.getValue().equals("Elapsed")) { return sa.getElapsed();
* } else if (colorBySort.getValue().equals("Remaining")) { return
* sa.getRemaining(); } return null;
*/
return (StatisticsAnnotationProperty) sa.getProperty(colorBySort.getValue().toString());
}
private void adjustTimeScale() {
double overallStateMax = getOverallStateMax();
double overallEdgeMax = getOverallTransitionMax();
double minValue = slider.getValue(0);
double maxValue = minValue + slider.getValue(1);
double stateMinValue = overallStateMax * minValue;
double stateMaxValue = overallStateMax * maxValue;
double transMinValue = overallEdgeMax * minValue;
double transMaxValue = overallEdgeMax * maxValue;
for (State state : system.getNodes()) {
String old = "<html><p align=\"center\">" + state.getAttributeMap().get(AttributeMap.LABEL).toString();
String value = "unknown";
TimeStateAnnotation san = annotation.getStateAnnotation(state);
if (san != null) {
/*
* StatisticsAnnotationProperty soujourn = san.getSoujourn();
* StatisticsAnnotationProperty remaining = san.getRemaining();
* StatisticsAnnotationProperty elapsed = san.getElapsed();
* String ss = (soujourn != null)?
* getDuration(getData(soujourn)):"unknown"; String se =
* (elapsed != null)? getDuration(getData(elapsed)):"unknown";
* String sr = (remaining != null)?
* getDuration(getData(remaining)):"unknown"; value = "s = " +
* ss + "<br> e = " + se + "<br> r = "+ sr;
*/
StatisticsAnnotationProperty property = getTimeMap(san);
value = (property != null) ? "[" + getDuration(getData(property)) + "]" : "unknown";
map.putViewSpecific(state, AttributeMap.AUTOSIZE, true);
if (getData(getTimeMap(san)) >= 0.0) {
double tempValue = getData(getTimeMap(san));
map.putViewSpecific(state, AttributeMap.FILLCOLOR,
getColor(tempValue, stateMinValue, stateMaxValue));
}
}
map.putViewSpecific(state, AttributeMap.LABEL, old + "<br>" + value + "</p></html>");
}
for (Transition trans : system.getEdges()) {
TimeTransitionAnnotation trann = annotation.getTransitionAnnotation(trans);
String value = "unknown";
if (trann != null) {
double tempValue = getData(trann.getDuration());
value = getDuration(tempValue);
map.putViewSpecific(trans, AttributeMap.EDGECOLOR, getColor(tempValue, transMinValue, transMaxValue));
}
map.putViewSpecific(trans, AttributeMap.TOOLTIP, "interval = " + value);
}
}
private Color getColor(double value, double min, double max) {
Color color = redColor;
if (value < min) {
color = blueColor;
} else if (value < max) {
color = yellowColor;
}
return color;
}
public HashSet<Transition> getAllEdgesTo(State state) {
HashSet<Transition> s = new HashSet<Transition>();
for (Transition t : system.getEdges()) {
if (isInPath(t, state)) {
s.add(t);
}
}
return s;
}
public boolean isInPath(State v1, State v2, HashSet<State> vs) {
Iterator<Transition> it = getOutEdges(v1).iterator();
while (it.hasNext()) {
Transition e = it.next();
if (e.getTarget() == v1) {
continue;
}
if (vs.contains(e.getTarget())) {
return false;
}
if (e.getTarget() == v2) {
return true;
} else {
vs.add(v1);
if ((getOutEdges(e.getTarget()) != null) && (getOutEdges(e.getTarget()).size() > 0)) {
if (isInPath(e.getTarget(), v2, vs)) {
return true;
}
}
}
}
return false;
}
public boolean isInPath(Transition e1, State v2) {
if (e1.getTarget() == v2) {
return true;
} else {
if ((e1.getSource() != e1.getTarget()) && (getOutEdges(e1.getTarget()) != null)
&& (getOutEdges(e1.getTarget()).size() > 0)) {
HashSet<State> vs = new HashSet<State>();
return isInPath(e1.getTarget(), v2, vs);
}
}
return false;
}
private Collection<Transition> getOutEdges(State s) {
ArrayList<Transition> result = new ArrayList<Transition>();
for (Transition t : system.getEdges()) {
if (t.getSource() == s) {
result.add(t);
}
}
return result;
}
private String getDuration(double miliseconds) {
Double d = new Double(miliseconds);
Duration duration = new Duration(d.longValue());
return duration.toString();
}
}
| [
"[email protected]"
] | |
4c0bf9f28d23abf996b994541c98cef9d4a12666 | 65ba7eef74b5871eda8c376fb5f99762e3ef2bdf | /src/main/java/com/crm/qa/pages/ContactsPage.java | d259d88f13db612317940818335cbc6b886f8078 | [] | no_license | vinitmangal/FreeCRMTest | 3f020646f0ce8159bdbbeecb6b81618f34ba24f2 | 072bb5b2393195c334b6b110d3b4eee1099727be | refs/heads/master | 2020-05-01T01:17:41.623907 | 2019-03-22T18:38:51 | 2019-03-22T18:38:51 | 177,191,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,725 | java | package com.crm.qa.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.crm.qa.base.TestBase;
public class ContactsPage extends TestBase{
@FindBy(xpath="//td[contains(text(),'Contacts')]")
@CacheLookup
WebElement contactsLabel;
@FindBy(id="first_name")
WebElement firstName;
@FindBy(id="surname")
WebElement surName;
@FindBy(name="client_lookup")
WebElement company;
@FindBy(xpath="//input[@type='submit' and @value='Save']")
WebElement savebtn;
public ContactsPage(){
System.out.println("inside Contactsage constructor");
PageFactory.initElements(driver, this);
}
public boolean verifyContactsPage(){
System.out.println("inside verifyContactsPage()");
WebDriverWait wait = new WebDriverWait(driver, 50);
wait.until(ExpectedConditions.visibilityOf(contactsLabel));
return contactsLabel.isDisplayed();
}
public void selectContactsByName(String name){
driver.findElement(By.xpath("//a[contains(text(),'"+name+"') and @context='contact' ]/parent::td[@class='datalistrow']/preceding-sibling::td/input[@name='contact_id']")).click();
}
public void createNewContact(String title,String fname,String lname,String company){
Select select = new Select(driver.findElement(By.name("title")));
select.selectByVisibleText(title);
firstName.sendKeys(fname);
surName.sendKeys(lname);
this.company.sendKeys(company);
savebtn.click();
}
}
| [
"[email protected]"
] | |
aceac8c746e0d55eb2a8935b4115e88321f9a703 | 392fbf26e26a86e7ea86a54d60bada004184dd9b | /impl/1.8.9/src/main/java/com/github/glassmc/sculpt/v1_8_9/test/SculptTransformer.java | 9b8671443c62e4d0c5701ca52caa0c206609959f | [
"MIT"
] | permissive | bottlemc/sculpt | b788bd3094cc79a00a926996ff55b16ef3755427 | 50afce3bdfbfe8be359083a0b3b96cd6de2a0e47 | refs/heads/main | 2023-07-10T20:56:17.603188 | 2021-08-05T02:06:55 | 2021-08-05T02:06:55 | 386,432,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,040 | java | package com.github.glassmc.sculpt.v1_8_9.test;
import com.github.glassmc.loader.loader.ITransformer;
import com.github.glassmc.loader.util.Identifier;
import net.minecraft.client.MinecraftClient;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
public class SculptTransformer implements ITransformer {
private final String MINECRAFT_CLIENT = Identifier.parse("net/minecraft/client/MinecraftClient").getClassName();
private final String GAME_RENDERER = Identifier.parse("net/minecraft/client/render/GameRenderer").getClassName();
private final String SCREEN = Identifier.parse("net/minecraft/client/gui/screen/Screen").getClassName();
@Override
public byte[] transform(String name, byte[] data) {
if(name.equals(MINECRAFT_CLIENT)) {
ClassNode classNode = this.getClassNode(data);
this.transformMinecraftClient(classNode);
return this.getData(classNode);
}
if(name.equals(GAME_RENDERER)) {
ClassNode classNode = this.getClassNode(data);
this.transformGameRenderer(classNode);
return this.getData(classNode);
}
if(name.equals(SCREEN)) {
ClassNode classNode = this.getClassNode(data);
this.transformScreen(classNode);
return this.getData(classNode);
}
return data;
}
private void transformMinecraftClient(ClassNode classNode) {
Identifier tick = Identifier.parse("net/minecraft/client/MinecraftClient#tick()V");
String tickName = tick.getMethodName();
String tickDescription = tick.getMethodDesc();
for(MethodNode methodNode : classNode.methods) {
if(methodNode.name.equals(tickName) && methodNode.desc.equals(tickDescription)) {
for(AbstractInsnNode node : methodNode.instructions.toArray()) {
if(node instanceof MethodInsnNode && ((MethodInsnNode) node).name.equals("getEventButton")) {
MethodInsnNode insert = new MethodInsnNode(Opcodes.INVOKESTATIC, Hook.class.getName().replace(".", "/"), "onAction", "()V");
methodNode.instructions.insertBefore(node, insert);
}
}
}
}
Identifier handleKeyInput = Identifier.parse("net/minecraft/client/MinecraftClient#handleKeyInput()V");
String handleKeyInputName = handleKeyInput.getMethodName();
String handleKeyInputDescription = handleKeyInput.getMethodDesc();
for(MethodNode methodNode : classNode.methods) {
if(methodNode.name.equals(handleKeyInputName) && methodNode.desc.equals(handleKeyInputDescription)) {
methodNode.instructions.insert(new MethodInsnNode(Opcodes.INVOKESTATIC, Hook.class.getName().replace(".", "/"), "onKey", "()V"));
}
}
}
private void transformGameRenderer(ClassNode classNode) {
Identifier render = Identifier.parse("net/minecraft/client/render/GameRenderer#render(FJ)V");
String renderName = render.getMethodName();
String renderDescription = render.getMethodDesc();
for(MethodNode methodNode : classNode.methods) {
if(methodNode.name.equals(renderName) && methodNode.desc.equals(renderDescription)) {
for(AbstractInsnNode node : methodNode.instructions.toArray()) {
if(node.getOpcode() == Opcodes.RETURN) {
MethodInsnNode insert = new MethodInsnNode(Opcodes.INVOKESTATIC, Hook.class.getName().replace(".", "/"), "onRender", "()V");
methodNode.instructions.insertBefore(node, insert);
}
}
}
}
}
private void transformScreen(ClassNode classNode) {
Identifier render = Identifier.parse("net/minecraft/client/gui/screen/Screen#handleMouse()V");
String renderName = render.getMethodName();
String renderDescription = render.getMethodDesc();
for(MethodNode methodNode : classNode.methods) {
if(methodNode.name.equals(renderName) && methodNode.desc.equals(renderDescription)) {
MethodInsnNode insert = new MethodInsnNode(Opcodes.INVOKESTATIC, Hook.class.getName().replace(".", "/"), "onAction", "()V");
methodNode.instructions.insert(insert);
}
}
}
private ClassNode getClassNode(byte[] data) {
ClassNode classNode = new ClassNode();
ClassReader classReader = new ClassReader(data);
classReader.accept(classNode, 0);
return classNode;
}
private byte[] getData(ClassNode classNode) {
ClassWriter classWriter = new ClassWriter(0);
classNode.accept(classWriter);
return classWriter.toByteArray();
}
} | [
"[email protected]"
] | |
3cad499bff57f0b2c65c065ae5f764d620790ce6 | 9ecfc3ed95494305d4f9b3d14cc900797a9a5f4d | /src/LinkedList/StdOut.java | 40b2863ad09a0b648e0c7c5c1c8f48a1667ffb3b | [] | no_license | linhnt31/Datastructure-And-Algorithm | 3eab8a64c7ab0c24d68d87a633547faafb3b42f9 | d4d68ebc9c07642189b1b2c1532879b4d9e48e4f | refs/heads/master | 2021-10-23T22:11:05.822722 | 2019-03-20T11:39:32 | 2019-03-20T11:39:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,302 | java |
package LinkedList;
/**
*
* @author alg4
*/
/******************************************************************************
* Compilation: javac StdOut.java
* Execution: java StdOut
* Dependencies: none
*
* Writes data of various types to standard output.
*
******************************************************************************/
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Locale;
/**
* This class provides methods for printing strings and numbers to standard output.
* <p>
* <b>Getting started.</b>
* To use this class, you must have {@code StdOut.class} in your
* Java classpath. If you used our autoinstaller, you should be all set.
* Otherwise, either download
* <a href = "https://introcs.cs.princeton.edu/java/code/stdlib.jar">stdlib.jar</a>
* and add to your Java classpath or download
* <a href = "https://introcs.cs.princeton.edu/java/stdlib/StdOut.java">StdOut.java</a>
* and put a copy in your working directory.
* <p>
* Here is an example program that uses {@code StdOut}:
* <pre>
* public class TestStdOut {
* public static void main(String[] args) {
* int a = 17;
* int b = 23;
* int sum = a + b;
* StdOut.println("Hello, World");
* StdOut.printf("%d + %d = %d\n", a, b, sum);
* }
* }
* </pre>
* <p>
* <b>Differences with System.out.</b>
* The behavior of {@code StdOut} is similar to that of {@link System#out},
* but there are a few technical differences:
* <ul>
* <li> {@code StdOut} coerces the character-set encoding to UTF-8,
* which is a standard character encoding for Unicode.
* <li> {@code StdOut} coerces the locale to {@link Locale#US},
* for consistency with {@link StdIn}, {@link Double#parseDouble(String)},
* and floating-point literals.
* <li> {@code StdOut} <em>flushes</em> standard output after each call to
* {@code print()} so that text will appear immediately in the terminal.
* </ul>
* <p>
* <b>Reference.</b>
* For additional documentation,
* see <a href="https://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
* <em>Computer Science: An Interdisciplinary Approach</em>
* by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public final class StdOut {
// force Unicode UTF-8 encoding; otherwise it's system dependent
private static final String CHARSET_NAME = "UTF-8";
// assume language = English, country = US for consistency with StdIn
private static final Locale LOCALE = Locale.US;
// send output here
private static PrintWriter out;
// this is called before invoking any methods
static {
try {
out = new PrintWriter(new OutputStreamWriter(System.out, CHARSET_NAME), true);
}
catch (UnsupportedEncodingException e) {
System.out.println(e);
}
}
// don't instantiate
private StdOut() { }
/**
* Closes standard output.
* @deprecated Calling close() permanently disables standard output;
* subsequent calls to StdOut.println() or System.out.println()
* will no longer produce output on standard output.
*/
@Deprecated
public static void close() {
out.close();
}
/**
* Terminates the current line by printing the line-separator string.
*/
public static void println() {
out.println();
}
/**
* Prints an object to this output stream and then terminates the line.
*
* @param x the object to print
*/
public static void println(Object x) {
out.println(x);
}
/**
* Prints a boolean to standard output and then terminates the line.
*
* @param x the boolean to print
*/
public static void println(boolean x) {
out.println(x);
}
/**
* Prints a character to standard output and then terminates the line.
*
* @param x the character to print
*/
public static void println(char x) {
out.println(x);
}
/**
* Prints a double to standard output and then terminates the line.
*
* @param x the double to print
*/
public static void println(double x) {
out.println(x);
}
/**
* Prints an integer to standard output and then terminates the line.
*
* @param x the integer to print
*/
public static void println(float x) {
out.println(x);
}
/**
* Prints an integer to standard output and then terminates the line.
*
* @param x the integer to print
*/
public static void println(int x) {
out.println(x);
}
/**
* Prints a long to standard output and then terminates the line.
*
* @param x the long to print
*/
public static void println(long x) {
out.println(x);
}
/**
* Prints a short integer to standard output and then terminates the line.
*
* @param x the short to print
*/
public static void println(short x) {
out.println(x);
}
/**
* Prints a byte to standard output and then terminates the line.
* <p>
* To write binary data, see {@link BinaryStdOut}.
*
* @param x the byte to print
*/
public static void println(byte x) {
out.println(x);
}
/**
* Flushes standard output.
*/
public static void print() {
out.flush();
}
/**
* Prints an object to standard output and flushes standard output.
*
* @param x the object to print
*/
public static void print(Object x) {
out.print(x);
out.flush();
}
/**
* Prints a boolean to standard output and flushes standard output.
*
* @param x the boolean to print
*/
public static void print(boolean x) {
out.print(x);
out.flush();
}
/**
* Prints a character to standard output and flushes standard output.
*
* @param x the character to print
*/
public static void print(char x) {
out.print(x);
out.flush();
}
/**
* Prints a double to standard output and flushes standard output.
*
* @param x the double to print
*/
public static void print(double x) {
out.print(x);
out.flush();
}
/**
* Prints a float to standard output and flushes standard output.
*
* @param x the float to print
*/
public static void print(float x) {
out.print(x);
out.flush();
}
/**
* Prints an integer to standard output and flushes standard output.
*
* @param x the integer to print
*/
public static void print(int x) {
out.print(x);
out.flush();
}
/**
* Prints a long integer to standard output and flushes standard output.
*
* @param x the long integer to print
*/
public static void print(long x) {
out.print(x);
out.flush();
}
/**
* Prints a short integer to standard output and flushes standard output.
*
* @param x the short integer to print
*/
public static void print(short x) {
out.print(x);
out.flush();
}
/**
* Prints a byte to standard output and flushes standard output.
*
* @param x the byte to print
*/
public static void print(byte x) {
out.print(x);
out.flush();
}
/**
* Prints a formatted string to standard output, using the specified format
* string and arguments, and then flushes standard output.
*
*
* @param format the <a href = "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">format string</a>
* @param args the arguments accompanying the format string
*/
public static void printf(String format, Object... args) {
out.printf(LOCALE, format, args);
out.flush();
}
/**
* Prints a formatted string to standard output, using the locale and
* the specified format string and arguments; then flushes standard output.
*
* @param locale the locale
* @param format the <a href = "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">format string</a>
* @param args the arguments accompanying the format string
*/
public static void printf(Locale locale, String format, Object... args) {
out.printf(locale, format, args);
out.flush();
}
/**
* Unit tests some of the methods in {@code StdOut}.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
// write to stdout
StdOut.println("Test");
StdOut.println(17);
StdOut.println(true);
StdOut.printf("%.6f\n", 1.0/7.0);
}
} | [
"silverbullet@LinhNT"
] | silverbullet@LinhNT |
9c8a819c424f5682741bc970b2d66c90af714017 | 37470eda05c8eec84dbf7934202824c3597d55d9 | /bmsys-service/bmsys-auth-service/src/main/java/com/ld/bmsys/auth/service/controller/MenuController.java | 1db2a453684de63592e57bafc25bb2211c8fc472 | [] | no_license | LI-DAI/bmsys | 4d12ddc05a82cafe8928dbc81da6f80e1ad6dd9e | 85c66cb45635118eaae0c06fa6afdfe8a98fcaf6 | refs/heads/master | 2023-05-02T12:49:09.847204 | 2021-05-15T04:44:53 | 2021-05-15T04:44:53 | 358,865,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | package com.ld.bmsys.auth.service.controller;
import com.ld.bmsys.auth.api.entity.Menu;
import com.ld.bmsys.auth.service.service.MenuService;
import com.ld.bmsys.common.entity.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author LD
* @date 2021/4/22 10:39
*/
@RestController
@RequestMapping("/menu")
@Api(tags = "菜单管理")
public class MenuController {
private final MenuService menuService;
public MenuController(MenuService menuService) {
this.menuService = menuService;
}
@GetMapping("/find")
@ApiOperation(value = "获取所有权限")
public Result<List<Menu>> findUserByUsername() {
return Result.data(menuService.loadAllMenus());
}
}
| [
"[email protected]"
] | |
af652a5145cf6c7452d90cf6841b6a3521a2bff8 | 59b47c39aca8e7cd58af0f7af82b1bb6e8ab9d10 | /controllers/src/main/java/com/netcracker/ruslan/userDetails/UserDetailsServiceImpl.java | a6d7060ae135df8ef8facacc40c286af92b3c543 | [] | no_license | RuslanClay/RUSLAN_SITARIS | 70f4c17d8626e0fa346c00eb75da14b08184ea0c | 096fbcdf9fcfaf6e0182d18f0f993025f84b6703 | refs/heads/master | 2023-04-29T11:06:31.697391 | 2021-05-07T13:16:26 | 2021-05-07T13:16:26 | 365,238,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | package com.netcracker.denisik.userDetails;
import com.netcracker.denisik.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
private final UserRepository userRepository;
@Autowired
public UserDetailsServiceImpl(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
return new UserDetailsImpl(userRepository.getByEmail(s));
}
}
| [
"[email protected]"
] | |
91a165f42d81b5bfbce90efa83787312c31460c2 | 418804c350e89b4c97f1c5de249fae04913cb64e | /src/main/java/com/fpoly/service/Category_ProductService.java | 7704014609ae5ced02ff9dcf08e5eb463e949f8d | [] | no_license | quanghuy2ktm/HNSneaker | e28ce304ecd7dc966b68755d1ebcdd8d20596417 | 28989fe478abc2c13daf1ffe61c67d7c7d325e6b | refs/heads/master | 2023-07-16T15:03:19.759651 | 2021-07-24T13:38:37 | 2021-07-24T13:38:37 | 376,355,010 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.fpoly.service;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fpoly.model.Category_Product;
import com.fpoly.repositories.Category_ProductRepository;
@Service
public class Category_ProductService {
@Autowired
Category_ProductRepository category_ProductRepository;
public Optional<Category_Product> findById(int id){
return category_ProductRepository.findById(id);
}
}
| [
"[email protected]"
] | |
e5f38d34aae1a7239df41924a60ecf495bf47c30 | d1c0d9d9bf4642ba178a900aff6303f5bdd30abf | /app/src/main/java/com/liutova/avocare/network/AsyncTaskProductFragment.java | 59b168149b550cf9f3a7613e48cecfaed955c6f2 | [] | no_license | sasha-liutova/Avocare | 748e75f58b6605b2b0f1ca264eda15d7ff30a45c | a9d22dbe150c9377ab2e4559a65f2cf21b462005 | refs/heads/master | 2020-12-31T06:33:04.988840 | 2017-02-01T19:56:56 | 2017-02-01T19:56:56 | 80,655,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,098 | java | package com.liutova.avocare.network;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import com.liutova.avocare.helper.CompositionTableRow;
import com.liutova.avocare.listener.ProductFragmentListener;
import com.liutova.avocare.model.DbProduct;
import com.liutova.avocare.model.DbProductBarcode;
import com.liutova.avocare.model.DbProductDescription;
import com.liutova.avocare.model.DbProductsToSubstances;
import com.liutova.avocare.model.DbSafetyLevel;
import com.liutova.avocare.model.DbSafetyLevelDescription;
import com.liutova.avocare.model.DbSubstance;
import com.liutova.avocare.model.DbSubstanceDescription;
import com.liutova.avocare.model.DbSubstanceName;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseQuery;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Created by Oleksandra Liutova on 28-Mar-16.
*/
public class AsyncTaskProductFragment extends AsyncTask {
String productID;
String productName;
String safetyLevelID;
ParseFile photoFile;
int safetyLevel;
String safetyLevelDescription;
boolean isFavourite;
Context context;
String photoURL;
ArrayList<CompositionTableRow> table;
String languageID;
String barcode;
ProductFragmentListener listener;
String TAG = this.getClass().getName();
public AsyncTaskProductFragment(String languageID, String barcode, String productID, ProductFragmentListener listener, Context context) {
this.languageID = languageID;
this.barcode = barcode;
this.productID = productID;
this.listener = listener;
this.context = context;
}
@Override
protected Object doInBackground(Object[] params) {
if (productID == null && barcode == null) {
return null;
}
if (productID == null) {
// get productID by barcode in ProductBarcode
ParseQuery<DbProductBarcode> query = DbProductBarcode.getQuery();
query.whereEqualTo("barcode", barcode);
List<DbProductBarcode> objects = null;
try {
objects = query.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects != null && objects.size() > 0) {
productID = objects.get(0).getProductID();
Log.d(TAG, "product id : " + productID);
}
}
if (productID != null) {
// get product name in ProductDescription
ParseQuery<DbProductDescription> query2 = DbProductDescription.getQuery();
query2.whereEqualTo("productID", productID);
query2.whereEqualTo("languageID", languageID);
List<DbProductDescription> objects2 = null;
try {
objects2 = query2.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects2 != null) {
productName = objects2.get(0).getName();
Log.d(TAG, "productName : " + productName);
}
// get product safety level ID and photo in Product
ParseQuery<DbProduct> query3 = DbProduct.getQuery();
query3.whereEqualTo("objectId", productID);
List<DbProduct> objects3 = null;
try {
objects3 = query3.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects3 != null) {
safetyLevelID = objects3.get(0).getSafetyLevelID();
Log.d(TAG, "safetyLevelID : " + safetyLevelID);
photoFile = objects3.get(0).getPhoto();
photoURL = photoFile.getUrl();
}
// get safety level in SafetyLevel
ParseQuery<DbSafetyLevel> query4 = DbSafetyLevel.getQuery();
query4.whereEqualTo("objectId", safetyLevelID);
List<DbSafetyLevel> objects4 = null;
try {
objects4 = query4.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects4 != null) {
safetyLevel = objects4.get(0).getLevel();
Log.d(TAG, "safetyLevel : " + safetyLevel);
}
// get safety level description
ParseQuery<DbSafetyLevelDescription> query5 = DbSafetyLevelDescription.getQuery();
query5.whereEqualTo("safetyLevelID", safetyLevelID);
query5.whereEqualTo("languageID", languageID);
List<DbSafetyLevelDescription> objects5 = null;
try {
objects5 = query5.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects5 != null) {
safetyLevelDescription = objects5.get(0).getDescription();
Log.d(TAG, "safetyLevelDescription : " + safetyLevelDescription);
}
// pull data for composition
// get substance IDs in ProductsTOSUbstances
ParseQuery<DbProductsToSubstances> query6 = DbProductsToSubstances.getQuery();
query6.whereEqualTo("productID", productID);
List<DbProductsToSubstances> objects6 = null;
try {
objects6 = query6.find();
} catch (ParseException e) {
e.printStackTrace();
}
table = new ArrayList<>();
if (objects6 != null && objects6.size() > 0) {
for (DbProductsToSubstances record : objects6) {
table.add(new CompositionTableRow(record.getOrderInComposition(), record.getSubstanceID()));
}
// for each substance id find safety level id
for (CompositionTableRow item : table) {
ParseQuery<DbSubstance> query7 = DbSubstance.getQuery();
query7.whereEqualTo("objectId", item.getId());
List<DbSubstance> objects7 = null;
try {
objects7 = query7.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects7 != null && objects7.size() > 0) {
item.setSafetyLevelID(objects7.get(0).getSafetyLevelID());
}
// for each substance find safety level value
ParseQuery<DbSafetyLevel> query8 = DbSafetyLevel.getQuery();
query8.whereEqualTo("objectId", item.getSafetyLevelID());
List<DbSafetyLevel> objects8 = null;
try {
objects8 = query8.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects8 != null && objects8.size() > 0) {
item.setSafetyLevel(objects8.get(0).getLevel());
}
// for each substance find safety level description
ParseQuery<DbSafetyLevelDescription> query9 = DbSafetyLevelDescription.getQuery();
query9.whereEqualTo("safetyLevelID", item.getSafetyLevelID());
query9.whereEqualTo("languageID", languageID);
List<DbSafetyLevelDescription> objects9 = null;
try {
objects9 = query9.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects9 != null && objects9.size() > 0) {
item.setSafetyLevelDescription(objects9.get(0).getDescription());
}
// for each substance find description
ParseQuery<DbSubstanceDescription> query10 = DbSubstanceDescription.getQuery();
query10.whereEqualTo("substanceID", item.getId());
query10.whereEqualTo("languageID", languageID);
List<DbSubstanceDescription> objects10 = null;
try {
objects10 = query10.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects10 != null && objects10.size() > 0) {
item.setDescription(objects10.get(0).getDescription());
}
// for each substance find name
ParseQuery<DbSubstanceName> query11 = DbSubstanceName.getQuery();
query11.whereEqualTo("substanceID", item.getId());
query11.whereEqualTo("languageID", languageID);
List<DbSubstanceName> objects11 = null;
try {
objects11 = query11.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects11 != null && objects11.size() > 0) {
item.setName(objects11.get(0).getName());
}
// if substance name in other language was not found - look for english
else if(objects11 != null && objects11.size() == 0 && languageID != "OzCyXIQ5LT"){
ParseQuery<DbSubstanceName> query12 = DbSubstanceName.getQuery();
query12.whereEqualTo("substanceID", item.getId());
query12.whereEqualTo("languageID", "OzCyXIQ5LT");
List<DbSubstanceName> objects12 = null;
try {
objects12 = query12.find();
} catch (ParseException e) {
e.printStackTrace();
}
if (objects12 != null && objects12.size() > 0) {
item.setName(objects12.get(0).getName());
}
}
}
Collections.sort(table, new CustomComparator());
}
}
return null;
}
public void setListenerToNull(){
listener = null;
}
@Override
protected void onPostExecute(Object o) {
if (listener != null) {
listener.onGetResults(productName, safetyLevel, safetyLevelDescription, photoURL, productID, table);
}
}
public class CustomComparator implements Comparator<CompositionTableRow> {
@Override
public int compare(CompositionTableRow o1, CompositionTableRow o2) {
if(o1.getIndex() > o2.getIndex()){
return 1;
}
else if(o1.getIndex() < o2.getIndex()){
return -1;
}
else{
return 0;
}
}
}
}
| [
"[email protected]"
] | |
a5c40f8f8e64d789f227e3e089f650339d043df7 | ca1a8270b02299f1b05171f9bf898af7a9b2099a | /src/com/lib/funsdk/support/utils/CheckNetWork.java | 642e61a71c97650e913048ae802e6ca79bd92aff | [] | no_license | PMMOS/Project_TQ3358 | 892a63ae547bc9088b0729bb4d0cabdef4581509 | 6f5b8d5dff58f7122f2b93d5ad8557861c27880e | refs/heads/master | 2021-01-24T08:06:15.611912 | 2018-01-23T03:19:42 | 2018-01-23T03:19:42 | 93,371,286 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package com.lib.funsdk.support.utils;
import com.lib.SDKCONST.NetWorkType;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class CheckNetWork {
public static int NetWorkUseful(Context context) {
String net_type;
ConnectivityManager manager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (manager == null) {
return NetWorkType.No_NetWork;
}
NetworkInfo networkinfo = manager.getActiveNetworkInfo();
if (networkinfo == null || !networkinfo.isAvailable()) {
return NetWorkType.No_NetWork;
}
net_type = networkinfo.getTypeName();
if (net_type.equalsIgnoreCase("WIFI"))
return NetWorkType.Wifi;
else if (net_type.equalsIgnoreCase("MOBILE"))
return NetWorkType.Other_NetWork;
return NetWorkType.No_NetWork;
}
}
| [
"[email protected]"
] | |
c53a90d447872d1296f6d82fcc7ad1df4908b22b | 252f59b7ee3e17d44c1fd392a0d83e05f17c2022 | /app/src/main/java/com/frontinelabs/rxsample/service/ApiUtils.java | 58f94f216a22ee7860ed707b32e3f9b54ac9c0ea | [
"MIT"
] | permissive | emjea/RxSample | 03f9e45b5431f791d54973f13156988a08047ca1 | 504d87d06f2678ed31ea6752e1b18449fbdaf794 | refs/heads/master | 2021-05-08T07:38:13.486270 | 2017-10-14T08:39:05 | 2017-10-14T08:39:05 | 106,777,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.frontinelabs.rxsample.service;
/**
* Created by EBaba on 10/10/2017.
*/
public class ApiUtils {
public static final String BASE_URL = "https://api.stackexchange.com/2.2/";
public static SOService getSOService() {
return RetrofitClient.getClient(BASE_URL).create(SOService.class);
}
}
| [
"[email protected]"
] | |
713404890e1fa690b7300b544ffa50c98cbe04e4 | d98e1f57f203b482adfbe3cde8c5ecaa621bd62d | /src/main/java/com/url/urlmessage/utils/AccessUtils.java | b6f81a9b100fddef85c3070820192437f2f89732 | [] | no_license | wangganghua/urlmessage | 63adc86a1f4c04741ecd208a831f76cfdc96a050 | c55c9159222b883f91d2f4a43ba017b58c01f0c4 | refs/heads/master | 2020-04-03T18:29:55.473311 | 2018-11-09T02:28:44 | 2018-11-09T02:28:44 | 155,486,603 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,160 | java | package com.url.urlmessage.utils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.ClassUtils;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.*;
import java.util.List;
/**
* 操作 mdb (Access)文件
*/
public class AccessUtils {
@Value("${access.mdb.jdbc.url}")
private static String access_url;
@Value("${access.mdb.driverClassName}")
private static String access_driver;
@Value("${spring.thymeleaf.prefix}")
private static String access_temp_path;
private static ClassPathResource classPathResource = new ClassPathResource("templates/temp.mdb");
private static String path = ClassUtils.getDefaultClassLoader().getResource("").getPath();
/**
* 连接 access
*
* @param path_fileName: access文件全路径
*/
public static Connection getCon(String path_fileName) {
//加载驱动
try {
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
} catch (ClassNotFoundException cnfex) {
System.out.println("Problem in loading or registering MS Access JDBC driver");
cnfex.printStackTrace();
}
try {
// return DriverManager.getConnection("jdbc:unanaccess://" + path_fileName);
return DriverManager.getConnection("jdbc:ucanaccess://E:\\wgh.accdb;showSchema=true");
} catch (Exception e) {
System.out.println(e.getMessage());
return null;
}
}
/**
* 关闭资源
*
* @param con 连接
* @param preparedStatement
* @param resultSet
*/
public static void close(Connection con, PreparedStatement preparedStatement, ResultSet resultSet) {
try {
if (resultSet != null)
resultSet.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (preparedStatement != null)
preparedStatement.close();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
/**
* 通过 create table 语句创建 access table
*
* @param fullPath : 路径及文件名
* @param strSql :create sql语句
*/
public static boolean CreateAccessTable(String fullPath, String strSql) {
if (!strSql.trim().toUpperCase().contains("CREATE")) {
System.out.println("create access file need 'create table' begin.......");
return false;
}
PreparedStatement ps = null;
Connection con = getCon(fullPath);
try {
con.setSchema("wag");
//Statement statement = con.createStatement(); //创建 table
PreparedStatement preparedStatement = null;
preparedStatement = con.prepareStatement(strSql);
preparedStatement.execute();
//statement.execute(strSql);
return true;
} catch (SQLException e) {
e.printStackTrace();
return false;
} finally {
close(con, ps, null);
}
}
public static boolean insertInto(String fullPath, List<String> listSql) {
// if (!strSql.trim().toUpperCase().contains("INSERT")) {
// System.out.println("create access file need 'create table' begin.......");
// return false;
// }
Connection con = getCon(fullPath);
try {
Statement statement = con.createStatement(); //创建 table
listSql.forEach(item -> {
try {
statement.executeUpdate(item.toString());
} catch (SQLException e) {
e.printStackTrace();
}
});
return true;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
/**
* 复制temp.mdb 空模板
*
* @param fileTo : 复制到目的地
* @return : 返回 true:成功、false:失败
*/
public static boolean copyTemp(String fileTo) {
try {
FileInputStream fileInputStream = new FileInputStream(path + classPathResource.getPath());
FileOutputStream fileOutputStream = new FileOutputStream(fileTo);
byte[] bytes = new byte[20480];
int count;
while ((count = fileInputStream.read(bytes)) > 0) {
fileOutputStream.write(bytes, 0, count);
}
fileInputStream.close();
fileOutputStream.close();
return true;
} catch (IOException e) {
e.printStackTrace();
System.out.println(classPathResource.getPath());
return false;
}
}
}
| [
"[email protected]"
] | |
7b4dcbec1a9c44b346b604b0e58e5407ecdf721e | f649f4cfcb2ed5942567eba9b3fb39431f5c19aa | /MSGameBoard.java | 434854863fc35be9441155ae89f8ca330d129b5f | [] | no_license | koldysnk/Mine-Sweeper | 74639cad126d11135d096ef39aaa42758cc454dc | a952da956316a3465acea137fb0409d37afecff8 | refs/heads/master | 2021-07-19T05:56:16.709462 | 2020-05-27T05:10:48 | 2020-05-27T05:10:48 | 169,358,530 | 0 | 0 | null | 2020-05-27T05:04:35 | 2019-02-06T05:16:31 | Java | UTF-8 | Java | false | false | 9,457 | java | import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class MSGameBoard extends JPanel
{
private static JButton[][] squares;
private static int[][] values;
private static ImageIcon bomb,flag, one,two,three,four,five,six,seven,eight,blank,noFlag;
private static boolean shift=false;
private static boolean firstClick;
private static int numBombs;
private static int numFlags;
private static int numberOfRows;
private static int numberOfColumns;
private static Timer timer;
public MSGameBoard(/*MSScoreboard*/)
{
//sBoard=b;
firstClick = true;
timer = new Timer(1000, new AddSecond());
numBombs=45;
numFlags=0;
setLayout(new GridLayout(20,20));
bomb = new ImageIcon("images/bomb.GIF");
flag = new ImageIcon("images/flag.GIF");
one = new ImageIcon("images/one.GIF");
two = new ImageIcon("images/two.GIF");
three = new ImageIcon("images/three.GIF");
four = new ImageIcon("images/four.GIF");
five = new ImageIcon("images/five.GIF");
six = new ImageIcon("images/six.GIF");
seven = new ImageIcon("images/seven.GIF");
eight = new ImageIcon("images/eight.GIF");
blank = new ImageIcon("images/eight(1).GIF");
noFlag = new ImageIcon("images/noflag.GIF");
squares = new JButton[20][20];
values = new int[20][20];
for(int r=0; r<values.length;r++)
{
for(int c=0; c<values[0].length;c++)
{
squares[r][c]= new JButton();
squares[r][c].addActionListener(new action(r,c));
add(squares[r][c]);
values[r][c]=0;
}
}
}
public static void setNumBombs(int n)
{
numBombs=n;
numFlags=n;
MSScoreboard.setBombs(n);
}
public static void checkWin()
{
for(int a = 0; a<values.length; a++)
{
for(int b = 0; b<values[a].length; b++)
{
if(squares[a][b].getIcon()!=null && squares[a][b].getIcon().equals(flag))
{
if(values[a][b]!=-9)
return;
}
else if(values[a][b]==-9)
{
return;
}
}
}
timer.stop();
String inputValue = JOptionPane.showInputDialog("YOU WON! Score: "+MSScoreboard.getScore()+"\nEnter your name.");
if(numBombs==50)
MSScoreboard.changeScores(inputValue,MSScoreboard.getScore());
else if(numBombs==63)
MSScoreboard.changeScores2(inputValue,MSScoreboard.getScore());
else if(numBombs==83)
MSScoreboard.changeScores3(inputValue,MSScoreboard.getScore());
reset();
}
public static void reset()
{
timer.stop();
MSScoreboard.setBombs(numBombs);
for(int r=0; r<values.length;r++)
{
for(int c=0; c<values[0].length;c++)
{
values[r][c]=0;
squares[r][c].setIcon(null);
if(!squares[r][c].isEnabled())
{
squares[r][c].setEnabled(true);
}
}
}
MSScoreboard.setScore(0);
firstClick=true;
}
public static void fillBoard(int x,int y)
{
for(int i=0;i<numBombs;i++)
{
int r=(int)(Math.random()*20);
int c=(int)(Math.random()*20);
if(r==x &&c==y)
i--;
else if(r==x &&c==y+1)
i--;
else if(r==x &&c==y-1)
i--;
else if(r==x-1 &&c==y)
i--;
else if(r==x-1 &&c==y-1)
i--;
else if(r==x-1 &&c==y+1)
i--;
else if(r==x+1 &&c==y+1)
i--;
else if(r==x+1 &&c==y)
i--;
else if(r==x+1 &&c==y-1)
i--;
else if(values[r][c]==-9)
i--;
else
{
values[r][c]=-9;
suround(r,c);
}
}
}
public static void suround(int r, int c)
{
if(r-1>=0)
{
if(c-1>=0)
{
if(values[r-1][c-1]!=-9)
values[r-1][c-1]-=1;
}
if(values[r-1][c]!=-9)
values[r-1][c]-=1;
if(c+1<20)
{
if(values[r-1][c+1]!=-9)
values[r-1][c+1]-=1;
}
}
if(c-1>=0)
{
if(values[r][c-1]!=-9)
values[r][c-1]-=1;
}
if(c+1<20)
{
if(values[r][c+1]!=-9)
values[r][c+1]-=1;
}
if(r+1<20)
{
if(c-1>=0)
{
if(values[r+1][c-1]!=-9)
values[r+1][c-1]-=1;
}
if(values[r+1][c]!=-9)
values[r+1][c]-=1;
if(c+1<20)
{
if(values[r+1][c+1]!=-9)
values[r+1][c+1]-=1;
}
}
}
public static void show(int r, int c)
{
values[r][c]*=-1;
if(values[r][c]==0)
squares[r][c].setEnabled(false);
if(values[r][c]==0)
{
if(r-1>=0)
{
if(c-1>=0)
{
if(squares[r-1][c-1].isEnabled())
show(r-1,c-1);
}
if(squares[r-1][c].isEnabled())
show(r-1,c);
if(c+1<20)
{
if(squares[r-1][c+1].isEnabled())
show(r-1,c+1);
}
}
if(c-1>=0)
{
if(squares[r][c-1].isEnabled())
show(r,c-1);
}
if(c+1<20)
{
if(squares[r][c+1].isEnabled())
show(r,c+1);
}
if(r+1<20)
{
if(c-1>=0)
{
if(squares[r+1][c-1].isEnabled())
show(r+1,c-1);
}
if(squares[r+1][c].isEnabled())
show(r+1,c);
if(c+1<20)
{
if(squares[r+1][c+1].isEnabled())
show(r+1,c+1);
}
}
}
else
{
if(values[r][c]!=9)
{
if(values[r][c]==8)
squares[r][c].setIcon(eight);
if(values[r][c]==7)
squares[r][c].setIcon(seven);
if(values[r][c]==6)
squares[r][c].setIcon(six);
if(values[r][c]==5)
squares[r][c].setIcon(five);
if(values[r][c]==4)
squares[r][c].setIcon(four);
if(values[r][c]==3)
squares[r][c].setIcon(three);
if(values[r][c]==2)
squares[r][c].setIcon(two);
if(values[r][c]==1)
squares[r][c].setIcon(one);
}
else
{
squares[r][c].setIcon(bomb);
youLost();
}
}
}
public static void youLost()
{
//squares[r][c].setIcon(bomb);
for(int a = 0; a<values.length; a++)
{
for(int b = 0; b<values[a].length; b++)
{
if(squares[a][b].getIcon()!=null && squares[a][b].getIcon().equals(flag))
{
if(values[a][b]!=-9)
squares[a][b].setIcon(noFlag);
}
else if(values[a][b]==-9)
{
squares[a][b].setIcon(bomb);
}
}
}
JOptionPane.showMessageDialog( null,
"You Lost", "You Lost",
JOptionPane.ERROR_MESSAGE);
reset();
}
public static void shift()
{
shift=!shift;
}
private class AddSecond implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
MSScoreboard.setScore(MSScoreboard.getScore()+1);
}
}
private class action implements ActionListener
{
private int row,col;
public action(int r, int c)
{
row=r;
col=c;
}
public void actionPerformed(ActionEvent action)
{
if(firstClick)
{
firstClick=false;
fillBoard(row,col);
if(shift)
{
squares[row][col].setIcon(flag);
}
else
show(row,col);
timer.start();
}
else
if(shift)
{
if(squares[row][col].getIcon()==null)
{
squares[row][col].setIcon(flag);
MSScoreboard.setBombs(MSScoreboard.getBombs()-1);
if(MSScoreboard.getBombs()==0)
{
checkWin();
}
}
else if(squares[row][col].getIcon().equals(flag))
{
squares[row][col].setIcon(null);
MSScoreboard.setBombs(MSScoreboard.getBombs()+1);
}
}
else
{
if(squares[row][col].getIcon()==null)
show(row,col);
}
}
}
} | [
"[email protected]"
] | |
2f6e6ef4e56b6df0957e896ec0a4e41f31f999f9 | 1b25d7099f22f050a1110a2f0eb0f16a11136ca9 | /basics-servlet/src/main/java/ai/shape/basics/routerservlet/OptionsHandler.java | 104b0bdccad062a196e7d7b4bd3b025c750baec9 | [
"Apache-2.0"
] | permissive | tombaeyens/basics | ea11875d299ecacaa46c9e89f16b6e3c27fdfd23 | d36685cf7e70ff9686af9b7a65eca8fc6c161c02 | refs/heads/master | 2020-06-01T08:47:41.664512 | 2019-05-28T19:26:03 | 2019-05-28T19:26:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,158 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package ai.shape.basics.routerservlet;
import ai.shape.basics.util.Http;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/** In contrast to the normal request handlers, a new OptionsHandler is
* created for each OPTIONS request. For other RequestHandler's, only
* one object is used for all requests. */
public class OptionsHandler implements RequestHandler {
protected List<String> allowedMethods = new ArrayList<>();
public void addAllowedMethod(String method) {
allowedMethods.add(method);
}
@Override
public String method() {
return Http.Methods.OPTIONS;
}
@Override
public boolean pathMatches(ServerRequest request) {
return true;
}
@Override
public void handle(ServerRequest request, ServerResponse response) {
// We assume that whatever headers the client requests is fine so we just copy all in the Access-Control-Allow-Headers
String allowedHeaders = request.getHeader(Http.Headers.ACCESS_CONTROL_REQUEST_HEADERS);
String allowedMethods = this.allowedMethods.stream().collect(Collectors.joining(", "));
response
.statusOk()
.header(Http.Headers.ACCESS_CONTROL_ALLOW_METHODS, allowedMethods)
.header(Http.Headers.ACCESS_CONTROL_ALLOW_HEADERS, allowedHeaders)
.headerContentType(Http.ContentTypes.TEXT_PLAIN);
}
}
| [
"[email protected]"
] | |
17cfd64301c8d038fc5d69ea21ae8d621fb13d7f | 000e9ddd9b77e93ccb8f1e38c1822951bba84fa9 | /java/classes3/com/ziroom/ziroomcustomer/social/b/c.java | 741d348ffdfae06085a3b54924f1ddd08ab53bc9 | [
"Apache-2.0"
] | permissive | Paladin1412/house | 2bb7d591990c58bd7e8a9bf933481eb46901b3ed | b9e63db1a4975b614c422fed3b5b33ee57ea23fd | refs/heads/master | 2021-09-17T03:37:48.576781 | 2018-06-27T12:39:38 | 2018-06-27T12:41:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,990 | java | package com.ziroom.ziroomcustomer.social.b;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;
import com.growingio.android.sdk.agent.VdsAgent;
public class c
{
private static Toast a;
private static View b;
public static void showToast(Context paramContext, int paramInt)
{
showToast(paramContext, paramInt, 0);
}
public static void showToast(Context paramContext, int paramInt1, int paramInt2)
{
if (paramContext == null) {
return;
}
if (b == null) {
b = ((LayoutInflater)paramContext.getApplicationContext().getSystemService("layout_inflater")).inflate(2130904650, null);
}
if (a == null) {
a = Toast.makeText(paramContext.getApplicationContext(), paramInt1, paramInt2);
}
a.setView(b);
a.setGravity(16842927, 0, 0);
paramContext = a;
if (!(paramContext instanceof Toast))
{
paramContext.show();
return;
}
VdsAgent.showToast((Toast)paramContext);
}
public static void showToast(Context paramContext, String paramString)
{
showToast(paramContext, paramString, 0);
}
public static void showToast(Context paramContext, String paramString, int paramInt)
{
if (paramContext == null) {
return;
}
if (b == null) {
b = ((LayoutInflater)paramContext.getApplicationContext().getSystemService("layout_inflater")).inflate(2130904650, null);
}
if (a == null) {
a = Toast.makeText(paramContext.getApplicationContext(), paramString, paramInt);
}
a.setView(b);
a.setGravity(16842927, 0, 0);
paramContext = a;
if (!(paramContext instanceof Toast))
{
paramContext.show();
return;
}
VdsAgent.showToast((Toast)paramContext);
}
}
/* Location: /Users/gaoht/Downloads/zirom/classes3-dex2jar.jar!/com/ziroom/ziroomcustomer/social/b/c.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
07257c06a542794816be8c0e0484a83bf923eefc | bfb8af8107bc2095490df2c4db1c45125dba3a54 | /src/model/MyFileDAO.java | f7ae09aa415cbeba22df3e643788303c7c831548 | [] | no_license | ahn3752/K07JSPServlet | 8c564dbe61e3772cd12f23904b68206f46dd4cdb | 6b1d45159ce0fe12e1b5cd40f61d187b804d92b5 | refs/heads/master | 2023-02-12T07:22:43.941305 | 2021-01-13T09:29:34 | 2021-01-13T09:29:34 | 314,505,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,557 | java | package model;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import java.util.Vector;
import javax.servlet.ServletContext;
public class MyFileDAO {
Connection con;
PreparedStatement psmt;
ResultSet rs;
public MyFileDAO(ServletContext ctx) {
try {
Class.forName(ctx.getInitParameter("JDBCDriver"));
String id = "kosmo";
String pw = "1234";
con = DriverManager.getConnection(
ctx.getInitParameter("ConnectionURL"), id, pw);
System.out.println("DB연결성공");
}catch(Exception e) {
System.out.println("DB연결실패");
e.printStackTrace();
}
}
//입력처리
public int myfileInsert(MyFileDTO dto) {
int affected = 0;
try {
String query = " INSERT INTO myfile ( "
+ " idx, name, title, inter, ofile, sfile ) "
+ " VALUES ( "
+ " SEQ_BBS_NUM.nextval, ?, ?, ?, ?, ?)";
psmt = con.prepareStatement(query);
psmt.setString(1, dto.getName());
psmt.setString(2, dto.getTitle());
psmt.setString(3, dto.getInter());
psmt.setString(4, dto.getOfile());
psmt.setString(5, dto.getSfile());
affected = psmt.executeUpdate();
}
catch(Exception e) {
System.out.println("insert중 예외발생");
e.printStackTrace();
}
return affected;
}
public List<MyFileDTO> myFileList(){
List<MyFileDTO> fileList = new Vector<MyFileDTO>();
String query="SELECT * FROm myfile"
+" WHERE 1=1 "
+" ORDER BY idx DESC";
System.out.println("query="+query);
try {
psmt=con.prepareStatement(query);
rs=psmt.executeQuery();
while(rs.next()) {
MyFileDTO dto = new MyFileDTO();
dto.setIdx(rs.getString(1));
dto.setName(rs.getString(2));
dto.setTitle(rs.getString(3));
dto.setInter(rs.getString(4));
dto.setOfile(rs.getString(5));
dto.setSfile(rs.getString(6));
dto.setPostdate(rs.getString(7));
fileList.add(dto);
}
}catch(Exception e) {
System.out.println("Select시 예외발생");
e.printStackTrace();
}
return fileList;
}
}
| [
"[email protected]"
] | |
6847bd428f180899e9f9e119605ada330ce0fa15 | b6ea417b48402d85b6fe90299c51411b778c07cc | /spring-web/src/test/java/org/springframework/http/client/support/InterceptingHttpAccessorTests.java | 70c7cf3ca7d266eace17fbb05aa065a8d2f5a85a | [
"Apache-2.0"
] | permissive | DevHui/spring-framework | 065f24e96eaaed38495b9d87bc322db82b6a046c | 4a2f291e26c6f78c3875dea13432be21bb1c0ed6 | refs/heads/master | 2020-12-04T21:08:18.445815 | 2020-01-15T03:54:42 | 2020-01-15T03:54:42 | 231,526,595 | 1 | 0 | Apache-2.0 | 2020-01-03T06:28:30 | 2020-01-03T06:28:29 | null | UTF-8 | Java | false | false | 2,872 | java | /*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.http.client.support;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertThat;
/**
* Tests for {@link InterceptingHttpAccessor}.
*
* @author Brian Clozel
*/
public class InterceptingHttpAccessorTests {
@Test
public void getInterceptors() {
TestInterceptingHttpAccessor accessor = new TestInterceptingHttpAccessor();
List<ClientHttpRequestInterceptor> interceptors = Arrays.asList(
new SecondClientHttpRequestInterceptor(),
new ThirdClientHttpRequestInterceptor(),
new FirstClientHttpRequestInterceptor()
);
accessor.setInterceptors(interceptors);
assertThat(accessor.getInterceptors().get(0), Matchers.instanceOf(FirstClientHttpRequestInterceptor.class));
assertThat(accessor.getInterceptors().get(1), Matchers.instanceOf(SecondClientHttpRequestInterceptor.class));
assertThat(accessor.getInterceptors().get(2), Matchers.instanceOf(ThirdClientHttpRequestInterceptor.class));
}
private class TestInterceptingHttpAccessor extends InterceptingHttpAccessor {
}
@Order(1)
private class FirstClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) {
return null;
}
}
private class SecondClientHttpRequestInterceptor implements ClientHttpRequestInterceptor, Ordered {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) {
return null;
}
@Override
public int getOrder() {
return 2;
}
}
private class ThirdClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) {
return null;
}
}
}
| [
"[email protected]"
] | |
4be963fb47b48a58fac58fb5145bf991651966bb | 05f27a5a8e4d76e582a3846989a9f885ac9da263 | /src/test/java/org/jenkinsci/plugins/gitclient/trilead/CredentialsProviderImplTest.java | 19d39c8bdaaee215d7f2ce141c30b8f8c21ccdc7 | [
"MIT"
] | permissive | jsoref/git-client-plugin | 6f3ecd5faaa6e9eec66fe068d21e0e0d0cfddb71 | 347c9c76978320031fe88367a5f4ded0ab7d2401 | refs/heads/master | 2020-03-22T11:56:36.961370 | 2018-07-06T04:07:14 | 2018-07-06T04:07:14 | 140,006,238 | 0 | 0 | MIT | 2018-07-06T16:14:26 | 2018-07-06T16:14:25 | null | UTF-8 | Java | false | false | 5,238 | java | package org.jenkinsci.plugins.gitclient.trilead;
import com.cloudbees.plugins.credentials.CredentialsDescriptor;
import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.common.StandardUsernameCredentials;
import hudson.model.TaskListener;
import hudson.util.Secret;
import hudson.util.StreamTaskListener;
import java.net.URISyntaxException;
import org.eclipse.jgit.errors.UnsupportedCredentialItem;
import org.eclipse.jgit.transport.CredentialItem;
import org.eclipse.jgit.transport.URIish;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
public class CredentialsProviderImplTest {
private CredentialsProviderImpl provider;
private TaskListener listener;
private StandardUsernameCredentials cred;
private final String USER_NAME = "user-name";
private final URIish uri;
private final String SECRET_VALUE = "secret-credentials-provider-impl-test";
@Rule
public ExpectedException exception = ExpectedException.none();
public CredentialsProviderImplTest() throws URISyntaxException {
uri = new URIish("git://github.com/jenkinsci/git-client-plugin.git");
}
@Before
public void setUp() {
Secret secret = Secret.fromString(SECRET_VALUE);
listener = StreamTaskListener.fromStdout();
cred = new StandardUsernamePasswordCredentialsImpl(USER_NAME, secret);
provider = new CredentialsProviderImpl(listener, cred);
}
@Test
public void testIsInteractive() {
assertFalse(provider.isInteractive());
}
@Test
public void testSupportsNullItems() {
CredentialItem.Username nullItem = null;
assertFalse(provider.supports(nullItem));
}
@Test
public void testSupportsUsername() {
CredentialItem.Username username = new CredentialItem.Username();
assertNull(username.getValue());
assertTrue(provider.supports(username));
assertTrue(provider.get(uri, username));
assertEquals(USER_NAME, username.getValue());
}
@Test
public void testSupportsPassword() {
CredentialItem.Password password = new CredentialItem.Password();
assertNull(password.getValue());
assertTrue(provider.supports(password));
assertTrue(provider.get(uri, password));
assertNotNull(password.getValue());
}
@Test
public void testSupportsSpecialStringType() {
CredentialItem.StringType specialStringType = new CredentialItem.StringType("Password: ", false);
assertNull(specialStringType.getValue());
/* The supports() method does not know about the "special" StringType
* which can be used to return the password plaintext. Passing a
* StringType with the prompt text "Password: " will return the plain
* text password.
*/
assertFalse(provider.supports(specialStringType));
assertTrue(provider.get(uri, specialStringType));
assertEquals(SECRET_VALUE, specialStringType.getValue());
}
@Test
public void testSpecialStringTypeThrowsException() {
CredentialItem.StringType specialStringType = new CredentialItem.StringType("Bad Password: ", false);
assertFalse(provider.supports(specialStringType));
exception.expect(UnsupportedCredentialItem.class);
assertTrue(provider.get(uri, specialStringType));
}
@Test
public void testThrowsUnsupportedOperationException() {
CredentialItem.InformationalMessage message = new CredentialItem.InformationalMessage("Some info");
assertFalse(provider.supports(message));
exception.expect(UnsupportedCredentialItem.class);
assertTrue(provider.get(uri, message));
}
@Test
public void testSupportsDisallowed() {
Secret secret = Secret.fromString(SECRET_VALUE);
listener = StreamTaskListener.fromStdout();
StandardUsernameCredentials badCred = new MyUsernameCredentialsImpl(USER_NAME);
CredentialsProviderImpl badProvider = new CredentialsProviderImpl(listener, badCred);
CredentialItem.Username username = new CredentialItem.Username();
assertNull(username.getValue());
assertFalse(badProvider.supports(username));
assertFalse(badProvider.get(uri, username));
assertNull(username.getValue());
}
private class MyUsernameCredentialsImpl implements StandardUsernameCredentials {
private final String username;
MyUsernameCredentialsImpl(String username) {
this.username = username;
}
public String getDescription() {
throw new UnsupportedOperationException("Do not call");
}
public String getId() {
throw new UnsupportedOperationException("Do not call");
}
public CredentialsScope getScope() {
throw new UnsupportedOperationException("Do not call");
}
public CredentialsDescriptor getDescriptor() {
throw new UnsupportedOperationException("Do not call");
}
public String getUsername() {
return username;
}
}
}
| [
"[email protected]"
] | |
60006e4cbc3ea49e86867b1cbf5dcab60e0653bf | eac756d34ce63a7f39ed196d4e22bec698fb9ae0 | /src/main/java/com/sunshine/netty/chat/server/SimpleChatServerHandler.java | eea870aaa0c8d06ce6332b93510e01b5097af35f | [] | no_license | wangtao927/JavaTest | 95b1f846ed52e8bf40b0f79238270fff4813f07a | ce26eb5db8463f525323acffc71b9ca61b2ec002 | refs/heads/master | 2022-12-29T02:07:11.574420 | 2020-05-31T11:07:39 | 2020-05-31T11:07:39 | 117,941,899 | 0 | 0 | null | 2022-12-16T05:58:57 | 2018-01-18T06:25:56 | Java | UTF-8 | Java | false | false | 2,273 | java | package com.sunshine.netty.chat.server;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;
/**
*
*/
public class SimpleChatServerHandler extends SimpleChannelInboundHandler<String> {
public static ChannelGroup channels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception { // (2)
Channel incoming = ctx.channel();
channels.writeAndFlush("[SERVER] - " + incoming.remoteAddress() + " 加入\n");
channels.add(ctx.channel());
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
Channel incoming = ctx.channel();
channels.writeAndFlush("[SERVER] - " + incoming.remoteAddress() + " 离开\n");
channels.remove(ctx.channel());
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, String s) throws Exception {
Channel incoming = ctx.channel();
for (Channel channel : channels) {
if (channel != incoming){
channel.writeAndFlush("[" + incoming.remoteAddress() + "]" + s + "\n");
} else {
channel.writeAndFlush("[you]" + s + "\n");
}
}
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception { // (5)
Channel incoming = ctx.channel();
System.out.println("SimpleChatClient:"+incoming.remoteAddress()+"在线");
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception { // (6)
Channel incoming = ctx.channel();
System.out.println("SimpleChatClient:"+incoming.remoteAddress()+"掉线");
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { // (7)
Channel incoming = ctx.channel();
System.out.println("SimpleChatClient:"+incoming.remoteAddress()+"异常");
// 当出现异常就关闭连接
cause.printStackTrace();
ctx.close();
}
}
| [
"meilin@1216"
] | meilin@1216 |
aa77c2821807df56852021839b60b83885e2108a | 1aca06de76ca6e71f1f8050c756b5d93b38b2bc4 | /src/main/java/org/jorge/fin/Direccion.java | 8c91ba3a2cee3195a2b4352420474982f83953b3 | [] | no_license | jorgezamora95/proyecto-final | a9a2fc00c598b3e97eae3338f9e6b5a74cc84ec2 | 61ee4a27681d3aeceee85e8cb24b47b58e1db7ae | refs/heads/master | 2020-12-02T21:10:13.660902 | 2017-08-02T02:42:35 | 2017-08-02T02:42:35 | 96,265,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.jorge.fin;
/**
*
* @author T-
*/
public class Direccion {
private String calle;
private String colonia;
private Long cp;
public Direccion() {
}
public Direccion(String calle) {
this.calle = calle;
}
public Direccion(String calle, String colonia, Long cp) {
this.calle = calle;
this.colonia = colonia;
this.cp = cp;
}
public String getCalle() {
return calle;
}
public void setCalle(String calle) {
this.calle = calle;
}
public String getColonia() {
return colonia;
}
public void setColonia(String colonia) {
this.colonia = colonia;
}
public Long getCp() {
return cp;
}
public void setCp(Long cp) {
this.cp = cp;
}
}
| [
"T-@PC198"
] | T-@PC198 |
94d0b538efade5346043cb42bc14287b614faa22 | 366a3727e333b94152535401d59807e754aef130 | /AndroidLegacy/gen/vn/ce/sale/Manifest.java | 3723d0bf555baaf54ab69f45821628ec0e8b6991 | [] | no_license | kieunv1102/MyData | 60e86477b16e185b223aa30fbf439340e3d15475 | 267482c107741eecfeb67ac06f217fad952ebe6c | refs/heads/master | 2021-01-11T11:25:47.380999 | 2016-11-03T15:03:15 | 2016-11-03T15:03:15 | 72,654,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package vn.ce.sale;
public final class Manifest {
public static final class permission {
public static final String MAPS_RECEIVE="com.google.maps.android.utils.permission.MAPS_RECEIVE";
}
}
| [
"[email protected]"
] | |
6428653f67d98fae777f6a29d4985e5284842657 | c5e04795088464c71f9a23d7d9fc2d2fe35b4cc1 | /musicplayer/src/main/java/adrian/example/musicplayer/service/list/UserInformationServiceListImpl.java | 8a1a9444d1648ee0ff1fa85c63c0e8fda331c2b0 | [] | no_license | bhafelsepaer/MusicPlayer | 7b6bc951059f51635c74bb9c9835ddb1f649b4e2 | 85db53d2a92011825f6d9360dc88a998591683e2 | refs/heads/master | 2020-05-13T17:01:47.739231 | 2015-01-12T15:58:57 | 2015-01-12T15:58:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 888 | java | package adrian.example.musicplayer.service.list;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
@Service("userInformationServiceListImpl")
public class UserInformationServiceListImpl implements UserInformationServiceList{
@Override
public List<String> getInterest() {
List<String> interest = new ArrayList<String>();
interest.add("Football");
interest.add("Video Game");
interest.add("Travel");
interest.add("Tennis");
interest.add("Fight");
return interest;
}
@Override
public List<String> getProgrammingStyle() {
List<String> programmingStyle = new ArrayList<String>();
programmingStyle.add("JAVA");
programmingStyle.add("JAVAEE");
programmingStyle.add("Spring");
programmingStyle.add("Struts");
programmingStyle.add("Hibernate");
programmingStyle.add("JSP");
return programmingStyle;
}
}
| [
"[email protected]"
] | |
9b357168dc5cc22e91709c601d78ac0e80ac5995 | b7e059fcec80340f0d371eb2f387111da9fbdaf1 | /zipzap/src/com/monkeysonnet/zipzap/behaviours/DieOnRangeBehaviour.java | 66fbbed66c7bb504582cf08d3ad8d1104f7670fb | [] | no_license | felixwatts/zipzap | 62412084ceeccd1221ba265260e4fd2ce96133ae | a720c704221464310ba6433f9564b1c77e2e0f92 | refs/heads/master | 2021-07-21T14:03:46.911690 | 2017-10-31T13:31:26 | 2017-10-31T13:31:26 | 106,736,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package com.monkeysonnet.zipzap.behaviours;
import com.monkeysonnet.engine.IEntity;
import com.monkeysonnet.zipzap.IOrigin;
import com.monkeysonnet.zipzap.Z;
public class DieOnRangeBehaviour extends BehaviourBase
{
private static final float MAX_RANGE_2 = 10000;
private static DieOnRangeBehaviour _instance;
@Override
public void update(float dt, IEntity subject)
{
if(((IOrigin)subject).origin().dst2(Z.sim().focalPoint()) > MAX_RANGE_2)
subject.free();
}
public static DieOnRangeBehaviour instance()
{
if(_instance == null)
_instance = new DieOnRangeBehaviour();
return _instance;
}
}
| [
"[email protected]"
] | |
92090307173b28d9b638b7229a8481cc3fa38c6b | fde5d72b9bfefe28b777f44b1026ce9a32b3e277 | /WordSearch.java | d06edc167a4768c4333ffa60ee4075335348d2b1 | [] | no_license | sbrink00/MKS21X-WordSearch | bdd30a282ecd1f1a61eeea581db846e2fc424ffd | e3a8a71d878126f386e490c19a576ec75c9dab25 | refs/heads/master | 2020-04-05T06:12:09.176857 | 2018-11-19T04:00:17 | 2018-11-19T04:00:17 | 156,629,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,071 | java | import java.util.*;
import java.io.*;
public class WordSearch{
private char[][] data;
private int seed;
private Random randgen;
private ArrayList<String>wordsToAdd;
private ArrayList<String>wordsAdded;
private static String instructions;
public static void main(String[]args){
instructions = "This program can be used with three, four, or five arguments\n arg 1 is the number of rows. It must be an int greater than 0.\n arg 2 is the number of columns. It must be a int greater than 0.\n arg 3 is a string that is the name of the file you wish to use. This file must exist within the directory of the wordsearch class\n the optional 4th argument is an int between 0 and 10000 inclusive that is the random seed you wish to use. Use this argument if you want a reproducible search.\n arg 5 is and optional string. If you enter key, it will give you the answer key";
WordSearch output;
if (args.length < 3){
System.out.println(instructions);
System.exit(0);
}
try{
if (args.length > 2){
int r = Integer.parseInt(args[0]);
int c = Integer.parseInt(args[1]);
}
if (args.length > 3){
int r = Integer.parseInt(args[3]);
}
}
catch (NumberFormatException e){
System.out.println(instructions);
System.exit(0);
}
if (args.length > 2 && (Integer.parseInt(args[0]) < 1 || Integer.parseInt(args[1]) < 1)){
System.out.println(instructions);
System.exit(0);
}
if ((args.length == 4 || args.length == 5) && (Integer.parseInt(args[3]) < 0 || Integer.parseInt(args[3]) > 10000)){
System.out.println(instructions);
System.exit(0);
}
if (Integer.parseInt(args[0]) < 1 || Integer.parseInt(args[1]) < 1){
System.out.println(instructions);
System.exit(0);
}
if (args.length == 3){
output = new WordSearch(Integer.parseInt(args[0]), Integer.parseInt(args[1]), args[2], (int)(Math.random() * 10000), "");
System.out.println(output);
}
if (args.length == 4){
output = new WordSearch(Integer.parseInt(args[0]), Integer.parseInt(args[1]), args[2], Integer.parseInt(args[3]), "");
System.out.println(output);
}
if (args.length == 5){
output = new WordSearch(Integer.parseInt(args[0]), Integer.parseInt(args[1]), args[2], Integer.parseInt(args[3]), args[4]);
System.out.println(output);
}
}
/*WordSearch(int rows, int cols, String fileName){
seed = (int)(Math.random()*1000);
randgen = new Random(seed);
data = new char[rows][cols];
wordsToAdd = new ArrayList<String>();
wordsAdded = new ArrayList<String>();
for (int idx = 0; idx < data.length; idx ++){
for (int idx2 = 0; idx2 < data[idx].length; idx2 ++){
data[idx][idx2] = '_';
}
}
try{
Scanner in = new Scanner(new File(fileName));
while (in.hasNext()) wordsToAdd.add(in.next().toUpperCase());
addAllWords();
printWordsInSearch();
System.out.println("This is your seed: " + seed);
}catch (FileNotFoundException e){
System.out.println(instructions);
System.exit(0);
}
}*/
public WordSearch(int rows, int cols, String fileName, int randSeed, String answers){
seed = randSeed;
randgen = new Random(randSeed);
data = new char[rows][cols];
wordsToAdd = new ArrayList<String>();
wordsAdded = new ArrayList<String>();
for (int idx = 0; idx < data.length; idx ++){
for (int idx2 = 0; idx2 < data[idx].length; idx2 ++){
data[idx][idx2] = '_';
}
}
try{
Scanner in = new Scanner(new File(fileName));
while (in.hasNext()) wordsToAdd.add(in.next().toUpperCase());
addAllWords();
if (answers.equals("key")) fillInSpaces();
else fillInLetters();
//printWordsInSearch();
}catch (FileNotFoundException e){
System.out.println(instructions);
System.exit(0);
}
}
private void addAllWords(){
int counter = 0;
while (!wordsToAdd.isEmpty() && counter < 50){
boolean added = false;
int cInc = randgen.nextInt(3) - 1;
int rInc = randgen.nextInt(3) - 1;
String letters = wordsToAdd.get(randgen.nextInt(wordsToAdd.size()));
for (int idx = 0; idx < 100 & !added; idx ++){
int rIdx = randgen.nextInt(data.length);
int cIdx = randgen.nextInt(data[0].length);
if (addWord(letters, rIdx, cIdx, rInc, cInc)){
added = true;
counter = 0;
}
}
if (!added) counter ++;
}
}
private boolean addWord(String word, int row, int col, int rowIncrement, int colIncrement){
if (rowIncrement == 0 && colIncrement == 0) return false;
int rIdx = row;
int cIdx = col;
boolean add = false;
boolean canAdd = true;
for (int wIdx = 0; wIdx < word.length(); wIdx ++){
if (rIdx >= 0 && cIdx >= 0 && rIdx < data.length && cIdx < data[0].length){
if (!(word.charAt(wIdx) == data[rIdx][cIdx] || data[rIdx][cIdx] == '_')) canAdd = false;
rIdx += rowIncrement;
cIdx += colIncrement;
}
else canAdd = false;
}
if (canAdd) add = true;
if (add){
rIdx = row;
cIdx = col;
for (int wIdx = 0; wIdx < word.length(); wIdx ++){
data[rIdx][cIdx] = word.charAt(wIdx);
rIdx += rowIncrement;
cIdx += colIncrement;
}
int pos = wordsToAdd.indexOf(word);
wordsAdded.add(wordsToAdd.remove(pos));
return true;
}
else return false;
}
public String toString(){
String output1 = "|";
for (int idx = 0; idx < data.length; idx ++){
for (int idx2 = 0; idx2 < data[idx].length; idx2 ++){
output1 += data[idx][idx2] + " ";
}
output1 += "|\n|";
}
output1 = output1.substring(0, output1.length() - 1);
String output2 = "Words: ";
for (int idx = 0; idx < wordsAdded.size(); idx ++) output2 += wordsAdded.get(idx) + ", ";
output2 = output2.substring(0, output2.length() - 2) + " (seed: " + seed + ")";
return output1 + output2;
}
public void printWordsInSearch(){
String output = "Words: ";
for (int idx = 0; idx < wordsAdded.size(); idx ++){
output += wordsAdded.get(idx) + " ";
}
System.out.println(output);
}
private void clear(){
for (int idx = 0; idx < data.length; idx ++){
for (int idx2 = 0; idx2 < data[idx].length; idx2 ++){
data[idx][idx2] = '_';
}
}
}
private void fillInLetters(){
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int rIdx = 0; rIdx < data.length; rIdx ++){
for (int cIdx = 0; cIdx < data[0].length; cIdx ++){
if (data[rIdx][cIdx] == '_') data[rIdx][cIdx] = alphabet.charAt(randgen.nextInt(26));
}
}
}
private void fillInSpaces(){
for (int rIdx = 0; rIdx < data.length; rIdx ++){
for (int cIdx = 0; cIdx < data[0].length; cIdx ++){
if (data[rIdx][cIdx] == '_') data[rIdx][cIdx] = ' ';
}
}
}
}
| [
"[email protected]"
] | |
ffa5011eca8580d3bb5fdbc7e3fac807ce86fcc7 | 9a1916ec4086cf71f8c0bccfe19b74e1bb8259e6 | /app/src/main/java/ch/hevs/alexpira/viewmodel/PatientViewModel.java | 7bade38ea2c05d7e384054618f6806bf651119b7 | [] | no_license | alexgrb/PatientIndex | fdb432e500c83acb3feca74dd8701dbddd43537a | 0f48eec097ec9c34b4cd80bb740713869f599a87 | refs/heads/master | 2021-02-18T09:49:58.828780 | 2020-03-31T20:17:20 | 2020-03-31T20:17:20 | 245,183,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,056 | java | package ch.hevs.alexpira.viewmodel;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import ch.hevs.alexpira.BaseApp;
import ch.hevs.alexpira.database.entity.PatientEntity;
import ch.hevs.alexpira.database.repository.PatientRepository;
public class PatientViewModel extends AndroidViewModel {
private PatientRepository repository;
private Application application;
//We are going to use a Mediator to observe the other LiveData objects.
private final MediatorLiveData<PatientEntity> observablePatient;
//This will create the patient on the screen
public PatientViewModel(@NonNull Application application, final int patientId, PatientRepository patientRepository){
super(application);
this.application = application;
repository = patientRepository;
//Null until the database initialize it.
observablePatient = new MediatorLiveData<>();
LiveData<PatientEntity> patient = repository.getPatient(patientId, application);
observablePatient.addSource(patient, observablePatient::setValue);
}
public static class Factory extends ViewModelProvider.NewInstanceFactory{
@NonNull
private final Application application;
private final int patientId;
private final PatientRepository repository;
public Factory(@NonNull Application application, int patientId){
this.application = application;
this.patientId = patientId;
repository = ((BaseApp) application).getPatientRepository();
}
@Override
public<T extends ViewModel> T create(Class<T> ModelClass){
return (T) new PatientViewModel(application,patientId,repository);
}
}
public LiveData<PatientEntity> getPatient() {
return observablePatient;
}
}
| [
"[email protected]"
] | |
4808826d92abf5d9bd08fc27b65c3b97831d2046 | 30e4531588e98674e2a58a3f4cb57c205244cc21 | /javaHowToProgram/códigos/Cap 03/firstExample/GradeBookTest.java | dc6a1ca68a586283ec92e18f0ff1fe69e52aa449 | [] | no_license | danrleypereira/OO | 5b23bb5dabc24a4179277eee3d2a6f0c14aad70e | 3ce9398ccd54c369f7acff17f51b1ad1c3d5cc3c | refs/heads/master | 2022-06-01T04:48:37.476306 | 2022-04-13T22:14:15 | 2022-04-13T22:14:15 | 53,614,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | //Criando um objeto GradeBook e chamando seu método displayMessage.
import java.util.Scanner;
public class GradeBookTest
{
public static void main( String[] args)
{
//Cria Scanner para obter entrada a partir da janela de comando.
Scanner input = new Scanner( System.in );
//Prompt para entrada do nome do curso
System.out.println( "Please enter the course name:" );
String nameOfCourse = input.nextLine();
System.out.println(); //gera saída de uma linha em branco
//Cria um objeto GradeBook e atribui a myGradeBook
//e passa nameOfCourse como argumento
GradeBook myGradeBook = new GradeBook();
//Chama o método displayMessage de myGradeBook
myGradeBook.displayMessage( nameOfCourse );
}
}
| [
"[email protected]"
] | |
415745c857ec5790e3f37db0b39ae98802f702ed | 9ae73446e2b5c82403cc69d67153764ae0b6f4cf | /app/src/main/java/github/alex/util/ViewUtil.java | ed52803641265e0d7880c1f55f9147b8f954374a | [] | no_license | 893573771/MvpApp | a74066f7e07b5cff6d15c3850a53fd1f98cb2dae | 38f4efa5e7de8572d3d349ee3622b9835ef895a6 | refs/heads/master | 2020-02-26T14:10:33.577100 | 2016-08-16T09:12:56 | 2016-08-16T09:12:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,796 | java | package github.alex.util;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.TouchDelegate;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.AbsListView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
/**
* 作者:Alex
* 时间:2016年08月06日 08:06
* 博客:http://www.jianshu.com/users/c3c4ea133871/subscriptions
*/
public class ViewUtil
{
/**
* 无效值
*/
public static final int INVALID = Integer.MIN_VALUE;
/**
* 描述:重置AbsListView的高度. item 的最外层布局要用 RelativeLayout,如果计算的不准,就为RelativeLayout指定一个高度
* @param absListView the abs list view
* @param lineNumber 每行几个 ListView一行一个item
* @param verticalSpace the vertical space
*/
public static void setAbsListViewHeight(AbsListView absListView, int lineNumber, int verticalSpace)
{
int totalHeight = getAbsListViewHeight(absListView, lineNumber, verticalSpace);
LayoutParams params = absListView.getLayoutParams();
params.height = totalHeight;
((MarginLayoutParams) params).setMargins(0, 0, 0, 0);
absListView.setLayoutParams(params);
}
/**
* 描述:获取AbsListView的高度.
*
* @param absListView the abs list view
* @param lineNumber 每行几个 ListView一行一个item
* @param verticalSpace the vertical space
* @return the abs list view height
*/
public static int getAbsListViewHeight(AbsListView absListView, int lineNumber, int verticalSpace)
{
int totalHeight = 0;
int w = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
int h = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
absListView.measure(w, h);
ListAdapter mListAdapter = absListView.getAdapter();
if (mListAdapter == null) {
return totalHeight;
}
int count = mListAdapter.getCount();
if (absListView instanceof ListView)
{
for (int i = 0; i < count; i++)
{
View listItem = mListAdapter.getView(i, null, absListView);
listItem.measure(w, h);
totalHeight += listItem.getMeasuredHeight();
}
if (count == 0) {
totalHeight = verticalSpace;
} else {
totalHeight = totalHeight + (((ListView) absListView).getDividerHeight() * (count - 1));
}
} else if (absListView instanceof GridView) {
int remain = count % lineNumber;
if (remain > 0) {
remain = 1;
}
if (mListAdapter.getCount() == 0) {
totalHeight = verticalSpace;
} else {
View listItem = mListAdapter.getView(0, null, absListView);
listItem.measure(w, h);
int line = count / lineNumber + remain;
totalHeight = line * listItem.getMeasuredHeight() + (line - 1) * verticalSpace;
}
}
return totalHeight;
}
/**
* 测量这个view
* 最后通过getMeasuredWidth()获取宽度和高度.
* @param view 要测量的view
* @return 测量过的view
*/
public static void measureView(View view) {
LayoutParams p = view.getLayoutParams();
if (p == null) {
p = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width);
int lpHeight = p.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
}
view.measure(childWidthSpec, childHeightSpec);
}
/**
* 获得这个View的宽度
* 测量这个view,最后通过getMeasuredWidth()获取宽度.
* @param view 要测量的view
* @return 测量过的view的宽度
*/
public static int getViewWidth(View view) {
measureView(view);
return view.getMeasuredWidth();
}
/**
* 获得这个View的高度
* 测量这个view,最后通过getMeasuredHeight()获取高度.
* @param view 要测量的view
* @return 测量过的view的高度
*/
public static int getViewHeight(View view) {
measureView(view);
return view.getMeasuredHeight();
}
/**
* 从父亲布局中移除自己
* @param v
*/
public static void removeSelfFromParent(View v) {
ViewParent parent = v.getParent();
if(parent != null){
if(parent instanceof ViewGroup){
((ViewGroup)parent).removeView(v);
}
}
}
/**
* TypedValue官方源码中的算法,任意单位转换为PX单位
* @param unit TypedValue.COMPLEX_UNIT_DIP
* @param value 对应单位的值
* @param metrics 密度
* @return px值
*/
public static float applyDimension(int unit, float value,
DisplayMetrics metrics){
switch (unit) {
case TypedValue.COMPLEX_UNIT_PX:
return value;
case TypedValue.COMPLEX_UNIT_DIP:
return value * metrics.density;
case TypedValue.COMPLEX_UNIT_SP:
return value * metrics.scaledDensity;
case TypedValue.COMPLEX_UNIT_PT:
return value * metrics.xdpi * (1.0f/72);
case TypedValue.COMPLEX_UNIT_IN:
return value * metrics.xdpi;
case TypedValue.COMPLEX_UNIT_MM:
return value * metrics.xdpi * (1.0f/25.4f);
}
return 0;
}
public static void setSelectionAtEndForEditText(View view){
if(view instanceof EditText){
EditText editText = (EditText) view;
String text = editText.getText().toString();
if(!TextUtils.isEmpty(text)){
editText.setSelection(text.length());
}
}
}
/**给TextView设置Text*/
public static void setText2TextView(View view, String text){
TextView textView = (TextView)view;
if((textView!=null) && (!TextUtils.isEmpty(text)) && (!"null".equalsIgnoreCase(text))){
//textView.setVisibility(View.VISIBLE);
textView.setText(text);
}
}
/**给EditText设置Text*/
public static void setText2EditText(View view, String text){
EditText editText = (EditText)view;
if((editText!=null) && (text!=null) && (!"null".equalsIgnoreCase(text))){
//editText.setVisibility(View.VISIBLE);
editText.setText(text);
}
}
/**让TextView的 字体大小自适应,默认字体大小 14sp*/
public static void scaleTextView(final View view) {
if (!(view instanceof TextView)) {
return;
}
final TextView textView = (TextView) view;
textView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
//测量字符串的长度
float measureWidth = textView.getPaint().measureText(String.valueOf(textView.getText()));
//得到TextView 的宽度
int width = textView.getWidth() - textView.getPaddingLeft() - textView.getPaddingRight();
//当前size大小
float textSize = textView.getTextSize();
if (width < measureWidth) {
textSize = (width / measureWidth) * textSize;
}
//注意,使用像素大小设置
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
textView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
}
public static void setBackgroundColor(View view, String color){
try
{
GradientDrawable gradientDrawable = (GradientDrawable) view.getBackground();
gradientDrawable.setColor(Color.parseColor(color));
} catch (Exception e){ }
}
public static int getYLocationOnScreen(View view){
int[] location = new int[2];
view.getLocationOnScreen(location);
int y = location[1];
return y;
}
public static View addShell2View(View view,Context context, View shellView){
LayoutParams lp = view.getLayoutParams();
ViewGroup vgParent = (ViewGroup)view.getParent();
int index = vgParent.indexOfChild(view);
/*view只能有一个Parent,先移除后添加*/
vgParent.removeView(view);
final FrameLayout bodyView = new FrameLayout(context);
/*FrameLayout 第一层视图*/
bodyView.addView(view);
final FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
/*FrameLayout 第二层视图*/
bodyView.addView(shellView, layoutParams);
vgParent.addView(bodyView, index, lp);
vgParent.invalidate();
shellView.setVisibility(View.GONE);
return bodyView;
}
/**增大点击区域*/
public static void enlargeViewTouchSize(final Context context, final View view, final float left, final float top, final float right, final float bottom) {
((View) view.getParent()).post(new Runnable() {
@Override
public void run() {
Rect bounds = new Rect();
view.setEnabled(true);
view.getHitRect(bounds);
bounds.top -= dp2Px(context,top);
bounds.bottom += dp2Px(context,bottom);
bounds.left -= dp2Px(context, left);
bounds.right += dp2Px(context, right);
TouchDelegate touchDelegate = new TouchDelegate(bounds, view);
if (View.class.isInstance(view.getParent())) {
((View) view.getParent()).setTouchDelegate(touchDelegate);
}
}
});
}
/**将光标移至文字尾
* @param view
* */
public static void setSelection(View view){
if(view == null){
return ;
}
if(view instanceof EditText){
EditText editText = (EditText) view;
String text = editText.getText().toString();
if(text!=null){
editText.setSelection(text.length());
}
}
}
/**数据转换: dp---->px*/
private static float dp2Px(Context context, float dp)
{
if (context == null) {
return -1;
}
return dp * context.getResources().getDisplayMetrics().density;
}
}
| [
"[email protected]"
] | |
2295a1e0ec08d5abc5effb2e513d70d35405cdbe | ea7a8d6d987d4808089961744bb8a139fcef9f5f | /src/gcom/cobranca/NegativCritGerReg.java | 951aedf68052dd7040725afc35d0b90b5f809656 | [] | no_license | caern/gsan-caern | bd02c6190e9f524cf9598b0afa39d0d6b6062d29 | 55967181debf311d619aa05df61330435750f684 | refs/heads/master | 2016-09-10T20:11:06.411053 | 2014-11-14T12:30:12 | 2014-11-14T12:30:12 | 26,600,300 | 1 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 5,739 | java | /*
* Copyright (C) 2007-2007 the GSAN - Sistema Integrado de Gestão de Serviços de Saneamento
*
* This file is part of GSAN, an integrated service management system for Sanitation
*
* GSAN 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.
*
* GSAN 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
*/
/*
* GSAN - Sistema Integrado de Gestão de Serviços de Saneamento
* Copyright (C) <2007>
* Adriano Britto Siqueira
* Alexandre Santos Cabral
* Ana Carolina Alves Breda
* Ana Maria Andrade Cavalcante
* Aryed Lins de Araújo
* Bruno Leonardo Rodrigues Barros
* Carlos Elmano Rodrigues Ferreira
* Cláudio de Andrade Lira
* Denys Guimarães Guenes Tavares
* Eduardo Breckenfeld da Rosa Borges
* Fabíola Gomes de Araújo
* Flávio Leonardo Cavalcanti Cordeiro
* Francisco do Nascimento Júnior
* Homero Sampaio Cavalcanti
* Ivan Sérgio da Silva Júnior
* José Edmar de Siqueira
* José Thiago Tenório Lopes
* Kássia Regina Silvestre de Albuquerque
* Leonardo Luiz Vieira da Silva
* Márcio Roberto Batista da Silva
* Maria de Fátima Sampaio Leite
* Micaela Maria Coelho de Araújo
* Nelson Mendonça de Carvalho
* Newton Morais e Silva
* Pedro Alexandre Santos da Silva Filho
* Rafael Corrêa Lima e Silva
* Rafael Francisco Pinto
* Rafael Koury Monteiro
* Rafael Palermo de Araújo
* Raphael Veras Rossiter
* Roberto Sobreira Barbalho
* Rodrigo Avellar Silveira
* Rosana Carvalho Barbosa
* Sávio Luiz de Andrade Cavalcante
* Tai Mu Shih
* Thiago Augusto Souza do Nascimento
* Tiago Moreno Rodrigues
* Vivianne Barbosa Sousa
*
* Este programa é software livre; você pode redistribuí-lo e/ou
* modificá-lo sob os termos de Licença Pública Geral GNU, conforme
* publicada pela Free Software Foundation; versão 2 da
* Licença.
* Este programa é distribuído na expectativa de ser útil, mas SEM
* QUALQUER GARANTIA; sem mesmo a garantia implícita de
* COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM
* PARTICULAR. Consulte a Licença Pública Geral GNU para obter mais
* detalhes.
* Você deve ter recebido uma cópia da Licença Pública Geral GNU
* junto com este programa; se não, escreva para Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*/
package gcom.cobranca;
import gcom.cobranca.NegativCritGerRegPK;
import gcom.cadastro.localidade.GerenciaRegional;
import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/** @author Hibernate CodeGenerator */
public class NegativCritGerReg implements Serializable {
private static final long serialVersionUID = 1L;
/** identifier field */
private NegativCritGerRegPK comp_id;
/** persistent field */
private Date ultimaAlteracao;
/** nullable persistent field */
private GerenciaRegional gerenciaRegional;
/** nullable persistent field */
private gcom.cobranca.NegativacaoCriterio negativacaoCriterio;
/** full constructor */
public NegativCritGerReg(NegativCritGerRegPK comp_id, Date ultimaAlteracao, GerenciaRegional gerenciaRegional, gcom.cobranca.NegativacaoCriterio negativacaoCriterio) {
this.comp_id = comp_id;
this.ultimaAlteracao = ultimaAlteracao;
this.gerenciaRegional = gerenciaRegional;
this.negativacaoCriterio = negativacaoCriterio;
}
/** default constructor */
public NegativCritGerReg() {
}
/** minimal constructor */
public NegativCritGerReg(NegativCritGerRegPK comp_id, Date ultimaAlteracao) {
this.comp_id = comp_id;
this.ultimaAlteracao = ultimaAlteracao;
}
public NegativCritGerRegPK getComp_id() {
return this.comp_id;
}
public void setComp_id(NegativCritGerRegPK comp_id) {
this.comp_id = comp_id;
}
public Date getUltimaAlteracao() {
return this.ultimaAlteracao;
}
public void setUltimaAlteracao(Date ultimaAlteracao) {
this.ultimaAlteracao = ultimaAlteracao;
}
public GerenciaRegional getGerenciaRegional() {
return this.gerenciaRegional;
}
public void setGerenciaRegional(GerenciaRegional gerenciaRegional) {
this.gerenciaRegional = gerenciaRegional;
}
public gcom.cobranca.NegativacaoCriterio getNegativacaoCriterio() {
return this.negativacaoCriterio;
}
public void setNegativacaoCriterio(gcom.cobranca.NegativacaoCriterio negativacaoCriterio) {
this.negativacaoCriterio = negativacaoCriterio;
}
public String toString() {
return new ToStringBuilder(this)
.append("comp_id", getComp_id())
.toString();
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( !(other instanceof NegativCritGerReg) ) return false;
NegativCritGerReg castOther = (NegativCritGerReg) other;
return new EqualsBuilder()
.append(this.getComp_id(), castOther.getComp_id())
.isEquals();
}
public int hashCode() {
return new HashCodeBuilder()
.append(getComp_id())
.toHashCode();
}
}
| [
"[email protected]"
] | |
b991eb46dffa8cdb8aef9587bbdbfd39ab5a7dfa | c3c6ea029647070fc76fc55f5836dd5a8fe69223 | /target/qforhashmaps/WEB-INF/classes/com/diwakar/qforhashmaps/util/Utilities.java | 6ccc18c0d3035fbb54bf07a052a1843479f2b9d1 | [] | no_license | bhardwajdb/qforhashmaps | d6499973905098df4df30dea041fa3631e48a974 | 9239cb74c04b947c05cf781385ee2a066f8585f7 | refs/heads/master | 2021-01-21T15:44:07.304859 | 2017-05-20T00:11:47 | 2017-05-20T00:11:47 | 91,853,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,909 | java | package com.diwakar.qforhashmaps.util;
import com.diwakar.qforhashmaps.domain.Response;
import com.diwakar.qforhashmaps.domain.WritablePacket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.async.DeferredResult;
import java.util.UUID;
/**
* often used methods
* @author diwakar
*
*/
@Component
public class Utilities {
@Value("${timeout.request.s:5}")
private long requestTimeout;
private static Logger logger=LoggerFactory.getLogger(Utilities.class);
/**
* factory method
* @return an empty result with error scenarios prefilled with timeout
*/
public DeferredResult<Response<WritablePacket>> emptyResponseWithTimeout(){
DeferredResult<Response<WritablePacket>> result=
new DeferredResult<Response<WritablePacket>>(0L,
new Response<WritablePacket>(new WritablePacket(),Constants.STATUS_TIMEOUT));
result.onCompletion(() -> {
//put something to do here in case of completion event
//such as kafka lognew Response<WritablePacket>
logger.debug("result received.");
});
result.onTimeout(() -> {
//put something to do here in case of timeout
});
return result;
}
/**
* An empty response factory method
* @return an empty result without timeout
*/
public DeferredResult<Response<WritablePacket>> emptyResponse(){
DeferredResult<Response<WritablePacket>> result=new DeferredResult<Response<WritablePacket>>();
result.onCompletion(() -> {
//put something to do here in case of completion event
//such as kafka log
logger.debug("result received.");
}
);
return result;
}
public static final String generateUUID(){
UUID u=UUID.randomUUID();
long id=u.getLeastSignificantBits();
return System.currentTimeMillis()+Constants.ID_SEPARATOR+Long.toString(id);
}
}
| [
"[email protected]"
] | |
35e0d57ae65473c0e6a1e8ff80b921314531e781 | a6f4d8a6c8bd1097cd468240bdc8eed241ef9f0e | /executor/src/main/java/com/linkedpipes/etl/executor/execution/model/ExecutionStatus.java | 4beebf0c8ab2fd81b352d9f6914807c016120e0d | [
"MIT"
] | permissive | linkedpipes/etl | e9cdb00bd53e8f720dbbfcbac32c8f0d48fd024c | 52e904241be27fccd9d9b966b19f03f1ef00b647 | refs/heads/develop | 2023-08-21T23:49:17.746028 | 2023-07-20T15:51:02 | 2023-07-20T15:51:02 | 49,733,838 | 139 | 37 | NOASSERTION | 2022-07-12T07:51:18 | 2016-01-15T17:23:57 | Java | UTF-8 | Java | false | false | 534 | java | package com.linkedpipes.etl.executor.execution.model;
import com.linkedpipes.etl.executor.api.v1.vocabulary.LP_EXEC;
public enum ExecutionStatus {
QUEUED(LP_EXEC.STATUS_QUEUED),
RUNNING(LP_EXEC.STATUS_RUNNING),
FINISHED(LP_EXEC.STATUS_FINISHED),
CANCELLED(LP_EXEC.STATUS_CANCELLED),
CANCELLING(LP_EXEC.STATUS_CANCELLING),
FAILED(LP_EXEC.STATUS_FAILED);
private final String iri;
ExecutionStatus(String iri) {
this.iri = iri;
}
public String getIri() {
return iri;
}
}
| [
"[email protected]"
] | |
309b484d02c7d1af38472a02a30c7f91725235eb | 370072f25dd5a214efceb79c66dfe4f45c31e1e7 | /PharosMiddleware/src/playerclient3/structures/simulation/PlayerSimulationPose2dReq.java | 74b13d8aefddaad7fa7a359e9da915a84c344af2 | [] | no_license | mahyuddin/pharostesbed | e953208ad7884d7f4b56498455a8756e9e183bf0 | 46cebffb630ad510ddac86b76b474aad74b27412 | refs/heads/master | 2021-01-10T07:48:39.383057 | 2012-09-21T01:49:30 | 2012-09-21T01:49:30 | 47,845,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,422 | java | /*
* Player Java Client 3 - PlayerSimulationPose2dReq.java
* Copyright (C) 2006 Radu Bogdan Rusu
*
* 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
*
* $Id: PlayerSimulationPose2dReq.java 125 2011-03-24 02:24:05Z corot $
*
*/
package playerclient3.structures.simulation;
import playerclient3.structures.*;
/**
* Request/reply: get/set 2D pose of a named simulation object
* To retrieve the pose of an object in a simulator, send a null
* PLAYER_SIMULATION_REQ_GET_POSE2D request. To set the pose of an object
* in a simulator, send a PLAYER_SIMULATION_REQ_SET_POSE2D request (response
* will be null).
* @author Radu Bogdan Rusu
* @version
* <ul>
* <li>v3.0 - Player 3.0 supported
* </ul>
*/
public class PlayerSimulationPose2dReq implements PlayerConstants {
// the identifier of the object we want to locate
private char[] name;
// the desired pose in [m, m, rad]
private PlayerPose2d pose;
/**
* @return Length of name
*/
public synchronized int getName_count () {
return (this.name == null)?0:this.name.length;
}
/**
* @return the identifier of the object we want to locate
*/
public synchronized char[] getName () {
return this.name;
}
/**
* @param newName the identifier of the object we want to locate
*/
public synchronized void setName (char[] newName) {
this.name = newName;
}
/**
* @return the desired pose in [m, m, rad]
*/
public synchronized PlayerPose2d getPose () {
return this.pose;
}
/**
* @param newPose the desired pose in [m, m, rad]
*/
public synchronized void setPose (PlayerPose2d newPose) {
this.pose = newPose;
}
} | [
"chien-liang@53a56b47-fd32-4597-bdd3-0ed485b86959"
] | chien-liang@53a56b47-fd32-4597-bdd3-0ed485b86959 |
c43b0082427dce404edbb751ccbc7d4e08872c6a | 9f64d1da234cb1c0191b3540f9e309e5f43d354b | / wai-client-v1 --username [email protected]/wai/src/com/google/android/apps/unveil/history/SearchListener.java | 1a37910e39fb238a487dc6a474b32450b3d2559d | [] | no_license | rayvo/wai-client-v1 | 17123d332fa9cc1878a00b144474d36b29891b3b | 0ebfa81c27203253be11b4edfac8927a709e1411 | refs/heads/master | 2021-01-22T11:58:41.270263 | 2013-11-02T04:58:30 | 2013-11-02T04:58:30 | 33,710,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package com.google.android.apps.unveil.history;
public abstract interface SearchListener
{
public abstract void onSearchCompleted(SearchHistoryQuery.QuerySpec paramQuerySpec, int paramInt);
public abstract void onSearchResultsNoResults(int paramInt);
}
/* Location: C:\apktool\SmaliToJavaTUTKit\jd-gui-0.3.5.windows\classes-dex2jar.jar
* Qualified Name: com.google.android.apps.unveil.history.SearchListener
* JD-Core Version: 0.6.2
*/ | [
"[email protected]@0fd9bcd8-174d-baa1-59d5-a6b515c80f00"
] | [email protected]@0fd9bcd8-174d-baa1-59d5-a6b515c80f00 |
6431e06244230562c7194bea51f3ea59c86b4c7f | a1cc2619e409597ed17a87326bd3e32f440d6b9c | /app/src/main/java/ru/korniltsev/telegram/chat/adapter/PhotoMessageVH.java | 7ddaadbb7a415d97f8c9de84c018b13180823436 | [] | no_license | n1n3b1t/tchalange | ebbdab44b7e2de65662fefd135ffd61e21c145e9 | 2ef8a386506349234414b35defef27ffb9d1d537 | refs/heads/master | 2021-01-15T12:14:04.797472 | 2015-07-17T15:50:50 | 2015-07-17T15:50:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,286 | java | package ru.korniltsev.telegram.chat.adapter;
import android.view.View;
import flow.Flow;
import org.drinkless.td.libcore.telegram.TdApi;
import ru.korniltsev.telegram.chat.R;
import ru.korniltsev.telegram.chat.adapter.view.PhotoMessageView;
import ru.korniltsev.telegram.core.rx.RxChat;
import ru.korniltsev.telegram.photoview.PhotoView;
class PhotoMessageVH extends BaseAvatarVH {
private final PhotoMessageView image;
public PhotoMessageVH(View itemView, final Adapter adapter) {
super(itemView, adapter);
image = (PhotoMessageView) itemView.findViewById(R.id.image);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RxChat.MessageItem item = (RxChat.MessageItem) adapter.getItem(getPosition());
TdApi.MessagePhoto photo = (TdApi.MessagePhoto) item.msg.message;
Flow.get(v.getContext())
.set(new PhotoView(photo.photo, item.msg.id, item.msg.chatId));
}
});
}
@Override
public void bind(RxChat.ChatListItem item, long lastReadOutbox) {
super.bind(item, lastReadOutbox);
TdApi.Message msg = ((RxChat.MessageItem) item).msg;
image.load(msg);
}
}
| [
"[email protected]"
] | |
ba7f5c9222884c2aab6f8edcdbe88dfdfa5d7e62 | 03dd6d8a5c6196eca9e7f5334a1377ba2bc5a397 | /src/com/github/amlcurran/showcaseview/StandardShowcaseDrawer.java | a317382043a75e08d068b9956e1e7a5f92aba750 | [] | no_license | CuongAppable/showcase_lib | a8900f5678014ccbc9e83e6c37b00c16e7b67c7d | 6ca9c22abc507826b980dc99122461aa463d05f0 | refs/heads/master | 2021-01-18T01:20:01.354775 | 2014-06-10T08:32:17 | 2014-06-10T08:32:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,225 | java | package com.github.amlcurran.showcaseview;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.Drawable;
/**
* Created by curraa01 on 13/10/2013.
*/
class StandardShowcaseDrawer implements ShowcaseDrawer {
protected final Paint eraserPaint;
protected final Drawable showcaseDrawable;
private final Paint basicPaint;
protected int backgroundColour;
public StandardShowcaseDrawer(Resources resources) {
PorterDuffXfermode xfermode = new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY);
eraserPaint = new Paint();
eraserPaint.setColor(0xFFFFFF);
eraserPaint.setAlpha(0);
eraserPaint.setXfermode(xfermode);
eraserPaint.setAntiAlias(true);
basicPaint = new Paint();
showcaseDrawable = resources.getDrawable(R.drawable.bg_cling);
}
@Override
public void setShowcaseColour(int color) {
showcaseDrawable.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
}
@Override
public void drawShowcase(Bitmap buffer, float x, float y, int w, int h, int sharp) {
Canvas bufferCanvas = new Canvas(buffer);
if(sharp == 0){
bufferCanvas.drawCircle(x, y, (int)(0.5f*Math.sqrt(w*w + h*h)), eraserPaint);
}else{
bufferCanvas.drawRect(x - w/2, y - h/2, x + w/2, y + h/2, eraserPaint);
}
}
@Override
public int getShowcaseWidth() {
return showcaseDrawable.getIntrinsicWidth();
}
@Override
public int getShowcaseHeight() {
return showcaseDrawable.getIntrinsicHeight();
}
@Override
public float getBlockedRadius() {
return 0;
}
@Override
public void setBackgroundColour(int backgroundColor) {
this.backgroundColour = backgroundColor;
}
@Override
public void erase(Bitmap bitmapBuffer) {
bitmapBuffer.eraseColor(backgroundColour);
}
@Override
public void drawToCanvas(Canvas canvas, Bitmap bitmapBuffer) {
canvas.drawBitmap(bitmapBuffer, 0, 0, basicPaint);
}
}
| [
"[email protected]"
] | |
dd7785608cbb4edf07460b6500a20cb3aafd76c7 | 583eabec20062324f029282db4f964a43dafcd76 | /Spring01hibernate/src/main/java/pl/coderslab/controller/PersonController.java | ee94648dd03d391f986b71c2c336306a6842ec1a | [] | no_license | PiotrDawidziuk/Spring01hibernate | ccb1e860ab823260e7fbc4307023e1ad0413591b | 52db25756149029c1ec4f64dec2d51ecaec396b9 | refs/heads/master | 2020-03-13T07:01:23.249708 | 2018-04-26T13:16:29 | 2018-04-26T13:16:29 | 131,016,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,461 | java | package pl.coderslab.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import pl.coderslab.model.Person;
import pl.coderslab.repositories.PersonDao;
@Controller
public class PersonController {
@Autowired
private PersonDao personDao;
@RequestMapping("/addperson")
@ResponseBody
public String hello() {
Person person = new Person();
person.setLogin("Jan");
person.setPassword("123");
person.setEmail("[email protected]");
personDao.savePerson(person);
return "Id dodanego usera to: " + person.getId();
}
@RequestMapping("/updateperson")
@ResponseBody
public String updatePerson() {
Person person = personDao.findById(1);
person.setLogin("Janusz");
personDao.update(person);
return "Id edytowanego usera to:"
+ person.getId();
}
@RequestMapping("/getperson")
@ResponseBody
public String getPerson() {
Person person = personDao.findById(1);
return person.toString();
}
@RequestMapping("/deleteperson")
@ResponseBody
public String deletePerson(){
Person person = personDao.findById(1);
if (person != null){
personDao.delete(person);
return "Person with Id "+person.getId()+" deleted.";
}
return "Nie ma takiego Id";
}
@RequestMapping(method = RequestMethod.GET, path = "/person-form")
public String showForm(Model model){
Person person = new Person();
person.setLogin("Example");
model.addAttribute("person", person);
return "form/person";
}
@RequestMapping(method = RequestMethod.POST, path = "/person-form")
public String saveForm(@RequestParam String login,
@RequestParam String password,
@RequestParam String email, Model model)
{
Person person = new Person();
person.setLogin(login);
person.setPassword(password);
person.setEmail(email);
personDao.savePerson(person);
return "form/success";
}
} | [
"[email protected]"
] | |
e99d523314244c4b40ebcd24c8ce5f03261b2dce | 9feb5b5ac3abf12b1101a3b57e3131f83c6b4ac1 | /Signup/test/jan/signup/services/db/UserAccountRequestServiceImplTest.java | 7066eff4bd1b4555fea39535cc649284d291bd1d | [] | no_license | oknw/signup | 97c05212afd59b25a4b62ae3e0a340736080f3b2 | 18826c958a2336057ab85fe48653724321ff6981 | refs/heads/master | 2021-01-15T18:51:30.116419 | 2014-11-04T20:00:27 | 2014-11-04T20:00:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | package jan.signup.services.db;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import jan.signup.server.services.db.StatusType;
import jan.signup.server.services.db.UAREntity;
import jan.signup.server.services.db.UserAccountRequestService;
import jan.signup.server.services.db.UserAccountRequestServiceImpl;
import org.junit.Before;
import org.junit.Test;
public class UserAccountRequestServiceImplTest {
private UserAccountRequestService service;
@Before
public void setUp(){
service = new UserAccountRequestServiceImpl();
}
@Test
public void testCreateUser() {
UAREntity req = service.createUser("Jan", "Jans Nachname", "[email protected]", "Einheit");
assertNotNull(req);
String token = req.getToken();
assertNotNull(token);
assertNotNull(service.getByTokenAndState(token, StatusType.NEW));
assertNotNull(service.getByEmail("[email protected]"));
assertNotNull(service.getByToken(token));
service.changeToken(req);
assertNotSame(token, req.getToken());
service.setState(req, StatusType.ADMIN_CONFIRMED);
assertNotNull(service.getByTokenAndState(req.getToken(), StatusType.ADMIN_CONFIRMED));
}
}
| [
"[email protected]"
] | |
f7479611999227628c27869e77be1a69e0ce0bdf | be09f83886f2566a7255af48f8a72cbdd649b625 | /src/main/java/com/iamlile/jira/burndown/vo/NormalIssue.java | 1bc707c83f63523bb66e42df5b06e2a42cd1406e | [] | no_license | iamlile/burndownchart | 4d4d25a8f696cda1d2b28fe0f923dfd7d2055314 | 1606b7272d0c528ee5ef9ed6cea5195afd1bf5fd | refs/heads/master | 2021-04-06T04:00:26.789329 | 2018-04-01T07:39:12 | 2018-04-01T07:39:12 | 124,728,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.iamlile.jira.burndown.vo;
/**
* Created by macpro on 2018/3/21.
*/
public class NormalIssue {
private String id;
private NormalIssueItem normalIssueItem;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public NormalIssueItem getNormalIssueItem() {
return normalIssueItem;
}
public void setNormalIssueItem(NormalIssueItem normalIssueItem) {
this.normalIssueItem = normalIssueItem;
}
}
| [
"[email protected]"
] | |
415d1119fc68ad35f2645096ef2717bf3bdfb2c9 | a1adf709d023835a648a3a0e6fdc4ee7bdddaf07 | /pedro/src/main/java/up/projeto/pedro/livro/controller/ClienteController.java | 1274d73bf8ec881755cdb4fb4e6ea73d070a7d33 | [] | no_license | 13pneto/crud-tes | 9e9d8e014731cb91bbafe005243d668fce6361e1 | 8915f2cf75e455b6b6721bc73532d332e25a5636 | refs/heads/master | 2022-11-15T19:55:10.400893 | 2020-07-08T21:51:01 | 2020-07-08T21:51:01 | 276,221,315 | 0 | 0 | null | 2020-07-08T21:51:03 | 2020-06-30T22:25:15 | Java | UTF-8 | Java | false | false | 1,364 | java | package up.projeto.pedro.livro.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import up.projeto.pedro.livro.entity.Cliente;
import up.projeto.pedro.livro.service.ClienteService;
@RestController
@RequestMapping("/cliente")
public class ClienteController {
@Autowired
private ClienteService clienteService;
@PostMapping(consumes = "application/json")
public Cliente cliente(@RequestBody Cliente cliente) {
return clienteService.salvar(cliente);
}
@GetMapping(produces = "application/json")
public List<Cliente> listar(){
return clienteService.listar();
}
@GetMapping (value = "/buscarporid/{id}", produces = "application/json")
public Cliente buscarPorId (@PathVariable Integer id)
{
return clienteService.buscarPorId (id);
}
@GetMapping (value = "/buscarporcpf/{cpf}", produces = "application/json")
public List<Cliente> buscarPorCpf (@PathVariable String cpf)
{
return clienteService.buscarPorCpf(cpf);
}
}
| [
"[email protected]"
] | |
63030158e27c7e7868ad6f977e8af7ff444b62d8 | 5f03d996e291de912639c32e6b51716fd472b373 | /cashloan-rule/src/main/java/com/ajaya/cashloan/rule/model/srule/config/rule/AbstractRule.java | 3e6be78e52e2b6ddb62179da7fdac1c3d0fc6605 | [] | no_license | jibopeng/cashloan-product-africa-web-app | cba8bb055672425d0b180984c3f3b187f63c78e6 | ebfe002843568acbfad39bb4178c9b0f69ef2ace | refs/heads/master | 2023-04-13T16:02:48.383530 | 2021-04-20T09:24:21 | 2021-04-20T09:24:21 | 359,663,403 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,131 | java | package com.ajaya.cashloan.rule.model.srule.config.rule;
import java.util.List;
import java.util.Map;
import com.ajaya.cashloan.rule.model.srule.config.condition.Condition;
import com.ajaya.cashloan.rule.model.srule.exception.RuleValueException;
import com.ajaya.cashloan.rule.model.srule.utils.RulePolicy;
/**
* Created by syq on 2016/12/17.
*/
public abstract class AbstractRule<T> implements Rule, RuleBasic<T> {
protected List<Condition<T>> conditions;
protected RulePolicy policy = RulePolicy.MATCHALL;
protected Map<T, Integer> preLoad;
protected Class<T> valueClass;
protected long id;
protected String column;
protected String name;
protected T matchTo;
@Override
public void setId(long id) {
this.id = id;
}
@Override
public void setColumn(String column) {
this.column = column;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public void setValueType(Class<T> clazz) {
this.valueClass = clazz;
}
@Override
@SuppressWarnings("All")
public void matchTo(Object o) throws RuleValueException {
if (o instanceof Integer || o instanceof Long || o instanceof Float) {
o = Double.valueOf(o.toString());
}
if (o.getClass() != valueClass) {
throw new RuleValueException("the matchTo Object: " + o + " which type is " + o.getClass().getName() + ",is not fit for the " + valueClass.getName());
}
this.matchTo = (T) o;
}
@Override
public long getId() {
return this.id;
}
@Override
public String getColumn() {
return this.column;
}
@Override
public String getName() {
return this.name;
}
@Override
public void setConditions(List<Condition<T>> conditions) {
this.conditions = conditions;
}
@Override
public void setRulePolicy(RulePolicy rulePolicy) {
this.policy = rulePolicy;
}
@Override
public void setPreLoad(Map<T, Integer> preLoad) {
this.preLoad = preLoad;
}
}
| [
"[email protected]"
] | |
e662b59e38968e69e65cfdcfd3c78b8062c84e83 | c057b4a30e6e04d2fb6836114b32628508d84f97 | /sample_recyclerview_pager_2/java/MainActivity.java | 0bcff879857ceb6c68a2c503552701b4f39a628c | [] | no_license | nomadlife/android_tutorial | 65d8b6e27a3d1351b3a4bda5682d36dbf7748e5b | af95f24105a3f6c062fbce742a5920978b587ef8 | refs/heads/master | 2020-08-28T22:47:31.775037 | 2019-11-14T13:25:30 | 2019-11-14T13:25:30 | 217,843,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,137 | java | package com.example.sample_recyclerview_pager;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ArrayList<Product> items = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initializeData();
RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
rv.setLayoutManager(mLayoutManager);
ProductCardAdapter mCardAdapter = new ProductCardAdapter(getSupportFragmentManager(), items);
rv.setAdapter(mCardAdapter);
}
public void initializeData() {
items.add(new Product(R.drawable.movie1, "어벤져스"));
items.add(new Product(R.drawable.movie2, "미션임파서블"));
items.add(new Product(R.drawable.movie3, "아저씨"));
}
}
| [
"[email protected]"
] | |
014af07cb47d6f0b6e54048f206eaebb7aa7a904 | cf8ce47e5f608740169e671625034feffb9260e9 | /shopping-api/src/main/java/com/programyourhome/shop/model/PyhBulkProduct.java | cab18a68caaab9f7bcafe79ac20f104bc69fed61 | [] | no_license | ewjmulder/program-your-home | a0c98980e7859c29bcb5014238a0542db783959b | ed3f6b64f12d3fd03e38e5dacbb3c049c9a2770a | refs/heads/master | 2020-12-20T12:33:18.718302 | 2017-12-19T11:04:40 | 2017-12-19T11:04:40 | 23,797,369 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 143 | java | package com.programyourhome.shop.model;
public interface PyhBulkProduct extends PyhBulkProductProperties {
public int getId();
}
| [
"[email protected]"
] | |
8a84167d2c226fff0a5617a2f3c60c4b5e3df821 | 028cbe18b4e5c347f664c592cbc7f56729b74060 | /v2/appserv-core/src/java/com/sun/jndi/url/corbaname/corbanameURLContext.java | 5a1e870fb87ae018992c67d3ad17073c284b798d | [] | no_license | dmatej/Glassfish-SVN-Patched | 8d355ff753b23a9a1bd9d7475fa4b2cfd3b40f9e | 269e29ba90db6d9c38271f7acd2affcacf2416f1 | refs/heads/master | 2021-05-28T12:55:06.267463 | 2014-11-11T04:21:44 | 2014-11-11T04:21:44 | 23,610,469 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,969 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.sun.jndi.url.corbaname;
import javax.naming.spi.ResolveResult;
import javax.naming.*;
import java.util.Hashtable;
import java.net.MalformedURLException;
import com.sun.jndi.cosnaming.IiopUrl;
/**
* A corbaname URL context.
*
* @author Rosanna Lee
*/
public class corbanameURLContext
extends com.sun.jndi.toolkit.url.GenericURLContext {
corbanameURLContext(Hashtable env) {
super(env);
}
/**
* Resolves 'name' into a target context with remaining name.
* It only resolves the hostname/port number. The remaining name
* contains the rest of the name found in the URL.
*
* For example, with a corbaname URL
* "corbaname:iiop://localhost:900#rest/of/name",
* this method resolves "corbaname:iiop://localhost:900" to the "NameService"
* context on for the ORB at 'localhost' on port 900,
* and returns as the remaining name "rest/of/name".
*/
protected ResolveResult getRootURLContext(String name, Hashtable env)
throws NamingException {
return corbanameURLContextFactory.getUsingURLIgnoreRest(name, env);
}
/**
* Return the suffix of a corbaname url.
* prefix parameter is ignored.
*/
protected Name getURLSuffix(String prefix, String url)
throws NamingException {
// Rewrite to corbaname url
url = corbanameURLContextFactory.rewriteUrl(url);
try {
IiopUrl parsedUrl = new IiopUrl(url);
return parsedUrl.getCosName();
} catch (MalformedURLException e) {
throw new InvalidNameException(e.getMessage());
}
}
/**
* Finds the prefix of a corbaname URL.
* This is all of the non-string name portion of the URL.
* The string name portion always occurs after the '#'
* so we just need to look for that.
*/
protected String getURLPrefix(String url) throws NamingException {
int start = url.indexOf('#');
if (start < 0) {
return url; // No '#', prefix is the entire URL
}
return url.substring(0, start);
}
}
| [
"kohsuke@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5"
] | kohsuke@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5 |
5ffc9f922577dc43b4fb20b4898562d8e873b053 | da4343f37e638db0752ef6898e8df34bc65af141 | /app/src/main/java/com/ayushagarwal96/compass/MainActivity.java | 8b9220c1b63dd6843801c99ab8fd43bfb3e93e84 | [] | no_license | ayushagarwal96/Compass | 9c5b58baa959de6a7c61bf8d4cd24731a62eb3eb | 400bfaf76d22cdc0ae0fa2cda6d2cb06305d0827 | refs/heads/master | 2021-06-25T00:18:40.732881 | 2017-09-11T05:28:24 | 2017-09-11T05:28:24 | 103,093,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,206 | java | package com.ayushagarwal96.compass;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements SensorEventListener {
ImageView iv_arrow;
TextView tv_degrees;
private static SensorManager sensorService;
private Sensor sensor;
private float currentDegree = 0f;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
iv_arrow = (ImageView) findViewById(R.id.iv_arrow);
tv_degrees = (TextView) findViewById(R.id.tv_degrees);
sensorService = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sensor = sensorService.getDefaultSensor(Sensor.TYPE_ORIENTATION);
}
@Override
protected void onResume() {
super.onResume();
if(sensor!= null){
sensorService.registerListener(this, sensor, SensorManager.SENSOR_DELAY_FASTEST);
} else {
Toast.makeText(MainActivity.this, "Not Support!", Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onPause() {
super.onPause();
sensorService.unregisterListener(this);
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
int degree = Math.round(sensorEvent.values[0]);
tv_degrees.setText(Integer.toString(degree) + (char) 0x00B0);
RotateAnimation ra = new RotateAnimation(currentDegree, -degree,
Animation.RELATIVE_TO_SELF, 0.5F, Animation.RELATIVE_TO_SELF, 0.5f);
ra.setDuration(1000);
ra.setFillAfter(true);
iv_arrow.startAnimation(ra);
currentDegree = -degree;
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
}
| [
"[email protected]"
] | |
5917c18fc0402ede2e137006624c03a3c0e50468 | c70bf1b4c4d5ab2117ffdba7f11d16f632edf3de | /src/ua/artcode/algo/TestFact.java | 30bc1779f715cb4113d5ffd0fc7efda47c55610f | [] | no_license | presly808/ACO3 | 67df45e1d808b0a8f23dd2c14945a5dce845420b | 62487eabeaad8205f4c1db4adfa1ffdc6049c3e7 | refs/heads/master | 2020-12-24T13:53:00.242523 | 2014-12-24T07:15:34 | 2014-12-24T07:15:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package ua.artcode.algo;
import java.math.BigInteger;
/**
* Created by admin on 01.12.2014.
*/
public class TestFact {
public static void main(String[] args) {
BigInteger bigInteger = new BigInteger("5");
System.out.println(fact(new BigInteger("11")));
}
public static BigInteger fact(BigInteger num){
return num.compareTo(new BigInteger("2")) < 0 ? BigInteger.ONE :
num.multiply(fact(num.subtract(BigInteger.ONE)));
}
public static long fact(int num){
return num < 2 ? 1 : num * fact(num-1);
}
}
| [
"[email protected]"
] | |
a0aaef761a6c4ac565b2e4304d8d1aacb6a6be3f | 8a50d66a77ecf245289f23acb2ab7f91be8edddf | /amq/src/main/java/com/ys/service/topic/ProducerTool.java | 3e35cc95b1f4e8679f954783190224265f97027f | [] | no_license | yushiwh/BigData | 71b472ff97cc50c033464de99b6b5d383e442ad8 | c9f538a6d4fe5127021579b5dd0bf31df2b225bf | refs/heads/master | 2021-01-22T20:08:50.515942 | 2017-05-02T10:32:55 | 2017-05-02T10:32:55 | 85,287,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,021 | java | package com.ys.service.topic;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import javax.jms.*;
public class ProducerTool {
private String user = ActiveMQConnection.DEFAULT_USER;
private String password = ActiveMQConnection.DEFAULT_PASSWORD;
private String url = ActiveMQConnection.DEFAULT_BROKER_URL;
private String subject = "mytopic";
private Destination destination = null;
private Connection connection = null;
private Session session = null;
private MessageProducer producer = null;
// 初始化
private void initialize() throws JMSException, Exception {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
user, password, url);
connection = connectionFactory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
destination = session.createTopic(subject);
producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
}
// 发送消息
public void produceMessage(String message) throws JMSException, Exception {
initialize();
TextMessage msg = session.createTextMessage(message);
connection.start();
System.out.println("Producer:->Sending message: " + message);
producer.send(msg);
System.out.println("Producer:->Message sent complete!");
}
// 关闭连接
public void close() throws JMSException {
System.out.println("Producer:->Closing connection");
if (producer != null)
producer.close();
if (session != null)
session.close();
if (connection != null)
connection.close();
}
} | [
"[email protected]"
] | |
9c605ffd6852f2813be3a7494cd8269a8229af3b | c1d20e33891deb190d096f5a5ea0cf426b257069 | /newserver1/newserver1/src/com/mayhem/core/network/login/Decoder.java | a61d06c5575cd5aaad0635ac8e11ea2fbf0ab271 | [] | no_license | premierscape/NS1 | 72a5d3a3f2d5c09886b1b26f166a6c2b27ac695d | 0fb88b155b2abbb98fe3d88bb287012bbcbb8bf9 | refs/heads/master | 2020-04-07T00:46:08.175508 | 2018-11-16T20:06:10 | 2018-11-16T20:06:10 | 157,917,810 | 0 | 0 | null | 2018-11-16T20:44:52 | 2018-11-16T20:25:56 | Java | UTF-8 | Java | false | false | 2,178 | java | package com.mayhem.core.network.login;
/*
* This file is part of RuneSource.
*
* RuneSource is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RuneSource 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 RuneSource. If not, see <http://www.gnu.org/licenses/>.
*/
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
import com.mayhem.core.network.ISAACCipher;
import com.mayhem.core.network.ReceivedPacket;
import com.mayhem.core.util.Utility;
/**
*
* @author Graham Edgecombe
* @author Stuart Murphy
*
*/
public class Decoder extends FrameDecoder {
private final ISAACCipher cipher;
private int opcode = -1;
private int size = -1;
public Decoder(ISAACCipher cipher) {
this.cipher = cipher;
}
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
if (opcode == -1) {
if (buffer.readableBytes() >= 1) {
opcode = buffer.readByte() & 0xFF;
opcode = (opcode - cipher.getNextValue()) & 0xFF;
size = Utility.packetLengths[opcode];
} else {
return null;
}
}
if (size == -1) {
if (buffer.readableBytes() >= 1) {
size = buffer.readByte() & 0xFF;
} else {
return null;
}
}
if (buffer.readableBytes() >= size) {
byte[] data = new byte[size];
buffer.readBytes(data);
ChannelBuffer payload = ChannelBuffers.buffer(size);
payload.writeBytes(data);
try {
return new ReceivedPacket(opcode, size, payload);
} finally {
opcode = -1;
size = -1;
}
}
return null;
}
}
| [
"[email protected]"
] | |
7e7a467fd2ada0ceb127ee06f9634c7ffd891712 | 42bbdff3f358f0291fed6ee9a2a4c29b484e2fb8 | /deployers/src/main/java/org/jboss/jpa/resolvers/strategy/SearchStrategy.java | 79a0dd4b95c1380251a442927b7d82f6b54e5dc7 | [] | no_license | jboss/jboss-jpa | 677ccd88cb81c339967009aa3a22ca2605ef42ba | a2ef4fdec9164d0220314b30852405838efaead4 | refs/heads/master | 2023-05-29T23:43:42.923281 | 2011-01-19T12:15:08 | 2011-08-11T02:20:07 | 1,177,403 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,978 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.jpa.resolvers.strategy;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
/**
* Allow for different methods to find persistence units.
*
* @author <a href="mailto:[email protected]">Carlo de Wolf</a>
* @version $Revision: $
*/
public interface SearchStrategy
{
/**
* Find the persistence unit supplier bean given a persistence unit name.
*
* @param resolver the resolver which we're working on behalf of
* @param deploymentUnit the deployment unit that has a persistence unit reference
* @param persistenceUnitName the (relative) name of a persistence unit or null for the default persistence unit
* @return the bean name of the persistence unit or null if not found
*/
String findPersistenceUnitSupplier(PersistenceUnitDependencyResolver resolver, DeploymentUnit deploymentUnit, String persistenceUnitName);
}
| [
"[email protected]"
] | |
ca943a7269c2adf6929995ea44a312d5c9e903ff | 3eefcf92ac4c73ad8e3839605de64898fb363c47 | /src/main/java/com/lh/view/AddUserView.java | 41384f3d186c3af808f52cb540cbc9e4e7da8856 | [] | no_license | MABIY/UsersManager | 05a69c7584b892f742a2695aab9b647caa38802c | 3208233d848cf37818c5b30061d8468991b101dc | refs/heads/master | 2021-01-25T13:47:01.079344 | 2018-03-09T05:49:36 | 2018-03-09T05:49:36 | 123,610,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,416 | java | package com.lh.view;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
public class AddUserView extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
out.println("<form action='/UsersManager/UserClServlet?type=add' method='post'>");
out.println("<table border=1px bordercolor=green cellspacing=0 width=500px>");
out.println("<tr><td>用户名</td><td><input type='text' name='username'/></td></tr>");
out.println("<tr><td>email</td><td><input type='text' name='email'/></td></tr>");
out.println("<tr><td>级别</td><td><input type='text' name='grade'/></td></tr>");
out.println("<tr><td>密码</td><td><input type='text' name='passwd' /></td></tr>");
out.println("<tr><td><input type='submit' value='添加用户'></td><td><input type='reset' value='重新填写'/></td></tr>");
out.println("</table>");
out.println("</form>");
}
}
| [
"[email protected]"
] | |
3eb1d15751706c648072ff41ec5b9b7d2a347624 | 5e2644e2c04bfdd8781b5f36a908d8fc497bb84f | /src/com/asus/suw/lockscreen/AsusFingerprintEnrollFindSensor.java | 146cf68d1369cf902c77de7bba139d54caa00f62 | [
"Apache-2.0"
] | permissive | biantao712/Settings | 2f61bfb4ce21f29e308afc2d0e6b138b4c8f6fa6 | eba1e20cdc131ff4678ba246451fb20796337468 | refs/heads/master | 2021-07-05T13:23:15.596634 | 2017-09-26T03:30:01 | 2017-09-26T03:30:01 | 105,894,988 | 1 | 0 | null | 2017-10-05T13:44:14 | 2017-10-05T13:44:14 | null | UTF-8 | Java | false | false | 9,739 | java | /*
* Copyright (C) 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.asus.suw.lockscreen;
import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.UserHandle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.ChooseLockSettingsHelper;
import com.android.settings.R;
import com.android.settings.fingerprint.AsusFindFingerprintSensorView;
import com.android.settings.fingerprint.FingerprintEnrollSidecar.Listener;
import com.android.settings.fingerprint.FingerprintEnrollSidecar;
import com.android.settings.fingerprint.FingerprintFindSensorAnimation;
import com.android.settings.fingerprint.FingerprintEnrollEnrolling;
/**
* Activity explaining the fingerprint sensor location for fingerprint enrollment.
*/
public class AsusFingerprintEnrollFindSensor extends AsusFingerprintEnrollBase {
private static String TAG = "FingerprintEnrollFindSensor";
private static boolean DEBUG = true;
private static final int CONFIRM_REQUEST = 1;
private static final int ENROLLING = 2;
public static final String EXTRA_KEY_LAUNCHED_CONFIRM = "launched_confirm_lock";
public static final String EXTRA_KEY_SENEOR_POSITION = "fingerprint_sensor_position";
private FingerprintFindSensorAnimation mAnimation;
private boolean mLaunchedConfirmLock;
private FingerprintEnrollSidecar mSidecar;
private boolean mNextClicked;
private TextView mMessage;
private AsusFindFingerprintSensorView mSensorPositionView;
private boolean mPosition = true; //True == front, False == back
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setSubContentView(getContentView());
setHeaderText(R.string.asus_security_settings_fingerprint_enroll_find_sensor_title);
if (savedInstanceState != null) {
mLaunchedConfirmLock = savedInstanceState.getBoolean(EXTRA_KEY_LAUNCHED_CONFIRM);
mToken = savedInstanceState.getByteArray(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
}
if (mToken == null && !mLaunchedConfirmLock) {
launchConfirmLock();
} else if (mToken != null) {
startLookingForFingerprint(); // already confirmed, so start looking for fingerprint
}
//++ Asus feature
mSensorPositionView = (AsusFindFingerprintSensorView)findViewById(R.id.find_sensor_view);
mMessage = (TextView)findViewById(R.id.find_sensor_text);
mPosition = AsusFindFingerprintSensorView.SENSOR_FRONT.equals(mSensorPositionView.getPosition());
if(mPosition){
mMessage.setText(R.string.asus_security_settings_fingerprint_enroll_find_sensor_message_front);
}else{
mMessage.setText(R.string.asus_security_settings_fingerprint_enroll_find_sensor_message_back);
}
TextView hintText = (TextView) findViewById(R.id.hint_message);
if(mPosition){
hintText.setVisibility(View.VISIBLE);
}
//mAnimation = (FingerprintLocationAnimationView) findViewById(
// R.id.fingerprint_sensor_location_animation);
//-- Asus feature
}
protected int getContentView() {
return R.layout.asus_fingerprint_enroll_find_sensor;
}
@Override
protected void onStart() {
super.onStart();
//mAnimation.startAnimation();
}
private void startLookingForFingerprint() {
mSidecar = (FingerprintEnrollSidecar) getFragmentManager().findFragmentByTag(
FingerprintEnrollEnrolling.TAG_SIDECAR);
if (mSidecar == null) {
mSidecar = new FingerprintEnrollSidecar();
getFragmentManager().beginTransaction()
.add(mSidecar, FingerprintEnrollEnrolling.TAG_SIDECAR).commit();
}
mSidecar.setListener(new Listener() {
@Override
public void onEnrollmentProgressChange(int steps, int remaining) {
mNextClicked = true;
if (!mSidecar.cancelEnrollment()) {
proceedToEnrolling();
}
}
@Override
public void onEnrollmentHelp(CharSequence helpString) {
}
@Override
public void onEnrollmentError(int errMsgId, CharSequence errString) {
if (mNextClicked && errMsgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
mNextClicked = false;
proceedToEnrolling();
}
}
});
}
@Override
protected void onStop() {
super.onStop();
//mAnimation.pauseAnimation();
}
@Override
protected void onDestroy() {
super.onDestroy();
//mAnimation.stopAnimation();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(EXTRA_KEY_LAUNCHED_CONFIRM, mLaunchedConfirmLock);
outState.putByteArray(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
}
@Override
protected void onNextButtonClick() {
Log.d(TAG, "onNextButtonClick");
mNextClicked = true;
if (mSidecar == null || (mSidecar != null && !mSidecar.cancelEnrollment())) {
proceedToEnrolling();
}
}
private void proceedToEnrolling() {
Log.d(TAG, "proceedToEnrolling");
if(mSidecar != null){
getFragmentManager().beginTransaction().remove(mSidecar).commit();
}else{
Log.d(TAG, "mSidecar is null");
}
mSidecar = null;
startActivityForResult(getEnrollingIntent(), ENROLLING);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CONFIRM_REQUEST) {
if (resultCode == RESULT_OK) {
mToken = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
overridePendingTransition(R.anim.suw_slide_next_in, R.anim.suw_slide_next_out);
getIntent().putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
startLookingForFingerprint();
} else {
finish();
}
} else if (requestCode == ENROLLING) {
//++ Asus flow: return token to FingerprintSettings
if(data == null){
data = new Intent();
}
data.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
//-- Asus flow: return token to FingerprintSettings
if (resultCode == RESULT_FINISHED) {
setResult(RESULT_FINISHED, data); // Asus flow: return token to FingerprintSettings
finish();
} else if (resultCode == RESULT_SKIP) {
setResult(RESULT_SKIP, data); // Asus flow: return token to FingerprintSettings
finish();
} else if (resultCode == RESULT_TIMEOUT) {
setResult(RESULT_TIMEOUT);
finish();
} else {
FingerprintManager fpm = getSystemService(FingerprintManager.class);
int enrolled = fpm.getEnrolledFingerprints().size();
int max = getResources().getInteger(
com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
if (enrolled >= max) {
finish();
} else {
// We came back from enrolling but it wasn't completed, start again.
startLookingForFingerprint();
}
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
private void launchConfirmLock() {
long challenge = getSystemService(FingerprintManager.class).preEnroll();
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
boolean launchedConfirmationActivity = false;
if (mUserId == UserHandle.USER_NULL) {
launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST,
getString(R.string.security_settings_fingerprint_preference_title),
null, null, challenge);
} else {
launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST,
getString(R.string.security_settings_fingerprint_preference_title),
null, null, challenge, mUserId);
}
if (!launchedConfirmationActivity) {
// This shouldn't happen, as we should only end up at this step if a lock thingy is
// already set.
finish();
} else {
mLaunchedConfirmLock = true;
}
}
@Override
protected int getMetricsCategory() {
return MetricsEvent.FINGERPRINT_FIND_SENSOR;
}
}
| [
"[email protected]"
] | |
5dc2617bffc6121edb74de42e1ae8859bba2e46f | 70b52c0d6fe124ebad7bf2a537c44d864cfd3665 | /FaceReplacementSystem/src/frs/curve/BestSideCurves.java | 0750d1e3f4868a0a4c241934f220d68d220c6c5a | [] | no_license | projectwork065bct/FaceReplacementSystem | cc68a866f70a56281bd52e913f8bafef8c845dc7 | 645085ea3317ce4368044e02a58fd13d04598c69 | refs/heads/master | 2021-06-22T18:55:12.723227 | 2017-03-30T15:44:34 | 2017-03-30T15:44:34 | 4,747,047 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,682 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package frs.curve;
import frs.dataTypes.FeaturePoint;
import frs.helpers.ColorModelConverter;
import frs.helpers.DeepCopier;
import java.awt.Point;
import java.awt.geom.GeneralPath;
import java.awt.geom.QuadCurve2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Robik Shrestha
*/
public class BestSideCurves {
protected BufferedImage image;
protected float[][][] ycbcr;
protected int LEFT = 1, RIGHT = 2;
// protected Curve curve, rightCurve1;
protected float maxLeftScore, maxRightScore;
protected List<Point> bestLeftPts, bestRightPts;
protected Point[] fp;//2 points in each list
protected int eyeDist;
protected int rx, lx;// x -coordinates of right and left eyes
public BestSideCurves(BufferedImage image, Point[] fp) {
this.image = image;
ycbcr = ColorModelConverter.getYCbCr(image);
this.fp = fp;
rx = fp[FeaturePoint.RIGHT_EYE].x;
lx = fp[FeaturePoint.LEFT_EYE].x;
eyeDist = Math.abs(rx - lx);
findBestLeftPts();
findBestRightPts();
}
public void findBestLeftPts() {
List<Point> tempBestLeftPts = new ArrayList();
//First step is to find the best curve from right cheek to middle of right cheek and eye (middle means middle along y-axis)
int xMin = (int) (lx - .5 * eyeDist);
int xMax = (int) (lx - .4 * eyeDist);
int y = (fp[FeaturePoint.LEFT_EYE].y) * 2 / 3;
Point pMin = new Point(xMin, y);
Point pMax = new Point(xMax, y);
tempBestLeftPts.addAll(findCurve(fp[FeaturePoint.LEFT_CHIN], fp[FeaturePoint.LEFT_CHEEK], pMin, pMax, LEFT));
bestLeftPts = new ArrayList();
for (int i = 0; i < tempBestLeftPts.size(); i++) {
Point p = tempBestLeftPts.get(i);
if (p.y >= fp[FeaturePoint.LEFT_EYE].y) {
bestLeftPts.add(p);
}
}
}
public void findBestRightPts() {
List<Point> tempBestRightPts = new ArrayList();
//First step is to find the best curve from right cheek to middle of right cheek and eye (middle means middle along y-axis)
int xMin = (int) (rx + .4 * eyeDist);
int xMax = (int) (rx + .5 * eyeDist);
int y = (fp[FeaturePoint.RIGHT_EYE].y) * 2 / 3;
Point pMin = new Point(xMin, y);
Point pMax = new Point(xMax, y);
tempBestRightPts.addAll(findCurve(fp[FeaturePoint.RIGHT_CHIN], fp[FeaturePoint.RIGHT_CHEEK], pMin, pMax, RIGHT));
bestRightPts = new ArrayList();
for (int i = 0; i < tempBestRightPts.size(); i++) {
Point p = tempBestRightPts.get(i);
if (p.y >= fp[FeaturePoint.RIGHT_EYE].y) {
bestRightPts.add(p);
}
}
}
/*
* int xMin = (int) (rx + .35 * eyeDist); int xMax = (int) (rx + 0.6 *
* eyeDist); int y = (fp[FeaturePoint.RIGHT_CHEEK].y +
* fp[FeaturePoint.RIGHT_EYE].y) / 2; Point pMin = new Point(xMin, y), pMax
* = new Point(xMax, y);
* bestRightPts.addAll(findCurve(fp[FeaturePoint.RIGHT_CHIN],
* fp[FeaturePoint.RIGHT_CHEEK], pMin, pMax)); //The values .35 and .7 were
* found by some experimentation. There is no guarantee that this range is
* correct //Following code finds the best curve from the right cheek to
* height of right eye xMin = (int) (rx + .35 * (float) eyeDist);// +
* (float) eyeDist / 3 xMax = (int) (rx + .7 * (float) eyeDist); y =
* fp[FeaturePoint.RIGHT_EYE].y; pMin = new Point(xMin, y); pMax = new
* Point(xMax, y);
* bestRightPts.addAll(findCurve(fp[FeaturePoint.RIGHT_CHEEK],
* bestRightPts.get(0), pMin, pMax));
*/
//A curve is found out start from p1, controlled by p2 till an end point whose x-coordinate lies along pMin.x and
//pMax.x and y-coordinate is equal to pMin.y which is equal to pMax.y
public List<Point> findCurve(Point p1, Point p2, Point pMin, Point pMax, int side) {
float maxScore = 0;//maximum score upto now
int xMin = pMin.x;
int xMax = pMax.x;
List<Point> curvePoints;
List<Point> bestPts = null;
for (int x = xMin; x <= xMax; x++) {
SquarePolynomial_003 curve = new SquarePolynomial_003();
Point[] threeCurvePoints = {p1, p2, new Point(x, pMin.y)};//points for the curve to be evaluated
Point[] curveEnds = {new Point(x, pMin.y), p2};
curve.setPoints(threeCurvePoints);
try {
curvePoints = curve.getPoints(curveEnds);
} catch (Exception e) {
System.out.println("Exception thrown");
continue;
}
//for each point in the trial curve
float score;
if (side == RIGHT) {
score = evaluateRightCurve(curvePoints);
} else {
score = evaluateLeftCurve(curvePoints);
}
if (score > maxScore) {
maxScore = score;
bestPts = DeepCopier.getPoints(curvePoints);
}
}
return bestPts;
}
public List<Point> getLeftCurve() {
return bestLeftPts;
}
public List<Point> getRightCurve() {
return bestRightPts;
}
//Find out how good that left curve really is
public float evaluateLeftCurve(List<Point> curvePoints) {
List<Point> simPoints = new ArrayList();//these points should be similar to the curve
List<Point> diffPoints = new ArrayList();//these points should be different to the curve
for (int i = 0; i < curvePoints.size(); i++) {
Point p = curvePoints.get(i);
for (int xSim = 1; xSim <= 5; xSim++) {
simPoints.add(new Point(p.x + xSim, p.y));
}
for (int xDiff = 1; xDiff <= 5; xDiff++) {
diffPoints.add(new Point(p.x - xDiff, p.y));
}
}
return findScore(simPoints, curvePoints, diffPoints);
}
//Find out how good that right curve really is
public float evaluateRightCurve(List<Point> curvePoints) {
List<Point> simPoints = new ArrayList();//these points should be similar to the curve
List<Point> diffPoints = new ArrayList();//these points should be different to the curve
for (int i = 0; i < curvePoints.size(); i++) {
Point p = curvePoints.get(i);
for (int xSim = 1; xSim <= 5; xSim++) {
simPoints.add(new Point(p.x - xSim, p.y));
}
for (int xDiff = 1; xDiff <= 5; xDiff++) {
diffPoints.add(new Point(p.x + xDiff, p.y));
}
}
return findScore(simPoints, curvePoints, diffPoints);
}
//Each curve has a score based on the similarity with inner points and dissimilarity with outer points
// i.e. inner or outer to face
public float findScore(List<Point> simPoints, List<Point> curvePoints, List<Point> diffPoints) {
float diffScore = (float) ((float) findDiffScore(curvePoints, diffPoints) * .5);
float simScore = (float) ((float) (1 - findDiffScore(curvePoints, simPoints)) * .25);//find similarity between curvePoints and simPoints
float skinScore = (float) ((float) (findSkinScore(curvePoints)) * 0.25);
return (diffScore + simScore + skinScore);
//float skinScore = findSkinScore(curvePoints);
//float nonSkinScore = findNonSkinScore(curvePoints);
}
//How different are the "diffPoints" wrt "curvePoints" ?
public float findDiffScore(List<Point> curvePoints, List<Point> diffPoints) {
float score = 0;
int n = 0;
for (int i = 0; i < diffPoints.size(); i++) {
Point cp = curvePoints.get(i % (curvePoints.size()));//curve point
Point dp = diffPoints.get(i);// diff point
try {
for (int j = 0; j < 3; j++) {
score += Math.abs(ycbcr[cp.x][cp.y][j] - ycbcr[dp.x][dp.y][j]);
}
n++;
} catch (Exception e) {
continue;
}
}
//3 for y, cb, cr and 255 for max. diff = 255
//normalization for value to be between 0 and 1
score /= (255 * n * 3);
return score;
}
public float findSkinScore(List<Point> curvePoints) {
int nSkin = 0;
int n = 0;
float Y, Cb, Cr;
for (int i = 0; i < curvePoints.size(); i++) {
Point p = curvePoints.get(i);
try {
Y = ycbcr[p.x][p.y][0];
Cb = ycbcr[p.x][p.y][1];
Cr = ycbcr[p.x][p.y][2];
} catch (Exception e) {
continue;
}
if (Y > 50 && Y < 240 && Cb >= -50 && Cb <= -5 && Cr > 0 && Cr < 50) {
nSkin++;
}
n++;
}
return (float) nSkin / n;
}
public float findNonSkinScore(List<Point> curvePoints) {
return 1;
}
// public float findScore(List<Point> simPoints, List<Point> curvePoints, List<Point> diffPoints) {
// float[] simSum, curveSum, diffSum;
// simSum = findSum(simPoints);
// curveSum = findSum(curvePoints);
// diffSum = findSum(diffPoints);
// float simMean[] = new float[3], curveMean[] = new float[3], diffMean[] = new float[3];
// float score = 0;
// for (int i = 0; i < 3; i++) {
// simMean[i] = (simSum[i]) / (simPoints.size());
// curveMean[i] = (curveSum[i]) / curvePoints.size();
// diffMean[i] = (diffSum[i] / diffPoints.size());
// score += (float) Math.abs(diffMean[i] - curveMean[i]) / Math.abs(simMean[i] - curveMean[i]);
// }
// return score;
// }
//
// //Find the sum of ycbcr values
// public float[] findSum(List<Point> points) {
// float sum[] = new float[3];
// for (int i = 0; i < points.size(); i++) {
// Point p = points.get(i);
// try {
// sum[0] += ycbcr[p.x][p.y][0];
// sum[1] += ycbcr[p.x][p.y][1];
// sum[2] += ycbcr[p.x][p.y][2];
// } catch (Exception e) {
// continue;
// }
// }
// return sum;
// }
}
| [
"ramsharan@ramsharan-PC"
] | ramsharan@ramsharan-PC |
079ebcbd481d58ba569f36de304d9c61c91e0f16 | f9baed16714cf2279ae67114d18da4a9815871be | /app/src/main/java/com/zj/reviewknowledgepoints/javaCode/bitmap/MemoryLruCache.java | ed961ac680d5da9ac8e56c84021e0bb87f261de2 | [] | no_license | zhangxushi665/ReviewKnowledgePoints | d408b191d2594304e7cc1c55fb87a609c4982ce5 | 2ea211abc12876553b37de3700dcb10bcabbb6e1 | refs/heads/master | 2020-04-22T08:07:55.826067 | 2019-02-21T06:52:49 | 2019-02-21T06:52:49 | 170,234,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,949 | java | package com.zj.reviewknowledgepoints.javaCode.bitmap;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.os.Build;
import android.text.TextUtils;
import android.util.LruCache;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Created by zj on 2019-02-13 16:18.
* 模拟Lrucache
*/
public class MemoryLruCache {
public static final String TAG = MemoryLruCache.class.getSimpleName();
private LruCache<String, Bitmap> mMemoryCache;
private MemoryLruCache instance;
private MemoryLruCache() {
long maxMemory = Runtime.getRuntime().maxMemory();
int cache = (int) (maxMemory / 8);
mMemoryCache = new LruCache<String, Bitmap>(cache) {
//回收内存
@Override
protected void entryRemoved(boolean evicted, String key, Bitmap oldValue, Bitmap newValue) {
super.entryRemoved(evicted, key, oldValue, newValue);
if (oldValue != null && !oldValue.isRecycled()) {
oldValue.recycle();
}
}
//计算一张图片所占内存
@SuppressLint("ObsoleteSdkInt")
@Override
protected int sizeOf(String key, Bitmap value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//19
int size = value.getAllocationByteCount();
return size;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {//12
return value.getByteCount();
}
// 低版本中使用bitmap所占的内存数等于bitmap的每一行所占的空间数乘以bitmap行数
return value.getRowBytes() * value.getHeight();
}
};
}
public MemoryLruCache getInstance() {
if (null == instance) {
instance = new MemoryLruCache();
}
return instance;
}
public Bitmap getBitmap(String key) {
if (TextUtils.isEmpty(key)) {
return null;
} else {
return mMemoryCache.get(key);
}
}
public void putBitmap(String key, Bitmap bitmap) {
mMemoryCache.put(key, bitmap);
}
// 放在activity中清除不需要的bitmap
public void cleanCache(String[] urls) {
try {
Class<?> aClass = Class.forName("android.util.LruCache");
Field field = aClass.getDeclaredField("map");
field.setAccessible(true);
LinkedHashMap<String, Bitmap> map = (LinkedHashMap<String, Bitmap>) field.get(mMemoryCache);
if (map == null)
return;
Iterator<Map.Entry<String, Bitmap>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Bitmap> entry = iterator.next();
Bitmap bit = entry.getValue();
if (urls != null && urls.length > 0) {
for (int i = 0; i < urls.length; i++) {
if (TextUtils.equals(entry.getKey(), urls[i])) {
if (bit != null && !bit.isRecycled()) {
bit.recycle();
}
iterator.remove();
break;
}
}
} else {
if (bit != null && !bit.isRecycled()) {
bit.recycle();
}
iterator.remove();
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
| [
"test"
] | test |
32dfb5fa81547ba16ec85f9cac2fc353c6f293c5 | bfa58ee4425d4881810cbfd779a966d1f4edf6dd | /src/main/java/tool/XmlTool.java | 6c08df0c5b6b6d7ff9f614b7e58c9b6884ef7ece | [] | no_license | libanguo/integrate | eda7f7ed838c9f9ae9101ad046f37ef91ce6d5bc | 17789bf82de720dcbd4bd5e7702348e5ac3e50f7 | refs/heads/master | 2023-05-23T17:05:18.204401 | 2021-06-08T11:17:36 | 2021-06-08T11:17:36 | 373,018,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,684 | java | package tool;
import org.xml.sax.SAXException;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.*;
public class XmlTool {
public boolean stringToFile(String res, String filePath) {
boolean flag = true;
BufferedReader bufferedReader = null;
BufferedWriter bufferedWriter = null;
try {
File distFile = new File(filePath);
if (!distFile.getParentFile().exists()) distFile.getParentFile().mkdirs();
bufferedReader = new BufferedReader(new StringReader(res));
bufferedWriter = new BufferedWriter(new FileWriter(distFile));
char buf[] = new char[1024]; //字符缓冲区
int len;
while ((len = bufferedReader.read(buf)) != -1) {
bufferedWriter.write(buf, 0, len);
}
bufferedWriter.flush();
bufferedReader.close();
bufferedWriter.close();
} catch (IOException e) {
e.printStackTrace();
flag = false;
return flag;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return flag;
}
/**
* 使用xslt转化XML文件
* @param srcXmlPath 源XML文件路径
* @param targetXmlPath 目标XML文件路径
* @param xsltPath XSLT文件路径
*/
public void transformXmlByXslt(String srcXmlPath,String targetXmlPath,String xsltPath) {
//获取转化器工厂
TransformerFactory tff = TransformerFactory.newInstance();
try {
//获取转化器对象实例s
Transformer tf = tff.newTransformer(new StreamSource(xsltPath));
//进行转化
tf.transform(new StreamSource(srcXmlPath), new StreamResult(
new FileOutputStream(targetXmlPath)));
System.out.println("转化成功");
} catch (TransformerConfigurationException e) {
e.printStackTrace();
System.out.println("获取转化对象实例失败");
} catch (FileNotFoundException e) {
e.printStackTrace();
System.out.println("没有发现源文件");
} catch (TransformerException e) {
e.printStackTrace();
System.out.println("转化成目标文件失败");
}
}
public boolean Validatexml(String xsdpath,String xmlpath) throws SAXException,IOException{
//建立schema工厂
SchemaFactory schemaFactory=SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
//建立验证文档文件对象,利用此文件对象所封装的文件进行schema验证
File schemaFile=new File(xsdpath);
//利用schema工厂,接收验证文档文件对象生成Schema对象
Schema schema=schemaFactory.newSchema(schemaFile);
//通过Schema产生针对于此Schema的验证器,利用schenaFile进行验证
Validator validator=schema.newValidator();
//得到验证的数据源
Source source=new StreamSource(xmlpath);
//开始验证,成功输出success!!!,失败输出fail
try{
validator.validate(source);
}catch(Exception ex){
ex.printStackTrace();
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
5951ff0d70849a58c78f9f6f04d2345ac1b30ed3 | 620df7c944c4e2762aabbedc980d382e9e895e3a | /Lab3/property/House.java | f3a07633a72007b9026f4758d6f9557b5dde834a | [] | no_license | mrr3n3w/Java | cc126a0a082afc9d2c877adf093075223f31f4a9 | 8f951536c10e9e790b873ad2fa4b07aacfb76dfc | refs/heads/master | 2020-05-16T23:21:57.551293 | 2014-06-04T20:43:18 | 2014-06-04T20:43:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | /**
* @author Jordan 300219995
*/
public class House extends Dwelling
{
private double yardArea;
private String houseType;
public House( String address, Zone pZone, double area, int bedrooms,
double bathrooms, double monthlyRent, double yardArea,
String houseType )
{
super(address, pZone, area, bedrooms, bathrooms, monthlyRent);
this.yardArea = yardArea;
this.houseType = houseType;
}
public double getYardArea()
{
return yardArea;
}
public String getHouseType()
{
return houseType;
}
public String toString()
{
return super.toString() + this.getYardArea() + "sq.ft. yard\n";
}
}
| [
"[email protected]"
] | |
768fb5495d171f37253ec7d37d2018a05e2d53d8 | 963599f6f1f376ba94cbb504e8b324bcce5de7a3 | /sources/p035ru/unicorn/ujin/view/customViews/dynamic/button/BaseButtonHolder$bindButton$1$1$3$2.java | 8e32788d7c94ca883c6bc5d574907c10543815f6 | [] | no_license | NikiHard/cuddly-pancake | 563718cb73fdc4b7b12c6233d9bf44f381dd6759 | 3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4 | refs/heads/main | 2023-04-09T06:58:04.403056 | 2021-04-20T00:45:08 | 2021-04-20T00:45:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package p035ru.unicorn.ujin.view.customViews.dynamic.button;
import android.content.DialogInterface;
import kotlin.Metadata;
@Metadata(mo51341bv = {1, 0, 3}, mo51342d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0004*\u0004\u0018\u00010\u00030\u00032\u0006\u0010\u0005\u001a\u00020\u0006H\n¢\u0006\u0002\b\u0007"}, mo51343d2 = {"<anonymous>", "", "dialog", "Landroid/content/DialogInterface;", "kotlin.jvm.PlatformType", "<anonymous parameter 1>", "", "onClick"}, mo51344k = 3, mo51345mv = {1, 4, 1})
/* renamed from: ru.unicorn.ujin.view.customViews.dynamic.button.BaseButtonHolder$bindButton$1$1$3$2 */
/* compiled from: BaseButtonHolder.kt */
final class BaseButtonHolder$bindButton$1$1$3$2 implements DialogInterface.OnClickListener {
public static final BaseButtonHolder$bindButton$1$1$3$2 INSTANCE = new BaseButtonHolder$bindButton$1$1$3$2();
BaseButtonHolder$bindButton$1$1$3$2() {
}
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}
| [
"[email protected]"
] | |
1b580153a342a83036c3acabb57520c61d56a166 | d029387ac07274968616cb5910fef3396601b0bd | /APL2.1/TP07/exo1/Moto.java | 8d13c154a2f6b771a3148b94b7402bdfaca4160d | [] | no_license | vbaron42/Transfert | 54ac130d1094ff215166f7887888992a01de179c | 5de585c6c3e05d2128f53b56682ad7fc48210392 | refs/heads/master | 2020-05-03T15:22:22.176629 | 2019-03-31T15:01:28 | 2019-03-31T15:01:28 | 178,702,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | public class Moto extends Vehicule {
@Override
public String sorte() {
return("Moto");
}
public int nbRoues() {
return(2);
}
}
| [
"[email protected]"
] | |
bd524e6662458b0e3e816e4b4bfd616bc46525ab | 3dd022cec8db7537273d511198d43527ad43170c | /src/main/java/resourceater/model/resource/offheap/CreateOffHeapResourceRequest.java | d9d7fdf66735219a113d50fea52f54f3723d63a7 | [] | no_license | jonatan-ivanov/resourceater | 5713cb7a67217f4de2a31406d994620bdebdee0c | eb7de196ca23627fab0ba086bab0f2c40330deab | refs/heads/main | 2023-08-01T08:45:41.400156 | 2023-07-18T03:15:15 | 2023-07-18T03:15:15 | 179,780,173 | 12 | 2 | null | 2022-10-26T06:28:48 | 2019-04-06T02:33:13 | Java | UTF-8 | Java | false | false | 258 | java | package resourceater.model.resource.offheap;
import java.time.Duration;
import resourceater.model.resource.CreateRequest;
/**
* @author Jonatan Ivanov
*/
public record CreateOffHeapResourceRequest(String size, Duration ttl) implements CreateRequest {
}
| [
"[email protected]"
] | |
ddf69d6cfdd90f51a8a86ecd4fbe6cf61fe96b3e | 7f5beb2fdc09edff977005f3f069ac9dee8e15d7 | /DistinctSubsequencesDP.java | aac9ce9d1a894c06ae98eb41d94f4f7e54621c62 | [] | no_license | breezedu/LeetCode2012 | 1a759a8402fd50b3d32aca301e875a91f5095542 | 2a04b2b52f0576c44a5538a51ed04a0c6b5032b9 | refs/heads/master | 2021-01-01T06:38:42.451967 | 2017-10-05T12:48:42 | 2017-10-05T12:48:42 | 16,752,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,276 | java | package leetCode2012;
import java.util.Scanner;
/******************
* Given a string S and a string T, count the number of distinct subsequences of T in S.
* A subsequence of a string is a new string which is formed from the original string
* by deleting some (can be none) of the characters without disturbing
* the relative positions of the remaining characters.
* (ie, "ACE" is a subsequence of "ABCDE" while "AEC" is not).
*
* Here is an example:
* S = "rabbbit", T = "rabbit"
* Return 3.
*
* @author Frog
* Time Limit Exceeded ==!
*/
public class DistinctSubsequencesDP {
public static void main(String[] args){
System.out.println("This is Distinct Subsequences DP program.");
//1st, ask user to input the original string and the target string;
System.out.println("Please input the original and target strings:");
Scanner input = new Scanner(System.in);
System.out.print("original string: ");
String oriStr = input.next();
System.out.print("target string: ");
String target = input.next();
input.close();
//2nd, calculate the distinct subsequences:
Stopwatch timmer = new Stopwatch();
int dist = numDistinct(oriStr, target);
//printout the result
System.out.println("There are " + dist + " distinct subsequences.");
System.out.println("The time used is: " + timmer.elapsedTime());
}//end main()
/**********
* string and substring questions could always be solved by DP, :)
* matrix(i, j) stand for the number of subsequences of target(0, i) in oriStr(0, j).
* If target.charAt(i) == oriStr.charAt(j), matrix(i, j) = matrix(i-1, j-1) + matrix(i-1,j);
* Otherwise, matrix(i, j) = matrix(i-1,j).
*
* @param oriStr
* @param target
* @return
*/
private static int numDistinct(String oriStr, String target) {
// TODO calculate the num of distinct target subsequences in the original string;
if(target.length() > oriStr.length()) return 0;
int[][] matrix = new int[oriStr.length() + 1][target.length() + 1];
for (int i = 0; i < oriStr.length(); i++)
matrix[i][0] = 1;
/**********
* matrix(i, j) stand for the number of subsequences of target(0, i) in oriStr(0, j).
* If target.charAt(i) == oriStr.charAt(j),
* matrix(i, j) = matrix(i-1, j-1) + matrix(i-1,j);
*
* Otherwise, matrix(i, j) = matrix(i-1,j).
*/
for (int i = 1; i <= oriStr.length(); i++) {
for (int j = 1; j <= target.length(); j++) {
if (oriStr.charAt(i-1) == target.charAt(j-1)) {
matrix[i][j] = matrix[i-1][j] + matrix[i-1][j-1];
} else {
matrix[i][j] = matrix[i-1][j];
} //end if-else conditions;
}//end for j<=target.length loop;
}//end for i<= oriStr.length loop;
printMatrix(matrix);
return matrix[oriStr.length()][target.length()];
}//end of numDistinct() method;
private static void printMatrix(int[][] matrix) {
// TODO Printout a matrix
if(matrix==null) return;
int row = matrix.length;
int col = matrix[0].length;
for(int i=0; i<row; i++){
for(int j=0; j<col; j++){
System.out.print(" " + matrix[i][j]);
}
System.out.println();
}
System.out.println();
}//end of printMatrix() method;
}//end of everything in DistinctSubsequences class
| [
"[email protected]"
] | |
f12c4d687530c87fbebcbecf50d60fd9496a2b3b | 6346188d452745223e0fccd6aa68c9f08e77299c | /FRC/2018/Stealth2018/autoCommands/Position3Path1_2.java | 20b2db179ef158d060ac8f90dfa37c8d442b8b37 | [] | no_license | JimWright4089/FIRSTWorkshops | 6f0fd61095974414fe3cba64e744e3a52c4949a0 | 12564ee58ecc0abe3a4dbc1dceba915e74f8cfb2 | refs/heads/master | 2023-01-29T05:02:25.502459 | 2023-01-12T18:19:31 | 2023-01-12T18:19:31 | 103,087,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,775 | java | // RobotBuilder Version: 2.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.
package org.usfirst.frc4089.Stealth2018.autoCommands;
import org.usfirst.frc4089.Stealth2018.Robot;
import org.usfirst.frc4089.Stealth2018.RobotMap;
import org.usfirst.frc4089.Stealth2018.MPPaths.*;
import org.usfirst.frc4089.Stealth2018.commands.AutoFindCube;
import org.usfirst.frc4089.Stealth2018.commands.DrivePathAction;
import org.usfirst.frc4089.Stealth2018.commands.HugBlock;
import org.usfirst.frc4089.Stealth2018.commands.LowerMainToBottom;
import org.usfirst.frc4089.Stealth2018.commands.LowerPicker;
import org.usfirst.frc4089.Stealth2018.commands.RaiseMainToTop;
import org.usfirst.frc4089.Stealth2018.commands.RejectBlock;
import org.usfirst.frc4089.Stealth2018.commands.SetAutoFinished;
import org.usfirst.frc4089.Stealth2018.commands.WaitTime;
import org.usfirst.frc4089.Stealth2018.subsystems.Picker;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.*;
/**
*
*/
public class Position3Path1_2 extends CommandGroup {
Path retracePath;
public Position3Path1_2() {
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
System.out.println("Position three Source: Commands.PositionThree");
//hug block
addSequential(new HugBlock());
//lower picker
addSequential(new LowerPicker());
//raise block to top
addParallel(new RaiseMainToTop());
//get game data
String gameData = DriverStation.getInstance().getGameSpecificMessage();
int counter = 0;
while ((gameData == "" || gameData == null || gameData.length() != 3) && counter < 250) {
gameData = DriverStation.getInstance().getGameSpecificMessage();
counter ++;
}
//figure out where to go
boolean left = true;
if(gameData.length()>1)
{
if('R'==gameData.charAt(0))
{
left = false;
}
}
if(left)
{
//go to where we need to go
addSequential(new DrivePathAction(new Red31Path60InPerSec()));
System.out.println("Left");
}
else
{
//go to where we need to go
addSequential(new DrivePathAction(new Red32Path60InPerSec()));
System.out.println("Right");
}
//let go of block
addSequential(new RejectBlock());
Robot.drive.DriveRobot(-0.3, 0);
addSequential(new WaitTime(500));
addSequential(new LowerMainToBottom());
addSequential(new AutoFindCube());
addSequential(new HugBlock());
addSequential(new RaiseMainToTop());
addSequential(new DrivePathAction(Robot.path));
Robot.drive.DriveRobot(0.3, 0);
addSequential(new WaitTime(500));
addSequential(new RejectBlock());
addSequential(new SetAutoFinished());
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return RobotMap.isAutoFinished;
}
// Called once after isFinished returns true
@Override
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
end();
}
}
| [
"[email protected]"
] | |
6d21bcaa42eec875593ecc0a685a490911a62b8c | 7ae75d33b16977e9baa1644ebf8f95a1c19af5db | /xxWork/app/src/main/java/com/shengxi/xxwork/network/api/LOLNewsService.java | 3393d2d16d889e16f2e09c10b13e9049229bc6d6 | [] | no_license | ShengxizzZ/NewsWork | c27b9bd152c1c1644e87c8c43d1759e9afddca04 | 85616fcbde02f7814cd34346ba2f684458f1c901 | refs/heads/master | 2020-04-29T22:07:57.474257 | 2019-03-21T05:53:25 | 2019-03-21T05:53:25 | 176,436,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.shengxi.xxwork.network.api;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import rx.Observable;
public interface LOLNewsService {
@GET("lua/lol_news/recommend?cid=12&areaid=24&reset=false&direction=0&plat=android&version=9854")
Observable<ResponseBody> getLolNews();
}
| [
"[email protected]"
] | |
f1435adfeb924ba8368395a212c4aa8dddc07328 | 5e665a179ee1b6dc8c9edc5df9e44775dd4adc04 | /src/main/java/com/util/Page.java | 329e111b9d18f31d316b6a812d9972d13632776f | [] | no_license | ffreeway233/aya | 306bfa5f2449c908613899fc93bae2bf8b104519 | 4689d6efccc4bc5d0ccd1541bcf5de4eb435e078 | refs/heads/master | 2020-04-29T21:35:19.118234 | 2019-03-23T03:03:49 | 2019-03-23T03:03:49 | 176,417,601 | 1 | 1 | null | 2019-03-20T08:59:58 | 2019-03-19T03:40:30 | JavaScript | UTF-8 | Java | false | false | 1,986 | java | package com.util;
public class Page {
private int pageIndex = 1;// 当前页
private int pageCount = 15;// 每页条数
private int totalCount = 0; // 总记录数
private int totalPage = 1; // 总页数
// 显示的页码
private int startPage;
private int endPage;
/**
* 开始记录数
*
* @return
*/
public int getStart() {
return (pageIndex - 1) * pageCount;
}
/**
* 结束记录数
*
* @return
*/
public int getEnd() {
return pageCount;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getPageIndex() {
return pageIndex;
}
public void setPageIndex(int pageIndex) {
if (pageIndex > 0)
this.pageIndex = pageIndex;
/*
* if(pageIndex>totalPage){ pageIndex=totalPage; }
*/
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
if (totalCount > 0) {
this.totalCount = totalCount;
setTotalPage();
}
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public void setTotalPage() {
if (totalCount % pageCount == 0)
this.totalPage = totalCount / pageCount;
else
this.totalPage = totalCount / pageCount + 1;
}
public int getStartPage() {
return startPage;
}
public void setStartPage(int startPage) {
this.startPage = startPage;
}
public int getEndPage() {
return endPage;
}
public void setEndPage(int endPage) {
this.endPage = endPage;
}
public void setShowPage(int pageIndex, int totalCount) {
setTotalCount(totalCount);
setTotalPage();
// 显示的页码
if (totalPage <= 5) {
startPage = 1;
endPage = totalPage;
} else {
startPage = pageIndex - 2;
endPage = pageIndex + 2;
if (startPage < 1) {
startPage = 1;
endPage = 5;
}
if (endPage > totalPage) {
endPage = totalPage;
startPage = totalPage - 4;
}
}
}
}
| [
"[email protected]"
] | |
f2b71e7eff3c98a567983a5bb57d5fffb8e827bc | 00c1d242bf4604e0a3fe07d49541b75bdcc339e6 | /lab2/VNull.java | 5d1ac56e9c6c35ac593b26f7945c6b9b325d0b09 | [] | no_license | Jesperrask/plt-chalmers | e777820d1483158bb2146cb2f3fc3c007ec4da6a | 8748e71f556bdfa4031bcc0c3660b892c4e36b42 | refs/heads/master | 2021-06-11T21:25:14.218460 | 2017-01-10T23:33:03 | 2017-01-10T23:33:03 | 126,058,367 | 0 | 1 | null | 2018-03-20T17:39:00 | 2018-03-20T17:39:00 | null | UTF-8 | Java | false | false | 110 | java | public class VNull extends Value {
public boolean equals(Object o) {
return (o instanceof VNull);
}
}
| [
"[email protected]"
] | |
dadbd57c36b9152e5740e64a4028061b1eb871c4 | 3800cd99fdb7d827b471d2541fa69e74eaa9e6e8 | /src/main/java/jb/dao/impl/DiveStoreAddressDaoImpl.java | f7513a113a79810dd91256642d5262f967af61e4 | [] | no_license | huanganrang/dive | 7183929b807aa3fb3928e8cb8639352f7315797c | 07e64e38510fb25bd901cb0ad0a17f71a6732369 | refs/heads/master | 2020-04-06T06:51:40.546561 | 2016-07-09T17:09:11 | 2016-07-09T17:09:11 | 38,625,923 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package jb.dao.impl;
import jb.dao.DiveStoreAddressDaoI;
import jb.model.TdiveStoreAddress;
import org.springframework.stereotype.Repository;
@Repository
public class DiveStoreAddressDaoImpl extends BaseDaoImpl<TdiveStoreAddress> implements DiveStoreAddressDaoI {
}
| [
"[email protected]"
] | |
c31aa9ddf216bdf9b561c1d51d05edef780f0979 | 854e6bad74000e934a3eca8ca9cd72666c8a327a | /src/com/demo/controller/UpdateinfoServlet.java | a749a3805c8b5657c6e92d49f49b2d33c5f88387 | [] | no_license | little-swallow/Demo | 042389a17eb41a4257e16f3a2d37d9af89ea4f2b | c69972239b566f6c4031aaeb580b7ab18cbc4094 | refs/heads/master | 2021-05-04T17:09:38.595770 | 2018-02-18T12:54:50 | 2018-02-18T12:54:50 | 120,265,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,236 | java | package com.demo.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.demo.bean.UserBean;
import com.demo.dao.UserDao;
/**
* Servlet implementation class UpdateinfoServlet
*/
@WebServlet("/UpdateinfoServlet")
public class UpdateinfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public UpdateinfoServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
HttpSession session = request.getSession();
int cid = (int) session.getAttribute("Userid");
String updatename = request.getParameter("nameinfo");
String upadtepass = request.getParameter("passinfo");
String updateemail = request.getParameter("emailinfo");
String updatephone = request.getParameter("phoneinfo");
UserBean userBean = new UserBean();
userBean.setCid(cid);
userBean.setName(updatename);
userBean.setPwd(upadtepass);
userBean.setEmail(updateemail);
userBean.setPhone(updatephone);
session.setAttribute("Userinfo", userBean);
UserDao userDao = new UserDao();
boolean flag = false;
try {
flag = userDao.updateuserinfo(userBean);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(flag) {
response.sendRedirect("SelectmainServlet");
}else {
response.sendRedirect("../../../view/selfinfo.jsp");
}
}
}
| [
"[email protected]"
] | |
f48e191c8658b27a3c2c58e4ca41eaa239c06659 | 429d845b6e9289d36eb857f3ba45a946f5171c46 | /GCD of three numbers using functions/Main.java | 8f78a9db2272225246c29d7ff8962e1045c3f721 | [] | no_license | ABHISYADAV/Playground | f0aedad82fd64edab6da55a65400ce5b9f3ff0c8 | c7cf2f55bb141f758f850868d935c81cad78a2c1 | refs/heads/master | 2020-04-26T20:07:36.274844 | 2019-06-14T18:40:05 | 2019-06-14T18:40:05 | 173,799,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | import java.util.Scanner;
class Main{
public static void main (String[] args){
// Type your code here
Scanner in = new Scanner(System.in);
int num1 = in.nextInt();
int num2 = in.nextInt();
int num3 = in.nextInt();
int gcd1=find_gcd(num1,num2);
System.out.println(find_gcd(gcd1,num3));
}
private static int find_gcd(int a, int b) {
// TODO Auto-generated method stub
if (b == 0)
return a;
else
return find_gcd(b, a % b);
}
} | [
"[email protected]"
] | |
acdf0b2d0a35238e64ce78c8c728301de87b22ac | a304a6f1f87d47d3d788307e07a2b451388fe490 | /src/main/java/ch/groovlet/model/resource/SongResource.java | bfc1d316388d17b8e863503b7e034bfc50d0ab2e | [] | no_license | xliquidzz/Groovlet | d6f4e5c9f741762f09decab59739000584a59f5d | 1ad0f5a5efb9d55101aeef972bf0edfa7c403942 | refs/heads/master | 2020-12-24T11:52:32.965921 | 2015-01-31T21:58:37 | 2015-01-31T21:58:37 | 27,779,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,644 | java | package ch.groovlet.model.resource;
import ch.groovlet.model.App;
import ch.groovlet.model.dao.SongDAO;
import ch.groovlet.model.representation.Song;
import ch.groovlet.model.service.SongService;
import org.skife.jdbi.v2.DBI;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/song")
public class SongResource {
private final SongService songService;
public SongResource() {
songService = App.getService(SongService.class);
}
@GET
public Response readAllSongs() {
List<Song> songs = songService.readAll();
return Response.ok(songs).build();
}
@POST
public Response createSong(final Song song) throws URISyntaxException {
final long newSongId = songService.create(song);
return Response.created(new URI(String.valueOf(newSongId))).build();
}
@GET
@Path("/{id}")
public Response readSong(@PathParam("id") final long id) {
final Song song = songService.readById(id);
if (song == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
return Response.ok(song).build();
}
@DELETE
@Path("/{id}")
public Response deleteSong(@PathParam("id") final long id) {
if (songService.readById(id) == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
songService.deleteById(id);
return Response.noContent().build();
}
}
| [
"[email protected]"
] | |
f02990f9093c2381ac9769a68a26cc6bd951e84c | 3f4ff70b478da48afc3eb13cfe74b2821797395b | /app/src/test/java/com/example/castdemo/ExampleUnitTest.java | e7c046b61d5f909e304ea9427f374f7acd681c8b | [] | no_license | EvanZch/CastDemo | d6df0d3a192dadcbb9d45fda705bff4eda07fd9d | 2e70daa50aba8f4b3d764652068592b9b8657d27 | refs/heads/main | 2023-01-04T13:22:39.926326 | 2020-10-22T08:44:06 | 2020-10-22T08:44:06 | 306,275,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.example.castdemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
f283743ebde8f0a508beb24ce7fa25ee3018ec18 | 398b791d7b90a7b0bb63c6cb1b3c5dbcd481ffe4 | /src_win/org/omg/Dynamic/Parameter.java | 75705aacaba31747dc18dd4a748b8992d9ca8400 | [] | no_license | wfb0902/openjdk1.8 | 78fd0e902c0400d0ed4010def1233959471e83a8 | 1f2cbef22484b47efd8ec9c18084cbf5e176eeb1 | refs/heads/master | 2020-06-05T15:49:47.729186 | 2019-06-19T02:52:12 | 2019-06-19T02:52:12 | 189,914,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package org.omg.Dynamic;
/**
* org/omg/Dynamic/Parameter.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/cygwin64/tmp/openjdk-jdk8u-windows-x64-hotspot/workspace/build/src/corba/src/share/classes/org/omg/PortableInterceptor/Interceptors.idl
* Monday, June 3, 2019 9:12:52 PM UTC
*/
public final class Parameter implements org.omg.CORBA.portable.IDLEntity
{
public org.omg.CORBA.Any argument = null;
public org.omg.CORBA.ParameterMode mode = null;
public Parameter ()
{
} // ctor
public Parameter (org.omg.CORBA.Any _argument, org.omg.CORBA.ParameterMode _mode)
{
argument = _argument;
mode = _mode;
} // ctor
} // class Parameter
| [
"[email protected]"
] | |
b33ad8d233daaa09f4a6af31b57b8301b974a89c | e0618cc61097baa4862dd97edac233e2430bc48b | /src/main/java/com/pavlova/service/UniversityClassServiceImpl.java | 1be316c51ed0dae704b9370348d7a72ccd2a65b9 | [] | no_license | PavlovaMargarita/university | 4354be7129142c32694626e0343c61428561fc21 | 901790d7d2b6f60af4b55e1d15a24d44d725660e | refs/heads/master | 2020-04-19T08:46:35.759411 | 2019-01-29T15:07:00 | 2019-01-29T15:07:00 | 168,088,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,060 | java | package com.pavlova.service;
import com.pavlova.dto.ClassStudentGradeDto;
import com.pavlova.dto.UniversityClassDto;
import com.pavlova.entity.ClassStudentGradeEntity;
import com.pavlova.entity.StudentEntity;
import com.pavlova.entity.UniversityClassEntity;
import com.pavlova.repository.StudentRepository;
import com.pavlova.repository.UniversityClassRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import static com.pavlova.entity.UniversityClassEntity.aUniversityClassEntity;
@Service
public class UniversityClassServiceImpl implements UniversityClassService {
private StudentRepository studentRepository;
private UniversityClassRepository universityClassRepository;
@Autowired
public UniversityClassServiceImpl(StudentRepository studentRepository,
UniversityClassRepository universityClassRepository) {
this.studentRepository = studentRepository;
this.universityClassRepository = universityClassRepository;
}
@Override
public void createClass(UniversityClassDto universityClassDto) {
final UniversityClassEntity universityClassEntity = aUniversityClassEntity()
.withName(universityClassDto.getName())
.build();
universityClassRepository.save(universityClassEntity);
}
@Override
public void updateClass(Long classId, UniversityClassDto universityClassDto) {
UniversityClassEntity existingClassEntity = verifyClassExists(classId);
final UniversityClassEntity universityClassEntity = aUniversityClassEntity()
.withId(classId)
.withName(universityClassDto.getName())
.withClassGradeEntityList(existingClassEntity.getClassStudentGradeEntityList())
.build();
universityClassRepository.save(universityClassEntity);
}
@Override
public void deleteClass(Long classId) {
verifyClassExists(classId);
universityClassRepository.delete(classId);
}
@Override
public void assignStudentToClass(Long classId, ClassStudentGradeDto classStudentGradeDto) {
UniversityClassEntity universityClassEntity = verifyClassExists(classId);
StudentEntity studentEntity = verifyStudentExist(classStudentGradeDto.getStudentId());
ClassStudentGradeEntity classStudentGradeEntity = ClassStudentGradeEntity.aClassStudentGradeEntity()
.withUniversityClassEntity(universityClassEntity)
.withStudentEntity(studentEntity)
.withGrade(classStudentGradeDto.getGrade())
.build();
universityClassEntity.getClassStudentGradeEntityList().add(classStudentGradeEntity);
universityClassRepository.save(universityClassEntity);
}
@Override
public void unassignStudentFromClass(Long classId, Long studentId) {
UniversityClassEntity universityClassEntity = verifyClassExists(classId);
List<ClassStudentGradeEntity> classes = universityClassEntity.getClassStudentGradeEntityList();
for (ClassStudentGradeEntity classEntity : classes) {
if(classEntity.getStudentEntity().getId().equals(studentId)) {
classes.remove(classEntity);
break;
}
}
universityClassRepository.save(universityClassEntity);
}
private StudentEntity verifyStudentExist(Long studentId) {
StudentEntity studentEntity = studentRepository.findOne(studentId);
if(studentEntity == null) {
throw new UnsupportedOperationException("Student not found");
}
return studentEntity;
}
private UniversityClassEntity verifyClassExists(Long classId) {
UniversityClassEntity universityClassEntity = universityClassRepository.findOne(classId);
if(universityClassEntity == null) {
throw new UnsupportedOperationException("University class not found");
}
return universityClassEntity;
}
}
| [
"[email protected]"
] | |
edbf9b5f9ee1dd370cb0db0750c5ab7749c95696 | 53ca3e236c717863d9eb36614d6041af22951b1d | /src/main/java/com/springframework/samples/madaja/web/AlquilerValidator.java | 518034591c12ffba1c02405b927db98b4c2b6cb3 | [] | no_license | anacatcam/dp1-2020-g1-05 | 2ced09664d3c708414c866ce0aee1756119e31f6 | 77eec15aca318c8e718278bd60051b9f04e7be91 | refs/heads/master | 2023-02-28T17:35:23.982780 | 2021-02-09T22:52:52 | 2021-02-09T22:52:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,771 | java | package com.springframework.samples.madaja.web;
import java.time.LocalDate;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import com.springframework.samples.madaja.model.Alquiler;
public class AlquilerValidator implements Validator{
@Override
public boolean supports(Class<?> clazz) {
// TODO Auto-generated method stub
return Alquiler.class.isAssignableFrom(clazz);
}
@Override
public void validate(Object target, Errors errors) {
// TODO Auto-generated method stub
Alquiler alquiler = (Alquiler) target;
if(alquiler.getFechaFin() == null) {
errors.rejectValue("fechaFin", "fecha incorrecta: yyyy-mm-dd",
"La fecha de finalización no puede estar vacía");
}
if(alquiler.getFechaFin().isBefore(alquiler.getFechaInicio())) {
errors.rejectValue("fechaFin", "fecha incorrecta: yyyy-mm-dd",
"La fecha de finalización no puede ser anterior a la fecha de inicio");
}
if(alquiler.getFechaFin().isEqual(alquiler.getFechaInicio())) {
errors.rejectValue("fechaFin", "fecha incorrecta: yyyy-mm-dd",
"La fecha de finalización no puede ser la misma que la fecha de inicio");
}
if(alquiler.getFechaInicio() == null) {
errors.rejectValue("fechaInicio", "fecha incorrecta: yyyy-mm-dd",
"La fecha de inicio no puede estar vacía");
}
if(alquiler.getFechaInicio().isAfter(alquiler.getFechaFin())) {
errors.rejectValue("fechaInicio", "fecha incorrecta: yyyy-mm-dd",
"La fecha de inicio no puede ser posterior a la fecha de finalización");
}
if(alquiler.getFechaInicio().isBefore(LocalDate.now())) {
errors.rejectValue("fechaInicio", "fecha incorrecta: yyyy-mm-dd",
"La fecha de inicio no puede ser anterior a la fecha de hoy");
}
}
}
| [
"[email protected]"
] | |
19f47e0a02ea6a134603f18a9c4c25508a2eae77 | 1d796b16f78d3682687adcc1265204e5686de105 | /src/test/java/com/mischenkov/controller/BaskedControllerTest.java | 2284296dffa2122e282f173ea7bb691a998e8823 | [] | no_license | oleg-mischenkov/final_project | 1934b6506ea2830cd9cb4985de8993b684ea7df9 | f77de40e962f6695aa02bd2de056420f8ba3a885 | refs/heads/main | 2023-01-01T10:48:11.814347 | 2020-10-20T01:13:54 | 2020-10-20T01:13:54 | 305,129,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package com.mischenkov.controller;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class BaskedControllerTest {
public BaskedController controller;
public HttpServletRequest request;
public HttpServletResponse response;
@Before
public void initController() {
controller = Mockito.mock(BaskedController.class);
request = Mockito.mock(HttpServletRequest.class);
response = Mockito.mock(HttpServletResponse.class);
}
@Test
public void doPost() throws ServletException, IOException {
controller.doPost(request, response);
Assert.assertNotNull(controller);
}
@Test
public void doGet() throws ServletException, IOException {
controller.doGet(request, response);
Assert.assertNotNull(controller);
}
} | [
"[email protected]"
] | |
937a5ae107575f1a2a44fb2acb5c638dde28742b | 6879989af6cec7dd6b9d3228b1cfaaa35a2090aa | /SoftDev1/11/Blatt11_VierGewinnt/VierGewinnt.java | d4a85c49967b54b490a11e085ae7abb34a59e37c | [] | no_license | Danzenzo/UniHH | dd991c35b4ad0a0d50ebf8412f9972c620f0ca26 | 54120388aa701487a96b054e3dab97e415fd4b85 | refs/heads/master | 2020-12-24T01:05:31.218551 | 2020-02-18T17:10:24 | 2020-02-18T17:10:24 | 237,331,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,079 | java | /**
* In dieser Klasse ist die Spiellogik von "Vier gewinnt" realisiert.
*
* Zwei Spieler legen abwechselnd einen Spielstein in einer freien Spalte ab, bis ein Spieler vier
* Steine in einer Reihe hat oder das Spielfeld voll ist.
*
* @author Daniel
* @version 2015
*/
class VierGewinnt
{
private final Spielfeld _spielfeld;
private final SpielfeldAnalyse _analyse;
private int _spieler;
private boolean _spielZuEnde;
/**
* Erzeugt ein neues Vier-Gewinnt-Spiel mit einem leeren Spielfeld. Spieler 1 ist als erster
* dran, und das Spiel ist noch nicht zu Ende.
*/
public VierGewinnt()
{
_spielfeld = new ArraySpielfeld();
_analyse = new SpielfeldAnalyse(_spielfeld);
_spieler = 1;
_spielZuEnde = false;
}
/**
* Gibt an, welcher Spieler gerade dran ist oder gewonnen hat.
*
* @return 1 (Spieler 1) oder 2 (Spieler 2) oder 0 (Spiel ist unentschieden ausgegangen)
*/
public int gibAktuellenSpieler()
{
return _spieler;
}
/**
* Wechselt den aktuellen Spieler von 1 zu 2 und umgekehrt.
*/
private void wechsleSpieler()
{
_spieler = 3 - _spieler;
}
/**
* Gibt an, ob das Spiel zu Ende ist. Falls es zu Ende ist, liefert gibAktuellenSpieler() den
* Gewinner.
*/
public boolean istSpielZuEnde()
{
return _spielZuEnde;
}
/**
* Gibt die letzte gefundene Vierer-Kombination.
*/
public Kombination gibVierer()
{
return _analyse.gibVierer();
}
/**
* Gibt den Besitzer der angegebenen Position auf dem Spielfeld.
*
* @param zeile
* vertikale Position
* @param spalte
* horizontale Position
* @return 0 (unbesetzt), 1 (Spieler 1), 2 (Spieler 2)
*/
public int gibBesitzer(int zeile, int spalte)
{
return _spielfeld.gibBesitzer(zeile, spalte);
}
/**
* Ist die angegebene Spalte voll?
*/
public boolean istSpalteVoll(int spalte)
{
return _spielfeld.istSpalteVoll(spalte);
}
/**
* Legt einen Spielstein in einer Spalte ab. Anschliessend wird geprueft, ob der aktuelle
* Spieler gewonnen hat, oder ob das Spielfeld voll ist. Ansonsten wird der aktuelle Spieler
* gewechselt.
*
* @param spalte
* horizontale Position
*/
public void legeSpielsteinAb(int spalte)
{
if (!istSpielZuEnde() && !istSpalteVoll(spalte))
{
_spielfeld.legeSpielsteinAb(spalte, _spieler);
if (_analyse.hatSpielerGewonnen(_spieler))
{
_spielZuEnde = true;
}
else if (_spielfeld.istSpielfeldVoll())
{
_spielZuEnde = true;
_spieler = 0;
}
else
{
wechsleSpieler();
}
}
}
}
| [
"[email protected]"
] | |
b1c243ece640dcbeb853f3038c46d13af28e32d9 | 4d25caa54ef3cc5ea6288585e4612268a8815f75 | /src/br/com/guikar/netbeans/ufc/poo/ativlab/TestaSistema.java | 8d55cebca5811f11987ae276f13b4552e78aa0cf | [] | no_license | GUIKAR741/Codigos-Java | 51c2d3f948eae5e0ba9e72b433bd29d22ad09063 | d0bb51688e2bc9ae60a4bc7072cd0104c583ed92 | refs/heads/master | 2020-04-27T08:23:42.164910 | 2019-03-06T15:34:25 | 2019-03-06T15:34:25 | 174,169,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,283 | java | package br.com.guikar.netbeans.ufc.poo.ativlab;
import java.util.Scanner;
public class TestaSistema {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
String nome,telefone,frase,corFrase,corPlaca,dataEntrega;
float altura,largura;
System.out.print("Digite o nome do Cliente:");
nome=s.nextLine();
System.out.print("Digite o numero do Cliente:");
telefone=s.nextLine();
Cliente cliente=new Cliente(nome,telefone);
System.out.print("Digite a altura da Placa:");
altura=s.nextFloat();
System.out.print("Digite a largura da Placa:");
largura=s.nextFloat();
s.nextLine();
System.out.print("Digite a cor da Placa:branca ou cinza ");
corPlaca=s.nextLine();
System.out.print("Digite a frase da Placa:");
frase=s.nextLine();
System.out.print("Digite a cor da Frase:azul ou vermelho ou amarelo ou preto ou verde ");
corFrase=s.nextLine();
System.out.print("Digite a data de entrega da Placa:");
dataEntrega=s.nextLine();
Encomenda encomenda=new Encomenda(cliente,altura,largura,frase,corPlaca,corFrase,dataEntrega);
encomenda.gerarVia();
}
}
| [
"[email protected]"
] | |
aea153ea771a8d1d38a31a05239ac51539bd9e6f | 28139125f0afc23bef2a08b2ed76ce556ba5b58e | /app/src/main/java/com/minlu/fosterpig/util/GsonTools.java | 1bdf37f5d5536c76c6661605a3b331c5ba31a3c3 | [] | no_license | sfgjys/FosterPig | f39fddf2917cc5bdc141acc41efe3d802b6c511e | a8d2504b91cae29d68061111b3a33b2e5026c6e1 | refs/heads/master | 2020-06-27T06:55:19.797412 | 2017-03-02T02:23:02 | 2017-03-02T02:23:02 | 74,536,622 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | package com.minlu.fosterpig.util;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.util.List;
import java.util.Map;
public class GsonTools {
public GsonTools() {
}
public static String createGsonString(Object object) {
Gson gson = new Gson();
String gsonString = gson.toJson(object);
return gsonString;
}
public static <T> T changeGsonToBean(String gsonString, Class<T> cls) {
Gson gson = new Gson();
T t = gson.fromJson(gsonString, cls);
return t;
}
public static <T> List<T> changeGsonToList(String gsonString, Class<T> cls) {
Gson gson = new Gson();
List<T> list = gson.fromJson(gsonString, new TypeToken<List<T>>() {
}.getType());
return list;
}
public static <T> List<Map<String, T>> changeGsonToListMaps(
String gsonString) {
List<Map<String, T>> list = null;
Gson gson = new Gson();
list = gson.fromJson(gsonString, new TypeToken<List<Map<String, T>>>() {
}.getType());
return list;
}
public static <T> Map<String, T> changeGsonToMaps(String gsonString) {
Map<String, T> map = null;
Gson gson = new Gson();
map = gson.fromJson(gsonString, new TypeToken<Map<String, T>>() {
}.getType());
return map;
}
}
| [
"[email protected]"
] | |
9f1d85c0d83058f1b54dbe65b83e0f5eb9a6d46e | 70b7f2da605ac3d7d8e28c4057bf3125088e8ecf | /ArkaPOOB/src/aplicacion/BloqueAmarillo.java | f9f57100fd99dfc98640d6bca433d6e410980bb7 | [] | no_license | JuanCe11/ArkaPOOB | 178a20c532f236fb97a92c3b6a44dd722bbbf179 | b5986d06d88bf7aaf2cc12cf099184a8eddcedf3 | refs/heads/master | 2023-01-11T12:51:37.262405 | 2020-11-23T14:46:48 | 2020-11-23T14:46:48 | 202,813,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package aplicacion;
/**
* Al igual que los bloques rosados, son muy inusuales. Y otorgan una vida
* extra. Son destruidos con un solo golpe de la bola. Dan 300 puntos.
*
* @author Juan Sebastian Fr�sica y Juan Sebasti�n G�mez
*
*/
public class BloqueAmarillo extends Bloque {
/**
*
*/
private static final long serialVersionUID = 1L;
public BloqueAmarillo(int x, int y) {
super(x, y);
setImagen("recursos/BloqueAmarillo.png");
}
@Override
public int getPuntaje() {
int puntaje = 0;
if (!isVisible())
puntaje = 300;
return puntaje;
}
@Override
public void destruyase(ArkaPOOB juego, Bola bola) {
setVisible(false);
juego.añadirVida(bola.getJugador());
}
}
| [
"[email protected]"
] | |
8c77356bbb7f96801247eb03b7854f7bd3ea3e73 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-migrationhuborchestrator/src/main/java/com/amazonaws/services/migrationhuborchestrator/model/transform/DeleteWorkflowStepRequestProtocolMarshaller.java | 34a4856a7953e5d8b03d4defa68448905b4b9257 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 2,735 | java | /*
* Copyright 2018-2023 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.migrationhuborchestrator.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.migrationhuborchestrator.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DeleteWorkflowStepRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DeleteWorkflowStepRequestProtocolMarshaller implements Marshaller<Request<DeleteWorkflowStepRequest>, DeleteWorkflowStepRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON).requestUri("/workflowstep/{id}")
.httpMethodName(HttpMethodName.DELETE).hasExplicitPayloadMember(false).hasPayloadMembers(false).serviceName("AWSMigrationHubOrchestrator").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public DeleteWorkflowStepRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<DeleteWorkflowStepRequest> marshall(DeleteWorkflowStepRequest deleteWorkflowStepRequest) {
if (deleteWorkflowStepRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<DeleteWorkflowStepRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
deleteWorkflowStepRequest);
protocolMarshaller.startMarshalling();
DeleteWorkflowStepRequestMarshaller.getInstance().marshall(deleteWorkflowStepRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.