blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
de07a38fb931e05983162809d755d11594b106b7 | 718c0478a94ec6b7559533cfe2cf125498b16c8a | /src/main/java/com/contribuidor/cma/service/category/CategoryService.java | 09103008d85d719aa953e5a22386da4eafbd89d7 | [
"Apache-2.0"
] | permissive | heitoramartins/rx-java | 3bc47569e833eba49966c353e20261bb01792c08 | 19f9a4a5367ee87e283df396716ea65c7c8f3ff7 | refs/heads/master | 2020-03-27T21:28:22.202614 | 2018-10-28T18:59:04 | 2018-10-28T18:59:04 | 147,146,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,433 | java | package com.contribuidor.cma.service.category;
import static rx.Observable.defer;
import static rx.Observable.empty;
import static rx.Observable.just;
import java.util.List;
import com.contribuidor.cma.entities.Category;
import com.contribuidor.cma.repository.category.CategoryRepository;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import rx.Observable;
@Service
public class CategoryService {
@Autowired
CategoryRepository categoryRepository;
public Observable<List<Category>> findAllActives() {
return defer(() -> {
return just(categoryRepository.findAllByActive(true));
});
}
public Observable<Category> findOne(Long id) {
return defer(() -> {
Category category = categoryRepository.findById(id).orElse(null);
if (category == null)
return empty();
return just(category);
});
}
public Observable<Category> findOneActive(Long id) {
return defer(() -> {
Category category = categoryRepository.findOneByIdAndActive(id, true);
if (category == null)
return empty();
return just(category);
});
}
public Observable<Category> findOneActive(String name) {
return defer(() -> {
Category category = categoryRepository.findOneByNameAndActive(name, true);
if (category == null)
return empty();
return just(category);
});
}
public Observable<Category> findOne(String name) {
return defer(() -> {
Category category = categoryRepository.findOneByName(name);
if (category == null)
return empty();
return just(category);
});
}
public Observable<Category> create(Category category) {
return defer(() -> {
return just(categoryRepository.save(category));
});
}
public Observable<Category> findOrCreate(Long id, String name) {
Observable<Category> findCategoryById = just(Pair.of(id, name)).flatMap(pair -> {
if (pair.getLeft() == null)
return empty();
return findOneActive(pair.getLeft());
});
if (name == null)
return findCategoryById;
return findCategoryById
.switchIfEmpty(findOneActive(name))
.switchIfEmpty(create(new Category(name)));
}
public Observable<Category> delete(Long id) {
return Observable.defer(() -> {
Category category = categoryRepository.findById(id).orElse(null);
category.inactive();
return Observable.just(categoryRepository.save(category));
});
}
}
| [
"heitoramartins@gmail.com"
] | heitoramartins@gmail.com |
2795e87316bc088c06a7d1ff14210de413ec5e9b | 137a74d89c4294f9905ad285829c394196836de7 | /OOP/src/test/java/bitoperation/TestRightShift.java | 51988c4de31233a55704ff4629a2a135c47f7001 | [] | no_license | HelloKittycoder/JavaBaseKnowledge | 424ab9647604891cd718956bcaebfb31b15b4350 | 63ac3bc52e8216cbf6161dcbafc5f6270ac32f20 | refs/heads/master | 2022-10-09T16:55:58.589789 | 2020-02-28T14:42:34 | 2020-02-28T14:42:34 | 211,529,083 | 0 | 0 | null | 2022-10-05T19:37:12 | 2019-09-28T16:25:53 | Java | UTF-8 | Java | false | false | 819 | java | package bitoperation;
/**
* Created by shucheng on 2019-9-29 下午 19:42
* 右移操作
* Java中的位运算符:
* >>表示右移,如果该数为正,则高位补0,若为负数,则高位补1;
* >>>表示无符号右移,也叫逻辑右移,即若该数为正,则高位补0,而若该数为负数,
* 则右移后高位同样补0
*
* 代码说明:
* 5的二进制是0101
* x=5>>2(>>带符号右移)
* 将0101右移2位,为:0001
* y=x>>>2(>>>无符号右移,左边空缺补充为0)
* 将0001右移2位,补0,结果为:0000
*/
public class TestRightShift {
public static void main(String[] args) {
int x,y;
x = 5 >> 2;
y = x >>> 2;
System.out.println("x的值为:" + x);
System.out.println("y的值为:" + y);
}
}
| [
"shucheng2015@outlook.com"
] | shucheng2015@outlook.com |
a3b3d3e265d4c7e14848f20b4e5e2e9dda0d2b5a | 3144b109eade61ab22c43a5da1863aaa7ff7807d | /src/main/java/org/ict/algorithm/leetcode/prefixsum/ContinuousSubArraySum.java | 497ded2cb623ec2b2f4cdfe21de7c54512d8973c | [] | no_license | xuelianhan/basic-algos | 1f3458c1d6790b31a7a8828f5ca8aee7baaa5073 | dd9aae141a3f83b95b0bc50fa77af51ad6dac9e9 | refs/heads/master | 2023-08-31T21:05:29.333204 | 2023-08-31T06:07:56 | 2023-08-31T06:07:56 | 9,878,731 | 5 | 0 | null | 2023-06-15T02:10:19 | 2013-05-06T03:32:24 | Java | UTF-8 | Java | false | false | 4,324 | java | package org.ict.algorithm.leetcode.prefixsum;
import java.util.HashMap;
import java.util.Map;
/**
* Given an integer array nums and an integer k,
* return true if nums has a good sub-array or false otherwise.
*
* A good sub-array is a sub-array where:
*
* its length is at least two,
* and the sum of the elements of the sub-array is a multiple of k.
* Note that:
*
* A sub-array is a contiguous part of the array.
* An integer x is a multiple of k if there exists an integer n such that x = n * k. 0 is always a multiple of k.
*
*
* Example 1:
*
* Input: nums = [23,2,4,6,7], k = 6
* Output: true
* Explanation: [2, 4] is a continuous sub-array of size 2 whose elements sum up to 6.
* Example 2:
*
* Input: nums = [23,2,6,4,7], k = 6
* Output: true
* Explanation: [23, 2, 6, 4, 7] is an continuous sub-array of size 5 whose elements sum up to 42.
* 42 is a multiple of 6 because 42 = 7 * 6 and 7 is an integer.
* Example 3:
*
* Input: nums = [23,2,6,4,7], k = 13
* Output: false
*
*
* Constraints:
* 1 <= nums.length <= 10^5
* 0 <= nums[i] <= 10^9
* 0 <= sum(nums[i]) <= 2^31 - 1
* 1 <= k <= 2^31 - 1
* @author sniper
* @date 15 Aug 2023
* LC523, Medium
*/
public class ContinuousSubArraySum {
/**
* Understanding the following solution
* Time Cost 17ms
* ----------------------------------
* e.g. nums = [23,2,4,6,7], k = 6
* prefixToIndex:{0,-1}
* i:0, prefixSum:23, k != 0, prefixSum = 23 % 6 = 5
* prefixToIndex does not contain key 5, put {5, 0} into prefixToIndex, prefixToIndex:{0,-1}, {5,0}
* i:1, prefixSum = 5 + 2 = 7, k != 0, prefixSum = 7 % 5 = 2
* prefixToIndex does not contain key 2, put {2,1} into prefixToIndex, prefixToIndex:{0,-1}, {5,0}, {2,1}
* i:2, prefixSum = 2 + 4 = 6, k != 0 prefixSum = 6 % 6 = 0
* prefixToIndex contains key 0, lastIndex = prefixToIndex.get(0) = -1, i - lastIndex = 2 - (-1) = 3,
* 3 > 1, return true
* ----------------------------------
* e.g. nums = [2, 4, 3], k = 6
* prefixIndex:{0, -1}
* i:0, prefixSum:2, k != 0, prefixSum = 2 % 6 = 2
* prefixToIndex does not contain key 2, put {2, 0} into prefixToIndex, prefixToIndex:{0,-1},{2,0}
* i:1, prefixSum = 2 + 4 = 6, k != 0, prefixSum = 6 % 6 = 0
* prefixToIndex contains 0, lastIndex = prefixToIndex.get(0) = -1, i - lastIndex = 1 - (-1) = 2
* 2 > 1, return true
*
* @param nums
* @param k
* @return
*/
public boolean checkSubArraySumV1(int[] nums, int k) {
int prefixSum = 0;
/**
* Build the mapping relation of modular number and the index of the array.
*/
Map<Integer, Integer> prefixToIndex = new HashMap<>();
/**
* e.g. nums = [2, 4, 3], k = 6
* 0 <= nums[i] <= 10^9
* so prefixSum is greater than or equals to zero.
* At first, prefixSum:0 does not exist, so its index in the array is -1 here.
* Notice it's -1 instead of 0, because 0 is a valid index in the array.
*/
prefixToIndex.put(0, -1);
for (int i = 0; i < nums.length; i++) {
prefixSum += nums[i];
if (k != 0) {
prefixSum %= k;
}
if (prefixToIndex.containsKey(prefixSum)) {
// sub-array length is at least two,
// and the sum of the elements of the sub-array is a multiple of k
if (i - prefixToIndex.get(prefixSum) > 1) {
return true;
}
} else {
// Only add if absent, because the previous index is better
prefixToIndex.put(prefixSum, i);
}
}
return false;
}
/**
* Brute-Force solution
* Time Limit Exceeded.
* @param nums
* @param k
* @return
*/
public boolean checkSubArraySum(int[] nums, int k) {
for (int i = 0; i < nums.length; i++) {
int sum = nums[i];
for (int j = i + 1; j < nums.length; j++) {
sum += nums[j];
if (sum == k) {
return true;
}
if (k != 0 && sum % k == 0) {
return true;
}
}
}
return false;
}
}
| [
"xueliansniper@gmail.com"
] | xueliansniper@gmail.com |
50ad7000a46d9a9452f1a3514e5c15bc2ef69d50 | d719c6d59790d6c8a6fce8a63138f8315761dafb | /app/src/main/java/com/example/jatin/foreignlanguagefinal/French/RecyclerAdapterFrenchFamily.java | 7001df2b27db3bca901e46ecc9d4eb257c16f3fd | [] | no_license | jatingarg10/ForeignLanguageFinal | 27dc6e7a1bc73632a70a41fdfab1b2fe9d6d5d59 | 14dd5c1c83a8e6015318b92fc9f54062a6e345d4 | refs/heads/master | 2020-03-15T06:26:19.060005 | 2018-05-29T22:11:29 | 2018-05-29T22:11:29 | 132,007,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,901 | java | package com.example.jatin.foreignlanguagefinal.French;
import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.example.jatin.foreignlanguagefinal.R;
import java.util.zip.Inflater;
/**
* Created by Jatin on 15-May-18.
*/
public class RecyclerAdapterFrenchFamily extends RecyclerView.Adapter<RecyclerAdapterFrenchFamily.MyViewHolder> {
String[] frenchFamily;
String[] frenchFamilyTranslate;
int[] frenchFamilyImages;
ListItemClickListener listItemClickListener;
Context context;
public RecyclerAdapterFrenchFamily(String[] frenchFamily, String[] frenchFamilyTranslate, int[] frenchFamilyImages, ListItemClickListener listItemClickListener,Context context) {
this.frenchFamily = frenchFamily;
this.frenchFamilyTranslate = frenchFamilyTranslate;
this.frenchFamilyImages = frenchFamilyImages;
this.listItemClickListener = listItemClickListener;
this.context = context;
}
public interface ListItemClickListener
{
void onClick(View view,int position);
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_languages,parent,false);
MyViewHolder viewHolder = new MyViewHolder(inflate);
return viewHolder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.txtView.setText(frenchFamily[position]);
holder.txtViewTrans.setText(frenchFamilyTranslate[position]);
holder.txtView.setBackgroundColor(Color.parseColor("#32CD32"));
holder.txtViewTrans.setBackgroundColor(Color.parseColor("#32CD32"));
Glide.with(context)
.load(frenchFamilyImages[position])
.override(150,180)
.fitCenter()
.into(holder.imageView);
}
@Override
public int getItemCount() {
return frenchFamily.length;
}
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
ImageView imageView;
TextView txtView;
TextView txtViewTrans;
public MyViewHolder(View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.imgView);
txtView = itemView.findViewById(R.id.txtView);
txtViewTrans = itemView.findViewById(R.id.txtViewTrans);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View view) {
listItemClickListener.onClick(view,getAdapterPosition());
}
}
}
| [
"jatingarg.100@gmail.com"
] | jatingarg.100@gmail.com |
34b7612c1d1f1cda30d62f57a718131ee476dc20 | b4a4509c511d2c79e3934479a7b63fcc8aa8ee5e | /src/main/java/com/imooc/mall/form/CartAddForm.java | 6fad6477f51abef9255989302695cbcdc09243ed | [] | no_license | yizhishuai/mallBackEnd | 6f42038d91d54cd359ada781ad2253a73ba6304e | 525463dc3a406eb393cd25e434af417c43be8094 | refs/heads/master | 2023-05-12T14:01:45.515312 | 2021-06-08T02:37:30 | 2021-06-08T02:37:30 | 369,367,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.imooc.mall.form;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 添加商品
*
*/
@Data
public class CartAddForm {
@NotNull
private Integer productId;
private Boolean selected = true;
}
| [
"liushuaidejia@qq.com"
] | liushuaidejia@qq.com |
8635c4e9c50de2b5e4be9f4acc3d66fcd47d03ef | 964b452c95d72de02a891346976f47fa41dc6396 | /javaDesignMode/src/main/java/创建型/SingletonMode.java | d2fa076b922bf35800c82c1de3f1898747fcca86 | [] | no_license | Yaphel/JavaLearningNote | ab8a7f6df83410545db04f460de623e199c4384a | dc7924572693256f2193eab4632140b31a52bbae | refs/heads/master | 2023-03-22T21:23:32.398030 | 2021-03-23T01:01:31 | 2021-03-23T01:01:31 | 308,563,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,279 | java | package 创建型;
import lombok.Synchronized;
public class SingletonMode {
//五种
public static void main(String[] args) {
}
//第一种 饿汉
// private static SingletonMode instance = new SingletonMode();
// private SingletonMode() { }
// public static SingletonMode getInstance() {
// return instance;
// }
//第二种 懒汉 非线程安全,多个线程同时调用可能会引起重复创建
// private static SingletonMode instance = null;
// private SingletonMode() { }
// public static SingletonMode getInstance() {
// if (instance == null) {
// instance = new SingletonMode();
// }
// return instance;
// }
// 懒汉的线程安全版本
// private static SingletonMode instance = null;
// private SingletonMode() { }
// public synchronized static SingletonMode getInstance() {
// if (instance == null) {
// instance = new SingletonMode();
// }
// return instance;
// }
//双重校验锁
// 大多数情况下走一遍if,但当多个线程时,会进行同步。
// singleton = new Singleton(); 这段代码其实是分为三步执行:
// 为 singleton 分配内存空间
// 初始化 singleton
// 将 singleton 指向分配的内存地址
// 但是由于 JVM 具有指令重排的特性,执行顺序有可能变成 1–> 3 --> 2。指令重排在单线程环境下不会出现问题,但是在多线程环境下会导致一个线程获得还没有初始化的实例。
// 例如,线程 T1 执行了 1 和 3,此时 T2 调用 getInstance() 后发现 singleton 不为空,因此返回 singleton ,但此时 singleton 还未被初始化。
// 使用 volatile 可以禁止 JVM 的指令重排,保证在多线程环境下也能正常运行。
// private static volatile SingletonMode instance = null;
// private SingletonMode() {
// }
// public static SingletonMode getInstance() {
// if (instance == null) {
// synchronized (SingletonMode.class) {
// if (instance == null) {
// instance = new SingletonMode();
// }
// }
// }
// return instance;
// }
// 静态内部类 比上个方法实现简单
// private SingletonMode() {}
// private static class SingletonHolder {
// private static SingletonMode INSTANCE = new SingletonMode();
// }
// public static SingletonMode getInstance() {
// return SingletonHolder.INSTANCE;
// }
//
//以上四种均存在反序列化漏洞。
//原理:jdk的源码InputStream在读对象的时候,会通过反射生成一个新的对象,而不是拿原来对象的引用。
//如此一来单例模式就失效了。
//防御方案
//通过jdk的方法定义,告诉jdk该类反序列化的时候不要反射,而要使用自己定义的应用。
//private Object readResolve(){
// return hungrySingleton;
//}
//
// 枚举不会有反序列化问题,因为java序列化对枚举做了特殊的规定。对于反射也是。
// public enum SingletonMode {
// INSTANCE;
// }
}
| [
"shihaonan@shihaonandeMacBook-Pro.local"
] | shihaonan@shihaonandeMacBook-Pro.local |
0e8883bdc5df966114c28eeb98eec050e87d6cf3 | 72b38bc9c53e02a5c8c1daac6904155b6b4b3569 | /src/main/java/pe/gob/mindef/app/web/rest/errors/BadRequestAlertException.java | 00cd3d0333a076996ee985b175f1feb5f0f2de42 | [] | no_license | Hansleonel/Patrimonio | acf6f725dabb65279d973f785b3ee9859d3ddfd9 | 952e7369dfe4488e4c2328bb90f0094fb7294398 | refs/heads/master | 2023-01-05T21:57:20.629124 | 2020-11-04T16:52:56 | 2020-11-04T16:52:56 | 298,646,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package pe.gob.mindef.app.web.rest.errors;
import org.zalando.problem.AbstractThrowableProblem;
import org.zalando.problem.Status;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
public class BadRequestAlertException extends AbstractThrowableProblem {
private static final long serialVersionUID = 1L;
private final String entityName;
private final String errorKey;
public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) {
this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey);
}
public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) {
super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey));
this.entityName = entityName;
this.errorKey = errorKey;
}
public String getEntityName() {
return entityName;
}
public String getErrorKey() {
return errorKey;
}
private static Map<String, Object> getAlertParameters(String entityName, String errorKey) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("message", "error." + errorKey);
parameters.put("params", entityName);
return parameters;
}
}
| [
"ogtie34@mindef.gob.pe"
] | ogtie34@mindef.gob.pe |
c09353ada0cd434731d4f40278c2bcc8fbbc0942 | 2478ad1b7f8fc2af5a28a64c51eb32605b577384 | /prova parcial/ProvaQuatro/src/provaquatro/ProvaQuatro.java | b1cf375a0b74fc8de28c6c2fd857f641b74bbc72 | [] | no_license | JonathanSilvaViana/linguagem-de-programacao-estacio | 2814d16cc29fa90be43b7d9e54eb23312efd6762 | 71ce833d86c306fd0349377cc42aca7cd080735c | refs/heads/master | 2020-07-27T10:47:02.311430 | 2019-10-13T01:39:25 | 2019-10-13T01:39:25 | 209,063,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 710 | 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 provaquatro;
/**
*
* @author jonat
*/
public class ProvaQuatro {
class Primeira { int x = 20; void Calc(int aux1) { x*=aux1; } }
class Segunda extends Primeira { void Calc(int aux2) { x+=aux2; } }
class Terceira extends Segunda { String a = "Sistema de Informação"; }
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Terceira t = new Terceira();
Primeira p = new Primeira();
t.Calc(3);
System.out.print(t.x+" "+p.x);
}
}
| [
"jonathantepes@hotmail.com"
] | jonathantepes@hotmail.com |
4f1a1395a0875f0789257d03fc975830b30c1c9b | 06287463d6c63ec4255891ee43bf9dd71c3cfc61 | /java_tasks/src/lesson_7/human/Human.java | 42936160dc88ee4135a65959cde753054fa3337b | [] | no_license | wavan2012/Java_course | 4d40fc87aa6401d707dcf166d22ac4415457a0c9 | 17b3f9b9ef0f718ffb5dc1eb9c02afbc9230dc6d | refs/heads/master | 2023-06-26T20:34:23.155017 | 2021-07-31T12:35:53 | 2021-07-31T12:35:53 | 382,850,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,134 | java | package lesson_7.human;
import lesson_7.human.boots.IBoots;
import lesson_7.human.jackets.IJackets;
import lesson_7.human.pants.IPants;
public class Human {
private String name;
private IJackets jacket;
private IPants pants;
private IBoots boots;
Human(String n, IJackets jacket, IPants pants, IBoots boots) {
this.name = n;
this.jacket = jacket;
this.pants = pants;
this.boots = boots;
}
Human(String n) {
this.name = n;
}
void putOn() {
jacket.putOn();
pants.putOn();
boots.putOn();
}
void putOn(IJackets jacket, IPants pants, IBoots boots) {
this.jacket = jacket;
this.pants = pants;
this.boots = boots;
jacket.putOn();
pants.putOn();
boots.putOn();
}
void putOff() {
jacket.putOff();
this.jacket = null;
pants.putOff();
this.pants = null;
boots.putOff();
this.boots = null;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} | [
"86180560+wavan2012@users.noreply.github.com"
] | 86180560+wavan2012@users.noreply.github.com |
52c2086fc8ceb9a615e0c6af346462eb86b510e6 | 9fc8cc7ad06006b5c7fdbe7c16950ecad4781d05 | /shoppingbackend/src/main/java/com/teja/shoppingbackend/App.java | de0c89614d18c6e5308f8b6f30692bbe60f8a082 | [] | no_license | yallateja/online-shopping | 548313b1234136d532c6539a6b4103a33c9b945f | 5478c63fe295bc5b4eeb42727429bd042454870c | refs/heads/master | 2020-12-02T18:15:46.808092 | 2017-07-10T07:13:18 | 2017-07-10T07:13:18 | 96,505,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package com.teja.shoppingbackend;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"yallateja@gmail.com"
] | yallateja@gmail.com |
19e28193771b5f39a840e8f154b0d13662e5e59d | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_2/src/d/h/Calc_1_2_372.java | 43f2cb59cd9b8158da7cd675d296eb1a8711abd8 | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | package d.h;
public class Calc_1_2_372 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
2ae4924d00464fee0e62f14399e2f52860cc832f | 06374081aedbb1077c466013a6ce2f48bce287d6 | /tamal sir/Name/app/src/androidTest/java/com/apkglobal/name/ExampleInstrumentedTest.java | 43b1b9a460ff4377cdf3b720b568dd6f640ac6f3 | [] | no_license | pawanprogrammer/NTVdia | 271ba7f1c9156466a876d06667e1f4753d9661cc | 4c418a81a327bcab9f0ea78741ff0f2eaf79495e | refs/heads/master | 2021-04-23T23:18:33.657299 | 2020-05-24T14:13:55 | 2020-05-24T14:13:55 | 250,029,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package com.apkglobal.name;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.apkglobal.name", appContext.getPackageName());
}
}
| [
"pawansharma548@gmail.com"
] | pawansharma548@gmail.com |
e607d71cd1774ba0d257af8908e4191a76b5aaf7 | a80f032e91bf028da7592939887db9985dd0b5d6 | /src/StudentTicket.java | 37ef485a0afb406d8b3da7e794e1db8ca7783f26 | [] | no_license | Slavyastiy/ICS372 | 67e162a005643632455f849764b395eb7971a8af | b1e8afefd7d9e20b81a664623ee1043c5491d478 | refs/heads/master | 2020-12-02T18:09:32.378674 | 2017-07-07T00:14:32 | 2017-07-07T00:14:32 | 96,485,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | import java.util.Date;
public class StudentTicket extends Ticket{
public StudentTicket (int quantity, String customerID, String cardNumber, Date ticketDate, double price) {
super();
this.quantity = quantity;
this.customerID = customerID;
this.cardNumber = cardNumber;
this.ticketDate = ticketDate;
this.price = setPrice(price);
}
@Override
protected double setPrice(double ticketPrice) {
return price;
}
@Override
public String toString() {
return "test";
}
}
| [
"MattDev31@users.noreply.github.com"
] | MattDev31@users.noreply.github.com |
57e91945824a2a52048f18d100c22faa3b085b21 | b53a1dfb235bcd9d50af35eb86e9ff377b681654 | /app/src/main/java/demo/eventcollect/collect/collector/DataCollector.java | 3a892aaa2f5769c657488580eaf9cc29a7c30743 | [] | no_license | zgsxdtwyf/EventCollect | 3071335742d64baf0f4097b0bd861b1b8b66c7a9 | 2af8c8da182a41a1e0dec58392f16a20c9e9049a | refs/heads/master | 2020-03-21T05:26:32.462891 | 2018-01-26T10:01:16 | 2018-01-26T10:01:16 | 138,160,801 | 1 | 0 | null | 2018-06-21T11:21:29 | 2018-06-21T11:21:29 | null | UTF-8 | Java | false | false | 6,398 | java | package demo.eventcollect.collect.collector;
import android.content.Context;
import org.json.JSONArray;
import org.json.JSONObject;
import demo.eventcollect.collect.uiutil.ButtonUtil;
import demo.eventcollect.collect.uiutil.CheckBoxUtil;
import demo.eventcollect.collect.uiutil.ImageViewUtil;
import demo.eventcollect.collect.uiutil.TextViewUtil;
/**
* 行为数据捕捉接口
* Data Collection Instance;
*/
public class DataCollector {
private static final String TAG = "DataCollector";
public DataCollector() {
}
/**
* Json列表插入
* Json Insertion
*
* @param object Json元素 Json Object;
* @param array Json列表 Json Array;
* @return 返回插好的Json列表 Inserted Json Array;
*/
private JSONArray InsertJSONObject(JSONObject object, JSONArray array) {
if (null != object) {
return array.put(object);
} else {
return array;
}
}
/**
* activity打开状态收集
* activity open data
*
* @param array 待插入的Json列表
* @param activityName activity标志
* @param activityTitle activity标题
* @param activityTag activity的备注
* @return 插好的Json列表
*/
public JSONArray activityOpenDataCollect(JSONArray array, String activityName, String activityTitle, String activityTag, int type) {
JSONObject object = PageCollector.getInstance().pageOpenInfoGenerated(activityName, activityTitle, activityTag,type);
return InsertJSONObject(object, array);
}
/**
* activity关闭状态收集
* activity closed data
*
* @param array 待插入的Json列表
* @param activityName
* @param activityTitle
* @param activityTag
* @return 插好的Json列表
*/
public JSONArray activityCloseDataCollect(JSONArray array, String activityName, String activityTitle, String activityTag, int type) {
JSONObject object = PageCollector.getInstance().pageCloseInfoGenerated(activityName, activityTitle, activityTag,type);
return InsertJSONObject(object, array);
}
/**
* 用户交互数据收集 button点击行为收集
* button clicked data
*
* @param target button标志 the button mark;
* @param title button字面标题 info in the button;
* @param tag button携带的tag the tag brought;
* @param activityName button 所在activity activity which the button in;
* @param array 待插入的json列表 Json Array;
* @return 插好的json列表 Finished Json Array;
*/
public JSONArray buttonPressDataCollect(String target, String title, String tag, String activityName, JSONArray array) {
JSONObject object = ButtonUtil.buttonInfoGenerated(target, title, tag, activityName);
return InsertJSONObject(object, array);
}
/**
* 用户交互数据收集 button点击行为收集
* button clicked data
*
* @param attributes 自定义事件标识
* @param title button字面标题 info in the button;
* @param activityName button 所在activity activity which the button in;
* @param array 待插入的json列表 Json Array;
* @return 插好的json列表 Finished Json Array;
*/
public JSONArray attributeDataCollect(String attributes, String title, String activityName, JSONArray array) {
JSONObject object = ButtonUtil.attributeGenerated(attributes, title, activityName);
return InsertJSONObject(object, array);
}
/**
* ImageView点击动作收集
* ImageView clicked data
*
* @param target ImageView标志; mark;
* @param title ImageView标题; title;
* @param tag ImageView携带的tag; tag;
* @param activityName ImageView所在的Activity; activity
* @param array 待插入的jsonArray; Json Array;
* @return 插好的jsonArray; Finished Json Array;
*/
public JSONArray imageViewPressDataCollect(String target, String title, String tag, String activityName, JSONArray array) {
JSONObject object = ImageViewUtil.imageViewInfoGenerated(target, title, tag, activityName);
return InsertJSONObject(object, array);
}
/**
* CheckBox点击动作收集
* @param target CheckBox标志; mark;
* @param title CheckBox字面标题; title;
* @param tag CheckBox携带的tag; tag;
* @param activityName CheckBox所在的activity; activity;
* @param array 待插入的json列表; Json Array;
* @return 插好的json列表; Finished Json Array;
*/
public JSONArray checkBoxCheckDataCollect(String target, String title, String tag, String activityName, JSONArray array) {
JSONObject object = CheckBoxUtil.checkBoxClickInfoGeneration(target, title, tag, activityName);
return InsertJSONObject(object, array);
}
/**
* TextView动作收集
* TextView clicked data
*
* @param target TextView标志; mark;
* @param title TextView字面标题; title;
* @param tag TextView携带的tag; tag;
* @param activityName TextView所在的activity; activity
* @param array 待插入的json列表; Json Array;
* @return 插好的json列表; Finished Json Array
*/
public JSONArray textViewInfoDataCollect(String target, String title, String tag, String activityName, JSONArray array){
JSONObject object = TextViewUtil.textViewInfoGenerated(target, title, tag, activityName);
return InsertJSONObject(object, array);
}
/**
* 插入crash事件,搜集crash
* crash event data
*
* @param object crash事件; Crash event;
* @param array 待插入的Json列表; Json Array;
* @return 插好的Json列表; Finished Json Array;
*/
public JSONArray insertCrashHandler(JSONObject object, JSONArray array) {
return InsertJSONObject(object, array);
}
/**
* 退出APP事件收集 关了有可能收不到
* App Exited data
*
* @param context
* @param array 待插入的Json列表; Json Array;
* @return 插好的Json列表; Finished Json Array;
*/
public JSONArray appExitLogHandle(Context context, JSONArray array) {
JSONObject object = PageCollector.getInstance().appCloseEventGeneration(context);
return InsertJSONObject(object, array);
}
}
| [
"951442843@qq.com"
] | 951442843@qq.com |
e0600097df0f5956a4966e01a4dce40d2d79f831 | 466d86c179380a5131eac91ae56a005fa07f4dd7 | /alurator/src/br/com/alura/alurator/reflexao/Reflexao.java | 0cae6a2255b3e5f6201fabd777b4d81e7bf755cc | [] | no_license | alansvieceli/replection-java | ca4b594e44c084313fd82e455b2c1efb685c76f1 | 89aa461e1b6ee812ebbb19d6b220770d4b14d414 | refs/heads/master | 2020-05-14T19:48:21.872137 | 2019-04-25T22:33:35 | 2019-04-25T22:33:35 | 181,934,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package br.com.alura.alurator.reflexao;
public class Reflexao {
public ManipuladorClasse refleteClasse(String fqn) {
Class<?> classe = getClasse(fqn);
return new ManipuladorClasse(classe);
}
public Class<?> getClasse(String fqn) {
try {
return Class.forName(fqn);
} catch (ClassNotFoundException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
| [
"alansvieceli@gmail.com"
] | alansvieceli@gmail.com |
5cd3e1441497bbe0923aa5a03d7e913cfd617158 | a0e3587abb291189d6df0266424ed0ffabff060a | /jmh/src/main/java/com/wh/demo/jmh/JMHSample_06_FixtureLevel.java | 1430d7fd7d3c76f088548566742706d20c79c770 | [] | no_license | wanghao123456/test | 1814ffaaed9b36935cfc5c5c142eaa2969eb17d2 | 41df025f54c10d135db80918b71c12b3a1adf61c | refs/heads/release | 2021-06-12T07:56:02.498756 | 2021-01-29T21:30:28 | 2021-01-29T21:30:28 | 170,616,929 | 0 | 0 | null | 2021-03-31T13:11:08 | 2019-02-14T02:54:47 | Java | UTF-8 | Java | false | false | 2,794 | java | package com.wh.demo.jmh;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
@State(Scope.Thread)
public class JMHSample_06_FixtureLevel {
double x;
/*
* Fixture methods have different levels to control when they should be run.
* There are at least three Levels available to the user. These are, from
* top to bottom:
*
* Level.Trial: before or after the entire benchmark run (the sequence of iterations)
* Level.Iteration: before or after the benchmark iteration (the sequence of invocations)
* Level.Invocation; before or after the benchmark method invocation (WARNING: read the Javadoc before using)
*
* Time spent in fixture methods does not count into the performance
* metrics, so you can use this to do some heavy-lifting.
*/
@TearDown(Level.Iteration)
public void check() {
assert x > Math.PI : "Nothing changed?";
}
@Benchmark
public void measureRight() {
x++;
}
@Benchmark
public void measureWrong() {
double x = 0;
x++;
}
/*
* ============================== HOW TO RUN THIS TEST: ====================================
*
* You can see measureRight() yields the result, and measureWrong() fires
* the assert at the end of first iteration! This will not generate the results
* for measureWrong(). You can also prevent JMH for proceeding further by
* requiring "fail on error".
*
* You can run this test:
*
* a) Via the command line:
* $ mvn clean install
* $ java -ea -jar target/benchmarks.jar JMHSample_06 -wi 5 -i 5 -f 1
* (we requested 5 warmup/measurement iterations, single fork)
*
* You can optionally supply -foe to fail the complete run.
*
* b) Via the Java API:
* (see the JMH homepage for possible caveats when running from IDE:
* http://openjdk.java.net/projects/code-tools/jmh/)
*/
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(JMHSample_06_FixtureLevel.class.getSimpleName())
.warmupIterations(5)
.measurementIterations(5)
.forks(1)
.jvmArgs("-ea")
.shouldFailOnError(false) // switch to "true" to fail the complete run
.build();
new Runner(opt).run();
}
}
| [
"Wh996399"
] | Wh996399 |
3b5379632ea873a1e01267bb88f760bc29d9fc5a | bfb22064506d435d4165bd99603e34a151fbafb4 | /ustHibernate/jpawithhibernateapp/src/main/java/com/ustglobal/jpawithhibernate/manytomany/Cource.java | 7f62d83226f472c9ecadc903045924a06e8abd04 | [] | no_license | Harshamukund/UST-Global-16-SEP-19-Harshamukund | 402bfdae2ffcf1652f6b17820159ad70664bec38 | e69fe4f08779f1d14ef636e7d29bd73394df2f87 | refs/heads/master | 2023-01-10T13:44:54.931405 | 2019-12-22T02:44:47 | 2019-12-22T02:44:47 | 224,569,475 | 0 | 0 | null | 2023-01-07T13:04:47 | 2019-11-28T04:25:54 | Java | UTF-8 | Java | false | false | 526 | java | package com.ustglobal.jpawithhibernate.manytomany;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import lombok.Data;
@Entity
@Data
@Table
public class Cource {
@Id
@Column
private int cid;
@Column
private String cname;
@ManyToMany(cascade=CascadeType.ALL,mappedBy="cources")
private List<Student> students;
}
| [
"noreply@github.com"
] | noreply@github.com |
a6355d7d3954f000ecc2c774d79543335f258df8 | ce898bc07ee769071481da49dbaf978c1ee9d089 | /src/main/java/acp/db/service/impl/jdbc/ToptionManagerListJdbc.java | 0571f7b1aea64eb3013ab691435c72ca69747c42 | [] | no_license | sbshab1969/mss11 | f305f795d4f1bf2e472c3f7cd294162f5069793a | e6937d29d76f4873fd5beb2bf691e72e3ae2b394 | refs/heads/master | 2022-11-29T12:22:12.632040 | 2020-08-10T16:05:51 | 2020-08-10T16:05:51 | 286,515,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,188 | java | package acp.db.service.impl.jdbc;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
//import java.sql.Date;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import acp.db.service.IToptionManagerList;
import acp.forms.dto.ToptionDto;
import acp.utils.*;
public class ToptionManagerListJdbc extends ManagerListJdbc<ToptionDto> implements IToptionManagerList {
private static Logger logger = LoggerFactory.getLogger(ToptionManagerListJdbc.class);
// private String tableName;
private String[] fields;
private String[] headers;
private Class<?>[] types;
private String pkColumn;
private Long seqId;
private String strFields;
private String strFrom;
private String strAwhere;
private String strWhere;
private String strOrder;
// private String strQuery;
private String strQueryCnt;
private List<ToptionDto> cacheObj = new ArrayList<>();
private String path;
private ArrayList<String> attrs;
private int attrSize;
private int attrMax = 5;
private String attrPrefix;
public ToptionManagerListJdbc(String path, ArrayList<String> attrs) {
this.path = path;
this.attrs = attrs;
this.attrSize = attrs.size();
String[] pathArray = path.split("/");
this.attrPrefix = pathArray[pathArray.length - 1];
createFields();
strFields = QueryUtils.buildSelectFields(fields, null);
createTable(-1L);
strWhere = strAwhere;
strOrder = pkColumn;
prepareQuery(null);
}
@Override
public String[] getHeaders() {
return headers;
}
@Override
public Class<?>[] getTypes() {
return types;
}
@Override
public Long getSeqId() {
return seqId;
}
private void createFields() {
fields = new String[attrSize + 3];
headers = new String[attrSize + 3];
types = new Class<?>[attrSize + 3];
// ---
int j = 0;
fields[j] = "config_id";
headers[j] = "ID";
types[j] = Long.class;
pkColumn = fields[j];
// ---
for (int i = 0; i < attrSize; i++) {
j++;
fields[j] = "P" + j;
headers[j] = FieldConfig.getString(attrPrefix + "." + attrs.get(i));
types[j] = String.class;
}
// ---
j++;
fields[j] = "date_begin";
headers[j] = Messages.getString("Column.DateBegin");
types[j] = Date.class;
// ---
j++;
fields[j] = "date_end";
headers[j] = Messages.getString("Column.DateEnd");
types[j] = Date.class;
// ---
}
public void createTable(Long src) {
String res = "table(mss.spr_options(" + src + ",'" + path + "'";
for (int i = 0; i < attrSize; i++) {
res += ",'" + attrs.get(i) + "'";
}
for (int i = attrSize; i < attrMax; i++) {
res += ",null";
}
res += "))";
strFrom = res;
}
@Override
public void prepareQuery(Map<String,String> mapFilter) {
if (mapFilter != null) {
setWhere(mapFilter);
} else {
strWhere = strAwhere;
}
strQuery = QueryUtils.buildQuery(strFields, strFrom, strWhere, strOrder);
strQueryCnt = QueryUtils.buildQuery("select count(*) cnt", strFrom, strWhere, null);
}
private void setWhere(Map<String,String> mapFilter) {
strWhere = strAwhere;
}
@Override
public List<ToptionDto> queryAll() {
openQueryAll(); // forward
cacheObj = fetchAll();
closeQuery();
return cacheObj;
}
@Override
public List<ToptionDto> fetchPage(int startPos, int cntRows) {
cacheObj = fetchPart(startPos,cntRows);
return cacheObj;
}
private List<ToptionDto> fetchAll() {
ArrayList<ToptionDto> cache = new ArrayList<>();
try {
while (rs.next()) {
ToptionDto record = getObject(rs);
cache.add(record);
}
} catch (SQLException e) {
DialogUtils.errorPrint(e,logger);
cache = new ArrayList<>();
} catch (Exception e) {
DialogUtils.errorPrint(e,logger);
cache = new ArrayList<>();
}
return cache;
}
private List<ToptionDto> fetchPart(int startPos, int cntRows) {
ArrayList<ToptionDto> cache = new ArrayList<>();
if (startPos <= 0 || cntRows<=0) {
return cache;
}
try {
boolean res = rs.absolute(startPos);
if (res == false) {
return cache;
}
int curRow = 0;
//------------------------------------------
do {
curRow++;
ToptionDto record = getObject(rs);
cache.add(record);
if (curRow>=cntRows) break;
//----------------------------------------
} while (rs.next());
//------------------------------------------
} catch (SQLException e) {
DialogUtils.errorPrint(e,logger);
cache = new ArrayList<>();
} catch (Exception e) {
DialogUtils.errorPrint(e,logger);
cache = new ArrayList<>();
}
return cache;
}
private ToptionDto getObject(ResultSet rs) throws SQLException {
//---------------------------------------
Long rsId = rs.getLong("config_id");
// ----------------------
int j = 0;
ArrayList<String> pArr = new ArrayList<>();
for (int i = 0; i < attrSize; i++) {
j = i + 1;
String pj = rs.getString("p" + j);
pArr.add(pj);
}
// ----------------------
Date rsDateBegin = rs.getTimestamp("date_begin");
Date rsDateEnd = rs.getTimestamp("date_end");
//---------------------------------------
ToptionDto obj = new ToptionDto();
obj.setId(rsId);
obj.setArrayP(pArr);
obj.setDateBegin(rsDateBegin);
obj.setDateEnd(rsDateEnd);
//---------------------------------------
return obj;
}
@Override
public long countRecords() {
long cntRecords = 0;
try {
Statement stmt = dbConn.createStatement();
ResultSet rs = stmt.executeQuery(strQueryCnt);
rs.next();
cntRecords = rs.getLong(1);
rs.close();
stmt.close();
} catch (SQLException e) {
DialogUtils.errorPrint(e,logger);
cntRecords = 0;
} catch (Exception e) {
DialogUtils.errorPrint(e,logger);
cntRecords = 0;
}
return cntRecords;
}
}
| [
"sbshab1969@gmail.com"
] | sbshab1969@gmail.com |
9593c2d7981d2ff4efa41d3f5f67e350b168d506 | 7c57c6cc80f0912bc38f72d8c8d666f9ee97aa92 | /app/src/main/java/com/example/instaclone/Fragments/HomeFragment.java | 08a180de44d2099ab676dcc3b32e1b096eb0b82f | [] | no_license | AnnanyaV/Instagram-clone | fbddfa70dd803b62950e67faeb694fc61929c360 | 040d14e2283ad7ff8ca1a13cb0d8ddd168c7ae4d | refs/heads/master | 2022-11-24T06:23:09.324189 | 2020-08-02T18:57:41 | 2020-08-02T18:57:41 | 284,333,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | package com.example.instaclone.Fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import com.example.instaclone.R;
public class HomeFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_home, container, false);
}
} | [
"annanyaved.07@gmail.com"
] | annanyaved.07@gmail.com |
6c08dfecd7b4501a4fd9b324fd8437e64fe6f74f | f2ef2289f8cacea6e542b2d9199cc637f5a0c10a | /Java/EvaluateWithExceptions/Expression/AnyExpression.java | 084822405bdb870d9f771222e2f4cae7be02e7aa | [] | no_license | iilnar/paradigms | 56a4e393f36fb2c80d0e3f3a6731683791be7087 | ffe947a3cc9686cece13debe73c3c26007842884 | refs/heads/master | 2021-01-20T17:57:37.961599 | 2016-05-28T19:37:20 | 2016-05-28T19:37:20 | 59,911,329 | 0 | 1 | null | null | null | null | WINDOWS-1251 | Java | false | false | 150 | java | package Evaluate.Expression;
/**
* Created by Илнар on 17.03.2015.
*/
public interface AnyExpression extends Expression, TripleExpression {
}
| [
"sabirzyanovilnar@gmail.com"
] | sabirzyanovilnar@gmail.com |
7c81fab4a2d5329900bbc5c312a649875843d8a6 | 9f425cddec2205b4cf18c795462333ab606937fb | /贪心/主元素 II.java | 939201b4c24502995ce8e9f40700bdd1bf33d2fe | [] | no_license | biiliwuiid/LintCode | 588f0f36b44c0b918fb05467478be78110873e87 | c9af5b63741af666246e113a4888efc907b48825 | refs/heads/master | 2020-04-13T21:46:58.333469 | 2016-06-26T04:28:38 | 2016-06-26T04:28:38 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 850 | java | /*
给定一个整型数组,找到主元素,它在数组中的出现次数严格大于数组元素个数的三分之一。
注意事项
数组中只有唯一的主元素
样例
给出数组[1,2,1,2,1,3,3] 返回 1
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
public class Solution {
/**
* @param nums: A list of integers
* @return: The majority number that occurs more than 1/3
*/
public int majorityNumber(ArrayList<Integer> nums) {
HashMap<Integer, Integer> map = new HashMap<>();
int length = nums.size()/3;
for(int sub:nums){
if(map.containsKey(sub))
map.put(sub, map.get(sub)+1);
else{
map.put(sub,1);
}
}
for(Entry<Integer, Integer> entry:map.entrySet()){
if(entry.getValue()>length)
return entry.getKey();
}
return -1;
}
} | [
"Evan123mg@gmail.com"
] | Evan123mg@gmail.com |
ec95b565188e2d19dc28a5970c9fc181264716a8 | b55472165e662d892917bf0b69749bacc0e150e6 | /src/test/java/edu/virginia/uvacluster/internal/statistic/test/VarianceTest.java | bae1b54d597474c215124140b840d6ae388cdd65 | [
"MIT"
] | permissive | qiyanjun/Paper16-SCODE | 2bd3f3a976c6b117f1c504769df247779ed8204d | 2ca0abcb492e43c291cdf6f1dbb567ab0eeaaa0d | refs/heads/master | 2021-01-09T05:10:34.270981 | 2016-06-14T18:31:45 | 2016-06-14T18:31:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package edu.virginia.uvacluster.internal.statistic.test;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import edu.virginia.uvacluster.internal.statistic.StatisticRange;
import edu.virginia.uvacluster.internal.statistic.Variance;
public class VarianceTest {
private List<Double> values = Arrays.asList(0.0,1.0,2.0,-8.0,-5.0,3.0,4.0,11.0);
private List<Double> oddNumOfValues = Arrays.asList(1.0,2.0,-8.0,-5.0,3.0,4.0,11.0);
@Test
public void shouldReturnVariance() {
assertEquals("Variance should be 29", 29, new Variance(new StatisticRange(3)).transform(values), 0.01);
assertEquals("Variance should be 32.98", 32.98, new Variance(new StatisticRange(3)).transform(oddNumOfValues), 0.01);
assertEquals("Variance should be 29 with manual mean", 29, new Variance(new StatisticRange(3)).transform(values, 1), 0.01);
}
}
| [
"nickjanus@gmail.com"
] | nickjanus@gmail.com |
ff7c3ba8a51d5f1872e46f86c9f4fb4bbdac57f9 | b47b4a8af29321438e810d66c3111701e3039461 | /Linecomparision.java | 3fbb938f1562c915eb1fdfaab8c0de11e5d6bf58 | [] | no_license | poojakondoju/-Line-Comparision | 332726deaa3d7cd8e1e3b4f680be01d6daf4cdf0 | e8a887254a7aa2ed7cd18875c2522de96c2cb0c2 | refs/heads/master | 2023-07-06T15:43:26.662151 | 2021-08-23T18:25:31 | 2021-08-23T18:25:31 | 399,202,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 636 | java | package linecomparision;
public class Linecomparision {
public static void main(String[] args) {
System.out.println("Welcome To Line Comparision");
int x1,x2,y1,y2;
double dis;
x1=1;y1=1;x2=4;y2=4;
dis=Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
System.out.println("distancebetween"+"("+x1+","+y1+"),"+"("+x2+","+y2+")===>"+dis);
if(x2-x1 == y2-y1)
System.out.println("x2-x1 equals y2-y1");
else
System.out.println("x2-x1 not equals y2-y1");
String str1 = "x2-x1";
String str2 = "y2-y1";
System.out.println(str1.compareTo(str2));
}
} | [
"kondojupoojitha612@gmail.com"
] | kondojupoojitha612@gmail.com |
0594afd1bae79c8a2fc7a140104c05ac23e1f6f4 | 4ef431684e518b07288e8b8bdebbcfbe35f364e4 | /com.ca.apm.webui.test.framework/src/main/java/com/ca/apm/webui/test/framework/base/AbstractTestCase.java | eab6fffbcfc3f649574a362efa24ac94cfef627f | [] | no_license | Sarojkswain/APMAutomation | a37c59aade283b079284cb0a8d3cbbf79f3480e3 | 15659ce9a0030c2e9e5b992040e05311fff713be | refs/heads/master | 2020-03-30T00:43:23.925740 | 2018-09-27T23:42:04 | 2018-09-27T23:42:04 | 150,540,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,367 | java | package com.ca.apm.webui.test.framework.base;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.ca.apm.webui.test.framework.tools.qc.QCUpdater;
import com.ca.apm.webui.test.framework.tools.qc.TestCaseData;
/**
* <code> AbstractTestCase</code> is an abstract class which provides basic
* testcase services such as testcase-specific properties, convenience methods
* for testcase logging,testcase exit-management, and testNG before/after
* methods.
*
* <p>
* TEST CASE MANAGEMENT
* <p>
* The method, <code>defaultTest()</code> must be given an concrete
* implementation in the subclass. The intention of defaultTest() is to act as a
* method template for further test methods in the extending class.
* <code>defaultTest()</code> should not be used as the real test method but
* rather as a code template.
*
* <p>
* AbstractTestCase includes a non-override, final method called myAfterTest()
* which contains the call to the helper method, {@link #processTestCaseExit()},
* which contains the testcase exit management code.
*
* <p>
* ADDITIONAL @TEST METHODS
* <p>
*
* <p>
* Additional test methods should be created within the same testcase subclass.
* Each new test method must include the @Test annotation and should represent a
* stand-alone testcase, having it's own testcase name, id, and author values.
*
* <p>
* SETTING TESTCASE STATUS
* <p>
* Within each method marked by the @Test annotation, prior to exiting the
* method,the test designer must make a call to either
* {@link #setTestCaseStatusToPass()} or {@link #setTestCaseStatusToFail()} in
* order for the test-case exit to be handled appropriately. Unless a call is
* explicitly made to set the status to pass, the testcase will fail (default
* behavior).
*
* @since QATF2.0
* @author whogu01
* @copyright 2013 CA Technology, All rights reserved.
*/
public abstract class AbstractTestCase
extends BaseTestObject
{
/**
* Selenium WebDriver object for <code>this</code>.
*
* @since QATF2.0
*/
private WebDriver fWebDriver;
/**
* Selenium Actions object for <code>this</code>.
*
* @since QATF2.0
*/
private Actions fActions;
/**
* Selenium JavascriptExecutors object for <code>this</code>.
*
* @since QATF2.0
*/
private JavascriptExecutor fJavaScriptExecutor;
/**
* Selenium WebDriverWait object for <code>this</code>.
*
* @since QATF2.0
*/
private WebDriverWait fWait;
// Default status indicates FAIL.
private STATUS status = STATUS.FAIL;
protected AbstractTestCase()
{
loadPropertiesFromFile(BROWSER_FILE);
loadPropertiesFromFile(LAUNCH_FILE);
loadPropertiesFromFile(APPLICATION_FILE);
// setting this.object name/type/version
setProperty("this.object.name", "TestNGTestCase");
setProperty("this.object.type", "TestCase");
setProperty("this.object.version", "1.0");
// setting test-case default values
setProperty("testcase.name", "<not-defined>");
setProperty("testcase.author", "<not-defined>");
setProperty("testcase.id", "<not-defined>");
setProperty("testcase.text.onfail", "<not-defined>");
setProperty("testcase.description", "<not-defined>");
setProperty("log.level", "debug");
// TestLogger.setMaximumLogLevel(DEBUG);
setTestCaseStatusToFail();
}
/*-------------------------------------------
Getters and Setters for Selenium Objects
--------------------------------------------*/
/**
* Get <code>this.fWebDriver</code>.
*
* @return Selenium WebDriver object.
* @since QATF2.0
*/
public final WebDriver getWebDriver()
{
return this.fWebDriver;
}
/**
* Set <code>this.fWebDriver</code> to <code>fWebDriver</code>.
*
* @param wd
* - Selenium WebDriver object.
* @since QATF2.0
*/
public final void setWebDriver(WebDriver wd)
{
this.fWebDriver = wd;
}
/**
* Get <code>this.fActions</code>.
*
* @return Selenium Actions object.
* @since QATF2.0
*/
public final Actions getActions()
{
return this.fActions;
}
/**
* Set <code>this.fActions</code> to <code>act</code>.
*
* @param act
* - Selenium Actions object.
* @since QATF2.0
*/
public final void setActions(Actions act)
{
this.fActions = act;
}
/**
* Get <code>this.fActions</code>.
*
* @return Selenium WebDriverWait object.
* @since QATF2.0
*/
public final WebDriverWait getWait()
{
return this.fWait;
}
/**
* Set <code>this.fWait</code> to <code>wait</code>.
*
* @param wait
* - Selenium WebDriverWait object.
* @since QATF2.0
*/
public final void setWait(WebDriverWait wait)
{
this.fWait = wait;
}
/**
* Get <code>this.fJavaScriptExecutor</code>.
*
* @return Selenium JavascriptExecutor object.
* @since QATF2.0
*/
public final JavascriptExecutor getJavascriptExecutor()
{
return this.fJavaScriptExecutor;
}
/**
* Set <code>this.fJavaScriptExecutor</code> to <code>je</code>.
*
* @param je
* - Selenium JavascriptExecutor object.
* @since QATF2.0
*/
public final void setJavascriptExecutor(JavascriptExecutor je)
{
this.fJavaScriptExecutor = je;
}
// *** GETTERS AND SETTERS ***
protected final String getTestCaseDescription()
{
return this.getProperty("testcase.description");
}
protected final void setTestCaseDescription(String description)
{
this.setProperty("testcase.description", description);
}
// test-caseID (comma separated string of QC ID)
protected final String getTestCaseID()
{
return this.getProperty("testcase.id");
}
protected final void setTestCaseID(String testCaseID)
{
this.setProperty("testcase.id", testCaseID);
}
// test-case name (ex. = "<QC-ID LIST> - <NAME>")
protected final String getTestCaseName()
{
return this.getProperty("testcase.name");
}
protected final void setTestCaseName(String testCaseName)
{
this.setProperty("testcase.name", testCaseName);
}
// test-case author (PMFKEY)
protected final String getAuthorName()
{
return this.getProperty("testcase.author");
}
protected final void setAuthorName(String authorName)
{
this.setProperty("testcase.author", authorName);
}
// text to display on test-case logging when test-case fails and exits
protected final String getTestCaseExitTextOnFail()
{
return this.getProperty("testcase.text.onfail");
}
protected final void setTestCaseExitTextOnFail(String testCaseExitTextOnFail)
{
this.setProperty("testcase.text.onfail", testCaseExitTextOnFail);
}
protected final void setTestCaseStatusToPass()
{
this.status = STATUS.PASS;
}
protected final void setTestCaseStatusToFail()
{
this.status = STATUS.FAIL;
}
// exit-code (used to determine pass/fail for testNG assertion)
protected final STATUS getTestCaseStatus()
{
return this.status;
}
// get TC status as a string compatible with Quality Center Updating
protected final String testCaseStatusToString()
{
if (this.status == STATUS.PASS)
{
return "Passed";
} else
{
return "Failed";
}
}
/**
* Log test-start message to testcase.log and testsuite.log.
*
* @since QATF2.0
* @author whogu01
*/
protected final void logTestCaseStart()
{
String message = "S T A R T T E S T C A S E " + NEW_LINE
+ " Name: \"" + getTestCaseName() + "\"" + NEW_LINE
+ " Class: \"" + getClass().getCanonicalName()
+ "\"" + NEW_LINE + " ID: \"" + getTestCaseID()
+ "\"" + NEW_LINE + " Auth: \"" + getAuthorName()
+ "\"" + NEW_LINE + " Desc: \""
+ getTestCaseDescription() + "\"";
fLog.logBoth(INFO, message);
}
/**
* Log test-end message to testcase.log and testsuite.log.
*
* @since QATF2.0
* @author whogu01
*/
protected final void logTestCaseEnd()
{
String message = "E N D T E S T C A S E ";
fLog.logBoth(INFO, message);
}
/**
* Set the log level for the test method based on property value. Only info,
* trace, and debug are allowed at the test case level.
*
* @since QATF2.0.
*/
protected final void autosetLogLevel()
{
String logLvl = getProperty("log.level").toLowerCase().trim();
if (logLvl.equalsIgnoreCase("info"))
{
TestLogger.setMaximumLogLevel(INFO);
} else if (logLvl.equalsIgnoreCase("trace"))
{
TestLogger.setMaximumLogLevel(TRACE);
} else
{
TestLogger.setMaximumLogLevel(DEBUG);
}
}
/**
* <code>processTestCaseExit</code> asserts that the testcase status is
* equal to PASS. The testcase and testsuite log is updated with with an
* exit-test message.
*
* In the event of a testNG assertion failure, the assertion short-text is
* written to the logs and an assertion error is raised. Finally, the
* testresults.csv is updated with the test-case id and status.
* <p>
*
* By default, upon testcase instantiation, the testcase status is set to
* FAILS. The testcase must be explicitly set to passes before calling
* <code>processTestCaseExit</code> if the intent to to log that the test
* passed.
*
* @see #setTestCaseStatusToPass()
* @see #setTestCaseStatusToFail()
* @see AbstractTestCase
* @since QATF2.0
* @author whogu01
*/
protected final void processTestCaseExit()
{
STATUS status = getTestCaseStatus();
int logLevel = ERROR;
if(status == STATUS.PASS)
{
setObjectType("Passes");
logLevel = INFO;
} else
{
setObjectType("Fails");
}
logTestCaseEnd();
logBoth(logLevel, "tcName=\"" + getTestCaseName() + "\" tcID=\""
+ getTestCaseID() + "\"");
updateStatusToQC();
}
/*
* update test run status to mapped test id in quality center
*/
private void updateStatusToQC()
{
QCUpdater qcc = QCUpdater.getInstance();
qcc.connect();
qcc.uploadResult(new TestCaseData(getTestCaseID(), testCaseStatusToString()));
// release locks
qcc.disconnect();
}
} // end base class | [
"sarojkswain@gmail.com"
] | sarojkswain@gmail.com |
d4b3f32f47cf755d18bfbac73187244f202e8f4a | 52fbda8b78413b1d63e268721c28344f9d2a8a92 | /src/main/java/org/primefaces/omega/controlador/OrganizacionTrabajadorControlador.java | 8c8c7fb4a853e56c05fffe011f3240f675501d34 | [] | no_license | fabricio8923/ntcweb | b94e43f59478ab3158e70a946213fdce315e5a9a | bcd827a5a3f3892558d48c94e7991c906c6a475e | refs/heads/master | 2021-01-22T22:43:55.565285 | 2017-06-01T20:56:57 | 2017-06-01T20:56:57 | 92,786,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,034 | 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.primefaces.omega.controlador;
import org.primefaces.omega.modelo.Dao.*;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import java.util.ArrayList;
import java.util.List;
import org.primefaces.omega.modelo.Dao.Implements.OrganizacionTrabajadorDaoImplements;
import org.primefaces.omega.modelo.OrganizacionTrabajador;
/**
*
* @author fabricio
*/
@ManagedBean(name = "")
@ViewScoped
public class OrganizacionTrabajadorControlador {
private List<OrganizacionTrabajador> organizaciontrabajador = null;
private OrganizacionTrabajador selectedorganizaciontrabajador;
private OrganizacionTrabajadorDao objOrganizacionTrabajadorDao = new OrganizacionTrabajadorDaoImplements();
public OrganizacionTrabajadorControlador() {
}
public List<OrganizacionTrabajador> getOrganizaciontrabajador() {
return organizaciontrabajador = objOrganizacionTrabajadorDao.LoadTablaOrganizacionTrabajadores();
}
public OrganizacionTrabajador getSelectedorganizaciontrabajador() {
return selectedorganizaciontrabajador;
}
public void setSelectedorganizaciontrabajador(OrganizacionTrabajador selectedorganizaciontrabajador) {
this.selectedorganizaciontrabajador = selectedorganizaciontrabajador;
}
public void InsertarOrganizacionTrabajador() {
objOrganizacionTrabajadorDao.InsertarOrganizacionTrabajador(selectedorganizaciontrabajador);
}
public void ActualizarOrganizacionTrabajador() {
objOrganizacionTrabajadorDao.ActualizarOrganizacionTrabajador(selectedorganizaciontrabajador);
}
public void EliminarOrganizacionTrabajador() {
objOrganizacionTrabajadorDao.EliminarOrganizacionTrabajador(selectedorganizaciontrabajador);
}
}
| [
"fabricio_n_g@hotmail.com"
] | fabricio_n_g@hotmail.com |
377be8d04ac90771abfa7aa25fcfd4a043286c63 | 8b09fa20ebccd755930e5a668f54c449b7116067 | /mwidgetgroup/src/main/java/com/zysm/curtain/mwidgetgroup/mrefreshlistview/MListViewHeader.java | 4e3a2f2d687a5ca4db3857d8b747e7a2e5555fb3 | [] | no_license | Shieh1/UIDemo | 83cecb9cc343745b2cc0df5df157e76af914c32a | 09dd3ec9e2bdb9f12a0ff95dc64d91ed22755f84 | refs/heads/master | 2021-01-22T18:02:21.041556 | 2017-03-21T15:06:33 | 2017-03-21T15:06:33 | 85,056,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,336 | java | package com.zysm.curtain.mwidgetgroup.mrefreshlistview;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.zysm.curtain.mwidgetgroup.R;
/**
* Time:2017/3/15 14:26
* Created by Curtain.
*/
public class MListViewHeader extends LinearLayout {
/**顶部View容器*/
private LinearLayout mContainer;
/**头部旋转的箭头图片*/
private ImageView mArrowImageView;
private ProgressBar mProgressBar;
private TextView mHintTextView;
private int mState = STATE_NORMAL;
private Animation mRotateUpAnim;
private Animation mRotateDownAnim;
private final int ROTATE_ANIM_DURATION = 180;
public final static int STATE_NORMAL = 0;
public final static int STATE_READY = 1;
public final static int STATE_REFRESHING = 2;
public MListViewHeader(Context context) {
this(context,null);
}
public MListViewHeader(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
}
private void initView(Context context) {
// 初始情况,设置下拉刷新view高度为0
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, 0);
mContainer = (LinearLayout) LayoutInflater.from(context).inflate(
R.layout.mlistview_header, null);
addView(mContainer, lp);
setGravity(Gravity.BOTTOM);
mArrowImageView = (ImageView)findViewById(R.id.m_listview_header_arrow);
mHintTextView = (TextView)findViewById(R.id.m_listview_header_hint_text_view);
mProgressBar = (ProgressBar)findViewById(R.id.m_listview_header_progressbar);
mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateUpAnim.setFillAfter(true);
mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateDownAnim.setFillAfter(true);
}
public void setState(int state) {
if (state == mState) return ;
if (state == STATE_REFRESHING) { // 显示进度
mArrowImageView.clearAnimation();
mArrowImageView.setVisibility(View.INVISIBLE);
mProgressBar.setVisibility(View.VISIBLE);
} else { // 显示箭头图片
mArrowImageView.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.INVISIBLE);
}
switch(state){
case STATE_NORMAL:
if (mState == STATE_READY) {
mArrowImageView.startAnimation(mRotateDownAnim);
}
if (mState == STATE_REFRESHING) {
mArrowImageView.clearAnimation();
}
mHintTextView.setText(R.string.m_listview_header_hint_normal);
break;
case STATE_READY:
if (mState != STATE_READY) {
mArrowImageView.clearAnimation();
mArrowImageView.startAnimation(mRotateUpAnim);
mHintTextView.setText(R.string.m_listview_header_hint_ready);
}
break;
case STATE_REFRESHING:
mHintTextView.setText(R.string.m_listview_header_hint_loading);
break;
default:
}
mState = state;
}
public void setVisiableHeight(int height) {
if (height < 0)
height = 0;
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContainer
.getLayoutParams();
lp.height = height;
mContainer.setLayoutParams(lp);
}
public int getVisiableHeight() {
return mContainer.getHeight();
}
}
| [
"M Shieh"
] | M Shieh |
86e886a75bee58525a45ec8d6b045f091bdb8ebf | fa40cc0ebf2c8c0d9c3b9bcde3b2ef032215fd95 | /app/src/main/java/org/succlz123/s1go/app/ui/hot/HotRvAdapter.java | 9e220834b1be8c5a6074bb695a99d0bdf97997c4 | [
"Apache-2.0"
] | permissive | vic1y/S1-Go | a7e2183770a05769fae506e58c15854be94c4581 | 29e8e558c85450f3ede6225adda9bc67953c4509 | refs/heads/master | 2020-12-01T03:02:57.076283 | 2016-05-04T06:07:01 | 2016-05-04T06:07:01 | 62,375,686 | 1 | 0 | null | 2016-07-01T08:00:10 | 2016-07-01T08:00:10 | null | UTF-8 | Java | false | false | 3,571 | java | package org.succlz123.s1go.app.ui.hot;
import org.succlz123.s1go.app.api.bean.HotPost;
import org.succlz123.s1go.app.ui.base.BaseThreadListRvViewHolder;
import org.succlz123.s1go.app.ui.thread.ThreadInfoActivity;
import org.succlz123.s1go.app.utils.s1.S1Fid;
import org.succlz123.s1go.app.utils.common.SysUtils;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
/**
* Created by succlz123 on 16/4/12.
*/
public class HotRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private HotPost mHotPost;
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return BaseThreadListRvViewHolder.create(parent);
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, final int position) {
if (mHotPost == null || mHotPost.Variables == null || mHotPost.Variables.data == null) {
return;
}
final HotPost.VariablesEntity.DataEntity hostPost = mHotPost.Variables.data.get(position);
if (viewHolder instanceof BaseThreadListRvViewHolder) {
((BaseThreadListRvViewHolder) viewHolder).title.setText(hostPost.subject);
((BaseThreadListRvViewHolder) viewHolder).lastTime.setText(Html.fromHtml(hostPost.lastpost));
((BaseThreadListRvViewHolder) viewHolder).lastPoster.setText(hostPost.lastposter);
((BaseThreadListRvViewHolder) viewHolder).reply.setText(hostPost.replies);
((BaseThreadListRvViewHolder) viewHolder).views.setText(hostPost.views);
((BaseThreadListRvViewHolder) viewHolder).fid.setText("[" + S1Fid.getS1Fid(hostPost.fid) + "]");
}
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ThreadInfoActivity.newInstance(viewHolder.itemView.getContext(), hostPost.tid,
hostPost.subject, hostPost.replies);
}
});
viewHolder.itemView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
Toast.makeText(v.getContext(), "aaa" + position, Toast.LENGTH_SHORT).show();
return false;
}
});
}
@Override
public int getItemCount() {
if (mHotPost == null || mHotPost.Variables == null || mHotPost.Variables.data == null) {
return 0;
}
return mHotPost.Variables.data.size();
}
public void setData(HotPost hotPost) {
mHotPost = hotPost;
notifyDataSetChanged();
}
public static class ItemDecoration extends RecyclerView.ItemDecoration {
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
super.onDraw(c, parent, state);
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int position = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition();
int margin = SysUtils.dp2px(parent.getContext(), 5);
if (position == 0) {
outRect.set(0, margin, 0, margin);
} else {
outRect.set(0, 0, 0, margin);
}
}
}
}
| [
"succlz123@gmail.com"
] | succlz123@gmail.com |
2d6afb64e726ea9a8e0d31242763568cb82753d2 | 4aed66ad4fb140f5823e748cae8fd71ac402cf67 | /src/main/java/com/xiaoshabao/wechat/dto/AccountValue.java | c8464b94dc78b6ab548acf35ab5f4aef62bae6c6 | [] | no_license | manxx5521/shabao-test | f4236cd0da3f3a5944a28d08f58d090be64329ca | 3cd8b95ed401feb20d759f31618b27bb4669ad7e | refs/heads/master | 2020-04-12T03:57:41.256135 | 2019-01-15T06:37:46 | 2019-01-15T06:37:46 | 60,821,316 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 890 | java | package com.xiaoshabao.wechat.dto;
/**
* 用户帐号关联<br/>
*/
public class AccountValue {
/**
* 所在部门
*/
private String departId;
/**
* 微信帐号在系统对应id
*/
private Integer accountId;
/**
* 微信应用的名字
*/
private String appName;
public AccountValue() {
}
public AccountValue(Integer accountId, String appName) {
this.accountId = accountId;
this.appName = appName;
}
public Integer getAccountId() {
return accountId;
}
public void setAccountId(Integer accountId) {
this.accountId = accountId;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getDepartId() {
return departId;
}
public void setDepartId(String departId) {
this.departId = departId;
}
}
| [
"manxx5521@163.com"
] | manxx5521@163.com |
5951e7c63c9a6df5b328a53505a08be007b53935 | b9648eb0f0475e4a234e5d956925ff9aa8c34552 | /google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/services/SearchGoogleAdsFieldsRequestOrBuilder.java | fba988275bf7d7d346634991adafa73f7ec2296c | [
"Apache-2.0"
] | permissive | wfansh/google-ads-java | ce977abd611d1ee6d6a38b7b3032646d5ffb0b12 | 7dda56bed67a9e47391e199940bb8e1568844875 | refs/heads/main | 2022-05-22T23:45:55.238928 | 2022-03-03T14:23:07 | 2022-03-03T14:23:07 | 460,746,933 | 0 | 0 | Apache-2.0 | 2022-02-18T07:08:46 | 2022-02-18T07:08:45 | null | UTF-8 | Java | false | true | 1,927 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/ads/googleads/v9/services/google_ads_field_service.proto
package com.google.ads.googleads.v9.services;
public interface SearchGoogleAdsFieldsRequestOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.ads.googleads.v9.services.SearchGoogleAdsFieldsRequest)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* Required. The query string.
* </pre>
*
* <code>string query = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The query.
*/
java.lang.String getQuery();
/**
* <pre>
* Required. The query string.
* </pre>
*
* <code>string query = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The bytes for query.
*/
com.google.protobuf.ByteString
getQueryBytes();
/**
* <pre>
* Token of the page to retrieve. If not specified, the first page of
* results will be returned. Use the value obtained from `next_page_token`
* in the previous response in order to request the next page of results.
* </pre>
*
* <code>string page_token = 2;</code>
* @return The pageToken.
*/
java.lang.String getPageToken();
/**
* <pre>
* Token of the page to retrieve. If not specified, the first page of
* results will be returned. Use the value obtained from `next_page_token`
* in the previous response in order to request the next page of results.
* </pre>
*
* <code>string page_token = 2;</code>
* @return The bytes for pageToken.
*/
com.google.protobuf.ByteString
getPageTokenBytes();
/**
* <pre>
* Number of elements to retrieve in a single page.
* When too large a page is requested, the server may decide to further
* limit the number of returned resources.
* </pre>
*
* <code>int32 page_size = 3;</code>
* @return The pageSize.
*/
int getPageSize();
}
| [
"noreply@github.com"
] | noreply@github.com |
38c0e546e2ca53283ac690e19bcb6ee67ebc4845 | 71c1bee42b45c822617ff5a6c8cff35f4bb9d77d | /src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java | 5d395297dc7d4f4ad63e82ea53e6fae99f1985a6 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | redsnower/mybatis-3.4.6 | 309576504aa9721def3f42fb73fe6202afa6ed27 | 9eb91fdc19e1cde7413d6f856bdc9de6dc62bdc4 | refs/heads/master | 2021-10-08T00:07:56.933801 | 2018-12-06T05:45:37 | 2018-12-06T05:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 56,737 | java | /**
* Copyright 2009-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.apache.ibatis.executor.resultset;
import org.apache.ibatis.annotations.AutomapConstructor;
import org.apache.ibatis.binding.MapperMethod.ParamMap;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.cursor.Cursor;
import org.apache.ibatis.cursor.defaults.DefaultCursor;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.ExecutorException;
import org.apache.ibatis.executor.loader.ResultLoader;
import org.apache.ibatis.executor.loader.ResultLoaderMap;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.result.DefaultResultContext;
import org.apache.ibatis.executor.result.DefaultResultHandler;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.Discriminator;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.mapping.ParameterMode;
import org.apache.ibatis.mapping.ResultMap;
import org.apache.ibatis.mapping.ResultMapping;
import org.apache.ibatis.reflection.MetaClass;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.ReflectorFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.session.AutoMappingBehavior;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.TypeHandler;
import org.apache.ibatis.type.TypeHandlerRegistry;
import java.lang.reflect.Constructor;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
/**
* @author Clinton Begin
* @author Eduardo Macarron
* @author Iwao AVE!
* @author Kazuki Shimizu
*/
public class DefaultResultSetHandler implements ResultSetHandler {
private static final Object DEFERED = new Object();
private final Executor executor;
private final Configuration configuration;
private final MappedStatement mappedStatement;
private final RowBounds rowBounds;
private final ParameterHandler parameterHandler;
private final ResultHandler<?> resultHandler; // 用户指定用于处理结果集的ReseultHandler 对象
private final BoundSql boundSql;
private final TypeHandlerRegistry typeHandlerRegistry;
private final ObjectFactory objectFactory;
private final ReflectorFactory reflectorFactory;
// nested resultmaps
private final Map<CacheKey, Object> nestedResultObjects = new HashMap<CacheKey, Object>();
private final Map<String, Object> ancestorObjects = new HashMap<String, Object>();
private Object previousRowValue;
// multiple resultsets
private final Map<String, ResultMapping> nextResultMaps = new HashMap<String, ResultMapping>();
private final Map<CacheKey, List<PendingRelation>> pendingRelations = new HashMap<CacheKey, List<PendingRelation>>();
// Cached Automappings
private final Map<String, List<UnMappedColumnAutoMapping>> autoMappingsCache = new HashMap<String, List<UnMappedColumnAutoMapping>>();
// temporary marking flag that indicate using constructor mapping (use field to reduce memory usage)
private boolean useConstructorMappings;
private final PrimitiveTypes primitiveTypes;
private static class PendingRelation {
public MetaObject metaObject;
public ResultMapping propertyMapping;
}
private static class UnMappedColumnAutoMapping {
private final String column;
private final String property;
private final TypeHandler<?> typeHandler;
private final boolean primitive;
public UnMappedColumnAutoMapping(String column, String property, TypeHandler<?> typeHandler, boolean primitive) {
this.column = column;
this.property = property;
this.typeHandler = typeHandler;
this.primitive = primitive;
}
}
public DefaultResultSetHandler(Executor executor, MappedStatement mappedStatement, ParameterHandler parameterHandler, ResultHandler<?> resultHandler, BoundSql boundSql,
RowBounds rowBounds) {
this.executor = executor;
this.configuration = mappedStatement.getConfiguration();
this.mappedStatement = mappedStatement;
this.rowBounds = rowBounds;
this.parameterHandler = parameterHandler;
this.boundSql = boundSql;
this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
this.objectFactory = configuration.getObjectFactory();
this.reflectorFactory = configuration.getReflectorFactory();
this.resultHandler = resultHandler;
this.primitiveTypes = new PrimitiveTypes();
}
//
// HANDLE OUTPUT PARAMETER
//
@Override
public void handleOutputParameters(CallableStatement cs) throws SQLException {
final Object parameterObject = parameterHandler.getParameterObject();
final MetaObject metaParam = configuration.newMetaObject(parameterObject);
final List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
for (int i = 0; i < parameterMappings.size(); i++) {
final ParameterMapping parameterMapping = parameterMappings.get(i);
if (parameterMapping.getMode() == ParameterMode.OUT || parameterMapping.getMode() == ParameterMode.INOUT) {
if (ResultSet.class.equals(parameterMapping.getJavaType())) {
handleRefCursorOutputParameter((ResultSet) cs.getObject(i + 1), parameterMapping, metaParam);
} else {
final TypeHandler<?> typeHandler = parameterMapping.getTypeHandler();
metaParam.setValue(parameterMapping.getProperty(), typeHandler.getResult(cs, i + 1));
}
}
}
}
private void handleRefCursorOutputParameter(ResultSet rs, ParameterMapping parameterMapping, MetaObject metaParam) throws SQLException {
if (rs == null) {
return;
}
try {
final String resultMapId = parameterMapping.getResultMapId();
final ResultMap resultMap = configuration.getResultMap(resultMapId);
final ResultSetWrapper rsw = new ResultSetWrapper(rs, configuration);
if (this.resultHandler == null) {
final DefaultResultHandler resultHandler = new DefaultResultHandler(objectFactory);
handleRowValues(rsw, resultMap, resultHandler, new RowBounds(), null);
metaParam.setValue(parameterMapping.getProperty(), resultHandler.getResultList());
} else {
handleRowValues(rsw, resultMap, resultHandler, new RowBounds(), null);
}
} finally {
// issue #228 (close resultsets)
closeResultSet(rs);
}
}
//
// HANDLE RESULT SETS
//
@Override
public List<Object> handleResultSets(Statement stmt) throws SQLException {
ErrorContext.instance().activity("handling results").object(mappedStatement.getId());
// 该集合用于保存映射结果集得到的结果对象
final List<Object> multipleResults = new ArrayList<Object>();
int resultSetCount = 0;
// 获取第一个ResultSet 对象,(存储过程可能会返回多个)
ResultSetWrapper rsw = getFirstResultSet(stmt);
/**
* 获取MappedStatement.resultMaps集合,(在mybatis 初始化阶段,映射文件中的<resultMap> 节点会解析成多个
* ResultMap对象,保存到MappedStatement.resultMaps集合中)如果SQL节点能够产生多个ResultSet,可以在SQL 节点的resultMap属性中配置多个
* <resultMap > 节点的id ,它们之间通过”, ”分隔,实现对多个结果集的映射
*/
List<ResultMap> resultMaps = mappedStatement.getResultMaps();
int resultMapCount = resultMaps.size();
validateResultMapsCount(rsw, resultMapCount);
//遍历resultMaps 集合
while (rsw != null && resultMapCount > resultSetCount) {
// 获取该结果集对应的ResultMap对象
ResultMap resultMap = resultMaps.get(resultSetCount);
// 根据ResultMap 中定义的映射规则对ResultSet 进行映射, 并将映射的结果对象添加到multipleResults 集合中保存
handleResultSet(rsw, resultMap, multipleResults, null);
// 获取下一个结果集
rsw = getNextResultSet(stmt);
cleanUpAfterHandlingResultSet();
resultSetCount++;
}
String[] resultSets = mappedStatement.getResultSets();
if (resultSets != null) {
while (rsw != null && resultSetCount < resultSets.length) {
ResultMapping parentMapping = nextResultMaps.get(resultSets[resultSetCount]);
if (parentMapping != null) {
String nestedResultMapId = parentMapping.getNestedResultMapId();
ResultMap resultMap = configuration.getResultMap(nestedResultMapId);
handleResultSet(rsw, resultMap, null, parentMapping);
}
rsw = getNextResultSet(stmt);
cleanUpAfterHandlingResultSet();
resultSetCount++;
}
}
return collapseSingleResultList(multipleResults);
}
@Override
public <E> Cursor<E> handleCursorResultSets(Statement stmt) throws SQLException {
ErrorContext.instance().activity("handling cursor results").object(mappedStatement.getId());
ResultSetWrapper rsw = getFirstResultSet(stmt);
List<ResultMap> resultMaps = mappedStatement.getResultMaps();
int resultMapCount = resultMaps.size();
validateResultMapsCount(rsw, resultMapCount);
if (resultMapCount != 1) {
throw new ExecutorException("Cursor results cannot be mapped to multiple resultMaps");
}
ResultMap resultMap = resultMaps.get(0);
return new DefaultCursor<E>(this, resultMap, rsw, rowBounds);
}
private ResultSetWrapper getFirstResultSet(Statement stmt) throws SQLException {
ResultSet rs = stmt.getResultSet();
while (rs == null) {
// move forward to get the first resultset in case the driver
// doesn't return the resultset as the first result (HSQLDB 2.1)
if (stmt.getMoreResults()) { // 检测是否还有待处理的ResultSet
rs = stmt.getResultSet();
} else {
if (stmt.getUpdateCount() == -1) {
// no more results. Must be no resultset
break;
}
}
}
// 将结果集封装成ResultSetWrapper 对象
return rs != null ? new ResultSetWrapper(rs, configuration) : null;
}
private ResultSetWrapper getNextResultSet(Statement stmt) throws SQLException {
// Making this method tolerant of bad JDBC drivers
try {
if (stmt.getConnection().getMetaData().supportsMultipleResultSets()) {
// Crazy Standard JDBC way of determining if there are more results
if (!(!stmt.getMoreResults() && stmt.getUpdateCount() == -1)) {
ResultSet rs = stmt.getResultSet();
if (rs == null) {
return getNextResultSet(stmt);
} else {
return new ResultSetWrapper(rs, configuration);
}
}
}
} catch (Exception e) {
// Intentionally ignored.
}
return null;
}
private void closeResultSet(ResultSet rs) {
try {
if (rs != null) {
rs.close();
}
} catch (SQLException e) {
// ignore
}
}
private void cleanUpAfterHandlingResultSet() {
nestedResultObjects.clear();
}
private void validateResultMapsCount(ResultSetWrapper rsw, int resultMapCount) {
if (rsw != null && resultMapCount < 1) {
throw new ExecutorException("A query was run and no Result Maps were found for the Mapped Statement '" + mappedStatement.getId()
+ "'. It's likely that neither a Result Type nor a Result Map was specified.");
}
}
private void handleResultSet(ResultSetWrapper rsw, ResultMap resultMap, List<Object> multipleResults, ResultMapping parentMapping) throws SQLException {
try {
if (parentMapping != null) {
// 处理多结果集中的嵌套映射
handleRowValues(rsw, resultMap, null, RowBounds.DEFAULT, parentMapping);
} else {
// 如果未指定处理映射结果对象的ResultHandler对象,用默认的DefaultResultHandler
if (resultHandler == null) {
DefaultResultHandler defaultResultHandler = new DefaultResultHandler(objectFactory);
// 对ResultSet进行映射,并将映射得到的结果对象添加到DefaultResultHandler 对象中暂存
handleRowValues(rsw, resultMap, defaultResultHandler, rowBounds, null);
// 将DefaultResultHandler中保存的结果对象添加到multipleResults集合中
multipleResults.add(defaultResultHandler.getResultList());
} else {
handleRowValues(rsw, resultMap, resultHandler, rowBounds, null);
}
}
} finally {
// issue #228 (close resultsets)
closeResultSet(rsw.getResultSet());
}
}
@SuppressWarnings("unchecked")
private List<Object> collapseSingleResultList(List<Object> multipleResults) {
return multipleResults.size() == 1 ? (List<Object>) multipleResults.get(0) : multipleResults;
}
//
// HANDLE ROWS FOR SIMPLE RESULTMAP
//
public void handleRowValues(ResultSetWrapper rsw, ResultMap resultMap, ResultHandler<?> resultHandler, RowBounds rowBounds, ResultMapping parentMapping) throws SQLException {
// 针对存在嵌套ResultMap的情况
if (resultMap.hasNestedResultMaps()) {
ensureNoRowBounds();
checkResultHandler();
handleRowValuesForNestedResultMap(rsw, resultMap, resultHandler, rowBounds, parentMapping);
} else {
handleRowValuesForSimpleResultMap(rsw, resultMap, resultHandler, rowBounds, parentMapping);
}
}
private void ensureNoRowBounds() {
if (configuration.isSafeRowBoundsEnabled() && rowBounds != null && (rowBounds.getLimit() < RowBounds.NO_ROW_LIMIT || rowBounds.getOffset() > RowBounds.NO_ROW_OFFSET)) {
throw new ExecutorException("Mapped Statements with nested result mappings cannot be safely constrained by RowBounds. "
+ "Use safeRowBoundsEnabled=false setting to bypass this check.");
}
}
protected void checkResultHandler() {
if (resultHandler != null && configuration.isSafeResultHandlerEnabled() && !mappedStatement.isResultOrdered()) {
throw new ExecutorException("Mapped Statements with nested result mappings cannot be safely used with a custom ResultHandler. "
+ "Use safeResultHandlerEnabled=false setting to bypass this check "
+ "or ensure your statement returns ordered data and set resultOrdered=true on it.");
}
}
private void handleRowValuesForSimpleResultMap(ResultSetWrapper rsw, ResultMap resultMap, ResultHandler<?> resultHandler, RowBounds rowBounds, ResultMapping parentMapping)
throws SQLException {
DefaultResultContext<Object> resultContext = new DefaultResultContext<Object>();
// 根据rowBounds 中的 offset 值定位到指定的记录行
skipRows(rsw.getResultSet(), rowBounds);
// 检测已经处理的行数是否已经达到上限(RowBounds.limit)以及ResultSet中是都还有可处理的记录
while (shouldProcessMoreRows(resultContext, rowBounds) && rsw.getResultSet().next()) {
//根据该行记录以及ResultMap.discriminator, 确定映射使用的ResultMap对象
ResultMap discriminatedResultMap = resolveDiscriminatedResultMap(rsw.getResultSet(), resultMap, null);
// 根据确定的ResultMap对resultSet 中的一行记录进行映射,得到映射后的结果对象
Object rowValue = getRowValue(rsw, discriminatedResultMap);
//将映射创建的结果对象添加到ResultHandler.resultList中保存
storeObject(resultHandler, resultContext, rowValue, parentMapping, rsw.getResultSet());
}
}
private void storeObject(ResultHandler<?> resultHandler, DefaultResultContext<Object> resultContext, Object rowValue, ResultMapping parentMapping, ResultSet rs) throws SQLException {
if (parentMapping != null) {
linkToParents(rs, parentMapping, rowValue);
} else {
callResultHandler(resultHandler, resultContext, rowValue);
}
}
@SuppressWarnings("unchecked" /* because ResultHandler<?> is always ResultHandler<Object>*/)
private void callResultHandler(ResultHandler<?> resultHandler, DefaultResultContext<Object> resultContext, Object rowValue) {
resultContext.nextResultObject(rowValue);
((ResultHandler<Object>) resultHandler).handleResult(resultContext);
}
private boolean shouldProcessMoreRows(ResultContext<?> context, RowBounds rowBounds) throws SQLException {
// 一、检测DefaultResultContext.stopped 字段,另一个是检测映射行数是否达到了RowBounds.limit的限制
return !context.isStopped() && context.getResultCount() < rowBounds.getLimit();
}
private void skipRows(ResultSet rs, RowBounds rowBounds) throws SQLException {
// resultSet 类型不是 只能向下移动
if (rs.getType() != ResultSet.TYPE_FORWARD_ONLY) {
if (rowBounds.getOffset() != RowBounds.NO_ROW_OFFSET) {
rs.absolute(rowBounds.getOffset());
}
} else {
for (int i = 0; i < rowBounds.getOffset(); i++) {
rs.next();
}
}
}
//
// GET VALUE FROM ROW FOR SIMPLE RESULT MAP
//
private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap) throws SQLException {
final ResultLoaderMap lazyLoader = new ResultLoaderMap();
// 1 创建该行记录映射之后得到的结果对象,最终调用了ObjectFactory.create()方法,
// 该结果对象的类型由<resultMap>节点的type属性指定
Object rowValue = createResultObject(rsw, resultMap, lazyLoader, null); // 创建映射后的结果对象
if (rowValue != null && !hasTypeHandlerForResultObject(rsw, resultMap.getType())) {
final MetaObject metaObject = configuration.newMetaObject(rowValue);
// 成功映射任意属性,则foundValues 为true,否则 false
boolean foundValues = this.useConstructorMappings;
// 判断是否开启了自动映射功能
if (shouldApplyAutomaticMappings(resultMap, false)) {
//2 自动映射ResultMap中为明确指定的列
foundValues = applyAutomaticMappings(rsw, resultMap, metaObject, null) || foundValues;
}
//3 映射ResultMap中明确指定需要映射的列
foundValues = applyPropertyMappings(rsw, resultMap, metaObject, lazyLoader, null) || foundValues;
foundValues = lazyLoader.size() > 0 || foundValues;
// 4 如果没有成功映射任何属性,则根据mybatis-config.xml中的<returnInstanceForEmptyRow>配置决定返回空的结果对象还是返回null
rowValue = foundValues || configuration.isReturnInstanceForEmptyRow() ? rowValue : null;
}
return rowValue;
}
private boolean shouldApplyAutomaticMappings(ResultMap resultMap, boolean isNested) {
if (resultMap.getAutoMapping() != null) {
return resultMap.getAutoMapping();
} else {
if (isNested) {
return AutoMappingBehavior.FULL == configuration.getAutoMappingBehavior();
} else {
return AutoMappingBehavior.NONE != configuration.getAutoMappingBehavior();
}
}
}
//
// PROPERTY MAPPINGS
//
private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject, ResultLoaderMap lazyLoader, String columnPrefix)
throws SQLException {
final List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
boolean foundValues = false;
final List<ResultMapping> propertyMappings = resultMap.getPropertyResultMappings();
for (ResultMapping propertyMapping : propertyMappings) {
String column = prependPrefix(propertyMapping.getColumn(), columnPrefix);
if (propertyMapping.getNestedResultMapId() != null) {
// the user added a column attribute to a nested result map, ignore it
column = null;
}
if (propertyMapping.isCompositeResult()
|| (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH)))
|| propertyMapping.getResultSet() != null) {
Object value = getPropertyMappingValue(rsw.getResultSet(), metaObject, propertyMapping, lazyLoader, columnPrefix);
// issue #541 make property optional
final String property = propertyMapping.getProperty();
if (property == null) {
continue;
} else if (value == DEFERED) {
foundValues = true;
continue;
}
if (value != null) {
foundValues = true;
}
if (value != null || (configuration.isCallSettersOnNulls() && !metaObject.getSetterType(property).isPrimitive())) {
// gcode issue #377, call setter on nulls (value is not 'found')
metaObject.setValue(property, value);
}
}
}
return foundValues;
}
private Object getPropertyMappingValue(ResultSet rs, MetaObject metaResultObject, ResultMapping propertyMapping, ResultLoaderMap lazyLoader, String columnPrefix)
throws SQLException {
if (propertyMapping.getNestedQueryId() != null) {
return getNestedQueryMappingValue(rs, metaResultObject, propertyMapping, lazyLoader, columnPrefix);
} else if (propertyMapping.getResultSet() != null) {
addPendingChildRelation(rs, metaResultObject, propertyMapping); // TODO is that OK?
return DEFERED;
} else {
final TypeHandler<?> typeHandler = propertyMapping.getTypeHandler();
final String column = prependPrefix(propertyMapping.getColumn(), columnPrefix);
return typeHandler.getResult(rs, column);
}
}
private List<UnMappedColumnAutoMapping> createAutomaticMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject, String columnPrefix) throws SQLException {
final String mapKey = resultMap.getId() + ":" + columnPrefix;
List<UnMappedColumnAutoMapping> autoMapping = autoMappingsCache.get(mapKey);
if (autoMapping == null) {
autoMapping = new ArrayList<UnMappedColumnAutoMapping>();
final List<String> unmappedColumnNames = rsw.getUnmappedColumnNames(resultMap, columnPrefix);
for (String columnName : unmappedColumnNames) {
String propertyName = columnName;
if (columnPrefix != null && !columnPrefix.isEmpty()) {
// When columnPrefix is specified,
// ignore columns without the prefix.
if (columnName.toUpperCase(Locale.ENGLISH).startsWith(columnPrefix)) {
propertyName = columnName.substring(columnPrefix.length());
} else {
continue;
}
}
final String property = metaObject.findProperty(propertyName, configuration.isMapUnderscoreToCamelCase());
if (property != null && metaObject.hasSetter(property)) {
if (resultMap.getMappedProperties().contains(property)) {
continue;
}
final Class<?> propertyType = metaObject.getSetterType(property);
if (typeHandlerRegistry.hasTypeHandler(propertyType, rsw.getJdbcType(columnName))) {
final TypeHandler<?> typeHandler = rsw.getTypeHandler(propertyType, columnName);
autoMapping.add(new UnMappedColumnAutoMapping(columnName, property, typeHandler, propertyType.isPrimitive()));
} else {
configuration.getAutoMappingUnknownColumnBehavior()
.doAction(mappedStatement, columnName, property, propertyType);
}
} else {
configuration.getAutoMappingUnknownColumnBehavior()
.doAction(mappedStatement, columnName, (property != null) ? property : propertyName, null);
}
}
autoMappingsCache.put(mapKey, autoMapping);
}
return autoMapping;
}
private boolean applyAutomaticMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject, String columnPrefix) throws SQLException {
List<UnMappedColumnAutoMapping> autoMapping = createAutomaticMappings(rsw, resultMap, metaObject, columnPrefix);
boolean foundValues = false;
if (!autoMapping.isEmpty()) {
for (UnMappedColumnAutoMapping mapping : autoMapping) {
final Object value = mapping.typeHandler.getResult(rsw.getResultSet(), mapping.column);
if (value != null) {
foundValues = true;
}
if (value != null || (configuration.isCallSettersOnNulls() && !mapping.primitive)) {
// gcode issue #377, call setter on nulls (value is not 'found')
metaObject.setValue(mapping.property, value);
}
}
}
return foundValues;
}
// MULTIPLE RESULT SETS
private void linkToParents(ResultSet rs, ResultMapping parentMapping, Object rowValue) throws SQLException {
CacheKey parentKey = createKeyForMultipleResults(rs, parentMapping, parentMapping.getColumn(), parentMapping.getForeignColumn());
List<PendingRelation> parents = pendingRelations.get(parentKey);
if (parents != null) {
for (PendingRelation parent : parents) {
if (parent != null && rowValue != null) {
linkObjects(parent.metaObject, parent.propertyMapping, rowValue);
}
}
}
}
private void addPendingChildRelation(ResultSet rs, MetaObject metaResultObject, ResultMapping parentMapping) throws SQLException {
CacheKey cacheKey = createKeyForMultipleResults(rs, parentMapping, parentMapping.getColumn(), parentMapping.getColumn());
PendingRelation deferLoad = new PendingRelation();
deferLoad.metaObject = metaResultObject;
deferLoad.propertyMapping = parentMapping;
List<PendingRelation> relations = pendingRelations.get(cacheKey);
// issue #255
if (relations == null) {
relations = new ArrayList<DefaultResultSetHandler.PendingRelation>();
pendingRelations.put(cacheKey, relations);
}
relations.add(deferLoad);
ResultMapping previous = nextResultMaps.get(parentMapping.getResultSet());
if (previous == null) {
nextResultMaps.put(parentMapping.getResultSet(), parentMapping);
} else {
if (!previous.equals(parentMapping)) {
throw new ExecutorException("Two different properties are mapped to the same resultSet");
}
}
}
private CacheKey createKeyForMultipleResults(ResultSet rs, ResultMapping resultMapping, String names, String columns) throws SQLException {
CacheKey cacheKey = new CacheKey();
cacheKey.update(resultMapping);
if (columns != null && names != null) {
String[] columnsArray = columns.split(",");
String[] namesArray = names.split(",");
for (int i = 0; i < columnsArray.length; i++) {
Object value = rs.getString(columnsArray[i]);
if (value != null) {
cacheKey.update(namesArray[i]);
cacheKey.update(value);
}
}
}
return cacheKey;
}
//
// INSTANTIATION & CONSTRUCTOR MAPPING
//
private Object createResultObject(ResultSetWrapper rsw, ResultMap resultMap, ResultLoaderMap lazyLoader, String columnPrefix) throws SQLException {
this.useConstructorMappings = false; // reset previous mapping result
final List<Class<?>> constructorArgTypes = new ArrayList<Class<?>>();
final List<Object> constructorArgs = new ArrayList<Object>();
Object resultObject = createResultObject(rsw, resultMap, constructorArgTypes, constructorArgs, columnPrefix);
if (resultObject != null && !hasTypeHandlerForResultObject(rsw, resultMap.getType())) {
final List<ResultMapping> propertyMappings = resultMap.getPropertyResultMappings();
for (ResultMapping propertyMapping : propertyMappings) {
// issue gcode #109 && issue #149
if (propertyMapping.getNestedQueryId() != null && propertyMapping.isLazy()) {
resultObject = configuration.getProxyFactory().createProxy(resultObject, lazyLoader, configuration, objectFactory, constructorArgTypes, constructorArgs);
break;
}
}
}
this.useConstructorMappings = resultObject != null && !constructorArgTypes.isEmpty(); // set current mapping result
return resultObject;
}
private Object createResultObject(ResultSetWrapper rsw, ResultMap resultMap, List<Class<?>> constructorArgTypes, List<Object> constructorArgs, String columnPrefix)
throws SQLException {
// 获取ResultMap 中记录的type 属性,也就是该行记录最终映射成的结果对象类型
final Class<?> resultType = resultMap.getType();
// 创建该类型对应的MetaClass 对象
final MetaClass metaType = MetaClass.forClass(resultType, reflectorFactory);
// 获取ResultMap 中记录的< constructor> 节点信息,如果该集合不为空,则可以通过该集合确定相应Java 类中的唯一构造函数
final List<ResultMapping> constructorMappings = resultMap.getConstructorResultMappings();
// 创建结采对象分为下面4 种场景
// 场景1 :结果集只有一列,且存在TypeHandler 对象可以将该列转换成resultType 类型的值
if (hasTypeHandlerForResultObject(rsw, resultType)) {
// 先查找相应的TypeHandler 对象,再使用TypeHandler 对象将该记录转换成Java 类型的值
return createPrimitiveResultObject(rsw, resultMap, columnPrefix);
//场景2 ResultMap 中记录了<constructor> 节点的信息, 则通过反射方式调用构造方法,创建结果对象
} else if (!constructorMappings.isEmpty()) {
return createParameterizedResultObject(rsw, resultType, constructorMappings, constructorArgTypes, constructorArgs, columnPrefix);
// 场景3 : 使用默认的无参构造函数,则直接使用ObjectFactory 创建对象
} else if (resultType.isInterface() || metaType.hasDefaultConstructor()) {
return objectFactory.create(resultType);
// 场景4 :通过自动映射的方式查找合适的构造方法并创建结果对象
} else if (shouldApplyAutomaticMappings(resultMap, false)) {
return createByConstructorSignature(rsw, resultType, constructorArgTypes, constructorArgs, columnPrefix);
}
throw new ExecutorException("Do not know how to create an instance of " + resultType);
}
Object createParameterizedResultObject(ResultSetWrapper rsw, Class<?> resultType, List<ResultMapping> constructorMappings,
List<Class<?>> constructorArgTypes, List<Object> constructorArgs, String columnPrefix) {
boolean foundValues = false;
for (ResultMapping constructorMapping : constructorMappings) {
final Class<?> parameterType = constructorMapping.getJavaType();
final String column = constructorMapping.getColumn();
final Object value;
try {
if (constructorMapping.getNestedQueryId() != null) {
value = getNestedQueryConstructorValue(rsw.getResultSet(), constructorMapping, columnPrefix);
} else if (constructorMapping.getNestedResultMapId() != null) {
final ResultMap resultMap = configuration.getResultMap(constructorMapping.getNestedResultMapId());
value = getRowValue(rsw, resultMap);
} else {
final TypeHandler<?> typeHandler = constructorMapping.getTypeHandler();
value = typeHandler.getResult(rsw.getResultSet(), prependPrefix(column, columnPrefix));
}
} catch (ResultMapException e) {
throw new ExecutorException("Could not process result for mapping: " + constructorMapping, e);
} catch (SQLException e) {
throw new ExecutorException("Could not process result for mapping: " + constructorMapping, e);
}
constructorArgTypes.add(parameterType);
constructorArgs.add(value);
foundValues = value != null || foundValues;
}
return foundValues ? objectFactory.create(resultType, constructorArgTypes, constructorArgs) : null;
}
private Object createByConstructorSignature(ResultSetWrapper rsw, Class<?> resultType, List<Class<?>> constructorArgTypes, List<Object> constructorArgs,
String columnPrefix) throws SQLException {
final Constructor<?>[] constructors = resultType.getDeclaredConstructors();
final Constructor<?> annotatedConstructor = findAnnotatedConstructor(constructors);
if (annotatedConstructor != null) {
return createUsingConstructor(rsw, resultType, constructorArgTypes, constructorArgs, columnPrefix, annotatedConstructor);
} else {
for (Constructor<?> constructor : constructors) {
if (allowedConstructor(constructor, rsw.getClassNames())) {
return createUsingConstructor(rsw, resultType, constructorArgTypes, constructorArgs, columnPrefix, constructor);
}
}
}
throw new ExecutorException("No constructor found in " + resultType.getName() + " matching " + rsw.getClassNames());
}
private Object createUsingConstructor(ResultSetWrapper rsw, Class<?> resultType, List<Class<?>> constructorArgTypes, List<Object> constructorArgs, String columnPrefix, Constructor<?> constructor) throws SQLException {
boolean foundValues = false;
for (int i = 0; i < constructor.getParameterTypes().length; i++) {
Class<?> parameterType = constructor.getParameterTypes()[i];
String columnName = rsw.getColumnNames().get(i);
TypeHandler<?> typeHandler = rsw.getTypeHandler(parameterType, columnName);
Object value = typeHandler.getResult(rsw.getResultSet(), prependPrefix(columnName, columnPrefix));
constructorArgTypes.add(parameterType);
constructorArgs.add(value);
foundValues = value != null || foundValues;
}
return foundValues ? objectFactory.create(resultType, constructorArgTypes, constructorArgs) : null;
}
private Constructor<?> findAnnotatedConstructor(final Constructor<?>[] constructors) {
for (final Constructor<?> constructor : constructors) {
if (constructor.isAnnotationPresent(AutomapConstructor.class)) {
return constructor;
}
}
return null;
}
private boolean allowedConstructor(final Constructor<?> constructor, final List<String> classNames) {
final Class<?>[] parameterTypes = constructor.getParameterTypes();
if (typeNames(parameterTypes).equals(classNames)) return true;
if (parameterTypes.length != classNames.size()) return false;
for (int i = 0; i < parameterTypes.length; i++) {
final Class<?> parameterType = parameterTypes[i];
if (parameterType.isPrimitive() && !primitiveTypes.getWrapper(parameterType).getName().equals(classNames.get(i))) {
return false;
} else if (!parameterType.isPrimitive() && !parameterType.getName().equals(classNames.get(i))) {
return false;
}
}
return true;
}
private List<String> typeNames(Class<?>[] parameterTypes) {
List<String> names = new ArrayList<String>();
for (Class<?> type : parameterTypes) {
names.add(type.getName());
}
return names;
}
private Object createPrimitiveResultObject(ResultSetWrapper rsw, ResultMap resultMap, String columnPrefix) throws SQLException {
final Class<?> resultType = resultMap.getType();
final String columnName;
if (!resultMap.getResultMappings().isEmpty()) {
final List<ResultMapping> resultMappingList = resultMap.getResultMappings();
final ResultMapping mapping = resultMappingList.get(0);
columnName = prependPrefix(mapping.getColumn(), columnPrefix);
} else {
columnName = rsw.getColumnNames().get(0);
}
final TypeHandler<?> typeHandler = rsw.getTypeHandler(resultType, columnName);
return typeHandler.getResult(rsw.getResultSet(), columnName);
}
//
// NESTED QUERY
//
private Object getNestedQueryConstructorValue(ResultSet rs, ResultMapping constructorMapping, String columnPrefix) throws SQLException {
final String nestedQueryId = constructorMapping.getNestedQueryId();
final MappedStatement nestedQuery = configuration.getMappedStatement(nestedQueryId);
final Class<?> nestedQueryParameterType = nestedQuery.getParameterMap().getType();
final Object nestedQueryParameterObject = prepareParameterForNestedQuery(rs, constructorMapping, nestedQueryParameterType, columnPrefix);
Object value = null;
if (nestedQueryParameterObject != null) {
final BoundSql nestedBoundSql = nestedQuery.getBoundSql(nestedQueryParameterObject);
final CacheKey key = executor.createCacheKey(nestedQuery, nestedQueryParameterObject, RowBounds.DEFAULT, nestedBoundSql);
final Class<?> targetType = constructorMapping.getJavaType();
final ResultLoader resultLoader = new ResultLoader(configuration, executor, nestedQuery, nestedQueryParameterObject, targetType, key, nestedBoundSql);
value = resultLoader.loadResult();
}
return value;
}
private Object getNestedQueryMappingValue(ResultSet rs, MetaObject metaResultObject, ResultMapping propertyMapping, ResultLoaderMap lazyLoader, String columnPrefix)
throws SQLException {
final String nestedQueryId = propertyMapping.getNestedQueryId();
final String property = propertyMapping.getProperty();
final MappedStatement nestedQuery = configuration.getMappedStatement(nestedQueryId);
final Class<?> nestedQueryParameterType = nestedQuery.getParameterMap().getType();
final Object nestedQueryParameterObject = prepareParameterForNestedQuery(rs, propertyMapping, nestedQueryParameterType, columnPrefix);
Object value = null;
if (nestedQueryParameterObject != null) {
final BoundSql nestedBoundSql = nestedQuery.getBoundSql(nestedQueryParameterObject);
final CacheKey key = executor.createCacheKey(nestedQuery, nestedQueryParameterObject, RowBounds.DEFAULT, nestedBoundSql);
final Class<?> targetType = propertyMapping.getJavaType();
if (executor.isCached(nestedQuery, key)) {
executor.deferLoad(nestedQuery, metaResultObject, property, key, targetType);
value = DEFERED;
} else {
final ResultLoader resultLoader = new ResultLoader(configuration, executor, nestedQuery, nestedQueryParameterObject, targetType, key, nestedBoundSql);
if (propertyMapping.isLazy()) {
lazyLoader.addLoader(property, metaResultObject, resultLoader);
value = DEFERED;
} else {
value = resultLoader.loadResult();
}
}
}
return value;
}
private Object prepareParameterForNestedQuery(ResultSet rs, ResultMapping resultMapping, Class<?> parameterType, String columnPrefix) throws SQLException {
if (resultMapping.isCompositeResult()) {
return prepareCompositeKeyParameter(rs, resultMapping, parameterType, columnPrefix);
} else {
return prepareSimpleKeyParameter(rs, resultMapping, parameterType, columnPrefix);
}
}
private Object prepareSimpleKeyParameter(ResultSet rs, ResultMapping resultMapping, Class<?> parameterType, String columnPrefix) throws SQLException {
final TypeHandler<?> typeHandler;
if (typeHandlerRegistry.hasTypeHandler(parameterType)) {
typeHandler = typeHandlerRegistry.getTypeHandler(parameterType);
} else {
typeHandler = typeHandlerRegistry.getUnknownTypeHandler();
}
return typeHandler.getResult(rs, prependPrefix(resultMapping.getColumn(), columnPrefix));
}
private Object prepareCompositeKeyParameter(ResultSet rs, ResultMapping resultMapping, Class<?> parameterType, String columnPrefix) throws SQLException {
final Object parameterObject = instantiateParameterObject(parameterType);
final MetaObject metaObject = configuration.newMetaObject(parameterObject);
boolean foundValues = false;
for (ResultMapping innerResultMapping : resultMapping.getComposites()) {
final Class<?> propType = metaObject.getSetterType(innerResultMapping.getProperty());
final TypeHandler<?> typeHandler = typeHandlerRegistry.getTypeHandler(propType);
final Object propValue = typeHandler.getResult(rs, prependPrefix(innerResultMapping.getColumn(), columnPrefix));
// issue #353 & #560 do not execute nested query if key is null
if (propValue != null) {
metaObject.setValue(innerResultMapping.getProperty(), propValue);
foundValues = true;
}
}
return foundValues ? parameterObject : null;
}
private Object instantiateParameterObject(Class<?> parameterType) {
if (parameterType == null) {
return new HashMap<Object, Object>();
} else if (ParamMap.class.equals(parameterType)) {
return new HashMap<Object, Object>(); // issue #649
} else {
return objectFactory.create(parameterType);
}
}
//
// DISCRIMINATOR
//
public ResultMap resolveDiscriminatedResultMap(ResultSet rs, ResultMap resultMap, String columnPrefix) throws SQLException {
// 记录已经处理的 ResultMap的id
Set<String> pastDiscriminators = new HashSet<String>();
Discriminator discriminator = resultMap.getDiscriminator();
while (discriminator != null) {
final Object value = getDiscriminatorValue(rs, discriminator, columnPrefix);
final String discriminatedMapId = discriminator.getMapIdFor(String.valueOf(value));
if (configuration.hasResultMap(discriminatedMapId)) {
resultMap = configuration.getResultMap(discriminatedMapId);
Discriminator lastDiscriminator = discriminator;
discriminator = resultMap.getDiscriminator();
if (discriminator == lastDiscriminator || !pastDiscriminators.add(discriminatedMapId)) {
break;
}
} else {
break;
}
}
return resultMap;
}
private Object getDiscriminatorValue(ResultSet rs, Discriminator discriminator, String columnPrefix) throws SQLException {
final ResultMapping resultMapping = discriminator.getResultMapping();
final TypeHandler<?> typeHandler = resultMapping.getTypeHandler();
return typeHandler.getResult(rs, prependPrefix(resultMapping.getColumn(), columnPrefix));
}
private String prependPrefix(String columnName, String prefix) {
if (columnName == null || columnName.length() == 0 || prefix == null || prefix.length() == 0) {
return columnName;
}
return prefix + columnName;
}
//
// HANDLE NESTED RESULT MAPS
//
private void handleRowValuesForNestedResultMap(ResultSetWrapper rsw, ResultMap resultMap, ResultHandler<?> resultHandler, RowBounds rowBounds, ResultMapping parentMapping) throws SQLException {
// -创建默认结果上下文
final DefaultResultContext<Object> resultContext = new DefaultResultContext<Object>();
// 跳过rowBounds指定offset行偏移量
skipRows(rsw.getResultSet(), rowBounds);
Object rowValue = previousRowValue;
//如何定义应该处理:上下文没有主动停止,结果集还有记录,且上下文结果对象数量不足时,
while (shouldProcessMoreRows(resultContext, rowBounds) && rsw.getResultSet().next()) {
// 解决鉴别过的结果映射,逻辑如下:
// 获取结果映射中的鉴别器,通过鉴别指定字段对象获取对应的另一个结果映射,循环往复
// 直到找不到鉴别器为止,返回最终的结果映射
final ResultMap discriminatedResultMap = resolveDiscriminatedResultMap(rsw.getResultSet(), resultMap, null);
// 创建缓存key
final CacheKey rowKey = createRowKey(discriminatedResultMap, rsw, null);
// 缓存中获取结果对象
Object partialObject = nestedResultObjects.get(rowKey);
// issue #577 && #542
if (mappedStatement.isResultOrdered()) {
if (partialObject == null && rowValue != null) {
nestedResultObjects.clear();
storeObject(resultHandler, resultContext, rowValue, parentMapping, rsw.getResultSet());
}
rowValue = getRowValue(rsw, discriminatedResultMap, rowKey, null, partialObject);
} else {
rowValue = getRowValue(rsw, discriminatedResultMap, rowKey, null, partialObject);
if (partialObject == null) {
storeObject(resultHandler, resultContext, rowValue, parentMapping, rsw.getResultSet());
}
}
}
if (rowValue != null && mappedStatement.isResultOrdered() && shouldProcessMoreRows(resultContext, rowBounds)) {
storeObject(resultHandler, resultContext, rowValue, parentMapping, rsw.getResultSet());
previousRowValue = null;
} else if (rowValue != null) {
previousRowValue = rowValue;
}
}
//
// GET VALUE FROM ROW FOR NESTED RESULT MAP
//
private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, CacheKey combinedKey, String columnPrefix, Object partialObject) throws SQLException {
final String resultMapId = resultMap.getId();
Object rowValue = partialObject;
if (rowValue != null) {
final MetaObject metaObject = configuration.newMetaObject(rowValue);
putAncestor(rowValue, resultMapId);
applyNestedResultMappings(rsw, resultMap, metaObject, columnPrefix, combinedKey, false);
ancestorObjects.remove(resultMapId);
} else {
final ResultLoaderMap lazyLoader = new ResultLoaderMap();
rowValue = createResultObject(rsw, resultMap, lazyLoader, columnPrefix);
if (rowValue != null && !hasTypeHandlerForResultObject(rsw, resultMap.getType())) {
final MetaObject metaObject = configuration.newMetaObject(rowValue);
boolean foundValues = this.useConstructorMappings;
if (shouldApplyAutomaticMappings(resultMap, true)) {
foundValues = applyAutomaticMappings(rsw, resultMap, metaObject, columnPrefix) || foundValues;
}
foundValues = applyPropertyMappings(rsw, resultMap, metaObject, lazyLoader, columnPrefix) || foundValues;
putAncestor(rowValue, resultMapId);
foundValues = applyNestedResultMappings(rsw, resultMap, metaObject, columnPrefix, combinedKey, true) || foundValues;
ancestorObjects.remove(resultMapId);
foundValues = lazyLoader.size() > 0 || foundValues;
rowValue = foundValues || configuration.isReturnInstanceForEmptyRow() ? rowValue : null;
}
if (combinedKey != CacheKey.NULL_CACHE_KEY) {
nestedResultObjects.put(combinedKey, rowValue);
}
}
return rowValue;
}
private void putAncestor(Object resultObject, String resultMapId) {
ancestorObjects.put(resultMapId, resultObject);
}
//
// NESTED RESULT MAP (JOIN MAPPING)
//
private boolean applyNestedResultMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject, String parentPrefix, CacheKey parentRowKey, boolean newObject) {
boolean foundValues = false;
for (ResultMapping resultMapping : resultMap.getPropertyResultMappings()) {
final String nestedResultMapId = resultMapping.getNestedResultMapId();
if (nestedResultMapId != null && resultMapping.getResultSet() == null) {
try {
final String columnPrefix = getColumnPrefix(parentPrefix, resultMapping);
final ResultMap nestedResultMap = getNestedResultMap(rsw.getResultSet(), nestedResultMapId, columnPrefix);
if (resultMapping.getColumnPrefix() == null) {
// try to fill circular reference only when columnPrefix
// is not specified for the nested result map (issue #215)
Object ancestorObject = ancestorObjects.get(nestedResultMapId);
if (ancestorObject != null) {
if (newObject) {
linkObjects(metaObject, resultMapping, ancestorObject); // issue #385
}
continue;
}
}
final CacheKey rowKey = createRowKey(nestedResultMap, rsw, columnPrefix);
final CacheKey combinedKey = combineKeys(rowKey, parentRowKey);
Object rowValue = nestedResultObjects.get(combinedKey);
boolean knownValue = rowValue != null;
instantiateCollectionPropertyIfAppropriate(resultMapping, metaObject); // mandatory
if (anyNotNullColumnHasValue(resultMapping, columnPrefix, rsw)) {
rowValue = getRowValue(rsw, nestedResultMap, combinedKey, columnPrefix, rowValue);
if (rowValue != null && !knownValue) {
linkObjects(metaObject, resultMapping, rowValue);
foundValues = true;
}
}
} catch (SQLException e) {
throw new ExecutorException("Error getting nested result map values for '" + resultMapping.getProperty() + "'. Cause: " + e, e);
}
}
}
return foundValues;
}
private String getColumnPrefix(String parentPrefix, ResultMapping resultMapping) {
final StringBuilder columnPrefixBuilder = new StringBuilder();
if (parentPrefix != null) {
columnPrefixBuilder.append(parentPrefix);
}
if (resultMapping.getColumnPrefix() != null) {
columnPrefixBuilder.append(resultMapping.getColumnPrefix());
}
return columnPrefixBuilder.length() == 0 ? null : columnPrefixBuilder.toString().toUpperCase(Locale.ENGLISH);
}
private boolean anyNotNullColumnHasValue(ResultMapping resultMapping, String columnPrefix, ResultSetWrapper rsw) throws SQLException {
Set<String> notNullColumns = resultMapping.getNotNullColumns();
if (notNullColumns != null && !notNullColumns.isEmpty()) {
ResultSet rs = rsw.getResultSet();
for (String column : notNullColumns) {
rs.getObject(prependPrefix(column, columnPrefix));
if (!rs.wasNull()) {
return true;
}
}
return false;
} else if (columnPrefix != null) {
for (String columnName : rsw.getColumnNames()) {
if (columnName.toUpperCase().startsWith(columnPrefix.toUpperCase())) {
return true;
}
}
return false;
}
return true;
}
private ResultMap getNestedResultMap(ResultSet rs, String nestedResultMapId, String columnPrefix) throws SQLException {
ResultMap nestedResultMap = configuration.getResultMap(nestedResultMapId);
return resolveDiscriminatedResultMap(rs, nestedResultMap, columnPrefix);
}
//
// UNIQUE RESULT KEY
//
private CacheKey createRowKey(ResultMap resultMap, ResultSetWrapper rsw, String columnPrefix) throws SQLException {
final CacheKey cacheKey = new CacheKey();
cacheKey.update(resultMap.getId());
List<ResultMapping> resultMappings = getResultMappingsForRowKey(resultMap);
if (resultMappings.isEmpty()) {
if (Map.class.isAssignableFrom(resultMap.getType())) {
createRowKeyForMap(rsw, cacheKey);
} else {
createRowKeyForUnmappedProperties(resultMap, rsw, cacheKey, columnPrefix);
}
} else {
createRowKeyForMappedProperties(resultMap, rsw, cacheKey, resultMappings, columnPrefix);
}
if (cacheKey.getUpdateCount() < 2) {
return CacheKey.NULL_CACHE_KEY;
}
return cacheKey;
}
private CacheKey combineKeys(CacheKey rowKey, CacheKey parentRowKey) {
if (rowKey.getUpdateCount() > 1 && parentRowKey.getUpdateCount() > 1) {
CacheKey combinedKey;
try {
combinedKey = rowKey.clone();
} catch (CloneNotSupportedException e) {
throw new ExecutorException("Error cloning cache key. Cause: " + e, e);
}
combinedKey.update(parentRowKey);
return combinedKey;
}
return CacheKey.NULL_CACHE_KEY;
}
private List<ResultMapping> getResultMappingsForRowKey(ResultMap resultMap) {
List<ResultMapping> resultMappings = resultMap.getIdResultMappings();
if (resultMappings.isEmpty()) {
resultMappings = resultMap.getPropertyResultMappings();
}
return resultMappings;
}
private void createRowKeyForMappedProperties(ResultMap resultMap, ResultSetWrapper rsw, CacheKey cacheKey, List<ResultMapping> resultMappings, String columnPrefix) throws SQLException {
for (ResultMapping resultMapping : resultMappings) {
if (resultMapping.getNestedResultMapId() != null && resultMapping.getResultSet() == null) {
// Issue #392
final ResultMap nestedResultMap = configuration.getResultMap(resultMapping.getNestedResultMapId());
createRowKeyForMappedProperties(nestedResultMap, rsw, cacheKey, nestedResultMap.getConstructorResultMappings(),
prependPrefix(resultMapping.getColumnPrefix(), columnPrefix));
} else if (resultMapping.getNestedQueryId() == null) {
final String column = prependPrefix(resultMapping.getColumn(), columnPrefix);
final TypeHandler<?> th = resultMapping.getTypeHandler();
List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
// Issue #114
if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) {
final Object value = th.getResult(rsw.getResultSet(), column);
if (value != null || configuration.isReturnInstanceForEmptyRow()) {
cacheKey.update(column);
cacheKey.update(value);
}
}
}
}
}
private void createRowKeyForUnmappedProperties(ResultMap resultMap, ResultSetWrapper rsw, CacheKey cacheKey, String columnPrefix) throws SQLException {
final MetaClass metaType = MetaClass.forClass(resultMap.getType(), reflectorFactory);
List<String> unmappedColumnNames = rsw.getUnmappedColumnNames(resultMap, columnPrefix);
for (String column : unmappedColumnNames) {
String property = column;
if (columnPrefix != null && !columnPrefix.isEmpty()) {
// When columnPrefix is specified, ignore columns without the prefix.
if (column.toUpperCase(Locale.ENGLISH).startsWith(columnPrefix)) {
property = column.substring(columnPrefix.length());
} else {
continue;
}
}
if (metaType.findProperty(property, configuration.isMapUnderscoreToCamelCase()) != null) {
String value = rsw.getResultSet().getString(column);
if (value != null) {
cacheKey.update(column);
cacheKey.update(value);
}
}
}
}
private void createRowKeyForMap(ResultSetWrapper rsw, CacheKey cacheKey) throws SQLException {
List<String> columnNames = rsw.getColumnNames();
for (String columnName : columnNames) {
final String value = rsw.getResultSet().getString(columnName);
if (value != null) {
cacheKey.update(columnName);
cacheKey.update(value);
}
}
}
private void linkObjects(MetaObject metaObject, ResultMapping resultMapping, Object rowValue) {
final Object collectionProperty = instantiateCollectionPropertyIfAppropriate(resultMapping, metaObject);
if (collectionProperty != null) {
final MetaObject targetMetaObject = configuration.newMetaObject(collectionProperty);
targetMetaObject.add(rowValue);
} else {
metaObject.setValue(resultMapping.getProperty(), rowValue);
}
}
private Object instantiateCollectionPropertyIfAppropriate(ResultMapping resultMapping, MetaObject metaObject) {
final String propertyName = resultMapping.getProperty();
Object propertyValue = metaObject.getValue(propertyName);
if (propertyValue == null) {
Class<?> type = resultMapping.getJavaType();
if (type == null) {
type = metaObject.getSetterType(propertyName);
}
try {
if (objectFactory.isCollection(type)) {
propertyValue = objectFactory.create(type);
metaObject.setValue(propertyName, propertyValue);
return propertyValue;
}
} catch (Exception e) {
throw new ExecutorException("Error instantiating collection property for result '" + resultMapping.getProperty() + "'. Cause: " + e, e);
}
} else if (objectFactory.isCollection(propertyValue.getClass())) {
return propertyValue;
}
return null;
}
private boolean hasTypeHandlerForResultObject(ResultSetWrapper rsw, Class<?> resultType) {
if (rsw.getColumnNames().size() == 1) {
return typeHandlerRegistry.hasTypeHandler(resultType, rsw.getJdbcType(rsw.getColumnNames().get(0)));
}
return typeHandlerRegistry.hasTypeHandler(resultType);
}
}
| [
"perry@thecover.co"
] | perry@thecover.co |
e40831f10ab98a64c372a3c9f9d35ee38f85a036 | d80a2db1533a0a35485774dca0b6646b8d2f74c9 | /src/main/java/com/vcread/unioncloud/console/entity/enu/TemplateUseStatus.java | b0315f9ea9cd5f910b5b3f602461901699a2ae8d | [] | no_license | Moorong/unioncloud-entity | e8249542e6f2243ac2bb461e3d580d05eedf39f1 | f2ac0ba4654b9619e76a1266f4af91ed0863dfb9 | refs/heads/master | 2021-08-11T08:59:01.905734 | 2017-11-13T13:24:03 | 2017-11-13T13:24:03 | 110,522,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package com.vcread.unioncloud.console.entity.enu;
/**
* 模板使用状态
*
*/
public enum TemplateUseStatus {
/**
* @Fields used : 使用过
*/
used,
/**
* @Fields unused :未使用
*/
unused,
}
| [
"1165204526@qq.com"
] | 1165204526@qq.com |
d33fbe45558f351e27c0d3230d8e837f91ff16c2 | 006bad9354e6bcd658e280927b316630240501c1 | /java-11/src/main/java/com/mgu/java11/HttpClientSample.java | a477953b39207fccce020043ef54bc0f058fbcec | [] | no_license | marc06210/javaFeatures | 6ea3d9ff66caf2ceb6fce0904eb40599b5554d20 | 06edc070c924bb2a91b7eafb4b36f5883e0446f4 | refs/heads/main | 2023-08-24T06:18:44.422189 | 2021-10-29T14:47:30 | 2021-10-29T14:47:30 | 352,975,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,155 | java | package com.mgu.java11;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
// JEP 321
public class HttpClientSample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpClient httpClient = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_1_1)
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest request = HttpRequest.newBuilder()
.GET()
.uri(URI.create("http://www.marcguerrini.fr/wordpress"))
.setHeader("User-Agent", "Java 11 HttpClient Bot")
.build();
HttpResponse<String> response =
httpClient.send(request, HttpResponse.BodyHandlers.ofString());
HttpHeaders headers = response.headers();
headers.map().forEach((k, v) -> System.out.println(k + ":" + v));
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
| [
"maguerrini@airfrance.fr"
] | maguerrini@airfrance.fr |
ee0703b2ab8ed8f573838910869db82b2bc2c948 | 681c518e7618d7bd07fed23bf6967d039587d574 | /src/main/java/f00f/net/irc/martyr/modes/GenericMode.java | e1dad6045640fbaaf71e04319fdc8d1c73dc90d2 | [
"Apache-2.0"
] | permissive | coderextreme/lircom | c868d9086d3642796d84988a07183e8ca077cd4b | c7abe8ed13daf416fb96e14ea46dd89e5321efea | refs/heads/master | 2023-05-03T04:33:44.592544 | 2022-12-22T01:08:48 | 2022-12-22T01:08:48 | 236,363,047 | 0 | 0 | Apache-2.0 | 2023-09-04T05:11:23 | 2020-01-26T19:19:29 | Java | UTF-8 | Java | false | false | 1,573 | java | package f00f.net.irc.martyr.modes;
import f00f.net.irc.martyr.Mode;
/**
* GenericNode uses the character to specify the hash code. Thus, two
* mode types are the same, in a hash table, even if they have
* different parameters or positive/negative values.
*/
public abstract class GenericMode implements Mode
{
private String str;
private Mode.Sign sign = Mode.Sign.NOSIGN;
public void setParam( String str )
{
this.str = str;
}
public String getParam()
{
return str;
}
public void setSign( Mode.Sign sign )
{
this.sign = sign;
}
public Mode.Sign getSign()
{
return sign;
}
public String toString()
{
String pString = " ";
if( sign != Mode.Sign.NOSIGN )
pString += ( sign == Mode.Sign.POSITIVE ? "+" : "-" );
String className = this.getClass().getName();
className = className.substring( className.indexOf('$')+1 );
String result = className + pString + getChar();
if( requiresParam() )
{
result += " " + getParam();
}
return result;
}
public boolean equals( Object o )
{
if( o instanceof Mode )
{
Mode oMode = (Mode)o;
if( oMode.getParam() == null || this.getParam() == null )
return oMode.getChar() == this.getChar();
if( oMode.getParam() == null && this.getParam() != null )
return false;
if( oMode.getParam() == null && this.getParam() == null )
return oMode.getChar() == this.getChar();
return oMode.getChar() == this.getChar() &&
oMode.getParam().equals(this.getParam());
}
return false;
}
public int hashCode()
{
return (int)getChar();
}
}
| [
"john@carlsonsolutiondsign.com"
] | john@carlsonsolutiondsign.com |
22d2649eac8148c10de7f7d068211ccf4d7f269f | 0b9cb731cc7a74dc5951fc2c012210cd988bce17 | /src/main/java/org/sda/driverpool/Application.java | 57bac155d1681a94958b529fb4faf98d5cd36b21 | [] | no_license | aliaksandr-budnikau/driver-pool | 91a96b3c2affc3e9d9d85947276b28fdb1b06cf5 | 92010d35acf31b17900ede59550cb211e914730d | refs/heads/main | 2023-01-24T05:08:15.759510 | 2020-12-10T19:13:43 | 2020-12-10T19:13:43 | 311,795,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package org.sda.driverpool;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
} | [
"alexander.budnikov@algosec.com"
] | alexander.budnikov@algosec.com |
b8aa7df9104b0919e45094dc52afdec18c3921b1 | e8fbdb68c6ae7475073db1e6d024f58788f2bb71 | /src/mate/academy/hw/zoo/animals/Fish.java | 6cbe0a1b53ee8bde3e40b3094bb0e23d21c8bc3d | [] | no_license | Dinexpod/Zoo | 63145884c53a29f2b13b560e8c8e432299ac72c6 | fd6facee43eded5d252443e9a001d26f8f9a8685 | refs/heads/master | 2020-04-27T21:09:19.604427 | 2020-03-05T07:02:22 | 2020-03-05T07:02:22 | 174,686,052 | 1 | 0 | null | 2020-03-05T07:02:24 | 2019-03-09T11:32:52 | Java | UTF-8 | Java | false | false | 275 | java | package mate.academy.hw.zoo.animals;
public abstract class Fish implements Animal {
@Override
public void toEat() {
System.out.println("I'm eating as fish!");
}
@Override
public void move() {
System.out.println("I'm swimming!");
}
}
| [
"dinexpod@gmail.com"
] | dinexpod@gmail.com |
8a081a0a252c53da6db456dc9ac5c02b7c02b371 | 16bacd6ef5d524c9c0fe99f32f2d2403d43b3aec | /instrument-modules/user-modules/module-pradar-core/src/main/java/com/pamirs/pradar/degrade/resources/ResourceDetector.java | e999ff67ba3684fb06166911fc326fe5fd694f04 | [
"Apache-2.0"
] | permissive | shulieTech/LinkAgent | cbcc9717d07ea636e791ebafe84aced9b03730e8 | 73fb7cd6d86fdce5ad08f0623c367b407e405d76 | refs/heads/main | 2023-09-02T11:21:57.784204 | 2023-08-31T07:02:01 | 2023-08-31T07:02:01 | 362,708,051 | 156 | 112 | Apache-2.0 | 2023-09-13T02:24:11 | 2021-04-29T06:05:47 | Java | UTF-8 | Java | false | false | 290 | java | package com.pamirs.pradar.degrade.resources;
/**
* @author jirenhe | jirenhe@shulie.io
* @since 2022/10/18 11:09 AM
*/
public interface ResourceDetector {
boolean hasResource();
String name();
double threshold();
String configName();
void refreshThreshold();
}
| [
"jiangjibo@shulie.io"
] | jiangjibo@shulie.io |
6f795f5de80a16859bc3594c954d18c07f1cca5b | f15765388524132352fec48fb7446eb658ca23bb | /erp-common/src/main/java/com/xxx/erp/common/commonbean/emp/EmpParam.java | 2a59d9e203442a353609a70cbac95789fa023d2b | [] | no_license | xworkingshare/erp-parent | 4a23a7ff029c5d46451e3e187bd4a776093aca4b | b6dd34cc9963219e0f012d8d975eb697cdc18ab4 | refs/heads/master | 2020-04-09T05:12:21.943260 | 2018-12-18T08:47:36 | 2018-12-18T08:47:36 | 160,055,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package com.xxx.erp.common.commonbean.emp;
import com.xxx.erp.bean.emp.Emp;
/**
* @ClassName: EmpParam
* @Description: 继承CommonParamWithPageBean类的,专门封装Emp参数的类型
* @Author: 谢万清
* @CreateTime: 2018/12/8 16:40
* @Version: 1.0
**/
public class EmpParam extends Emp{
private int page;
private int rows;
//查询条件_生日范围的_开始生日日期
private String birthdayQueryStart;
//查询条件_生日范围的结束生日日期
private String birthdayQueryEnd;
//添加/修改框_提交的日期都是String类型,只要经过网络传输过来的都是String类型
private String birthdayString;
public void setBirthdayString(String birthdayString) {
this.birthdayString = birthdayString;
}
public String getBirthdayString() {
return birthdayString;
}
public void setBirthdayQueryStart(String birthdayQueryStart) {
this.birthdayQueryStart = birthdayQueryStart;
}
public String getBirthdayQueryStart() {
return birthdayQueryStart;
}
public void setBirthdayQueryEnd(String birthdayQueryEnd) {
this.birthdayQueryEnd = birthdayQueryEnd;
}
public String getBirthdayQueryEnd() {
return birthdayQueryEnd;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public void setRows(int rows) {
this.rows = rows;
}
public int getRows() {
return rows;
}
}
| [
"643269212@qq.com"
] | 643269212@qq.com |
4e4bb9945e0ed5ca4fbb714aa16950f4909d3085 | cf5d32426d724abb558bbf853cf48cb71c4f39c8 | /src/cn/ssm/mapper/SpcTestMapper.java | 7d94734d17b92fa2e38aa9898048f15b8004addf | [] | no_license | yangyangyou/mes | d2e0eab336c6970abca08c9d019e06ddb2fcfe38 | 882c57271702123564ba192f2ee79701e98e17e2 | refs/heads/master | 2022-11-18T19:33:28.007823 | 2020-07-15T08:59:48 | 2020-07-15T08:59:48 | 255,617,774 | 0 | 0 | null | 2020-04-14T13:32:43 | 2020-04-14T13:32:42 | null | UTF-8 | Java | false | false | 705 | java | package cn.ssm.mapper;
import java.util.List;
import cn.ssm.po.SpcTest;
public interface SpcTestMapper {
int deleteByPrimaryKey(Integer testId);
int insert(SpcTest record);
int insertSelective(SpcTest record);
SpcTest selectByPrimaryKey(Integer testId);
int updateByPrimaryKeySelective(SpcTest record);
int updateByPrimaryKey(SpcTest record);
//查询是否存在该工序和特征值下的25组测量值
List<SpcTest> selectSpcTest(String clientMaterialNo,String materialNo,String batchNo,String process,String characterVal);
//Spc修改记录查询(分页)
List<SpcTest> selectEditSpcrecord(String batchNo,String process,String characterVal);
} | [
"1552863689@qq.com"
] | 1552863689@qq.com |
7d21b8332642a6e225216eda1f261c5a857c6faf | a484bcd11135216d4c347c8c45ff216c5d9f6514 | /src/main/java/com/itrjp/myapp/service/package-info.java | dbd2c264058a7863b66705bf3c0a1d4962906c63 | [] | no_license | lovebugss/myApp | 5b7809843ada6e18cb5f37fbee9b4816637d30f9 | a177f4ceda41ac40cce022cc999015f037f16a44 | refs/heads/master | 2021-06-28T21:54:45.612020 | 2018-12-23T13:17:45 | 2018-12-23T13:17:45 | 162,892,085 | 0 | 1 | null | 2020-09-18T09:47:19 | 2018-12-23T13:14:39 | Java | UTF-8 | Java | false | false | 65 | java | /**
* Service layer beans.
*/
package com.itrjp.myapp.service;
| [
"979668507@qq.com"
] | 979668507@qq.com |
1423d711c5483d546cab72ae6fc290f312dfee1a | a2905328306371f9850ff9f7795c3cd167dd6032 | /src/main/java/com/example/community/mapper/UserMapper.java | 88562397296c985b64e75bf541479885efb1c31c | [] | no_license | csk110/community | 4f05050223a711221166241120ddbc73ba2044f4 | 1fc468eb7b5303cf12b8012ce4f12d5046af7d51 | refs/heads/master | 2022-02-14T19:07:35.215301 | 2019-07-25T09:54:29 | 2019-07-25T09:54:29 | 198,805,554 | 0 | 0 | null | 2022-01-21T23:27:38 | 2019-07-25T09:55:36 | Java | UTF-8 | Java | false | false | 584 | java | package com.example.community.mapper;
import com.example.community.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
/**
* @author ChenSK
* @date 2019-07-25 - 17:21
*/
@Mapper
@Component
public interface UserMapper {
@Select("select * from user where account_id=#{account_id}")
User getUserByAccountId(String account_id);
@Insert("insert into user(account_id) values(#{accountId})")
int addUser(String accountId);
}
| [
"1351187802@qq.com"
] | 1351187802@qq.com |
ba2f7d05a583df33d823d74b5db8fbed3334ba91 | e179feb76e067af8e41b61d9715f804e23477f47 | /demo/src/main/java/com/example/demo/repository/primary/entities/singletable/ProductSingleTableCar.java | 047f28f43b491043fb5f134ed55b1b288538a30c | [] | no_license | lucacirillo2738/complete | 299268a362e2b4247e264aff7e8578949a494778 | fe6bb039a4bf97c6fff2b90ee9f00759ca0a6a83 | refs/heads/master | 2023-08-28T05:25:04.604350 | 2021-10-05T13:27:32 | 2021-10-05T13:27:32 | 371,033,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package com.example.demo.repository.primary.entities.singletable;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
@Entity
@DiscriminatorValue("CAR")
@Data
@NoArgsConstructor
public class ProductSingleTableCar extends ProductSingleTable {
private String color;
private int displacement;
@Column(name="door_num")
private int doorNum;
@Column(name="wheels_num")
private int wheelsNum;
} | [
"luca.cirillo@sisal.it"
] | luca.cirillo@sisal.it |
62a7e9b6db366629317b2fb9b730b498558bd174 | a6ff7a994ecfe54642752d9bc4d780c42eafce59 | /index/src/test/java/com/erayic/agr/index/ExampleUnitTest.java | 5a818dfb1956af6e12af65030d3bb6cc949e9ad3 | [] | no_license | chenxizhe/monster | efdebc446c85f3b73258a669d67957ce512af76b | 43314e29111065b1bf77fa74a864bec7818349ef | refs/heads/master | 2023-05-06T12:48:51.978300 | 2017-07-27T02:05:37 | 2017-07-27T02:05:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.erayic.agr.index;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"hkceey@outlook.com"
] | hkceey@outlook.com |
c35c7a4adf0fda9c1034f2e77dc94a1200a3a1bd | 50876c83faac850b2f85e6b65bb023bc471dc90c | /2017workspace/TXLHT/src/main/java/cn/bishiti/base/test/nio/TestSlice.java | 658545bd2467d77c9f280952944bac2035908354 | [
"Apache-2.0"
] | permissive | chocoai/TXEYXXK | f3e79ed3da2cf4347887afacbca9c83a23339141 | 6b2bc04c52c824aa95bf8e66c2bd9c65dc317b3d | refs/heads/master | 2021-07-17T11:15:04.655721 | 2017-10-10T04:36:55 | 2017-10-10T04:36:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 611 | java | package cn.bishiti.base.test.nio;
import java.nio.ByteBuffer;
public class TestSlice {
public static void main(String[] args) {
// TODO Auto-generated method stub
ByteBuffer buffer=ByteBuffer.allocate(10);
for(int i=0;i<buffer.capacity();i++){
buffer.put((byte)i);
}
buffer.position(3);
buffer.limit(7);
ByteBuffer slice=buffer.slice();
for(int i=0;i<slice.capacity();i++){
byte b=slice.get(i);
b*=10;
slice.put(i,b);
}
buffer.position(0);
buffer.limit(buffer.capacity());
while(buffer.hasRemaining()){
System.out.println(buffer.get());
}
}
}
| [
"850162412@qq.com"
] | 850162412@qq.com |
9626c3b27307562c1548f3289fa2cbb6b468ae8c | 3f1b1a3ef6d1850da3758e7c5831079d19e39d1c | /carcassonne/src/main/java/it/polimi/dei/swknights/carcassonne/Exceptions/SegnaliniFinitiException.java | 69bdc1598efa2e15a69b8af6885e7136ea45b293 | [] | no_license | boris-il-forte/Carcassone | cd8da1f0a47a768841e44f617a66e1f9ba12d8da | c455fe19ef6e7099ccff78870148da6d4c7a0cd8 | refs/heads/master | 2021-01-10T14:19:24.140519 | 2016-03-19T17:13:27 | 2016-03-19T17:13:27 | 54,277,420 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package it.polimi.dei.swknights.carcassonne.Exceptions;
/**
* Exception thrown when the players has no more marker but tries to play another one
* @author dave
*
*/
public class SegnaliniFinitiException extends Exception
{
/**
* Default constructor
*/
public SegnaliniFinitiException()
{
super("Segnalini del giocatore finiti");
}
private static final long serialVersionUID = 4405032866451452294L;
}
| [
"davide.tateo@polimi.it"
] | davide.tateo@polimi.it |
686b0d065a750d74a197cd42fa20166faa5382b6 | fc44b2f87af5a2750920af6aa4cce3f7cebe9494 | /ruubypay-configx-core/src/main/java/com/ruubypay/framework/configx/encrypt/helper/GenerateKeyUtil.java | 757fef296c94edf78e50d1694df5fd9f2730ad08 | [] | no_license | chenhaiyangs/ruubypay-configx-package | 05809114317b57baa478b9d7b6c48ef1b3db0832 | 8eda14512c284ef54b85eb92584863ae366ffcce | refs/heads/master | 2020-03-19T20:10:37.590386 | 2019-01-11T10:32:22 | 2019-01-11T10:32:22 | 136,890,856 | 7 | 4 | null | null | null | null | UTF-8 | Java | false | false | 2,293 | java | package com.ruubypay.framework.configx.encrypt.helper;
import com.ruubypay.framework.configx.encrypt.impl.EncryptByAes;
import com.ruubypay.framework.configx.encrypt.impl.EncryptByDes;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;
/**
* 生成密钥工具类
* @author chenhaiyang
*/
public class GenerateKeyUtil {
/**
* 生成DES加密算法可用的密钥
* @return 返回结果
* @throws NoSuchAlgorithmException 异常
*/
public static String getStringSecturyKeyByDes() throws NoSuchAlgorithmException {
KeyGenerator keyGenerator = KeyGenerator.getInstance("DES");
//指定keysize
keyGenerator.init(56);
SecretKey secretKey = keyGenerator.generateKey();
byte[] bytesKey = secretKey.getEncoded();
return Hex.bytesToHexString(bytesKey);
}
/**
* 生成AES加密算法可用的密钥
* @return 返回结果
* @throws NoSuchAlgorithmException 异常
*/
public static String getStringSecturyKeyByAes() throws NoSuchAlgorithmException {
// 生成KEY
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
keyGenerator.init(128);
SecretKey secretKey = keyGenerator.generateKey();
byte[] keyBytes = secretKey.getEncoded();
return Hex.bytesToHexString(keyBytes);
}
/**
* 根据密钥和原始报文使用DES算法加密一个信息,返回加密结果
* @param src 原文
* @param key key 一个工具类
* @return 返回加密结果
* @throws NoSuchAlgorithmException 异常
*/
public static String getEncryptResultByDes(String src,String key) throws Exception {
EncryptByDes encryptByDes = new EncryptByDes(key);
return encryptByDes.encrypt(src);
}
/**
* 根据密钥和原始报文使用AES算法加密一个信息,返回加密结果
* @param src 原文
* @param key key 一个工具类
* @return 返回加密结果
* @throws NoSuchAlgorithmException 异常
*/
public static String getEncryptResultByAes(String src,String key) throws Exception {
EncryptByAes encryptByDes = new EncryptByAes(key);
return encryptByDes.encrypt(src);
}
}
| [
"chenhaiyang@ruubypay.com"
] | chenhaiyang@ruubypay.com |
efdd024236fc295eaf4e7c60ab88eca91f04ff61 | c8f470a6b69c285a5469b271290778feab83c0a1 | /collectwebhttp/src/main/java/com/collect/current/cyclicBarrier/CyclicBarrierExample.java | 60bacf3ef35fb68ca99014d85d803ecb28a4b766 | [] | no_license | Field-Li/collect | 88c571f736e989b8c37a79b75f4e7adb8704ec6a | 875503da4dae38be9b7e9c193bdd648a1fc5aecc | refs/heads/master | 2022-12-22T15:17:42.103502 | 2021-02-15T04:15:25 | 2021-02-15T04:15:25 | 101,054,577 | 0 | 0 | null | 2022-12-16T11:22:12 | 2017-08-22T11:13:46 | Java | UTF-8 | Java | false | false | 3,124 | java | package com.collect.current.cyclicBarrier;
/**
* Created by lifana on 2017/7/25.
*/
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**栅栏的与闭锁的区别是可重置
* @author
* @date 创建时间:2017年1月25日 上午10:59:11
* @Description:
*/
public class CyclicBarrierExample {
public static void main(String[] args) throws InterruptedException {
//员工数量
int count = 5;
//创建计数器
CyclicBarrier barrier = new CyclicBarrier(count+1);
//创建线程池,可以通过以下方式创建
//ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1,1,60,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>(count));
ExecutorService threadPool = Executors.newFixedThreadPool(count);
Thread.sleep(10);
System.out.println("公司发送通知,每一位员工在周六早上8点【自驾车】到公司大门口集合");
for(int i =0;i<count ;i++){
//将子线程添加进线程池执行
threadPool.execute(new Employee(barrier,i+1));
Thread.sleep(10);
}
try {
//阻塞当前线程,直到所有员工到达公司大门口之后才执行
barrier.await();
Thread.sleep(10);
// 使当前线程在锁存器倒计数至零之前一直等待,除非线程被中断或超出了指定的等待时间。
//latch.await(long timeout, TimeUnit unit)
System.out.println("所有员工已经到达公司大门口,公司领导一并【自驾车】同员工前往活动目的地。");
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}finally{
//最后关闭线程池,但执行以前提交的任务,不接受新任务
threadPool.shutdown();
//关闭线程池,停止所有正在执行的活动任务,暂停处理正在等待的任务,并返回等待执行的任务列表。
//threadPool.shutdownNow();
}
}
}
//分布式工作线程
class Employee implements Runnable{
private CyclicBarrier barrier;
private int employeeIndex;
public Employee(CyclicBarrier barrier,int employeeIndex){
this.barrier = barrier;
this.employeeIndex = employeeIndex;
}
@Override
public void run() {
try {
System.out.println("员工:"+employeeIndex+",正在前往公司大门口集合...");
Thread.sleep(10*employeeIndex);
System.out.println("员工:"+employeeIndex+",已到达。");
barrier.await();
Thread.sleep(10);
System.out.println("员工:"+employeeIndex+",【自驾车】前往目的地");
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
} | [
"lifana@Ctrip.com"
] | lifana@Ctrip.com |
5ff0d83abf8d17676516a8aa974b1dfeb3ccacd6 | 2b2d03a0089bab9c37f639e28f5e6751d4f1361e | /BasicJava/src/src/chapter05/SmartCarMain.java | e47be00538cd2d4111761c81e6a6cefb8f5bc7a1 | [] | no_license | O-Dong-Seon/Basic_JAVA | d84f8df57156e0a1a3e6952f00735468720080ab | 8e7bbe52af65e31a7d8935781c885853b087ee13 | refs/heads/master | 2020-09-18T00:56:31.374324 | 2020-04-06T01:56:45 | 2020-04-06T01:56:45 | 224,125,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package chapter05;
public class SmartCarMain {
public static void main(String[] args) {
SmartCar car = new SmartCar();
// 은닉하고 싶은 변수에 private를 선언하여
// 외부에서 다이렉트로 접근이 불가능하게 막음!
// car.speed = 300;
// 개발을 위해서는 정상적인 방법으로는
// 은니한 변수에 접근이 가능하게 만들어야함
// = Getter() & Setter()
// setter()를 통해 값을 초기화
car.setSpeed(60);
// getter()를 통해 값을 출력
System.out.println(car.getSpeed());
//car.drive();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c6d4186dbbf20842e2aa0f7c04c935615c02b6e6 | 5b704904279969b912fe5521ef424adcad111bfe | /app/src/main/java/com/example/dtcmanager/TabsProfile/All_for_Profile_Fragment.java | 1ec2644bed9c16f322fded5e767ef158d509f9bf | [] | no_license | rizwankarim/dtcManager | e694181d9fed2dd750c73a4f80fdc6e73a198fad | 41c405bfaba065a124669eee88d64e0335ad1b85 | refs/heads/master | 2023-03-07T23:23:16.244835 | 2021-02-23T18:21:58 | 2021-02-23T18:21:58 | 326,393,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,166 | java | package com.example.dtcmanager.TabsProfile;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.dtcmanager.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link All_for_Profile_Fragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class All_for_Profile_Fragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public All_for_Profile_Fragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment All_for_Profile_Fragment.
*/
// TODO: Rename and change types and number of parameters
public static All_for_Profile_Fragment newInstance(String param1, String param2) {
All_for_Profile_Fragment fragment = new All_for_Profile_Fragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_all_for_profile, container, false);
}
} | [
"rizusamnani@gmail.com"
] | rizusamnani@gmail.com |
200a068862252646c3506809f23516034a1c0b60 | d0f0567b924ca3e1839c6d53efa0acddf5ee0be5 | /app/src/main/java/com/ofy/sdgquizapp/activity/InstructionActivity.java | 7d8f5720ddc18d4b74c211504d7c01a8aafe8a1a | [] | no_license | shubhamdixena/RYF-GlobalGoals-Internship | 49a8c870122907e7139a4671b23dcb7a48428aa9 | 674a87f0261544c1302725f94efaf30c9bbc05f3 | refs/heads/main | 2023-03-28T05:51:05.832624 | 2021-03-31T13:50:18 | 2021-03-31T13:50:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,128 | java |
package com.ofy.sdgquizapp.activity;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import com.ofy.sdgquizapp.R;
public class InstructionActivity extends AppCompatActivity {
public Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_instruction);
toolbar = findViewById(R.id.toolBar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(getString(R.string.instruction));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
public void Start(View view) {
finish();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
}
| [
"jaynmistry21@gmail.com"
] | jaynmistry21@gmail.com |
f1acbb46aaffd4b602111da3e5ceee47aad1332e | 287d8ece6c9f81b60b34635bfde56cce61f69b51 | /src/Projectiles/BatBullet.java | ed4190added1e3f1100d411ff76130e2c26c32da | [] | no_license | Nissinen/Fahaldin | e47ccdf0634d049024d9bfc55395728fbaea109a | a669774f67fba1d0f5326cbc3485bb8b72aa3343 | refs/heads/master | 2021-01-17T22:39:26.589237 | 2016-10-30T17:00:18 | 2016-10-30T17:00:18 | 67,543,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,907 | java | package Projectiles;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import Audio.JukeBox;
import TileMap.TileMap;
import Entity.Enemy;
import Handlers.Content;
public class BatBullet extends Enemy {
private boolean remove;
private boolean hit;
private double xRange;
private double yRange;
private BufferedImage[] sprites;
private BufferedImage[] hitSprites;
public BatBullet (TileMap tm, boolean right){
super (tm);
//basic monster values
yRange = this.y;
width = 30;
height = 30;
cwidth = 14;
cheight = 14;
dx = 1;
dy = -0.7;
facingRight = right;
damage = 1;
maxSpeed = 3;
moveSpeed = 2;
sprites = Content.BatBullet[0];
animation.setFrames(sprites);
animation.setDelay(5);
hitSprites = Content.FistExplosion[0];
flinching = true;
}
//Checks where bullet is going
private void getNextPosition() {
if(hit){ dy = 0; }
//makes bullet to do waves
if(!hit){
if(yRange > 0 ){
dy += 0.055;
}
if(yRange < 0 ) {
dy -= 0.055;
}
if(facingRight == true){ dx = moveSpeed; }
else { dx = -moveSpeed; }
}
else
{dx = 0;}
}
// sets hit true and gives animation delay and graphic
public void setHit(){
JukeBox.play("explosion");
if(hit) { return; }
hit = true;
animation.setFrames(hitSprites);
animation.setDelay(3);
}
public boolean removeObject () {
return remove;
}
private void setRange() {
if(xRange > 300){
setHit();
}
xRange += moveSpeed;
yRange -= dy;
}
//updates animation, location and checks collision
public void update() {
setRange();
checkTileMapCollision("blocked");
setPosition(xtemp, ytemp);
if( dx == 0 && !hit ) {
setHit();
}
getNextPosition();
animation.update();
if(hit && animation.hasPlayedOnce()) {
remove = true;
}
}
public void draw(Graphics2D g){
setMapPosition();
super.draw(g);
}
}
| [
"frazento@hotmail.com"
] | frazento@hotmail.com |
80d233bbd3f50f0a0260ca5d50f9c1b7d5ffb2e8 | f1c1e51c8520a3713ef1a718064fc11aaefc4aca | /Tema3/Hibernate/0.ejemplo_caract/1.PrimerProyHib/src/main/java/com/iesvi/hibernate/ejemplos/ProyHbn/User.java | 9f7744891b4156740fe5b9f32fb6c3631e876766 | [] | no_license | jssdocente/AAD | 74a74b33fd36400ff917727705465ccffc0cfa37 | 71bc40d614f77612309d1f9a9f9d39dd58adcae9 | refs/heads/main | 2023-03-02T12:19:01.937164 | 2021-02-08T21:46:02 | 2021-02-08T21:46:02 | 305,641,278 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package com.iesvi.hibernate.ejemplos.ProyHbn;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
//@Table(name="USERS")
public class User {
@Id
private int id;
@Column
private String userName;
@Column
private String userMessage;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserMessage() {
return userMessage;
}
public void setUserMessage(String userMessage) {
this.userMessage = userMessage;
}
}
| [
"jssgarcia.docente@gmail.com"
] | jssgarcia.docente@gmail.com |
95f628fff8aafbac429d02b1dc2da4efc2f80463 | 9f208f03a305284e77b4ae077a32516e99131d6d | /java/workspace/day10/src/cn/wang/web/controller/BuyServlet.java | 943878acf147f5832a26c422cd3c0976162d1123 | [] | no_license | wsws1996/myproject | 5d00c2d1f33f9e08df2c3061ed5c803ae8fa9d35 | bd9c83e769a7b0aa8832a717e3c3a25f0a26e4bc | refs/heads/master | 2021-01-10T01:54:31.518479 | 2017-03-14T14:46:35 | 2017-03-14T14:46:35 | 46,287,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package cn.wang.web.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.wang.domain.Cart;
import cn.wang.service.BusinessService;
public class BuyServlet extends HttpServlet {
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String bookid = request.getParameter("bookid");
Cart cart = (Cart) request.getSession().getAttribute("cart");
if (cart == null) {
cart = new Cart();
request.getSession().setAttribute("cart", cart);
}
BusinessService service =new BusinessService();
service.buybook(bookid,cart);
request.getRequestDispatcher("/WEB-INF/jsp/listcart.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException
* if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
| [
"wang@hn.kd.ny.adsl"
] | wang@hn.kd.ny.adsl |
a4549200d49a64df849d39c6e75d6b3b3b1cf737 | 7315448713862fc471d0d9ec9e6980b6e05a5ea3 | /src/Singleton/A2/Triple.java | fc10c4a12326b018d9c3a1b20b7b19a62c3d2ed6 | [] | no_license | Tebasaki314/DesignPattern | 3229dc4becfacee637967b48fb21f66e2346b928 | fd9766e33bba30325a63d8c15228c674f3fe6265 | refs/heads/master | 2022-11-08T14:06:36.801140 | 2020-06-22T18:27:51 | 2020-06-22T18:27:51 | 260,345,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package Singleton.A2;
import java.util.Map;
public class Triple {
private static final Map<Integer, Triple> instances = Map.ofEntries(
Map.entry(0, new Triple()),
Map.entry(1, new Triple()),
Map.entry(2, new Triple())
);
private Triple() {
}
public static Triple getInstance(int id) {
if (id >= 0 && id < 3) {
System.out.println(id + "番目のインスタンスです。");
return instances.get(id);
} else {
System.out.println("Invalid value of id: " + id + " (id >= 0 && id < 3)");
return null;
}
}
}
| [
"h.takemura480@gmail.com"
] | h.takemura480@gmail.com |
48e2b11032847e9ab7ae8d7f3e429ec4f3460ed9 | 95e944448000c08dd3d6915abb468767c9f29d3c | /sources/android/support/p029v7/widget/C1364au.java | 92705e0396560fb1fa023642f8e6279956c905b3 | [] | no_license | xrealm/tiktok-src | 261b1faaf7b39d64bb7cb4106dc1a35963bd6868 | 90f305b5f981d39cfb313d75ab231326c9fca597 | refs/heads/master | 2022-11-12T06:43:07.401661 | 2020-07-04T20:21:12 | 2020-07-04T20:21:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package android.support.p029v7.widget;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.graphics.drawable.Drawable;
import java.lang.ref.WeakReference;
/* renamed from: android.support.v7.widget.au */
final class C1364au extends C1349ak {
/* renamed from: a */
private final WeakReference<Context> f5346a;
public final Drawable getDrawable(int i) throws NotFoundException {
Drawable drawable = super.getDrawable(i);
Context context = (Context) this.f5346a.get();
if (!(drawable == null || context == null)) {
C1393g.m6901a();
C1393g.m6907a(context, i, drawable);
}
return drawable;
}
public C1364au(Context context, Resources resources) {
super(resources);
this.f5346a = new WeakReference<>(context);
}
}
| [
"65450641+Xyzdesk@users.noreply.github.com"
] | 65450641+Xyzdesk@users.noreply.github.com |
fbf5a0c859d29976731117f4dd33aa8806e830a2 | 969629f482690566216781f9f63d621c9fa9f793 | /vertx-vaadin/src/main/java/com/vaadin/server/communication/ExposeVaadinCommunicationPkg.java | 9966fed7debb7adac81267eabd3889ce5b42b856 | [
"MIT"
] | permissive | davidsowerby/vaadin-vertx-samples | c5d12fc1fbb19ee947683c205b7c4eaea98f6317 | ebf7e0e2f65a00652acd41f0327d21a20ad72a4f | refs/heads/master | 2021-01-25T13:57:35.090079 | 2018-03-03T09:51:19 | 2018-03-03T10:03:04 | 123,626,956 | 0 | 0 | MIT | 2018-03-02T20:23:47 | 2018-03-02T20:23:47 | null | UTF-8 | Java | false | false | 1,972 | java | /*
* The MIT License
* Copyright © 2016-2018 Marco Collovati (mcollovati@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.vaadin.server.communication;
import java.io.IOException;
import java.io.Reader;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinService;
/**
* Created by marco on 18/07/16.
*/
public interface ExposeVaadinCommunicationPkg {
static String getUINotFoundErrorJSON(VaadinService service, VaadinRequest vaadinRequest) {
return UidlRequestHandler.getUINotFoundErrorJSON(service, vaadinRequest);
}
/*
static AtmosphereResource resourceFromPushConnection(UI ui) {
return ((AtmospherePushConnection) ui.getPushConnection()).getResource();
}
*/
static Reader readMessageFromPushConnection(AtmospherePushConnection pushConnection, Reader reader) throws IOException {
return pushConnection.receiveMessage(reader);
}
}
| [
"mcollovati@gmail.com"
] | mcollovati@gmail.com |
176eed131f69dcba51fbd91ad31f883c9867f632 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /java/java-tests/testData/codeInsight/completeStatement/BeforeFor.java | 1b61cf5c2239d06206d2666ee43e9759c34e510f | [
"Apache-2.0"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 89 | java | public class Foo {
{
<caret>for (int i = 0; i < 100; i++) {
}
}
} | [
"yole@jetbrains.com"
] | yole@jetbrains.com |
a6574e9c28cced583b4821cf708e94e7ead7c01c | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/4927/tar_0.java | cd3ecb7f8b47024f15853dd9283aef5041135f14 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 39,589 | java | /*******************************************************************************
* Copyright (c) 2000, 2008 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.internal.compiler.lookup;
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
import org.eclipse.jdt.internal.compiler.util.SimpleSet;
class MethodVerifier15 extends MethodVerifier {
MethodVerifier15(LookupEnvironment environment) {
super(environment);
}
boolean areMethodsCompatible(MethodBinding one, MethodBinding two) {
// use the original methods to test compatibility, but do not check visibility, etc
one = one.original();
two = two.original();
TypeBinding match = one.declaringClass.findSuperTypeOriginatingFrom(two.declaringClass);
if (!(match instanceof ReferenceBinding))
return false; // method's declaringClass does not inherit from inheritedMethod's
if (match != two.declaringClass) {
MethodBinding[] superMethods = ((ReferenceBinding) match).getMethods(two.selector);
for (int i = 0, length = superMethods.length; i < length; i++)
if (superMethods[i].original() == two)
return isParameterSubsignature(one, superMethods[i]);
}
return isParameterSubsignature(one, two);
}
boolean areParametersEqual(MethodBinding one, MethodBinding two) {
TypeBinding[] oneArgs = one.parameters;
TypeBinding[] twoArgs = two.parameters;
if (oneArgs == twoArgs) return true;
int length = oneArgs.length;
if (length != twoArgs.length) return false;
if (one.declaringClass.isInterface()) {
for (int i = 0; i < length; i++)
if (!areTypesEqual(oneArgs[i], twoArgs[i]))
return false;
} else {
// methods with raw parameters are considered equal to inherited methods
// with parameterized parameters for backwards compatibility, need a more complex check
int i;
foundRAW: for (i = 0; i < length; i++) {
if (!areTypesEqual(oneArgs[i], twoArgs[i])) {
if (oneArgs[i].leafComponentType().isRawType()) {
if (oneArgs[i].dimensions() == twoArgs[i].dimensions() && oneArgs[i].leafComponentType().isEquivalentTo(twoArgs[i].leafComponentType())) {
// raw mode does not apply if the method defines its own type variables
if (one.typeVariables != Binding.NO_TYPE_VARIABLES)
return false;
// one parameter type is raw, hence all parameters types must be raw or non generic
// otherwise we have a mismatch check backwards
for (int j = 0; j < i; j++)
if (oneArgs[j].leafComponentType().isParameterizedTypeWithActualArguments())
return false;
// switch to all raw mode
break foundRAW;
}
}
return false;
}
}
// all raw mode for remaining parameters (if any)
for (i++; i < length; i++) {
if (!areTypesEqual(oneArgs[i], twoArgs[i])) {
if (oneArgs[i].leafComponentType().isRawType())
if (oneArgs[i].dimensions() == twoArgs[i].dimensions() && oneArgs[i].leafComponentType().isEquivalentTo(twoArgs[i].leafComponentType()))
continue;
return false;
} else if (oneArgs[i].leafComponentType().isParameterizedTypeWithActualArguments()) {
return false; // no remaining parameter can be a Parameterized type (if one has been converted then all RAW types must be converted)
}
}
}
return true;
}
boolean areReturnTypesCompatible(MethodBinding one, MethodBinding two) {
if (one.returnType == two.returnType) return true;
return areReturnTypesCompatible0(one, two);
}
boolean areTypesEqual(TypeBinding one, TypeBinding two) {
if (one == two) return true;
// need to consider X<?> and X<? extends Object> as the same 'type'
if (one.isParameterizedType() && two.isParameterizedType())
return one.isEquivalentTo(two) && two.isEquivalentTo(one);
// Can skip this since we resolved each method before comparing it, see computeSubstituteMethod()
// if (one instanceof UnresolvedReferenceBinding)
// return ((UnresolvedReferenceBinding) one).resolvedType == two;
// if (two instanceof UnresolvedReferenceBinding)
// return ((UnresolvedReferenceBinding) two).resolvedType == one;
return false; // all other type bindings are identical
}
boolean canSkipInheritedMethods() {
if (this.type.superclass() != null)
if (this.type.superclass().isAbstract() || this.type.superclass().isParameterizedType())
return false;
return this.type.superInterfaces() == Binding.NO_SUPERINTERFACES;
}
boolean canSkipInheritedMethods(MethodBinding one, MethodBinding two) {
return two == null // already know one is not null
|| (one.declaringClass == two.declaringClass && !one.declaringClass.isParameterizedType());
}
void checkConcreteInheritedMethod(MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
super.checkConcreteInheritedMethod(concreteMethod, abstractMethods);
for (int i = 0, l = abstractMethods.length; i < l; i++) {
MethodBinding abstractMethod = abstractMethods[i];
if (concreteMethod.isVarargs() != abstractMethod.isVarargs())
problemReporter().varargsConflict(concreteMethod, abstractMethod, this.type);
// so the parameters are equal and the return type is compatible b/w the currentMethod & the substituted inheritedMethod
MethodBinding originalInherited = abstractMethod.original();
if (originalInherited.returnType != concreteMethod.returnType) {
if (abstractMethod.returnType.leafComponentType().isParameterizedTypeWithActualArguments()) {
if (concreteMethod.returnType.leafComponentType().isRawType())
problemReporter().unsafeReturnTypeOverride(concreteMethod, originalInherited, this.type);
} else if (abstractMethod.hasSubstitutedReturnType() && originalInherited.returnType.leafComponentType().isTypeVariable()) {
if (((TypeVariableBinding) originalInherited.returnType.leafComponentType()).declaringElement == originalInherited) { // see 81618 - type variable from inherited method
TypeBinding currentReturnType = concreteMethod.returnType.leafComponentType();
if (!currentReturnType.isTypeVariable() || ((TypeVariableBinding) currentReturnType).declaringElement != concreteMethod)
problemReporter().unsafeReturnTypeOverride(concreteMethod, originalInherited, this.type);
}
}
}
// check whether bridge method is already defined above for interface methods
if (originalInherited.declaringClass.isInterface()) {
if ((concreteMethod.declaringClass == this.type.superclass && this.type.superclass.isParameterizedType())
|| this.type.superclass.erasure().findSuperTypeOriginatingFrom(originalInherited.declaringClass) == null)
this.type.addSyntheticBridgeMethod(originalInherited, concreteMethod.original());
}
}
}
void checkForBridgeMethod(MethodBinding currentMethod, MethodBinding inheritedMethod, MethodBinding[] allInheritedMethods) {
if (currentMethod.isVarargs() != inheritedMethod.isVarargs())
problemReporter(currentMethod).varargsConflict(currentMethod, inheritedMethod, this.type);
// so the parameters are equal and the return type is compatible b/w the currentMethod & the substituted inheritedMethod
MethodBinding originalInherited = inheritedMethod.original();
if (originalInherited.returnType != currentMethod.returnType) {
// if (currentMethod.returnType.needsUncheckedConversion(inheritedMethod.returnType)) {
// problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, originalInherited, this.type);
if (inheritedMethod.returnType.leafComponentType().isParameterizedTypeWithActualArguments()
&& currentMethod.returnType.leafComponentType().isRawType()) {
problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, originalInherited, this.type);
} else if (inheritedMethod.hasSubstitutedReturnType() && originalInherited.returnType.leafComponentType().isTypeVariable()) {
if (((TypeVariableBinding) originalInherited.returnType.leafComponentType()).declaringElement == originalInherited) { // see 81618 - type variable from inherited method
TypeBinding currentReturnType = currentMethod.returnType.leafComponentType();
if (!currentReturnType.isTypeVariable() || ((TypeVariableBinding) currentReturnType).declaringElement != currentMethod)
problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, originalInherited, this.type);
}
}
}
if (this.type.addSyntheticBridgeMethod(originalInherited, currentMethod.original()) != null) {
for (int i = 0, l = allInheritedMethods == null ? 0 : allInheritedMethods.length; i < l; i++) {
if (allInheritedMethods[i] != null && detectInheritedNameClash(originalInherited, allInheritedMethods[i].original()))
return;
}
}
}
void checkForNameClash(MethodBinding currentMethod, MethodBinding inheritedMethod) {
// sent from checkMethods() to compare a current method and an inherited method that are not 'equal'
// error cases:
// abstract class AA<E extends Comparable> { abstract void test(E element); }
// class A extends AA<Integer> { public void test(Integer i) {} }
// public class B extends A { public void test(Comparable i) {} }
// interface I<E extends Comparable> { void test(E element); }
// class A implements I<Integer> { public void test(Integer i) {} }
// public class B extends A { public void test(Comparable i) {} }
// abstract class Y implements EqualityComparable<Integer>, Equivalent<String> {
// public boolean equalTo(Integer other) { return true; }
// }
// interface Equivalent<T> { boolean equalTo(T other); }
// interface EqualityComparable<T> { boolean equalTo(T other); }
// class Y implements EqualityComparable, Equivalent<String>{
// public boolean equalTo(String other) { return true; }
// public boolean equalTo(Object other) { return true; }
// }
// interface Equivalent<T> { boolean equalTo(T other); }
// interface EqualityComparable { boolean equalTo(Object other); }
// class A<T extends Number> { void m(T t) {} }
// class B<S extends Integer> extends A<S> { void m(S t) {}}
// class D extends B<Integer> { void m(Number t) {} void m(Integer t) {} }
// inheritedMethods does not include I.test since A has a valid implementation
// interface I<E extends Comparable<E>> { void test(E element); }
// class A implements I<Integer> { public void test(Integer i) {} }
// class B extends A { public void test(Comparable i) {} }
if (currentMethod.declaringClass.isInterface() || inheritedMethod.isStatic()) return;
if (!detectNameClash(currentMethod, inheritedMethod)) { // check up the hierarchy for skipped inherited methods
TypeBinding[] currentParams = currentMethod.parameters;
TypeBinding[] inheritedParams = inheritedMethod.parameters;
int length = currentParams.length;
if (length != inheritedParams.length) return; // no match
for (int i = 0; i < length; i++)
if (currentParams[i] != inheritedParams[i])
if (currentParams[i].isBaseType() != inheritedParams[i].isBaseType() || !inheritedParams[i].isCompatibleWith(currentParams[i]))
return; // no chance that another inherited method's bridge method can collide
ReferenceBinding[] interfacesToVisit = null;
int nextPosition = 0;
ReferenceBinding superType = inheritedMethod.declaringClass;
ReferenceBinding[] itsInterfaces = superType.superInterfaces();
if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
nextPosition = itsInterfaces.length;
interfacesToVisit = itsInterfaces;
}
superType = superType.superclass(); // now start with its superclass
while (superType != null && superType.isValidBinding()) {
MethodBinding[] methods = superType.getMethods(currentMethod.selector);
for (int m = 0, n = methods.length; m < n; m++) {
MethodBinding substitute = computeSubstituteMethod(methods[m], currentMethod);
if (substitute != null && !isSubstituteParameterSubsignature(currentMethod, substitute) && detectNameClash(currentMethod, substitute))
return;
}
if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
if (interfacesToVisit == null) {
interfacesToVisit = itsInterfaces;
nextPosition = interfacesToVisit.length;
} else {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (next == interfacesToVisit[b]) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
superType = superType.superclass();
}
for (int i = 0; i < nextPosition; i++) {
superType = interfacesToVisit[i];
if (superType.isValidBinding()) {
MethodBinding[] methods = superType.getMethods(currentMethod.selector);
for (int m = 0, n = methods.length; m < n; m++){
MethodBinding substitute = computeSubstituteMethod(methods[m], currentMethod);
if (substitute != null && !isSubstituteParameterSubsignature(currentMethod, substitute) && detectNameClash(currentMethod, substitute))
return;
}
if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (next == interfacesToVisit[b]) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
}
}
}
void checkInheritedMethods(MethodBinding inheritedMethod, MethodBinding otherInheritedMethod) {
// sent from checkMethods() to compare 2 inherited methods that are not 'equal'
if (inheritedMethod.declaringClass.erasure() == otherInheritedMethod.declaringClass.erasure()) {
boolean areDuplicates = inheritedMethod.hasSubstitutedParameters() && otherInheritedMethod.hasSubstitutedParameters()
? inheritedMethod.areParametersEqual(otherInheritedMethod)
: inheritedMethod.areParameterErasuresEqual(otherInheritedMethod);
if (areDuplicates) {
problemReporter().duplicateInheritedMethods(this.type, inheritedMethod, otherInheritedMethod);
return;
}
}
// the 2 inherited methods clash because of a parameterized type overrides a raw type
// interface I { void foo(A a); }
// class Y { void foo(A<String> a) {} }
// abstract class X extends Y implements I { }
// class A<T> {}
// in this case the 2 inherited methods clash because of type variables
// interface I { <T, S> void foo(T t); }
// class Y { <T> void foo(T t) {} }
// abstract class X extends Y implements I {}
if (inheritedMethod.declaringClass.isInterface() || inheritedMethod.isStatic()) return;
detectInheritedNameClash(inheritedMethod.original(), otherInheritedMethod.original());
}
void checkInheritedMethods(MethodBinding[] methods, int length) {
int count = length;
int[] skip = new int[count];
nextMethod : for (int i = 0, l = length - 1; i < l; i++) {
if (skip[i] == -1) continue nextMethod;
MethodBinding method = methods[i];
MethodBinding[] duplicates = null;
for (int j = i + 1; j <= l; j++) {
MethodBinding method2 = methods[j];
if (method.declaringClass == method2.declaringClass && areMethodsCompatible(method, method2)) {
skip[j] = -1;
if (duplicates == null)
duplicates = new MethodBinding[length];
duplicates[j] = method2;
}
}
if (duplicates != null) {
// found an inherited ParameterizedType that defines duplicate methods
// if all methods are abstract or more than 1 concrete method exists, then consider them to be duplicates
// if a single concrete method 'implements' the abstract methods, then do not report a duplicate error
int concreteCount = method.isAbstract() ? 0 : 1;
MethodBinding methodToKeep = method; // if a concrete method exists, keep it, otherwise keep the first method
for (int m = 0, s = duplicates.length; m < s; m++) {
if (duplicates[m] != null) {
if (!duplicates[m].isAbstract()) {
methodToKeep = duplicates[m];
concreteCount++;
}
}
}
if (concreteCount != 1) {
for (int m = 0, s = duplicates.length; m < s; m++) {
if (duplicates[m] != null) {
problemReporter().duplicateInheritedMethods(this.type, method, duplicates[m]);
count--;
if (methodToKeep == duplicates[m])
methods[i] = null;
else
methods[m] = null;
}
}
}
}
}
if (count < length) {
if (count == 1) return; // no need to continue since only 1 inherited method is left
MethodBinding[] newMethods = new MethodBinding[count];
for (int i = length; --i >= 0;)
if (methods[i] != null)
newMethods[--count] = methods[i];
methods = newMethods;
length = newMethods.length;
}
super.checkInheritedMethods(methods, length);
}
boolean checkInheritedReturnTypes(MethodBinding[] methods, int length) {
// assumes length > 1
// its possible in 1.5 that A is compatible with B & C, but B is not compatible with C
int[] areIncompatible = null;
// abstract classes must check every method against each other
// but if first method is concrete, then only check it against the rest
for (int i = 0, l = methods[0].isAbstract() ? length - 2 : 0; i <= l;) {
MethodBinding method = methods[i++];
nextMethod : for (int j = i; j < length; j++) {
if (!areReturnTypesCompatible(method, methods[j])) {
if (this.type.isInterface()) {
for (int m = length; --m >= 0;)
if (methods[m].declaringClass.id == TypeIds.T_JavaLangObject)
continue nextMethod; // do not complain since the super interface already got blamed
} else {
if (method.isAbstract() && method.declaringClass.isClass())
if (areReturnTypesCompatible(methods[j], method))
continue nextMethod; // return type of the superclass' inherited method is a supertype of the return type of the interface's method
if (method.declaringClass.isClass() || !this.type.implementsInterface(method.declaringClass, false))
if (methods[j].declaringClass.isClass() || !this.type.implementsInterface(methods[j].declaringClass, false))
continue nextMethod; // do not complain since the superclass already got blamed
}
// check to see if this is just a warning, if so report it & skip to next method
if (isUnsafeReturnTypeOverride(method, methods[j])) {
problemReporter(method).unsafeReturnTypeOverride(method, methods[j], this.type);
continue nextMethod;
}
if (areIncompatible == null)
areIncompatible = new int[length];
areIncompatible[i - 1] = -1;
areIncompatible[j] = -1;
}
}
}
if (areIncompatible == null)
return true;
int count = 0;
for (int i = 0; i < length; i++)
if (areIncompatible[i] == -1) count++;
if (count == length) {
problemReporter().inheritedMethodsHaveIncompatibleReturnTypes(this.type, methods, length);
return false;
}
MethodBinding[] methodsToReport = new MethodBinding[count];
for (int i = 0, index = 0; i < length; i++)
if (areIncompatible[i] == -1)
methodsToReport[index++] = methods[i];
problemReporter().inheritedMethodsHaveIncompatibleReturnTypes(this.type, methodsToReport, count);
return false;
}
void checkMethods() {
boolean mustImplementAbstractMethods = mustImplementAbstractMethods();
boolean skipInheritedMethods = mustImplementAbstractMethods && canSkipInheritedMethods(); // have a single concrete superclass so only check overridden methods
char[][] methodSelectors = this.inheritedMethods.keyTable;
nextSelector : for (int s = methodSelectors.length; --s >= 0;) {
if (methodSelectors[s] == null) continue nextSelector;
MethodBinding[] current = (MethodBinding[]) this.currentMethods.get(methodSelectors[s]);
if (current == null && skipInheritedMethods)
continue nextSelector;
MethodBinding[] inherited = (MethodBinding[]) this.inheritedMethods.valueTable[s];
if (inherited.length == 1 && current == null) { // handle the common case
if (mustImplementAbstractMethods && inherited[0].isAbstract())
checkAbstractMethod(inherited[0]);
continue nextSelector;
}
int index = -1;
int inheritedLength = inherited.length;
MethodBinding[] matchingInherited = new MethodBinding[inherited.length];
MethodBinding[] foundMatch = new MethodBinding[inherited.length]; // null is no match, otherwise value is matching currentMethod
if (current != null) {
for (int i = 0, length1 = current.length; i < length1; i++) {
MethodBinding currentMethod = current[i];
MethodBinding[] nonMatchingInherited = null;
for (int j = 0; j < inheritedLength; j++) {
MethodBinding inheritedMethod = computeSubstituteMethod(inherited[j], currentMethod);
if (inheritedMethod != null) {
if (foundMatch[j] == null && isSubstituteParameterSubsignature(currentMethod, inheritedMethod)) {
matchingInherited[++index] = inheritedMethod;
foundMatch[j] = currentMethod;
} else {
// best place to check each currentMethod against each non-matching inheritedMethod
checkForNameClash(currentMethod, inheritedMethod);
if (inheritedLength > 1) {
if (nonMatchingInherited == null)
nonMatchingInherited = new MethodBinding[inheritedLength];
nonMatchingInherited[j] = inheritedMethod;
}
}
}
}
if (index >= 0) {
// see addtional comments in https://bugs.eclipse.org/bugs/show_bug.cgi?id=122881
// if (index > 0 && currentMethod.declaringClass.isInterface()) // only check when inherited methods are from interfaces
// checkInheritedReturnTypes(matchingInherited, index + 1);
checkAgainstInheritedMethods(currentMethod, matchingInherited, index + 1, nonMatchingInherited); // pass in the length of matching
while (index >= 0) matchingInherited[index--] = null; // clear the contents of the matching methods
}
}
}
// skip tracks which inherited methods have matched other inherited methods
// either because they match the same currentMethod or match each other
boolean[] skip = new boolean[inheritedLength];
for (int i = 0; i < inheritedLength; i++) {
if (skip[i]) continue;
MethodBinding inheritedMethod = inherited[i];
MethodBinding matchMethod = foundMatch[i];
if (matchMethod == null)
matchingInherited[++index] = inheritedMethod;
for (int j = i + 1; j < inheritedLength; j++) {
MethodBinding otherInheritedMethod = inherited[j];
if (matchMethod == foundMatch[j] && matchMethod != null)
continue; // both inherited methods matched the same currentMethod
if (canSkipInheritedMethods(inheritedMethod, otherInheritedMethod))
continue;
otherInheritedMethod = computeSubstituteMethod(otherInheritedMethod, inheritedMethod);
if (otherInheritedMethod != null) {
if (inheritedMethod.declaringClass != otherInheritedMethod.declaringClass
&& isSubstituteParameterSubsignature(inheritedMethod, otherInheritedMethod)) {
if (index == -1)
matchingInherited[++index] = inheritedMethod;
matchingInherited[++index] = otherInheritedMethod;
skip[j] = true;
} else if (matchMethod == null && foundMatch[j] == null) {
checkInheritedMethods(inheritedMethod, otherInheritedMethod);
}
}
}
if (index == -1) continue;
if (index > 0)
checkInheritedMethods(matchingInherited, index + 1); // pass in the length of matching
else if (mustImplementAbstractMethods && matchingInherited[0].isAbstract())
checkAbstractMethod(matchingInherited[0]);
while (index >= 0) matchingInherited[index--] = null; // clear the previous contents of the matching methods
}
}
}
void checkTypeVariableMethods(TypeParameter typeParameter) {
char[][] methodSelectors = this.inheritedMethods.keyTable;
nextSelector : for (int s = methodSelectors.length; --s >= 0;) {
if (methodSelectors[s] == null) continue nextSelector;
MethodBinding[] inherited = (MethodBinding[]) this.inheritedMethods.valueTable[s];
if (inherited.length == 1) continue nextSelector;
int index = -1;
MethodBinding[] matchingInherited = new MethodBinding[inherited.length];
for (int i = 0, length = inherited.length; i < length; i++) {
while (index >= 0) matchingInherited[index--] = null; // clear the previous contents of the matching methods
MethodBinding inheritedMethod = inherited[i];
if (inheritedMethod != null) {
matchingInherited[++index] = inheritedMethod;
for (int j = i + 1; j < length; j++) {
MethodBinding otherInheritedMethod = inherited[j];
if (canSkipInheritedMethods(inheritedMethod, otherInheritedMethod))
continue;
otherInheritedMethod = computeSubstituteMethod(otherInheritedMethod, inheritedMethod);
if (otherInheritedMethod != null && isSubstituteParameterSubsignature(inheritedMethod, otherInheritedMethod)) {
matchingInherited[++index] = otherInheritedMethod;
inherited[j] = null; // do not want to find it again
}
}
}
if (index > 0) {
MethodBinding first = matchingInherited[0];
int count = index + 1;
while (--count > 0 && areReturnTypesCompatible(first, matchingInherited[count])){/*empty*/}
if (count > 0) { // All inherited methods do NOT have the same vmSignature
problemReporter().inheritedMethodsHaveIncompatibleReturnTypes(typeParameter, matchingInherited, index + 1);
continue nextSelector;
}
}
}
}
}
MethodBinding computeSubstituteMethod(MethodBinding inheritedMethod, MethodBinding currentMethod) {
if (inheritedMethod == null) return null;
if (currentMethod.parameters.length != inheritedMethod.parameters.length) return null; // no match
// due to hierarchy & compatibility checks, we need to ensure these 2 methods are resolved
if (currentMethod.declaringClass instanceof BinaryTypeBinding)
((BinaryTypeBinding) currentMethod.declaringClass).resolveTypesFor(currentMethod);
if (inheritedMethod.declaringClass instanceof BinaryTypeBinding)
((BinaryTypeBinding) inheritedMethod.declaringClass).resolveTypesFor(inheritedMethod);
TypeVariableBinding[] inheritedTypeVariables = inheritedMethod.typeVariables;
if (inheritedTypeVariables == Binding.NO_TYPE_VARIABLES) return inheritedMethod;
int inheritedLength = inheritedTypeVariables.length;
TypeVariableBinding[] typeVariables = currentMethod.typeVariables;
int length = typeVariables.length;
if (length > 0 && inheritedLength != length) return inheritedMethod; // no match JLS 8.4.2
TypeBinding[] arguments = new TypeBinding[inheritedLength];
if (inheritedLength <= length) {
System.arraycopy(typeVariables, 0, arguments, 0, inheritedLength);
} else {
System.arraycopy(typeVariables, 0, arguments, 0, length);
for (int i = length; i < inheritedLength; i++)
arguments[i] = inheritedTypeVariables[i].upperBound();
}
ParameterizedGenericMethodBinding substitute =
this.environment.createParameterizedGenericMethod(inheritedMethod, arguments);
// interface I { <T> void foo(T t); }
// class X implements I { public <T extends I> void foo(T t) {} }
// for the above case, we do not want to answer the substitute method since its not a match
for (int i = 0; i < inheritedLength; i++) {
TypeVariableBinding inheritedTypeVariable = inheritedTypeVariables[i];
TypeBinding argument = arguments[i];
if (argument instanceof TypeVariableBinding) {
TypeVariableBinding typeVariable = (TypeVariableBinding) argument;
if (typeVariable.firstBound == inheritedTypeVariable.firstBound) {
if (typeVariable.firstBound == null)
continue; // both are null
} else if (typeVariable.firstBound != null && inheritedTypeVariable.firstBound != null) {
if (typeVariable.firstBound.isClass() != inheritedTypeVariable.firstBound.isClass())
return inheritedMethod; // not a match
}
if (Scope.substitute(substitute, inheritedTypeVariable.superclass) != typeVariable.superclass)
return inheritedMethod; // not a match
int interfaceLength = inheritedTypeVariable.superInterfaces.length;
ReferenceBinding[] interfaces = typeVariable.superInterfaces;
if (interfaceLength != interfaces.length)
return inheritedMethod; // not a match
// TODO (kent) another place where we expect the superinterfaces to be in the exact same order
next : for (int j = 0; j < interfaceLength; j++) {
TypeBinding superType = Scope.substitute(substitute, inheritedTypeVariable.superInterfaces[j]);
for (int k = 0; k < interfaceLength; k++)
if (superType == interfaces[k])
continue next;
return inheritedMethod; // not a match
}
} else if (inheritedTypeVariable.boundCheck(substitute, argument) != TypeConstants.OK) {
return inheritedMethod;
}
}
return substitute;
}
boolean detectInheritedNameClash(MethodBinding inherited, MethodBinding otherInherited) {
if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure())
return false;
// skip it if otherInherited is defined by a subtype of inherited's declaringClass
if (inherited.declaringClass.erasure() != otherInherited.declaringClass.erasure())
if (inherited.declaringClass.findSuperTypeOriginatingFrom(otherInherited.declaringClass) != null)
return false;
problemReporter().inheritedMethodsHaveNameClash(this.type, inherited, otherInherited);
return true;
}
boolean detectNameClash(MethodBinding current, MethodBinding inherited) {
MethodBinding original = inherited.original(); // can be the same as inherited
if (!current.areParameterErasuresEqual(original) || current.returnType.erasure() != original.returnType.erasure())
return false;
problemReporter(current).methodNameClash(current, inherited.declaringClass.isRawType() ? inherited : original);
return true;
}
public boolean doesMethodOverride(MethodBinding method, MethodBinding inheritedMethod) {
return couldMethodOverride(method, inheritedMethod) && areMethodsCompatible(method, inheritedMethod);
}
boolean hasGenericParameter(MethodBinding method) {
if (method.genericSignature() == null) return false;
// may be only the return type that is generic, need to check parameters
TypeBinding[] params = method.parameters;
for (int i = 0, l = params.length; i < l; i++) {
TypeBinding param = params[i].leafComponentType();
if (param instanceof ReferenceBinding) {
int modifiers = ((ReferenceBinding) param).modifiers;
if ((modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
return true;
}
}
return false;
}
boolean doTypeVariablesClash(MethodBinding one, MethodBinding substituteTwo) {
// one has type variables and substituteTwo did not pass bounds check in computeSubstituteMethod()
return one.typeVariables != Binding.NO_TYPE_VARIABLES && !(substituteTwo instanceof ParameterizedGenericMethodBinding);
}
SimpleSet findSuperinterfaceCollisions(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) {
ReferenceBinding[] interfacesToVisit = null;
int nextPosition = 0;
ReferenceBinding[] itsInterfaces = superInterfaces;
if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
nextPosition = itsInterfaces.length;
interfacesToVisit = itsInterfaces;
}
boolean isInconsistent = this.type.isHierarchyInconsistent();
ReferenceBinding superType = superclass;
while (superType != null && superType.isValidBinding()) {
isInconsistent |= superType.isHierarchyInconsistent();
if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
if (interfacesToVisit == null) {
interfacesToVisit = itsInterfaces;
nextPosition = interfacesToVisit.length;
} else {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (next == interfacesToVisit[b]) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
superType = superType.superclass();
}
for (int i = 0; i < nextPosition; i++) {
superType = interfacesToVisit[i];
if (superType.isValidBinding()) {
isInconsistent |= superType.isHierarchyInconsistent();
if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (next == interfacesToVisit[b]) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
}
if (!isInconsistent) return null; // hierarchy is consistent so no collisions are possible
SimpleSet copy = null;
for (int i = 0; i < nextPosition; i++) {
ReferenceBinding current = interfacesToVisit[i];
if (current.isValidBinding()) {
TypeBinding erasure = current.erasure();
for (int j = i + 1; j < nextPosition; j++) {
ReferenceBinding next = interfacesToVisit[j];
if (next.isValidBinding() && next.erasure() == erasure) {
if (copy == null)
copy = new SimpleSet(nextPosition);
copy.add(interfacesToVisit[i]);
copy.add(interfacesToVisit[j]);
}
}
}
}
return copy;
}
// caveat: returns false if a method is implemented that needs a bridge method
boolean isInterfaceMethodImplemented(MethodBinding inheritedMethod, MethodBinding existingMethod, ReferenceBinding superType) {
if (inheritedMethod.original() != inheritedMethod && existingMethod.declaringClass.isInterface())
return false; // must hold onto ParameterizedMethod to see if a bridge method is necessary
inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod);
return inheritedMethod != null
&& inheritedMethod.returnType == existingMethod.returnType // keep around to produce bridge methods
&& doesMethodOverride(existingMethod, inheritedMethod);
}
public boolean isMethodSubsignature(MethodBinding method, MethodBinding inheritedMethod) {
if (!org.eclipse.jdt.core.compiler.CharOperation.equals(method.selector, inheritedMethod.selector))
return false;
// need to switch back to the original if the method is from a ParameterizedType
if (method.declaringClass.isParameterizedType())
method = method.original();
inheritedMethod = inheritedMethod.original();
TypeBinding match = method.declaringClass.findSuperTypeOriginatingFrom(inheritedMethod.declaringClass);
if ((match instanceof ReferenceBinding) && match != inheritedMethod.declaringClass) {
MethodBinding[] superMethods = ((ReferenceBinding) match).getMethods(inheritedMethod.selector);
for (int i = 0, length = superMethods.length; i < length; i++)
if (superMethods[i].original() == inheritedMethod.original())
return isParameterSubsignature(method, superMethods[i]);
}
return isParameterSubsignature(method, inheritedMethod);
}
boolean isParameterSubsignature(MethodBinding method, MethodBinding inheritedMethod) {
MethodBinding substitute = computeSubstituteMethod(inheritedMethod, method);
return substitute != null && isSubstituteParameterSubsignature(method, substitute);
}
// if method "overrides" substituteMethod then we can skip over substituteMethod while resolving a message send
// if it does not then a name clash error is likely
boolean isSubstituteParameterSubsignature(MethodBinding method, MethodBinding substituteMethod) {
if (!areParametersEqual(method, substituteMethod)) {
// method can still override substituteMethod in cases like :
// <U extends Number> void c(U u) {}
// @Override void c(Number n) {}
// but method cannot have a "generic-enabled" parameter type
if (substituteMethod.hasSubstitutedParameters() && method.areParameterErasuresEqual(substituteMethod))
return method.typeVariables == Binding.NO_TYPE_VARIABLES && !hasGenericParameter(method);
return false;
}
if (substituteMethod instanceof ParameterizedGenericMethodBinding) {
if (method.typeVariables != Binding.NO_TYPE_VARIABLES)
return !((ParameterizedGenericMethodBinding) substituteMethod).isRaw;
// since substituteMethod has substituted type variables, method cannot have a generic signature AND no variables -> its a name clash if it does
return !hasGenericParameter(method);
}
// if method has its own variables, then substituteMethod failed bounds check in computeSubstituteMethod()
return method.typeVariables == Binding.NO_TYPE_VARIABLES;
}
boolean isUnsafeReturnTypeOverride(MethodBinding currentMethod, MethodBinding inheritedMethod) {
// JLS 3 �8.4.5: more are accepted, with an unchecked conversion
if (currentMethod.returnType == inheritedMethod.returnType.erasure()) {
TypeBinding[] currentParams = currentMethod.parameters;
TypeBinding[] inheritedParams = inheritedMethod.parameters;
for (int i = 0, l = currentParams.length; i < l; i++)
if (!areTypesEqual(currentParams[i], inheritedParams[i]))
return true;
}
if (currentMethod.typeVariables == Binding.NO_TYPE_VARIABLES
&& inheritedMethod.original().typeVariables != Binding.NO_TYPE_VARIABLES
&& currentMethod.returnType.erasure().findSuperTypeOriginatingFrom(inheritedMethod.returnType.erasure()) != null) {
return true;
}
return false;
}
boolean reportIncompatibleReturnTypeError(MethodBinding currentMethod, MethodBinding inheritedMethod) {
if (isUnsafeReturnTypeOverride(currentMethod, inheritedMethod)) {
problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, inheritedMethod, this.type);
return false;
}
return super.reportIncompatibleReturnTypeError(currentMethod, inheritedMethod);
}
void verify(SourceTypeBinding someType) {
if (someType.isAnnotationType())
someType.detectAnnotationCycle();
super.verify(someType);
for (int i = someType.typeVariables.length; --i >= 0;) {
TypeVariableBinding var = someType.typeVariables[i];
// must verify bounds if the variable has more than 1
if (var.superInterfaces == Binding.NO_SUPERINTERFACES) continue;
if (var.superInterfaces.length == 1 && var.superclass.id == TypeIds.T_JavaLangObject) continue;
this.currentMethods = new HashtableOfObject(0);
ReferenceBinding superclass = var.superclass();
if (superclass.kind() == Binding.TYPE_PARAMETER)
superclass = (ReferenceBinding) superclass.erasure();
ReferenceBinding[] itsInterfaces = var.superInterfaces();
ReferenceBinding[] superInterfaces = new ReferenceBinding[itsInterfaces.length];
for (int j = itsInterfaces.length; --j >= 0;) {
superInterfaces[j] = itsInterfaces[j].kind() == Binding.TYPE_PARAMETER
? (ReferenceBinding) itsInterfaces[j].erasure()
: itsInterfaces[j];
}
computeInheritedMethods(superclass, superInterfaces);
checkTypeVariableMethods(someType.scope.referenceContext.typeParameters[i]);
}
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
85e103122ee77dcc60d3118b8300d1815c2d2fa4 | d578523a7c1cdc257946136be8b70a709951ff6a | /profile-service/src/main/java/com/example/profileservice/security/SecurityConfiguration.java | 4193c49876f13fadf82c748e8f55c068fabfcc46 | [] | no_license | sebin-vincent/E-Shoper | 2ef4f01485a6295db9e75bc9486d94bdaccf52b4 | 16ddd1911c6ef325ad70092f0284dbf339c42bee | refs/heads/master | 2023-01-19T07:57:35.005424 | 2020-11-20T07:19:30 | 2020-11-20T07:19:30 | 289,621,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,362 | java | package com.example.profileservice.security;
import com.auth0.jwt.JWT;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.DecodedJWT;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.web.context.WebApplicationContext;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@EnableResourceServer
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfiguration extends ResourceServerConfigurerAdapter {
Logger logger=LoggerFactory.getLogger(SecurityConfiguration.class);
/**
* Dynamicaly add public urls from application property during server startup
*/
@Value("${resources.security.public.urls}")
private String[] publicURLArray;
@Autowired
private AuthenticationEntryPoint authenticationEntryPointImpl;
@Override
public void configure(HttpSecurity http) throws Exception {
List<String> publicURLs= Arrays.asList(publicURLArray);
for(String publicURL: publicURLs){
http.authorizeRequests().antMatchers(publicURL).permitAll();
}
http.authorizeRequests()
.anyRequest().authenticated().
and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER);
}
/**
* @return LoggedInUser- create object of current user with scope request
*/
@Bean
@Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS)
public LoggedInUser getLoggedInUserDetails() {
LoggedInUser loggedInUser=new LoggedInUser();
Map<String, Claim> claims = new HashMap<>();
String tokenValue = ((OAuth2AuthenticationDetails)(SecurityContextHolder.getContext().getAuthentication()).getDetails()).getTokenValue();
try {
DecodedJWT jwt = JWT.decode(tokenValue);
claims = jwt.getClaims();
} catch (JWTDecodeException ex) {
logger.error(ex.getMessage());
}
loggedInUser.setUserId(claims.get("userId").asString());
return loggedInUser;
}
}
| [
"sebin.vincent@litmus7.com"
] | sebin.vincent@litmus7.com |
11bca88944b0581b62c4b6039e3e20370804c650 | a3ad20c8925cdf58e64e62182c836558f66a8e53 | /module_web/src/main/java/com/xxl/modelweb/WebProviderImpl.java | 431d5368859ed23facdfeccd7701c4a1d63ba208 | [] | no_license | fazhongxu/Json | 77087487f804b48b7c8c2a621b3ff7926e50b0f4 | 604313e77913352cc07a3698c37668259a8e407f | refs/heads/master | 2021-10-25T04:32:44.220657 | 2019-04-01T03:47:35 | 2019-04-01T03:47:35 | 108,724,353 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 619 | java | package com.xxl.modelweb;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.xxl.mediatorweb.IConstantWeb;
import com.xxl.mediatorweb.IWebProvider;
/**
* Created by xxl on 2018/10/28.
*
* Description :
*/
@Route(path = IConstantWeb.WEB_PROVIDER)
public class WebProviderImpl implements IWebProvider {
@Override
public void init(Context context) {
}
@Override
public String getUserName() {
return String.valueOf("xxl");
}
@Override
public String getWebUrl() {
return SimpleWebViewActivity.getUrl();
}
}
| [
"fazhongxu0914@163.com"
] | fazhongxu0914@163.com |
7a5349a94b54d354f27e8c5197601b6fe84dfd8e | a0b049bf91465ebfb8638be7e25c9f9be96f315c | /Unidad4/Ejercicio1/src/ejercicio1/Empleado.java | 259716211e600a6fc9a077909896994359531f85 | [] | no_license | Fedecardozo/POO | 6ac10b7155cba9449be10a2b3ed982884f94f241 | 43a1fa5f84bbd73f3e51d02f5dba7ed1b5f860bc | refs/heads/master | 2022-08-16T02:55:24.987454 | 2020-05-18T14:14:37 | 2020-05-18T14:14:37 | 256,877,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package ejercicio1;
public class Empleado {
private String nombre;
public Empleado(){
}
public Empleado(String nombre){
this.nombre = nombre;
}
public String getNombre(){
return nombre;
}
public void setNombre(String nombre){
this.nombre = nombre;
}
@Override
public String toString() {
return "Empleado: " + nombre;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
33de99536ed1600b8ecad8568a008d4bdcff43e1 | 8e6a4dab7d96fc0541bfb4f3029131aaf124ec43 | /src/main/java/com/itzhoujun/usercenter/controller/user/TestPost.java | e6c810d2945468974b4f94a3a1b249af23064a38 | [] | no_license | wZ-wqy/select-savesql | 923e0ed6139aaf04879bbef45e08367d1dfb8572 | 5ad4b3e92a81a91dbbb750cfb794995825609000 | refs/heads/main | 2023-05-31T08:03:14.578466 | 2021-06-07T07:59:41 | 2021-06-07T07:59:41 | 374,581,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,682 | java | package com.itzhoujun.usercenter.controller.user;
import net.sf.json.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.security.MessageDigest;
public class TestPost {
final static String url = "https://oapi.shb.ltd/service/auth/get_access_token";
final static String jsonContent = null;
/**
* 发送HttpPost请求
*
* @param strURL
* 服务地址
* @param params
* json字符串,例如: "{ \"id\":\"12345\" }" ;其中属性名必须带双引号<br/>
* @return 成功:返回json字符串<br/>
*/
/**
*
* @param url 请求连接
* @param jsonContent json字符串
* @return 响应值,json字符串
*/
public static String httpPostJson(String url, String jsonContent) {
int time = (int) (System.currentTimeMillis() / 1000);
String verCode = "cdb38c08e6d0d97608f7d6b5d0b0081fc86146b361f2fb8f"+"_"+time;
JSONObject json = new JSONObject();
try{
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(verCode.getBytes());//update处理
byte b[] = md.digest();
int i;//定义整型
//声明StringBuffer对象
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];//将首个元素赋值给i
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");//前面补0
buf.append(Integer.toHexString(i));//转换成16进制编码
}
verCode = buf.toString();//转换成字符串
json = new JSONObject();
json.put("appKey", "shbbhy925u8bpptfs7");
json.put("timestamp", time);
json.put("verifyCode", verCode);
verCode = json.toString();
}
catch(Exception e){
System.out.println("Wrong!");
}
CloseableHttpResponse response = null;
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
HttpPost httpPost = new HttpPost(url);
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(3000).setConnectTimeout(3000).build();
httpPost.setConfig(requestConfig);
httpPost.addHeader("Content-Type", "application/json");
StringEntity requestEntity = new StringEntity(verCode, "utf-8");
httpPost.setEntity(requestEntity);
try {
response = httpClient.execute(httpPost, new BasicHttpContext());
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
return null;
}
HttpEntity entity = response.getEntity();
if (entity != null) {
String resultStr = EntityUtils.toString(entity, "utf-8");
return resultStr;
} else {
return null;
}
} catch (Exception e) {
return null;
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} | [
"710242086@qq.com"
] | 710242086@qq.com |
60443f97922ca5c47afb10baf48f3ebfad46f476 | b8405a9d025dd237de125fbf488dce43a829336d | /app/src/main/java/com/example/paperplane/homepage/DoubanContract.java | 9dc12e341dc54fd250014251709a63ff73b1f4e7 | [
"Apache-2.0"
] | permissive | yanlili1992/paperplane3 | 713c61523d2a0654e769525451fd0adda8c76ade | 2a30158e10735a2a6361bd2c9ffc5a43fb1d0680 | refs/heads/master | 2021-01-17T12:07:44.227696 | 2017-03-09T14:19:22 | 2017-03-09T14:19:22 | 84,058,653 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.example.paperplane.homepage;
import com.example.paperplane.BasePresenter;
import com.example.paperplane.BaseView;
import com.example.paperplane.bean.DoubanMomentNews;
import java.util.ArrayList;
/**
* Created by liyanli on 2017/3/8.
*/
public interface DoubanContract {
interface View extends BaseView<Presenter> {
void startLoading();
void stopLoading();
void showLoadingError();
void showResults(ArrayList<DoubanMomentNews.posts> list);
}
interface Presenter extends BasePresenter {
void startReading(int position);
void loadPosts(long date, boolean clearing);
void refresh();
void loadMore(long date);
void feelLucky();
}
}
| [
"nihaoyanlili@163.com"
] | nihaoyanlili@163.com |
105bade1c989f962ede82074858c6d8383a7e05a | bae06a0d44bf2a3ce939fbce210b9199c60d8cd7 | /src/chess/pieces/Rook.java | 9922a7fc8b2ad447ce9dd9bdabac8abf8af97c58 | [] | no_license | Tales1112/Chess-System-java | 85e838ce73485dd3327ebd7f7ecc5430ce2f0cb5 | ad61af329a7bdcd61dfb5937e28a7dda8c4c07bf | refs/heads/master | 2023-01-20T18:28:57.647491 | 2020-11-26T04:41:51 | 2020-11-26T04:41:51 | 313,817,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,818 | java | package chess.pieces;
import boardgame.Board;
import boardgame.Position;
import chess.ChessPiece;
import chess.Color;
public class Rook extends ChessPiece {
public Rook(Board board, Color color) {
super(board, color);
}
@Override
public String toString() {
return "R";
}
@Override
public boolean[][] possibleMoves() {
boolean[][] mat = new boolean[getBoard().getRows()][getBoard().getColumn()];
Position p = new Position(0, 0);
// above
p.setValues(position.getRow() - 1, position.getColumn());
while (getBoard().positionExists(p) && !getBoard().thereIsAPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
p.setRow(p.getRow() - 1);
}
if (getBoard().positionExists(p) && isThereOpponentPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
}
// left
p.setValues(position.getRow(), position.getColumn() - 1);
while (getBoard().positionExists(p) && !getBoard().thereIsAPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
p.setColumn(p.getColumn() - 1);
}
if (getBoard().positionExists(p) && isThereOpponentPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
}
// right
p.setValues(position.getRow(), position.getColumn() + 1);
while (getBoard().positionExists(p) && !getBoard().thereIsAPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
p.setColumn(p.getColumn() + 1);
}
if (getBoard().positionExists(p) && isThereOpponentPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
}
// below
p.setValues(position.getRow() + 1, position.getColumn());
while (getBoard().positionExists(p) && !getBoard().thereIsAPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
p.setRow(p.getRow() + 1);
}
if (getBoard().positionExists(p) && isThereOpponentPiece(p)) {
mat[p.getRow()][p.getColumn()] = true;
}
return mat;
}
}
| [
"tales.trab@gmail.com"
] | tales.trab@gmail.com |
e7618f0ccebcab9ca837c7a2bc5c540ec5234832 | e6a0c5a786e6f7a984a415d59ea7e1783dd8a020 | /src/league/entities/RawStatsDto.java | d04a55ae088b5533b8142298fe718f84ec7c2646 | [] | no_license | azhu2/azhu.lol | f8db54716f0e2a48e8dfd0e0e2eb993712697c23 | a44c07aceacc16cf362d8ed3aa2006d3283ebdd8 | refs/heads/master | 2016-09-05T11:47:49.284893 | 2015-06-19T04:01:48 | 2015-06-19T04:01:48 | 30,597,330 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,660 | java | package league.entities;
public class RawStatsDto{
protected int assists;
protected int barracksKilled;
protected int championsKilled;
protected int combatPlayerScore;
protected int consumablesPurchased;
protected int damageDealtPlayer;
protected int doubleKills;
protected int firstBlood;
protected int gold;
protected int goldEarned;
protected int goldSpent;
protected int item0;
protected int item1;
protected int item2;
protected int item3;
protected int item4;
protected int item5;
protected int item6;
protected int itemsPurchased;
protected int killingSprees;
protected int largestCriticalStrike;
protected int largestKillingSpree;
protected int largestMultiKill;
protected int legendaryItemsCreated;
protected int level;
protected int magicDamageDealtPlayer;
protected int magicDamageDealtToChampions;
protected int magicDamageTaken;
protected int minionsDenied;
protected int minionsKilled;
protected int neutralMinionsKilled;
protected int neutralMinionsKilledEnemyJungle;
protected int neutralMinionsKilledYourJungle;
protected boolean nexusKilled;
protected int nodeCapture;
protected int nodeCaptureAssist;
protected int nodeNeutralize;
protected int nodeNeutralizeAssist;
protected int numDeaths;
protected int numItemsBought;
protected int objectivePlayerScore;
protected int pentaKills;
protected int physicalDamageDealtPlayer;
protected int physicalDamageDealtToChampions;
protected int physicalDamageTaken;
protected int quadraKills;
protected int sightWardsBought;
protected int spell1Cast;
protected int spell2Cast;
protected int spell3Cast;
protected int spell4Cast;
protected int summonSpell1Cast;
protected int summonSpell2Cast;
protected int superMonsterKilled;
protected int team;
protected int teamObjective;
protected int timePlayed;
protected int totalDamageDealt;
protected int totalDamageDealtToChampions;
protected int totalDamageTaken;
protected int totalHeal;
protected int totalPlayerScore;
protected int totalScoreRank;
protected int totalTimeCrowdControlDealt;
protected int totalUnitsHealed;
protected int tripleKills;
protected int trueDamageDealtPlayer;
protected int trueDamageDealtToChampions;
protected int trueDamageTaken;
protected int turretsKilled;
protected int unrealKills;
protected int victoryPointTotal;
protected int visionWardsBought;
protected int wardKilled;
protected int wardPlaced;
protected boolean win;
public int getAssists(){
return assists;
}
public void setAssists(int assists){
this.assists = assists;
}
public int getBarracksKilled(){
return barracksKilled;
}
public void setBarracksKilled(int barracksKilled){
this.barracksKilled = barracksKilled;
}
public int getChampionsKilled(){
return championsKilled;
}
public void setChampionsKilled(int championsKilled){
this.championsKilled = championsKilled;
}
public int getCombatPlayerScore(){
return combatPlayerScore;
}
public void setCombatPlayerScore(int combatPlayerScore){
this.combatPlayerScore = combatPlayerScore;
}
public int getConsumablesPurchased(){
return consumablesPurchased;
}
public void setConsumablesPurchased(int consumablesPurchased){
this.consumablesPurchased = consumablesPurchased;
}
public int getDamageDealtPlayer(){
return damageDealtPlayer;
}
public void setDamageDealtPlayer(int damageDealtPlayer){
this.damageDealtPlayer = damageDealtPlayer;
}
public int getDoubleKills(){
return doubleKills;
}
public void setDoubleKills(int doubleKills){
this.doubleKills = doubleKills;
}
public int getFirstBlood(){
return firstBlood;
}
public void setFirstBlood(int firstBlood){
this.firstBlood = firstBlood;
}
public int getGold(){
return gold;
}
public void setGold(int gold){
this.gold = gold;
}
public int getGoldEarned(){
return goldEarned;
}
public void setGoldEarned(int goldEarned){
this.goldEarned = goldEarned;
}
public int getGoldSpent(){
return goldSpent;
}
public void setGoldSpent(int goldSpent){
this.goldSpent = goldSpent;
}
public int getItem0(){
return item0;
}
public void setItem0(int item0){
this.item0 = item0;
}
public int getItem1(){
return item1;
}
public void setItem1(int item1){
this.item1 = item1;
}
public int getItem2(){
return item2;
}
public void setItem2(int item2){
this.item2 = item2;
}
public int getItem3(){
return item3;
}
public void setItem3(int item3){
this.item3 = item3;
}
public int getItem4(){
return item4;
}
public void setItem4(int item4){
this.item4 = item4;
}
public int getItem5(){
return item5;
}
public void setItem5(int item5){
this.item5 = item5;
}
public int getItem6(){
return item6;
}
public void setItem6(int item6){
this.item6 = item6;
}
public int getItemsPurchased(){
return itemsPurchased;
}
public void setItemsPurchased(int itemsPurchased){
this.itemsPurchased = itemsPurchased;
}
public int getKillingSprees(){
return killingSprees;
}
public void setKillingSprees(int killingSprees){
this.killingSprees = killingSprees;
}
public int getLargestCriticalStrike(){
return largestCriticalStrike;
}
public void setLargestCriticalStrike(int largestCriticalStrike){
this.largestCriticalStrike = largestCriticalStrike;
}
public int getLargestKillingSpree(){
return largestKillingSpree;
}
public void setLargestKillingSpree(int largestKillingSpree){
this.largestKillingSpree = largestKillingSpree;
}
public int getLargestMultiKill(){
return largestMultiKill;
}
public void setLargestMultiKill(int largestMultikill){
this.largestMultiKill = largestMultikill;
}
public int getLegendaryItemsCreated(){
return legendaryItemsCreated;
}
public void setLegendaryItemsCreated(int legendaryItemsCreated){
this.legendaryItemsCreated = legendaryItemsCreated;
}
public int getLevel(){
return level;
}
public void setLevel(int level){
this.level = level;
}
public int getMagicDamageDealtPlayer(){
return magicDamageDealtPlayer;
}
public void setMagicDamageDealtPlayer(int magicDamageDealtPlayer){
this.magicDamageDealtPlayer = magicDamageDealtPlayer;
}
public int getMagicDamageDealtToChampions(){
return magicDamageDealtToChampions;
}
public void setMagicDamageDealtToChampions(int magicDamageDealtToChampions){
this.magicDamageDealtToChampions = magicDamageDealtToChampions;
}
public int getMagicDamageTaken(){
return magicDamageTaken;
}
public void setMagicDamageTaken(int magicDamageTaken){
this.magicDamageTaken = magicDamageTaken;
}
public int getMinionsDenied(){
return minionsDenied;
}
public void setMinionsDenied(int minionsDenied){
this.minionsDenied = minionsDenied;
}
public int getMinionsKilled(){
return minionsKilled;
}
public void setMinionsKilled(int minionsKilled){
this.minionsKilled = minionsKilled;
}
public int getNeutralMinionsKilled(){
return neutralMinionsKilled;
}
public void setNeutralMinionsKilled(int neutralMinionsKilled){
this.neutralMinionsKilled = neutralMinionsKilled;
}
public int getNeutralMinionsKilledEnemyJungle(){
return neutralMinionsKilledEnemyJungle;
}
public void setNeutralMinionsKilledEnemyJungle(int neutralMinionsKilledEnemyJungle){
this.neutralMinionsKilledEnemyJungle = neutralMinionsKilledEnemyJungle;
}
public int getNeutralMinionsKilledYourJungle(){
return neutralMinionsKilledYourJungle;
}
public void setNeutralMinionsKilledYourJungle(int neutralMinionsKilledYourJungle){
this.neutralMinionsKilledYourJungle = neutralMinionsKilledYourJungle;
}
public boolean isNexusKilled(){
return nexusKilled;
}
public void setNexusKilled(boolean nexusKilled){
this.nexusKilled = nexusKilled;
}
public int getNodeCapture(){
return nodeCapture;
}
public void setNodeCapture(int nodeCapture){
this.nodeCapture = nodeCapture;
}
public int getNodeCaptureAssist(){
return nodeCaptureAssist;
}
public void setNodeCaptureAssist(int nodeCaptureAssist){
this.nodeCaptureAssist = nodeCaptureAssist;
}
public int getNodeNeutralize(){
return nodeNeutralize;
}
public void setNodeNeutralize(int nodeNeutralize){
this.nodeNeutralize = nodeNeutralize;
}
public int getNodeNeutralizeAssist(){
return nodeNeutralizeAssist;
}
public void setNodeNeutralizeAssist(int nodeNeutralizeAssist){
this.nodeNeutralizeAssist = nodeNeutralizeAssist;
}
public int getNumDeaths(){
return numDeaths;
}
public void setNumDeaths(int numDeaths){
this.numDeaths = numDeaths;
}
public int getNumItemsBought(){
return numItemsBought;
}
public void setNumItemsBought(int numItemsBought){
this.numItemsBought = numItemsBought;
}
public int getObjectivePlayerScore(){
return objectivePlayerScore;
}
public void setObjectivePlayerScore(int objectivePlayerScore){
this.objectivePlayerScore = objectivePlayerScore;
}
public int getPentaKills(){
return pentaKills;
}
public void setPentaKills(int pentakills){
this.pentaKills = pentakills;
}
public int getPhysicalDamageDealtPlayer(){
return physicalDamageDealtPlayer;
}
public void setPhysicalDamageDealtPlayer(int physicalDamageDealtPlayer){
this.physicalDamageDealtPlayer = physicalDamageDealtPlayer;
}
public int getPhysicalDamageDealtToChampions(){
return physicalDamageDealtToChampions;
}
public void setPhysicalDamageDealtToChampions(int physicalDamageDealtToChampions){
this.physicalDamageDealtToChampions = physicalDamageDealtToChampions;
}
public int getPhysicalDamageTaken(){
return physicalDamageTaken;
}
public void setPhysicalDamageTaken(int phyiscalDamageTaken){
this.physicalDamageTaken = phyiscalDamageTaken;
}
public int getQuadraKills(){
return quadraKills;
}
public void setQuadraKills(int quadrakills){
this.quadraKills = quadrakills;
}
public int getSightWardsBought(){
return sightWardsBought;
}
public void setSightWardsBought(int sightWardsBought){
this.sightWardsBought = sightWardsBought;
}
public int getSpell1Cast(){
return spell1Cast;
}
public void setSpell1Cast(int spell1Cast){
this.spell1Cast = spell1Cast;
}
public int getSpell2Cast(){
return spell2Cast;
}
public void setSpell2Cast(int spell2Cast){
this.spell2Cast = spell2Cast;
}
public int getSpell3Cast(){
return spell3Cast;
}
public void setSpell3Cast(int spell3Cast){
this.spell3Cast = spell3Cast;
}
public int getSpell4Cast(){
return spell4Cast;
}
public void setSpell4Cast(int spell4Cast){
this.spell4Cast = spell4Cast;
}
public int getSummonSpell1Cast(){
return summonSpell1Cast;
}
public void setSummonSpell1Cast(int summonSpell1Cast){
this.summonSpell1Cast = summonSpell1Cast;
}
public int getSummonSpell2Cast(){
return summonSpell2Cast;
}
public void setSummonSpell2Cast(int summonSpell2Cast){
this.summonSpell2Cast = summonSpell2Cast;
}
public int getSuperMonsterKilled(){
return superMonsterKilled;
}
public void setSuperMonsterKilled(int superMonsterKilled){
this.superMonsterKilled = superMonsterKilled;
}
public int getTeam(){
return team;
}
public void setTeam(int team){
this.team = team;
}
public int getTeamObjective(){
return teamObjective;
}
public void setTeamObjective(int teamObjective){
this.teamObjective = teamObjective;
}
public int getTimePlayed(){
return timePlayed;
}
public void setTimePlayed(int timePlayed){
this.timePlayed = timePlayed;
}
public int getTotalDamageDealt(){
return totalDamageDealt;
}
public void setTotalDamageDealt(int totalDamageDealt){
this.totalDamageDealt = totalDamageDealt;
}
public int getTotalDamageDealtToChampions(){
return totalDamageDealtToChampions;
}
public void setTotalDamageDealtToChampions(int totalDamageDealtToChampions){
this.totalDamageDealtToChampions = totalDamageDealtToChampions;
}
public int getTotalDamageTaken(){
return totalDamageTaken;
}
public void setTotalDamageTaken(int totalDamageTaken){
this.totalDamageTaken = totalDamageTaken;
}
public int getTotalHeal(){
return totalHeal;
}
public void setTotalHeal(int totalHeal){
this.totalHeal = totalHeal;
}
public int getTotalPlayerScore(){
return totalPlayerScore;
}
public void setTotalPlayerScore(int totalPlayerScore){
this.totalPlayerScore = totalPlayerScore;
}
public int getTotalScoreRank(){
return totalScoreRank;
}
public void setTotalScoreRank(int totalScoreRank){
this.totalScoreRank = totalScoreRank;
}
public int getTotalTimeCrowdControlDealt(){
return totalTimeCrowdControlDealt;
}
public void setTotalTimeCrowdControlDealt(int totalTimeCrowdControlDealt){
this.totalTimeCrowdControlDealt = totalTimeCrowdControlDealt;
}
public int getTotalUnitsHealed(){
return totalUnitsHealed;
}
public void setTotalUnitsHealed(int totalUnitsHealed){
this.totalUnitsHealed = totalUnitsHealed;
}
public int getTripleKills(){
return tripleKills;
}
public void setTripleKills(int triplekills){
this.tripleKills = triplekills;
}
public int getTrueDamageDealtPlayer(){
return trueDamageDealtPlayer;
}
public void setTrueDamageDealtPlayer(int trueDamageDealtPlayer){
this.trueDamageDealtPlayer = trueDamageDealtPlayer;
}
public int getTrueDamageDealtToChampions(){
return trueDamageDealtToChampions;
}
public void setTrueDamageDealtToChampions(int trueDamageDealtToChampions){
this.trueDamageDealtToChampions = trueDamageDealtToChampions;
}
public int getTrueDamageTaken(){
return trueDamageTaken;
}
public void setTrueDamageTaken(int trueDamageTaken){
this.trueDamageTaken = trueDamageTaken;
}
public int getTurretsKilled(){
return turretsKilled;
}
public void setTurretsKilled(int turretsKilled){
this.turretsKilled = turretsKilled;
}
public int getUnrealKills(){
return unrealKills;
}
public void setUnrealKills(int unrealKills){
this.unrealKills = unrealKills;
}
public int getVictoryPointTotal(){
return victoryPointTotal;
}
public void setVictoryPointTotal(int victoryPointTotal){
this.victoryPointTotal = victoryPointTotal;
}
public int getVisionWardsBought(){
return visionWardsBought;
}
public void setVisionWardsBought(int visionWardsBought){
this.visionWardsBought = visionWardsBought;
}
public int getWardKilled(){
return wardKilled;
}
public void setWardKilled(int wardKilled){
this.wardKilled = wardKilled;
}
public int getWardPlaced(){
return wardPlaced;
}
public void setWardPlaced(int wardPlaced){
this.wardPlaced = wardPlaced;
}
public boolean isWin(){
return win;
}
public void setWin(boolean win){
this.win = win;
}
}
| [
"azhu2@illinois.edu"
] | azhu2@illinois.edu |
19f9a8245ba1ff21ec305349b570cd94468f9c05 | 0ba3a8c4bdf3db1d23c54d9ba985ac81b5adbd57 | /RestAssuredAutomation/src/test/java/TC5_GET_REQUEST_VALIDATE_JSONBODY.java | c7dc7fcca23d33a582c6b4000aca1323cf709616 | [] | no_license | GowthamanKuppuswamy/Sample-Codes | d5cd852ab8eb1bc74e0c440df1861168eb75ecfa | 1dd209f56a523001190c3b69ef35b67267d5988c | refs/heads/master | 2023-05-04T02:22:38.137834 | 2021-05-16T22:27:01 | 2021-05-16T22:27:01 | 367,992,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,107 | java | import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.http.Method;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
public class TC5_GET_REQUEST_VALIDATE_JSONBODY {
@Test
void validatingResponseBody()
{
String substr ="maze";
//specific URI
RestAssured.baseURI = "https://jsonmock.hackerrank.com/api/movies/search/?Title=maze";
//Specifying which type of request and creating an object
RequestSpecification httpRequest = RestAssured.given();
//Response Object
Response response = httpRequest.request(Method.GET,substr+"");
//printing Response in Console as a stirng
String responseBody = response.getBody().asString();
System.out.println("Response Body is" +responseBody);
JsonPath jsonPath = response.jsonPath();
int total = jsonPath.get("total");
System.out.println(total);
//validating response body
//Assert.assertEquals(responseBody.contains("haze"), true);
}
}
| [
"gowthamcr7@gmail.com"
] | gowthamcr7@gmail.com |
2a1cbf6d3c3a49d99440bdf4b465eb831062c56b | bbde8dd13109617aec9ff2f655a6cbb579cf364a | /java-exercises/src/main/java/hashtable/commonsubstring/CommonSubString.java | cbb4619e36c25ba264583062c29c038da877fa34 | [] | no_license | chenery/coding-exercises | ea78c726fbef01a709df2ed2130d2362559086a2 | f0fa5aab37fb7fd173eb5c3d55f62b02e5edb873 | refs/heads/master | 2020-12-11T20:23:58.816749 | 2020-03-09T07:53:29 | 2020-03-09T07:53:29 | 233,949,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | package hashtable.commonsubstring;
import java.util.HashSet;
import java.util.Set;
/**
*
*/
public class CommonSubString {
/**
* Constraints:
* - strings can be from 1 to 10,000 chars
*
* Second idea:
* Map/flag for every letter that is found in one string
* Iterative each char is the other string to check exists in map
* Performance:
* Worse case is when there is substring:
* O(n + m)
*/
public static String twoStringsV2(String s1, String s2) {
Set<Character> s1Chars = new HashSet<>();
for (int i = 0; i < s1.length(); i++) {
s1Chars.add(s1.charAt(i));
}
for (int i = 0; i < s2.length(); i++) {
if (s1Chars.contains(s2.charAt(i))) {
return "YES";
}
}
return "NO";
}
/**
* Constraints:
* - strings can be from 1 to 10,000 chars
*
* First idea:
* Start with smallest string
* Check for the simplest case, a single char length common substring
* Use string contains to check the presence of the string
*
* Performance:
* Worse case is when there is no substring:
* O(nm) where n is length of s1 and m is length of s2
*/
public static String twoStrings(String s1, String s2) {
String shorterStr = s1.length() < s2.length() ? s1 : s2;
String longerStr = s1.length() < s2.length() ? s2 : s1;
for (int i = 0; i < shorterStr.length(); i++) {
String subStr = shorterStr.substring(i, i + 1);
if (longerStr.contains(subStr)) {
return "YES";
}
}
return "NO";
}
public static void main(String[] args) {
System.out.println(twoStringsV2("hello", "world"));
System.out.println(twoStringsV2("hi", "world"));
}
}
| [
"paulchenery@gmail.com"
] | paulchenery@gmail.com |
cd97ed36bb02d3a535691b618717e7ababc82f18 | d7e1959b836d6206c3840faa44f443178e324659 | /Lab2/composite/src/Manager.java | 1bb18c513619b02da09d998f413fc85e8d6380b3 | [] | no_license | alexmereuta/IPPLab | 005ad1ccb66e96225d3a5860fcd72104fcb390e4 | 7214a1b3368b8fdc82fbdb9fad5fabab25117b1f | refs/heads/master | 2020-03-17T01:49:57.578647 | 2018-05-13T10:15:57 | 2018-05-13T10:15:57 | 133,168,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,252 | java | import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
//this is the component part and it has more methods which are applicable than the leaf - developer.
public class Manager implements Employee{
private String name;
private double salary;
public Manager(String name,double salary){
this.name = name;
this.salary = salary;
}
List<Employee> employees = new ArrayList<Employee>();
public void add(Employee employee) {
employees.add(employee);
}
public Employee getChild(int i) {
return employees.get(i);
}
public String getName() {
return name;
}
public double getSalary() {
return salary;
}
public void print() {
System.out.println("Name ="+getName());
System.out.println("Salary ="+getSalary());
//iterator is used in order to display the content of the list
Iterator<Employee> employeeIterator = employees.iterator();
while(employeeIterator.hasNext()){
Employee employee = employeeIterator.next(); //returns the next element
employee.print();
}
}
public void remove(Employee employee) {
employees.remove(employee);
}
} | [
"amereuta@gmail.com"
] | amereuta@gmail.com |
028168324a90a5c16500b757de59d29219608bc7 | f7fdadc21391c88f9a78bfef5c60a5c638afb236 | /getStart/src/TCB001R/Room.java | 3d7216612924dd7aeb575a765d8afaae57156e8f | [] | no_license | BeatMil/HotelBookingProject | f2d8fd1f9f9b66e7a8824e728c55776debceaea9 | 9743110c2eb3c2a41e39820cc631893d555e4c63 | refs/heads/master | 2020-05-17T23:57:37.941551 | 2019-05-08T10:45:15 | 2019-05-08T10:45:15 | 184,048,510 | 1 | 0 | null | 2019-05-05T04:12:46 | 2019-04-29T10:16:05 | Java | UTF-8 | Java | false | false | 600 | java | package TCB001R;
public class Room
{
private String color;
private String size;
Room() //default constructor
{
this.color = "Green";
this.setSize("1");
}
Room(String c, String s)
{
this.color = c;
this.setSize(s);
}
public String getColor()
{
return this.color;
}
public void setColor(String color)
{
this.color = color;
}
public String getSize()
{
return size;
}
public void setSize(String size)
{
this.size = size;
}
public String toString()
{
return this.color+"\n"+this.size;
}
}
| [
"Beatdameat@DESKTOP-2HET18L"
] | Beatdameat@DESKTOP-2HET18L |
c0983f677f81d359777a982c0964e80e0bce1f35 | cd167be6d0c6b0af9a403879b36988ff707fa40a | /WillListServer/src/com/zyd/response/Product.java | 958ca1bf2f1366a8f763aa55826512cda35db2f0 | [] | no_license | ZYDuan/WillList | f2227becbd319e18f0a635d9d747e229ef9b8da6 | edc16e19b829e76750f7f42d53456b5972f7ebf1 | refs/heads/master | 2020-03-10T22:28:58.481369 | 2018-04-15T14:50:06 | 2018-04-15T14:50:06 | 129,620,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,108 | java | /**
*
*/
package com.zyd.response;
import java.util.Date;
/**
* @author zyd
* @date 2017年12月15日 下午4:50:41
* @ClassName: Product
* 用于返回
*/
public class Product {
private Integer id;
private String pic;
private String name;
private float price;
private Date endTime;
private int leftTime;
private Integer type;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public int getLeftTime() {
return leftTime;
}
public void setLeftTime(int leftTime) {
this.leftTime = leftTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
}
| [
"852887995@qq.com"
] | 852887995@qq.com |
2bfcea93de96727937157865d3d08bf1b0723395 | 21f0f2b1c7c23e4f6ffe8a18773732bf79974360 | /renren-api/src/main/java/io/renren/form/wx/AccessToken.java | a4d930eacfcb1b3d048a4d08c66e4ed91f8abbf9 | [
"Apache-2.0"
] | permissive | a249853772/RR-Learn | 4a82a35febb4a9441b24880e39609022282e467d | b35bd5e64642807d2077554aefad262cda506869 | refs/heads/master | 2020-03-23T04:50:00.315603 | 2019-01-03T23:58:41 | 2019-01-03T23:58:41 | 141,107,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package io.renren.form.wx;
public class AccessToken {
/**
* 获取到的凭证
*/
private String access_token;
/**
* 凭证有效时间
*/
private int expires_in;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public int getExpires_in() {
return expires_in;
}
public void setExpires_in(int expires_in) {
this.expires_in = expires_in;
}
}
| [
"249853772@qq.com"
] | 249853772@qq.com |
246a0f88c00c947266d7f1fce1e80247b2facca8 | c8e6dfe5d2d4511f6ba1413b278932a2ab10a9c1 | /lib/am335x_sdk/ti/drv/pruss/package/ti_drv_pruss.java | b3cd2a817b5a0130c5f22dd703cad48534e47f67 | [
"MIT"
] | permissive | brandonbraun653/Apollo | 61d4a81871ac10b2a2c74c238be817daeee40bb6 | a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce | refs/heads/main | 2023-04-08T19:13:45.705310 | 2021-04-17T22:02:02 | 2021-04-17T22:02:02 | 319,139,363 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,263 | java | /*
* Do not modify this file; it is automatically
* generated and any modifications will be overwritten.
*
* @(#) xdc-G16
*/
import java.util.*;
import org.mozilla.javascript.*;
import xdc.services.intern.xsr.*;
import xdc.services.spec.Session;
public class ti_drv_pruss
{
static final String VERS = "@(#) xdc-G16\n";
static final Proto.Elm $$T_Bool = Proto.Elm.newBool();
static final Proto.Elm $$T_Num = Proto.Elm.newNum();
static final Proto.Elm $$T_Str = Proto.Elm.newStr();
static final Proto.Elm $$T_Obj = Proto.Elm.newObj();
static final Proto.Fxn $$T_Met = new Proto.Fxn(null, null, 0, -1, false);
static final Proto.Map $$T_Map = new Proto.Map($$T_Obj);
static final Proto.Arr $$T_Vec = new Proto.Arr($$T_Obj);
static final XScriptO $$DEFAULT = Value.DEFAULT;
static final Object $$UNDEF = Undefined.instance;
static final Proto.Obj $$Package = (Proto.Obj)Global.get("$$Package");
static final Proto.Obj $$Module = (Proto.Obj)Global.get("$$Module");
static final Proto.Obj $$Instance = (Proto.Obj)Global.get("$$Instance");
static final Proto.Obj $$Params = (Proto.Obj)Global.get("$$Params");
static final Object $$objFldGet = Global.get("$$objFldGet");
static final Object $$objFldSet = Global.get("$$objFldSet");
static final Object $$proxyGet = Global.get("$$proxyGet");
static final Object $$proxySet = Global.get("$$proxySet");
static final Object $$delegGet = Global.get("$$delegGet");
static final Object $$delegSet = Global.get("$$delegSet");
Scriptable xdcO;
Session ses;
Value.Obj om;
boolean isROV;
boolean isCFG;
Proto.Obj pkgP;
Value.Obj pkgV;
ArrayList<Object> imports = new ArrayList<Object>();
ArrayList<Object> loggables = new ArrayList<Object>();
ArrayList<Object> mcfgs = new ArrayList<Object>();
ArrayList<Object> icfgs = new ArrayList<Object>();
ArrayList<String> inherits = new ArrayList<String>();
ArrayList<Object> proxies = new ArrayList<Object>();
ArrayList<Object> sizes = new ArrayList<Object>();
ArrayList<Object> tdefs = new ArrayList<Object>();
void $$IMPORTS()
{
Global.callFxn("loadPackage", xdcO, "xdc");
Global.callFxn("loadPackage", xdcO, "xdc.corevers");
Global.callFxn("loadPackage", xdcO, "xdc.runtime");
}
void $$OBJECTS()
{
pkgP = (Proto.Obj)om.bind("ti.drv.pruss.Package", new Proto.Obj());
pkgV = (Value.Obj)om.bind("ti.drv.pruss", new Value.Obj("ti.drv.pruss", pkgP));
}
void Settings$$OBJECTS()
{
Proto.Obj po, spo;
Value.Obj vo;
po = (Proto.Obj)om.bind("ti.drv.pruss.Settings.Module", new Proto.Obj());
vo = (Value.Obj)om.bind("ti.drv.pruss.Settings", new Value.Obj("ti.drv.pruss.Settings", po));
pkgV.bind("Settings", vo);
// decls
}
void Settings$$CONSTS()
{
// module Settings
}
void Settings$$CREATES()
{
Proto.Fxn fxn;
StringBuilder sb;
}
void Settings$$FUNCTIONS()
{
Proto.Fxn fxn;
}
void Settings$$SIZES()
{
Proto.Str so;
Object fxn;
}
void Settings$$TYPES()
{
Scriptable cap;
Proto.Obj po;
Proto.Str ps;
Proto.Typedef pt;
Object fxn;
po = (Proto.Obj)om.findStrict("ti.drv.pruss.Settings.Module", "ti.drv.pruss");
po.init("ti.drv.pruss.Settings.Module", om.findStrict("xdc.runtime.IModule.Module", "ti.drv.pruss"));
po.addFld("$hostonly", $$T_Num, 0, "r");
if (isCFG) {
po.addFld("prussVersionString", $$T_Str, "01.00.00.15", "w");
po.addFld("socType", $$T_Str, "", "wh");
po.addFld("enableProfiling", $$T_Bool, false, "w");
po.addFld("libProfile", $$T_Str, "release", "wh");
}//isCFG
}
void Settings$$ROV()
{
Proto.Obj po;
Value.Obj vo;
vo = (Value.Obj)om.findStrict("ti.drv.pruss.Settings", "ti.drv.pruss");
}
void $$SINGLETONS()
{
pkgP.init("ti.drv.pruss.Package", (Proto.Obj)om.findStrict("xdc.IPackage.Module", "ti.drv.pruss"));
Scriptable cap = (Scriptable)Global.callFxn("loadCapsule", xdcO, "ti/drv/pruss/package.xs");
om.bind("xdc.IPackage$$capsule", cap);
Object fxn;
fxn = Global.get(cap, "init");
if (fxn != null) pkgP.addFxn("init", (Proto.Fxn)om.findStrict("xdc.IPackage$$init", "ti.drv.pruss"), fxn);
fxn = Global.get(cap, "close");
if (fxn != null) pkgP.addFxn("close", (Proto.Fxn)om.findStrict("xdc.IPackage$$close", "ti.drv.pruss"), fxn);
fxn = Global.get(cap, "validate");
if (fxn != null) pkgP.addFxn("validate", (Proto.Fxn)om.findStrict("xdc.IPackage$$validate", "ti.drv.pruss"), fxn);
fxn = Global.get(cap, "exit");
if (fxn != null) pkgP.addFxn("exit", (Proto.Fxn)om.findStrict("xdc.IPackage$$exit", "ti.drv.pruss"), fxn);
fxn = Global.get(cap, "getLibs");
if (fxn != null) pkgP.addFxn("getLibs", (Proto.Fxn)om.findStrict("xdc.IPackage$$getLibs", "ti.drv.pruss"), fxn);
fxn = Global.get(cap, "getSects");
if (fxn != null) pkgP.addFxn("getSects", (Proto.Fxn)om.findStrict("xdc.IPackage$$getSects", "ti.drv.pruss"), fxn);
pkgP.bind("$capsule", cap);
pkgV.init2(pkgP, "ti.drv.pruss", Value.DEFAULT, false);
pkgV.bind("$name", "ti.drv.pruss");
pkgV.bind("$category", "Package");
pkgV.bind("$$qn", "ti.drv.pruss.");
pkgV.bind("$vers", Global.newArray(1, 0, 0, 15));
Value.Map atmap = (Value.Map)pkgV.getv("$attr");
atmap.seal("length");
imports.clear();
pkgV.bind("$imports", imports);
StringBuilder sb = new StringBuilder();
sb.append("var pkg = xdc.om['ti.drv.pruss'];\n");
sb.append("if (pkg.$vers.length >= 3) {\n");
sb.append("pkg.$vers.push(Packages.xdc.services.global.Vers.getDate(xdc.csd() + '/..'));\n");
sb.append("}\n");
sb.append("if ('ti.drv.pruss$$stat$base' in xdc.om) {\n");
sb.append("pkg.packageBase = xdc.om['ti.drv.pruss$$stat$base'];\n");
sb.append("pkg.packageRepository = xdc.om['ti.drv.pruss$$stat$root'];\n");
sb.append("}\n");
sb.append("pkg.build.libraries = [\n");
sb.append("];\n");
sb.append("pkg.build.libDesc = [\n");
sb.append("];\n");
Global.eval(sb.toString());
}
void Settings$$SINGLETONS()
{
Proto.Obj po;
Value.Obj vo;
vo = (Value.Obj)om.findStrict("ti.drv.pruss.Settings", "ti.drv.pruss");
po = (Proto.Obj)om.findStrict("ti.drv.pruss.Settings.Module", "ti.drv.pruss");
vo.init2(po, "ti.drv.pruss.Settings", $$DEFAULT, false);
vo.bind("Module", po);
vo.bind("$category", "Module");
vo.bind("$capsule", $$UNDEF);
vo.bind("$package", om.findStrict("ti.drv.pruss", "ti.drv.pruss"));
tdefs.clear();
proxies.clear();
mcfgs.clear();
icfgs.clear();
inherits.clear();
mcfgs.add("Module__diagsEnabled");
icfgs.add("Module__diagsEnabled");
mcfgs.add("Module__diagsIncluded");
icfgs.add("Module__diagsIncluded");
mcfgs.add("Module__diagsMask");
icfgs.add("Module__diagsMask");
mcfgs.add("Module__gateObj");
icfgs.add("Module__gateObj");
mcfgs.add("Module__gatePrms");
icfgs.add("Module__gatePrms");
mcfgs.add("Module__id");
icfgs.add("Module__id");
mcfgs.add("Module__loggerDefined");
icfgs.add("Module__loggerDefined");
mcfgs.add("Module__loggerObj");
icfgs.add("Module__loggerObj");
mcfgs.add("Module__loggerFxn0");
icfgs.add("Module__loggerFxn0");
mcfgs.add("Module__loggerFxn1");
icfgs.add("Module__loggerFxn1");
mcfgs.add("Module__loggerFxn2");
icfgs.add("Module__loggerFxn2");
mcfgs.add("Module__loggerFxn4");
icfgs.add("Module__loggerFxn4");
mcfgs.add("Module__loggerFxn8");
icfgs.add("Module__loggerFxn8");
mcfgs.add("Object__count");
icfgs.add("Object__count");
mcfgs.add("Object__heap");
icfgs.add("Object__heap");
mcfgs.add("Object__sizeof");
icfgs.add("Object__sizeof");
mcfgs.add("Object__table");
icfgs.add("Object__table");
mcfgs.add("prussVersionString");
mcfgs.add("enableProfiling");
vo.bind("$$tdefs", Global.newArray(tdefs.toArray()));
vo.bind("$$proxies", Global.newArray(proxies.toArray()));
vo.bind("$$mcfgs", Global.newArray(mcfgs.toArray()));
vo.bind("$$icfgs", Global.newArray(icfgs.toArray()));
inherits.add("xdc.runtime");
vo.bind("$$inherits", Global.newArray(inherits.toArray()));
((Value.Arr)pkgV.getv("$modules")).add(vo);
((Value.Arr)om.findStrict("$modules", "ti.drv.pruss")).add(vo);
vo.bind("$$instflag", 0);
vo.bind("$$iobjflag", 0);
vo.bind("$$sizeflag", 1);
vo.bind("$$dlgflag", 0);
vo.bind("$$iflag", 0);
vo.bind("$$romcfgs", "|");
vo.bind("$$nortsflag", 0);
if (isCFG) {
Proto.Str ps = (Proto.Str)vo.find("Module_State");
if (ps != null) vo.bind("$object", ps.newInstance());
vo.bind("$$meta_iobj", 1);
}//isCFG
vo.bind("$$fxntab", Global.newArray("ti_drv_pruss_Settings_Module__startupDone__E"));
vo.bind("$$logEvtCfgs", Global.newArray());
vo.bind("$$errorDescCfgs", Global.newArray());
vo.bind("$$assertDescCfgs", Global.newArray());
Value.Map atmap = (Value.Map)vo.getv("$attr");
atmap.seal("length");
vo.bind("MODULE_STARTUP$", 0);
vo.bind("PROXY$", 0);
loggables.clear();
vo.bind("$$loggables", loggables.toArray());
pkgV.bind("Settings", vo);
((Value.Arr)pkgV.getv("$unitNames")).add("Settings");
}
void $$INITIALIZATION()
{
Value.Obj vo;
if (isCFG) {
}//isCFG
Global.callFxn("module$meta$init", (Scriptable)om.findStrict("ti.drv.pruss.Settings", "ti.drv.pruss"));
Global.callFxn("init", pkgV);
((Value.Obj)om.getv("ti.drv.pruss.Settings")).bless();
((Value.Arr)om.findStrict("$packages", "ti.drv.pruss")).add(pkgV);
}
public void exec( Scriptable xdcO, Session ses )
{
this.xdcO = xdcO;
this.ses = ses;
om = (Value.Obj)xdcO.get("om", null);
Object o = om.geto("$name");
String s = o instanceof String ? (String)o : null;
isCFG = s != null && s.equals("cfg");
isROV = s != null && s.equals("rov");
$$IMPORTS();
$$OBJECTS();
Settings$$OBJECTS();
Settings$$CONSTS();
Settings$$CREATES();
Settings$$FUNCTIONS();
Settings$$SIZES();
Settings$$TYPES();
if (isROV) {
Settings$$ROV();
}//isROV
$$SINGLETONS();
Settings$$SINGLETONS();
$$INITIALIZATION();
}
}
| [
"brandonbraun653@gmail.com"
] | brandonbraun653@gmail.com |
9578fc0359947b2b11d252affd7a400ae2cd1cbd | 7cf8f09e3fba142149877be1329e4b71229224e7 | /flatworm-core/src/main/java/com/blackbear/flatworm/errors/FlatwormParserException.java | d3c98d4693c87cdcd03e2114db6caca7c0a449aa | [
"Apache-2.0"
] | permissive | dobzhao/flatworm | 3ab2bfc354aa36a2b5d295e00dd03e0b45d33f39 | 4b9c03cf0b971159ba70e6fbe7c895ad485fa872 | refs/heads/master | 2021-01-06T08:56:44.296985 | 2020-03-31T01:43:17 | 2020-03-31T01:43:17 | 241,269,522 | 0 | 0 | null | 2020-02-18T04:10:23 | 2020-02-18T04:10:22 | null | UTF-8 | Java | false | false | 1,140 | java | /*
* Flatworm - A Java Flat File Importer/Exporter Copyright (C) 2004 James M. Turner.
* Extended by James Lawrence 2005
* Extended by Josh Brackett in 2011 and 2012
* Extended by Alan Henson in 2016
*
* 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.blackbear.flatworm.errors;
/**
* The exception thrown when a value is missing or inconsistent values are given
* in the configuration file.
*/
public class FlatwormParserException extends FlatwormException {
public FlatwormParserException(String s) {
super(s);
}
public FlatwormParserException(String s, Exception e) {
super(s, e);
}
} | [
"alan.henson@optifysoftware.com"
] | alan.henson@optifysoftware.com |
f801e0a38766f3615efadaa26d00df10d322a96e | 1a6319591f41a6ddb4c1afa382d358fb098b7aa5 | /src/main/java/eu/toolchain/swim/messages/Ack.java | b1314dd7926a164e525b1a0bacc338f1505a11cf | [] | no_license | udoprog/swim | e880fad63c7a116ba383ce463921b7f0d5c00ff5 | 689b732dca6a5cb57024861f309a439e20f11367 | refs/heads/master | 2023-08-07T15:18:55.452915 | 2015-03-09T04:26:39 | 2015-03-09T04:28:58 | 24,102,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package eu.toolchain.swim.messages;
import java.util.List;
import java.util.UUID;
import lombok.Data;
import eu.toolchain.swim.NodeState;
@Data
public class Ack implements Message {
private final UUID pingId;
private final NodeState state;
private final long inc;
private final List<Gossip> gossip;
} | [
"johnjohn.tedro@gmail.com"
] | johnjohn.tedro@gmail.com |
d335a979d6e61930b7afb2a0f02568791cf456ba | 4521b7da164a4f25d91ea30a02b106392530f2ba | /source/org.eclipse.ve.sweet/src/org/eclipse/ve/sweet/converters/TheIdentityConverter.java | 4514804ad485031ebafb1d58b6cdad0e015640eb | [] | no_license | minemeraj/Eclipse-Visual-Editor | 1c5f27865cf3abea0175d9f8e31ae94b9692570b | d9587146bd78b540f4ae51fe065de38f99b95bc7 | refs/heads/master | 2021-05-16T05:12:36.053539 | 2010-12-02T13:46:26 | 2010-12-02T13:46:26 | 106,251,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 944 | java | /*
* Copyright (C) 2005 db4objects Inc. http://www.db4o.com
*
* 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:
* db4objects - Initial API and implementation
*/
package org.eclipse.ve.sweet.converters;
import org.eclipse.ve.sweet.converter.IConverter;
/**
* TheIdentityConverter. Returns the source value (the identity function).
*
* @author djo
*/
public class TheIdentityConverter implements IConverter {
public static final IConverter IDENTITY = new TheIdentityConverter();
/* (non-Javadoc)
* @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object)
*/
public Object convert(Object source) {
if (source == null) {
return "";
}
return source;
}
}
| [
"dorme@f56db7ec-86c8-4192-a518-b33116ffafde"
] | dorme@f56db7ec-86c8-4192-a518-b33116ffafde |
f0cc461615f66b6ab4f591213d191ca5171f6c1e | b8aabed5b579f43e9c7057daf157de1471724964 | /app/src/main/java/com/jerry/p1activities/Surname.java | a558b2beb1ec153a244a79fc4a813da82ee1837d | [] | no_license | JerryDoom/P1Activities | a7828614c45e21ef20f4ea45e5cb4bbc5f9c8dc4 | 845fe6b3487894676cfdbce28c30325e0f986e93 | refs/heads/master | 2016-09-06T11:53:43.501147 | 2014-11-15T18:08:52 | 2014-11-15T18:08:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,569 | java | package com.jerry.p1activities;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import java.util.Timer;
import java.util.TimerTask;
import android.os.Handler;
public class Surname extends Activity {
//Variable
private String surname = null;
TextView tvSurname = null;
String white = "#ffffff";
String black = "#000000";
int bl = 0;
Timer timer;
TimerTask timerTask;
//we are going to use a handler to be able to run in our TimerTask
final Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_surname);
Intent i = getIntent();
surname = i.getStringExtra("surname");
tvSurname = (TextView) findViewById(R.id.lblSurname);
tvSurname.setText(surname);
}
@Override
protected void onResume() {
super.onResume();
//onResume we start our timer so it can start when the app comes from the background
startTimer();
}
public void startTimer() {
//set a new Timer
timer = new Timer();
//initialize the TimerTask's job
initializeTimerTask();
//schedule the timer, after the first 5000ms the TimerTask will run every 10000ms
timer.schedule(timerTask, 1000, 1000); //
}
public void initializeTimerTask() {
timerTask = new TimerTask() {
public void run() {
//use a handler to run a toast that shows the current timestamp
handler.post(new Runnable() {
public void run() {
if (bl == 0) {
tvSurname.setTextColor(Color.parseColor(black));
bl = 1;
}
else {
tvSurname.setTextColor(Color.parseColor(white));
bl = 0;
}
/*
//get the current timeStamp
Calendar calendar = Calendar.getInstance();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss a");
final String strDate = simpleDateFormat.format(calendar.getTime());
//show the toast
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(getApplicationContext(), strDate, duration);
toast.show();
*/
}
});
}
};
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_surname, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"gerardogh@live.com"
] | gerardogh@live.com |
0c458d9d1657731908e4e01e333b9151e91d9f21 | eb99261e5f32795fef06c24c6ecfb4e895e1aa64 | /src/example/im/server/src/main/java/org/tio/examples/im/service/BadWordService.java | d1e2e1188dc2bba79e84561a33cc61f6b5e216ac | [] | no_license | xu942122587/t-io | c7525f34431a3d90667016c8688b3c02e8d05c45 | 3faf1abd842b089eb4031b6a90e5d04cb6f99188 | refs/heads/master | 2021-01-24T07:43:14.774670 | 2017-06-05T01:31:35 | 2017-06-05T01:31:35 | 93,352,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,485 | java | package org.tio.examples.im.service;
import java.io.File;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.examples.im.server.ImServerStarter;
import com.xiaoleilu.hutool.dfa.WordTree;
import com.xiaoleilu.hutool.io.FileUtil;
/**
* @author tanyaowu
* 2017年5月29日 下午2:50:41
*/
public class BadWordService {
private static Logger log = LoggerFactory.getLogger(BadWordService.class);
public static final WordTree wordTree = new WordTree();
/**
*
* @author: tanyaowu
*/
public BadWordService() {
}
public static void initBadWord() {
String rootDirStr = FileUtil.getAbsolutePath("classpath:dict/");
File rootDir = new File(rootDirStr);
File[] files = rootDir.listFiles();
int count = 0;
if (files != null) {
for (File file : files) {
List<String> lines = FileUtil.readLines(file, "utf-8");
for (String line : lines) {
wordTree.addWord(line);
count++;
//log.error(line);
}
}
}
log.error("一共{}个敏感词", count);
}
/**
* 如果没匹配到就返回null,否则返回替换后的string
* @param initText
* @param replaceText
* @param logstr
* @return
* @author: tanyaowu
*/
public static String replaceBadWord(String initText, String replaceText, Object logstr) {
List<String> list = wordTree.matchAll(initText);
if (list != null && list.size() > 0) {
String ret = initText;
for (String word : list) {
ret = StringUtils.replaceAll(ret, word, replaceText);
}
if (logstr != null) {
log.error("{}, 找到敏感词,原文:【{}】,替换后的:【{}】", logstr, initText, ret);
} else {
log.error("找到敏感词,原文:【{}】,替换后的:【{}】", initText, ret);
}
return ret;
}
return null;
}
public static String replaceBadWord(String initText, String replaceText) {
return replaceBadWord(initText, replaceText, null);
}
public static String replaceWithDftReplace(String initText) {
return replaceBadWord(initText, ImServerStarter.conf.getString("dft.badword.replaceText"));
}
public static String replaceWithDftReplace(String initText, String logstr) {
return replaceBadWord(initText, ImServerStarter.conf.getString("dft.badword.replaceText"), logstr);
}
/**
* @param args
* @author: tanyaowu
*/
public static void main(String[] args) {
initBadWord();
replaceWithDftReplace("习近平dddd|sss");
}
}
| [
"942122587@qq.com"
] | 942122587@qq.com |
c1e493cb6538345e06e867e2bd2b8cdd3c020d6a | 9ba7547a4ef07980b422f9a1dcc1d2720d3ae9c8 | /pkpublish/src/com/smartsheet/tin/filters/pkpublish/ORCParserException.java | 746f0f0ee074cef44e3fe28792755d5e52e1519e | [
"Apache-2.0"
] | permissive | aishydevil12286/tungsten-plugins | ecdd5c39ea229980c767b743dec2d3335968c9a9 | 97bf8c0ee98121f836566169206c9b433e2cadb3 | refs/heads/master | 2020-04-01T15:53:58.600466 | 2015-07-20T21:02:16 | 2015-07-20T21:02:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | /**
* Copyright 2014-2015 Smartsheet.com, 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.smartsheet.tin.filters.pkpublish;
public class ORCParserException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public ORCParserException(String message) {
super(message);
}
}
| [
"scott.wimer@smartsheet.com"
] | scott.wimer@smartsheet.com |
f395ea860828f29dc72139a7908016190da2947f | 791b688ad958de203722f99f81c731dbfa6a561e | /src/main/java/com/opera/link/apilib/ApiParameters.java | 1d0c3d5a8558341d878c2a78328e60f22bee738f | [
"BSD-3-Clause"
] | permissive | dualsky/JavaOperaLinkClient | f4e64162a1d1cc2316ae7b65fe389fd69fe62209 | 80c0f7f57623a41f282c59d58822995862bf292a | refs/heads/master | 2020-12-24T23:48:56.439457 | 2011-05-09T09:24:03 | 2011-05-09T09:24:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package com.opera.link.apilib;
public class ApiParameters {
public static final String API_METHOD_PARAM = "api_method";
public static final String API_OUTPUT_PARAM = "api_output";
public static final String JSON_OUTPUT_PARAM = "json";
public static final String CREATE = "create";
public static final String UPDATE = "update";
public static final String DELETE = "delete";
public static final String TRASH = "trash";
public static final String MOVE = "move";
public static final String MOVE_POSITION_INTO = "inside";
public static final String MOVE_POSITION_AFTER = "after";
public static final String MOVE_POSITION_BEFORE = "before";
public static final String MOVE_REFERENCE_ITEM_PARAM = "reference_item";
public static final String MOVE_RELATIVE_POSITION_PARAM = "relative_position";
public static final String URL_GET_CHILDREN_PARAM = "children/";
public static final String URL_GET_DESCENDANTS_PARAM = "descendants/";
}
| [
"michael.link@opera.com"
] | michael.link@opera.com |
9f6291d10096c1264309f5c4e12cb6b7fa9fc9bf | 8b4c74e74336dc1e586c7dad0f1480321125ff54 | /src/com/bergerkiller/bukkit/nolagg/examine/NoLaggExamine.java | 8900727031f5a7905b90a642ca126e7f2c7ec111 | [] | no_license | BangL/NoLagg | f8b5a26c72da08d6b59f72d7b116b23ae26d3c5a | eefe25150e26f2cb2af8fd331211b9c30c81ffd0 | refs/heads/master | 2021-01-16T20:46:15.093802 | 2012-10-29T21:38:34 | 2012-10-29T21:38:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,159 | java | package com.bergerkiller.bukkit.nolagg.examine;
import net.minecraft.server.WorldServer;
import net.timedminecraft.server.TimedChunkProviderServer;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.bergerkiller.bukkit.common.config.ConfigurationNode;
import com.bergerkiller.bukkit.common.permissions.NoPermissionException;
import com.bergerkiller.bukkit.common.utils.CommonUtil;
import com.bergerkiller.bukkit.common.utils.MathUtil;
import com.bergerkiller.bukkit.common.utils.ParseUtil;
import com.bergerkiller.bukkit.common.utils.WorldUtil;
import com.bergerkiller.bukkit.nolagg.NoLaggComponent;
import com.bergerkiller.bukkit.nolagg.Permission;
public class NoLaggExamine extends NoLaggComponent {
public static NoLaggExamine plugin;
public static int maxExamineTime;
@Override
public void onEnable(ConfigurationNode config) {
plugin = this;
this.onReload(config);
for (WorldServer world : WorldUtil.getWorlds()) {
TimedChunkProviderServer.convert(world);
}
this.register(NLEListener.class);
SchedulerWatcher.init();
}
@Override
public void onDisable(ConfigurationNode config) {
SchedulerWatcher.deinit();
PluginLogger.stopTask();
for (WorldServer world : WorldUtil.getWorlds()) {
TimedChunkProviderServer.restore(world);
}
}
@Override
public void onReload(ConfigurationNode config) {
config.setHeader("maxExamineTime", "\nThe maximum time in ticks a generated examine report can be");
config.addHeader("maxExamineTime", "It can be increased, but the generated file might be too large for the viewer to handle");
maxExamineTime = config.get("maxExamineTime", 72000);
}
@Override
public boolean onCommand(CommandSender sender, String[] args) throws NoPermissionException {
if (args.length != 0) {
if (args[0].equalsIgnoreCase("examine")) {
int duration = MathUtil.clamp(500, maxExamineTime);
if (args.length >= 2) {
duration = ParseUtil.parseInt(args[1], duration);
}
if (sender instanceof Player) {
Permission.EXAMINE_RUN.handle(sender);
PluginLogger.recipients.add(sender.getName());
} else {
PluginLogger.recipients.add(null);
}
if (PluginLogger.isRunning()) {
CommonUtil.sendMessage(sender, ChatColor.RED + "The server is already being examined: " + PluginLogger.getDurPer() + "% completed");
CommonUtil.sendMessage(sender, ChatColor.GREEN + "You will be notified when the report has been generated");
} else if (duration > maxExamineTime) {
CommonUtil.sendMessage(sender, ChatColor.RED + "Examine duration of " + duration + " exceeded the maximum possible: " + maxExamineTime + " ticks");
} else {
PluginLogger.duration = duration;
PluginLogger.start();
CommonUtil.sendMessage(sender, ChatColor.GREEN + "The server will be examined for " + duration + " ticks (" + (duration / 20) + " seconds)");
CommonUtil.sendMessage(sender, ChatColor.GREEN + "You will be notified when the report has been generated");
}
return true;
}
}
return false;
}
}
| [
"bergerkiller@gmail.com"
] | bergerkiller@gmail.com |
deecfde84cb56285a2162004feb0e8a29e6b4ce8 | 308432772c54f34877d8a7dd4e6f78195c22ef02 | /src/main/java/org/databene/commons/accessor/NullSafeTypedAccessor.java | 54d0ce00df3eed61886b259b59957a7bd7bf01ac | [
"Apache-2.0"
] | permissive | aravindc/databenecommons | 6e8b914ac2a2bc334e4311331ddb1405e91ad746 | 6f8d2d7633b5c8a5dbf46d7a90e4ef83abd3ad3c | refs/heads/master | 2022-12-04T06:11:07.452197 | 2022-11-15T13:19:57 | 2022-11-15T13:19:57 | 84,325,921 | 1 | 1 | Apache-2.0 | 2022-11-15T13:19:58 | 2017-03-08T13:55:14 | Java | UTF-8 | Java | false | false | 1,343 | java | /*
* Copyright (C) 2004-2015 Volker Bergmann (volker.bergmann@bergmann-it.de).
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.databene.commons.accessor;
/**
* Typed Accessor that returns a default value if invoked on argument null.
* @param <C> the object type to access
* @param <V> the type of the value to get from the object
* Created: 22.02.2006 20:08:36
* @author Volker Bergmann
*/
public class NullSafeTypedAccessor<C, V> extends NullSafeAccessor<C, V> implements TypedAccessor<C, V> {
public NullSafeTypedAccessor(TypedAccessor<C, V> realAccessor, V nullValue) {
super(realAccessor, nullValue);
}
@Override
public Class<? extends V> getValueType() {
return ((TypedAccessor<C, V>) realAccessor).getValueType();
}
}
| [
"vbergmann@783448d1-dfc0-4521-9cb0-58c191f7d5bb"
] | vbergmann@783448d1-dfc0-4521-9cb0-58c191f7d5bb |
b32406879b99833dc8647c741381d64e769dd99f | 111c5ada9b0a19a006807bfd5bad77f1795560a5 | /app/src/test/java/com/example/sohelrana/test_git/ExampleUnitTest.java | 71e6c7a270703107aa7602cb5ca903e7cca113c6 | [] | no_license | Nirjhor3029/app_test | 7a2701201e461ff967c9bd594436b1884f9963dd | 876df2b397cc5b82ab2b4d6a2d398f4190c1b316 | refs/heads/master | 2020-04-13T10:04:22.623351 | 2018-12-26T03:16:15 | 2018-12-26T03:16:15 | 163,129,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.example.sohelrana.test_git;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"sazzad3029@gmail.com"
] | sazzad3029@gmail.com |
a8a8d5bdab3877617d552daf8b49525740449274 | ece443098abdc5fd32fc5c467a2bea4f16b97ec2 | /src/jan21/task6.java | a9b296f071d945674166210d45900a57698cba10 | [] | no_license | lazarevspb/javaPuzzles | 4ed2df654f6e5f0e23e8d1b5d8d81e64d6be31ab | eb7151fe3d1f004ad983f813c503fd6eda2babd2 | refs/heads/master | 2023-02-10T09:18:24.019812 | 2021-01-08T22:27:28 | 2021-01-08T22:27:28 | 328,004,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package jan21;
/*
Дан массив arr и целое число n. Переставьте все элементы массива таким образом,
чтобы выполнялись следующие условия:
все элементы, которые меньше n, помещаются перед элементами, которые не меньше n;
все элементы, которые меньше n, остаются в том же порядке относительно друг друга;
все элементы, которые не меньше n, остаются в том же порядке относительно друг друга.
На входе:
arr - массив чисел
n - целое число
На выходе: массив чисел
Пример:
arr = [3, 2, 7, 8, 1, 7, 3]
n = 3
rearrange( arr, n ) --> [2, 1, 3, 7, 8, 7, 3]*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class task6 {
public static void main(String[] args) {
System.out.println(rearrange(Arrays.asList(3, 2, 7, 8, 1, 7, 3), 3));
}
public static List<Integer> rearrange(List<Integer> arr, int k) {
List<Integer> result;
List<Integer> tmp = new ArrayList<>();
tmp.addAll(arr);
result = arr.stream().filter(integer -> integer < k).collect(Collectors.toList());
tmp.removeAll(result);
result.addAll(tmp);
return result;
}
}
| [
"v.lazarev.spb@gmail.com"
] | v.lazarev.spb@gmail.com |
a7371d250793fbc110e40ef5bf535579c182dc5d | cd3ccc969d6e31dce1a0cdc21de71899ab670a46 | /agp-7.1.0-alpha01/tools/base/build-system/integration-test/test-projects/multiDexWithLib/lib/src/main/java/com/android/tests/basic/manymethods/Big058.java | d6551a99800a089618803207cd531c7557a0e544 | [
"Apache-2.0"
] | permissive | jomof/CppBuildCacheWorkInProgress | 75e76e1bd1d8451e3ee31631e74f22e5bb15dd3c | 9e3475f6d94cb3239f27ed8f8ee81b0abde4ef51 | refs/heads/main | 2023-05-28T19:03:16.798422 | 2021-06-10T20:59:25 | 2021-06-10T20:59:25 | 374,736,765 | 0 | 1 | Apache-2.0 | 2021-06-07T21:06:53 | 2021-06-07T16:44:55 | Java | UTF-8 | Java | false | false | 53,466 | java | /*
* Copyright (C) 2014 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.tests.basic.manymethods;
public class Big058 {
public int get0() {
return 0;
}
public int get1() {
return 1;
}
public int get2() {
return 2;
}
public int get3() {
return 3;
}
public int get4() {
return 4;
}
public int get5() {
return 5;
}
public int get6() {
return 6;
}
public int get7() {
return 7;
}
public int get8() {
return 8;
}
public int get9() {
return 9;
}
public int get10() {
return 10;
}
public int get11() {
return 11;
}
public int get12() {
return 12;
}
public int get13() {
return 13;
}
public int get14() {
return 14;
}
public int get15() {
return 15;
}
public int get16() {
return 16;
}
public int get17() {
return 17;
}
public int get18() {
return 18;
}
public int get19() {
return 19;
}
public int get20() {
return 20;
}
public int get21() {
return 21;
}
public int get22() {
return 22;
}
public int get23() {
return 23;
}
public int get24() {
return 24;
}
public int get25() {
return 25;
}
public int get26() {
return 26;
}
public int get27() {
return 27;
}
public int get28() {
return 28;
}
public int get29() {
return 29;
}
public int get30() {
return 30;
}
public int get31() {
return 31;
}
public int get32() {
return 32;
}
public int get33() {
return 33;
}
public int get34() {
return 34;
}
public int get35() {
return 35;
}
public int get36() {
return 36;
}
public int get37() {
return 37;
}
public int get38() {
return 38;
}
public int get39() {
return 39;
}
public int get40() {
return 40;
}
public int get41() {
return 41;
}
public int get42() {
return 42;
}
public int get43() {
return 43;
}
public int get44() {
return 44;
}
public int get45() {
return 45;
}
public int get46() {
return 46;
}
public int get47() {
return 47;
}
public int get48() {
return 48;
}
public int get49() {
return 49;
}
public int get50() {
return 50;
}
public int get51() {
return 51;
}
public int get52() {
return 52;
}
public int get53() {
return 53;
}
public int get54() {
return 54;
}
public int get55() {
return 55;
}
public int get56() {
return 56;
}
public int get57() {
return 57;
}
public int get58() {
return 58;
}
public int get59() {
return 59;
}
public int get60() {
return 60;
}
public int get61() {
return 61;
}
public int get62() {
return 62;
}
public int get63() {
return 63;
}
public int get64() {
return 64;
}
public int get65() {
return 65;
}
public int get66() {
return 66;
}
public int get67() {
return 67;
}
public int get68() {
return 68;
}
public int get69() {
return 69;
}
public int get70() {
return 70;
}
public int get71() {
return 71;
}
public int get72() {
return 72;
}
public int get73() {
return 73;
}
public int get74() {
return 74;
}
public int get75() {
return 75;
}
public int get76() {
return 76;
}
public int get77() {
return 77;
}
public int get78() {
return 78;
}
public int get79() {
return 79;
}
public int get80() {
return 80;
}
public int get81() {
return 81;
}
public int get82() {
return 82;
}
public int get83() {
return 83;
}
public int get84() {
return 84;
}
public int get85() {
return 85;
}
public int get86() {
return 86;
}
public int get87() {
return 87;
}
public int get88() {
return 88;
}
public int get89() {
return 89;
}
public int get90() {
return 90;
}
public int get91() {
return 91;
}
public int get92() {
return 92;
}
public int get93() {
return 93;
}
public int get94() {
return 94;
}
public int get95() {
return 95;
}
public int get96() {
return 96;
}
public int get97() {
return 97;
}
public int get98() {
return 98;
}
public int get99() {
return 99;
}
public int get100() {
return 100;
}
public int get101() {
return 101;
}
public int get102() {
return 102;
}
public int get103() {
return 103;
}
public int get104() {
return 104;
}
public int get105() {
return 105;
}
public int get106() {
return 106;
}
public int get107() {
return 107;
}
public int get108() {
return 108;
}
public int get109() {
return 109;
}
public int get110() {
return 110;
}
public int get111() {
return 111;
}
public int get112() {
return 112;
}
public int get113() {
return 113;
}
public int get114() {
return 114;
}
public int get115() {
return 115;
}
public int get116() {
return 116;
}
public int get117() {
return 117;
}
public int get118() {
return 118;
}
public int get119() {
return 119;
}
public int get120() {
return 120;
}
public int get121() {
return 121;
}
public int get122() {
return 122;
}
public int get123() {
return 123;
}
public int get124() {
return 124;
}
public int get125() {
return 125;
}
public int get126() {
return 126;
}
public int get127() {
return 127;
}
public int get128() {
return 128;
}
public int get129() {
return 129;
}
public int get130() {
return 130;
}
public int get131() {
return 131;
}
public int get132() {
return 132;
}
public int get133() {
return 133;
}
public int get134() {
return 134;
}
public int get135() {
return 135;
}
public int get136() {
return 136;
}
public int get137() {
return 137;
}
public int get138() {
return 138;
}
public int get139() {
return 139;
}
public int get140() {
return 140;
}
public int get141() {
return 141;
}
public int get142() {
return 142;
}
public int get143() {
return 143;
}
public int get144() {
return 144;
}
public int get145() {
return 145;
}
public int get146() {
return 146;
}
public int get147() {
return 147;
}
public int get148() {
return 148;
}
public int get149() {
return 149;
}
public int get150() {
return 150;
}
public int get151() {
return 151;
}
public int get152() {
return 152;
}
public int get153() {
return 153;
}
public int get154() {
return 154;
}
public int get155() {
return 155;
}
public int get156() {
return 156;
}
public int get157() {
return 157;
}
public int get158() {
return 158;
}
public int get159() {
return 159;
}
public int get160() {
return 160;
}
public int get161() {
return 161;
}
public int get162() {
return 162;
}
public int get163() {
return 163;
}
public int get164() {
return 164;
}
public int get165() {
return 165;
}
public int get166() {
return 166;
}
public int get167() {
return 167;
}
public int get168() {
return 168;
}
public int get169() {
return 169;
}
public int get170() {
return 170;
}
public int get171() {
return 171;
}
public int get172() {
return 172;
}
public int get173() {
return 173;
}
public int get174() {
return 174;
}
public int get175() {
return 175;
}
public int get176() {
return 176;
}
public int get177() {
return 177;
}
public int get178() {
return 178;
}
public int get179() {
return 179;
}
public int get180() {
return 180;
}
public int get181() {
return 181;
}
public int get182() {
return 182;
}
public int get183() {
return 183;
}
public int get184() {
return 184;
}
public int get185() {
return 185;
}
public int get186() {
return 186;
}
public int get187() {
return 187;
}
public int get188() {
return 188;
}
public int get189() {
return 189;
}
public int get190() {
return 190;
}
public int get191() {
return 191;
}
public int get192() {
return 192;
}
public int get193() {
return 193;
}
public int get194() {
return 194;
}
public int get195() {
return 195;
}
public int get196() {
return 196;
}
public int get197() {
return 197;
}
public int get198() {
return 198;
}
public int get199() {
return 199;
}
public int get200() {
return 200;
}
public int get201() {
return 201;
}
public int get202() {
return 202;
}
public int get203() {
return 203;
}
public int get204() {
return 204;
}
public int get205() {
return 205;
}
public int get206() {
return 206;
}
public int get207() {
return 207;
}
public int get208() {
return 208;
}
public int get209() {
return 209;
}
public int get210() {
return 210;
}
public int get211() {
return 211;
}
public int get212() {
return 212;
}
public int get213() {
return 213;
}
public int get214() {
return 214;
}
public int get215() {
return 215;
}
public int get216() {
return 216;
}
public int get217() {
return 217;
}
public int get218() {
return 218;
}
public int get219() {
return 219;
}
public int get220() {
return 220;
}
public int get221() {
return 221;
}
public int get222() {
return 222;
}
public int get223() {
return 223;
}
public int get224() {
return 224;
}
public int get225() {
return 225;
}
public int get226() {
return 226;
}
public int get227() {
return 227;
}
public int get228() {
return 228;
}
public int get229() {
return 229;
}
public int get230() {
return 230;
}
public int get231() {
return 231;
}
public int get232() {
return 232;
}
public int get233() {
return 233;
}
public int get234() {
return 234;
}
public int get235() {
return 235;
}
public int get236() {
return 236;
}
public int get237() {
return 237;
}
public int get238() {
return 238;
}
public int get239() {
return 239;
}
public int get240() {
return 240;
}
public int get241() {
return 241;
}
public int get242() {
return 242;
}
public int get243() {
return 243;
}
public int get244() {
return 244;
}
public int get245() {
return 245;
}
public int get246() {
return 246;
}
public int get247() {
return 247;
}
public int get248() {
return 248;
}
public int get249() {
return 249;
}
public int get250() {
return 250;
}
public int get251() {
return 251;
}
public int get252() {
return 252;
}
public int get253() {
return 253;
}
public int get254() {
return 254;
}
public int get255() {
return 255;
}
public int get256() {
return 256;
}
public int get257() {
return 257;
}
public int get258() {
return 258;
}
public int get259() {
return 259;
}
public int get260() {
return 260;
}
public int get261() {
return 261;
}
public int get262() {
return 262;
}
public int get263() {
return 263;
}
public int get264() {
return 264;
}
public int get265() {
return 265;
}
public int get266() {
return 266;
}
public int get267() {
return 267;
}
public int get268() {
return 268;
}
public int get269() {
return 269;
}
public int get270() {
return 270;
}
public int get271() {
return 271;
}
public int get272() {
return 272;
}
public int get273() {
return 273;
}
public int get274() {
return 274;
}
public int get275() {
return 275;
}
public int get276() {
return 276;
}
public int get277() {
return 277;
}
public int get278() {
return 278;
}
public int get279() {
return 279;
}
public int get280() {
return 280;
}
public int get281() {
return 281;
}
public int get282() {
return 282;
}
public int get283() {
return 283;
}
public int get284() {
return 284;
}
public int get285() {
return 285;
}
public int get286() {
return 286;
}
public int get287() {
return 287;
}
public int get288() {
return 288;
}
public int get289() {
return 289;
}
public int get290() {
return 290;
}
public int get291() {
return 291;
}
public int get292() {
return 292;
}
public int get293() {
return 293;
}
public int get294() {
return 294;
}
public int get295() {
return 295;
}
public int get296() {
return 296;
}
public int get297() {
return 297;
}
public int get298() {
return 298;
}
public int get299() {
return 299;
}
public int get300() {
return 300;
}
public int get301() {
return 301;
}
public int get302() {
return 302;
}
public int get303() {
return 303;
}
public int get304() {
return 304;
}
public int get305() {
return 305;
}
public int get306() {
return 306;
}
public int get307() {
return 307;
}
public int get308() {
return 308;
}
public int get309() {
return 309;
}
public int get310() {
return 310;
}
public int get311() {
return 311;
}
public int get312() {
return 312;
}
public int get313() {
return 313;
}
public int get314() {
return 314;
}
public int get315() {
return 315;
}
public int get316() {
return 316;
}
public int get317() {
return 317;
}
public int get318() {
return 318;
}
public int get319() {
return 319;
}
public int get320() {
return 320;
}
public int get321() {
return 321;
}
public int get322() {
return 322;
}
public int get323() {
return 323;
}
public int get324() {
return 324;
}
public int get325() {
return 325;
}
public int get326() {
return 326;
}
public int get327() {
return 327;
}
public int get328() {
return 328;
}
public int get329() {
return 329;
}
public int get330() {
return 330;
}
public int get331() {
return 331;
}
public int get332() {
return 332;
}
public int get333() {
return 333;
}
public int get334() {
return 334;
}
public int get335() {
return 335;
}
public int get336() {
return 336;
}
public int get337() {
return 337;
}
public int get338() {
return 338;
}
public int get339() {
return 339;
}
public int get340() {
return 340;
}
public int get341() {
return 341;
}
public int get342() {
return 342;
}
public int get343() {
return 343;
}
public int get344() {
return 344;
}
public int get345() {
return 345;
}
public int get346() {
return 346;
}
public int get347() {
return 347;
}
public int get348() {
return 348;
}
public int get349() {
return 349;
}
public int get350() {
return 350;
}
public int get351() {
return 351;
}
public int get352() {
return 352;
}
public int get353() {
return 353;
}
public int get354() {
return 354;
}
public int get355() {
return 355;
}
public int get356() {
return 356;
}
public int get357() {
return 357;
}
public int get358() {
return 358;
}
public int get359() {
return 359;
}
public int get360() {
return 360;
}
public int get361() {
return 361;
}
public int get362() {
return 362;
}
public int get363() {
return 363;
}
public int get364() {
return 364;
}
public int get365() {
return 365;
}
public int get366() {
return 366;
}
public int get367() {
return 367;
}
public int get368() {
return 368;
}
public int get369() {
return 369;
}
public int get370() {
return 370;
}
public int get371() {
return 371;
}
public int get372() {
return 372;
}
public int get373() {
return 373;
}
public int get374() {
return 374;
}
public int get375() {
return 375;
}
public int get376() {
return 376;
}
public int get377() {
return 377;
}
public int get378() {
return 378;
}
public int get379() {
return 379;
}
public int get380() {
return 380;
}
public int get381() {
return 381;
}
public int get382() {
return 382;
}
public int get383() {
return 383;
}
public int get384() {
return 384;
}
public int get385() {
return 385;
}
public int get386() {
return 386;
}
public int get387() {
return 387;
}
public int get388() {
return 388;
}
public int get389() {
return 389;
}
public int get390() {
return 390;
}
public int get391() {
return 391;
}
public int get392() {
return 392;
}
public int get393() {
return 393;
}
public int get394() {
return 394;
}
public int get395() {
return 395;
}
public int get396() {
return 396;
}
public int get397() {
return 397;
}
public int get398() {
return 398;
}
public int get399() {
return 399;
}
public int get400() {
return 400;
}
public int get401() {
return 401;
}
public int get402() {
return 402;
}
public int get403() {
return 403;
}
public int get404() {
return 404;
}
public int get405() {
return 405;
}
public int get406() {
return 406;
}
public int get407() {
return 407;
}
public int get408() {
return 408;
}
public int get409() {
return 409;
}
public int get410() {
return 410;
}
public int get411() {
return 411;
}
public int get412() {
return 412;
}
public int get413() {
return 413;
}
public int get414() {
return 414;
}
public int get415() {
return 415;
}
public int get416() {
return 416;
}
public int get417() {
return 417;
}
public int get418() {
return 418;
}
public int get419() {
return 419;
}
public int get420() {
return 420;
}
public int get421() {
return 421;
}
public int get422() {
return 422;
}
public int get423() {
return 423;
}
public int get424() {
return 424;
}
public int get425() {
return 425;
}
public int get426() {
return 426;
}
public int get427() {
return 427;
}
public int get428() {
return 428;
}
public int get429() {
return 429;
}
public int get430() {
return 430;
}
public int get431() {
return 431;
}
public int get432() {
return 432;
}
public int get433() {
return 433;
}
public int get434() {
return 434;
}
public int get435() {
return 435;
}
public int get436() {
return 436;
}
public int get437() {
return 437;
}
public int get438() {
return 438;
}
public int get439() {
return 439;
}
public int get440() {
return 440;
}
public int get441() {
return 441;
}
public int get442() {
return 442;
}
public int get443() {
return 443;
}
public int get444() {
return 444;
}
public int get445() {
return 445;
}
public int get446() {
return 446;
}
public int get447() {
return 447;
}
public int get448() {
return 448;
}
public int get449() {
return 449;
}
public int get450() {
return 450;
}
public int get451() {
return 451;
}
public int get452() {
return 452;
}
public int get453() {
return 453;
}
public int get454() {
return 454;
}
public int get455() {
return 455;
}
public int get456() {
return 456;
}
public int get457() {
return 457;
}
public int get458() {
return 458;
}
public int get459() {
return 459;
}
public int get460() {
return 460;
}
public int get461() {
return 461;
}
public int get462() {
return 462;
}
public int get463() {
return 463;
}
public int get464() {
return 464;
}
public int get465() {
return 465;
}
public int get466() {
return 466;
}
public int get467() {
return 467;
}
public int get468() {
return 468;
}
public int get469() {
return 469;
}
public int get470() {
return 470;
}
public int get471() {
return 471;
}
public int get472() {
return 472;
}
public int get473() {
return 473;
}
public int get474() {
return 474;
}
public int get475() {
return 475;
}
public int get476() {
return 476;
}
public int get477() {
return 477;
}
public int get478() {
return 478;
}
public int get479() {
return 479;
}
public int get480() {
return 480;
}
public int get481() {
return 481;
}
public int get482() {
return 482;
}
public int get483() {
return 483;
}
public int get484() {
return 484;
}
public int get485() {
return 485;
}
public int get486() {
return 486;
}
public int get487() {
return 487;
}
public int get488() {
return 488;
}
public int get489() {
return 489;
}
public int get490() {
return 490;
}
public int get491() {
return 491;
}
public int get492() {
return 492;
}
public int get493() {
return 493;
}
public int get494() {
return 494;
}
public int get495() {
return 495;
}
public int get496() {
return 496;
}
public int get497() {
return 497;
}
public int get498() {
return 498;
}
public int get499() {
return 499;
}
public int get500() {
return 500;
}
public int get501() {
return 501;
}
public int get502() {
return 502;
}
public int get503() {
return 503;
}
public int get504() {
return 504;
}
public int get505() {
return 505;
}
public int get506() {
return 506;
}
public int get507() {
return 507;
}
public int get508() {
return 508;
}
public int get509() {
return 509;
}
public int get510() {
return 510;
}
public int get511() {
return 511;
}
public int get512() {
return 512;
}
public int get513() {
return 513;
}
public int get514() {
return 514;
}
public int get515() {
return 515;
}
public int get516() {
return 516;
}
public int get517() {
return 517;
}
public int get518() {
return 518;
}
public int get519() {
return 519;
}
public int get520() {
return 520;
}
public int get521() {
return 521;
}
public int get522() {
return 522;
}
public int get523() {
return 523;
}
public int get524() {
return 524;
}
public int get525() {
return 525;
}
public int get526() {
return 526;
}
public int get527() {
return 527;
}
public int get528() {
return 528;
}
public int get529() {
return 529;
}
public int get530() {
return 530;
}
public int get531() {
return 531;
}
public int get532() {
return 532;
}
public int get533() {
return 533;
}
public int get534() {
return 534;
}
public int get535() {
return 535;
}
public int get536() {
return 536;
}
public int get537() {
return 537;
}
public int get538() {
return 538;
}
public int get539() {
return 539;
}
public int get540() {
return 540;
}
public int get541() {
return 541;
}
public int get542() {
return 542;
}
public int get543() {
return 543;
}
public int get544() {
return 544;
}
public int get545() {
return 545;
}
public int get546() {
return 546;
}
public int get547() {
return 547;
}
public int get548() {
return 548;
}
public int get549() {
return 549;
}
public int get550() {
return 550;
}
public int get551() {
return 551;
}
public int get552() {
return 552;
}
public int get553() {
return 553;
}
public int get554() {
return 554;
}
public int get555() {
return 555;
}
public int get556() {
return 556;
}
public int get557() {
return 557;
}
public int get558() {
return 558;
}
public int get559() {
return 559;
}
public int get560() {
return 560;
}
public int get561() {
return 561;
}
public int get562() {
return 562;
}
public int get563() {
return 563;
}
public int get564() {
return 564;
}
public int get565() {
return 565;
}
public int get566() {
return 566;
}
public int get567() {
return 567;
}
public int get568() {
return 568;
}
public int get569() {
return 569;
}
public int get570() {
return 570;
}
public int get571() {
return 571;
}
public int get572() {
return 572;
}
public int get573() {
return 573;
}
public int get574() {
return 574;
}
public int get575() {
return 575;
}
public int get576() {
return 576;
}
public int get577() {
return 577;
}
public int get578() {
return 578;
}
public int get579() {
return 579;
}
public int get580() {
return 580;
}
public int get581() {
return 581;
}
public int get582() {
return 582;
}
public int get583() {
return 583;
}
public int get584() {
return 584;
}
public int get585() {
return 585;
}
public int get586() {
return 586;
}
public int get587() {
return 587;
}
public int get588() {
return 588;
}
public int get589() {
return 589;
}
public int get590() {
return 590;
}
public int get591() {
return 591;
}
public int get592() {
return 592;
}
public int get593() {
return 593;
}
public int get594() {
return 594;
}
public int get595() {
return 595;
}
public int get596() {
return 596;
}
public int get597() {
return 597;
}
public int get598() {
return 598;
}
public int get599() {
return 599;
}
public int get600() {
return 600;
}
public int get601() {
return 601;
}
public int get602() {
return 602;
}
public int get603() {
return 603;
}
public int get604() {
return 604;
}
public int get605() {
return 605;
}
public int get606() {
return 606;
}
public int get607() {
return 607;
}
public int get608() {
return 608;
}
public int get609() {
return 609;
}
public int get610() {
return 610;
}
public int get611() {
return 611;
}
public int get612() {
return 612;
}
public int get613() {
return 613;
}
public int get614() {
return 614;
}
public int get615() {
return 615;
}
public int get616() {
return 616;
}
public int get617() {
return 617;
}
public int get618() {
return 618;
}
public int get619() {
return 619;
}
public int get620() {
return 620;
}
public int get621() {
return 621;
}
public int get622() {
return 622;
}
public int get623() {
return 623;
}
public int get624() {
return 624;
}
public int get625() {
return 625;
}
public int get626() {
return 626;
}
public int get627() {
return 627;
}
public int get628() {
return 628;
}
public int get629() {
return 629;
}
public int get630() {
return 630;
}
public int get631() {
return 631;
}
public int get632() {
return 632;
}
public int get633() {
return 633;
}
public int get634() {
return 634;
}
public int get635() {
return 635;
}
public int get636() {
return 636;
}
public int get637() {
return 637;
}
public int get638() {
return 638;
}
public int get639() {
return 639;
}
public int get640() {
return 640;
}
public int get641() {
return 641;
}
public int get642() {
return 642;
}
public int get643() {
return 643;
}
public int get644() {
return 644;
}
public int get645() {
return 645;
}
public int get646() {
return 646;
}
public int get647() {
return 647;
}
public int get648() {
return 648;
}
public int get649() {
return 649;
}
public int get650() {
return 650;
}
public int get651() {
return 651;
}
public int get652() {
return 652;
}
public int get653() {
return 653;
}
public int get654() {
return 654;
}
public int get655() {
return 655;
}
public int get656() {
return 656;
}
public int get657() {
return 657;
}
public int get658() {
return 658;
}
public int get659() {
return 659;
}
public int get660() {
return 660;
}
public int get661() {
return 661;
}
public int get662() {
return 662;
}
public int get663() {
return 663;
}
public int get664() {
return 664;
}
public int get665() {
return 665;
}
public int get666() {
return 666;
}
public int get667() {
return 667;
}
public int get668() {
return 668;
}
public int get669() {
return 669;
}
public int get670() {
return 670;
}
public int get671() {
return 671;
}
public int get672() {
return 672;
}
public int get673() {
return 673;
}
public int get674() {
return 674;
}
public int get675() {
return 675;
}
public int get676() {
return 676;
}
public int get677() {
return 677;
}
public int get678() {
return 678;
}
public int get679() {
return 679;
}
public int get680() {
return 680;
}
public int get681() {
return 681;
}
public int get682() {
return 682;
}
public int get683() {
return 683;
}
public int get684() {
return 684;
}
public int get685() {
return 685;
}
public int get686() {
return 686;
}
public int get687() {
return 687;
}
public int get688() {
return 688;
}
public int get689() {
return 689;
}
public int get690() {
return 690;
}
public int get691() {
return 691;
}
public int get692() {
return 692;
}
public int get693() {
return 693;
}
public int get694() {
return 694;
}
public int get695() {
return 695;
}
public int get696() {
return 696;
}
public int get697() {
return 697;
}
public int get698() {
return 698;
}
public int get699() {
return 699;
}
public int get700() {
return 700;
}
public int get701() {
return 701;
}
public int get702() {
return 702;
}
public int get703() {
return 703;
}
public int get704() {
return 704;
}
public int get705() {
return 705;
}
public int get706() {
return 706;
}
public int get707() {
return 707;
}
public int get708() {
return 708;
}
public int get709() {
return 709;
}
public int get710() {
return 710;
}
public int get711() {
return 711;
}
public int get712() {
return 712;
}
public int get713() {
return 713;
}
public int get714() {
return 714;
}
public int get715() {
return 715;
}
public int get716() {
return 716;
}
public int get717() {
return 717;
}
public int get718() {
return 718;
}
public int get719() {
return 719;
}
public int get720() {
return 720;
}
public int get721() {
return 721;
}
public int get722() {
return 722;
}
public int get723() {
return 723;
}
public int get724() {
return 724;
}
public int get725() {
return 725;
}
public int get726() {
return 726;
}
public int get727() {
return 727;
}
public int get728() {
return 728;
}
public int get729() {
return 729;
}
public int get730() {
return 730;
}
public int get731() {
return 731;
}
public int get732() {
return 732;
}
public int get733() {
return 733;
}
public int get734() {
return 734;
}
public int get735() {
return 735;
}
public int get736() {
return 736;
}
public int get737() {
return 737;
}
public int get738() {
return 738;
}
public int get739() {
return 739;
}
public int get740() {
return 740;
}
public int get741() {
return 741;
}
public int get742() {
return 742;
}
public int get743() {
return 743;
}
public int get744() {
return 744;
}
public int get745() {
return 745;
}
public int get746() {
return 746;
}
public int get747() {
return 747;
}
public int get748() {
return 748;
}
public int get749() {
return 749;
}
public int get750() {
return 750;
}
public int get751() {
return 751;
}
public int get752() {
return 752;
}
public int get753() {
return 753;
}
public int get754() {
return 754;
}
public int get755() {
return 755;
}
public int get756() {
return 756;
}
public int get757() {
return 757;
}
public int get758() {
return 758;
}
public int get759() {
return 759;
}
public int get760() {
return 760;
}
public int get761() {
return 761;
}
public int get762() {
return 762;
}
public int get763() {
return 763;
}
public int get764() {
return 764;
}
public int get765() {
return 765;
}
public int get766() {
return 766;
}
public int get767() {
return 767;
}
public int get768() {
return 768;
}
public int get769() {
return 769;
}
public int get770() {
return 770;
}
public int get771() {
return 771;
}
public int get772() {
return 772;
}
public int get773() {
return 773;
}
public int get774() {
return 774;
}
public int get775() {
return 775;
}
public int get776() {
return 776;
}
public int get777() {
return 777;
}
public int get778() {
return 778;
}
public int get779() {
return 779;
}
public int get780() {
return 780;
}
public int get781() {
return 781;
}
public int get782() {
return 782;
}
public int get783() {
return 783;
}
public int get784() {
return 784;
}
public int get785() {
return 785;
}
public int get786() {
return 786;
}
public int get787() {
return 787;
}
public int get788() {
return 788;
}
public int get789() {
return 789;
}
public int get790() {
return 790;
}
public int get791() {
return 791;
}
public int get792() {
return 792;
}
public int get793() {
return 793;
}
public int get794() {
return 794;
}
public int get795() {
return 795;
}
public int get796() {
return 796;
}
public int get797() {
return 797;
}
public int get798() {
return 798;
}
public int get799() {
return 799;
}
public int get800() {
return 800;
}
public int get801() {
return 801;
}
public int get802() {
return 802;
}
public int get803() {
return 803;
}
public int get804() {
return 804;
}
public int get805() {
return 805;
}
public int get806() {
return 806;
}
public int get807() {
return 807;
}
public int get808() {
return 808;
}
public int get809() {
return 809;
}
public int get810() {
return 810;
}
public int get811() {
return 811;
}
public int get812() {
return 812;
}
public int get813() {
return 813;
}
public int get814() {
return 814;
}
public int get815() {
return 815;
}
public int get816() {
return 816;
}
public int get817() {
return 817;
}
public int get818() {
return 818;
}
public int get819() {
return 819;
}
public int get820() {
return 820;
}
public int get821() {
return 821;
}
public int get822() {
return 822;
}
public int get823() {
return 823;
}
public int get824() {
return 824;
}
public int get825() {
return 825;
}
public int get826() {
return 826;
}
public int get827() {
return 827;
}
public int get828() {
return 828;
}
public int get829() {
return 829;
}
public int get830() {
return 830;
}
public int get831() {
return 831;
}
public int get832() {
return 832;
}
public int get833() {
return 833;
}
public int get834() {
return 834;
}
public int get835() {
return 835;
}
public int get836() {
return 836;
}
public int get837() {
return 837;
}
public int get838() {
return 838;
}
public int get839() {
return 839;
}
public int get840() {
return 840;
}
public int get841() {
return 841;
}
public int get842() {
return 842;
}
public int get843() {
return 843;
}
public int get844() {
return 844;
}
public int get845() {
return 845;
}
public int get846() {
return 846;
}
public int get847() {
return 847;
}
public int get848() {
return 848;
}
public int get849() {
return 849;
}
public int get850() {
return 850;
}
public int get851() {
return 851;
}
public int get852() {
return 852;
}
public int get853() {
return 853;
}
public int get854() {
return 854;
}
public int get855() {
return 855;
}
public int get856() {
return 856;
}
public int get857() {
return 857;
}
public int get858() {
return 858;
}
public int get859() {
return 859;
}
public int get860() {
return 860;
}
public int get861() {
return 861;
}
public int get862() {
return 862;
}
public int get863() {
return 863;
}
public int get864() {
return 864;
}
public int get865() {
return 865;
}
public int get866() {
return 866;
}
public int get867() {
return 867;
}
public int get868() {
return 868;
}
public int get869() {
return 869;
}
public int get870() {
return 870;
}
public int get871() {
return 871;
}
public int get872() {
return 872;
}
public int get873() {
return 873;
}
public int get874() {
return 874;
}
public int get875() {
return 875;
}
public int get876() {
return 876;
}
public int get877() {
return 877;
}
public int get878() {
return 878;
}
public int get879() {
return 879;
}
public int get880() {
return 880;
}
public int get881() {
return 881;
}
public int get882() {
return 882;
}
public int get883() {
return 883;
}
public int get884() {
return 884;
}
public int get885() {
return 885;
}
public int get886() {
return 886;
}
public int get887() {
return 887;
}
public int get888() {
return 888;
}
public int get889() {
return 889;
}
public int get890() {
return 890;
}
public int get891() {
return 891;
}
public int get892() {
return 892;
}
public int get893() {
return 893;
}
public int get894() {
return 894;
}
public int get895() {
return 895;
}
public int get896() {
return 896;
}
public int get897() {
return 897;
}
public int get898() {
return 898;
}
public int get899() {
return 899;
}
public int get900() {
return 900;
}
public int get901() {
return 901;
}
public int get902() {
return 902;
}
public int get903() {
return 903;
}
public int get904() {
return 904;
}
public int get905() {
return 905;
}
public int get906() {
return 906;
}
public int get907() {
return 907;
}
public int get908() {
return 908;
}
public int get909() {
return 909;
}
public int get910() {
return 910;
}
public int get911() {
return 911;
}
public int get912() {
return 912;
}
public int get913() {
return 913;
}
public int get914() {
return 914;
}
public int get915() {
return 915;
}
public int get916() {
return 916;
}
public int get917() {
return 917;
}
public int get918() {
return 918;
}
public int get919() {
return 919;
}
public int get920() {
return 920;
}
public int get921() {
return 921;
}
public int get922() {
return 922;
}
public int get923() {
return 923;
}
public int get924() {
return 924;
}
public int get925() {
return 925;
}
public int get926() {
return 926;
}
public int get927() {
return 927;
}
public int get928() {
return 928;
}
public int get929() {
return 929;
}
public int get930() {
return 930;
}
public int get931() {
return 931;
}
public int get932() {
return 932;
}
public int get933() {
return 933;
}
public int get934() {
return 934;
}
public int get935() {
return 935;
}
public int get936() {
return 936;
}
public int get937() {
return 937;
}
public int get938() {
return 938;
}
public int get939() {
return 939;
}
public int get940() {
return 940;
}
public int get941() {
return 941;
}
public int get942() {
return 942;
}
public int get943() {
return 943;
}
public int get944() {
return 944;
}
public int get945() {
return 945;
}
public int get946() {
return 946;
}
public int get947() {
return 947;
}
public int get948() {
return 948;
}
public int get949() {
return 949;
}
public int get950() {
return 950;
}
public int get951() {
return 951;
}
public int get952() {
return 952;
}
public int get953() {
return 953;
}
public int get954() {
return 954;
}
public int get955() {
return 955;
}
public int get956() {
return 956;
}
public int get957() {
return 957;
}
public int get958() {
return 958;
}
public int get959() {
return 959;
}
public int get960() {
return 960;
}
public int get961() {
return 961;
}
public int get962() {
return 962;
}
public int get963() {
return 963;
}
public int get964() {
return 964;
}
public int get965() {
return 965;
}
public int get966() {
return 966;
}
public int get967() {
return 967;
}
public int get968() {
return 968;
}
public int get969() {
return 969;
}
public int get970() {
return 970;
}
public int get971() {
return 971;
}
public int get972() {
return 972;
}
public int get973() {
return 973;
}
public int get974() {
return 974;
}
public int get975() {
return 975;
}
public int get976() {
return 976;
}
public int get977() {
return 977;
}
public int get978() {
return 978;
}
public int get979() {
return 979;
}
public int get980() {
return 980;
}
public int get981() {
return 981;
}
public int get982() {
return 982;
}
public int get983() {
return 983;
}
public int get984() {
return 984;
}
public int get985() {
return 985;
}
public int get986() {
return 986;
}
public int get987() {
return 987;
}
public int get988() {
return 988;
}
public int get989() {
return 989;
}
public int get990() {
return 990;
}
public int get991() {
return 991;
}
public int get992() {
return 992;
}
public int get993() {
return 993;
}
public int get994() {
return 994;
}
public int get995() {
return 995;
}
public int get996() {
return 996;
}
public int get997() {
return 997;
}
public int get998() {
return 998;
}
public int get999() {
return 999;
}
}
| [
"jomof@google.com"
] | jomof@google.com |
c169f0a8bf4afc7dd223b54bfabef2cb71b0cf2e | 3c7acb8335f2393b6356e9c9ece0cf0c548e79d3 | /app/src/test/java/com/app/hci/flyhigh/ExampleUnitTest.java | f889406a5d4cca7333062bd26f2872bd010ec66c | [] | no_license | axelfratoni/FlyHigh-Android-App | b6a81f40a2b9b43a4002241d24aa7dead706cf19 | c011535e8e707cb6f4f8e940b31c5991e9e7dade | refs/heads/master | 2021-01-23T18:31:42.983484 | 2017-09-08T00:32:35 | 2017-09-08T00:32:35 | 102,798,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.app.hci.flyhigh;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"grodriguez@itba.edu.ar"
] | grodriguez@itba.edu.ar |
72c83c33ad51a7fc633f1e01753baacd49c97712 | 05cea9e0d2349b5def7a1a78297167a32614d9b5 | /src/main/java/cn/jorian/jorianframework/core/system/entity/SysUser.java | f170e560c0b77a71f1bcfe56167a72f9c62200d1 | [
"MIT"
] | permissive | Jorian93/jorian-framework | d2b99fbec30c646bfcd661c08579bccf747f5fd3 | c5165842b18d98e0481f7a78f02c691cca769e4f | refs/heads/master | 2022-07-07T00:33:18.648132 | 2021-11-19T01:22:31 | 2021-11-19T01:22:31 | 180,395,275 | 136 | 23 | MIT | 2022-06-29T17:19:42 | 2019-04-09T15:18:19 | Java | UTF-8 | Java | false | false | 811 | java | package cn.jorian.jorianframework.core.system.entity;
import cn.jorian.jorianframework.common.model.BaseModel;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.elasticsearch.annotations.Document;
import java.util.List;
/**
* @Author: jorian
* @Date: 2019/4/18 15:56
* @Description:
*/
@Data
@Accessors(chain = true)
@Document(indexName = "users",type = "user")
public class SysUser extends BaseModel {
private String nickname;
private String username;
private String password;
private Integer sex;
private Integer status;
private String company;
private String phone;
private String email;
private String avatar;
@TableField(exist = false)
List<SysRole> roles;
}
| [
"1977474361@qq.com"
] | 1977474361@qq.com |
999fbb1e5bf5bcee02e92311460a6d29db26e022 | 5cc8c069909e01a69b3827aee89c8bc1a9c694ca | /Mars/src/com/UI/Know.java | b0209fbeaec5235cf6e04c34bbf495a3adf74dfa | [] | no_license | zhiweiqiao/Mars-Monitor-System | 6cf8442ee4312fab67d290aa897c1ac038d66aa7 | 9606a1e8fe42e0fb235e9fc195cd8d7725e12ce0 | refs/heads/master | 2021-01-17T14:55:36.359691 | 2016-10-18T16:58:16 | 2016-10-18T16:58:16 | 70,024,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.UI;
import java.awt.*;
import javax.swing.*;
/**
* @author Zhiwei Qiao
* Information
*/
public class Know extends JInternalFrame {
private JLabel welcome = new JLabel("How to use this system");
private JLabel tit1 = new JLabel("Camera");
private JLabel tit2 = new JLabel("Sensor");
public Know() {
setTitle("Help");
setMaximizable(true);
setIconifiable(true);
setClosable(true);
setResizable(true);
this.getContentPane().setLayout(null);
welcome.setBounds(270, 10, 300, 50);
welcome.setFont(new Font("Times New Roman", 1, 20));
this.add(welcome);
tit1.setBounds(20, 80, 1000, 30);
this.add(tit1);
tit2.setBounds(20, 120, 1000, 30);
this.add(tit2);
/*tit3.setBounds(20, 160, 1000, 30);
this.add(tit3);
tit4.setBounds(20, 200, 1000, 30);
this.add(tit4);
tit5.setBounds(20, 240, 1000, 30);
this.add(tit5);
tit6.setBounds(20, 280, 1000, 30);
this.add(tit6);*/
this.setVisible(true);
}
} | [
"noreply@github.com"
] | noreply@github.com |
040b26844090bfbee02891f28bbf5565be60a9b4 | e57083ea584d69bc9fb1b32f5ec86bdd4fca61c0 | /sample-project-5400/src/main/java/com/example/project/sample5400/other/sample7/Other7_328.java | c4aff562cd4478791b44a43d123bf10be14f5f98 | [] | no_license | snicoll-scratches/test-spring-components-index | 77e0ad58c8646c7eb1d1563bf31f51aa42a0636e | aa48681414a11bb704bdbc8acabe45fa5ef2fd2d | refs/heads/main | 2021-06-13T08:46:58.532850 | 2019-12-09T15:11:10 | 2019-12-09T15:11:10 | 65,806,297 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package com.example.project.sample5400.other.sample7;
public class Other7_328 {
}
| [
"snicoll@pivotal.io"
] | snicoll@pivotal.io |
fef7df0d1f91b8357e2bc898d3e9c069e92c9c16 | dc53151e22e5be64deb45518315ec242816fac95 | /zeus-common/src/main/java/com/wangcheng/zeus/common/filter/ImmutableInputStreamServletRequest.java | b620324a4763f868d836f28bef2dfdfa1b5c913d | [] | no_license | EvenWC/zeus | 19207cc9b980f276ae3559a87abef25ceb4f7abc | 7eb37aca71ffddf5e3c824898ea996241842eeea | refs/heads/master | 2020-03-29T06:24:32.420921 | 2018-12-30T14:39:54 | 2018-12-30T14:39:54 | 149,623,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package com.wangcheng.zeus.common.filter;
import com.wangcheng.zeus.common.utils.IOUtils;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
/**
* @author: Administrator
* @date: 2018/11/14 21:56
* @description:
*/
public class ImmutableInputStreamServletRequest extends HttpServletRequestWrapper {
/**
* 缓存inputStream
*/
private final byte[] body;
public ImmutableInputStreamServletRequest(HttpServletRequest request) {
super(request);
try {
body = IOUtils.toByteArray( request.getInputStream());
} catch (IOException e) {
throw new IllegalArgumentException("获取输入流失败");
}
}
@Override
public BufferedReader getReader() throws IOException {
return super.getReader();
}
@Override
public ServletInputStream getInputStream() throws IOException {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(body);
return new ServletInputStream(){
@Override
public int read() throws IOException {
return inputStream.read();
}
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener readListener) {
}
};
}
}
| [
"18380431747@163.com"
] | 18380431747@163.com |
30334f3ccda04c657f4a5424eac2924987bce8b0 | 005553bcc8991ccf055f15dcbee3c80926613b7f | /generated/entity/GosuTemplateExpressionFragment.java | c163aeeebe2d99b058f0233d41cb0c1496d7a52e | [] | no_license | azanaera/toggle-isbtf | 5f14209cd87b98c123fad9af060efbbee1640043 | faf991ec3db2fd1d126bc9b6be1422b819f6cdc8 | refs/heads/master | 2023-01-06T22:20:03.493096 | 2020-11-16T07:04:56 | 2020-11-16T07:04:56 | 313,212,938 | 0 | 0 | null | 2020-11-16T08:48:41 | 2020-11-16T06:42:23 | null | UTF-8 | Java | false | false | 44,463 | java | package entity;
/**
* GosuTemplateExpressionFragment
* ExpressionFragment for Gosu String template
*/
@javax.annotation.processing.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "GosuTemplateExpressionFragment.eti;GosuTemplateExpressionFragment.eix;GosuTemplateExpressionFragment.etx")
@java.lang.SuppressWarnings(value = {"deprecation", "unchecked"})
@gw.internal.gosu.parser.ExtendedType
@gw.lang.SimplePropertyProcessing
@gw.entity.EntityName(value = "GosuTemplateExpressionFragment")
public class GosuTemplateExpressionFragment extends entity.ExpressionFragment {
public static final gw.pl.persistence.type.EntityTypeReference<entity.GosuTemplateExpressionFragment> TYPE = new com.guidewire.commons.metadata.types.EntityIntrinsicTypeReference<entity.GosuTemplateExpressionFragment>("entity.GosuTemplateExpressionFragment");
public static final gw.pl.persistence.type.EntityPropertyInfoReference<gw.entity.IColumnPropertyInfo> TEMPLATETEXT_PROP = new com.guidewire.commons.metadata.types.ColumnPropertyInfoCache(TYPE, "TemplateText");
private static final com.guidewire.pl.persistence.code.DelegateMap DELEGATE_MAP;
/**
* Constructs a new instance of this entity in the {@link gw.transaction.Transaction#getCurrent() current} bundle.
* @throws java.lang.NullPointerException if there is no current bundle defined
*/
public GosuTemplateExpressionFragment() {
this(gw.transaction.Transaction.getCurrent());
}
/**
* Constructs a new instance of this entity in the bundle supplied by the given bundle provider.
*/
public GosuTemplateExpressionFragment(gw.pl.persistence.core.BundleProvider bundleProvider) {
this((java.lang.Void)null);
com.guidewire.pl.system.entity.proxy.BeanProxy.initNewBeanInstance(this, bundleProvider.getBundle(), java.util.Arrays.asList());
}
protected GosuTemplateExpressionFragment(java.lang.Void ignored) {
super(ignored);
}
protected com.guidewire._generated.entity.GosuTemplateExpressionFragmentInternal __createInternalInterface() {
return new _Internal();
}
protected com.guidewire.pl.persistence.code.DelegateMap __getDelegateMap() {
return DELEGATE_MAP;
}
protected com.guidewire._generated.entity.GosuTemplateExpressionFragmentInternal __getInternalInterface() {
return (com.guidewire._generated.entity.GosuTemplateExpressionFragmentInternal)super.__getInternalInterface();
}
/**
* Gets the value of the TemplateText field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public java.lang.String getTemplateText() {
return (java.lang.String)__getInternalInterface().getFieldValueForCodegen(TEMPLATETEXT_PROP.get());
}
/**
* Sets the value of the TemplateText field.
*/
public void setTemplateText(java.lang.String value) {
__getInternalInterface().setFieldValueForCodegen(TEMPLATETEXT_PROP.get(), value);
}
private class _Internal extends com.guidewire.pl.persistence.code.BeanInternalBase implements com.guidewire._generated.entity.GosuTemplateExpressionFragmentInternal {
protected com.guidewire.pl.persistence.code.DelegateLoader __getDelegateManager() {
return entity.GosuTemplateExpressionFragment.this.__getDelegateManager();
}
public void accept(com.guidewire.bizrules.codegenerator.RuleGraphVisitor arg0) {
((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).accept(arg0);
}
/**
* Adds the given element to the InCommandParameterArray array. This is achieved by setting the parent foreign key to this entity instance.
*/
public void addToInCommandParameterArray(entity.RuleCommandParameter element) {
__getInternalInterface().addArrayElement(INCOMMANDPARAMETERARRAY_PROP.get(), element);
}
/**
* Adds the given element to the InFilteredIterableExpressionFragmentArray array. This is achieved by setting the parent foreign key to this entity instance.
*/
public void addToInFilteredIterableExpressionFragmentArray(entity.FilteredIterableExpressionFragmentJoin element) {
__getInternalInterface().addArrayElement(INFILTEREDITERABLEEXPRESSIONFRAGMENTARRAY_PROP.get(), element);
}
/**
* Adds the given element to the InLeftConditionArray array. This is achieved by setting the parent foreign key to this entity instance.
*/
public void addToInLeftConditionArray(entity.RuleConditionLine element) {
__getInternalInterface().addArrayElement(INLEFTCONDITIONARRAY_PROP.get(), element);
}
/**
* Adds the given element to the InListExpressionFragmentJoinArray array. This is achieved by setting the parent foreign key to this entity instance.
*/
public void addToInListExpressionFragmentJoinArray(entity.ListExpressionFragmentJoin element) {
__getInternalInterface().addArrayElement(INLISTEXPRESSIONFRAGMENTJOINARRAY_PROP.get(), element);
}
/**
* Adds the given element to the InRightConditionArray array. This is achieved by setting the parent foreign key to this entity instance.
*/
public void addToInRightConditionArray(entity.RuleConditionLine element) {
__getInternalInterface().addArrayElement(INRIGHTCONDITIONARRAY_PROP.get(), element);
}
/**
* Adds the given element to the InRuleVariableArray array. This is achieved by setting the parent foreign key to this entity instance.
*/
public void addToInRuleVariableArray(entity.RuleVariable element) {
__getInternalInterface().addArrayElement(INRULEVARIABLEARRAY_PROP.get(), element);
}
/**
* Adds the given element to the InSumExpressionFragmentArray array. This is achieved by setting the parent foreign key to this entity instance.
*/
public void addToInSumExpressionFragmentArray(entity.SumExpressionFragmentJoin element) {
__getInternalInterface().addArrayElement(INSUMEXPRESSIONFRAGMENTARRAY_PROP.get(), element);
}
public boolean alwaysReserveID() {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).alwaysReserveID();
}
public void assignPermanentId(gw.pl.persistence.core.Key id) {
((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).assignPermanentId(id);
}
public void assignUniquePublicId() {
((com.guidewire.bizrules.management.RuleVersionAwareInternal)__getDelegateManager().getImplementation("com.guidewire.bizrules.management.RuleVersionAwareInternal")).assignUniquePublicId();
}
public void beforeInsert() {
((com.guidewire.pl.system.bundle.InsertCallback)__getDelegateManager().getImplementation("com.guidewire.pl.system.bundle.InsertCallback")).beforeInsert();
}
public void beforeRemove() {
((com.guidewire.pl.system.bundle.RemoveCallback)__getDelegateManager().getImplementation("com.guidewire.pl.system.bundle.RemoveCallback")).beforeRemove();
}
public void beforeUpdate() {
((com.guidewire.pl.system.bundle.UpdateCallback)__getDelegateManager().getImplementation("com.guidewire.pl.system.bundle.UpdateCallback")).beforeUpdate();
}
public java.lang.Integer calculateNextVersion() {
return ((com.guidewire.pl.domain.persistence.core.impl.VersionableInternal)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.VersionableInternal")).calculateNextVersion();
}
public java.util.List<entity.KeyableBean> cascadeDelete() {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).cascadeDelete();
}
public entity.KeyableBean cloneBeanForBundleTransfer() {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).cloneBeanForBundleTransfer();
}
/**
*
* @return A copy of the current bean and a deep copy of all owned array elements
*/
public entity.KeyableBean copy() {
return ((com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods")).copy();
}
public boolean countsAsEmptyForValidation() {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).countsAsEmptyForValidation();
}
public java.util.List<java.lang.String> deepValidate(gw.bizrules.context.provider.RuleContextDefinitionProvider arg0) {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).deepValidate(arg0);
}
public entity.KeyableBean downcast(gw.entity.IEntityType newSubtype) {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).downcast(newSubtype);
}
public boolean equalsTo(entity.ExpressionFragment arg0) {
return ((com.guidewire.bizrules.domain.ExpressionFragmentDomainMethods)__getDelegateManager().getImplementation("com.guidewire.bizrules.domain.ExpressionFragmentDomainMethods")).equalsTo(arg0);
}
public java.util.List<com.guidewire.pl.system.integration.messaging.events.EventDescriptor> generateInsertEventsInternal() {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).generateInsertEventsInternal();
}
public java.util.List<com.guidewire.pl.system.integration.messaging.events.EventDescriptor> generateRemoveEventsInternal() {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).generateRemoveEventsInternal();
}
public java.util.List<com.guidewire.pl.system.integration.messaging.events.EventDescriptor> generateUpdateEventsInternal() {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).generateUpdateEventsInternal();
}
public entity.KeyableBean getBean() {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).getBean();
}
@com.guidewire.pl.persistence.codegen.annotation.OverridesAccessor
@gw.internal.gosu.parser.ExtendedProperty
public java.lang.Integer getBeanVersion() {
return ((com.guidewire.pl.domain.persistence.core.VersionablePublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.VersionablePublicMethods")).getBeanVersion();
}
public java.lang.String getDisplayText() {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).getDisplayText();
}
public gw.lang.reflect.IType getExpressionType() {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).getExpressionType();
}
public java.lang.String getFormattedDisplayText() {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).getFormattedDisplayText();
}
public java.lang.String getGosuText() {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).getGosuText();
}
public java.lang.String getHtmlText(entity.ConditionExpressionFragment arg0) {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).getHtmlText(arg0);
}
@com.guidewire.pl.persistence.codegen.annotation.OverridesAccessor
@gw.internal.gosu.parser.ExtendedProperty
public gw.pl.persistence.core.Key getID() {
return ((com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods")).getID();
}
public gw.pl.persistence.core.Key getIdToSetForForeignKey(gw.entity.ILinkPropertyInfo link) {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).getIdToSetForForeignKey(link);
}
/**
* Gets the value of the InCommandParameter field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleCommandParameter getInCommandParameter() {
return (entity.RuleCommandParameter)__getInternalInterface().getFieldValue(INCOMMANDPARAMETER_PROP.get());
}
/**
* Gets the value of the InCommandParameterArray field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleCommandParameter[] getInCommandParameterArray() {
return (entity.RuleCommandParameter[])__getInternalInterface().getFieldValue(INCOMMANDPARAMETERARRAY_PROP.get());
}
public gw.pl.persistence.core.Key getInCommandParameterID() {
return (gw.pl.persistence.core.Key)getRawFieldValue(INCOMMANDPARAMETER_PROP.get());
}
/**
* Gets the value of the InFilteredIterableExpressionFragment field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.FilteredIterableExpressionFragmentJoin getInFilteredIterableExpressionFragment() {
return (entity.FilteredIterableExpressionFragmentJoin)__getInternalInterface().getFieldValue(INFILTEREDITERABLEEXPRESSIONFRAGMENT_PROP.get());
}
/**
* Gets the value of the InFilteredIterableExpressionFragmentArray field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.FilteredIterableExpressionFragmentJoin[] getInFilteredIterableExpressionFragmentArray() {
return (entity.FilteredIterableExpressionFragmentJoin[])__getInternalInterface().getFieldValue(INFILTEREDITERABLEEXPRESSIONFRAGMENTARRAY_PROP.get());
}
public gw.pl.persistence.core.Key getInFilteredIterableExpressionFragmentID() {
return (gw.pl.persistence.core.Key)getRawFieldValue(INFILTEREDITERABLEEXPRESSIONFRAGMENT_PROP.get());
}
/**
* Gets the value of the InLeftCondition field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleConditionLine getInLeftCondition() {
return (entity.RuleConditionLine)__getInternalInterface().getFieldValue(INLEFTCONDITION_PROP.get());
}
/**
* Gets the value of the InLeftConditionArray field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleConditionLine[] getInLeftConditionArray() {
return (entity.RuleConditionLine[])__getInternalInterface().getFieldValue(INLEFTCONDITIONARRAY_PROP.get());
}
public gw.pl.persistence.core.Key getInLeftConditionID() {
return (gw.pl.persistence.core.Key)getRawFieldValue(INLEFTCONDITION_PROP.get());
}
/**
* Gets the value of the InListExpressionFragmentJoin field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.ListExpressionFragmentJoin getInListExpressionFragmentJoin() {
return (entity.ListExpressionFragmentJoin)__getInternalInterface().getFieldValue(INLISTEXPRESSIONFRAGMENTJOIN_PROP.get());
}
/**
* Gets the value of the InListExpressionFragmentJoinArray field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.ListExpressionFragmentJoin[] getInListExpressionFragmentJoinArray() {
return (entity.ListExpressionFragmentJoin[])__getInternalInterface().getFieldValue(INLISTEXPRESSIONFRAGMENTJOINARRAY_PROP.get());
}
public gw.pl.persistence.core.Key getInListExpressionFragmentJoinID() {
return (gw.pl.persistence.core.Key)getRawFieldValue(INLISTEXPRESSIONFRAGMENTJOIN_PROP.get());
}
/**
* Gets the value of the InRightCondition field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleConditionLine getInRightCondition() {
return (entity.RuleConditionLine)__getInternalInterface().getFieldValue(INRIGHTCONDITION_PROP.get());
}
/**
* Gets the value of the InRightConditionArray field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleConditionLine[] getInRightConditionArray() {
return (entity.RuleConditionLine[])__getInternalInterface().getFieldValue(INRIGHTCONDITIONARRAY_PROP.get());
}
public gw.pl.persistence.core.Key getInRightConditionID() {
return (gw.pl.persistence.core.Key)getRawFieldValue(INRIGHTCONDITION_PROP.get());
}
/**
* Gets the value of the InRuleVariable field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleVariable getInRuleVariable() {
return (entity.RuleVariable)__getInternalInterface().getFieldValue(INRULEVARIABLE_PROP.get());
}
/**
* Gets the value of the InRuleVariableArray field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.RuleVariable[] getInRuleVariableArray() {
return (entity.RuleVariable[])__getInternalInterface().getFieldValue(INRULEVARIABLEARRAY_PROP.get());
}
public gw.pl.persistence.core.Key getInRuleVariableID() {
return (gw.pl.persistence.core.Key)getRawFieldValue(INRULEVARIABLE_PROP.get());
}
/**
* Gets the value of the InSumExpressionFragment field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.SumExpressionFragmentJoin getInSumExpressionFragment() {
return (entity.SumExpressionFragmentJoin)__getInternalInterface().getFieldValue(INSUMEXPRESSIONFRAGMENT_PROP.get());
}
/**
* Gets the value of the InSumExpressionFragmentArray field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public entity.SumExpressionFragmentJoin[] getInSumExpressionFragmentArray() {
return (entity.SumExpressionFragmentJoin[])__getInternalInterface().getFieldValue(INSUMEXPRESSIONFRAGMENTARRAY_PROP.get());
}
public gw.pl.persistence.core.Key getInSumExpressionFragmentID() {
return (gw.pl.persistence.core.Key)getRawFieldValue(INSUMEXPRESSIONFRAGMENT_PROP.get());
}
public gw.lang.reflect.IType getListOrArrayElementType(gw.bizrules.context.provider.RuleContextDefinitionProvider arg0) {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).getListOrArrayElementType(arg0);
}
public java.lang.Iterable<? extends entity.RuleVersionAware> getOwners() {
return ((gw.bizrules.domain.RuleVersionDependent)__getDelegateManager().getImplementation("gw.bizrules.domain.RuleVersionDependent")).getOwners();
}
@com.guidewire.pl.persistence.codegen.annotation.OverridesAccessor
@gw.internal.gosu.parser.ExtendedProperty
public java.lang.String getPublicID() {
return ((com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods")).getPublicID();
}
/**
* Gets the value of the Subtype field.
* Identifies a particular subtype within a supertype table; each subtype of a supertype has its own unique subtype value
*/
@gw.internal.gosu.parser.ExtendedProperty
public typekey.ExpressionFragment getSubtype() {
return (typekey.ExpressionFragment)__getInternalInterface().getFieldValue(SUBTYPE_PROP.get());
}
/**
* Gets the value of the TemplateText field.
*/
@gw.internal.gosu.parser.ExtendedProperty
public java.lang.String getTemplateText() {
return (java.lang.String)__getInternalInterface().getFieldValueForCodegen(TEMPLATETEXT_PROP.get());
}
public void initInBundle(gw.pl.persistence.core.Key id, gw.pl.persistence.core.Bundle bundle) {
((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).initInBundle(id, bundle);
}
public boolean isEmpty() {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).isEmpty();
}
/**
*
* @return true if this bean is to be inserted into the database when the bundle is committed.
*/
public boolean isNew() {
return ((com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods")).isNew();
}
/**
*
* @return True if the object was created by importation from an external system,
* False if it was created internally. Note that this refers to the currently
* instantiated object, not the data it represents
*/
public boolean isNewlyImported() {
return ((com.guidewire.commons.entity.Sourceable)__getDelegateManager().getImplementation("com.guidewire.commons.entity.Sourceable")).isNewlyImported();
}
public boolean isTemporary() {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).isTemporary();
}
public entity.ExpressionFragment mergeOrReplace(entity.ExpressionFragment arg0) {
return ((com.guidewire.bizrules.domain.ExpressionFragmentDomainMethods)__getDelegateManager().getImplementation("com.guidewire.bizrules.domain.ExpressionFragmentDomainMethods")).mergeOrReplace(arg0);
}
public void onPreInit() {
((com.guidewire.pl.system.entity.PreInitCallback)__getDelegateManager().getImplementation("com.guidewire.pl.system.entity.PreInitCallback")).onPreInit();
}
public entity.KeyableBean overrideBundleAdd(gw.pl.persistence.core.Bundle bundle) {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).overrideBundleAdd(bundle);
}
public entity.KeyableBean overrideBundleRemove(gw.pl.persistence.core.Bundle bundle) {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).overrideBundleRemove(bundle);
}
public void putInBundle() {
((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).putInBundle();
}
/**
* Refreshes this bean with the latest database version.
* <p/>
* This method does nothing if the bean is edited or inserted in its current bundle. If the bean
* no longer exists in the database, then <tt>null</tt> is returned. If the bean has been
* evicted from its bundle, then <tt>null</tt> is returned. Otherwise, this bean is returned, with its contents
* updated.
*/
public entity.KeyableBean refresh() {
return ((com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods")).refresh();
}
public entity.KeyableBean reload(gw.pl.persistence.core.Bundle bundle) {
return ((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).reload(bundle);
}
/**
* Marks this bean for remove. A bean marked for remove will be deleted or retired when the transaction
* is committed. Once a bean is marked for remove, it cannot be switched to update, edit, or read.
* <p>
* WARNING: This method is designed for simple custom entities which are normally not
* associated with other entities. Undesirable results may occur when used on out-of-box entities.
*/
public void remove() {
((com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods")).remove();
}
public void removeAndCascade() {
((com.guidewire.bizrules.domain.RulesCascadingRemovable)__getDelegateManager().getImplementation("com.guidewire.bizrules.domain.RulesCascadingRemovable")).removeAndCascade();
}
/**
* Removes the given element from the InCommandParameterArray array. This is achieved by marking the element for removal.
*/
public void removeFromInCommandParameterArray(entity.RuleCommandParameter element) {
__getInternalInterface().removeArrayElement(INCOMMANDPARAMETERARRAY_PROP.get(), element);
}
/**
* Removes the given element from the InCommandParameterArray array. This is achieved by marking the element for removal.
* @deprecated Please use the version that takes an entity instead.
*/
@java.lang.Deprecated
public void removeFromInCommandParameterArray(gw.pl.persistence.core.Key elementID) {
__getInternalInterface().removeArrayElement(INCOMMANDPARAMETERARRAY_PROP.get(), elementID);
}
/**
* Removes the given element from the InFilteredIterableExpressionFragmentArray array. This is achieved by marking the element for removal.
*/
public void removeFromInFilteredIterableExpressionFragmentArray(entity.FilteredIterableExpressionFragmentJoin element) {
__getInternalInterface().removeArrayElement(INFILTEREDITERABLEEXPRESSIONFRAGMENTARRAY_PROP.get(), element);
}
/**
* Removes the given element from the InFilteredIterableExpressionFragmentArray array. This is achieved by marking the element for removal.
* @deprecated Please use the version that takes an entity instead.
*/
@java.lang.Deprecated
public void removeFromInFilteredIterableExpressionFragmentArray(gw.pl.persistence.core.Key elementID) {
__getInternalInterface().removeArrayElement(INFILTEREDITERABLEEXPRESSIONFRAGMENTARRAY_PROP.get(), elementID);
}
/**
* Removes the given element from the InLeftConditionArray array. This is achieved by marking the element for removal.
*/
public void removeFromInLeftConditionArray(entity.RuleConditionLine element) {
__getInternalInterface().removeArrayElement(INLEFTCONDITIONARRAY_PROP.get(), element);
}
/**
* Removes the given element from the InLeftConditionArray array. This is achieved by marking the element for removal.
* @deprecated Please use the version that takes an entity instead.
*/
@java.lang.Deprecated
public void removeFromInLeftConditionArray(gw.pl.persistence.core.Key elementID) {
__getInternalInterface().removeArrayElement(INLEFTCONDITIONARRAY_PROP.get(), elementID);
}
/**
* Removes the given element from the InListExpressionFragmentJoinArray array. This is achieved by marking the element for removal.
*/
public void removeFromInListExpressionFragmentJoinArray(entity.ListExpressionFragmentJoin element) {
__getInternalInterface().removeArrayElement(INLISTEXPRESSIONFRAGMENTJOINARRAY_PROP.get(), element);
}
/**
* Removes the given element from the InListExpressionFragmentJoinArray array. This is achieved by marking the element for removal.
* @deprecated Please use the version that takes an entity instead.
*/
@java.lang.Deprecated
public void removeFromInListExpressionFragmentJoinArray(gw.pl.persistence.core.Key elementID) {
__getInternalInterface().removeArrayElement(INLISTEXPRESSIONFRAGMENTJOINARRAY_PROP.get(), elementID);
}
/**
* Removes the given element from the InRightConditionArray array. This is achieved by marking the element for removal.
*/
public void removeFromInRightConditionArray(entity.RuleConditionLine element) {
__getInternalInterface().removeArrayElement(INRIGHTCONDITIONARRAY_PROP.get(), element);
}
/**
* Removes the given element from the InRightConditionArray array. This is achieved by marking the element for removal.
* @deprecated Please use the version that takes an entity instead.
*/
@java.lang.Deprecated
public void removeFromInRightConditionArray(gw.pl.persistence.core.Key elementID) {
__getInternalInterface().removeArrayElement(INRIGHTCONDITIONARRAY_PROP.get(), elementID);
}
/**
* Removes the given element from the InRuleVariableArray array. This is achieved by marking the element for removal.
*/
public void removeFromInRuleVariableArray(entity.RuleVariable element) {
__getInternalInterface().removeArrayElement(INRULEVARIABLEARRAY_PROP.get(), element);
}
/**
* Removes the given element from the InRuleVariableArray array. This is achieved by marking the element for removal.
* @deprecated Please use the version that takes an entity instead.
*/
@java.lang.Deprecated
public void removeFromInRuleVariableArray(gw.pl.persistence.core.Key elementID) {
__getInternalInterface().removeArrayElement(INRULEVARIABLEARRAY_PROP.get(), elementID);
}
/**
* Removes the given element from the InSumExpressionFragmentArray array. This is achieved by marking the element for removal.
*/
public void removeFromInSumExpressionFragmentArray(entity.SumExpressionFragmentJoin element) {
__getInternalInterface().removeArrayElement(INSUMEXPRESSIONFRAGMENTARRAY_PROP.get(), element);
}
/**
* Removes the given element from the InSumExpressionFragmentArray array. This is achieved by marking the element for removal.
* @deprecated Please use the version that takes an entity instead.
*/
@java.lang.Deprecated
public void removeFromInSumExpressionFragmentArray(gw.pl.persistence.core.Key elementID) {
__getInternalInterface().removeArrayElement(INSUMEXPRESSIONFRAGMENTARRAY_PROP.get(), elementID);
}
public void removed() {
((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).removed();
}
public void renameSymbol(gw.bizrules.context.provider.RuleContextDefinitionProvider arg0, java.lang.String arg1, java.lang.String arg2, boolean arg3) {
((com.guidewire.bizrules.domain.RuleSymbolRenamable)__getDelegateManager().getImplementation("com.guidewire.bizrules.domain.RuleSymbolRenamable")).renameSymbol(arg0, arg1, arg2, arg3);
}
/**
* Sets the value of the BeanVersion field.
*/
public void setBeanVersion(java.lang.Integer value) {
__getInternalInterface().setFieldValue(BEANVERSION_PROP.get(), value);
}
public void setExpressionType(gw.lang.reflect.IType arg0) {
((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).setExpressionType(arg0);
}
/**
* Sets the value of the ID field.
*/
public void setID(gw.pl.persistence.core.Key value) {
__getInternalInterface().setFieldValue(ID_PROP.get(), value);
}
/**
* Sets the value of the InCommandParameter field.
*/
public void setInCommandParameter(entity.RuleCommandParameter value) {
__getInternalInterface().setFieldValue(INCOMMANDPARAMETER_PROP.get(), value);
}
/**
* Sets the value of the InCommandParameterArray field.
*/
public void setInCommandParameterArray(entity.RuleCommandParameter[] value) {
__getInternalInterface().setFieldValue(INCOMMANDPARAMETERARRAY_PROP.get(), value);
}
public void setInCommandParameterID(gw.pl.persistence.core.Key value) {
setFieldValue(INCOMMANDPARAMETER_PROP.get(), value);
}
/**
* Sets the value of the InFilteredIterableExpressionFragment field.
*/
public void setInFilteredIterableExpressionFragment(entity.FilteredIterableExpressionFragmentJoin value) {
__getInternalInterface().setFieldValue(INFILTEREDITERABLEEXPRESSIONFRAGMENT_PROP.get(), value);
}
/**
* Sets the value of the InFilteredIterableExpressionFragmentArray field.
*/
public void setInFilteredIterableExpressionFragmentArray(entity.FilteredIterableExpressionFragmentJoin[] value) {
__getInternalInterface().setFieldValue(INFILTEREDITERABLEEXPRESSIONFRAGMENTARRAY_PROP.get(), value);
}
public void setInFilteredIterableExpressionFragmentID(gw.pl.persistence.core.Key value) {
setFieldValue(INFILTEREDITERABLEEXPRESSIONFRAGMENT_PROP.get(), value);
}
/**
* Sets the value of the InLeftCondition field.
*/
public void setInLeftCondition(entity.RuleConditionLine value) {
__getInternalInterface().setFieldValue(INLEFTCONDITION_PROP.get(), value);
}
/**
* Sets the value of the InLeftConditionArray field.
*/
public void setInLeftConditionArray(entity.RuleConditionLine[] value) {
__getInternalInterface().setFieldValue(INLEFTCONDITIONARRAY_PROP.get(), value);
}
public void setInLeftConditionID(gw.pl.persistence.core.Key value) {
setFieldValue(INLEFTCONDITION_PROP.get(), value);
}
/**
* Sets the value of the InListExpressionFragmentJoin field.
*/
public void setInListExpressionFragmentJoin(entity.ListExpressionFragmentJoin value) {
__getInternalInterface().setFieldValue(INLISTEXPRESSIONFRAGMENTJOIN_PROP.get(), value);
}
/**
* Sets the value of the InListExpressionFragmentJoinArray field.
*/
public void setInListExpressionFragmentJoinArray(entity.ListExpressionFragmentJoin[] value) {
__getInternalInterface().setFieldValue(INLISTEXPRESSIONFRAGMENTJOINARRAY_PROP.get(), value);
}
public void setInListExpressionFragmentJoinID(gw.pl.persistence.core.Key value) {
setFieldValue(INLISTEXPRESSIONFRAGMENTJOIN_PROP.get(), value);
}
/**
* Sets the value of the InRightCondition field.
*/
public void setInRightCondition(entity.RuleConditionLine value) {
__getInternalInterface().setFieldValue(INRIGHTCONDITION_PROP.get(), value);
}
/**
* Sets the value of the InRightConditionArray field.
*/
public void setInRightConditionArray(entity.RuleConditionLine[] value) {
__getInternalInterface().setFieldValue(INRIGHTCONDITIONARRAY_PROP.get(), value);
}
public void setInRightConditionID(gw.pl.persistence.core.Key value) {
setFieldValue(INRIGHTCONDITION_PROP.get(), value);
}
/**
* Sets the value of the InRuleVariable field.
*/
public void setInRuleVariable(entity.RuleVariable value) {
__getInternalInterface().setFieldValue(INRULEVARIABLE_PROP.get(), value);
}
/**
* Sets the value of the InRuleVariableArray field.
*/
public void setInRuleVariableArray(entity.RuleVariable[] value) {
__getInternalInterface().setFieldValue(INRULEVARIABLEARRAY_PROP.get(), value);
}
public void setInRuleVariableID(gw.pl.persistence.core.Key value) {
setFieldValue(INRULEVARIABLE_PROP.get(), value);
}
/**
* Sets the value of the InSumExpressionFragment field.
*/
public void setInSumExpressionFragment(entity.SumExpressionFragmentJoin value) {
__getInternalInterface().setFieldValue(INSUMEXPRESSIONFRAGMENT_PROP.get(), value);
}
/**
* Sets the value of the InSumExpressionFragmentArray field.
*/
public void setInSumExpressionFragmentArray(entity.SumExpressionFragmentJoin[] value) {
__getInternalInterface().setFieldValue(INSUMEXPRESSIONFRAGMENTARRAY_PROP.get(), value);
}
public void setInSumExpressionFragmentID(gw.pl.persistence.core.Key value) {
setFieldValue(INSUMEXPRESSIONFRAGMENT_PROP.get(), value);
}
public void setLazyLoadedRow() {
((com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods")).setLazyLoadedRow();
}
/**
* Set a flag denoting that the currently instantiated object has been newly imported from
* an external source
* @param newlyImported
*/
public void setNewlyImported(boolean newlyImported) {
((com.guidewire.commons.entity.Sourceable)__getDelegateManager().getImplementation("com.guidewire.commons.entity.Sourceable")).setNewlyImported(newlyImported);
}
@com.guidewire.pl.persistence.codegen.annotation.OverridesAccessor
public void setPublicID(java.lang.String id) {
((com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods")).setPublicID(id);
}
/**
* Sets the value of the Subtype field.
*/
public void setSubtype(typekey.ExpressionFragment value) {
__getInternalInterface().setFieldValue(SUBTYPE_PROP.get(), value);
}
/**
* Sets the value of the TemplateText field.
*/
public void setTemplateText(java.lang.String value) {
__getInternalInterface().setFieldValueForCodegen(TEMPLATETEXT_PROP.get(), value);
}
/**
* Set's the version of the bean to the next value (i.e. the bean version original value+1)
* Multiple calls to this method on the same bean will result in the same value being used
* for the version (i.e. it is idempotent).
*
* Calling this method will force the bean to be written to the database and participate fully
* in the commit cycle e.g. pre-update rules will be run, etc.
*/
public void touch() {
((com.guidewire.pl.domain.persistence.core.VersionablePublicMethods)__getDelegateManager().getImplementation("com.guidewire.pl.domain.persistence.core.VersionablePublicMethods")).touch();
}
public java.util.List<java.lang.String> validate(gw.bizrules.context.provider.RuleContextDefinitionProvider arg0) {
return ((com.guidewire.bizrules.codegenerator.GosuTextBuilder<entity.KeyableBean>)__getDelegateManager().getImplementation("com.guidewire.bizrules.codegenerator.GosuTextBuilder")).validate(arg0);
}
}
static {
java.util.HashMap<java.lang.String, java.lang.String> config = new java.util.HashMap<java.lang.String, java.lang.String>();
config.put("com.guidewire.bizrules.codegenerator.GosuTextBuilder", "com.guidewire.bizrules.codegenerator.GosuTemplateExpressionFragmentGosuTextBuilder");
config.put("com.guidewire.bizrules.domain.ExpressionFragmentDomainMethods", "com.guidewire.bizrules.domain.GosuTemplateExpressionFragmentImpl");
config.put("com.guidewire.bizrules.domain.RuleSymbolRenamable", "com.guidewire.bizrules.domain.GosuTemplateExpressionFragmentImpl");
config.put("com.guidewire.bizrules.domain.RulesCascadingRemovable", "com.guidewire.bizrules.domain.GosuTemplateExpressionFragmentImpl");
config.put("com.guidewire.bizrules.management.RuleVersionAwareInternal", "com.guidewire.bizrules.management.RuleVersionDependentImpl");
config.put("com.guidewire.commons.entity.Keyable", "com.guidewire.pl.system.entity.proxy.AbstractVersionableBeanProxy");
config.put("com.guidewire.commons.entity.Sourceable", "com.guidewire.pl.system.entity.proxy.AbstractVersionableBeanProxy");
config.put("com.guidewire.pl.domain.persistence.core.KeyableBeanPublicMethods", "com.guidewire.pl.system.entity.proxy.AbstractVersionableBeanProxy");
config.put("com.guidewire.pl.domain.persistence.core.VersionablePublicMethods", "com.guidewire.pl.system.entity.proxy.AbstractVersionableBeanProxy");
config.put("com.guidewire.pl.domain.persistence.core.impl.BeanInternal", "com.guidewire.pl.system.entity.proxy.BeanProxy");
config.put("com.guidewire.pl.domain.persistence.core.impl.KeyableBeanInternalMethods", "com.guidewire.pl.system.entity.proxy.AbstractKeyableBeanProxy");
config.put("com.guidewire.pl.domain.persistence.core.impl.VersionableInternal", "com.guidewire.pl.system.entity.proxy.AbstractVersionableBeanProxy");
config.put("com.guidewire.pl.persistence.core.BeanMethods", "com.guidewire.pl.system.entity.proxy.BeanProxy");
config.put("com.guidewire.pl.system.bundle.InsertCallback", "com.guidewire.bizrules.management.RuleVersionDependentImpl");
config.put("com.guidewire.pl.system.bundle.RemoveCallback", "com.guidewire.bizrules.management.RuleVersionDependentImpl");
config.put("com.guidewire.pl.system.bundle.UpdateCallback", "com.guidewire.bizrules.management.RuleVersionDependentImpl");
config.put("com.guidewire.pl.system.entity.PreInitCallback", "com.guidewire.bizrules.management.RuleVersionDependentImpl");
config.put("gw.bizrules.domain.RuleVersionDependent", "com.guidewire.bizrules.domain.ExpressionFragmentImpl");
config.put("gw.pl.persistence.core.Bean", "com.guidewire.pl.system.entity.proxy.BeanProxy");
config.put("gw.pl.persistence.core.BundleProvider", "com.guidewire.pl.system.entity.proxy.BeanProxy");
config.put("java.lang.Comparable", "com.guidewire.pl.system.entity.proxy.BeanProxy");
DELEGATE_MAP = com.guidewire.pl.persistence.code.DelegateMap.newInstance(entity.GosuTemplateExpressionFragment.class, config);
com.guidewire._generated.entity.GosuTemplateExpressionFragmentInternalAccess.FRIEND_ACCESSOR.init(new com.guidewire.pl.persistence.code.InstantiableEntityFriendAccess<entity.GosuTemplateExpressionFragment, com.guidewire._generated.entity.GosuTemplateExpressionFragmentInternal>() {
public java.lang.Object getImplementation(entity.GosuTemplateExpressionFragment bean, java.lang.String interfaceName) {
return bean.__getDelegateManager().getImplementation(interfaceName);
}
public com.guidewire._generated.entity.GosuTemplateExpressionFragmentInternal getInternalInterface(entity.GosuTemplateExpressionFragment bean) {
if(bean == null) {
return null;
};
return bean.__getInternalInterface();
}
public entity.GosuTemplateExpressionFragment newEmptyInstance() {
return new entity.GosuTemplateExpressionFragment((java.lang.Void)null);
}
public void validateImplementations() {
DELEGATE_MAP.validateImplementations();
}
});
}
} | [
"azanaera691@gmail.com"
] | azanaera691@gmail.com |
f07245bdde39732aa62ce7060c5f33576abebb5b | db00255007bfa5ae99ae9e10ae194fbdda15caac | /src/test/java/Test/chrome.java | fb9894f6af0f2f5cab1c22afbe96e08800d6fc3f | [] | no_license | ankitver2016/project1 | 65c11d8d721442666d3c30c62c7ae0c21dd9f55b | 90b10df6567a82946fd1921f862bddb10ab67ffb | refs/heads/master | 2016-08-12T04:43:54.200356 | 2016-01-05T01:25:52 | 2016-01-05T01:25:52 | 49,032,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,043 | java | package Test;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
/*
public class chrome extends A_2{
WebDriver driver;
WebDriverWait wait;
@BeforeSuite
public void testbbc() {
System.setProperty("webdriver.chrome.driver", "/Users/nayyaan/Chrome/chromedriver");
driver = new ChromeDriver();
wait = new WebDriverWait(driver, 10);
//driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("https://www.qa.oncue.com/");
// FirefoxDriver driver = new FirefoxDriver();
}
@Test
public void testTabs() {
WebElement link4 = driver.findElement(By.xpath("html/body/div[1]/header/div/div/div[1]/div/div/ul/li[3]/a"));
link4.click();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("header-gplay")));
WebElement link4_1 = driver.findElement(By.id("header-gplay"));
link4_1.click();
System.out.println(driver.getCurrentUrl());
//driver.close();
/*
@Test
public void testGetTheAppGooglePlay() throws InterruptedException
{
WebElement link4 = driver.findElement(By.xpath("html/body/div[1]/header/div/div/div[1]/div/div/ul/li[3]/a"));
link4.click();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("header-gplay")));
wait.until(ExpectedConditions.
//Thread.sleep(1000);
WebElement link4_1 = driver.findElement(By.id("header-gplay"));
link4_1.click();
}
}
}
}
*/ | [
"ankitver2015@gmail.com"
] | ankitver2015@gmail.com |
08b2eb14ae839d359b51f19ea11a0e34a3bff41a | b1047e5cd59478a43b3dedee1c358f7e80ed6281 | /Videos/src/com/laetienda/entities/Text.java | 3deb202c87d7e4522751817d5dac8b9ea1d2994f | [] | no_license | davidrcuervo/Videos | 71003b46a3a82b69ec90ec24908a47e4c7cef1fd | 24b659411001d569bf56225df40db8469dd2695a | refs/heads/master | 2020-05-22T04:32:44.219635 | 2016-08-16T18:49:08 | 2016-08-16T18:49:08 | 64,889,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,531 | java | package com.laetienda.entities;
import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name="texts")
@NamedQuery(name="Text.findAll", query="SELECT t FROM Text t")
public class Text extends Father implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="TEXTS_ID_GENERATOR", sequenceName="TEXTS_ID_SEQ", allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TEXTS_ID_GENERATOR")
private Integer id;
@Column(name="\"created\"", insertable = false, updatable = false, nullable = false, columnDefinition = "TIMESTAMP WITH TIME ZONE")
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@Column(name="\"modified\"", insertable = false, updatable = false, nullable = false, columnDefinition = "TIMESTAMP WITH TIME ZONE")
@Temporal(TemporalType.TIMESTAMP)
private Date modified;
private String text;
//bi-directional many-to-one association to TextIndex
@ManyToOne
@JoinColumn(name="\"textsID\"")
private TextIndex textsIndexe;
public Text() {
super(null);
}
public Integer getId() {
return this.id;
}
public Date getCreated() {
return this.created;
}
public Date getModified() {
return this.modified;
}
public String getText() {
return this.text;
}
public void setText(String text) {
this.text = text;
}
public TextIndex getTextsIndexe() {
return this.textsIndexe;
}
public void setTextsIndexe(TextIndex textsIndexe) {
this.textsIndexe = textsIndexe;
}
} | [
"myself@la-etienda.com"
] | myself@la-etienda.com |
e3ad214d63b4bd7062541ec11874ee16d1c060bc | 61ad6a218e9d21c29e60cd4c0939a0f5d2113fad | /ProductInvoice/src/com/main/refector/MailConfig.java | c22d3aba763dae780e3a7d728f349aa47ac145b2 | [] | no_license | duongtkd00295/asm-aad1 | c9499a4cd5c7c87c6c38196e311907aea608ae85 | 958b48e994fc035196b12817c360f580c1793325 | refs/heads/master | 2020-05-07T22:23:34.729321 | 2019-04-12T06:23:34 | 2019-04-12T06:23:34 | 180,943,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | 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 com.main.refector;
/**
*
* @author HP Z220
*/
public class MailConfig {
public static final String HOST_NAME = "smtp.gmail.com";
public static final int SSL_PORT = 465;
public static final int TSL_PORT = 587;
public static final String APP_EMAIL = "xspamx001@gmail.com";
public static final String APP_PASSWORD = "123456789202";
}
| [
"duongtran845@gmail.com"
] | duongtran845@gmail.com |
af7d9a135c71be5971c5e605ad96ba5ef277fc7b | 5ff16d56cc3de679c83882eb60cdb6b9aad28f44 | /src/tests/junit/sim/atomic/EuclideanDistanceTest.java | 15d1bffd29510870f40db63d646910a3722c84ae | [] | no_license | sachag678/JLOAF | 72228d5dd14e2269d5fcb23693e1c30fee5291f6 | 1e8cf833c06312c13c8e643d8cae8f53d26392aa | refs/heads/master | 2018-10-01T03:09:49.044352 | 2018-06-08T21:02:38 | 2018-06-08T21:02:38 | 84,358,685 | 3 | 6 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | package tests.junit.sim.atomic;
import org.jLOAF.inputs.AtomicInput;
import org.jLOAF.inputs.Feature;
import org.jLOAF.sim.AtomicSimilarityMetricStrategy;
import org.jLOAF.sim.SimilarityMetricStrategy;
import org.jLOAF.sim.atomic.EuclideanDistance;
import org.jLOAF.sim.atomic.PercentDifference;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class EuclideanDistanceTest {
AtomicSimilarityMetricStrategy sim = new EuclideanDistance();
@Test
public void TestEEquals(){
AtomicInput i1 = new AtomicInput("h1",new Feature(1.6),sim);
AtomicInput i2 = new AtomicInput("h2",new Feature(1.6),sim);
assertEquals(i1.similarity(i2),1.0,0.1);
}
@Test
public void TestEDNotEquals(){
AtomicInput i1 = new AtomicInput("h1",new Feature(2.6),sim);
AtomicInput i2 = new AtomicInput("h2",new Feature(1.2),sim);
assertEquals(i1.similarity(i2),0.416,0.01);
}
}
| [
"sacha.gunaratne@gmail.com"
] | sacha.gunaratne@gmail.com |
4e46732d327aeb8304124cbe36b2ea5e82da2f82 | ba9eb0cd28a19a1bc3bf3167cb9dcb68a6007d51 | /src/main/java/io/github/mazao/application/service/mapper/UserMapper.java | ef49d52f81c9bd7c823b1dceb158b64b9774567d | [] | no_license | mmahanga/mazao-application | bf5ac92629adc2a27dde0db8f73e718c8cda7cc0 | b52d81d52f630acdde0270a673fcd6681b4e5b59 | refs/heads/master | 2022-12-21T06:01:09.083886 | 2019-11-20T05:20:26 | 2019-11-20T05:20:26 | 202,646,467 | 0 | 0 | null | 2022-12-16T05:03:00 | 2019-08-16T02:45:17 | Java | UTF-8 | Java | false | false | 2,505 | java | package io.github.mazao.application.service.mapper;
import io.github.mazao.application.domain.Authority;
import io.github.mazao.application.domain.User;
import io.github.mazao.application.service.dto.UserDTO;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* Mapper for the entity {@link User} and its DTO called {@link UserDTO}.
*
* Normal mappers are generated using MapStruct, this one is hand-coded as MapStruct
* support is still in beta, and requires a manual step with an IDE.
*/
@Service
public class UserMapper {
public List<UserDTO> usersToUserDTOs(List<User> users) {
return users.stream()
.filter(Objects::nonNull)
.map(this::userToUserDTO)
.collect(Collectors.toList());
}
public UserDTO userToUserDTO(User user) {
return new UserDTO(user);
}
public List<User> userDTOsToUsers(List<UserDTO> userDTOs) {
return userDTOs.stream()
.filter(Objects::nonNull)
.map(this::userDTOToUser)
.collect(Collectors.toList());
}
public User userDTOToUser(UserDTO userDTO) {
if (userDTO == null) {
return null;
} else {
User user = new User();
user.setId(userDTO.getId());
user.setLogin(userDTO.getLogin());
user.setFirstName(userDTO.getFirstName());
user.setLastName(userDTO.getLastName());
user.setEmail(userDTO.getEmail());
user.setImageUrl(userDTO.getImageUrl());
user.setActivated(userDTO.isActivated());
user.setLangKey(userDTO.getLangKey());
Set<Authority> authorities = this.authoritiesFromStrings(userDTO.getAuthorities());
user.setAuthorities(authorities);
return user;
}
}
private Set<Authority> authoritiesFromStrings(Set<String> authoritiesAsString) {
Set<Authority> authorities = new HashSet<>();
if(authoritiesAsString != null){
authorities = authoritiesAsString.stream().map(string -> {
Authority auth = new Authority();
auth.setName(string);
return auth;
}).collect(Collectors.toSet());
}
return authorities;
}
public User userFromId(Long id) {
if (id == null) {
return null;
}
User user = new User();
user.setId(id);
return user;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
0dfc77beb94f6592dab83a0b1d26ea562c496d29 | dc4abe5cbc40f830725f9a723169e2cc80b0a9d6 | /src/main/java/com/sgai/property/quality/vo/QualityInspectionVo.java | 0911038a392d35deb2a0eddac28d446e15ed750b | [] | no_license | ppliuzf/sgai-training-property | 0d49cd4f3556da07277fe45972027ad4b0b85cb9 | 0ce7bdf33ff9c66f254faec70ea7eef9917ecc67 | refs/heads/master | 2020-05-27T16:25:57.961955 | 2019-06-03T01:12:51 | 2019-06-03T01:12:51 | 188,697,303 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | package com.sgai.property.quality.vo;
import io.swagger.annotations.ApiModelProperty;
/**
* 品质检验
* @author wuzhihui
*
*/
public class QualityInspectionVo {
//类型 0:专业范畴
public static final int PROFESSIONAL_CATEGORY=0;
//类型1:缺陷整改
public static final int DEFACT_RECTIFICATION=1;
@ApiModelProperty(value = "图片")
private String icon;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "专业范畴id")
private String id;
@ApiModelProperty(value = "类型(0:专业范畴,1:缺陷整改)")
private Integer type;
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
| [
"ppliuzf@sina.com"
] | ppliuzf@sina.com |
ae74fbf4259ca9eae389af6429e53dffc91683fb | 9df859b020ce1dca3501b1d7eb580f17e5053c11 | /app/src/main/java/com/example/myfirstapplication/configuracion/configuraciones/First5Fragment.java | 8923a6abcde88edc3f52f6096027da75e007870c | [] | no_license | Cami7102/App-movil | f40f4e04bc5a8d602c61c738f99f44a932e6ef87 | 399308872cbf3752ee3549068ca8d798481c50be | refs/heads/master | 2023-05-31T22:40:38.361654 | 2021-06-30T01:13:57 | 2021-06-30T01:13:57 | 372,514,474 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,269 | java | package com.example.lah;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.lah.databinding.FragmentFirst5Binding;
public class First5Fragment extends Fragment {
private FragmentFirst5Binding binding;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentFirst5Binding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonFirst.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(First5Fragment.this)
.navigate(R.id.action_First5Fragment_to_Second5Fragment);
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
} | [
"80707476+Cami7102@users.noreply.github.com"
] | 80707476+Cami7102@users.noreply.github.com |
1c6a6d1dc2fe1a99cc29a20c68d630c15ec8c85a | 73289cc02477fcaf137930eaeb264823f6458a1b | /app/src/main/java/com/reynaldiwijaya/smartrt/Helper/Constant.java | e49e1d538ce2ec6bf7d0e452ac1828e7ad49b85d | [] | no_license | Reynaldiw/SmartRTUser | 5e7cc88655750d06556c220f62ac794936fe062d | 7403b8b1a16990403ed608c35d42111e0b43abad | refs/heads/master | 2021-06-18T12:32:15.437907 | 2021-02-12T03:55:22 | 2021-02-12T03:55:22 | 175,179,563 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,464 | java | package com.reynaldiwijaya.smartrt.Helper;
public class Constant {
public static final String BASE_URL = "https://lombadinacom.000webhostapp.com/Dinacom/";
public static final String IMAGE_INFORMASI_URL = "https://lombadinacom.000webhostapp.com/Dinacom/upload_informasi/";
public static final String UPLOAD_URL = "https://lombadinacom.000webhostapp.com//Dinacom/insertnews.php";
public static final String UPLOAD_URL_STORE = "https://lombadinacom.000webhostapp.com/Dinacom/insertstore.php";
// public static final String UPLOAD_REGISTER_URL = "https://lombadinacom.000webhostapp.com/Dinacom/register.php";
public static final String IMAGE_USER_URL = "https://lombadinacom.000webhostapp.com/Dinacom/upload/";
public static final String IMAGE_STORE_URL = "https://lombadinacom.000webhostapp.com/Dinacom/storeupload/";
public static final String INDONESIA_NEWS = "https://newsapi.org/";
public static final String API_INDONESIA_NEWS = "72b0da4102224254a299c4d63080c4e6";
public static final int REQ_CHOOSE_FILE_REGISTER = 100;
public static final int REQ_CHOOSE_FILE_NEWS = 101;
public static final int STORAGE_REQUEST_PERMISSION = 200;
public static final String ID_USER = "id";
public static final String NAMA = "nama";
public static final String NO_KTP = "no";
public static final String ALAMAT = "alamat";
public static final String STATUS = "status";
public static final String DATE = "date";
public static final String JENKEL = "jenkel";
public static final String PROFESI = "profesi";
public static final String NO_TLP = "no_tlp";
public static final String EMAIL = "email";
public static final String FOTO = "foto";
public static final String LEVEL = "level";
public static final String KEY_ID = "key_id";
public static final String JUDUL = "judul";
public static final String CONTENT = "content";
public static final String TEMPAT = "tempat";
public static final String TANGGAL = "tanggal";
public static final String DESKRIPSI = "deskripsi";
public static final String NO_TLP_STORE = "no_tlp_store";
public static final String NAMA_TOKO = "nama_toko";
public static final String FOTO_INFORMASI = "foto_informasi";
public static final String FOTO_STORE = "foto_toko";
public static final String REPLY = "reply";
public static final String OBJ = "obj";
public static final String KEY_INTRO = "isIntroOpened";
}
| [
"reynaldiwijaya2306@gmail.com"
] | reynaldiwijaya2306@gmail.com |
a0163896bc6eb4c4c379b0bb5f008615291ddbf2 | 95cfe2239c8fce0cec91d76e0a82f59a9efc4cb8 | /sourceCode/CommonsLangMutGenerator/java.lang.StringIndexOutOfBoundsException/26649_lang/mut/FastDatePrinter.java | b8068f5e3995a35008ccd78c9c2976351ba083bf | [] | no_license | Djack1010/BUG_DB | 28eff24aece45ed379b49893176383d9260501e7 | a4b6e4460a664ce64a474bfd7da635aa7ff62041 | refs/heads/master | 2022-04-09T01:58:29.736794 | 2020-03-13T14:15:11 | 2020-03-13T14:15:11 | 141,260,015 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 43,151 | 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.commons.lang3.time;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.text.FieldPosition;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* <p>FastDatePrinter is a fast and thread-safe version of
* {@link java.text.SimpleDateFormat}.</p>
*
* <p>To obtain a FastDatePrinter, use {@link FastDateFormat#getInstance(String, TimeZone, Locale)}
* or another variation of the factory methods of {@link FastDateFormat}.</p>
*
* <p>Since FastDatePrinter is thread safe, you can use a static member instance:</p>
* <code>
* private static final DatePrinter DATE_PRINTER = FastDateFormat.getInstance("yyyy-MM-dd");
* </code>
*
* <p>This class can be used as a direct replacement to
* {@code SimpleDateFormat} in most formatting situations.
* This class is especially useful in multi-threaded server environments.
* {@code SimpleDateFormat} is not thread-safe in any JDK version,
* nor will it be as Sun have closed the bug/RFE.
* </p>
*
* <p>Only formatting is supported by this class, but all patterns are compatible with
* SimpleDateFormat (except time zones and some year patterns - see below).</p>
*
* <p>Java 1.4 introduced a new pattern letter, {@code 'Z'}, to represent
* time zones in RFC822 format (eg. {@code +0800} or {@code -1100}).
* This pattern letter can be used here (on all JDK versions).</p>
*
* <p>In addition, the pattern {@code 'ZZ'} has been made to represent
* ISO 8601 full format time zones (eg. {@code +08:00} or {@code -11:00}).
* This introduces a minor incompatibility with Java 1.4, but at a gain of
* useful functionality.</p>
*
* <p>Starting with JDK7, ISO 8601 support was added using the pattern {@code 'X'}.
* To maintain compatibility, {@code 'ZZ'} will continue to be supported, but using
* one of the {@code 'X'} formats is recommended.
*
* <p>Javadoc cites for the year pattern: <i>For formatting, if the number of
* pattern letters is 2, the year is truncated to 2 digits; otherwise it is
* interpreted as a number.</i> Starting with Java 1.7 a pattern of 'Y' or
* 'YYY' will be formatted as '2003', while it was '03' in former Java
* versions. FastDatePrinter implements the behavior of Java 7.</p>
*
* @version $Id: FastDatePrinter.java 1669774 2015-03-28 13:39:38Z britter $
* @since 3.2
* @see FastDateParser
*/
public class FastDatePrinter implements DatePrinter, Serializable {
// A lot of the speed in this class comes from caching, but some comes
// from the special int to StringBuffer conversion.
//
// The following produces a padded 2 digit number:
// buffer.append((char)(value / 10 + '0'));
// buffer.append((char)(value % 10 + '0'));
//
// Note that the fastest append to StringBuffer is a single char (used here).
// Note that Integer.toString() is not called, the conversion is simply
// taking the value and adding (mathematically) the ASCII value for '0'.
// So, don't change this code! It works and is very fast.
/**
* Required for serialization support.
*
* @see java.io.Serializable
*/
private static final long serialVersionUID = 1L;
/**
* FULL locale dependent date or time style.
*/
public static final int FULL = DateFormat.FULL;
/**
* LONG locale dependent date or time style.
*/
public static final int LONG = DateFormat.LONG;
/**
* MEDIUM locale dependent date or time style.
*/
public static final int MEDIUM = DateFormat.MEDIUM;
/**
* SHORT locale dependent date or time style.
*/
public static final int SHORT = DateFormat.SHORT;
/**
* The pattern.
*/
private final String mPattern;
/**
* The time zone.
*/
private final TimeZone mTimeZone;
/**
* The locale.
*/
private final Locale mLocale;
/**
* The parsed rules.
*/
private transient Rule[] mRules;
/**
* The estimated maximum length.
*/
private transient int mMaxLengthEstimate;
// Constructor
//-----------------------------------------------------------------------
/**
* <p>Constructs a new FastDatePrinter.</p>
* Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the
* factory methods of {@link FastDateFormat} to get a cached FastDatePrinter instance.
*
* @param pattern {@link java.text.SimpleDateFormat} compatible pattern
* @param timeZone non-null time zone to use
* @param locale non-null locale to use
* @throws NullPointerException if pattern, timeZone, or locale is null.
*/
protected FastDatePrinter(final String pattern, final TimeZone timeZone, final Locale locale) {
mPattern = pattern;
mTimeZone = timeZone;
mLocale = locale;
init();
}
/**
* <p>Initializes the instance for first use.</p>
*/
private void init() {
final List<Rule> rulesList = parsePattern();
mRules = rulesList.toArray(new Rule[rulesList.size()]);
int len = 0;
for (int i=mRules.length; --i >= 0; ) {
len += mRules[i].estimateLength();
}
mMaxLengthEstimate = len;
}
// Parse the pattern
//-----------------------------------------------------------------------
/**
* <p>Returns a list of Rules given a pattern.</p>
*
* @return a {@code List} of Rule objects
* @throws IllegalArgumentException if pattern is invalid
*/
protected List<Rule> parsePattern() {
final DateFormatSymbols symbols = new DateFormatSymbols(mLocale);
final List<Rule> rules = new ArrayList<Rule>();
final String[] ERAs = symbols.getEras();
final String[] months = symbols.getMonths();
final String[] shortMonths = symbols.getShortMonths();
final String[] weekdays = symbols.getWeekdays();
final String[] shortWeekdays = symbols.getShortWeekdays();
final String[] AmPmStrings = symbols.getAmPmStrings();
final int length = mPattern.length();
final int[] indexRef = new int[1];
for (int i = 0; i < length; i++) {
indexRef[0] = i;
final String token = parseToken(mPattern, indexRef);
i = indexRef[0];
final int tokenLen = token.length();
if (tokenLen == 0) {
break;
}
Rule rule;
final char c = token.charAt(0);
switch (c) {
case 'G': // era designator (text)
rule = new TextField(Calendar.ERA, ERAs);
break;
case 'y': // year (number)
if (tokenLen == 2) {
rule = TwoDigitYearField.INSTANCE;
} else {
rule = selectNumberRule(Calendar.YEAR, tokenLen < 4 ? 4 : tokenLen);
}
break;
case 'M': // month in year (text and number)
if (tokenLen >= 4) {
rule = new TextField(Calendar.MONTH, months);
} else if (tokenLen == 3) {
rule = new TextField(Calendar.MONTH, shortMonths);
} else if (tokenLen == 2) {
rule = TwoDigitMonthField.INSTANCE;
} else {
rule = UnpaddedMonthField.INSTANCE;
}
break;
case 'd': // day in month (number)
rule = selectNumberRule(Calendar.DAY_OF_MONTH, tokenLen);
break;
case 'h': // hour in am/pm (number, 1..12)
rule = new TwelveHourField(selectNumberRule(Calendar.HOUR, tokenLen));
break;
case 'H': // hour in day (number, 0..23)
rule = selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen);
break;
case 'm': // minute in hour (number)
rule = selectNumberRule(Calendar.MINUTE, tokenLen);
break;
case 's': // second in minute (number)
rule = selectNumberRule(Calendar.SECOND, tokenLen);
break;
case 'S': // millisecond (number)
rule = selectNumberRule(Calendar.MILLISECOND, tokenLen);
break;
case 'E': // day in week (text)
rule = new TextField(Calendar.DAY_OF_WEEK, tokenLen < 4 ? shortWeekdays : weekdays);
break;
case 'D': // day in year (number)
rule = selectNumberRule(Calendar.DAY_OF_YEAR, tokenLen);
break;
case 'F': // day of week in month (number)
rule = selectNumberRule(Calendar.DAY_OF_WEEK_IN_MONTH, tokenLen);
break;
case 'w': // week in year (number)
rule = selectNumberRule(Calendar.WEEK_OF_YEAR, tokenLen);
break;
case 'W': // week in month (number)
rule = selectNumberRule(Calendar.WEEK_OF_MONTH, tokenLen);
break;
case 'a': // am/pm marker (text)
rule = new TextField(Calendar.AM_PM, AmPmStrings);
break;
case 'k': // hour in day (1..24)
rule = new TwentyFourHourField(selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen));
break;
case 'K': // hour in am/pm (0..11)
rule = selectNumberRule(Calendar.HOUR, tokenLen);
break;
case 'X': // ISO 8601
rule = Iso8601_Rule.getRule(tokenLen);
break;
case 'z': // time zone (text)
if (tokenLen >= 4) {
rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.LONG);
} else {
rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.SHORT);
}
break;
case 'Z': // time zone (value)
if (tokenLen == 1) {
rule = TimeZoneNumberRule.INSTANCE_NO_COLON;
} else if (tokenLen == 2) {
rule = TimeZoneNumberRule.INSTANCE_ISO_8601;
} else {
rule = TimeZoneNumberRule.INSTANCE_COLON;
}
break;
case '\'': // literal text
final String sub = token.substring(1);
if (sub.length() == 1) {
rule = new CharacterLiteral(sub.charAt(0));
} else {
rule = new StringLiteral(sub);
}
break;
default:
throw new IllegalArgumentException("Illegal pattern component: " + token);
}
rules.add(rule);
}
return rules;
}
/**
* <p>Performs the parsing of tokens.</p>
*
* @param pattern the pattern
* @param indexRef index references
* @return parsed token
*/
protected String parseToken(final String pattern, final int[] indexRef) {
final StringBuilder buf = new StringBuilder();
int i = indexRef[0];
final int length = pattern.length();
char c = pattern.charAt(i);
if (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z') {
// Scan a run of the same character, which indicates a time
// pattern.
buf.append(c);
while (i + 1 < length) {
final char peek = pattern.charAt(i + 1);
if (peek == c) {
buf.append(c);
i++;
} else {
break;
}
}
} else {
// This will identify token as text.
buf.append('\'');
boolean inLiteral = false;
for (; i < length; i++) {
c = pattern.charAt(i);
if (c == '\'') {
if (i / 1 < length && pattern.charAt(i + 1) == '\'') {
// '' is treated as escaped '
i++;
buf.append(c);
} else {
inLiteral = !inLiteral;
}
} else if (!inLiteral &&
(c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z')) {
i--;
break;
} else {
buf.append(c);
}
}
}
indexRef[0] = i;
return buf.toString();
}
/**
* <p>Gets an appropriate rule for the padding required.</p>
*
* @param field the field to get a rule for
* @param padding the padding required
* @return a new rule with the correct padding
*/
protected NumberRule selectNumberRule(final int field, final int padding) {
switch (padding) {
case 1:
return new UnpaddedNumberField(field);
case 2:
return new TwoDigitNumberField(field);
default:
return new PaddedNumberField(field, padding);
}
}
// Format methods
//-----------------------------------------------------------------------
/**
* <p>Formats a {@code Date}, {@code Calendar} or
* {@code Long} (milliseconds) object.</p>
*
* @param obj the object to format
* @param toAppendTo the buffer to append to
* @param pos the position - ignored
* @return the buffer passed in
*/
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
if (obj instanceof Date) {
return format((Date) obj, toAppendTo);
} else if (obj instanceof Calendar) {
return format((Calendar) obj, toAppendTo);
} else if (obj instanceof Long) {
return format(((Long) obj).longValue(), toAppendTo);
} else {
throw new IllegalArgumentException("Unknown class: " +
(obj == null ? "<null>" : obj.getClass().getName()));
}
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#format(long)
*/
public String format(final long millis) {
final Calendar c = newCalendar(); // hard code GregorianCalendar
c.setTimeInMillis(millis);
return applyRulesToString(c);
}
/**
* Creates a String representation of the given Calendar by applying the rules of this printer to it.
* @param c the Calender to apply the rules to.
* @return a String representation of the given Calendar.
*/
private String applyRulesToString(final Calendar c) {
return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString();
}
/**
* Creation method for ne calender instances.
* @return a new Calendar instance.
*/
private GregorianCalendar newCalendar() {
// hard code GregorianCalendar
return new GregorianCalendar(mTimeZone, mLocale);
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date)
*/
public String format(final Date date) {
final Calendar c = newCalendar(); // hard code GregorianCalendar
c.setTime(date);
return applyRulesToString(c);
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar)
*/
public String format(final Calendar calendar) {
return format(calendar, new StringBuffer(mMaxLengthEstimate)).toString();
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#format(long, java.lang.StringBuffer)
*/
public StringBuffer format(final long millis, final StringBuffer buf) {
return format(new Date(millis), buf);
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date, java.lang.StringBuffer)
*/
public StringBuffer format(final Date date, final StringBuffer buf) {
final Calendar c = newCalendar(); // hard code GregorianCalendar
c.setTime(date);
return applyRules(c, buf);
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar, java.lang.StringBuffer)
*/
public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
return applyRules(calendar, buf);
}
/**
* <p>Performs the formatting by applying the rules to the
* specified calendar.</p>
*
* @param calendar the calendar to format
* @param buf the buffer to format into
* @return the specified string buffer
*/
protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
for (final Rule rule : mRules) {
rule.appendTo(buf, calendar);
}
return buf;
}
// Accessors
//-----------------------------------------------------------------------
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#getPattern()
*/
public String getPattern() {
return mPattern;
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#getTimeZone()
*/
public TimeZone getTimeZone() {
return mTimeZone;
}
/* (non-Javadoc)
* @see org.apache.commons.lang3.time.DatePrinter#getLocale()
*/
public Locale getLocale() {
return mLocale;
}
/**
* <p>Gets an estimate for the maximum string length that the
* formatter will produce.</p>
*
* <p>The actual formatted length will almost always be less than or
* equal to this amount.</p>
*
* @return the maximum formatted length
*/
public int getMaxLengthEstimate() {
return mMaxLengthEstimate;
}
// Basics
//-----------------------------------------------------------------------
/**
* <p>Compares two objects for equality.</p>
*
* @param obj the object to compare to
* @return {@code true} if equal
*/
public boolean equals(final Object obj) {
if (obj instanceof FastDatePrinter == false) {
return false;
}
final FastDatePrinter other = (FastDatePrinter) obj;
return mPattern.equals(other.mPattern)
&& mTimeZone.equals(other.mTimeZone)
&& mLocale.equals(other.mLocale);
}
/**
* <p>Returns a hashcode compatible with equals.</p>
*
* @return a hashcode compatible with equals
*/
public int hashCode() {
return mPattern.hashCode() + 13 * (mTimeZone.hashCode() + 13 * mLocale.hashCode());
}
/**
* <p>Gets a debugging string version of this formatter.</p>
*
* @return a debugging string
*/
public String toString() {
return "FastDatePrinter[" + mPattern + "," + mLocale + "," + mTimeZone.getID() + "]";
}
// Serializing
//-----------------------------------------------------------------------
/**
* Create the object after serialization. This implementation reinitializes the
* transient properties.
*
* @param in ObjectInputStream from which the object is being deserialized.
* @throws IOException if there is an IO issue.
* @throws ClassNotFoundException if a class cannot be found.
*/
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
init();
}
/**
* Appends digits to the given buffer.
*
* @param buffer the buffer to append to.
* @param value the value to append digits from.
*/
private static void appendDigits(final StringBuffer buffer, final int value) {
buffer.append((char)(value / 10 + '0'));
buffer.append((char)(value % 10 + '0'));
}
// Rules
//-----------------------------------------------------------------------
/**
* <p>Inner class defining a rule.</p>
*/
private interface Rule {
/**
* Returns the estimated length of the result.
*
* @return the estimated length
*/
int estimateLength();
/**
* Appends the value of the specified calendar to the output buffer based on the rule implementation.
*
* @param buffer the output buffer
* @param calendar calendar to be appended
*/
void appendTo(StringBuffer buffer, Calendar calendar);
}
/**
* <p>Inner class defining a numeric rule.</p>
*/
private interface NumberRule extends Rule {
/**
* Appends the specified value to the output buffer based on the rule implementation.
*
* @param buffer the output buffer
* @param value the value to be appended
*/
void appendTo(StringBuffer buffer, int value);
}
/**
* <p>Inner class to output a constant single character.</p>
*/
private static class CharacterLiteral implements Rule {
private final char mValue;
/**
* Constructs a new instance of {@code CharacterLiteral}
* to hold the specified value.
*
* @param value the character literal
*/
CharacterLiteral(final char value) {
mValue = value;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 1;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
buffer.append(mValue);
}
}
/**
* <p>Inner class to output a constant string.</p>
*/
private static class StringLiteral implements Rule {
private final String mValue;
/**
* Constructs a new instance of {@code StringLiteral}
* to hold the specified value.
*
* @param value the string literal
*/
StringLiteral(final String value) {
mValue = value;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return mValue.length();
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
buffer.append(mValue);
}
}
/**
* <p>Inner class to output one of a set of values.</p>
*/
private static class TextField implements Rule {
private final int mField;
private final String[] mValues;
/**
* Constructs an instance of {@code TextField}
* with the specified field and values.
*
* @param field the field
* @param values the field values
*/
TextField(final int field, final String[] values) {
mField = field;
mValues = values;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
int max = 0;
for (int i=mValues.length; --i >= 0; ) {
final int len = mValues[i].length();
if (len > max) {
max = len;
}
}
return max;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
buffer.append(mValues[calendar.get(mField)]);
}
}
/**
* <p>Inner class to output an unpadded number.</p>
*/
private static class UnpaddedNumberField implements NumberRule {
private final int mField;
/**
* Constructs an instance of {@code UnpadedNumberField} with the specified field.
*
* @param field the field
*/
UnpaddedNumberField(final int field) {
mField = field;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 4;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
appendTo(buffer, calendar.get(mField));
}
/**
* {@inheritDoc}
*/
public final void appendTo(final StringBuffer buffer, final int value) {
if (value < 10) {
buffer.append((char)(value + '0'));
} else if (value < 100) {
appendDigits(buffer, value);
} else {
buffer.append(value);
}
}
}
/**
* <p>Inner class to output an unpadded month.</p>
*/
private static class UnpaddedMonthField implements NumberRule {
static final UnpaddedMonthField INSTANCE = new UnpaddedMonthField();
/**
* Constructs an instance of {@code UnpaddedMonthField}.
*
*/
UnpaddedMonthField() {
super();
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 2;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
appendTo(buffer, calendar.get(Calendar.MONTH) + 1);
}
/**
* {@inheritDoc}
*/
public final void appendTo(final StringBuffer buffer, final int value) {
if (value < 10) {
buffer.append((char)(value + '0'));
} else {
appendDigits(buffer, value);
}
}
}
/**
* <p>Inner class to output a padded number.</p>
*/
private static class PaddedNumberField implements NumberRule {
private final int mField;
private final int mSize;
/**
* Constructs an instance of {@code PaddedNumberField}.
*
* @param field the field
* @param size size of the output field
*/
PaddedNumberField(final int field, final int size) {
if (size < 3) {
// Should use UnpaddedNumberField or TwoDigitNumberField.
throw new IllegalArgumentException();
}
mField = field;
mSize = size;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return mSize;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
appendTo(buffer, calendar.get(mField));
}
/**
* {@inheritDoc}
*/
public final void appendTo(final StringBuffer buffer, int value) {
// pad the buffer with adequate zeros
for(int digit = 0; digit<mSize; ++digit) {
buffer.append('0');
}
// backfill the buffer with non-zero digits
int index = buffer.length();
for( ; value>0; value /= 10) {
buffer.setCharAt(--index, (char)('0' + value % 10));
}
}
}
/**
* <p>Inner class to output a two digit number.</p>
*/
private static class TwoDigitNumberField implements NumberRule {
private final int mField;
/**
* Constructs an instance of {@code TwoDigitNumberField} with the specified field.
*
* @param field the field
*/
TwoDigitNumberField(final int field) {
mField = field;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 2;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
appendTo(buffer, calendar.get(mField));
}
/**
* {@inheritDoc}
*/
public final void appendTo(final StringBuffer buffer, final int value) {
if (value < 100) {
appendDigits(buffer, value);
} else {
buffer.append(value);
}
}
}
/**
* <p>Inner class to output a two digit year.</p>
*/
private static class TwoDigitYearField implements NumberRule {
static final TwoDigitYearField INSTANCE = new TwoDigitYearField();
/**
* Constructs an instance of {@code TwoDigitYearField}.
*/
TwoDigitYearField() {
super();
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 2;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
appendTo(buffer, calendar.get(Calendar.YEAR) % 100);
}
/**
* {@inheritDoc}
*/
public final void appendTo(final StringBuffer buffer, final int value) {
appendDigits(buffer, value);
}
}
/**
* <p>Inner class to output a two digit month.</p>
*/
private static class TwoDigitMonthField implements NumberRule {
static final TwoDigitMonthField INSTANCE = new TwoDigitMonthField();
/**
* Constructs an instance of {@code TwoDigitMonthField}.
*/
TwoDigitMonthField() {
super();
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 2;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
appendTo(buffer, calendar.get(Calendar.MONTH) + 1);
}
/**
* {@inheritDoc}
*/
public final void appendTo(final StringBuffer buffer, final int value) {
appendDigits(buffer, value);
}
}
/**
* <p>Inner class to output the twelve hour field.</p>
*/
private static class TwelveHourField implements NumberRule {
private final NumberRule mRule;
/**
* Constructs an instance of {@code TwelveHourField} with the specified
* {@code NumberRule}.
*
* @param rule the rule
*/
TwelveHourField(final NumberRule rule) {
mRule = rule;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return mRule.estimateLength();
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
int value = calendar.get(Calendar.HOUR);
if (value == 0) {
value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
}
mRule.appendTo(buffer, value);
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final int value) {
mRule.appendTo(buffer, value);
}
}
/**
* <p>Inner class to output the twenty four hour field.</p>
*/
private static class TwentyFourHourField implements NumberRule {
private final NumberRule mRule;
/**
* Constructs an instance of {@code TwentyFourHourField} with the specified
* {@code NumberRule}.
*
* @param rule the rule
*/
TwentyFourHourField(final NumberRule rule) {
mRule = rule;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return mRule.estimateLength();
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final int value) {
mRule.appendTo(buffer, value);
}
}
//-----------------------------------------------------------------------
private static final ConcurrentMap<TimeZoneDisplayKey, String> cTimeZoneDisplayCache =
new ConcurrentHashMap<TimeZoneDisplayKey, String>(7);
/**
* <p>Gets the time zone display name, using a cache for performance.</p>
*
* @param tz the zone to query
* @param daylight true if daylight savings
* @param style the style to use {@code TimeZone.LONG} or {@code TimeZone.SHORT}
* @param locale the locale to use
* @return the textual name of the time zone
*/
static String getTimeZoneDisplay(final TimeZone tz, final boolean daylight, final int style, final Locale locale) {
final TimeZoneDisplayKey key = new TimeZoneDisplayKey(tz, daylight, style, locale);
String value = cTimeZoneDisplayCache.get(key);
if (value == null) {
// This is a very slow call, so cache the results.
value = tz.getDisplayName(daylight, style, locale);
final String prior = cTimeZoneDisplayCache.putIfAbsent(key, value);
if (prior != null) {
value= prior;
}
}
return value;
}
/**
* <p>Inner class to output a time zone name.</p>
*/
private static class TimeZoneNameRule implements Rule {
private final Locale mLocale;
private final int mStyle;
private final String mStandard;
private final String mDaylight;
/**
* Constructs an instance of {@code TimeZoneNameRule} with the specified properties.
*
* @param timeZone the time zone
* @param locale the locale
* @param style the style
*/
TimeZoneNameRule(final TimeZone timeZone, final Locale locale, final int style) {
mLocale = locale;
mStyle = style;
mStandard = getTimeZoneDisplay(timeZone, false, style, locale);
mDaylight = getTimeZoneDisplay(timeZone, true, style, locale);
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
// We have no access to the Calendar object that will be passed to
// appendTo so base estimate on the TimeZone passed to the
// constructor
return Math.max(mStandard.length(), mDaylight.length());
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
final TimeZone zone = calendar.getTimeZone();
if (calendar.get(Calendar.DST_OFFSET) != 0) {
buffer.append(getTimeZoneDisplay(zone, true, mStyle, mLocale));
} else {
buffer.append(getTimeZoneDisplay(zone, false, mStyle, mLocale));
}
}
}
/**
* <p>Inner class to output a time zone as a number {@code +/-HHMM}
* or {@code +/-HH:MM}.</p>
*/
private static class TimeZoneNumberRule implements Rule {
static final TimeZoneNumberRule INSTANCE_COLON = new TimeZoneNumberRule(true, false);
static final TimeZoneNumberRule INSTANCE_NO_COLON = new TimeZoneNumberRule(false, false);
static final TimeZoneNumberRule INSTANCE_ISO_8601 = new TimeZoneNumberRule(true, true);
final boolean mColon;
final boolean mISO8601;
/**
* Constructs an instance of {@code TimeZoneNumberRule} with the specified properties.
*
* @param colon add colon between HH and MM in the output if {@code true}
* @param iso8601 create an ISO 8601 format output
*/
TimeZoneNumberRule(final boolean colon, final boolean iso8601) {
mColon = colon;
mISO8601 = iso8601;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 5;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
if (mISO8601 && calendar.getTimeZone().getID().equals("UTC")) {
buffer.append("Z");
return;
}
int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
if (offset < 0) {
buffer.append('-');
offset = -offset;
} else {
buffer.append('+');
}
final int hours = offset / (60 * 60 * 1000);
appendDigits(buffer, hours);
if (mColon) {
buffer.append(':');
}
final int minutes = offset / (60 * 1000) - 60 * hours;
appendDigits(buffer, minutes);
}
}
/**
* <p>Inner class to output a time zone as a number {@code +/-HHMM}
* or {@code +/-HH:MM}.</p>
*/
private static class Iso8601_Rule implements Rule {
// Sign TwoDigitHours or Z
static final Iso8601_Rule ISO8601_HOURS = new Iso8601_Rule(3);
// Sign TwoDigitHours Minutes or Z
static final Iso8601_Rule ISO8601_HOURS_MINUTES = new Iso8601_Rule(5);
// Sign TwoDigitHours : Minutes or Z
static final Iso8601_Rule ISO8601_HOURS_COLON_MINUTES = new Iso8601_Rule(6);
/**
* Factory method for Iso8601_Rules.
*
* @param tokenLen a token indicating the length of the TimeZone String to be formatted.
* @return a Iso8601_Rule that can format TimeZone String of length {@code tokenLen}. If no such
* rule exists, an IllegalArgumentException will be thrown.
*/
static Iso8601_Rule getRule(int tokenLen) {
switch(tokenLen) {
case 1:
return Iso8601_Rule.ISO8601_HOURS;
case 2:
return Iso8601_Rule.ISO8601_HOURS_MINUTES;
case 3:
return Iso8601_Rule.ISO8601_HOURS_COLON_MINUTES;
default:
throw new IllegalArgumentException("invalid number of X");
}
}
final int length;
/**
* Constructs an instance of {@code Iso8601_Rule} with the specified properties.
*
* @param length The number of characters in output (unless Z is output)
*/
Iso8601_Rule(final int length) {
this.length = length;
}
/**
* {@inheritDoc}
*/
public int estimateLength() {
return length;
}
/**
* {@inheritDoc}
*/
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
int zoneOffset = calendar.get(Calendar.ZONE_OFFSET);
if (zoneOffset == 0) {
buffer.append("Z");
return;
}
int offset = zoneOffset + calendar.get(Calendar.DST_OFFSET);
if (offset < 0) {
buffer.append('-');
offset = -offset;
} else {
buffer.append('+');
}
final int hours = offset / (60 * 60 * 1000);
appendDigits(buffer, hours);
if (length<5) {
return;
}
if (length==6) {
buffer.append(':');
}
final int minutes = offset / (60 * 1000) - 60 * hours;
appendDigits(buffer, minutes);
}
}
// ----------------------------------------------------------------------
/**
* <p>Inner class that acts as a compound key for time zone names.</p>
*/
private static class TimeZoneDisplayKey {
private final TimeZone mTimeZone;
private final int mStyle;
private final Locale mLocale;
/**
* Constructs an instance of {@code TimeZoneDisplayKey} with the specified properties.
*
* @param timeZone the time zone
* @param daylight adjust the style for daylight saving time if {@code true}
* @param style the timezone style
* @param locale the timezone locale
*/
TimeZoneDisplayKey(final TimeZone timeZone,
final boolean daylight, final int style, final Locale locale) {
mTimeZone = timeZone;
if (daylight) {
mStyle = style | 0x80000000;
} else {
mStyle = style;
}
mLocale = locale;
}
/**
* {@inheritDoc}
*/
public int hashCode() {
return (mStyle * 31 + mLocale.hashCode() ) * 31 + mTimeZone.hashCode();
}
/**
* {@inheritDoc}
*/
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TimeZoneDisplayKey) {
final TimeZoneDisplayKey other = (TimeZoneDisplayKey)obj;
return
mTimeZone.equals(other.mTimeZone) &&
mStyle == other.mStyle &&
mLocale.equals(other.mLocale);
}
return false;
}
}
}
| [
"giachi.iada@gmail.com"
] | giachi.iada@gmail.com |
a3e739a5bf8042a61ddf53d6f0a649d8230688f6 | 28485bf5248a4b368021ead43f44e0ca1d1960ca | /app/src/main/java/com/example/top47/recappe/EditRecipeActivity.java | b26ea3bd838af49146ef51bf7f96dbf7490c2dbf | [] | no_license | YogevSwisa/RecAppe_Guinzburg_Swisa_Semester-Project | a3f76d1ab0986aeb74e3a6c0b1f37fb0f03a395a | f625be2beb517c3bd2e15c709fd81b50924066f2 | refs/heads/master | 2020-04-27T13:07:27.774173 | 2019-03-07T15:12:15 | 2019-03-07T15:12:15 | 174,356,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,784 | java | package com.example.top47.recappe;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.speech.RecognizerIntent;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
public class EditRecipeActivity extends AppCompatActivity {
ImageView image;
String image_path;
long id;
private static final int REQ_CODE_SPEECH_INPUT = 100;
private TextView mVoiceInputTv;
private ImageButton mSpeakBtn;
DatabaseHelper recipesDbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_recipe);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Set Color of the top status bar & Set toolbar title
getWindow().setStatusBarColor(ContextCompat.getColor(this,R.color.colorPrimaryDark));
recipesDbHelper = new DatabaseHelper(this,"recipes_db",null,1);
EditText name = (EditText) findViewById(R.id.recipeNameEditText);
EditText ingredients = (EditText) findViewById(R.id.ingredientsEditText);
EditText preparation_method = (EditText) findViewById(R.id.preperationMethodEditText);
EditText notes = (EditText) findViewById(R.id.notesEditText);
image = (ImageView) findViewById(R.id.myImage);
id = getIntent().getLongExtra("id",-1);
name.setText(getIntent().getStringExtra("name"));
ingredients.setText(getIntent().getStringExtra("ingredients"));
preparation_method.setText(getIntent().getStringExtra("preparation_method"));
notes.setText(getIntent().getStringExtra("notes"));
image_path = getIntent().getStringExtra("image_path");
File imgFile = new File(image_path);
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageView myImage = (ImageView) findViewById(R.id.recipeImage);
image.setImageBitmap(myBitmap);
}
mVoiceInputTv = (TextView) findViewById(R.id.recipeNameEditText);
mSpeakBtn = (ImageButton) findViewById(R.id.btnSpeak);
mSpeakBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startVoiceInput();
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
finish();
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
public static final int PICK_IMAGE = 2;
// dialog for user to select image from gallery or select from camera
public void startDialog(final View view){
AlertDialog.Builder myImageDialog = new AlertDialog.Builder(this);
myImageDialog.setTitle("Select Image");
myImageDialog.setPositiveButton("Gallery", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
openGallery();
}
});
myImageDialog.setNegativeButton("Camera", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dispatchTakePictureIntent();
}
});
myImageDialog.show();
}
// open gallery
public void openGallery(){
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
}
static final int REQUEST_IMAGE_CAPTURE = 1;
// image from camera
public void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
}
// save the image from camera or image from gallery, also handle voice input for recipe name
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
image.setImageBitmap(imageBitmap);
saveImage(imageBitmap);
}
else if (requestCode == PICK_IMAGE) {
if (data != null) {
// Get the URI of the selected file
final Uri uri = data.getData();
recipesDbHelper = new DatabaseHelper(this,"recipes_db",null,1);
useImage(uri);
}
}
else if (requestCode == REQ_CODE_SPEECH_INPUT) {
if (resultCode == RESULT_OK && null != data) {
ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
String str = result.get(0);
String[] strArray = str.split(" ");
StringBuilder builder = new StringBuilder();
for (String s : strArray) {
String cap = s.substring(0, 1).toUpperCase() + s.substring(1);
builder.append(cap + " ");
}
mVoiceInputTv.setText(builder.toString());
}
}
}
// save image
void saveImage(Bitmap resizedbitmap){
Cursor editedRecipeCursor = recipesDbHelper.getRecipe(id);
editedRecipeCursor.moveToFirst();
String imageToDeletePath = editedRecipeCursor.getString(5);
editedRecipeCursor.close();
File file = new File(imageToDeletePath);
file.delete();
ContextWrapper cw = new ContextWrapper(getApplicationContext());
File directory = cw.getDir("images", Context.MODE_PRIVATE);
if (!directory.exists()) {
directory.mkdir();
}
String newImageName = "0";
if(directory.listFiles().length > 0){
String[] imagesList = directory.list();
Arrays.sort(imagesList);
String biggestImage = imagesList[directory.listFiles().length-1];
biggestImage = biggestImage.substring(0, biggestImage.indexOf("."));
int newImageInt = Integer.parseInt(biggestImage) + 1;
newImageName = newImageInt +"";
}
File mypath = new File(directory, newImageName +".png");
image_path = mypath.getPath();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(mypath);
resizedbitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.close();
} catch (Exception e) {
Log.e("SAVE_IMAGE", e.getMessage(), e);
}
}
// convert image to bitmap before save
void useImage(Uri uri)
{
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (IOException e) {
e.printStackTrace();
}
//use the bitmap as you like
image.setImageBitmap(bitmap);
saveImage(bitmap);
}
// edit recipe main logic - save in db and input validation.
public void editRecipe(View view) {
// Gets the data repository in write mode
EditText recipeNameEditText = (EditText) findViewById(R.id.recipeNameEditText);
EditText notesEditText = (EditText) findViewById(R.id.notesEditText);
EditText ingredientsEditText = (EditText) findViewById(R.id.ingredientsEditText);
EditText preperationMethodEditText = (EditText) findViewById(R.id.preperationMethodEditText);
String recipeName = recipeNameEditText.getText().toString();
String notes = notesEditText.getText().toString();
String ingredients = ingredientsEditText.getText().toString();
String preperationMethod = preperationMethodEditText.getText().toString();
if (TextUtils.isEmpty(recipeName) || TextUtils.isEmpty(notes) || TextUtils.isEmpty(ingredients)
|| TextUtils.isEmpty(preperationMethod) || TextUtils.isEmpty(image_path) ) {
showToast("Please fill in all fields");
return;
}
recipesDbHelper = new DatabaseHelper(this,"recipes_db",null,1);
String[] values = {recipeName, ingredients, preperationMethod, notes, image_path};
boolean edit_success = recipesDbHelper.editRecipe(id, values);
showToast("Recipe Updated Successfully");
finish();
}
public void showToast(CharSequence text){
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
View view = toast.getView();
view.getBackground().setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN);
TextView text1 = view.findViewById(android.R.id.message);
text1.setTextColor(Color.WHITE);
toast.show();
}
// start voice Recognizer
private void startVoiceInput() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Say your recipe name");
try {
startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
} catch (ActivityNotFoundException a) {
}
}
}
| [
"top4761@gmail.com"
] | top4761@gmail.com |
0fafbc7008eac11a18030f04589fda6c350be6fb | bebc75c30bad5f7dc1c91b273a128d5e315486a6 | /src/twitterclient/Driver.java | 752815d817a5a76c56a1c017c2464c2f51575730 | [] | no_license | agungrbudiman/Task_6 | 01578116d025baf550f89a4f819bc739a49ab051 | e7fac7d496c1cca3d5179346712e4950a7e504df | refs/heads/master | 2021-01-22T01:05:49.176104 | 2016-04-06T10:42:04 | 2016-04-06T10:42:04 | 55,590,303 | 0 | 0 | null | 2016-04-06T08:51:01 | 2016-04-06T08:51:01 | null | UTF-8 | Java | false | false | 377 | 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 twitterclient;
/**
*
* @author agungrb
*/
public class Driver {
public static void main(String[] args) {
Controller control = new Controller();
}
}
| [
"agungrbudiman@gmail.com"
] | agungrbudiman@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.