blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d82437c30dbc2278655da275c60c52b8f9e78c4f | b6f29a2c8b0674c62e953e60a3d55460b800e60e | /sample-common/src/main/java/me/sample/sys/domain/SysUserGroup.java | cbd037459507ea18423a73f3f26e2e2840832acf | [
"MIT"
] | permissive | jrchens/sample | 53436005a734b3492d590e453e2d5b3690ed7216 | 10c54f5eccc6d16f3e717c7b4be4c9284b7ffc77 | refs/heads/master | 2021-01-10T09:26:51.530460 | 2017-12-14T04:23:27 | 2017-12-14T04:23:27 | 46,535,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,554 | java | package me.sample.sys.domain;
import java.io.Serializable;
public class SysUserGroup implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7367746587216778639L;
private Integer id;
private String username;
private String groupname;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getGroupname() {
return groupname;
}
public void setGroupname(String groupname) {
this.groupname = groupname == null ? null : groupname.trim();
}
public SysUserGroup() {
super();
}
public SysUserGroup(String username, String groupname) {
super();
this.username = username;
this.groupname = groupname;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
SysUserGroup other = (SysUserGroup) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
&& (this.getGroupname() == null ? other.getGroupname() == null : this.getGroupname().equals(other.getGroupname()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
result = prime * result + ((getGroupname() == null) ? 0 : getGroupname().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", username=").append(username);
sb.append(", groupname=").append(groupname);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | [
"shengchen@promote.cache-dns.local"
] | shengchen@promote.cache-dns.local |
077c33a9da7030563a5c879190be0efdc66136e5 | ec54e2c177a52affe300369ee5265c0f6a12f4d7 | /src/java/cusc/mbean/DangkyNhaTuyenDung.java | dc47098b76bc0b91dcd0f494ed163a1edcac0533 | [] | no_license | giaotrinhjavaee/JobCenter | 906b092ab2d75ce8c17ce0807ec78ea01a40f9d0 | 0e1ee2b3b325057490368b9df61e4c0a117b8455 | refs/heads/master | 2021-01-10T11:21:24.873703 | 2016-04-02T09:46:05 | 2016-04-02T09:46:05 | 39,068,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,455 | java | package cusc.mbean;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class DangkyNhaTuyenDung {
private String email;
private String matkhau;
private String tencongty;
private String motacongty;
private String websitecongty;
public DangkyNhaTuyenDung() {
}
@PostConstruct
public void init() {
// initialization code
}
@PreDestroy
public void shutdown() {
// shutdown code
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getMatkhau() {
return matkhau;
}
public void setMatkhau(String matkhau) {
this.matkhau = matkhau;
}
public String getTencongty() {
return tencongty;
}
public void setTencongty(String tencongty) {
this.tencongty = tencongty;
}
public String getMotacongty() {
return motacongty;
}
public void setMotacongty(String motacongty) {
this.motacongty = motacongty;
}
public String getWebsitecongty() {
return websitecongty;
}
public void setWebsitecongty(String websitecongty) {
this.websitecongty = websitecongty;
}
}
| [
"Le Thi Minh Loan@minhloan"
] | Le Thi Minh Loan@minhloan |
484a84af346e0add6f20ebf64ba78f33fde3efa8 | 9e781ed9a2bc216197f85c2648ceea3e98f28397 | /java/src/main/java/com/java/model/strategy/behavior/fly/FlyBehavior.java | a82c5dd4bdde841c6fa8517b4a16af9617e6209f | [] | no_license | tom-QQQ/javaLearn | aee8d5d22a799e555018db9e6978eae89ebd93c1 | 10839b9dcea5d55d2812433d38d2d749e3c47bcf | refs/heads/master | 2022-07-07T00:45:29.633120 | 2021-06-28T01:00:38 | 2021-06-28T01:00:38 | 213,827,379 | 0 | 0 | null | 2022-06-17T02:34:52 | 2019-10-09T05:20:42 | Java | UTF-8 | Java | false | false | 186 | java | package com.java.model.strategy.behavior.fly;
/**
* @author Ning
* @date Create in 2019/3/20
*/
public interface FlyBehavior {
/**
* 飞的动作
*/
void fly();
}
| [
"kangning.qu@changhong.com"
] | kangning.qu@changhong.com |
53eb153881700e52275bfcead8d28355a9fe3f2d | 0eab5324c4a2326daf2372515d8487cdb62cb421 | /Wapp/app/src/main/java/com/example/wapp/RegisterActivity.java | 25e228ab286edd1fc41e34adb099d4fa8b379067 | [] | no_license | Raj-Mehta2012/ChitChat_ChattingApp | b15668b5782f32352af89b76c3a74434ccdb5c0f | 0dd867b2f2523327222a1c2e6dd3ee8e5a96dfa6 | refs/heads/master | 2022-11-09T00:41:35.192369 | 2020-06-26T08:50:29 | 2020-06-26T08:50:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,896 | java | package com.example.wapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.GenericTypeIndicator;
import com.rengwuxian.materialedittext.MaterialEditText;
import java.util.HashMap;
public class RegisterActivity extends AppCompatActivity {
MaterialEditText username,email,password;
Button btn_register;
FirebaseAuth auth;
DatabaseReference reference;
ProgressBar splashProgress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
Toolbar toolbar=findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Register");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
username=findViewById(R.id.username);
email=findViewById(R.id.email);
password=findViewById(R.id.password);
btn_register=findViewById(R.id.btn_register);
auth=FirebaseAuth.getInstance();
splashProgress=findViewById(R.id.splashProgress);
btn_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String txt_username=username.getText().toString();
String txt_email=email.getText().toString();
String txt_password=password.getText().toString();
playProgress();
if (TextUtils.isEmpty(txt_username)||TextUtils.isEmpty(txt_email)||TextUtils.isEmpty(txt_password)){
Toast.makeText(RegisterActivity.this,"All fields are required",Toast.LENGTH_SHORT).show();
} else if (txt_password.length()<6){
Toast.makeText(RegisterActivity.this,"Password must be 6 characters",Toast.LENGTH_SHORT).show();
} else {
register(txt_username,txt_email,txt_password);
}
}
});
}
private void register(final String username, String email, String password)
{
auth.createUserWithEmailAndPassword(email,password)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
FirebaseUser firebaseUser=auth.getCurrentUser();
assert firebaseUser != null;
String userid=firebaseUser.getUid();
reference= FirebaseDatabase.getInstance().getReference("Users").child(userid);
HashMap<String,String> hashMap=new HashMap<>();
hashMap.put("id",userid);
hashMap.put("username",username);
hashMap.put("imageURL", "default");
hashMap.put("status","offline");
hashMap.put("search",username.toLowerCase());
reference.setValue(hashMap).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Intent intent=new Intent(RegisterActivity.this,MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
}
});
} else {
Toast.makeText(RegisterActivity.this,"You can't register with this email or password",Toast.LENGTH_SHORT).show();
}
}
});
}
private void playProgress() {
ObjectAnimator.ofInt(splashProgress, "progress", 100)
.setDuration(8000)
.start();
}
}
| [
"61338379+Raj-Mehta2012@users.noreply.github.com"
] | 61338379+Raj-Mehta2012@users.noreply.github.com |
78a2c976fbd57bf67651daecb1aee1f27e871855 | 902cbae1f871f128a64e1b140fff23f72465ca0c | /java-algorithm/src/main/java/com/ethan/sort/RadixSortDemo.java | f752998416cc8562d12039b7dc2117dcfe7497fc | [
"Apache-2.0"
] | permissive | PhotonAlpha/spring-creed | 5f085e612fccd767baa68de7359f1ca53fcb111d | 64a08bc59ef1e21e47893ace707307bb7c529866 | refs/heads/master | 2023-06-23T02:03:34.214592 | 2023-05-13T12:05:29 | 2023-05-13T12:05:29 | 225,605,374 | 2 | 0 | Apache-2.0 | 2023-08-07T16:18:15 | 2019-12-03T11:38:37 | JavaScript | UTF-8 | Java | false | false | 6,141 | java | package com.ethan.sort;
import java.util.Arrays;
import java.util.Random;
/**
* @className: RadixSortDemo
* @author: Ethan
* @date: 8/7/2021
**/
public class RadixSortDemo {
public static void main(String[] args) {
// int[] arr = {53, 3, 542, 748, 14, 214};
int[] arr = new int[8000_000];
Random random = new Random();
for (int i = 0; i < arr.length; i++) {
arr[i] = random.nextInt(8000_000);
}
// System.out.println("排序前:" + Arrays.toString(arr));
long start = System.currentTimeMillis();
// radixSortDerive(arr);
radixSort(arr);
long end = System.currentTimeMillis();
System.out.println("耗费时间" + (end - start) + "ms");
// System.out.println(Arrays.toString(arr));
}
private static void radixSort(int[] arr) {
//1.先得到数组中最大的数的位数
int max = arr[0];
for (int i = 0; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
//得到最大数的位数
int maxLength = (max + "").length();
int[][] bucket = new int[10][arr.length];
//为了记录每个桶中实际存放了多少个数据,定义一个一维数组来记录各个桶每次放入的个数
int[] bucketElementCounts = new int[10];
for (int i = 0, n = 1; i < maxLength; i++, n *= 10) {
//第一轮(针对每个元素的个位进行排序处理)
for (int j = 0; j < arr.length; j++) {
// int digitOfElement = arr[j] / (int) Math.pow(10, i) % 10;
int digitOfElement = arr[j] / n % 10;
//放入到对应的桶中
bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];
bucketElementCounts[digitOfElement]++;
}
//按照桶的顺序,放入原来的数组
int index = 0;
//遍历每一个桶,并将桶中的数据放入到原数组
for (int k = 0; k < bucketElementCounts.length; k++) {
//如果桶中有数据,才放入到原数组
if (bucketElementCounts[k] != 0) {
for (int l = 0; l < bucketElementCounts[k]; l++) {
//取出元素放入到arr中
arr[index++] = bucket[k][l];
}
}
// 第一轮处理后,需要将每个bucketElementCounts[k] 置零
bucketElementCounts[k] = 0;
}
}
}
//基数排序法
private static void radixSortDerive(int[] arr) {
//第一轮(针对每个元素的个位进行排序处理)
// 定义一个二维数组,表示10个桶,每个桶就是一个一维数组
// 1. 二维数组包含10个1维数组
// 2. 为了防止放入数的时候,数据溢出,则每一个一维数组(桶),大小定为arr.length
/**3.基数排序是使用空间换时间的经典算法*/
int[][] bucket = new int[10][arr.length];
//为了记录每个桶中实际存放了多少个数据,定义一个一维数组来记录各个桶每次放入的个数
int[] bucketElementCounts = new int[10];
//第一轮(针对每个元素的个位进行排序处理)
for (int j = 0; j < arr.length; j++) {
int digitOfElement = arr[j] % 10;
//放入到对应的桶中
bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];
bucketElementCounts[digitOfElement]++;
}
//按照桶的顺序,放入原来的数组
int index = 0;
//遍历每一个桶,并将桶中的数据放入到原数组
for (int k = 0; k < bucketElementCounts.length; k++) {
//如果桶中有数据,才放入到原数组
if (bucketElementCounts[k] != 0) {
for (int l = 0; l < bucketElementCounts[k]; l++) {
//取出元素放入到arr中
arr[index++] = bucket[k][l];
}
}
// 第一轮处理后,需要将每个bucketElementCounts[k] 置零
bucketElementCounts[k] = 0;
}
//第二轮(针对每个元素的个位进行排序处理)
for (int j = 0; j < arr.length; j++) {
int digitOfElement = arr[j] / 10 % 10;
//放入到对应的桶中
bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];
bucketElementCounts[digitOfElement]++;
}
//按照桶的顺序,放入原来的数组
index = 0;
//遍历每一个桶,并将桶中的数据放入到原数组
for (int k = 0; k < bucketElementCounts.length; k++) {
//如果桶中有数据,才放入到原数组
if (bucketElementCounts[k] != 0) {
for (int l = 0; l < bucketElementCounts[k]; l++) {
//取出元素放入到arr中
arr[index++] = bucket[k][l];
}
}
bucketElementCounts[k] = 0;
}
//第三轮(针对每个元素的个位进行排序处理)
for (int j = 0; j < arr.length; j++) {
int digitOfElement = arr[j] / 100 % 10;
//放入到对应的桶中
bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];
bucketElementCounts[digitOfElement]++;
}
//按照桶的顺序,放入原来的数组
index = 0;
//遍历每一个桶,并将桶中的数据放入到原数组
for (int k = 0; k < bucketElementCounts.length; k++) {
//如果桶中有数据,才放入到原数组
if (bucketElementCounts[k] != 0) {
for (int l = 0; l < bucketElementCounts[k]; l++) {
//取出元素放入到arr中
arr[index++] = bucket[k][l];
}
}
bucketElementCounts[k] = 0;
}
}
}
| [
"ethan"
] | ethan |
4315d5a9dac7637000551e882315a3edc0e97b8e | 81038212f616419aebae9c96deb3c66a7c94590d | /app/src/main/java/com/nikolaevdev/weatherapp/model/pojo/Weather.java | 3201986bc25206915a33dc8b86989ad1e52b32e3 | [] | no_license | rkNiko/WeatherApp | b1926e619eda3099cc08bbc76cac3e23c984e3e7 | a799a0f4331c1d6741146c6d32e1138740e75d5c | refs/heads/master | 2020-06-20T16:53:41.908160 | 2019-07-16T14:46:50 | 2019-07-16T14:46:50 | 197,184,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,931 | java |
package com.nikolaevdev.weatherapp.model.pojo;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"main",
"description",
"icon"
})
public class Weather {
@JsonProperty("id")
private Integer id;
@JsonProperty("main")
private String main;
@JsonProperty("description")
private String description;
@JsonProperty("icon")
private String icon;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@JsonProperty("main")
public String getMain() {
return main;
}
@JsonProperty("main")
public void setMain(String main) {
this.main = main;
}
@JsonProperty("description")
public String getDescription() {
return description;
}
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
@JsonProperty("icon")
public String getIcon() {
return icon;
}
@JsonProperty("icon")
public void setIcon(String icon) {
this.icon = icon;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"kostenkoaleksander7@gmail.com"
] | kostenkoaleksander7@gmail.com |
5da023990b98343713301aa54186434e003140f2 | 14f6aefcadf94f0dbc8346b89810755910f6a9c9 | /_5/src/main/java/DatabasePostgreSql.java | 0a48a02c6a4ef7b365cec243fc92b6201c141010 | [] | no_license | MikolajNawojowski/projektowanie | 69b497dd2a447d54a09e5d0353b790e4b11020c7 | 0fbfc24c52eb4b5e0de7a9bcc695dd87179718cd | refs/heads/master | 2021-09-06T10:02:40.911182 | 2018-02-05T09:13:02 | 2018-02-05T09:13:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 947 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DatabasePostgreSql implements InterfaceDatabase {
private static DatabasePostgreSql instance = null;
public static DatabasePostgreSql getInstance() {
if (instance == null) {
instance = new DatabasePostgreSql();
}
return instance;
}
public static void main(String[] args) {
//getByKey(2);
//getOne("Mikolaj");
//insert("Rafal", 25);
//delete("Rafal");
//update("Agata", 35);
//getAll();
}
@Override
public Connection getDriverManager() {
Connection connection = null;
try {
connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "niemiecki3");
} catch (SQLException e) {
System.out.println(e);
}
return connection;
}
}
| [
"mikolaj.nawojowski@student.uj.edu.pl"
] | mikolaj.nawojowski@student.uj.edu.pl |
4c9b6354849c67d05cb2567edfd2956c889557f7 | a89c1aaad9e05338429942edad4dbbdc3f3aa563 | /src/noteFrame/TestFrame.java | 67172fc5700d478e1a22e11302bba3982e93eae8 | [] | no_license | shamanovskyi/ACO1 | 7f40cc246ae01850014f15ab1a72519f7c896a80 | 1717a4f671430133b81676793568ffe3c4beb725 | refs/heads/master | 2021-05-29T18:36:28.466712 | 2015-04-22T20:12:35 | 2015-04-22T20:12:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | package noteFrame;
public class TestFrame {
public static void main(String[] args) {
new MyFrame("Note");
}
}
| [
"some4day@gmail.com"
] | some4day@gmail.com |
95b797066d012a29717af59d6a44401473370a0b | f1efeb2876f4f4f3acf717af8feddf30f16976f1 | /persistence/src/main/java/com/stockatto/repository/user/UserRepository.java | 65791dc047d6e0077c838621d7bec5b8e42c91a9 | [] | no_license | haileypark-kr/stockatto-backend | 03f7123ae0ce2cc0a61dabe446b6742d2d6306c1 | ef2176575e02cce6cbd8375dead42807611a8a17 | refs/heads/master | 2023-08-09T22:38:43.177707 | 2021-09-16T12:49:45 | 2021-09-16T12:49:45 | 407,148,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package com.stockatto.repository.user;
import org.springframework.data.jpa.repository.JpaRepository;
import com.stockatto.model.user.User;
public interface UserRepository extends JpaRepository<User, Long> {
}
| [
"soohyun@Soohyuns-MacBookPro.local"
] | soohyun@Soohyuns-MacBookPro.local |
bac77f62f11df7937c98c760566979a906498a2c | 9acfab9d154da29f2f44e5ce9dcc39a2a1e2a170 | /openhealth/src/org/bn/annotations/ASN1Float.java | 301f9d41de976c3ef5801000b8b93231698cb541 | [] | no_license | joan38/openhealthsecured | 34bd0828c991897c92d7af4370fa208475a8ad94 | 2975560d74e412ba2bb2745b7081c7cce2903601 | refs/heads/master | 2020-05-17T23:56:39.591783 | 2015-03-16T10:32:03 | 2015-03-16T10:32:03 | 32,317,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | /*
* Copyright 2008 Santiago Carot Nemesio (sancane@gmail.com).
*/
package org.bn.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ASN1Float {
String name();
}
| [
"joan.goyeau@db5d540e-1c00-245f-e998-93d8dc787d26"
] | joan.goyeau@db5d540e-1c00-245f-e998-93d8dc787d26 |
7b240ac4b7bdbad9b791f26daeb7d2f1dd5bee86 | 662432df2c6a6080a1d3c8c166261273c93ee060 | /HoMED/HoMED-rws/src/java/ws/datamodel/UnassignFcmTokenReq.java | 1388677c41a2450361ab3e0e246daf4b2d5be3d1 | [] | no_license | jianyiee96/HoMED | 93dac6f1534171911f91bd200bc3b04bf6db6f7c | 539bab09df8ed0d566741fac3d7de539356ac94d | refs/heads/master | 2023-01-23T16:01:38.716276 | 2020-11-15T09:40:08 | 2020-11-15T09:40:08 | 294,517,792 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | /*
* Project Title: Home Team Medical Board
* Project Application: HoMED-rws
*/
package ws.datamodel;
/**
*
* @author Keith Lim <https://github.com/keithlim>
*/
public class UnassignFcmTokenReq {
private Long servicemanId;
public UnassignFcmTokenReq() {
}
public UnassignFcmTokenReq(Long servicemanId) {
this.servicemanId = servicemanId;
}
public Long getServicemanId() {
return servicemanId;
}
public void setServicemanId(Long servicemanId) {
this.servicemanId = servicemanId;
}
}
| [
"keithlck96@gmail.com"
] | keithlck96@gmail.com |
30c3fb8809d496845e0308cf39029f9a0c3e0289 | a47f5306c4795d85bf7100e646b26b614c32ea71 | /sphairas-libs/couchdb/src/org/thespheres/betula/couchdb/ui/CouchDBCredentialsController.java | e8dadf75c31585ddfe91dd4160895c23991d2982 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | sphairas/sphairas-desktop | 65aaa0cd1955f541d3edcaf79442e645724e891b | f47c8d4ea62c1fc2876c0ffa44e5925bfaebc316 | refs/heads/master | 2023-01-21T12:02:04.146623 | 2020-10-22T18:26:52 | 2020-10-22T18:26:52 | 243,803,115 | 2 | 1 | Apache-2.0 | 2022-12-06T00:34:25 | 2020-02-28T16:11:33 | Java | UTF-8 | Java | false | false | 2,629 | 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.thespheres.betula.couchdb.ui;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.JComponent;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
/**
*
* @author boris.heithecker
*/
public abstract class CouchDBCredentialsController extends OptionsPanelController {
private CouchDBCredentialsPanel panel;
protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed;
@Override
public final void update() {
getPanel().load();
changed = false;
}
@Override
public final void applyChanges() {
// SwingUtilities.invokeLater(() -> {
if (isChanged()) {
getPanel().store();
}
changed = false;
// });
}
@Override
public final void cancel() {
// need not do anything special, if no changes have been persisted yet
}
@Override
public final boolean isValid() {
return getPanel().valid();
}
@Override
public final boolean isChanged() {
return changed;
}
@Override
public HelpCtx getHelpCtx() {
return null; // new HelpCtx("...ID") if you have a help set
}
@Override
public JComponent getComponent(Lookup masterLookup) {
return getPanel();
}
private CouchDBCredentialsPanel getPanel() {
if (panel == null) {
panel = new CouchDBCredentialsPanel(this);
}
return panel;
}
final void changed() {
if (!changed) {
changed = true;
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
}
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
}
public abstract String loadCouchDBDatabase();
public abstract void storeCouchDBDatabase(String db);
public abstract String loadCouchDBUser();
public abstract void storeCouchDBUser(String user);
public abstract boolean hasStoredPassword();
public abstract void storeCouchDBPassword(char[] pw);
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l);
}
}
| [
"boris.heithecker@gmx.net"
] | boris.heithecker@gmx.net |
bf4bca340506c9cd4922e4965bc8b2bfb17c178e | 0708888b1ae0b9827d02afa113818ea07088b6cc | /v2/datastream-to-spanner/src/test/java/com/google/cloud/teleport/v2/templates/spanner/ProcessInformationSchemaTest.java | e9ec99e4abe8d8d8b116072758224a781e361c8a | [
"Apache-2.0"
] | permissive | Pio1006/DataflowTemplates | 93201954a5b4b5bd7804a5631c2f2a35d40cd971 | 7c054cec559d5df69451d98a825647a890b56ecf | refs/heads/master | 2023-07-12T03:17:21.596892 | 2021-06-24T11:41:15 | 2021-06-24T11:41:15 | 397,986,386 | 0 | 0 | Apache-2.0 | 2021-08-19T15:19:17 | 2021-08-19T15:16:27 | null | UTF-8 | Java | false | false | 5,240 | java | /*
* Copyright (C) 2021 Google 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 com.google.cloud.teleport.v2.templates.spanner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import com.google.cloud.teleport.v2.templates.spanner.ddl.Ddl;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.beam.sdk.io.gcp.spanner.SpannerConfig;
import org.junit.Test;
/**
* Unit tests for ProcessInformationSchema class.
*/
public class ProcessInformationSchemaTest {
static Ddl getTestDdl() {
/* Creates DDL with 2 tables with the same fields but with different primary key
* columns and their associated shadow tables.
*/
Ddl ddl = Ddl.builder()
.createTable("Users")
.column("first_name").string().max().endColumn()
.column("last_name").string().size(5).endColumn()
.column("age").int64().endColumn()
.column("bool_field").bool().endColumn()
.column("int64_field").int64().endColumn()
.column("float64_field").float64().endColumn()
.column("string_field").string().max().endColumn()
.column("bytes_field").bytes().max().endColumn()
.column("timestamp_field").timestamp().endColumn()
.column("date_field").date().endColumn()
.primaryKey().asc("first_name").desc("last_name")
.asc("age").asc("bool_field")
.asc("int64_field").asc("float64_field")
.asc("string_field").asc("bytes_field")
.asc("timestamp_field").asc("date_field").end()
.endTable()
.createTable("shadow_Users")
.column("first_name").string().max().endColumn()
.column("last_name").string().size(5).endColumn()
.column("age").int64().endColumn()
.column("bool_field").bool().endColumn()
.column("int64_field").int64().endColumn()
.column("float64_field").float64().endColumn()
.column("string_field").string().max().endColumn()
.column("bytes_field").bytes().max().endColumn()
.column("timestamp_field").timestamp().endColumn()
.column("date_field").date().endColumn()
.column("version").int64().endColumn()
.primaryKey().asc("first_name").desc("last_name")
.asc("age").asc("bool_field")
.asc("int64_field").asc("float64_field")
.asc("string_field").asc("bytes_field")
.asc("timestamp_field").asc("date_field").end()
.endTable()
.createTable("Users_interleaved")
.column("first_name").string().max().endColumn()
.column("last_name").string().size(5).endColumn()
.column("age").int64().endColumn()
.column("bool_field").bool().endColumn()
.column("int64_field").int64().endColumn()
.column("float64_field").float64().endColumn()
.column("string_field").string().max().endColumn()
.column("bytes_field").bytes().max().endColumn()
.column("timestamp_field").timestamp().endColumn()
.column("date_field").date().endColumn()
.column("id").int64().endColumn()
.primaryKey().asc("first_name").desc("last_name")
.asc("age").asc("bool_field")
.asc("int64_field").asc("float64_field")
.asc("string_field").asc("bytes_field")
.asc("timestamp_field").asc("date_field").asc("id").end()
.endTable()
.build();
return ddl;
}
@Test
public void canListShadowTablesInDdl() throws Exception {
SpannerConfig spannerConfig = mock(SpannerConfig.class);
ProcessInformationSchema.ProcessInformationSchemaFn processInformationSchema =
new ProcessInformationSchema.ProcessInformationSchemaFn(spannerConfig,
/*shouldCreateShadowTables=*/true, "shadow_", "oracle");
Set<String> shadowTables =
processInformationSchema.getShadowTablesInDdl(getTestDdl());
assertThat(shadowTables, is(new HashSet<String>(Arrays.asList("shadow_Users"))));
}
@Test
public void canListDataTablesWithNoShadowTablesInDdl() throws Exception {
SpannerConfig spannerConfig = mock(SpannerConfig.class);
ProcessInformationSchema.ProcessInformationSchemaFn processInformationSchema =
new ProcessInformationSchema.ProcessInformationSchemaFn(spannerConfig,
/*shouldCreateShadowTables=*/true, "shadow_", "oracle");
List<String> dataTablesWithNoShadowTables =
processInformationSchema.getDataTablesWithNoShadowTables(getTestDdl());
assertThat(dataTablesWithNoShadowTables, is(Arrays.asList("Users_interleaved")));
}
}
| [
"cloud-teleport@google.com"
] | cloud-teleport@google.com |
a1b276d47fdf6f00bcb35d961a73c72a30b5e334 | 6da351eb6669d0afc1649e7e9b489ad5fbe40caf | /src/main/java/com/evalution/rewards/config/JpaConfig.java | da81576c02fc39d5dce31d2ac301eaed8ad93d63 | [] | no_license | nikhileshch/RewardPoints | b95a70906c3040a58bb45c8cc64f18af7b37d9c6 | ba3c30196b59cb7ec8e7a3c323d94697b8d35207 | refs/heads/main | 2023-04-18T06:10:22.407469 | 2021-04-23T21:24:54 | 2021-04-23T21:24:54 | 360,970,172 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package com.evalution.rewards.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@Configuration
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
public class JpaConfig {
@Bean
public AuditorAware<String> auditorAware() {
return new AuditorAwareImpl();
}
}
| [
"ch.nikhil6@gmail.com"
] | ch.nikhil6@gmail.com |
0267a6d0f0c59de42d99481da849dca59d345414 | ca1a412a08c8bbb254f4cb72d5ba957627d35a9d | /ssm/maven2/src/main/java/com/chenv/dao/UserMapper.java | f458e0477776d6b355f59e5d59c992a6547a91d8 | [] | no_license | chenvi/JavaWeb | ecf426524f60a38009fd3c26e2ac542037435da7 | d781f4afcf70e6dc46e049f48cd0e08b583a1143 | refs/heads/master | 2020-04-09T16:03:57.313307 | 2016-12-18T06:55:48 | 2016-12-18T06:55:48 | 60,084,549 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.chenv.dao;
import com.chenv.pojo.User;
public interface UserMapper {
int deleteByPrimaryKey(Integer id);
int insert(User record);
int insertSelective(User record);
User selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
} | [
"chen-v@foxmail.com"
] | chen-v@foxmail.com |
08e0142876a7503223f7241adddfa6ef102d15d9 | 6882f778ff961d5c87e838f2027d61d7021bd6bc | /org.jvoicexml.callmanager.text/unittests/src/org/jvoicexml/callmanager/text/TestTextApplication.java | 233b6359aae7d8afbe540fdef4bb691abe8a8b95 | [] | no_license | ridixcr/JVoiceXML | ac75ce5484e41dcf720269e63caeb262b14fb2c8 | 3b36d974ec41b3d5a277fd2454957fd3331a6fe4 | refs/heads/master | 2021-01-18T03:45:57.337021 | 2015-09-16T07:05:52 | 2015-09-16T07:05:52 | 42,839,146 | 1 | 0 | null | 2015-09-21T02:21:46 | 2015-09-21T02:21:45 | null | UTF-8 | Java | false | false | 3,322 | java | /*
* File: $HeadURL$
* Version: $LastChangedRevision$
* Date: $Date$
* Author: $LastChangedBy$
*
* JVoiceXML - A free VoiceXML implementation.
*
* Copyright (C) 2012-2013 JVoiceXML group - http://jvoicexml.sourceforge.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.jvoicexml.callmanager.text;
import java.net.URI;
import org.junit.Assert;
import org.junit.Test;
/**
* Test cases for {@link TextApplication}.
* @author Dirk Schnelle-Walka
*
*/
public final class TestTextApplication {
/**
* Test method for {@link org.jvoicexml.callmanager.text.TextApplication#getUriObject()}.
* @exception Exception
* test failed
*/
@Test
public void testGetUriObject() throws Exception {
final TextApplication application1 = new TextApplication();
application1.setUri("http:localhost:8080");
final URI uri1 = new URI("http:localhost:8080");
Assert.assertEquals(uri1, application1.getUriObject());
final TextApplication application2 = new TextApplication();
Assert.assertNull(application2.getUriObject());
}
/**
* Test method for {@link org.jvoicexml.callmanager.text.TextApplication#getPort()}.
*/
@Test
public void testGetPort() {
final TextApplication application1 = new TextApplication();
application1.setPort(4242);
Assert.assertEquals(4242, application1.getPort());
final TextApplication application2 = new TextApplication();
Assert.assertEquals(0, application2.getPort());
}
/**
* Test method for {@link org.jvoicexml.callmanager.text.TextApplication#getUri()}.
*/
@Test
public void testGetUri() {
final TextApplication application1 = new TextApplication();
application1.setUri("http:localhost:8080");
Assert.assertEquals("http:localhost:8080", application1.getUri());
final TextApplication application2 = new TextApplication();
Assert.assertNull(application2.getUri());
}
public void testSetUri() {
final TextApplication application = new TextApplication();
application.setUri("foo");
Assert.assertEquals("foo", application);
application.setUri(null);
Assert.assertNull(application.getUri());
}
/**
* Test method for {@link org.jvoicexml.callmanager.text.TextApplication#setUri(String)}.
*/
@Test(expected = IllegalArgumentException.class)
public void testSetUriInvalid() {
final TextApplication application = new TextApplication();
application.setUri("#foo#");
}
}
| [
"dirk.schnelle@jvoicexml.org"
] | dirk.schnelle@jvoicexml.org |
2d1e395b95c7f80ce91dea55cbc6df5200ecce10 | 5bbc3c8f190febd708bc9c8aae6271d085ed7220 | /app/src/main/java/com/xian/www/cinemas/fragments/PostersActivityFragment.java | c415a646bed8213f8ea79fceb1d29969f79a5d1e | [] | no_license | dshrout/cinemas | 70efa50e1268751243ed94849e8a14dc2f596872 | c978338cdfcbcba79e87ad90ec7dc0d25a821631 | refs/heads/master | 2021-01-10T12:21:47.850156 | 2016-04-04T13:13:18 | 2016-04-04T13:13:18 | 55,411,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 626 | java | package com.xian.www.cinemas.fragments;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.xian.www.cinemas.R;
/**
* A placeholder fragment containing a simple view.
*/
public class PostersActivityFragment extends Fragment {
public PostersActivityFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
}
| [
"madwhit@gmail.com"
] | madwhit@gmail.com |
120a64c335c8a30ecac433f49fd06fa1ed94c37c | 8a93b9ff5c0520e3d538076b7e29d72f63f1a2cf | /src/egc3_lw31/client/util/Member.java | 8860ea1d8a314c48a771f6a2d0446ab059efa9af | [] | no_license | rocmeister/Trivia-Game | 54ab8f170860065fc512c3954361a4a06bf6548b | f13179b7767b7b2e4573ee2b70837330b39c4125 | refs/heads/master | 2020-05-02T11:58:54.730701 | 2019-11-20T19:16:09 | 2019-11-20T19:16:09 | 177,946,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,631 | java | package egc3_lw31.client.util;
import java.rmi.RemoteException;
//import java.util.UUID;
import common.IMember;
import common.IGroup;
import common.ICmd2ModelAdapter;
import common.IRemoteConnection;
import common.message.GroupDataPacket;
import common.message.GroupDataPacketAlgo;
import provided.datapacket.IDataPacketData;
/**
* Concrete Member class
*/
public class Member implements IMember {
/**
* The API compliant ChatroomDataPacketAlg visitor installed in this ChatApp
*/
private GroupDataPacketAlgo visitor;
/**
* The room this member is in
*/
private IGroup room;
/**
* The member's userStub
*/
private IRemoteConnection userStub;
// private transient ICmd2ModelAdapter c2mAdpt;
// private UUID id;
// private IMember repstub;
//public int BOUND_PORT_REP = IMember.BOUND_PORT; // 2101
/**
* Constructor, core of message handling
* @param _room Chat room
* @param _userStub Stub of the user
* @param _c2mAdpt Cmd2ModelAdapter
* @param visitor Visitor
*/
public Member(IGroup _room, IRemoteConnection _userStub, ICmd2ModelAdapter _c2mAdpt, GroupDataPacketAlgo visitor) {
// make a deep opy of this chatroom with UUID
room = new ChatRoom(_room.getName(), _room.getUUID());
// add all exisiting members to this room
for (IMember repStub: _room.getMembers()) {
room.getMembers().add(repStub);
}
this.userStub = _userStub;
this.visitor = visitor;
// try {
// this.repstub = (IRepresentative) UnicastRemoteObject.exportObject(this, BOUND_PORT_REP);
// } catch (RemoteException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
/* Installing well-known msg type commands to the visitor!! */
// default cmd
// IExtVisitorCmd<R, I, P, H> defaultcmd = new IExtVisitorCmd<> () {
// @Override
// public <T extends IExtVisitorHost<I, ? super H>> R apply(I index, T host){
// // TODO Auto-generated method stub
// host.receiveMsg(IRequestInstruction);
// }
// }
// IRequestInstruction();
//ADataPacketAlgoCmd defaultcmd = null;
//this.visitor = new DataPacketAlgo(defaultcmd);
// cmd for IText
// ADataPacketAlgoCmd<Integer, IText, Integer, ICmd2ModelAdapter, DataPacket<IText, IRepresentative>> textCmd
// = new ADataPacketAlgoCmd<>() {
// /**
// *
// */
// private static final long serialVersionUID = 4033756108955376172L;
//
// @Override
// public Integer apply(IDataPacketID index, DataPacket<IText, IRepresentative> host, Integer... params) {
// // TODO Auto-generated method stub
// c2mAdpt.appendString(host.getData().getText());
// //return host.getData().getText();
// return 0;
// }
//
// @Override
// public void setCmd2ModelAdpt(ICmd2ModelAdapter cmd2ModelAdpt) {
// // TODO Auto-generated method stub
// //c2mAdpt = cmd2ModelAdpt;
// }
//
// };
// default
// UnknownMessageCmd defaultCmd = new UnknownMessageCmd(repstub);
// defaultCmd.setCmd2ModelAdpt(this.c2mAdpt);
// this.visitor = new DataPacketAlgo<Integer, Integer>(defaultCmd);
// // text
// TextCmd textCmd = new TextCmd(this.c2mAdpt);
// textCmd.setCmd2ModelAdpt(this.c2mAdpt);
// this.visitor = new ChatroomDataPacketAlgo(textCmd);
// visitor.setCmd(ITxtData.GetID(), textCmd);
//
// requestInstruction
// RequestInstructionCmd requestInstructionCmd = new RequestInstructionCmd(c2mAdpt, room, repstub);
// requestInstructionCmd.setCmd2ModelAdpt(this.c2mAdpt);
// visitor.setCmd(IRequestInstruction.GetID(), requestInstructionCmd);
// // instruct
// InstructCmd instructCmd = new InstructCmd(c2mAdpt, room);
// instructCmd.setCmd2ModelAdpt(this.c2mAdpt);
// visitor.setCmd(IInstallCmdData.GetID(), instructCmd);
//cmd for getChatRooms
//ADataPacketAlgoCmd<Integer, > getChatRoomCmd;
// cmd for IAddRep
// ADataPacketAlgoCmd<Integer, IAddRep, Integer, ICmd2ModelAdapter, DataPacket<IAddRep, IRepresentative>> addRepCmd
// = new ADataPacketAlgoCmd<>() {
// private static final long serialVersionUID = 1L;
//
// @Override
// public Integer apply(IDataPacketID index, DataPacket<IAddRep, IRepresentative> host, Integer... params) {
// room.addRep(host.getData().getRepToAdd());
// c2mAdpt.appendString("A new user has joined!\n");
// return 0;
// }
//
// @Override
// public void setCmd2ModelAdpt(ICmd2ModelAdapter cmd2ModelAdpt) {
// //c2mAdpt = cmd2ModelAdpt;
// }
// };
// JoinDataCmd addRepCmd = new JoinDataCmd(c2mAdpt, room);
// addRepCmd.setCmd2ModelAdpt(this.c2mAdpt);
// visitor.setCmd(IAddRep.GetID(), addRepCmd);
//
// LeaveDataCmd removeRepCmd = new LeaveDataCmd(c2mAdpt, room);
// removeRepCmd.setCmd2ModelAdpt(this.c2mAdpt);
// visitor.setCmd(IRemoveRep.GetID(), removeRepCmd);
/* End of Visitor Initialization */
}
@Override
public void receiveData(GroupDataPacket<? extends IDataPacketData> dp) throws RemoteException {
System.out.println("Member received data!");
dp.execute(visitor);
}
@Override
public String getName() throws RemoteException {
return userStub.getName();
}
@Override
public IRemoteConnection getRemoteConnection() throws RemoteException {
return userStub;
}
// @Override
// public void receiveMessage(ADataPacket D) {
// // TODO Auto-generated method stub
//// if (D.getClass().equals(IInstruct.class)) {
//// IInstruct I = (IInstruct) D;
//// visitor.setCmd(idx, I.getCmd());
//// }
// D.execute(visitor);
// //System.out.println("HEloo");
// //System.out.println(D.toString());
// //c2mAdpt.appendString(D.toString());
// }
// @Override
// public String getUserName() throws RemoteException {
// return userStub.getName();
// }
}
| [
"lw31@rice.edu"
] | lw31@rice.edu |
e20295b908c0f392a6e1742a558da248eedbcf48 | f3ba304fff2397123fc09e9f5e3652d799575297 | /src/main/java/backtracing/Q79.java | 3b861304e4359a3f4bd9d060ba85e7886b9eaa77 | [] | no_license | LucasPiazon/leetcode | d1d9b9eebb4aa146d3fe36b6e11b2bbe9d70a7d9 | 0edc47be6265b5ebc6ff32d70a5deb93457364cd | refs/heads/master | 2020-09-15T22:56:55.950369 | 2020-01-07T13:45:42 | 2020-01-07T13:45:42 | 223,576,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,972 | java | package backtracing;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* @author chelsea
* @date 2019-11-23
* <p>
* 单词搜索
*/
public class Q79 {
public static void main(String[] args) {
Solution solution = new Solution();
char[][] board = new char[][]{{'a'}};
solution.exist(board, "ab");
IntStream.range(1, 9).boxed().collect(Collectors.toList());
}
static class Solution {
public boolean exist(char[][] board, String word) {
if (board.length == 0 || word == null) {
return false;
}
char[] cha = word.toCharArray();
char[][] flags = new char[board.length][board[0].length];
for (int i = 0; i < board.length; i++) {
for (int j = 0; i < board[i].length; j++) {
if (board[i][j] == word.charAt(0) && existHelper(board, flags, cha, 0, i, j)) {
return true;
}
}
}
return false;
}
private boolean existHelper(char[][] board, char[][] flags, char[] cha, int pos, int x, int y) {
if (x == board.length || y == board[0].length || x < 0 || y < 0 || flags[x][y] == 1) {
return false;
}
if (cha[pos] != board[x][y]) {
return false;
}
if (pos == cha.length - 1 && cha[pos] == board[x][y]) {
return true;
}
if (pos == cha.length) {
return false;
}
//上、下、左、右
flags[x][y] = 1;
boolean res = existHelper(board, flags, cha, pos + 1, x - 1, y) || existHelper(board, flags, cha, pos + 1, x + 1, y) || existHelper(board, flags, cha, pos + 1, x, y - 1) || existHelper(board, flags, cha, pos + 1, x, y + 1);
flags[x][y] = 0;
return res;
}
}
}
| [
"liuchaoqun@guazi.com"
] | liuchaoqun@guazi.com |
ee5d560c7c050d6a99abda772aa88f1f2defbfcb | 5a171739937788559f1a2c071e04f2e32e08e3a8 | /app/src/main/java/com/thedramaticcolumnist/appdistributor/mAdapter/SliderAdapterHome.java | d5cfd1614b81fb42a4e4124412510e4a0bccc97b | [] | no_license | SanjaySinghGangwar/easybutorDistributor | 0bbf6cf3a8d6fa18182c314f17f85d3bb7a27a69 | a4b29782b2b0e1f2732168841a517b50003b0058 | refs/heads/master | 2023-08-13T21:21:04.941652 | 2021-10-05T12:01:28 | 2021-10-05T12:01:28 | 385,240,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,995 | java | package com.thedramaticcolumnist.appdistributor.mAdapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.smarteist.autoimageslider.SliderViewAdapter;
import com.thedramaticcolumnist.appdistributor.R;
import com.thedramaticcolumnist.appdistributor.models.SliderData;
import java.util.ArrayList;
import java.util.List;
public class SliderAdapterHome extends SliderViewAdapter<SliderAdapterHome.SliderAdapterHomeViewHolder> {
private final List<SliderData> mSliderItems;
public SliderAdapterHome(Context context, ArrayList<SliderData> sliderDataArrayList) {
this.mSliderItems = sliderDataArrayList;
}
@Override
public int getCount() {
return mSliderItems.size();
}
@Override
public SliderAdapterHomeViewHolder onCreateViewHolder(ViewGroup parent) {
View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.slider_layout, null);
return new SliderAdapterHomeViewHolder(inflate);
}
@Override
public void onBindViewHolder(SliderAdapterHomeViewHolder viewHolder, int position) {
final SliderData sliderItem = mSliderItems.get(position);
Glide.with(viewHolder.itemView)
.load(sliderItem.getImgUrl())
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.error(R.drawable.ic_error)
.into(viewHolder.imageViewBackground);
}
static class SliderAdapterHomeViewHolder extends SliderViewAdapter.ViewHolder {
View itemView;
ImageView imageViewBackground;
public SliderAdapterHomeViewHolder(View itemView) {
super(itemView);
imageViewBackground = itemView.findViewById(R.id.myimage);
this.itemView = itemView;
}
}
} | [
"gangwar.jar@gmail.com"
] | gangwar.jar@gmail.com |
f5848808e6031b2b364b687924e8188bac488fcc | 7dbbe21b902fe362701d53714a6a736d86c451d7 | /BzenStudio-5.6/Source/com/zend/ide/cb/a/oc.java | f59b4ec7fc74406e663d70965dcf8b6765e95d10 | [] | no_license | HS-matty/dev | 51a53b4fd03ae01981549149433d5091462c65d0 | 576499588e47e01967f0c69cbac238065062da9b | refs/heads/master | 2022-05-05T18:32:24.148716 | 2022-03-20T16:55:28 | 2022-03-20T16:55:28 | 196,147,486 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package com.zend.ide.cb.a;
import com.zend.ide.util.c.h;
import com.zend.ide.util.ct;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
class oc extends AbstractAction
{
final dd a;
public oc(dd paramdd)
{
super(ct.a(116));
}
public void actionPerformed(ActionEvent paramActionEvent)
{
if (dd.b())
return;
dd.a(this.a, true);
he localhe = new he(this);
h.c().a(localhe, true);
}
}
/* Location: C:\Program Files\Zend\ZendStudio-5.5.1\bin\ZendIDE.jar
* Qualified Name: com.zend.ide.cb.a.oc
* JD-Core Version: 0.6.0
*/ | [
"byqdes@gmail.com"
] | byqdes@gmail.com |
2055ed19951cad5c5c73dddd22732976f9566f6b | 9486fbb937256e9edfe11c20a1455978c8529631 | /src/rs/ac/bg/etf/pp1/ast/MaybeRelopExpr.java | 58a0a306a8516262ff6915dc3f53c1bac16d251c | [] | no_license | Djordje1995/MJCompiler | 162b6a5c942d2ad7ea27c790eaee4f355de4f8e4 | b34222e0e4e2d09fccba0d821b2286c07a517761 | refs/heads/master | 2020-05-16T06:56:45.537414 | 2019-06-13T18:36:38 | 2019-06-13T18:36:38 | 182,860,394 | 0 | 0 | null | 2019-06-13T18:36:39 | 2019-04-22T20:11:05 | Java | UTF-8 | Java | false | false | 829 | java | // generated with ast extension for cup
// version 0.8
// 13/5/2019 19:21:7
package rs.ac.bg.etf.pp1.ast;
public abstract class MaybeRelopExpr implements SyntaxNode {
private SyntaxNode parent;
private int line;
public SyntaxNode getParent() {
return parent;
}
public void setParent(SyntaxNode parent) {
this.parent=parent;
}
public int getLine() {
return line;
}
public void setLine(int line) {
this.line=line;
}
public abstract void accept(Visitor visitor);
public abstract void childrenAccept(Visitor visitor);
public abstract void traverseTopDown(Visitor visitor);
public abstract void traverseBottomUp(Visitor visitor);
public String toString() { return toString(""); }
public abstract String toString(String tab);
}
| [
"bozovic.djole@yahoo.com"
] | bozovic.djole@yahoo.com |
54886e8f3fffae4d1bc5f6ccde51e8ee1b4b773f | e91b2bb5f405f880ce79aec737237cebbef0e94b | /app/src/main/java/com/ske/snakebaddesign/models/Player.java | 741da2174576d9e85c9f28f00a48c7af85b43a63 | [] | no_license | chinatip/Snake-and-Ladder | 5d17a336a29e96c122fe2f5dc4972e6668f6d939 | da3b6ebe23d224a5736941dab9f5dc7b15eb9356 | refs/heads/master | 2021-01-10T13:39:54.357092 | 2016-03-17T14:24:54 | 2016-03-17T14:24:54 | 54,123,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package com.ske.snakebaddesign.models;
public class Player {
private static int NUMBER = 1;
private int number;
private Piece piece;
public Player(int color){
this.number = NUMBER;
piece = new Piece(color);
NUMBER++;
}
public int getNumber() {
return number;
}
public int getPosition(){
return piece.getPosition();
}
public void setPosition(int position) {
piece.setPosition(position);
}
public Piece getPiece() {
return piece;
}
public void reset(){
piece.reset();
}
}
| [
"namtan8888@gmail.com"
] | namtan8888@gmail.com |
2296df56a9e93bc673b956dc24d3e645009e0543 | 4e8757f15e3792c04c3d8d6a6c865d231d85511d | /sevensGame/src/main/java/techtest/sevensGame/sevensGame/MouseLogic.java | 3cbaf0ebe1dd968753dfdf0049825446272cf5f8 | [] | no_license | ScottFreeman96/sevensGame | 66aa3471cc62484697179cb48f3f695183d615a1 | 0f137171573e130e055eeb2df00c3b32bb718304 | refs/heads/main | 2023-01-23T15:58:04.016754 | 2020-12-07T14:33:12 | 2020-12-07T14:33:12 | 319,141,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | package techtest.sevensGame.sevensGame;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class MouseLogic extends MouseAdapter
{
Player player;
public MouseLogic(Player player)
{
this.player =player;
}
@Override
public void mouseClicked(MouseEvent e)
{
//Coordinates of click
int xPos = e.getX();
int yPos = e.getY();
player.checkSelectedCardAndPlay(xPos, yPos);
}
}
| [
"scott_freeman1996@hotmail.com"
] | scott_freeman1996@hotmail.com |
b8b30e898ed52aca6fceb788816bd16fe2ac848f | 9254e7279570ac8ef687c416a79bb472146e9b35 | /codeup-20200414/src/main/java/com/aliyun/codeup20200414/models/GetMergeRequestDetailResponseBody.java | ba9deb16b0b7f0185d70a9ba6c58ffaf80823f64 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,256 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.codeup20200414.models;
import com.aliyun.tea.*;
public class GetMergeRequestDetailResponseBody extends TeaModel {
@NameInMap("ErrorMessage")
public String errorMessage;
@NameInMap("RequestId")
public String requestId;
@NameInMap("Success")
public Boolean success;
@NameInMap("ErrorCode")
public String errorCode;
@NameInMap("Result")
public GetMergeRequestDetailResponseBodyResult result;
public static GetMergeRequestDetailResponseBody build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBody self = new GetMergeRequestDetailResponseBody();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBody setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
return this;
}
public String getErrorMessage() {
return this.errorMessage;
}
public GetMergeRequestDetailResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public GetMergeRequestDetailResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public GetMergeRequestDetailResponseBody setErrorCode(String errorCode) {
this.errorCode = errorCode;
return this;
}
public String getErrorCode() {
return this.errorCode;
}
public GetMergeRequestDetailResponseBody setResult(GetMergeRequestDetailResponseBodyResult result) {
this.result = result;
return this;
}
public GetMergeRequestDetailResponseBodyResult getResult() {
return this.result;
}
public static class GetMergeRequestDetailResponseBodyResultAssigneeList extends TeaModel {
@NameInMap("Status")
public String status;
@NameInMap("ExternUserId")
public String externUserId;
@NameInMap("Email")
public String email;
@NameInMap("AvatarUrl")
public String avatarUrl;
@NameInMap("Name")
public String name;
@NameInMap("Id")
public String id;
public static GetMergeRequestDetailResponseBodyResultAssigneeList build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResultAssigneeList self = new GetMergeRequestDetailResponseBodyResultAssigneeList();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResultAssigneeList setStatus(String status) {
this.status = status;
return this;
}
public String getStatus() {
return this.status;
}
public GetMergeRequestDetailResponseBodyResultAssigneeList setExternUserId(String externUserId) {
this.externUserId = externUserId;
return this;
}
public String getExternUserId() {
return this.externUserId;
}
public GetMergeRequestDetailResponseBodyResultAssigneeList setEmail(String email) {
this.email = email;
return this;
}
public String getEmail() {
return this.email;
}
public GetMergeRequestDetailResponseBodyResultAssigneeList setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
return this;
}
public String getAvatarUrl() {
return this.avatarUrl;
}
public GetMergeRequestDetailResponseBodyResultAssigneeList setName(String name) {
this.name = name;
return this;
}
public String getName() {
return this.name;
}
public GetMergeRequestDetailResponseBodyResultAssigneeList setId(String id) {
this.id = id;
return this;
}
public String getId() {
return this.id;
}
}
public static class GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers extends TeaModel {
@NameInMap("ExternUserId")
public String externUserId;
@NameInMap("Name")
public String name;
@NameInMap("AvatarUrl")
public String avatarUrl;
@NameInMap("Id")
public Long id;
public static GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers self = new GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers setExternUserId(String externUserId) {
this.externUserId = externUserId;
return this;
}
public String getExternUserId() {
return this.externUserId;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers setName(String name) {
this.name = name;
return this;
}
public String getName() {
return this.name;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
return this;
}
public String getAvatarUrl() {
return this.avatarUrl;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers setId(Long id) {
this.id = id;
return this;
}
public Long getId() {
return this.id;
}
}
public static class GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults extends TeaModel {
@NameInMap("CheckStatus")
public String checkStatus;
@NameInMap("CheckType")
public String checkType;
@NameInMap("CheckName")
public String checkName;
@NameInMap("ExtraUsers")
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers> extraUsers;
@NameInMap("UnsatisfiedItems")
public java.util.List<String> unsatisfiedItems;
@NameInMap("SatisfiedItems")
public java.util.List<String> satisfiedItems;
public static GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults self = new GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults setCheckStatus(String checkStatus) {
this.checkStatus = checkStatus;
return this;
}
public String getCheckStatus() {
return this.checkStatus;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults setCheckType(String checkType) {
this.checkType = checkType;
return this;
}
public String getCheckType() {
return this.checkType;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults setCheckName(String checkName) {
this.checkName = checkName;
return this;
}
public String getCheckName() {
return this.checkName;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults setExtraUsers(java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers> extraUsers) {
this.extraUsers = extraUsers;
return this;
}
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResultsExtraUsers> getExtraUsers() {
return this.extraUsers;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults setUnsatisfiedItems(java.util.List<String> unsatisfiedItems) {
this.unsatisfiedItems = unsatisfiedItems;
return this;
}
public java.util.List<String> getUnsatisfiedItems() {
return this.unsatisfiedItems;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults setSatisfiedItems(java.util.List<String> satisfiedItems) {
this.satisfiedItems = satisfiedItems;
return this;
}
public java.util.List<String> getSatisfiedItems() {
return this.satisfiedItems;
}
}
public static class GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers extends TeaModel {
@NameInMap("ExternUserId")
public String externUserId;
@NameInMap("Name")
public String name;
@NameInMap("AvatarUrl")
public String avatarUrl;
@NameInMap("Id")
public Long id;
public static GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers self = new GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers setExternUserId(String externUserId) {
this.externUserId = externUserId;
return this;
}
public String getExternUserId() {
return this.externUserId;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers setName(String name) {
this.name = name;
return this;
}
public String getName() {
return this.name;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
return this;
}
public String getAvatarUrl() {
return this.avatarUrl;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers setId(Long id) {
this.id = id;
return this;
}
public Long getId() {
return this.id;
}
}
public static class GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults extends TeaModel {
@NameInMap("CheckStatus")
public String checkStatus;
@NameInMap("CheckType")
public String checkType;
@NameInMap("CheckName")
public String checkName;
@NameInMap("ExtraUsers")
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers> extraUsers;
@NameInMap("UnsatisfiedItems")
public java.util.List<String> unsatisfiedItems;
@NameInMap("SatisfiedItems")
public java.util.List<String> satisfiedItems;
public static GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults self = new GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults setCheckStatus(String checkStatus) {
this.checkStatus = checkStatus;
return this;
}
public String getCheckStatus() {
return this.checkStatus;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults setCheckType(String checkType) {
this.checkType = checkType;
return this;
}
public String getCheckType() {
return this.checkType;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults setCheckName(String checkName) {
this.checkName = checkName;
return this;
}
public String getCheckName() {
return this.checkName;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults setExtraUsers(java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers> extraUsers) {
this.extraUsers = extraUsers;
return this;
}
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResultsExtraUsers> getExtraUsers() {
return this.extraUsers;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults setUnsatisfiedItems(java.util.List<String> unsatisfiedItems) {
this.unsatisfiedItems = unsatisfiedItems;
return this;
}
public java.util.List<String> getUnsatisfiedItems() {
return this.unsatisfiedItems;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults setSatisfiedItems(java.util.List<String> satisfiedItems) {
this.satisfiedItems = satisfiedItems;
return this;
}
public java.util.List<String> getSatisfiedItems() {
return this.satisfiedItems;
}
}
public static class GetMergeRequestDetailResponseBodyResultApproveCheckResult extends TeaModel {
@NameInMap("TotalCheckResult")
public String totalCheckResult;
@NameInMap("SatisfiedCheckResults")
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults> satisfiedCheckResults;
@NameInMap("UnsatisfiedCheckResults")
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults> unsatisfiedCheckResults;
public static GetMergeRequestDetailResponseBodyResultApproveCheckResult build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResultApproveCheckResult self = new GetMergeRequestDetailResponseBodyResultApproveCheckResult();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResult setTotalCheckResult(String totalCheckResult) {
this.totalCheckResult = totalCheckResult;
return this;
}
public String getTotalCheckResult() {
return this.totalCheckResult;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResult setSatisfiedCheckResults(java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults> satisfiedCheckResults) {
this.satisfiedCheckResults = satisfiedCheckResults;
return this;
}
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultSatisfiedCheckResults> getSatisfiedCheckResults() {
return this.satisfiedCheckResults;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResult setUnsatisfiedCheckResults(java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults> unsatisfiedCheckResults) {
this.unsatisfiedCheckResults = unsatisfiedCheckResults;
return this;
}
public java.util.List<GetMergeRequestDetailResponseBodyResultApproveCheckResultUnsatisfiedCheckResults> getUnsatisfiedCheckResults() {
return this.unsatisfiedCheckResults;
}
}
public static class GetMergeRequestDetailResponseBodyResultAuthor extends TeaModel {
@NameInMap("ExternUserId")
public String externUserId;
@NameInMap("Name")
public String name;
@NameInMap("AvatarUrl")
public String avatarUrl;
@NameInMap("Id")
public Long id;
public static GetMergeRequestDetailResponseBodyResultAuthor build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResultAuthor self = new GetMergeRequestDetailResponseBodyResultAuthor();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResultAuthor setExternUserId(String externUserId) {
this.externUserId = externUserId;
return this;
}
public String getExternUserId() {
return this.externUserId;
}
public GetMergeRequestDetailResponseBodyResultAuthor setName(String name) {
this.name = name;
return this;
}
public String getName() {
return this.name;
}
public GetMergeRequestDetailResponseBodyResultAuthor setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
return this;
}
public String getAvatarUrl() {
return this.avatarUrl;
}
public GetMergeRequestDetailResponseBodyResultAuthor setId(Long id) {
this.id = id;
return this;
}
public Long getId() {
return this.id;
}
}
public static class GetMergeRequestDetailResponseBodyResult extends TeaModel {
@NameInMap("IsSupportMerge")
public Boolean isSupportMerge;
@NameInMap("State")
public String state;
@NameInMap("BehindCommitCount")
public Integer behindCommitCount;
@NameInMap("ProjectId")
public Long projectId;
@NameInMap("CreatedAt")
public String createdAt;
@NameInMap("AcceptedRevision")
public String acceptedRevision;
@NameInMap("SourceBranch")
public String sourceBranch;
@NameInMap("WebUrl")
public String webUrl;
@NameInMap("Description")
public String description;
@NameInMap("NameWithNamespace")
public String nameWithNamespace;
@NameInMap("MergeType")
public String mergeType;
@NameInMap("TargetBranch")
public String targetBranch;
@NameInMap("AheadCommitCount")
public Integer aheadCommitCount;
@NameInMap("UpdatedAt")
public String updatedAt;
@NameInMap("Title")
public String title;
@NameInMap("MergeError")
public String mergeError;
@NameInMap("MergedRevision")
public String mergedRevision;
@NameInMap("Id")
public Long id;
@NameInMap("MergeStatus")
public String mergeStatus;
@NameInMap("AssigneeList")
public java.util.List<GetMergeRequestDetailResponseBodyResultAssigneeList> assigneeList;
@NameInMap("ApproveCheckResult")
public GetMergeRequestDetailResponseBodyResultApproveCheckResult approveCheckResult;
@NameInMap("Author")
public GetMergeRequestDetailResponseBodyResultAuthor author;
public static GetMergeRequestDetailResponseBodyResult build(java.util.Map<String, ?> map) throws Exception {
GetMergeRequestDetailResponseBodyResult self = new GetMergeRequestDetailResponseBodyResult();
return TeaModel.build(map, self);
}
public GetMergeRequestDetailResponseBodyResult setIsSupportMerge(Boolean isSupportMerge) {
this.isSupportMerge = isSupportMerge;
return this;
}
public Boolean getIsSupportMerge() {
return this.isSupportMerge;
}
public GetMergeRequestDetailResponseBodyResult setState(String state) {
this.state = state;
return this;
}
public String getState() {
return this.state;
}
public GetMergeRequestDetailResponseBodyResult setBehindCommitCount(Integer behindCommitCount) {
this.behindCommitCount = behindCommitCount;
return this;
}
public Integer getBehindCommitCount() {
return this.behindCommitCount;
}
public GetMergeRequestDetailResponseBodyResult setProjectId(Long projectId) {
this.projectId = projectId;
return this;
}
public Long getProjectId() {
return this.projectId;
}
public GetMergeRequestDetailResponseBodyResult setCreatedAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
public String getCreatedAt() {
return this.createdAt;
}
public GetMergeRequestDetailResponseBodyResult setAcceptedRevision(String acceptedRevision) {
this.acceptedRevision = acceptedRevision;
return this;
}
public String getAcceptedRevision() {
return this.acceptedRevision;
}
public GetMergeRequestDetailResponseBodyResult setSourceBranch(String sourceBranch) {
this.sourceBranch = sourceBranch;
return this;
}
public String getSourceBranch() {
return this.sourceBranch;
}
public GetMergeRequestDetailResponseBodyResult setWebUrl(String webUrl) {
this.webUrl = webUrl;
return this;
}
public String getWebUrl() {
return this.webUrl;
}
public GetMergeRequestDetailResponseBodyResult setDescription(String description) {
this.description = description;
return this;
}
public String getDescription() {
return this.description;
}
public GetMergeRequestDetailResponseBodyResult setNameWithNamespace(String nameWithNamespace) {
this.nameWithNamespace = nameWithNamespace;
return this;
}
public String getNameWithNamespace() {
return this.nameWithNamespace;
}
public GetMergeRequestDetailResponseBodyResult setMergeType(String mergeType) {
this.mergeType = mergeType;
return this;
}
public String getMergeType() {
return this.mergeType;
}
public GetMergeRequestDetailResponseBodyResult setTargetBranch(String targetBranch) {
this.targetBranch = targetBranch;
return this;
}
public String getTargetBranch() {
return this.targetBranch;
}
public GetMergeRequestDetailResponseBodyResult setAheadCommitCount(Integer aheadCommitCount) {
this.aheadCommitCount = aheadCommitCount;
return this;
}
public Integer getAheadCommitCount() {
return this.aheadCommitCount;
}
public GetMergeRequestDetailResponseBodyResult setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
return this;
}
public String getUpdatedAt() {
return this.updatedAt;
}
public GetMergeRequestDetailResponseBodyResult setTitle(String title) {
this.title = title;
return this;
}
public String getTitle() {
return this.title;
}
public GetMergeRequestDetailResponseBodyResult setMergeError(String mergeError) {
this.mergeError = mergeError;
return this;
}
public String getMergeError() {
return this.mergeError;
}
public GetMergeRequestDetailResponseBodyResult setMergedRevision(String mergedRevision) {
this.mergedRevision = mergedRevision;
return this;
}
public String getMergedRevision() {
return this.mergedRevision;
}
public GetMergeRequestDetailResponseBodyResult setId(Long id) {
this.id = id;
return this;
}
public Long getId() {
return this.id;
}
public GetMergeRequestDetailResponseBodyResult setMergeStatus(String mergeStatus) {
this.mergeStatus = mergeStatus;
return this;
}
public String getMergeStatus() {
return this.mergeStatus;
}
public GetMergeRequestDetailResponseBodyResult setAssigneeList(java.util.List<GetMergeRequestDetailResponseBodyResultAssigneeList> assigneeList) {
this.assigneeList = assigneeList;
return this;
}
public java.util.List<GetMergeRequestDetailResponseBodyResultAssigneeList> getAssigneeList() {
return this.assigneeList;
}
public GetMergeRequestDetailResponseBodyResult setApproveCheckResult(GetMergeRequestDetailResponseBodyResultApproveCheckResult approveCheckResult) {
this.approveCheckResult = approveCheckResult;
return this;
}
public GetMergeRequestDetailResponseBodyResultApproveCheckResult getApproveCheckResult() {
return this.approveCheckResult;
}
public GetMergeRequestDetailResponseBodyResult setAuthor(GetMergeRequestDetailResponseBodyResultAuthor author) {
this.author = author;
return this;
}
public GetMergeRequestDetailResponseBodyResultAuthor getAuthor() {
return this.author;
}
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
132d8e4967e22d72b42a536f452d2a74a6e6f48d | 7f20b1bddf9f48108a43a9922433b141fac66a6d | /csplugins/trunk/ucsd/kono/NCBIUI/src/edu/ucsd/bioeng/idekerlab/ncbiclientui/NCBIUIPlugin.java | 1eafd4bf9b7db413141905ebc067d2044acd7734 | [] | no_license | ahdahddl/cytoscape | bf783d44cddda313a5b3563ea746b07f38173022 | a3df8f63dba4ec49942027c91ecac6efa920c195 | refs/heads/master | 2020-06-26T16:48:19.791722 | 2013-08-28T04:08:31 | 2013-08-28T04:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,340 | java | /*
Copyright (c) 2006, 2007, The Cytoscape Consortium (www.cytoscape.org)
The Cytoscape Consortium is:
- Institute for Systems Biology
- University of California San Diego
- Memorial Sloan-Kettering Cancer Center
- Institut Pasteur
- Agilent Technologies
This library 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
any later version.
This library 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. The software and
documentation provided hereunder is on an "as is" basis, and the
Institute for Systems Biology and the Whitehead Institute
have no obligations to provide maintenance, support,
updates, enhancements or modifications. In no event shall the
Institute for Systems Biology and the Whitehead Institute
be liable to any party for direct, indirect, special,
incidental or consequential damages, including lost profits, arising
out of the use of this software and its documentation, even if the
Institute for Systems Biology and the Whitehead Institute
have been advised of the possibility of such damage. 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 library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
package edu.ucsd.bioeng.idekerlab.ncbiclientui;
import cytoscape.Cytoscape;
import cytoscape.plugin.CytoscapePlugin;
import edu.ucsd.bioeng.idekerlab.ncbiclientui.ui.NCBIGeneDialog;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JDialog;
import javax.swing.JMenuItem;
/**
*
*/
public class NCBIUIPlugin extends CytoscapePlugin {
/**
* Creates a new NCBIUIPlugin object.
*/
public NCBIUIPlugin() {
Cytoscape.getDesktop().getCyMenus().getMenuBar().getMenu("File.Import").add(new JMenuItem(new AbstractAction("Import Attributes from NCBI Entrez Gene...") {
public void actionPerformed(ActionEvent e) {
JDialog dialog = new NCBIGeneDialog();
dialog.setVisible(true);
}
}));
}
}
| [
"kono@0ecc0d97-ab19-0410-9704-bfe1a75892f5"
] | kono@0ecc0d97-ab19-0410-9704-bfe1a75892f5 |
7e652a382c02870b80e38c6886cbff04c012c62f | 8c6ce5e7ef5addb7e8c40d17d59510e9d3c80977 | /app/src/main/java/com/eightyeightysix/shourya/almondclient/fcm/FirebaseIDService.java | 11b0e23cac5f79e11797db7d92e6d877af9692bb | [] | no_license | shouryalala/periferi-client | d9dafdc6cc82e0e7815aba94e9ff84d8b8137108 | 7e0c79b91a8fe5f08cc54d9410775d9c536eb877 | refs/heads/master | 2021-03-19T18:11:09.604047 | 2020-05-25T11:38:56 | 2020-05-25T11:38:56 | 91,770,221 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | package com.eightyeightysix.shourya.almondclient.fcm;
/*
* Created by shourya on 20/6/17.
*/
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
public class FirebaseIDService extends FirebaseInstanceIdService {
private static final String DEBUG_TAG = "AlmondLog:: " + FirebaseIDService.class.getSimpleName();
@Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(DEBUG_TAG, "Refreshed token: " + refreshedToken);
// TODO: Implement this method to send any registration to your app's servers.
sendRegistrationToServer(refreshedToken);
}
/**
* Persist token to third-party servers.
*
* Modify this method to associate the user's FCM InstanceID token with any server-side account
* maintained by your application.
*
* @param token The new token.
*/
private void sendRegistrationToServer(String token) {
// Add custom implementation, as needed.
}
}
| [
"shouryalala@gmail.com"
] | shouryalala@gmail.com |
83566c4ddd8ea5ac3935e95522eb46ff7f560b24 | 101aeec35377267eb0901e9e805690c415cc2524 | /Prj1/src/lectureExample/Array/String/StringExam3.java | 6f15893cc4867b32a8593c129c9694d83204a3b7 | [] | no_license | marhabaeli/java2020 | c1c09bc8c0e8fdc364386f137a7f971006069527 | ea1f309d117dc71f2a7aa6c1519a76373b630e11 | refs/heads/master | 2020-12-26T16:31:22.756949 | 2020-05-05T19:20:29 | 2020-05-05T19:20:29 | 237,564,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,253 | java | package lectureExample.Array.String;
public class StringExam3 {
public static void main(String[] args) {
String s="Robert Rosar";
StringExam3 obj=new StringExam3();
// System.out.println(obj.getAbbrName(s));
System.out.println(obj.delConsonant("Hello, have a good day!"));
}
String delConsonant(String s){
// for(int i=0;i<s.length();i++){
// char c=s.charAt(i);
// if(c>='a' && c<='z' || c>='A' && c<='Z'){
// String str=Character.toString(c);
// if(!"AaEeIiOoUu".contains(str))
// s.replace(str, "");
// }
// }
// return s;
String vowels="aeiouAEIOU,.:?; ";
StringBuilder sb=new StringBuilder(s);
for(int i=0;i<sb.length();){
if(!vowels.contains(sb.subSequence(i, i+1))){
sb.replace(i, i+1, "");
continue;
}
i++;
}
// System.out.println(sb.toString());
return sb.toString();
}
String getAbbrName(String nm){ //nm=Robert Brett Rosar
String[] nms=nm.split(" "); //nms[0]=Robert, nms[1]=Brett, nms[2]=ROsar, length=3
StringBuilder sb=new StringBuilder();
for(int i=0;i<nms.length-1;i++){
sb.append(nms[i].substring(0,1)+".");
}
sb.append(nms[nms.length-1]); //? nms[2]
return sb.toString();
}
} | [
"marhabaeli@gmail.com"
] | marhabaeli@gmail.com |
1141db2a4edc4c85c42507e7e832d2cf86274412 | e9310550eebc4f8dfcd97a38256e5d2c078b0b2b | /app/src/main/java/com/example/basisql/Model/Contact.java | 59a1ab6088283189ef5d6ff9179db63637949118 | [] | no_license | Durganand-ds1/sql | 80cc2d9ae1173ce87b1467b727f9521e7aab0014 | b736321c762abcf949adf672a29532023516288d | refs/heads/master | 2023-03-24T02:34:17.781124 | 2021-03-19T15:19:55 | 2021-03-19T15:19:55 | 349,466,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | java | package com.example.basisql.Model;
public class Contact {
private int id;
private String name;
private String email;
public Contact(String name, String email, int id) {
this.name = name;
this.email=email;
this.id=id;
}
public Contact(String name, String email) {
this.name = name;
this.email=email;
}
public Contact() {
}
public void setName (String name){
this.name = name;
}
public void setEmail(String email){
this.email = email;
}
public void setId(int id){
this.id = id;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public int getId(){
return id;
}
}
| [
"dmdu23@gmail.com"
] | dmdu23@gmail.com |
30224328e1ca4f24354be8f9040045c1ab24ef1c | c1882c016759cb782faa166108df245481ab6294 | /Data-Structure-Implementations/src/linkedList/ILinkedList.java | f8f92c161a91510fc2f5db8c93ae7e6c06d0f965 | [
"Unlicense"
] | permissive | mostafaLabib65/Data-structure-implementation | 4e6df6786c0fa655f7ba6f7f0e9c4b0e81d1d5b1 | 67cdeaa9985a8576b62c5f2bb469814ee8bcef08 | refs/heads/master | 2021-01-18T20:05:18.710787 | 2017-08-25T01:16:47 | 2017-08-25T01:16:47 | 100,543,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package linkedList;
public interface ILinkedList {
/**
* Inserts a specified element at the specified sposition in the list.
*/
public void add(int index, Object element);
/** Inserts the specified element at the end of the list. */
public void add(Object element);
/** Returns the element at the specified position in this list. */
public Object get(int index);
/**
* Replaces the element at the specified position in this list with
* the specified element.
*/
public void set(int index, Object element);
/** Removes all of the elements from this list. */
public void clear();
/** Returns true if this list contains no elements. */
public boolean isEmpty();
/** Removes the element at the specified position in this list. */
public void remove(int index);
/** Returns the number of elements in this list. */
public int size();
/**
* Returns a view of the portion of this list between the specified
* fromIndex and toIndex, inclusively.
*/
public ILinkedList sublist(int fromIndex, int toIndex);
/**
* Returns true if this list contains an element with the same value
* as the specified element.
*/
public boolean contains(Object o);
}
| [
"Mustafa@admin-pc"
] | Mustafa@admin-pc |
5ad39f2b9a0d6170873df88c61bd0065194e32fb | ceac2e92837be22cb82086ef9448dcd290271656 | /app/src/main/java/com/puzzle/industries/inumbr/ui/PlaceBetActivity.java | c128493b686f01186028b1d905aafad3e752d8be | [] | no_license | MulisaRamukosi/inumbr | d64f64070cb6370ca5e2314ef83d7f72f27d0a97 | 33d6cc45bd182ebb817843a0c043470ac4973b9c | refs/heads/master | 2023-04-19T22:09:22.942823 | 2021-05-03T13:02:24 | 2021-05-03T13:02:24 | 348,459,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,623 | java | package com.puzzle.industries.inumbr.ui;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.puzzle.industries.inumbr.dataModels.LuckyNumberGame;
import com.puzzle.industries.inumbr.databinding.ActivityPlaceBetsBinding;
import com.puzzle.industries.inumbr.utils.Constants;
import java.io.IOException;
import java.util.List;
public class PlaceBetActivity extends BetPlacerActivity {
public static List<int[]> sResults;
private ActivityPlaceBetsBinding mBinding;
private LuckyNumberGame mLuckyNumberGame;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBinding = ActivityPlaceBetsBinding.inflate(getLayoutInflater());
mLuckyNumberGame = getIntent().getExtras().getParcelable(Constants.KEY_LN_GAME);
setContentView(mBinding.getRoot());
startBetting(mBinding.wvSite);
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
@Override
public void placeBets() {
try{
String betNumsSet = getStringifiedList(sResults);
String betPlaceScript = loadScript(mLuckyNumberGame.getScript());
if (mLuckyNumberGame.getName().equals("GOSLOTO RUSSIA 7/49")){
betPlaceScript = String.format(betPlaceScript, betNumsSet, 3);
}
else betPlaceScript = String.format(betPlaceScript, betNumsSet, sResults.get(0).length - 1);
evaluateScript(betPlaceScript);
}
catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"mulisa0998@gmail.com"
] | mulisa0998@gmail.com |
37c55562a41e4dc0eacabe7959e5f8197e5296c4 | 4ea516edf07e87b15e424d1411c4deb3ae2e4fc5 | /apigetway/src/main/java/com/pack/apigetway/core/zuul/filter/pre/RateLimiterFilter.java | 4faa39daa2b4135d8b72b41d446749745e6ec3ca | [] | no_license | maoxinyuan/zuul1.x | 3b9113844945b7be625f9c88c8851d95df3e1b98 | 3a264368313160da487a1025942ed9705143aacd | refs/heads/master | 2023-01-06T16:08:28.613428 | 2020-11-10T07:07:30 | 2020-11-10T07:07:30 | 311,565,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,054 | java | package com.pacific.apigetway.core.zuul.filter.pre;
import com.google.common.util.concurrent.RateLimiter;
import com.pacific.apigetway.core.zuul.FilterOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
/**
* @author yekai
* @date 20181210
* 限流过滤器
**/
public class RateLimiterFilter extends AbstractPreZuulFilter {
private static final Logger LOGGER = LoggerFactory.getLogger(RateLimiterFilter.class);
/**
* 每秒允许处理的量是5
*/
RateLimiter rateLimiter = RateLimiter.create(5);
@Override
public int filterOrder() {
return FilterOrder.RATE_LIMITER_ORDER;
}
@Override
public Object doRun() {
HttpServletRequest request = context.getRequest();
String url = request.getRequestURI();
if (rateLimiter.tryAcquire()) {
return success();
} else {
LOGGER.info("rate limit:{}", url);
return fail(401, String.format("rate limit:{}", url));
}
}
}
| [
"maoxinyuan0@gmail.com"
] | maoxinyuan0@gmail.com |
6c79cafa504819fb1fba8ee3b81fc00152cdc751 | b7e855c85deaf26fa5d2f7652cfb72cbfebf02b9 | /spring/springCore/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java | a164cf34f49ce496df3f614cecc8381d7f1ed9ed | [] | no_license | 90ji/studySourceParent | 36f45a14c6797aac76629d1e27404871549b0565 | b4a9716dcb40a920a5489eddff591ba5de6d582b | refs/heads/master | 2022-10-08T08:47:52.166076 | 2020-06-12T03:22:38 | 2020-06-12T03:22:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,424 | 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
*
* 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.springframework.core.env;
import org.springframework.core.convert.ConversionException;
import org.springframework.util.ClassUtils;
/**
* {@link PropertyResolver} implementation that resolves property values against
* an underlying set of {@link PropertySources}.
*
* @author Chris Beams
* @author Juergen Hoeller
* @see PropertySource
* @see PropertySources
* @see AbstractEnvironment
* @since 3.1
*/
public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
private final PropertySources propertySources;
/**
* Create a new resolver against the given property sources.
*
* @param propertySources the set of {@link PropertySource} objects to use
*/
public PropertySourcesPropertyResolver(PropertySources propertySources) {
this.propertySources = propertySources;
}
@Override
public boolean containsProperty(String key) {
if (this.propertySources != null) {
for (PropertySource<?> propertySource : this.propertySources) {
if (propertySource.containsProperty(key)) {
return true;
}
}
}
return false;
}
@Override
public String getProperty(String key) {
return getProperty(key, String.class, true);
}
@Override
public <T> T getProperty(String key, Class<T> targetValueType) {
return getProperty(key, targetValueType, true);
}
@Override
protected String getPropertyAsRawString(String key) {
return getProperty(key, String.class, false);
}
protected <T> T getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders) {
if (this.propertySources != null) {
for (PropertySource<?> propertySource : this.propertySources) {
// if (logger.isTraceEnabled()) {
// logger.trace("Searching for key '" + key + "' in PropertySource '" +
// propertySource.getName() + "'");
// }
Object value = propertySource.getProperty(key);
if (value != null) {
if (resolveNestedPlaceholders && value instanceof String) {
value = resolveNestedPlaceholders((String) value);
}
logKeyFound(key, propertySource, value);
return convertValueIfNecessary(value, targetValueType);
}
}
}
// if (logger.isDebugEnabled()) {
// logger.debug("Could not find key '" + key + "' in any property source");
// }
return null;
}
@Override
@Deprecated
public <T> Class<T> getPropertyAsClass(String key, Class<T> targetValueType) {
if (this.propertySources != null) {
for (PropertySource<?> propertySource : this.propertySources) {
// if (logger.isTraceEnabled()) {
// logger.trace(String.format("Searching for key '%s' in [%s]", key, propertySource.getName()));
// }
Object value = propertySource.getProperty(key);
if (value != null) {
logKeyFound(key, propertySource, value);
Class<?> clazz;
if (value instanceof String) {
try {
clazz = ClassUtils.forName((String) value, null);
} catch (Exception ex) {
throw new ClassConversionException((String) value, targetValueType, ex);
}
} else if (value instanceof Class) {
clazz = (Class<?>) value;
} else {
clazz = value.getClass();
}
if (!targetValueType.isAssignableFrom(clazz)) {
throw new ClassConversionException(clazz, targetValueType);
}
@SuppressWarnings("unchecked")
Class<T> targetClass = (Class<T>) clazz;
return targetClass;
}
}
}
// if (logger.isDebugEnabled()) {
// logger.debug(String.format("Could not find key '%s' in any property source", key));
// }
return null;
}
/**
* Log the given key as found in the given {@link PropertySource}, resulting in
* the given value.
* <p>The default implementation writes a debug log message with key and source.
* As of 4.3.3, this does not log the value anymore in order to avoid accidental
* logging of sensitive settings. Subclasses may override this method to change
* the log level and/or log message, including the property's value if desired.
*
* @param key the key found
* @param propertySource the {@code PropertySource} that the key has been found in
* @param value the corresponding value
* @since 4.3.1
*/
protected void logKeyFound(String key, PropertySource<?> propertySource, Object value) {
// if (logger.isDebugEnabled()) {
// logger.debug("Found key '" + key + "' in PropertySource '" + propertySource.getName() +
// "' with value of type " + value.getClass().getSimpleName());
// }
}
@SuppressWarnings("serial")
@Deprecated
private static class ClassConversionException extends ConversionException {
public ClassConversionException(Class<?> actual, Class<?> expected) {
super(String.format("Actual type %s is not assignable to expected type %s", actual.getName(), expected.getName()));
}
public ClassConversionException(String actual, Class<?> expected, Exception ex) {
super(String.format("Could not find/load class %s during attempt to convert to %s", actual, expected.getName()), ex);
}
}
}
| [
"394731688@qq.com"
] | 394731688@qq.com |
d8a1873b0c414bd4a14d83799370df612915cf5d | 2f4a058ab684068be5af77fea0bf07665b675ac0 | /app/com/facebook/katana/platform/PlatformWrapperActivity.java | 5fdde58063b40e9c83fdb03a6c951b358a5ba7b3 | [] | no_license | cengizgoren/facebook_apk_crack | ee812a57c746df3c28fb1f9263ae77190f08d8d2 | a112d30542b9f0bfcf17de0b3a09c6e6cfe1273b | refs/heads/master | 2021-05-26T14:44:04.092474 | 2013-01-16T08:39:00 | 2013-01-16T08:39:00 | 8,321,708 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,818 | java | package com.facebook.katana.platform;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.common.util.ErrorReporting;
import com.facebook.katana.LoginActivity;
import com.facebook.katana.activity.BaseFacebookActivity;
import com.facebook.katana.binding.AppSession;
import com.facebook.katana.binding.AppSession.LoginStatus;
import com.facebook.katana.features.Gatekeeper;
import com.facebook.orca.annotations.AuthNotRequired;
import com.facebook.orca.common.util.StringLocaleUtil;
import com.facebook.orca.debug.BLog;
import com.facebook.orca.inject.FbInjector;
@AuthNotRequired
public class PlatformWrapperActivity extends BaseFacebookActivity
implements AbstractPlatformActionExecutor.CompletionCallback
{
private static final Class<?> n = PlatformWrapperActivity.class;
private String o;
private AbstractPlatformActionExecutor p;
private AuthDialogActionExecutorFactory q;
private ShareDialogActionExecutorFactory r;
private ComposeDialogActionExecutorFactory s;
private AbstractPlatformActionExecutor a(Intent paramIntent)
{
String str = paramIntent.getStringExtra("com.facebook.platform.protocol.PROTOCOL_ACTION");
Object localObject;
if ("com.facebook.platform.action.request.LOGIN_DIALOG".equals(str))
localObject = b(paramIntent);
while (true)
{
if (localObject != null)
((AbstractPlatformActionExecutor)localObject).a(this);
return localObject;
if ("com.facebook.platform.action.request.SHARE_DIALOG".equals(str))
{
localObject = c(paramIntent);
continue;
}
if ("com.facebook.platform.action.request.COMPOSE_DIALOG".equals(str))
{
localObject = d(paramIntent);
continue;
}
a(str);
localObject = null;
}
}
private void a(String paramString)
{
if (paramString == null);
for (String str = StringLocaleUtil.a("Expected non-null '%s' extra.", new Object[] { "com.facebook.platform.protocol.PROTOCOL_ACTION" }); ; str = StringLocaleUtil.a("Unrecognized '%s' extra: '%s'.", new Object[] { "com.facebook.platform.protocol.PROTOCOL_ACTION", paramString }))
{
b(str);
return;
}
}
private void a(boolean paramBoolean, Intent paramIntent)
{
if (paramBoolean);
for (int i = -1; ; i = 0)
{
setResult(i, paramIntent);
finish();
return;
}
}
private void a(boolean paramBoolean, Bundle paramBundle)
{
if (paramBundle == null)
paramBundle = new Bundle();
paramBundle.putInt("com.facebook.platform.protocol.PROTOCOL_VERSION", 20121101);
String str = f(getIntent().getExtras());
if (str != null)
paramBundle.putString("com.facebook.platform.protocol.PROTOCOL_ACTION", str);
Intent localIntent = new Intent();
localIntent.putExtras(paramBundle);
a(paramBoolean, localIntent);
}
private AuthDialogActionExecutor b(Intent paramIntent)
{
AuthDialogActionExecutor localAuthDialogActionExecutor = null;
PlatformActivityLoginDialogRequest localPlatformActivityLoginDialogRequest = new PlatformActivityLoginDialogRequest();
if (Boolean.FALSE.equals(Gatekeeper.a(this, "fbandroid_native_gdp")))
a(false, new PlatformActivityErrorIntentBuilder("com.facebook.platform.action.reply.LOGIN_DIALOG", "ServiceDisabled", "Please fall back to the previous version of the SSO Login Dialog").a());
while (true)
{
return localAuthDialogActionExecutor;
if (localPlatformActivityLoginDialogRequest.c(paramIntent))
{
localAuthDialogActionExecutor = this.q.a(localPlatformActivityLoginDialogRequest, this.o);
continue;
}
a(false, localPlatformActivityLoginDialogRequest.e());
localAuthDialogActionExecutor = null;
}
}
private void b(String paramString)
{
e(AuthorizeAppResults.a("ProtocolError", paramString));
}
private ShareDialogActionExecutor c(Intent paramIntent)
{
PlatformActivityShareDialogRequest localPlatformActivityShareDialogRequest = new PlatformActivityShareDialogRequest();
if (localPlatformActivityShareDialogRequest.c(paramIntent));
for (ShareDialogActionExecutor localShareDialogActionExecutor = this.r.a(this, localPlatformActivityShareDialogRequest); ; localShareDialogActionExecutor = null)
{
return localShareDialogActionExecutor;
a(false, localPlatformActivityShareDialogRequest.e());
}
}
private ComposeDialogActionExecutor d(Intent paramIntent)
{
PlatformActivityComposeDialogRequest localPlatformActivityComposeDialogRequest = new PlatformActivityComposeDialogRequest();
if (localPlatformActivityComposeDialogRequest.c(paramIntent));
for (ComposeDialogActionExecutor localComposeDialogActionExecutor = this.s.a(this, localPlatformActivityComposeDialogRequest); ; localComposeDialogActionExecutor = null)
{
return localComposeDialogActionExecutor;
a(false, localPlatformActivityComposeDialogRequest.e());
}
}
private String f(Bundle paramBundle)
{
String str1 = paramBundle.getString("com.facebook.platform.protocol.PROTOCOL_ACTION");
String str2;
if ("com.facebook.platform.action.request.LOGIN_DIALOG".equals(str1))
str2 = "com.facebook.platform.action.reply.LOGIN_DIALOG";
while (true)
{
return str2;
if ("com.facebook.platform.action.request.COMPOSE_DIALOG".equals(str1))
{
str2 = "com.facebook.platform.action.reply.COMPOSE_DIALOG";
continue;
}
if ("com.facebook.platform.action.request.SHARE_DIALOG".equals(str1))
{
str2 = "com.facebook.platform.action.reply.SHARE_DIALOG";
continue;
}
str2 = null;
}
}
private String i()
{
String str1 = getCallingPackage();
if ((getIntent().getExtras() != null) && (("com.facebook.katana".equals(str1)) || ("com.facebook.wakizashi".equals(str1))));
for (String str2 = getIntent().getExtras().getString("calling_package_key"); ; str2 = null)
return str2;
}
private boolean j()
{
AppSession localAppSession = AppSession.a(this, false);
int i = 0;
if (localAppSession != null)
{
AppSession.LoginStatus localLoginStatus1 = localAppSession.i();
AppSession.LoginStatus localLoginStatus2 = AppSession.LoginStatus.STATUS_LOGGED_IN;
i = 0;
if (localLoginStatus1 == localLoginStatus2)
i = 1;
}
return i;
}
protected void a(Bundle paramBundle)
{
BLog.b(n, "onActivityCreate " + paramBundle);
super.a(paramBundle);
if (paramBundle != null)
{
this.o = paramBundle.getString("calling_package");
FbInjector localFbInjector = FbInjector.a(this);
this.q = ((AuthDialogActionExecutorFactory)localFbInjector.a(AuthDialogActionExecutorFactory.class));
this.r = ((ShareDialogActionExecutorFactory)localFbInjector.a(ShareDialogActionExecutorFactory.class));
this.s = ((ComposeDialogActionExecutorFactory)localFbInjector.a(ComposeDialogActionExecutorFactory.class));
if (this.o != null)
break label125;
ErrorReporting.a("sso", "getCallingPackage==null; finish() called. see t1118578", true);
b("The calling package was null");
}
while (true)
{
return;
this.o = i();
break;
label125: this.p = a(getIntent());
if (this.p == null)
continue;
BLog.b(n, "Starting UI or Login screen");
if (!j())
{
LoginActivity.c(this);
continue;
}
this.p.a(paramBundle);
}
}
public void b(Bundle paramBundle)
{
d(paramBundle);
}
public void c(Bundle paramBundle)
{
e(paramBundle);
}
protected void d(Bundle paramBundle)
{
a(true, paramBundle);
}
protected void e(Bundle paramBundle)
{
a(false, paramBundle);
}
protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
{
BLog.b(n, "onActivityResult");
switch (paramInt1)
{
default:
this.p.a(paramInt1, paramInt2, paramIntent);
case 2210:
}
while (true)
{
return;
if (paramInt2 == 0)
{
e(AuthorizeAppResults.a("User canceled login"));
continue;
}
this.p.a(null);
}
}
protected void onDestroy()
{
BLog.b(n, "onDestroy");
super.onDestroy();
if (this.p != null)
this.p.D();
}
protected void onSaveInstanceState(Bundle paramBundle)
{
BLog.b(n, "onSaveInstanceState");
super.onSaveInstanceState(paramBundle);
paramBundle.putString("calling_package", this.o);
if (this.p != null)
this.p.e(paramBundle);
}
}
/* Location: /data1/software/jd-gui/com.facebook.katana_2.0_liqucn.com-dex2jar.jar
* Qualified Name: com.facebook.katana.platform.PlatformWrapperActivity
* JD-Core Version: 0.6.0
*/ | [
"macluz@msn.com"
] | macluz@msn.com |
05cd1dcd56a1080a65dec69186122f59b065a5ef | b2dd36dde592e75701b6f44bbc0d4d262e4c6422 | /ace/ace-live/ace-live-web/target/tomcat/work/localEngine/localhost/live/org/apache/jsp/dynamic/common/footer_002d2_jsp.java | 38081e2ed9b3fd5d313295196f566637d5a54dbd | [] | no_license | marswon/ace | 1257f8f7160115f3d8d0a312443d650b015537dc | a75ccdb02644e98c5953e8157250d81280b1f62c | refs/heads/master | 2020-03-11T02:25:22.244394 | 2018-04-16T07:04:46 | 2018-04-16T07:04:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,697 | java | package org.apache.jsp.dynamic.common;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class footer_002d2_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
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("\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\"\n");
out.write("\thref=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${portalPath}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("/content/common/js/jquery-easyui-1.3.6/themes/gray/easyui.css?version=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${cfg.version}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\">\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\"\n");
out.write("\thref=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${portalPath}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("/content/common/js/jquery-easyui-1.3.6/themes/icon.css?version=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${cfg.version}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\">\n");
out.write("<script type=\"text/javascript\"\n");
out.write("\tsrc=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${portalPath}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("/content/common/js/jquery-easyui-1.3.6/gz/jquery.easyui.min.js?version=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${cfg.version}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\"></script>\n");
out.write("<script type=\"text/javascript\"\n");
out.write("\tsrc=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${portalPath}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("/content/common/js/jquery-easyui-1.3.6/locale/easyui-lang-zh_CN.js?version=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${cfg.version}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\"></script>\t\n");
out.write("\t\n");
out.write("<script type=\"text/javascript\"\n");
out.write("\tsrc=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${portalPath}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("/content/common/js/jquery.form.js?version=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${cfg.version}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\"></script>\n");
out.write("<script type=\"text/javascript\"\n");
out.write("\tsrc=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${portalPath}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("/content/common/js/authority.js?version=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${cfg.version}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("\"></script>\n");
out.write("\n");
} catch (Throwable t) {
if (!(t instanceof 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);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"249134995@qq.com"
] | 249134995@qq.com |
5deac7eeb6ae50a9a698b5463baca1ab417d7eba | ee7e3493b1c3857c83f0a23f61803c1d86f7dd43 | /src/main/java/xyz/mizan/springbootsecurity/boot/service/package-info.java | 3a57c32a7eee6c303e0c1b44b2ca8044f53fbed1 | [] | no_license | kmmizanurrahmanjp/spring-boot-security | 2a48807dced0d23bafcc7e75f57f6a6678b40e60 | c49d48f679223c44b9974c5c83f1044cbdfa3204 | refs/heads/master | 2020-04-02T23:01:55.423243 | 2018-10-29T17:00:29 | 2018-10-29T17:00:29 | 154,853,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | /**
*
*/
/**
* @author lenovo
*
*/
package xyz.mizan.springbootsecurity.boot.service; | [
"https.mizan@gmail.com"
] | https.mizan@gmail.com |
078447b0fa2fb7b08aeef47e951d44255c1ffe35 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_1c01ecdc8bdb26db006a9e7fca946214d646ed8b/ImageLayer/8_1c01ecdc8bdb26db006a9e7fca946214d646ed8b_ImageLayer_s.java | c5365bfe5b2263d3707a183718cc5010ef11e0ba | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,409 | java | package net.coobird.paint.image;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import net.coobird.paint.BlendingMode;
/*************************
* TODO Clean up this class!!
*/
/**
* Represents a image layer within the Untitled Image Manipulation Application
* @author coobird
*
*/
public class ImageLayer
{
private static final int THUMBNAIL_SCALE = 8;
private static final int DEFAULT_IMAGE_TYPE = BufferedImage.TYPE_INT_ARGB;
public static int getDefaultType()
{
return DEFAULT_IMAGE_TYPE;
}
private BufferedImage image;
private BufferedImage thumbImage;
private Graphics2D g;
private String caption;
private boolean visible;
{
visible = true;
}
// TODO
// Location of ImageLayer wrt some origin
private int x;
private int y;
private int width;
private int height;
private float alpha = 1.0f;
private BlendingMode mode = BlendingMode.LAYER_NORMAL;
/**
* ImageLayer must be constructed with a width and height parameter.
* TODO fix this javadoc:
* @see ImageLayer(int,int)
*/
@SuppressWarnings("unused")
private ImageLayer() {};
public ImageLayer(BufferedImage image)
{
initInstance();
setImage(image);
thumbImage = new BufferedImage(
this.width / THUMBNAIL_SCALE,
this.height / THUMBNAIL_SCALE,
DEFAULT_IMAGE_TYPE
);
renderThumbnail();
}
/**
* Instantiate a new ImageLayer.
* @param width The width of the ImageLayer.
* @param height The height of the ImageLayer.
*/
public ImageLayer(int width, int height)
{
initInstance();
image = new BufferedImage(
width,
height,
DEFAULT_IMAGE_TYPE
);
setImage(image);
thumbImage = new BufferedImage(
width / THUMBNAIL_SCALE,
height / THUMBNAIL_SCALE,
DEFAULT_IMAGE_TYPE
);
renderThumbnail();
}
/**
* Creates a thumbnail image
*/
private void renderThumbnail()
{
// TODO
//@resize "image" to "thumbImage"
Graphics2D g = thumbImage.createGraphics();
g.drawImage(image,
0,
0,
thumbImage.getWidth(),
thumbImage.getHeight(),
null
);
g.dispose();
}
/**
* Updates the state of the ImageLayer
*/
public void update()
{
// Perform action to keep imagelayer up to date
// Here, renderThumbnail to synch the image and thumbImage representation
renderThumbnail();
}
/**
* Initializes the instance of ImageLayer.
*/
private void initInstance()
{
this.x = 0;
this.y = 0;
this.setCaption("Untitled Layer");
}
/**
* TODO
* @return
*/
public Graphics2D getGraphics()
{
return g;
}
/**
* Checks if this ImageLayer is set as visible.
* @return The visibility of this ImageLayer.
*/
public boolean isVisible()
{
return visible;
}
/**
* @return the image
*/
public BufferedImage getImage()
{
return image;
}
/**
* @param image the image to set
*/
public void setImage(BufferedImage image)
{
/*
* If the type of the given BufferedImage is not the DEFAULT_IMAGE_TYPE,
* then create a new BufferedImage with the DEFAULT_IMAGE_TYPE, and
* draw the given image onto the new BufferedImage.
*/
if (image.getType() == DEFAULT_IMAGE_TYPE)
{
this.image = image;
this.width = image.getWidth();
this.height = image.getHeight();
this.g = image.createGraphics();
}
else
{
this.width = image.getWidth();
this.height = image.getHeight();
this.image = new BufferedImage(
this.width,
this.height,
DEFAULT_IMAGE_TYPE
);
this.g = this.image.createGraphics();
g.drawImage(image, 0, 0, null);
}
}
/**
* @return the thumbImage
*/
public BufferedImage getThumbImage()
{
return thumbImage;
}
/**
* @param thumbImage the thumbImage to set
*/
public void setThumbImage(BufferedImage thumbImage)
{
this.thumbImage = thumbImage;
}
/**
* Sets the visibility of this ImageLayer.
* @param visible The visibility of this ImageLayer.
*/
public void setVisible(boolean visible)
{
this.visible = visible;
}
/**
* Returns the caption of the ImageLayer.
* @return The caption of the ImageLayer.
*/
public String getCaption()
{
return caption;
}
/**
* Sets the caption of the ImageLayer.
* @param caption The caption to set the ImageLayer to.
*/
public void setCaption(String caption)
{
this.caption = caption;
}
/**
* Returns the width of the ImageLayer.
* @return The width of the ImageLayer.
*/
public int getWidth()
{
return image.getWidth();
}
/**
* Returns the height of the ImageLayer.
* @return The height of the ImageLayer.
*/
public int getHeight()
{
return image.getHeight();
}
/**
* @return the x
*/
public int getX()
{
return x;
}
/**
* @param x the x to set
*/
public void setX(int x)
{
this.x = x;
}
/**
* @return the y
*/
public int getY()
{
return y;
}
/**
* @param y the y to set
*/
public void setY(int y)
{
this.y = y;
}
/**
* Sets the ImageLayer offset.
* @param x
* @param y
*/
public void setLocation(int x, int y)
{
this.x = x;
this.y = y;
}
/**
* @return the alpha
*/
public float getAlpha()
{
return alpha;
}
/**
* @param alpha the alpha to set
*/
public void setAlpha(float alpha)
{
this.alpha = alpha;
}
/**
* @return the mode
*/
public BlendingMode getMode()
{
return mode;
}
/**
* @param mode the mode to set
*/
public void setMode(BlendingMode mode)
{
this.mode = mode;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
String msg = "Image Layer: " + this.caption +
", x: " + this.x + ", y: " + this.y +
", width: " + this.width + ", height: " + this.height;
return msg;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
6ffb9dbd9f213938de09b75a5e5f379428e1b7cd | beede3370b36f14dd8151cdd165fdd42105ef594 | /app/src/main/java/ru/electronim/msuc/ListViewAdapterForWorkToday.java | 1a2aca58bce5895d99a105105a5dde2c8905a629 | [] | no_license | reffren/2016_msdp | 9d0656052302860c2e8b370ad5c7f5f80b50f960 | d81cbc32d1cc856428cc685f39868579eb309dcb | refs/heads/master | 2020-04-06T03:57:56.016748 | 2017-02-27T22:55:26 | 2017-02-27T22:55:43 | 83,083,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,534 | java | package ru.electronim.msuc;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
/**
* Created by Tim on 20.01.2016.
*/
public class ListViewAdapterForWorkToday extends ListViewAdapterForWork {
ArrayList<Integer> arrayListID = new ArrayList<Integer>();
public ListViewAdapterForWorkToday(Context context, Cursor c, int flags) {
super(context, c, flags);
}
public View newView(Context context, Cursor cursor, ViewGroup parent) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View view = layoutInflater.inflate(R.layout.fill_for_work_list_today, parent, false);
return view;
}
public void bindView(View view, Context context, Cursor cursor) {
final Context cont = context;
workName = (TextView) view.findViewById(R.id.workName);
workTime = (TextView) view.findViewById(R.id.workTime);
final String name = cursor.getString(cursor.getColumnIndex("work_name"));
final String time = cursor.getString(cursor.getColumnIndex("work_time"));
final int id = cursor.getInt(cursor.getColumnIndex("_id"));
arrayListID.add(id); // передаем в WorkTodayActivity и затем в слушатель ListView (определяем нажатие по id)
workName.setText(name);
workTime.setText(time);
}
}
| [
"emailtotimur@gmail.com"
] | emailtotimur@gmail.com |
c57cd8f362e9596ef71f8bd1ce99412c842ebc0f | 517dfd08ed6e957d201cf0fe2160b3c41a30d517 | /TP5_Autowired/src/main/java/Application.java | aae28c526aab6bad488eb52fa69fe450d098c034 | [] | no_license | jeanyvesruffin/SPRING | c23fdf5db6adbe449735c71c65d2c4c17e65246a | 51535cacfecb60f54b48362e778b4b1f9db835ad | refs/heads/master | 2021-07-14T02:10:24.975340 | 2020-06-23T13:54:46 | 2020-06-23T13:54:46 | 173,896,193 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 744 | java |
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import com.ruffin.service.SpeakerServiceImpl;
public class Application {
public static void main(String[] args) {
@SuppressWarnings("resource")
ApplicationContext appContext = new AnnotationConfigApplicationContext(AppConfig.class);
SpeakerServiceImpl serviceSingleton1 = appContext.getBean("speakerService", SpeakerServiceImpl.class);
// A l'aide de l'autowired et du System.out.println ()
// Nous pouvons constater comment est crée le constructeur au demarrage
System.out.println(serviceSingleton1);
System.out.println(serviceSingleton1.findAll().get(0).getFirstName());
}
}
| [
"ruffinmax@hotmail.fr"
] | ruffinmax@hotmail.fr |
3ed72b085cd8333f40d9df7df7e923aa87812414 | ab3b50ba1ecef6dbc0072158d09df5d66f207788 | /src/main/java/ru/geekbrains/demo/repository/UserRepository.java | 0c48934a01688d03df3bf9f1a1e6788bfb63d57e | [] | no_license | IgorTribul/geekbrains-spring-jdbc | bfe8c1af81e3c8122f7fba14f41c376769eba917 | 89db3ce2ba9f13f11cf64c1f2697f4b4a872faf9 | refs/heads/master | 2022-12-26T16:52:00.291269 | 2020-10-12T21:28:06 | 2020-10-12T21:28:06 | 303,516,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package ru.geekbrains.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import ru.geekbrains.demo.model.User;
import java.util.List;
public interface UserRepository extends JpaRepository<User, Long>{
List<User> findAllByAgeBetween(int min, int max);
List<User> deleteUsersByName(String name);
}
| [
"igor_tt@rambler.ru"
] | igor_tt@rambler.ru |
286d0189674415b7c0582b14606a1ca9ac76c232 | bfd1d439a04d2f1f84befb98ff8c445180248c4a | /app/src/main/java/com/feitianzhu/huangliwo/shop/adapter/ServeOrderAdapter.java | 25ce6dbd60d3d4569934836190022174a5e74ff0 | [
"Apache-2.0"
] | permissive | cliangtime/huangliwo_android | 29e0b1c0d3f4875879d7cf45dc259ff309a9de40 | 662fdd4586d4a9ef9c286055fbb567b1e9185261 | refs/heads/master | 2022-10-28T12:39:56.989273 | 2020-06-18T05:41:45 | 2020-06-18T05:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,409 | java | package com.feitianzhu.huangliwo.shop.adapter;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseViewHolder;
import com.feitianzhu.huangliwo.R;
import com.feitianzhu.huangliwo.common.base.SFBaseAdapter;
import com.feitianzhu.huangliwo.model.ServeOrderModel;
import java.util.List;
/**
* Created by Administrator on 2017/8/28 0028.
*/
public class ServeOrderAdapter extends SFBaseAdapter<ServeOrderModel.ListBean, BaseViewHolder> {
public ServeOrderAdapter(@Nullable List<ServeOrderModel.ListBean> data) {
super(R.layout.item_serve_order_view, data);
}
@Override protected void convert(BaseViewHolder mBaseViewHolder, ServeOrderModel.ListBean mShopTypeModel) {
ImageView mView = mBaseViewHolder.getView(R.id.item_icon);
Glide.with(mContext).load(mShopTypeModel.service.adImg)
.apply(RequestOptions.placeholderOf(R.mipmap.pic_fuwutujiazaishibai).dontAnimate())
.into(mView);
mBaseViewHolder.setText(R.id.item_name,mShopTypeModel.service.serviceName+"");
mBaseViewHolder.setText(R.id.item_time,mShopTypeModel.createDate+"");
mBaseViewHolder.setText(R.id.item_money,"¥"+mShopTypeModel.amount+"");
mBaseViewHolder.setText(R.id.item_fanli,"¥"+mShopTypeModel.rebatePv+"");
}
}
| [
"694125155@qq.com"
] | 694125155@qq.com |
a064992031d006cac25edab6cb2e0c23c25c3bcb | bc55d7d928d3c6ba0dc72cdc969c3e69427d9f2d | /app/src/main/java/com/example/tryretrofitlogin/adapter/Lelbyhwburungadapt.java | 3e3f6359beed1c31b686c327ef75cecadf818844 | [] | no_license | galangsur/TryRetrofitLogin | c4bce48190063428b5458acb4c977c276258cd62 | 62d0b87a05dabd04ebc973e0027c3c5711327380 | refs/heads/master | 2023-06-28T18:18:11.580744 | 2021-08-04T09:33:57 | 2021-08-04T09:33:57 | 256,243,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,017 | java | package com.example.tryretrofitlogin.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.tryretrofitlogin.R;
import com.example.tryretrofitlogin.activity.DetailLelangActivity;
import com.example.tryretrofitlogin.getresponse.getLelangbyHewanResponse.SuccessItem;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Locale;
public class Lelbyhwburungadapt extends RecyclerView.Adapter<Lelbyhwburungadapt.LelBurungViewHolder> {
ArrayList<SuccessItem> getburungresult;
Context burungcontext;
private int hargaburung;
public Lelbyhwburungadapt(Context burungcontext, ArrayList<SuccessItem> getburungresult){
super();
this.burungcontext = burungcontext;
this.getburungresult = getburungresult;
}
@NonNull
@Override
public LelBurungViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View view = inflater.inflate(R.layout.lelbyhewanburung_layout,parent,false);
return new LelBurungViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull LelBurungViewHolder holder, final int position) {
holder.lelburungid.setText(getburungresult.get(position).getId());
hargaburung = getburungresult.get(position).getHarga();
//ubahformat Rp.
Locale localID = new Locale("in","ID");
NumberFormat formatRupiah = NumberFormat.getCurrencyInstance(localID);
holder.lelburungharga.setText(formatRupiah.format((double)hargaburung));
holder.lelburungcomment.setText(getburungresult.get(position).getComment());
holder.btndetlelburung.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent burungleldet = new Intent(burungcontext, DetailLelangActivity.class);
burungleldet.putExtra("lelid",getburungresult.get(position).getId());
burungcontext.startActivity(burungleldet);
}
});
}
@Override
public int getItemCount() {
return getburungresult.size();
}
public class LelBurungViewHolder extends RecyclerView.ViewHolder {
TextView lelburungid, lelburungharga, lelburungcomment;
ImageView btndetlelburung;
public LelBurungViewHolder(@NonNull View itemView) {
super(itemView);
lelburungid = itemView.findViewById(R.id.idburung);
lelburungharga = itemView.findViewById(R.id.hargaburung);
lelburungcomment = itemView.findViewById(R.id.commentburung);
btndetlelburung = itemView.findViewById(R.id.btn_detailburung);
}
}
}
| [
"galang221b@gmail.com"
] | galang221b@gmail.com |
d8e3eddda8bfc9cd3515cea2c7cd5aafd206037c | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project35/src/main/java/org/gradle/test/performance35_3/Production35_255.java | 2f93c0972b8febcebe63cfe32eaa5999042bdd4d | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance35_3;
public class Production35_255 extends org.gradle.test.performance12_3.Production12_255 {
private final String property;
public Production35_255() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
7f93289c9629f81b7f2d55b2e0734a4657e3370e | 2bbe916e09670674397ff0eba62e20ee1b408eb3 | /src/Java_15/TestCricle.java | 6f769a5a6311b3795319c79824d9025360d8c3f2 | [] | no_license | tuanpth1909/P_Tuan_Java | 694530a8227b18ec2d9a8d28a1be6a3c6af125aa | d793e6b6d0933d187b78322573fc958f2a98a658 | refs/heads/master | 2021-03-20T14:22:47.423467 | 2020-04-28T03:01:01 | 2020-04-28T03:01:01 | 247,213,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,671 | java | //package Java_15;
//
//public class TestCircle {
// public static void main(String[] args) {
// // Test Constructors and toString()
// Circle c1 = new Circle();
// System.out.println(c1); // Circle's toString()
// Circle c2 = new Circle(1, 2, 3.3);
// System.out.println(c2); // Circle's toString()
// Circle c3 = new Circle(new Point(4, 5), 6.6); // an anonymous Point instance
// System.out.println(c3); // Circle's toString()
//
// // Test Setters and Getters
// c1.setCenter(new Point(11, 12));
// c1.setRadius(13.3);
// System.out.println(c1); // Circle's toString()
// System.out.println("center is: " + c1.getCenter()); // Point's toString()
// System.out.println("radius is: " + c1.getRadius());
//
// c1.setCenterX(21);
// c1.setCenterY(22);
// System.out.println(c1); // Circle's toString()
// System.out.println("center's x is: " + c1.getCenterX());
// System.out.println("center's y is: " + c1.getCenterY());
// c1.setCenterXY(31, 32);
// System.out.println(c1); // Circle's toString()
// System.out.println("center's x is: " + c1.getCenterXY()[0]);
// System.out.println("center's y is: " + c1.getCenterXY()[1]);
//
// // Test getArea() and getCircumference()
// System.out.printf("area is: %.2f%n", c1.getArea());
// System.out.printf("circumference is: %.2f%n", c1.getCircumference());
//
// // Test distance()
// System.out.printf("distance is: %.2f%n", c1.distance(c2));
// System.out.printf("distance is: %.2f%n", c2.distance(c1));
// }
//}
| [
"60849085+tuanpth1909@users.noreply.github.com"
] | 60849085+tuanpth1909@users.noreply.github.com |
f31d3be9a4331516904c6e07effc3a7fa1476912 | e5c911145590bf6b5b08d8445e6626dcf9c0ce42 | /src/test/java/ru/job4j/pooh_jms/TopicTest.java | c31fc3991c78ed4b9ca6e7e89bf65a550875a552 | [] | no_license | i3acsi/job4j-middle | b31b336e078b36aefb34cbbc2da3dc11f18382d6 | f6f83bb6c45719a5cdec7a684817c01c7308a7cd | refs/heads/master | 2023-04-09T20:28:18.072110 | 2021-04-16T18:36:37 | 2021-04-16T18:36:37 | 294,595,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,124 | java | package ru.job4j.pooh_jms;
import org.junit.Assert;
import org.junit.Test;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.function.BiConsumer;
import java.util.function.Supplier;
import static ru.job4j.pooh_jms.Tools.assertJson;
import static ru.job4j.pooh_jms.Tools.getRandomTopic;
public class TopicTest {
private boolean inProcess = true;
private static Random random = new Random();
private final Runnable startServer = () -> {
Iterator<String> iteratorServer = List.of("", "", "", "", "", "", "", "", "", "", "", "").iterator();
Supplier<String> inputServer = () -> {
if (iteratorServer.hasNext()) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return iteratorServer.next();
}
inProcess = false;
return "stop";
};
JmsServer.startServer(inputServer);
};
private final Runnable subscriberTask = () -> {
Iterator<String> iteratorSub = List.of("weather", "city", "", "", "", "", "", "", "", "", "", "", "weather", "", "", "").iterator();
Supplier<String> inputSub = () -> {
String res = "";
while (res.equals("")) {
if (iteratorSub.hasNext()) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
res = iteratorSub.next();
} else {
res = "stop";
}
}
return res;
};
BiConsumer<String, SocketConnection> requestProcessor = (response, connection) -> isCorrectResponse(response);
Subscriber.startSubscriber(inputSub, requestProcessor, false);
};
private final Runnable postTask = () -> {
Supplier<String> inputPub = () -> {
try {
Thread.sleep(800);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (random.nextInt(100) < 95) {
return getRandomTopic.get().toString();
} else {
return "stop";
}
};
BiConsumer<String, SocketConnection> processRequest = (response, connection) -> isCorrectResponse(response);
Publisher.startPublisher(inputPub, processRequest, false);
};
@Test
public void postGetTopicTest() throws InterruptedException {
Thread server = new Thread(startServer);
Thread sub = new Thread(subscriberTask);
Thread pub = new Thread(postTask);
server.start();
sub.start();
pub.start();
while (inProcess) {
Thread.sleep(1000);
}
}
private static void isCorrectResponse(String response) {
Assert.assertEquals("POST /topic", response.lines().findFirst().orElseThrow());
assertJson(response, true);
}
}
| [
"gasevskyv@gmail.com"
] | gasevskyv@gmail.com |
7b15461da3bc5ccfd43ba172ab3e60929d52f36d | 823a6fc581cb0d1857083de8270e9ab21ba6708e | /src/com/vince/demo/mediator/colleague/Purchase.java | 7155b9b0f63c7dc6c30af54e320e94ceae747853 | [] | no_license | zouqinjia/design-pattern | 0463384e989e045a1232d218817319f2091ccbc4 | 0fa6222d1809a7501159c04b218a0c70fa25e5b8 | refs/heads/master | 2021-07-03T04:28:53.634088 | 2020-08-18T13:15:30 | 2020-08-18T13:15:30 | 135,042,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package com.vince.demo.mediator.colleague;
import com.vince.demo.mediator.mediator.AbstractMediator;
/**
* colleague
*/
public class Purchase extends AbstractColleague{
public Purchase(AbstractMediator abstractMediator) {
super(abstractMediator);
}
public void buyIBMComputer(int number){
super.abstractMediator.execute("purchase.buy",number);
}
public void refuseBuyIBM(){
System.out.println("不要再采购IBM电脑");
}
}
| [
"zouqinjia@163.com"
] | zouqinjia@163.com |
53f27ea52e1f61aa4c785981188fb7b7d8e2d543 | d490e90c7784dbf952bcf85027e4dded8453e6f9 | /FileConverterApi/src/main/java/com/kryptow/fileConverterapi/tools/FileBaseName.java | 399732fb13e05cdc413f019cc80452311579c7ee | [] | no_license | onuraykut/fileConverterApi | 919a239c08bdcaba2ac25eb4851a60bbeab1ac87 | f21f617fc176511466789245d76ac48ccb94d8b0 | refs/heads/master | 2023-05-04T23:25:58.966234 | 2021-05-22T06:48:51 | 2021-05-22T06:48:51 | 334,456,803 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package com.kryptow.fileConverterapi.tools;
public class FileBaseName {
public static String getBaseName(String fileName) {
int index = fileName.lastIndexOf('.');
if (index == -1) {
return fileName;
} else {
return fileName.substring(0, index);
}
}
public static String getUniqName(String fileName,int count) {
int index = fileName.lastIndexOf('.');
if (index == -1) {
return fileName;
} else {
return fileName.substring(0, index) + "-" + count + fileName.substring(index, fileName.length());
}
}
}
| [
"onuraykut@outlook.com"
] | onuraykut@outlook.com |
51fd10e747a8346ddf43124cf7cb6b46fffee326 | 786210736d40715f28b1bbd1b9c275afae3bf20e | /Karaok/src/com/karaok/note/Model.java | 96735cc6de93ab406a25ba276b77660856a41759 | [] | no_license | kosta130/karaok | b40aec9223b44e6486a90a8cfb19e8a90e6913de | 733be42db236e893e8d574800f6f56273c9991fa | refs/heads/master | 2021-01-11T01:37:47.040496 | 2016-11-04T08:11:49 | 2016-11-04T08:11:49 | 70,682,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 55 | java | package com.karaok.note;
public class Model {
}
| [
"SungWook@192.168.0.116"
] | SungWook@192.168.0.116 |
0a9e401bc21e3381ce75407993a61682c63a1dec | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/kylin/learning/4524/AclPermissionFactory.java | 49015984c13d2983b5f9699181d65662a6143bb3 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,034 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kylin.rest.security;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.acls.domain.DefaultPermissionFactory;
import org.springframework.security.acls.model.Permission;
/**
* @author xduo
*
*/
public class AclPermissionFactory extends DefaultPermissionFactory {
public AclPermissionFactory() {
super();
registerPublicPermissions(AclPermission.class);
}
public static List<Permission> getPermissions() {
List<Permission> permissions = new ArrayList<Permission>();
Field[] fields = AclPermission.class.getFields();
for (Field field : fields) {
try {
Object fieldValue = field.get(null);
if (Permission.class.isAssignableFrom(fieldValue.getClass())) {
Permission perm = (Permission) fieldValue;
String permissionName = field.getName();
if (permissionName.equals(AclPermissionType.ADMINISTRATION)
|| permissionName.equals(AclPermissionType.MANAGEMENT )
|| permissionName.equals(AclPermissionType.OPERATION)
|| permissionName.equals(AclPermissionType.READ)) {
// Found a Permission static field
permissions.add(perm);
}
}
} catch (Exception ignore) {
//ignore on purpose
}
}
return permissions;
}
public static Permission getPermission(String perName) {
Field[] fields = AclPermission.class.getFields();
for (Field field : fields) {
try {
Object fieldValue = field.get(null);
if (Permission.class.isAssignableFrom(fieldValue.getClass())) {
// Found a Permission static field
if (perName.equals(field.getName())) {
return (Permission) fieldValue;
}
}
} catch (Exception ignore) {
//ignore on purpose
}
}
return null;
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
64334cfd85cc413f9c5925886a9095d60215f978 | ef0c039e27f173a3aa4e82ab4e26edc93f9e28e0 | /bazel/testSrc/com/android/tools/gradle/ProfilerToBenchmarkAdapter.java | dbec8dab6f72aec3548b11135251b9d396cba15a | [] | no_license | ggaier/android_platform_tools_base | 1091a25aa220665d7eb02481426f4941d0fedd18 | 85c6b73c22cd23c069d94eb19c824d4fb74a5ec9 | refs/heads/master | 2020-09-17T11:33:48.674204 | 2019-11-26T02:43:12 | 2019-11-26T02:43:12 | 224,085,780 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 14,290 | java | /*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.gradle;
import com.android.annotations.NonNull;
import com.android.tools.build.gradle.internal.profile.GradleTaskExecutionType;
import com.android.tools.build.gradle.internal.profile.GradleTransformExecutionType;
import com.android.tools.perflogger.Analyzer;
import com.android.tools.perflogger.Benchmark;
import com.android.tools.perflogger.Metric;
import com.android.tools.perflogger.WindowDeviationAnalyzer;
import com.google.wireless.android.sdk.stats.GarbageCollectionStats;
import com.google.wireless.android.sdk.stats.GradleBuildMemorySample;
import com.google.wireless.android.sdk.stats.GradleBuildProfile;
import com.google.wireless.android.sdk.stats.GradleBuildProfileSpan;
import com.google.wireless.android.sdk.stats.GradleBuildProfileSpan.ExecutionType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.logging.Logger;
/**
* Translates a {@link com.google.wireless.android.sdk.stats.GradleBuildProfileSpan} into a {link
* Metric} map.
*/
public class ProfilerToBenchmarkAdapter {
private static final Logger LOGGER =
Logger.getLogger(ProfilerToBenchmarkAdapter.class.getName());
private static final EnumSet<ExecutionType> CONFIGURATION_TYPES =
EnumSet.of(
ExecutionType.BASE_PLUGIN_PROJECT_CONFIGURE,
ExecutionType.BASE_PLUGIN_PROJECT_BASE_EXTENSION_CREATION,
ExecutionType.BASE_PLUGIN_PROJECT_TASKS_CREATION,
ExecutionType.TASK_MANAGER_CREATE_TASKS,
ExecutionType.BASE_PLUGIN_CREATE_ANDROID_TASKS);
@NonNull private final Benchmark benchmark;
@NonNull private final BenchmarkRun benchmarkRun;
@NonNull private final Map<String, Metric> metrics;
@NonNull
private static final Analyzer DEFAULT_ANALYZER =
new WindowDeviationAnalyzer.Builder()
.setMetricAggregate(Analyzer.MetricAggregate.MEDIAN)
.setRunInfoQueryLimit(50)
.setRecentWindowSize(25)
.addMedianTolerance(
new WindowDeviationAnalyzer.MedianToleranceParams.Builder()
// const term of 10.0 ms to ignore regressions in trivial tasks
.setConstTerm(10.0)
// recommended value
.setMadCoeff(1.0)
// flag 10% regressions
.setMedianCoeff(0.10)
.build())
.addMeanTolerance(
new WindowDeviationAnalyzer.MeanToleranceParams.Builder()
// const term of 10.0 ms to ignore regressions in trivial tasks
.setConstTerm(10.0)
// recommended value
.setStddevCoeff(1.0)
// flag 10% regressions
.setMeanCoeff(0.10)
.build())
.build();
@NonNull
private static final Analyzer MIN_ANALYZER =
new WindowDeviationAnalyzer.Builder()
.setMetricAggregate(Analyzer.MetricAggregate.MIN)
.setRunInfoQueryLimit(50)
.setRecentWindowSize(25)
.addMedianTolerance(new WindowDeviationAnalyzer.MedianToleranceParams.Builder()
// constant term of 10.0 ms to ignore regressions in trivial tasks
.setConstTerm(10.0)
// recommended value
.setMadCoeff(1.0)
// flag 10% regressions
.setMedianCoeff(0.10)
.build())
.build();
@NonNull
private static final List<String> MIN_ANALYZER_METRICS =
Arrays.asList("DEX_MERGER", "DEX_MERGING", "EXTERNAL_LIBS_MERGER");
@NonNull
private final List<ConsolidatedRunTimings> consolidatedTimingsPerIterations = new ArrayList<>();
public ProfilerToBenchmarkAdapter(
@NonNull Benchmark benchmark, @NonNull BenchmarkRun benchmarkRun) {
this.benchmark = benchmark;
this.benchmarkRun = benchmarkRun;
metrics = new HashMap<>();
final int upperLimit =
benchmarkRun.iterations
- (benchmarkRun.removeUpperOutliers + benchmarkRun.removeLowerOutliers);
if (upperLimit < benchmarkRun.removeLowerOutliers || benchmarkRun.removeLowerOutliers < 0) {
throw new RuntimeException(
String.format(
"Invalid upper (%d) and/or lower (%d) outliers removal settings",
benchmarkRun.removeLowerOutliers, benchmarkRun.removeUpperOutliers));
}
}
@SuppressWarnings("MethodMayBeStatic")
public void adapt(long iterationStartTime, @NonNull GradleBuildProfile profile) {
consolidatedTimingsPerIterations.add(
new ConsolidatedRunTimings(
iterationStartTime,
profile.getBuildTime(),
getGcTime(profile),
consolidate(profile, isTask, (it) -> it.getTask().getType()),
consolidate(profile, isTransform, (it) -> it.getTransform().getType()),
consolidate(profile, isConfiguration, (it) -> it.getType().getNumber())));
}
public void commit() {
Metric totalBuildTime = new Metric("TOTAL_BUILD_TIME");
Metric totalGcTime = new Metric("TOTAL_GC_TIME");
consolidatedTimingsPerIterations
.stream()
.sorted(Comparator.comparingLong(ConsolidatedRunTimings::getBuildTime))
.skip(benchmarkRun.removeLowerOutliers)
.limit(
benchmarkRun.iterations
- (benchmarkRun.removeUpperOutliers
+ benchmarkRun.removeLowerOutliers))
.forEach(
consolidatedRunTimings -> {
totalBuildTime.addSamples(
benchmark,
new Metric.MetricSample(
consolidatedRunTimings.startTime,
consolidatedRunTimings.buildTime));
totalGcTime.addSamples(
benchmark,
new Metric.MetricSample(
consolidatedRunTimings.startTime,
consolidatedRunTimings.gcTime));
consolidatedRunTimings.timingsForTasks.forEach(
(type, timing) ->
addMetricSample(
GradleTaskExecutionType.forNumber(type).name(),
consolidatedRunTimings.startTime,
timing));
consolidatedRunTimings.timingsForTransforms.forEach(
(type, timing) ->
addMetricSample(
GradleTransformExecutionType.forNumber(type)
.name(),
consolidatedRunTimings.startTime,
timing));
consolidatedRunTimings.timingsForConfiguration.forEach(
(type, timing) ->
addMetricSample(
ExecutionType.forNumber(type).name(),
consolidatedRunTimings.startTime,
timing));
});
// set analyzers
metrics.values().forEach(it -> setAnalyzers(it, benchmark));
setAnalyzers(totalBuildTime, benchmark);
// commit all metrics
metrics.values().forEach(Metric::commit);
totalBuildTime.commit();
totalGcTime.commit();
}
/**
* Add a metric sample
*
* @param metricName the metric name
* @param utcMs the universal time
* @param timing the duration of the metric for this metric sample
*/
private void addMetricSample(String metricName, long utcMs, long timing) {
Metric metric = metrics.computeIfAbsent(metricName, Metric::new);
metric.addSamples(benchmark, new Metric.MetricSample(utcMs, timing));
LOGGER.info(metricName + " : " + timing);
}
/**
* Set the analyzers for the metric
*
* @param metric the metric whose analyzers are set
* @param benchmark the benchmark for which the metric's analyzers are set
*/
private static void setAnalyzers(Metric metric, Benchmark benchmark) {
if (MIN_ANALYZER_METRICS.contains(metric.getMetricName())) {
metric.setAnalyzers(benchmark, Arrays.asList(MIN_ANALYZER));
} else {
metric.setAnalyzers(benchmark, Arrays.asList(DEFAULT_ANALYZER));
}
}
/**
* Returns the total garbage collection time from a gradle build, in milliseconds.
*
* @param profile the profile information
* @return the total garbage collection time from a gradle build, in milliseconds.
*/
private static long getGcTime(GradleBuildProfile profile) {
long gcTime = 0;
for (GradleBuildMemorySample memorySample : profile.getMemorySampleList()) {
for (GarbageCollectionStats gcStats :
memorySample.getJavaProcessStats().getGarbageCollectionStatsList()) {
if (gcStats.getGcTime() > 0) {
gcTime += gcStats.getGcTime();
}
}
}
return gcTime;
}
/**
* Consolidate all tasks or transforms of the same type under a single value by adding each
* element duration together.
*
* @param profile the profile information
* @param predicate predicate to filter spans from the passed profile
* @param idProvider function to return the id to consolidate a particular task or transform
* type under.
* @return a map of id to consolidated duration.
*/
private static Map<Integer, Long> consolidate(
GradleBuildProfile profile,
Predicate<GradleBuildProfileSpan> predicate,
Function<GradleBuildProfileSpan, Integer> idProvider) {
Map<Integer, Long> consolidatedTimings = new HashMap<>();
profile.getSpanList()
.stream()
.filter(predicate)
.forEach(
it ->
consolidatedTimings.put(
idProvider.apply(it),
consolidatedTimings.getOrDefault(idProvider.apply(it), 0L)
+ it.getDurationInMs()));
return consolidatedTimings;
}
private static final Predicate<GradleBuildProfileSpan> isTransform =
gradleBuildProfileSpan ->
gradleBuildProfileSpan.getType() == ExecutionType.TASK_TRANSFORM;
private static final Predicate<GradleBuildProfileSpan> isTask =
// ignore task type 65 because those are transform tasks, which are accounted for in the
// transform spans.
gradleBuildProfileSpan ->
gradleBuildProfileSpan.getType() == ExecutionType.TASK_EXECUTION
&& gradleBuildProfileSpan.getTask() != null
&& gradleBuildProfileSpan.getTask().getType() != 65;
private static final Predicate<GradleBuildProfileSpan> isConfiguration =
gradleBuildProfileSpan ->
CONFIGURATION_TYPES.contains(gradleBuildProfileSpan.getType());
private static final class ConsolidatedRunTimings {
final long startTime;
final long buildTime;
final long gcTime;
final Map<Integer, Long> timingsForTasks;
final Map<Integer, Long> timingsForTransforms;
final Map<Integer, Long> timingsForConfiguration;
private ConsolidatedRunTimings(
long startTime,
long buildTime,
long gcTime,
Map<Integer, Long> timingsForTasks,
Map<Integer, Long> timingsForTransforms,
Map<Integer, Long> timingsForConfiguration) {
this.startTime = startTime;
this.buildTime = buildTime;
this.gcTime = gcTime;
this.timingsForTasks = timingsForTasks;
this.timingsForTransforms = timingsForTransforms;
this.timingsForConfiguration = timingsForConfiguration;
}
long getBuildTime() {
return buildTime;
}
}
}
| [
"jwenbo52@gmail.com"
] | jwenbo52@gmail.com |
947ff6a421739179587dcf01db98b385ab4a6764 | d97488157ad05c35595404c7a854b08b28927281 | /src/main/java/com/example/emailschedulerwithquartz/dto/RescheduleMinuteDTO.java | 170a20bb0a898ddb70c83f9b9ff958f3b42a6a2f | [] | no_license | kutayyaman/email-scheduler-with-quartz | 70c1d7c2d9f7f875efe61528eccf5552096705d3 | 8ad9f69a8a30b06a3a06bd190bbe90f4e322965d | refs/heads/master | 2023-07-16T01:58:23.490559 | 2021-08-23T12:13:22 | 2021-08-23T12:13:22 | 398,404,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.example.emailschedulerwithquartz.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class RescheduleMinuteDTO {
private String minute;
}
| [
"yamankutay1@gmail.com"
] | yamankutay1@gmail.com |
2a211a9119f818adf2dd149041b71a7050d3e1d8 | 0915b39458bf947a804f25c73304baf8fd96e3c1 | /similarnames2-java/SimilarNames2Test.java | d20714191d4c26764f0e0c0243c3909651cb4515 | [] | no_license | rafalio/topcoder | 28fa2fb33d0565ddaf305cc26193ff49613d10f8 | f1325e248660c006cb2b10502ead2dfaf2c27e4d | refs/heads/master | 2021-01-02T09:07:21.532953 | 2014-09-03T17:08:10 | 2014-09-03T17:08:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,067 | java | import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class SimilarNames2Test {
protected SimilarNames2 solution;
@Before
public void setUp() {
solution = new SimilarNames2();
}
@Test(timeout = 2000)
public void testCase0() {
String[] names = new String[]{"kenta", "kentaro", "ken"};
int L = 2;
int expected = 3;
int actual = solution.count(names, L);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase1() {
String[] names = new String[]{"hideo", "hideto", "hideki", "hide"};
int L = 2;
int expected = 6;
int actual = solution.count(names, L);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase2() {
String[] names = new String[]{"aya", "saku", "emi", "ayane", "sakura", "emika", "sakurako"};
int L = 3;
int expected = 24;
int actual = solution.count(names, L);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase3() {
String[] names = new String[]{"taro", "jiro", "hanako"};
int L = 2;
int expected = 0;
int actual = solution.count(names, L);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase4() {
String[] names = new String[]{"alice", "bob", "charlie"};
int L = 1;
int expected = 6;
int actual = solution.count(names, L);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase5() {
String[] names = new String[]{"ryota", "ryohei", "ryotaro", "ryo", "ryoga", "ryoma", "ryoko", "ryosuke", "ciel", "lun", "ryuta", "ryuji", "ryuma", "ryujiro", "ryusuke", "ryutaro", "ryu", "ryuhei", "ryuichi", "evima"};
int L = 3;
int expected = 276818566;
int actual = solution.count(names, L);
Assert.assertEquals(expected, actual);
}
}
| [
"me@rafal.io"
] | me@rafal.io |
3933d62267321aec444ee50e35038bafaec19c9f | 5f3f46c97bdecaf3b99307c5fcaf2f5e1974555f | /src/main/java/com/ubisys/drone/modules/base/model/SensorConfigTemporary.java | 8df9a4f3df091477e457e36bda58f97c9e7084bc | [] | no_license | shao139772/springboot2WithSecurity | 54bf1a9968887ceee0eb92038b00df7f2108773a | 02dd5d27e548e88dac530cb54eb695f4b55ca2d7 | refs/heads/master | 2020-04-17T06:39:44.608688 | 2019-01-18T03:05:21 | 2019-01-18T03:05:21 | 166,334,162 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | package com.ubisys.drone.modules.base.model;
import java.io.Serializable;
import java.util.List;
public class SensorConfigTemporary implements Serializable {
/**
* 暂时保留,创建时间
*/
/*@JSONField(name = "attacking")
private boolean attacking;*/
private String build_time;
/**
* 暂时保留
*/
/*@JSONField(name = "can_attack")
private boolean canAttack;*/
private float df_deflection;
/**
* 暂时保留
*/
/*@JSONField(name = "attacking")
private boolean attacking;*/
private String engine_ip;
/**
* 暂时保留
*/
/*@JSONField(name = "can_attack")
private boolean canAttack;*/
private Integer engine_port;
/**
* 暂时保留,站点名称
*/
/*@JSONField(name = "attacking")
private boolean attacking;*/
private List<SensorConfigGeoTemporary> geo_location;
public String getBuild_time() {
return build_time;
}
public void setBuild_time(String build_time) {
this.build_time = build_time;
}
public float getDf_deflection() {
return df_deflection;
}
public void setDf_deflection(float df_deflection) {
this.df_deflection = df_deflection;
}
public String getEngine_ip() {
return engine_ip;
}
public void setEngine_ip(String engine_ip) {
this.engine_ip = engine_ip;
}
public Integer getEngine_port() {
return engine_port;
}
public void setEngine_port(Integer engine_port) {
this.engine_port = engine_port;
}
public List<SensorConfigGeoTemporary> getGeo_location() {
return geo_location;
}
public void setGeo_location(List<SensorConfigGeoTemporary> geo_location) {
this.geo_location = geo_location;
}
@Override
public String toString() {
return "SensorConfigTemporary{" +
"build_time=" + build_time +
", df_deflection='" + df_deflection + '\'' +
", engine_ip=" + engine_ip +
", engine_port='" + engine_port + '\'' +
", geo_location=" + geo_location +
'}';
}
}
| [
"1223602751@qq.com"
] | 1223602751@qq.com |
f3ae19ee00b725d463ca9213d29e971358c65055 | 7d9946e5ae996e226f97cfcae9737c827d20aa08 | /src/main/java/com/example/lucklymoney/form/UserForm.java | 60bc025705a6604f9ff83fedf816f3979cec62ad | [] | no_license | Yyang2009/springBoot | 6f2657030a76737b3ae450820562782a03db6ec4 | f2970f98cc2909dca51b1885f745a6744603c21b | refs/heads/master | 2022-06-21T18:27:03.825361 | 2019-12-11T08:10:00 | 2019-12-11T08:10:00 | 224,656,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package com.example.lucklymoney.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhusidao855
* @date 2019/12/6
*/
@Data
@ApiModel
public class UserForm {
@ApiModelProperty("用户名")
private String userName;
@ApiModelProperty("密码")
private String passWord;
}
| [
"zhusidao855@pingan.com.cn"
] | zhusidao855@pingan.com.cn |
6b6bfe8682473a61231be5fb30050116aa7eeb5f | f11d0634c95a3340dd6b880ddd892a8da85729a9 | /way-cnab/src/test/java/br/com/objectos/way/cnab/TesteDeLoteExtItau.java | 7aad95c7dc1b0eaf13e7a5d0eb1c7661993753d2 | [
"Apache-2.0"
] | permissive | fredwilliamtjr/jabuticava | 11e27091cffd080853b6811ef364c8c9ab9aa9aa | 3235e3cc2f48e2145c86dfe73b88ebeed141cddb | refs/heads/master | 2023-03-18T05:16:17.925964 | 2014-09-27T22:00:56 | 2014-09-27T22:00:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,735 | java | /*
* Copyright 2014 Objectos, Fábrica de Software LTDA.
*
* 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 br.com.objectos.way.cnab;
import static br.com.objectos.way.base.testing.WayMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.List;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
/**
* @author marcio.endo@objectos.com.br (Marcio Endo)
*/
@Test
public class TesteDeLoteExtItau extends TesteDeLoteExtAbstrato {
@Override
MiniCnab cnab() {
return CnabsFalso.RETORNO_341_01;
}
public void nosso_numero() {
List<String> prova = ImmutableList.<String> builder()
.add("193892026")
.add("160103779")
.add("184020447")
.add("187458040")
.add("193891788")
.add("193891887")
.add("193892059")
.add("201773655")
.add("201773663")
.add("201773713")
.add("201773721")
.add("201773739")
.add("202456342")
.add("202456391")
.add("193892257")
.add("236942283")
.add("172464003")
.add("172464003")
.add("172464326")
.add("172464326")
.add("172464334")
.add("172464334")
.add("172464342")
.add("172464342")
.add("256421408")
.add("256421416")
.add("256421424")
.add("256421432")
.add("256421440")
.add("256421457")
.add("256421465")
.add("256421473")
.add("256421481")
.add("256421499")
.add("256421507")
.add("256421515")
.add("256421523")
.add("256421531")
.add("256421549")
.add("256421556")
.add("256421564")
.add("256421572")
.add("256421580")
.add("256421598")
.add("256421606")
.add("256421614")
.add("256421622")
.add("256421630")
.add("256421648")
.add("256421655")
.add("256421663")
.add("256421671")
.add("256421689")
.add("256421697")
.add("256421705")
.build();
List<String> res = lotesTo(LoteExtToNossoNumero.INSTANCE);
assertThat(res, equalTo(prova));
}
} | [
"marcio.endo@objectos.com.br"
] | marcio.endo@objectos.com.br |
d782522a57f2c2043b0c1a7f69db45784309c785 | 068bb1a43adf5d128500d4f9cb2a2fade289db57 | /src/java/controller/RegisterController.java | 54bcfe4eab67659348dea96b75d5cb8c652a37cd | [] | no_license | Phonng/Teender-COPY- | f6f1e504724dab0d3d2a95f71783e9f95a0c5fb6 | 0553bac80b5ab9567443ffe2e29580b01529823b | refs/heads/master | 2020-03-23T19:30:49.262511 | 2018-07-31T11:44:49 | 2018-07-31T11:44:49 | 141,983,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,975 | 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 controller;
import dal.UserDAO;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.User;
import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.FileUploadException;
import utils.InputValidator;
@MultipartConfig(fileSizeThreshold = 1024*1024*2,//2MB
maxFileSize = 1024*1024*10, //10MB
maxRequestSize = 1024*1024*50 //50MB
)
public class RegisterController extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.getRequestDispatcher("register.jsp").forward(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/plain;charset=UTF-8");
String username = "";
String password = "";
String passwordcf = "";
PrintWriter out = response.getWriter();
boolean isMultipart = FileUpload.isMultipartContent(request);
log("content-length: " + request.getContentLength());
log("method: " + request.getMethod());
log("character encoding: " + request.getCharacterEncoding());
String name = "name";
if (isMultipart) {
log("is multipart");
DiskFileUpload upload = new DiskFileUpload();
List items = null;
try {
items = upload.parseRequest(request);
log("items: " + items.toString());
} catch(FileUploadException ex) {
log("failed to parse request", ex);
}
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
//check if the current item is a form field or an upload file
if (item.isFormField()) {
String fieldName = item.getFieldName();
if (fieldName.equals("username")) {
username = item.getString();
name = username;
} else if (fieldName.equals("password")) {
password = item.getString();
} else if (fieldName.equals("passwordcf")) {
passwordcf = item.getString();
}
} else {
//must be an uploaded file, save to disk
File fullFile = new File(item.getName());
System.out.println("item.name:" + item.getName());
System.out.println("real context path in register controller: " + getServletContext().getRealPath("/"));
// System.out.println("real path: " + realPath);
// String realPath = "C:\\Users\\emsnguyen\\Documents\\NetBeansProjects\\TeenderWebApp\\web\\uploads";
String realPath = getServletContext().getRealPath("/");
File savedFile = null;
File prevFile = null;
prevFile = new File(realPath, "" + name + ".png");
if (prevFile.exists()) {
if (prevFile.delete()){
log("old file deleted " + prevFile.getPath());
} else {
log("error deleting " + prevFile.getPath());
}
}
prevFile = new File(realPath, "" + name + ".jpeg");
if (prevFile.exists()) {
if (prevFile.delete()){
log("old file deleted " + prevFile.getPath());
} else {
log("error deleting " + prevFile.getPath());
}
}
prevFile = new File(realPath, "" + name + ".jpg");
if (prevFile.exists()) {
if (prevFile.delete()){
log("old file deleted " + prevFile.getPath());
} else {
log("error deleting " + prevFile.getPath());
}
}
if (item.getName().contains("png")) {
savedFile = new File(realPath, "" + name + ".png");
} else if (item.getName().contains("jpg")) {
savedFile = new File(realPath, "" + name + ".jpg");
} else if (item.getName().contains("jpeg")) {
savedFile = new File(realPath, "" + name + ".jpeg");
} else {
request.setAttribute("error", "Vui lòng chỉ tải lên file .png, .jpeg hoặc .jpg");
doGet(request, response);
}
try {
item.write(savedFile);
} catch (Exception ex) {
Logger.getLogger(ChangeAvatarController.class.getName()).log(Level.SEVERE, null, ex);
}
log("new images saved successfully to " + savedFile.getPath());
}
}
}
UserDAO userDB = new UserDAO();
String checkUsername = InputValidator.isUsernameValid(username);
String checkPassword = InputValidator.isPasswordValid(password);
if (!checkUsername.equals("") || !checkPassword.equals("")) {
request.setAttribute("wrongUsername", checkUsername);
request.setAttribute("wrongPassword", checkPassword);
request.getRequestDispatcher("register.jsp").forward(request, response);
} else if (userDB.isUsernameExisted(username.trim())) {
request.setAttribute("wrongUsername", "Tên đăng nhập đã tồn tại!");
request.getRequestDispatcher("register.jsp").forward(request, response);
} else if (!passwordcf.equals(password)) {
request.setAttribute("wrongPasswordCf", "Mật khẩu không khớp");
request.getRequestDispatcher("register.jsp").forward(request, response);
}
else {
User u = new User();
u.setUsername(username);
u.setPassword(password);
if (userDB.insert(u)) {
//set attribute user for current session
//set avatar path
System.out.println("real context path: " + getServletContext().getRealPath("/"));
// String realPath = "C:\\Users\\emsnguyen\\Documents\\NetBeansProjects\\TeenderWebApp\\web\\";
String realPath = getServletContext().getRealPath("/");
String jpg = realPath + "uploads\\" + u.getUsername()+ ".jpg";
File fileJpg = new File(jpg);
String png = realPath + "uploads\\" + u.getUsername() + ".png";
File filePng = new File(png);
String jpeg = realPath + "uploads\\" + u.getUsername() + ".jpeg";
File fileJpeg = new File(jpeg);
if (fileJpg.exists()) {
request.getSession().setAttribute("avatarPath", "uploads/" + u.getUsername() + ".jpg");
} else if (filePng.exists()) {
request.getSession().setAttribute("avatarPath", "uploads/" + u.getUsername() + ".png");
} else if (fileJpeg.exists()) {
request.getSession().setAttribute("avatarPath", "uploads/" + u.getUsername() + ".jpeg");
} else {
request.getSession().setAttribute("avatarPath", "img/logo.jpg");
}
//set user attribute
request.getSession().setAttribute("user", u);
response.sendRedirect("setting");
} else {
request.getRequestDispatcher("signup.jsp").forward(request, response);
}
}
}
}
| [
"heartgold1405@gmail.com"
] | heartgold1405@gmail.com |
8ae24c070237f095cb8d3a749c5dd4b99a15682f | 0a77b00a82aa6b80e32f2f8cb1522210eb65c197 | /app/src/main/java/com/github/s0nerik/shoppingassistant/glide_binding/GlideBindingAdapter.java | 9c248edc28f48273d4249181d8f7b1080ad3c5c9 | [] | no_license | s0nerik/Kart | 0b3e50445492a2f16b91e32cc018433310ca4665 | b496577c487351403412a5426ee96da64629f62d | refs/heads/master | 2021-01-17T04:30:51.387265 | 2017-12-09T21:57:35 | 2017-12-09T21:57:35 | 82,968,385 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,513 | java | package com.github.s0nerik.shoppingassistant.glide_binding;
import android.databinding.BindingAdapter;
import android.net.Uri;
import android.widget.ImageView;
import com.bumptech.glide.DrawableRequestBuilder;
import com.bumptech.glide.DrawableTypeRequest;
import com.bumptech.glide.Glide;
public class GlideBindingAdapter {
private static <T> DrawableTypeRequest<?> getDrawableRequest(ImageView iv, T oldPath, T newPath) {
if (newPath != null && !newPath.equals(oldPath)) {
return Glide.with(iv.getContext()).load(newPath);
} else {
return null;
}
}
private static <T> void loadImage(
ImageView iv,
T oldPath,
T newPath,
Object configProviderKey
) {
DrawableTypeRequest<?> drawableRequest = getDrawableRequest(iv, oldPath, newPath);
if (drawableRequest != null) {
GlideBindingConfig.Provider configProvider;
DrawableRequestBuilder<?> requestBuilder;
if ((configProvider = GlideBindingConfig.getProvider(configProviderKey)) != null) {
requestBuilder = configProvider.provide(iv, drawableRequest);
} else if ((configProvider = GlideBindingConfig.getDefaultProvider()) != null) {
requestBuilder = configProvider.provide(iv, drawableRequest);
} else {
requestBuilder = drawableRequest;
}
requestBuilder.into(iv);
}
}
@BindingAdapter("glideSrc")
public static void setGlideImagePath(ImageView iv, String oldPath, String newPath) {
loadImage(iv, oldPath, newPath, null);
}
@BindingAdapter({"glideSrc", "glideConfig"})
public static void setGlideImagePath(
ImageView iv,
String oldPath,
Object oldGlideConfigProviderKey,
String newPath,
Object newGlideConfigProviderKey
) {
loadImage(iv, oldPath, newPath, newGlideConfigProviderKey);
}
@BindingAdapter("glideSrc")
public static void setGlideImageUri(ImageView iv, Uri oldUri, Uri newUri) {
loadImage(iv, oldUri, newUri, null);
}
@BindingAdapter({"glideSrc", "glideConfig"})
public static void setGlideImageUri(
ImageView iv,
Uri oldUri,
Object oldGlideConfigProviderKey,
Uri newUri,
Object newGlideConfigProviderKey
) {
loadImage(iv, oldUri, newUri, newGlideConfigProviderKey);
}
} | [
"thesonerik@gmail.com"
] | thesonerik@gmail.com |
262e75b404e380cbf0be599d2a1d565039b53a55 | f2ca82398c9ca6d21e7f0b6bc8cd56a5dffa757f | /dubbo-admin/dubbo-ops-backend/src/main/java/org/apache/dubbo/admin/registry/common/route/RouteUtils.java | 0ba04d3228500f2e4ba47d6808970bc64d9184ec | [] | no_license | nzomkxia/ops | a07f78ab996c918fce7cea251b6a1a491d00601e | 1113f294454e726f083c22d64d54afff87842c96 | refs/heads/master | 2020-03-26T13:37:48.911603 | 2018-08-16T07:21:43 | 2018-08-16T07:21:43 | 144,948,873 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,532 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.admin.registry.common.route;
import org.apache.dubbo.admin.registry.common.domain.Override;
import org.apache.dubbo.admin.registry.common.domain.Provider;
import org.apache.dubbo.admin.registry.common.domain.Route;
import com.alibaba.dubbo.common.utils.StringUtils;
import org.apache.dubbo.admin.web.pulltool.Tool;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
/**
* RouteParser route rule parse tool。
*
*/
public class RouteUtils {
public static boolean matchRoute(String consumerAddress, String consumerQueryUrl, Route route, Map<String, List<String>> clusters) {
RouteRule rule = RouteRule.parseQuitely(route);
Map<String, RouteRule.MatchPair> when = RouteRuleUtils.expandCondition(
rule.getWhenCondition(), "consumer.cluster", "consumer.host", clusters);
Map<String, String> consumerSample = ParseUtils.parseQuery("consumer.", consumerQueryUrl);
final int index = consumerAddress.lastIndexOf(":");
String consumerHost = null;
if (index != -1) {
consumerHost = consumerAddress.substring(0, index);
} else {
consumerHost = consumerAddress;
}
consumerSample.put("consumer.host", consumerHost);
return RouteRuleUtils.isMatchCondition(when, consumerSample, consumerSample);
}
public static Map<String, String> previewRoute(String serviceName, String consumerAddress, String queryUrl, Map<String, String> serviceUrls,
Route route, Map<String, List<String>> clusters, List<Route> routed) {
if (null == route) {
throw new IllegalArgumentException("Route is null.");
}
List<Route> routes = new ArrayList<Route>();
routes.add(route);
return route(serviceName, consumerAddress, queryUrl, serviceUrls, routes, clusters, routed);
}
/**
* @return Map<methodName, Route>
*/
public static List<Route> findUsedRoute(String serviceName, String consumerAddress, String consumerQueryUrl,
List<Route> routes, Map<String, List<String>> clusters) {
List<Route> routed = new ArrayList<Route>();
Map<String, String> urls = new HashMap<String, String>();
urls.put("dubbo://" + consumerAddress + "/" + serviceName, consumerQueryUrl);
RouteUtils.route(serviceName, consumerAddress, consumerQueryUrl, urls, routes, clusters, routed);
return routed;
}
public static List<Provider> route(String serviceName, String consumerAddress, String consumerQueryUrl, List<Provider> providers,
List<Override> overrides, List<Route> routes, Map<String, List<String>> clusters, List<Route> routed) {
if (providers == null) {
return null;
}
Map<String, String> urls = new HashMap<String, String>();
urls.put("consumer://" + consumerAddress + "/" + serviceName, consumerQueryUrl); // not empty dummy data
for (Provider provider : providers) {
if (Tool.isProviderEnabled(provider, overrides)) {
urls.put(provider.getUrl(), provider.getParameters());
}
}
urls = RouteUtils.route(serviceName, consumerAddress, consumerQueryUrl, urls, routes, clusters, routed);
List<Provider> result = new ArrayList<Provider>();
for (Provider provider : providers) {
if (urls.containsKey(provider.getUrl())) {
result.add(provider);
}
}
return result;
}
/**
* @param serviceName e.g. {@code com.alibaba.morgan.MemberService}
* @param consumerAddress e.g. {@code 192.168.1.3:54333}
* @param consumerQueryUrl metadata of subscribe url, e.g. <code>aplication=nasdaq&dubbo=2.0.3&methods=updateItems,validateNew&revision=1.7.0</code>
* @param serviceUrls providers
* @param routes all route rules
* @param clusters all clusters
* @return route result, Map<url-body, url-params>
*/
// FIXME The combination of clusters and routes can be done in advance when clusters or routes changes
// FIXME Separating the operation of Cache from the Util method
public static Map<String, String> route(String serviceName, String consumerAddress, String consumerQueryUrl, Map<String, String> serviceUrls,
List<Route> routes, Map<String, List<String>> clusters, List<Route> routed) {
if (serviceUrls == null || serviceUrls.size() == 0) {
return serviceUrls;
}
if (routes == null || routes.isEmpty()) {
return serviceUrls;
}
Map<Long, RouteRule> rules = route2RouteRule(routes, clusters);
final Map<String, String> consumerSample = ParseUtils.parseQuery("consumer.", consumerQueryUrl);
final int index = consumerAddress.lastIndexOf(":");
final String consumerHost;
if (consumerAddress != null && index != -1) {
consumerHost = consumerAddress.substring(0, index);
} else {
consumerHost = consumerAddress;
}
consumerSample.put("consumer.host", consumerHost);
Map<String, Map<String, String>> url2ProviderSample = new HashMap<String, Map<String, String>>();
for (Map.Entry<String, String> entry : serviceUrls.entrySet()) {
URI uri;
try {
uri = new URI(entry.getKey());
} catch (URISyntaxException e) {
throw new IllegalStateException("fail to parse url(" + entry.getKey() + "):" + e.getMessage(), e);
}
Map<String, String> sample = new HashMap<String, String>();
sample.putAll(ParseUtils.parseQuery("provider.", entry.getValue()));
sample.put("provider.protocol", uri.getScheme());
sample.put("provider.host", uri.getHost());
sample.put("provider.port", String.valueOf(uri.getPort()));
url2ProviderSample.put(entry.getKey(), sample);
}
Map<String, Set<String>> url2Methods = new HashMap<String, Set<String>>();
// Consumer can specify the required methods through the consumer.methods Key
String methodsString = consumerSample.get("consumer.methods");
String[] methods = methodsString == null || methodsString.length() == 0 ? new String[]{Route.ALL_METHOD} : methodsString.split(ParseUtils.METHOD_SPLIT);
for (String method : methods) {
consumerSample.put("method", method);
// NOTE:
// <*method>only configure <no method key>
// if method1 matches <no method key> and <method = method1>, we should reduce the priority of <no method key>.
if (routes != null && routes.size() > 0) {
for (Route route : routes) {
if (isSerivceNameMatched(route.getService(), serviceName)) {
RouteRule rule = rules.get(route.getId());
// matches When Condition
if (rule != null && RouteRuleUtils.isMatchCondition(
rule.getWhenCondition(), consumerSample, consumerSample)) {
if (routed != null && !routed.contains(route)) {
routed.add(route);
}
Map<String, RouteRule.MatchPair> then = rule.getThenCondition();
if (then != null) {
Map<String, Map<String, String>> tmp = getUrlsMatchedCondition(then, consumerSample, url2ProviderSample);
// If the result of the rule is empty, the rule is invalid and all Provider is used.
if (route.isForce() || !tmp.isEmpty()) {
url2ProviderSample = tmp;
}
}
}
}
}
}
for (String url : url2ProviderSample.keySet()) {
Set<String> mts = url2Methods.get(url);
if (mts == null) {
mts = new HashSet<String>();
url2Methods.put(url, mts);
}
mts.add(method);
}
} // end of for methods
return appendMethodsToUrls(serviceUrls, url2Methods);
}
static Map<Long, RouteRule> route2RouteRule(List<Route> routes,
Map<String, List<String>> clusters) {
Map<Long, RouteRule> rules = new HashMap<Long, RouteRule>();
// route -> RouteRule
if (routes != null && routes.size() > 0) {
for (Route route : routes) {
rules.put(route.getId(), RouteRule.parseQuitely(route));
}
}
// expand the cluster parameters into conditions of routerule
if (clusters != null && clusters.size() > 0) {
Map<Long, RouteRule> rrs = new HashMap<Long, RouteRule>();
for (Map.Entry<Long, RouteRule> entry : rules.entrySet()) {
RouteRule rr = entry.getValue();
Map<String, RouteRule.MatchPair> when = RouteRuleUtils.expandCondition(
rr.getWhenCondition(), "consumer.cluster", "consumer.host", clusters);
Map<String, RouteRule.MatchPair> then = RouteRuleUtils.expandCondition(
rr.getThenCondition(), "provider.cluster", "provider.host", clusters);
rrs.put(entry.getKey(), RouteRule.createFromCondition(when, then));
}
rules = rrs;
}
return rules;
}
static Map<String, String> appendMethodsToUrls(Map<String, String> serviceUrls,
Map<String, Set<String>> url2Methods) {
// Add method parameters to URL
Map<String, String> results = new HashMap<String, String>();
for (Map.Entry<String, Set<String>> entry : url2Methods.entrySet()) {
String url = entry.getKey();
String query = serviceUrls.get(url);
Set<String> methodNames = entry.getValue();
if (methodNames != null && methodNames.size() > 0) {
String ms = StringUtils.join(methodNames.toArray(new String[0]), ParseUtils.METHOD_SPLIT);
query = ParseUtils.replaceParameter(query, "methods", ms);
}
results.put(url, query);
}
return results;
}
static Route getFirstRouteMatchedWhenConditionOfRule(String serviceName, Map<String, String> consumerSample, List<Route> routes, Map<Long, RouteRule> routeRuleMap) {
if (serviceName == null || serviceName.length() == 0) {
return null;
}
if (routes != null && routes.size() > 0) {
for (Route route : routes) {
if (isSerivceNameMatched(route.getService(), serviceName)) {
RouteRule rule = routeRuleMap.get(route.getId());
// if matches When Condition
if (rule != null && RouteRuleUtils.isMatchCondition(
rule.getWhenCondition(), consumerSample, consumerSample)) {
return route; // will return if the first condition matches
}
}
}
}
return null;
}
/**
* Check if a service name matches pattern
*
* @param servicePattern
* @param serviceName
*/
static boolean isSerivceNameMatched(String servicePattern, String serviceName) {
final int pip = servicePattern.indexOf('/');
final int pi = serviceName.indexOf('/');
if (pip != -1) { // pattern has group
if (pi == -1) return false; // servicename doesn't have group
String gp = servicePattern.substring(0, pip);
servicePattern = servicePattern.substring(pip + 1);
String g = serviceName.substring(0, pi);
if (!gp.equals(g)) return false;
}
if (pi != -1)
serviceName = serviceName.substring(pi + 1);
final int vip = servicePattern.lastIndexOf(':');
final int vi = serviceName.lastIndexOf(':');
if (vip != -1) { // pattern has group
if (vi == -1) return false;
String vp = servicePattern.substring(vip + 1);
servicePattern = servicePattern.substring(0, vip);
String v = serviceName.substring(vi + 1);
if (!vp.equals(v)) return false;
}
if (vi != -1)
serviceName = serviceName.substring(0, vi);
return ParseUtils.isMatchGlobPattern(servicePattern, serviceName);
}
static Map<String, Map<String, String>> getUrlsMatchedCondition(Map<String, RouteRule.MatchPair> condition,
Map<String, String> parameters, Map<String, Map<String, String>> url2Sample) {
Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
for (Map.Entry<String, Map<String, String>> entry : url2Sample.entrySet()) {
Map<String, String> sample = entry.getValue();
Map<String, String> params = new HashMap<String, String>();
params.putAll(sample);
params.putAll(parameters);
if (RouteRuleUtils.isMatchCondition(condition, params, sample)) {
result.put(entry.getKey(), entry.getValue());
}
}
return result;
}
}
| [
"minuxan.zmx@alibaba-inc.com"
] | minuxan.zmx@alibaba-inc.com |
c9a47fdfa854035ab0fc123a9b49b43b623e24fb | 5ac03030a05280364ab831eb0ee590f5af7a6f63 | /app/src/main/java/com/example/administrator/mjproject/DailyActivity.java | 9610d9dddb9a42044969b6d166915a0e2b9e7b7f | [] | no_license | danny0628/APP_project | d0666f013001fd2aba6918592dfc3bc3183a3a09 | 36153a47fda894757cc7a5a66cbdbdb0fc87fa1a | refs/heads/master | 2021-07-15T04:39:25.547402 | 2017-10-19T17:58:17 | 2017-10-19T17:58:17 | 107,614,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,760 | java | package com.example.administrator.mjproject;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import java.util.ArrayList;
public class DailyActivity extends AppCompatActivity {
ArrayList<String> Items;
ArrayAdapter<String> Adapter;
ListView list;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_daily);
Items = new ArrayList<String>();
Items.add("First");
Items.add("Second");
Items.add("Third");
Items.add("Fourth");
Items.add("Fifth");
Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_single_choice, Items);
list = (ListView) findViewById(R.id.list);
list.setAdapter(Adapter);
list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
public void mOnCilck(View v){
EditText ed = (EditText)findViewById(R.id.newitem);
switch (v.getId()){
case R.id.add:
String text = ed.getText().toString();
if(text.length() != 0){
Items.add(text);
ed.setText("");
Adapter.notifyDataSetChanged();
}
break;
case R.id.delete:
int pos;
pos = list.getCheckedItemPosition();
if(pos != ListView.INVALID_POSITION){
Items.remove(pos);
list.clearChoices();
Adapter.notifyDataSetChanged();
}
break;
}
}
}
| [
"danny0628@naver.com"
] | danny0628@naver.com |
8fec8cdeb6ba62eb2f14eb0990d090ec532ad0dc | c81befea60b06542082d8d33dd439d8bb7bfc2de | /services-staticmap/src/main/java/com/mapbox/staticmap/v1/models/StaticMarkerAnnotation.java | e97dc7c0959d6a62cf4f3e5ce4a0db192da30b18 | [] | no_license | rubythonode/mapbox-java | b0c767957837e7f88adf3a608c2721a3c998d25b | 1e65f8f501763bc4b4f38821f19426d40500dc7e | refs/heads/master | 2021-08-15T19:56:14.160287 | 2017-11-18T05:46:00 | 2017-11-18T05:46:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,823 | java | package com.mapbox.staticmap.v1.models;
import android.support.annotation.Nullable;
import com.google.auto.value.AutoValue;
import com.mapbox.geojson.Point;
import com.mapbox.services.exceptions.ServicesException;
import com.mapbox.services.utils.TextUtils;
import com.mapbox.staticmap.v1.StaticMapCriteria;
import com.mapbox.staticmap.v1.StaticMapCriteria.MarkerCriteria;
import java.awt.Color;
import java.util.Locale;
/**
* Mapbox Static Image API marker overlay. Building this object allows you to place a marker on top
* or within your static image. The marker can either use the default marker (though you can change
* it's color and size) or you have the option to also pass in a custom marker icon using it's url.
*
* @since 2.1.0
*/
@AutoValue
public abstract class StaticMarkerAnnotation {
/**
* Build a new {@link StaticMarkerAnnotation} object with the initial values set for the
* {@link #name()} to {@link StaticMapCriteria#MEDIUM_PIN}.
*
* @return a {@link StaticMarkerAnnotation.Builder} object for creating this object
* @since 3.0.0
*/
public static Builder builder() {
return new AutoValue_StaticMarkerAnnotation.Builder()
.name(StaticMapCriteria.MEDIUM_PIN);
}
public String url() {
String url;
if (iconUrl() != null) {
return String.format(
Locale.US, "url-%s(%f,%f)", iconUrl(), lnglat().longitude(), lnglat().latitude());
}
if (color() != null && label() != null && !TextUtils.isEmpty(label())) {
url = String.format(Locale.US, "%s-%s+%s", name(), label(), toHexString(color()));
} else if (label() != null && !TextUtils.isEmpty(label())) {
url = String.format(Locale.US, "%s-%s", name(), label());
} else if (color() != null) {
url = String.format(Locale.US, "%s-%s", name(), toHexString(color()));
} else {
url = name();
}
return String.format(Locale.US, "%s(%f,%f)", url, lnglat().longitude(), lnglat().latitude());
}
@Nullable
abstract String name();
@Nullable
abstract String label();
@Nullable
abstract Color color();
@Nullable
abstract Point lnglat();
@Nullable
abstract String iconUrl();
/**
* This builder is used to create a new request to the Mapbox Static Map API. At a bare minimum,
* your request must include a name and {@link StaticMarkerAnnotation.Builder#lnglat(Point)}.
* All other fields can be left alone inorder to use the default behaviour of the API.
*
* @since 2.1.0
*/
@AutoValue.Builder
public abstract static class Builder {
/**
* Modify the markers scale factor using one of the pre defined
* {@link StaticMapCriteria#SMALL_PIN}, {@link StaticMapCriteria#MEDIUM_PIN}, or
* {@link StaticMapCriteria#LARGE_PIN}.
*
* @param name one of the three string sizes provided in this methods summary
* @return this builder for chaining options together
* @since 2.1.0
*/
public abstract Builder name(@MarkerCriteria String name);
/**
* Marker symbol. Options are an alphanumeric label "a" through "z", "0" through "99", or a
* valid Maki icon. If a letter is requested, it will be rendered uppercase only.
*
* @param label a valid alphanumeric value
* @return this builder for chaining options together
* @since 2.1.0
*/
// TODO place a filter on only accepted labels
public abstract Builder label(String label);
/**
* A reference to a {@link Color} which defines the markers color.
*
* @param color {@link Color} denoting the marker icon color
* @return this builder for chaining options together
* @since 2.1.0
*/
public abstract Builder color(@Nullable Color color);
/**
* Represents where the marker should be shown on the map.
*
* @param lnglat a GeoJSON Point which denotes where the marker will be placed on the static
* map image. Altitude value, if given, will be ignored
* @return this builder for chaining options together
* @since 2.1.0
*/
public abstract Builder lnglat(Point lnglat);
public abstract Builder iconUrl(@Nullable String url);
abstract StaticMarkerAnnotation autoBuild();
public StaticMarkerAnnotation build() {
StaticMarkerAnnotation marker = autoBuild();
if (marker.lnglat() == null) {
throw new ServicesException("A Static map marker requires a defined longitude and latitude"
+ " coordinate.");
}
return marker;
}
}
// TODO move to utils class
public static final String toHexString(Color color) {
String hexColour = Integer.toHexString(color.getRGB() & 0xffffff);
if (hexColour.length() < 6) {
hexColour = "000000".substring(0, 6 - hexColour.length()) + hexColour;
}
return hexColour;
}
}
| [
"cameron@mapbox.com"
] | cameron@mapbox.com |
0331e34bf1cf0ad8e2f6432ff82d1d440f89cd04 | c1bc8ca242cb90a26e4d842a1393fb89458b6b0d | /src/main/java/organizer/event/CsvReader.java | 9481b5d1dd2adfbbd25cc4dc30255e6381fe8d65 | [] | no_license | Makedo81/Calendar-Organizer | 4645080de9a75e3e816d385b9327e83c4bacc9df | 6914ce5e82efe30fc6192c069565e2d536b95fde | refs/heads/master | 2021-01-04T03:21:23.010316 | 2020-02-13T20:45:53 | 2020-02-13T20:45:53 | 240,356,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package organizer.event;
import com.google.api.client.util.DateTime;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.EventDateTime;
import com.opencsv.CSVReader;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class CsvReader {
public List<Event> reader(String filePath) throws IOException {
List<Event> eventsList = new ArrayList<>();
try (
Reader reader = Files.newBufferedReader(Paths.get(filePath));
CSVReader csvReader = new CSVReader(reader)) {
String[] nextRecord;
while ((nextRecord = csvReader.readNext()) != null) {
System.out.println("Summary : "+ nextRecord[0] +"Location : " + nextRecord[1] + "StartDate : " + nextRecord[2] +"Description : " + nextRecord[3]);
Event event = createEvent(nextRecord);
eventsList.add(event);
}
return eventsList;
}
}
private Event createEvent (String[]data){
return new Event()
.setSummary(data[0])
.setLocation(data[1])
.setStart(createDate(data[2]))
.setEnd(createDate(data[2]))
.setDescription(data[3]);
}
private EventDateTime createDate(String date){
DateTime startDateTime = new DateTime(date);
return new EventDateTime()
.setDate(startDateTime);
}
}
| [
"domi.stan@wp.pl"
] | domi.stan@wp.pl |
f033f02168abd640ec1ea100954787352538f8c2 | d5f63aaabd51acd11753ef75abed3f0a2873fe49 | /roilat-study/roilat-study-java/src/main/java/cn/roilat/study/socket/iobuffer/TestSocketIOBufferServer.java | 9da758b73e8af866a0b89e25d7199df93409ea0c | [] | no_license | roilat/roilat_study_code | bf8ac1849f69d60ca0142fc03e452da5e235a975 | 8e58735b62c4ceda120410b999c06dea57d47e1d | refs/heads/master | 2022-12-23T21:07:26.720607 | 2019-12-17T16:00:39 | 2019-12-17T16:00:39 | 125,948,386 | 0 | 2 | null | 2022-12-16T06:11:44 | 2018-03-20T02:21:34 | Java | UTF-8 | Java | false | false | 2,287 | java | package cn.roilat.study.socket.iobuffer;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.executor.ExecutorFilter;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.SocketAcceptor;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
public class TestSocketIOBufferServer {
private static SocketAcceptor acceptor;
public static void startSalaryServer() throws IOException {
ExecutorService executor = Executors.newSingleThreadExecutor();
acceptor = new NioSocketAcceptor(Runtime.getRuntime().availableProcessors() + 1);
acceptor.getFilterChain().addLast("executor", new ExecutorFilter(executor));
TextLineCodecFactory listenerLine = new TextLineCodecFactory(Charset.forName("GBK"));
acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(listenerLine));
acceptor.getFilterChain().addLast("logger", new LoggingFilter());
acceptor.setHandler(new IoHandlerAdapter() {
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
System.out.println("message=" + message);
super.messageReceived(session, message);
}
});
acceptor.getSessionConfig().setReadBufferSize(10);
acceptor.getSessionConfig().setMaxReadBufferSize(64);
acceptor.getSessionConfig().setReceiveBufferSize(10);
acceptor.getSessionConfig().setSendBufferSize(64);
acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10);
acceptor.bind(new InetSocketAddress("127.0.0.1", 6776));
// System.out.println("快贷移动端端口" + ConstantsApplication.FC_PORT + "启用......");
}
public static void main(String[] args) throws IOException {
startSalaryServer();
}
}
| [
"wb-dtw368035@antfin.com"
] | wb-dtw368035@antfin.com |
d49dc53d92ca2254a8bdbe1ddf19bf0fc5acbae2 | 8f8961fcb17be9eb283eda1f66a5309d3198c9be | /branches/sandbox/src/main/java/es/us/lsi/tdg/fast/core/component/UnwiredComponent.java | b9499f997dc874a7b0235440516f2908ccee1b36 | [] | no_license | raina070/fast-trading | a98b453ddf0917e1459a30d225fe30c725f6a29c | 38e569225199d88a6a68f85ab12d395db48ac89f | refs/heads/master | 2016-09-06T21:35:28.613272 | 2012-09-21T20:17:17 | 2012-09-21T20:17:17 | 35,436,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package es.us.lsi.tdg.fast.core.component;
public class UnwiredComponent extends RuntimeException {
String unwiredAdaptor;
public UnwiredComponent(String unwiredAdaptor) {
this.unwiredAdaptor = unwiredAdaptor;
}
public String toString(){
return toString()+":"+unwiredAdaptor;
}
/**
*
*/
private static final long serialVersionUID = 1L;
}
| [
"pafmon@1dd39048-c632-0410-b676-f7962134b12f"
] | pafmon@1dd39048-c632-0410-b676-f7962134b12f |
cfc1ebeb266be1443b99ff05aa755ddd9616ad0a | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE523_Unprotected_Cred_Transport/CWE523_Unprotected_Cred_Transport__Servlet_16.java | a6fb029c5150ef5ae04c2e34caa6d12f101f218a | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,205 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE523_Unprotected_Cred_Transport__Servlet_16.java
Label Definition File: CWE523_Unprotected_Cred_Transport__Servlet.label.xml
Template File: point-flaw-16.tmpl.java
*/
/*
* @description
* CWE: 523 Unprotected Transport of Credentials
* Sinks: non_ssl
* GoodSink: Send across SSL connection
* BadSink : Send across non-SSL connection
* Flow Variant: 16 Control flow: while(true)
*
* */
package testcases.CWE523_Unprotected_Cred_Transport;
import testcasesupport.*;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.logging.Level;
public class CWE523_Unprotected_Cred_Transport__Servlet_16 extends AbstractTestCaseServlet
{
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
while(true)
{
PrintWriter writer = null;
try
{
writer = response.getWriter();
/* FLAW: transmitting login credentials across a non-SSL connection */
writer.println("<form action='http://hostname.com/j_security_check' method='post'>");
writer.println("<table>");
writer.println("<tr><td>Name:</td>");
writer.println("<td><input type='text' name='j_username'></td></tr>");
writer.println("<tr><td>Password:</td>");
writer.println("<td><input type='password' name='j_password' size='8'></td>");
writer.println("</tr>");
writer.println("</table><br />");
writer.println("<input type='submit' value='login'>");
writer.println("</form>");
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "There was a problem writing", exceptIO);
}
finally
{
if (writer != null)
{
writer.close();
}
}
break;
}
}
/* good1() change the conditions on the while statements */
private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
while(true)
{
PrintWriter writer = null;
try
{
writer = response.getWriter();
/* FIX: ensure the connection is secure (https) */
writer.println("<form action='https://hostname.com/j_security_check' method='post'>");
writer.println("<table>");
writer.println("<tr><td>Name:</td>");
writer.println("<td><input type='text' name='j_username'></td></tr>");
writer.println("<tr><td>Password:</td>");
writer.println("<td><input type='password' name='j_password' size='8'></td>");
writer.println("</tr>");
writer.println("</table><br />");
writer.println("<input type='submit' value='login'>");
writer.println("</form>");
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "There was a problem writing", exceptIO);
}
finally
{
if (writer != null)
{
writer.close();
}
}
break;
}
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
good1(request, response);
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"bqcuong2212@gmail.com"
] | bqcuong2212@gmail.com |
47005dc7fab5bbc636f3416b8fa20cfb34332a4d | 4b02716fe4b91399d2bfda4dda3becc31a9d793a | /huigou-uasp/src/main/java/com/huigou/uasp/bmp/dataManage/domain/query/OpdatakindQueryRequest.java | 1605326ab3854c15d6ee444cf77fcc7c3edb6017 | [] | no_license | wuyounan/drawio | 19867894fef13596be31f4f5db4296030f2a19b6 | d0d1a0836e6b3602c27a53846a472a0adbe15e93 | refs/heads/develop | 2022-12-22T05:12:08.062112 | 2020-02-06T07:28:12 | 2020-02-06T07:28:12 | 241,046,824 | 0 | 2 | null | 2022-12-16T12:13:57 | 2020-02-17T07:38:48 | JavaScript | UTF-8 | Java | false | false | 1,077 | java | package com.huigou.uasp.bmp.dataManage.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
/**
* 数据管理权限维度定义
*
* @author xx
* SA_OPDATAKIND
* @date 2018-09-04 10:52
*/
public class OpdatakindQueryRequest extends QueryAbstractRequest {
/**
* 编码
**/
protected String code;
/**
* 名称
**/
protected String name;
/**
* 类型
**/
protected String dataKind;
private Integer status;
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getDataKind() {
return this.dataKind;
}
public void setDataKind(String dataKind) {
this.dataKind = dataKind;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
| [
"2232911026@qq.com"
] | 2232911026@qq.com |
cc3e5e260883e1b0fc2dbbf92c45537fd7d37ec6 | d7cdeb414c5effca26db5981d5c3275a2ebe42f4 | /src/main/java/com/expedia/www/EditWebPage.java | fced95dcbbffa127fa346cc61bb81ce089ea7e9d | [] | no_license | chilichilimo/expedia-challenge | 173e67cc5be0b8d297d0730c3255f54d6eb1f534 | ae040bc730b8d22d564e8120dee6799dec307ef8 | refs/heads/master | 2021-01-11T14:24:29.739406 | 2017-02-08T17:06:53 | 2017-02-08T17:06:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package com.expedia.www;
import java.util.Scanner;
/*
Ask user for the URL that they wish to edit
Display the current <title>, <meta name="description" content="" /> and <meta name="keywords" content"" /> to the user
Ask which element they would like to edit
Ask what the user wants the new content for that element to be
Save the old value and new value (in memory is fine)
Ask the user if they wish to continue editing, if yes, return to step 2, else return to the options menu
* */
public class EditWebPage {
History h;
public EditWebPage() {
String url = askForURL();
String[] oldValues = {"old title", "old meta desc", "old meta keyword"};
h = new History(url, oldValues);
}
protected String askForURL() {
return askForUserInput("Enter the URL you would like to edit: ");
}
protected void editElement() {
String element = askForUserInput( "Which element would you like to edit?");
if (element.equals("title")) {
h.setTitle(askForNewContent());
} else if (element.equals("meta description")) {
h.setMetaDesc(askForNewContent());
} else {
h.setKeyword(askForNewContent());
}
}
protected String askForNewContent() {
return askForUserInput("Enter the new content you would like to replace it with: ");
}
protected boolean askIfContinue() {
return (askForUserInput("Continue editing? [Y/N]") == "Y");
}
private static String askForUserInput(String msg) {
Scanner reader = new Scanner(System.in); // Reading from System.in
System.out.println(msg);
return reader.nextLine();
}
}
| [
"linna.wang15@imperial.ac.uk"
] | linna.wang15@imperial.ac.uk |
2732c8ce1e8442a7b2842b0f60c42f872a758f8b | 97386b00aa112044a46b55db632c6be1195ed79d | /src/main/java/com/adpf/tracking/entity/TAppLogin.java | daf0d0a484a6bbf0fbbf500e93f82f9b857922c4 | [] | no_license | mayongcan/adpf | 8f1a036c05afdb8978730eebaa5860b5bc56219e | 69d3be034e4270501f56da5a3ac3a82825c4aac9 | refs/heads/master | 2022-07-09T21:57:35.733201 | 2020-01-20T07:04:48 | 2020-01-20T07:04:48 | 255,856,674 | 0 | 0 | null | 2022-06-29T18:04:31 | 2020-04-15T08:43:22 | Java | UTF-8 | Java | false | false | 2,571 | java | /*
* Copyright(c) 2018 gimplatform(通用信息管理平台) All rights reserved.
*/
package com.adpf.tracking.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.gimplatform.core.annotation.CustomerDateAndTimeDeserialize;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* TAppLogin数据库映射实体类
* @version 1.0
* @author
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "t_app_login")
public class TAppLogin implements Serializable {
private static final long serialVersionUID = 1L;
// 登录id
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "TAppLoginIdGenerator")
@TableGenerator(name = "TAppLoginIdGenerator", table = "sys_tb_generator", pkColumnName = "GEN_NAME", valueColumnName = "GEN_VALUE", pkColumnValue = "T_APP_LOGIN_PK", allocationSize = 1)
@Column(name = "id", unique = true, nullable = false)
private Long id;
// 发生时间
@JsonDeserialize(using = CustomerDateAndTimeDeserialize.class)
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "when1")
private Date when1;
// 接入key
@Column(name = "app_key", length = 200)
private String appKey;
// 产品id
@Column(name = "app_id")
private String appId;
// 平台类型
@Column(name = "app_type", length = 100)
private String appType;
// 安卓id
@Column(name = "android_id", length = 100)
private String androidId;
// IOS IDFA
@Column(name = "idfa", length = 100)
private String idfa;
// 设备IP
@Column(name = "ip", length = 100)
private String ip;
// 设备ua
@Column(name = "ua", length = 100)
private String ua;
// 设备imei
@Column(name = "imei", length = 100)
private String imei;
// 设备mac
@Column(name = "mac", length = 100)
private String mac;
// 用户账号
@Column(name = "account_id", length = 100)
private String accountId;
// 创建时间
@JsonDeserialize(using = CustomerDateAndTimeDeserialize.class)
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "create_time")
private Date createTime;
}
| [
"1571638094@qq.com"
] | 1571638094@qq.com |
a4c5c89b7baac0d29973d37e11aa0a01e9c9257f | addab6c55935a29d7663594b951416f035274f16 | /src/com/totalwine/test/storelocator/SLSearch.java | 8b1c6fda15f3b7fc0d1f97eadb0212b1d9ab147b | [] | no_license | mhossaintotalwine/TWMAutomation_Bugfix | 6a266c44a06c6de9537e7b1d8afaccf53e2f910a | b6949620a7297b8d67e550533ecf33f640465ee2 | refs/heads/master | 2021-01-14T08:51:55.219290 | 2016-04-22T13:57:25 | 2016-04-22T13:57:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,695 | java | package com.totalwine.test.storelocator;
/*
* Store Locator (Search)
* Workflow:
* 1. Access the site and navigate to the Store Locator page
* 2. Search using most-frequently used search terms
* 3. Validate result
*
* Technical Modules:
* 1. BeforeMethod (Test Pre-requisites):
* Maximize browser window
* 2. Test (Workflow)
* 3. AfterMethod
* Take screenshot, in case of failure
* Close webdriver
* 4. AfterClass
* Quit webdriver
*/
//@author=rsud
import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.relevantcodes.extentreports.LogStatus;
import com.totalwine.test.actions.SiteAccess;
import com.totalwine.test.config.ConfigurationFunctions;
import com.totalwine.test.trials.Browser;
public class SLSearch extends Browser {
String IP = "71.193.51.0";
String StoreLink = "ul.header-classes > li > a[href*=\\/store-finder]";
@BeforeMethod
public void setUp() throws Exception {
driver.manage().window().maximize();
}
@Test //Search by City
public void SLCitySearchTest () throws InterruptedException {
//Access the site using the remoteTestIPAddress URL parameter for all test IPs
logger=report.startTest("SL: Search by city");
String [] CitySearch = {"las vegas","orlando","phoenix","laurel md","fort myers"};
String [] ClosestStores = {"Las Vegas (Summerlin)","Orlando (Colonial Plaza)","Phoenix (Camelback)","Laurel (Corridor)","Fort Myers"};
SiteAccess.ActionAccessSite(driver, IP);
//Navigate to the Store Locator page
driver.findElement(By.cssSelector(StoreLink)).click();
Thread.sleep(3000);
logger.log(LogStatus.PASS, "Navigate to SL page");
//for (String SearchTerm : CitySearchTerms) {
for (int i=0;i<CitySearch.length;i++) {
//Enter search term and search
driver.findElement(By.id("storelocator-query")).click();
driver.findElement(By.id("storelocator-query")).clear();
driver.findElement(By.id("storelocator-query")).sendKeys(CitySearch[i]);
driver.findElement(By.id("storeFinderBtn")).click();
Thread.sleep(3000);
//Click the first "Did you mean?" link, if it appears
if (driver.findElements(By.cssSelector("button.btn > em.icon-rightarrow")).size()!=0) {
driver.findElement(By.cssSelector("button.btn > em.icon-rightarrow")).click();
}
//Validate search results
Assert.assertEquals(driver.findElement(By.xpath("//li[1]/div/address/a/p")).getText(),ClosestStores[i]);
logger.log(LogStatus.PASS, "Closest store while searching "+CitySearch[i]+" returned the Closest Store as "+ClosestStores[i]);
}
}
@Test //Search by State
public void SLStateSearchTest () throws InterruptedException {
logger=report.startTest("SL: State Search");
String [] ZipSearch = {"95630","33186"};
String [] ClosestStores = {"Folsom","Kendall"};
//Access the site using the remoteTestIPAddress URL parameter for all test IPs
SiteAccess.ActionAccessSite(driver, IP);
//Navigate to the Store Locator page
driver.findElement(By.cssSelector(StoreLink)).click();
Thread.sleep(3000);
//for (String SearchTerm : CitySearchTerms) {
for (int i=0;i<ZipSearch.length;i++) {
//Enter search term and search
driver.findElement(By.id("storelocator-query")).click();
driver.findElement(By.id("storelocator-query")).clear();
driver.findElement(By.id("storelocator-query")).sendKeys(ZipSearch[i]);
driver.findElement(By.id("storeFinderBtn")).click();
Thread.sleep(3000);
//Validate search results
Assert.assertEquals(driver.findElement(By.xpath("//li[1]/div/address/a/p")).getText(),ClosestStores[i]);
logger.log(LogStatus.PASS, "Closest store while searching "+ZipSearch[i]);
}
}
@Test //Search by Zip
public void SLZipSearchTest () throws InterruptedException {
logger=report.startTest("SL: Search by zip");
String [] StateSearch = {"delaware"};
String [] ClosestStores = {"Wilmington"};
//Access the site using the remoteTestIPAddress URL parameter for all test IPs
driver.get(ConfigurationFunctions.locationSet+IP);
Thread.sleep(5000);
driver.findElement(By.id("btnYes")).click();
Thread.sleep(5000);
driver.findElement(By.cssSelector("#email-signup-overlay-new-site > div.modal-dialog > div.modal-content > div.modal-body > p.close > a.btn-close")).click();
Thread.sleep(5000);
//Navigate to the Store Locator page
driver.findElement(By.cssSelector(StoreLink)).click();
Thread.sleep(3000);
//for (String SearchTerm : CitySearchTerms) {
for (int i=0;i<StateSearch.length;i++) {
//Enter search term and search
driver.findElement(By.id("storelocator-query")).click();
driver.findElement(By.id("storelocator-query")).clear();
driver.findElement(By.id("storelocator-query")).sendKeys(StateSearch[i]);
driver.findElement(By.id("storeFinderBtn")).click();
Thread.sleep(3000);
//Click the first "Did you mean?" link, if it appears
if (driver.findElements(By.cssSelector("button.btn > em.icon-rightarrow")).size()!=0) {
driver.findElement(By.cssSelector("button.btn > em.icon-rightarrow")).click();
}
//Validate search results
Assert.assertEquals(driver.findElement(By.xpath("//li[1]/div/address/a/p")).getText(),ClosestStores[i]);
logger.log(LogStatus.PASS, "Closest store while searching "+StateSearch[i]);
}
}
}
| [
"rajatsud@yahoo.com"
] | rajatsud@yahoo.com |
a60210f0758d56a5b4ba33294a8a1c422768555d | b0ec91b43376b40b7b7c0c54b56cc14750d203d6 | /Code Snippets/September/30September/Codes/P6.java | cbbb712f70d88e679824484465dfe35ea75872df | [] | no_license | himanshuparmar121/Sortedmap | a8c1e8df24cd4b85f4beacac926feb3bf9fd0c89 | c55b9d1ed038311a679ca943f29054906b425458 | refs/heads/master | 2023-03-07T00:31:34.845702 | 2021-02-09T17:26:43 | 2021-02-09T17:26:43 | 281,379,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | class Demo {
public static void main(String[] args) {
BufferedReader br = new BufferedReader();
String str = br.readLine();
System.out.println(str);
}
}
| [
"parmarhimanshu360@gmail.com"
] | parmarhimanshu360@gmail.com |
218cb5fc2e92f76fa058f2caf06aa4bd016139ab | 72e1e90dd8e1e43bad4a6ba46a44d1f30aa76fe6 | /java/core/javaee7-samples-master/websocket/atmosphere-chat/src/main/java/org/javaee7/websocket/atmosphere/JacksonDecoder.java | 94ef5505f1e21f3b124246ffdfa8e36b31f61805 | [
"CDDL-1.0",
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-oracle-openjdk-exception-2.0",
"Apache-2.0"
] | permissive | fernando-romulo-silva/myStudies | bfdf9f02778d2f4993999f0ffc0ddd0066ec41b4 | aa8867cda5edd54348f59583555b1f8fff3cd6b3 | refs/heads/master | 2023-08-16T17:18:50.665674 | 2023-08-09T19:47:15 | 2023-08-09T19:47:15 | 230,160,136 | 3 | 0 | Apache-2.0 | 2023-02-08T19:49:02 | 2019-12-25T22:27:59 | null | UTF-8 | Java | false | false | 1,159 | java | /*
* Copyright 2013 Jeanfrancois Arcand
*
* 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.javaee7.websocket.atmosphere;
import org.atmosphere.config.managed.Decoder;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.IOException;
/**
* Decode a String into a {@link Message}.
*/
public class JacksonDecoder implements Decoder<String, Message> {
private final ObjectMapper mapper = new ObjectMapper();
@Override
public Message decode(String s) {
try {
return mapper.readValue(s, Message.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
| [
"fernando.romulo.silva@gmail.com"
] | fernando.romulo.silva@gmail.com |
727062792b8cbb3b0f3e1f86115d8e1537d733d1 | 13b65e436a57d944d41250d9f472cbe26775f38c | /app/src/main/java/com/Dayat/finalmobile/data/api/repository/SingleRequest.java | d1bce456cb21740d2b926b528faa8e51823d6239 | [] | no_license | Hidayatullah14/FinalPM | 433196e8c8f3ef7d30983312a1a1754a6c4623e2 | 015b953e362d8295af8444863b80723e898ae167 | refs/heads/master | 2023-05-15T05:33:46.940109 | 2021-06-10T15:37:43 | 2021-06-10T15:37:43 | 375,748,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.deril1709.finalmobile.data.api.repository;
import com.deril1709.finalmobile.Consts;
import com.deril1709.finalmobile.data.api.Service;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class SingleRequest {
private static Service service;
public static Service getInstance() {
if(service == null) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Consts.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
service = retrofit.create(Service.class);
}
return service;
}
}
| [
"Dayattulla14@gmail.com"
] | Dayattulla14@gmail.com |
0f19b21424dd89713223e768d863d51aac4abe95 | 4cd77f7b407a78b30ce79994c030e19047f1b60d | /src/main/java/com/assessment/API.java | f20b9a1d97c3c92960ee3d55e817543351150743 | [] | no_license | sunkanokporn/DDTHAssessment | 16af7b260fac95376fa8a9967d730a2b936645f5 | 64133aff8d400f3017537cc633ce0cb9fa636afb | refs/heads/master | 2020-05-07T09:04:11.800494 | 2019-04-09T15:22:26 | 2019-04-09T15:22:26 | 180,361,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,449 | java | package com.assessment;
import com.assessment.com.MainLogic;
import com.bean.Input;
import com.bean.Output;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@RestController
public class API {
static MainLogic mainLogic = new MainLogic();
@RequestMapping("/api/hello")
public String hello(){
return "Hello";
}
@RequestMapping(path = "/api/firstfactorial",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public Output firstfactorial(@RequestBody Input input ){
int inpitInt = Integer.parseInt(input.getInput());
int result = mainLogic.FirstFactorial(inpitInt);
Output output = new Output(String.valueOf(result));
return output ;
}
@RequestMapping(path = "/api/rirstreverse",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public Output rirstreverse(@RequestBody Input input ){
String result = mainLogic.FirstReverse(input.getInput());
Output output = new Output(String.valueOf(result));
return output ;
}
@RequestMapping(path = "/api/alphabetsoup",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public Output alphabetsoup(@RequestBody Input input ){
String result = mainLogic.AlphabetSoup(input.getInput());
Output output = new Output(String.valueOf(result));
return output ;
}
}
| [
"kanokpon.tan@gmail.com"
] | kanokpon.tan@gmail.com |
f9d3de8ea99291fce5c15f2eb4b6d5399f5eebbf | 5923b0d035b7bafd6de650ceb7a67f25ba79eed9 | /src/main/java/cn/jianchen/com/trade/common/exception/ArgumentServiceException.java | 9b5b5b4436720c6898082f65ec7d98e2a591833d | [] | no_license | cpwk/school-trade-api | 0e825b8288723abcebb0b07799540477ed9ccd55 | 4129e4270f7fbb6eb13fa3f09be6b2b548b6c6be | refs/heads/master | 2023-02-25T03:30:51.461259 | 2020-08-05T06:29:44 | 2020-08-05T06:29:44 | 299,173,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 721 | java | package cn.jianchen.com.trade.common.exception;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 创建人:chenpeng
* 创建时间:2019-11-01 10:05
**/
public class ArgumentServiceException extends ServiceException {
private static final long serialVersionUID = -7398899188917026294L;
public ArgumentServiceException(String key, Serializable value) {
super(ErrorCode.ERR_ILLEGAL_ARGUMENT);
Map<String, Object> errorData = new HashMap<String, Object>(2);
errorData.put("key", key);
errorData.put("value", value);
this.setErrorData(errorData);
}
public ArgumentServiceException(String key) {
this(key, null);
}
}
| [
"1395688079@qq.com"
] | 1395688079@qq.com |
a8955ca573000fb7e39f2e8b685753488a76818c | 01d4416163c2c8beace93930a8e7c3c7281cbc36 | /Zelda ROBERTs/src/entity/weapons/Seed.java | ed0cb456e1b0eda91f86ebe47b1d3fb7b7eb336f | [] | no_license | cubeman99/old-eclipse-workspace | 639c7a6540545b68b4068159872c3986f81925d0 | e6001ce0e9e657abfbe8e8ec5fb9e3d956251d39 | refs/heads/master | 2020-08-03T08:03:01.258280 | 2019-09-29T14:41:31 | 2019-09-29T14:41:31 | 211,675,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,305 | java | package entity.weapons;
import entity.Entity;
import geometry.Point;
import geometry.Rectangle;
import geometry.Vector;
import graphics.Draw;
import graphics.Sprite;
import graphics.library.Library;
import java.awt.Graphics2D;
import world.Room;
/**
* A base seed that can be dropped or shot.
* @author Robert Jordan
*/
public class Seed extends Entity {
// ======================= Members ========================
/** The sprite of the effect. */
public Sprite effectSprite;
/** The tile of the seed. */
public Point tile;
/** Defines how the seed interacts with the environmemt. */
public int seedState;
/** The action state of the seed. */
public int effectState;
// 0 = dropped
// 1 = seed shooter
// 2 = slingshot center
// 3 = slingshot top
// 4 = slingshot bottom
// ===================== Constructors =====================
/** Constructs the default seed. */
public Seed() {
super("seed");
this.bounds = new Rectangle(4, 4, 8, 8);
this.z = 1.25 - 0.99;
this.zspeed = 1 - 0.99;
this.tile = new Point(4, 15);
this.seedState = 0;
this.effectState = 0;
this.effectSprite = new Sprite(null, null);
}
/** Constructs a seed with the given direction and position. */
public Seed(String seedType, int direction, int seedState, Point tile, Vector point, double z) {
super(seedType);
this.bounds = new Rectangle(4, 4, 8, 8);
this.position = new Vector(point);
this.z = z + 1 - 0.99;
this.zspeed = 0;
this.tile = new Point(tile);
this.seedState = seedState;
this.effectState = 0;
this.effectSprite = new Sprite(null, null);
if (seedState == 0) {
this.id += "_seed_satchel";
this.z = z + 1.25 - 0.99;
this.zspeed = 0.6;
double diag1 = 3.5 / Math.sqrt(2.0);
double diag2 = 0.75 / Math.sqrt(2.0);
switch (direction) {
case 0:
this.position.add( 3.5, 0);
this.velocity.set(0.75, 0);
break;
case 1:
this.position.add(diag1, diag1);
this.velocity.set(diag2, diag2);
break;
case 2:
this.position.add(0, 3.5);
this.velocity.set(0, 0.75);
break;
case 3:
this.position.add(-diag1, diag1);
this.velocity.set(-diag2, diag2);
break;
case 4:
this.position.add( -3.5, 0);
this.velocity.set(-0.75, 0);
break;
case 5:
this.position.add(-diag1, -diag1);
this.velocity.set(-diag2, -diag2);
break;
case 6:
this.position.add(0, -3.5);
this.velocity.set(0, -0.75);
break;
case 7:
this.position.add(diag1, -diag1);
this.velocity.set(diag2, -diag2);
break;
}
}
else if (seedState == 1) {
this.id += "_seed_shooter";
double diag1 = 16.0 / Math.sqrt(2.0);
double diag2 = 3.0 / Math.sqrt(2.0);
switch (direction) {
case 0:
this.position.add(16, 0);
this.velocity.set( 3, 0);
break;
case 1:
this.position.add(diag1, diag1);
this.velocity.set(diag2, diag2);
break;
case 2:
this.position.add(0, 16);
this.velocity.set(0, 3);
break;
case 3:
this.position.add(-diag1, diag1);
this.velocity.set(-diag2, diag2);
break;
case 4:
this.position.add(-16, 0);
this.velocity.set( -3, 0);
break;
case 5:
this.position.add(-diag1, -diag1);
this.velocity.set(-diag2, -diag2);
break;
case 6:
this.position.add(0, -16);
this.velocity.set(0, -3);
break;
case 7:
this.position.add(diag1, -diag1);
this.velocity.set(diag2, -diag2);
break;
}
}
else if (seedState == 2) {
this.id += "_slingshot";
double diag1 = 1.0 / Math.sqrt(2.0);
double diag2 = 3.0 / Math.sqrt(2.0);
switch (direction) {
case 0:
this.position.add(1, 0);
this.velocity.set(3, 0);
break;
case 1:
this.position.add(diag1, diag1);
this.velocity.set(diag2, diag2);
break;
case 2:
this.position.add(0, 1);
this.velocity.set(0, 3);
break;
case 3:
this.position.add(-diag1, diag1);
this.velocity.set(-diag2, diag2);
break;
case 4:
this.position.add(-1, 0);
this.velocity.set(-3, 0);
break;
case 5:
this.position.add(-diag1, -diag1);
this.velocity.set(-diag2, -diag2);
break;
case 6:
this.position.add(0, -1);
this.velocity.set(0, -3);
break;
case 7:
this.position.add(diag1, -diag1);
this.velocity.set(diag2, -diag2);
break;
}
}
else {
this.id += "_slingshot";
double diag1 = 1.0 / Math.sqrt(2.0);
//double diag2 = 2.75 / Math.sqrt(2.0);
double diag2 = 3.5 / Math.sqrt(2.0);
switch (direction) {
case 0:
this.position.add( 1, 0);
this.velocity.set(2.75, -1);
break;
case 1:
this.position.add(diag1, diag1);
this.velocity.set(diag2, diag1);
break;
case 2:
this.position.add( 0, 1);
this.velocity.set(-1, 2.75);
break;
case 3:
this.position.add(-diag1, diag1);
this.velocity.set(-diag2, diag1);
break;
case 4:
this.position.add( -1, 0);
this.velocity.set(-2.75, -1);
break;
case 5:
this.position.add(-diag1, -diag1);
this.velocity.set(-diag1, -diag2);
break;
case 6:
this.position.add( 0, -1);
this.velocity.set(-1, -2.75);
break;
case 7:
this.position.add(diag1, -diag1);
this.velocity.set(diag1, -diag2);
break;
}
if (seedState == 4) {
if (direction % 2 == 0) {
if (direction % 4 == 0)
this.velocity.y = -this.velocity.y;
else
this.velocity.x = -this.velocity.x;
}
else if (direction == 1 || direction == 5){
double swap = this.velocity.x;
this.velocity.x = this.velocity.y;
this.velocity.y = swap;
}
else {
double swap = this.velocity.x;
this.velocity.x = -this.velocity.y;
this.velocity.y = -swap;
}
}
}
}
/** Initializes the entity and sets up the container variables. */
public void initialize(Room room) {
super.initialize(room);
}
// ======================= Updating =======================
/** Called every step, before movement, to update the entity's state. */
public void preupdate() {
super.preupdate();
effectSprite.update();
if (seedState == 0 && effectState == 0)
zspeed -= 0.15;
if (effectSprite.isAnimationFinished()) {
destroy();
}
}
/** Called every step, before collision, to update the entity's state. */
public void update() {
super.update();
}
/** Called every step, after collision, to update the entity's state. */
public void postupdate() {
super.postupdate();
}
/** Called every step, after drawing, to update the entity's state. */
public void postdraw() {
super.postdraw();
}
/** Called every step to move the entity. */
public void updateMovement() {
super.updateMovement();
}
/** Called every step to check collisions. */
public void updateCollissions() {
super.updateCollissions();
if (room.isOutsideRoom(position, bounds)) {
destroy();
}
else if (effectState == 0 && z <= -1.0) {
velocity.zero();
effectState = 1;
zspeed = 0;
startEffect();
}
}
/** Called every step to draw the entity in the room. */
public void draw(Graphics2D g, Vector point) {
super.draw(g, point);
if (effectState == 0) {
Draw.drawTile(g, Library.tilesets.weapons, tile, point.plus(position).plus(0, -z));
}
else {
effectSprite.draw(g, point.plus(position).plus(0, -z));
}
}
// ===================== Seed Related =====================
/** Called to create the effect and perform actions. */
public void startEffect() {
effectSprite.setAnimation(Library.animations.mysterySeedEffect);
effectSprite.setTileset(Library.tilesets.specialEffects);
}
/** Creates a seed of the specific type. */
public static Seed createSeedOfType(String type, int direction, int seedState, Vector point, double z) {
if (type.equals("ember_seeds"))
return new EmberSeed(direction, seedState, point, z);
else if (type.equals("scent_seeds"))
return new ScentSeed(direction, seedState, point, z);
else if (type.equals("pegasus_seeds"))
return new PegasusSeed(direction, seedState, point, z);
else if (type.equals("gale_seeds"))
return new GaleSeed(direction, seedState, point, z);
else if (type.equals("mystery_seeds"))
return new MysterySeed(direction, seedState, point, z);
return null;
}
} | [
"jordand95@gmail.com"
] | jordand95@gmail.com |
b0f8e9fc814077249ce5ad324b0c0b32a7e379f6 | 5b216f274a8d14c9307ee32b5b8628bf0b083174 | /src/main/java/bjad/swing/DateEntryField.java | 82b9f06c6d454ea661fd3f36c248f7267658849f | [] | no_license | bendougall/BJAD_SwingUtils | 1c880e4ea4090409a77aed5db14ba42cf3a4ecec | 9a928af643ae83b49c52dcecae10a652543f9518 | refs/heads/master | 2022-12-03T13:33:38.861522 | 2022-11-26T12:58:32 | 2022-11-26T12:58:32 | 61,485,472 | 0 | 0 | null | 2021-12-19T14:45:44 | 2016-06-19T14:59:06 | Java | UTF-8 | Java | false | false | 5,913 | java | package bjad.swing;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.text.Document;
import bjad.swing.InvalidKeyEntryListener.InvalidatedReason;
/**
* Field for entering a date value into and
* then show as a formatted string once
* focus is lost in the field.
*
* @author
* Ben Dougall
*/
public class DateEntryField extends AbstractRestrictiveTextField
{
private static final long serialVersionUID = -4673002871494096631L;
private static final SimpleDateFormat YYYYMMDD_FORMAT = new SimpleDateFormat("yyyyMMdd");
private static final SimpleDateFormat YYMMDD_FORMAT = new SimpleDateFormat("yyMMdd");
private Document baseDoc;
private NumericFieldDocument numDoc;
/**
* The datw formatter used to format the date entered in the
* field to a more readable format.
*/
protected DateFormat displayFormat = new SimpleDateFormat("MMM d, yyyy");
/**
* The date entered in the field.
*/
protected Date enteredDate = null;
/**
* Default constructor, setting up the field without a
* prefilled date.
*/
public DateEntryField()
{
this(null);
}
/**
* Constructor setting the date within the field.
*
* @param defaultDate
* The default to show in the field.
*/
public DateEntryField(Date defaultDate)
{
setPlaceholderText("CCYYMMDD");
baseDoc = getDocument();
if (defaultDate != null)
{
enteredDate = defaultDate;
updateDateDisplay();
}
numDoc = new NumericFieldDocument(this, new BigDecimal(99_000_000L), false, false);
}
/**
* Returns the date in the the field, or null if blank
* or an invalid date has been entered.
*
* @return
* The date entered, which is validated if the field
* currently has focus.
*/
public Date getEnteredDate()
{
// Field has focus? Trigger the validation and update
// logic we do when focus is losted to ensure the
// date is properly set.
if (hasFocus())
{
onFocusLost();
}
return enteredDate;
}
/**
* Sets the date value in the field
* @param value
* The date to show in the field.
*/
public void setEnteredDate(Date value)
{
enteredDate = value;
updateDateDisplay();
}
/**
* Throws an exception right away, as you should use the
* getEnteredDate method to get the date contained in the field.
*
* @see javax.swing.text.JTextComponent#setText(java.lang.String)
*/
@Override
public String getText()
{
throw new IllegalArgumentException("Please use getEnteredDate() from the field.");
}
/**
* Throws an exception right away, as you should use the
* setEnteredDate(Date) function to set the date in the field.
*/
@Override
public void setText(String val)
{
throw new IllegalArgumentException("Please use setEnteredDate(Date) to set the date in the field");
}
/**
* Returns the date formatter used to display the date
* once entered by the user.
*
* @return
* The date formatter used to display the date to
* the user once the date is enetered and focus
* is lost.
*/
public DateFormat getDisplayFormat()
{
return this.displayFormat;
}
/**
* Sets the format to display the date in the field with
* once a date is entered and focus on lost within the
* field.
*
* @param formatter
* The formatter to use to display the entered date
* with. If null is passed, the existing formatter
* will be used.
*/
public void setDisplayFormat(DateFormat formatter)
{
if (formatter != null)
{
displayFormat = formatter;
if (enteredDate != null)
{
updateDateDisplay();
}
}
}
/**
* When focus is lost on the field, the user entry
* will be validated. If a date is found, the entered
* value is formatted into the readable format.
*/
@Override
protected void onFocusLost()
{
// Attempt to convert the entry into a
// date object.
try
{
switch (getTextContent().length())
{
case 0:
enteredDate = null;
case 6:
enteredDate = YYMMDD_FORMAT.parse(getTextContent());
break;
case 8:
enteredDate = YYYYMMDD_FORMAT.parse(getTextContent());
break;
default:
fireInvalidEntryListeners(InvalidatedReason.INVALID_DATE, getTextContent() + " is an invalid date.");
enteredDate = null;
super.setText("");
}
}
catch (ParseException ex)
{
fireInvalidEntryListeners(InvalidatedReason.INVALID_DATE, getTextContent() + " is an invalid date.");
enteredDate = null;
super.setText("");
}
// Update the display in the field.
updateDateDisplay();
}
/**
* When focus is gained in the field, the document
* supporting numeric entry only is applied, and
* the entered date is returned to the int key
* format.
*/
@Override
protected void onFocusGained()
{
if (enteredDate != null)
{
super.setText(YYYYMMDD_FORMAT.format(enteredDate));
}
setDocument(numDoc);
}
/**
* Updates the field's contents by removing the
* character restricting document and then formatted
* the entered date if one is found.
*/
private void updateDateDisplay()
{
setDocument(baseDoc);
if (enteredDate != null)
{
super.setText(displayFormat.format(enteredDate));
}
}
}
| [
"ben.dougall@gmail.com"
] | ben.dougall@gmail.com |
9b45e18e359867229315333fddd9a1e61af475b3 | d62b02b365b177d535a1a8b754aea6252c1a4199 | /week-01/day-4/src/Coding_Hours/CodingHours.java | 0b00add9701d6c5f55135a7acd0e233c9a8ba4bb | [] | no_license | green-fox-academy/SzidAnett | 56ed9839b9248993ce800c419519f66db56ce272 | 95f7e0d0e40ef68e6acc491ba5065fc8b18bf2ac | refs/heads/master | 2022-12-01T01:03:56.325146 | 2020-08-14T15:46:09 | 2020-08-14T15:46:09 | 265,593,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package Coding_Hours;
public class CodingHours {
public static void main(String[] args) {
int dailyHours = 6;
int weeks = 17;
System.out.println("Hours spent with coding in a semester: " + (weeks * 5 * dailyHours));
int a = weeks * 5 * dailyHours;
int b = weeks * 52;
System.out.println("Percentage of the coding hours: " + ((float) a / b * 100) + "%");
}
}
| [
"amszideri@gmail.com"
] | amszideri@gmail.com |
9593ef3ed5f4a9a8c785a4f1edc3291ac95f4e3e | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/app/a.java | 014716bc27c1d7572a4561a5f5842a3084fbdb8d | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 38,077 | java | package com.tencent.mm.app;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
import android.util.Base64;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.compatible.e.p;
import com.tencent.mm.sdk.a.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.bo;
public final class a
{
private static String bWa;
private static int cdA;
private static p cdB;
private static final a.b cdC;
private static final a.d cdD;
private static a.b cdE;
private static a.d cdF;
private static Handler cdG;
private static int cdH;
private static int cdI;
private static String cdJ;
private static boolean cdK;
private static boolean cdL;
private static Thread cdM;
private static int cdz;
static
{
AppMethodBeat.i(15364);
cdz = 0;
cdA = 0;
cdB = new p(Process.myPid());
cdC = new a.b()
{
public final void c(a.a paramAnonymousa)
{
AppMethodBeat.i(15348);
int i = ah.getContext().getSharedPreferences("system_config_prefs", com.tencent.mm.compatible.util.h.Mu()).getInt("main_thread_watch_report", 0);
boolean bool;
if (i > 0)
bool = true;
while (true)
{
ab.w("MicroMsg.ANRWatchDog.summeranr", "summeranr onAppNotResponding error reportFlag[%b]", new Object[] { Boolean.valueOf(bool) });
try
{
String str = a.b(paramAnonymousa);
if (i > 0)
{
paramAnonymousa = str;
if (str != null)
{
paramAnonymousa = str;
if (str.length() > 51200)
paramAnonymousa = str.substring(0, 51200);
}
b.A(Base64.encodeToString(paramAnonymousa.getBytes(), 2), "main_thread_watch");
AppMethodBeat.o(15348);
}
while (true)
{
return;
bool = false;
break;
com.tencent.mm.plugin.report.service.h.pYm.a(510L, 14L, 1L, true);
AppMethodBeat.o(15348);
}
}
catch (OutOfMemoryError paramAnonymousa)
{
while (true)
{
ab.e("MicroMsg.ANRWatchDog.summeranr", "summeranr buildReport OutOfMemory %s", new Object[] { paramAnonymousa.getMessage() });
System.gc();
com.tencent.mm.plugin.report.service.h.pYm.a(510L, 15L, 1L, true);
AppMethodBeat.o(15348);
}
}
}
}
};
cdD = new a.d()
{
public final void a(InterruptedException paramAnonymousInterruptedException)
{
AppMethodBeat.i(15349);
ab.w("MicroMsg.ANRWatchDog.summeranr", "summeranr DEFAULT_INTERRUPTION_LISTENER onInterrupted exception.getMessage[%s]", new Object[] { paramAnonymousInterruptedException.getMessage() });
AppMethodBeat.o(15349);
}
};
cdE = cdC;
cdF = cdD;
cdH = 4500;
cdI = 500;
cdJ = "";
cdK = true;
cdL = false;
bWa = "";
AppMethodBeat.o(15364);
}
// ERROR //
private static String a(a.a parama)
{
// Byte code:
// 0: sipush 15361
// 3: invokestatic 47 com/tencent/matrix/trace/core/AppMethodBeat:i (I)V
// 6: new 123 org/json/JSONObject
// 9: dup
// 10: invokespecial 124 org/json/JSONObject:<init> ()V
// 13: astore_1
// 14: new 123 org/json/JSONObject
// 17: astore_2
// 18: aload_2
// 19: invokespecial 124 org/json/JSONObject:<init> ()V
// 22: aload_1
// 23: ldc 126
// 25: aload_2
// 26: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 29: pop
// 30: aload_2
// 31: ldc 132
// 33: iconst_1
// 34: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 37: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 40: pop
// 41: new 140 java/lang/String
// 44: astore_3
// 45: aload_3
// 46: getstatic 145 android/os/Build:MODEL Ljava/lang/String;
// 49: invokespecial 148 java/lang/String:<init> (Ljava/lang/String;)V
// 52: aload_2
// 53: ldc 150
// 55: aload_3
// 56: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 59: pop
// 60: new 140 java/lang/String
// 63: astore 4
// 65: new 152 java/lang/StringBuilder
// 68: astore_3
// 69: aload_3
// 70: ldc 154
// 72: invokespecial 155 java/lang/StringBuilder:<init> (Ljava/lang/String;)V
// 75: aload 4
// 77: aload_3
// 78: getstatic 160 android/os/Build$VERSION:SDK_INT I
// 81: invokevirtual 164 java/lang/StringBuilder:append (I)Ljava/lang/StringBuilder;
// 84: invokevirtual 168 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 87: invokespecial 148 java/lang/String:<init> (Ljava/lang/String;)V
// 90: aload_2
// 91: ldc 170
// 93: aload 4
// 95: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 98: pop
// 99: new 123 org/json/JSONObject
// 102: astore_3
// 103: aload_3
// 104: invokespecial 124 org/json/JSONObject:<init> ()V
// 107: aload_1
// 108: ldc 172
// 110: aload_3
// 111: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 114: pop
// 115: aload_3
// 116: ldc 174
// 118: ldc 176
// 120: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 123: pop
// 124: new 178 org/json/JSONArray
// 127: astore_2
// 128: aload_2
// 129: invokespecial 179 org/json/JSONArray:<init> ()V
// 132: new 123 org/json/JSONObject
// 135: astore 4
// 137: aload 4
// 139: invokespecial 124 org/json/JSONObject:<init> ()V
// 142: aload_2
// 143: aload 4
// 145: invokevirtual 182 org/json/JSONArray:put (Ljava/lang/Object;)Lorg/json/JSONArray;
// 148: pop
// 149: aload_3
// 150: ldc 184
// 152: aload_2
// 153: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 156: pop
// 157: new 123 org/json/JSONObject
// 160: astore_2
// 161: aload_2
// 162: invokespecial 124 org/json/JSONObject:<init> ()V
// 165: aload 4
// 167: ldc 186
// 169: aload_2
// 170: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 173: pop
// 174: aload_0
// 175: getfield 190 com/tencent/mm/app/a$a:cdN Ljava/util/LinkedList;
// 178: astore_0
// 179: aload_0
// 180: invokestatic 196 com/tencent/mm/sdk/platformtools/bo:ek (Ljava/util/List;)Z
// 183: ifne +301 -> 484
// 186: aload_0
// 187: invokevirtual 202 java/util/LinkedList:iterator ()Ljava/util/Iterator;
// 190: astore_0
// 191: aload_0
// 192: invokeinterface 207 1 0
// 197: ifeq +287 -> 484
// 200: aload_0
// 201: invokeinterface 211 1 0
// 206: checkcast 213 android/util/Pair
// 209: astore 5
// 211: aload 5
// 213: getfield 217 android/util/Pair:first Ljava/lang/Object;
// 216: checkcast 219 java/lang/Thread
// 219: astore 6
// 221: aload 5
// 223: getfield 222 android/util/Pair:second Ljava/lang/Object;
// 226: checkcast 224 [Ljava/lang/StackTraceElement;
// 229: astore 5
// 231: aload 5
// 233: ifnull -42 -> 191
// 236: aload 5
// 238: arraylength
// 239: ifle -48 -> 191
// 242: new 152 java/lang/StringBuilder
// 245: astore 7
// 247: aload 7
// 249: invokespecial 225 java/lang/StringBuilder:<init> ()V
// 252: aload 7
// 254: aload 6
// 256: invokevirtual 228 java/lang/Thread:getName ()Ljava/lang/String;
// 259: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 262: ldc 233
// 264: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 267: aload 6
// 269: invokevirtual 236 java/lang/Thread:getPriority ()I
// 272: invokevirtual 164 java/lang/StringBuilder:append (I)Ljava/lang/StringBuilder;
// 275: ldc 238
// 277: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 280: aload 6
// 282: invokevirtual 242 java/lang/Thread:getId ()J
// 285: invokevirtual 245 java/lang/StringBuilder:append (J)Ljava/lang/StringBuilder;
// 288: ldc 247
// 290: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 293: aload 6
// 295: invokevirtual 251 java/lang/Thread:getState ()Ljava/lang/Thread$State;
// 298: invokevirtual 254 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder;
// 301: ldc_w 256
// 304: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 307: invokevirtual 168 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 310: astore 7
// 312: new 178 org/json/JSONArray
// 315: astore 6
// 317: aload 6
// 319: invokespecial 179 org/json/JSONArray:<init> ()V
// 322: aload 5
// 324: arraylength
// 325: istore 8
// 327: iconst_0
// 328: istore 9
// 330: iload 9
// 332: iload 8
// 334: if_icmpge +32 -> 366
// 337: aload 5
// 339: iload 9
// 341: aaload
// 342: astore 10
// 344: aload 10
// 346: ifnull +14 -> 360
// 349: aload 6
// 351: aload 10
// 353: invokevirtual 259 java/lang/StackTraceElement:toString ()Ljava/lang/String;
// 356: invokevirtual 182 org/json/JSONArray:put (Ljava/lang/Object;)Lorg/json/JSONArray;
// 359: pop
// 360: iinc 9 1
// 363: goto -33 -> 330
// 366: aload_2
// 367: aload 7
// 369: aload 6
// 371: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 374: pop
// 375: goto -184 -> 191
// 378: astore_0
// 379: ldc_w 261
// 382: aload_0
// 383: ldc_w 263
// 386: iconst_0
// 387: anewarray 4 java/lang/Object
// 390: invokestatic 269 com/tencent/mm/sdk/platformtools/ab:printErrStackTrace (Ljava/lang/String;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
// 393: getstatic 275 com/tencent/mm/plugin/report/service/h:pYm Lcom/tencent/mm/plugin/report/service/h;
// 396: ldc2_w 276
// 399: ldc2_w 278
// 402: lconst_1
// 403: iconst_1
// 404: invokevirtual 282 com/tencent/mm/plugin/report/service/h:a (JJJZ)V
// 407: aload_1
// 408: invokevirtual 283 org/json/JSONObject:toString ()Ljava/lang/String;
// 411: astore_2
// 412: aload_1
// 413: invokevirtual 286 org/json/JSONObject:length ()I
// 416: istore 9
// 418: aload_2
// 419: invokevirtual 287 java/lang/String:length ()I
// 422: istore 8
// 424: aload_2
// 425: invokevirtual 287 java/lang/String:length ()I
// 428: ldc_w 288
// 431: if_icmple +986 -> 1417
// 434: aload_2
// 435: iconst_0
// 436: ldc_w 288
// 439: invokevirtual 292 java/lang/String:substring (II)Ljava/lang/String;
// 442: astore_0
// 443: ldc_w 261
// 446: ldc_w 294
// 449: iconst_3
// 450: anewarray 4 java/lang/Object
// 453: dup
// 454: iconst_0
// 455: iload 9
// 457: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 460: aastore
// 461: dup
// 462: iconst_1
// 463: iload 8
// 465: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 468: aastore
// 469: dup
// 470: iconst_2
// 471: aload_0
// 472: aastore
// 473: invokestatic 297 com/tencent/mm/sdk/platformtools/ab:i (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
// 476: sipush 15361
// 479: invokestatic 93 com/tencent/matrix/trace/core/AppMethodBeat:o (I)V
// 482: aload_2
// 483: areturn
// 484: getstatic 65 com/tencent/mm/app/a:cdB Lcom/tencent/mm/compatible/e/p;
// 487: invokevirtual 300 com/tencent/mm/compatible/e/p:LI ()I
// 490: istore 11
// 492: getstatic 65 com/tencent/mm/app/a:cdB Lcom/tencent/mm/compatible/e/p;
// 495: invokevirtual 303 com/tencent/mm/compatible/e/p:LJ ()I
// 498: istore 9
// 500: getstatic 65 com/tencent/mm/app/a:cdB Lcom/tencent/mm/compatible/e/p;
// 503: invokevirtual 306 com/tencent/mm/compatible/e/p:LH ()I
// 506: istore 8
// 508: ldc_w 261
// 511: ldc_w 308
// 514: iconst_3
// 515: anewarray 4 java/lang/Object
// 518: dup
// 519: iconst_0
// 520: iload 11
// 522: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 525: aastore
// 526: dup
// 527: iconst_1
// 528: iload 9
// 530: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 533: aastore
// 534: dup
// 535: iconst_2
// 536: iload 8
// 538: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 541: aastore
// 542: invokestatic 297 com/tencent/mm/sdk/platformtools/ab:i (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
// 545: aload 4
// 547: ldc_w 310
// 550: iload 11
// 552: invokevirtual 313 org/json/JSONObject:put (Ljava/lang/String;I)Lorg/json/JSONObject;
// 555: pop
// 556: aload 4
// 558: ldc_w 315
// 561: iload 9
// 563: invokevirtual 313 org/json/JSONObject:put (Ljava/lang/String;I)Lorg/json/JSONObject;
// 566: pop
// 567: aload 4
// 569: ldc_w 317
// 572: iload 8
// 574: invokevirtual 313 org/json/JSONObject:put (Ljava/lang/String;I)Lorg/json/JSONObject;
// 577: pop
// 578: invokestatic 323 com/tencent/mm/sdk/platformtools/ah:getContext ()Landroid/content/Context;
// 581: ldc_w 325
// 584: invokevirtual 331 android/content/Context:getSystemService (Ljava/lang/String;)Ljava/lang/Object;
// 587: checkcast 333 android/app/ActivityManager
// 590: astore 5
// 592: new 335 android/app/ActivityManager$MemoryInfo
// 595: astore_2
// 596: aload_2
// 597: invokespecial 336 android/app/ActivityManager$MemoryInfo:<init> ()V
// 600: aload 5
// 602: aload_2
// 603: invokevirtual 340 android/app/ActivityManager:getMemoryInfo (Landroid/app/ActivityManager$MemoryInfo;)V
// 606: lconst_0
// 607: lstore 12
// 609: bipush 16
// 611: invokestatic 346 com/tencent/mm/compatible/util/d:iW (I)Z
// 614: ifeq +399 -> 1013
// 617: aload_2
// 618: getfield 350 android/app/ActivityManager$MemoryInfo:totalMem J
// 621: lstore 12
// 623: ldc_w 261
// 626: ldc_w 352
// 629: iconst_4
// 630: anewarray 4 java/lang/Object
// 633: dup
// 634: iconst_0
// 635: lload 12
// 637: invokestatic 357 java/lang/Long:valueOf (J)Ljava/lang/Long;
// 640: aastore
// 641: dup
// 642: iconst_1
// 643: aload_2
// 644: getfield 360 android/app/ActivityManager$MemoryInfo:availMem J
// 647: invokestatic 357 java/lang/Long:valueOf (J)Ljava/lang/Long;
// 650: aastore
// 651: dup
// 652: iconst_2
// 653: aload_2
// 654: getfield 363 android/app/ActivityManager$MemoryInfo:threshold J
// 657: invokestatic 357 java/lang/Long:valueOf (J)Ljava/lang/Long;
// 660: aastore
// 661: dup
// 662: iconst_3
// 663: aload_2
// 664: getfield 366 android/app/ActivityManager$MemoryInfo:lowMemory Z
// 667: invokestatic 371 java/lang/Boolean:valueOf (Z)Ljava/lang/Boolean;
// 670: aastore
// 671: invokestatic 297 com/tencent/mm/sdk/platformtools/ab:i (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
// 674: aload 4
// 676: ldc_w 373
// 679: lload 12
// 681: invokevirtual 376 org/json/JSONObject:put (Ljava/lang/String;J)Lorg/json/JSONObject;
// 684: pop
// 685: aload 4
// 687: ldc_w 378
// 690: aload_2
// 691: getfield 360 android/app/ActivityManager$MemoryInfo:availMem J
// 694: invokevirtual 376 org/json/JSONObject:put (Ljava/lang/String;J)Lorg/json/JSONObject;
// 697: pop
// 698: aload 4
// 700: ldc_w 380
// 703: aload_2
// 704: getfield 363 android/app/ActivityManager$MemoryInfo:threshold J
// 707: invokevirtual 376 org/json/JSONObject:put (Ljava/lang/String;J)Lorg/json/JSONObject;
// 710: pop
// 711: aload 4
// 713: ldc_w 382
// 716: aload_2
// 717: getfield 366 android/app/ActivityManager$MemoryInfo:lowMemory Z
// 720: invokevirtual 385 org/json/JSONObject:put (Ljava/lang/String;Z)Lorg/json/JSONObject;
// 723: pop
// 724: aload 4
// 726: ldc_w 387
// 729: invokestatic 392 android/os/Debug:getNativeHeapSize ()J
// 732: invokevirtual 376 org/json/JSONObject:put (Ljava/lang/String;J)Lorg/json/JSONObject;
// 735: pop
// 736: aload 4
// 738: ldc_w 394
// 741: invokestatic 397 android/os/Debug:getNativeHeapAllocatedSize ()J
// 744: invokevirtual 376 org/json/JSONObject:put (Ljava/lang/String;J)Lorg/json/JSONObject;
// 747: pop
// 748: aload 4
// 750: ldc_w 399
// 753: invokestatic 402 android/os/Debug:getNativeHeapFreeSize ()J
// 756: invokevirtual 376 org/json/JSONObject:put (Ljava/lang/String;J)Lorg/json/JSONObject;
// 759: pop
// 760: aload 5
// 762: iconst_1
// 763: newarray int
// 765: dup
// 766: iconst_0
// 767: invokestatic 59 android/os/Process:myPid ()I
// 770: iastore
// 771: invokevirtual 406 android/app/ActivityManager:getProcessMemoryInfo ([I)[Landroid/os/Debug$MemoryInfo;
// 774: astore_0
// 775: aload_0
// 776: ifnull +66 -> 842
// 779: aload_0
// 780: arraylength
// 781: ifle +61 -> 842
// 784: aload_0
// 785: iconst_0
// 786: aaload
// 787: ifnull +55 -> 842
// 790: aload_0
// 791: iconst_0
// 792: aaload
// 793: astore_0
// 794: aload 4
// 796: ldc_w 408
// 799: aload_0
// 800: invokevirtual 413 android/os/Debug$MemoryInfo:getTotalPrivateDirty ()I
// 803: bipush 10
// 805: ishl
// 806: invokevirtual 313 org/json/JSONObject:put (Ljava/lang/String;I)Lorg/json/JSONObject;
// 809: pop
// 810: aload 4
// 812: ldc_w 415
// 815: aload_0
// 816: invokevirtual 418 android/os/Debug$MemoryInfo:getTotalSharedDirty ()I
// 819: bipush 10
// 821: ishl
// 822: invokevirtual 313 org/json/JSONObject:put (Ljava/lang/String;I)Lorg/json/JSONObject;
// 825: pop
// 826: aload 4
// 828: ldc_w 420
// 831: aload_0
// 832: invokevirtual 423 android/os/Debug$MemoryInfo:getTotalPss ()I
// 835: bipush 10
// 837: ishl
// 838: invokevirtual 313 org/json/JSONObject:put (Ljava/lang/String;I)Lorg/json/JSONObject;
// 841: pop
// 842: getstatic 49 com/tencent/mm/app/a:cdz I
// 845: iconst_1
// 846: if_icmpne +417 -> 1263
// 849: invokestatic 428 com/tencent/mm/model/aw:RK ()Z
// 852: ifeq +411 -> 1263
// 855: invokestatic 434 com/tencent/mm/kernel/g:RN ()Lcom/tencent/mm/kernel/a;
// 858: getfield 439 com/tencent/mm/kernel/a:eJb Z
// 861: ifeq +402 -> 1263
// 864: getstatic 445 com/tencent/mm/storage/ac$a:xQt Lcom/tencent/mm/storage/ac$a;
// 867: astore 6
// 869: getstatic 448 com/tencent/mm/storage/ac$a:xQu Lcom/tencent/mm/storage/ac$a;
// 872: astore 14
// 874: getstatic 451 com/tencent/mm/storage/ac$a:xQv Lcom/tencent/mm/storage/ac$a;
// 877: astore 10
// 879: getstatic 454 com/tencent/mm/storage/ac$a:xQw Lcom/tencent/mm/storage/ac$a;
// 882: astore 5
// 884: getstatic 457 com/tencent/mm/storage/ac$a:xQx Lcom/tencent/mm/storage/ac$a;
// 887: astore 7
// 889: getstatic 460 com/tencent/mm/storage/ac$a:xQy Lcom/tencent/mm/storage/ac$a;
// 892: astore 15
// 894: getstatic 463 com/tencent/mm/storage/ac$a:xQz Lcom/tencent/mm/storage/ac$a;
// 897: astore 16
// 899: iconst_0
// 900: istore 9
// 902: ldc 82
// 904: astore_0
// 905: iload 9
// 907: bipush 7
// 909: if_icmpge +321 -> 1230
// 912: bipush 7
// 914: anewarray 441 com/tencent/mm/storage/ac$a
// 917: dup
// 918: iconst_0
// 919: aload 6
// 921: aastore
// 922: dup
// 923: iconst_1
// 924: aload 14
// 926: aastore
// 927: dup
// 928: iconst_2
// 929: aload 10
// 931: aastore
// 932: dup
// 933: iconst_3
// 934: aload 5
// 936: aastore
// 937: dup
// 938: iconst_4
// 939: aload 7
// 941: aastore
// 942: dup
// 943: iconst_5
// 944: aload 15
// 946: aastore
// 947: dup
// 948: bipush 6
// 950: aload 16
// 952: aastore
// 953: iload 9
// 955: aaload
// 956: astore_2
// 957: new 152 java/lang/StringBuilder
// 960: astore 17
// 962: aload 17
// 964: invokespecial 225 java/lang/StringBuilder:<init> ()V
// 967: aload 17
// 969: aload_0
// 970: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 973: astore 17
// 975: invokestatic 467 com/tencent/mm/model/aw:ZK ()Lcom/tencent/mm/model/c;
// 978: pop
// 979: aload 17
// 981: invokestatic 473 com/tencent/mm/model/c:Ry ()Lcom/tencent/mm/storage/z;
// 984: aload_2
// 985: lconst_0
// 986: invokestatic 357 java/lang/Long:valueOf (J)Ljava/lang/Long;
// 989: invokevirtual 479 com/tencent/mm/storage/z:get (Lcom/tencent/mm/storage/ac$a;Ljava/lang/Object;)Ljava/lang/Object;
// 992: invokevirtual 254 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder;
// 995: ldc_w 481
// 998: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 1001: invokevirtual 168 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 1004: astore_2
// 1005: iinc 9 1
// 1008: aload_2
// 1009: astore_0
// 1010: goto -105 -> 905
// 1013: new 483 java/io/RandomAccessFile
// 1016: astore_0
// 1017: aload_0
// 1018: ldc_w 485
// 1021: ldc_w 487
// 1024: invokespecial 490 java/io/RandomAccessFile:<init> (Ljava/lang/String;Ljava/lang/String;)V
// 1027: new 492 java/lang/StringBuffer
// 1030: astore 7
// 1032: aload 7
// 1034: invokespecial 493 java/lang/StringBuffer:<init> ()V
// 1037: aload_0
// 1038: invokevirtual 496 java/io/RandomAccessFile:readLine ()Ljava/lang/String;
// 1041: invokevirtual 500 java/lang/String:toCharArray ()[C
// 1044: astore 6
// 1046: aload 6
// 1048: arraylength
// 1049: istore 8
// 1051: iconst_0
// 1052: istore 9
// 1054: iload 9
// 1056: iload 8
// 1058: if_icmpge +40 -> 1098
// 1061: aload 6
// 1063: iload 9
// 1065: caload
// 1066: bipush 57
// 1068: if_icmpgt +24 -> 1092
// 1071: aload 6
// 1073: iload 9
// 1075: caload
// 1076: bipush 48
// 1078: if_icmplt +14 -> 1092
// 1081: aload 7
// 1083: aload 6
// 1085: iload 9
// 1087: caload
// 1088: invokevirtual 503 java/lang/StringBuffer:append (C)Ljava/lang/StringBuffer;
// 1091: pop
// 1092: iinc 9 1
// 1095: goto -41 -> 1054
// 1098: aload 7
// 1100: invokevirtual 504 java/lang/StringBuffer:toString ()Ljava/lang/String;
// 1103: ldc2_w 505
// 1106: invokestatic 510 com/tencent/mm/sdk/platformtools/bo:getLong (Ljava/lang/String;J)J
// 1109: lstore 18
// 1111: lload 18
// 1113: lconst_0
// 1114: lcmp
// 1115: ifle +10 -> 1125
// 1118: lload 18
// 1120: bipush 10
// 1122: lshl
// 1123: lstore 12
// 1125: aload_0
// 1126: invokevirtual 513 java/io/RandomAccessFile:close ()V
// 1129: goto -506 -> 623
// 1132: astore_0
// 1133: ldc_w 261
// 1136: aload_0
// 1137: ldc_w 515
// 1140: iconst_0
// 1141: anewarray 4 java/lang/Object
// 1144: invokestatic 269 com/tencent/mm/sdk/platformtools/ab:printErrStackTrace (Ljava/lang/String;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
// 1147: getstatic 275 com/tencent/mm/plugin/report/service/h:pYm Lcom/tencent/mm/plugin/report/service/h;
// 1150: ldc2_w 276
// 1153: ldc2_w 516
// 1156: lconst_1
// 1157: iconst_1
// 1158: invokevirtual 282 com/tencent/mm/plugin/report/service/h:a (JJJZ)V
// 1161: goto -754 -> 407
// 1164: astore 6
// 1166: ldc_w 261
// 1169: aload 6
// 1171: ldc_w 519
// 1174: iconst_0
// 1175: anewarray 4 java/lang/Object
// 1178: invokestatic 269 com/tencent/mm/sdk/platformtools/ab:printErrStackTrace (Ljava/lang/String;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
// 1181: aload_0
// 1182: invokevirtual 513 java/io/RandomAccessFile:close ()V
// 1185: goto -562 -> 623
// 1188: astore_2
// 1189: aload_0
// 1190: invokevirtual 513 java/io/RandomAccessFile:close ()V
// 1193: sipush 15361
// 1196: invokestatic 93 com/tencent/matrix/trace/core/AppMethodBeat:o (I)V
// 1199: aload_2
// 1200: athrow
// 1201: astore_2
// 1202: ldc_w 261
// 1205: aload_2
// 1206: ldc_w 521
// 1209: iconst_0
// 1210: anewarray 4 java/lang/Object
// 1213: invokestatic 269 com/tencent/mm/sdk/platformtools/ab:printErrStackTrace (Ljava/lang/String;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
// 1216: getstatic 275 com/tencent/mm/plugin/report/service/h:pYm Lcom/tencent/mm/plugin/report/service/h;
// 1219: ldc2_w 276
// 1222: ldc2_w 522
// 1225: lconst_1
// 1226: iconst_1
// 1227: invokevirtual 282 com/tencent/mm/plugin/report/service/h:a (JJJZ)V
// 1230: ldc_w 261
// 1233: ldc_w 525
// 1236: iconst_2
// 1237: anewarray 4 java/lang/Object
// 1240: dup
// 1241: iconst_0
// 1242: getstatic 90 com/tencent/mm/app/a:bWa Ljava/lang/String;
// 1245: aastore
// 1246: dup
// 1247: iconst_1
// 1248: aload_0
// 1249: aastore
// 1250: invokestatic 297 com/tencent/mm/sdk/platformtools/ab:i (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
// 1253: aload 4
// 1255: ldc_w 527
// 1258: aload_0
// 1259: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 1262: pop
// 1263: aload 4
// 1265: ldc_w 529
// 1268: getstatic 78 com/tencent/mm/app/a:cdH I
// 1271: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 1274: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 1277: pop
// 1278: iconst_0
// 1279: istore 9
// 1281: getstatic 534 com/tencent/mm/storage/ac:eSj Ljava/lang/String;
// 1284: astore_0
// 1285: new 536 java/io/File
// 1288: astore_2
// 1289: aload_2
// 1290: aload_0
// 1291: invokespecial 537 java/io/File:<init> (Ljava/lang/String;)V
// 1294: aload_2
// 1295: invokevirtual 540 java/io/File:exists ()Z
// 1298: ifeq +26 -> 1324
// 1301: invokestatic 323 com/tencent/mm/sdk/platformtools/ah:getContext ()Landroid/content/Context;
// 1304: ldc_w 542
// 1307: invokestatic 547 com/tencent/mm/compatible/util/h:Mu ()I
// 1310: invokevirtual 551 android/content/Context:getSharedPreferences (Ljava/lang/String;I)Landroid/content/SharedPreferences;
// 1313: ldc_w 553
// 1316: iconst_0
// 1317: invokeinterface 559 3 0
// 1322: istore 9
// 1324: new 354 java/lang/Long
// 1327: astore_0
// 1328: aload_0
// 1329: iload 9
// 1331: i2l
// 1332: invokespecial 560 java/lang/Long:<init> (J)V
// 1335: aload_3
// 1336: ldc_w 562
// 1339: aload_0
// 1340: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 1343: pop
// 1344: aload_3
// 1345: ldc_w 564
// 1348: getstatic 90 com/tencent/mm/app/a:bWa Ljava/lang/String;
// 1351: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 1354: pop
// 1355: new 354 java/lang/Long
// 1358: astore_0
// 1359: aload_0
// 1360: invokestatic 569 java/lang/System:currentTimeMillis ()J
// 1363: invokespecial 560 java/lang/Long:<init> (J)V
// 1366: aload_3
// 1367: ldc_w 529
// 1370: aload_0
// 1371: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 1374: pop
// 1375: aload_3
// 1376: ldc_w 571
// 1379: getstatic 576 com/tencent/mm/protocal/d:vxo I
// 1382: invokestatic 138 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 1385: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 1388: pop
// 1389: aload_3
// 1390: ldc_w 578
// 1393: invokestatic 583 com/tencent/mm/loader/j/a:Uk ()Ljava/lang/String;
// 1396: invokevirtual 130 org/json/JSONObject:put (Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
// 1399: pop
// 1400: getstatic 275 com/tencent/mm/plugin/report/service/h:pYm Lcom/tencent/mm/plugin/report/service/h;
// 1403: ldc2_w 276
// 1406: ldc2_w 584
// 1409: lconst_1
// 1410: iconst_1
// 1411: invokevirtual 282 com/tencent/mm/plugin/report/service/h:a (JJJZ)V
// 1414: goto -1007 -> 407
// 1417: aload_2
// 1418: astore_0
// 1419: goto -976 -> 443
//
// Exception table:
// from to target type
// 14 191 378 org/json/JSONException
// 191 231 378 org/json/JSONException
// 236 327 378 org/json/JSONException
// 349 360 378 org/json/JSONException
// 366 375 378 org/json/JSONException
// 484 606 378 org/json/JSONException
// 609 623 378 org/json/JSONException
// 623 775 378 org/json/JSONException
// 779 784 378 org/json/JSONException
// 794 842 378 org/json/JSONException
// 842 899 378 org/json/JSONException
// 912 1005 378 org/json/JSONException
// 1013 1027 378 org/json/JSONException
// 1125 1129 378 org/json/JSONException
// 1181 1185 378 org/json/JSONException
// 1189 1201 378 org/json/JSONException
// 1202 1230 378 org/json/JSONException
// 1230 1263 378 org/json/JSONException
// 1263 1278 378 org/json/JSONException
// 1281 1294 378 org/json/JSONException
// 1294 1324 378 org/json/JSONException
// 1324 1414 378 org/json/JSONException
// 14 191 1132 java/lang/Exception
// 191 231 1132 java/lang/Exception
// 236 327 1132 java/lang/Exception
// 349 360 1132 java/lang/Exception
// 366 375 1132 java/lang/Exception
// 484 606 1132 java/lang/Exception
// 609 623 1132 java/lang/Exception
// 623 775 1132 java/lang/Exception
// 779 784 1132 java/lang/Exception
// 794 842 1132 java/lang/Exception
// 842 899 1132 java/lang/Exception
// 1013 1027 1132 java/lang/Exception
// 1125 1129 1132 java/lang/Exception
// 1181 1185 1132 java/lang/Exception
// 1189 1201 1132 java/lang/Exception
// 1202 1230 1132 java/lang/Exception
// 1230 1263 1132 java/lang/Exception
// 1263 1278 1132 java/lang/Exception
// 1281 1294 1132 java/lang/Exception
// 1294 1324 1132 java/lang/Exception
// 1324 1414 1132 java/lang/Exception
// 1027 1051 1164 java/lang/Exception
// 1081 1092 1164 java/lang/Exception
// 1098 1111 1164 java/lang/Exception
// 1027 1051 1188 finally
// 1081 1092 1188 finally
// 1098 1111 1188 finally
// 1166 1181 1188 finally
// 912 1005 1201 java/lang/Exception
}
public static void cP(String paramString)
{
AppMethodBeat.i(15360);
SharedPreferences localSharedPreferences = ah.getContext().getSharedPreferences("system_config_prefs", com.tencent.mm.compatible.util.h.Mu());
int i = localSharedPreferences.getInt("main_thread_watch_enable", 65535);
int j = localSharedPreferences.getInt("main_thread_watch_timeout", 0);
int k = localSharedPreferences.getInt("main_thread_watch_log_loop", 0);
int m = localSharedPreferences.getInt("main_thread_watch_report", 0);
int n = k;
int i1 = j;
if (q(paramString, i))
{
i1 = j;
if (j <= 0)
i1 = 4500;
j = k;
if (k <= 0)
j = 500;
if (cdM != null)
cdM.interrupt();
bWa = paramString;
if (i1 > 0)
cdH = i1;
if (j > 0)
cdI = j;
cdM = com.tencent.mm.sdk.g.d.h(new a.c(), paramString + "_ANRWatchDog");
if (cdG == null)
cdG = new Handler(Looper.getMainLooper());
cdM.start();
ab.i("MicroMsg.ANRWatchDog.summeranr", "summeranr startWatch sProcessName[%s], sTimeoutInterval[%d], logLoop[%d], sWatchThread[%s], stack[%s]", new Object[] { bWa, Integer.valueOf(cdH), Integer.valueOf(cdI), cdM.getName(), bo.dpG() });
n = j;
}
ab.i("MicroMsg.ANRWatchDog.summeranr", "summeranr startWatch processName[%s] enable[%d], timeout[%d], loop[%d], report[%d]", new Object[] { paramString, Integer.valueOf(i), Integer.valueOf(i1), Integer.valueOf(n), Integer.valueOf(m) });
AppMethodBeat.o(15360);
}
private static boolean q(String paramString, int paramInt)
{
boolean bool = false;
AppMethodBeat.i(15359);
if (bo.isNullOrNil(paramString))
AppMethodBeat.o(15359);
while (true)
{
return bool;
if (paramString.equals(ah.getPackageName()))
{
cdz = 1;
if ((com.tencent.mm.protocal.d.vxs) || ((paramInt & 0x1) != 0))
{
AppMethodBeat.o(15359);
bool = true;
}
else
{
AppMethodBeat.o(15359);
}
}
else if (paramString.endsWith(":push"))
{
cdz = 2;
if ((paramInt & 0x2) != 0)
{
AppMethodBeat.o(15359);
bool = true;
}
else
{
AppMethodBeat.o(15359);
}
}
else if ((paramString.endsWith(":tools")) || (paramString.endsWith(":toolsmp")))
{
cdz = 4;
if ((paramInt & 0x4) != 0)
{
AppMethodBeat.o(15359);
bool = true;
}
else
{
AppMethodBeat.o(15359);
}
}
else if (paramString.endsWith(":sandbox"))
{
cdz = 8;
if ((paramInt & 0x8) != 0)
{
AppMethodBeat.o(15359);
bool = true;
}
else
{
AppMethodBeat.o(15359);
}
}
else if (paramString.endsWith(":exdevice"))
{
cdz = 16;
if ((paramInt & 0x10) != 0)
{
AppMethodBeat.o(15359);
bool = true;
}
else
{
AppMethodBeat.o(15359);
}
}
else if (paramString.contains(":appbrand"))
{
cdz = 32;
if ((paramInt & 0x20) != 0)
{
AppMethodBeat.o(15359);
bool = true;
}
else
{
AppMethodBeat.o(15359);
}
}
else
{
AppMethodBeat.o(15359);
}
}
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes5-dex2jar.jar
* Qualified Name: com.tencent.mm.app.a
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
b490c3c85b2cbf2f82ed3aacc5b17fc0bffaf580 | 6dbae30c806f661bcdcbc5f5f6a366ad702b1eea | /Corpus/eclipse.jdt.debug/991.java | fffddbb2fee2f674a73c25485f45c20ac486f28c | [
"MIT"
] | permissive | SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018 | d3fd21745dfddb2979e8ac262588cfdfe471899f | 0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0 | refs/heads/master | 2020-03-31T15:52:01.005505 | 2018-10-01T23:38:50 | 2018-10-01T23:38:50 | 152,354,327 | 1 | 0 | MIT | 2018-10-10T02:57:02 | 2018-10-10T02:57:02 | null | UTF-8 | Java | false | false | 8,572 | java | /*******************************************************************************
* Copyright (c) 2007, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.debug.ui.launchConfigurations;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
import org.eclipse.jdt.internal.debug.ui.jres.JREMessages;
import org.eclipse.jdt.launching.VMStandin;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
/**
* A wizard page used to edit the attributes of an installed JRE. A page is
* provided by JDT to edit standard JREs, but clients may contribute a custom
* page for a VM install type if required.
* <p>
* A VM install page is contributed via the <code>vmInstallPages</code> extension
* point. Following is an example definition of a VM install page.
* <pre>
* <extension point="org.eclipse.jdt.debug.ui.vmInstallPages">
* <vmInstallPage
* vmInstallType="org.eclipse.jdt.launching.EEVMType"
* class="org.eclipse.jdt.internal.debug.ui.jres.EEVMPage">
* </vmInstallPage>
* </extension>
* </pre>
* The attributes are specified as follows:
* <ul>
* <li><code>vmInstallType</code> Specifies the VM install type this wizard page is to be used for.
* Unique identifier corresponding to an <code>IVMInstallType</code>'s id.</li>
* <li><code>class</code> Wizard page implementation. Must be a subclass of
* <code>org.eclipse.jdt.debug.ui.launchConfigurations.AbstractVMInstallPage</code>.</li>
* </ul>
* </p>
* <p>
* Clients contributing a custom VM install page via the <code>vmInstallPages</code>
* extension point must subclass this class.
* </p>
* @since 3.3
*/
public abstract class AbstractVMInstallPage extends WizardPage {
/**
* Name of the original VM being edited, or <code>null</code> if none.
*/
private String fOriginalName = null;
/**
* Status of VM name (to notify of name already in use)
*/
private IStatus fNameStatus = Status.OK_STATUS;
private String[] fExistingNames;
/**
* Constructs a new page with the given page name.
*
* @param pageName the name of the page
*/
protected AbstractVMInstallPage(String pageName) {
super(pageName);
}
/**
* Creates a new wizard page with the given name, title, and image.
*
* @param pageName the name of the page
* @param title the title for this wizard page,
* or <code>null</code> if none
* @param titleImage the image descriptor for the title of this wizard page,
* or <code>null</code> if none
*/
protected AbstractVMInstallPage(String pageName, String title, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
}
/**
* Called when the VM install page wizard is closed by selecting
* the finish button. Implementers typically override this method to
* store the page result (new/changed vm install returned in
* getSelection) into its model.
*
* @return if the operation was successful. Only when returned
* <code>true</code>, the wizard will close.
*/
public abstract boolean finish();
/**
* Returns the edited or created VM install. This method
* may return <code>null</code> if no VM install exists.
*
* @return the edited or created VM install.
*/
public abstract VMStandin getSelection();
/**
* Sets the VM install to be edited.
*
* @param vm the VM install to edit
*/
public void setSelection(VMStandin vm) {
fOriginalName = vm.getName();
}
/**
* Updates the name status based on the new name. This method should be called
* by the page each time the VM name changes.
*
* @param newName new name of VM
*/
protected void nameChanged(String newName) {
fNameStatus = Status.OK_STATUS;
if (newName == null || newName.trim().length() == 0) {
int sev = IStatus.ERROR;
if (fOriginalName == null || fOriginalName.length() == 0) {
sev = IStatus.WARNING;
}
fNameStatus = new Status(sev, JDIDebugUIPlugin.getUniqueIdentifier(), JREMessages.addVMDialog_enterName);
} else {
if (isDuplicateName(newName)) {
fNameStatus = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), JREMessages.addVMDialog_duplicateName);
} else {
IStatus s = ResourcesPlugin.getWorkspace().validateName(newName, IResource.FILE);
if (!s.isOK()) {
fNameStatus = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), NLS.bind(JREMessages.AddVMDialog_JRE_name_must_be_a_valid_file_name___0__1, new String[] { s.getMessage() }));
}
}
}
updatePageStatus();
}
/**
* Returns whether the name is already in use by an existing VM
*
* @param name new name
* @return whether the name is already in use
*/
private boolean isDuplicateName(String name) {
if (fExistingNames != null) {
for (int i = 0; i < fExistingNames.length; i++) {
if (name.equals(fExistingNames[i])) {
return true;
}
}
}
return false;
}
/**
* Sets the names of existing VMs, not including the VM being edited. This method
* is called by the wizard and clients should not call this method.
*
* @param names existing VM names or an empty array
*/
public void setExistingNames(String[] names) {
fExistingNames = names;
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#getNextPage()
*/
@Override
public IWizardPage getNextPage() {
return null;
}
/**
* Sets this page's message based on the status severity.
*
* @param status status with message and severity
*/
protected void setStatusMessage(IStatus status) {
if (status.isOK()) {
setMessage(status.getMessage());
} else {
switch(status.getSeverity()) {
case IStatus.ERROR:
setMessage(status.getMessage(), IMessageProvider.ERROR);
break;
case IStatus.INFO:
setMessage(status.getMessage(), IMessageProvider.INFORMATION);
break;
case IStatus.WARNING:
setMessage(status.getMessage(), IMessageProvider.WARNING);
break;
default:
break;
}
}
}
/**
* Returns the current status of the name being used for the VM.
*
* @return status of current VM name
*/
protected IStatus getNameStatus() {
return fNameStatus;
}
/**
* Updates the status message on the page, based on the status of the VM and other
* status provided by the page.
*/
protected void updatePageStatus() {
IStatus max = Status.OK_STATUS;
IStatus[] vmStatus = getVMStatus();
for (int i = 0; i < vmStatus.length; i++) {
IStatus status = vmStatus[i];
if (status.getSeverity() > max.getSeverity()) {
max = status;
}
}
if (fNameStatus.getSeverity() > max.getSeverity()) {
max = fNameStatus;
}
if (max.isOK()) {
setMessage(null, IMessageProvider.NONE);
} else {
setStatusMessage(max);
}
setPageComplete(max.isOK() || max.getSeverity() == IStatus.INFO);
}
/**
* Returns a collection of status messages pertaining to the current edit
* status of the VM on this page. An empty collection or a collection of
* OK status objects indicates all is well.
*
* @return collection of status objects for this page
*/
protected abstract IStatus[] getVMStatus();
}
| [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
451cba03a14387cf157941dbc671c652e02646de | 559d78fd7b69995001e74c7d34c2500d6ea4b18a | /pettrade/src/main/java/com/chongwu/pettrade/controller/OrdersController.java | 2c3a99b9d4ca455b03286d28a3aac0d7c4e2849a | [] | no_license | BoWen98/pettrade_parent | 98e17ea11c92188d654772528ca3abf4222523a1 | 295d9e92b94cc6a6abb7477091c036965fb5b288 | refs/heads/master | 2022-12-24T13:11:14.081303 | 2019-12-07T00:43:00 | 2019-12-07T00:43:00 | 226,434,242 | 0 | 0 | null | 2022-12-16T08:06:34 | 2019-12-07T00:42:11 | Java | UTF-8 | Java | false | false | 4,017 | java | package com.chongwu.pettrade.controller;
import com.chongwu.pettrade.bean.Cart;
import com.chongwu.pettrade.bean.CartItem;
import com.chongwu.pettrade.service.entity.OrderItem;
import com.chongwu.pettrade.service.entity.Orders;
import com.chongwu.pettrade.service.entity.User;
import com.chongwu.pettrade.service.service.OrderService;
import com.chongwu.pettrade.service.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpSession;
import java.util.*;
/**
* 客户订单控制层
*
* @author zhaoxianhai
*
*/
@Controller
public class OrdersController {
@Autowired
private OrderService orderService;
@Autowired
private PayService payService;
/**
* 提交订单
*
* @return
*/
@RequestMapping(value = "/submitOrders")
public String submitOrders(HttpSession session, Map<String, Object> map) {
/**
* 判断客户是否登陆
*/
User user = (User) session.getAttribute("user");
if (user == null) {
map.put("withoutLogin", "withoutLogin");
return "message";
}
/**
* 若登陆则从session中获取购物车对象
*
*/
Cart cart = (Cart) session.getAttribute("cart");
/**
* 判断购物车是否为空
*/
if (cart == null) {
return "redirect:myCart";
}
/**
* 创建订单对象 订单状态1:未付款,2:已付款,3:已发货,4:未发货
*/
Orders order = new Orders();
order.setTotal(cart.getTotal());
order.setState(1);
order.setOrdertime(new Date());
order.setUser(user);
/**
* 获取订单项
*
*/
Set<OrderItem> sets = new HashSet<OrderItem>();
for (CartItem cartItem : cart.getCartItems()) {
OrderItem orderItem = new OrderItem();
orderItem.setCount(cartItem.getCount());
orderItem.setSubtotal(cartItem.getSubtotal());
orderItem.setPet(cartItem.getPet());
orderItem.setOrder(order);
sets.add(orderItem);
}
order.setOrderItems(sets);
orderService.save(order);
/**
* 提交订单后清除购物车
*
*/
cart.clearCart();
map.put("order", order);
return "order";
}
/**
* 确认订单,跳至支付页面,修改订单状态
*
* @return
*/
@RequestMapping(value = "/orderPay")
public String orderPay(Integer oid, String addr, String name, String phone, String total, Integer paytype,
Map<String, Object> map) {
Orders order = orderService.findByOid(oid);
/**
* 订单支付
*/
if (paytype == 0) {
int index = payService.payOrderByWallet(order, addr, name, phone, total);
if(index == 0){
map.put("payment", "payok");
return "message";
}else {
map.put("payment", "payerror");
return "message";
}
} else {
//在线支付
map.put("payment", "payment");
return "message";
}
}
/**
* 分页查询订单
* @param session
* @param map
* @param page
* @return
*/
@RequestMapping(value = "/findOrderByUid/{page}")
public String findOrderByUid(HttpSession session, Map<String, Object> map, @PathVariable("page") Integer page) {
/**
* 从session中获取客户
*/
User user = (User) session.getAttribute("user");
if(user == null) {
map.put("withoutLogin", "withoutLogin");
return "message";
}
Integer count = orderService.findCountByUid(user.getUid());
List<Orders> orders = orderService.findByUid(user.getUid(), page);
/**
* 放到map中
*/
map.put("page", page);
map.put("count", count);
map.put("orders", orders);
return "orderList";
}
/**
* 我的订单页点击付款
* 通过订单id查询订单
* @param session
* @param map
* @param page
* @return
*/
@RequestMapping(value = "/findByOid/{oid}")
public String findByOid(@PathVariable("oid") Integer oid, Map<String, Object> map) {
Orders order = orderService.findByOid(oid);
map.put("order", order);
return "order";
}
}
| [
"376512291@qq.com"
] | 376512291@qq.com |
9e26966263a8e0d7eae20df9ac56c514b04b1fc3 | 297b13a372efa3423f71e11fc157c0d5738f51cc | /src/emulator/src/andorxor/OR_A_XX.java | 7be4f0dcc23565f34ca6baf163d87c6c61a4363e | [] | no_license | milanvidakovic/16-bit-CPU-emulator | 7ccbe57ce08c5f7e5303e4d1eccdbbdb15dd5ffb | 431fabb31cf303ff6924a102ecb36633e71d96c2 | refs/heads/master | 2021-08-22T23:11:42.276223 | 2017-12-01T15:40:22 | 2017-12-01T15:40:22 | 112,648,291 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | package emulator.src.andorxor;
import emulator.engine.Context;
import emulator.src.Instruction;
public class OR_A_XX extends Instruction {
public OR_A_XX(short[] memory, int addr) {
super(memory, addr);
super.setArgument();
super.setAssembler("or a, 0x%04x");
}
@Override
public void exec(Context ctx) {
int res = ctx.a.val | this.argument;
ctx.a.val = (short)res;
markFlags(res, ctx.a.val, ctx);
ctx.pc.val +=2;
}
}
| [
"minja@maja.localdomain"
] | minja@maja.localdomain |
2def5a2ba469767257e343a5b1db6eb5faf73f5d | 1b90935275ba3621376c480c5f788a5dc571eae1 | /src/java/com/uoc/ead/entity/Movie.java | e99331e53f26e940420cc696e633405737219774 | [] | no_license | PasinduWJ/GMDB_Movie_web_Application | 5851c56562059a2f93e21c358e1e8e57358c0e00 | 555aad9d9900c564b7f0921084ed7b6b484386ba | refs/heads/master | 2023-07-02T09:57:23.462567 | 2021-08-10T13:15:45 | 2021-08-10T13:15:45 | 394,608,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,892 | java |
package com.uoc.ead.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import org.hibernate.annotations.Target;
@Entity
public class Movie implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int movieId;
private String movieName, runTime;
private double price;
@OneToMany(mappedBy = "movie", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private Collection<Directors> director = new ArrayList();
@ManyToMany(fetch = FetchType.EAGER)
private Collection<Genres> genre = new ArrayList();
@OneToMany(mappedBy = "movie", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private Collection<Actors> actor = new ArrayList();
@OneToMany(mappedBy = "movie",cascade = CascadeType.ALL)
private Collection<Purchas> pruchas = new ArrayList();
@OneToOne(mappedBy = "movie",fetch = FetchType.EAGER,cascade = CascadeType.REMOVE)
private Rate rate;
public Movie() {
}
public Movie(String movieName, String runTime) {
this.movieName = movieName;
this.runTime = runTime;
}
public int getMovieId() {
return movieId;
}
public void setMovieId(int movieId) {
this.movieId = movieId;
}
public String getMovieName() {
return movieName;
}
public void setMovieName(String movieName) {
this.movieName = movieName;
}
public String getRunTime() {
return runTime;
}
public void setRunTime(String runTime) {
this.runTime = runTime;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public Collection<Directors> getDirector() {
return director;
}
public void setDirector(Collection<Directors> director) {
this.director = director;
}
public Collection<Genres> getGenre() {
return genre;
}
public void setGenre(Collection<Genres> genre) {
this.genre = genre;
}
public Collection<Actors> getActor() {
return actor;
}
public void setActor(Collection<Actors> actor) {
this.actor = actor;
}
public Collection<Purchas> getPruchas() {
return pruchas;
}
public void setPruchas(Collection<Purchas> pruchas) {
this.pruchas = pruchas;
}
public Rate getRate() {
return rate;
}
public void setRate(Rate rate) {
this.rate = rate;
}
}
| [
"pasindujayasekara3@gmail.com"
] | pasindujayasekara3@gmail.com |
510c6406003b49bb5e96235f0be7cd5cf9acf251 | 1dbcbba915221357bc155ba9de6f3f74a31b7b79 | /src/main/java/com/blungehroot/javacore/chapter18/Address.java | 43b72566cd1a75478a184190832117d047f56a16 | [] | no_license | Blungehroot/javacore | 3fd1c98fdb8f041c72ea7a6e8936ae18906bf5a4 | 349630cd48948b09358b6d0ef0ac53f09d1009a9 | refs/heads/master | 2023-08-06T22:49:38.641519 | 2021-09-19T14:45:32 | 2021-09-19T14:45:32 | 388,747,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package com.blungehroot.javacore.chapter18;
public class Address {
private String name;
private String street;
private String city;
private String state;
private String code;
Address(String n, String s, String с, String st, String cd) {
name = n;
street = s;
city = с;
state = st;
code = cd;
}
public String toString() {
return name + " \n" + street +"\n" +
city + " " + state + " " + code;
}
}
| [
"yevgeniy.shaydur@kyivstar.net"
] | yevgeniy.shaydur@kyivstar.net |
6866e5e00a61bee4300d2261a96fc45278c06adb | 2ae62537a15964c0b1ba7bdb4b1fab180ba26ea1 | /src/OOP_CSE_2214/Buyer.java | 28a555717afa40ec359e33dd779ecd8d8dec8299 | [] | no_license | Mahbub2027/Shopping_Mall_Management_System_Java | a9d2ac49fcacc4c64b1950e4386798713af78add | 186a371e0f9c2daa013761c59b9466c25da38e03 | refs/heads/master | 2023-08-25T17:00:57.185098 | 2021-10-27T01:06:58 | 2021-10-27T01:06:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,658 | java | package OOP_CSE_2214;
import java.util.Scanner;
public class Buyer {
public void Buyer(){
System.out.println(" We select you as a buyer. ");
System.out.println("Choose an option: ");
System.out.println(" 1. Maps 2. Your Thoughts 3. About Ourself");
System.out.println(" 4. Search Product 5. Search Shop");
System.out.println(" 6. All Shop List");
System.out.println("Select an option: ");
//while(optionSelect){
// problem
Scanner input = new Scanner(System.in);
int optionSelect = input.nextInt();
switch (optionSelect)
{
case 1 :
System.out.println("_____________________________________________________");
System.out.println( "/////////////////////////////////////////////////////");
System.out.println("|| || || || ||");
System.out.println("|| || || || ||");
System.out.println("|| 1 || 2 || 3 || 4 ||");
System.out.println("|| || || || ||");
System.out.println("|| || || || ||");
System.out.println( "/////////////////////////////////////////////////////");
System.out.println( "'''''''''''''''''''''''''''''''''''''''''''''''''''");
System.out.println("_____________________________________________________");
System.out.println( "/////////////////////////////////////////////////////");
System.out.println("|| || || || ||");
System.out.println("|| || || || ||");
System.out.println("|| 5 || 6 || 7 || 8 ||");
System.out.println("|| || || || ||");
System.out.println("|| || || || ||");
System.out.println( "/////////////////////////////////////////////////////");
System.out.println( "'''''''''''''''''''''''''''''''''''''''''''''''''''");
System.out.println("-----------------------------------------------------");
Buyer();
break;
case 2 :
System.out.println("Please write some word about your experience with us");
System.out.println("Please write your comment here: ");
//Scanner input = new Scanner(System.in);
String comment = input.nextLine();
System.out.println(comment);
break;
case 3 :
System.out.println("This is a console based project.");
System.out.println("Using Object Oriented Programming language.");
System.out.println("This project contributed by 3 person.");
System.out.println("");
break;
case 4 :
System.out.println("Here you can search all our products");
break;
case 5 :
System.out.println("Here you can search all our Shop.");
break;
case 6 :
System.out.println("Here you can see all our shop.");
break;
default:
Buyer();
break;
}
}
}
| [
"abidurrahman780@gmail.com"
] | abidurrahman780@gmail.com |
f4521b22064a181c29236b4127f563dbbce32d3a | ce8276068f14c233efb3c361be1259482edccccd | /app/src/main/java/com/tremainebuchanan/register/activities/Register.java | d4cb629523dcfb8fb90d4316f91c3d831ba4ea96 | [] | no_license | tremainebuchanan/register-mobile-app | f637f7d90fa0dbc9c1ec22c423f0a8f8e41484d8 | 740696483a69bafb0564144966f9640c7954ab69 | refs/heads/master | 2021-01-13T09:17:00.597570 | 2016-12-05T23:37:51 | 2016-12-05T23:37:51 | 69,660,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,701 | java | package com.tremainebuchanan.register.activities;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;
import android.widget.ProgressBar;
import com.tremainebuchanan.register.R;
import com.tremainebuchanan.register.adapters.AbsentListAdapter;
import com.tremainebuchanan.register.adapters.StudentListAdapter;
import com.tremainebuchanan.register.data.Student;
import com.tremainebuchanan.register.services.Api;
import com.tremainebuchanan.register.services.SMS;
import com.tremainebuchanan.register.utils.JSONUtil;
import com.tremainebuchanan.register.utils.SessionManager;
import com.tremainebuchanan.register.utils.SettingsPreference;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import okhttp3.OkHttpClient;
public class Register extends AppCompatActivity {
OkHttpClient client;
Context context;
private ProgressBar spinner;
private static final String TAG = Register.class.getSimpleName();
private ListView listView;
private StudentListAdapter adapter;
private ArrayList<Student> studentList = new ArrayList<>();
String re_id, su_id, title, students;
ProgressDialog dialog;
ArrayList<Student> absentList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
Intent intent = getIntent();
title = intent.getStringExtra("title");
re_id = intent.getStringExtra("re_id");
su_id = intent.getStringExtra("su_id");
students = intent.getStringExtra("students");
setTitle(title);
spinner = (ProgressBar) findViewById(R.id.progressbar);
spinner.setVisibility(View.GONE);
listView = (ListView) findViewById(R.id.student_list);
adapter = new StudentListAdapter(this, studentList);
client = new OkHttpClient();
context = this;
populateStudents(students);
listView.setAdapter(adapter);
}
private class MarkTask extends AsyncTask<String, Void, String>{
public MarkTask(Context context){
dialog = new ProgressDialog(context);
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setMessage(getResources().getString(R.string.marking_progress));
}
@Override
protected void onPreExecute() {
dialog.show();
}
@Override
protected void onPostExecute(String result) {
if(result.equals("success")){
//if the user enabled sms notification in settings send sms
if (SettingsPreference.sendSMS(getApplicationContext())) {
SMS.send(absentList, title, SessionManager.getOrgName(getApplicationContext()));
}
if(dialog.isShowing()) dialog.dismiss();
showDialog("Marked", "Your register has been marked");
}
}
@Override
protected String doInBackground(String... params) {
return Api.markRegister(client, re_id, params[0]);
}
}
private void populateStudents(String students){
try{
ArrayList<Student> studentsList = new ArrayList<>();
JSONArray studentsArray = new JSONArray(students);
int len = studentsArray.length();
for(int i=0; i < len; i++){
JSONObject student = studentsArray.getJSONObject(i);
String student_id = student.getString("_id");
String student_name = student.getString("name");
String contact = student.getString("st_contact");
String gender = student.getString("st_gender");
studentsList.add(new Student(student_id, student_name, gender, true, contact));
}
setAdapter(studentsList);
}catch(JSONException e){
Log.e(TAG, "Error in converting students list to array");
}
}
/**
* Set a listview adapter.
* @param students - List of students
*/
private void setAdapter(ArrayList<Student> students){
studentList = students;
adapter = new StudentListAdapter(this, students);
listView.setAdapter(adapter);
}
/**
* Prepares the attendance list
* @param view
*/
public void prepareAttendanceList(View view){
ArrayList<String> attendanceList = new ArrayList<>();
absentList = new ArrayList<>();
int len = studentList.size();
for(int i=0;i<len;i++){
String student = JSONUtil.toJSON(studentList.get(i), re_id, SessionManager.getUserId(context), SessionManager.getOrgId(context), su_id);
attendanceList.add(student);
if(!studentList.get(i).isPresent()){
absentList.add(studentList.get(i));
}
}
confirmDialog(absentList, attendanceList.toString());
}
/**
* Generic function to display a dialog.
* @param title - The title of the dialog.
* @param message - The message to the user.
*/
//TODO convert this into a snack bar or toast
public void showDialog(String title, String message){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setTitle(title);
alertDialogBuilder
.setMessage(message)
.setCancelable(false)
.setPositiveButton("Ok",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
Register.this.finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
/**
* Shows confirmation dialog with list of absentees.
* @param absentees - List of absent students
* @param attendance - List of attendance record for all students
*/
public void confirmDialog(final ArrayList<Student> absentees, final String attendance){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
AbsentListAdapter adapter = new AbsentListAdapter(this, absentees);
LayoutInflater inflater = getLayoutInflater();
final View convertView = inflater.inflate(R.layout.student_absent_list, null);
alertDialogBuilder.setView(convertView);
ListView listView = (ListView) convertView.findViewById(R.id.absentees);
listView.setAdapter(adapter);
listView.setClickable(false);
alertDialogBuilder
.setTitle("Absent List")
.setPositiveButton("Mark Register",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
dialog.dismiss();
new MarkTask(context).execute(attendance);
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
| [
"tremainekbuchanan@gmail.com"
] | tremainekbuchanan@gmail.com |
f45e68c1ae41a307fbad8c70a82a8e5570be4f72 | c2dd2f26744e41f1ca9a8650f451b63be14511e4 | /module-1/04_Loops_Arrays/student-lecture/java/src/main/java/com/techelevator/Lecture.java | 70d9ccdaf69876f9af5aeded65ccd38a049fa567 | [] | no_license | normrothwell/TechElevator | 0596d3528d77079072bc47dc89672e01717c454b | f850ff783d63fa28003f36d0a225cb27fc2d63b3 | refs/heads/master | 2022-12-22T12:01:31.485002 | 2020-08-10T23:32:41 | 2020-08-10T23:32:41 | 247,785,553 | 0 | 0 | null | 2022-12-16T10:33:04 | 2020-03-16T18:10:39 | TSQL | UTF-8 | Java | false | false | 4,233 | java | package com.techelevator;
public class Lecture {
/*
1. Return the created array
*/
public int[] returnArray() {
int[] array = { 80, 8080, 443 };
return array;
}
/*
2. Return the first element of the array
*/
public int returnFirstElement() {
int[] portNumbers = { 80, 8080, 443 };
return portNumbers[0];
}
/*
3. Return the last element of the array
*/
public int returnLastElement() {
int[] portNumbers = { 80, 8080, 443 };
return portNumbers[2];
}
/*
4. Return the first element of the array from the parameters
*/
public int returnFirstElementOfParam(int[] passedInArray) {
return passedInArray[0];
}
/*
5. Return the last element of the array from the parameters
*/
public int returnLastElementOfParam(int[] passedInArray) {
return passedInArray[passedInArray.length - 1];
}
/*
6. Here, a variable is defined within a block. How can we get the value of that outside of the block in order to
return it? There are a couple of different ways of doing this, what can you come up with?
*/
public int returnVariableFromBlock(int number) {
int result;
{ // A new block with scoped variables
result = number * 5;
} // the result variable disappears here
return result; // We want to return result here. How?
}
/*
7. What will the variable result be at the end of the method? Change the number in the logic expression so that
it returns true.
*/
public boolean returnOperationInBlock() {
int result = 5;
{
int multiplier = 10;
result *= multiplier;
}
return result == 50; // <-- Change the number to match result and make this be true
}
/*
8. Return the only variable that is in scope at the return statement.
*/
public double returnInScopeVariable() {
double one = 1.0;
{
double three = 3.0;
one += three;
{
double four = 4.0;
three = four - one;
one++;
}
double five = 5.0;
double eight = five + three;
}
return one;
}
/*
9. How many times do we go through this loop? Change the number in the logic expression so that it returns true.
*/
public boolean returnCounterFromLoop() {
int[] arrayToLoopThrough = { 3, 4, 2, 9 };
int counter = 0; // Must be started outside the block so that have access to it after the block
for (int i = 0; i < arrayToLoopThrough.length; i++) {
counter++;
}
return counter == 4; // What should the number be to return true?
}
/*
10. This loop is counting incorrectly. What needs to change in the loop for it to count properly?
*/
public boolean returnCorrectCount() {
int[] arrayToLoopThrough = { 4, 23, 9 };
int counter = 0;
// Start; Keep going while Increment by one;
for (int i = 0; i < arrayToLoopThrough.length; i++) {
counter += 1;
}
return counter == 3;
}
/*
11. This loop is counting incorrectly. What needs to change in the loop for it to count properly?
*/
public boolean returnCountCorrectTimes() {
int[] arrayToLoopThrough = { 4, 23, 9, 4, 33 };
int counter = 0;
// Start; Keep going while Increment by one;
for (int i = 0; i < arrayToLoopThrough.length; i++) {
counter = counter + 1;
}
return counter == 5;
}
/*
12. We want this loop to only count every other item starting at zero. What needs to change in the loop for
it to do that?
*/
public boolean returnSumEveryOtherNumber() {
int[] arrayToLoopThrough = { 4, 3, 4, 1, 4, 6 };
int sum = 0;
// Start; Keep going while Increment by;
for (int i = 0; i < arrayToLoopThrough.length; i = i + 2) {
sum = sum + arrayToLoopThrough[i];
}
return sum == 12;
}
} | [
"normrothwell@gmail.com"
] | normrothwell@gmail.com |
e54fb3b6ea2a4f76391210dba979709b255d134c | 4a3fb28c181be627a7b7cb58de0ad23989a47d63 | /src/test/java/hu/akarnokd/reactive4javaflow/tck/FromArrayTckTest.java | e4ca852d561750269e0a707ba667490e9292eec7 | [
"Apache-2.0"
] | permissive | akarnokd/Reactive4JavaFlow | b2d4ffcf035c9148d60a4375c7a9404a867319cf | a976aca7f8c16a097374df033d283780c7c37829 | refs/heads/master | 2023-02-04T08:36:10.625961 | 2022-12-01T08:29:56 | 2022-12-01T08:29:56 | 98,419,292 | 50 | 5 | Apache-2.0 | 2023-01-30T04:03:08 | 2017-07-26T12:16:51 | Java | UTF-8 | Java | false | false | 1,105 | java | /*
* Copyright 2017 David Karnok
*
* 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 hu.akarnokd.reactive4javaflow.tck;
import hu.akarnokd.reactive4javaflow.Folyam;
import org.reactivestreams.Publisher;
import org.testng.annotations.Test;
import java.util.concurrent.Flow;
@Test
public class FromArrayTckTest extends BaseTck<Long> {
@Override
public Flow.Publisher<Long> createFlowPublisher(long elements) {
return
Folyam.fromArray(array(elements))
;
}
@Override
public long maxElementsFromPublisher() {
return 1024 * 1024;
}
}
| [
"akarnokd@gmail.com"
] | akarnokd@gmail.com |
8eb142204d9dda43125be4fe255fe390d1a1b28a | 5df16f843c414071d71fd2a94b5836b7ae0cf01b | /app/src/main/java/com/zyd/kedaxunfeivoicetestapplication/WakeupWhenSpeakActivity.java | 3c05cf001d74cc4aa5486e4473fa9db62f56975f | [] | no_license | zhuyongdi/KeDaXunFeiVoiceTestApplication | 3c4d0f8d68285e0f83e0cb9f45288e5c6934b6b9 | 6e4ea820d66c77888a42e6eae72ff69612a555b5 | refs/heads/master | 2023-07-17T20:27:40.292441 | 2021-08-31T10:53:35 | 2021-08-31T10:53:35 | 401,668,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | package com.zyd.kedaxunfeivoicetestapplication;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.zyd.kedaxunfeivoicetestapplication.voice.VoiceManager;
public class WakeupWhenSpeakActivity extends AppCompatActivity {
@Override
protected void onPause() {
super.onPause();
//停止播放
VoiceManager.getInstance().stopSpeak();
//停止识别
VoiceManager.getInstance().stopRecognize();
//停止唤醒
VoiceManager.getInstance().stopWakeup();
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
VoiceManager.getInstance().startWakeup();
VoiceManager.getInstance().startSpeak("123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789", null);
}
}
| [
"zhuyd@eaccessy.com"
] | zhuyd@eaccessy.com |
9287d395e27890af8e1484dec3314b60df12575c | 16bb610b27ef0d840bfc65a28533cce7f967aa5a | /src/main/java/Admin.java | 3161f97a164bad2913db9071e00462cfe2dfe431 | [] | no_license | Mr-java-little/ssm1 | edde062a69233a7eb1315fecf887cd8040914c44 | cd41d31f8179e77cb943244cb5d0a5828b35659d | refs/heads/master | 2021-07-20T00:30:37.698074 | 2019-11-17T12:00:12 | 2019-11-17T12:00:12 | 222,241,219 | 0 | 0 | null | 2020-10-13T17:31:13 | 2019-11-17T12:00:25 | Java | UTF-8 | Java | false | false | 112 | java | public class Admin {
public static void main(String[] args) {
System.out.println("疯狂");
}
}
| [
"172721151@qq.com"
] | 172721151@qq.com |
938e29b132ebfeb8d69444286f00ecf120432e03 | 5e46df3dab4a0d44ac1ff89b5eb8323cbf803a8d | /DBMeter/app/src/main/java/com/example/makeze/dbmeter/BackUpClass.java | 7517972d92e558b001f4722e67539993f481e6f5 | [] | no_license | hasan-li/Signal-Map | 7a7f2cb011574d02c25c055fdf55118c45d5700f | 84c53245d99233f6f605cee22d95a20d944a3136 | refs/heads/master | 2021-06-11T22:56:48.547083 | 2017-02-22T00:54:01 | 2017-02-22T00:54:01 | 71,238,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package com.example.makeze.dbmeter;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
/**
* Created by maksudg on 06/01/2017.
*/
public class BackUpClass {
List<String> array;
FileWriter fw;
BufferedWriter bw;
public BackUpClass(List<String> array){
this.array=array;
backUp();
}
private void backUp(){
try {
this.fw = new FileWriter("/storage/emulated/0/DBMeter/backup.dat");
this.bw = new BufferedWriter(fw);
for (int i=0;i<array.size();i++){
String line = array.get(i);
bw.write(array.get(i)+"\n");
}
} catch (IOException e){
e.printStackTrace();
} finally {
try {
if (bw != null)
bw.close();
if (fw != null)
fw.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
} | [
"max.gana93@gmail.com"
] | max.gana93@gmail.com |
ef6f5bb0c3d7df6cddbc4cc4070f7369c4ccda0b | ea175d8d30a3c8566ce62fdd66ac4e7fb7935c37 | /core/src/main/java/com/orientechnologies/orient/core/security/authenticator/OServerConfigAuthenticator.java | e67551086266aa6662e19906cfc584c3daf4751f | [
"BSD-3-Clause",
"CDDL-1.0",
"Apache-2.0"
] | permissive | orientechnologies/orientdb | a9aa2708e927cfbd8ba479ed1ceabb1979ba9f65 | 7df5ffa9f691ae752a0abdb45ccf93bc8ae8b9a4 | refs/heads/develop | 2023-08-31T12:42:55.842426 | 2023-08-30T13:56:50 | 2023-08-30T13:56:50 | 7,083,240 | 3,932 | 979 | Apache-2.0 | 2023-09-11T12:49:58 | 2012-12-09T20:33:47 | Java | UTF-8 | Java | false | false | 2,168 | java | /*
*
* * Copyright 2016 OrientDB LTD (info(at)orientdb.com)
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * 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.
* *
* * For more information: http://www.orientdb.com
*
*/
package com.orientechnologies.orient.core.security.authenticator;
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.core.db.ODatabaseSession;
import com.orientechnologies.orient.core.metadata.security.OSecurityUser;
/**
* Provides an OSecurityAuthenticator for the users listed in orientdb-server-config.xml.
*
* @author S. Colin Leister
*/
public class OServerConfigAuthenticator extends OSecurityAuthenticatorAbstract {
// OSecurityComponent
// Called once the Server is running.
public void active() {
OLogManager.instance().debug(this, "OServerConfigAuthenticator is active");
}
// OSecurityAuthenticator
// Returns the actual username if successful, null otherwise.
public OSecurityUser authenticate(
ODatabaseSession session, final String username, final String password) {
return getSecurity().authenticateServerUser(username, password);
}
// OSecurityAuthenticator
public OSecurityUser getUser(final String username) {
return getSecurity().getServerUser(username);
}
// OSecurityAuthenticator
// If not supported by the authenticator, return false.
public boolean isAuthorized(final String username, final String resource) {
return getSecurity().isServerUserAuthorized(username, resource);
}
// Server configuration users are never case sensitive.
@Override
protected boolean isCaseSensitive() {
return false;
}
}
| [
"tglman@tglman.com"
] | tglman@tglman.com |
0c05c100027c3ae8b26f093748a77fb77ab16946 | 0efee7798dabe44888f7e4a7ea5438c2e9585aab | /src/day28_loops/JavaCityCases.java | f024a0f25b68d0bf7324fc10552fff368a6e83da | [] | no_license | EmrahTOPUZ/java-programming | e06c57ce83b4be21c46fe4150e94e9d28092eaaf | 058066d79c400cbb5f6cd7f366fa89169a08f7dd | refs/heads/master | 2023-08-28T19:13:18.805163 | 2021-10-14T13:15:56 | 2021-10-14T13:15:56 | 369,928,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package day28_loops;
public class JavaCityCases {
public static void main(String[] args) {
int totalCases = 0;
for (int day = 1; day <= 30 ; day++) {
if (day % 7 == 0) {
totalCases += 500;
}else {
totalCases += 200;
}
System.out.println("Day " + day +" | total cases : " + totalCases);
}
System.out.println("JavaCity 11/2021 Total Cases: " +totalCases );
}
}
| [
"emrtpz@gmail.com"
] | emrtpz@gmail.com |
1bd85eb9157e2fab45906b105abd9b8c49b7d83e | f4d4daae54ad24ae1907267c003332b398150f2e | /src/main/java/com/arenacampeao/config/KafkaProperties.java | 9424da57e142c944889b67aee862aad3c3ac9c47 | [] | no_license | ferreira-amaral/arena-campeao | 69fc815632484a99a936d3b563b7e94becb1381a | 94535ae2e778c056eac0005acce14b48ec8b0d80 | refs/heads/master | 2023-01-04T13:24:31.967250 | 2020-10-26T00:02:15 | 2020-10-26T00:02:15 | 307,218,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,491 | java | package com.arenacampeao.config;
import java.util.HashMap;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "kafka")
public class KafkaProperties {
private String bootStrapServers = "localhost:9092";
private Map<String, String> consumer = new HashMap<>();
private Map<String, String> producer = new HashMap<>();
public String getBootStrapServers() {
return bootStrapServers;
}
public void setBootStrapServers(String bootStrapServers) {
this.bootStrapServers = bootStrapServers;
}
public Map<String, Object> getConsumerProps() {
Map<String, Object> properties = new HashMap<>(this.consumer);
if (!properties.containsKey("bootstrap.servers")) {
properties.put("bootstrap.servers", this.bootStrapServers);
}
return properties;
}
public void setConsumer(Map<String, String> consumer) {
this.consumer = consumer;
}
public Map<String, Object> getProducerProps() {
Map<String, Object> properties = new HashMap<>(this.producer);
if (!properties.containsKey("bootstrap.servers")) {
properties.put("bootstrap.servers", this.bootStrapServers);
}
return properties;
}
public void setProducer(Map<String, String> producer) {
this.producer = producer;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
ab528136af4774d9d09c542f8f6b4c19d5346e2e | f9bfc65c18880590caf142b1490bcd59f5187096 | /src/test/java/stepDefinition/login.java | 02cda08067363c71eec4c213af39d449d300cb99 | [] | no_license | bhagyashreemalge/SampleCucumberFramework | df3ad23c3cf6f7d0647e90713922f364ce1bb1fc | 0530ae546884dbc9257028d866952a31a266a6b5 | refs/heads/master | 2022-12-01T16:06:43.626612 | 2020-08-06T09:27:43 | 2020-08-06T09:27:43 | 285,525,665 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,419 | java | package stepDefinition;
import java.util.List;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import ResuseComponents.BaseClass;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class login
{
WebDriver driver;
@Given("^the user is on TT Login page$")
public void the_user_is_on_TT_Login_page()
{
BaseClass bc=new BaseClass();
driver=bc.initializeBrowser();
//Hooks hks=new Hooks();
//driver=hks.initializeBrowser();
driver.get("https://mobileqa.internationalsos.com/Mobile/MapUI/Login.aspx");
}
@When("^user enters \"([^\"]*)\" and \"([^\"]*)\"$")
public void user_enters_username_and_password(String strArg1, String strArg2) throws Throwable {
driver.findElement(By.xpath("//input[@id='ctl00_MainContent_LoginUser_txtUserName']")).sendKeys(strArg1);
driver.findElement(By.xpath("//input[@value='Continue']")).click();
driver.findElement(By.xpath("//input[@id='ctl00_MainContent_LoginUser_txtPassword']")).sendKeys(strArg2);
driver.findElement(By.xpath("//input[@value='Sign in']")).click();
}
@When("^user enters following details$")
public void user_enters_following_details(DataTable dt)
{
List<String> list=dt.asList();
driver.findElement(By.xpath("//input[@id='ctl00_MainContent_LoginUser_txtUserName']")).sendKeys(list.get(0));
driver.findElement(By.xpath("//input[@value='Continue']")).click();
driver.findElement(By.xpath("//input[@id='ctl00_MainContent_LoginUser_txtPassword']")).sendKeys(list.get(1));
driver.findElement(By.xpath("//input[@value='Sign in']")).click();
}
@When("^user enters user credentials (.+) and (.+)$")
public void user_enters_user_credentials(String username,String password)
{
driver.findElement(By.xpath("//input[@id='ctl00_MainContent_LoginUser_txtUserName']")).sendKeys(username);
driver.findElement(By.xpath("//input[@value='Continue']")).click();
driver.findElement(By.xpath("//input[@id='ctl00_MainContent_LoginUser_txtPassword']")).sendKeys(password);
driver.findElement(By.xpath("//input[@value='Sign in']")).click();
}
@Then("^TT homepage should be displayed$")
public void TT_homepage_should_be_displayed()
{
if(driver.findElement(By.xpath("//a[@id='ctl00_AdminHeaderControl_lnkMapHome']")).isDisplayed())
{
Assert.assertTrue(true);
}
}
}
| [
"bhagyashreemalge@gmail.com"
] | bhagyashreemalge@gmail.com |
ff5507675f26ae7ff3d0d0d6dab0c2b1742f037c | 9c2f3fe064571a7f94d93dc00c356a57f833b087 | /analise-de-dados-java/analise-de-dados-java/src/main/java/com/analisededadosjava/analisededadosjava/Util/ManipuladorDeArquivos.java | d9c599c96b404708f2dbef90917243ffc060f257 | [] | no_license | beckeryuri/analise-de-dados-java | 7d1df69efca18c62e462e4307b40f5b7b1bab87c | 8f96c5a578df41b2a13c32f25a007c79c1512011 | refs/heads/master | 2022-11-30T09:39:44.053079 | 2020-08-04T18:29:51 | 2020-08-04T18:29:51 | 283,433,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,289 | java | package com.analisededadosjava.analisededadosjava.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.*;
import java.util.ArrayList;
import java.util.Date;
@Component
public class ManipuladorDeArquivos {
Logger logger = LoggerFactory.getLogger(ManipuladorDeArquivos.class);
public void deveLimparPasta() {
File folder = new File("/home/becker/data/in");
if (folder.isDirectory()) {
File[] sun = folder.listFiles();
for (File toDelete : sun) {
toDelete.delete();
}
}
logger.info("Arquivos da pasta in foram deletados.");
}
public void deveEscreverReport(ManipuladorDeArquivos manipulador) {
Verificador verificado = manipulador.verificaDados();
manipulador.escrituraDeArquivos(verificado);
}
public Verificador verificaDados(){
ArrayList<String> dados = this.ordenaDados();
Verificador verificador = new Verificador();
dados.forEach(verificador::verificaDado);
return verificador;
}
public ArrayList<String> ordenaDados(){
Verificador verificar = new Verificador();
ArrayList<String> formatado = this.formataQuebraDeLInha(this.leituraDeArquivos());
ArrayList<String> clientes = new ArrayList<>();
ArrayList<String> vendedores = new ArrayList<>();
ArrayList<String> vendas = new ArrayList<>();
ArrayList<String> outros = new ArrayList<>();
ArrayList<String> ordenado = new ArrayList<>();
for(String indice : formatado){
String[] dividido = verificar.divideDado(indice);
switch (dividido[0]) {
case "001":
clientes.add(indice);
break;
case "002":
vendedores.add(indice);
break;
case "003":
vendas.add(indice);
break;
default:
outros.add(indice);
break;
}
}
ordenado.addAll(clientes);
ordenado.addAll(vendedores);
ordenado.addAll(vendas);
ordenado.addAll(outros);
return ordenado;
}
public ArrayList<String> leituraDeArquivos() {
int qtdArquivosLidos = 0;
FileFilter filter = file -> file.getName().endsWith(".dat");
File path = new File("/home/becker/data/in");
File[] files = path.listFiles(filter);
ArrayList<String> entradaDados = new ArrayList<>();
for (File file : files) {
qtdArquivosLidos++;
try (BufferedReader br = new BufferedReader(new FileReader(file.getAbsoluteFile()))) {
String line = br.readLine();
while (line != null) {
entradaDados.add(line);
line = br.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}
}
logger.info("O total de " + qtdArquivosLidos + " arquivos foram lidos.");
return entradaDados;
}
public ArrayList<String> formataQuebraDeLInha(ArrayList<String> dados){
ArrayList<String> formatado = new ArrayList<>();
for(int i = 0; i <dados.size(); i++){
String[] separada = dados.get(i).split("ç");
if(separada.length < 4 ){
formatado.add(dados.get(i) + dados.get(i + 1));
}
if(separada.length == 4 ){
formatado.add(dados.get(i));
}
}
return formatado;
}
public void escrituraDeArquivos(Verificador verificado) {
try {
String quantidadeClientes = verificado.getClientes().getQuantidadeClientes() > 0 ?
"A quantidade de clientes registrados nos arquivos processados é: " + verificado.getClientes().getQuantidadeClientes() + "." :
"Nenhum cliente foi registrado.";
String quantidadeVendedores = verificado.getVendedores().getQuantidadeVendedores() > 0 ?
"A quantidade de vendedores registrados nos arquivos processados é: " + verificado.getVendedores().getQuantidadeVendedores() + "." :
"Nenhum vendedor foi registrado.";
String piorvendedor = verificado.getVendas().getQuantidadeVendas() > 0 ?
"Dos vendedores que fizeram alguma venda, o pior vendedor é o vendedor " + verificado.getVendas().getPiorVendedor().get(1).toUpperCase() +
" vendendo um total de: R$" + verificado.getVendas().getPiorVendedor().get(0) + "." :
"Não foi possível acessar o maior vendedor pois nenhuma venda foi registrada.";
String maiorVenda = verificado.getVendas().getQuantidadeVendas() > 0 ?
"O ID da venda de maior valor é: " + verificado.getVendas().getMaiorVenda() + "." :
"Não foi possível acessar a maior venda pois nenhuma venda foi registrada";
ArrayList<String> naoVenderam = verificado.getVendas().getVendedoresComNenhumaVenda(verificado.getVendedores());
String naoVenderamStr = "Os vendedores " + naoVenderam.toString().replace("[", "").replace("]", "")+ " não fizeram nenhuma venda.";
Date date = new Date();
File file = new File("/home/becker/data/out/" + date.toString().replace(" ", "_") + ".done.dat");
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(quantidadeClientes);
bw.newLine();
bw.write(quantidadeVendedores);
bw.newLine();
bw.write(maiorVenda);
bw.newLine();
bw.write(piorvendedor);
bw.newLine();
if(!naoVenderam.isEmpty()){
bw.write(naoVenderamStr);
}
bw.close();
logger.info("Um novo relátorio foi escrito.");
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"beckercpg@gmail.com"
] | beckercpg@gmail.com |
dca4e680c6e96ecb713c05e05d8eba15f54904c0 | ad0351b1277c0534192a87409070926a3f0ddf02 | /deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/property/query/PropertyQuery.java | 5276d78939e3871b98da1753dbe207a5eca3ab0e | [
"Apache-2.0"
] | permissive | struberg/deltaspike | 3c2d5ed6fc41c4497babe5052e8ead7dd9dee95f | f49e38635b10bfb8dac16f739eef48a1795a4a12 | refs/heads/master | 2022-11-25T03:07:25.712466 | 2021-12-04T12:25:48 | 2021-12-04T12:25:48 | 3,175,585 | 1 | 1 | Apache-2.0 | 2022-11-19T02:58:56 | 2012-01-14T00:49:21 | Java | UTF-8 | Java | false | false | 8,117 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.deltaspike.data.impl.property.query;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.apache.deltaspike.data.impl.property.MethodProperty;
import org.apache.deltaspike.data.impl.property.Properties;
import org.apache.deltaspike.data.impl.property.Property;
/**
* <p>
* Queries a target class for properties that match certain criteria. A property may either be a private or public
* field, declared by the target class or inherited from a superclass, or a public method declared by the target class
* or inherited from any of its superclasses. For properties that are exposed via a method, the property must be a
* JavaBean style property, i.e. it must provide both an accessor and mutator method according to the JavaBean
* specification.
* </p>
* <p/>
* <p>
* This class is not thread-safe, however the result returned by the getResultList() method is.
* </p>
*
* @see PropertyQueries
* @see PropertyCriteria
*/
public class PropertyQuery<V>
{
private final Class<?> targetClass;
private final List<PropertyCriteria> criteria;
PropertyQuery(Class<?> targetClass)
{
if (targetClass == null)
{
throw new IllegalArgumentException("targetClass parameter may not be null");
}
this.targetClass = targetClass;
this.criteria = new ArrayList<PropertyCriteria>();
}
/**
* Add a criteria to query
*
* @param criteria
* the criteria to add
*/
public PropertyQuery<V> addCriteria(PropertyCriteria criteria)
{
this.criteria.add(criteria);
return this;
}
/**
* Get the first result from the query, causing the query to be run.
*
* @return the first result, or null if there are no results
*/
public Property<V> getFirstResult()
{
List<Property<V>> results = getResultList();
return results.isEmpty() ? null : results.get(0);
}
/**
* Get the first result from the query that is not marked as read only, causing the query to be run.
*
* @return the first writable result, or null if there are no results
*/
public Property<V> getFirstWritableResult()
{
List<Property<V>> results = getWritableResultList();
return results.isEmpty() ? null : results.get(0);
}
/**
* Get a single result from the query, causing the query to be run. An exception is thrown if the query does not
* return exactly one result.
*
* @return the single result
* @throws RuntimeException
* if the query does not return exactly one result
*/
public Property<V> getSingleResult()
{
List<Property<V>> results = getResultList();
if (results.size() == 1)
{
return results.get(0);
}
else if (results.isEmpty())
{
throw new RuntimeException("Expected one property match, but the criteria did not match any properties on "
+ targetClass.getName());
}
else
{
throw new RuntimeException("Expected one property match, but the criteria matched " + results.size()
+ " properties on " + targetClass.getName());
}
}
/**
* Get a single result from the query that is not marked as read only, causing the query to be run. An exception is
* thrown if the query does not return exactly one result.
*
* @return the single writable result
* @throws RuntimeException
* if the query does not return exactly one result
*/
public Property<V> getWritableSingleResult()
{
List<Property<V>> results = getWritableResultList();
if (results.size() == 1)
{
return results.get(0);
}
else if (results.isEmpty())
{
throw new RuntimeException("Expected one property match, but the criteria did not match any properties on "
+ targetClass.getName());
}
else
{
throw new RuntimeException("Expected one property match, but the criteria matched " + results.size()
+ " properties on " + targetClass.getName());
}
}
/**
* Get the result from the query, causing the query to be run.
*
* @return the results, or an empty list if there are no results
*/
public List<Property<V>> getResultList()
{
return getResultList(false);
}
/**
* Get the non read only results from the query, causing the query to be run.
*
* @return the results, or an empty list if there are no results
*/
public List<Property<V>> getWritableResultList()
{
return getResultList(true);
}
/**
* Get the result from the query, causing the query to be run.
*
* @param writable
* if this query should only return properties that are not read only
* @return the results, or an empty list if there are no results
*/
private List<Property<V>> getResultList(boolean writable)
{
List<Property<V>> results = new ArrayList<Property<V>>();
// First check public accessor methods (we ignore private methods)
for (Method method : targetClass.getMethods())
{
if (!(method.getName().startsWith("is") || method.getName().startsWith("get")))
{
continue;
}
boolean match = true;
for (PropertyCriteria c : criteria)
{
if (!c.methodMatches(method))
{
match = false;
break;
}
}
if (match)
{
MethodProperty<V> property = Properties.<V> createProperty(method);
if (!writable || !property.isReadOnly())
{
results.add(property);
}
}
}
Class<?> cls = targetClass;
while (cls != null && !cls.equals(Object.class))
{
// Now check declared fields
for (Field field : cls.getDeclaredFields())
{
boolean match = true;
for (PropertyCriteria c : criteria)
{
if (!c.fieldMatches(field))
{
match = false;
break;
}
}
Property<V> prop = Properties.<V> createProperty(field);
if (match && !resultsContainsProperty(results, prop.getName()))
{
if (!writable || !prop.isReadOnly())
{
results.add(prop);
}
}
}
cls = cls.getSuperclass();
}
return results;
}
private boolean resultsContainsProperty(List<Property<V>> results, String propertyName)
{
for (Property<V> p : results)
{
if (propertyName.equals(p.getName()))
{
return true;
}
}
return false;
}
}
| [
"Thomas.Hug@ctp-consulting.com"
] | Thomas.Hug@ctp-consulting.com |
21d40c953f52c570e85624a8ac83cc5d3fe94e7f | 98a9c286f5a515e5dc16f0869a9586a0d9565833 | /src/test/java/com/techproed/smoketest/PositiveTest.java | b084a481228bf75612873ad334b9ffe285b014cc | [] | no_license | hsn74/testNGfraemwork | 978270f77d764c7f98d8e009602f031f0f3f8a3c | c6c1dd8627cc87dc591ef6daa5279e7f55017460 | refs/heads/master | 2023-05-14T22:23:41.379403 | 2020-10-18T15:46:23 | 2020-10-18T15:46:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package com.techproed.smoketest;
import com.techproed.utilities.TestBase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;
public class PositiveTest extends TestBase {
//Create a clickLogin Method
public void clickOnLogin(){
driver.get("http://www.kaolapalace-qa-environment2.com/");
WebElement mainPageLoginButton = driver.findElement(By.linkText("Log in"));
mainPageLoginButton.click();
}
@Test
public void positiveLoginTest() throws InterruptedException {
clickOnLogin();
Thread.sleep(5000);
driver.findElement(By.id("UserName")).sendKeys("manager2");
driver.findElement(By.id("Password")).sendKeys("Man1ager2!");
driver.findElement(By.id("btnSubmit")).click();
Thread.sleep(15000);
WebElement addUserButton = driver.findElement(By.xpath("//span[@class='hidden-480']"));
Assert.assertTrue(addUserButton.isDisplayed());
}
}
| [
"maliayyildiz61@gmail.com"
] | maliayyildiz61@gmail.com |
1db6ae866ac1ada1eef8b3263d66a5fd4c0d1855 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/5/5_1b46dc2d94e1e52fc12cbd7e6b865516f7046041/UDPReceiver/5_1b46dc2d94e1e52fc12cbd7e6b865516f7046041_UDPReceiver_s.java | 2ba1d94568d0b6edf988c8c007fb3a5ca69701f8 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,947 | java | package Communications;
import java.io.*;
import java.net.SocketException;
import java.util.concurrent.*;
import Messages.Message;
import Utilities.Parser;
public class UDPReceiver {
protected PipedInputStream data=null;
protected UDPReceiverThread thread=null;
protected Thread t;
protected ConcurrentLinkedQueue<Byte> queue=new ConcurrentLinkedQueue<Byte>();
protected boolean needsMore=false;
int size=132;
int moreNeeded=Integer.MAX_VALUE;
byte[] current=null;
byte[] body=null;
Parser parser=new Parser();
public UDPReceiver() throws SocketException{
data=new PipedInputStream();
thread=new UDPReceiverThread(queue);
t=(new Thread(thread));
t.start();
}
// public byte[] getPacket(){
// if(queue.size()<size){
// return new byte[0];
// }
// else{
// byte[] packet = new byte[size];
// for(int i=0;i<size;i++){
// packet[i]=queue.poll();
// }
// }
// }
public Message read(){
if (!needsMore) {
if (queue.size() >= size) {
System.out.println("getting first");
current = new byte[size];
for (int i = 0; i < size; i++) {
current[i] = queue.poll();
}
moreNeeded=parser.parse(current);
if(queue.size()>=moreNeeded){
System.out.println("Second is there alredy");
for (int i = 0; i < moreNeeded; i++) {
body[i] = queue.poll();
}
needsMore=false;
moreNeeded=Integer.MAX_VALUE;
return parser.addBody(body);
}
needsMore=true;
return null;
} else {
return null;
}
}
else if(queue.size()>=moreNeeded){
System.out.println("getting second");
for (int i = 0; i < moreNeeded; i++) {
body[i] = queue.poll();
}
needsMore=false;
moreNeeded=Integer.MAX_VALUE;
return parser.addBody(body);
}
return null;
}
public void stop() throws InterruptedException{
thread.setRunning(false);
t.join();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
2bfb4a5f337fd93991b47522d23deb9399f93fd6 | e256f21b9efb17888de2ffbc2b9490e08c4c1de7 | /gearman-server/src/main/java/org/gearman/server/persistence/PersistenceEngine.java | 0f304b410c0c8b26b59bab1dd0ba60fe2cb702c1 | [] | no_license | dinhkhanh/gearman-java | 1ec395ff97ca8c39e57049d3f5f74ae503088fa6 | 47d318710bcc16d42f98d49eb1585907753cb80d | refs/heads/master | 2021-01-18T12:15:54.935406 | 2013-07-27T06:04:35 | 2013-07-27T06:04:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package org.gearman.server.persistence;
import org.gearman.common.Job;
import org.gearman.server.core.QueuedJob;
import java.util.Collection;
public interface PersistenceEngine {
public String getIdentifier();
public void write(Job job);
public void delete(Job job);
public void delete(String functionName, String uniqueID);
public void deleteAll();
public Job findJob(String functionName, String uniqueID);
public Collection<QueuedJob> readAll();
public Collection<QueuedJob> getAllForFunction(String functionName);
public Job findJobByHandle(String jobHandle);
} | [
"john@unixninjas.org"
] | john@unixninjas.org |
c9ac5088b4038b489526f9e29afa86e5829ada01 | 191dc2563f6fbb71e6551f9b9ebd94da36258924 | /oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java | 4fddaaf37f934f2cebc24c4755ec542e61f92956 | [
"Apache-2.0"
] | permissive | denismo/jackrabbit-dynamodb-store | d14b2c2417a3edf87d8a070c4ee70778125dbf44 | 953080b9de9b9333aec85292a75b7f75904d7a19 | refs/heads/master | 2016-09-06T01:13:06.318295 | 2014-11-25T14:14:25 | 2014-11-25T14:14:25 | 26,908,216 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 25,355 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jackrabbit.oak.plugins.document;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Sets;
import org.apache.jackrabbit.mk.api.MicroKernelException;
import org.apache.jackrabbit.oak.commons.json.JsopStream;
import org.apache.jackrabbit.oak.commons.json.JsopWriter;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.COLLISIONS;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.SPLIT_CANDIDATE_THRESHOLD;
/**
* A higher level object representing a commit.
*/
public class Commit {
private static final Logger LOG = LoggerFactory.getLogger(Commit.class);
private final DocumentNodeStore nodeStore;
private final Revision baseRevision;
private final Revision revision;
private HashMap<String, UpdateOp> operations = new LinkedHashMap<String, UpdateOp>();
private JsopWriter diff = new JsopStream();
private Set<Revision> collisions = new LinkedHashSet<Revision>();
/**
* List of all node paths which have been modified in this commit. In addition to the nodes
* which are actually changed it also contains there parent node paths
*/
private HashSet<String> modifiedNodes = new HashSet<String>();
private HashSet<String> addedNodes = new HashSet<String>();
private HashSet<String> removedNodes = new HashSet<String>();
/** Set of all nodes which have binary properties. **/
private HashSet<String> nodesWithBinaries = Sets.newHashSet();
Commit(DocumentNodeStore nodeStore, Revision baseRevision, Revision revision) {
this.baseRevision = baseRevision;
this.revision = revision;
this.nodeStore = nodeStore;
}
UpdateOp getUpdateOperationForNode(String path) {
UpdateOp op = operations.get(path);
if (op == null) {
String id = Utils.getIdFromPath(path);
op = new UpdateOp(id, false);
NodeDocument.setModified(op, revision);
operations.put(path, op);
}
return op;
}
/**
* The revision for this new commit. That is, the changes within this commit
* will be visible with this revision.
*
* @return the revision for this new commit.
*/
@Nonnull
Revision getRevision() {
return revision;
}
/**
* Returns the base revision for this commit. That is, the revision passed
* to {@link DocumentMK#commit(String, String, String, String)}. The base
* revision may be <code>null</code>, e.g. for the initial commit of the
* root node, when there is no base revision.
*
* @return the base revision of this commit or <code>null</code>.
*/
@CheckForNull
Revision getBaseRevision() {
return baseRevision;
}
void addNodeDiff(DocumentNodeState n) {
diff.tag('+').key(n.getPath());
diff.object();
n.append(diff, false);
diff.endObject();
diff.newline();
}
void updateProperty(String path, String propertyName, String value) {
UpdateOp op = getUpdateOperationForNode(path);
String key = Utils.escapePropertyName(propertyName);
op.setMapEntry(key, revision, value);
}
void markNodeHavingBinary(String path) {
this.nodesWithBinaries.add(path);
}
void addNode(DocumentNodeState n) {
String path = n.getPath();
if (operations.containsKey(path)) {
String msg = "Node already added: " + path;
LOG.error(msg);
throw new MicroKernelException(msg);
}
operations.put(path, n.asOperation(true));
addedNodes.add(path);
}
boolean isEmpty() {
return operations.isEmpty();
}
/**
* Applies this commit to the store.
*
* @return the commit revision.
* @throws MicroKernelException if the commit cannot be applied.
* TODO: use non-MK exception type
*/
@Nonnull
Revision apply() throws MicroKernelException {
boolean success = false;
Revision baseRev = getBaseRevision();
boolean isBranch = baseRev != null && baseRev.isBranch();
Revision rev = getRevision();
if (isBranch && !nodeStore.isDisableBranches()) {
rev = rev.asBranchRevision();
// remember branch commit
Branch b = nodeStore.getBranches().getBranch(baseRev);
if (b == null) {
// baseRev is marker for new branch
b = nodeStore.getBranches().create(baseRev.asTrunkRevision(), rev);
} else {
b.addCommit(rev);
}
try {
// prepare commit
prepare(baseRev);
success = true;
} finally {
if (!success) {
b.removeCommit(rev);
if (!b.hasCommits()) {
nodeStore.getBranches().remove(b);
}
}
}
} else {
applyInternal();
}
if (isBranch) {
rev = rev.asBranchRevision();
}
return rev;
}
/**
* Apply the changes to the document store and the cache.
*/
private void applyInternal() {
if (!operations.isEmpty()) {
updateParentChildStatus();
updateBinaryStatus();
applyToDocumentStore();
}
}
private void prepare(Revision baseRevision) {
if (!operations.isEmpty()) {
updateParentChildStatus();
updateBinaryStatus();
applyToDocumentStore(baseRevision);
}
}
/**
* Update the binary status in the update op.
*/
private void updateBinaryStatus() {
DocumentStore store = this.nodeStore.getDocumentStore();
for (String path : this.nodesWithBinaries) {
NodeDocument nd = store.getIfCached(Collection.NODES, Utils.getIdFromPath(path));
if ((nd == null) || !nd.hasBinary()) {
UpdateOp updateParentOp = getUpdateOperationForNode(path);
NodeDocument.setHasBinary(updateParentOp);
}
}
}
/**
* Apply the changes to the document store.
*/
void applyToDocumentStore() {
applyToDocumentStore(null);
}
/**
* Apply the changes to the document store.
*
* @param baseBranchRevision the base revision of this commit. Currently only
* used for branch commits.
*/
private void applyToDocumentStore(Revision baseBranchRevision) {
// the value in _revisions.<revision> property of the commit root node
// regular commits use "c", which makes the commit visible to
// other readers. branch commits use the base revision to indicate
// the visibility of the commit
String commitValue = baseBranchRevision != null ? baseBranchRevision.toString() : "c";
DocumentStore store = nodeStore.getDocumentStore();
String commitRootPath = null;
if (baseBranchRevision != null) {
// branch commits always use root node as commit root
commitRootPath = "/";
}
ArrayList<UpdateOp> newNodes = new ArrayList<UpdateOp>();
ArrayList<UpdateOp> changedNodes = new ArrayList<UpdateOp>();
// operations are added to this list before they are executed,
// so that all operations can be rolled back if there is a conflict
ArrayList<UpdateOp> opLog = new ArrayList<UpdateOp>();
//Compute the commit root
for (String p : operations.keySet()) {
markChanged(p);
if (commitRootPath == null) {
commitRootPath = p;
} else {
while (!PathUtils.isAncestor(commitRootPath, p)) {
commitRootPath = PathUtils.getParentPath(commitRootPath);
if (PathUtils.denotesRoot(commitRootPath)) {
break;
}
}
}
}
int commitRootDepth = PathUtils.getDepth(commitRootPath);
// check if there are real changes on the commit root
boolean commitRootHasChanges = operations.containsKey(commitRootPath);
// create a "root of the commit" if there is none
UpdateOp commitRoot = getUpdateOperationForNode(commitRootPath);
for (String p : operations.keySet()) {
UpdateOp op = operations.get(p);
if (op.isNew()) {
NodeDocument.setDeleted(op, revision, false);
}
if (op == commitRoot) {
if (!op.isNew() && commitRootHasChanges) {
// commit root already exists and this is an update
changedNodes.add(op);
}
} else {
NodeDocument.setCommitRoot(op, revision, commitRootDepth);
if (op.isNew()) {
if (baseBranchRevision == null) {
// for new non-branch nodes we can safely set _lastRev on
// insert. for existing nodes the _lastRev is updated by
// the background thread to avoid concurrent updates
NodeDocument.setLastRev(op, revision);
}
newNodes.add(op);
} else {
changedNodes.add(op);
}
}
}
if (changedNodes.size() == 0 && commitRoot.isNew()) {
// no updates and root of commit is also new. that is,
// it is the root of a subtree added in a commit.
// so we try to add the root like all other nodes
NodeDocument.setRevision(commitRoot, revision, commitValue);
newNodes.add(commitRoot);
}
try {
if (newNodes.size() > 0) {
// set commit root on new nodes
if (!store.create(NODES, newNodes)) {
// some of the documents already exist:
// try to apply all changes one by one
for (UpdateOp op : newNodes) {
if (op == commitRoot) {
// don't write the commit root just yet
// (because there might be a conflict)
NodeDocument.unsetRevision(commitRoot, revision);
}
// setting _lastRev is only safe on insert. now the
// background thread needs to take care of it
NodeDocument.unsetLastRev(op, revision.getClusterId());
changedNodes.add(op);
}
newNodes.clear();
}
}
for (UpdateOp op : changedNodes) {
// set commit root on changed nodes. this may even apply
// to the commit root. the _commitRoot entry is removed
// again when the _revisions entry is set at the end
NodeDocument.setCommitRoot(op, revision, commitRootDepth);
opLog.add(op);
createOrUpdateNode(store, op);
}
// finally write the commit root, unless it was already written
// with added nodes (the commit root might be written twice,
// first to check if there was a conflict, and only then to commit
// the revision, with the revision property set)
if (changedNodes.size() > 0 || !commitRoot.isNew()) {
// set revision to committed
NodeDocument.setRevision(commitRoot, revision, commitValue);
if (commitRootHasChanges) {
// remove previously added commit root
NodeDocument.removeCommitRoot(commitRoot, revision);
}
opLog.add(commitRoot);
if (baseBranchRevision == null) {
// create a clone of the commitRoot in order
// to set isNew to false. If we get here the
// commitRoot document already exists and
// only needs an update
UpdateOp commit = commitRoot.shallowCopy(commitRoot.getId());
commit.setNew(false);
// only set revision on commit root when there is
// no collision for this commit revision
commit.containsMapEntry(COLLISIONS, revision, false);
NodeDocument before = nodeStore.updateCommitRoot(commit);
if (before == null) {
String msg = "Conflicting concurrent change. " +
"Update operation failed: " + commitRoot;
throw new MicroKernelException(msg);
} else {
// if we get here the commit was successful and
// the commit revision is set on the commitRoot
// document for this commit.
// now check for conflicts/collisions by other commits.
// use original commitRoot operation with
// correct isNew flag.
checkConflicts(commitRoot, before);
checkSplitCandidate(before);
}
} else {
// this is a branch commit, do not fail on collisions now
// trying to merge the branch will fail later
createOrUpdateNode(store, commitRoot);
}
operations.put(commitRootPath, commitRoot);
}
} catch (MicroKernelException e) {
rollback(newNodes, opLog, commitRoot);
throw e;
}
}
private void updateParentChildStatus() {
final Set<String> processedParents = Sets.newHashSet();
for (String path : addedNodes) {
if (PathUtils.denotesRoot(path)) {
continue;
}
String parentPath = PathUtils.getParentPath(path);
if (processedParents.contains(parentPath)) {
continue;
}
processedParents.add(parentPath);
UpdateOp op = getUpdateOperationForNode(parentPath);
NodeDocument.setChildrenFlag(op, true);
}
}
private void rollback(List<UpdateOp> newDocuments,
List<UpdateOp> changed,
UpdateOp commitRoot) {
DocumentStore store = nodeStore.getDocumentStore();
for (UpdateOp op : changed) {
UpdateOp reverse = op.getReverseOperation();
store.findAndUpdate(NODES, reverse);
}
for (UpdateOp op : newDocuments) {
UpdateOp reverse = op.getReverseOperation();
NodeDocument.unsetLastRev(reverse, revision.getClusterId());
store.findAndUpdate(NODES, reverse);
}
UpdateOp removeCollision = new UpdateOp(commitRoot.getId(), false);
NodeDocument.removeCollision(removeCollision, revision);
store.findAndUpdate(NODES, removeCollision);
}
/**
* Try to create or update the node. If there was a conflict, this method
* throws an exception, even though the change is still applied.
*
* @param store the store
* @param op the operation
*/
private void createOrUpdateNode(DocumentStore store, UpdateOp op) {
NodeDocument doc = store.createOrUpdate(NODES, op);
checkConflicts(op, doc);
checkSplitCandidate(doc);
}
private void checkSplitCandidate(@Nullable NodeDocument doc) {
if (doc != null && doc.getMemory() > SPLIT_CANDIDATE_THRESHOLD) {
nodeStore.addSplitCandidate(doc.getId());
}
}
/**
* Checks if the update operation introduced any conflicts on the given
* document. The document shows the state right before the operation was
* applied.
*
* @param op the update operation.
* @param before how the document looked before the update was applied or
* {@code null} if it didn't exist before.
*/
private void checkConflicts(@Nonnull UpdateOp op,
@Nullable NodeDocument before) {
DocumentStore store = nodeStore.getDocumentStore();
collisions.clear();
if (baseRevision != null) {
Revision newestRev = null;
if (before != null) {
newestRev = before.getNewestRevision(nodeStore, revision,
new CollisionHandler() {
@Override
void concurrentModification(Revision other) {
collisions.add(other);
}
});
}
String conflictMessage = null;
if (newestRev == null) {
if (op.isDelete() || !op.isNew()) {
conflictMessage = "The node " +
op.getId() + " does not exist or is already deleted";
}
} else {
if (op.isNew()) {
conflictMessage = "The node " +
op.getId() + " was already added in revision\n" +
newestRev;
} else if (nodeStore.isRevisionNewer(newestRev, baseRevision)
&& (op.isDelete() || isConflicting(before, op))) {
conflictMessage = "The node " +
op.getId() + " was changed in revision\n" + newestRev +
", which was applied after the base revision\n" +
baseRevision;
}
}
if (conflictMessage == null) {
// the modification was successful
// -> check for collisions and conflict (concurrent updates
// on a node are possible if property updates do not overlap)
// TODO: unify above conflict detection and isConflicting()
if (!collisions.isEmpty() && isConflicting(before, op)) {
for (Revision r : collisions) {
// mark collisions on commit root
Collision c = new Collision(before, r, op, revision, nodeStore);
if (c.mark(store).equals(revision)) {
// our revision was marked
if (baseRevision.isBranch()) {
// this is a branch commit. do not fail immediately
// merging this branch will fail later.
} else {
// fail immediately
conflictMessage = "The node " +
op.getId() + " was changed in revision\n" + r +
", which was applied after the base revision\n" +
baseRevision;
}
}
}
}
}
if (conflictMessage != null) {
conflictMessage += ", before\n" + revision +
"; document:\n" + (before == null ? "" : before.format()) +
",\nrevision order:\n" + nodeStore.getRevisionComparator();
throw new MicroKernelException(conflictMessage);
}
}
}
/**
* Checks whether the given <code>UpdateOp</code> conflicts with the
* existing content in <code>doc</code>. The check is done based on the
* {@link #baseRevision} of this commit. An <code>UpdateOp</code> conflicts
* when there were changes after {@link #baseRevision} on properties also
* contained in <code>UpdateOp</code>.
*
* @param doc the contents of the nodes before the update.
* @param op the update to perform.
* @return <code>true</code> if the update conflicts; <code>false</code>
* otherwise.
*/
private boolean isConflicting(@Nullable NodeDocument doc,
@Nonnull UpdateOp op) {
if (baseRevision == null || doc == null) {
// no conflict is possible when there is no baseRevision
// or document did not exist before
return false;
}
return doc.isConflicting(op, baseRevision, revision, nodeStore);
}
/**
* Apply the changes to the DocumentNodeStore (to update the cache).
*
* @param before the revision right before this commit.
* @param isBranchCommit whether this is a commit to a branch
*/
public void applyToCache(Revision before, boolean isBranchCommit) {
HashMap<String, ArrayList<String>> nodesWithChangedChildren = new HashMap<String, ArrayList<String>>();
for (String p : modifiedNodes) {
if (PathUtils.denotesRoot(p)) {
continue;
}
String parent = PathUtils.getParentPath(p);
ArrayList<String> list = nodesWithChangedChildren.get(parent);
if (list == null) {
list = new ArrayList<String>();
nodesWithChangedChildren.put(parent, list);
}
list.add(p);
}
DiffCache.Entry cacheEntry = nodeStore.getDiffCache().newEntry(before, revision);
List<String> added = new ArrayList<String>();
List<String> removed = new ArrayList<String>();
List<String> changed = new ArrayList<String>();
for (String path : modifiedNodes) {
added.clear();
removed.clear();
changed.clear();
ArrayList<String> changes = nodesWithChangedChildren.get(path);
if (changes != null) {
for (String s : changes) {
if (addedNodes.contains(s)) {
added.add(s);
} else if (removedNodes.contains(s)) {
removed.add(s);
} else {
changed.add(s);
}
}
}
UpdateOp op = operations.get(path);
boolean isNew = op != null && op.isNew();
boolean pendingLastRev = op == null
|| !NodeDocument.hasLastRev(op, revision.getClusterId());
nodeStore.applyChanges(revision, path, isNew, pendingLastRev,
isBranchCommit, added, removed, changed, cacheEntry);
}
cacheEntry.done();
}
public void moveNode(String sourcePath, String targetPath) {
diff.tag('>').key(sourcePath).value(targetPath);
}
public void copyNode(String sourcePath, String targetPath) {
diff.tag('*').key(sourcePath).value(targetPath);
}
private void markChanged(String path) {
if (!PathUtils.denotesRoot(path) && !PathUtils.isAbsolute(path)) {
throw new IllegalArgumentException("path: " + path);
}
while (true) {
if (!modifiedNodes.add(path)) {
break;
}
if (PathUtils.denotesRoot(path)) {
break;
}
path = PathUtils.getParentPath(path);
}
}
public void updatePropertyDiff(String path, String propertyName, String value) {
diff.tag('^').key(PathUtils.concat(path, propertyName)).value(value);
}
public void removeNodeDiff(String path) {
diff.tag('-').value(path).newline();
}
public void removeNode(String path) {
removedNodes.add(path);
UpdateOp op = getUpdateOperationForNode(path);
op.setDelete(true);
NodeDocument.setDeleted(op, revision, true);
}
}
| [
"denismo@yahoo.com"
] | denismo@yahoo.com |
85c67d1f8bbac791dc0dc415dcc1eab4c31e8187 | 385722dc7221c59df50c3077b6bdf6ce66163439 | /spring-boot-demo-neo4j/src/main/java/com/xkcoding/neo4j/SpringBootDemoNeo4jApplication.java | c9e8f4d0a22c4377cda600c1524b28c8c3dc67da | [
"MIT"
] | permissive | cuijxin/spring-boot-demo | f2a166391db1844adbe2c594b6be375e2004402a | 115a8fe5b539b4afe930b6a3604c3d9fb0d8ad6c | refs/heads/master | 2020-04-06T21:18:31.116461 | 2018-11-15T12:04:46 | 2018-11-15T12:04:46 | 157,799,298 | 1 | 0 | MIT | 2018-11-16T02:10:04 | 2018-11-16T02:10:04 | null | UTF-8 | Java | false | false | 348 | java | package com.xkcoding.neo4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootDemoNeo4jApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoNeo4jApplication.class, args);
}
}
| [
"237497819@qq.com"
] | 237497819@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.