blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a22a765b9d835d2db3ebfa1ecd3b773ea94f7952 | b9ec089702ecaaf878a5bc53d7672fb23d9c71f5 | /src/main/java/com/kft/kalkulator/service/memory/ButorServiceImpl.java | b102b255f5801c07523e7c85047ce375f41312cf | [] | no_license | HomeWorksJava/duna16_17_2_TEAM01 | 791bf60ae042bb1c24423055a42cc893b5070c40 | 0926fdef8bd9894aeda73adc421ad04df4a86202 | refs/heads/master | 2021-01-20T13:11:02.920116 | 2017-05-17T18:03:35 | 2017-05-17T18:03:35 | 90,458,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | package com.kft.kalkulator.service.memory;
import com.kft.kalkulator.datamodel.Butor;
import com.kft.kalkulator.datamodel.Mennyiseg;
import com.kft.kalkulator.datamodel.Szoba;
import com.kft.kalkulator.service.api.ButorService;
public class ButorServiceImpl implements ButorService {
public long getAr(Butor butor, Mennyiseg mennyiseg) throws NullPointerException {
return butor.getAr() * mennyiseg.getMennyiseg();
}
public Butor getButorById(long id) throws NullPointerException {
for (Szoba szoba : DataStore.lakas.getSzobak()) {
for (Butor butor : szoba.getBerendezes()) {
if (butor.getID() == id) {
return butor;
}
}
}
throw new NullPointerException();
}
public Mennyiseg getMennyisegById(long id) throws NullPointerException {
for (Mennyiseg mennyiseg : DataStore.lakas.getMennyisegek()) {
if (mennyiseg.getID() == id) {
return mennyiseg;
}
}
throw new NullPointerException();
}
}
| [
"[email protected]"
] | |
ee0f159b2d0e3bb1a42c77cd9dc3a851d2bc8aca | 5ea9d513db29294923c7b14b8f038bd2b6e46f9d | /src/main/java/net/lesno/stock/entitys/model/BaseModel.java | a3b9608d485c6f41eed2fc839d08deab389fbef8 | [] | no_license | dbborisov/Stock-Monitoring | f970290b7cfd6b43921652493c6285a7cd1f7c8e | 3dc73f103e50737282278a3bdf01b7338bf3ef0a | refs/heads/master | 2022-09-07T07:26:10.032883 | 2020-02-03T19:43:28 | 2020-02-03T19:43:28 | 232,622,090 | 0 | 0 | null | 2022-09-01T23:18:45 | 2020-01-08T17:40:04 | JavaScript | UTF-8 | Java | false | false | 339 | java | package net.lesno.stock.entitys.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
@Getter
@Setter
@NoArgsConstructor
@MappedSuperclass
public class BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
}
| [
"[email protected]"
] | |
676f9b2aca46fe705f6339fa4941b9ebf8be998c | 58023e7ac782d77e8e4aed580077be57e3341597 | /app/src/main/java/com/shenni/lives/jjdxmplayer/bean/LiveBean.java | b3d851849bc531aa950526c82e654350206fb6c0 | [] | no_license | JamesMarts/shenNiLives | 9f056a80db1e3abbf16570ed97738f3160dba908 | d98f0590b26ad014b1db773391e02395d69bbab8 | refs/heads/master | 2021-06-24T18:39:00.174954 | 2017-09-11T14:42:43 | 2017-09-11T14:42:43 | 103,147,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,434 | java | package com.shenni.lives.jjdxmplayer.bean;
/**
* ========================================
* <p/>
* 版 权:dou361.com 版权所有 (C) 2015
* <p/>
* 作 者:陈冠明
* <p/>
* 个人网站:http://www.dou361.com
* <p/>
* 版 本:1.0
* <p/>
* 创建日期:2016/8/30
* <p/>
* 描 述:
* <p/>
* <p/>
* 修订历史:
* <p/>
* ========================================
*/
public class LiveBean {
/**
* nickname : 🐈这只野喵有毒🕳
* livestarttime : 1473031828564
* liveStream : http://pull.kktv8.com/livekktv/109204379.flv
* portrait : /portrait/20160814/10/109204379_588711.jpg!256
*/
private String nickname;
private long livestarttime;
private String liveStream;
private String portrait;
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public long getLivestarttime() {
return livestarttime;
}
public void setLivestarttime(long livestarttime) {
this.livestarttime = livestarttime;
}
public String getLiveStream() {
return liveStream;
}
public void setLiveStream(String liveStream) {
this.liveStream = liveStream;
}
public String getPortrait() {
return portrait;
}
public void setPortrait(String portrait) {
this.portrait = portrait;
}
}
| [
"[email protected]"
] | |
a161e9346eb3d8fb3e57ff9a38b7666d1f8e59ea | 78c42dd5b4f4c91ce96ff961c29590272bf9cc2d | /BackEnd/src/main/java/lk/ijse/spring/entity/Driver.java | f8d2c3dfb0a4b351660b5f853e55f5ba4b62d305 | [] | no_license | Ausha123/car_rental_system-spring | c990a8824d9ef4ce113155023d29bf24b7330420 | a309a0bf8a89f2e98f8581d140b2ed4ce9a0a703 | refs/heads/main | 2023-09-04T17:28:46.017402 | 2021-11-14T03:30:58 | 2021-11-14T03:30:58 | 427,828,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package lk.ijse.spring.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Driver {
@Id
private String id;
private String name;
private String address;
private String licence;
private int contact;
}
| [
"[email protected]"
] | |
d098196c99fa90d8e099e22caedd2a180c9becd1 | e97db814ced07e786177abcba20e3cb3137b298a | /src/main/java/com/projectbolek/domain/entity/ChargeEntity.java | 61f64d38bdede8f41bbcbe22c62b7179d3ad72c5 | [
"Apache-2.0"
] | permissive | rogalsp1/ProjectBolek | fb30639893279d1d96242b0e4be0f9c3ec4e4077 | 1020893458ffa774eb250e6ae5acd3921d3adff6 | refs/heads/master | 2021-01-21T04:50:38.268810 | 2016-06-24T01:34:53 | 2016-06-24T01:34:53 | 55,693,582 | 1 | 1 | null | 2016-05-25T21:35:54 | 2016-04-07T12:41:06 | Java | UTF-8 | Java | false | false | 982 | java | package com.projectbolek.domain.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* Created by rogalsp1 on 26.05.16.
*/
@Entity
@Table(schema = "bolekshema", name = "charge")
@Data
public class ChargeEntity extends BaseEntity implements Serializable{
private static final long serialVersionUID = 4225411281569337626L;
@Id
@SequenceGenerator(name = "charge_seq" ,sequenceName = "bolekshema.charge_id_seq")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "charge_seq")
private Long id;
@Column(name = "to_pay")
private Double toPay;
@Column(name = "service_date")
private Timestamp invoiceDate;
@Column(name = "payment_date")
private Timestamp paymentDate;
@ManyToOne
@JoinColumn(name = "patient_id")
private PatientEntity patient;
@OneToOne
@JoinColumn(name = "examination_id")
private ExaminationEntity examination;
}
| [
"[email protected]"
] | |
304b607bba86287aeec881c61103a43fa774f222 | 9bab3bb53285d72b2786920ffa8d85d277939657 | /算法设计/src/排序算法/插入排序.java | 1b2fca802dbb6d5c8ec49c8ffe28ac7246c834e0 | [] | no_license | Pin-Wang/Algorithm_Design | 015f74e2d10f893d4d55d7bea7b890133d07360d | 4bbae9c71f11dd4f828bc6b528914ceecdf08d1d | refs/heads/master | 2021-01-14T13:07:05.643132 | 2016-08-23T08:57:00 | 2016-08-23T08:57:00 | 64,927,156 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,668 | java | package 排序算法;
import java.util.Scanner;
/*
*2016年8月13日 上午11:18:35
*@Author Pin-Wang
*@E-mail [email protected]
*/
public class 插入排序 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner=new Scanner(System.in);
int num=0;
num=scanner.nextInt();
int[] arr=new int[num];
for(int i=0;i<num;i++){
arr[i]=scanner.nextInt();
}
//insertSort(arr, num);
hillSort(arr, num);
for(int i=0;i<num;i++){
System.out.print(arr[i]+" ");
}
}
//直接插入排序(稳定的排序算法),最好情况下时间复杂度可以达到是O(n),最坏和平均情况下是O(n*n)
public static void insertSort(int[] arr,int n){
for(int i=1;i<n;i++){
//将当前元素逐个与前面的序列比较
//暂存当前元素
int current=arr[i];
int j=i-1;
for(;j>=0;j--){
//比当前元素大的往后移
if(arr[j]>current){
arr[j+1]=arr[j];
}
else{
break;
}
}
//将当前元素放到最终的位子
arr[j+1]=current;
}
}
//希尔排序(加强版的不稳定的插入排序),最好,平均,最坏情况下时间复杂度是O(n),O(n^1.5),O(n*n)
public static void hillSort(int[] arr,int len){
//步长从len/2开始,逐渐缩小
for(int bc=len/2;bc>0;bc/=2){
//在每一个步长范围进行直接插入
for(int i=bc;i<len;i+=bc){
int current=arr[i];
int j=i-bc;
for(;j>=0;j-=bc){
if(arr[j]>current){
arr[j+bc]=arr[j];
}
else{
break;
}
}
arr[j+bc]=current;
}
}
}
}
| [
"[email protected]"
] | |
bd6188514d7b9f2c604cfe13db1558ef454740c3 | 82bd58cc74a225ac9920c389345134d4b25f8d03 | /book-library-console/src/main/java/com/booklibrary/repositories/ConsoleBookRepository.java | 210a2649ec572f10d25734fb3f4fdbbe7453fd18 | [] | no_license | ucfjoe/book-Library-layered-Architecture | c800e6951c2bc63b1fad27ec3ecac43fdde3b33c | 51ebb88bcdb119b4c560588b8666009968a511bf | refs/heads/master | 2022-01-22T15:51:30.766078 | 2019-06-08T17:00:26 | 2019-06-08T17:00:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,779 | java | package com.booklibrary.repositories;
import com.booklibrary.common.dtos.Book;
import com.booklibrary.common.exceptions.AppException;
import com.booklibrary.common.utils.Util;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ConsoleBookRepository implements BookRepository {
private Logger logger = Logger.getLogger(this.getClass().getName());
private String getDbFileName() throws AppException {
Properties properties = Util.getConfiguration(this.getClass(), "database.properties");
return properties.getProperty("dbfile.name");
}
private String getFullDbFileName() throws AppException{
Properties properties = Util.getConfiguration(this.getClass(), "database.properties");
return properties.getProperty("dbfile.path")+getDbFileName();
}
@Override
public Map<Integer, Book> loadAllBooks() throws AppException {
Map<Integer,Book> books = new LinkedHashMap<>();
String dbfileName = getFullDbFileName();
BufferedReader bufferedReader = Util.getBufferedReaderOfFile(this.getClass(),dbfileName);
String st;
try {
while ((st = bufferedReader.readLine()) != null && !st.equals("")) {
String[] fileRecord = st.split(",");
Book readedBook = new Book(Integer.valueOf(fileRecord[0]),fileRecord[1],fileRecord[2],fileRecord[3]);
books.put(readedBook.getId(),readedBook);
}
}catch (IOException e){
logger.log(Level.ALL,e.getMessage()+" - Error reading db txt file");
throw new AppException("Error reading db txt file");
}finally {
try {
bufferedReader.close();
} catch (IOException e) {
throw new AppException("Error reading db txt file");
}
}
return books;
}
@Override
public void saveBooks(Map<Integer, Book> books) throws AppException {
String dbfileName = getFullDbFileName();
BufferedWriter bufferedWriter = Util.getBufferedWriteOfFile(this.getClass(),dbfileName);
try {
for(Book book:books.values()){
bufferedWriter.write(book.toString());
bufferedWriter.newLine();
}
}catch (IOException e){
logger.log(Level.ALL,e.getMessage()+" - Error Saving data !");
throw new AppException("Error Saving data !");
}finally {
try {
bufferedWriter.close();
} catch (IOException e) {
throw new AppException("Error saving db txt file");
}
}
}
}
| [
"[email protected]"
] | |
49f4ee1ddf8501907d1add5abaf83958f0dd20b3 | 219191815f355e9ae8e7160d96d8c81b47946443 | /Testapp/src/main/java/com/mastercard/testapp/presentation/presenter/base/CartConfirmationPresenterInterface.java | 9866a812c6278814bdf0b88448d588aebf485542 | [
"Apache-2.0"
] | permissive | Mastercard/commerce-web-android | 4499d3429404307fe1b7f83eddbb27168db5055f | bc07a9f6b0fe477f05f0af6ccd03cbb23e31a23f | refs/heads/master | 2022-06-13T21:23:55.028770 | 2022-03-10T21:18:23 | 2022-03-10T21:18:23 | 192,600,368 | 6 | 10 | Apache-2.0 | 2022-06-01T21:55:58 | 2019-06-18T19:27:15 | Java | UTF-8 | Java | false | false | 1,561 | java | package com.mastercard.testapp.presentation.presenter.base;
import com.mastercard.mp.switchservices.checkout.ExpressCheckoutRequest;
import com.mastercard.testapp.domain.model.Item;
import com.mastercard.testapp.domain.model.MasterpassConfirmationObject;
import java.util.List;
/**
* Created by Sebastian Farias on 10-10-17.
*/
public interface CartConfirmationPresenterInterface extends Presenter {
/**
* Load items on cart.
*
* @param forceUpdate the force update
*/
void loadItemsOnCart(boolean forceUpdate);
/**
* Show items on cart.
*
* @param itemsOnCart the items on cart
*/
void showItemsOnCart(List<Item> itemsOnCart);
/**
* Total price.
*
* @param totalPrice the total price
*/
void totalPrice(String totalPrice);
/**
* Subtotal price.
*
* @param subtotalPrice the subtotal price
*/
void subtotalPrice(String subtotalPrice);
/**
* Tax price.
*
* @param taxPrice the tax price
*/
void taxPrice(String taxPrice);
/**
* Confirm checkout.
*
* @param masterpassConfirmationObject the masterpass confirmation object
*/
void confirmCheckout(MasterpassConfirmationObject masterpassConfirmationObject);
/**
* Is suppress shipping.
*
* @param suppressShipping the suppress shipping
*/
void isSuppressShipping(boolean suppressShipping);
/**
* Express checkout.
*
* @param masterpassExpressCheckoutObject the masterpass confirmation object
*/
void expressCheckout(ExpressCheckoutRequest masterpassExpressCheckoutObject);
}
| [
"[email protected]"
] | |
5cc8e71752ef0bce7b8a171f4a3073ee69690243 | 62e5d339ddcb9f10f2f3ba0238febdcf03ea72cc | /src/test/java/io/FileWriterTest.java | 0318839585040c9857fa980b35adfcd14d053c9a | [] | no_license | sakuya9t/sudoku_solver | b2ff7ef0e33cb34a9c7a6cfe24839a4417a7be9a | 94ca966bfeef7c97e83a56f8fa8fbb1d7c343986 | refs/heads/master | 2020-04-11T01:49:57.078342 | 2018-12-16T22:10:33 | 2018-12-16T22:10:33 | 161,426,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | import core.CellGrid;
import io.FileWriter;
import org.junit.Test;
public class FileWriterTest {
@Test
public void TestWriteCompleteSudoku(){
String filename = "test1.txt";
int[][] board = new int[][]{
{4,3,5,2,6,9,8,7,1},
{6,8,2,5,7,1,4,9,3},
{1,9,7,8,3,4,5,6,2},
{8,2,6,1,9,5,3,4,7},
{3,7,4,6,8,2,9,1,5},
{9,5,1,7,4,3,6,2,8},
{5,1,9,3,2,6,8,7,4},
{2,4,8,9,5,7,1,3,6},
{7,6,3,4,1,8,2,5,9}
};
CellGrid grid = new CellGrid(board);
FileWriter.write(filename, grid);
}
@Test
public void TestWriteString(){
String filename = "test1.txt";
String message = "Hello World.";
FileWriter.write(filename, message);
}
}
| [
"[email protected]"
] | |
5226fde7a2bc4374a0db79768138c813b359ac93 | c6cd2687317028537b965ccb4a2d63efee2e39fd | /mikoto/src/com/s1025/mikoto/api/AccessTokenApi.java | 024c9d343235ea8933768a7306bd820b15adf178 | [
"MIT"
] | permissive | s1025/mikoto | b4125ed87df52471f25e38ae587d3adf1f4ef24e | bd8d2b9b29ff395f9ec4d656244e064b2cdc19ae | refs/heads/master | 2020-04-06T06:58:38.747528 | 2016-06-10T15:17:18 | 2016-06-10T15:17:18 | 34,667,800 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,640 | java | package com.s1025.mikoto.api;
import java.util.Calendar;
import com.google.gson.Gson;
import com.s1025.mikoto.Mikoto;
import com.s1025.mikoto.model.AccessToken;
import com.s1025.mikoto.model.App;
import com.s1025.mikoto.util.HttpCon;
/**
* 公众平台通用接口工具类
*
* @author liuyq
* @date 2013-08-09
*/
public class AccessTokenApi {
private static AccessTokenApi accessTokenApi = new AccessTokenApi();
private AccessToken accessToken;
private Calendar time;
private Gson gson = new Gson();
private String tmpAccessToken;
private boolean debug = false;
private AccessTokenApi(){};
public static AccessTokenApi getAccessTokenApi() {
return accessTokenApi;
}
public final String access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
public String getAccessToken() {
if(debug) return tmpAccessToken;
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR_OF_DAY, -1);
if(time == null || cal.after(time)){
accessToken = obtainAccessToken(Mikoto.app);
time = Calendar.getInstance();
System.out.println(accessToken);
}
return accessToken.getAccess_token();
}
/**
* 获取access_token
*
* @param appid 凭证
* @param appsecret 密钥
* @return
*/
public AccessToken getAccessToken(boolean o) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR_OF_DAY, -1);
if(time == null || cal.after(time)){
accessToken = obtainAccessToken(Mikoto.app);
time = Calendar.getInstance();
}
return accessToken;
}
public AccessToken obtainAccessToken(App app){
AccessToken accessToken = null;
String requestUrl = access_token_url.replace("APPID", app.getAppID()).replace("APPSECRET", app.getAppSecret());
String response = HttpCon.httpRequest(requestUrl, "GET", null);
// 如果请求成功
if (null != response) {
accessToken = gson.fromJson(response,AccessToken.class);
}
return accessToken;
}
public String getTmpAccessToken() {
return tmpAccessToken;
}
public void setTmpAccessToken(String tmpAccessToken) {
this.tmpAccessToken = tmpAccessToken;
}
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
} | [
"[email protected]"
] | |
2bebdaf637eac88989ebf0c822c21245c194485b | d6fd47f5f1359cad87d617a2ff8137b515086c55 | /play/jonathan/src/test/java/nov/tree/answer/thomas/TreeSerializerTest.java | 1c4cd5ec5ecdcee08f581ac6cb4d4ddfdbb846f4 | [] | no_license | HuberyChen/study | 3da9668f971caaa6cd3b4178f3047cff4cd875c6 | 7ecfa988915956b3ee2d04306fb788735a28e656 | refs/heads/master | 2020-07-20T12:19:28.138123 | 2014-04-14T00:47:40 | 2014-04-14T00:47:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | package nov.tree.answer.thomas;
import com.google.common.base.Stopwatch;
import nov.tree.Tree;
import nov.tree.TreeSerializer;
import nov.tree.TreeTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
* @author chi
*/
public class TreeSerializerTest {
TreeSerializer<String> treeSerializer;
@Before
public void init() {
treeSerializer = new TreeSerializerImpl<>();
}
@Test
public void test() throws IOException {
Tree<String> testData = TreeTest.get();
Stopwatch stopwatch = Stopwatch.createStarted();
File file = treeSerializer.serialize(testData);
System.out.println("File length:" + file.length());
System.out.println("Serialize Time:" + stopwatch.elapsed(TimeUnit.MILLISECONDS));
stopwatch.reset().start();
Tree<String> data = treeSerializer.deserialize(file);
System.out.println("Deserialize Time:" + stopwatch.elapsed(TimeUnit.MILLISECONDS));
Assert.assertTrue(testData.equals(data));
}
}
| [
"[email protected]"
] | |
e5d254017c913b959ac9f0ecdad91453529acda1 | 96c92d2808ce2420d187f545458701d86b746a32 | /5-Synchronization/WebDriverWait/CustomExpectedConditions/CustomExpectedConditionsExampleTest.java | 2a661a6f818674a3c1ec69080fcf5def9c8caef3 | [] | no_license | IngridTawfiek/Selenium2-WebDriver-Basics-Course | 5e6cebccd699e2c2775a88e6241a20250dece302 | ed81f11897aa8c235960ac4a49075d993a2b0ae2 | refs/heads/master | 2021-01-12T11:32:32.394832 | 2016-11-05T20:51:39 | 2016-11-05T20:51:39 | 72,945,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,483 | java | package com.seleniumsimplified.webdriver.Synchronization.WebDriverWait.CustomExpectedConditions;
import com.seleniumsimplified.webdriver.manager.Driver;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
public class CustomExpectedConditionsExampleTest {
public WebDriver driver;
@Before
public void Setup(){
driver = Driver.get("http://www.compendiumdev.co.uk/selenium/basic_ajax.html");
}
@Test
public void SyncronizationUsingSeparateNamedClassExpectedCondition(){
//SelectServer
WebElement categorySelect = driver.findElement(By.id("combo1"));
categorySelect.findElement(By.cssSelector("option[value = '3']")).click();
new WebDriverWait (driver, 10).until(new SelectContainsText(By.id("combo2"), "Java"));
//Then select Java
WebElement languageSelect = driver.findElement(By.id("combo2"));
languageSelect.findElement(By.cssSelector("option[value = '23']")).click();
//Submit the form
WebElement CodeInIT = driver.findElement(By.name("submitbutton"));
CodeInIT.click();
new WebDriverWait(driver, 10).until(titleIs("Processed Form Details"));
WebElement languageWeUsed = driver.findElement(By.id("_valuelanguage_id"));
assertEquals("Expected Java Code", "23", languageWeUsed.getText());
}
private class SelectContainsText implements ExpectedCondition<Boolean> {
private String textToFind;
private By FindBy;
public SelectContainsText(final By comboFindBy, final String textToFind) {
this.FindBy = comboFindBy;
this.textToFind = textToFind;
}
@Override
public Boolean apply(WebDriver webDriver) {
WebElement combo = webDriver.findElement(this.FindBy);
List<WebElement> options = combo.findElements(By.tagName("option"));
for (WebElement anoption : options) {
if (anoption.getText().equals(this.textToFind))
return true;
}
return false;
}
@Override
public String toString(){
return "select" + this.FindBy + " to contain " + this.textToFind;
}
}
@Test
public void SyncronizationUsingAnonymousClassExpectedCondition(){
//SelectServer
WebElement categorySelect = driver.findElement(By.id("combo1"));
categorySelect.findElement(By.cssSelector("option[value = '3']")).click();
new WebDriverWait (driver, 10).until(new ExpectedCondition<Boolean>(){
@Override
public Boolean apply(WebDriver webDriver){
return webDriver.findElement(By.cssSelector("option[value = '23']")).isDisplayed();
}
}
);
//Then select Java
WebElement languageSelect = driver.findElement(By.id("combo2"));
languageSelect.findElement(By.cssSelector("option[value = '23']")).click();
//Submit the form
WebElement CodeInIT = driver.findElement(By.name("submitbutton"));
CodeInIT.click();
new WebDriverWait(driver, 10).until(titleIs("Processed Form Details"));
WebElement languageWeUsed = driver.findElement(By.id("_valuelanguage_id"));
assertEquals("Expected Java Code", "23", languageWeUsed.getText());
}
@Test
public void SyncronizationUsingAnonymousClassWebElementExpectedCondition(){
//SelectServer
WebElement categorySelect = driver.findElement(By.id("combo1"));
categorySelect.findElement(By.cssSelector("option[value = '3']")).click();
WebElement elly = new WebDriverWait (driver, 10).until(new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver webDriver) {
WebElement elli = webDriver.findElement(By.cssSelector("option[value = '23']"));
if(elli.isDisplayed())
return elli;
return null;
}
}
);
//Then select Java
elly.click();
assertEquals("Expected Java", "Java", elly.getText());
//Submit the form
WebElement CodeInIT = driver.findElement(By.name("submitbutton"));
CodeInIT.click();
new WebDriverWait(driver, 10).until(titleIs("Processed Form Details"));
WebElement languageWeUsed = driver.findElement(By.id("_valuelanguage_id"));
assertEquals("Expected Java Code", "23", languageWeUsed.getText());
}
@Test
public void SyncronizationUsingWrapMethodExpectedCondition(){
//SelectServer
WebElement categorySelect = driver.findElement(By.id("combo1"));
categorySelect.findElement(By.cssSelector("option[value = '3']")).click();
WebElement javaOption = new WebDriverWait (driver, 10).until(OptionWithValueDisplayed("23"));
//Then select Java
javaOption.click();
//Submit the form
WebElement CodeInIT = driver.findElement(By.name("submitbutton"));
CodeInIT.click();
new WebDriverWait(driver, 10).until(titleIs("Processed Form Details"));
WebElement languageWeUsed = driver.findElement(By.id("_valuelanguage_id"));
assertEquals("Expected Java Code", "23", languageWeUsed.getText());
}
private ExpectedCondition <WebElement> OptionWithValueDisplayed (final String value) {
return new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver webDriver) {
return webDriver.findElement(By.cssSelector("option[value = '" + value + "']"));
}
};
}
} | [
"[email protected]"
] | |
b43e8b8b7e4800ba3bd0c0acce518e62964b1228 | 2d156f978a9a033c777057a842eb01de8b3ff5a9 | /core/src/main/java/com/eshop/dao/order/OrderRepository.java | 26da23d8e7398efd20ac982a6a54a7037b8af848 | [] | no_license | anapprentice/spring-eshop | bcceddf4f0bf9a5effa07fde3b78bf9bd9f4c495 | 9fb88f91452f1712355470dbb4d2301197864a8f | refs/heads/master | 2021-05-23T13:48:45.224071 | 2020-04-05T19:58:59 | 2020-04-05T19:58:59 | 253,320,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package com.eshop.dao.order;
import com.eshop.model.CustomerOrder;
import org.springframework.data.jpa.repository.JpaRepository;
public interface OrderRepository extends JpaRepository<CustomerOrder, Integer> {
}
| [
"[email protected]"
] | |
ebe1740e1e431b0cf98cf4fddce473202ced4255 | feb6e81e73538b782554fff58ca61c65df004985 | /src/chapter_08/Exercise_8_14.java | ca0aafe04e0fcc7d482328bebf5e13e41b2ea82c | [] | no_license | LucasVigarinho/Pirulito_BOOK | 16a1571cf007128f00a576bbd1dabd8ce4311453 | f0a2b1c1966e1a72724caafcc26a1dfe3eb17065 | refs/heads/master | 2021-07-09T09:37:39.317245 | 2020-10-22T20:25:59 | 2020-10-22T20:25:59 | 205,431,592 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,300 | java | package chapter_08;
/**
*
* (Explore matrix) Write a program that prompts the user to enter the length of a
* square matrix, randomly fills in 0s and 1s into the matrix, prints the matrix, and
* finds the rows, columns, and diagonals with all 0s or 1s. Here is a sample run of
* the program:
*
* Enter the size for the matrix: 4
* 0111
* 0000
* 0100
* 1111
* All 0s on row 1
* All 1s on row 3
* No same numbers on a column
* No same numbers on the major diagonal
* No same numbers on the sub-diagonal
*
*
* @author lucasmaximo
*
*/
/** Necessary imports */
import java.util.Scanner;
/** Creating the class named Exercise_8_01 */
public class Exercise_8_14{
/** Creating the main method */
public static void main(String[] arg) {
//create the necessary objects
Scanner input = new Scanner (System.in);
//print out the guide message to the user insert the size of the multidimensional array
System.out.print("\n\n\tEnter the size for the matrix: ");
//Created the variable in order to absorb the user insertion
int size = input.nextInt();
//created the multidimensional array and use the variable created with the user insertion to define its size
int [][] matrix = new int [size][size];
//created the main for loop in order to run all the rows of the array created
for(int a = 0; a < matrix.length; a++) {
//created the nested for loop in order to run all the columns of the array created
for(int b = 0; b < matrix[a].length; b++) {
//fill all the positions of the array randomly with 1 and 0
matrix[a][b] = (int) (Math.random()*2);
}//closing the nested for loop
}//closing the main for loop
printArray(matrix);
int row0 = verifyNumber(matrix, 0, 0);
// System.out.print("\n\t" + row0); //printing result to test the answers
int row1 = verifyNumber(matrix, 1, 0);
// System.out.print("\n\t" + row1); //printing result to test the answers
int column0 = verifyNumber(matrix, 0, 1);
// System.out.print("\n\t" + column0); //printing result to test the answers
int column1 = verifyNumber(matrix, 1, 1);
// System.out.print("\n\t" + column1); //printing result to test the answers
int diagonal0 = verifyNumber(matrix, 0, 2);
// System.out.print("\n\t" + diagonal0); //printing result to test the answers
int diagonal1 = verifyNumber(matrix, 1, 2);
// System.out.print("\n\t" + diagonal1); //printing result to test the answers
int subDiagonal0 = verifyNumber(matrix, 0, 3);
// System.out.print("\n\t" + subDiagonal0); //printing result to test the answers
int subDiagonal1 = verifyNumber(matrix, 1, 3);
// System.out.print("\n\t" + subDiagonal1); //printing result to test the answers
//printing the final result/answers
System.out.print("\n\n\t" + (((row0 < 0)?"No row with all positions with 0":"All 0s on row " + row0)));
System.out.print("\n\n\t" + (((row1 < 0)?"No row with all positions with 0":"All 1s on row " + row1)));
System.out.print("\n\n\t" + (((column0 < 0)?"No column with all positions with 0":"All 0s on column " + column0)));
System.out.print("\n\n\t" + (((column1 < 0)?"No column with all positions with 0":"All 1s on column " + column1)));
System.out.print("\n\n\t" + (((diagonal0 < matrix.length )?"No same numbers on the major diagonal 0":"All 0s on major diagonal ")));
System.out.print("\n\n\t" + (((diagonal1 < matrix.length )?"No same numbers on the sub-diagonal 1":"All 1s on diagonal ")));
System.out.print("\n\n\t" + (((subDiagonal0 < matrix.length )?"No same numbers on the major diagonal 0":"All 0s on sub-diagonal ")));
System.out.print("\n\n\t" + (((subDiagonal1 < matrix.length )?"No same numbers on the sub-diagonal 1":"All 1s on sub-diagonal ")));
input.close();
}//closing the main method
public static int verifyNumber(int [][] myArray, int number, int each) {
int count = 0;
//created an if statement in order to change the for loop to be used
if(each < 2) {
//created the main for loop in order to run all the rows of the array created
for(int c = 0; c < myArray.length; c++) {
//created the nested for loop in order to run all the columns of the array created
for(int d = 0; d < myArray[c].length; d++) {
//Created a if statement in order to check if columns or rows
if(each == 0) {
count += myArray[c][d];
}else {
count += myArray[d][c];
}
}//closing the nested for loop
//created an if statement in order to return result if the number was founded
if(count == myArray.length && number == 1) {
return c;
}else if (count == 0 && number == 0){
return c;
}else {
count = 0;
}
}//closing the main for loop
}else if (each == 2) {
//created the nested for loop in order to run all the columns of the array created
for(int e = 0; e < myArray.length; e++) {
//Created a if statement in order to check if columns or rows
count += myArray[e][e];
}//closing the nested for loop
//created an if statement in order to return result if the number was founded
if(count == myArray.length && number == 1) {
return myArray.length + 1;
}else if (count == 0 && number == 0){
return myArray.length + 1;
}else {
count = 0;
}
}else if (each > 2) {
int inverse = myArray.length-1;
//created the nested for loop in order to run all the columns of the array created
for(int f = 0; f < myArray.length; f++) {
//Created a if statement in order to check if columns or rows
count += myArray[f][inverse--];
}//closing the nested for loop
//created an if statement in order to return result if the number was founded
if(count == myArray.length && number == 1) {
return myArray.length + 2;
}else if (count == 0 && number == 0){
return myArray.length + 2;
}else {
count = 0;
}
}
return -1;
}
/** Created a method in order to print a multidimensional array */
public static void printArray(int [][] matrix) {
System.out.print("\n\t");
//created a for loop in order to print out the matrix
for (int i = 0; i < matrix.length; i++) {
for (int k = 0; k < matrix[i].length; k++) {
System.out.print(matrix[i][k] + " ");
}
System.out.print("\n\t");
}
}
}//closing the class_8_14
| [
"[email protected]"
] | |
2142b960e272424a4ebfeed024a75724bd9ccee0 | 7b2b776936eb297919b1ad7d6d139c3e3f644f53 | /src/main/java/Main.java | 9f45edcb521f2afe1dbbeb1a59a801f4e196f626 | [] | no_license | Maksim-ya/test | f1807d988e9b15b155b52b21921e9b771cb7f3db | a2ae4ec41480eaff6585282ce2682b80fe354d25 | refs/heads/main | 2023-05-05T23:07:03.789333 | 2021-05-24T07:39:26 | 2021-05-24T07:39:26 | 369,985,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | import parser.Parser;
import java.util.*;
public class Main {
public static void main(String[] args) {
String filename = "src/main/resources/passage.txt";
Parser parser = new Parser();
String str = parser.parse(filename);
Splitter splitter = new Splitter();
List<String> results = splitter.getWords(str);
Printer printer = new Printer();
printer.printWordsCount(results);
WordsIdentificator identificator = new WordsIdentificator();
Map<String, Integer> sortedByCount = identificator.mapCreator(results);
printer.print10values(sortedByCount);
List<String> sentences = splitter.getSentences(str);
printer.printLastSentence(sentences,sortedByCount);
}
}
| [
"[email protected]"
] | |
1341b0c775f70385eb089d80dc8d8cca57adf266 | bf84cae511b15a5521b61c19bc5396c62893e9f8 | /dist-primary/src/main/java/com/stylefeng/guns/DistributionManageApplication.java | 491d12821a74fdfb12ea70a9d0395dbb3f89dde8 | [
"LicenseRef-scancode-mulanpsl-1.0-en",
"MulanPSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | LKG/distribution_management | 7c0ba0a4e3226c8297a62744f666951f783f416f | 20421423e172c475eeb35394961d843be7f2ec7c | refs/heads/master | 2023-05-06T10:42:44.093940 | 2021-01-08T07:11:00 | 2021-01-08T07:11:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,390 | java | package com.stylefeng.guns;
import com.stylefeng.guns.config.properties.GunsProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* SpringBoot方式启动类
*/
@SpringBootApplication
public class DistributionManageApplication extends WebMvcConfigurerAdapter{
protected final static Logger logger = LoggerFactory.getLogger(DistributionManageApplication.class);
@Autowired
GunsProperties gunsProperties;
/**
* 增加swagger的支持
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
if(gunsProperties.getSwaggerOpen()){
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
public static void main(String[] args) {
SpringApplication.run(DistributionManageApplication.class, args);
logger.info("Application is sussess!");
}
}
| [
"[email protected]"
] | |
e4ba16baffc1a9cd24939870f3fa63bc4cce4b02 | 3a56b87145043f02673f2d031a68f8f8acccac6b | /src/Bridge/TargetB.java | cac2daeb111fa77faf54cfed1b220929d70427c9 | [] | no_license | Emmonss/java-Design-patterns | 3936d8a9f80aad89fed043376fc1bb2bc6456794 | b024c5a9d0fa3b6c5dce104f9f16fb674b9f2dae | refs/heads/master | 2020-03-22T21:42:49.974690 | 2018-07-12T13:00:35 | 2018-07-12T13:00:35 | 140,709,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 71 | java | package Bridge;
public interface TargetB {
public void USB();
}
| [
"[email protected]"
] | |
13a14b1c1eb864caf0d01cd3ed72d818da6c7f6c | efe8b49f2f917e60d1764c50c6e8726a17812797 | /serialization-tests/src/test/java/com/gs/collections/impl/map/immutable/primitive/ImmutableObjectLongSingletonMapTest.java | 0fb27bd91a112020847004e0ad3d08b602f8ea41 | [
"Apache-2.0"
] | permissive | ANeumann82/gs-collections | c059ce67a99e06a604ca01d54fc2d5767a029eee | 4607ac434382c8f692545673621d181d788e832f | refs/heads/master | 2021-05-27T01:03:47.865935 | 2014-04-04T10:51:58 | 2014-04-04T10:51:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,259 | java | /*
* Copyright 2013 Goldman Sachs.
*
* 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.gs.collections.impl.map.immutable.primitive;
import com.gs.collections.impl.test.Verify;
import org.junit.Test;
public class ImmutableObjectLongSingletonMapTest
{
@Test
public void serializedForm()
{
Verify.assertSerializedForm(
1L,
"rO0ABXNyAHdjb20uZ3MuY29sbGVjdGlvbnMuaW1wbC5tYXAuaW1tdXRhYmxlLnByaW1pdGl2ZS5B\n"
+ "YnN0cmFjdEltbXV0YWJsZU9iamVjdExvbmdNYXAkSW1tdXRhYmxlT2JqZWN0TG9uZ01hcFNlcmlh\n"
+ "bGl6YXRpb25Qcm94eQAAAAAAAAABDAAAeHB3BAAAAAF0AAExdwgAAAAAAAAAAXg=",
new ImmutableObjectLongSingletonMap<String>("1", 1L));
}
}
| [
"[email protected]"
] | |
d5fc6983b49bba54f45872e43ea21c6b5946e52d | 3bc62f2a6d32df436e99507fa315938bc16652b1 | /struts2/src/test/java/com/intellij/lang/ognl/psi/VariableAssignmentExpressionPsiTest.java | 2f9c1101047ef6acf9b476ea9cca6f7098fffa80 | [
"Apache-2.0"
] | permissive | JetBrains/intellij-obsolete-plugins | 7abf3f10603e7fe42b9982b49171de839870e535 | 3e388a1f9ae5195dc538df0d3008841c61f11aef | refs/heads/master | 2023-09-04T05:22:46.470136 | 2023-06-11T16:42:37 | 2023-06-11T16:42:37 | 184,035,533 | 19 | 29 | Apache-2.0 | 2023-07-30T14:23:05 | 2019-04-29T08:54:54 | Java | UTF-8 | Java | false | false | 1,726 | java | /*
* Copyright 2014 The 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 com.intellij.lang.ognl.psi;
import com.intellij.lang.ognl.OgnlLanguage;
import com.intellij.lang.ognl.OgnlTypes;
import com.intellij.psi.PsiTypes;
import org.intellij.lang.annotations.Language;
/**
* {@link OgnlVariableAssignmentExpression}.
*
* @author Yann Cébron
*/
public class VariableAssignmentExpressionPsiTest extends PsiTestCase {
public void testVariableAssignment() {
final OgnlVariableAssignmentExpression expression = parse("#varName = 1 + 2");
assertEquals("varName", expression.getVariableName());
assertEquals(PsiTypes.intType(), expression.getType());
final OgnlExpression assignment = expression.getAssignment();
assertElementType(OgnlTypes.BINARY_EXPRESSION, assignment);
}
private OgnlVariableAssignmentExpression parse(@Language(value = OgnlLanguage.ID,
prefix = OgnlLanguage.EXPRESSION_PREFIX,
suffix = OgnlLanguage.EXPRESSION_SUFFIX) final String expression) {
return (OgnlVariableAssignmentExpression)parseSingleExpression(expression);
}
} | [
"[email protected]"
] | |
3e34e5eff315a97b579b8cbbb74e4a2c2cdcf32d | ca9371238f2f8fbec5f277b86c28472f0238b2fe | /src/mx/com/kubo/model/catalogos/DependantsNumberPK.java | 7fc7bba20eee6a32bdd385a084813310bc4a6661 | [] | no_license | ocg1/kubo.portal | 64cb245c8736a1f8ec4010613e14a458a0d94881 | ab022457d55a72df73455124d65b625b002c8ac2 | refs/heads/master | 2021-05-15T17:23:48.952576 | 2017-05-08T17:18:09 | 2017-05-08T17:18:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java | package mx.com.kubo.model.catalogos;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
@Embeddable
public class DependantsNumberPK
implements Serializable
{
private static final long serialVersionUID = 1L;
@Column private int dependants_number_id;
@Column private int company_id;
public int getDependants_number_id()
{
return dependants_number_id;
}
public void setDependants_number_id(int dependants_number_id)
{
this.dependants_number_id = dependants_number_id;
}
public int getCompany_id()
{
return company_id;
}
public void setCompany_id(int company_id)
{
this.company_id = company_id;
}
}
| [
"[email protected]"
] | |
b1612d145953481d4e2f494f433d521efc4cfe84 | bf0c11b40c9aa6cfd72039b007ff559ac8f60de9 | /2Darray/src/wavetraversal.java | 3a0e08aa699427942a1bc09a146782d9e19a7b56 | [] | no_license | rishabh-66/javaprog | 51218cb738f3dc52b3383de3b0ada0b1ba63e54b | b3db8410c70217bb70279d298dc5227266d20079 | refs/heads/main | 2023-06-27T13:03:50.015459 | 2021-07-31T17:43:16 | 2021-07-31T17:43:16 | 370,754,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 753 | java | import java.util.Scanner;
public class wavetraversal {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int m= scn.nextInt();
int [][] arr = new int[n][m];
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr[0].length;j++){
arr[i][j]=scn.nextInt();
}
}
for(int i=0;i<arr[0].length;i++){
if(i%2==0){
for(int j=0;j< arr.length;j++){
System.out.println(arr[j][i]);
}
}else{
for(int j= arr.length-1;j>=0;j--){
System.out.println(arr[j][i]);
}
}
}
}
}
| [
"[email protected]"
] | |
f5b0d67c0b5be553e4c51efb9ba89b4ec57dd04b | 36b89c18fde69f8da2e97d20cf9461c441a87b15 | /projectArchetype/src/main/java/com/arabsoft/utils/Constante.java | c9e37ddf1b3cc6b1400a3ba15ba3c17ec006bacb | [] | no_license | xsaf/mystke | d278a6ff6c0cc5ebec300ef9e176dfd51050d142 | 7bb36495fef7f1e509e116525e38aa24eb7399aa | refs/heads/master | 2020-05-22T06:43:02.604051 | 2016-10-09T17:13:37 | 2016-10-09T17:13:37 | 62,892,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.arabsoft.utils;
public class Constante {
public static final short stadeAnalyseFinaciere = 1;
public static final String COD_ETAT_ENCOURS = "E";
public static final String COD_ETAT_VALIDER = "V";
public static final Long TACHE_PRISE_EN_CHARGE = Long.valueOf("1");
public static final Long TACHE_VALIDATION = Long.valueOf("2");
public static final String COD_ATTENTE = "A";
public static final String COD_PREVALID = "P";
public static final String COD_VALIDATION = "V";
public static final String COD_ANNULATION = "R";
public static final String COD_ANNULATION_APRES_VALIDATION = "N";
}
| [
"Safwen@Safwen-PC"
] | Safwen@Safwen-PC |
bacdb5e72befa74f002ce8fafa9177150bdacf17 | 4260d20b704ccd1a33d28b033beb28dce214eacb | /app/src/androidTest/java/com/example/sgt_powell/studyjamapp/ApplicationTest.java | 794a184949dca5c36201fb0f624d3bbaa7902207 | [] | no_license | antpowell/GoogleStudyJams5ThingsApplication | a4909ef91ee79bab45fe170fdd9377c65c5188c5 | 77c67430c6cc67a230af72ea07108d7227d7812d | refs/heads/master | 2021-01-01T03:48:03.856064 | 2016-04-28T02:02:23 | 2016-04-28T02:02:23 | 56,949,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.example.sgt_powell.studyjamapp;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
9e5ca917c98e3dbd63e2aa08e861e1a1f532d2fb | 01bac3bd6490d234435e3dd89c9bc732bb79ba79 | /src/test/java/io/harness/test/rest/rbac/CloudProvidersTest.java | 10a32bb4974e03b86e88a155210182dc39ef1728 | [] | no_license | veereshradder90/Automation-Harn | 983fb08c76898cce438659bc51fc886557fd1710 | dec128978bb28330ed94eb6e0d70ec0a578b50be | refs/heads/main | 2023-02-10T15:11:18.184016 | 2021-01-11T08:13:31 | 2021-01-11T08:13:31 | 328,593,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,818 | java | package io.harness.test.rest.rbac;
import io.harness.rest.helper.cloudproviders.cloudprovider.CloudProviderHelper;
import io.harness.test.rest.base.AbstractTest;
import io.harness.rest.helper.cloudproviders.aws.AwsHelper;
import io.harness.rest.helper.cloudproviders.azure.AzureHelper;
import io.harness.rest.helper.cloudproviders.gcp.GCPHelper;
import io.harness.rest.helper.cloudproviders.k8s.K8SHelper;
import io.harness.rest.helper.cloudproviders.pcf.PcfHelper;
import io.harness.rest.helper.cloudproviders.physicaldata.PhysicalDataCPHelper;
import io.harness.rest.helper.cloudproviders.spotinst.SpotInstCPHelper;
import io.harness.rest.core.GenericRequestBuilder;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
import org.testng.Assert;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class CloudProvidersTest extends AbstractTest {
CloudProviderHelper cloudProviderHelper = new CloudProviderHelper();
AwsHelper awsHelper = new AwsHelper();
AzureHelper azureHelper = new AzureHelper();
GCPHelper gcpHelper = new GCPHelper();
K8SHelper k8sHelper = new K8SHelper();
PcfHelper pcfHelper = new PcfHelper();
PhysicalDataCPHelper pdcHelper = new PhysicalDataCPHelper();
SpotInstCPHelper spotinstHelper = new SpotInstCPHelper();
String rbacUser = configPropertis.getConfig("RBAC_ACCOUNT_LEVEL_USER");
String rbacPassword = secretsProperties.getSecret("RBAC_TEST_USER_PASSWORD_QA");
@Test
public void azureTest() {
// add azure cloud provider- user not authorized
RequestSpecification requestSpecificationObject =
GenericRequestBuilder.getRequestSpecificationObject(rbacUser, rbacPassword);
String azureName = commonHelper.createRandomName("azure-");
JsonPath addResponse = azureHelper.createAzureCloudProvider(requestSpecificationObject, azureName);
assertThat(
addResponse.getString("responseMessages.message").equalsIgnoreCase("Invalid request: User not authorized"));
// delete azure cloud provider- user not authorized
Response deleteCloudProvider = cloudProviderHelper.deleteCloudProviderById("zVRSeyz8TvKJupLZG32KnQ");
assertThat(deleteCloudProvider.getStatusCode()).isEqualTo(400);
}
@Test
public void kubernetesTest() {
RequestSpecification requestSpecificationObject =
GenericRequestBuilder.getRequestSpecificationObject(rbacUser, rbacPassword);
// add k8s cloud provider
String k8sName = commonHelper.createRandomName("k8s-");
JsonPath addResponse = k8sHelper.createKubernetesCloudProvider(requestSpecificationObject, k8sName);
assertThat(
addResponse.getString("responseMessages.message").equalsIgnoreCase("Invalid request: User not authorized"));
// delete k8s cloud provider- user not authorized
Response deleteCloudProvider = cloudProviderHelper.deleteCloudProviderById("ondf5CKGSU2ln05VvYnO5Q");
assertThat(deleteCloudProvider.getStatusCode()).isEqualTo(400);
}
@Test
public void physicalDataCenterTest() {
RequestSpecification requestSpecificationObject =
GenericRequestBuilder.getRequestSpecificationObject(rbacUser, rbacPassword);
// add physical data center cloud provider
String pdcName = commonHelper.createRandomName("pdc-");
JsonPath addResponse = pdcHelper.createPhysicalDataCenterCloudProvider(requestSpecificationObject, pdcName);
assertThat(
addResponse.getString("responseMessages.message").equalsIgnoreCase("Invalid request: User not authorized"));
// delete pdc cloud provider- user not authorized
Response deleteCloudProvider = cloudProviderHelper.deleteCloudProviderById("PQF1semtS-2O5z7xxmwPmA");
assertThat(deleteCloudProvider.getStatusCode()).isEqualTo(400);
}
@Test
public void googleTest() {
RequestSpecification requestSpecificationObject =
GenericRequestBuilder.getRequestSpecificationObject(rbacUser, rbacPassword);
// add google cloud provider
String gcpName = commonHelper.createRandomName("gcp-");
JsonPath addResponse = gcpHelper.createGoogleCloudProvider(requestSpecificationObject, gcpName);
assertThat(
addResponse.getString("responseMessages.message").equalsIgnoreCase("Invalid request: User not authorized"));
// delete google cloud provider- user not authorized
Response deleteCloudProvider = cloudProviderHelper.deleteCloudProviderById("rM4k05SqR3SPftBILqwHDg");
assertThat(deleteCloudProvider.getStatusCode()).isEqualTo(400);
}
@Test
public void spotinstTest() {
RequestSpecification requestSpecificationObject =
GenericRequestBuilder.getRequestSpecificationObject(rbacUser, rbacPassword);
// add spotinst cloud provider
String spotinstName = commonHelper.createRandomName("spotinst-");
JsonPath addResponse = spotinstHelper.createSpotInstCloudProvider(requestSpecificationObject, spotinstName);
assertThat(
addResponse.getString("responseMessages.message").equalsIgnoreCase("Invalid request: User not authorized"));
// delete spotinst cloud provider- user not authorized
Response deleteCloudProvider = cloudProviderHelper.deleteCloudProviderById("C20bP8yVT-SSd8MJroBGJQ");
assertThat(deleteCloudProvider.getStatusCode()).isEqualTo(400);
}
@Test
public void pivotalCloudFoundryTest() {
RequestSpecification requestSpecificationObject =
GenericRequestBuilder.getRequestSpecificationObject(rbacUser, rbacPassword);
// add pcf cloud provider
String pcfName = commonHelper.createRandomName("pcf-");
JsonPath addResponse = pcfHelper.createPCFCloudProvider(requestSpecificationObject, pcfName);
assertThat(
addResponse.getString("responseMessages.message").equalsIgnoreCase("Invalid request: User not authorized"));
// delete pcf cloud provider- user not authorized
Response deleteCloudProvider = cloudProviderHelper.deleteCloudProviderById("yBRUwxotRhmLINbNUphxaA");
assertThat(deleteCloudProvider.getStatusCode()).isEqualTo(400);
}
@Test
public void awsCloudProviderTest() {
RequestSpecification requestSpecificationObject =
GenericRequestBuilder.getRequestSpecificationObject(rbacUser, rbacPassword);
// add aws cloud provider
String awsName = commonHelper.createRandomName("aws-");
JsonPath addResponse = awsHelper.createAWSCloudProvider(requestSpecificationObject, awsName);
assertThat(
addResponse.getString("responseMessages.message").equalsIgnoreCase("Invalid request: User not authorized"));
// delete pcf cloud provider- user not authorized
Response deleteCloudProvider = cloudProviderHelper.deleteCloudProviderById("1IU5xoCxTBSQs7Bswv4NRQ");
assertThat(deleteCloudProvider.getStatusCode()).isEqualTo(400);
}
} | [
"[email protected]"
] | |
34b35cfc9b5b1e6547958e23965cd83a92c70579 | 818bb9750604ee6ec801d0c80b34a9de4c966eb1 | /app/src/main/java/com/example/phobes/witnessassitant/service/SocketThread.java | 931440fd95a9c25d4a82df23b3b3a1f1094a6745 | [] | no_license | ZRXiang/Witnessassitant1 | eb5c392d2c1371cd7975b2f0f8b9564fcabc23b3 | 5d4065027bcc0d502b24597cb0d39592d16dbe11 | refs/heads/master | 2021-01-19T14:09:41.533599 | 2017-04-07T09:01:12 | 2017-04-07T09:01:12 | 88,128,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,635 | java | package com.example.phobes.witnessassitant.service;
//http://www.cnblogs.com/shaocm/p/3528346.html
import com.example.phobes.witnessassitant.model.CommData;
import com.example.phobes.witnessassitant.struct.*;
import com.example.phobes.witnessassitant.struct.TFHeader;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.nio.ByteOrder;
import java.util.UUID;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
public class SocketThread extends Thread {
private String ip = "10.0.0.113";
private int port = 13000;
private String TAG = "socket thread";
private int timeout = 10000;
public boolean isFinish = false;
public int G_nPackIndex =99999999;
public static Socket server = null;
public String filename;
public String shortFileName;
DataOutputStream out;
DataInputStream in;
public boolean isRun = true;
Handler inHandler;
Handler outHandler;
Context ctx;
private String TAG1 = "===Send===";
SharedPreferences sp;
private int nCountLength;
private String mOrderId;
private final String DEBUG="DEBUG";
private final String ERROR="ERROR";
public SocketThread(Handler handlerin, Handler handlerout, Context context,String orderId) {
inHandler = handlerin;
outHandler = handlerout;
ctx = context;
mOrderId=orderId;
//filename= context.getExternalFilesDir(null).getPath();//手机sdcard目录
filename=context.getFilesDir().getPath(); //手机内存目录
LogWriter.log(DEBUG,"创建线程SocketThread");
}
/**
* 连接socket服务器
*/
/* public void connect() {
try {
initdate();
//Log.i(TAG, "连接中……");
LogWriter.open(CommData.filePath).print(DEBUG,"SocketThread开始连接");
client = new Socket(ip, port);
try{
client.setSoTimeout(timeout);// 设置阻塞时间
}catch (IOException e){
// SendMessage("连接服务器错误,请重试!", 0, (byte) 5, 100);
e.printStackTrace();
}
//Log.i(TAG, "连接成功");
LogWriter.open(CommData.filePath).print(DEBUG,"SocketThread连接成功");
in = new DataInputStream(new BufferedInputStream(client.getInputStream()));
out = new DataOutputStream(new BufferedOutputStream(client.getOutputStream()));
// Log.i(TAG, "输入输出流获取成功");
LogWriter.open(CommData.filePath).print(DEBUG,"开始获取输入输出流");
} catch (UnknownHostException e) {
// Log.i(TAG, "连接错误UnknownHostException 重新获取");
try {
LogWriter.open(CommData.filePath).print(ERROR,"连接错误UnknownHostException 重新获取连接");
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
connect();
} catch (IOException e) {
Log.i(TAG, "连接服务器io错误"+e);
try {
LogWriter.open(CommData.filePath).print(ERROR,"连接服务器io错误"+e.getMessage());
} catch (IOException e1) {
e1.printStackTrace();
}
try {
if(client!=null){
client.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
} catch (Exception e) {
// SendMessage("连接服务器超时,请重试!", 0, (byte) 5, 100);
// Log.i(TAG, "连接服务器错误Exception" + e.getMessage());
try {
LogWriter.open(CommData.filePath).print(ERROR, "连接服务器错误Exception" + e.getMessage());
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
}
}*/
public static void setSocket(Socket sktConn){
server = sktConn;
}
public void setStream(){
try {
in = new DataInputStream(new BufferedInputStream(server.getInputStream()));
out = new DataOutputStream(new BufferedOutputStream(server.getOutputStream()));
} catch (IOException e) {
e.printStackTrace();
}
}
public void SendMessage(String sMsg,int nLen,byte nState,int nCountLength){
TFState st = new TFState();
st.nState = nState;
st.nLength = nLen;
st.sMsg = sMsg;
st.nCountLength=nCountLength;
Message msg = outHandler.obtainMessage();
msg.obj = st;
msg.what = 1;
outHandler.sendMessage(msg);// 结果返回给UI处理
}
public void sendResult(String msg){
Message msgStr = outHandler.obtainMessage();
msgStr.obj = msg;
msgStr.what = 1;
inHandler.sendMessage(msgStr);
}
/* public void initdate() {
sp = ctx.getSharedPreferences("SP", ctx.MODE_PRIVATE);
ip = sp.getString("ipstr", ip);
port = Integer.parseInt(sp.getString("port", String.valueOf(port)));
Log.i(TAG, "获取到ip端口:" + ip + ";" + port);
}*/
private void isRead(byte[] buff,int offset,int size,DataInputStream is)
{
int readCount = 0; // 已经成功读取的字节的个数
while (readCount < size)
{
try
{
readCount += is.read(buff, offset+readCount, size - readCount);
// System.out.println(readCount+"-------------------------------------is length="+is.available());
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
/**
* 实时接受数据
*/
@Override
public void run() {
byte[] buff = new byte[1024];
G_nPackIndex =99999999;
shortFileName = "";
byte[] confirm;
FileOutputStream outStream = null;
LogWriter.log(CommData.INFO,TAG+"开始运行");
//Log.i(TAG, "线程socket开始运行");
// close();//首先断开的意义在于 可能上次的连接还在缓存,导致这次连接异常
//connect();//连接是个阻塞的过程,如果没连接上就阻塞了 (建议增加延时功能,友情提醒用户连接超时);
//Log.i(TAG, "1.run开始");
LogWriter.log(CommData.INFO,TAG+"1.run开始");
TFHeader hd = new TFHeader();
TFConfirm cf = new TFConfirm();
TFData data = new TFData();
isFinish = false;
while (isRun) {
try {
if (server != null) {
setStream();//获取输入输出流
SendMessage("连接成功", 0, (byte) 0, 0);
// Log.i(TAG, "2.接收数据头");
LogWriter.log(CommData.INFO,TAG+"2.接收数据头开始");
//循环读取头
while(true) {
in.read(buff, 0, 1);
if (buff[0]==71){//G
in.read(buff, 1, 1);
if (buff[1]==90) {//Z
in.read(buff, 2, 1);
if (buff[2]==74) {//J
in.read(buff, 3, 1);
if (buff[3]==67) {//C
in.read(buff,4,1);//Tag
break;
}
}
}
}
}
LogWriter.log(CommData.INFO,TAG+"2.接收数据头成功");
//判断tag 1 参数包 2 数据包 4 结束报 5 确认包
if(buff[4]==1)//head tag
{
LogWriter.log(CommData.INFO,"接收参数包开始");
isRead(buff,5,16,in);
//判断当前的包头是否是要接收的数据包头
/* JavaStruct.unpack(hd, buff, ByteOrder.BIG_ENDIAN);
//cf.ReceivePackIndex = hd.PackIndex;
//cf.ReceivePackTag = hd.PackTag;
hd.PackIndex =IntLHToHL(hd.PackIndex);
hd.PackCount =IntLHToHL(hd.PackCount);
hd.ParamSize =IntLHToHL(hd.ParamSize);
hd.TestNo =IntLHToHL(hd.TestNo);
*/
JavaStruct.unpack(hd, buff, ByteOrder.LITTLE_ENDIAN);
isRead(buff,21,512-21,in);
if (buff[511]!=70){//tail→F
continue;
}
if (hdCheckBitEx(buff)){
cf.ReceiveConfirmTag=1;
}else{
cf.ReceiveConfirmTag=0;
}
cf.ReceivePackIndex = hd.PackIndex;
cf.ReceivePackTag = hd.PackTag;
cf.PackHead=new byte[]{71,90,74,67};
cf.PackTag = 5;
cf.PackCount = 1;//转成低高位
cf.PackIndex = 1;//转成低高位
cf.PackTail = 70; //F
confirm = JavaStruct.pack(cf, ByteOrder.LITTLE_ENDIAN);
confirm= cfCheckBit(confirm);
out.write(confirm);
out.flush();
LogWriter.log(CommData.INFO,"接收参数包完成");
//重发时,应将outStream 缓存输出,并关闭,然后删除文件
/* if(outStream!=null) {
outStream.close();
}*/
//判断是否已经存在此文件(当前蓝牙连接超时重发,应先把文件给删除)
DeleteFile(shortFileName);
G_nPackIndex =99999999;//初始化接受包的序号
//System.out.println("out1 length="+out.size());
}
else if(buff[4]==2){ //data tag
LogWriter.log(CommData.INFO,"接收数据包开始");
isRead(buff, 5,12,in);//edit by wt
/* JavaStruct.unpack(data, buff, ByteOrder.BIG_ENDIAN);
data.PackIndex =IntLHToHL(data.PackIndex);
data.PackCount =IntLHToHL(data.PackCount);
data.ParamSize =IntLHToHL(data.ParamSize);
*/
JavaStruct.unpack(data, buff, ByteOrder.LITTLE_ENDIAN);
nCountLength= data.PackCount;
isRead(buff, 17,512 - 17, in);
if (buff[511]!=70){//tail→F
continue;
}
if(data.PackIndex!=G_nPackIndex) {
if (hdCheckBitEx(buff)) {
if (G_nPackIndex == 99999999) {
if (shortFileName == "") {
shortFileName = UUID.randomUUID().toString() + ".prt";
sendResult(shortFileName);
shortFileName = filename + "/" + shortFileName;
//filename += "/" + shortFileName;
outStream = new FileOutputStream(shortFileName);
}
//outStream = new FileOutputStream(filename);
//sendResult(shortFileName);
//outStream = new FileOutputStream(shortFileName);
}
cf.ReceiveConfirmTag = 1;
outStream.write(buff, 17, data.ParamSize);
// SendMessage("接收包号" + data.PackIndex, data.ParamSize, data.PackTag, nCountLength);
SendMessage("接收包号" + data.PackIndex, data.PackIndex, data.PackTag, nCountLength);
G_nPackIndex = data.PackIndex;
} else {
cf.ReceiveConfirmTag = 0;
}
cf.ReceivePackIndex = data.PackIndex;
cf.ReceivePackTag = data.PackTag;
cf.PackHead = new byte[]{71, 90, 74, 67};
cf.PackTag = 5;
//cf.PackCount = IntHLToLH(1);
//cf.PackIndex = IntHLToLH(1);
cf.PackCount = 1;
cf.PackIndex = 1;
cf.PackTail = 70; //F
//confirm = JavaStruct.pack(cf, ByteOrder.BIG_ENDIAN);
confirm = JavaStruct.pack(cf, ByteOrder.LITTLE_ENDIAN);
confirm = cfCheckBit(confirm);
out.write(confirm);
out.flush();
LogWriter.log(CommData.INFO,"接收第"+G_nPackIndex+"数据包完成");
//System.out.println("out2 length=" + out.size());
}
}
else if(buff[4]==4) {//finish tag
LogWriter.log(CommData.INFO,"接收结束包开始");
isRead(buff, 5, 12, in);//edit by wt
/*
JavaStruct.unpack(data, buff, ByteOrder.BIG_ENDIAN);
data.PackIndex = IntLHToHL(data.PackIndex);
data.PackCount = IntLHToHL(data.PackCount);
data.ParamSize = IntLHToHL(data.ParamSize);*/
JavaStruct.unpack(data, buff, ByteOrder.LITTLE_ENDIAN);
nCountLength = data.PackCount;
isRead(buff, 17, 512 - 17, in);
if (buff[511] != 70) {//tail→F
continue;
}
if (hdCheckBitEx(buff)) {
cf.ReceiveConfirmTag = 1;
} else {
cf.ReceiveConfirmTag = 0;
}
cf.ReceivePackIndex = data.PackIndex;
cf.ReceivePackTag = data.PackTag;
cf.PackHead = new byte[]{71, 90, 74, 67};
cf.PackTag = 5;
cf.PackCount = 1;
cf.PackIndex = 1;
cf.PackTail = 70; //F
confirm = JavaStruct.pack(cf, ByteOrder.LITTLE_ENDIAN);
confirm = cfCheckBit(confirm);
out.write(confirm);
out.flush();
LogWriter.log(CommData.INFO,"接收结束包完成");
// System.out.println("out4 length=" + out.size());
isFinish = true;
}
else
{
continue;
}
if (isFinish) {
if(outStream != null) {
outStream.flush();
outStream.close();
}
LogWriter.log(CommData.INFO,"蓝牙连接开始断开");
close();
LogWriter.log(CommData.INFO,"蓝牙连接断开成功");
SendMessage("接受完毕", nCountLength, (byte) 4, nCountLength);
LogWriter.log(CommData.INFO,TAG+"1.run 退出");
//Log.i(TAG, "1.run 退出");
break;
}
} else {
Log.i(TAG, "没有可用连接");
// connect();
}
} catch (Exception e) {
LogWriter.log(ERROR,"数据接收错误" + e.getMessage());
e.printStackTrace();
continue;
}
}
}
/*
* 暂且不提取run()中提交的相同函数 (报异常)
* */
public void SendConfirmPacket( int ReceivePackIndex,byte ReceivePackTag,byte ReceiveConfirmTag){
TFConfirm cf = new TFConfirm();
cf.ReceiveConfirmTag = ReceiveConfirmTag;
cf.ReceivePackTag =ReceivePackTag;
cf.ReceivePackIndex = ReceivePackIndex;
cf.PackHead = new byte[]{71, 90, 74, 67};
cf.PackTag = 5;
cf.PackCount = IntHLToLH(1);
cf.PackIndex = IntHLToLH(1);
cf.PackTail = 70; //F
//confirm = JavaStruct.pack(cf, ByteOrder.BIG_ENDIAN);
//confirm = cfCheckBit(confirm);
//out.write(confirm);
//out.flush();
}
/**
* 关闭连接
*/
public void close()
{
try
{
if (server != null)
{
Log.i(TAG, "close in");
in.close();
Log.i(TAG, "close out");
out.close();
Log.i(TAG, "close client");
server.close();
}
}
catch (Exception e)
{
LogWriter.log(ERROR,"关闭连接异常" + e.getMessage());
e.printStackTrace();
}
}
public int byteToInt(byte b) {
//Java 总是把 byte 当做有符处理;我们可以通过将其和 0xFF 进行二进制与得到它的无符值
return b & 0xFF;
}
public Boolean hdCheckBit(byte[] buff,byte[] buff1 ){
int hcb=0;
for(int i=0;i<509;i++){
hcb += byteToInt(buff[i]);
}
hcb += byteToInt( buff1[buff1.length-3]);
if(((byte)(hcb%255))==buff1[buff1.length-2]) {
return true;
}else{
return false;
}
}
//整个包 校验是校验位 前的所有byte→int相加 对255求余
public Boolean hdCheckBitEx(byte[] buff){
int hcb=0;
for(int i=0;i<510;i++){
hcb += byteToInt(buff[i]);
}
//hcb += byteToInt( buff[buff.length-3]);
if(((byte)(hcb%255))==buff[510]) {
return true;
}else{
return false;
}
}
//确认包校验位
public byte[] cfCheckBit(byte[] buff){
int sum=0;
for(int i=0;i< buff.length-2;i++){
sum+=byteToInt(buff[i]);
}
sum=sum%255;
buff[20]=(byte)sum;
return buff;
}
//整数 低高位 变成 高低位
public int IntLHToHL(int temp){
// 将每个字节取出来
byte byte4 = (byte) (temp & 0xff);
byte byte3 = (byte) ((temp & 0xff00) >> 8);
byte byte2 = (byte) ((temp & 0xff0000) >> 16);
byte byte1 = (byte) ((temp & 0xff000000) >> 24);
// 拼装成 正确的int
int realint = ((byte1 & 0xff)<<0)+((byte2& 0xff)<<8) + ((byte3 & 0xff)<< 16) +((byte4& 0xff)<<24);
return realint;
}
//整数 高低位 变成 低高位
public int IntHLToLH(int temp){
// 将每个字节取出来
byte byte1 = (byte) (temp & 0xff);
byte byte2 = (byte) ((temp & 0xff00) >> 8);
byte byte3 = (byte) ((temp & 0xff0000) >> 16);
byte byte4 = (byte) ((temp & 0xff000000) >> 24);
// 拼装成 正确的int
int realint = ((byte1 & 0xff)<<0)+((byte2& 0xff)<<8) + ((byte3 & 0xff)<< 16) +((byte4& 0xff)<<24);
return realint;
}
public void DeleteFile(String filename1){
if (filename1 != "") {
File file = new File(filename1);
if (file.exists()) {
file.delete();
}
}
}
} | [
"[email protected]"
] | |
f9261f735bdc148d38d91f235881190aafa362ff | 2429c7749c8009782d135b0175036a67c3e247e2 | /app/src/main/java/ro/atoming/bakingapp/ui/RecipeStepDetailFragment.java | eec991ea0964593ae5ebcb3e445577e9660409f7 | [] | no_license | stavrr0ss/BakingApp | acf5563007b617c731b423dd034d4079e2600a3d | 3a7df8a7c1c67837f63ea16365a22fa024c80901 | refs/heads/master | 2020-03-16T16:54:02.038032 | 2019-09-23T09:55:05 | 2019-09-23T09:55:05 | 132,808,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,818 | java | package ro.atoming.bakingapp.ui;
import android.app.Fragment;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.LoadControl;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util;
import ro.atoming.bakingapp.R;
import ro.atoming.bakingapp.models.RecipeStep;
/**
* Created by Bogdan on 5/10/2018.
*/
public class RecipeStepDetailFragment extends Fragment {
private RecipeStep mRecipeStep ;
private TextView mDescription;
private SimpleExoPlayer mExoPlayer;
private PlayerView mExoPlayerView;
private String mVideoUrl;
public RecipeStepDetailFragment(){}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.detail_fragment_step_player,container,false);
mDescription = view.findViewById(R.id.step_description);
mExoPlayerView = view.findViewById(R.id.playerView);
Intent intent = getActivity().getIntent();
Bundle bundle = intent.getBundleExtra("currentStep");
if (bundle!=null){
mRecipeStep = bundle.getParcelable("step");
}
mDescription.setText(mRecipeStep.getDescription());
mVideoUrl = mRecipeStep.getVideoUrl();
initializaPlayer(Uri.parse(mVideoUrl));
return view;
}
private void initializaPlayer (Uri mediaUri){
TrackSelector trackSelector = new DefaultTrackSelector();
LoadControl loadControl = new DefaultLoadControl();
mExoPlayer = ExoPlayerFactory.newSimpleInstance(getActivity(),trackSelector,loadControl);
mExoPlayerView.setPlayer(mExoPlayer);
String userAgent = Util.getUserAgent(getActivity(), "BakingApp");
MediaSource mediaSource = new ExtractorMediaSource(mediaUri,new DefaultDataSourceFactory(getActivity(),userAgent),
new DefaultExtractorsFactory(),null,null);
mExoPlayer.prepare(mediaSource);
}
}
| [
"[email protected]"
] | |
9e9573b06b3e4cfc59a3420b5b85053515c72381 | 05befa621d9e55c0d11d5ff1a803976c7922c0c7 | /app/src/test/java/com/angryscarf/recyclerviewapp/ExampleUnitTest.java | 930d2a9c8487be79a8b4604d52d02dd3ea7d57aa | [] | no_license | JDAlvarenga/PDM_L5_RecyclerViewApp | b4adad959cddc1bff8c74a561f7fe378a09350f9 | b86363d48df7ba2a052a71991d5153e589535e42 | refs/heads/master | 2020-03-11T16:09:57.016339 | 2018-04-23T21:55:26 | 2018-04-23T21:55:26 | 130,107,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.angryscarf.recyclerviewapp;
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);
}
} | [
"[email protected]"
] | |
8a7825d6638bc394e50348cc6be42cf6f6e1848b | ad9785adccf5aa1533002f64a1fa129254204ee7 | /src/java/DAO/Interface/IPersonaDAO.java | d49a79f95ad39483c22cc3383de2d2bdb63aff51 | [] | no_license | TigreF/cafe4workp9u8b5n3 | 10ee2397885a7fb39074fc403f223525ab2480c2 | 4891c50e414d195dce6c12bf922fb8f8915e5531 | refs/heads/master | 2021-01-10T15:10:07.115807 | 2016-02-26T02:07:50 | 2016-02-26T02:07:50 | 52,557,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | 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 DAO.Interface;
import DTO.PersonaDTO;
/**
*
* @author renzo
*/
public interface IPersonaDAO {
public PersonaDTO buscarPersona(PersonaDTO persona) throws Exception;
}
| [
"[email protected]"
] | |
1865d42eec485f21fdc31e9abf555d3c675d5c70 | 9b3a3c2ebfa2036ed4004ef0bfb01dfc50903101 | /src/com/thai/intellijentEC/main/ui/TakeSuccess.java | 94ec140fc3125bbbea82e522f37462419f94a864 | [] | no_license | CREEPERDCH/Ineffective_1 | deeedcf40ef7b43ec9c1bafd52eb619834e1cbcb | 6e69e709bb35ae85e97c9c82cf1dc61289094b05 | refs/heads/master | 2021-09-06T11:31:42.670122 | 2018-02-06T03:19:58 | 2018-02-06T03:19:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,781 | 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.thai.intellijentEC.main.ui;
/**
*
* @author 段晓强
*/
public class TakeSuccess extends javax.swing.JFrame {
/**
* Creates new form SendIn
*/
public TakeSuccess() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
btn_return = new javax.swing.JButton();
lab_time = new javax.swing.JLabel();
lab_info = new javax.swing.JLabel();
lab_takein_img = new javax.swing.JLabel();
lab_custom = new javax.swing.JLabel();
btn_continue = new javax.swing.JButton();
btn_backMain = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel2.setBackground(new java.awt.Color(251, 205, 57));
btn_return.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/thai/intellijentEC/resources/btn_return.png"))); // NOI18N
lab_time.setFont(new java.awt.Font("微软雅黑", 0, 24)); // NOI18N
lab_time.setForeground(new java.awt.Color(255, 255, 255));
lab_time.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lab_time.setText("25s");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(btn_return, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lab_time, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(15, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lab_time, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn_return, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
lab_info.setFont(new java.awt.Font("微软雅黑", 0, 32)); // NOI18N
lab_info.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lab_info.setText("取件成功!感谢使用快递柜服务!");
lab_takein_img.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lab_takein_img.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/thai/intellijentEC/resources/sendS_success.png"))); // NOI18N
lab_custom.setFont(new java.awt.Font("微软雅黑", 0, 24)); // NOI18N
lab_custom.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lab_custom.setText("如需帮助请致电010-0123 4569");
btn_continue.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/thai/intellijentEC/resources/中-继续取件.png"))); // NOI18N
btn_backMain.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/thai/intellijentEC/resources/中-返回主页.png"))); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(280, 280, 280)
.addComponent(btn_continue, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE)
.addComponent(btn_backMain, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(280, 280, 280))
.addComponent(lab_takein_img, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lab_info, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lab_custom, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(184, 184, 184)
.addComponent(lab_info)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lab_custom)
.addGap(62, 62, 62)
.addComponent(lab_takein_img)
.addGap(92, 92, 92)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_continue, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn_backMain, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(236, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TakeSuccess.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TakeSuccess.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TakeSuccess.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TakeSuccess.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TakeSuccess().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btn_backMain;
private javax.swing.JButton btn_continue;
private javax.swing.JButton btn_return;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JLabel lab_custom;
private javax.swing.JLabel lab_info;
private javax.swing.JLabel lab_takein_img;
private javax.swing.JLabel lab_time;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
4cb224234c0672745590ee37cad9027a25ceba64 | 62d3ec55742067cf0d769c69e04a86e25ebef20a | /src/main/java/signingToday/client/model/InlineResponse401.java | f0f42742f14e958cdc354f80af8865a5ef950269 | [
"MIT"
] | permissive | signingtoday/signingtoday-sdk-java | 4fa60a3599365f1f75fefbd417ba6dc27c30f183 | 1a6c6ff16a3483e66b69e78fefdfd5abd4891684 | refs/heads/master | 2022-05-29T14:14:30.351422 | 2020-03-24T08:26:37 | 2020-03-24T08:26:37 | 232,547,913 | 0 | 0 | MIT | 2022-05-20T21:20:59 | 2020-01-08T11:26:45 | Java | UTF-8 | Java | false | false | 12,048 | java | /*
* Signing Today API
* KlNpZ25pbmcgVG9kYXkqIGVuYWJsZXMgc2VhbWxlc3MgaW50ZWdyYXRpb24gb2YgZGlnaXRhbCBzaWduYXR1cmVzIGludG8gYW55CndlYnNpdGUgYnkgdGhlIHVzZSBvZiBlYXN5IHJlcXVlc3RzIHRvIG91ciBBUEkuIFRoaXMgaXMgdGhlIHNtYXJ0IHdheSBvZgphZGRpbmcgZGlnaXRhbCBzaWduYXR1cmUgc3VwcG9ydCB3aXRoIGEgZ3JlYXQgdXNlciBleHBlcmllbmNlLgoKCipTaWduaW5nIFRvZGF5IEFQSXMqIHVzZSBIVFRQIG1ldGhvZHMgYW5kIGFyZSBSRVNUZnVsIGJhc2VkLCBtb3Jlb3ZlciB0aGV5CmFyZSBwcm90ZWN0ZWQgYnkgYSAqc2VydmVyIHRvIHNlcnZlciBhdXRoZW50aWNhdGlvbiogc3RhbmRhcmQgYnkgdGhlIHVzZSBvZgp0b2tlbnMuCgoKKlNpZ25pbmcgVG9kYXkgQVBJcyogY2FuIGJlIHVzZWQgaW4gdGhlc2UgZW52aXJvbm1lbnRzOgoKCnwgRW52aXJvbm1lbnQgfCBEZXNjcmlwdGlvbiB8IEVuZHBvaW50IHwKfCAtLS0tLS0tLS0tLSB8IC0tLS0tLS0tLS0tIHwgLS0tLS0tLS0gfAp8IFNhbmRib3ggICAgIHwgVGVzdCBlbnZpcm9ubWVudCB8IGBodHRwczovL3NhbmRib3guc2lnbmluZ3RvZGF5LmNvbWAgfAp8IExpdmUgICAgICAgIHwgUHJvZHVjdGlvbiBlbnZpcm9ubWVudCB8IGBodHRwczovL2FwaS5zaWduaW5ndG9kYXkuY29tYCB8CgoKRm9yIGV2ZXJ5IHNpbmdsZSByZXF1ZXN0IHRvIFNpZ25pbmcgVG9kYXkgaGFzIHRvIGJlIGRlZmluZWQgdGhlIGZvbGxvd2luZwoqSFRUUCogaGVhZGVyOgotIGBBdXRob3JpemF0aW9uYCwgd2hpY2ggY29udGFpbnMgdGhlIGF1dGhlbnRpY2F0aW9uIHRva2VuLgoKSWYgdGhlIHJlcXVlc3QgaGFzIGEgYm9keSB0aGFuIGFub3RoZXIgKkhUVFAqIGhlYWRlciBpcyByZXF1ZXN0ZWQ6Ci0gYENvbnRlbnQtVHlwZWAsIHdpdGggYGFwcGxpY2F0aW9uL2pzb25gIHZhbHVlLgoKCkZvbGxvd3MgYW4gZXhhbXBsZSBvZiB1c2FnZSB0byBlbnVtZXJhdGUgYWxsIHRoZSB1c2VyIG9mICpteS1vcmcqCm9yZ2FuaXphdGlvbi4KCioqRXhhbXBsZSoqCgpgYGBqc29uCiQgY3VybCBodHRwczovL3NhbmRib3guc2lnbmluZ3RvZGF5LmNvbS9hcGkvdjEvbXktb3JnL3VzZXJzIFwKICAgIC1IICdBdXRob3JpemF0aW9uOiBUb2tlbiA8YWNjZXNzLXRva2VuPicKYGBgCgojIyBIVFRQIG1ldGhvZHMgdXNlZAoKQVBJcyB1c2UgdGhlIHJpZ2h0IEhUVFAgdmVyYiBpbiBldmVyeSBzaXR1YXRpb24uCgp8IE1ldGhvZCAgIHwgRGVzY3JpcHRpb24gICAgICAgICAgICAgICAgICAgIHwKfCAtLS0tLS0tLSB8IC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSB8CnwgYEdFVGAgICAgfCBSZXF1ZXN0IGRhdGEgZnJvbSBhIHJlc291cmNlICAgfAp8IGBQT1NUYCAgIHwgU2VuZCBkYXRhIHRvIGNyZWF0ZSBhIHJlc291cmNlIHwKfCBgUFVUYCAgICB8IFVwZGF0ZSBhIHJlc291cmNlICAgICAgICAgICAgICB8CnwgYFBBVENIYCAgfCBQYXJ0aWFsbHkgdXBkYXRlIGEgcmVzb3VyY2UgICAgfAp8IGBERUxFVEVgIHwgRGVsZXRlIGEgcmVzb3Vyc2UgICAgICAgICAgICAgIHwKCgojIyBSZXNwb25zZSBkZWZpbml0aW9uCgpBbGwgdGhlIHJlc3BvbnNlIGFyZSBpbiBKU09OIGZvcm1hdC4KQXMgcmVzcG9uc2UgdG8gYSByZXF1ZXN0IG9mIGFsbCB1c2VycyBvZiBhbiBvcmdhbml6YXRpb24geW91IHdpbGwgaGF2ZSBhCnJlc3VsdCBsaWtlIHRoaXM6CgpgYGBqc29uCnsKICAgICJwYWdpbmF0aW9uIjogewogICAgICAiY291bnQiOiA3NSwKICAgICAgInByZXZpb3VzIjogImh0dHBzOi8vc2FuZGJveC5zaWduaW5ndG9kYXkuY29tL2FwaS92MS9teS1vcmcvdXNlcnM/cGFnZT0xIiwKICAgICAgIm5leHQiOiAiaHR0cHM6Ly9zYW5kYm94LnNpZ25pbmd0b2RheS5jb20vYXBpL3YxL215LW9yZy91c2Vycz9wYWdlPTMiLAogICAgICAicGFnZXMiOiA4LAogICAgICAicGFnZSI6IDIKICAgIH0sCiAgICAibWV0YSI6IHsKICAgICAgImNvZGUiOiAyMDAKICAgIH0sCiAgICAiZGF0YSI6IFsKICAgICAgewogICAgICAgICJpZCI6ICJqZG8iLAogICAgICAgICJzdGF0dXMiOiAiZW5hYmxlZCIsCiAgICAgICAgInR5cGUiOiAiQmFzaWMgdXNlciBhY2NvdW50IiwKICAgICAgICAiZW1haWwiOiBqb2huZG9lQGR1bW15ZW1haWwuY29tLAogICAgICAgICJmaXJzdF9uYW1lIjogIkpvaG4iLAogICAgICAgICJsYXN0X25hbWUiOiAiRG9lIiwKICAgICAgICAid2FsbGV0IjogW10sCiAgICAgICAgImNyZWF0ZWRfYnkiOiAic3lzdGVtIiwKICAgICAgICAib3duZXIiOiBmYWxzZSwKICAgICAgICAiYXV0b21hdGljIjogZmFsc2UsCiAgICAgICAgInJhbyI6IGZhbHNlCiAgICAgIH0sCiAgICAgIC4uLgogICAgXQogIH0KYGBgCgpUaGUgSlNPTiBvZiB0aGUgcmVzcG9uc2UgaXMgbWFkZSBvZiB0aHJlZSBwYXJ0czoKLSBQYWdpbmF0aW9uCi0gTWV0YQotIERhdGEKCiMjIyBQYWdpbmF0aW9uCgoqUGFnaW5hdGlvbiogb2JqZWN0IGFsbG93cyB0byBzcGxpdCB0aGUgcmVzcG9uc2UgaW50byBwYXJ0cyBhbmQgdGhlbiB0bwpyZWJ1aWxkIGl0IHNlcXVlbnRpYWxseSBieSB0aGUgdXNlIG9mIGBuZXh0YCBhbmQgYHByZXZpb3VzYCBwYXJhbWV0ZXJzLCBieQp3aGljaCB5b3UgZ2V0IHByZXZpb3VzIGFuZCBmb2xsb3dpbmcgYmxvY2tzLiBUaGUgKlBhZ2luYXRpb24qIGlzIHByZXNlbnQKb25seSBpZiB0aGUgcmVzcG9uc2UgaXMgYSBsaXN0IG9mIG9iamVjdHMuCgpUaGUgZ2VuZXJhbCBzdHJ1Y3R1cmUgb2YgKlBhZ2luYXRpb24qIG9iamVjdCBpcyB0aGUgZm9sbG93aW5nOgoKYGBganNvbgp7CiAgICAicGFnaW5hdGlvbiI6IHsKICAgICAgImNvdW50IjogNzUsCiAgICAgICJwcmV2aW91cyI6ICJodHRwczovL3NhbmRib3guc2lnbmluZ3RvZGF5LmNvbS9hcGkvdjEvbXktb3JnL3VzZXJzP3BhZ2U9MSIsCiAgICAgICJuZXh0IjogImh0dHBzOi8vc2FuZGJveC5zaWduaW5ndG9kYXkuY29tL2FwaS92MS9teS1vcmcvdXNlcnM/cGFnZT0zIiwKICAgICAgInBhZ2VzIjogOCwKICAgICAgInBhZ2UiOiAyCiAgICB9LAogICAgLi4uCiAgfQpgYGAKCiMjIyBNZXRhCgoqTWV0YSogb2JqZWN0IGlzIHVzZWQgdG8gZW5yaWNoIHRoZSBpbmZvcm1hdGlvbiBhYm91dCB0aGUgcmVzcG9uc2UuIEluIHRoZQpwcmV2aW91cyBleGFtcGxlLCBhIHN1Y2Nlc3NmdWwgY2FzZSBvZiByZXNwb25zZSwgKk1ldGEqIHdpbGwgaGF2ZSB2YWx1ZQpgc3RhdHVzOiAyWFhgLiBJbiBjYXNlIG9mIHVuc3VjY2Vzc2Z1bCByZXNwb25zZSwgKk1ldGEqIHdpbGwgaGF2ZSBmdXJ0aGVyCmluZm9ybWF0aW9uLCBhcyBmb2xsb3dzOgoKYGBganNvbgp7CiAgICAibWV0YSI6IHsKICAgICAgImNvZGUiOiA8SFRUUCBTVEFUVVMgQ09ERT4sCiAgICAgICJlcnJvcl90eXBlIjogPFNUQVRVUyBDT0RFIERFU0NSSVBUSU9OPiwKICAgICAgImVycm9yX21lc3NhZ2UiOiA8RVJST1IgREVTQ1JJUFRJT04+CiAgICB9CiAgfQpgYGAKCiMjIyBEYXRhCgoqRGF0YSogb2JqZWN0IG91dHB1dHMgYXMgb2JqZWN0IG9yIGxpc3Qgb2YgdGhlbS4gQ29udGFpbnMgdGhlIGV4cGVjdGVkIGRhdGEKYXMgcmVxdWVzdGVkIHRvIHRoZSBBUEkuCgojIyBTZWFyY2ggZmlsdGVycwoKU2VhcmNoIGZpbHRlcnMgb2YgdGhlIEFQSSBoYXZlIHRoZSBmb2xsb3dpbmcgc3RydWN0dXJlOgoKYHdoZXJlX0FUVFJJQlVURU5BTUVgPWBWQUxVRWAKCkluIHRoaXMgd2F5IHlvdSBtYWtlIGEgY2FzZS1zZW5zaXRpdmUgc2VhcmNoIG9mICpWQUxVRSouIFlvdSBjYW4gZXh0ZW5kIGl0CnRocm91Z2ggdGhlIERqYW5nbyBsb29rdXAsIG9idGFpbmluZyBtb3JlIHNwZWNpZmljIGZpbHRlcnMuIEZvciBleGFtcGxlOgoKYHdoZXJlX0FUVFJJQlVURU5BTUVfX0xPT0tVUGA9YFZBTFVFYAoKd2hlcmUgKkxPT0tVUCogY2FuIGJlIHJlcGxhY2VkIHdpdGggYGljb250YWluc2AgdG8gaGF2ZSBhIHBhcnRpYWwgaW5zZW5zaXRpdmUKcmVzZWFyY2gsIHdoZXJlCgpgd2hlcmVfZmlyc3RfbmFtZV9faWNvbnRhaW5zYD1gQ0hhYAoKbWF0Y2hlcyB3aXRoIGV2ZXJ5IHVzZXIgdGhhdCBoYXZlIHRoZSAqY2hhKiBzdHJpbmcgaW4gdGhlaXIgbmFtZSwgd2l0aApubyBkaWZmZXJlbmNlcyBiZXR3ZWVuIGNhcGl0YWwgYW5kIGxvd2VyIGNhc2VzLgoKW0hlcmVdKGh0dHBzOi8vZG9jcy5kamFuZ29wcm9qZWN0LmNvbS9lbi8xLjExL3JlZi9tb2RlbHMvcXVlcnlzZXRzLyNmaWVsZC1sb29rdXBzKQp0aGUgbGlzdCBvZiB0aGUgbG9va3Vwcy4KCiMjIFdlYmhvb2tzCgpTaWduaW5nIFRvZGF5IHN1cHBvcnRzIHdlYmhvb2tzIGZvciB0aGUgdXBkYXRlIG9mIERTVHMgYW5kIGlkZW50aXRpZXMgc3RhdHVzLgpZb3UgY2FuIGNob29zZSBpZiB0byB1c2Ugb3Igbm90IHdlYmhvb2tzIGFuZCBpZiB5b3Ugd2FudCB0byByZWNlaXZlIHVwZGF0ZXMKYWJvdXQgRFNUcyBhbmQvb3IgaWRlbnRpdGllcy4gWW91IGNhbiBjb25maWd1cmF0ZSBpdCBvbiBhcHBsaWNhdGlvbiB0b2tlbgpsZXZlbCwgaW4gdGhlICp3ZWJob29rKiBmaWVsZCwgYXMgZm9sbG93czoKCmBgYGpzb24KIndlYmhvb2tzIjogewogICJkc3QiOiAiVVJMIiwKICAiaWRlbnRpdHkiOiAiVVJMIgogIH0KYGBgCgojIyMgRFNUcyBzdGF0dXMgdXBkYXRlCgpEU1RzIHNlbmQgdGhlIGZvbGxvd2luZyBzdGF0dXMgdXBkYXRlczoKLSAqKkRTVF9TVEFUVVNfQ0hBTkdFRCoqOiB3aGVuZXZlciB0aGUgRFNUIGNoYW5nZXMgaXRzIHN0YXR1cwotICoqU0lHTkFUVVJFX1NUQVRVU19DSEFOR0VEKio6IHdoZW5ldmVyIG9uZSBvZiB0aGUgc2lnbmF0dXJlcyBjaGFuZ2VzIGl0cwpzdGF0dXMKCiMjIyMgRFNUX1NUQVRVU19DSEFOR0VECgpTZW5kcyB0aGUgZm9sbG93aW5nIGluZm9ybWF0aW9uOgoKYGBganNvbgp7CiAgICAibWVzc2FnZSI6ICJEU1RfU1RBVFVTX0NIQU5HRUQiLAogICAgImRhdGEiOiB7CiAgICAgICJzdGF0dXMiOiAiPERTVF9TVEFUVVM+IiwKICAgICAgImRzdCI6ICI8RFNUX0lEPiIsCiAgICAgICJyZWFzb24iOiAiPERTVF9SRUFTT04+IgogICAgfQogIH0KYGBgCgojIyMjIFNJR05BVFVSRV9TVEFUVVNfQ0hBTkdFRAoKU2VuZHMgdGhlIGZvbGxvd2luZyBpbmZvcm1hdGlvbjoKCmBgYGpzb24KewogICAgIm1lc3NhZ2UiOiAiU0lHTkFUVVJFX1NUQVRVU19DSEFOR0VEIiwKICAgICJkYXRhIjogewogICAgICAic3RhdHVzIjogIjxTSUdOQVRVUkVfU1RBVFVTPiIsCiAgICAgICJncm91cCI6IDxNRU1CRVJTSElQX0dST1VQX0lOREVYPiwKICAgICAgImRzdCI6IHsKICAgICAgICAiaWQiOiAiPERTVF9JRD4iLAogICAgICAgICJ0aXRsZSI6ICI8RFNUX1RJVExFPiIKICAgICAgfSwKICAgICAgInNpZ25hdHVyZSI6ICI8U0lHTkFUVVJFX0lEPiIsCiAgICAgICJzaWduZXIiOiAiPFNJR05FUl9VU0VSTkFNRT4iLAogICAgICAicG9zaXRpb24iOiAiPFNJR05BVFVSRV9QT1NJVElPTj4iLAogICAgICAiZG9jdW1lbnQiOiB7CiAgICAgICAgImRpc3BsYXlfbmFtZSI6ICI8RE9DVU1FTlRfVElUTEU+IiwKICAgICAgICAiaWQiOiAiPERPQ1VNRU5UX0lEPiIsCiAgICAgICAgIm9yZGVyIjogPERPQ1VNRU5UX0lOREVYPgogICAgICB9LAogICAgICAiYXV0b21hdGljIjogPERFQ0xBUkVTX0lGX1RIRV9TSUdORVJfSVNfQVVUT01BVElDPiwKICAgICAgInBhZ2UiOiAiPFNJR05BVFVSRV9QQUdFPiIKICAgIH0KICB9CmBgYAoKIyMjIElkZW50aXRpZXMgc3RhdHVzIHVwZGF0ZQoKSWRlbnRpdGllcyBzZW5kIHRoZSBmb2xsb3dpbmcgc3RhdHVzIHVwZGF0ZXM6Ci0gKipJREVOVElUWV9SRVFVRVNUX0VOUk9MTEVEKio6IHdoZW5ldmVyIGFuIGlkZW50aXR5IHJlcXVlc3QgaXMgYWN0aXZhdGVkCgojIyMjIElERU5USVRZX1JFUVVFU1RfRU5ST0xMRUQKClNlbmRzIHRoZSBmb2xsb3dpbmcgaW5mb3JtYXRpb246CgpgYGBqc29uCnsKICAgICJtZXNzYWdlIjogIklERU5USVRZX1JFUVVFU1RfRU5ST0xMRUQiLAogICAgImRhdGEiOiB7CiAgICAgICJzdGF0dXMiOiAiPFJFUVVFU1RfU1RBVFVTPiIsCiAgICAgICJyZXF1ZXN0IjogIjxSRVFVRVNUX0lEPiIsCiAgICAgICJ1c2VyIjogIjxBUFBMSUNBTlRfVVNFUk5BTUU+IgogICAgfQogIH0KYGBgCgojIyMgVXJsYmFjawoKU29tZXRpbWVzIG1heSBiZSBuZWNlc3NhcnkgdG8gbWFrZSBhIHJlZGlyZWN0IGFmdGVyIGFuIHVzZXIsIGZyb20gdGhlCnNpZ25hdHVyZSB0cmF5LCBoYXMgY29tcGxldGVkIGhpcyBvcGVyYXRpb25zIG9yIGFjdGl2YXRlZCBhIGNlcnRpZmljYXRlLgoKSWYgc2V0LCByZWRpcmVjdHMgY291bGQgaGFwcGVuIGluIDMgY2FzZXM6Ci0gYWZ0ZXIgYSBzaWduYXR1cmUgb3IgZGVjbGluZQotIGFmdGVyIGEgRFNUIGhhcyBiZWVuIHNpZ25lZCBieSBhbGwgdGhlIHNpZ25lcnMgb3IgY2FuY2VsZWQKLSBhZnRlciB0aGUgYWN0aXZhdGlvbiBvZiBhIGNlcnRpZmljYXRlCgpJbiB0aGUgZmlyc3QgdHdvIGNhc2VzIHRoZSB1cmxiYWNrIHJldHVybnMgdGhlIGZvbGxvd2luZyBpbmZvcm1hdGlvbiB0aHJvdWdoCmEgZGF0YSBmb3JtOgotICoqZHN0LWlkKio6IGlkIG9mIHRoZSBEU1QKLSAqKmRzdC11cmwqKjogc2lnbmF0dXJlX3RpY2tldCBvZiB0aGUgc2lnbmF0dXJlCi0gKipkc3Qtc3RhdHVzKio6IGN1cnJlbnQgc3RhdHVzIG9mIHRoZSBEU1QKLSAqKmRzdC1zaWduYXR1cmUtaWQqKjogaWQgb2YgdGhlIHNpZ25hdHVyZQotICoqZHN0LXNpZ25hdHVyZS1zdGF0dXMqKjogY3VycmVudCBzdGF0dXMgb2YgdGhlIHNpZ25hdHVyZQotICoqdXNlcioqOiB1c2VybmFtZSBvZiB0aGUgc2lnbmVyCi0gKipkZWNsaW5lLXJlYXNvbioqOiBpbiBjYXNlIG9mIGEgcmVmdXNlZCBEU1QgY29udGFpbnMgdGhlIHJlYXNvbiBvZiB0aGUKZGVjbGluZQoKSW4gdGhlIGxhc3QgY2FzZSB0aGUgdXJsYmFjayByZXR1cm5zIHRoZSBmb2xsb3dpbmcgaW5mb3JtYXRpb24gdGhyb3VnaCBhCmRhdGEgZm9ybToKLSAqKnVzZXIqKjogdXNlcm5hbWUgb2YgdGhlIHVzZXIgYWN0aXZhdGVkIHRoZSBjZXJ0aWZpY2F0ZQotICoqaWRlbnRpdHktcHJvdmlkZXIqKjogdGhlIHByb3ZpZGVyIGhhcyBiZWVuIHVzZWQgdG8gaXNzdWUgdGhlIGNlcnRpZmljYXRlCi0gKippZGVudGl0eS1yZXF1ZXN0LWlkKio6IGlkIG9mIHRoZSBlbnJvbGxtZW50IHJlcXVlc3QKLSAqKmlkZW50aXR5LWlkKio6IGlkIG9mIHRoZSBuZXcgaWRlbnRpdHkKLSAqKmlkZW50aXR5LWxhYmVsKio6IHRoZSBsYWJlbCBhc3NpZ25lZCB0byB0aGUgaWRlbnRpdHkKLSAqKmlkZW50aXR5LWNlcnRpZmljYXRlKio6IHB1YmxpYyBrZXkgb2YgdGhlIGNlcnRpZmljYXRlCgoK
*
* The version of the OpenAPI document: 1.5.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package signingToday.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* InlineResponse401
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-01-08T09:32:12.749Z[GMT]")
public class InlineResponse401 {
public static final String SERIALIZED_NAME_DETAIL = "detail";
@SerializedName(SERIALIZED_NAME_DETAIL)
private String detail = "Invalid credentials";
public InlineResponse401 detail(String detail) {
this.detail = detail;
return this;
}
/**
* Get detail
* @return detail
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "Invalid credentials", value = "")
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InlineResponse401 inlineResponse401 = (InlineResponse401) o;
return Objects.equals(this.detail, inlineResponse401.detail);
}
@Override
public int hashCode() {
return Objects.hash(detail);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse401 {\n");
sb.append(" detail: ").append(toIndentedString(detail)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
520c2ea1c65d82918a259fdd43dfd6570b675501 | 2487126e8e84858981df0b6094d27c9b94103dd3 | /DerbyApp.java | 454a2aec1d667b62645495f35ddedb975c773bdb | [] | no_license | ashokramcse/rps_citi_java8 | 27be19fe35ca90e5cfa776d77d7e8380db52f318 | 05da45f142c96bb84cac8ff7ef03f18ea42debb2 | refs/heads/master | 2020-03-19T07:40:19.459588 | 2018-05-24T12:11:50 | 2018-05-24T12:11:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | package com.citi.banking;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class App {
public static void main(String[] args) {
// TODO Auto-generated method stub
String dbURL = "jdbc:derby:carDB;create=true";
try {
Connection conn = DriverManager.getConnection( dbURL );
//Connection con = DriverManager.getConnection
// ("jdbc:derby://localhost:1527/junkdb;create=true","app","app");
System.out.println( "Database created successfully" );
Statement stmt = conn.createStatement();
stmt.executeUpdate("CREATE TABLE USERS (ID INT PRIMARY KEY, NAME VARCHAR(12))");
System.out.println("Created Table");
stmt.executeUpdate("INSERT INTO USERS VALUES (1,'TOM'),(2,'BILL'),(3,'AMY'),(4,'OWEN')");
System.out.println("Populated Table");
System.out.println("Done");
PreparedStatement statement = conn
.prepareStatement("SELECT * from USERS");
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
String user = resultSet.getString("NAME");
String number = resultSet.getString("ID");
System.out.println("User: " + user);
System.out.println("ID: " + number);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
cd9ea5cec4a33a6f01c310d91f558fde46f5309c | 116911540a82648550ef143900ee39c17ccb0f40 | /src/main/java/com/github/repository/ShoeRepository.java | 5a35f8d821250e09cb6cd552a8af8210ec78651f | [] | no_license | ThamVanNguyen/SerializationDemo | c4539c62bfacfb6a858431bbf684d388744fcc90 | 43207a6ba0dd9a34ab3f7bcde8024a5b5399bbca | refs/heads/master | 2021-06-17T10:46:29.674665 | 2017-06-07T09:35:54 | 2017-06-07T09:35:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 300 | java | package com.github.repository;
import com.github.entity.Shoe;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* Created by tham on 6/7/17.
*/
@Repository
public interface ShoeRepository extends JpaRepository<Shoe, Integer> {
}
| [
"[email protected]"
] | |
b33f673ffa97a8a6a6f46a5800cc8bac7aa116fa | 1e0f2efd7353e02b12cfab003b5e7f0161408486 | /src/javaassignment12015/JavaAssignment12015.java | b70e6e66389a8f3b8b979d92effd6d3301d1ce93 | [] | no_license | JibinPeter/JavaAssignment12015 | d1cc4a2c137d828d0ae2ab5af7ef838c9165a486 | f915895505e6cc6e5d1fe88488d098c1e38fbf3a | refs/heads/master | 2016-09-05T10:25:07.104275 | 2015-09-14T20:14:14 | 2015-09-14T20:14:14 | 42,473,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | 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 javaassignment12015;
/**
*
* @author c0662366
*/
public class JavaAssignment12015 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
/***************************************************
* Assignment #1
*
* Job Posting: Senior Java Developer
* http://autodata.applytojob.com/apply/381f20167d006053004a764b72725a685668140e03763926002a3749721338277b6f37/Senior-Java-Developer?source=INDE&sid=RpBIO0Qf0rGyCEoPgQKWY1idRodxADts35a&source=INDE
*
* J2EE - Java Enterprise Edition - https://en.wikipedia.org/wiki/Java_Platform,_Enterprise_Edition
* Apache Tomcat - Open source web server - https://en.wikipedia.org/wiki/Apache_Tomcat
* C++ - Object oriented programming language - https://en.wikipedia.org/wiki/C%2B%2B
* C# - C Sharp - https://en.wikipedia.org/wiki/C_Sharp_(programming_language)
* SQL - Structured Query Language - https://en.wikipedia.org/wiki/SQL
*
* Toronto Salary - 78,187 CAD
* Waterloo Salary - 80,221 CAD
* Vancouver Salary - 82,707 CAD
*
*/
}
}
| [
"[email protected]"
] | |
b02c94f2e73bfbcf6924313b6544ed9fb31bd371 | 2e804c0d326ada7da2e610a5fcc7999507389da0 | /src/main/java/com/marcel/pontointeligente/api/dtos/EmpresaDto.java | 81d9f0529ef184f9fb647dd65a493da675ddfc76 | [
"MIT"
] | permissive | aguiarmarcel/ponto-inteligente-api | d10296760af650aaf445ad2504b913071eee100b | ed75cd9ee0fac7ea58dc7ab85f4e07dc018f010a | refs/heads/master | 2022-01-28T12:44:07.468989 | 2019-06-17T18:07:31 | 2019-06-17T18:07:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package com.marcel.pontointeligente.api.dtos;
import javax.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.br.CNPJ;
public class EmpresaDto {
private Long id;
private String razaoSocial;
@NotEmpty(message = "CNPJ não pode se vazio.")
@CNPJ(message = "CNPJ inválido.")
private String cnpj;
public EmpresaDto() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCnpj() {
return cnpj;
}
public void setCnpj(String cnpj) {
this.cnpj = cnpj;
}
public String getRazaoSocial() {
return razaoSocial;
}
public void setRazaoSocial(String razaoSocial) {
this.razaoSocial = razaoSocial;
}
@Override
public String toString() {
return "EmpresaDto [id=" + id + ", razaoSocial=" + razaoSocial + ", cnpj=" + cnpj + "]";
}
}
| [
"[email protected]"
] | |
0fe91395491419c3ece19d23b7c01b81ffe52420 | 2941ac7784fca3f065c6fa2efd3d830c89e6f137 | /src/main/java/jp/co/solxyz/lessons/catalog/business/GoodsService.java | e6d48666cc1e952466675703e92630c37b2f3326 | [] | no_license | jsn-developer/lessons-catalog | f8cb0b9859fe5bdbf8e638cb25cb5b803d2c4840 | efb6b94da01d6bbb16096e90b98a165405ef5b7f | refs/heads/master | 2022-06-27T08:27:17.194405 | 2020-03-30T04:43:03 | 2020-03-30T04:43:03 | 249,858,849 | 0 | 0 | null | 2022-06-21T03:03:34 | 2020-03-25T01:30:36 | JavaScript | UTF-8 | Java | false | false | 821 | java | package jp.co.solxyz.lessons.catalog.business;
import java.util.List;
import java.util.Optional;
import jp.co.solxyz.lessons.catalog.dao.DataDao;
import jp.co.solxyz.lessons.catalog.entity.GoodsEntity;
public class GoodsService {
/**
* 全ての商品情報を取得
* @return リスト
*/
public List<GoodsEntity> getAllGoods() throws Exception{
DataDao dao = new DataDao();
return dao.select("select * from goods");
}
/**
* IDから商品情報を取得。商品が見つからない場合にはnullを返却
* @param id 商品ID
* @return 商品情報
*/
public Optional<GoodsEntity> getGoodsFromId(String id) throws Exception{
DataDao dao = new DataDao();
var ret = dao.select("select * from goods where id = " + id);
return Optional.of(ret.isEmpty() ? null : ret.get(0));
}
}
| [
"[email protected]"
] | |
facf9a78c91dd376d8d447c8e386960f92003160 | 4799e22735a832aebad27d15af8b54ea1bc2611d | /app/src/test/java/com/examensupletorio/visorlugares/ExampleUnitTest.java | 70df87bf356ea10758222738c5946dab8df8884e | [] | no_license | Jalejandro2000/VisorLugares | 031de662b619dca0d62ff74bf4b60bd18b711f56 | fb8cbdeb43a6f3d842525858c762a5361f251908 | refs/heads/master | 2023-07-18T19:26:45.072514 | 2021-09-10T04:18:30 | 2021-09-10T04:18:30 | 404,954,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.examensupletorio.visorlugares;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
61d7731356f7a4b37ff6924c87b757bd5f59d36a | 096105c682346ea9dc211b4cb1223f510a6cdd17 | /src/com/cts/arrays/test/MergeTest.java | d5ec08bd8ef0cefc2ee5bc77c46fe335492556d5 | [] | no_license | Dilludoll/CTSAssignment | 52a5b14b93fa6c57f9b089b12d9c9905c554b008 | 14f371d10a04c61dc8d494c585a4afeb3f523952 | refs/heads/master | 2020-03-18T06:42:36.538110 | 2018-06-01T20:45:34 | 2018-06-01T20:45:34 | 134,411,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package com.cts.arrays.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MergeTest {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int arr1[]=new int[5];
int arr2[]=new int[5];
int arr3[]=new int[10];
System.out.println("eneter the five nos for frst array:");
for(int i=0;i<5;i++) {
arr1[i]=Integer.parseInt(br.readLine());
}
System.out.println("eneter the five nos for seecond array:");
for(int i=0;i<5;i++) {
arr2[i]=Integer.parseInt(br.readLine());
}
for(int i=0;i<5;i++) {
arr3[i]=arr1[i];
arr3[5+i]=arr2[i];
}
System.out.println("final array is:");
for(int i=0;i<10;i++) {
System.out.print(arr3[i]+ " ");
}
}
} | [
"[email protected]"
] | |
5cc702024bceb8f224cf725a4012da4890034837 | ee62db9c643e79dfc6e72a0ae90769a4de71b07b | /04_ReadingData/LoopingRows/src/com/lynda/javatraining/db/Main.java | 95dc87a892de6725e4dece5dfe2143386c21283a | [] | no_license | yaroslav-shlapak/LyndaJDBCTutorial | 7a955fa52f28850dddf444839126c0e6615da528 | bfbfacaf63ef85ad4ee3220a138585055906fc76 | refs/heads/master | 2021-01-17T17:07:14.269800 | 2014-01-06T12:08:52 | 2014-01-06T12:08:52 | 15,621,434 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package com.lynda.javatraining.db;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.lynda.javatraining.db.tables.Tours;
public class Main {
public static void main(String[] args) throws SQLException {
try (
Connection conn = DBUtil.getConnection(DBType.HSQLDB);
Statement stmt = conn.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("SELECT * FROM tours");
) {
Tours.displayData(rs);
} catch (SQLException e) {
DBUtil.processException(e);
}
}
}
| [
"[email protected]"
] | |
a4297316bcd5e81f2dbe4f9e229a815850f46077 | f5ae9153e263577dc33d777ea5091f50ab132db1 | /src/main/java/com/sun/javaee/blueprints/petstore/model/SellerContactInfo.java | e857dbe028143f49f2125d6e5c52471b8d00784f | [] | no_license | vijayanand15/onlinepetstore | 9378d7a41767980981d6f8b3e52aa8a8ccbff7ba | 3f4ae1724aefa8ea250a7e1667b388d9088bf489 | refs/heads/master | 2021-01-12T16:43:04.895695 | 2016-10-20T08:08:12 | 2016-10-20T08:08:12 | 71,436,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,916 | java | /* Copyright 2006 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at: http://developer.sun.com/berkeley_license.html
$Id: SellerContactInfo.java,v 1.5 2007/01/09 19:02:11 basler Exp $ */
package com.sun.javaee.blueprints.petstore.model;
import com.sun.javaee.blueprints.petstore.util.PetstoreUtil;
import java.util.ArrayList;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@SuppressWarnings("serial")
@Entity
@Table(name="sellercontactinfo")
public class SellerContactInfo implements java.io.Serializable {
private String contactInfoID;
private String lastName;
private String firstName;
private String email;
public SellerContactInfo() { }
public SellerContactInfo(String firstName, String lastName,
String email) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
@TableGenerator(name="CONTACTINFO_ID_GEN",
table="ID_GEN",
pkColumnName="GEN_KEY",
valueColumnName="GEN_VALUE",
pkColumnValue="CONTACT_INFO_ID",
allocationSize=1)
@GeneratedValue(strategy=GenerationType.TABLE,generator="CONTACTINFO_ID_GEN")
@Id
public String getContactInfoID() {
return contactInfoID;
}
public String getLastName() {
return lastName;
}
public String getFirstName() {
return firstName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public void setContactInfoID(String contactInfoID) {
this.contactInfoID = contactInfoID;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* This method checks to make sure the class values are valid
*
* @return Message(s) of validation errors or and empty array (zero length) if class is valid
*/
public String[] validateWithMessage() {
ArrayList<String> valMess=new ArrayList<String>();
// make sure make and address is entered
if(firstName == null || firstName.equals("")) {
// price should be a number
valMess.add(PetstoreUtil.getMessage("invalid_contact_firstname"));
}
if(lastName == null || lastName.equals("")) {
valMess.add(PetstoreUtil.getMessage("invalid_contact_lastname"));
}
return valMess.toArray(new String[valMess.size()]);
}
}
| [
"[email protected]"
] | |
d117afb9319a52f6d680540e3931023a5584417d | 2bfbb55cee5ca970f6932f69047267541ec6edf5 | /app/src/normal/java/io/gonative/android/LeanWebView.java | 189f3a4a7ce64cb154589978062f87a5ebeaf21a | [] | no_license | lucakiebel/ListX-App | 9a9d8578986aa6196a3525acfbedd5bf45aaadd8 | 3d46e54409a5bb4d2e316542c6ea966dd028e3e3 | refs/heads/master | 2021-04-12T03:51:26.927436 | 2018-03-17T22:10:35 | 2018-03-17T22:10:35 | 125,671,444 | 2 | 0 | null | 2020-11-23T13:42:23 | 2018-03-17T21:44:59 | Java | UTF-8 | Java | false | false | 4,084 | java | package io.gonative.android;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.util.AttributeSet;
import android.webkit.WebBackForwardList;
import android.webkit.WebChromeClient;
import android.webkit.WebHistoryItem;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* Pass calls WebViewClient.shouldOverrideUrlLoading when loadUrl, reload, or goBack are called.
*/
public class LeanWebView extends WebView implements GoNativeWebviewInterface {
private WebViewClient mClient = null;
private WebChromeClient mChromeClient = null;
private boolean checkLoginSignup = true;
public LeanWebView(Context context) {
super(context);
}
public LeanWebView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LeanWebView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void setWebViewClient(WebViewClient client) {
mClient = client;
super.setWebViewClient(client);
}
@Override
public void setWebChromeClient(WebChromeClient client) {
mChromeClient = client;
super.setWebChromeClient(client);
}
@Override
public void loadUrl(String url) {
if (url == null) return;
if (url.startsWith("javascript:"))
runJavascript(url.substring("javascript:".length()));
else if (mClient == null || !mClient.shouldOverrideUrlLoading(this, url)) {
super.loadUrl(url);
}
}
@Override
public void reload() {
if (mClient == null || !(mClient instanceof GoNativeWebviewClient)) super.reload();
else if(!((GoNativeWebviewClient)mClient).shouldOverrideUrlLoading(this, getUrl(), true))
super.reload();
}
@Override
public void goBack() {
try {
WebBackForwardList history = copyBackForwardList();
WebHistoryItem item = history.getItemAtIndex(history.getCurrentIndex() - 1);
// this shouldn't be necessary, but sometimes we are not able to get an updated
// intercept url from onPageStarted, so this call to shouldOverrideUrlLoading ensures
// that our html interceptor knows about this url.
if (mClient.shouldOverrideUrlLoading(this, item.getUrl())) {
return;
}
super.goBack();
return;
} catch (Exception ignored) {
super.goBack();
return;
}
}
// skip shouldOverrideUrlLoading, including its html override logic.
public void loadUrlDirect(String url) {
super.loadUrl(url);
}
public boolean checkLoginSignup() {
return checkLoginSignup;
}
public void setCheckLoginSignup(boolean checkLoginSignup) {
this.checkLoginSignup = checkLoginSignup;
}
public void runJavascript(String js) {
// before Kitkat, the only way to run javascript was to load a url that starts with "javascript:".
// Starting in Kitkat, the "javascript:" method still works, but it expects the rest of the string
// to be URL encoded, unlike previous versions. Rather than URL encode for Kitkat and above,
// use the new evaluateJavascript method.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
loadUrlDirect("javascript:" + js);
} else {
evaluateJavascript(js, null);
}
}
public boolean exitFullScreen() {
if (mChromeClient != null && mChromeClient instanceof GoNativeWebChromeClient) {
return ((GoNativeWebChromeClient) mChromeClient).exitFullScreen();
} else {
return false;
}
}
@Override
public boolean isCrosswalk() {
return false;
}
@Override
public void saveStateToBundle(Bundle outBundle) {
saveState(outBundle);
}
@Override
public void restoreStateFromBundle(Bundle inBundle) {
restoreState(inBundle);
}
}
| [
"[email protected]"
] | |
3eafa90e3c07891a82f15d99650ee35dacf638ef | 609f1638b9deebbb6000ed3634aa0e54767051c4 | /src/main/java/com/cjf/generic/FruitGenerator1.java | c80ed22253502b40d4c686a6f8d63880a27c7444 | [] | no_license | soochowcjf/sgc-learn | 93ba6dd6fef46831f2e8562289124a30f0778882 | b99c801498504d2bd0e1e068f0e46905c32e785f | refs/heads/master | 2021-08-18T13:42:52.870267 | 2021-02-08T05:24:21 | 2021-02-08T05:24:21 | 243,742,116 | 0 | 0 | null | 2021-02-08T01:21:07 | 2020-02-28T11:00:32 | Java | UTF-8 | Java | false | false | 773 | java | package com.cjf.generic;
import java.util.Random;
/**
* 传入泛型实参时:
* 定义一个生产器实现这个接口,虽然我们只创建了一个泛型接口Generator<T>
* 但是我们可以为T传入无数个实参,形成无数种类型的Generator接口。
* 在实现类实现泛型接口时,如已将泛型类型传入实参类型,则所有使用泛型的地方都要替换成传入的实参类型
* 即:Generator<T>,public T next();中的的T都要替换成传入的String类型。
*/
public class FruitGenerator1 implements Generator<String> {
private String[] fruits = new String[]{"Apple", "Banana", "Pear"};
@Override
public String next() {
Random rand = new Random();
return fruits[rand.nextInt(3)];
}
} | [
"[email protected]"
] | |
0900fa3d2ccdd6093b234bcd9eca7730e8c97fe5 | 291fa7a2def7799d6475ebfedd24a5bc94696dd8 | /app/src/main/java/com/example/youssef/getyourdrug/customfonts/EditText_Roboto_Meidum.java | 2dcbbeb10ceb3c8bc1ed3ab383fb855bb3351185 | [] | no_license | YoussefJabbari/Get-Your-Drug | 94b0c0c3e00ddde2f2b6b32bb179a93ef85a2946 | d11dc2ebd332f7742db1365565c0d8d9cdd2b974 | refs/heads/master | 2021-09-16T04:10:48.817298 | 2018-06-15T23:14:01 | 2018-06-15T23:14:01 | 137,538,339 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 865 | java | package com.example.youssef.getyourdrug.customfonts;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;
public class EditText_Roboto_Meidum extends android.support.v7.widget.AppCompatEditText {
public EditText_Roboto_Meidum(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public EditText_Roboto_Meidum(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public EditText_Roboto_Meidum(Context context) {
super(context);
init();
}
private void init() {
if (!isInEditMode()) {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Medium.ttf");
setTypeface(tf);
}
}
} | [
"[email protected]"
] | |
0ebdf78a65443133cb74975e3ffdba69b97552b1 | e7dba28ef2a986e9348fba1f443e522be94d859d | /CustomCamera/app/src/main/java/com/handpay/camera/manager/AutoFocusManager.java | 4348a15f2a8ff4a7c9e23e5e64cad18fb07b8dc1 | [] | no_license | xiaoshi316/AndroidProjectStudy | 4309d8acc6d5c3dae481e24c516e353169143d8a | 7f47e404be29e3ec7eb2873aeb5c69f6a7258efa | refs/heads/master | 2021-01-12T15:43:04.861663 | 2017-01-20T08:59:12 | 2017-01-20T08:59:12 | 71,866,223 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,746 | java | package com.handpay.camera.manager;
import android.hardware.Camera;
import android.os.AsyncTask;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.RejectedExecutionException;
/***
* 自动对焦
*/
public class AutoFocusManager implements Camera.AutoFocusCallback{
private static final String TAG = AutoFocusManager.class.getSimpleName();
private static final long AUTO_FOCUS_INTERVAL_MS = 2000L;
private static final Collection<String> FOCUS_MODES_CALLING_AF;
static {
FOCUS_MODES_CALLING_AF = new ArrayList<String>(2);
FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_AUTO);
FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_MACRO);
}
private boolean stopped;
private boolean focusing;
private final boolean useAutoFocus;
private final Camera camera;
private AsyncTask<?,?,?> outstandingTask;
public AutoFocusManager(Camera camera) {
this.camera = camera;
String currentFocusMode = camera.getParameters().getFocusMode();
useAutoFocus = FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
Log.e(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
start();
}
@Override
public synchronized void onAutoFocus(boolean success, Camera theCamera) {
focusing = false;
autoFocusAgainLater();
}
private synchronized void autoFocusAgainLater() {
if (!stopped && outstandingTask == null) {
AutoFocusTask newTask = new AutoFocusTask();
try {
newTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
outstandingTask = newTask;
} catch (RejectedExecutionException ree) {
Log.e(TAG, "Could not request auto focus", ree);
}
}
}
/**
* 开始自动对焦
*/
public synchronized void start() {
if (useAutoFocus) {
outstandingTask = null;
if (!stopped && !focusing) {
try {
camera.autoFocus(this);
focusing = true;
} catch (RuntimeException re) {
// Have heard RuntimeException reported in Android 4.0.x+; continue?
Log.e(TAG, "Unexpected exception while focusing", re);
// Try again later to keep cycle going
autoFocusAgainLater();
}
}
}
}
private synchronized void cancelOutstandingTask() {
if (outstandingTask != null) {
if (outstandingTask.getStatus() != AsyncTask.Status.FINISHED) {
outstandingTask.cancel(true);
}
outstandingTask = null;
}
}
/**
* 停止自动对焦
*/
public synchronized void stop() {
stopped = true;
if (useAutoFocus) {
cancelOutstandingTask();
// Doesn't hurt to call this even if not focusing
try {
camera.cancelAutoFocus();
} catch (RuntimeException re) {
// Have heard RuntimeException reported in Android 4.0.x+; continue?
Log.e(TAG, "Unexpected exception while cancelling focusing", re);
}
}
}
private final class AutoFocusTask extends AsyncTask<Object,Object,Object> {
@Override
protected Object doInBackground(Object... voids) {
try {
Thread.sleep(AUTO_FOCUS_INTERVAL_MS);
} catch (InterruptedException e) {
// continue
}
start();
return null;
}
}
}
| [
"[email protected]"
] | |
a3a30ecf98881a501e8b4a4a335918e0be810f6b | e0ba7ddeb226fe452e5114ce2b8b94ddb4b97b3e | /app/src/main/java/com/zhuye/ershoufang/bean/MybidderBean.java | a863f21a7a2e0d0ff0a2c41dc7e317b2b1df3e17 | [] | no_license | jingzhixb/trunk | 5337a676f9eb91888171bd06f7a657e72cb05636 | e9201b355323c86db5b3a22a8e869b1243b00763 | refs/heads/master | 2020-03-28T01:34:08.005377 | 2018-09-05T12:34:05 | 2018-09-05T12:34:05 | 147,514,146 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,429 | java | package com.zhuye.ershoufang.bean;
/**
* Created by Administrator on 2018/5/2 0002.
*/
public class MybidderBean {
/**
* data : [{"id":"id","city_id":"市id","area_id":"区id","xiaoqu":"小区","addr":"详细地址","qp_money":"怕买价格","start_time":"开始时间","jp_time":"拍卖周期","photo":"图片","city":"市名称","area":"区名称","end_time":"结束时间","money":"成交价格"}]
* message :
* code : 200
*/
/**
* id : id
* city_id : 市id
* area_id : 区id
* xiaoqu : 小区
* addr : 详细地址
* qp_money : 怕买价格
* start_time : 开始时间
* jp_time : 拍卖周期
* photo : 图片
* city : 市名称
* area : 区名称
* end_time : 结束时间
* money : 成交价格
*/
private String id;
private String city_id;
private String area_id;
private String xiaoqu;
private String addr;
private String qp_money;
private String start_time;
private String jp_time;
private String photo;
private String city;
private String area;
private String end_time;
private String money;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCity_id() {
return city_id;
}
public void setCity_id(String city_id) {
this.city_id = city_id;
}
public String getArea_id() {
return area_id;
}
public void setArea_id(String area_id) {
this.area_id = area_id;
}
public String getXiaoqu() {
return xiaoqu;
}
public void setXiaoqu(String xiaoqu) {
this.xiaoqu = xiaoqu;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public String getQp_money() {
return qp_money;
}
public void setQp_money(String qp_money) {
this.qp_money = qp_money;
}
public String getStart_time() {
return start_time;
}
public void setStart_time(String start_time) {
this.start_time = start_time;
}
public String getJp_time() {
return jp_time;
}
public void setJp_time(String jp_time) {
this.jp_time = jp_time;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getEnd_time() {
return end_time;
}
public void setEnd_time(String end_time) {
this.end_time = end_time;
}
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
}
| [
"1390056147qq.com"
] | 1390056147qq.com |
d33eb45cfeea3ee03f94147690957d0c8e9cb873 | 7e526e526db5ab98767a620ef8595a397ecf6941 | /src/main/java/common/element/Table.java | 7a5d4ab11cae0a54ab0df6e5e0e62a2cc0a87313 | [] | no_license | viethuynh140499/railway | f756a18ff66b19b549b9ea50bc7b43fe7ba801a2 | 7307bc9a8f1c65308a4f9e7e7f29a417d25e1f0b | refs/heads/master | 2023-04-24T15:53:08.150928 | 2021-05-10T17:13:06 | 2021-05-10T17:38:22 | 359,656,549 | 0 | 0 | null | 2021-05-10T17:13:07 | 2021-04-20T02:15:11 | Java | UTF-8 | Java | false | false | 152 | java | package common.element;
import org.openqa.selenium.By;
public class Table extends BaseElement{
public Table(By locator) {
super(locator);
}
}
| [
"[email protected]"
] | |
69c666e42268106fbd0bbc1ebeba395145eb543f | 77f5ce0039fac42d31dbaf05f1875dd4f9773b74 | /MaratonaJava/src/javacore/colecoes/testes/SetTest.java | 48c52026ce40d467b43a0bc90fc70eb1915879e2 | [] | no_license | devleandrodias/maratona-java | 16011d6e3325ce6cb25a49b1a363612e6683953e | 9cc1f18e0ed8ead542d0306f71c23f5e0c569d25 | refs/heads/master | 2020-11-24T03:42:05.472317 | 2020-01-26T15:16:26 | 2020-01-26T15:16:26 | 227,949,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package javacore.colecoes.testes;
import javacore.colecoes.classe.Produto;
import java.util.HashSet;
import java.util.Set;
/**
* SetTest
*/
public class SetTest {
public static void main(String[] args) {
Produto produto1 = new Produto("123124", "MacBook Air 2017", 3999.99);
Produto produto2 = new Produto("235252", "iMac 2018", 13999.99);
Produto produto3 = new Produto("345224", "iPhone 11 Pro Max", 7999.99);
Produto produto4 = new Produto("253232", "Mac Mini", 4999.99);
// SET Não permite elementos duplicados, ele não é indexado
Set<Produto> produtosSet = new HashSet<>();
// LinkedHashSet mantém a ordem de inserção
produtosSet.add(produto1);
produtosSet.add(produto2);
produtosSet.add(produto3);
produtosSet.add(produto4);
// SET Não tem nenhum tipo de ordenação
for (Produto produto : produtosSet) {
System.out.println(produto);
}
}
} | [
"[email protected]"
] | |
25a0d00a982e45dc0351adfdc5ed5a319ea4b88b | b948212e8852fb22dd0ab280933c335e7976f8cd | /GraphQL_Media_Service/src/main/java/GraphQL/media_service/pojo/Movie.java | 60399cf375f488eb34fe2234b2afd4e1461354d3 | [
"MIT"
] | permissive | KolHaj/GraphQL-Microservices-Media-Demo | eb4a8a99b616059fc2f08b7a1d4873193554bdbd | 00e4b5ab4945c19b755c14dbb3170f688e57ee75 | refs/heads/main | 2023-04-10T22:14:12.013204 | 2021-04-26T01:14:10 | 2021-04-26T01:14:10 | 361,578,677 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package GraphQL.media_service.pojo;
import lombok.Data;
/**
* Movie variables with Lombok java library to remove
* unnecessary getter, setter, and constructor for cleaner
* overall code look.
*/
@Data
public class Movie {
private String id;
private String name;
private String writers;
private boolean available;
private String media;
//private Media media;
}
| [
"[email protected]"
] | |
9827a83ffc7eb681b4f79b4a55a334ea77c640f6 | 653ecfe38ce0b3037a2c3222a2636582d77f4a79 | /src/main/java/com/fenglinga/tinyspring/App.java | 8c05a9bc6bfe7cdb71d1e7ad9aebcf2fb2e0424b | [] | no_license | nkligang/tinySpringSample | 0d9e7a06c922c40851a98592e2eb835cf034bb47 | 33ad40fd3802792f1d75aab11c7d937e0199bca5 | refs/heads/master | 2023-03-20T08:33:55.662274 | 2021-03-23T03:42:32 | 2021-03-23T03:42:32 | 341,755,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package com.fenglinga.tinyspring;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args ) throws Exception
{
new SpringAppBuilder().run(args);
}
}
| [
"[email protected]"
] | |
bb309fc2970710fdd720ee9f52d5e0398bc69be9 | 335608f1017f8663b2f9203a36e1058dce9576be | /HoloEverywhere/HoloEverywhereLib/src/com/WazaBe/HoloEverywhere/preference/Preference.java | 96583a1cf03b85223bb6dd87d6f4e45eebbd528b | [] | no_license | Eugeny/fksis-schedule | cde416222d1ed05c76607ec13be3905febf79e7f | 8532aa84d3cf2ef167f37cdef157e3ebe2e82877 | refs/heads/master | 2016-09-10T10:20:38.471790 | 2013-02-10T15:17:27 | 2013-02-10T15:17:27 | 5,688,368 | 0 | 1 | null | 2013-01-10T13:38:11 | 2012-09-05T14:29:18 | Java | UTF-8 | Java | false | false | 21,276 | java | package com.WazaBe.HoloEverywhere.preference;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.AbsSavedState;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.WazaBe.HoloEverywhere.R;
import com.WazaBe.HoloEverywhere.util.CharSequences;
public class Preference implements Comparable<Preference>,
OnDependencyChangeListener {
public static class BaseSavedState extends AbsSavedState {
public static final Parcelable.Creator<BaseSavedState> CREATOR = new Parcelable.Creator<BaseSavedState>() {
@Override
public BaseSavedState createFromParcel(Parcel in) {
return new BaseSavedState(in);
}
@Override
public BaseSavedState[] newArray(int size) {
return new BaseSavedState[size];
}
};
public BaseSavedState(Parcel source) {
super(source);
}
public BaseSavedState(Parcelable superState) {
super(superState);
}
}
interface OnPreferenceChangeInternalListener {
void onPreferenceChange(Preference preference);
void onPreferenceHierarchyChange(Preference preference);
}
public interface OnPreferenceChangeListener {
boolean onPreferenceChange(Preference preference, Object newValue);
}
public interface OnPreferenceClickListener {
boolean onPreferenceClick(Preference preference);
}
public static final int DEFAULT_ORDER = Integer.MAX_VALUE;
private boolean mBaseMethodCalled;
private Context mContext;
private Object mDefaultValue;
private String mDependencyKey;
private boolean mDependencyMet = true;
private List<Preference> mDependents;
private boolean mEnabled = true;
private Bundle mExtras;
private String mFragment;
private boolean mHasSpecifiedLayout = false;
private Drawable mIcon;
private int mIconResId;
private long mId;
private Intent mIntent;
private String mKey;
private int mLayoutResId = R.layout.preference_holo;
private OnPreferenceChangeInternalListener mListener;
private OnPreferenceChangeListener mOnChangeListener;
private OnPreferenceClickListener mOnClickListener;
private int mOrder = DEFAULT_ORDER;
private boolean mPersistent = true;
private PreferenceManager mPreferenceManager;
private boolean mRequiresKey;
private boolean mSelectable = true;
private boolean mShouldDisableView = true;
private CharSequence mSummary;
private CharSequence mTitle;
private int mTitleRes;
private int mWidgetLayoutResId;
public Preference(Context context) {
this(context, null);
}
public Preference(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.preferenceStyle);
}
public Preference(Context context, AttributeSet attrs, int defStyle) {
mContext = context;
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Preference, defStyle, 0);
mIconResId = a.getResourceId(R.styleable.Preference_icon, 0);
mKey = a.getString(R.styleable.Preference_key);
mTitleRes = a.getResourceId(R.styleable.Preference_title, 0);
mTitle = a.getString(R.styleable.Preference_title);
mSummary = a.getString(R.styleable.Preference_summary);
mOrder = a.getInt(R.styleable.Preference_order, mOrder);
mFragment = a.getString(R.styleable.Preference_fragment);
mLayoutResId = a.getResourceId(R.styleable.Preference_layout,
mLayoutResId);
mWidgetLayoutResId = a.getResourceId(
R.styleable.Preference_widgetLayout, mWidgetLayoutResId);
mEnabled = a.getBoolean(R.styleable.Preference_enabled, true);
mSelectable = a.getBoolean(R.styleable.Preference_selectable, true);
mPersistent = a.getBoolean(R.styleable.Preference_persistent,
mPersistent);
mDependencyKey = a.getString(R.styleable.Preference_dependency);
mDefaultValue = onGetDefaultValue(a,
R.styleable.Preference_defaultValue);
mShouldDisableView = a.getBoolean(
R.styleable.Preference_shouldDisableView, mShouldDisableView);
a.recycle();
if (!getClass().getName().startsWith(
"com.WazaBe.HoloEverywhere.preference")) {
mHasSpecifiedLayout = true;
}
}
protected boolean callChangeListener(Object newValue) {
return mOnChangeListener == null ? true : mOnChangeListener
.onPreferenceChange(this, newValue);
}
@Override
public int compareTo(Preference another) {
if (mOrder != DEFAULT_ORDER || mOrder == DEFAULT_ORDER
&& another.mOrder != DEFAULT_ORDER) {
return mOrder - another.mOrder;
} else if (mTitle == null) {
return 1;
} else if (another.mTitle == null) {
return -1;
} else {
return CharSequences.compareToIgnoreCase(mTitle, another.mTitle);
}
}
void dispatchRestoreInstanceState(Bundle container) {
if (hasKey()) {
Parcelable state = container.getParcelable(mKey);
if (state != null) {
mBaseMethodCalled = false;
onRestoreInstanceState(state);
if (!mBaseMethodCalled) {
throw new IllegalStateException(
"Derived class did not call super.onRestoreInstanceState()");
}
}
}
}
void dispatchSaveInstanceState(Bundle container) {
if (hasKey()) {
mBaseMethodCalled = false;
Parcelable state = onSaveInstanceState();
if (!mBaseMethodCalled) {
throw new IllegalStateException(
"Derived class did not call super.onSaveInstanceState()");
}
if (state != null) {
container.putParcelable(mKey, state);
}
}
}
private void dispatchSetInitialValue() {
final boolean shouldPersist = shouldPersist();
if (!shouldPersist || !getSharedPreferences().contains(mKey)) {
if (mDefaultValue != null) {
onSetInitialValue(false, mDefaultValue);
}
} else {
onSetInitialValue(true, null);
}
}
protected Preference findPreferenceInHierarchy(String key) {
if (TextUtils.isEmpty(key) || mPreferenceManager == null) {
return null;
}
return mPreferenceManager.findPreference(key);
}
public Context getContext() {
return mContext;
}
public String getDependency() {
return mDependencyKey;
}
public SharedPreferences.Editor getEditor() {
if (mPreferenceManager == null) {
return null;
}
return mPreferenceManager.getEditor();
}
public Bundle getExtras() {
if (mExtras == null) {
mExtras = new Bundle();
}
return mExtras;
}
StringBuilder getFilterableStringBuilder() {
StringBuilder sb = new StringBuilder();
CharSequence title = getTitle();
if (!TextUtils.isEmpty(title)) {
sb.append(title).append(' ');
}
CharSequence summary = getSummary();
if (!TextUtils.isEmpty(summary)) {
sb.append(summary).append(' ');
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
return sb;
}
public String getFragment() {
return mFragment;
}
public Drawable getIcon() {
return mIcon;
}
long getId() {
return mId;
}
public Intent getIntent() {
return mIntent;
}
public String getKey() {
return mKey;
}
public int getLayoutResource() {
return mLayoutResId;
}
public OnPreferenceChangeListener getOnPreferenceChangeListener() {
return mOnChangeListener;
}
public OnPreferenceClickListener getOnPreferenceClickListener() {
return mOnClickListener;
}
public int getOrder() {
return mOrder;
}
protected boolean getPersistedBoolean(boolean defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
return mPreferenceManager.getSharedPreferences().getBoolean(mKey,
defaultReturnValue);
}
protected float getPersistedFloat(float defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
return mPreferenceManager.getSharedPreferences().getFloat(mKey,
defaultReturnValue);
}
protected int getPersistedInt(int defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
return mPreferenceManager.getSharedPreferences().getInt(mKey,
defaultReturnValue);
}
protected long getPersistedLong(long defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
return mPreferenceManager.getSharedPreferences().getLong(mKey,
defaultReturnValue);
}
protected String getPersistedString(String defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
return mPreferenceManager.getSharedPreferences().getString(mKey,
defaultReturnValue);
}
protected Set<String> getPersistedStringSet(Set<String> defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
return mPreferenceManager.getSharedPreferences().getStringSet(mKey,
defaultReturnValue);
}
public PreferenceManager getPreferenceManager() {
return mPreferenceManager;
}
public SharedPreferences getSharedPreferences() {
if (mPreferenceManager == null) {
return null;
}
return mPreferenceManager.getSharedPreferences();
}
public boolean getShouldDisableView() {
return mShouldDisableView;
}
public CharSequence getSummary() {
return mSummary;
}
public CharSequence getTitle() {
return mTitle;
}
public int getTitleRes() {
return mTitleRes;
}
public View getView(View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = onCreateView(parent);
}
onBindView(convertView);
return convertView;
}
public int getWidgetLayoutResource() {
return mWidgetLayoutResId;
}
public boolean hasKey() {
return !TextUtils.isEmpty(mKey);
}
boolean hasSpecifiedLayout() {
return mHasSpecifiedLayout;
}
public boolean isEnabled() {
return mEnabled && mDependencyMet;
}
public boolean isPersistent() {
return mPersistent;
}
public boolean isSelectable() {
return mSelectable;
}
protected void notifyChanged() {
if (mListener != null) {
mListener.onPreferenceChange(this);
}
}
public void notifyDependencyChange(boolean disableDependents) {
final List<Preference> dependents = mDependents;
if (dependents == null) {
return;
}
final int dependentsCount = dependents.size();
for (int i = 0; i < dependentsCount; i++) {
dependents.get(i).onDependencyChanged(this, disableDependents);
}
}
protected void notifyHierarchyChanged() {
if (mListener != null) {
mListener.onPreferenceHierarchyChange(this);
}
}
protected void onAttachedToActivity() {
registerDependency();
}
protected void onAttachedToHierarchy(PreferenceManager preferenceManager) {
mPreferenceManager = preferenceManager;
mId = preferenceManager.getNextId();
dispatchSetInitialValue();
}
protected void onBindView(View view) {
final TextView titleView = (TextView) view.findViewById(R.id.title);
if (titleView != null) {
final CharSequence title = getTitle();
if (!TextUtils.isEmpty(title)) {
titleView.setText(title);
titleView.setVisibility(View.VISIBLE);
} else {
titleView.setVisibility(View.GONE);
}
}
final TextView summaryView = (TextView) view.findViewById(R.id.summary);
if (summaryView != null) {
final CharSequence summary = getSummary();
if (!TextUtils.isEmpty(summary)) {
summaryView.setText(summary);
summaryView.setVisibility(View.VISIBLE);
} else {
summaryView.setVisibility(View.GONE);
}
}
ImageView imageView = (ImageView) view.findViewById(R.id.icon);
if (imageView != null) {
if (mIconResId != 0 || mIcon != null) {
if (mIcon == null) {
mIcon = getContext().getResources().getDrawable(mIconResId);
}
if (mIcon != null) {
imageView.setImageDrawable(mIcon);
}
}
imageView.setVisibility(mIcon != null ? View.VISIBLE : View.GONE);
}
if (mShouldDisableView) {
setEnabledStateOnViews(view, isEnabled());
}
}
protected void onClick() {
}
protected View onCreateView(ViewGroup parent) {
final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
final View layout = layoutInflater.inflate(mLayoutResId, parent, false);
final ViewGroup widgetFrame = (ViewGroup) layout
.findViewById(R.id.widget_frame);
if (widgetFrame != null) {
if (mWidgetLayoutResId != 0) {
layoutInflater.inflate(mWidgetLayoutResId, widgetFrame);
} else {
widgetFrame.setVisibility(View.GONE);
}
}
return layout;
}
@Override
public void onDependencyChanged(Preference dependency,
boolean disableDependent) {
if (mDependencyMet == disableDependent) {
mDependencyMet = !disableDependent;
notifyDependencyChange(shouldDisableDependents());
notifyChanged();
}
}
protected Object onGetDefaultValue(TypedArray a, int index) {
return null;
}
public boolean onKey(View v, int keyCode, KeyEvent event) {
return false;
}
protected void onPrepareForRemoval() {
unregisterDependency();
}
protected void onRestoreInstanceState(Parcelable state) {
mBaseMethodCalled = true;
if (state != AbsSavedState.EMPTY_STATE && state != null) {
throw new IllegalArgumentException(
"Wrong state class -- expecting Preference State");
}
}
protected Parcelable onSaveInstanceState() {
mBaseMethodCalled = true;
return AbsSavedState.EMPTY_STATE;
}
protected void onSetInitialValue(boolean restorePersistedValue,
Object defaultValue) {
}
public Bundle peekExtras() {
return mExtras;
}
void performClick(PreferenceScreen preferenceScreen) {
if (!isEnabled()) {
return;
}
onClick();
if (mOnClickListener != null
&& mOnClickListener.onPreferenceClick(this)) {
return;
}
PreferenceManager preferenceManager = getPreferenceManager();
if (preferenceManager != null) {
PreferenceManager.OnPreferenceTreeClickListener listener = preferenceManager
.getOnPreferenceTreeClickListener();
if (preferenceScreen != null && listener != null
&& listener.onPreferenceTreeClick(preferenceScreen, this)) {
return;
}
}
if (mIntent != null) {
Context context = getContext();
context.startActivity(mIntent);
}
}
protected boolean persistBoolean(boolean value) {
if (shouldPersist()) {
if (value == getPersistedBoolean(!value)) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putBoolean(mKey, value);
tryCommit(editor);
return true;
}
return false;
}
protected boolean persistFloat(float value) {
if (shouldPersist()) {
if (value == getPersistedFloat(Float.NaN)) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putFloat(mKey, value);
tryCommit(editor);
return true;
}
return false;
}
protected boolean persistInt(int value) {
if (shouldPersist()) {
if (value == getPersistedInt(~value)) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putInt(mKey, value);
tryCommit(editor);
return true;
}
return false;
}
protected boolean persistLong(long value) {
if (shouldPersist()) {
if (value == getPersistedLong(~value)) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putLong(mKey, value);
tryCommit(editor);
return true;
}
return false;
}
protected boolean persistString(String value) {
if (shouldPersist()) {
// Shouldn't store null
if (value == getPersistedString(null)) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putString(mKey, value);
tryCommit(editor);
return true;
}
return false;
}
protected boolean persistStringSet(Set<String> values) {
if (shouldPersist()) {
if (values.equals(getPersistedStringSet(null))) {
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putStringSet(mKey, values);
tryCommit(editor);
return true;
}
return false;
}
private void registerDependency() {
if (TextUtils.isEmpty(mDependencyKey)) {
return;
}
Preference preference = findPreferenceInHierarchy(mDependencyKey);
if (preference != null) {
preference.registerDependent(this);
} else {
throw new IllegalStateException("Dependency \"" + mDependencyKey
+ "\" not found for preference \"" + mKey + "\" (title: \""
+ mTitle + "\"");
}
}
private void registerDependent(Preference dependent) {
if (mDependents == null) {
mDependents = new ArrayList<Preference>();
}
mDependents.add(dependent);
dependent.onDependencyChanged(this, shouldDisableDependents());
}
void requireKey() {
if (mKey == null) {
throw new IllegalStateException(
"Preference does not have a key assigned.");
}
mRequiresKey = true;
}
public void restoreHierarchyState(Bundle container) {
dispatchRestoreInstanceState(container);
}
public void saveHierarchyState(Bundle container) {
dispatchSaveInstanceState(container);
}
public void setDefaultValue(Object defaultValue) {
mDefaultValue = defaultValue;
}
public void setDependency(String dependencyKey) {
unregisterDependency();
mDependencyKey = dependencyKey;
registerDependency();
}
public void setEnabled(boolean enabled) {
if (mEnabled != enabled) {
mEnabled = enabled;
notifyDependencyChange(shouldDisableDependents());
notifyChanged();
}
}
private void setEnabledStateOnViews(View v, boolean enabled) {
v.setEnabled(enabled);
if (v instanceof ViewGroup) {
final ViewGroup vg = (ViewGroup) v;
for (int i = vg.getChildCount() - 1; i >= 0; i--) {
setEnabledStateOnViews(vg.getChildAt(i), enabled);
}
}
}
public void setFragment(String fragment) {
mFragment = fragment;
}
public void setIcon(Drawable icon) {
if (icon == null && mIcon != null || icon != null && mIcon != icon) {
mIcon = icon;
notifyChanged();
}
}
public void setIcon(int iconResId) {
mIconResId = iconResId;
setIcon(mContext.getResources().getDrawable(iconResId));
}
public void setIntent(Intent intent) {
mIntent = intent;
}
public void setKey(String key) {
mKey = key;
if (mRequiresKey && !hasKey()) {
requireKey();
}
}
public void setLayoutResource(int layoutResId) {
if (layoutResId != mLayoutResId) {
// Layout changed
mHasSpecifiedLayout = true;
}
mLayoutResId = layoutResId;
}
final void setOnPreferenceChangeInternalListener(
OnPreferenceChangeInternalListener listener) {
mListener = listener;
}
public void setOnPreferenceChangeListener(
OnPreferenceChangeListener onPreferenceChangeListener) {
mOnChangeListener = onPreferenceChangeListener;
}
public void setOnPreferenceClickListener(
OnPreferenceClickListener onPreferenceClickListener) {
mOnClickListener = onPreferenceClickListener;
}
public void setOrder(int order) {
if (order != mOrder) {
mOrder = order;
// Reorder the list
notifyHierarchyChanged();
}
}
public void setPersistent(boolean persistent) {
mPersistent = persistent;
}
public void setSelectable(boolean selectable) {
if (mSelectable != selectable) {
mSelectable = selectable;
notifyChanged();
}
}
public void setShouldDisableView(boolean shouldDisableView) {
mShouldDisableView = shouldDisableView;
notifyChanged();
}
public void setSummary(CharSequence summary) {
if (summary == null && mSummary != null || summary != null
&& !summary.equals(mSummary)) {
mSummary = summary;
notifyChanged();
}
}
public void setSummary(int summaryResId) {
setSummary(mContext.getString(summaryResId));
}
public void setTitle(CharSequence title) {
if (title == null && mTitle != null || title != null
&& !title.equals(mTitle)) {
mTitleRes = 0;
mTitle = title;
notifyChanged();
}
}
public void setTitle(int titleResId) {
setTitle(mContext.getString(titleResId));
mTitleRes = titleResId;
}
public void setWidgetLayoutResource(int widgetLayoutResId) {
if (widgetLayoutResId != mWidgetLayoutResId) {
mHasSpecifiedLayout = true;
}
mWidgetLayoutResId = widgetLayoutResId;
}
public boolean shouldCommit() {
if (mPreferenceManager == null) {
return false;
}
return mPreferenceManager.shouldCommit();
}
public boolean shouldDisableDependents() {
return !isEnabled();
}
protected boolean shouldPersist() {
return mPreferenceManager != null && isPersistent() && hasKey();
}
@Override
public String toString() {
return getFilterableStringBuilder().toString();
}
private void tryCommit(SharedPreferences.Editor editor) {
if (mPreferenceManager.shouldCommit()) {
try {
editor.apply();
} catch (AbstractMethodError unused) {
editor.commit();
}
}
}
private void unregisterDependency() {
if (mDependencyKey != null) {
final Preference oldDependency = findPreferenceInHierarchy(mDependencyKey);
if (oldDependency != null) {
oldDependency.unregisterDependent(this);
}
}
}
private void unregisterDependent(Preference dependent) {
if (mDependents != null) {
mDependents.remove(dependent);
}
}
} | [
"[email protected]"
] | |
84f8e350ba668de3a46cf5c1f0c72354538b7092 | dbb33553fcdc92e6cf66c0cc98fea249194be46e | /hkia/src/main/java/com/sails/service/Version.java | bedbc60177a1250f357fe1eb2508f2b4d943b6b8 | [] | no_license | willy830704/NCKU_Hospital_APP | 3ecfdaba95e6c58c982b3ac6448ee7259859375f | 04d52fd621905d8c41214b02f39be4c6551692dc | refs/heads/master | 2021-01-17T08:40:13.863003 | 2016-09-30T09:06:33 | 2016-09-30T09:06:33 | 64,288,243 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.sails.service;
/**
* Created by autospot on 14/3/21.
*/
public final class Version {
public static final boolean DEBUG = false;
public static final String SAILS_TOKEN = "3c1d084e86b5442592c945989968a033";
public static final String BUILDING_ID = "528fea2cb4eb33531e000001";
// public static final String BUILDING_ID = "5327b9bad52602262000019a";
}
| [
"[email protected]"
] | |
5a48b8e3268a8bd5cee6aabe2754bc70126592eb | f6f10e657bc3ab325b9d74761739c73149c2688d | /exchange-wrapper/src/main/java/com/mali/exchanger/communication/impl/okex/utils/OkexErrorCodeMsgs.java | fdaf6dd80a223fbb293c878931a2c15b95e962e4 | [] | no_license | robertolima-dev/AI-Financial-Market | fb58f6454d04cd9a184368d77a412018943a39f7 | 1cdec7e4eb0b894df9d8e618d51049c3d4f32096 | refs/heads/master | 2021-10-21T21:48:01.197845 | 2019-03-06T18:48:08 | 2019-03-06T18:48:08 | 174,201,579 | 1 | 5 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | package com.mali.exchanger.communication.impl.okex.utils;
import org.springframework.stereotype.Service;
@Service
public class OkexErrorCodeMsgs {
public String getCorrectMessage(Long errorCode){
if (errorCode == 1002) return "The transaction amount exceed the balance";
if (errorCode == 1003) return "The transaction amount is less than the minimum requirement";
return "";
}
}
| [
"[email protected]"
] | |
8331466d3896ec4ec3adc269b7c77c57ac88bddf | a7365d54c1129db05f09979a1fdfd8b5d3ebb716 | /src/practice/DecisionMaking/PerimeterOfRectangle.java | 077134930d89fda39231208d82e45e53a190ae4f | [] | no_license | Richa789/JavaConcepts | 55b0be30b219128ce8e78152d4103cd7b23ef413 | c64de6cf52a75464e2704f37907dfd2291eac1cf | refs/heads/master | 2022-12-20T17:10:09.813065 | 2020-10-04T15:32:39 | 2020-10-04T15:32:39 | 301,163,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package practice.DecisionMaking;
public class PerimeterOfRectangle {
public static void main(String[] args) {
int value = perimeter(12, 14);
System.out.println("The perimeter of rectangle is " + value);
}
public static int perimeter(int length, int height) {
return 2*(length + height);
}
}
| [
"[email protected]"
] | |
5ba7215b52ef42e4e821907dde52dd177c4c88cf | 60fe9caa0b627813d4bdf3f7e627f0402b788077 | /app/src/main/java/com/chocozhao/chocobilibili/mvp/ui/adapter/ArticleAdapter.java | 114d49425aab86cfe1fc598b8db08699deeab56f | [
"Apache-2.0"
] | permissive | chocozhao/chocobilibili | 15f160202389844c7519f5d5742c4a85e1b0e1e2 | 768be8116d3ff0b60a03b55507b140af24f04cec | refs/heads/master | 2020-08-16T03:59:45.448817 | 2020-04-13T06:10:09 | 2020-04-13T06:10:09 | 215,451,805 | 3 | 0 | Apache-2.0 | 2020-02-25T09:59:11 | 2019-10-16T03:48:53 | Java | UTF-8 | Java | false | false | 1,269 | java | package com.chocozhao.chocobilibili.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chocozhao.chocobilibili.R;
import com.chocozhao.chocobilibili.mvp.model.entity.GetArticleData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* ClaseName:ArticleAdapter
* Description:
* Author:chocozhao
* QQ: 1027313530
* Createtime:2019/12/17 15:50
* Modified By:
* Fixtime:2019/12/17 15:50
* FixDescription:
**/
public class ArticleAdapter extends BaseQuickAdapter<GetArticleData.DatasBean, BaseViewHolder> {
/**
* 构造方法,此示例中,在实例化Adapter时就传入了一个List。
* 如果后期设置数据,不需要传入初始List,直接调用 super(layoutResId); 即可
*/
public ArticleAdapter(@Nullable List<GetArticleData.DatasBean> data) {
super(R.layout.article_list, data);
}
/**
* 在此方法中设置item数据
*/
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, GetArticleData.@Nullable DatasBean datasBean) {
baseViewHolder.setText(R.id.article_tv, datasBean.getTitle());
}
} | [
"[email protected]"
] | |
7a57bd7eb246fe82bd3e4a3cb76f0b525a7d398b | 0341d57c29bb4bf64bbb258cce506e6ba5ef2e62 | /src/main/java/org/kitteh/irc/client/library/feature/twitch/messagetag/MsgParamSubPlanName.java | f6f053b239f175af9acef5fe1225319571f33afa | [
"MIT",
"Apache-2.0"
] | permissive | boostchicken/KittehIRCClientLib | 4715620d0149151db8069b5b0ef0c9c9c943bce0 | f5ad7cad286991798824cbee386d54f53e39d810 | refs/heads/master | 2020-06-16T16:48:01.820354 | 2019-07-08T23:45:20 | 2019-07-08T23:45:20 | 195,640,167 | 0 | 0 | NOASSERTION | 2019-07-07T10:53:10 | 2019-07-07T10:53:10 | null | UTF-8 | Java | false | false | 2,058 | java | /*
* * Copyright (C) 2013-2019 Matt Baxter https://kitteh.org
*
* 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 org.kitteh.irc.client.library.feature.twitch.messagetag;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.kitteh.irc.client.library.Client;
import org.kitteh.irc.client.library.feature.MessageTagManager;
import org.kitteh.irc.client.library.util.TriFunction;
/**
* Message tag for subscription plan name.
*/
public class MsgParamSubPlanName extends MessageTagManager.DefaultMessageTag {
/**
* Name of this message tag.
*/
public static final String NAME = "msg-param-sub-plan-name";
/**
* Function to create this message tag.
*/
@SuppressWarnings("ConstantConditions")
public static final TriFunction<Client, String, String, MsgParamSubPlanName> FUNCTION = (client, name, value) -> new MsgParamSubPlanName(name, value);
private MsgParamSubPlanName(@NonNull String name, @NonNull String value) {
super(name, value);
}
}
| [
"[email protected]"
] | |
84fc01498e2f235ae72e1ccdc7535863a9ac198d | a63a260c20b77bfa2c02ed637bce085ac3438b0f | /casclient1/src/test/java/com/cas/casclient1/Casclient1ApplicationTests.java | b33e3f8c100fd24cc7b325afae111b97dc83b9e5 | [] | no_license | EamonYin/CasDemo | dace8ecb0a8b204ba6a59fd956d7928fbb43df04 | cb45b848f15ec8b3596669370b324eddb662279e | refs/heads/master | 2022-04-07T23:09:37.346325 | 2019-12-18T02:56:23 | 2019-12-18T02:56:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package com.cas.casclient1;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Casclient1ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
09e7b0199a51c7a83df8fa7ddbc7d7945c6a346a | 90bd3a3683eec8954569f44759e6c2b44868d307 | /uebung5/src/main/java/ch/hsr/skapferer/parprog/uebung5/aufgabe2/WebDownload.java | f07bc17b6996281c2fb9ccac5cf88ed9e98c365c | [] | no_license | stefan-ka/HSR-ParProg | ca75243da8b4d857238b30d9005cde2bfa5f5c8c | af82a4e53c357a09d9aebc331b81567e33876c31 | refs/heads/master | 2021-01-10T18:49:36.369223 | 2015-05-27T12:37:31 | 2015-05-27T12:37:31 | 30,962,966 | 0 | 0 | null | 2015-05-20T12:03:17 | 2015-02-18T11:30:09 | Java | UTF-8 | Java | false | false | 541 | java | package ch.hsr.skapferer.parprog.uebung5.aufgabe2;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
public class WebDownload {
public String downloadUrl(String link) throws IOException {
URL url = new URL(link);
StringBuffer stringBuffer = new StringBuffer();
try (Reader reader = new InputStreamReader(url.openStream())) {
int i;
while ((i = reader.read()) >= 0) {
stringBuffer.append((char) i);
}
}
return stringBuffer.toString();
}
}
| [
"[email protected]"
] | |
b4c33daa263259cfca08998bfcb6fbd451bab5dc | 537aa828c3896b3fd7c33c17055e6ea1bc691a86 | /src/main/java/com/maersk/knapsack/config/SwaggerConfig.java | 6f9886595010590f4f2484702c79b5b1d517a899 | [] | no_license | Raman281990/KnapsackOptimizer | 0bcdd5ddbb9c627f62b30a682b14e695ea70141e | 98be3690785cbeb6bfe151bc41e46a519aa3c87a | refs/heads/master | 2020-04-23T12:22:00.164737 | 2019-02-17T21:59:13 | 2019-02-17T21:59:13 | 171,165,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package com.maersk.knapsack.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.base.Predicates;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
/** SwaggerConfig configuration class for setting up swagger.
*
* Swagger provides the documentation details for the Rest API's
*
* @author Ramandeep kaur
*
*/
@Configuration
public class SwaggerConfig {
@Bean public Docket api() { return new
Docket(DocumentationType.SWAGGER_2).select()
.apis(Predicates.not(RequestHandlerSelectors.basePackage(
"org.springframework.boot")))
.paths(Predicates.not(PathSelectors.regex("/error"))).build(); }
}
| [
"[email protected]"
] | |
d04692f938da4326648f63c9f0bb765f6239121e | 70dfc9457af7c5c8f660c705ae57576c0f5cc878 | /RPGToms/src/ReferInformation.java | c550f45170aa64cb3a03758fc177d839ebd2c7fa | [] | no_license | ThomBarrett/DavidLessonRepositorie | 5e2fe377c9393f099758fb4e37a63a24f6cfc654 | 4109c51c5a301f92568718331b40ca85ee84a7e6 | refs/heads/master | 2021-01-01T18:00:49.541552 | 2017-07-26T22:31:12 | 2017-10-09T18:51:31 | 98,225,802 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 330 | java |
public class ReferInformation {
private final String[] months = {
"January","February","March",
"April","May","June",
"July","August","September",
"October","November","December"};
public String[] getMonthsArray(){
return months;
}
public String getMonth(int input){
return months[input-1].toString();
}
}
| [
"[email protected]"
] | |
1282c3fba7281d89a97d2ffc9b284fd0f1bd99d5 | 2e48c0382c30cc8fbf9b122f6936a33162b95a79 | /app/src/main/java/com/example/ofir/testfunctionality2/Tabs/ViewPagerAdapter.java | 84378d3431cde6deb7feb6501541d70319654007 | [] | no_license | Styxer/BoPo | e0c6343870ddc8f9d40da115ac48b6f30853d73a | 0f4738bc7e680062834c363382e94963822abaa2 | refs/heads/master | 2020-12-24T21:01:43.013492 | 2016-11-10T10:27:31 | 2016-11-10T10:27:31 | 56,344,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package com.example.ofir.testfunctionality2.Tabs;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.ArrayList;
/**
* Created by Ofir on 04/06/2016.
*/
public class ViewPagerAdapter extends FragmentPagerAdapter {
ArrayList<Fragment> fragments = new ArrayList<>();
ArrayList<String> tabTitles = new ArrayList<>();
public void addFragments(Fragment fragments,String titles){
this.fragments.add(fragments);
this.tabTitles.add(titles);
}
public ViewPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return fragments.size();
}
@Override
public CharSequence getPageTitle(int position) {
return tabTitles.get(position);
}
}
| [
"[email protected]"
] | |
0564a77b4e65919095afc9ad38c23e53c54ccc70 | bbb0343e3c86437b371cb8dd2e3fa1b0b3151741 | /javaee/tzstruts2/src/com/newstart/action/iter/LogInterceptor.java | b1cc32a5f99fcebf3c87eaf909d764ef23425dea | [] | no_license | zhou-j/helloworld | 1c1b5cf12cef14bf25636eeaa3c283d1e74f68f3 | 29485679382f098187dfab169ebc5f5850d7e056 | refs/heads/master | 2021-06-07T00:33:35.425776 | 2016-09-20T10:34:50 | 2016-09-20T10:34:50 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,295 | java | package com.newstart.action.iter;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
/**
* 创建一个拦截器的步骤:
* 1:定义一个LoginInterceptor 继承AbstractInterceptor
* 2:在struts-login.xml中配置和注册我们的拦截器
* 3:引用拦截器
* 注意点:自定义的拦截器一定要在后面加上默认的拦截器栈,我们需要struts2提供的一系列拦截器,他们会帮我们处理:文件上传,参数注入,国际化,下载等等!
* 类名: LogInterceptor
* 描述: 登录拦截,继承AbstractInterceptor:拦截所有的进入action方法之前的一个拦截器
* 创建人: zhoujuan
* 时间: 2016年4月10日 下午11:17:23
* @version: V1.0
*/
public class LogInterceptor extends AbstractInterceptor{
/**
* @fieldName: serialVersionUID
* @fieldType: long
* @Description: TODO
*/
private static final long serialVersionUID = 1L;
@Override
public String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
System.out.println("日志拦截器进来了吗?");
return invocation.invoke();//如果执行成功,就可以放行,去执行我们对应的Action或许操作。(进入Action方法)
}
}
| [
"[email protected]"
] | |
c128284b0b28c828a77c3898bc0ac7e6ec98d988 | b11248eb8d38355e10861c6c19750c55b4530e38 | /src/main/java/hu/akarnokd/rxjava2/functions/PlainFunction4.java | beb60d6a96f1f08b67ad651f4c551ba642ed6b95 | [
"Apache-2.0"
] | permissive | tomdotbradshaw/RxJava2Extensions | 2d50d14aff39a1ddb4fe6a32352aebecc4e8d68d | 254fead58021bb8304aa1c343cc776e7b5a3168d | refs/heads/master | 2020-04-06T16:48:30.122024 | 2018-11-15T03:29:15 | 2018-11-15T03:30:42 | 157,635,134 | 0 | 0 | Apache-2.0 | 2018-11-15T01:36:50 | 2018-11-15T01:36:50 | null | UTF-8 | Java | false | false | 1,143 | java | /*
* Copyright 2016-2018 David Karnok
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package hu.akarnokd.rxjava2.functions;
import io.reactivex.functions.*;
/**
* A {@link Function4} with suppressed exception on its
* {@link #apply(Object, Object, Object, Object)} method.
*
* @param <T1> the first argument type
* @param <T2> the second argument type
* @param <T3> the third argument type
* @param <T4> the fourth argument type
* @param <R> the output value type
*/
public interface PlainFunction4<T1, T2, T3, T4, R>
extends Function4<T1, T2, T3, T4, R> {
@Override
R apply(T1 t1, T2 t2, T3 t3, T4 t4);
}
| [
"[email protected]"
] | |
3a598188285e14160c119b75d9a76eb85d751034 | 64b2b5554def20010afc748b6d50ab5c33fde8fa | /app/src/main/java/com/vose/activity/SingupLoginActivity.java | 1e3e77dbe4f37a5846fc03b38dc82d6ee75e1d38 | [] | no_license | JimmyHou/vose_android | bc496867d42cb598598e06f143b412bdf37234f1 | d82d40ebf42852ea008c4a5bd1c21edef3fde4b7 | refs/heads/master | 2016-09-03T06:46:23.175164 | 2015-08-18T05:14:15 | 2015-08-18T05:14:15 | 40,951,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,113 | java | package com.vose.activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.voice.app.R;
import com.vose.AsyncTask.GetAllCompaniesTask;
import com.vose.AsyncTask.GetIndustriesTask;
import com.vose.fragment.launch.LoginFragment;
import com.vose.fragment.launch.SignupFragment;
import com.vose.fragment.launch.WelcomeFragment;
import com.vose.util.Constants;
import com.vose.util.SharedPreferencesManager;
import com.vose.util.Utility;
import java.util.ArrayList;
import java.util.List;
/**
* Created by jimmyhou on 1/3/15.
*/
public class SingupLoginActivity extends FragmentActivity {
PageAdapter pageAdapter;
@Override
protected void onCreate(final Bundle savedInstanceState){
getActionBar().setDisplayHomeAsUpEnabled(false);
super.onCreate(savedInstanceState);
loadCompanyAndIndustryData();
launchFragment();
}
private void launchFragment(){
if(!SharedPreferencesManager.getInstance(this).putBoolean(Constants.HAS_LOGGED_IN)) {
setContentView(R.layout.welcome_fragment_pager);
List<Fragment> fragments = new ArrayList<Fragment>();
fragments.add(WelcomeFragment.newInstance());
fragments.add(SignupFragment.newInstance());
pageAdapter = new PageAdapter(getSupportFragmentManager(), fragments);
ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
pager.setAdapter(pageAdapter);
}
else {
LoginFragment loginFragment = LoginFragment.newInstance();
pushFragment(loginFragment, LoginFragment.FRAGMENT_TAG);
}
}
//restart is being called after the new activity is started
@Override
protected void onRestart(){
super.onRestart();
Utility.resetParameters();
}
@Override
public void onBackPressed()
{
return;
}
@Override
public void onDestroy(){
super.onDestroy();
}
public void pushFragment(Fragment fragment, String fragmentTag){
//since it's called at acitivty, can't just call fm.popBackStack();
//setContentView(R.layout.fragment_onboarding);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
transaction.replace(android.R.id.content, fragment, fragmentTag).addToBackStack(fragmentTag);
transaction.commit();
}
private void loadCompanyAndIndustryData(){
new GetAllCompaniesTask(this).execute();
new GetIndustriesTask(this).execute("");
}
public void hideKeyboard(EditText editText){
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
public void popCurrentFragment(){
//hide any keyboard
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
if(getCurrentFocus()!=null) {
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
FragmentManager fm = getSupportFragmentManager();
fm.popBackStack();
}
class PageAdapter extends FragmentPagerAdapter {
private List<Fragment> fragments;
public PageAdapter(FragmentManager fm, List<Fragment> fragments) {
super(fm);
this.fragments = fragments;
}
@Override
public Fragment getItem(int position) {
return this.fragments.get(position);
}
@Override
public int getCount() {
return this.fragments.size();
}
}
}
| [
"[email protected]"
] | |
43b98b0c9c622196b2cd1dd8768e3e411b2aafd8 | 7788464074367b6f2cf70da3f1d6b41e53e7523d | /Delivery Service, JAVA project/src/execution/ParcelTableStuff.java | 8886d240b1afd8a59ac4825cb3f0a4d57be24ca1 | [] | no_license | xpetrov/FIIT | 748b34700b2c8bf643090cf64abc0eb2f7d972ce | b953ce1d59818d084c8c1a5f353da558dd8cb224 | refs/heads/master | 2021-04-03T07:04:31.506322 | 2018-04-17T17:15:38 | 2018-04-17T17:15:38 | 124,876,342 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,191 | java | package execution;
//import com.sun.xml.internal.ws.api.ha.StickyFeature;
/**
* Created by IVAN-PC on 01.05.2017.
*/
public class ParcelTableStuff {
int trackingNumber;
String typeOfParcel;
String typeOfDelivery;
String dpt, dst;
String statusOfParcel;
int weight;
double price;
public ParcelTableStuff(int trackingNumber, String typeOfParcel, String typeOfDelivery, String dpt, String dst, String statusOfParcel, int weight, double price) {
this.trackingNumber = trackingNumber;
this.typeOfParcel = typeOfParcel;
this.typeOfDelivery = typeOfDelivery;
this.dpt = dpt;
this.dst = dst;
this.statusOfParcel = statusOfParcel;
this.weight = weight;
this.price = price;
}
public int getTrackingNumber() {return trackingNumber;}
public String getTypeOfParcel() {return typeOfParcel;}
public String getTypeOfDelivery() {return typeOfDelivery;}
public String getDpt() {return dpt;}
public String getDst() {return dst;}
public String getStatusOfParcel() {return statusOfParcel;}
public int getWeight() {return weight;}
public double getPrice() {return price;}
}
| [
"[email protected]"
] | |
dab8fdd5f53e95f6f02ea107786fba55682f4b5f | f1445810e471a85b2a400aee1fcde81a4001fd99 | /src/controller/AddItemServlet.java | 521896c51f7a850c0df170f231db545a97aa3072 | [] | no_license | Abutalibhasan/WebShoppingList | a4bf0e84605d330e6c6da1f809b8357ec1f106f9 | 42241044f2308c0ffe6cfe1677b51e63c9a95732 | refs/heads/main | 2023-03-14T06:45:55.587021 | 2021-03-03T06:28:34 | 2021-03-03T06:28:34 | 344,025,504 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | package controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.ListItem;
/**
* Servlet implementation class AddItemServlet
*/
@WebServlet("/addItemServlet")
public class AddItemServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AddItemServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String store = request.getParameter("store");
String item = request.getParameter("item");
ListItem li = new ListItem(store, item);
ListItemHelper dao = new ListItemHelper();
dao.insertItem(li);
getServletContext().getRequestDispatcher("/index.html").forward(request, response);
}
}
| [
"[email protected]"
] | |
13bdd668ecf68fd39a5b542ae2b9c1b646155f9f | bf4122f5ae3a9f9b9c2cc94ef87cdb9dcadc9dc9 | /Transfer/My Study/forestrymanagementsystemjpahiber/src/main/java/com/tyss/forestrymanagementsystemjpahiber/dao/ContractDaoImpl.java | fe3ad177138ce0a75620a4f81fcaef442a78a761 | [] | no_license | haren7474/TY_ELF_JFS_HarendraKumar | 7ef8b9a0bb6d6bdddb94b88ab2db4e0aef0fbc1d | f99ef30b40d0877167c8159e8b7f322af7cc87b9 | refs/heads/master | 2023-01-11T01:01:10.458037 | 2020-01-23T18:20:20 | 2020-01-23T18:20:20 | 225,845,989 | 0 | 0 | null | 2023-01-07T22:01:21 | 2019-12-04T11:00:37 | HTML | UTF-8 | Java | false | false | 4,192 | java | package com.tyss.forestrymanagementsystemjpahiber.dao;
import java.sql.Connection;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;
import com.tyss.forestrymanagementsystemjpahiber.controller.DBConnection;
import com.tyss.forestrymanagementsystemjpahiber.dto.BillingBean;
import com.tyss.forestrymanagementsystemjpahiber.dto.ContractBean;
import com.tyss.forestrymanagementsystemjpahiber.dto.ProductBean;
import com.tyss.forestrymanagementsystemjpahiber.factory.ForestryManagementSystemFactory;
import com.tyss.forestrymanagementsystemjpahiber.services.ProductServices;
public class ContractDaoImpl implements ContractDao {
private List<ContractBean> contractList = null;
static Connection connection = DBConnection.getConnection();
ContractBean contract = null;
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("TestPersistence");
static ProductServices productServices = ForestryManagementSystemFactory.instanceOfProductServies();
@Override
public boolean deleteContract(int contractId) {
EntityManager entityManager = entityManagerFactory.createEntityManager();
EntityTransaction transaction = entityManager.getTransaction();
boolean isDeleted = false;
try {
transaction.begin();
contract = entityManager.find(ContractBean.class, contractId);
if (contract != null) {
entityManager.remove(contract);
transaction.commit();
isDeleted = true;
}
} catch (Exception e) {
e.printStackTrace();
transaction.rollback();
}
entityManager.close();
return isDeleted;
}
@Override
public boolean addContract(ContractBean contract) {
EntityManager entityManager = entityManagerFactory.createEntityManager();
EntityTransaction transaction = entityManager.getTransaction();
// TO update stock quantity i.e. ExistingStockQuantity - contractQuantity
int contractProductQuantity = contract.getQuantity();
int productId = contract.getProductBean().getProductId();
ProductBean product = productServices.searchProduct(productId);
int stockUpdatedQuantity = product.getProductQuantity() - contractProductQuantity;
boolean isAdded = false;
try {
transaction.begin();
entityManager.persist(contract);
productServices.updateQuantity(productId, stockUpdatedQuantity);
transaction.commit();
isAdded = true;
} catch (Exception e) {
e.printStackTrace();
transaction.rollback();
}
entityManager.close();
return isAdded;
}
@Override
public List<ContractBean> getAllContract() {
EntityManager entityManager = entityManagerFactory.createEntityManager();
String jpql = " from ContractBean";
Query query = entityManager.createQuery(jpql);
contractList = query.getResultList();
entityManager.close();
return contractList;
}
@Override
public boolean modifyContract(int contractId, int contractNewQuantity) {
EntityManager entityManager = entityManagerFactory.createEntityManager();
EntityTransaction transaction = entityManager.getTransaction();
boolean isModified = false;
try {
transaction.begin();
contract = entityManager.find(ContractBean.class, contractId);
if (contract != null) {
// TO update stock quantity i.e. ExistingStockQuantity - (contractNewQuantity - contractExistingQuantity)
int productId = contract.getProductBean().getProductId();
ProductBean product = productServices.searchProduct(productId);
int stockUpdatedQuantity = product.getProductQuantity() - (contractNewQuantity - contract.getQuantity());
productServices.updateQuantity(productId, stockUpdatedQuantity);
contract.setQuantity(contractNewQuantity);
transaction.commit();
isModified = true;
}
} catch (Exception e) {
e.printStackTrace();
transaction.rollback();
}
entityManager.close();
return isModified;
}
@Override
public ContractBean getContractById(int contractId) {
EntityManager entityManager = entityManagerFactory.createEntityManager();
contract = entityManager.find(ContractBean.class, contractId);
return contract;
}
}
| [
"[email protected]"
] | |
2f84d7f1e8bbef9407d909ddfc87e42d7b092282 | 28ddcd238fbff69923856c9911120dcd8b1df1bd | /src/main/java/org/example/app/exceptions/BookShelfDownloadFileException.java | a288c78ceefb589f87f9b18e3f681671328d5d3d | [] | no_license | chegodaevk/second_homework | b0d5394182566b8945acec27a00beb7ede786839 | 9b75928d073da5d7651a4245fd7f7a7e7ce4e1f6 | refs/heads/master | 2023-08-06T02:37:12.693352 | 2021-09-17T16:52:28 | 2021-09-17T16:52:28 | 400,627,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package org.example.app.exceptions;
public class BookShelfDownloadFileException extends Exception {
public final String message;
public BookShelfDownloadFileException(String message) {
this.message = message;
}
@Override
public String getMessage() {
return message;
}
}
| [
"[email protected]"
] | |
4a24b0c4a10f58df309a69798cc8a7297c231aa6 | c39fcc45a95d5f8e4f421b5cd6180c0fa1dd294b | /build/generated/source/buildConfig/test/debug/me/ppxpp/wp/test/BuildConfig.java | 128684c8aee6693e379d384e0c7aebb34c46b9c6 | [
"Apache-2.0"
] | permissive | ppxpp/wp | f0589432511894d0c49ac92d76bbdb15206d37cd | 6c2bf08a3bcc73b278a5183a0c4708245b55fd4b | refs/heads/master | 2021-01-23T07:29:50.123447 | 2014-10-06T02:13:26 | 2014-10-06T02:13:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package me.ppxpp.wp.test;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String PACKAGE_NAME = "me.ppxpp.wp.test";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = -1;
public static final String VERSION_NAME = "";
}
| [
"[email protected]"
] | |
4ec6a711bb84af5eca894b12153ca01c1c475ac5 | 8da6826d847043241c359ae074083164f0e41df4 | /src/main/java/by/htp/drozdovskaya/library/data/factorymethod/AbstractFactoryCreator.java | ddb174aa771c253a1968954ea851f96cab6e229a | [] | no_license | vicadrozdovskaya/LibraryFinalTask | 979bdd4485dd69e06d6e1d70b2ad748e805edd2d | a72077c27abc791581f3b58eb6900f7552c55864 | refs/heads/master | 2020-03-24T18:16:24.771417 | 2018-08-07T11:02:51 | 2018-08-07T11:02:51 | 142,887,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package by.htp.drozdovskaya.library.data.factorymethod;
import by.htp.drozdovskaya.library.data.factory.AbstractFactory;
public abstract class AbstractFactoryCreator {
public abstract AbstractFactory factoryMethod();
}
| [
"[email protected]"
] | |
c4b19c47d437ea0f7a6a682e76819f7acf9bb58b | a2aa1cbfe12e9c2d3d121a5af50807d8fd697302 | /Loliapp/app/src/main/java/com/example/usuario/loliapp/MainActivity2Activity.java | 11f4075365953c84349c6f36b0285a8eb2da5005 | [] | no_license | Ebanibaldo/Formulario_MD | 43bf510ed4d6503d1bd0ae9086d39f93efedb1aa | 1bee39fe0bda288162bcbff389d195d0e5490166 | refs/heads/master | 2020-05-20T06:57:06.617153 | 2015-06-24T21:12:27 | 2015-06-24T21:12:27 | 38,010,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package com.example.usuario.loliapp;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity2Activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_activity2);
Bundle parametros= getIntent().getExtras();
String valor=parametros.getString("s");
TextView tv_contenido = (TextView) findViewById(R.id.textView);
tv_contenido.setText(valor);
}
@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_main_activity2, 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);
}
}
| [
"[email protected]"
] | |
55fe81214dae89ac6fab916175c793f2e313e1e9 | 7052673efec94966ed29adb8ded5717a4c0fdc23 | /common/src/main/java/ateam/tickettoride/common/responses/EmptyResponse.java | 5e7c7516000de94991bb22b0b9e1d5bdaa2657de | [] | no_license | ethanp55/Ticket-to-Ride-Android-App | 5c0f3b935a4db7c83c2e1e754e323b42b442584b | acc55f9bbe789d7fa752a03030ec2a3d1ab0752e | refs/heads/master | 2021-05-25T21:07:08.168943 | 2020-04-07T22:21:22 | 2020-04-07T22:21:22 | 253,919,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 94 | java | package ateam.tickettoride.common.responses;
public class EmptyResponse extends Response {
}
| [
"[email protected]"
] | |
ea22bf1cb9b9bd9e0c9a46731902032f15b31342 | 3a59bd4f3c7841a60444bb5af6c859dd2fe7b355 | /sources/kotlin/Suppress.java | a6a028bfdf7a81ea7d8a2677b533062ab350784f | [] | no_license | sengeiou/KnowAndGo-android-thunkable | 65ac6882af9b52aac4f5a4999e095eaae4da3c7f | 39e809d0bbbe9a743253bed99b8209679ad449c9 | refs/heads/master | 2023-01-01T02:20:01.680570 | 2020-10-22T04:35:27 | 2020-10-22T04:35:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | package kotlin;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import kotlin.annotation.AnnotationRetention;
import kotlin.annotation.AnnotationTarget;
import kotlin.annotation.Retention;
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.ANNOTATION_TYPE})
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.EXPRESSION, AnnotationTarget.FILE, AnnotationTarget.TYPEALIAS})
@Metadata(mo39784bv = {1, 0, 3}, mo39785d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0000\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0014\u0012\u0012\u0010\u0002\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00040\u0003\"\u00020\u0004R\u0017\u0010\u0002\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00040\u0003¢\u0006\u0006\u001a\u0004\b\u0002\u0010\u0005¨\u0006\u0006"}, mo39786d2 = {"Lkotlin/Suppress;", "", "names", "", "", "()[Ljava/lang/String;", "kotlin-stdlib"}, mo39787k = 1, mo39788mv = {1, 1, 15})
@Retention(AnnotationRetention.SOURCE)
@java.lang.annotation.Retention(RetentionPolicy.SOURCE)
/* compiled from: Annotations.kt */
public @interface Suppress {
String[] names();
}
| [
"[email protected]"
] | |
ab32fdd90daaab47defa5a96c31faa6d01c356ff | 7dc7fab98d6ffa8eb32e5fefbedea6729167c50a | /lo-mejor-de-oaxaca/lomejordeoax-module-webservice/src/test/java/com/lomejordeoax/test/QueryInvoiceTest.java | 604554e8c62a60e8d693d78450feb5d5324c349c | [] | no_license | JovaniKastronovo/LMOAX | 16b652092b76938ac577aebee034fb0095763fd4 | 48bfa27229eda5de2490a144a2e32380651a1e10 | refs/heads/master | 2020-03-29T04:23:00.096816 | 2016-07-16T00:31:16 | 2016-07-16T00:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,167 | java | package com.lomejordeoax.test;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.lomejordeoax.model.product.Invoice;
import org.lomejordeoax.model.sales.enums.InvoiceStatus;
import org.lomejordeoax.utilities.exceptions.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.lomejordeoax.service.InvoiceService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:spring-config.xml"})
public class QueryInvoiceTest {
@Autowired
private InvoiceService invoiceService;
@Test
public void InvoiceByStatus() throws BusinessException{
List<Invoice> invoices=invoiceService.getInvoiceByStatus(InvoiceStatus.CANCELED);
Assert.assertNotNull(invoices);
for (Invoice invoice : invoices) {
Assert.assertNotNull(invoice.getInvoice_id());
boolean isCancelStatus =(invoice.getInvoice_status_id() == InvoiceStatus.CANCELED.getStatusId());
Assert.assertTrue(isCancelStatus);
}
}
}
| [
"[email protected]"
] | |
186641be3b32fee92c4cf176cd12f0e42337d0e2 | 89aa449b020d2f6ea00fdd8ea184fc3b470f16d5 | /src/DesignPattern/StarBuzz/Main.java | cada5153a2c25ab25642e4eab175937fb7df0983 | [] | no_license | zoebbmm/CodeTests | 56ea2f9cc3cf6083b1baa2c2b0c4875309bc5e30 | 384edbd526558b38dc165bb4e0f22ad1f4d94456 | refs/heads/master | 2021-01-23T07:59:37.797605 | 2017-03-28T14:11:44 | 2017-03-28T14:11:44 | 86,468,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,083 | java | package DesignPattern.StarBuzz;
/**
* Created by weizhou on 9/10/16.
*/
public class Main {
public static void main(String[] agrs) {
Beverage espresso = new Espresso();
System.out.println(espresso.getDescription() + " $" + espresso.cost());
Beverage darkRoast = new DarkRoast();
Beverage darkRoastWrappedOneMocha = new Mocha(darkRoast);
Beverage darkRoastWrappedDoubleMocha = new Mocha(darkRoastWrappedOneMocha);
Beverage darkRoastWrappedDoubleMochaWhip = new Whip(darkRoastWrappedDoubleMocha);
System.out.println(darkRoastWrappedDoubleMochaWhip.getDescription() + " $" + darkRoastWrappedDoubleMochaWhip.cost());
Beverage houseBlend = new HouseBlend();
Beverage houseBlendWrappedSoy = new Soy(houseBlend);
Beverage houseBlendWrappedSoyMocha = new Mocha(houseBlendWrappedSoy);
Beverage houseBlendWrappedSoyMochaWhip = new Whip(houseBlendWrappedSoyMocha);
System.out.println(houseBlendWrappedSoyMochaWhip.getDescription() + " $" + houseBlendWrappedSoyMochaWhip.cost());
}
}
| [
"[email protected]"
] | |
68f241c52001b658f92e26037cba38ada3465e56 | 05da1ce08b365e18753b9930ab6ea75bfec80424 | /app/src/main/java/com/wat128/nyan_java/MyView.java | a4ba45d942a93794d65d9c83ecca757ef80c1f80 | [] | no_license | wat128/nyan_Java | 2066c870f0495b8f65585daedd28559f9e7afb3e | ec960968d43fff5f6227c86a792e242fec069b6f | refs/heads/master | 2022-12-03T16:52:44.591164 | 2020-08-14T08:06:42 | 2020-08-14T08:06:42 | 271,514,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,520 | java | package com.wat128.nyan_java;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Picture;
import android.graphics.PorterDuff;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class MyView extends View {
private Paint paint;
private Bitmap bmp;
public MyView(Context context) {
super(context);
paint = new Paint();
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.image);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = 10000;
setMeasuredDimension(width, height);
}
@Override
protected void onDraw(Canvas canvas) {
Log.d("TestView", "onDraw()");
canvas.drawColor(Color.argb(255, 0, 0, 125));
canvas.drawBitmap(bmp, 50, 300, paint);
// Circle
paint.setColor(Color.argb(255,255,0,255));
paint.setStrokeWidth(30);
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.STROKE);
canvas.drawCircle(130, 550,100, paint);
// Circle2
paint.setStrokeWidth(30);
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.STROKE);
canvas.drawCircle(130,550,50, paint);
}
}
| [
"[email protected]"
] | |
7cfd3671508c3d8f389858607db73939adbfa744 | 8e7c349e8e6494ea722053744230d7c445fb5d24 | /src/main/java/nl/han/ica/oose/dea/dataAccess/DAO/LoginDAO.java | 6652a3132a7f4185598c53d505e6f9f3ebe80a0c | [] | no_license | jilldinnissen93/Vodagone | 79581f2df89b34568edf47674721674c03163a07 | 58bc380c1c22fa561f1b33690c8199c943329203 | refs/heads/master | 2023-03-05T13:47:47.966100 | 2021-02-17T11:22:58 | 2021-02-17T11:22:58 | 125,355,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,274 | java | package nl.han.ica.oose.dea.dataAccess.DAO;
import nl.han.ica.oose.dea.dataAccess.SqlQueries;
import nl.han.ica.oose.dea.domain.User;
import nl.han.ica.oose.dea.presentation.dtos.Login.LoginResponse;
import nl.han.ica.oose.dea.service.TokenService;
import javax.enterprise.inject.Default;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
@Default
public class LoginDAO extends DAO{
public LoginResponse getUserForLogin(String gebruikersnaam, String wachtwoord) throws SQLException {
logger.log(Level.SEVERE,gebruikersnaam);
User user = null;
LoginResponse loginResponse = null;
try {
Connection connection = sqlConnection.getConnection();
statement = connection.prepareStatement(SqlQueries.LOGIN);
statement.setString(1, gebruikersnaam);
statement.setString(2, wachtwoord);
result = statement.executeQuery();
while (result.next()) {
if (userMap.findUserByID(result.getInt("user_id")).isPresent()) {
user = userMap.findUserByID(result.getInt("user_id")).get();
User replacement = new User(result.getString("voornaam") + " " +
result.getString("achternaam"),
result.getInt("user_id"),
TokenService.generateToken());
userMap.update(user,replacement);
} else {
userMap.insert(
user = new User(result.getString("voornaam") + " " +
result.getString("achternaam"),
result.getInt("abonnee_id"),
TokenService.generateToken())
);
}
}
} catch (SQLException e) {
logger.log(Level.SEVERE, "Failed to retrieve user with name " + gebruikersnaam, e);
throw new SQLException(e);
} finally {
closeConnection(result,statement,connection);
}
if (user != null) {
loginResponse = new LoginResponse(user.getUser(),user.getToken());
}
return loginResponse;
}
}
| [
"[email protected]"
] | |
09d811daa83893936d193e143a19d45fed910a54 | 2bbef6249c4c7d144bef958ccbb6c12a598cc39d | /enroll-finger-from-scanner/src/main/java/EnrollFingerFromScanner.java | e3e7c0b6f9c58c7eaa2fc028885abc06128e2b40 | [
"MIT"
] | permissive | wiringbits/fingerprint-reader-daemon | 8696ab0f79de7ddb13c21b696a54591fd1949861 | dff6bc0d47323315addbde77635cbd3651f9fa51 | refs/heads/master | 2021-04-09T09:46:22.219096 | 2020-07-04T04:34:00 | 2020-07-04T04:34:00 | 248,861,251 | 8 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,329 | java | import static spark.Spark.*;
import org.json.JSONObject;
import java.util.Base64;
import java.util.concurrent.*;
public final class EnrollFingerFromScanner {
public static void main(String[] args) {
final EnrollFingerFromScannerBiometric enrollFromScanner;
try {
enrollFromScanner = new EnrollFingerFromScannerBiometric();
} catch (Exception e) {
System.out.println(e.getMessage());
return;
}
port(1212);
post("/fingerprints", (req, res) -> {
res.type("application/json");
JSONObject jsonResponse = new JSONObject();
final ScanThread scanThread = new ScanThread(enrollFromScanner);
try {
final FingerPrintDetails fingerPrintDetails = scanFingerPrint(scanThread);
jsonResponse
.put("data", new JSONObject()
.put("image", new String(fingerPrintDetails.getImageBytes()))
.put("template", new String(fingerPrintDetails.getTemplateBytes()))
);
} catch (BScannerException e) {
jsonResponse
.put("error", e.getMessage());
res.status(e.getCode());
} catch (TimeoutException e) {
scanThread.stopScan();
jsonResponse
.put("error", "Timeout waiting for scan");
res.status(413);
} catch (Exception e) {
jsonResponse
.put("error", "Unknown error: [" + e.getMessage() + "]");
res.status(500);
} finally {
scanThread.stopThread();
}
return jsonResponse.toString();
});
}
private static FingerPrintDetails scanFingerPrint(
ScanThread scanThread) throws Exception {
Future<FingerPrintDetails> future = scanThread.start();
FingerPrintDetails fingerPrintDetails = future.get(3000, TimeUnit.MILLISECONDS);
// if internal exception
if (fingerPrintDetails == null) {
throw scanThread.getException();
}
byte[] imageBytes = fingerPrintDetails.getImageBytes();
byte[] templateBytes = fingerPrintDetails.getTemplateBytes();
byte[] imageEncoded = Base64
.getEncoder()
.encode(imageBytes);
byte[] templateEncoded = Base64
.getEncoder()
.encode(templateBytes);
return new FingerPrintDetails(imageEncoded, templateEncoded);
}
}
| [
"[email protected]"
] | |
0b3cc1beb4daa95c79392ddff41cc590ef836961 | 8c7b59d1dc6a06dbf6932858e403314205cd0178 | /app/src/main/java/com/whatsappclone/ChatInfoScreen.java | eb68103b548d2e499de4cae8af3d9488e1e459c2 | [] | no_license | sulsDotK/ChatApp | 1e2a8dbfcae1219c1e65621f2c3b8437f491d172 | 6eddecefa1f5b35167009ad10752b4fb52ffdad8 | refs/heads/master | 2020-08-06T15:12:11.562745 | 2019-10-05T18:50:01 | 2019-10-05T18:50:01 | 212,185,465 | 0 | 0 | null | 2019-10-04T12:23:02 | 2019-10-01T19:44:57 | Java | UTF-8 | Java | false | false | 7,507 | java | package com.whatsappclone;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.appbar.AppBarLayout;
import java.util.List;
import Database.DbContact;
import Database.DbContact_;
import HelperClasses.GlobalFunctions;
import HelperClasses.GlobalVariables;
import HelperClasses.HeaderView;
import io.objectbox.android.AndroidScheduler;
import io.objectbox.query.Query;
import io.objectbox.reactive.DataObserver;
import io.objectbox.reactive.DataSubscription;
public class ChatInfoScreen extends AppCompatActivity implements AppBarLayout.OnOffsetChangedListener {
DataSubscription subscription;
/* @BindView(R.id.toolbarHeaderView)*/ HeaderView toolbarHeaderView;
/* @BindView(R.id.floatHeaderView)*/ HeaderView floatHeaderView;
/* @BindView(R.id.chatInfoAppBar)*/ AppBarLayout appBarLayout;
/*@BindView(R.id.chatInfoToolBar)*/ Toolbar toolbar;
/*@BindView(R.id.chatInfoCardStatus)*/ TextView userStatus;
/*@BindView(R.id.chatInfoCardContactNumber)*/ TextView userNumber;
TextView headerChatInfoChatName;
TextView headerChatInfoLastSeen;
TextView toolbarChatInfoChatName;
TextView toolbarChatInfoLastSeen;
private boolean isHideToolbarView = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat_info_screen);
toolbarHeaderView = findViewById(R.id.toolbarHeaderView);
floatHeaderView = findViewById(R.id.floatHeaderView);
appBarLayout = findViewById(R.id.chatInfoAppBar);
toolbar = findViewById(R.id.chatInfoToolBar);
toolbarHeaderView.setVariables();
floatHeaderView.setVariables();
userStatus = findViewById(R.id.chatInfoCardStatus);
userNumber = findViewById(R.id.chatInfoCardContactNumber);
headerChatInfoChatName = floatHeaderView.findViewById(R.id.chatInfoChatName);
headerChatInfoLastSeen = floatHeaderView.findViewById(R.id.chatInfoLastSeen);
toolbarChatInfoChatName = toolbarHeaderView.findViewById(R.id.chatInfoChatName);
toolbarChatInfoLastSeen = toolbarHeaderView.findViewById(R.id.chatInfoLastSeen);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
initUI();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
private void initUI() {
appBarLayout.addOnOffsetChangedListener(this);
// set the views to the information of the current user!
Intent intent = getIntent();
final DbContact currentContact = (DbContact) intent.getSerializableExtra("contact");
headerChatInfoChatName.setText(currentContact.getUserName());
headerChatInfoLastSeen.setText(currentContact.getLastSeenString());
toolbarChatInfoChatName.setText(currentContact.getUserName());
toolbarChatInfoLastSeen.setText(currentContact.getLastSeenString());
ImageView chatImage = findViewById(R.id.chatInfoChatImage);
if (!currentContact.getProfilePhotoPath().equals("")) {
chatImage.setImageURI(Uri.parse(currentContact.getProfilePhotoPath()));
} else {
chatImage.setImageResource(R.drawable.ic_person_black_36dp);
}
userStatus.setText(currentContact.getStatus());
userNumber.setText(currentContact.getPhoneNumber());
Query<DbContact> query = GlobalVariables.getInstance(getApplicationContext())
.getBoxStore().boxFor(DbContact.class).query()
.equal(DbContact_.phoneNumber, currentContact.getPhoneNumber()).build();
subscription = query.subscribe().on(AndroidScheduler.mainThread())
.observer(new DataObserver<List<DbContact>>() {
@Override
public void onData(List<DbContact> data) {
int index = data.indexOf(currentContact);
if (index != -1) {
DbContact c = data.get(index);
String lastSeen = GlobalFunctions.getLastSeen(c.getLastSeen());
// DateFormat onlyDateFormat = new SimpleDateFormat("dd/MM/yyyy");
// DateFormat onlyTimeFormat = new SimpleDateFormat("HH:mm");
//
// String lastSeen = "";
//
// if(c.getLastSeen() == 0)
// {
// lastSeen = c.getLastSeenString();
// }
// else
// {
// DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
//
// try
// {
// Date lastSeenDate = format.parse(c.getLastSeenString());
//
// if(DateUtils.isToday(c.getLastSeen()))
// {
// lastSeen = "last seen today at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(lastSeenDate);
// }
// else if(DateUtils.isToday(lastSeenDate.getTime() + DateUtils.DAY_IN_MILLIS))
// {
// lastSeen = "last seen yesterday at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(lastSeenDate);
// }
// else
// {
// lastSeen = "last seen on " + DateFormat.getInstance().format(lastSeenDate);
// }
// }
// catch (ParseException e)
// {
// e.printStackTrace();
// }
// }
headerChatInfoChatName.setText(c.getUserName());
headerChatInfoLastSeen.setText(lastSeen);
toolbarChatInfoChatName.setText(c.getUserName());
toolbarChatInfoLastSeen.setText(lastSeen);
}
}
});
}
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int offset) {
int maxScroll = appBarLayout.getTotalScrollRange();
float percentage = (float) Math.abs(offset) / (float) maxScroll;
if (percentage == 1f && isHideToolbarView) {
toolbarHeaderView.setVisibility(View.VISIBLE);
isHideToolbarView = !isHideToolbarView;
} else if (percentage < 1f && !isHideToolbarView) {
toolbarHeaderView.setVisibility(View.GONE);
isHideToolbarView = !isHideToolbarView;
}
}
@Override
protected void onStart() {
super.onStart();
GlobalVariables.ACTIVITIES_COUNT.addAndGet(1);
}
@Override
protected void onStop() {
super.onStop();
GlobalVariables.decrementActivities();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (!subscription.isCanceled()) {
subscription.cancel();
}
}
}
| [
"[email protected]"
] | |
6d67f04ff46273c05165274f6d901243c6bcbe93 | 1a1cef5f723ce412c7599eea68605e423e5603fc | /Main_Type 4/src/Main.java | 958b513c5a4e9234464f22c2e8059691a35e47f5 | [] | no_license | dahun428/login | def23e63c8c10b0b19631efd6d873adb40982759 | 2f3f591a3fc546e41efc8ee015b8cea3821e66c6 | refs/heads/master | 2020-12-06T03:15:55.229116 | 2020-01-19T22:00:21 | 2020-01-19T22:00:21 | 232,322,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException {
PrintWriter p1 = new PrintWriter("result1.txt");
p1.write("hello 1");
p1.close();
PrintWriter p2 = new PrintWriter("result2.txt");
p2.write("hello 2");
p2.close();
p2.toString();
p2.write("hello 2");
}
}
| [
"[email protected]"
] | |
825128293d84614715646c122fe2c094e5ad66e7 | 62e6a51374722b8d873e08387ceaa9a76aec8c86 | /zdal-parser/src/test/java/com/alipay/zdal/parser/druid/bvt/sql/mysql/visitor/MySqlSchemaStatVisitorTest_Subquery2.java | 6b0ada2b8b2012bce961fd7db57c98832b2f6037 | [] | no_license | shuxc/zdal | 4a93d3ced06aee31d8841b709982fb2b222132d8 | 3bed2d4aa3efa5be3d19177a22b5825f98dbc4c4 | refs/heads/master | 2022-07-09T05:04:16.082510 | 2019-08-29T05:56:03 | 2019-08-29T05:56:03 | 205,068,306 | 0 | 0 | null | 2020-07-02T00:25:50 | 2019-08-29T02:58:05 | Java | WINDOWS-1252 | Java | false | false | 3,295 | java | package com.alipay.zdal.parser.druid.bvt.sql.mysql.visitor;
import java.util.List;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.alipay.zdal.parser.sql.ast.SQLStatement;
import com.alipay.zdal.parser.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alipay.zdal.parser.visitor.ZdalMySqlSchemaStatVisitor;
/**
*
* @author xiaoqing.zhouxq
* @version $Id: MySqlSchemaStatVisitorTest_Subquery2.java, v 0.1 2012-5-17 ÉÏÎç10:12:03 xiaoqing.zhouxq Exp $
*/
public class MySqlSchemaStatVisitorTest_Subquery2 extends TestCase {
public void test_0() throws Exception {
String sql = "select "
+ "t1.owner_card_no,opposite_card_no,opposite_name,opposite_nick_name,consume_title,"
+ "consume_fee,consume_type,t1.biz_type,biz_sub_type,biz_orig,t1.biz_in_no,biz_out_no,"
+ "biz_extra_no,biz_state,consume_status,consume_refund_status,in_out,consume_site,"
+ "trade_from,flag_locked,flag_refund,gmt_biz_create,delete_type,delete_time,"
+ "delete_over_time,gmt_modify from "
+ "(select owner_card_no,biz_in_no,biz_type from ps_consume_delete15 where owner_card_no = ? and delete_type IN ( ?,?) ORDER BY gmt_biz_create DESC LIMIT ?, ?) "
+ " as t1,ps_consume_delete15 t2 "
+ " where t1.owner_card_no =t2.owner_card_no and t1.biz_in_no=t2.biz_in_no and t1.biz_type=t2.biz_type order by biz_type";
MySqlStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> statementList = parser.parseStatementList();
SQLStatement statemen = statementList.get(0);
Assert.assertEquals(1, statementList.size());
ZdalMySqlSchemaStatVisitor visitor = new ZdalMySqlSchemaStatVisitor();
statemen.accept(visitor);
System.out.println(sql);
System.out.println("Tables : " + visitor.getTables());
System.out.println("fields : " + visitor.getColumns());
System.out.println("alias : " + visitor.getAliasMap());
System.out.println("conditions : " + visitor.getConditions());
System.out.println("orderBy : " + visitor.getOrderByColumns());
System.out.println("groupBy : " + visitor.getGroupByColumns());
System.out.println("variant : " + visitor.getVariants());
System.out.println("relationShip : " + visitor.getRelationships());
// Assert.assertEquals(1, visitor.getTables().size());
// Assert.assertEquals(true, visitor.containsTable("users"));
// Assert.assertEquals(true, visitor.containsTable("groups"));
// Assert.assertEquals(5, visitor.getColumns().size());
// Assert.assertEquals(true, visitor.getColumns().contains(new Column("users", "id")));
// Assert.assertEquals(true, visitor.getColumns().contains(new Column("users", "groupId")));
// Assert.assertEquals(true, visitor.getColumns().contains(new Column("users", "name")));
// Assert.assertEquals(true, visitor.getColumns().contains(new Column("groups", "id")));
// Assert.assertEquals(true, visitor.getColumns().contains(new Column("groups", "name")));
}
}
| [
"[email protected]"
] | |
1e19d3b0b9d38dc86743602909095806486eab90 | 9d109937c7d1ba499e1ed575d4d34bc6aeb8d578 | /app/src/main/java/com/jscheng/elemeapplication/Wiget/PointFTypeEvaluator.java | 1c284856d36479601698d66877b66858345ccd72 | [] | no_license | liaojialin/ShoppingCart | 447ffffe98beff40aa103e69c925eb6a3da14ca0 | 4b6f016093a8be78a4fc5b12ecbff9003f0597a2 | refs/heads/master | 2020-07-11T04:58:20.046749 | 2016-11-13T15:07:04 | 2016-11-13T15:07:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,283 | java | package com.jscheng.elemeapplication.Wiget;
/**
* Created by cheng on 16-11-13.
*/
import android.animation.TypeEvaluator;
import android.graphics.PointF;
/**
* 自定义估值器
*/
public class PointFTypeEvaluator implements TypeEvaluator<PointF> {
/**
* 每个估值器对应一个属性动画,每个属性动画仅对应唯一一个控制点
*/
PointF control;
/**
* 估值器返回值
*/
PointF mPointF = new PointF();
public PointFTypeEvaluator(PointF control) {
this.control = control;
}
@Override
public PointF evaluate(float fraction, PointF startValue, PointF endValue) {
return getBezierPoint(startValue, endValue, control, fraction);
}
/**
* 二次贝塞尔曲线公式
*
* @param start 开始的数据点
* @param end 结束的数据点
* @param control 控制点
* @param t float 0-1
* @return 不同t对应的PointF
*/
private PointF getBezierPoint(PointF start, PointF end, PointF control, float t) {
mPointF.x = (1 - t) * (1 - t) * start.x + 2 * t * (1 - t) * control.x + t * t * end.x;
mPointF.y = (1 - t) * (1 - t) * start.y + 2 * t * (1 - t) * control.y + t * t * end.y;
return mPointF;
}
}
| [
"[email protected]"
] | |
e416eb7b526c4af03fd5be061f86654dab2912a7 | 52197c479b604ac74e36fe4ab998864e82d09148 | /app/src/main/java/com/example/spotpoc/ui/RegisterActivity.java | e4b8e07be2af43b6fed5236df8bac58a50eba8bc | [] | no_license | madhutota/SpotPoc | 299c3737ca1e64920623e368cc08e2dbac17bb11 | 3b8bf89445877cc930dcf1bb6297c1eabaf621ac | refs/heads/master | 2020-06-19T14:26:00.669720 | 2019-07-13T17:03:04 | 2019-07-13T17:03:04 | 196,742,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,255 | java | package com.example.spotpoc.ui;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.example.spotpoc.R;
import com.example.spotpoc.networking.model.RegisterRequest;
import com.example.spotpoc.networking.model.RegisterResponse;
import com.wang.avi.AVLoadingIndicatorView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class RegisterActivity extends BaseActivity {
@BindView(R.id.input_name)
EditText inputName;
@BindView(R.id.input_email)
EditText inputEmail;
@BindView(R.id.input_password)
EditText inputPassword;
@BindView(R.id.input_confirm_password)
EditText inputConfirmPassword;
@BindView(R.id.input_gender)
EditText gender;
@BindView(R.id.input_mobile)
EditText mobile;
@BindView(R.id.loader)
AVLoadingIndicatorView loader;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
ButterKnife.bind(this);
}
@OnClick(R.id.btn_register)
void onRegisterClick() {
String name = inputName.getText().toString();
String email = inputEmail.getText().toString();
String password = inputPassword.getText().toString();
String confirmPassword = inputConfirmPassword.getText().toString();
String mobileNumber = mobile.getText().toString();
String genderString = gender.getText().toString();
if (TextUtils.isEmpty(name) || TextUtils.isEmpty(email) || TextUtils.isEmpty(password)) {
Toast.makeText(getApplicationContext(), getString(R.string.msg_fill_the_form), Toast.LENGTH_LONG).show();
return;
}
loader.setVisibility(View.VISIBLE);
RegisterRequest request = new RegisterRequest();
request.name = name;
request.email = email;
request.password = password;
request.confirmPassword = confirmPassword;
request.mobile = mobileNumber;
request.gender = genderString;
getApi().register(request).enqueue(new Callback<RegisterResponse>() {
@Override
public void onResponse(Call<RegisterResponse> call, Response<RegisterResponse> response) {
loader.setVisibility(View.INVISIBLE);
if (!response.isSuccessful()) {
handleError(response.errorBody());
return;
}
}
@Override
public void onFailure(Call<RegisterResponse> call, Throwable t) {
loader.setVisibility(View.INVISIBLE);
handleError(t);
}
});
}
@OnClick(R.id.btn_login_account)
void onCreateAccountClick() {
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}
}
| [
"[email protected]"
] | |
23a2ed2ae74b1c85bc6fbd4580c9db1f0861aaf3 | a362bf811acfa93b8b8ec2837fcbbb83288ff4ab | /src/com/java/algorithm/set/FileIndex.java | 3879b993fead5f03c1fb3732b3c165d5285d246d | [] | no_license | mirdesai81/JavaDesginPatterns | 247c76a9a3538b228c8855d2c95c3470ba76a780 | f17a5aa701e0226e5dae20376f1223aa4883bc06 | refs/heads/master | 2021-09-23T16:13:02.139132 | 2021-09-22T22:53:01 | 2021-09-22T22:53:01 | 78,155,262 | 1 | 0 | null | 2020-11-02T02:23:16 | 2017-01-05T23:01:48 | Java | UTF-8 | Java | false | false | 1,318 | java | package com.java.algorithm.set;
import com.java.algorithm.tree.ST;
import com.java.stdlib.In;
import com.java.stdlib.StdIn;
import com.java.stdlib.StdOut;
import java.io.File;
public class FileIndex {
//Do not instantiate.
private FileIndex() { }
public static void main(String[] args) {
// key = word, value = set of files containing that word
ST<String, SET<File>> st = new ST<String, SET<File>>();
// create inverted index of all files
StdOut.println("Indexing files");
for (String filename : args) {
StdOut.println(" " + filename);
File file = new File(filename);
In in = new In(file);
while (!in.isEmpty()) {
String word = in.readString();
if (!st.contains(word)) st.put(word, new SET<File>());
SET<File> set = st.get(word);
set.add(file);
}
}
// read queries from standard input, one per line
while (!StdIn.isEmpty()) {
String query = StdIn.readString();
if (st.contains(query)) {
SET<File> set = st.get(query);
for (File file : set) {
StdOut.println(" " + file.getName());
}
}
}
}
}
| [
"[email protected]"
] | |
8783fac9026ee6b8dbd67fbd61beaa4902908830 | a169035abf5c9c40c4e7e70db869a6200d52f495 | /java/exceptions/src/org/academiadecodigo/ramsters/exceptionsExercise/exceptions/NotEnoughSpaceException.java | 5debe4a809256b788686bd80686bdcd0edb3cb74 | [] | no_license | ojaoc/AC_exercises | 40e8b8bd6a689a030dc2df1ae7afb3fd8c243949 | 2d8c738ecfddccb90d200fb13561869820f9c91b | refs/heads/master | 2022-04-11T09:05:19.930067 | 2020-03-27T16:44:17 | 2020-03-27T16:44:17 | 238,555,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package org.academiadecodigo.ramsters.exceptionsExercise.exceptions;
public class NotEnoughSpaceException extends FileException {
public NotEnoughSpaceException() {
super("You don't have enough storage for the file you want to download.");
}
}
| [
"[email protected]"
] | |
9637f033d520c911ddb3f70d9966e2cb682c2a89 | 3d0b04fa4868fbf17125ead72b034371bf08451e | /DaYingJia/src/com/hzwydyj/finace/activitys/ShiPanSelectActivity.java | 4f39c49d3e67cd0a7a808b916022ad69d5ae79a2 | [] | no_license | djun100/HuaZongWeiYe_DaYingJia | b9da8081bc905435050b872f6634ca2c0e4aaa57 | 0c6ee3d1144a743ff386a34bba8f0349c0bf26d0 | refs/heads/master | 2020-06-04T14:01:53.710407 | 2014-07-08T05:51:39 | 2014-07-08T05:51:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,080 | java | package com.hzwydyj.finace.activitys;
import java.net.SocketException;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.analytics.tracking.android.EasyTracker;
import com.hzwydyj.finace.MyApplication;
import com.hzwydyj.finace.R;
import com.hzwydyj.finace.data.Const;
import com.hzwydyj.finace.data.ExceptionBean;
import com.hzwydyj.finace.data.ShiPanTanGuBean;
import com.hzwydyj.finace.db.DBConst;
import com.hzwydyj.finace.db.DriectDBhelper;
import com.hzwydyj.finace.service.HuaZongWeiYeService;
import com.hzwydyj.finace.service.SysApplication;
import com.hzwydyj.finace.utils.CommonUtil;
import com.hzwydyj.finace.utils.Util;
import com.umeng.analytics.MobclickAgent;
/**
* 实盘直播
*
* @author LuoYi
*
*/
public class ShiPanSelectActivity extends Activity implements OnClickListener, OnItemClickListener {
private final static String TAG = "ShiPanSelectActivity";
private Button selectBack;
private Button selectOutLogin;
private Util selectUtil = new Util();
private List<ShiPanTanGuBean> selectBeanList;
private ListView selectList;
ShiPanTanGuBean selectBean;
private String selectGroupid;
private String selectGroupTitle;
private String selectGrade;
private String selectRoomlevel;
private String selectCookieid;
private String selectUid;
private AlertDialog selectDialog;
public int[] selectImage = new int[] { R.drawable.pic_1, R.drawable.pic_2, R.drawable.pic_3, R.drawable.pic_4 };
private HZWY_BaseActivity hzwy_BaseActivity;
@Override
protected void onStart() {
super.onStart();
// 谷歌分析统计代码
EasyTracker.getInstance().activityStart(this);
}
@Override
protected void onStop() {
super.onStop();
// 谷歌分析统计代码
EasyTracker.getInstance().activityStop(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
SelectDialog();
init();
}
public void init() {
setContentView(R.layout.shipanselect);
hzwy_BaseActivity = new HZWY_BaseActivity(MyApplication.CONTEXT);
/* 获取上个页面的值 */
Intent intent = getIntent();
selectGroupid = intent.getStringExtra("groupid");
selectGroupTitle = intent.getStringExtra("groupTitle");
selectGrade = intent.getStringExtra("grade");
selectRoomlevel = intent.getStringExtra("roomlevel");
selectCookieid = intent.getStringExtra("cookieid");
selectUid = intent.getStringExtra("uid");
/* 初始化控件 */
selectList = (ListView) findViewById(R.id.list_select);
selectBack = (Button) findViewById(R.id.button_backbtn);
selectOutLogin = (Button) findViewById(R.id.button_out_login);
selectOutLogin.setText(R.string.tishi_login_out);
selectList.setOnItemClickListener(this);
selectBack.setOnClickListener(this);
selectOutLogin.setOnClickListener(this);
if (CommonUtil.isConnectingToInternet(ShiPanSelectActivity.this)) {
select();
} else {
hzwy_BaseActivity.HZWY_Toast(R.string.network_connection_failure);
selectDialog.cancel();
ShiPanSelectActivity.this.finish();
}
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_backbtn:// 返回
ShiPanSelectActivity.this.finish();
break;
case R.id.button_out_login:// 退出登录
clearData();
break;
default:
break;
}
}
public void clearData() { // 便于测试,需求没有要求退出登录
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.shipan_share_dialog, null);
TextView outInTitle = (TextView) textEntryView.findViewById(R.id.share_title_text);
TextView outInContent = (TextView) textEntryView.findViewById(R.id.share_content_text);
Button outInQueRen = (Button) textEntryView.findViewById(R.id.share_queren_button);
Button outInQuXiao = (Button) textEntryView.findViewById(R.id.share_quxiao_button);
/* 提示*/
outInTitle.setText(R.string.tishi_warm_prompt);
outInContent.setText(R.string.tishi_logout);
outInQueRen.setText(R.string.tishi_que_dings);
outInQuXiao.setVisibility(View.VISIBLE);
final AlertDialog dialog = new AlertDialog.Builder(this).setView(textEntryView).create();
dialog.show();
outInQueRen.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
DriectDBhelper driectDBhelper = new DriectDBhelper(MyApplication.CONTEXT);
driectDBhelper.deleteAllData(DBConst.DB_TABLE_DRIECT1);
driectDBhelper.deleteAllData(DBConst.DB_TABLE_DRIECT2);
driectDBhelper.deleteAllData(DBConst.DB_TABLE_DRIECT3);
driectDBhelper.deleteAllData(DBConst.DB_TABLE_DRIECT4);
SharedPreferences preferences = getSharedPreferences("ShiPanLogin", Context.MODE_PRIVATE);
preferences.edit().clear().commit();
ShiPanSelectActivity.this.finish();
dialog.cancel();
}
});
outInQuXiao.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dialog.cancel();
}
});
}
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
}
/**
* 直播室信息接口 网络请求
*/
public void select() {
new Thread(new Runnable() {
@SuppressLint("ShowToast")
public void run() {
String url = Const.HZWY_URL + "type=roomstatus&cookieid=" + selectCookieid;
Log.i("temp", "直播室信息接口 网络请求-->>" + url);
try {
Message msg = selectHandler.obtainMessage();
msg.obj = selectUtil.getTanGu_post(url);
selectHandler.sendMessage(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
@SuppressLint("HandlerLeak")
Handler selectHandler = new Handler() {
@SuppressWarnings("unchecked")
public void handleMessage(Message msg) {
selectBeanList = (List<ShiPanTanGuBean>) msg.obj;
selectList.setAdapter(new ShiPanSelectAdapter(ShiPanSelectActivity.this, selectBeanList));
selectDialog.cancel();
};
};
class ShiPanSelectAdapter extends BaseAdapter {
private Context context;
private LayoutInflater inflater;
private List<ShiPanTanGuBean> selectBean;
public ShiPanSelectAdapter(Context context, List<ShiPanTanGuBean> pointBeanList) {
this.context = context;
this.selectBean = pointBeanList;
inflater = LayoutInflater.from(context);
}
public int getCount() {
return selectBean.size();
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
@SuppressLint("ResourceAsColor")
@SuppressWarnings("deprecation")
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.shipan_select_item, parent, false);
}
LinearLayout layout_button_dayingjia = CommonUtil.get(convertView, R.id.layout_button_dayingjia);
LinearLayout layout_dayingjia = CommonUtil.get(convertView, R.id.layout_dayingjia);
TextView button_dayingjia = CommonUtil.get(convertView, R.id.button_dayingjia);
TextView button_dayingjia1 = CommonUtil.get(convertView, R.id.button_dayingjia1);
TextView theme_dayingjia = CommonUtil.get(convertView, R.id.text_theme);
TextView viewPoint_dayingjia = CommonUtil.get(convertView, R.id.text_viewpoint);
TextView analyst_dayingjia = CommonUtil.get(convertView, R.id.text_analyst);
String listName = selectBean.get(position).getName();
if (position % 2 == 0) {
button_dayingjia.setText(listName);
button_dayingjia.setVisibility(View.VISIBLE);
button_dayingjia1.setVisibility(View.GONE);
} else {
button_dayingjia1.setText(listName);
button_dayingjia.setVisibility(View.GONE);
button_dayingjia1.setVisibility(View.VISIBLE);
}
theme_dayingjia.setText("主 题:" + selectBean.get(position).getSubject());
viewPoint_dayingjia.setText("观 点:" + selectBean.get(position).getPoint());
analyst_dayingjia.setText("分析师:" + selectBean.get(position).getUsername());
for (int i = 0; i < 4; i++) {
layout_dayingjia.setBackgroundDrawable(getResources().getDrawable(selectImage[position]));
}
layout_button_dayingjia.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if ("open".equals(selectBean.get(position).getStatus())) {
Intent intent = new Intent(ShiPanSelectActivity.this, ShiPanInteractionHomeActivity.class);
intent.putExtra("name", selectBean.get(position).getName());
intent.putExtra("username", selectBean.get(position).getUsername());
intent.putExtra("subject", selectBean.get(position).getSubject());
intent.putExtra("point", selectBean.get(position).getPoint());
intent.putExtra("public_notice", selectBean.get(position).getPublic_notice());
intent.putExtra("rid", selectBean.get(position).getRid());
/* 登录界面的值 */
intent.putExtra("groupid", selectGroupid);
intent.putExtra("groupTitle", selectGroupTitle);
intent.putExtra("grade", selectGrade);
intent.putExtra("roomlevel", selectRoomlevel);
intent.putExtra("cookieid", selectCookieid);
intent.putExtra("uid", selectUid);
if ("1".equals(selectBean.get(position).getAuthority())) {
startActivity(intent);
} else {
if ("-1".equals(selectBean.get(position).getAuthority())) {
hzwy_BaseActivity.permissionHint(R.string.tishi_zhibojian_kaifang1);
} else if("-2".equals(selectBean.get(position).getAuthority())) {
hzwy_BaseActivity.permissionHint(R.string.tishi_zhibojian_kaifang2);
} else if("-3".equals(selectBean.get(position).getAuthority())) {
hzwy_BaseActivity.permissionHint(R.string.tishi_zhibojian_kaifang3);
} else if("-4".equals(selectBean.get(position).getAuthority()) || "-5".equals(selectBean.get(position).getAuthority())){
hzwy_BaseActivity.permissionHint(R.string.tishi_zhibojian_kaifang4);
}
}
} else {
hzwy_BaseActivity.HZWY_Toast1(selectBean.get(position).getName() + "直播室现已关闭");
}
}
});
return convertView;
}
}
/*********************************************获取实盘直播列表弹窗********开始************************************************/
public void SelectDialog(){
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.shipan_share_dialog, null);
TextView loginTitle = (TextView) textEntryView.findViewById(R.id.share_title_text);
ProgressBar loginProgess = (ProgressBar) textEntryView.findViewById(R.id.progress_bar);
TextView loginContent = (TextView) textEntryView.findViewById(R.id.share_content_text);
TextView loginMessage = (TextView) textEntryView.findViewById(R.id.share_message_text);
LinearLayout loginLayout = (LinearLayout) textEntryView.findViewById(R.id.share_layout);
loginTitle.setText(R.string.later_on_user);
loginProgess.setVisibility(View.VISIBLE);
loginContent.setVisibility(View.GONE);
loginMessage.setText(R.string.tishi_shipan_list);
loginMessage.setVisibility(View.VISIBLE);
loginLayout.setVisibility(View.GONE);
selectDialog = new AlertDialog.Builder(this).setView(textEntryView).create();
selectDialog.show();
}
/**********************************************获取实盘直播列表弹窗********结束***********************************************/
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
System.gc();
}
}
| [
"[email protected]"
] | |
8da471ebb5a0af90c52e3063011be3534288b47a | 897639e2b1039da188a48d9fe9b5a7d2ec18172d | /vaadin-recaptcha-demo/src/main/java/com/wcs/wcslib/vaadin/widget/recaptcha/demo/DummyRegWithReCaptcha.java | ff338a0d00d1638f09d41ca0fcb823fc042b2139 | [
"Apache-2.0"
] | permissive | dve/vaadin-recaptcha | 887154007bd54df04fc1a01b9211fb4b927eb415 | dc2186b5763ad1d30c39133109c1d3533287064e | refs/heads/master | 2021-01-22T20:13:30.214379 | 2016-07-15T11:28:03 | 2016-07-15T11:28:03 | 85,298,809 | 0 | 0 | null | 2017-03-17T10:18:12 | 2017-03-17T10:18:12 | null | UTF-8 | Java | false | false | 7,812 | java | /*
* Copyright 2013 kumm.
*
* 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.wcs.wcslib.vaadin.widget.recaptcha.demo;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup;
import com.vaadin.event.ShortcutAction;
import com.vaadin.server.Page;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Reindeer;
import com.wcs.wcslib.vaadin.widget.recaptcha.ReCaptcha;
import com.wcs.wcslib.vaadin.widget.recaptcha.shared.ReCaptchaOptions;
/**
*
* @author kumm
*/
public class DummyRegWithReCaptcha extends Panel implements Button.ClickListener {
private VerticalLayout content;
private ReCaptcha reCaptcha;
private BeanFieldGroup<RegistrationBean> fieldGroup;
private RegistrationBean regBean;
private int captchaFailCount = 0;
public DummyRegWithReCaptcha(ConfigComponent config) {
initFieldGroup();
reCaptcha = createCaptcha(config);
setCaption("Dummy registration");
setSizeUndefined();
content = new VerticalLayout();
setContent(content);
buildContent();
}
private void initFieldGroup() {
fieldGroup = new BeanFieldGroup<RegistrationBean>(RegistrationBean.class);
regBean = new RegistrationBean();
fieldGroup.setItemDataSource(regBean);
}
private void buildContent() {
content.setMargin(true);
content.addComponent(createForm());
content.addComponent(reCaptcha);
Button reconfigBtn = createCancelBtn();
Button submitBtn = new Button("Register", this);
submitBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);
submitBtn.addStyleName(Reindeer.BUTTON_DEFAULT);
HorizontalLayout actionsLayout = new HorizontalLayout(submitBtn, reconfigBtn);
actionsLayout.setSpacing(true);
actionsLayout.setWidth(100, Unit.PERCENTAGE);
actionsLayout.setComponentAlignment(reconfigBtn, Alignment.MIDDLE_RIGHT);
content.addComponent(actionsLayout);
}
private Layout createForm() {
RegistrationFields registrationFields = new RegistrationFields();
fieldGroup.buildAndBindMemberFields(registrationFields);
GridLayout layout = new GridLayout(2, 2);
layout.setSpacing(true);
layout.addComponent(registrationFields.getLogin(), 0, 0);
layout.addComponent(registrationFields.getPassword(), 0, 1);
layout.addComponent(registrationFields.getPasswordAgain(), 1, 1);
registrationFields.login.focus();
return layout;
}
private ReCaptcha createCaptcha(final ConfigComponent config) {
return new ReCaptcha(
"6Lc8ESUTAAAAAB_8IHl5FcE8o_QCToT44hOhBa-1",
new ReCaptchaOptions() {
{
theme = config.getTheme();
sitekey = "6Lc8ESUTAAAAABAYgG11XSkPRY-YXTKKFCjGb9GJ";
type = config.getType();
size = config.getSize();
}
},
config.getLang()
);
}
@Override
public void buttonClick(Button.ClickEvent event) {
try {
fieldGroup.commit();
} catch (FieldGroup.CommitException ex) {
Notification.show("All fields are required!", Notification.Type.ERROR_MESSAGE);
fieldGroup.discard();
return;
}
if (!regBean.password.equals(regBean.passwordAgain)) {
Notification.show("passwords do not match", Notification.Type.ERROR_MESSAGE);
regBean.password = "";
regBean.passwordAgain = "";
fieldGroup.discard();
return;
}
//captcha should be the last validation
if (!reCaptcha.validate()) {
if (++captchaFailCount > 2) {
content.setEnabled(false);
Notification.show("You are an evil bot!", Notification.Type.ERROR_MESSAGE);
} else {
if (!reCaptcha.isEmpty()) {
Notification.show("Invalid Captcha!", Notification.Type.ERROR_MESSAGE);
reCaptcha.reload();
} else {
Notification.show("Please fill the captcha!", Notification.Type.ERROR_MESSAGE);
}
}
return;
}
//after a successfull captcha validation you should hide it
//since you can use a code just once
content.removeAllComponents();
content.addComponent(new Label("Congratulations!"));
}
private Button createCancelBtn() {
return new Button("Cancel", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
Page.getCurrent().reload();
}
});
}
public class RegistrationBean {
private String login = "";
private String password = "";
private String passwordAgain = "";
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPasswordAgain() {
return passwordAgain;
}
public void setPasswordAgain(String passwordAgain) {
this.passwordAgain = passwordAgain;
}
}
public class RegistrationFields {
private TextField login;
private PasswordField password;
private PasswordField passwordAgain;
public RegistrationFields() {
login = new TextField("login");
login.setRequired(true);
login.setTabIndex(2);
password = new PasswordField("password");
password.setRequired(true);
password.setTabIndex(3);
passwordAgain = new PasswordField("retype password");
passwordAgain.setRequired(true);
passwordAgain.setTabIndex(4);
}
public TextField getLogin() {
return login;
}
public void setLogin(TextField login) {
this.login = login;
}
public PasswordField getPassword() {
return password;
}
public void setPassword(PasswordField password) {
this.password = password;
}
public PasswordField getPasswordAgain() {
return passwordAgain;
}
public void setPasswordAgain(PasswordField passwordAgain) {
this.passwordAgain = passwordAgain;
}
}
}
| [
"[email protected]"
] | |
e5e89be8b289bb76139d7605727d693c4d2ee3bb | 5845a87181dc36eee51c939c5b6a8b85d97331c4 | /gen/com/yondervision/mi/dto/Mi008Example.java | d08b68601b19370435862b86ecbadbe755aa0f87 | [] | no_license | yupomang/YBMAPLAST | 96cc4b5a617adc9e102fb8eda108a68e01487403 | ad4678c7a3e5cf0a7f63094a0f8326a424f4b428 | refs/heads/master | 2023-03-29T20:05:50.201626 | 2021-03-30T03:23:53 | 2021-03-30T03:23:53 | 352,857,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,314 | java | package com.yondervision.mi.dto;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Mi008Example {
/**
* This field was generated by Abator for iBATIS. This field corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
protected String orderByClause;
/**
* This field was generated by Abator for iBATIS. This field corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
protected List oredCriteria;
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public Mi008Example() {
oredCriteria = new ArrayList();
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
protected Mi008Example(Mi008Example example) {
this.orderByClause = example.orderByClause;
this.oredCriteria = example.oredCriteria;
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public List getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by Abator for iBATIS. This method corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public void clear() {
oredCriteria.clear();
}
/**
* This class was generated by Abator for iBATIS. This class corresponds to the database table MI008
* @abatorgenerated Fri Oct 04 15:07:58 CST 2013
*/
public static class Criteria {
protected List criteriaWithoutValue;
protected List criteriaWithSingleValue;
protected List criteriaWithListValue;
protected List criteriaWithBetweenValue;
protected Criteria() {
super();
criteriaWithoutValue = new ArrayList();
criteriaWithSingleValue = new ArrayList();
criteriaWithListValue = new ArrayList();
criteriaWithBetweenValue = new ArrayList();
}
public boolean isValid() {
return criteriaWithoutValue.size() > 0
|| criteriaWithSingleValue.size() > 0
|| criteriaWithListValue.size() > 0
|| criteriaWithBetweenValue.size() > 0;
}
public List getCriteriaWithoutValue() {
return criteriaWithoutValue;
}
public List getCriteriaWithSingleValue() {
return criteriaWithSingleValue;
}
public List getCriteriaWithListValue() {
return criteriaWithListValue;
}
public List getCriteriaWithBetweenValue() {
return criteriaWithBetweenValue;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteriaWithoutValue.add(condition);
}
protected void addCriterion(String condition, Object value,
String property) {
if (value == null) {
throw new RuntimeException("Value for " + property
+ " cannot be null");
}
Map map = new HashMap();
map.put("condition", condition);
map.put("value", value);
criteriaWithSingleValue.add(map);
}
protected void addCriterion(String condition, List values,
String property) {
if (values == null || values.size() == 0) {
throw new RuntimeException("Value list for " + property
+ " cannot be null or empty");
}
Map map = new HashMap();
map.put("condition", condition);
map.put("values", values);
criteriaWithListValue.add(map);
}
protected void addCriterion(String condition, Object value1,
Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property
+ " cannot be null");
}
List list = new ArrayList();
list.add(value1);
list.add(value2);
Map map = new HashMap();
map.put("condition", condition);
map.put("values", list);
criteriaWithBetweenValue.add(map);
}
public Criteria andSyskeyIsNull() {
addCriterion("SYSKEY is null");
return this;
}
public Criteria andSyskeyIsNotNull() {
addCriterion("SYSKEY is not null");
return this;
}
public Criteria andSyskeyEqualTo(String value) {
addCriterion("SYSKEY =", value, "syskey");
return this;
}
public Criteria andSyskeyNotEqualTo(String value) {
addCriterion("SYSKEY <>", value, "syskey");
return this;
}
public Criteria andSyskeyGreaterThan(String value) {
addCriterion("SYSKEY >", value, "syskey");
return this;
}
public Criteria andSyskeyGreaterThanOrEqualTo(String value) {
addCriterion("SYSKEY >=", value, "syskey");
return this;
}
public Criteria andSyskeyLessThan(String value) {
addCriterion("SYSKEY <", value, "syskey");
return this;
}
public Criteria andSyskeyLessThanOrEqualTo(String value) {
addCriterion("SYSKEY <=", value, "syskey");
return this;
}
public Criteria andSyskeyLike(String value) {
addCriterion("SYSKEY like", value, "syskey");
return this;
}
public Criteria andSyskeyNotLike(String value) {
addCriterion("SYSKEY not like", value, "syskey");
return this;
}
public Criteria andSyskeyIn(List values) {
addCriterion("SYSKEY in", values, "syskey");
return this;
}
public Criteria andSyskeyNotIn(List values) {
addCriterion("SYSKEY not in", values, "syskey");
return this;
}
public Criteria andSyskeyBetween(String value1, String value2) {
addCriterion("SYSKEY between", value1, value2, "syskey");
return this;
}
public Criteria andSyskeyNotBetween(String value1, String value2) {
addCriterion("SYSKEY not between", value1, value2, "syskey");
return this;
}
public Criteria andSysseqIsNull() {
addCriterion("SYSSEQ is null");
return this;
}
public Criteria andSysseqIsNotNull() {
addCriterion("SYSSEQ is not null");
return this;
}
public Criteria andSysseqEqualTo(Long value) {
addCriterion("SYSSEQ =", value, "sysseq");
return this;
}
public Criteria andSysseqNotEqualTo(Long value) {
addCriterion("SYSSEQ <>", value, "sysseq");
return this;
}
public Criteria andSysseqGreaterThan(Long value) {
addCriterion("SYSSEQ >", value, "sysseq");
return this;
}
public Criteria andSysseqGreaterThanOrEqualTo(Long value) {
addCriterion("SYSSEQ >=", value, "sysseq");
return this;
}
public Criteria andSysseqLessThan(Long value) {
addCriterion("SYSSEQ <", value, "sysseq");
return this;
}
public Criteria andSysseqLessThanOrEqualTo(Long value) {
addCriterion("SYSSEQ <=", value, "sysseq");
return this;
}
public Criteria andSysseqIn(List values) {
addCriterion("SYSSEQ in", values, "sysseq");
return this;
}
public Criteria andSysseqNotIn(List values) {
addCriterion("SYSSEQ not in", values, "sysseq");
return this;
}
public Criteria andSysseqBetween(Long value1, Long value2) {
addCriterion("SYSSEQ between", value1, value2, "sysseq");
return this;
}
public Criteria andSysseqNotBetween(Long value1, Long value2) {
addCriterion("SYSSEQ not between", value1, value2, "sysseq");
return this;
}
public Criteria andModitimeIsNull() {
addCriterion("MODITIME is null");
return this;
}
public Criteria andModitimeIsNotNull() {
addCriterion("MODITIME is not null");
return this;
}
public Criteria andModitimeEqualTo(String value) {
addCriterion("MODITIME =", value, "moditime");
return this;
}
public Criteria andModitimeNotEqualTo(String value) {
addCriterion("MODITIME <>", value, "moditime");
return this;
}
public Criteria andModitimeGreaterThan(String value) {
addCriterion("MODITIME >", value, "moditime");
return this;
}
public Criteria andModitimeGreaterThanOrEqualTo(String value) {
addCriterion("MODITIME >=", value, "moditime");
return this;
}
public Criteria andModitimeLessThan(String value) {
addCriterion("MODITIME <", value, "moditime");
return this;
}
public Criteria andModitimeLessThanOrEqualTo(String value) {
addCriterion("MODITIME <=", value, "moditime");
return this;
}
public Criteria andModitimeLike(String value) {
addCriterion("MODITIME like", value, "moditime");
return this;
}
public Criteria andModitimeNotLike(String value) {
addCriterion("MODITIME not like", value, "moditime");
return this;
}
public Criteria andModitimeIn(List values) {
addCriterion("MODITIME in", values, "moditime");
return this;
}
public Criteria andModitimeNotIn(List values) {
addCriterion("MODITIME not in", values, "moditime");
return this;
}
public Criteria andModitimeBetween(String value1, String value2) {
addCriterion("MODITIME between", value1, value2, "moditime");
return this;
}
public Criteria andModitimeNotBetween(String value1, String value2) {
addCriterion("MODITIME not between", value1, value2, "moditime");
return this;
}
}
} | [
"[email protected]"
] | |
1499b5d987ea30f0974cc5cc180d867da74f6602 | b77f586a3ed35d6e731816b0067eddbca1caf19b | /app/src/main/java/org/aotu/aotu/ui/activity/LoginActivity.java | b7c32153b08a470886e98848f7f4a7bb9a85e63f | [] | no_license | qq254814414/Aotu-app | 78cbb3255cb21a123699d027e9d741485e219c1b | bff29062883c79ab3375406f94cb53f3d6c3e50a | refs/heads/master | 2020-03-27T14:49:51.422046 | 2018-08-30T01:42:17 | 2018-08-30T01:42:17 | 146,681,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package org.aotu.aotu.ui.activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import org.aotu.aotu.R;
import org.aotu.aotu.ui.fragment.LoginFragment;
import org.aotu.aotu.utils.PageChangeUtil;
public class LoginActivity extends AppCompatActivity{
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment);
PageChangeUtil.replaceFragment(this,R.id.activity_fragment,new LoginFragment());
}
}
| [
"[email protected]"
] | |
f67cffd7ed529015f624aa683813f15962fbb0e3 | acffbdfac1fe26c70da96877284d81d1ad6e32f1 | /app/src/main/java/com/homenet/mofangwl/MFWLApplication.java | 15e8c9e75921a13870960481d093c57d305340f8 | [] | no_license | JimmyByte/MoFangWL | 3b49780533bb111635076be13c411ac566506de7 | 16289c3d82b49e5626b36ca4d0173277675a6f18 | refs/heads/master | 2023-01-14T18:03:21.042278 | 2018-05-25T06:44:02 | 2018-05-25T06:44:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package com.homenet.mofangwl;
import android.app.Application;
import com.homenet.mofangwl.net.GlobalConfig;
import timber.log.Timber;
/**
* Created by weijunpeng on 2018/5/23.
*/
public class MFWLApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
GlobalConfig.init(this)
.withApiHost("http://123.57.31.11/androidnet/")
.withIsReleased(false)
.configure();
//log过滤打印树
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
}
}
| [
"[email protected]"
] | |
ef9bdd2fe1fb0b9411e2eb55ab551b1df914c15d | 60eaa3bd822f7e95d66f67f5f5b0b35b75860aba | /keeper-examples/keeper-spring-boot-jwt-redis/src/main/java/com/example/keeper/config/KeeperBeanConfig.java | 960cf415522cd7d7e57da580a10352e2b0167623 | [
"Apache-2.0"
] | permissive | g5niusx/keeper | cb3b9340c377da182e6ee8430aa7b09f7fb6f07a | 0f7653a46569e536335d08664826d14436b41fa2 | refs/heads/master | 2020-05-07T01:19:07.817066 | 2019-04-09T12:35:51 | 2019-04-09T12:35:51 | 180,269,517 | 0 | 0 | Apache-2.0 | 2019-04-09T12:35:51 | 2019-04-09T02:31:39 | Java | UTF-8 | Java | false | false | 2,849 | java | package com.example.keeper.config;
import com.example.keeper.model.Response;
import com.example.keeper.service.UserService;
import io.github.biezhi.keeper.Keeper;
import io.github.biezhi.keeper.core.cache.redis.AuthenticRedisCache;
import io.github.biezhi.keeper.core.cache.redis.AuthorizeRedisCache;
import io.github.biezhi.keeper.core.cache.redis.LogoutRedisCache;
import io.github.biezhi.keeper.core.web.filter.JwtAuthenticFilter;
import io.github.biezhi.keeper.enums.SubjectType;
import io.github.biezhi.keeper.utils.WebUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.Duration;
@Configuration
public class KeeperBeanConfig extends WebMvcConfigurationSupport {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedHeaders("*")
.allowedMethods("*")
.allowedOrigins("*");
}
@Bean
public AuthorizeRedisCache authorizeRedisCache(StringRedisTemplate stringRedisTemplate) {
// return new AuthorizeRedisCache(stringRedisTemplate, Duration.ofMinutes(10));
return new AuthorizeRedisCache(stringRedisTemplate, Duration.ofSeconds(10));
}
@Bean
public JwtAuthenticFilter jwtAuthenticFilter() {
return new JwtAuthenticFilter() {
@Override
protected void initFilterBean() {
this.addPathPatterns("/**")
.excludePathPatterns("/guest", "/login");
}
@Override
protected void unAuthentic(HttpServletRequest request, HttpServletResponse response) {
WebUtil.writeJSON(response,
Response.<String>builder().code(500)
.msg("请登录后访问")
.build());
}
};
}
@Bean
public KeeperAuthorizeBean keeperAuthorizeBean(UserService userService, StringRedisTemplate stringRedisTemplate) {
return new KeeperAuthorizeBean(userService, stringRedisTemplate);
}
@Bean
@Primary
public Keeper initKeeper(Keeper keeper, StringRedisTemplate stringRedisTemplate) {
keeper.setSubjectType(SubjectType.JWT);
keeper.setAuthenticInfoCache(new AuthenticRedisCache(stringRedisTemplate));
keeper.setLogoutCache(new LogoutRedisCache(stringRedisTemplate));
return keeper;
}
}
| [
"[email protected]"
] | |
b13daa902639c00edcf41dbdbb60a512468053ff | 1b394467e21db4c18ed00cf87fa276489473dee2 | /DrawCut/src/main/java/com/mthoresen/drawcut/ui/activitiy/SettingsActivity.java | 2be1757f47b632987385f1bd27a77b3c28217afe | [] | no_license | martinhath/drawcut | 81d67525d85ec073d1f8667a7db45b745138c7b7 | afd4f7ceb9e19f4329ab8b7f638f5288fbadc3ce | refs/heads/master | 2016-09-10T16:00:17.709523 | 2014-01-29T22:54:37 | 2014-01-29T22:54:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.mthoresen.drawcut.ui.activitiy;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import com.mthoresen.drawcut.R;
import com.mthoresen.drawcut.ui.fragment.PrefsFragment;
public class SettingsActivity extends Activity {
private Fragment content;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_container);
if (savedInstanceState == null) {
content = new PrefsFragment();
getFragmentManager().beginTransaction().add(R.id.container, content).commit();
}
}
}
| [
"[email protected]"
] | |
76974d9a8edae96144fa8cfdc78d387c057133d4 | 4827fc49c3ab3f5c0e2adbb63a7f13c9eb0b8a8e | /user-core/src/main/java/com/jarvis/user/entity/UserRole.java | 4dbbdfaf995c66f89649ce3fab1f0980307baafa | [] | no_license | zhuzhengfang/jarvis | b723bf2d07634a1c0ed549fd2d3ffcbce92ed453 | e8c5aa698ced2f74e6687cfdc9a76eac183b4981 | refs/heads/master | 2021-10-20T00:16:07.190822 | 2019-02-25T02:23:10 | 2019-02-25T02:23:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | package com.jarvis.user.entity;
import com.jarvis.base.entity.BaseEntity;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.hibernate.annotations.Type;
import javax.persistence.Column;
import javax.persistence.Entity;
/**
* Created by jian on 18-3-9
*/
@Entity
public class UserRole extends BaseEntity {
/**
* 角色名
*/
@Column(length = 20,nullable = false)
private String name;
/**
* 是否全局角色
*/
@Column(nullable = false)
@Type(type = "yes_no")
private Boolean globalRole;
/**
* 关联机构id
*/
private Long orgRefId;
/**
* 是否有效
*/
@Column(nullable = false)
@Type(type = "yes_no")
private Boolean enabled;
/**
* 备注
*/
private String memo;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getGlobalRole() {
return globalRole;
}
public void setGlobalRole(Boolean globalRole) {
this.globalRole = globalRole;
}
public Long getOrgRefId() {
return orgRefId;
}
public void setOrgRefId(Long orgRefId) {
this.orgRefId = orgRefId;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
}
| [
"[email protected]"
] | |
f8335174a08587d5cfe2d420644e7c42827b7a12 | 5f7128c60aec42751ee7278083071d835e178a97 | /app/src/main/java/com/ptapp/io/model/Branch.java | a3d1eea2ee283e50406117fd4c97b9b5814410b5 | [] | no_license | uday144/PTA | 8e56428e2ac6759d6bb77cec807d9bdf6e66029c | ac1455bfd1dfa7033177bb391802349458d50c48 | refs/heads/master | 2016-09-06T02:02:09.415650 | 2015-03-13T03:28:33 | 2015-03-13T03:28:33 | 32,125,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package com.ptapp.io.model;
/**
* This class is our model and contains the data we will save in the database
* and show in the user interface.
*/
public class Branch {
// private variables
public int BranchId;
public String BranchName;
public String Email;
public String Phone;
public String CountryISOCode;
public int AddressId;
public int InstituteId;
// Empty constructor
public Branch() {
}
}
| [
"[email protected]"
] | |
fda48658efe21c97f4659e2775aeeec7f98ea7a5 | 3cd364307c005f65b03c42555f32c6ac8f0818ec | /infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/sane/postgresql/PostgreSQLSaneQueryResultEngine.java | 452952dd0a9e4e5175dde16ddeee2771fc4132b9 | [
"Apache-2.0"
] | permissive | tristaZero/incubator-shardingsphere | 3f7dbd901c65b7dcca8b7e679a8e3fe5d59ab7c4 | 4dd471b2c4f0e3956cb284a095da02e0e088e412 | refs/heads/master | 2023-02-07T02:24:23.561349 | 2023-01-19T03:28:59 | 2023-01-19T03:28:59 | 218,487,520 | 1 | 1 | Apache-2.0 | 2019-10-30T09:14:23 | 2019-10-30T09:14:23 | null | UTF-8 | Java | false | false | 1,622 | 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.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.sane.postgresql;
import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.sane.SaneQueryResultEngine;
import org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import java.sql.SQLException;
import java.util.Optional;
/**
* Sane query result engine for PostgreSQL.
*/
public final class PostgreSQLSaneQueryResultEngine implements SaneQueryResultEngine {
@Override
public Optional<ExecuteResult> getSaneQueryResult(final SQLStatement sqlStatement, final SQLException ex) {
return Optional.empty();
}
@Override
public String getType() {
return "PostgreSQL";
}
}
| [
"[email protected]"
] | |
328d2c156a45d590e7b17a3431ff3b5c7f071744 | a715e8312a90d099b72c24e5b7da1372c9fe67fb | /android/android/testSrc/com/android/tools/idea/rendering/ProjectResourceRepositoryTest.java | f8c1e6af54a27ca3b1638327deaa9f0d7993111f | [
"Apache-2.0"
] | permissive | wiltonlazary/bugvm-studio | ff98c1beca1f890013aa05ecd67f137a14a70c32 | 5861389424a51181c58178576c78cf35c0ceb1b5 | refs/heads/master | 2021-01-24T20:58:41.730805 | 2015-12-18T19:34:14 | 2015-12-18T19:34:14 | 56,322,614 | 2 | 1 | null | 2016-04-15T13:34:56 | 2016-04-15T13:34:56 | null | UTF-8 | Java | false | false | 15,918 | java | /*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.idea.rendering;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.builder.model.AndroidProject;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.res2.ResourceItem;
import com.android.resources.ResourceType;
import com.android.tools.idea.gradle.IdeaAndroidProject;
import com.android.tools.idea.gradle.TestProjects;
import com.android.tools.idea.gradle.stubs.android.AndroidLibraryStub;
import com.android.tools.idea.gradle.stubs.android.AndroidProjectStub;
import com.android.tools.idea.gradle.stubs.android.VariantStub;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleWithNameAlreadyExists;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.TestFixtureBuilder;
import org.jetbrains.android.AndroidTestCase;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.util.AndroidUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.util.GradleConstants;
import java.io.File;
import java.util.*;
import static com.android.tools.idea.rendering.ModuleResourceRepositoryTest.getFirstItem;
public class ProjectResourceRepositoryTest extends AndroidTestCase {
private static final String LAYOUT = "resourceRepository/layout.xml";
private static final String VALUES = "resourceRepository/values.xml";
private static final String VALUES_OVERLAY1 = "resourceRepository/valuesOverlay1.xml";
private static final String VALUES_OVERLAY2 = "resourceRepository/valuesOverlay2.xml";
private static final String VALUES_OVERLAY2_NO = "resourceRepository/valuesOverlay2No.xml";
public void testStable() {
assertSame(ProjectResourceRepository.getProjectResources(myFacet, true), ProjectResourceRepository.getProjectResources(myFacet, true));
assertSame(ProjectResourceRepository.getProjectResources(myFacet, true), ProjectResourceRepository.getProjectResources(myModule, true));
}
// Ensure that we invalidate the id cache when the file is rescanned but ids don't change
// (this was broken)
public void testInvalidateIds() {
// Like testOverlayUpdates1, but rather than testing changes to layout resources (file-based resource)
// perform document edits in value-documents
VirtualFile layoutFile = myFixture.copyFileToProject(LAYOUT, "res/layout/layout1.xml");
VirtualFile res1 = myFixture.copyFileToProject(VALUES, "res/values/values.xml").getParent().getParent();
VirtualFile res2 = myFixture.copyFileToProject(VALUES_OVERLAY1, "res2/values/values.xml").getParent().getParent();
VirtualFile res3 = myFixture.copyFileToProject(VALUES_OVERLAY2, "res3/values/nameDoesNotMatter.xml").getParent().getParent();
myFixture.copyFileToProject(VALUES_OVERLAY2_NO, "res3/values-no/values.xml");
assertNotSame(res1, res2);
assertNotSame(res1, res3);
assertNotSame(res2, res3);
// Just need an empty repository to make it a real module -set-; otherwise with a single
// module we just get a module repository, not a module set repository
LocalResourceRepository other = new LocalResourceRepository("unit test") {
@NonNull
@Override
protected Map<ResourceType, ListMultimap<String, ResourceItem>> getMap() {
return Collections.emptyMap();
}
@Nullable
@Override
protected ListMultimap<String, ResourceItem> getMap(ResourceType type, boolean create) {
return ArrayListMultimap.create();
}
};
ModuleResourceRepository module = ModuleResourceRepository.createForTest(myFacet, Arrays.asList(res1, res2, res3));
final ProjectResourceRepository resources = ProjectResourceRepository.createForTest(myFacet, Arrays.asList(module, other));
PsiFile layoutPsiFile = PsiManager.getInstance(getProject()).findFile(layoutFile);
assertNotNull(layoutPsiFile);
assertTrue(resources.hasResourceItem(ResourceType.ID, "btn_title_refresh"));
final PsiResourceItem item = getFirstItem(resources, ResourceType.ID, "btn_title_refresh");
final long generation = resources.getModificationCount();
final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject());
final Document document = documentManager.getDocument(layoutPsiFile);
assertNotNull(document);
WriteCommandAction.runWriteCommandAction(null, new Runnable() {
@Override
public void run() {
String string = "<ImageView style=\"@style/TitleBarSeparator\" />";
int offset = document.getText().indexOf(string);
document.deleteString(offset, offset + string.length());
documentManager.commitDocument(document);
}
});
assertTrue(resources.isScanPending(layoutPsiFile));
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
assertTrue(generation < resources.getModificationCount());
// Should still be defined:
assertTrue(resources.hasResourceItem(ResourceType.ID, "btn_title_refresh"));
PsiResourceItem newItem = getFirstItem(resources, ResourceType.ID, "btn_title_refresh");
assertNotNull(newItem.getSource());
// However, should be a different item
assertNotSame(item, newItem);
}
});
}
// Regression test for https://code.google.com/p/android/issues/detail?id=57090
public void testParents() {
myFixture.copyFileToProject(LAYOUT, "res/layout/layout1.xml");
List<AndroidFacet> libraries = AndroidUtils.getAllAndroidDependencies(myModule, true);
assertEquals(2, libraries.size());
ModuleRootModificationUtil.addDependency(libraries.get(0).getModule(), libraries.get(1).getModule());
addArchiveLibraries();
ProjectResourceRepository repository = ProjectResourceRepository.create(myFacet);
assertEquals(3, repository.getChildCount());
Collection<String> items = repository.getItemsOfType(ResourceType.STRING);
assertTrue(items.isEmpty());
for (AndroidFacet facet : libraries) {
LocalResourceRepository moduleRepository = facet.getModuleResources(true);
assertNotNull(moduleRepository);
LocalResourceRepository moduleSetRepository = facet.getProjectResources(true);
assertNotNull(moduleSetRepository);
LocalResourceRepository librarySetRepository = facet.getAppResources(true);
assertNotNull(librarySetRepository);
}
myFacet.getModuleResources(true);
myFacet.getProjectResources(true);
myFacet.getAppResources(true);
}
private void addArchiveLibraries() {
// Add in some Android projects too
myFacet.getProperties().ALLOW_USER_CONFIGURATION = false; // make it a Gradle project
AndroidProjectStub androidProject = TestProjects.createFlavorsProject();
VariantStub variant = androidProject.getFirstVariant();
assertNotNull(variant);
File rootDir = androidProject.getRootDir();
IdeaAndroidProject ideaAndroidProject = new IdeaAndroidProject(GradleConstants.SYSTEM_ID, androidProject.getName(), rootDir,
androidProject, variant.getName(), AndroidProject.ARTIFACT_ANDROID_TEST);
myFacet.setIdeaAndroidProject(ideaAndroidProject);
File bundle = new File(rootDir, "bundle.aar");
File libJar = new File(rootDir, "bundle_aar" + File.separatorChar + "library.jar");
AndroidLibraryStub library = new AndroidLibraryStub(bundle, libJar);
variant.getMainArtifact().getDependencies().addLibrary(library);
}
@Override
protected void configureAdditionalModules(@NotNull TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder,
@NotNull List<MyAdditionalModuleData> modules) {
final String testName = getTestName(true);
if (testName.equals("parents")) { // for unit test testDependencies
addModuleWithAndroidFacet(projectBuilder, modules, "plib1", true);
addModuleWithAndroidFacet(projectBuilder, modules, "plib2", true);
} else if (testName.equals("dependencies")) { // for unit test testDependencies
addModuleWithAndroidFacet(projectBuilder, modules, "sharedlib", true);
addModuleWithAndroidFacet(projectBuilder, modules, "lib1", true);
addModuleWithAndroidFacet(projectBuilder, modules, "lib2", true);
addModuleWithAndroidFacet(projectBuilder, modules, "app", true);
}
}
// Regression test for https://code.google.com/p/android/issues/detail?id=65140
public void testDependencies() throws Exception {
myFixture.copyFileToProject(LAYOUT, "res/layout/layout1.xml");
Module lib1 = null;
Module lib2 = null;
Module sharedLib = null;
Module app = null;
for (Module module : ModuleManager.getInstance(getProject()).getModules()) {
if (module != myModule) {
VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
assertEquals(1, contentRoots.length);
String name = contentRoots[0].getName();
if (name.equals("lib1")) {
lib1 = module;
}
else if (name.equals("lib2")) {
lib2 = module;
}
else if (name.equals("sharedlib")) {
sharedLib = module;
}
else if (name.equals("app")) {
app = module;
} else {
fail(name);
}
}
}
assertNotNull(lib1);
assertNotNull(lib2);
assertNotNull(sharedLib);
assertNotNull(app);
renameModule(lib1, "lib1");
renameModule(lib2, "lib2");
renameModule(sharedLib, "sharedLib");
renameModule(app, "app");
AndroidFacet lib1Facet = AndroidFacet.getInstance(lib1);
AndroidFacet lib2Facet = AndroidFacet.getInstance(lib2);
AndroidFacet sharedLibFacet = AndroidFacet.getInstance(sharedLib);
AndroidFacet appFacet = AndroidFacet.getInstance(app);
assertNotNull(lib1Facet);
assertNotNull(lib2Facet);
assertNotNull(sharedLibFacet);
assertNotNull(appFacet);
// Set up project dependencies
addModuleDependency(lib1, sharedLib);
addModuleDependency(lib2, sharedLib);
addModuleDependency(app, lib1);
addModuleDependency(app, lib2);
assertTrue(ModuleRootManager.getInstance(app).isDependsOn(lib1));
assertTrue(ModuleRootManager.getInstance(lib1).isDependsOn(sharedLib));
assertFalse(ModuleRootManager.getInstance(sharedLib).isDependsOn(lib1));
assertFalse(ModuleRootManager.getInstance(lib2).isDependsOn(lib1));
// Note that these are currently direct dependencies only, so app.isDependsOn(sharedLib) is false
// Test AndroidUtils#getallAndroidDependencies
List<AndroidFacet> appDependsOn = AndroidUtils.getAllAndroidDependencies(app, true);
assertTrue(appDependsOn.contains(lib1Facet));
assertTrue(appDependsOn.contains(lib2Facet));
assertTrue(appDependsOn.contains(sharedLibFacet));
assertFalse(appDependsOn.contains(appFacet));
List<AndroidFacet> lib1DependsOn = AndroidUtils.getAllAndroidDependencies(lib1, true);
assertTrue(lib1DependsOn.contains(sharedLibFacet));
assertFalse(lib1DependsOn.contains(appFacet));
assertFalse(lib1DependsOn.contains(lib1Facet));
assertFalse(lib1DependsOn.contains(lib2Facet));
// Set up resources so we can check which values are inherited through module dependencies
VirtualFile v1 = myFixture.copyFileToProject(VALUES, "additionalModules/sharedlib/res/values/sharedvalues.xml");
VirtualFile v2 = myFixture.copyFileToProject(VALUES_OVERLAY1, "additionalModules/lib2/res/values/lib2values.xml");
assertNotNull(v1);
assertNotNull(v2);
PsiManager manager = PsiManager.getInstance(getProject());
PsiFile sharedLibValues = manager.findFile(v1);
PsiFile lib2Values = manager.findFile(v2);
assertNotNull(sharedLibValues);
assertNotNull(lib2Values);
final AppResourceRepository lib1Resources = lib1Facet.getAppResources(true);
final AppResourceRepository lib2Resources = lib2Facet.getAppResources(true);
assertNotNull(lib1Resources);
assertNotNull(lib2Resources);
assertNotSame(lib1Resources, lib2Resources);
assertFalse(lib1Resources.isScanPending(sharedLibValues));
assertFalse(lib1Resources.isScanPending(lib2Values));
assertFalse(lib2Resources.isScanPending(sharedLibValues));
assertFalse(lib2Resources.isScanPending(lib2Values));
assertTrue(lib1Resources.hasResourceItem(ResourceType.PLURALS, "my_plural"));
assertTrue(lib1Resources.hasResourceItem(ResourceType.STRING, "ellipsis"));
assertTrue(lib1Resources.hasResourceItem(ResourceType.ARRAY, "security_questions"));
List<ResourceItem> items = lib1Resources.getResourceItem(ResourceType.STRING, "ellipsis");
assertNotNull(items);
ResourceValue firstValue = items.get(0).getResourceValue(false);
assertNotNull(firstValue);
assertEquals("Here it is: \u2026!", firstValue.getValue());
assertTrue(lib2Resources.hasResourceItem(ResourceType.ARRAY, "security_questions"));
assertTrue(lib2Resources.hasResourceItem(ResourceType.PLURALS, "my_plural"));
assertTrue(lib2Resources.hasResourceItem(ResourceType.STRING, "ellipsis"));
// ONLY defined in lib2: should not be visible from lib1
assertTrue(lib2Resources.hasResourceItem(ResourceType.STRING, "unique_string"));
items = lib2Resources.getResourceItem(ResourceType.STRING, "unique_string");
assertNotNull(items);
firstValue = items.get(0).getResourceValue(false);
assertNotNull(firstValue);
assertEquals("Unique", firstValue.getValue());
assertFalse(lib1Resources.hasResourceItem(ResourceType.STRING, "unique_string"));
}
private static void addModuleDependency(Module from, Module to) {
final ModifiableRootModel model = ModuleRootManager.getInstance(from).getModifiableModel();
model.addModuleOrderEntry(to);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
model.commit();
}
});
}
private static void renameModule(Module from, String name) throws ModuleWithNameAlreadyExists {
final ModifiableModuleModel model = ModuleManager.getInstance(from.getProject()).getModifiableModel();
model.renameModule(from, name);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
model.commit();
}
});
}
// Note that the project resource repository is also tested in the app resource repository test, which of course merges
// project resources with libraries
}
| [
"[email protected]"
] | |
1a567c102ae2c6d2bc793e89ced1dc64cbf4f13b | c49250c4f1b4044fd383bcdb821ed5b97be993b4 | /src/test/java/com/test/MyTest.java | 552c9d420302dc4fa8c7862680069fd92434647c | [] | no_license | fengyong7723131/javaweb_technical_summary | 4ed8091bbe06ae5d13ef80ad2e58f6c2afd2e86f | 110f5a30d4afbcddc9d2f97d962a4fa62fc75b9c | refs/heads/master | 2020-04-10T03:10:14.471953 | 2018-12-07T03:58:51 | 2018-12-07T03:58:51 | 160,762,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,624 | java | package com.test;
import org.springframework.util.Base64Utils;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import java.security.Key;
public class MyTest {
/**
* 加密
*
* @param key
* @param text
* @return
* @throws Exception
*/
public static byte[] encrypt(Key key, String text) throws Exception {
Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(text.getBytes());
}
/**
* 解密
*
* @param key
* @param text
* @return
* @throws Exception
*/
public static byte[] decrypt(Key key, byte[] bt) throws Exception {
Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(bt);
}
/**
* @return
* @throws Exception
*/
public static Key keyGenerator() throws Exception {
KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
keyGenerator.init(128);
return keyGenerator.generateKey();
}
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
Key key = keyGenerator();
System.out.println("Key : " + Base64Utils.encode(key.getEncoded()));
String src = "/system/";
byte[] target = encrypt(key, src);
System.out.println("密文: " + Base64Utils.encode(target));
System.out.println("明文: " + new String(decrypt(key, target)));
}
} | [
"[email protected]"
] | |
d527b16a84986d9571aefe96d2692160c3569b55 | c19cb77e3958a194046d6f84ca97547cc3a223c3 | /core/src/test/jdk1.3/org/bouncycastle/crypto/test/Argon2Test.java | 5cc744c21a5bc525e8c6c475a8b1c355d279f8e7 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bcgit/bc-java | 1b6092bc5d2336ec26ebd6da6eeaea6600b4c70a | 62b03c0f704ebd243fe5f2d701aef4edd77bba6e | refs/heads/main | 2023-09-04T00:48:33.995258 | 2023-08-30T05:33:42 | 2023-08-30T05:33:42 | 10,416,648 | 1,984 | 1,021 | MIT | 2023-08-26T05:14:28 | 2013-06-01T02:38:42 | Java | UTF-8 | Java | false | false | 8,129 | java | package org.bouncycastle.crypto.test;
import org.bouncycastle.crypto.generators.Argon2BytesGenerator;
import org.bouncycastle.crypto.params.Argon2Parameters;
import org.bouncycastle.util.Strings;
import org.bouncycastle.util.encoders.Hex;
import org.bouncycastle.util.test.SimpleTest;
/**
* Tests from https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03
*
*/
public class Argon2Test
extends SimpleTest
{
private static final int DEFAULT_OUTPUTLEN = 32;
public String getName()
{
return "ArgonTest";
}
public void performTest()
throws Exception
{
if (getJvmVersion() < 7)
{
return;
}
testVectorsFromInternetDraft();
int version = Argon2Parameters.ARGON2_VERSION_10;
/* Multiple test cases for various input values */
hashTest(version, 2, 16, 1, "password", "somesalt",
"f6c4db4a54e2a370627aff3db6176b94a2a209a62c8e36152711802f7b30c694", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 20, 1, "password", "somesalt",
"9690ec55d28d3ed32562f2e73ea62b02b018757643a2ae6e79528459de8106e9",
DEFAULT_OUTPUTLEN);
hashTest(version, 2, 18, 1, "password", "somesalt",
"3e689aaa3d28a77cf2bc72a51ac53166761751182f1ee292e3f677a7da4c2467",
DEFAULT_OUTPUTLEN);
hashTest(version, 2, 8, 1, "password", "somesalt",
"fd4dd83d762c49bdeaf57c47bdcd0c2f1babf863fdeb490df63ede9975fccf06",
DEFAULT_OUTPUTLEN);
hashTest(version, 2, 8, 2, "password", "somesalt",
"b6c11560a6a9d61eac706b79a2f97d68b4463aa3ad87e00c07e2b01e90c564fb", DEFAULT_OUTPUTLEN);
hashTest(version, 1, 16, 1, "password", "somesalt",
"81630552b8f3b1f48cdb1992c4c678643d490b2b5eb4ff6c4b3438b5621724b2", DEFAULT_OUTPUTLEN);
hashTest(version, 4, 16, 1, "password", "somesalt",
"f212f01615e6eb5d74734dc3ef40ade2d51d052468d8c69440a3a1f2c1c2847b", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 16, 1, "differentpassword", "somesalt",
"e9c902074b6754531a3a0be519e5baf404b30ce69b3f01ac3bf21229960109a3", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 16, 1, "password", "diffsalt",
"79a103b90fe8aef8570cb31fc8b22259778916f8336b7bdac3892569d4f1c497", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 16, 1, "password", "diffsalt",
"1a097a5d1c80e579583f6e19c7e4763ccb7c522ca85b7d58143738e12ca39f8e6e42734c950ff2463675b97c37ba" +
"39feba4a9cd9cc5b4c798f2aaf70eb4bd044c8d148decb569870dbd923430b82a083f284beae777812cce18cdac68ee8ccef" +
"c6ec9789f30a6b5a034591f51af830f4",
112);
version = Argon2Parameters.ARGON2_VERSION_13;
/* Multiple test cases for various input values */
hashTest(version, 2, 16, 1, "password", "somesalt",
"c1628832147d9720c5bd1cfd61367078729f6dfb6f8fea9ff98158e0d7816ed0",
DEFAULT_OUTPUTLEN);
hashTest(version, 2, 20, 1, "password", "somesalt",
"d1587aca0922c3b5d6a83edab31bee3c4ebaef342ed6127a55d19b2351ad1f41", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 18, 1, "password", "somesalt",
"296dbae80b807cdceaad44ae741b506f14db0959267b183b118f9b24229bc7cb", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 8, 1, "password", "somesalt",
"89e9029f4637b295beb027056a7336c414fadd43f6b208645281cb214a56452f", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 8, 2, "password", "somesalt",
"4ff5ce2769a1d7f4c8a491df09d41a9fbe90e5eb02155a13e4c01e20cd4eab61", DEFAULT_OUTPUTLEN);
hashTest(version, 1, 16, 1, "password", "somesalt",
"d168075c4d985e13ebeae560cf8b94c3b5d8a16c51916b6f4ac2da3ac11bbecf", DEFAULT_OUTPUTLEN);
hashTest(version, 4, 16, 1, "password", "somesalt",
"aaa953d58af3706ce3df1aefd4a64a84e31d7f54175231f1285259f88174ce5b", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 16, 1, "differentpassword", "somesalt",
"14ae8da01afea8700c2358dcef7c5358d9021282bd88663a4562f59fb74d22ee", DEFAULT_OUTPUTLEN);
hashTest(version, 2, 16, 1, "password", "diffsalt",
"b0357cccfbef91f3860b0dba447b2348cbefecadaf990abfe9cc40726c521271", DEFAULT_OUTPUTLEN);
}
private void hashTest(int version, int iterations, int memory, int parallelism,
String password, String salt, String passwordRef, int outputLength)
{
Argon2Parameters.Builder builder = new Argon2Parameters.Builder(Argon2Parameters.ARGON2_i)
.withVersion(version)
.withIterations(iterations)
.withMemoryPowOfTwo(memory)
.withParallelism(parallelism)
.withSalt(Strings.toByteArray(salt));
//
// Set the password.
//
Argon2BytesGenerator gen = new Argon2BytesGenerator();
gen.init(builder.build());
byte[] result = new byte[outputLength];
gen.generateBytes(password.toCharArray(), result, 0, result.length);
isTrue(passwordRef + " Failed", areEqual(result, Hex.decode(passwordRef)));
}
/**
* Tests from https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03
*
* @throws Exception
*/
private void testVectorsFromInternetDraft()
{
byte[] ad = Hex.decode("040404040404040404040404");
byte[] secret = Hex.decode("0303030303030303");
byte[] salt = Hex.decode("02020202020202020202020202020202");
byte[] password = Hex.decode("0101010101010101010101010101010101010101010101010101010101010101");
Argon2Parameters.Builder builder = new Argon2Parameters.Builder(Argon2Parameters.ARGON2_d)
.withVersion(Argon2Parameters.ARGON2_VERSION_13) // 19
.withIterations(3)
.withMemoryAsKB(32)
.withParallelism(4)
.withAdditional(ad)
.withSecret(secret)
.withSalt(salt);
Argon2BytesGenerator dig = new Argon2BytesGenerator();
dig.init(builder.build());
byte[] result = new byte[32];
dig.generateBytes(password, result);
isTrue("Argon 2d Failed", areEqual(result, Hex.decode("512b391b6f1162975371d30919734294f" +
"868e3be3984f3c1a13a4db9fabe4acb")));
builder = new Argon2Parameters.Builder(Argon2Parameters.ARGON2_i)
.withVersion(Argon2Parameters.ARGON2_VERSION_13) // 19
.withIterations(3)
.withMemoryAsKB(32)
.withParallelism(4)
.withAdditional(ad)
.withSecret(secret)
.withSalt(salt);
dig = new Argon2BytesGenerator();
dig.init(builder.build());
result = new byte[32];
dig.generateBytes(password, result);
isTrue("Argon 2i Failed", areEqual(result, Hex.decode("c814d9d1dc7f37aa13f0d77f2494bda1c8de6b016" +
"dd388d29952a4c4672b6ce8")));
builder = new Argon2Parameters.Builder(Argon2Parameters.ARGON2_id)
.withVersion(Argon2Parameters.ARGON2_VERSION_13) // 19
.withIterations(3)
.withMemoryAsKB(32)
.withParallelism(4)
.withAdditional(ad)
.withSecret(secret)
.withSalt(salt);
dig = new Argon2BytesGenerator();
dig.init(builder.build());
result = new byte[32];
dig.generateBytes(password, result);
isTrue("Argon 2id Failed", areEqual(result, Hex.decode("0d640df58d78766c08c037a34a8b53c9d01ef0452" +
"d75b65eb52520e96b01e659")));
}
private static int getJvmVersion()
{
String version = System.getProperty("java.version");
if (version.startsWith("1.7"))
{
return 7;
}
if (version.startsWith("1.8"))
{
return 8;
}
if (version.startsWith("1.9"))
{
return 9;
}
if (version.startsWith("1.1"))
{
return 10;
}
return -1;
}
public static void main(String[] args)
{
runTest(new Argon2Test());
}
}
| [
"[email protected]"
] | |
4ed45177dd7d3f31aca17a3b1eaffb8e171ee980 | 2dd712ce85ee8ff2ee693722632cdb727a54ba73 | /chapter_007_1/src/main/java/ru/job4j/servlets/FindByRole.java | 814ed84e12e825e7411ef503d3bfc4760aeca3e3 | [
"Apache-2.0"
] | permissive | YuryMatskevich/job4j | 89ab4a9b1b26fd85f0c57727431fc9015c812e79 | 12b9c26a12712308bc53350961168506dae5c52c | refs/heads/master | 2021-09-22T09:37:04.502710 | 2018-08-21T15:19:51 | 2018-08-21T15:19:51 | 114,556,371 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,605 | java | package ru.job4j.servlets;
import ru.job4j.model.pojo.Roles;
import ru.job4j.model.pojo.User;
import ru.job4j.model.validate.Validate;
import ru.job4j.model.validate.ValidateService;
import ru.job4j.servlets.utils.AppUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;
/**
* @author Yury Matskevich
*/
@WebServlet("/findByRole")
public class FindByRole extends HttpServlet {
private final Validate validate = ValidateService.getInstance();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setAttribute("roles", Roles.values());
req.getRequestDispatcher("/WEB-INF/views/findByRole.jsp").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String role = req.getParameter("role");
User user = AppUtils.getLoginedUser(req.getSession());
String page;
if (user.getRole().equals(Roles.USER)) {
page = "userView.jsp";
} else {
List<User> users = validate.findByRole(AppUtils.toRoles(role));
req.setAttribute("users", users);
if (user.getRole().equals(Roles.MODERATOR)) {
page = "moderView.jsp";
} else {
page = "adminView.jsp";
}
}
req.getRequestDispatcher(String.format("/WEB-INF/views/%s", page)).forward(req, resp);
}
}
| [
"[email protected]"
] | |
30aef5a62d13cde1d2d055a820d8642bf8245550 | 12cee9abfc6c361e04c4df8d3340030c2d297019 | /Tencenttv/src/com/oepn/settingd/library/processutil/models/ProcFile.java | 87be5ce147962887f96c24ec9bb9e9ccedaee5ea | [] | no_license | CodeChina888/TenventTVEclipse | 94c861c816eb3b46426ec171a3db3973b4f0d105 | 1ca940e134fd7846da338259493d57be4960284e | refs/heads/master | 2022-10-22T06:07:05.913623 | 2017-07-27T07:12:38 | 2017-07-27T07:12:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,441 | java | /*
* Copyright (C) 2015. Jared Rummler <[email protected]>
*
* 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.oepn.settingd.library.processutil.models;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class ProcFile extends File implements Parcelable {
/**
* Read the contents of a file.
*
* @param path
* the absolute path to the file.
* @return the contents of the file.
* @throws IOException
* if an error occurred while reading.
*/
protected static String readFile(String path) throws IOException {
BufferedReader reader = null;
try {
StringBuilder output = new StringBuilder();
reader = new BufferedReader(new FileReader(path));
for (String line = reader.readLine(), newLine = ""; line != null; line = reader.readLine()) {
output.append(newLine).append(line);
newLine = "\n";
}
return output.toString();
} finally {
if (reader != null) {
reader.close();
}
}
}
public final String content;
protected ProcFile(String path) throws IOException {
super(path);
content = readFile(path);
}
protected ProcFile(Parcel in) {
super(in.readString());
this.content = in.readString();
}
@Override public long length() {
return content.length();
}
@Override public int describeContents() {
return 0;
}
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(getAbsolutePath());
dest.writeString(this.content);
}
public static final Creator<ProcFile> CREATOR = new Creator<ProcFile>() {
@Override public ProcFile createFromParcel(Parcel in) {
return new ProcFile(in);
}
@Override public ProcFile[] newArray(int size) {
return new ProcFile[size];
}
};
}
| [
"[email protected]"
] | |
a69e94df2ff11abf848ceed2d55783c07aa81b41 | 9d528ec2ef7ff183f07c08e80a721e9a9ad63616 | /runtime/src/main/java/com/mypopsy/hook/Hooker.java | ba4bced818812e5d28f72ba5b51adc21c02b224b | [
"Apache-2.0"
] | permissive | renaudcerrato/Hook | a62a28b020c0cea81c1e76ebef8af95ab3ae477c | 8e42bf70bf9dd3df9a85061676a9c7364d2487da | refs/heads/master | 2020-12-25T10:59:55.247770 | 2016-07-22T09:31:38 | 2016-07-22T09:31:38 | 61,806,835 | 27 | 5 | null | null | null | null | UTF-8 | Java | false | false | 19,311 | java | package com.mypopsy.hook;
import com.mypopsy.hook.annotations.After;
import com.mypopsy.hook.annotations.Before;
import com.mypopsy.hook.annotations.Call;
import com.mypopsy.hook.annotations.Hook;
import com.mypopsy.hook.annotations.Hooked;
import com.mypopsy.hook.annotations.Param;
import com.mypopsy.hook.annotations.Result;
import com.mypopsy.hook.annotations.Returning;
import com.mypopsy.hook.annotations.Target;
import com.mypopsy.hook.internal.OrderedLinkedList;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class Hooker {
private static Hooker sInstance;
private final Map<String, LL<LL.HookEntry>> hooks =
Collections.synchronizedMap(new HashMap<String, LL<LL.HookEntry>>());
private final Map<String, LL<LL.BeforeEntry>> befores =
Collections.synchronizedMap(new HashMap<String, LL<LL.BeforeEntry>>());
private final Map<String, LL<LL.BeforeEntry>> calls =
Collections.synchronizedMap(new HashMap<String, LL<LL.BeforeEntry>>());
private final Map<String, LL<LL.AfterEntry>> afters =
Collections.synchronizedMap(new HashMap<String, LL<LL.AfterEntry>>());
private final Map<String, LL<LL.AfterEntry>> returnings =
Collections.synchronizedMap(new HashMap<String, LL<LL.AfterEntry>>());
private final HashMap<Object, Set<OrderedLinkedList.Node>> subscribers = new HashMap<>();
public static Hooker instance() {
if(sInstance == null) sInstance = new Hooker();
return sInstance;
}
private Hooker() {}
public synchronized void register(Object subscriber) {
if(isRegistered(subscriber)) return;
Class<?> klass = subscriber.getClass();
while (klass != Object.class)
{
final List<Method> allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods()));
for (final Method method : allMethods) {
if(method.isBridge() || method.isSynthetic()) {
continue;
}
if (method.isAnnotationPresent(Hook.class)) {
register(subscriber, method, method.getAnnotation(Hook.class));
}else if (method.isAnnotationPresent(Before.class)) {
register(subscriber, method, method.getAnnotation(Before.class));
}else if (method.isAnnotationPresent(After.class)) {
register(subscriber, method, method.getAnnotation(After.class));
}else if (method.isAnnotationPresent(Call.class)) {
register(subscriber, method, method.getAnnotation(Call.class));
}else if (method.isAnnotationPresent(Returning.class)) {
register(subscriber, method, method.getAnnotation(Returning.class));
}
}
klass = klass.getSuperclass();
}
}
public boolean isRegistered(Object object) {
return subscribers.containsKey(object);
}
public synchronized void unregister(Object subscriber) {
final Set<OrderedLinkedList.Node> entries = subscribers.remove(subscriber);
if(entries == null) return;
for(OrderedLinkedList.Node entry : entries) {
entry.remove();
}
}
private void register(Object subscriber, Method method, Hook annotation) {
if(annotation == null) return;
final String name = annotation.value();
LL<LL.HookEntry> nodes = hooks.get(name);
if(nodes == null) {
hooks.put(name, nodes = new LL<>());
}
add(subscriber, nodes.insert(nodes.new HookEntry(subscriber, method, annotation.priority())));
}
private void register(Object subscriber, Method method, Before annotation) {
if(annotation == null) return;
final String name = annotation.value();
LL<LL.BeforeEntry> nodes = befores.get(name);
if(nodes == null) {
befores.put(name, nodes = new LL<>());
}
add(subscriber, nodes.insert(nodes.new BeforeEntry(subscriber, method, annotation.priority())));
}
private void register(Object subscriber, Method method, Call annotation) {
if(annotation == null) return;
final String name = annotation.value();
LL<LL.BeforeEntry> nodes = calls.get(name);
if(nodes == null) {
calls.put(name, nodes = new LL<>());
}
add(subscriber, nodes.insert(nodes.new BeforeEntry(subscriber, method, annotation.priority())));
}
private void register(Object subscriber, Method method, After annotation) {
if(annotation == null) return;
final String name = annotation.value();
LL<LL.AfterEntry> nodes = afters.get(name);
if(nodes == null) {
afters.put(name, nodes = new LL<>());
}
add(subscriber, nodes.insert(nodes.new AfterEntry(subscriber, method, annotation.priority())));
}
private void register(Object subscriber, Method method, Returning annotation) {
if(annotation == null) return;
final String name = annotation.value();
LL<LL.AfterEntry> nodes = returnings.get(name);
if(nodes == null) {
returnings.put(name, nodes = new LL<>());
}
add(subscriber, nodes.insert(nodes.new AfterEntry(subscriber, method, annotation.priority())));
}
private void add(Object subscriber, OrderedLinkedList.Node entry) {
Set<OrderedLinkedList.Node> set = subscribers.get(subscriber);
if(set == null) {
subscribers.put(subscriber, set = new HashSet<>());
}
set.add(entry);
}
/*package*/ Object proceed(HookedMethod root) throws Throwable {
return new AroundHookedMethod(new BeforeHookedMethod(new AfterHookedMethod(root))).proceed();
}
private class AroundHookedMethod extends HookedMethodDelegate {
AroundHookedMethod(HookedMethod instance) {
super(instance);
}
@Override
public Object proceed() throws Throwable {
return proceed(args());
}
@Override
public Object proceed(Object... args) throws Throwable {
final Hooked hook = method().getAnnotation(Hooked.class);
notifyCall(hook, args);
final LL<LL.HookEntry> nodes = hooks.get(hook.value());
if(nodes != null) {
final LL.HookEntry first = nodes.first();
if(first != null) {
final Object ret = first.proceed(delegate(), args);
notifyReturning(hook, args, ret);
return ret;
}
}
final Object ret = super.proceed(args);
notifyReturning(hook, args, ret);
return ret;
}
private void notifyCall(Hooked annotation, Object[] args) throws Throwable {
final LL<LL.BeforeEntry> nodes = calls.get(annotation.value());
if(nodes == null) return;
for(LL.BeforeEntry entry: nodes) {
entry.invoke(delegate(), args);
}
}
private void notifyReturning(Hooked annotation, Object[] args, Object ret) throws Throwable {
final LL<LL.AfterEntry> nodes = returnings.get(annotation.value());
if(nodes == null) return;
for(LL.AfterEntry entry: nodes) {
entry.invoke(delegate(), args, ret);
}
}
}
private class BeforeHookedMethod extends HookedMethodDelegate {
BeforeHookedMethod(HookedMethod instance) {
super(instance);
}
@Override
public Object proceed() throws Throwable {
return proceed(args());
}
@Override
public Object proceed(Object... args) throws Throwable {
final Hooked annotation = method().getAnnotation(Hooked.class);
final LL<LL.BeforeEntry> nodes = befores.get(annotation.value());
if(nodes != null) {
for(LL.BeforeEntry entry: nodes) {
entry.invoke(delegate(), args);
}
}
return super.proceed(args);
}
}
private class AfterHookedMethod extends HookedMethodDelegate {
AfterHookedMethod(HookedMethod instance) {
super(instance);
}
@Override
public Object proceed() throws Throwable {
return proceed(args());
}
@Override
public Object proceed(Object... args) throws Throwable {
final Hooked annotation = method().getAnnotation(Hooked.class);
final LL<LL.AfterEntry> nodes = afters.get(annotation.value());
final Object ret = super.proceed(args);
if(nodes != null) {
for(LL.AfterEntry entry : nodes) {
entry.invoke(delegate(), args, ret);
}
}
return ret;
}
}
@SuppressWarnings("unchecked")
private static class LL<T extends LL.Entry> extends OrderedLinkedList<T> {
abstract class Entry extends Node {
final Object target;
final Method method;
final int priority;
final Annotation annotations[];
protected Entry(Object target, Method method, int priority) {
this.target = target;
this.method = method;
this.priority = priority;
final Annotation[][] a = method.getParameterAnnotations();
annotations = new Annotation[a.length];
for(int i = 0; i < annotations.length; i++) {
for(Annotation an: a[i]) {
if(isSupported(an, i)) {
annotations[i] = an;
break;
}
}
}
}
protected abstract boolean isSupported(Annotation annotation, int position);
Object invoke(Object[] args) throws InvocationTargetException, IllegalAccessException {
if(!method.isAccessible()) {
method.setAccessible(true);
}
if(args == null || args.length == 0)
return method.invoke(target);
else
return method.invoke(target, args);
}
@Override
public int compareTo(Node other) {
return priority - ((Entry)other).priority;
}
}
class HookEntry extends Entry {
HookEntry(Object target, Method method, int priority) {
super(target, method, priority);
final Class<?>[] types = method.getParameterTypes();
if(types.length == 0 || !HookedMethod.class.isAssignableFrom(types[0])) {
throw new IllegalArgumentException(method+": first argument must be of type "+HookedMethod.class);
}
}
@Override
protected boolean isSupported(Annotation annotation, int position) {
if(position > 1) {
final Annotation previous = annotations[position - 1];
if (annotation == null && previous != null || annotation != null && previous == null)
throw new IllegalArgumentException(method +
": missing annotation on argument " + position +
" (either none or all optional arguments must be annotated)");
}
if(annotation instanceof Result)
throw new IllegalArgumentException(Result.class+" annotation can only be used"
+" on methods annotated with @" + After.class + " or @" + Returning.class);
return annotation instanceof Param || annotation instanceof Target;
}
Object proceed(final HookedMethod hooked, Object[] args) throws Throwable {
final Object[] invokeArgs = new Object[annotations.length];
invokeArgs[0] = new ChainedHookedMethod(hooked, args);
for(int i = 1; i < invokeArgs.length; i++) {
if(annotations[1] == null) {
invokeArgs[i] = args[i - 1];
}else {
final Annotation annotation = annotations[i];
if(annotation instanceof Target)
invokeArgs[i] = target;
else{
final int pos = hooked.getPosition((Param) annotation);
if (pos == -1) {
throw new IllegalStateException("can't find " + annotation + " on " + hooked);
}
invokeArgs[i] = args[pos];
}
}
}
return invoke(invokeArgs);
}
class ChainedHookedMethod extends HookedMethodDelegate {
private final Object[] args;
public ChainedHookedMethod(HookedMethod original, Object[] args) {
super(original);
this.args = args;
}
@Override
public Object proceed() throws Throwable {
return proceed(args());
}
@Override
public Object proceed(Object... newArgs) throws Throwable {
if(newArgs != null) {
System.arraycopy(newArgs, 0, args, 0, Math.min(newArgs.length, args.length));
}
final HookEntry n = (HookEntry) next;
if (n != null) {
return n.proceed(delegate(), args);
}
return super.proceed(args);
}
@Override
public Object[] args() {
return args;
}
}
}
class BeforeEntry extends Entry {
protected BeforeEntry(Object target, Method method, int priority) {
super(target, method, priority);
if(method.getReturnType() != void.class)
throw new IllegalArgumentException(method+" must return void");
}
@Override
protected boolean isSupported(Annotation annotation, int position) {
if(position > 0) {
final Annotation previous = annotations[position - 1];
if (annotation == null && previous != null || annotation != null && previous == null)
throw new IllegalArgumentException(method +
": missing annotation on argument " + position +
" (either none or all arguments must be annotated)");
}
if(annotation instanceof Result)
throw new IllegalArgumentException(Result.class+" annotation can only be used"
+" on methods annotated with @" + After.class + " or @" + Returning.class);
return annotation instanceof Param || annotation instanceof Target;
}
void invoke(HookedMethod hooked, Object[] args) throws Throwable {
if(annotations.length == 0) {
// no arguments?
invoke(null);
}else if(annotations[0] == null) {
// no @Params annotation? assume same signature
invoke(args);
}else {
final Object[] invokeArgs = new Object[annotations.length];
for (int i = 0; i < invokeArgs.length; i++) {
final Annotation annotation = annotations[i];
if(annotation instanceof Target)
invokeArgs[i] = target;
else{
final int pos = hooked.getPosition((Param) annotation);
if (pos == -1) {
throw new IllegalStateException("can't find " + annotation + " on " + hooked);
}
invokeArgs[i] = args[pos];
}
}
invoke(invokeArgs);
}
}
}
class AfterEntry extends Entry {
protected AfterEntry(Object target, Method method, int priority) {
super(target, method, priority);
if(method.getReturnType() != void.class)
throw new IllegalArgumentException(method+" must return void");
}
@Override
protected boolean isSupported(Annotation annotation, int position) {
if(position > 0) {
final Annotation previous = annotations[position - 1];
if (annotation == null && previous != null || annotation != null && previous == null)
throw new IllegalArgumentException(method +
": missing annotation on argument " + position +
" (either none or all arguments must be annotated)");
}
return annotation instanceof Param || annotation instanceof Target || annotation instanceof Result;
}
void invoke(HookedMethod hooked, Object[] args, Object result) throws InvocationTargetException, IllegalAccessException {
if(annotations.length == 0) {
// no arguments?
invoke(null);
}else if(annotations[0] == null) {
// no annotations? assume same signature
invoke(args);
}else {
final Object[] invokeArgs = new Object[annotations.length];
for (int i = 0; i < invokeArgs.length; i++) {
final Annotation annotation = annotations[i];
if(annotation instanceof Target)
invokeArgs[i] = target;
else if(annotation instanceof Result)
invokeArgs[i] = result;
else{
final int pos = hooked.getPosition((Param) annotation);
if (pos == -1) {
throw new IllegalStateException("can't find " + annotation + " on " + hooked);
}
invokeArgs[i] = args[pos];
}
}
invoke(invokeArgs);
}
}
}
}
}
| [
"[email protected]"
] | |
5db1dcb974d137ae868618204aa9409aa37478fe | f6e5a58f6fd11da8ea21da7b27f3ebddb34ef00e | /app/src/main/java/com/example/lenovo/repaircaptain/entity/SelectData.java | baf86537eb93e25c699c687c3e7e769b97e41157 | [] | no_license | babaloveu/RepairCaptain | eaa66ca423385c64c49dd3273849005bccbfc571 | b8a358769a779b5fc7d4dd64197ac6202f22dfe3 | refs/heads/master | 2020-03-27T00:58:06.172254 | 2018-08-22T07:29:05 | 2018-08-22T07:29:05 | 145,670,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 834 | java | package com.example.lenovo.repaircaptain.entity;
/**
* Created by lenovo on 2018/3/29.
*/
public class SelectData {
private int id;
private int id_order;
private String datatime;
private String state;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getId_order() {
return id_order;
}
public void setId_order(int id_order) {
this.id_order = id_order;
}
public String getDatatime() {
return datatime;
}
public void setDatatime(String datatime) {
this.datatime = datatime;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String toString(){
return null;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.