blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
f6da78981e6bcf0b92c42c12da7132b7901f92ef
1720728e73ec932d5a9c53fd36ceeea2c75b80ee
/basemvp/src/test/java/com/fytu/basemvp/ExampleUnitTest.java
b56f5257a88b65c33007311d898c6a3bf2ecc2f2
[ "Apache-2.0" ]
permissive
StudyNoteOfTu/modules
5b6d4a83ebd76259ec3b2499688eb709569a233e
7b041f25418f6e414352dd6beb726cbd43c40c33
refs/heads/master
2021-06-27T11:14:52.093010
2020-11-11T14:13:46
2020-11-11T14:13:46
180,824,190
0
0
null
null
null
null
UTF-8
Java
false
false
377
java
package com.fytu.basemvp; 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); } }
[ "820218696@qq.com" ]
820218696@qq.com
dadcb026922e44928a05ead9e605d4a13fb94b8a
b9833f8c38bfeb7a101b65d95fad42f873364502
/src/main/java/za/ac/cput/chapter4/ISP/InterfaceViolation.java
02ffa9193433973b8d7142c99c24ae7ca8e1d354
[]
no_license
Beatrixd18/Assessment4
f9779799571aa55d1a4cd7d380c0c4fbf1016332
7931280e0ae1515902774b90ec82e8d1ea33956c
refs/heads/master
2021-01-17T12:06:45.358146
2015-02-27T20:09:56
2015-02-27T20:09:56
31,436,596
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package za.ac.cput.chapter4.ISP; public interface InterfaceViolation { //an interface containing a lot of methods are called "fat" and therefore violates ISP int add(int c, int d); int subtract(int c, int d); int multiple(int c, int d); public int devide(int c, int d); }
[ "beatrixd18@gmail.com" ]
beatrixd18@gmail.com
97e8df97400487db4afeaddac3b4278b981aa3ad
0a411ad89b4efc77a94e8e4ce4f0dd1d0f228106
/app/src/main/java/com/sample/coolweather/db/Province.java
39cac0c3138e1c9d30789ac609917b58329c7ee4
[ "Apache-2.0" ]
permissive
Ro0kieY/CoolWeather
c410f64fb45b9bc8df520ad090941d40777786b6
81dcbaf90115a7ff7afa7869dd2e43f54037f962
refs/heads/master
2021-01-25T11:33:31.495810
2017-07-05T03:22:13
2017-07-05T03:22:13
93,932,765
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package com.sample.coolweather.db; import org.litepal.crud.DataSupport; /** * Created by Jia on 2017/6/11. */ public class Province extends DataSupport { private int id; private String provinceName; private int provinceCode; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getProvinceName() { return provinceName; } public void setProvinceName(String provinceName) { this.provinceName = provinceName; } public int getProvinceCode() { return provinceCode; } public void setProvinceCode(int provinceCode) { this.provinceCode = provinceCode; } }
[ "yejia1231@163.com" ]
yejia1231@163.com
d026876824ab8deffec07aeb33ac9c257db9784f
c035a692df3f0c1c6c92aa00ddd9c29481a27311
/eoto/xm/eoto/xm/Registration.java
3594951e5b8d0dd3ca38a5a7be6d496e9f139744
[]
no_license
wohenjiujie/End-of-the-operation-4.0
a1f75dc985e8c217e58d5cc3d7f04ac1dedac8ad
8a9a353266b53c986fd2f0b3a70d6a4979a28b7d
refs/heads/master
2020-07-29T23:48:54.600652
2019-09-21T15:11:17
2019-09-21T15:11:17
210,006,207
1
0
null
null
null
null
UTF-8
Java
false
false
2,085
java
package eoto.xm; import java.io.IOException; import java.util.*; public class Registration { //注册 @SuppressWarnings("resource") static void registration() throws IOException{ System.out.println("请填写用户名(用户名长度需大于3...PS:按0即可退出当前界面):"); String anc=new Scanner(System.in).nextLine(); while(anc.equals("0")) { Start.main(null); } while(anc.length()<3){ System.out.println("用户名长度需大于3"); System.out.println("请重新输入:(PS:按0即可退出当前界面)"); anc=new Scanner(System.in).nextLine(); while(anc.equals("0")) { Start.main(null); } } while(Duplicate.check(anc,null,false)==1) { System.out.println("用户名已存在!!!"); System.out.println("请重新填写用户名:"); anc=new Scanner(System.in).nextLine(); } System.out.println("请填写密码(密码长度需大于6):"); String pa1=new Scanner(System.in).nextLine(); while(pa1.length()<6){ System.out.println("密码长度需大于6:"); System.out.println("请重新输入:"); pa1=new Scanner(System.in).nextLine(); } System.out.println("请再次确认密码:"); String pa2=new Scanner(System.in).nextLine(); while(pa1.equals(pa2)==false){ System.out.println("两次输入的密码不一致,请重新输入!"); pa1=new Scanner(System.in).nextLine(); while(pa1.length()<6){ System.out.println("密码长度需大于6:"); System.out.println("请再次输入:"); pa1=new Scanner(System.in).nextLine(); } System.out.println("请再次确认:"); pa2=new Scanner(System.in).nextLine(); } if(pa1.equals(pa2)){ System.out.println("你的账号为:"+anc); System.out.println("你的密码为:"+pa1); } Connect.Connection(anc,pa1,1); //写入信息 Attributes.setPoints(1000); //初始化积分 Attributes.setHost(anc); //将用户名封装 } }
[ "xiaomu1079@outlook.com" ]
xiaomu1079@outlook.com
91b79a679a4f3b600be0af4dad80a87c323cadee
068a4d63eecf374b02e9fd9ab6227fa235c6a2e7
/onlineshop-product/src/main/java/com/jwang261/onlineshop/product/entity/SkuSaleAttrValueEntity.java
557d1182ee434a55ca43f06f9925009e1e664424
[]
no_license
jwang261/onlineshop-5
a507fc01d6d90585cea7c812e8cde1b145a44db6
2f611b4ae068ba7500be3a428e4c8a5ce8a7bcd3
refs/heads/master
2023-03-06T21:16:22.302618
2021-01-14T04:08:46
2021-01-14T04:08:46
286,692,896
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package com.jwang261.onlineshop.product.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * sku销售属性&值 * * @author JIALIANG WANG * @email jwang261@syr.edu * @date 2020-08-20 18:14:42 */ @Data @TableName("pms_sku_sale_attr_value") public class SkuSaleAttrValueEntity implements Serializable { private static final long serialVersionUID = 1L; /** * $column.comments */ @TableId private Long id; /** * $column.comments */ private Long skuId; /** * $column.comments */ private Long attrId; /** * $column.comments */ private String attrName; /** * $column.comments */ private String attrValue; /** * $column.comments */ private Integer attrSort; }
[ "jwang261@syr.edu" ]
jwang261@syr.edu
975cb8f43779fc7a31fb22f61d6323b2b62732e5
19599ad278e170175f31f3544f140a8bc4ee6bab
/src/com/ametis/cms/service/RejectedCaseService.java
4a6ab5b4eded806e52b1000e3a0f5314e9c59508
[]
no_license
andreHer/owlexaGIT
a2a0df83cd64a399e1c57bb6451262434e089631
426df1790443e8e8dd492690d6b7bd8fd37fa3d7
refs/heads/master
2021-01-01T04:26:16.039616
2016-05-12T07:37:20
2016-05-12T07:37:20
58,693,624
0
0
null
null
null
null
UTF-8
Java
false
false
23,601
java
package com.ametis.cms.service; import java.util.Collection; import org.hibernate.Criteria; import org.hibernate.criterion.DetachedCriteria; import com.ametis.cms.datamodel.ActionUser; import com.ametis.cms.datamodel.RejectedCase; // imports+ // imports- /** * RejectedCase is a servlet controller for rejected_case Table. * All you have to do is to convert necessary data field to the named parameter */ public interface RejectedCaseService // extends+ // extends- { /* * Method create (RejectedCase object) berfungsi untuk melakukan penambahan * sebuah object kedalam database * @param object adalah sebuah object yang ingin diubah * @param user adalah User pelaku create * @return object hasil kreasi,lengkap dengan assigned primary key, exception jika gagal */ public RejectedCase create (RejectedCase object,ActionUser actionUser) throws Exception; public RejectedCase getCaseRejection(Integer caseId) throws Exception; /* * Method update (RejectedCase object) berfungsi untuk melakukan perubahan terhadap * sebuah object yang terdapat didalam database * @param object adalah sebuah object yang ingin diubah * @param user adalah User pelaku aksi yang bersangkutan * @return object hasil update, exception jika gagal */ public RejectedCase update (RejectedCase object,ActionUser actionUser) throws Exception; /* * Method trash (Object pkey) berfungsi untuk melakukan penghapusan terhadap * sebuah object yang terdapat didalam database - benar2 HAPUS !!! * @param pkey adalah sebuah object yang merepresentasikan primary key dari * tabel yang bersangkutan. Object tersebut dapat dalam bentuk single ID maupun composite ID * @return no return value karena objeknya sendiri sudah dihapus - just for consistency. Again, * exception if failure occured * WARNING ! Unvalid value for the returned object, better not use it again in any * place */ public RejectedCase trash (java.io.Serializable pkey) throws Exception; /* * Method delete (RejectedCase object) berfungsi untuk melakukan penghapusan terhadap * sebuah object yang terdapat didalam database * @param pkey adalah sebuah object yang merepresentasikan primary key dari * tabel yang bersangkutan. * Object tersebut dapat dalam bentuk single ID maupun composite ID * @param user adalah User pelaku aksi yang bersangkutan * @return updated object, exception if failed */ public RejectedCase delete (java.io.Serializable pkey,ActionUser actionUser) throws Exception; /* * Method delete (RejectedCase object) berfungsi untuk melakukan penghapusan terhadap * sebuah object yang terdapat didalam database * @param object adalah sebuah object yang ingin dihapus, isi dari object tersebut cukup dengan * mengisi field-field primary key * @param user adalah User pelaku aksi yang bersangkutan * @return updated object, exception if failed */ public RejectedCase delete (RejectedCase object,ActionUser actionUser) throws Exception; // -- get section - carefull ! /* * Method get (Object pkey) berfungsi untuk melakukan retrieval terhadap * sebuah object yang terdapat didalam database * @param pkey adalah sebuah object yang merepresentasikan primary key dari * tabel yang bersangkutan. Object tersebut dapat dalam bentuk single ID maupun composite ID * @return Object yang dihasilkan dari proses retrieval, apabila object tidak ditemukan * maka method akan mengembalikan nilai "NULL" */ public RejectedCase get (java.io.Serializable pkey) throws Exception; /* * Method get (Object pkey) berfungsi untuk melakukan retrieval terhadap * sebuah object yang terdapat didalam database * @param pkey adalah sebuah object yang merepresentasikan primary key dari * tabel yang bersangkutan. Object tersebut dapat dalam bentuk single ID maupun composite ID * @param required adalah array dari field-field yang dibutuhkan dari hibernate object * @return Object yang dihasilkan dari proses retrieval, apabila object tidak ditemukan * maka method akan mengembalikan nilai "NULL" */ public RejectedCase get (java.io.Serializable pkey, String[] required) throws Exception; // -- get section end here // SEARCH SECTION - PALING RUMIT !! // -- 1 /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams,String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, boolean asc, String columnOrder[], int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param asc - shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, boolean asc, String columnOrder[], String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param asc - shor order Ascending or descending * @param columnOrder - order by the column(s) * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, boolean asc, String columnOrder, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, boolean asc, String columnOrder, String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, boolean asc, String columnOrder[], int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, boolean asc, String columnOrder[], String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, boolean asc, String columnOrder, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, boolean asc, String columnOrder, String[] required, int index, int offset) throws Exception; // -- 2 , between /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, String[] btwnColumns, Object[] btwnParams1, Object[] btwnParams2, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, String[] btwnColumns, Object[] btwnParams1, Object[] btwnParams2, String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, String[] btwnColumns, Object[] btwnParams1, Object[] btwnParams2, boolean asc, String columnOrder[], int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, String[] btwnColumns, Object[] btwnParams1, Object[] btwnParams2, boolean asc, String columnOrder[], String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, String[] btwnColumns, Object[] btwnParams1, Object[] btwnParams2, boolean asc, String columnOrder, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String[] likeColumns, Object[] likeParams, String[] eqColumns, Object[] eqParams, String[] btwnColumns, Object[] btwnParams1, Object[] btwnParams2, boolean asc, String columnOrder, String[] required, int index, int offset) throws Exception; // -- 2b /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, String btwnColumns, Object btwnParams1, Object btwnParams2, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, String btwnColumns, Object btwnParams1, Object btwnParams2, String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, String btwnColumns, Object btwnParams1, Object btwnParams2, boolean asc, String columnOrder[], int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, String btwnColumns, Object btwnParams1, Object btwnParams2, boolean asc, String columnOrder[], String[] required, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, String btwnColumns, Object btwnParams1, Object btwnParams2, boolean asc, String columnOrder, int index, int offset) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching * @param asc shor order Ascending or descending * @param columnOrder - order by the column(s) * @param required required for lazy initialization problem * @param index index first * @param offset number of object result */ public Collection search (String likeColumns, Object likeParams, String eqColumns, Object eqParams, String btwnColumns, Object btwnParams1, Object btwnParams2, boolean asc, String columnOrder, String[] required, int index, int offset) throws Exception; // req end // -- search end //-- get total /* Method searching number of objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal */ public int getTotal (String[] likeQuery, Object[] likeObject, String[] eqColumns, Object[] eqParams) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching */ public int getTotal (String[] likeQuery, Object[] likeObject, String[] eqColumns, Object[] eqParams, String btwnColumns[], Object btwnParams1[], Object btwnParams2[] ) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal */ public int getTotal (String likeQuery, Object likeObject, String eqColumns, Object eqParams) throws Exception; /* Method searching objects from database * @param likeColumn kolom like * @param likeParams param like * @param eqColumn kolom equal * @param eqParams param equal * @param btwnColumns between value column for searching * @param btwnParams1 between value 1st param for searching * @param btwnParams2 between value 2nd param for searching */ public int getTotal (String[] likeQuery, Object[] likeObject, String[] eqColumns, Object[] eqParams, String btwnColumns, Object btwnParams1, Object btwnParams2 ) throws Exception; //------------------------------------------------------------------ /* * getting total number of current objects in database */ public int getTotal () throws Exception; //-- get total end //--------------------------------------------------- /* getting all object @param required - for lazy init problem */ public Collection getAll (String[] required) throws Exception; /* getting all object */ public Collection getAll () throws Exception; //------------------------------------------------- // unique Result /* * getting single unique object * @param eqColumns column for retrieve * @param eqParams value for column * @param required - for lazy init problem */ public RejectedCase searchUnique (String eqColumns, Object eqParams, String[] required) throws Exception; /* * getting single unique object * @param eqColumns column for retrieve * @param eqParams value for column */ public RejectedCase searchUnique (String eqColumns, Object eqParams) throws Exception; /** BASIC IMPLEMENTATION !! USE WITH CAUTION ! USE IT IF NO OTHER OPTIONS LEFT @return criteria */ public Criteria getCriteria() throws Exception ; /** BASIC IMPLEMENTATION !! USE WITH CAUTION ! USE IT IF NO OTHER OPTIONS LEFT @return detached criteria */ public DetachedCriteria getDetachedCriteria() throws Exception; // class+ // class- }
[ "mashuri@7a4bab5d-9f4e-4b47-a10f-b21823e054b7" ]
mashuri@7a4bab5d-9f4e-4b47-a10f-b21823e054b7
9930fa018ecf1d2156dc70a045d18a48d44995da
b46c42aa22b32c3953a676ba96e1b3c77cd9453c
/src/com/company/Main.java
2e1d6afded52ab277ba7bbaa4dcf1fa0054e4e3f
[]
no_license
cnguyen0691/Movie
637e84c0a363263eb936d5750dd7ffb8e1fccf49
c764410f90cc8eaae4f9cbdd7ee0109b4aa58073
refs/heads/master
2020-05-16T15:03:50.068786
2019-04-24T01:16:57
2019-04-24T01:16:57
183,121,207
0
0
null
null
null
null
UTF-8
Java
false
false
1,101
java
package com.company; import java.io.File; import java.util.ArrayList; import java.util.Random; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { ArrayList<String> nameMovie = new ArrayList<>(); Scanner movie = new Scanner(System.in); String userAnswer =""; while (!userAnswer.equalsIgnoreCase("Q")) { System.out.println("Add movie: "); String movies = movie.nextLine(); nameMovie.add(movies); System.out.println("Add more movie (y/n): "); userAnswer= movie.nextLine(); if (userAnswer.equalsIgnoreCase("N")){ break; } } Collections.sort(nameMovie); for (int i =0; i<nameMovie.size();i++) System.out.println(nameMovie.get(i)); Random myMovie = new Random(); String seeMovie = nameMovie.get(myMovie.nextInt(nameMovie.size())); System.out.println("Suggest movie tonight: "+seeMovie); } }
[ "chaunguyen0691@gmail.com" ]
chaunguyen0691@gmail.com
1d2214af434ab089bdb394516d701525680f857b
a3b3a431be04a3bc1f2beec1937d20aa42e2b92a
/JavaOOP_Day01_0100/src/cn/bdqn/Chapter01/Demo01.java
15fea080ce2b207bfca8dbd78e8b543d7be847c1
[]
no_license
AGaoYuan/kfd
65a928b8e03c298d78f68c9d4d0433231dbd3cca
d7f5587d3d83663dfcf8af5dda4e76589b8a749b
refs/heads/master
2020-03-15T09:39:56.704991
2019-01-24T08:15:18
2019-01-24T08:15:18
132,080,906
1
0
null
null
null
null
GB18030
Java
false
false
834
java
package cn.bdqn.Chapter01; import java.util.Scanner; public class Demo01 { public static void main(String[] args) { Scanner in = new Scanner(System.in); Dog dog = new Dog(); System.out.println("欢迎来到宠物店"); System.out.println("请输入要领养的宠物名字:"); String Name = in.next(); dog.setName(Name); System.out.println("请选择要领养的宠物类型:(1、狗狗 2、企鹅)"); int num =in.nextInt(); switch (num) { case 1: dog.print(); break; case 2: Penguin pe = new Penguin(); System.out.println("请输入企鹅性别:(1、雄 2、雌)"); pe.setName(Name); int sex = in.nextInt(); if (sex == 1) { pe.sex = pe.SEX_MALE; } else if(sex == 2) { pe.sex = pe.SEX_FEMALE; } pe.print(); break; default: break; } } }
[ "2105328651qq.com" ]
2105328651qq.com
dfbdaae1fcd7796f6131f581102ea967037ce471
275e0e071b917a59b0e0759c390baea46b6b5fea
/src/main/java/dal/dataReaders/dataCSVGeneralInfoReadingStrategies/ReadGeneralInfoStatePhilosiphies.java
5758cfa78974c7d967f342af07fb4775b534c2cb
[]
no_license
nvanhoeck/NovaPolitica
ff10d7788440900cf81868d330e232347d99ba91
ad99a601fce450de8665cba436631bc89624d477
refs/heads/master
2020-04-04T14:32:49.443815
2018-11-04T12:08:17
2018-11-04T12:08:17
156,002,340
0
0
null
null
null
null
UTF-8
Java
false
false
152
java
package dal.dataReaders.dataCSVGeneralInfoReadingStrategies; public class ReadGeneralInfoStatePhilosiphies implements ReadGeneralInfoDataInterface { }
[ "niko.van.hoeck@telenetgroup.be" ]
niko.van.hoeck@telenetgroup.be
a096c6d69f72faa24810e205317ea096deaacee0
9ecc7d85a7ecdea7b622d2813f04428eb665e5ae
/app/src/main/java/com/igniva/indiecore/model/PremiumBadgePojo.java
9a3d0eb313c2367b1efe831d3af534b8a196ce1a
[]
no_license
ignivajitender/IndieTest
786138dd379195ba56e6eec40e1a59a0cb566046
819b0d8a6dc9c25b80967510cf977db70a1447fc
refs/heads/master
2020-05-22T06:53:06.730218
2016-11-18T10:11:34
2016-11-18T10:11:34
60,521,025
0
1
null
null
null
null
UTF-8
Java
false
false
755
java
package com.igniva.indiecore.model; import android.graphics.drawable.Drawable; /** * Created by igniva-andriod-05 on 22/7/16. */ public class PremiumBadgePojo { private Drawable badgeIcon; private String badgeName; private String badgePrice; public Drawable getBadgeIcon() { return badgeIcon; } public void setBadgeIcon(Drawable badgeIcon) { this.badgeIcon = badgeIcon; } public String getBadgeName() { return badgeName; } public void setBadgeName(String badgeName) { this.badgeName = badgeName; } public String getBadgePrice() { return badgePrice; } public void setBadgePrice(String badgePrice) { this.badgePrice = badgePrice; } }
[ "sidharth.github@ignivasolutions.com" ]
sidharth.github@ignivasolutions.com
0a3093aa593b770714ac4859734f5595c1995577
09b9ef9f4d622d8c4aedb82be4d520f92a683d0f
/net.sf.anathema.character.abilities/src/net/sf/anathema/character/abilities/points/AbilityBonusPointExpenditureBuilder.java
1e2deef2176657c66cbe47a7100ce24bf505cff3
[]
no_license
anathema/anathema-rcp
a10491b7b3eae5d6cce2c7eb480110f741a86dd4
558a47659a96a7065ab703d43740a353b43e96de
refs/heads/master
2020-02-26T14:50:50.304707
2009-10-20T11:12:27
2009-10-20T11:12:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package net.sf.anathema.character.abilities.points; import net.sf.anathema.character.trait.IBasicTrait; public class AbilityBonusPointExpenditureBuilder { int cheapDotCount = 0; int expensiveDotCount = 0; public void addTrait(IBasicTrait trait) { if (trait.getStatusManager().getStatus().isCheap()) { cheapDotCount += trait.getCreationModel().getValue(); } else { expensiveDotCount += trait.getCreationModel().getValue(); } } public int getCost() { return cheapDotCount + expensiveDotCount * 2; } }
[ "sandra.sieroux@googlemail.com" ]
sandra.sieroux@googlemail.com
076134c1ace5fdb4e012c4b6eb55912d2732a952
3fe94a6d049312b440b41f9361ec3745093d439e
/src/com/example/foodmates/CreatEvent.java
60a9538cec8bd7423d9db0a18258269dfa8b9071
[]
no_license
vietthaotran/foodmates
4f3f9f137202d5f56ef76fa68e87d301d994eb00
f5a8c3dbee7d3611ba3ed1ed01ce10af3f9633c8
refs/heads/master
2021-01-01T06:45:38.491779
2014-03-26T03:55:41
2014-03-26T03:55:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
951
java
package com.example.foodmates; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; public class CreatEvent extends Activity implements OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.creat_event); ImageButton button = (ImageButton)findViewById(R.id.add_parti); button.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.creat_event, menu); return true; } public void onClick(View v){ Intent intent = new Intent(CreatEvent.this, AddParticipant.class); startActivity(intent); } }
[ "pvttran.2011@smu.edu.sg" ]
pvttran.2011@smu.edu.sg
02f3c6799e0bc5f6353827c6b139bdea6749c381
446613963cda46298ef119c954184d962499aca1
/Java Podstawy - 6 rozdział - Interfejsy i klasy wewnętrzne/src/clone/CloneTest.java
f0bd9a936950eb100c827182d84fb17a4d385be1
[]
no_license
lDante93/Learning-Java
3ab2444b336d26f99002e987edcf120f90ed06af
5bd1a9d70a762d0cc3eef15ad0162f32fd13001f
refs/heads/master
2020-07-03T18:46:00.222480
2016-11-19T22:46:36
2016-11-19T22:46:36
74,239,772
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package clone; public class CloneTest { public static void main(String[] args) { try { Employee original = new Employee("Jan W. Kowalski", 50000); original.setHireDay(2000, 1, 1); Employee copy = original.clone(); copy.raiseSalary(10); copy.setHireDay(2002, 12, 31); System.out.println("original =" + original); System.out.println("copy=" + copy); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } }
[ "niletuv@gmail.com" ]
niletuv@gmail.com
b0655704ed2c803be5858df56c44fbc1404ef779
8c7bf59731f4e219c83deb5f98ae38f14cfde946
/LeetCode/src/algorithm/SortPractice.java
c68e2f234247e8d1948ece966a5ac5c065cf6dba
[]
no_license
aloneagy/LeetCode
82bb9664e4f985c3db4485aa6e50bead998c2a1b
95e605f763ed0ddaf4c6b8fed32ecaae99b8d102
refs/heads/master
2022-11-18T16:07:14.433050
2020-07-16T17:45:44
2020-07-16T17:45:44
259,057,763
0
0
null
null
null
null
UTF-8
Java
false
false
6,471
java
package algorithm; import java.util.Arrays; /** * @author ynz * create at 2020-05-03 20:20 * @description:this is the class for **/ public class SortPractice { //假设进来的是递增序列 //没找到返回-1; //tested public int binarySearch(int[] arr,int left,int right,int target) { int mid = (left + right) / 2; if (right >= left) { if (target == arr[mid]) { return mid; } else if (arr[mid] > target) { return binarySearch(arr, left, mid - 1, target); } else { return binarySearch(arr, mid + 1, right, target); } } else { return -1; } } public int[] quickSort(int[] arr,int low,int high) { int p,i,j,temp; if(low<high) { //p就是基准数,这里就是每个数组的第一个 p = arr[low]; i = low; j = high; while (i < j) { //右边当发现小于p的值时停止循环 while (arr[j] >= p && i < j) { j--; } //这里一定是右边开始,上下这两个循环不能调换(下面有解析,可以先想想) //左边当发现大于p的值时停止循环 while (arr[i] <= p && i < j) { i++; } temp = arr[j]; arr[j] = arr[i]; arr[i] = temp; } arr[low] = arr[i];//这里的arr[i]一定是停小于p的,经过i、j交换后i处的值一定是小于p的(j先走) arr[i] = p; quickSort(arr, low, j - 1); //对左边快排 quickSort(arr, j + 1, high); //对右边快排 } return arr; } //tested public int[] bubbleSort(int arr[],int n){//n为长度 int i,j,k; for(i=0;i<n-1;i++){ for(j=0;j<n-1-i;j++){ if(arr[j]>arr[j+1]){ k=arr[j]; arr[j]=arr[j+1]; arr[j+1]=k; } } } return arr; } //tested public int[] selectSort(int[] arr,int n){ int i,j,min,k; for(i=0;i<n-1;i++){ min=i;//设定第一个数为最小,然后遍历 for(j=i+1;j<n;j++){ if(arr[min]>arr[j]){ min=j; } } if(min!=i){ k=arr[min]; arr[min]=arr[i]; arr[i]=k; } } return arr; } public int[] insertSort(int[] a) { int i, j, insertNote;// 要插入的数据 for (i = 1; i < a.length; i++) {// 从数组的第二个元素开始循环将数组中的元素插入 insertNote = a[i];// 设置数组中的第2个元素为第一次循环要插入的数据 j = i - 1; while (j >= 0 && insertNote < a[j]) { a[j + 1] = a[j];// 如果要插入的元素小于第j个元素,就将第j个元素向后移动 j--; } a[j + 1] = insertNote;// 直到要插入的元素不小于第j个元素,将insertNote插入到数组中 } return a; } //归并排序 public static void merge(int[] a, int low, int mid, int high) { int[] temp = new int[high - low + 1]; int i = low;// 左指针 int j = mid + 1;// 右指针 int k = 0; // 把较小的数先移到新数组中 while (i <= mid && j <= high) { if (a[i] < a[j]) { temp[k++] = a[i++]; } else { temp[k++] = a[j++]; } } // 把左边剩余的数移入数组 while (i <= mid) { temp[k++] = a[i++]; } // 把右边边剩余的数移入数组 while (j <= high) { temp[k++] = a[j++]; } // 把新数组中的数覆盖nums数组 for (int k2 = 0; k2 < temp.length; k2++) { a[k2 + low] = temp[k2]; } } public int[] mergeSort(int[] a, int low, int high) { int mid = (low + high) / 2; if (low < high) { // 左边 mergeSort(a, low, mid); // 右边 mergeSort(a, mid + 1, high); // 左右归并 merge(a, low, mid, high); } return a; } public static void sort(int []arr){ //1.构建大顶堆 for(int i=arr.length/2-1;i>=0;i--){ //从第一个非叶子结点从下至上,从右至左调整结构 adjustHeap(arr,i,arr.length); } //2.调整堆结构+交换堆顶元素与末尾元素 for(int j=arr.length-1;j>0;j--){ swap(arr,0,j);//将堆顶元素与末尾元素进行交换 adjustHeap(arr,0,j);//重新对堆进行调整 } } /** * 调整大顶堆(仅是调整过程,建立在大顶堆已构建的基础上) */ public static void adjustHeap(int []arr,int i,int length){ int temp = arr[i];//先取出当前元素i for(int k=i*2+1;k<length;k=k*2+1){//从i结点的左子结点开始,也就是2i+1处开始 if(k+1<length && arr[k]<arr[k+1]){//如果左子结点小于右子结点,k指向右子结点 k++; } if(arr[k] >temp){//如果子节点大于父节点,将子节点值赋给父节点(不用进行交换) arr[i] = arr[k]; i = k; }else{ break; } } arr[i] = temp;//将temp值放到最终的位置 } public static void swap(int []arr,int a ,int b){ int temp=arr[a]; arr[a] = arr[b]; arr[b] = temp; } public static void main(String[] args) { SortPractice a=new SortPractice(); int []arr = {3,1,4,2,8,5,9,7,6}; sort(arr); System.out.println(Arrays.toString(arr)); int[] aa=new int[]{4,3,5,6,7,9}; // int[] ints = a.insertSort(aa); // System.out.println(Arrays.toString(ints)); // int[] ints1 = a.mergeSort(aa, 0, aa.length - 1); // System.out.println(Arrays.toString(ints1)); // int[] ints2 = a.quickSort(aa, 0, aa.length - 1); // System.out.println(Arrays.toString(aa)); } }
[ "850700882@qq.com" ]
850700882@qq.com
3a3f0720fc7b8182f8907e403fb521511af9ea94
cfd346ab436b00ab9bfd98a5772e004d6a25451a
/hub/hostobjects/org.axiata.store.hostobjects/1.0.0/src/main/java/org/axiata/store/hostobjects/model/Operator.java
076a39f1e2d8ae39d9f590da544afd7fe1e90ba2
[]
no_license
Shasthojoy/wso2telcohub
74df08e954348c2395cb3bc4d59732cfae065dad
0f5275f1226d66540568803282a183e1e584bf85
refs/heads/master
2021-04-09T15:37:33.245057
2016-03-08T05:44:30
2016-03-08T05:44:30
125,588,468
0
0
null
2018-03-17T02:03:11
2018-03-17T02:03:11
null
UTF-8
Java
false
false
658
java
package org.axiata.store.hostobjects.model; public class Operator { private int operatorId; private String operatorName; private String operatorDescription; public int getOperatorId() { return operatorId; } public void setOperatorId(int operatorId) { this.operatorId = operatorId; } public String getOperatorName() { return operatorName; } public void setOperatorName(String operatorName) { this.operatorName = operatorName; } public String getOperatorDescription() { return operatorDescription; } public void setOperatorDescription(String operatorDescription) { this.operatorDescription = operatorDescription; } }
[ "igunawardana@mitrai.com" ]
igunawardana@mitrai.com
d33041fc623e175df58c911eafbf206558092998
6211de33a6a1f900728df8d250bf574424ccef2e
/Sex.java
245badba1100e3e974cbe9770c11952b17e9ae14
[]
no_license
Ryan57/ProjectV
b4d0924e535320938b2258f288a4a45f50112392
71684c3a6d5c105011e588925ea61df6ceec2357
refs/heads/master
2021-01-22T02:34:42.695729
2014-12-12T22:13:20
2014-12-12T22:13:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
46
java
package com.company; enum Sex{MALE, FEMALE}
[ "Ryan.Owens1@marist.edu" ]
Ryan.Owens1@marist.edu
c77a4252a438524cf17c8e099680027bbc13d525
d891529579909fccbd516aace2394618ac96f2c8
/src/main/java/io/ananas/iaas/repository/search/package-info.java
4f77fbdddbc620c51fe1995741a4e536e410a8a8
[]
no_license
parema/level6-portal-mongodb
5dab46ed7d694b31c24094de6e9365f84863c2b6
e47fde7ea388a658c7078715eae12d71ab46338e
refs/heads/master
2020-05-29T19:01:12.012408
2019-05-30T00:41:10
2019-05-30T00:41:10
189,319,109
0
0
null
2019-11-01T00:48:30
2019-05-30T00:41:00
Java
UTF-8
Java
false
false
93
java
/** * Spring Data Elasticsearch repositories. */ package io.ananas.iaas.repository.search;
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
4f843a2984621f3ccd8b014316115eaa60c219c5
cbd86ff581f8bd9889c7602fc9e2c9e0f464c6b6
/app/src/test/java/williammordohay/citizenfood/ExampleUnitTest.java
b3c0f03a8394133b88dc45f03cbf1132c9070523
[]
no_license
mordohaw/CitizenFood
234bf1c95baf2286a2dab6b9b29c81e63349a7d4
b8bad5c1e35cdfb1a2fdd3975c62427ef3ba42c5
refs/heads/master
2021-05-02T10:40:24.886003
2018-02-08T13:21:36
2018-02-08T13:21:36
120,760,919
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package williammordohay.citizenfood; 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); } }
[ "william.mordohay@gmail.com" ]
william.mordohay@gmail.com
a474e2d6a1b9754e2d23578844a2f1945df0e822
24abd9fbc8399429020b25bf4242246499563e81
/实验数据和结果/jGenProg/Chart/3b/variantSeed3/AstorMain-3b/src/default/org/jfree/chart/axis/ValueAxis.java
c7dfcb3360047e77140bf311195943ae42981a32
[]
no_license
RitaRuan/defects4j-repair
0dfc56809b96df0d7757918b388be1134892e23b
3b6fa4817dfd675765cd17f20ee7c83967ab06b7
refs/heads/main
2023-05-11T20:22:45.519984
2021-06-03T12:31:47
2021-06-03T12:31:47
330,844,690
2
0
null
null
null
null
UTF-8
Java
false
false
59,340
java
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2009, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * -------------- * ValueAxis.java * -------------- * (C) Copyright 2000-2009, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Jonathan Nash; * Nicolas Brodu (for Astrium and EADS Corporate Research * Center); * Peter Kolb (patch 1934255); * Andrew Mickish (patch 1870189); * * Changes * ------- * 18-Sep-2001 : Added standard header and fixed DOS encoding problem (DG); * 23-Nov-2001 : Overhauled standard tick unit code (DG); * 04-Dec-2001 : Changed constructors to protected, and tidied up default * values (DG); * 12-Dec-2001 : Fixed vertical gridlines bug (DG); * 16-Jan-2002 : Added an optional crosshair, based on the implementation by * Jonathan Nash (DG); * 23-Jan-2002 : Moved the minimum and maximum values to here from NumberAxis, * and changed the type from Number to double (DG); * 25-Feb-2002 : Added default value for autoRange. Changed autoAdjustRange * from public to protected. Updated import statements (DG); * 23-Apr-2002 : Added setRange() method (DG); * 29-Apr-2002 : Added range adjustment methods (DG); * 13-Jun-2002 : Modified setCrosshairValue() to notify listeners only when the * crosshairs are visible, to avoid unnecessary repaints, as * suggested by Kees Kuip (DG); * 25-Jul-2002 : Moved lower and upper margin attributes from the NumberAxis * class (DG); * 05-Sep-2002 : Updated constructor for changes in Axis class (DG); * 01-Oct-2002 : Fixed errors reported by Checkstyle (DG); * 04-Oct-2002 : Moved standardTickUnits from NumberAxis --> ValueAxis (DG); * 08-Nov-2002 : Moved to new package com.jrefinery.chart.axis (DG); * 19-Nov-2002 : Removed grid settings (now controlled by the plot) (DG); * 27-Nov-2002 : Moved the 'inverted' attributed from NumberAxis to * ValueAxis (DG); * 03-Jan-2003 : Small fix to ensure auto-range minimum is observed * immediately (DG); * 14-Jan-2003 : Changed autoRangeMinimumSize from Number --> double (DG); * 20-Jan-2003 : Replaced monolithic constructor (DG); * 26-Mar-2003 : Implemented Serializable (DG); * 09-May-2003 : Added AxisLocation parameter to translation methods (DG); * 13-Aug-2003 : Implemented Cloneable (DG); * 01-Sep-2003 : Fixed bug 793167 (setMaximumAxisValue exception) (DG); * 02-Sep-2003 : Fixed bug 795366 (zooming on inverted axes) (DG); * 08-Sep-2003 : Completed Serialization support (NB); * 08-Sep-2003 : Renamed get/setMinimumValue --> get/setLowerBound, * and get/setMaximumValue --> get/setUpperBound (DG); * 27-Oct-2003 : Changed DEFAULT_AUTO_RANGE_MINIMUM_SIZE value - see bug ID * 829606 (DG); * 07-Nov-2003 : Changes to tick mechanism (DG); * 06-Jan-2004 : Moved axis line attributes to Axis class (DG); * 21-Jan-2004 : Removed redundant axisLineVisible attribute. Renamed * translateJava2DToValue --> java2DToValue, and * translateValueToJava2D --> valueToJava2D (DG); * 23-Jan-2004 : Fixed setAxisLinePaint() and setAxisLineStroke() which had no * effect (andreas.gawecki@coremedia.com); * 07-Apr-2004 : Changed text bounds calculation (DG); * 26-Apr-2004 : Added getter/setter methods for arrow shapes (DG); * 18-May-2004 : Added methods to set axis range *including* current * margins (DG); * 02-Jun-2004 : Fixed bug in setRangeWithMargins() method (DG); * 30-Sep-2004 : Moved drawRotatedString() from RefineryUtilities * --> TextUtilities (DG); * 11-Jan-2005 : Removed deprecated methods in preparation for 1.0.0 * release (DG); * 21-Apr-2005 : Replaced Insets with RectangleInsets (DG); * ------------- JFREECHART 1.0.x --------------------------------------------- * 10-Oct-2006 : Source reformatting (DG); * 22-Mar-2007 : Added new defaultAutoRange attribute (DG); * 20-Jun-2007 : Removed JCommon dependencies (DG); * 12-Jul-2007 : Added PlotRenderingInfo to drawTickMarksAndLabels() * method (DG); * 02-Aug-2007 : Check for major tick when drawing label (DG); * 25-Sep-2008 : Added minor tick support, see patch 1934255 by Peter Kolb (DG); * 21-Jan-2009 : Updated default behaviour of minor ticks (DG); * 18-Mar-2008 : Added resizeRange2() method which provides more natural * anchored zooming for mouse wheel support (DG); * 26-Mar-2009 : In equals(), only check current range if autoRange is * false (DG); * 30-Mar-2009 : Added pan(double) method (DG); * */ package org.jfree.chart.axis; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.Shape; import java.awt.font.LineMetrics; import java.awt.geom.AffineTransform; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Iterator; import java.util.List; import org.jfree.chart.event.AxisChangeEvent; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.text.TextUtilities; import org.jfree.chart.util.ObjectUtilities; import org.jfree.chart.util.PublicCloneable; import org.jfree.chart.util.RectangleEdge; import org.jfree.chart.util.RectangleInsets; import org.jfree.chart.util.SerialUtilities; import org.jfree.data.Range; /** * The base class for axes that display value data, where values are measured * using the <code>double</code> primitive. The two key subclasses are * {@link DateAxis} and {@link NumberAxis}. */ public abstract class ValueAxis extends Axis implements Cloneable, PublicCloneable, Serializable { /** For serialization. */ private static final long serialVersionUID = 3698345477322391456L; /** The default axis range. */ public static final Range DEFAULT_RANGE = new Range(0.0, 1.0); /** The default auto-range value. */ public static final boolean DEFAULT_AUTO_RANGE = true; /** The default inverted flag setting. */ public static final boolean DEFAULT_INVERTED = false; /** The default minimum auto range. */ public static final double DEFAULT_AUTO_RANGE_MINIMUM_SIZE = 0.00000001; /** The default value for the lower margin (0.05 = 5%). */ public static final double DEFAULT_LOWER_MARGIN = 0.05; /** The default value for the upper margin (0.05 = 5%). */ public static final double DEFAULT_UPPER_MARGIN = 0.05; /** The default auto-tick-unit-selection value. */ public static final boolean DEFAULT_AUTO_TICK_UNIT_SELECTION = true; /** The maximum tick count. */ public static final int MAXIMUM_TICK_COUNT = 500; /** * A flag that controls whether an arrow is drawn at the positive end of * the axis line. */ private boolean positiveArrowVisible; /** * A flag that controls whether an arrow is drawn at the negative end of * the axis line. */ private boolean negativeArrowVisible; /** The shape used for an up arrow. */ private transient Shape upArrow; /** The shape used for a down arrow. */ private transient Shape downArrow; /** The shape used for a left arrow. */ private transient Shape leftArrow; /** The shape used for a right arrow. */ private transient Shape rightArrow; /** A flag that affects the orientation of the values on the axis. */ private boolean inverted; /** The axis range. */ private Range range; /** * Flag that indicates whether the axis automatically scales to fit the * chart data. */ private boolean autoRange; /** The minimum size for the 'auto' axis range (excluding margins). */ private double autoRangeMinimumSize; /** * The default range is used when the dataset is empty and the axis needs * to determine the auto range. * * @since 1.0.5 */ private Range defaultAutoRange; /** * The upper margin percentage. This indicates the amount by which the * maximum axis value exceeds the maximum data value (as a percentage of * the range on the axis) when the axis range is determined automatically. */ private double upperMargin; /** * The lower margin. This is a percentage that indicates the amount by * which the minimum axis value is "less than" the minimum data value when * the axis range is determined automatically. */ private double lowerMargin; /** * If this value is positive, the amount is subtracted from the maximum * data value to determine the lower axis range. This can be used to * provide a fixed "window" on dynamic data. */ private double fixedAutoRange; /** * Flag that indicates whether or not the tick unit is selected * automatically. */ private boolean autoTickUnitSelection; /** The standard tick units for the axis. */ private TickUnitSource standardTickUnits; /** An index into an array of standard tick values. */ private int autoTickIndex; /** * The number of minor ticks per major tick unit. This is an override * field, if the value is > 0 it is used, otherwise the axis refers to the * minorTickCount in the current tickUnit. */ private int minorTickCount; /** A flag indicating whether or not tick labels are rotated to vertical. */ private boolean verticalTickLabels; /** * Constructs a value axis. * * @param label the axis label (<code>null</code> permitted). * @param standardTickUnits the source for standard tick units * (<code>null</code> permitted). */ protected ValueAxis(String label, TickUnitSource standardTickUnits) { super(label); this.positiveArrowVisible = false; this.negativeArrowVisible = false; this.range = DEFAULT_RANGE; this.autoRange = DEFAULT_AUTO_RANGE; this.defaultAutoRange = DEFAULT_RANGE; this.inverted = DEFAULT_INVERTED; this.autoRangeMinimumSize = DEFAULT_AUTO_RANGE_MINIMUM_SIZE; this.lowerMargin = DEFAULT_LOWER_MARGIN; this.upperMargin = DEFAULT_UPPER_MARGIN; this.fixedAutoRange = 0.0; this.autoTickUnitSelection = DEFAULT_AUTO_TICK_UNIT_SELECTION; this.standardTickUnits = standardTickUnits; Polygon p1 = new Polygon(); p1.addPoint(0, 0); p1.addPoint(-2, 2); p1.addPoint(2, 2); this.upArrow = p1; Polygon p2 = new Polygon(); p2.addPoint(0, 0); p2.addPoint(-2, -2); p2.addPoint(2, -2); this.downArrow = p2; Polygon p3 = new Polygon(); p3.addPoint(0, 0); p3.addPoint(-2, -2); p3.addPoint(-2, 2); this.rightArrow = p3; Polygon p4 = new Polygon(); p4.addPoint(0, 0); p4.addPoint(2, -2); p4.addPoint(2, 2); this.leftArrow = p4; this.verticalTickLabels = false; this.minorTickCount = 0; } /** * Returns <code>true</code> if the tick labels should be rotated (to * vertical), and <code>false</code> otherwise. * * @return <code>true</code> or <code>false</code>. * * @see #setVerticalTickLabels(boolean) */ public boolean isVerticalTickLabels() { return this.verticalTickLabels; } /** * Sets the flag that controls whether the tick labels are displayed * vertically (that is, rotated 90 degrees from horizontal). If the flag * is changed, an {@link AxisChangeEvent} is sent to all registered * listeners. * * @param flag the flag. * * @see #isVerticalTickLabels() */ public void setVerticalTickLabels(boolean flag) { if (this.verticalTickLabels != flag) { this.verticalTickLabels = flag; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns a flag that controls whether or not the axis line has an arrow * drawn that points in the positive direction for the axis. * * @return A boolean. * * @see #setPositiveArrowVisible(boolean) */ public boolean isPositiveArrowVisible() { return this.positiveArrowVisible; } /** * Sets a flag that controls whether or not the axis lines has an arrow * drawn that points in the positive direction for the axis, and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param visible the flag. * * @see #isPositiveArrowVisible() */ public void setPositiveArrowVisible(boolean visible) { this.positiveArrowVisible = visible; notifyListeners(new AxisChangeEvent(this)); } /** * Returns a flag that controls whether or not the axis line has an arrow * drawn that points in the negative direction for the axis. * * @return A boolean. * * @see #setNegativeArrowVisible(boolean) */ public boolean isNegativeArrowVisible() { return this.negativeArrowVisible; } /** * Sets a flag that controls whether or not the axis lines has an arrow * drawn that points in the negative direction for the axis, and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param visible the flag. * * @see #setNegativeArrowVisible(boolean) */ public void setNegativeArrowVisible(boolean visible) { this.negativeArrowVisible = visible; notifyListeners(new AxisChangeEvent(this)); } /** * Returns a shape that can be displayed as an arrow pointing upwards at * the end of an axis line. * * @return A shape (never <code>null</code>). * * @see #setUpArrow(Shape) */ public Shape getUpArrow() { return this.upArrow; } /** * Sets the shape that can be displayed as an arrow pointing upwards at * the end of an axis line and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param arrow the arrow shape (<code>null</code> not permitted). * * @see #getUpArrow() */ public void setUpArrow(Shape arrow) { if (arrow == null) { throw new IllegalArgumentException("Null 'arrow' argument."); } this.upArrow = arrow; notifyListeners(new AxisChangeEvent(this)); } /** * Returns a shape that can be displayed as an arrow pointing downwards at * the end of an axis line. * * @return A shape (never <code>null</code>). * * @see #setDownArrow(Shape) */ public Shape getDownArrow() { return this.downArrow; } /** * Sets the shape that can be displayed as an arrow pointing downwards at * the end of an axis line and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param arrow the arrow shape (<code>null</code> not permitted). * * @see #getDownArrow() */ public void setDownArrow(Shape arrow) { if (arrow == null) { throw new IllegalArgumentException("Null 'arrow' argument."); } this.downArrow = arrow; notifyListeners(new AxisChangeEvent(this)); } /** * Returns a shape that can be displayed as an arrow pointing left at the * end of an axis line. * * @return A shape (never <code>null</code>). * * @see #setLeftArrow(Shape) */ public Shape getLeftArrow() { return this.leftArrow; } /** * Sets the shape that can be displayed as an arrow pointing left at the * end of an axis line and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param arrow the arrow shape (<code>null</code> not permitted). * * @see #getLeftArrow() */ public void setLeftArrow(Shape arrow) { if (arrow == null) { throw new IllegalArgumentException("Null 'arrow' argument."); } this.leftArrow = arrow; notifyListeners(new AxisChangeEvent(this)); } /** * Returns a shape that can be displayed as an arrow pointing right at the * end of an axis line. * * @return A shape (never <code>null</code>). * * @see #setRightArrow(Shape) */ public Shape getRightArrow() { return this.rightArrow; } /** * Sets the shape that can be displayed as an arrow pointing rightwards at * the end of an axis line and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param arrow the arrow shape (<code>null</code> not permitted). * * @see #getRightArrow() */ public void setRightArrow(Shape arrow) { if (arrow == null) { throw new IllegalArgumentException("Null 'arrow' argument."); } this.rightArrow = arrow; notifyListeners(new AxisChangeEvent(this)); } /** * Draws an axis line at the current cursor position and edge. * * @param g2 the graphics device. * @param cursor the cursor position. * @param dataArea the data area. * @param edge the edge. */ protected void drawAxisLine(Graphics2D g2, double cursor, Rectangle2D dataArea, RectangleEdge edge) { Line2D axisLine = null; if (edge == RectangleEdge.TOP) { axisLine = new Line2D.Double(dataArea.getX(), cursor, dataArea.getMaxX(), cursor); } else if (edge == RectangleEdge.BOTTOM) { axisLine = new Line2D.Double(dataArea.getX(), cursor, dataArea.getMaxX(), cursor); } else if (edge == RectangleEdge.LEFT) { axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, dataArea.getMaxY()); } else if (edge == RectangleEdge.RIGHT) { axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, dataArea.getMaxY()); } g2.setPaint(getAxisLinePaint()); g2.setStroke(getAxisLineStroke()); g2.draw(axisLine); boolean drawUpOrRight = false; boolean drawDownOrLeft = false; if (this.positiveArrowVisible) { if (this.inverted) { drawDownOrLeft = true; } else { drawUpOrRight = true; } } if (this.negativeArrowVisible) { if (this.inverted) { drawUpOrRight = true; } else { drawDownOrLeft = true; } } if (drawUpOrRight) { double x = 0.0; double y = 0.0; Shape arrow = null; if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) { x = dataArea.getMaxX(); y = cursor; arrow = this.rightArrow; } else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) { x = cursor; y = dataArea.getMinY(); arrow = this.upArrow; } // draw the arrow... AffineTransform transformer = new AffineTransform(); transformer.setToTranslation(x, y); Shape shape = transformer.createTransformedShape(arrow); g2.fill(shape); g2.draw(shape); } if (drawDownOrLeft) { double x = 0.0; double y = 0.0; Shape arrow = null; if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) { x = dataArea.getMinX(); y = cursor; arrow = this.leftArrow; } else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) { x = cursor; y = dataArea.getMaxY(); arrow = this.downArrow; } // draw the arrow... AffineTransform transformer = new AffineTransform(); transformer.setToTranslation(x, y); Shape shape = transformer.createTransformedShape(arrow); g2.fill(shape); g2.draw(shape); } } /** * Calculates the anchor point for a tick label. * * @param tick the tick. * @param cursor the cursor. * @param dataArea the data area. * @param edge the edge on which the axis is drawn. * * @return The x and y coordinates of the anchor point. */ protected float[] calculateAnchorPoint(ValueTick tick, double cursor, Rectangle2D dataArea, RectangleEdge edge) { RectangleInsets insets = getTickLabelInsets(); float[] result = new float[2]; if (edge == RectangleEdge.TOP) { result[0] = (float) valueToJava2D(tick.getValue(), dataArea, edge); result[1] = (float) (cursor - insets.getBottom() - 2.0); } else if (edge == RectangleEdge.BOTTOM) { result[0] = (float) valueToJava2D(tick.getValue(), dataArea, edge); result[1] = (float) (cursor + insets.getTop() + 2.0); } else if (edge == RectangleEdge.LEFT) { result[0] = (float) (cursor - insets.getLeft() - 2.0); result[1] = (float) valueToJava2D(tick.getValue(), dataArea, edge); } else if (edge == RectangleEdge.RIGHT) { result[0] = (float) (cursor + insets.getRight() + 2.0); result[1] = (float) valueToJava2D(tick.getValue(), dataArea, edge); } return result; } /** * Draws the axis line, tick marks and tick mark labels. * * @param g2 the graphics device. * @param cursor the cursor. * @param plotArea the plot area. * @param dataArea the data area. * @param edge the edge that the axis is aligned with. * @param info the plot rendering info. * * @return The width or height used to draw the axis. */ protected AxisState drawTickMarksAndLabels(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, PlotRenderingInfo info) { AxisState state = new AxisState(cursor); if (isAxisLineVisible()) { drawAxisLine(g2, cursor, dataArea, edge); } List ticks = refreshTicks(g2, state, dataArea, edge); state.setTicks(ticks); g2.setFont(getTickLabelFont()); Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { ValueTick tick = (ValueTick) iterator.next(); if (isTickLabelsVisible()) { g2.setPaint(getTickLabelPaint()); float[] anchorPoint = calculateAnchorPoint(tick, cursor, dataArea, edge); TextUtilities.drawRotatedString(tick.getText(), g2, anchorPoint[0], anchorPoint[1], tick.getTextAnchor(), tick.getAngle(), tick.getRotationAnchor()); } if ((isTickMarksVisible() && tick.getTickType().equals( TickType.MAJOR)) || (isMinorTickMarksVisible() && tick.getTickType().equals(TickType.MINOR))) { double ol = (tick.getTickType().equals(TickType.MINOR)) ? getMinorTickMarkOutsideLength() : getTickMarkOutsideLength(); double il = (tick.getTickType().equals(TickType.MINOR)) ? getMinorTickMarkInsideLength() : getTickMarkInsideLength(); float xx = (float) valueToJava2D(tick.getValue(), dataArea, edge); Line2D mark = null; g2.setStroke(getTickMarkStroke()); g2.setPaint(getTickMarkPaint()); if (edge == RectangleEdge.LEFT) { mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx); } else if (edge == RectangleEdge.RIGHT) { mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx); } else if (edge == RectangleEdge.TOP) { mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il); } else if (edge == RectangleEdge.BOTTOM) { mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il); } g2.draw(mark); } } // need to work out the space used by the tick labels... // so we can update the cursor... double used = 0.0; if (isTickLabelsVisible()) { if (edge == RectangleEdge.LEFT) { used += findMaximumTickLabelWidth(ticks, g2, plotArea, isVerticalTickLabels()); state.cursorLeft(used); } else if (edge == RectangleEdge.RIGHT) { used = findMaximumTickLabelWidth(ticks, g2, plotArea, isVerticalTickLabels()); state.cursorRight(used); } else if (edge == RectangleEdge.TOP) { used = findMaximumTickLabelHeight(ticks, g2, plotArea, isVerticalTickLabels()); state.cursorUp(used); } else if (edge == RectangleEdge.BOTTOM) { used = findMaximumTickLabelHeight(ticks, g2, plotArea, isVerticalTickLabels()); state.cursorDown(used); } } return state; } /** * Returns the space required to draw the axis. * * @param g2 the graphics device. * @param plot the plot that the axis belongs to. * @param plotArea the area within which the plot should be drawn. * @param edge the axis location. * @param space the space already reserved (for other axes). * * @return The space required to draw the axis (including pre-reserved * space). */ public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) { // create a new space object if one wasn't supplied... if (space == null) { space = new AxisSpace(); } // if the axis is not visible, no additional space is required... if (!isVisible()) { return space; } // if the axis has a fixed dimension, return it... double dimension = getFixedDimension(); if (dimension > 0.0) { space.ensureAtLeast(dimension, edge); } // calculate the max size of the tick labels (if visible)... double tickLabelHeight = 0.0; double tickLabelWidth = 0.0; if (isTickLabelsVisible()) { g2.setFont(getTickLabelFont()); List ticks = refreshTicks(g2, new AxisState(), plotArea, edge); if (RectangleEdge.isTopOrBottom(edge)) { tickLabelHeight = findMaximumTickLabelHeight(ticks, g2, plotArea, isVerticalTickLabels()); } else if (RectangleEdge.isLeftOrRight(edge)) { tickLabelWidth = findMaximumTickLabelWidth(ticks, g2, plotArea, isVerticalTickLabels()); } } // get the axis label size and update the space object... Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge); double labelHeight = 0.0; double labelWidth = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { labelHeight = labelEnclosure.getHeight(); space.add(labelHeight + tickLabelHeight, edge); } else if (RectangleEdge.isLeftOrRight(edge)) { labelWidth = labelEnclosure.getWidth(); space.add(labelWidth + tickLabelWidth, edge); } return space; } /** * A utility method for determining the height of the tallest tick label. * * @param ticks the ticks. * @param g2 the graphics device. * @param drawArea the area within which the plot and axes should be drawn. * @param vertical a flag that indicates whether or not the tick labels * are 'vertical'. * * @return The height of the tallest tick label. */ protected double findMaximumTickLabelHeight(List ticks, Graphics2D g2, Rectangle2D drawArea, boolean vertical) { RectangleInsets insets = getTickLabelInsets(); Font font = getTickLabelFont(); double maxHeight = 0.0; if (vertical) { FontMetrics fm = g2.getFontMetrics(font); Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { Tick tick = (Tick) iterator.next(); Rectangle2D labelBounds = TextUtilities.getTextBounds( tick.getText(), g2, fm); if (labelBounds.getWidth() + insets.getTop() + insets.getBottom() > maxHeight) { maxHeight = labelBounds.getWidth() + insets.getTop() + insets.getBottom(); } } } else { LineMetrics metrics = font.getLineMetrics("ABCxyz", g2.getFontRenderContext()); maxHeight = metrics.getHeight() + insets.getTop() + insets.getBottom(); } return maxHeight; } /** * A utility method for determining the width of the widest tick label. * * @param ticks the ticks. * @param g2 the graphics device. * @param drawArea the area within which the plot and axes should be drawn. * @param vertical a flag that indicates whether or not the tick labels * are 'vertical'. * * @return The width of the tallest tick label. */ protected double findMaximumTickLabelWidth(List ticks, Graphics2D g2, Rectangle2D drawArea, boolean vertical) { RectangleInsets insets = getTickLabelInsets(); Font font = getTickLabelFont(); double maxWidth = 0.0; if (!vertical) { FontMetrics fm = g2.getFontMetrics(font); Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { Tick tick = (Tick) iterator.next(); Rectangle2D labelBounds = TextUtilities.getTextBounds( tick.getText(), g2, fm); if (labelBounds.getWidth() + insets.getLeft() + insets.getRight() > maxWidth) { maxWidth = labelBounds.getWidth() + insets.getLeft() + insets.getRight(); } } } else { LineMetrics metrics = font.getLineMetrics("ABCxyz", g2.getFontRenderContext()); maxWidth = metrics.getHeight() + insets.getTop() + insets.getBottom(); } return maxWidth; } /** * Returns a flag that controls the direction of values on the axis. * <P> * For a regular axis, values increase from left to right (for a horizontal * axis) and bottom to top (for a vertical axis). When the axis is * 'inverted', the values increase in the opposite direction. * * @return The flag. * * @see #setInverted(boolean) */ public boolean isInverted() { return this.inverted; } /** * Sets a flag that controls the direction of values on the axis, and * notifies registered listeners that the axis has changed. * * @param flag the flag. * * @see #isInverted() */ public void setInverted(boolean flag) { if (this.inverted != flag) { this.inverted = flag; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns the flag that controls whether or not the axis range is * automatically adjusted to fit the data values. * * @return The flag. * * @see #setAutoRange(boolean) */ public boolean isAutoRange() { return this.autoRange; } /** * Sets a flag that determines whether or not the axis range is * automatically adjusted to fit the data, and notifies registered * listeners that the axis has been modified. * * @param auto the new value of the flag. * * @see #isAutoRange() */ public void setAutoRange(boolean auto) { setAutoRange(auto, true); } /** * Sets the auto range attribute. If the <code>notify</code> flag is set, * an {@link AxisChangeEvent} is sent to registered listeners. * * @param auto the flag. * @param notify notify listeners? * * @see #isAutoRange() */ protected void setAutoRange(boolean auto, boolean notify) { if (this.autoRange != auto) { this.autoRange = auto; if (this.autoRange) { autoAdjustRange(); } if (notify) { notifyListeners(new AxisChangeEvent(this)); } } } /** * Returns the minimum size allowed for the axis range when it is * automatically calculated. * * @return The minimum range. * * @see #setAutoRangeMinimumSize(double) */ public double getAutoRangeMinimumSize() { return this.autoRangeMinimumSize; } /** * Sets the auto range minimum size and sends an {@link AxisChangeEvent} * to all registered listeners. * * @param size the size. * * @see #getAutoRangeMinimumSize() */ public void setAutoRangeMinimumSize(double size) { setAutoRangeMinimumSize(size, true); } /** * Sets the minimum size allowed for the axis range when it is * automatically calculated. * <p> * If requested, an {@link AxisChangeEvent} is forwarded to all registered * listeners. * * @param size the new minimum. * @param notify notify listeners? */ public void setAutoRangeMinimumSize(double size, boolean notify) { if (size <= 0.0) { throw new IllegalArgumentException( "NumberAxis.setAutoRangeMinimumSize(double): must be > 0.0."); } if (this.autoRangeMinimumSize != size) { this.autoRangeMinimumSize = size; if (this.autoRange) { autoAdjustRange(); } if (notify) { notifyListeners(new AxisChangeEvent(this)); } } } /** * Returns the default auto range. * * @return The default auto range (never <code>null</code>). * * @see #setDefaultAutoRange(Range) * * @since 1.0.5 */ public Range getDefaultAutoRange() { return this.defaultAutoRange; } /** * Sets the default auto range and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param range the range (<code>null</code> not permitted). * * @see #getDefaultAutoRange() * * @since 1.0.5 */ public void setDefaultAutoRange(Range range) { if (range == null) { throw new IllegalArgumentException("Null 'range' argument."); } this.defaultAutoRange = range; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the lower margin for the axis, expressed as a percentage of the * axis range. This controls the space added to the lower end of the axis * when the axis range is automatically calculated (it is ignored when the * axis range is set explicitly). The default value is 0.05 (five percent). * * @return The lower margin. * * @see #setLowerMargin(double) */ public double getLowerMargin() { return this.lowerMargin; } /** * Sets the lower margin for the axis (as a percentage of the axis range) * and sends an {@link AxisChangeEvent} to all registered listeners. This * margin is added only when the axis range is auto-calculated - if you set * the axis range manually, the margin is ignored. * * @param margin the margin percentage (for example, 0.05 is five percent). * * @see #getLowerMargin() * @see #setUpperMargin(double) */ public void setLowerMargin(double margin) { this.lowerMargin = margin; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); } /** * Returns the upper margin for the axis, expressed as a percentage of the * axis range. This controls the space added to the lower end of the axis * when the axis range is automatically calculated (it is ignored when the * axis range is set explicitly). The default value is 0.05 (five percent). * * @return The upper margin. * * @see #setUpperMargin(double) */ public double getUpperMargin() { return this.upperMargin; } /** * Sets the upper margin for the axis (as a percentage of the axis range) * and sends an {@link AxisChangeEvent} to all registered listeners. This * margin is added only when the axis range is auto-calculated - if you set * the axis range manually, the margin is ignored. * * @param margin the margin percentage (for example, 0.05 is five percent). * * @see #getLowerMargin() * @see #setLowerMargin(double) */ public void setUpperMargin(double margin) { this.upperMargin = margin; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); } /** * Returns the fixed auto range. * * @return The length. * * @see #setFixedAutoRange(double) */ public double getFixedAutoRange() { return this.fixedAutoRange; } /** * Sets the fixed auto range for the axis. * * @param length the range length. * * @see #getFixedAutoRange() */ public void setFixedAutoRange(double length) { this.fixedAutoRange = length; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); } /** * Returns the lower bound of the axis range. * * @return The lower bound. * * @see #setLowerBound(double) */ public double getLowerBound() { return this.range.getLowerBound(); } /** * Sets the lower bound for the axis range. An {@link AxisChangeEvent} is * sent to all registered listeners. * * @param min the new minimum. * * @see #getLowerBound() */ public void setLowerBound(double min) { if (this.range.getUpperBound() > min) { setRange(new Range(min, this.range.getUpperBound())); } else { setRange(new Range(min, min + 1.0)); } } /** * Returns the upper bound for the axis range. * * @return The upper bound. * * @see #setUpperBound(double) */ public double getUpperBound() { return this.range.getUpperBound(); } /** * Sets the upper bound for the axis range, and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param max the new maximum. * * @see #getUpperBound() */ public void setUpperBound(double max) { if (this.range.getLowerBound() < max) { setRange(new Range(this.range.getLowerBound(), max)); } else { setRange(max - 1.0, max); } } /** * Returns the range for the axis. * * @return The axis range (never <code>null</code>). * * @see #setRange(Range) */ public Range getRange() { return this.range; } /** * Sets the range attribute and sends an {@link AxisChangeEvent} to all * registered listeners. As a side-effect, the auto-range flag is set to * <code>false</code>. * * @param range the range (<code>null</code> not permitted). * * @see #getRange() */ public void setRange(Range range) { // defer argument checking setRange(range, true, true); } /** * Sets the range for the axis, if requested, sends an * {@link AxisChangeEvent} to all registered listeners. As a side-effect, * the auto-range flag is set to <code>false</code> (optional). * * @param range the range (<code>null</code> not permitted). * @param turnOffAutoRange a flag that controls whether or not the auto * range is turned off. * @param notify a flag that controls whether or not listeners are * notified. * * @see #getRange() */ public void setRange(Range range, boolean turnOffAutoRange, boolean notify) { if (range == null) { throw new IllegalArgumentException("Null 'range' argument."); } if (turnOffAutoRange) { this.autoRange = false; } this.range = range; if (notify) { notifyListeners(new AxisChangeEvent(this)); } } /** * Sets the axis range and sends an {@link AxisChangeEvent} to all * registered listeners. As a side-effect, the auto-range flag is set to * <code>false</code>. * * @param lower the lower axis limit. * @param upper the upper axis limit. * * @see #getRange() * @see #setRange(Range) */ public void setRange(double lower, double upper) { setRange(new Range(lower, upper)); } /** * Sets the range for the axis (after first adding the current margins to * the specified range) and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param range the range (<code>null</code> not permitted). */ public void setRangeWithMargins(Range range) { setRangeWithMargins(range, true, true); } /** * Sets the range for the axis after first adding the current margins to * the range and, if requested, sends an {@link AxisChangeEvent} to all * registered listeners. As a side-effect, the auto-range flag is set to * <code>false</code> (optional). * * @param range the range (excluding margins, <code>null</code> not * permitted). * @param turnOffAutoRange a flag that controls whether or not the auto * range is turned off. * @param notify a flag that controls whether or not listeners are * notified. */ public void setRangeWithMargins(Range range, boolean turnOffAutoRange, boolean notify) { if (range == null) { throw new IllegalArgumentException("Null 'range' argument."); } setRange(Range.expand(range, getLowerMargin(), getUpperMargin()), turnOffAutoRange, notify); } /** * Sets the axis range (after first adding the current margins to the * range) and sends an {@link AxisChangeEvent} to all registered listeners. * As a side-effect, the auto-range flag is set to <code>false</code>. * * @param lower the lower axis limit. * @param upper the upper axis limit. */ public void setRangeWithMargins(double lower, double upper) { setRangeWithMargins(new Range(lower, upper)); } /** * Sets the axis range, where the new range is 'size' in length, and * centered on 'value'. * * @param value the central value. * @param length the range length. */ public void setRangeAboutValue(double value, double length) { setRange(new Range(value - length / 2, value + length / 2)); } /** * Returns a flag indicating whether or not the tick unit is automatically * selected from a range of standard tick units. * * @return A flag indicating whether or not the tick unit is automatically * selected. * * @see #setAutoTickUnitSelection(boolean) */ public boolean isAutoTickUnitSelection() { return this.autoTickUnitSelection; } /** * Sets a flag indicating whether or not the tick unit is automatically * selected from a range of standard tick units. If the flag is changed, * registered listeners are notified that the chart has changed. * * @param flag the new value of the flag. * * @see #isAutoTickUnitSelection() */ public void setAutoTickUnitSelection(boolean flag) { setAutoTickUnitSelection(flag, true); } /** * Sets a flag indicating whether or not the tick unit is automatically * selected from a range of standard tick units. * * @param flag the new value of the flag. * @param notify notify listeners? * * @see #isAutoTickUnitSelection() */ public void setAutoTickUnitSelection(boolean flag, boolean notify) { if (this.autoTickUnitSelection != flag) { this.autoTickUnitSelection = flag; if (notify) { notifyListeners(new AxisChangeEvent(this)); } } } /** * Returns the source for obtaining standard tick units for the axis. * * @return The source (possibly <code>null</code>). * * @see #setStandardTickUnits(TickUnitSource) */ public TickUnitSource getStandardTickUnits() { return this.standardTickUnits; } /** * Sets the source for obtaining standard tick units for the axis and sends * an {@link AxisChangeEvent} to all registered listeners. The axis will * try to select the smallest tick unit from the source that does not cause * the tick labels to overlap (see also the * {@link #setAutoTickUnitSelection(boolean)} method. * * @param source the source for standard tick units (<code>null</code> * permitted). * * @see #getStandardTickUnits() */ public void setStandardTickUnits(TickUnitSource source) { this.standardTickUnits = source; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the number of minor tick marks to display. * * @return The number of minor tick marks to display. * * @see #setMinorTickCount(int) * * @since 1.0.12 */ public int getMinorTickCount() { return this.minorTickCount; } /** * Sets the number of minor tick marks to display, and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param count the count. * * @see #getMinorTickCount() * * @since 1.0.12 */ public void setMinorTickCount(int count) { this.minorTickCount = count; notifyListeners(new AxisChangeEvent(this)); } /** * Converts a data value to a coordinate in Java2D space, assuming that the * axis runs along one edge of the specified dataArea. * <p> * Note that it is possible for the coordinate to fall outside the area. * * @param value the data value. * @param area the area for plotting the data. * @param edge the edge along which the axis lies. * * @return The Java2D coordinate. * * @see #java2DToValue(double, Rectangle2D, RectangleEdge) */ public abstract double valueToJava2D(double value, Rectangle2D area, RectangleEdge edge); /** * Converts a length in data coordinates into the corresponding length in * Java2D coordinates. * * @param length the length. * @param area the plot area. * @param edge the edge along which the axis lies. * * @return The length in Java2D coordinates. */ public double lengthToJava2D(double length, Rectangle2D area, RectangleEdge edge) { double zero = valueToJava2D(0.0, area, edge); double l = valueToJava2D(length, area, edge); return Math.abs(l - zero); } /** * Converts a coordinate in Java2D space to the corresponding data value, * assuming that the axis runs along one edge of the specified dataArea. * * @param java2DValue the coordinate in Java2D space. * @param area the area in which the data is plotted. * @param edge the edge along which the axis lies. * * @return The data value. * * @see #valueToJava2D(double, Rectangle2D, RectangleEdge) */ public abstract double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge); /** * Automatically sets the axis range to fit the range of values in the * dataset. Sometimes this can depend on the renderer used as well (for * example, the renderer may "stack" values, requiring an axis range * greater than otherwise necessary). */ protected abstract void autoAdjustRange(); /** * Centers the axis range about the specified value and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param value the center value. */ public void centerRange(double value) { double central = this.range.getCentralValue(); Range adjusted = new Range(this.range.getLowerBound() + value - central, this.range.getUpperBound() + value - central); setRange(adjusted); } /** * Increases or decreases the axis range by the specified percentage about * the central value and sends an {@link AxisChangeEvent} to all registered * listeners. * <P> * To double the length of the axis range, use 200% (2.0). * To halve the length of the axis range, use 50% (0.5). * * @param percent the resize factor. * * @see #resizeRange(double, double) */ public void resizeRange(double percent) { resizeRange(percent, this.range.getCentralValue()); } /** * Increases or decreases the axis range by the specified percentage about * the specified anchor value and sends an {@link AxisChangeEvent} to all * registered listeners. * <P> * To double the length of the axis range, use 200% (2.0). * To halve the length of the axis range, use 50% (0.5). * * @param percent the resize factor. * @param anchorValue the new central value after the resize. * * @see #resizeRange(double) */ public void resizeRange(double percent, double anchorValue) { if (percent > 0.0) { double halfLength = this.range.getLength() * percent / 2; Range adjusted = new Range(anchorValue - halfLength, anchorValue + halfLength); setRange(adjusted); } else { setAutoRange(true); } } /** * Increases or decreases the axis range by the specified percentage about * the specified anchor value and sends an {@link AxisChangeEvent} to all * registered listeners. * <P> * To double the length of the axis range, use 200% (2.0). * To halve the length of the axis range, use 50% (0.5). * * @param percent the resize factor. * @param anchorValue the new central value after the resize. * * @see #resizeRange(double) * * @since 1.0.13 */ public void resizeRange2(double percent, double anchorValue) { if (percent > 0.0) { double left = anchorValue - getLowerBound(); double right = getUpperBound() - anchorValue; Range adjusted = new Range(anchorValue - left * percent, anchorValue + right * percent); setRange(adjusted); } else { setAutoRange(true); } } /** * Zooms in on the current range. * * @param lowerPercent the new lower bound. * @param upperPercent the new upper bound. */ public void zoomRange(double lowerPercent, double upperPercent) { double start = this.range.getLowerBound(); double length = this.range.getLength(); Range adjusted = null; if (isInverted()) { adjusted = new Range(start + (length * (1 - upperPercent)), start + (length * (1 - lowerPercent))); } else { adjusted = new Range(start + length * lowerPercent, start + length * upperPercent); } setRange(adjusted); } /** * Slides the axis range by the specified percentage. * * @param percent the percentage. * * @since 1.0.13 */ public void pan(double percent) { Range range = getRange(); double length = range.getLength(); double adj = length * percent; double lower = range.getLowerBound() + adj; double upper = range.getUpperBound() + adj; setRange(lower, upper); } /** * Returns the auto tick index. * * @return The auto tick index. * * @see #setAutoTickIndex(int) */ protected int getAutoTickIndex() { return this.autoTickIndex; } /** * Sets the auto tick index. * * @param index the new value. * * @see #getAutoTickIndex() */ protected void setAutoTickIndex(int index) { this.autoTickIndex = index; } /** * Tests the axis for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return <code>true</code> or <code>false</code>. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ValueAxis)) { return false; } ValueAxis that = (ValueAxis) obj; if (this.positiveArrowVisible != that.positiveArrowVisible) { return false; } if (this.negativeArrowVisible != that.negativeArrowVisible) { return false; } if (this.inverted != that.inverted) { return false; } // if autoRange is true, then the current range is irrelevant if (!this.autoRange && !ObjectUtilities.equal(this.range, that.range)) { return false; } if (this.autoRange != that.autoRange) { return false; } if (this.autoRangeMinimumSize != that.autoRangeMinimumSize) { return false; } if (!this.defaultAutoRange.equals(that.defaultAutoRange)) { return false; } if (this.upperMargin != that.upperMargin) { return false; } if (this.lowerMargin != that.lowerMargin) { return false; } if (this.fixedAutoRange != that.fixedAutoRange) { return false; } if (this.autoTickUnitSelection != that.autoTickUnitSelection) { return false; } if (!ObjectUtilities.equal(this.standardTickUnits, that.standardTickUnits)) { return false; } if (this.verticalTickLabels != that.verticalTickLabels) { return false; } if (this.minorTickCount != that.minorTickCount) { return false; } return super.equals(obj); } /** * Returns a clone of the object. * * @return A clone. * * @throws CloneNotSupportedException if some component of the axis does * not support cloning. */ public Object clone() throws CloneNotSupportedException { ValueAxis clone = (ValueAxis) super.clone(); return clone; } /** * Provides serialization support. * * @param stream the output stream. * * @throws IOException if there is an I/O error. */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtilities.writeShape(this.upArrow, stream); SerialUtilities.writeShape(this.downArrow, stream); SerialUtilities.writeShape(this.leftArrow, stream); SerialUtilities.writeShape(this.rightArrow, stream); } /** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.upArrow = SerialUtilities.readShape(stream); this.downArrow = SerialUtilities.readShape(stream); this.leftArrow = SerialUtilities.readShape(stream); this.rightArrow = SerialUtilities.readShape(stream); } }
[ "1193563986@qq.com" ]
1193563986@qq.com
4803b0246a8e07762bf66e09903a29524247646c
b36bd19e30a40413b82c8055d852a2c1a6ed27c3
/app/src/main/java/com/immimu/pm/vm/TaskManagerViewModelFactory.java
5385fbcc9d05906416f1ce4b6d610b32cd123550
[ "Apache-2.0" ]
permissive
immimu/project-manager
7ce714c3f6a1605a465c09c3f900f8fb028cfa37
94101b4292eb000e5287e5beb770b762e86a2173
refs/heads/master
2020-04-03T00:40:29.838436
2018-11-12T01:47:24
2018-11-12T01:47:24
154,905,332
0
0
null
null
null
null
UTF-8
Java
false
false
1,893
java
/* * Copyright (C) 2017 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.immimu.pm.vm; import android.arch.lifecycle.ViewModel; import android.arch.lifecycle.ViewModelProvider; import android.support.annotation.NonNull; import java.util.Map; import javax.inject.Inject; import javax.inject.Provider; import javax.inject.Singleton; @Singleton public class TaskManagerViewModelFactory implements ViewModelProvider.Factory { private final Map<Class<? extends ViewModel>, Provider<ViewModel>> creators; @Inject public TaskManagerViewModelFactory(Map<Class<? extends ViewModel>, Provider<ViewModel>> creators) { this.creators = creators; } @SuppressWarnings("unchecked") @Override public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { Provider<? extends ViewModel> creator = creators.get(modelClass); if (creator == null) { for (Map.Entry<Class<? extends ViewModel>, Provider<ViewModel>> entry : creators.entrySet()) { if (modelClass.isAssignableFrom(entry.getKey())) { creator = entry.getValue(); break; } } } if (creator == null) { throw new IllegalArgumentException("unknown model class " + modelClass); } try { return (T) creator.get(); } catch (Exception e) { throw new RuntimeException(e); } } }
[ "mubarakmiftah@gmail.com" ]
mubarakmiftah@gmail.com
1adaed69a825683512122434f5bf5ba9a1b1e881
db53f96c69b5fc7c6c060aebd7054448db3088fb
/src/baekjoon/problem1350.java
8cb5a88fe79d332f4458e2ddb3f0a42178fb8b70
[]
no_license
HyecheonLee/Algorithm
f4d4cb93530efb772b00d4a64cc49638491cce05
65e16515074bf0e412850fb5b2f51ec0122d2745
refs/heads/master
2020-06-20T12:11:06.753692
2016-11-27T04:15:58
2016-11-27T04:15:58
74,866,529
0
0
null
null
null
null
UTF-8
Java
false
false
1,234
java
package baekjoon; import java.math.BigInteger; import java.util.Scanner; /** * Created by ihyecheon on 2016. 6. 24.. */ public class problem1350 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int[] fileSize = new int[N]; long sum = 0; for (int i = 0; i < N; i++) { fileSize[i] = scanner.nextInt(); } int cluster = scanner.nextInt(); // int sum = 0; // int N = (int) (Math.random() * 1000); // int[] fileSize = new int[N]; // for (int i = 0; i < N; i++) { // fileSize[i] = (int) (Math.random() * 1000000000); // } // int cluster = (int) (Math.random() * 1048576); // int num = 0; for (int i = 0; i < N; i++) { sum += fileSize[i]; if (sum >= cluster) { num += (int) (sum / cluster); sum = sum % cluster; } } if (sum != 0) { num++; } BigInteger bigInteger = new BigInteger(String.valueOf(num)); bigInteger = bigInteger.multiply(BigInteger.valueOf(cluster)); System.out.println(bigInteger); } }
[ "rainbow880616@gmail.com" ]
rainbow880616@gmail.com
dedea419a22818617a4ad04d6e4d493ee101f41b
d0b977d5e13615e7b0454a9917816e6ba3c0539c
/components/org.wso2.carbon.identity.oauth/src/test/java/org/wso2/carbon/identity/oauth/util/ClaimCacheKeyTest.java
ec76a639d58bc5a4f6e805c1399e7ad84cc93970
[ "Apache-2.0" ]
permissive
Minoli/identity-inbound-auth-oauth
09ba6101f5cb050e2626b5ae51622eb97f8d599b
82b1a7962afb53ef7648e8bf7da6dda2effef61a
refs/heads/master
2021-07-14T13:46:45.707527
2017-10-19T08:58:02
2017-10-19T08:58:02
107,260,958
0
0
null
2017-10-17T11:45:22
2017-10-17T11:45:22
null
UTF-8
Java
false
false
2,841
java
/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. 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.wso2.carbon.identity.oauth.util; import org.testng.annotations.Test; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import static org.testng.Assert.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertTrue; /** * Test Class for the ClaimCacheKey. */ public class ClaimCacheKeyTest { DummyAuthenticatedUser dummy = new DummyAuthenticatedUser(); ClaimCacheKey testclass; @Test public void testEquals() { testclass = new ClaimCacheKey(dummy); assertFalse(testclass.equals("test")); ClaimCacheKey testclass2 = new ClaimCacheKey(dummy); assertTrue(testclass.equals(testclass2)); DummyAuthenticatedUser dummy2 = new DummyAuthenticatedUser(); dummy.setAuthenticatedSubjectIdentifier("test1"); dummy.setTenantDomain("test1Domain"); dummy2.setTenantDomain("test2Domain"); dummy2.setAuthenticatedSubjectIdentifier("test2"); testclass = new ClaimCacheKey(dummy); ClaimCacheKey testclass3 = new ClaimCacheKey(dummy2); assertFalse(testclass.equals(testclass3)); } @Test public void testHashCode() { testclass = new ClaimCacheKey(null); assertEquals(testclass.hashCode(), 0); dummy.setHashValue(10); testclass = new ClaimCacheKey(dummy); assertEquals(testclass.hashCode(), 310); } @Test public void testToString() { testclass = new ClaimCacheKey(null); assertEquals(testclass.toString(), "ClaimCacheKey{authenticatedUser='null'}"); testclass = new ClaimCacheKey(dummy); assertEquals(testclass.toString(), "ClaimCacheKey{authenticatedUser='test'}"); } class DummyAuthenticatedUser extends AuthenticatedUser { int hashValue; @Override public String toString() { return "test"; } public void setHashValue(int hashValue) { this.hashValue = hashValue; } @Override public int hashCode() { return hashValue; } } }
[ "inthiraj1994@gmail.com" ]
inthiraj1994@gmail.com
55e5078208a18de0a4680b10a7dee0b782680268
552f31305a76706b03143272355209f13cad9e45
/src/test/java/net/ttddyy/dsproxy/StatementQueryTest.java
759b876a512a8fce1e291ba6ee379ff80aaeb1e9
[ "MIT" ]
permissive
gavlyukovskiy/datasource-proxy
9e6d9fa34e1dd5b20e36d55b42eb2609755141a6
c33e3a094a64481d097b938382aa590634668909
refs/heads/master
2021-07-15T10:52:17.003144
2017-10-13T04:58:46
2017-10-13T04:58:46
106,852,987
2
0
null
2017-10-13T17:17:41
2017-10-13T17:17:40
null
UTF-8
Java
false
false
2,458
java
package net.ttddyy.dsproxy; import net.ttddyy.dsproxy.proxy.JdbcProxyFactory; import net.ttddyy.dsproxy.proxy.ProxyConfig; import net.ttddyy.dsproxy.proxy.SimpleResultSetProxyLogicFactory; import net.ttddyy.dsproxy.proxy.jdk.JdkJdbcProxyFactory; import net.ttddyy.dsproxy.proxy.jdk.ResultSetInvocationHandler; import org.junit.After; import org.junit.Before; import org.junit.Test; import javax.sql.DataSource; import java.lang.reflect.Proxy; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import static org.assertj.core.api.Assertions.assertThat; /** * @author Tadaya Tsuyukubo */ public class StatementQueryTest { private DataSource jdbcDataSource; @Before public void setup() throws Exception { // real datasource jdbcDataSource = TestUtils.getDataSourceWithData(); } @After public void teardown() throws Exception { TestUtils.shutdown(jdbcDataSource); } @Test public void resultSetProxy() throws Throwable { Connection conn = this.jdbcDataSource.getConnection(); Statement st = conn.createStatement(); JdbcProxyFactory proxyFactory = new JdkJdbcProxyFactory(); ProxyConfig proxyConfig = ProxyConfig.Builder.create().resultSetProxyLogicFactory(new SimpleResultSetProxyLogicFactory()).build(); Statement proxySt = proxyFactory.createStatement(st, new ConnectionInfo(), conn, proxyConfig); // verify executeQuery ResultSet result = proxySt.executeQuery("select * from emp;"); assertThat(result).isInstanceOf(ResultSet.class); assertThat(Proxy.isProxyClass(result.getClass())).isTrue(); assertThat(Proxy.getInvocationHandler(result)).isExactlyInstanceOf(ResultSetInvocationHandler.class); // verify getResultSet proxySt.execute("select * from emp;"); result = proxySt.getResultSet(); assertThat(result).isInstanceOf(ResultSet.class); assertThat(Proxy.isProxyClass(result.getClass())).isTrue(); assertThat(Proxy.getInvocationHandler(result)).isExactlyInstanceOf(ResultSetInvocationHandler.class); // verify getGeneratedKeys result = proxySt.getGeneratedKeys(); assertThat(result).isInstanceOf(ResultSet.class); assertThat(Proxy.isProxyClass(result.getClass())).isTrue(); assertThat(Proxy.getInvocationHandler(result)).isExactlyInstanceOf(ResultSetInvocationHandler.class); } }
[ "tadaya@ttddyy.net" ]
tadaya@ttddyy.net
ad330a4bf7fdb0560649b7c0cde029948df268ba
eb7703996ef61cfba48f8017cc2a6bfe3e87bcb3
/src/main/java/org/jenkinsci/plugins/redmine/RedmineLinkChangeLogAnnotator.java
4c58d0a5b0648599a3e8ef8a192e36e9b35f3639
[]
no_license
murtzsarialtun/jenkins-redmine-plugin
b182852c4cdb791db873478c3d0df00008e1c1d0
348722a02553a20c53185aa82934cb31d54f4421
refs/heads/master
2023-08-03T13:17:49.896217
2021-10-04T10:09:46
2021-10-04T10:09:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,011
java
package org.jenkinsci.plugins.redmine; import hudson.Extension; import hudson.MarkupText; import hudson.model.Run; import hudson.scm.ChangeLogAnnotator; import hudson.scm.ChangeLogSet.Entry; import java.util.Optional; /** * ChangeLogAnnotator to create issue links for issue references en commit messages. * * @see https://redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages * @author didiez */ @Extension public class RedmineLinkChangeLogAnnotator extends ChangeLogAnnotator { @Override public void annotate(Run<?, ?> build, Entry change, MarkupText text) { Optional.ofNullable(build.getParent().getProperty(RedmineWebsiteJobProperty.class)) .flatMap(prop -> RedmineGlobalConfiguration.get().findWebsiteByName(prop.getWebsiteName())) .ifPresent( redmineWebsite -> { String url = redmineWebsite.getBaseUrl(); redmineWebsite.getRedmineLinkMarkupProcessor().process(text, url); }); } }
[ "diegodiez.ddr@gmail.com" ]
diegodiez.ddr@gmail.com
43332af7750bd28f752947a975bb51539fc07dab
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/JxPath-22/org.apache.commons.jxpath.ri.model.dom.DOMNodePointer/BBC-F0-opt-60/23/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer_ESTest_scaffolding.java
633d7e03a4f2161612e7636792bee93bc0ae93a4
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
20,724
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Oct 23 00:13:04 GMT 2021 */ package org.apache.commons.jxpath.ri.model.dom; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class DOMNodePointer_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.jxpath.ri.model.dom.DOMNodePointer"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { /*No java.lang.System property to set*/ } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DOMNodePointer_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.jxpath.Variables", "org.apache.html.dom.HTMLLinkElementImpl", "org.apache.html.dom.HTMLPreElementImpl", "org.apache.wml.dom.WMLEmElementImpl", "org.apache.commons.jxpath.ri.model.beans.PropertyPointer", "org.apache.commons.jxpath.ri.model.beans.BeanPointer", "org.apache.commons.jxpath.util.BasicTypeConverter", "org.apache.wml.dom.WMLPrevElementImpl", "org.apache.wml.WMLUElement", "org.apache.html.dom.HTMLTextAreaElementImpl", "org.apache.wml.WMLIElement", "org.apache.html.dom.HTMLHeadingElementImpl", "org.apache.html.dom.HTMLLIElementImpl", "org.apache.commons.jxpath.ri.model.NodeIterator", "org.apache.html.dom.HTMLFrameSetElementImpl", "org.apache.commons.jxpath.ri.compiler.CoreOperationCompare", "org.apache.commons.jxpath.ExpressionContext", "org.apache.commons.jxpath.ri.model.dom.DOMAttributePointer", "org.apache.wml.dom.WMLAccessElementImpl", "org.apache.html.dom.HTMLBodyElementImpl", "org.apache.wml.dom.WMLHeadElementImpl", "org.apache.commons.jxpath.ri.model.beans.CollectionPointer", "org.apache.wml.WMLCardElement", "org.apache.wml.WMLOneventElement", "org.apache.commons.jxpath.JXPathContext", "org.apache.html.dom.HTMLTableSectionElementImpl", "org.apache.wml.WMLNoopElement", "org.apache.commons.jxpath.ri.compiler.TreeCompiler", "org.apache.wml.WMLBrElement", "org.apache.html.dom.HTMLHeadElementImpl", "org.apache.wml.dom.WMLNoopElementImpl", "org.apache.wml.dom.WMLOptionElementImpl", "org.apache.commons.jxpath.ri.model.dom.DOMNodeIterator", "org.apache.commons.jxpath.ri.model.beans.NullPointer", "org.apache.html.dom.HTMLElementImpl", "org.apache.commons.jxpath.ri.compiler.NodeTest", "org.apache.wml.WMLElement", "org.apache.wml.WMLAElement", "org.apache.wml.dom.WMLImgElementImpl", "org.apache.html.dom.HTMLScriptElementImpl", "org.apache.html.dom.HTMLBaseElementImpl", "org.apache.wml.WMLTimerElement", "org.apache.commons.jxpath.ri.model.NodePointerFactory", "org.apache.html.dom.HTMLMenuElementImpl", "org.apache.html.dom.HTMLFormControl", "org.apache.wml.dom.WMLSetvarElementImpl", "org.apache.wml.WMLBigElement", "org.apache.html.dom.HTMLOptionElementImpl", "org.apache.html.dom.HTMLFrameElementImpl", "org.apache.wml.dom.WMLSelectElementImpl", "org.apache.commons.jxpath.ri.model.beans.CollectionPointerFactory", "org.apache.html.dom.HTMLDirectoryElementImpl", "org.apache.html.dom.HTMLTableCaptionElementImpl", "org.apache.html.dom.HTMLObjectElementImpl", "org.apache.commons.jxpath.BasicVariables", "org.apache.html.dom.HTMLFormElementImpl", "org.apache.wml.WMLDoElement", "org.apache.commons.jxpath.JXPathAbstractFactoryException", "org.apache.commons.jxpath.JXPathInvalidAccessException", "org.apache.commons.jxpath.ri.compiler.CoreOperationEqual", "org.apache.html.dom.HTMLSelectElementImpl", "org.apache.commons.jxpath.ri.model.NodePointer", "org.apache.commons.jxpath.ri.model.VariablePointer$1", "org.apache.commons.jxpath.ri.compiler.CoreOperation", "org.apache.html.dom.HTMLAppletElementImpl", "org.apache.wml.dom.WMLPostfieldElementImpl", "org.apache.wml.dom.WMLRefreshElementImpl", "org.apache.wml.WMLWmlElement", "org.apache.wml.WMLTdElement", "org.apache.html.dom.HTMLStyleElementImpl", "org.apache.commons.jxpath.ri.model.container.ContainerPointer", "org.apache.wml.WMLMetaElement", "org.apache.html.dom.HTMLHtmlElementImpl", "org.apache.html.dom.HTMLImageElementImpl", "org.apache.commons.jxpath.ri.axes.RootContext", "org.apache.commons.jxpath.ri.axes.InitialContext", "org.apache.wml.dom.WMLMetaElementImpl", "org.apache.html.dom.HTMLAnchorElementImpl", "org.apache.html.dom.HTMLMapElementImpl", "org.apache.wml.dom.WMLInputElementImpl", "org.apache.commons.jxpath.ri.JXPathContextReferenceImpl", "org.apache.wml.dom.WMLBrElementImpl", "org.apache.commons.jxpath.util.TypeUtils$1", "org.apache.wml.dom.WMLOneventElementImpl", "org.apache.commons.jxpath.ri.model.dom.DOMAttributeIterator", "org.apache.html.dom.HTMLUListElementImpl", "org.apache.wml.dom.WMLWmlElementImpl", "org.apache.wml.WMLInputElement", "org.apache.wml.WMLPrevElement", "org.apache.html.dom.HTMLLabelElementImpl", "org.apache.wml.WMLAnchorElement", "org.apache.html.dom.HTMLTableColElementImpl", "org.apache.commons.jxpath.ri.model.VariablePointerFactory", "org.apache.wml.WMLAccessElement", "org.apache.commons.jxpath.util.TypeUtils", "org.apache.html.dom.HTMLAreaElementImpl", "org.apache.commons.jxpath.JXPathTypeConversionException", "org.apache.wml.WMLTrElement", "org.apache.wml.WMLFieldsetElement", "org.apache.wml.WMLRefreshElement", "org.apache.wml.WMLOptgroupElement", "org.apache.commons.jxpath.ri.compiler.NodeNameTest", "org.apache.wml.WMLTableElement", "org.apache.wml.dom.WMLCardElementImpl", "org.apache.wml.WMLHeadElement", "org.apache.commons.jxpath.Pointer", "org.apache.commons.jxpath.ri.compiler.Expression", "org.apache.wml.dom.WMLAnchorElementImpl", "org.apache.wml.dom.WMLTrElementImpl", "org.apache.wml.dom.WMLStrongElementImpl", "org.apache.commons.jxpath.Function", "org.apache.html.dom.HTMLHRElementImpl", "org.apache.wml.WMLPostfieldElement", "org.apache.html.dom.HTMLOptGroupElementImpl", "org.apache.wml.WMLDocument", "org.apache.commons.jxpath.JXPathInvalidSyntaxException", "org.apache.wml.dom.WMLUElementImpl", "org.apache.wml.WMLOptionElement", "org.apache.commons.jxpath.ri.model.dynamic.DynamicPointer", "org.apache.wml.dom.WMLBElementImpl", "org.apache.wml.dom.WMLTableElementImpl", "org.apache.wml.WMLPElement", "org.apache.html.dom.HTMLTableRowElementImpl", "org.apache.html.dom.HTMLButtonElementImpl", "org.apache.html.dom.HTMLModElementImpl", "org.apache.commons.jxpath.ri.model.VariablePointer", "org.apache.wml.WMLSmallElement", "org.apache.commons.jxpath.ri.model.dynamic.DynamicPointerFactory", "org.apache.html.dom.HTMLDListElementImpl", "org.apache.commons.jxpath.ri.QName", "org.apache.wml.dom.WMLDocumentImpl", "org.apache.html.dom.HTMLBRElementImpl", "org.apache.commons.jxpath.CompiledExpression", "org.apache.commons.jxpath.NodeSet", "org.apache.html.dom.HTMLIFrameElementImpl", "org.apache.wml.dom.WMLIElementImpl", "org.apache.html.dom.HTMLTableElementImpl", "org.apache.html.dom.HTMLLegendElementImpl", "org.apache.wml.WMLGoElement", "org.apache.commons.jxpath.JXPathNotFoundException", "org.apache.wml.dom.WMLTimerElementImpl", "org.apache.commons.jxpath.ri.model.dom.NamespacePointer", "org.apache.html.dom.HTMLFontElementImpl", "org.apache.wml.WMLEmElement", "org.apache.commons.jxpath.ExceptionHandler", "org.apache.html.dom.HTMLQuoteElementImpl", "org.apache.html.dom.HTMLDocumentImpl", "org.apache.commons.jxpath.util.TypeConverter", "org.apache.wml.WMLStrongElement", "org.apache.html.dom.HTMLParamElementImpl", "org.apache.commons.jxpath.ri.compiler.NameAttributeTest", "org.apache.commons.jxpath.ri.compiler.ProcessingInstructionTest", "org.apache.wml.dom.WMLDoElementImpl", "org.apache.wml.dom.WMLSmallElementImpl", "org.apache.wml.dom.WMLGoElementImpl", "org.apache.wml.WMLImgElement", "org.apache.html.dom.HTMLFieldSetElementImpl", "org.apache.commons.jxpath.ri.NamespaceResolver", "org.apache.html.dom.HTMLTableCellElementImpl", "org.apache.wml.WMLSetvarElement", "org.apache.commons.jxpath.AbstractFactory", "org.apache.wml.WMLSelectElement", "org.apache.wml.WMLTemplateElement", "org.apache.wml.dom.WMLTemplateElementImpl", "org.apache.commons.jxpath.ri.Compiler", "org.apache.wml.dom.WMLFieldsetElementImpl", "org.apache.wml.dom.WMLBigElementImpl", "org.apache.html.dom.HTMLDivElementImpl", "org.apache.wml.dom.WMLOptgroupElementImpl", "org.apache.html.dom.HTMLMetaElementImpl", "org.apache.commons.jxpath.Functions", "org.apache.commons.jxpath.ri.model.beans.BeanPointerFactory", "org.apache.html.dom.HTMLInputElementImpl", "org.apache.commons.jxpath.util.ClassLoaderUtil", "org.apache.commons.jxpath.ri.compiler.NodeTypeTest", "org.apache.html.dom.HTMLOListElementImpl", "org.apache.wml.dom.WMLAElementImpl", "org.apache.wml.dom.WMLPElementImpl", "org.apache.commons.jxpath.JXPathException", "org.apache.commons.jxpath.ri.model.beans.PropertyOwnerPointer", "org.apache.html.dom.HTMLIsIndexElementImpl", "org.apache.wml.dom.WMLElementImpl", "org.apache.commons.jxpath.PackageFunctions", "org.apache.wml.dom.WMLTdElementImpl", "org.apache.html.dom.HTMLParagraphElementImpl", "org.apache.html.dom.HTMLTitleElementImpl", "org.apache.commons.jxpath.ri.model.dom.DOMNamespaceIterator", "org.apache.wml.WMLBElement", "org.apache.html.dom.HTMLBaseFontElementImpl", "org.apache.commons.jxpath.ri.EvalContext", "org.apache.commons.jxpath.JXPathFunctionNotFoundException", "org.apache.commons.jxpath.ri.model.container.ContainerPointerFactory", "org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", "org.apache.commons.jxpath.ri.compiler.Operation", "org.apache.commons.jxpath.ri.model.beans.NullPropertyPointer" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(DOMNodePointer_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.apache.commons.jxpath.ri.model.NodePointer", "org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", "org.apache.commons.jxpath.util.BasicTypeConverter", "org.apache.commons.jxpath.util.TypeUtils$1", "org.apache.commons.jxpath.util.TypeUtils", "org.apache.commons.jxpath.BasicVariables", "org.apache.commons.jxpath.ri.QName", "org.apache.commons.jxpath.ri.model.VariablePointer", "org.apache.commons.jxpath.PackageFunctions", "org.apache.commons.jxpath.JXPathContext", "org.apache.commons.jxpath.JXPathContextFactory", "org.apache.commons.jxpath.util.ClassLoaderUtil", "org.apache.commons.jxpath.ri.JXPathContextFactoryReferenceImpl", "org.apache.commons.jxpath.ri.compiler.TreeCompiler", "org.apache.commons.jxpath.ri.model.beans.CollectionPointerFactory", "org.apache.commons.jxpath.ri.model.beans.BeanPointerFactory", "org.apache.commons.jxpath.ri.model.dynamic.DynamicPointerFactory", "org.apache.commons.jxpath.ri.model.VariablePointerFactory", "org.apache.commons.jxpath.ri.model.dom.DOMPointerFactory", "org.jdom.Document", "org.apache.commons.jxpath.ri.model.jdom.JDOMPointerFactory", "org.apache.commons.jxpath.ri.model.dynabeans.DynaBeanPointerFactory", "org.apache.commons.jxpath.ri.model.container.ContainerPointerFactory", "org.apache.commons.jxpath.ri.JXPathContextReferenceImpl$1", "org.apache.commons.jxpath.ri.JXPathContextReferenceImpl", "org.apache.commons.jxpath.util.ValueUtils", "org.apache.commons.jxpath.JXPathBasicBeanInfo$1", "org.apache.commons.jxpath.JXPathBasicBeanInfo", "org.apache.commons.jxpath.JXPathIntrospector", "org.apache.commons.jxpath.ri.model.beans.PropertyOwnerPointer", "org.apache.commons.jxpath.ri.model.beans.BeanPointer", "org.apache.commons.jxpath.ri.NamespaceResolver", "org.apache.html.dom.HTMLDocumentImpl", "org.apache.html.dom.HTMLElementImpl", "org.apache.html.dom.HTMLFormElementImpl", "org.apache.wml.dom.WMLElementImpl", "org.apache.wml.dom.WMLBElementImpl", "org.apache.wml.dom.WMLNoopElementImpl", "org.apache.wml.dom.WMLAElementImpl", "org.apache.wml.dom.WMLSetvarElementImpl", "org.apache.wml.dom.WMLAccessElementImpl", "org.apache.wml.dom.WMLStrongElementImpl", "org.apache.wml.dom.WMLPostfieldElementImpl", "org.apache.wml.dom.WMLDoElementImpl", "org.apache.wml.dom.WMLWmlElementImpl", "org.apache.wml.dom.WMLTrElementImpl", "org.apache.wml.dom.WMLGoElementImpl", "org.apache.wml.dom.WMLBigElementImpl", "org.apache.wml.dom.WMLAnchorElementImpl", "org.apache.wml.dom.WMLTimerElementImpl", "org.apache.wml.dom.WMLSmallElementImpl", "org.apache.wml.dom.WMLOptgroupElementImpl", "org.apache.wml.dom.WMLHeadElementImpl", "org.apache.wml.dom.WMLTdElementImpl", "org.apache.wml.dom.WMLFieldsetElementImpl", "org.apache.wml.dom.WMLImgElementImpl", "org.apache.wml.dom.WMLRefreshElementImpl", "org.apache.wml.dom.WMLOneventElementImpl", "org.apache.wml.dom.WMLInputElementImpl", "org.apache.wml.dom.WMLPrevElementImpl", "org.apache.wml.dom.WMLTableElementImpl", "org.apache.wml.dom.WMLMetaElementImpl", "org.apache.wml.dom.WMLTemplateElementImpl", "org.apache.wml.dom.WMLBrElementImpl", "org.apache.wml.dom.WMLOptionElementImpl", "org.apache.wml.dom.WMLUElementImpl", "org.apache.wml.dom.WMLPElementImpl", "org.apache.wml.dom.WMLSelectElementImpl", "org.apache.wml.dom.WMLEmElementImpl", "org.apache.wml.dom.WMLIElementImpl", "org.apache.wml.dom.WMLCardElementImpl", "org.apache.wml.dom.WMLDocumentImpl", "org.apache.html.dom.HTMLFrameElementImpl", "org.apache.html.dom.HTMLTableSectionElementImpl", "org.apache.html.dom.HTMLTableRowElementImpl", "org.apache.html.dom.HTMLTableCellElementImpl", "org.apache.html.dom.HTMLParagraphElementImpl", "org.apache.commons.jxpath.ri.model.dom.DOMAttributeIterator", "org.apache.html.dom.HTMLAnchorElementImpl", "org.apache.commons.jxpath.ri.compiler.NodeTest", "org.apache.commons.jxpath.ri.compiler.NodeNameTest", "org.apache.html.dom.HTMLHeadElementImpl", "org.apache.html.dom.HTMLQuoteElementImpl", "org.apache.commons.jxpath.ri.compiler.ProcessingInstructionTest", "org.apache.commons.jxpath.ri.model.dom.NamespacePointer", "org.apache.html.dom.HTMLTableColElementImpl", "org.apache.html.dom.HTMLHtmlElementImpl", "org.apache.html.dom.HTMLInputElementImpl", "org.apache.commons.jxpath.ri.model.beans.NullPointer", "org.apache.commons.jxpath.ri.model.dom.DOMNodeIterator", "org.apache.html.dom.HTMLDivElementImpl", "org.apache.html.dom.HTMLFieldSetElementImpl", "org.apache.commons.jxpath.JXPathException", "org.apache.commons.jxpath.ri.model.dom.DOMNamespaceIterator", "org.apache.html.dom.HTMLLabelElementImpl", "org.apache.html.dom.HTMLLegendElementImpl", "org.apache.html.dom.HTMLSelectElementImpl", "org.apache.html.dom.HTMLButtonElementImpl", "org.apache.commons.jxpath.ri.model.VariablePointer$1", "org.apache.html.dom.HTMLLIElementImpl", "org.apache.commons.jxpath.ri.model.beans.CollectionPointer", "org.apache.commons.jxpath.ri.compiler.NodeTypeTest", "org.apache.html.dom.HTMLIsIndexElementImpl", "org.apache.html.dom.HTMLBodyElementImpl", "org.apache.html.dom.HTMLOptGroupElementImpl", "org.apache.html.dom.HTMLBaseFontElementImpl", "org.apache.html.dom.HTMLScriptElementImpl", "org.apache.html.dom.HTMLOListElementImpl", "org.apache.html.dom.HTMLFontElementImpl", "org.apache.html.dom.HTMLMapElementImpl", "org.apache.html.dom.HTMLImageElementImpl", "org.apache.html.dom.HTMLDirectoryElementImpl", "org.apache.html.dom.HTMLParamElementImpl", "org.apache.html.dom.HTMLHRElementImpl", "org.apache.html.dom.HTMLTextAreaElementImpl", "org.apache.html.dom.HTMLOptionElementImpl", "org.apache.html.dom.HTMLModElementImpl", "org.apache.html.dom.HTMLIFrameElementImpl", "org.apache.html.dom.HTMLMetaElementImpl", "org.apache.html.dom.HTMLUListElementImpl", "org.apache.html.dom.HTMLAreaElementImpl", "org.apache.commons.jxpath.JXPathNotFoundException", "org.apache.html.dom.HTMLObjectElementImpl", "org.apache.html.dom.HTMLTableElementImpl", "org.apache.html.dom.HTMLTitleElementImpl", "org.apache.html.dom.HTMLPreElementImpl", "org.apache.html.dom.HTMLMenuElementImpl", "org.apache.html.dom.HTMLFrameSetElementImpl", "org.apache.html.dom.HTMLBaseElementImpl", "org.apache.commons.jxpath.ri.model.dom.DOMAttributePointer", "org.apache.html.dom.HTMLTableCaptionElementImpl", "org.apache.html.dom.HTMLStyleElementImpl", "org.apache.html.dom.NameNodeListImpl", "org.apache.html.dom.HTMLDListElementImpl", "org.apache.html.dom.HTMLAppletElementImpl", "org.apache.html.dom.HTMLHeadingElementImpl", "org.apache.html.dom.HTMLLinkElementImpl", "org.apache.html.dom.HTMLCollectionImpl", "org.apache.commons.jxpath.ri.model.beans.PropertyIterator", "org.apache.commons.jxpath.ri.model.beans.BeanAttributeIterator", "org.apache.commons.jxpath.ri.model.beans.PropertyPointer", "org.apache.commons.jxpath.ri.model.beans.NullPropertyPointer", "org.apache.html.dom.HTMLBRElementImpl", "org.apache.html.dom.CollectionIndex" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
6907df1586ae7c4b474646ffce81aabbac8cc740
fc6f9d475fff101775064c630d3c5ee1d8598362
/shoppingbackend/src/test/java/net/arn/shoppingbackend/AppTest.java
2fa295e8a3e1c80fe5b6f30d01755d0c067e533e
[]
no_license
arunyadav1/online-shopping
942a08a1b51d480346af180fbb3a64b1fcba6562
673230575ef19e090ef3941cf6de3d87c4bdfe18
refs/heads/master
2021-07-17T01:02:11.895164
2017-10-20T04:10:21
2017-10-20T04:10:21
107,226,997
0
0
null
null
null
null
UTF-8
Java
false
false
689
java
package net.arn.shoppingbackend; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "arunyadav190@gmail.com" ]
arunyadav190@gmail.com
d0dba2cb120abc10a48c361ee9c6f3eeeb71758c
249e976e357e8d61e5b70e66d6ae31c40b8f0dbb
/src/main/java/de/wolfi/utils/ParticleAPI.java
158c05d792171e7364cbe97125a65ed4eca64d79
[]
no_license
WOLFI3654/PublicUtils
4d2952198fc5798a9f9b91fc5f9b9121e420232a
43185c80c999eaec21ea9a211516596c9cb53b94
refs/heads/master
2020-12-25T15:18:06.462059
2018-10-04T14:22:59
2018-10-04T14:22:59
65,135,654
1
0
null
null
null
null
UTF-8
Java
false
false
2,922
java
package de.wolfi.utils; import java.lang.reflect.Constructor; import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; public final class ParticleAPI { public static class Particle { Enum<?> en; private Particle(Enum<?> p) { this.en = p; } private Particle(String name) { this.en = ParticleAPI.getWitch(name); } public void play(Location l, float offsetX, float offsetY, float offsetZ, float speed, int count) { for (Player p : Bukkit.getOnlinePlayers()) { if (p.getWorld().equals(l.getWorld())) { try { this.play(p, l, offsetX, offsetY, offsetZ, speed, count); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public void play(Player player, Location l, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception { Object cp = player.getClass().getMethod("getHandle").invoke(player); Object pc = cp.getClass().getField("playerConnection").get(cp); Class<?> packet = Reflection.getNMSClass("PacketPlayOutWorldParticles"); Constructor<?> pac = null; for (Constructor<?> c : packet.getConstructors()) { if (c.getParameterTypes().length > 1) { pac = c; } } pc.getClass().getMethod("sendPacket", Reflection.getNMSClass("Packet")).invoke(pc, pac.newInstance(en, true, (float) l.getX(), (float) l.getY(), (float) l.getZ(), offsetX, offsetY, offsetZ, speed, count, new int[0])); // PacketPlayOutWorldParticles packet = new // PacketPlayOutWorldParticles(type, true, (float)l.getX(), // (float)l.getY(), (float)l.getZ(), offsetX, offsetY, offsetZ, // speed, count, 0); // p.getHandle().playerConnection.sendPacket(packet); } } private static HashMap<String, Particle> byName = new HashMap<>(); @SuppressWarnings("unchecked") private static Class<? extends Enum<?>> clazz = (Class<? extends Enum<?>>) Reflection.getNMSClass("EnumParticle"); static { for (Enum<?> e : ParticleAPI.clazz.getEnumConstants()) { ParticleAPI.registerParticle(e.toString(), new Particle(e)); } } public static Particle getParticle(String name) { return ParticleAPI.byName.get(name); } private static Enum<?> getWitch(String name) { try { for (Enum<?> e : ParticleAPI.clazz.getEnumConstants()) { if (e.name().equals(name)) return e; } } catch (IllegalArgumentException | SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } /** * * @param name * Unique name * @param p * particle. Override play Method for Custom feelings <3 * @return successfully add. */ public static boolean registerParticle(String name, Particle p) { if (!ParticleAPI.byName.containsKey(name)) { ParticleAPI.byName.put(name, p); return true; } return false; } }
[ "thomas@architekt-windt.de" ]
thomas@architekt-windt.de
e96c11175b0c1ebd8d3019c665220af3170046c5
1f50700d0ed78dabdca8474e985887b3c56ab9d2
/exercicis/src/LyyraCard/MyDate.java
add6514f5b6050938aa5608fb8c02ba9494a2543
[]
no_license
salasobrino/exericisJava2021
07351e4a98fbbd1e3adface59878e4aae269a5ca
53692e4dc9e8bd9d324a9ae3ce454ef51510e894
refs/heads/master
2023-03-31T21:16:09.216568
2021-04-11T19:00:48
2021-04-11T19:00:48
353,745,916
0
0
null
null
null
null
UTF-8
Java
false
false
797
java
package LyyraCard; import java.util.ArrayList; public class MyDate { int day; int month; int year; String[] mes = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; public MyDate(int day, int month, int year) { this.day=day; this.month=month; this.year=year; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public String toString() { return day + " / " + mes[month-1] + " / " + year; } }
[ "joanmariasalagodia@gmail.com" ]
joanmariasalagodia@gmail.com
2db5f75a04d39e91dce6c4bbc36e8e73d59d2ebd
56ed823bc684e67fda61be2f963af6293d1b4c85
/MavenRest/src/main/java/edu/gatech/sad/project4/hometables/TacourseassignmenttableHome.java
8b0e956f843bb98127796c94c3c0bf04bef4f242
[]
no_license
gtzippy/Project4
ea4bdcf465c2812efdccdb447de5b89e085d9ee3
41ff06d06ebd662bdc8e8211a63054a244e53fea
refs/heads/master
2021-01-10T11:03:32.950423
2015-12-01T13:11:11
2015-12-01T13:11:11
46,990,419
0
0
null
null
null
null
UTF-8
Java
false
false
3,991
java
package edu.gatech.sad.project4.hometables; // Generated Nov 25, 2015 3:17:11 AM by Hibernate Tools 3.4.0.CR1 import edu.gatech.sad.project4.entities.Tacourseassignmenttable; import java.util.List; import javax.naming.InitialContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.LockMode; import org.hibernate.SessionFactory; import org.hibernate.criterion.Example; /** * Home object for domain model class Tacourseassignmenttable. * @see edu.gatech.sad.project4.entities.Tacourseassignmenttable * @author Hibernate Tools */ public class TacourseassignmenttableHome { private static final Log log = LogFactory .getLog(TacourseassignmenttableHome.class); private final SessionFactory sessionFactory = getSessionFactory(); protected SessionFactory getSessionFactory() { try { return (SessionFactory) new InitialContext() .lookup("SessionFactory"); } catch (Exception e) { log.error("Could not locate SessionFactory in JNDI", e); throw new IllegalStateException( "Could not locate SessionFactory in JNDI"); } } public void persist(Tacourseassignmenttable transientInstance) { log.debug("persisting Tacourseassignmenttable instance"); try { sessionFactory.getCurrentSession().persist(transientInstance); log.debug("persist successful"); } catch (RuntimeException re) { log.error("persist failed", re); throw re; } } public void attachDirty(Tacourseassignmenttable instance) { log.debug("attaching dirty Tacourseassignmenttable instance"); try { sessionFactory.getCurrentSession().saveOrUpdate(instance); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public void attachClean(Tacourseassignmenttable instance) { log.debug("attaching clean Tacourseassignmenttable instance"); try { sessionFactory.getCurrentSession().lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public void delete(Tacourseassignmenttable persistentInstance) { log.debug("deleting Tacourseassignmenttable instance"); try { sessionFactory.getCurrentSession().delete(persistentInstance); log.debug("delete successful"); } catch (RuntimeException re) { log.error("delete failed", re); throw re; } } public Tacourseassignmenttable merge( Tacourseassignmenttable detachedInstance) { log.debug("merging Tacourseassignmenttable instance"); try { Tacourseassignmenttable result = (Tacourseassignmenttable) sessionFactory .getCurrentSession().merge(detachedInstance); log.debug("merge successful"); return result; } catch (RuntimeException re) { log.error("merge failed", re); throw re; } } public Tacourseassignmenttable findById( edu.gatech.sad.project4.entities.TacourseassignmenttableId id) { log.debug("getting Tacourseassignmenttable instance with id: " + id); try { Tacourseassignmenttable instance = (Tacourseassignmenttable) sessionFactory .getCurrentSession() .get("edu.gatech.sad.project4.entities.Tacourseassignmenttable", id); if (instance == null) { log.debug("get successful, no instance found"); } else { log.debug("get successful, instance found"); } return instance; } catch (RuntimeException re) { log.error("get failed", re); throw re; } } public List findByExample(Tacourseassignmenttable instance) { log.debug("finding Tacourseassignmenttable instance by example"); try { List results = sessionFactory .getCurrentSession() .createCriteria( "edu.gatech.sad.project4.entities.Tacourseassignmenttable") .add(Example.create(instance)).list(); log.debug("find by example successful, result size: " + results.size()); return results; } catch (RuntimeException re) { log.error("find by example failed", re); throw re; } } }
[ "gtg985r@mail.gatech.edu" ]
gtg985r@mail.gatech.edu
1f0ba10c1acd84bf46fe0a1cc4629bd8d9778583
8d211331b426801ccab9a9973e68a804d3b7536a
/src/main/java/com/alex/tp/library/config/ocp/compliance/SalaryAppConfig.java
6fab5c1d6ae37c88a6b6a67ceab174d36c46a27c
[]
no_license
AlexanderDaniels/AlexanderDanielsLibraryDomain1
b8cbcf69250346c15d1f823d4eca7da11bf04a94
bcb4bd143e175c1f7cd8ba5296a48495c23cfe6c
refs/heads/master
2021-01-10T21:10:10.553849
2014-02-28T12:55:37
2014-02-28T12:55:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.alex.tp.library.config.ocp.compliance; import com.alex.tp.library.ocp.compliance.Impl.SalaryServiceImpl; import com.alex.tp.library.ocp.compliance.SalaryService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * * @author Alex */ @Configuration public class SalaryAppConfig { @Bean(name="salary") public SalaryService getService(){ return new SalaryServiceImpl(); } }
[ "Alex@Alex-PC" ]
Alex@Alex-PC
ce1f781b24994ed9d21d87ef2b46cb8decd04d57
3d030a2c50b7e3018d4f009c035a30ee212aced7
/src/oo/polymorphism/demo03/Demo01Main.java
554f32235c892b6b10c6ea5021b6feef11150dc6
[]
no_license
HandH1998/Java_learn
ef4738cc45c821731175c15045d01dc5d4e15743
fdc25778d9b7443a856c24131125c7bba814372d
refs/heads/master
2023-01-09T06:25:43.971558
2020-11-03T06:45:27
2020-11-03T06:45:27
297,592,226
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package oo.polymorphism.demo03; public class Demo01Main { public static void main(String[] args) { //对象的向上转型就是多态 Animal animal=new Cat();//本来是创建的猫 animal.eat(); // animal.catchMouse();//错误写法 //向下转型,进行还原动作 Cat cat=(Cat) animal; cat.catchMouse();//还原成功了 //下面是错误的向下转型 //本来是猫,现在非得做条狗 Dog dog=(Dog) animal;//错误写法 编译不会报错,运行会出现异常ClassCastException } }
[ "1335248067@qq.com" ]
1335248067@qq.com
593a420557e7bffa74e8661a549e1b2025e194bf
774c9de4302938a4c2372384451729c4079cec08
/app/src/main/java/com/example/administrator/oschina/bean/ShakeObject.java
4e2951fe1211c95a66a9fc921e512d0c5bd7744b
[]
no_license
600849155/OsChina
6c0a02523cb5d6008afe60e2c5f5d5879b2df954
4a82bc539190423af748568fa4fe358d1ebb5202
refs/heads/master
2021-01-02T09:46:41.433137
2017-08-04T03:23:29
2017-08-04T03:23:29
99,298,720
0
0
null
null
null
null
UTF-8
Java
false
false
2,441
java
package com.example.administrator.oschina.bean; import com.thoughtworks.xstream.annotations.XStreamAlias; @XStreamAlias("oschina") public class ShakeObject { @XStreamAlias("randomtype") private String randomtype; // 数据类型 @XStreamAlias("id") private String id; // 数据id @XStreamAlias("title") private String title; // 帖子标题 @XStreamAlias("detail") private String detail; // 内容 @XStreamAlias("author") private String author; // 作者 @XStreamAlias("authorid") private String authorid; // 作者id @XStreamAlias("image") private String image; // 头像地址 @XStreamAlias("pubDate") private String pubDate; // 收录日期 @XStreamAlias("commentCount") private String commentCount; @XStreamAlias("url") private String url; public static final String RANDOMTYPE_NEWS = "1"; public static final String RANDOMTYPE_BLOG = "2"; public static final String RANDOMTYPE_SOFTWARE = "3"; public String getRandomtype() { return randomtype; } public void setRandomtype(String randomtype) { this.randomtype = randomtype; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getAuthorid() { return authorid; } public void setAuthorid(String authorid) { this.authorid = authorid; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getPubDate() { return pubDate; } public void setPubDate(String pubDate) { this.pubDate = pubDate; } public String getCommentCount() { return commentCount; } public void setCommentCount(String commentCount) { this.commentCount = commentCount; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } }
[ "534801304@qq.com" ]
534801304@qq.com
f072209d806be03c16f9f7cd4926a57db5544924
f34e4912ff3eae96fc2df4632d92f91036cd52e2
/src/test/java/com/nbcuni/test/nbcidx/sanityWorkflow/SC03_TC01_MemberGet_API_Verification.java
d41450755e29cc6195ba09b301fca474b715d116
[]
no_license
RaghuRashmi/test-project
08593431ed0f7a557b4c557af296daf12236bed5
89fa25b46919a272babace4d3f001a3616b9b3cd
refs/heads/master
2021-01-15T14:11:09.007512
2014-09-26T22:03:33
2014-09-26T22:03:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,356
java
package com.nbcuni.test.nbcidx.sanityWorkflow; import static org.testng.AssertJUnit.fail; import java.net.Proxy; import org.testng.Assert; import org.testng.Reporter; import org.testng.annotations.BeforeClass; import org.testng.annotations.Parameters; import org.testng.annotations.Test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.nbcuni.test.nbcidx.AppLib; import com.nbcuni.test.webdriver.API; import com.nbcuni.test.webdriver.CustomWebDriver; /**************************************************************************** * NBCIDX Sanity Test Cases - SC03_TC01_MemberGet_API_Verification. Copyright. * * @author Rashmi Sale * @version 1.0 Date: Feb 7, 2014 ****************************************************************************/ public class SC03_TC01_MemberGet_API_Verification { private CustomWebDriver cs; private AppLib al; private API api; private Proxy proxy=null; /** * Instantiate the TestNG Before Class Method. * * @param sEnv - environment * @throws Exception - error */ @BeforeClass(alwaysRun = true) @Parameters("Environment") public void startEnvironment(String sEnv) { try { cs = null; al = new AppLib(cs); al.setEnvironmentInfo(sEnv); proxy = al.getHttpProxy(); api = new API(); api.setProxy(proxy); } catch (Exception e) { fail(e.toString()); } } /** * Instantiate the TestNG Test Method. * * @throws Exception - error */ @Test(groups = {"sanity", "API"}) public void memberGet_verifyAPI() throws Exception { Reporter.log(" "); Reporter.log("/************************************************************************ MEMBER.GET ************************************************************************/"); // Get the API Response String apicall, responseString; String name=SC01_Create_RandomMemberInfo.randomMemberName; String email=SC01_Create_RandomMemberInfo.randomEmail; apicall = al.getApiURL()+"/member/get?API_KEY="+al.getDefaultApiKey()+"&BRAND_ID="+al.getSurfBrandId()+"&id="+name; int responseCode = api.getHTTPResponseCode(apicall, api.REQUEST_GET, api.REQUEST_CONTENTTYPE_JSON); JsonObject response = api.getRootObjectsFromResponseBody(api.getRestRequest(apicall, api.REQUEST_CONTENTTYPE_JSON)); Reporter.log(" "); if(responseCode == 200) { Reporter.log("Passed : Response code from member.get : "+responseCode); Reporter.log(" "); } else fail("Failed : HTTP error code : "+ responseCode); Reporter.log("Validating member.get API Response"); responseString = response.toString(); Reporter.log(" "); Reporter.log("API Call Response : " + responseString); Reporter.log(" "); JsonElement membername = response.get("username"); //Reporter.log("membername="+membername.toString()); JsonElement email_address = response.getAsJsonArray("email").get(0).getAsJsonObject().get("address"); //Reporter.log("email -> address=" + email_address.toString()); boolean bMembername = membername.toString().contains(name); Assert.assertEquals(bMembername, true); boolean bEmail = email_address.toString().contains(email); Assert.assertEquals(bEmail, true); Reporter.log("Passed : member.get API Response contains Member = " +name+ " with Email-Id = "+email); Reporter.log(" "); } }
[ "206424426@5TS206424426L7.tfayd.com" ]
206424426@5TS206424426L7.tfayd.com
63af9db14f4032fa92d1d9a9bda2c973ef3cf403
b09604aefea16ae2175a05c4ebc9a550bf5c2dbe
/migration/src/main/java/co/gov/sic/migration/configuration/SchedulerConfig.java
fcd7b79c620b2105393a9f457bd018764f4a8c5c
[]
no_license
nesvila90/migration
b4f20270213d5dd99cc0a5f23719fac980e7c271
fb3a3883ebee320ba3e77850c85b791c79231ad7
refs/heads/master
2020-07-10T16:49:16.636666
2019-08-25T20:56:14
2019-08-25T20:56:14
204,315,151
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package co.gov.sic.migration.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.stereotype.Component; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @Configuration @Component public class SchedulerConfig { @Bean("taskExecutor") public ConcurrentTaskScheduler taskScheduler() { ScheduledExecutorService localExecutor = Executors.newSingleThreadScheduledExecutor(); return new ConcurrentTaskScheduler(localExecutor); } }
[ "nestorvl2011@hotmail.com" ]
nestorvl2011@hotmail.com
66d753e577bd92bee2f8e335246b2c71930d8219
02414a662b6024da6e59cb8940cee6ba1316eda5
/PaletteEditor.java
95c4268d85df81c28812aa9f3c6795f022be58a8
[]
no_license
joelbrewster/lsdpatch
990b6bab067956dd672d44d5c4f3ce34464a4fa0
fe26a53cd5df1412bef2f6bba5b5c5ea245f3a03
refs/heads/master
2021-01-11T17:21:24.129699
2017-01-23T00:29:59
2017-01-23T00:29:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
28,930
java
/** Copyright (C) 2017 by Johan Kotlinski 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. */ import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.GridBagLayout; import javax.swing.JComboBox; import java.awt.Panel; import javax.swing.JSlider; import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; import javax.swing.JLabel; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; public class PaletteEditor extends JFrame implements java.awt.event.ItemListener, ChangeListener, java.awt.event.ActionListener { private JPanel contentPane; private byte romImage[] = null; private int paletteOffset = -1; private int nameOffset = -1; private int colorSetSize = 4 * 2; // one colorset contains 4 colors private int colorSetCount = 5; // one palette contains 5 color sets private int paletteSize = colorSetCount * colorSetSize; private int paletteCount = 6; private int paletteNameSize = 5; private JPanel preview1a; private JPanel preview1b; private JPanel preview2a; private JPanel preview2b; private JPanel preview3a; private JPanel preview3b; private JPanel preview4a; private JPanel preview4b; private JPanel preview5a; private JPanel preview5b; private JPanel previewSong; private JLabel previewSongLabel; private JPanel previewInstr; private JLabel previewInstrLabel; private JSpinner c1r1; private JSpinner c1g1; private JSpinner c1b1; private JSpinner c1r2; private JSpinner c1g2; private JSpinner c1b2; private JSpinner c2r1; private JSpinner c2g1; private JSpinner c2b1; private JSpinner c2r2; private JSpinner c2g2; private JSpinner c2b2; private JSpinner c3r1; private JSpinner c3g1; private JSpinner c3b1; private JSpinner c3r2; private JSpinner c3g2; private JSpinner c3b2; private JSpinner c4r1; private JSpinner c4g1; private JSpinner c4b1; private JSpinner c4r2; private JSpinner c4g2; private JSpinner c4b2; private JSpinner c5r1; private JSpinner c5g1; private JSpinner c5b1; private JSpinner c5r2; private JSpinner c5g2; private JSpinner c5b2; private JComboBox kitSelector; private java.awt.image.BufferedImage songImage; private java.awt.image.BufferedImage instrImage; private int previousSelectedKit = -1; private boolean updatingSpinners = false; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { PaletteEditor frame = new PaletteEditor(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public PaletteEditor() { setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setBounds(100, 100, 650, 636); setResizable(false); setTitle("Palette Editor"); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); kitSelector = new JComboBox(); kitSelector.setBounds(10, 10, 140, 20); kitSelector.setEditable(true); kitSelector.addItemListener(this); kitSelector.addActionListener(this); contentPane.add(kitSelector); previewSong = new JPanel(new BorderLayout()); previewSong.setBounds(314, 10, 160 * 2, 144 * 2); previewSongLabel = new JLabel(); previewSong.add(previewSongLabel); contentPane.add(previewSong); previewInstr = new JPanel(new BorderLayout()); previewInstr.setBounds(314, 10 + 144 * 2 + 10, 160 * 2, 144 * 2); previewInstrLabel = new JLabel(); previewInstr.add(previewInstrLabel); contentPane.add(previewInstr); c1r1 = new JSpinner(); c1r1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c1r1.setBounds(10, 66, 36, 20); contentPane.add(c1r1); JLabel lblNormal = new JLabel("Normal"); lblNormal.setBounds(10, 41, 46, 14); contentPane.add(lblNormal); c1g1 = new JSpinner(); c1g1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c1g1.setBounds(56, 66, 36, 20); contentPane.add(c1g1); c1b1 = new JSpinner(); c1b1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c1b1.setBounds(102, 66, 36, 20); contentPane.add(c1b1); preview1a = new JPanel(); preview1a.setBounds(95, 41, 43, 14); preview1a.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview1a); preview1b = new JPanel(); preview1b.setBounds(159, 41, 43, 14); preview1b.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview1b); c1b2 = new JSpinner(); c1b2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c1b2.setBounds(251, 66, 36, 20); contentPane.add(c1b2); c1g2 = new JSpinner(); c1g2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c1g2.setBounds(205, 66, 36, 20); contentPane.add(c1g2); c1r2 = new JSpinner(); c1r2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c1r2.setBounds(159, 66, 36, 20); contentPane.add(c1r2); JLabel lblShaded = new JLabel("Shaded"); lblShaded.setBounds(10, 97, 46, 14); contentPane.add(lblShaded); c2r1 = new JSpinner(); c2r1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c2r1.setBounds(10, 122, 36, 20); contentPane.add(c2r1); c2g1 = new JSpinner(); c2g1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c2g1.setBounds(56, 122, 36, 20); contentPane.add(c2g1); c2b1 = new JSpinner(); c2b1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c2b1.setBounds(102, 122, 36, 20); contentPane.add(c2b1); c2r2 = new JSpinner(); c2r2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c2r2.setBounds(159, 122, 36, 20); contentPane.add(c2r2); c2g2 = new JSpinner(); c2g2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c2g2.setBounds(205, 122, 36, 20); contentPane.add(c2g2); c2b2 = new JSpinner(); c2b2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c2b2.setBounds(251, 122, 36, 20); contentPane.add(c2b2); preview2b = new JPanel(); preview2b.setBounds(159, 97, 43, 14); preview2b.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview2b); preview2a = new JPanel(); preview2a.setBounds(95, 97, 43, 14); preview2a.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview2a); JLabel lblAlternate = new JLabel("Alternate"); lblAlternate.setBounds(10, 153, 82, 14); contentPane.add(lblAlternate); c3r1 = new JSpinner(); c3r1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c3r1.setBounds(10, 178, 36, 20); contentPane.add(c3r1); c3g1 = new JSpinner(); c3g1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c3g1.setBounds(56, 178, 36, 20); contentPane.add(c3g1); c3b1 = new JSpinner(); c3b1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c3b1.setBounds(102, 178, 36, 20); contentPane.add(c3b1); c3r2 = new JSpinner(); c3r2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c3r2.setBounds(159, 178, 36, 20); contentPane.add(c3r2); c3g2 = new JSpinner(); c3g2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c3g2.setBounds(205, 178, 36, 20); contentPane.add(c3g2); c3b2 = new JSpinner(); c3b2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c3b2.setBounds(251, 178, 36, 20); contentPane.add(c3b2); preview3b = new JPanel(); preview3b.setBounds(159, 153, 43, 14); preview3b.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview3b); preview3a = new JPanel(); preview3a.setBounds(95, 153, 43, 14); preview3a.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview3a); JLabel lblCursor = new JLabel("Selection"); lblCursor.setBounds(10, 209, 82, 14); contentPane.add(lblCursor); c4r1 = new JSpinner(); c4r1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c4r1.setBounds(10, 234, 36, 20); contentPane.add(c4r1); c4g1 = new JSpinner(); c4g1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c4g1.setBounds(56, 234, 36, 20); contentPane.add(c4g1); c4b1 = new JSpinner(); c4b1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c4b1.setBounds(102, 234, 36, 20); contentPane.add(c4b1); c4r2 = new JSpinner(); c4r2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c4r2.setBounds(159, 234, 36, 20); contentPane.add(c4r2); c4g2 = new JSpinner(); c4g2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c4g2.setBounds(205, 234, 36, 20); contentPane.add(c4g2); c4b2 = new JSpinner(); c4b2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c4b2.setBounds(251, 234, 36, 20); contentPane.add(c4b2); preview4b = new JPanel(); preview4b.setBounds(159, 209, 43, 14); preview4b.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview4b); preview4a = new JPanel(); preview4a.setBounds(95, 209, 43, 14); preview4a.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview4a); JLabel lblStartscroll = new JLabel("Scroll"); lblStartscroll.setBounds(10, 265, 65, 14); contentPane.add(lblStartscroll); c5r1 = new JSpinner(); c5r1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c5r1.setBounds(10, 290, 36, 20); contentPane.add(c5r1); c5g1 = new JSpinner(); c5g1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c5g1.setBounds(56, 290, 36, 20); contentPane.add(c5g1); c5b1 = new JSpinner(); c5b1.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c5b1.setBounds(102, 290, 36, 20); contentPane.add(c5b1); c5r2 = new JSpinner(); c5r2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c5r2.setBounds(159, 290, 36, 20); contentPane.add(c5r2); c5g2 = new JSpinner(); c5g2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c5g2.setBounds(205, 290, 36, 20); contentPane.add(c5g2); c5b2 = new JSpinner(); c5b2.setModel(new SpinnerNumberModel(0, 0, 31, 1)); c5b2.setBounds(251, 290, 36, 20); contentPane.add(c5b2); preview5b = new JPanel(); preview5b.setBounds(159, 265, 43, 14); preview5b.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview5b); preview5a = new JPanel(); preview5a.setBounds(95, 265, 43, 14); preview5a.setBorder(javax.swing.BorderFactory.createLoweredBevelBorder()); contentPane.add(preview5a); listenToSpinners(); try { songImage = javax.imageio.ImageIO.read(getClass().getResource("/song.bmp")); instrImage = javax.imageio.ImageIO.read(getClass().getResource("/instr.bmp")); } catch (java.io.IOException e) { e.printStackTrace(); } } private void listenToSpinners() { c1r1.addChangeListener(this); c1g1.addChangeListener(this); c1b1.addChangeListener(this); c1r2.addChangeListener(this); c1g2.addChangeListener(this); c1b2.addChangeListener(this); c2r1.addChangeListener(this); c2g1.addChangeListener(this); c2b1.addChangeListener(this); c2r2.addChangeListener(this); c2g2.addChangeListener(this); c2b2.addChangeListener(this); c3r1.addChangeListener(this); c3g1.addChangeListener(this); c3b1.addChangeListener(this); c3r2.addChangeListener(this); c3g2.addChangeListener(this); c3b2.addChangeListener(this); c4r1.addChangeListener(this); c4g1.addChangeListener(this); c4b1.addChangeListener(this); c4r2.addChangeListener(this); c4g2.addChangeListener(this); c4b2.addChangeListener(this); c5r1.addChangeListener(this); c5g1.addChangeListener(this); c5b1.addChangeListener(this); c5r2.addChangeListener(this); c5g2.addChangeListener(this); c5b2.addChangeListener(this); } public void setRomImage(byte[] romImage) { this.romImage = romImage; paletteOffset = findPaletteOffset(); if (paletteOffset == -1) { System.err.println("Could not find palette offset!"); } nameOffset = findNameOffset(); if (nameOffset == -1) { System.err.println("Could not find palette name offset!"); } populateKitSelector(); } private int selectedPalette() { int palette = kitSelector.getSelectedIndex(); assert palette >= 0; assert palette < paletteCount; return palette; } // Returns color scaled to 0-0xf8. private java.awt.Color color(int offset) { // gggrrrrr 0bbbbbgg int r = (romImage[offset] & 0x1f) << 3; int g = ((romImage[offset + 1] & 3) << 6) | ((romImage[offset] & 0xe0) >> 2); int b = (romImage[offset + 1] << 1) & 0xf8; return new java.awt.Color(r, g, b); } private void updateRom(int offset, JSpinner sr1, JSpinner sg1, JSpinner sb1, JSpinner sr2, JSpinner sg2, JSpinner sb2) { int r1 = (Integer)sr1.getValue(); int g1 = (Integer)sg1.getValue(); int b1 = (Integer)sb1.getValue(); // gggrrrrr 0bbbbbgg romImage[offset] = (byte)(r1 | (g1 << 5)); romImage[offset + 1] = (byte)((g1 >> 3) | (b1 << 2)); int r2 = (Integer)sr2.getValue(); int g2 = (Integer)sg2.getValue(); int b2 = (Integer)sb2.getValue(); romImage[offset + 6] = (byte)(r2 | (g2 << 5)); romImage[offset + 7] = (byte)((g2 >> 3) | (b2 << 2)); // Generating antialiasing colors. int rMid = (r1 + r2) / 2; int gMid = (g1 + g2) / 2; int bMid = (b1 + b2) / 2; romImage[offset + 2] = (byte)(rMid | (gMid << 5)); romImage[offset + 3] = (byte)((gMid >> 3) | (bMid << 2)); romImage[offset + 4] = romImage[offset + 2]; romImage[offset + 5] = romImage[offset + 3]; } private void updateRomFromSpinners() { int offset = paletteOffset + selectedPalette() * paletteSize; updateRom(offset, c1r1, c1g1, c1b1, c1r2, c1g2, c1b2); updateRom(offset + 8, c2r1, c2g1, c2b1, c2r2, c2g2, c2b2); updateRom(offset + 16, c3r1, c3g1, c3b1, c3r2, c3g2, c3b2); updateRom(offset + 24, c4r1, c4g1, c4b1, c4r2, c4g2, c4b2); updateRom(offset + 32, c5r1, c5g1, c5b1, c5r2, c5g2, c5b2); } private java.awt.Color firstColor(int colorSet) { assert colorSet >= 0; assert colorSet < colorSetCount; int offset = paletteOffset + selectedPalette() * paletteSize + colorSet * colorSetSize; return color(offset); } private java.awt.Color secondColor(int colorSet) { assert colorSet >= 0; assert colorSet < colorSetCount; int offset = paletteOffset + selectedPalette() * paletteSize + colorSet * colorSetSize + 3 * 2; return color(offset); } private java.awt.Color midColor(int colorSet) { assert colorSet >= 0; assert colorSet < colorSetCount; int offset = paletteOffset + selectedPalette() * paletteSize + colorSet * colorSetSize + 2; return color(offset); } private String paletteName(int palette) { assert palette >= 0; assert palette < paletteCount; String s = new String(); s += (char)romImage[nameOffset + palette * paletteNameSize]; s += (char)romImage[nameOffset + palette * paletteNameSize + 1]; s += (char)romImage[nameOffset + palette * paletteNameSize + 2]; s += (char)romImage[nameOffset + palette * paletteNameSize + 3]; return s; } private void setPaletteName(int palette, String name) { if (name == null) { return; } if (name.length() >= paletteNameSize) { name = name.substring(0, paletteNameSize - 1); } else while (name.length() < paletteNameSize - 1) { name = name + " "; } romImage[nameOffset + palette * paletteNameSize] = (byte)name.charAt(0); romImage[nameOffset + palette * paletteNameSize + 1] = (byte)name.charAt(1); romImage[nameOffset + palette * paletteNameSize + 2] = (byte)name.charAt(2); romImage[nameOffset + palette * paletteNameSize + 3] = (byte)name.charAt(3); } private void populateKitSelector() { kitSelector.removeAllItems(); for (int i = 0; i < paletteCount; ++i) { kitSelector.addItem(paletteName(i)); } } private int gammaCorrect(java.awt.Color c) { int r = ((c.getRed() >> 3) * 255) / 0xf8; int g = ((c.getGreen() >> 3) * 255) / 0xf8; int b = ((c.getBlue() >> 3) * 255) / 0xf8; // Matrix conversion from Gambatte. return (((r * 13 + g * 2 + b) >> 1) << 16) | ((g * 3 + b) << 9) | ((r * 3 + g * 2 + b * 11) >> 1); } private java.awt.image.BufferedImage modifyUsingPalette(java.awt.image.BufferedImage srcImage) { int w = srcImage.getWidth(); int h = srcImage.getHeight(); java.awt.image.BufferedImage dstImage = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_RGB); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { int rgb = srcImage.getRGB(x, y); java.awt.Color c; if (rgb == 0xff000000) { c = firstColor(0); } else if (rgb == 0xff000008) { c = midColor(0); } else if (rgb == 0xff000019) { c = secondColor(0); } else if (rgb == 0xff000800) { c = firstColor(1); } else if (rgb == 0xff000808) { c = midColor(1); } else if (rgb == 0xff000819) { c = secondColor(1); } else if (rgb == 0xff001000) { c = firstColor(2); } else if (rgb == 0xff001008) { c = midColor(2); } else if (rgb == 0xff001019) { c = secondColor(2); } else if (rgb == 0xff001900) { c = firstColor(3); } else if (rgb == 0xff001908) { c = midColor(3); } else if (rgb == 0xff001919) { c = secondColor(3); } else if (rgb == 0xff002100) { c = firstColor(4); } else if (rgb == 0xff002108) { c = midColor(4); } else if (rgb == 0xff002119) { c = secondColor(4); } else { System.err.println(String.format("%x", rgb)); c = new java.awt.Color(255, 0, 255); } dstImage.setRGB(x, y, gammaCorrect(c)); } } return dstImage; } private void updateSongAndInstrScreens() { previewSongLabel.setIcon(new StretchIcon(modifyUsingPalette(songImage))); previewInstrLabel.setIcon(new StretchIcon(modifyUsingPalette(instrImage))); } private void updatePreviewPanes() { preview1a.setBackground(new java.awt.Color(gammaCorrect(firstColor(0)))); preview1b.setBackground(new java.awt.Color(gammaCorrect(secondColor(0)))); preview2a.setBackground(new java.awt.Color(gammaCorrect(firstColor(1)))); preview2b.setBackground(new java.awt.Color(gammaCorrect(secondColor(1)))); preview3a.setBackground(new java.awt.Color(gammaCorrect(firstColor(2)))); preview3b.setBackground(new java.awt.Color(gammaCorrect(secondColor(2)))); preview4a.setBackground(new java.awt.Color(gammaCorrect(firstColor(3)))); preview4b.setBackground(new java.awt.Color(gammaCorrect(secondColor(3)))); preview5a.setBackground(new java.awt.Color(gammaCorrect(firstColor(4)))); preview5b.setBackground(new java.awt.Color(gammaCorrect(secondColor(4)))); updateSongAndInstrScreens(); } private void updateSpinners() { updatingSpinners = true; c1r1.setValue(firstColor(0).getRed() >> 3); c1g1.setValue(firstColor(0).getGreen() >> 3); c1b1.setValue(firstColor(0).getBlue() >> 3); c1r2.setValue(secondColor(0).getRed() >> 3); c1g2.setValue(secondColor(0).getGreen() >> 3); c1b2.setValue(secondColor(0).getBlue() >> 3); c2r1.setValue(firstColor(1).getRed() >> 3); c2g1.setValue(firstColor(1).getGreen() >> 3); c2b1.setValue(firstColor(1).getBlue() >> 3); c2r2.setValue(secondColor(1).getRed() >> 3); c2g2.setValue(secondColor(1).getGreen() >> 3); c2b2.setValue(secondColor(1).getBlue() >> 3); c3r1.setValue(firstColor(2).getRed() >> 3); c3g1.setValue(firstColor(2).getGreen() >> 3); c3b1.setValue(firstColor(2).getBlue() >> 3); c3r2.setValue(secondColor(2).getRed() >> 3); c3g2.setValue(secondColor(2).getGreen() >> 3); c3b2.setValue(secondColor(2).getBlue() >> 3); c4r1.setValue(firstColor(3).getRed() >> 3); c4g1.setValue(firstColor(3).getGreen() >> 3); c4b1.setValue(firstColor(3).getBlue() >> 3); c4r2.setValue(secondColor(3).getRed() >> 3); c4g2.setValue(secondColor(3).getGreen() >> 3); c4b2.setValue(secondColor(3).getBlue() >> 3); c5r1.setValue(firstColor(4).getRed() >> 3); c5g1.setValue(firstColor(4).getGreen() >> 3); c5b1.setValue(firstColor(4).getBlue() >> 3); c5r2.setValue(secondColor(4).getRed() >> 3); c5g2.setValue(secondColor(4).getGreen() >> 3); c5b2.setValue(secondColor(4).getBlue() >> 3); updatingSpinners = false; } private int findNameOffset() { // Palette names are in bank 27. int i = 0x4000 * 27; while (i < 0x4000 * 28) { if (romImage[i] == 'G' && // gray romImage[i + 1] == 'R' && romImage[i + 2] == 'A' && romImage[i + 3] == 'Y' && romImage[i + 4] == 0 && romImage[i + 5] == 'I' && // inv romImage[i + 6] == 'N' && romImage[i + 7] == 'V' && romImage[i + 8] == ' ' && romImage[i + 9] == 0 && romImage[i + 10] == 0 && // empty romImage[i + 11] == 0 && romImage[i + 12] == 0 && romImage[i + 13] == 0 && romImage[i + 14] == 0 && romImage[i + 15] == 0 && // empty romImage[i + 16] == 0 && romImage[i + 17] == 0 && romImage[i + 18] == 0 && romImage[i + 19] == 0 && romImage[i + 20] == 0 && // empty romImage[i + 21] == 0 && romImage[i + 22] == 0 && romImage[i + 23] == 0 && romImage[i + 24] == 0 && romImage[i + 25] == 0 && // empty romImage[i + 26] == 0 && romImage[i + 27] == 0 && romImage[i + 28] == 0 && romImage[i + 29] == 0) { return i + 30; } ++i; } return -1; } private int findPaletteOffset() { // Finds the palette location by searching for the screen // backgrounds, which are defined directly after the palettes // in bank 1. int i = 0x4000; while (i < 0x8000) { // The first screen background start with 17 zeroes // followed by three 72's. if (romImage[i] == 0 && romImage[i + 1] == 0 && romImage[i + 2] == 0 && romImage[i + 3] == 0 && romImage[i + 4] == 0 && romImage[i + 5] == 0 && romImage[i + 6] == 0 && romImage[i + 7] == 0 && romImage[i + 8] == 0 && romImage[i + 9] == 0 && romImage[i + 10] == 0 && romImage[i + 11] == 0 && romImage[i + 12] == 0 && romImage[i + 13] == 0 && romImage[i + 14] == 0 && romImage[i + 15] == 0 && romImage[i + 16] == 0 && romImage[i + 17] == 72 && romImage[i + 18] == 72 && romImage[i + 19] == 72) { return i - paletteCount * paletteSize; } ++i; } return -1; } public void itemStateChanged(java.awt.event.ItemEvent e) { if (e.getStateChange() == java.awt.event.ItemEvent.SELECTED) { // Palette changed. if (kitSelector.getSelectedIndex() != -1) { updatePreviewPanes(); updateSpinners(); } } } public void stateChanged(ChangeEvent e) { // Spinner changed. if (!updatingSpinners) { updateRomFromSpinners(); updatePreviewPanes(); } } public void actionPerformed(java.awt.event.ActionEvent e) { // Kit name was edited. JComboBox cb = (JComboBox)e.getSource(); if (cb.getSelectedIndex() == -1) { setPaletteName(previousSelectedKit, (String)cb.getSelectedItem()); populateKitSelector(); cb.setSelectedIndex(previousSelectedKit); } else { previousSelectedKit = cb.getSelectedIndex(); } } }
[ "kotlinski@gmail.com" ]
kotlinski@gmail.com
69c14cafca193aa1d884dc4c73f476a84576164e
d71d393a6e606ee9e6f0669951c314064adca3b7
/src/Block.java
e29b5f134ddd985a2c718ccc9823dbb8714cfdc6
[]
no_license
quanpham0805/TetrisClone
5d800bbbe8e040b298ce832f3e7dde439f786626
c6531c13f20268ef119fb2d738d5ec9e15c36704
refs/heads/master
2022-08-11T17:24:18.951990
2020-05-20T01:44:28
2020-05-20T01:44:28
264,778,977
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
import java.awt.Color; import java.awt.Graphics; class Block { public int colorIndex; public static Color[] colors = {Color.cyan, Color.blue, Color.orange, Color.yellow, Color.red, Color.green, Color.magenta}; public Block(int colorIndex) { this.colorIndex = colorIndex; } public void draw(Graphics g, int scale, int x, int y) { g.setColor(colors[colorIndex]); g.fillRect(x * scale + 1, y * scale + 1, scale - 2, scale - 2); } }
[ "shiroemon95@gmail.com" ]
shiroemon95@gmail.com
2dd68db1523e73ae795bfe683e930d0d8f4215b0
a8fa66e479705e114b36a21d9e1623b276714fe3
/src/main/java/com/song/springbootdianping/config/druid/DruidFilter.java
0e252e1045efe1995b917e4f98a7dc9b43b43e4e
[]
no_license
songshengping/springboot-dianping
22e7c4684eb46e9ee076528432a8aaf3f3e8a07a
63359293a3bd6eb61b51252865b9ecfd4040cd58
refs/heads/master
2023-01-30T16:02:28.351347
2020-12-15T15:09:16
2020-12-15T15:09:16
293,186,536
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
package com.song.springbootdianping.config.druid; import com.alibaba.druid.support.http.WebStatFilter; import javax.servlet.annotation.WebFilter; import javax.servlet.annotation.WebInitParam; /** * @Description Druid的过滤器,用于过滤一些静态文件 * @Date 2020/9/26 12:16 * @Created by Jeremy */ @WebFilter( filterName = "druidWebStatFilter",urlPatterns = "/*", initParams = { @WebInitParam(name="exclusions",value="*.js,*.gif,*.jpg,*.bpm,*.png,*.css,*.ico,/druid/*") //忽略资源 } ) public class DruidFilter extends WebStatFilter { }
[ "=" ]
=
5e606b8e045731a3dc4438b23f68ec900eaf2cfd
cde0cb089583850f067a395d530e2a084a84398a
/src/main/java/com/springbrewery/springbrewery/web/model/BeerDto.java
7e2d57d66c68e00b6f2ae6542ae98d521378307f
[]
no_license
geodan89/spring-brewery
548e0435b1c4fd9deb22ce9d22f926dde9cd2112
b1d654969948e8bd76dd7cfae3ec250e02c79a37
refs/heads/master
2022-11-16T06:18:42.580510
2020-07-17T20:54:30
2020-07-17T20:54:30
275,444,852
0
0
null
null
null
null
UTF-8
Java
false
false
558
java
package com.springbrewery.springbrewery.web.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Null; import javax.validation.constraints.Positive; import java.util.UUID; @Data @NoArgsConstructor @AllArgsConstructor @Builder public class BeerDto { @Null private UUID id; @NotBlank private String beerName; @NotBlank private String beerStyle; @Positive private Long upc; }
[ "geodan89@gmail.com" ]
geodan89@gmail.com
659699dd53f61c8896ea3d094eddb930295d5461
d30baa0e5a3a7b3977c311c7337569ecaa56ed2d
/project/1 Demo/kafka_producer_consumer_demo/src/main/java/cn/ac/sict/ljc/kafka_producer_consumer_demo/Producer.java
6fb0599ec61fb944796e01d8964bc88bf0545ffe
[]
no_license
Will-Grindelwald/Storm-Kafka
5bd356d7ac813fa54a1695e801829338c080b782
9fbd3706692f706b980d5e17eff87592e943e2b7
refs/heads/master
2021-01-12T16:52:11.038899
2018-10-10T15:35:26
2018-10-10T16:15:06
71,458,478
24
22
null
null
null
null
UTF-8
Java
false
false
1,297
java
package cn.ac.sict.ljc.kafka_producer_consumer_demo; import java.util.Properties; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.serialization.StringSerializer; public class Producer extends Thread { private final KafkaProducer<String, String> producer; private final String topic; public Producer(String kafkaStr, String topic) { Properties props = new Properties(); props.put("bootstrap.servers", kafkaStr); props.put("acks", "all"); props.put("retries", 0); props.put("batch.size", 16384); props.put("linger.ms", 1); props.put("buffer.memory", 33554432); props.put("key.serializer", StringSerializer.class.getName()); props.put("value.serializer", StringSerializer.class.getName()); this.producer = new KafkaProducer<String, String>(props); this.topic = topic; } @Override public void run() { int messageNo = 1; try { while (true) { String messageStr = "Message_" + messageNo; System.out.println("Send:" + messageStr); producer.send(new ProducerRecord<String, String>(topic, "Message", messageStr)); messageNo++; sleep(200); } } catch (InterruptedException e) { e.printStackTrace(); } finally { producer.close(); } } }
[ "ljclg_1516@foxmail.com" ]
ljclg_1516@foxmail.com
1fa24a122cb48b124a6ff702a2472b9d352420b2
8bd4d36cf43cad75ed105d17467e22bc170f44b5
/test-ejb/ejbModule/ubci/app/business/AuthenticationServiceRemote.java
af2037d9fecc8c4a1d2bade033e475e3a9d1a53c
[]
no_license
salmalandoulsi/PFE_UBCI
b8cf835154767912064d04b771e8879bb29a39fb
43fbcd8409b79760ce4498c5620f5d863a3c377a
refs/heads/master
2021-01-17T17:55:35.713522
2016-06-16T05:11:05
2016-06-16T05:11:05
61,261,506
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package ubci.app.business; import java.util.List; import javax.ejb.Remote; import ubci.app.persistence.User; @Remote public interface AuthenticationServiceRemote { void createUser(User user); List<User> findAllUsers(); User authenticate(String login, String password); }
[ "salmalandoulsi@gmail.com" ]
salmalandoulsi@gmail.com
9274105da0b36f69cc5e9cda60e7df3acd0f5877
120fff3e7a897b904e6a7f3b9edc8ee854bcc175
/src/main/java/com/ebei/eba/mapper/ParamDetailMapper.java
457f450af6bb88ed455afbea3eeb466a3adda412
[]
no_license
yangsumeng/eba-management-service
9bf6cbb64ee1dfcb26a3863bb7f390631576315c
5c98a27d3bdd9e01668a4a9fb44a986d595dd6ec
refs/heads/master
2020-03-28T14:08:48.342653
2018-09-13T12:49:38
2018-09-13T12:49:38
148,460,676
0
0
null
null
null
null
UTF-8
Java
false
false
1,285
java
package com.ebei.eba.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.baomidou.mybatisplus.plugins.Page; import com.ebei.eba.model.entity.ParamDetail; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Map; /** auto code version 1.4 * * @Description : ParamDetailMapper * @time 创建时间 : 2018-09-10 * @author : JiangP * @Copyright (c) ${year} 一碑科技 * @version */ @Repository public interface ParamDetailMapper extends BaseMapper<ParamDetail> { /**自动生成 2018-09-10 */ public List<Map<String,Object>> selectMapList(Page<Map<String,Object>> page, Map params); /**自动生成 2018-09-10 */ public List<Map<String,Object>> getLabelAndValueList(Map<String,Object> params); /** * emptyMethod1 方法 * 自动生成 2018-09-10 */ public List<Map<String,Object>> emptyMethod1(Map<String,Object> params); /** * emptyMethod2 方法 * 自动生成 2018-09-10 */ public List<Map<String,Object>> emptyMethod2(Map<String,Object> params); /** * getShowDeviceLevelPage 方法 * 自动生成 2018-09-10 */ public List<Map<String,Object>> getShowDeviceLevelPage(Page<Map<String,Object>> page,Map<String,Object> params); }
[ "584903541@qq.com" ]
584903541@qq.com
99eabfc2291529286fe95f0e639978a58a48f056
d0e8d03d2b84a6f210d6536ccbc2ca60f574f4f8
/app/src/main/java/com/manao/manaoshop/activity/CreateOrderActivity.java
2b4e268e4ac97e5a15ba36d7b7717180cf4e2b6e
[]
no_license
zuoyan007/MaNaoShop
e354419bbbea7d6dd964101ba8a36631dd7ebeb9
fcdadb47576d3b09c77195924a85daa3eb66e645
refs/heads/master
2022-01-16T15:02:16.126590
2018-12-13T06:54:42
2018-12-13T06:54:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,335
java
package com.manao.manaoshop.activity; import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.Button; import android.widget.RadioButton; import android.widget.RelativeLayout; import android.widget.TextView; import com.manao.manaoshop.BuildConfig; import com.manao.manaoshop.Constants; import com.manao.manaoshop.MaNaoAppaplication; import com.manao.manaoshop.R; import com.manao.manaoshop.adapter.WareOrderAdapter; import com.manao.manaoshop.adapter.layoutmanager.FullyLinearLayoutManager; import com.manao.manaoshop.base.baseactivity.BaseActivity; import com.manao.manaoshop.bean.BaseRespMsg; import com.manao.manaoshop.bean.Charge; import com.manao.manaoshop.bean.CreateOrderRespMsg; import com.manao.manaoshop.bean.ShoppingCart; import com.manao.manaoshop.http.ApiService; import com.manao.manaoshop.http.OkHttpHelper; import com.manao.manaoshop.http.SpotsCallBack; import com.manao.manaoshop.utils.JSONUtils; import com.manao.manaoshop.utils.ShopCarProvider; import com.manao.manaoshop.utils.ToastUtils; import com.manao.manaoshop.weiget.MaNaoToolbar; import com.pingplusplus.android.PaymentActivity; import com.pingplusplus.android.Pingpp; import org.xutils.view.annotation.ViewInject; import org.xutils.x; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import okhttp3.Response; /** * Created by Malong * on 18/12/8. * 提交订单页面 */ public class CreateOrderActivity extends BaseActivity implements View.OnClickListener { /** * 银联支付渠道 */ private static final String CHANNEL_UPACP = "upacp"; /** * 微信支付渠道 */ private static final String CHANNEL_WECHAT = "wx"; /** * 支付支付渠道 */ private static final String CHANNEL_ALIPAY = "alipay"; @ViewInject(R.id.toolbar) private MaNaoToolbar mMaNaoToolbar; @ViewInject(R.id.txt_order) private TextView txtOrder;//订单列表文字 @ViewInject(R.id.recycler_view) private RecyclerView mRecyclerView;//订单列表图片 @ViewInject(R.id.rl_alipay) private RelativeLayout mLayoutAlipay;//支付宝支付 @ViewInject(R.id.rl_wechat) private RelativeLayout mLayoutWechat;//微信支付 @ViewInject(R.id.rl_bd) private RelativeLayout mLayoutBd;//银联支付 @ViewInject(R.id.rb_alipay) private RadioButton mRbAlipay;//支付宝选中按钮 @ViewInject(R.id.rb_webchat) private RadioButton mRbWechat;//微信选中按钮 @ViewInject(R.id.rb_bd) private RadioButton mRbBd;//银联选中按钮 @ViewInject(R.id.btn_createOrder) private Button mBtnCreateOrder;//银提交订单按钮 @ViewInject(R.id.txt_total) private TextView mTxtTotal;//总价钱 OkHttpHelper okHttpHelper = OkHttpHelper.getInstance();//创建网络请求 private ShopCarProvider provider;//数据存储类 private WareOrderAdapter mAdapter;//列表商品图片 private String orderNum;//订单id private String payChannel = CHANNEL_ALIPAY;//默认选择支付宝支付 private float amount;//总价钱 private HashMap<String, RadioButton> channels = new HashMap<>(3);//三个支付渠道选择要互斥,所以创建一个map保存 @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_order); //引入xUtils x.view().inject(this); //展示商品数据 showData(); //初始化 init(); //加载toolbar initToolbar(); } //展示商品数据 private void showData() { provider = new ShopCarProvider(this); mAdapter = new WareOrderAdapter(this, provider.getAll()); FullyLinearLayoutManager layoutManager = new FullyLinearLayoutManager(this);//解决ScrollView嵌套recyclerView宽高问题 layoutManager.setOrientation(GridLayoutManager.HORIZONTAL); mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.setAdapter(mAdapter); amount = mAdapter.getTotalPrice(); mTxtTotal.setText("应付款: ¥" + amount); } //初始化 private void init() { channels.put(CHANNEL_ALIPAY, mRbAlipay); channels.put(CHANNEL_WECHAT, mRbWechat); channels.put(CHANNEL_UPACP, mRbBd); mLayoutAlipay.setOnClickListener(this); mLayoutWechat.setOnClickListener(this); mLayoutBd.setOnClickListener(this); mBtnCreateOrder.setOnClickListener(this); } //加载toolbar private void initToolbar() { mMaNaoToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CreateOrderActivity.this.finish(); } }); mMaNaoToolbar.hideSearchView(); mMaNaoToolbar.hideRightButton(); } //点击支付渠道,互斥,只能选中一个 @Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.rl_alipay: case R.id.rl_wechat: case R.id.rl_bd: String tag = (String) v.getTag();//设置一个tag,在布局里设置的,要跟最上面的内容一致才可以 for (Map.Entry<String, RadioButton> entry : channels.entrySet()) { payChannel = tag; RadioButton button = entry.getValue(); if (entry.getKey().equals(tag)) { boolean checked = button.isChecked(); button.setChecked(!checked); } else { button.setChecked(false); } } break; case R.id.btn_createOrder: postNewOrder();//发起支付 break; } } //发起支付 private void postNewOrder() { final List<ShoppingCart> datas = mAdapter.getDatas(); List<WareItem> items = new ArrayList<>(datas.size());//发起支付时需要有这一种格式 //遍历元素并装入 WareItem for (ShoppingCart c : datas) { WareItem item = new WareItem(c.getId(), c.getPrice().intValue()); items.add(item); } String json = JSONUtils.toJSON(items);//将其转换为string HashMap<String, Object> params = new HashMap<>(5);//初始化参数 params.put("user_id", MaNaoAppaplication.getInstance().getUser().getId() + ""); params.put("item_json", json); params.put("pay_channel", payChannel); params.put("amount", (int) amount + ""); params.put("addr_id", 1 + ""); mBtnCreateOrder.setEnabled(false);//在发起支付的时候不可以再点击提交订单按钮 //请求网络 okHttpHelper.post(ApiService.API.ORDER_CREATE, params, new SpotsCallBack<CreateOrderRespMsg>(this) { @Override public void onSuccess(Response response, CreateOrderRespMsg respMsg) { // provider.delete((ShoppingCart) provider.getAll());//清空购物车信息 mBtnCreateOrder.setEnabled(true);//发起支付请求成功后可以点击 orderNum = respMsg.getData().getOrderNum(); Charge charge = respMsg.getData().getCharge(); //请求后台API成功后,获取支付Charge,去调起支付SDK API发起支付 openPaymentActivity(JSONUtils.toJSON(charge)); } @Override public void onError(Response response, int code, Exception e) { mBtnCreateOrder.setEnabled(true);//发起支付请求失败后可以点击 } @Override public void onErrorToken(Response response, int code) { super.onErrorToken(response, code); } }); } //请求后台API成功后,获取支付Charge,去调起支付SDK API发起支付 private void openPaymentActivity(String s) { Pingpp.createPayment(this,s); if (BuildConfig.DEBUG){ Pingpp.DEBUG = true;//打开Ping++ log日志 } } //intent回调 然后直接进入支付结果页面 @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == Constants.REQUEST_CODE_PAYMENT && resultCode == Activity.RESULT_OK) { String pay_result = data.getExtras().getString("pay_result"); /** * 处理返回值 * "success" - payment succeed * "fail" - payment failed * "cancel" - user canceld * "invalid" - payment plugin not installed 不合法 * * 如果是银联渠道返回 invalid,调用 UPPayAssistEx.installUPPayPlugin(this); 安装银联安全支付控件。 */ if (pay_result.equals("success")) changeOrderStatus(1);//处理不同返回值得函数 else if (pay_result.equals("fail")) changeOrderStatus(-1);//处理不同返回值得函数 else if (pay_result.equals("cancel")) changeOrderStatus(-2);//处理不同返回值得函数 else changeOrderStatus(0);//处理不同返回值得函数 } } //处理不同返回值得函数 private void changeOrderStatus(final int status) { Map<String, Object> params = new HashMap<>(5); params.put("order_num", orderNum); params.put("status", status + ""); okHttpHelper.post(ApiService.API.ORDER_COMPLEPE, params, new SpotsCallBack<BaseRespMsg>(this) { @Override public void onSuccess(Response response, BaseRespMsg o) { toPayResultActivity(status);//进入支付完成的结果页 } @Override public void onError(Response response, int code, Exception e) { toPayResultActivity(-1);//进入支付完成的结果页 } }); } //进入支付完成的结果页 private void toPayResultActivity(int status) { Intent intent = new Intent(this, PayResultActivity.class); intent.putExtra("status", status); startActivity(intent); this.finish(); } //发起支付时需要有这一种格式 class WareItem { private Long ware_id; private int amount; public WareItem(Long ware_id, int amount) { this.ware_id = ware_id; this.amount = amount; } public Long getWare_id() { return ware_id; } public void setWare_id(Long ware_id) { this.ware_id = ware_id; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } } }
[ "malong@100tal.com" ]
malong@100tal.com
5561addc07f9d36edf1b623ca879bee188f463d6
00e1e36e1b3eaa61eecb6fa23506c5ef4d0a8d7b
/app/src/main/java/com/example/thelazychef/MainActivity.java
4d6fe80bc32b864dda22dd832fdc5552597fd715
[]
no_license
13sakshi13/the-lazy-chef-android
d7761ce4234c7e5d9eefd0123abb51362a09c358
bd9e0478e98d1f8c495ce5d106b808e0e30daa9d
refs/heads/master
2023-07-02T00:31:37.669654
2020-11-26T07:11:56
2020-11-26T07:11:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,435
java
package com.example.thelazychef; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { Button getStartedButton; ImageView contactUsButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // going to explore screen getStartedButton = findViewById(R.id.getStartedButton); getStartedButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // check for internet connectivity if (isNetworkConnectionAvailable()) { Intent explorePageOpener = new Intent(MainActivity.this, Explore.class); startActivity(explorePageOpener); } else { // display network error page if network connection is not available Intent networkErrorPageOpener = new Intent(MainActivity.this, NetworkError.class); startActivity(networkErrorPageOpener); } } }); // going to contacts screen contactUsButton = findViewById(R.id.contactUsButton); contactUsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent contactUsPageOpener = new Intent(MainActivity.this, ContactUs.class); startActivity(contactUsPageOpener); } }); } public boolean isNetworkConnectionAvailable () { boolean connected = false; ConnectivityManager connectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); try { connected = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED; } catch (Exception e) { e.printStackTrace(); } return connected; } }
[ "gr8gautham@gmail.com" ]
gr8gautham@gmail.com
326b6a317f400a62a76fa413d275ea0b1c604727
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/serge-rider--dbeaver/d8e50ccd42b81d2ec7e6687724688029f377f7a5/after/NavigatorHandlerLocalFolderCreate.java
0449abb8873a334ed75a9f5c40351551a510e98e
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
3,073
java
/* * Copyright (C) 2010-2013 Serge Rieder * serge@jkiss.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.jkiss.dbeaver.ui.actions.navigator; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.handlers.HandlerUtil; import org.jkiss.dbeaver.model.navigator.*; import org.jkiss.dbeaver.ui.NavigatorUtils; import org.jkiss.dbeaver.ui.dialogs.EnterNameDialog; import org.jkiss.utils.CommonUtils; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; public class NavigatorHandlerLocalFolderCreate extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { final ISelection selection = HandlerUtil.getCurrentSelection(event); if (selection instanceof IStructuredSelection) { IStructuredSelection structSelection = (IStructuredSelection) selection; List<DBNDataSource> dataSources = new ArrayList<DBNDataSource>(); for (Iterator iter = structSelection.iterator(); iter.hasNext(); ) { Object element = iter.next(); if (element instanceof DBNDataSource) { dataSources.add((DBNDataSource) element); } } if (!dataSources.isEmpty()) { createFolder(HandlerUtil.getActiveWorkbenchWindow(event), dataSources, null); } } return null; } public static boolean createFolder(IWorkbenchWindow workbenchWindow, final Collection<DBNDataSource> nodes, String newName) { if (newName == null) { newName = EnterNameDialog.chooseName(workbenchWindow.getShell(), "Folder name"); } if (CommonUtils.isEmpty(newName)) { return false; } // Just set folder path and refresh databases root // DS container will reload folders on refresh for (DBNDataSource node : nodes) { node.setFolderPath(newName); } NavigatorUtils.updateConfigAndRefreshDatabases(nodes.iterator().next()); return true; } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
83c9f7960247bcde9b0d66a310c794bb36255449
3c57076e273d35434ed088e4bb71575ef4265042
/app/src/main/java/com/tti/ttimediastore/fragment/CatalogFragment.java
94c1d3811888f7b8d779a8011f26148d7f5dc26b
[]
no_license
JinRong1125/MediaStore
345d3a4999bc180aa0134530f3285effdfa83514
92153496ff0c9e7754b21251536c7d6873d52297
refs/heads/master
2020-03-22T21:06:48.532781
2019-01-31T10:51:06
2019-01-31T10:51:06
140,657,756
1
1
null
null
null
null
UTF-8
Java
false
false
22,193
java
package com.tti.ttimediastore.fragment; import android.app.Activity; import android.content.ContentResolver; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.provider.MediaStore; import android.support.v17.leanback.app.BackgroundManager; import android.support.v17.leanback.app.BrowseFragment; import android.support.v17.leanback.widget.ArrayObjectAdapter; import android.support.v17.leanback.widget.HeaderItem; import android.support.v17.leanback.widget.ListRow; import android.support.v17.leanback.widget.ListRowPresenter; import android.support.v17.leanback.widget.OnItemViewClickedListener; import android.support.v17.leanback.widget.Presenter; import android.support.v17.leanback.widget.Row; import android.support.v17.leanback.widget.RowPresenter; import android.support.v4.content.ContextCompat; import android.view.KeyEvent; import android.view.View; import android.widget.Toast; import com.tti.ttimediastore.activity.ContentActivity; import com.tti.ttimediastore.activity.ItemGridActivity; import com.tti.ttimediastore.R; import com.tti.ttimediastore.activity.SearchActivty; import com.tti.ttimediastore.manager.IrisActionManager; import com.tti.ttimediastore.utils.Utils; import com.tti.ttimediastore.activity.UPnPActivity; import com.tti.ttimediastore.constants.Constants; import com.tti.ttimediastore.manager.AudioPlayerController; import com.tti.ttimediastore.manager.AudioTrackUpdater; import com.tti.ttimediastore.model.Audio; import com.tti.ttimediastore.model.Image; import com.tti.ttimediastore.model.Option; import com.tti.ttimediastore.model.OptionDialog; import com.tti.ttimediastore.model.Video; import com.tti.ttimediastore.presenter.ListRowPrestenter; import java.util.ArrayList; /** * Created by dylan_liang on 2017/4/7. */ public class CatalogFragment extends BrowseFragment implements AudioTrackUpdater.OnTrackUpdater, IrisActionManager.IrisCommandListener { private ArrayObjectAdapter catalogAdapter; private ArrayObjectAdapter listRowAdapter; private ArrayObjectAdapter videoListAdapter; private ArrayObjectAdapter audioListAdapter; private ArrayObjectAdapter imageListAdapter; private BackgroundManager backgroundManager; private ListRowPrestenter listRowPrestenter; private HeaderItem headerItem; private Option option; private OptionDialog deleteDialog; private boolean isPause = false; private boolean isToastShown = false; private boolean isUpdated = false; private Activity activity; private Audio audio; private ArrayList<Image> imageList; private static final int IMAGE_ITEM = 4; private static final int DELAY_UPDATE = 750; public void onAttach(Activity activity) { super.onAttach(activity); if (activity == null) return; this.activity = activity; } public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Constants.IRIS_EVENT = Constants.EVENT_NONE; setUIElements(); setCatalog(); } public void onResume() { super.onResume(); if (Constants.IRIS_EVENT == Constants.EVENT_VIDEO) { Constants.IRIS_EVENT = Constants.EVENT_NONE; Constants.MODEL_TYPE = Constants.VIDEO_ALL; Intent intent = new Intent(getActivity(), ItemGridActivity.class); startActivity(intent); } else if (Constants.IRIS_EVENT == Constants.EVENT_AUDIO) { Constants.IRIS_EVENT = Constants.EVENT_NONE; Constants.MODEL_TYPE = Constants.AUDIO_ALL; Intent intent = new Intent(getActivity(), ItemGridActivity.class); startActivity(intent); } else if (Constants.IRIS_EVENT == Constants.EVENT_IMAGE) { Constants.IRIS_EVENT = Constants.EVENT_NONE; Constants.MODEL_TYPE = Constants.IMAGE_ALL; Intent intent = new Intent(getActivity(), ItemGridActivity.class); startActivity(intent); } backgroundManager.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.wallpaper)); if (!isUpdated) { isUpdated = true; new Handler().postDelayed(new Runnable() { @Override public void run() { updateState(); } }, DELAY_UPDATE); } IrisActionManager.getInstance().setListener(this); isPause = false; isToastShown = false; } public void onPause() { super.onPause(); IrisActionManager.getInstance().setListener(null); isPause = true; isUpdated = false; } public void onStop() { super.onStop(); } public void onDestroy() { super.onDestroy(); backgroundManager.release(); } @Override public void onIrisYes(String message) { } @Override public void onIrisNo(String message) { } @Override public void onIrisPlay(String message) { } @Override public void onIrisPause(String message) { } @Override public void onIrisVolumeUp(String message) { } @Override public void onIrisVolumeDown(String message) { } @Override public void onIrisMute(String message) { } @Override public void onIrisUnMute(String message) { } @Override public void onIrisBack(String message) { getActivity().moveTaskToBack(true); } @Override public void onIrisClose(String message) { getActivity().moveTaskToBack(true); } @Override public void onIrisVideo(String message) { Constants.MODEL_TYPE = Constants.VIDEO_ALL; Intent intent = new Intent(getActivity(), ItemGridActivity.class); startActivity(intent); } @Override public void onIrisAudio(String message) { Constants.MODEL_TYPE = Constants.AUDIO_ALL; Intent intent = new Intent(getActivity(), ItemGridActivity.class); startActivity(intent); } @Override public void onIrisImage(String message) { Constants.MODEL_TYPE = Constants.IMAGE_ALL; Intent intent = new Intent(getActivity(), ItemGridActivity.class); startActivity(intent); } @Override public void onIrisMain(String message) { } private void setUIElements() { setTitle(getString(R.string.app_title)); setHeadersState(HEADERS_ENABLED); setHeadersTransitionOnBackEnabled(true); setBrandColor(ContextCompat.getColor(getContext(), R.color.base_color)); setSearchAffordanceColor(ContextCompat.getColor(getContext(), R.color.search)); backgroundManager = BackgroundManager.getInstance(getActivity()); if (!backgroundManager.isAttached()) backgroundManager.attach(getActivity().getWindow()); setOnSearchClickedListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), SearchActivty.class); startActivity(intent); } }); AudioTrackUpdater.getInstance().setListener(this); setDialog(); } private void setDialog() { deleteDialog = new OptionDialog(getActivity(), getString(R.string.record_delete), new CatalogFragment.YesListener(), new CatalogFragment.NoListener()); deleteDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { @Override public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK || keyEvent.getKeyCode() == KeyEvent.KEYCODE_ESCAPE && deleteDialog.isShowing()) { deleteDialog.dismiss(); } return false; } }); } private class YesListener implements View.OnClickListener { @Override public void onClick(View view) { clearAdapter(videoListAdapter); option = new Option(); option.setName(getString(R.string.video_all)); addAdapterItem(videoListAdapter, option); Utils.Preferences.setVideoRecord(null); deleteDialog.dismiss(); Toast.makeText(getActivity(), R.string.delete_complete, Toast.LENGTH_SHORT).show(); } } private class NoListener implements View.OnClickListener { @Override public void onClick(View view) { deleteDialog.dismiss(); } } private void setCatalog() { catalogAdapter = new ArrayObjectAdapter(new ListRowPresenter()); listRowPrestenter = new ListRowPrestenter(); setVideo(); setAuido(); setImage(); setOther(); setAdapter(catalogAdapter); setEventListener(); } private void clearAdapter(final ArrayObjectAdapter adapter) { activity.runOnUiThread(new Runnable() { @Override public void run() { adapter.clear(); } }); } private void addAdapterItem(final ArrayObjectAdapter adapter, final Object object) { activity.runOnUiThread(new Runnable() { @Override public void run() { adapter.add(object); } }); } private void setVideo() { Constants.isVideoRecordChanged = true; videoListAdapter = new ArrayObjectAdapter(listRowPrestenter); headerItem = new HeaderItem(0, getString(R.string.catalog_video)); option = new Option(); option.setName(getString(R.string.video_all)); addAdapterItem(videoListAdapter, option); addAdapterItem(catalogAdapter, new ListRow(headerItem, videoListAdapter)); } private void setAuido() { audioListAdapter = new ArrayObjectAdapter(listRowPrestenter); headerItem = new HeaderItem(1, getString(R.string.catalog_audio)); String[] audioOption = new String[] { getString(R.string.audio_all), getString(R.string.audio_artists), getString(R.string.audio_albums), getString(R.string.audio_genres) }; for (int i = 0; i < audioOption.length; i++) { option = new Option(); option.setName(audioOption[i]); addAdapterItem(audioListAdapter, option); } addAdapterItem(catalogAdapter, new ListRow(headerItem, audioListAdapter)); } private void setImage() { imageListAdapter = new ArrayObjectAdapter(listRowPrestenter); headerItem = new HeaderItem(2, getString(R.string.catalog_image)); option = new Option(); option.setName(getString(R.string.image_all)); addAdapterItem(imageListAdapter, option); addAdapterItem(catalogAdapter, new ListRow(headerItem, imageListAdapter)); } private void setOther() { listRowAdapter = new ArrayObjectAdapter(listRowPrestenter); headerItem = new HeaderItem(3, getString(R.string.catalog_other)); String[] otherOption = new String[] { getString(R.string.other_lan), getString(R.string.other_internet), getString(R.string.video_delete), }; for (int i = 0; i < otherOption.length; i++) { option = new Option(); option.setName(otherOption[i]); addAdapterItem(listRowAdapter, option); } addAdapterItem(catalogAdapter, new ListRow(headerItem, listRowAdapter)); } private void updateState() { if (Constants.isVideoRecordChanged) { Constants.isVideoRecordChanged = false; clearAdapter(videoListAdapter); option = new Option(); option.setName(getString(R.string.video_all)); addAdapterItem(videoListAdapter, option); ArrayList<Video> recordList = Utils.Preferences.getVideoRecord(); if (recordList != null) { int recordCount = recordList.size(); if (recordCount > 0) { for (int i = recordCount; i > 0; i--) addAdapterItem(videoListAdapter, recordList.get(i - 1)); } } } if (AudioPlayerController.getInstance().getListener() != null) { Audio audio = Utils.Preferences.getResumeAudio(); if (this.audio != audio) { this.audio = audio; if (audio != null) { if (audioListAdapter.get(0) instanceof Audio) { audioListAdapter.replace(0, audio); } else { clearAdapter(audioListAdapter); addAdapterItem(audioListAdapter, audio); addAudioOption(); } } else { if (audioListAdapter.get(0) instanceof Audio) { clearAdapter(audioListAdapter); addAudioOption(); } } } } else { Utils.Preferences.setResumeAudio(null); if (audioListAdapter.get(0) instanceof Audio) { clearAdapter(audioListAdapter); addAudioOption(); } } clearAdapter(imageListAdapter); option = new Option(); option.setName(getString(R.string.image_all)); addAdapterItem(imageListAdapter, option); new setImageList().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void addAudioOption() { String[] audioOption = new String[] { getString(R.string.audio_all), getString(R.string.audio_artists), getString(R.string.audio_albums), getString(R.string.audio_genres), }; for (int i = 0; i < audioOption.length; i++) { option = new Option(); option.setName(audioOption[i]); addAdapterItem(audioListAdapter, option); } } private void randomImage() { if (imageList != null) { int imageCount = imageList.size(); if (imageCount > 0) { if (imageCount <= IMAGE_ITEM) { for (int i = 0; i < imageCount; i++) addAdapterItem(imageListAdapter, imageList.get(i)); } else { int imageTrack = (int) (Math.random() * (imageCount - IMAGE_ITEM)); for (int i = imageTrack; i < imageTrack + IMAGE_ITEM; i++) addAdapterItem(imageListAdapter, imageList.get(i)); } } } } @Override public void onTrackUpdate() { if (!isPause) { audio = AudioTrackUpdater.getInstance().getUpdateTrack(); audioListAdapter.replace(0, audio); } } @Override public void onTrackListEnd() { if (!isPause) { Utils.Preferences.setResumeAudio(null); clearAdapter(audioListAdapter); addAudioOption(); AudioPlayerController.getInstance().finish(); } } private void scanVideo(final Video video) { MediaScannerConnection.scanFile(getActivity(), new String[] { video.getPath() }, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { video.setPath(path); Constants.MODEL_TYPE = Constants.VIDEO_RESUME; Intent intent = new Intent(getActivity(), ContentActivity.class); intent.putExtra(Constants.ITEM_CONTENT, video); startActivity(intent); } }); } private void scanImage(final Image image) { MediaScannerConnection.scanFile(getActivity(), new String[] { image.getPath() }, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { image.setPath(path); Constants.MODEL_TYPE = Constants.IMAGE_ALL; Intent intent = new Intent(getActivity(), ContentActivity.class); intent.putExtra(Constants.ITEM_CONTENT, imageList); intent.putExtra(Constants.ITEM_ID, image.getId()); startActivity(intent); } }); } private class setImageList extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { imageList = new ArrayList<>(); } @Override protected Void doInBackground(Void... voids) { Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; ContentResolver contentResolver = getActivity().getContentResolver(); Cursor cursor = contentResolver.query(uri, null, null, null, null); if (cursor != null && cursor.getCount() > 0) { cursor.moveToFirst(); for (int i = 0; i < cursor.getCount(); i++) { if (cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)) != null) { Image image = new Image(); image.setId(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID))); image.setTitle(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE))); image.setPath(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA))); imageList.add(image); cursor.moveToNext(); } else cursor.moveToNext(); } } if (cursor != null) cursor.close(); return null; } @Override protected void onPostExecute(Void aVoid) { randomImage(); } } private void setEventListener() { setOnItemViewClickedListener(new OnItemViewClickedListener() { @Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof Video) { scanVideo((Video) item); } else if (item instanceof Audio) { Constants.MODEL_TYPE = Constants.AUDIO_RESUME; Intent intent = new Intent(getActivity(), ContentActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); } else if (item instanceof Image) { scanImage((Image) item); } else if (item instanceof Option) { String name = ((Option) item).getName(); if (name.equals(getString(R.string.video_delete))) { ArrayList<Video> recordList = Utils.Preferences.getVideoRecord(); if (recordList != null) if (recordList.size() > 0) deleteDialog.show(); else { Utils.Preferences.setVideoRecord(null); Toast.makeText(getActivity(), R.string.record_empty, Toast.LENGTH_SHORT).show(); } else Toast.makeText(getActivity(), R.string.record_empty, Toast.LENGTH_SHORT).show(); } else if (name.equals(getString(R.string.other_lan))) { Constants.MODEL_TYPE = Constants.OTHER_UPNP; Intent intent = new Intent(getActivity(), UPnPActivity.class); startActivity(intent); } else if (name.equals(getString(R.string.other_internet))) { Constants.MODEL_TYPE = Constants.OTHER_INTERNET; Intent intent = new Intent(getActivity(), ContentActivity.class); startActivity(intent); } else if (name.equals(getString(R.string.other_preferences))) { Constants.MODEL_TYPE = Constants.OTHER_PREFERENCES; } else { if (name.equals(getString(R.string.video_all))) Constants.MODEL_TYPE = Constants.VIDEO_ALL; else if (name.equals(getString(R.string.audio_artists))) Constants.MODEL_TYPE = Constants.AUDIO_ARTISTS; else if (name.equals(getString(R.string.audio_albums))) Constants.MODEL_TYPE = Constants.AUDIO_ALBUMS; else if (name.equals(getString(R.string.audio_genres))) Constants.MODEL_TYPE = Constants.AUDIO_GENRES; else if (name.equals(getString(R.string.audio_all))) Constants.MODEL_TYPE = Constants.AUDIO_ALL; else if (name.equals(getString(R.string.image_all))) Constants.MODEL_TYPE = Constants.IMAGE_ALL; Intent intent = new Intent(getActivity(), ItemGridActivity.class); startActivity(intent); } } } }); } }
[ "w842001@gmail.com" ]
w842001@gmail.com
9cab8efac9b70f2da1fe38e19f20f4702ed77a69
1776c6d6e8088afa19821d8f634173176268d955
/eladmin-system/src/main/java/me/liang/modules/system/service/dto/RoleQueryCriteria.java
f8c450d1be72a3a2c46767b919ec7e82daaaeb3e
[ "Apache-2.0" ]
permissive
bobzxqwe/Employee-Management
31ca037cefee71672877ccc66d63b1f404f9ea7b
c161e8ba804c61e3738cacd20399ce603ddc2bde
refs/heads/master
2022-11-04T11:25:58.682456
2020-06-22T08:14:06
2020-06-22T08:14:06
274,077,815
0
0
null
null
null
null
UTF-8
Java
false
false
992
java
/* * Copyright 2019-2020 Zheng Jie * * 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 me.liang.modules.system.service.dto; import lombok.Data; import me.liang.annotation.Query; import java.sql.Timestamp; import java.util.List; /** * @author Zheng Jie * 公共查询类 */ @Data public class RoleQueryCriteria { @Query(blurry = "name,description") private String blurry; @Query(type = Query.Type.BETWEEN) private List<Timestamp> createTime; }
[ "574914905@qq.com" ]
574914905@qq.com
beb2d08f71b9ffad914d97189b9e4b6d21d3ab61
51dc74bdd5be9143cd501a3722b32812f320c0a9
/ide-diff-builder/mock-old-ide/src/main/java/access/AccessOpenedClass.java
09c347d33afc9c3c85782fd0b406c864e47c5e34
[ "Apache-2.0" ]
permissive
JetBrains/intellij-plugin-verifier
00bb9d69cdbda6aee7bdeed0ea6d07e24e7ecd5c
639ae7ebbc433a81dd956564be57e4514d504ea7
refs/heads/master
2023-09-03T19:14:27.483985
2023-08-30T07:08:13
2023-08-30T07:08:13
3,686,654
161
46
Apache-2.0
2023-09-14T19:09:10
2012-03-11T12:39:20
Kotlin
UTF-8
Java
false
false
139
java
package access; class AccessOpenedClass { //Should not be registered. public int publicField; public void publicMethod() { } }
[ "Sergey.Patrikeev@jetbrains.com" ]
Sergey.Patrikeev@jetbrains.com
8da56aab21c4629e73dcf4afbf97398f1e17281e
3838d5bba2227af9083f47e72cc8fd630a1e6243
/view-redis-core/src/main/java/com/github/huifer/view/redis/model/RedisMemoryTaskData.java
12b557c8becdcf619c50a94086b419249dfc4081
[ "Apache-2.0" ]
permissive
BestJex/view-redis
87b789c840a567c54c6fa16770699bd0de66d558
00d431ac123c8decc744ada9f13cabe1404e17e6
refs/heads/main
2023-01-29T22:25:06.662743
2020-11-10T06:38:07
2020-11-10T06:38:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,023
java
/* * * Copyright 2020 HuiFer All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.github.huifer.view.redis.model; /** redis 内存任务数据 */ public class RedisMemoryTaskData { private long usedMemory = -1; private long usedMemoryRss = -1; private long usedMemoryPeak = -1; private long usedMemoryLua = -1; public RedisMemoryTaskData(long usedMemory, long usedMemoryRss, long usedMemoryPeak, long usedMemoryLua) { this.usedMemory = usedMemory; this.usedMemoryRss = usedMemoryRss; this.usedMemoryPeak = usedMemoryPeak; this.usedMemoryLua = usedMemoryLua; } @Override public String toString() { return "{\"RedisMemoryTaskData\":{" + "\"usedMemory\":" + usedMemory + ",\"usedMemoryRss\":" + usedMemoryRss + ",\"usedMemoryPeak\":" + usedMemoryPeak + ",\"usedMemoryLua\":" + usedMemoryLua + "}}"; } public long getUsedMemory() { return usedMemory; } public void setUsedMemory(long usedMemory) { this.usedMemory = usedMemory; } public long getUsedMemoryRss() { return usedMemoryRss; } public void setUsedMemoryRss(long usedMemoryRss) { this.usedMemoryRss = usedMemoryRss; } public long getUsedMemoryPeak() { return usedMemoryPeak; } public void setUsedMemoryPeak(long usedMemoryPeak) { this.usedMemoryPeak = usedMemoryPeak; } public long getUsedMemoryLua() { return usedMemoryLua; } public void setUsedMemoryLua(long usedMemoryLua) { this.usedMemoryLua = usedMemoryLua; } }
[ "huifer97@163.com" ]
huifer97@163.com
332ebc3be2ba8b82ef4b362698c3728b3cc5b803
3af5305388a7955696a5c38081f0e0a292dde88e
/itest/src/test/java/org/jboss/test/osgi/framework/service/GetUnGetServiceTestCase.java
33128f8f0a240f825de8f7761b686308b744607c
[]
no_license
gspandy/jbosgi-framework
3fd9504a83b8a0d9ffc5742fea99f92007d78085
b96c625ab5141861728980f0bb185b07e5c0952a
refs/heads/master
2023-08-09T20:26:00.986632
2012-04-30T19:38:58
2012-04-30T19:38:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,599
java
/* * JBoss, Home of Professional Open Source * Copyright 2009, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.osgi.framework.service; import org.jboss.osgi.testing.OSGiFrameworkTest; import org.jboss.osgi.spi.OSGiManifestBuilder; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.Asset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.test.osgi.framework.service.support.BrokenServiceFactory; import org.junit.Test; import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkEvent; import org.osgi.framework.ServiceException; import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; import java.io.InputStream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; /** * GetUnGetServiceTest. * * @author <a href="adrian@jboss.com">Adrian Brock</a> * @author <a href="ales.justin@jboss.org">Ales Justin</a> * @author Thomas.Diesler@jboss.com */ public class GetUnGetServiceTestCase extends OSGiFrameworkTest { static String OBJCLASS = BundleContext.class.getName(); @Test public void testGetUnServiceErrors() throws Exception { Bundle bundle = installBundle(getBundleArchiveA()); try { bundle.start(); BundleContext context = bundle.getBundleContext(); assertNotNull(context); context.registerService(OBJCLASS, context, null); try { context.getService(null); fail("Should not be here!"); } catch (IllegalArgumentException t) { // expected } try { context.ungetService(null); fail("Should not be here!"); } catch (IllegalArgumentException t) { // expected } } finally { bundle.uninstall(); } } @Test public void testGetService() throws Exception { Bundle bundle = installBundle(getBundleArchiveA()); try { bundle.start(); BundleContext context = bundle.getBundleContext(); assertNotNull(context); ServiceRegistration sreg = context.registerService(OBJCLASS, context, null); ServiceReference sref = sreg.getReference(); Object actual = context.getService(sref); assertEquals(context, actual); sreg.unregister(); actual = context.getService(sref); assertNull("" + actual, actual); } finally { bundle.uninstall(); } } @Test public void testGetServiceAfterStop() throws Exception { Bundle bundle = installBundle(getBundleArchiveA()); try { bundle.start(); BundleContext context = bundle.getBundleContext(); assertNotNull(context); ServiceRegistration sreg = context.registerService(OBJCLASS, context, null); ServiceReference sref = sreg.getReference(); Object actual = context.getService(sref); assertEquals(context, actual); bundle.stop(); try { context.getService(sref); fail("Should not be here!"); } catch (IllegalStateException t) { // expected } } finally { bundle.uninstall(); } } @Test public void testErrorInGetService() throws Exception { Bundle bundle = installBundle(getBundleArchiveA()); try { bundle.start(); BundleContext context = bundle.getBundleContext(); assertNotNull(context); context.addFrameworkListener(this); ServiceRegistration sreg = context.registerService(OBJCLASS, new BrokenServiceFactory(context, true), null); ServiceReference sref = sreg.getReference(); Object actual = context.getService(sref); assertNull("" + actual, actual); assertFrameworkEvent(FrameworkEvent.ERROR, bundle, ServiceException.class); } finally { bundle.uninstall(); } } @Test public void testErrorInUnGetService() throws Exception { Bundle bundle = installBundle(getBundleArchiveA()); try { bundle.start(); BundleContext context = bundle.getBundleContext(); assertNotNull(context); context.addFrameworkListener(this); ServiceRegistration sreg = context.registerService(OBJCLASS, new BrokenServiceFactory(context, false), null); ServiceReference sref = sreg.getReference(); Object actual = context.getService(sref); assertEquals(context, actual); assertNoFrameworkEvent(); sreg.unregister(); assertFrameworkEvent(FrameworkEvent.WARNING, bundle, ServiceException.class); } finally { bundle.uninstall(); } } @Test public void testUnGetServiceResult() throws Exception { Bundle bundle1 = installBundle(getBundleArchiveA()); try { bundle1.start(); BundleContext context1 = bundle1.getBundleContext(); assertNotNull(context1); ServiceRegistration sreg = context1.registerService(OBJCLASS, context1, null); ServiceReference sref = sreg.getReference(); Object actual = context1.getService(sref); assertEquals(context1, actual); assertTrue(context1.ungetService(sref)); assertFalse(context1.ungetService(sref)); context1.getService(sref); context1.getService(sref); assertTrue(context1.ungetService(sref)); assertTrue(context1.ungetService(sref)); assertFalse(context1.ungetService(sref)); Bundle bundle2 = installBundle(getBundleArchiveB()); try { bundle2.start(); BundleContext context2 = bundle2.getBundleContext(); assertNotNull(context2); context2.getService(sref); context1.getService(sref); assertTrue(context1.ungetService(sref)); assertFalse(context1.ungetService(sref)); assertTrue(context2.ungetService(sref)); assertFalse(context2.ungetService(sref)); } finally { bundle2.uninstall(); } } finally { bundle1.uninstall(); } } @Test public void testUnGetAfterUninstall() throws Exception { Bundle bundle = installBundle(getBundleArchiveA()); bundle.start(); BundleContext context = bundle.getBundleContext(); ServiceRegistration sreg = context.registerService(OBJCLASS, context, null); ServiceReference sref = sreg.getReference(); Object actual = context.getService(sref); assertEquals(context, actual); bundle.uninstall(); try { context.ungetService(sref); fail("IllegalStateException expected"); } catch (IllegalStateException e) { //expected } } private JavaArchive getBundleArchiveA() { final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "simple1"); archive.setManifest(new Asset() { public InputStream openStream() { OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance(); builder.addBundleManifestVersion(2); builder.addBundleSymbolicName(archive.getName()); builder.addImportPackages(BundleActivator.class); return builder.openStream(); } }); return archive; } private JavaArchive getBundleArchiveB() { final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "simple2"); archive.setManifest(new Asset() { public InputStream openStream() { OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance(); builder.addBundleManifestVersion(2); builder.addBundleSymbolicName(archive.getName()); builder.addImportPackages(BundleActivator.class); return builder.openStream(); } }); return archive; } }
[ "thomas.diesler@jboss.com" ]
thomas.diesler@jboss.com
570b4b2fa1238423c94c2da1b1955c2b40d457ac
03eec4940b221bcf437b754524a278f9d6a68a88
/project3/src/main/java/com/example/controller/TestController.java
4487e7eaf8ac32b25ddc4a73ec31415e4ccf01b6
[]
no_license
RookieDe/project
8c43e72e5ffa206acedb35cce301a8023bf2175f
ab432b3b217e200e8a8a9fe6dea40e69bf76eab2
refs/heads/master
2022-06-26T01:47:55.324943
2020-11-12T05:12:13
2020-11-12T05:12:13
191,961,766
2
0
null
2022-06-21T03:10:45
2019-06-14T14:59:00
Java
UTF-8
Java
false
false
899
java
package com.example.controller; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; /** * Shanghai yejia Diaital Technology Co.,Ltd. * * @author chenhongde * @ClassName TestController * @date 2019/9/16 9:38 */ @RestController @RequestMapping("/test") public class TestController { @RequestMapping("/getDate") public String getDate() { return "测试成功"; } @ExceptionHandler public String doError(Exception ex) throws Exception { ex.printStackTrace(); return ex.getMessage(); } }
[ "634105393@qq.com" ]
634105393@qq.com
643411cf0ad43bbc6cd2f031176c7e4fc4489b0b
309298f0e747d6c6b01a36104c41d44eb7cf977f
/SuperLeagueSprint1/src/main/java/com/s1/ms/sprint1/service/InventoryService.java
a9f5eb513fbb14d7fcebfa734901f4c8117abf59
[]
no_license
RagiRaveendran/msbatch3
abad09bf4437fa7a9c0f3c5357c114c6fa6decc1
0f3756d1b1ac943b92f2f0e01fad633895fdd4b2
refs/heads/master
2023-04-10T05:53:29.001182
2021-05-04T04:51:02
2021-05-04T04:51:02
361,638,175
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
package com.s1.ms.sprint1.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.s1.ms.sprint1.h2.model.INVENTORY; import com.s1.ms.sprint1.h2.repository.InventoryRepository; @Service public class InventoryService { @Autowired InventoryRepository inventoryRepo; public void saveInventory(List<INVENTORY> inventoryList) { inventoryRepo.saveAll(inventoryList); } public List<INVENTORY> findAllInventory() { return inventoryRepo.findAll(); } }
[ "38403479+aswinkrishnamohan@users.noreply.github.com" ]
38403479+aswinkrishnamohan@users.noreply.github.com
fe08ff9d10a81565eae47213cc16ce7eeb02cd5b
9cdf4a803b5851915b53edaeead2546f788bddc6
/machinelearning/5.0/drools-compiler/src/main/java/org/drools/lang/descr/FieldBindingDescr.java
c6ea6975debd7624bbd58ff6aafe230f4e7d7383
[ "Apache-2.0" ]
permissive
kiegroup/droolsjbpm-contributed-experiments
8051a70cfa39f18bc3baa12ca819a44cc7146700
6f032d28323beedae711a91f70960bf06ee351e5
refs/heads/master
2023-06-01T06:11:42.641550
2020-07-15T15:09:02
2020-07-15T15:09:02
1,184,582
1
13
null
2021-06-24T08:45:52
2010-12-20T15:42:26
Java
UTF-8
Java
false
false
1,659
java
package org.drools.lang.descr; /* * Copyright 2005 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class FieldBindingDescr extends BaseDescr { /** * */ private static final long serialVersionUID = 400L; private String fieldName; private String identifier; public FieldBindingDescr() { this( null, null ); } public FieldBindingDescr(final String fieldName, final String identifier) { this.fieldName = fieldName; this.identifier = identifier; } public void setFieldName(final String fieldName) { this.fieldName = fieldName; } public void setIdentifier(final String identifier) { this.identifier = identifier; } public String getFieldName() { return this.fieldName; } public String getIdentifier() { return this.identifier; } public String toString() { return "[FieldBinding: field=" + this.fieldName + "; identifier=" + this.identifier + "]"; } }
[ "gizil.oguz@gmail.com" ]
gizil.oguz@gmail.com
3bbdc529c8cd901025ebad1ae6074403e153c490
e57083ea584d69bc9fb1b32f5ec86bdd4fca61c0
/sample-project-5400/src/main/java/com/example/project/sample5400/other/sample2/Other2_207.java
adbbbd5bbbd1b494a09b8f2ab08a60487cbf8c79
[]
no_license
snicoll-scratches/test-spring-components-index
77e0ad58c8646c7eb1d1563bf31f51aa42a0636e
aa48681414a11bb704bdbc8acabe45fa5ef2fd2d
refs/heads/main
2021-06-13T08:46:58.532850
2019-12-09T15:11:10
2019-12-09T15:11:10
65,806,297
5
3
null
null
null
null
UTF-8
Java
false
false
84
java
package com.example.project.sample5400.other.sample2; public class Other2_207 { }
[ "snicoll@pivotal.io" ]
snicoll@pivotal.io
c8ef6cde258a58fdbbbb52b44fd531abc7d0233b
9ff1d5eb7f284985b24f5057ab9b180ba593bb35
/jzab-refactoring-291a9a2e7d4d/src/main/java/com/jzab/refactoring/collection/Company.java
bf573c847e3002852d9a4e03e4e03e5619929fe4
[]
no_license
audray/Refactoring
78da6e46e4d2319cc4099dd1bbba5dad3f9d04c7
3db75b3e8a577bf02d0c1cd34dc233ce616eebd4
refs/heads/master
2021-01-22T21:38:30.303709
2017-03-21T03:05:23
2017-03-21T03:05:23
85,455,926
0
0
null
null
null
null
UTF-8
Java
false
false
560
java
package com.jzab.refactoring.collection; import java.util.ArrayList; import java.util.List; /** * * @author jzab */ class Company { private final List<Employee> employees; private int employeeCount; public Company(){ this.employees = new ArrayList<>(); } public void hire(Employee e){ this.employees.add(e); employeeCount++; } public void fire(Employee e){ this.employees.remove(e); } public int getEmployeeCount(){ return employeeCount; } public List<Employee> getEmployees(){ return employees; } }
[ "arichan.hr16@gmail.com" ]
arichan.hr16@gmail.com
cd739491b3015ebcd7bf26af890aeab1cbaf9215
f6177189645a07a873443401932be4a814b2a905
/zipkin-zookeeper/src/main/java/zipkin/collector/zookeeper/SampleRateUpdater.java
f59732b07cd5b9b29f930a89c7e1435e7b10b63e
[ "Apache-2.0" ]
permissive
ryanrupp/zipkin
0866d031ef9c0e29b1e300dd3f7cb9953a670092
80d336326698b945c226c368fe7c31935403b6ec
refs/heads/master
2021-04-12T03:56:22.812896
2018-03-16T11:17:16
2018-03-16T11:17:16
125,760,844
0
0
Apache-2.0
2018-03-18T19:38:15
2018-03-18T19:38:10
Java
UTF-8
Java
false
false
3,737
java
/** * Copyright 2015-2016 The OpenZipkin 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 zipkin.collector.zookeeper; import com.google.common.collect.ImmutableMap; import java.io.Closeable; import java.io.IOException; import java.util.Map; import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.PathChildrenCache; import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent; import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener; import org.apache.curator.framework.recipes.nodes.GroupMember; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static zipkin.internal.Util.UTF_8; /** * This watches the store rate path for updates. */ final class SampleRateUpdater implements PathChildrenCacheListener, Closeable { final Logger log = LoggerFactory.getLogger(SampleRateUpdater.class); private final GroupMember storeRateMember; private final String sampleRatePath; private final Function<Map<String, Integer>, Optional<Float>> calculator; private final Supplier<Boolean> guard; private final PathChildrenCache dataWatcher; SampleRateUpdater(CuratorFramework client, GroupMember storeRateMember, String storeRatePath, String sampleRatePath, Function<Map<String, Integer>, Optional<Float>> calculator, Supplier<Boolean> guard ) { this.storeRateMember = storeRateMember; this.sampleRatePath = sampleRatePath; this.calculator = calculator; this.guard = guard; // We don't need to cache the data as we can already access it from storeRateMember this.dataWatcher = new PathChildrenCache(client, storeRatePath, false); try { this.dataWatcher.start(); } catch (Exception e) { throw new IllegalStateException(e); } dataWatcher.getListenable().addListener(this); } @Override public void close() throws IOException { dataWatcher.close(); } @Override public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) { switch (event.getType()) { case CHILD_ADDED: case CHILD_UPDATED: case CHILD_REMOVED: break; default: return; } ImmutableMap.Builder<String, Integer> builder = new ImmutableMap.Builder(); for (Map.Entry<String, byte[]> i : storeRateMember.getCurrentMembers().entrySet()) { if (i.getValue() == null) continue; try { builder.put(i.getKey(), Integer.valueOf(new String(i.getValue(), UTF_8))); } catch (NumberFormatException e) { log.debug("malformed data at path {}: {}", i.getKey(), e.getMessage()); } } Optional<Float> newSampleRate = calculator.apply(builder.build()); if (!newSampleRate.isPresent() || !guard.get()) return; Float rate = newSampleRate.get(); log.info("updating sample rate: {} {}", sampleRatePath, rate); try { client.create().creatingParentsIfNeeded() .forPath(sampleRatePath, rate.toString().getBytes(UTF_8)); } catch (Exception e) { log.warn("could not set sample rate to {} for {}", rate, sampleRatePath); } } }
[ "acole@pivotal.io" ]
acole@pivotal.io
0b33ad14b5b174c62e698748f97d15856a2fb7a7
6d152a5bb665c8151c94326c38862f013ca107a6
/src/loops/Years_Allive.java
083112e9e8ad6aa6fdd7cee7995f18882660a83d
[]
no_license
League-Level0-Student/level-0-module-3-jadenfw
e4654d5fb919b2b33b83bf52b4614723d2243486
36228e482e3f04bd37449eca1eab8e6c814501a8
refs/heads/master
2020-05-07T15:50:45.425401
2019-07-18T23:30:06
2019-07-18T23:30:06
180,655,178
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package loops; import javax.swing.JOptionPane; public class Years_Allive { public static void main(String[] args) { String age = JOptionPane.showInputDialog("how old are you"); int year = Integer.parseInt(age); for (int i = 2019; i >= 2019 - year ; i--) { System.out.println(i); } } }
[ "league@WTS9.attlocal.net" ]
league@WTS9.attlocal.net
70eda9e35d6012d2657329210ec3ff815b239ac8
853d08546b2b443232cc8c444d4ca64f63a69a25
/algorithm-implementation/src/main/java/com/mashibing/juc/c_012_Volatile/T01_HelloVolatile.java
6b6883a9f62edc33741f52883dd9221c15fd2bab
[]
no_license
isplendid/AlgorithmsImplementation
530edb163ba2dc6ff67acd4ca1753c3ced019cd9
29afc7825d5bb803ef44cd757733efda391c7fa2
refs/heads/master
2023-08-22T08:27:12.400436
2023-06-10T14:49:48
2023-06-10T14:49:48
167,800,263
2
0
null
2023-08-07T18:01:34
2019-01-27T11:17:27
Java
GB18030
Java
false
false
1,619
java
/** * volatile 关键字,使一个变量在多个线程间可见 * A B线程都用到一个变量,java默认是A线程中保留一份copy,这样如果B线程修改了该变量,则A线程未必知道 * 使用volatile关键字,会让所有线程都会读到变量的修改值 * * 在下面的代码中,running是存在于堆内存的t对象中 * 当线程t1开始运行的时候,会把running值从内存中读到t1线程的工作区,在运行过程中直接使用这个copy,并不会每次都去 * 读取堆内存,这样,当主线程修改running的值之后,t1线程感知不到,所以不会停止运行 * * 使用volatile,将会强制所有线程都去堆内存中读取running的值 * * 可以阅读这篇文章进行更深入的理解 * http://www.cnblogs.com/nexiyi/p/java_memory_model_and_thread.html * * volatile并不能保证多个线程共同修改running变量时所带来的不一致问题,也就是说volatile不能替代synchronized * @author mashibing */ package com.mashibing.juc.c_012_Volatile; import java.util.concurrent.TimeUnit; public class T01_HelloVolatile { /*volatile*/ boolean running = true; //对比一下有无volatile的情况下,整个程序运行结果的区别 void m() { System.out.println("m start"); while(running) { } System.out.println("m end!"); } public static void main(String[] args) { T01_HelloVolatile t = new T01_HelloVolatile(); new Thread(t::m, "t1").start(); try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } t.running = false; } }
[ "hixushichao@163.com" ]
hixushichao@163.com
eac15ac9792fb2e7e90b564a962809b13a093aa9
a33aac97878b2cb15677be26e308cbc46e2862d2
/data/libgdx/btAxisSweep3InternalShort_unQuantize.java
5945d1afdf2f7f40b3b847e3d9ae7cf9b76ec874
[]
no_license
GabeOchieng/ggnn.tensorflow
f5d7d0bca52258336fc12c9de6ae38223f28f786
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
refs/heads/master
2022-05-30T11:17:42.278048
2020-05-02T11:33:31
2020-05-02T11:33:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
public void unQuantize(btBroadphaseProxy proxy, Vector3 aabbMin, Vector3 aabbMax) { CollisionJNI.btAxisSweep3InternalShort_unQuantize(swigCPtr, this, btBroadphaseProxy.getCPtr(proxy), proxy, aabbMin, aabbMax); }
[ "bdqnghi@gmail.com" ]
bdqnghi@gmail.com
6624f90af70c404b06fb571b708ea2d3133eda2a
5f94d15174b067937b7133a12c84ba5e145aa93a
/Cvac/src/main/java/cn/misection/cvac/ast/expr/nonterminal/unary/package-info.java
3033cb5db11444e36fc808c9ddfb546291fe48b8
[ "MIT" ]
permissive
MilitaryIntelligence6/Cva
6516ca266c36b1e4fe6d126189c0ca41b3028148
c66a168b448b4316d09f7a81d152e3c3eede2bd8
refs/heads/master
2023-07-19T01:11:30.110403
2021-09-01T15:37:14
2021-09-01T15:37:14
338,727,422
73
12
null
2021-02-27T13:12:34
2021-02-14T04:19:07
Java
UTF-8
Java
false
false
233
java
/** * @ClassName package-info * @author Military Intelligence 6 root * @version 1.0.0 * @Description 应该用装饰模式最好; * @CreateTime 2021年02月21日 12:42:00 */ package cn.misection.cvac.ast.expr.nonterminal.unary;
[ "hlrongzun@qq.com" ]
hlrongzun@qq.com
0b6504e66469642bec40412a47c1dfe3aa1af584
11596f468e8666675aade26cfcdb6d597e3e0fc3
/gmpp/src/main/java/org/femtoframework/net/message/MessageRegistry.java
e79d500d970329ea84dd5799df10b2f925155c76
[ "Apache-2.0" ]
permissive
femtoframework/femto-net
5830298f580a54ccf2b185d3f48ce9cbcd5f1e0b
59585fdfdee8faf0e8c67b0eacb3831d78010037
refs/heads/master
2020-04-17T20:16:55.815423
2019-11-23T18:50:50
2019-11-23T18:50:50
166,898,702
1
0
null
null
null
null
UTF-8
Java
false
false
1,498
java
package org.femtoframework.net.message; /** * 消息注册登记 * * @author fengyun * @version 1.00 2005-5-7 0:11:46 */ public interface MessageRegistry { /** * 没有该类型 */ public static final int NO_SUCH_TYPE = -1; /** * 根据消息对象返回类型 * * @param message 消息对象 * @return 如果不存在该类型,返回<code>NO_SUCH_TYPE</code> */ public int getType(Object message); /** * 根据消息类型创建一个新的对象 * * @param type 消息类型 * @return 返回对象 */ public Object createMessage(int type); /** * 根据类型返回消息元数据 * * @param type 消息类型 * @return 返回对象 */ public MessageMetadata getMetadata(int type); /** * 根据消息返回消息元数据 * * @param message 消息 * @return 返回对象 */ public MessageMetadata getMetadata(Object message); /** * 添加消息元数据 * * @param metadata 消息元数据 */ public void addMetadata(MessageMetadata metadata); /** * 删除消息元数据 * * @param type 消息类型 * @return 删除的消息元数据 */ public MessageMetadata removeMetadata(int type); /** * 删除消息元数据 * * @param clazz 消息类 * @return 删除的消息元数据 */ public MessageMetadata removeMetadata(Class clazz); }
[ "shaoxt@gmail.com" ]
shaoxt@gmail.com
97b4a42cff0512051bae7644de47d238877a4b8d
5239f26e431420e9a81bbcd5aabcb364602fd5b6
/src/main/java/PersistantTree.java
fa61b253b7b803c3cadef19a752b1bcdd125067f
[]
no_license
USquare14/DSA-Java
c7242f7b5edf941e74147a1bc7b4a31f5cee9fbb
d535f4c46d3b94ae5de661fd50ca664002ecc9d3
refs/heads/master
2023-03-07T18:08:18.286590
2021-02-27T06:24:20
2021-02-27T06:24:20
290,844,292
0
0
null
null
null
null
UTF-8
Java
false
false
1,494
java
/** * @author umangupadhyay */ //Codeforces D840 class PersistantTree { static class Node { Node left, right; int sum; Node(int value) { this.sum = value; } Node(Node left, Node right) { this.left = left; this.right = right; if (left != null) { sum += left.sum; } if (right != null) { sum += right.sum; } } } static Node build(int left, int right) { if (left == right) { return new Node(0); } return new Node(build(left, (left + right) / 2), build((left + right) / 2 + 1, right)); } static int sum(int a, int b, Node root, int left, int right) { if (a > right || b < left) { return 0; } if (a <= left && right <= b) { return root.sum; } return sum(a, b, root.left, left, (left + right) / 2) + sum(a, b, root.right, (left + right) / 2 + 1, right); } static Node set(int pos, int value, Node root, int left, int right) { if (left == right) { return new Node(value); } int mid = (left + right) / 2; if (pos <= mid) { return new Node(set(pos, value, root.left, left, mid), root.right); } else { return new Node(root.left, set(pos, value, root.right, mid + 1, right)); } } }
[ "umang.upadhyay@sprinklr.com" ]
umang.upadhyay@sprinklr.com
f5eec91235178b30293ce3b00be731e865eafc93
dbabd3f6c102034a94db44b4c12b1becb389a661
/kettleWithIndex/engine/org/pentaho/di/trans/steps/accessoutput/AccessOutputMeta.java
5db5ebb191f0d125f31cd14d207b635d3f591700
[ "Apache-2.0" ]
permissive
tengfeipu/tools4fun
e440308bc1211389b7bc246da5fecfc950c9ca12
9b39470ed6e48e0434a797bdd0a2da0a74679ab6
refs/heads/master
2023-05-12T03:38:01.178762
2021-05-21T14:09:49
2021-05-21T14:09:49
287,212,492
3
0
null
null
null
null
UTF-8
Java
false
false
22,119
java
/*! ****************************************************************************** * * Pentaho Data Integration * * Copyright (C) 2002-2016 by Pentaho : http://www.pentaho.com * ******************************************************************************* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ package org.pentaho.di.trans.steps.accessoutput; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettlePluginException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.exception.KettleValueException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.row.value.ValueMetaFactory; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.repository.ObjectId; import org.pentaho.di.repository.Repository; import org.pentaho.di.resource.ResourceDefinition; import org.pentaho.di.resource.ResourceNamingInterface; import org.pentaho.di.trans.Trans; import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.step.BaseStepMeta; import org.pentaho.di.trans.step.StepDataInterface; import org.pentaho.di.trans.step.StepInterface; import org.pentaho.di.trans.step.StepMeta; import org.pentaho.di.trans.step.StepMetaInterface; import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import com.healthmarketscience.jackcess.Column; import com.healthmarketscience.jackcess.DataType; import com.healthmarketscience.jackcess.Database; import com.healthmarketscience.jackcess.Table; /* * Created on 2-jun-2003 * */ public class AccessOutputMeta extends BaseStepMeta implements StepMetaInterface { private static Class<?> PKG = AccessOutputMeta.class; // for i18n purposes, needed by Translator2!! private String filename; private boolean fileCreated; private String tablename; private boolean tableCreated; private boolean tableTruncated; private int commitSize; /** Flag: add the filenames to result filenames */ private boolean addToResultFilenames; /** Flag : Do not open new file when transformation start */ private boolean doNotOpeNnewFileInit; public AccessOutputMeta() { super(); // allocate BaseStepMeta } public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode, databases ); } public Object clone() { AccessOutputMeta retval = (AccessOutputMeta) super.clone(); return retval; } /** * @return Returns the tablename. */ public String getTablename() { return tablename; } /** * @param tablename * The tablename to set. */ public void setTablename( String tablename ) { this.tablename = tablename; } /** * @return Returns the truncate table flag. */ public boolean truncateTable() { return tableTruncated; } /** * @param truncateTable * The truncate table flag to set. */ public void setTableTruncated( boolean truncateTable ) { this.tableTruncated = truncateTable; } private void readData( Node stepnode, List<DatabaseMeta> databases ) throws KettleXMLException { try { filename = XMLHandler.getTagValue( stepnode, "filename" ); tablename = XMLHandler.getTagValue( stepnode, "table" ); tableTruncated = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "truncate" ) ); fileCreated = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "create_file" ) ); tableCreated = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "create_table" ) ); commitSize = Const.toInt( XMLHandler.getTagValue( stepnode, "commit_size" ), AccessOutput.COMMIT_SIZE ); String addToResultFiles = XMLHandler.getTagValue( stepnode, "add_to_result_filenames" ); if ( Utils.isEmpty( addToResultFiles ) ) { addToResultFilenames = true; } else { addToResultFilenames = "Y".equalsIgnoreCase( addToResultFiles ); } doNotOpeNnewFileInit = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "do_not_open_newfile_init" ) ); } catch ( Exception e ) { throw new KettleXMLException( "Unable to load step info from XML", e ); } } public void setDefault() { fileCreated = true; tableCreated = true; tableTruncated = false; commitSize = AccessOutput.COMMIT_SIZE; doNotOpeNnewFileInit = false; addToResultFilenames = true; } public String getXML() { StringBuilder retval = new StringBuilder( 300 ); retval.append( " " ).append( XMLHandler.addTagValue( "filename", filename ) ); retval.append( " " ).append( XMLHandler.addTagValue( "table", tablename ) ); retval.append( " " ).append( XMLHandler.addTagValue( "truncate", tableTruncated ) ); retval.append( " " ).append( XMLHandler.addTagValue( "create_file", fileCreated ) ); retval.append( " " ).append( XMLHandler.addTagValue( "create_table", tableCreated ) ); retval.append( " " ).append( XMLHandler.addTagValue( "commit_size", commitSize ) ); retval.append( " " ).append( XMLHandler.addTagValue( "add_to_result_filenames", addToResultFilenames ) ); retval.append( " " ).append( XMLHandler.addTagValue( "do_not_open_newfile_init", doNotOpeNnewFileInit ) ); return retval.toString(); } public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { filename = rep.getStepAttributeString( id_step, "filename" ); tablename = rep.getStepAttributeString( id_step, "table" ); tableTruncated = rep.getStepAttributeBoolean( id_step, "truncate" ); fileCreated = rep.getStepAttributeBoolean( id_step, "create_file" ); tableCreated = rep.getStepAttributeBoolean( id_step, "create_table" ); commitSize = (int) rep.getStepAttributeInteger( id_step, "commit_size" ); String addToResultFiles = rep.getStepAttributeString( id_step, "add_to_result_filenames" ); if ( Utils.isEmpty( addToResultFiles ) ) { addToResultFilenames = true; } else { addToResultFilenames = rep.getStepAttributeBoolean( id_step, "add_to_result_filenames" ); } doNotOpeNnewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_newfile_init" ); } catch ( Exception e ) { throw new KettleException( "Unexpected error reading step information from the repository", e ); } } public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveStepAttribute( id_transformation, id_step, "filename", filename ); rep.saveStepAttribute( id_transformation, id_step, "table", tablename ); rep.saveStepAttribute( id_transformation, id_step, "truncate", tableTruncated ); rep.saveStepAttribute( id_transformation, id_step, "create_file", fileCreated ); rep.saveStepAttribute( id_transformation, id_step, "create_table", tableCreated ); rep.saveStepAttribute( id_transformation, id_step, "commit_size", commitSize ); rep.saveStepAttribute( id_transformation, id_step, "add_to_result_filenames", addToResultFilenames ); rep.saveStepAttribute( id_transformation, id_step, "do_not_open_newfile_init", doNotOpeNnewFileInit ); } catch ( Exception e ) { throw new KettleException( "Unable to save step information to the repository for id_step=" + id_step, e ); } } public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { // TODO: add file checking in case we don't create a table. // See if we have input streams leading to this step! if ( input.length > 0 ) { CheckResult cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "AccessOutputMeta.CheckResult.ExpectedInputOk" ), stepMeta ); remarks.add( cr ); } else { CheckResult cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "AccessOutputMeta.CheckResult.ExpectedInputError" ), stepMeta ); remarks.add( cr ); } } public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ) { return new AccessOutput( stepMeta, stepDataInterface, cnr, transMeta, trans ); } public StepDataInterface getStepData() { return new AccessOutputData(); } public RowMetaInterface getRequiredFields( VariableSpace space ) throws KettleException { String realFilename = space.environmentSubstitute( filename ); File file = new File( realFilename ); Database db = null; try { if ( !file.exists() || !file.isFile() ) { throw new KettleException( BaseMessages.getString( PKG, "AccessOutputMeta.Exception.FileDoesNotExist", realFilename ) ); } // open the database and get the table db = Database.open( file ); String realTablename = space.environmentSubstitute( tablename ); Table table = db.getTable( realTablename ); if ( table == null ) { throw new KettleException( BaseMessages.getString( PKG, "AccessOutputMeta.Exception.TableDoesNotExist", realTablename ) ); } RowMetaInterface layout = getLayout( table ); return layout; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "AccessOutputMeta.Exception.ErrorGettingFields" ), e ); } finally { try { if ( db != null ) { db.close(); } } catch ( IOException e ) { throw new KettleException( BaseMessages.getString( PKG, "AccessOutputMeta.Exception.ErrorClosingDatabase" ), e ); } } } public static final RowMetaInterface getLayout( Table table ) throws SQLException, KettleStepException { RowMetaInterface row = new RowMeta(); List<Column> columns = table.getColumns(); for ( int i = 0; i < columns.size(); i++ ) { Column column = columns.get( i ); int valtype = ValueMetaInterface.TYPE_STRING; int length = -1; int precision = -1; int type = column.getType().getSQLType(); switch ( type ) { case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: // Character Large Object valtype = ValueMetaInterface.TYPE_STRING; length = column.getLength(); break; case java.sql.Types.CLOB: valtype = ValueMetaInterface.TYPE_STRING; length = DatabaseMeta.CLOB_LENGTH; break; case java.sql.Types.BIGINT: valtype = ValueMetaInterface.TYPE_INTEGER; precision = 0; // Max 9.223.372.036.854.775.807 length = 15; break; case java.sql.Types.INTEGER: valtype = ValueMetaInterface.TYPE_INTEGER; precision = 0; // Max 2.147.483.647 length = 9; break; case java.sql.Types.SMALLINT: valtype = ValueMetaInterface.TYPE_INTEGER; precision = 0; // Max 32.767 length = 4; break; case java.sql.Types.TINYINT: valtype = ValueMetaInterface.TYPE_INTEGER; precision = 0; // Max 127 length = 2; break; case java.sql.Types.DECIMAL: case java.sql.Types.DOUBLE: case java.sql.Types.FLOAT: case java.sql.Types.REAL: case java.sql.Types.NUMERIC: valtype = ValueMetaInterface.TYPE_NUMBER; length = column.getLength(); precision = column.getPrecision(); if ( length >= 126 ) { length = -1; } if ( precision >= 126 ) { precision = -1; } if ( type == java.sql.Types.DOUBLE || type == java.sql.Types.FLOAT || type == java.sql.Types.REAL ) { if ( precision == 0 ) { precision = -1; // precision is obviously incorrect if the type if Double/Float/Real } } else { if ( precision == 0 && length < 18 && length > 0 ) { // Among others Oracle is affected here. valtype = ValueMetaInterface.TYPE_INTEGER; } } if ( length > 18 || precision > 18 ) { valtype = ValueMetaInterface.TYPE_BIGNUMBER; } break; case java.sql.Types.DATE: case java.sql.Types.TIME: case java.sql.Types.TIMESTAMP: valtype = ValueMetaInterface.TYPE_DATE; break; case java.sql.Types.BOOLEAN: case java.sql.Types.BIT: valtype = ValueMetaInterface.TYPE_BOOLEAN; break; case java.sql.Types.BINARY: case java.sql.Types.BLOB: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: valtype = ValueMetaInterface.TYPE_BINARY; break; default: valtype = ValueMetaInterface.TYPE_STRING; length = column.getLength(); break; } ValueMetaInterface v; try { v = ValueMetaFactory.createValueMeta( column.getName(), valtype ); } catch ( KettlePluginException e ) { throw new KettleStepException( e ); } v.setLength( length, precision ); row.addValueMeta( v ); } return row; } public static final List<Column> getColumns( RowMetaInterface row ) { List<Column> list = new ArrayList<Column>(); for ( int i = 0; i < row.size(); i++ ) { ValueMetaInterface value = row.getValueMeta( i ); Column column = new Column(); column.setName( value.getName() ); int length = value.getLength(); switch ( value.getType() ) { case ValueMetaInterface.TYPE_INTEGER: if ( length < 3 ) { column.setType( DataType.BYTE ); length = DataType.BYTE.getFixedSize(); } else { if ( length < 5 ) { column.setType( DataType.INT ); length = DataType.INT.getFixedSize(); } else { column.setType( DataType.LONG ); length = DataType.LONG.getFixedSize(); } } break; case ValueMetaInterface.TYPE_NUMBER: column.setType( DataType.DOUBLE ); length = DataType.DOUBLE.getFixedSize(); break; case ValueMetaInterface.TYPE_DATE: column.setType( DataType.SHORT_DATE_TIME ); length = DataType.SHORT_DATE_TIME.getFixedSize(); break; case ValueMetaInterface.TYPE_STRING: if ( length < 255 ) { column.setType( DataType.TEXT ); length *= DataType.TEXT.getUnitSize(); } else { column.setType( DataType.MEMO ); length *= DataType.MEMO.getUnitSize(); } break; case ValueMetaInterface.TYPE_BINARY: column.setType( DataType.BINARY ); break; case ValueMetaInterface.TYPE_BOOLEAN: column.setType( DataType.BOOLEAN ); length = DataType.BOOLEAN.getFixedSize(); break; case ValueMetaInterface.TYPE_BIGNUMBER: column.setType( DataType.NUMERIC ); length = DataType.NUMERIC.getFixedSize(); break; default: break; } if ( length >= 0 ) { column.setLength( (short) length ); } if ( value.getPrecision() >= 1 && value.getPrecision() <= 28 ) { column.setPrecision( (byte) value.getPrecision() ); } list.add( column ); } return list; } public static Object[] createObjectsForRow( RowMetaInterface rowMeta, Object[] rowData ) throws KettleValueException { Object[] values = new Object[rowMeta.size()]; for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface valueMeta = rowMeta.getValueMeta( i ); Object valueData = rowData[i]; // Prevent a NullPointerException below if ( valueData == null || valueMeta == null ) { values[i] = null; continue; } int length = valueMeta.getLength(); switch ( valueMeta.getType() ) { case ValueMetaInterface.TYPE_INTEGER: if ( length < 3 ) { values[i] = new Byte( valueMeta.getInteger( valueData ).byteValue() ); } else { if ( length < 5 ) { values[i] = new Short( valueMeta.getInteger( valueData ).shortValue() ); } else { values[i] = valueMeta.getInteger( valueData ); } } break; case ValueMetaInterface.TYPE_NUMBER: values[i] = valueMeta.getNumber( valueData ); break; case ValueMetaInterface.TYPE_DATE: values[i] = valueMeta.getDate( valueData ); break; case ValueMetaInterface.TYPE_STRING: values[i] = valueMeta.getString( valueData ); break; case ValueMetaInterface.TYPE_BINARY: values[i] = valueMeta.getBinary( valueData ); break; case ValueMetaInterface.TYPE_BOOLEAN: values[i] = valueMeta.getBoolean( valueData ); break; case ValueMetaInterface.TYPE_BIGNUMBER: values[i] = valueMeta.getNumber( valueData ); break; default: break; } } return values; } /** * @return the fileCreated */ public boolean isFileCreated() { return fileCreated; } /** * @param fileCreated * the fileCreated to set */ public void setFileCreated( boolean fileCreated ) { this.fileCreated = fileCreated; } /** * @return the filename */ public String getFilename() { return filename; } /** * @param filename * the filename to set */ public void setFilename( String filename ) { this.filename = filename; } /** * @return the tableCreated */ public boolean isTableCreated() { return tableCreated; } /** * @param tableCreated * the tableCreated to set */ public void setTableCreated( boolean tableCreated ) { this.tableCreated = tableCreated; } /** * @return the tableTruncated */ public boolean isTableTruncated() { return tableTruncated; } /** * @return the commitSize */ public int getCommitSize() { return commitSize; } /** * @param commitSize * the commitSize to set */ public void setCommitSize( int commitSize ) { this.commitSize = commitSize; } /** * @return Returns the add to result filesname. */ public boolean isAddToResultFiles() { return addToResultFilenames; } /** * @param addtoresultfilenamesin * The addtoresultfilenames to set. */ public void setAddToResultFiles( boolean addtoresultfilenamesin ) { this.addToResultFilenames = addtoresultfilenamesin; } /** * @return Returns the "do not open new file init" flag */ public boolean isDoNotOpenNewFileInit() { return doNotOpeNnewFileInit; } /** * @param doNotOpenNewFileInit * The "do not open new file init" flag to set. */ public void setDoNotOpenNewFileInit( boolean doNotOpenNewFileInit ) { this.doNotOpeNnewFileInit = doNotOpenNewFileInit; } public String[] getUsedLibraries() { return new String[] { "jackcess-1.1.13.jar", "commons-collections-3.1.jar", "commons-logging.jar", "commons-lang-2.2.jar", "commons-dbcp-1.2.1.jar", "commons-pool-1.3.jar", }; } /** * @param space * the variable space to use * @param definitions * @param resourceNamingInterface * @param repository * The repository to optionally load other resources from (to be converted to XML) * @param metaStore * the metaStore in which non-kettle metadata could reside. * * @return the filename of the exported resource */ public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... // if ( !Utils.isEmpty( filename ) ) { FileObject fileObject = KettleVFS.getFileObject( space.environmentSubstitute( filename ), space ); filename = resourceNamingInterface.nameResource( fileObject, space, true ); } return null; } catch ( Exception e ) { throw new KettleException( e ); } } }
[ "tengfeipu@outlook.com" ]
tengfeipu@outlook.com
4eea191973d274b35bd434d0636e8f55aa7f5d1b
a6fc73a492be1bf1e1183f017592da326d1ac4ec
/src/main/java/com/daycaptain/systemtest/backend/entity/Project.java
0d8488876a738d74fb4f2d271d32477213f2ef10
[ "Apache-2.0" ]
permissive
CodingSpiderFox/daycaptain-systemtest
28c3f821842ea063eeb73b009c105af038caa8bc
f5c5fc2aa285665bbeaa0c97634b5436b31575fe
refs/heads/main
2023-05-29T06:16:06.196793
2021-06-08T07:20:43
2021-06-08T07:20:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package com.daycaptain.systemtest.backend.entity; import java.net.URI; public class Project { public String string; public String note; public String area; public boolean archived; public URI _self; }
[ "git@sebastian-daschner.de" ]
git@sebastian-daschner.de
24b58bb4d4e1f183263f8e827766507ceeaf0860
773735dca0f12f2e2eb13c62a9659b316bdf1173
/src/java/ticket/com/launch/implDao/LaunchAvailableSeatOnSearchImplDao.java
e72e2b0201dd4074a9e93207c5763acc16b234b1
[]
no_license
rashed21/etickit
5e9f184c26e4ae092d092e58a4e7d73fa28fa934
6a021a153eedf366e7144ae14dfa543b2800ab81
refs/heads/master
2021-01-10T05:00:14.879116
2015-10-11T18:02:05
2015-10-11T18:02:05
43,544,255
0
0
null
null
null
null
UTF-8
Java
false
false
3,531
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 ticket.com.launch.implDao; import java.sql.ResultSet; import java.sql.Statement; import java.sql.Time; import java.util.ArrayList; import java.util.List; import ticket.com.connection.DBConnectionHandler; import ticket.com.launch.pojo.LaunchAvailableSeatOnSearch; import ticket.com.launch.pojo.Launch_TimeSchedule; /** * * @author Emrul */ public class LaunchAvailableSeatOnSearchImplDao { public List<LaunchAvailableSeatOnSearch> getAllLaunchTimeSheduleOnSearchList(Launch_TimeSchedule obj) { List<LaunchAvailableSeatOnSearch> list = new ArrayList<LaunchAvailableSeatOnSearch>(); String sql = "SELECT launch_info.launch_name,\n" + " launch_time_schedule.dept_time,\n" + " launch_time_schedule.arriv_time,\n" + " launch_time_schedule.depart_from,\n" + " launch_time_schedule.arrive_to,\n" + " launch_available_seat.availableSeat,\n" + " launch_available_seat.seat_names,\n" + " launch_available_seat.per_seat_fair,\n" + " seat_catagory.cata_name,\n" + " seat_type.type_name,\n" + " launch_available_seat.lau_ava_seat_id,\n" + " launch_time_schedule.launch_time_id\n" + " FROM (((ticket.launch_available_seat launch_available_seat\n" + " INNER JOIN ticket.seat_type seat_type\n" + " ON (launch_available_seat.seat_type_id = seat_type.seat_type_id))\n" + " INNER JOIN ticket.launch_time_schedule launch_time_schedule\n" + " ON (launch_available_seat.launch_time_id =\n" + " launch_time_schedule.launch_time_id))\n" + " INNER JOIN ticket.launch_info launch_info\n" + " ON (launch_time_schedule.launch_id = launch_info.launch_id))\n" + " INNER JOIN ticket.seat_catagory seat_catagory\n" + " ON (launch_available_seat.cata_id = seat_catagory.cata_id)\n" + " WHERE (launch_time_schedule.launch_time_id = '" + obj.getLaunchTimeId() + "');"; try { Statement st = DBConnectionHandler.getConnection().createStatement(); ResultSet rs = st.executeQuery(sql); while (rs.next()) { LaunchAvailableSeatOnSearch ru = new LaunchAvailableSeatOnSearch(); ru.setLaunchName(rs.getString("launch_name")); ru.setDepartFrom(rs.getString("depart_from")); ru.setDeptTime((Time) rs.getTime("dept_time")); ru.setArrivTime((Time) rs.getTime("arriv_time")); ru.setArriveTo(rs.getString("arrive_to")); ru.setAvailableSeat(rs.getInt("availableSeat")); ru.setSeatCataName(rs.getString("cata_name")); ru.setTypeName(rs.getString("type_name")); ru.setSeatName(rs.getString("seat_names")); ru.setFair(rs.getDouble("per_seat_fair")); ru.setLau_ava_seatID(rs.getInt("lau_ava_seat_id")); list.add(ru); } } catch (Exception e) { } return list; } }
[ "rashedunnabi21@gmail.com" ]
rashedunnabi21@gmail.com
a10121fbcd2b13e03704ddf880dd3570e0bab715
d80b911571966894845c12265a7bd333fc7b09d3
/core/src/main/java/com/loop54/model/response/GetRelatedEntitiesResponse.java
e14042e062fd6a86c2c7a3d252603c9e8a1cb33b
[ "BSD-3-Clause" ]
permissive
LoopFiftyFour/Java-Connector
d2ac636cbc623db02e17e21fdbeed8191cc9caf1
5db08602ce55d3775388aef9017519bc62194056
refs/heads/master
2023-02-08T15:00:14.404880
2023-01-27T13:03:47
2023-01-27T13:03:47
141,687,325
1
1
BSD-3-Clause
2023-01-27T13:03:48
2018-07-20T08:45:13
Java
UTF-8
Java
false
false
265
java
package com.loop54.model.response; /** The result of a getRelatedEntities request. */ public class GetRelatedEntitiesResponse extends Response { /** The entities that are related to the entity supplied in the request. */ public EntityCollection results; }
[ "joakim@loop54.com" ]
joakim@loop54.com
dc1b7e898634de053c0a696908b29374f3586b26
5ca02abcbdeab8ccf43c77c91d84ebb359ec0431
/src/main/java/com/aps/monitor/service/IHbTypeConfigService.java
f455c12936545c3ff8fbbed088042965c176a076
[]
no_license
appleshow/monitor
4ae0632d2fe4c7df6cae200384db45a1bdd29176
2cb8bc6265ca8caf4ab283c55e4050c0e3b9d1e5
refs/heads/master
2020-05-21T14:14:33.145556
2017-10-10T14:23:42
2017-10-10T14:23:42
54,189,607
2
0
null
null
null
null
UTF-8
Java
false
false
449
java
package com.aps.monitor.service; import javax.servlet.http.HttpSession; import com.aps.monitor.comm.RequestMdyPar; import com.aps.monitor.comm.RequestRefPar; import com.aps.monitor.comm.ResponseData; public interface IHbTypeConfigService { void referHbType(HttpSession httpSession, RequestRefPar requestRefPar, ResponseData responseData); void modifyHbType(HttpSession httpSession, RequestMdyPar requestMdyPar, ResponseData responseData); }
[ "appleshow@hotmail.com" ]
appleshow@hotmail.com
6abbee3e552e3c9c73b9fa84bc039c73cdc0f73c
9d0ff754c58c190828214f51ceebdd82c207f872
/src/main/java/com/demo/web/bundle/universe/model/service/impl/ConstellationServiceImpl.java
1bff53b3531cc8c61420db5001a74b7bd3fd77a3
[]
no_license
huskyui/eve
aa3aab6f15f79153f2541d9ce300e715999d9caa
68fe16f59b3a8a30566523f8f16c8e2758c83b7d
refs/heads/master
2022-12-03T15:18:38.745911
2020-08-15T08:24:34
2020-08-15T08:24:34
287,421,059
0
0
null
2020-08-14T02:04:47
2020-08-14T02:04:47
null
UTF-8
Java
false
false
819
java
package com.demo.web.bundle.universe.model.service.impl; import com.demo.web.bundle.universe.entity.Constellation; import com.demo.web.bundle.universe.model.dao.ConstellationDao; import com.demo.web.bundle.universe.model.service.ConstellationService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * (Constellation)表服务实现类 * * @author makejava * @since 2020-06-03 15:45:54 */ @Service("constellationsService") public class ConstellationServiceImpl implements ConstellationService { @Resource private ConstellationDao dao; @Override public void save(Constellation constellation) { dao.save(constellation); } @Override public List<Constellation> findAll() { return dao.findAll(); } }
[ "376195987@qq.com" ]
376195987@qq.com
0dd55e5f09eabba6dee0af5026b8e043e714728e
3a20b07e2f1e148a14782d412d5e05ec82ff209e
/GroupeG/trunk/src/main/java/alma/atarigo/ia/AbstractAlgorithm.java
b20abf6fff0e9bdd4e5444304279fc1cc0b22df3
[]
no_license
sunye/alma-go
5683c2cd998112fd2cbadc2b17679adce041832e
8cffdc3f89f1a4c103b175a58c9b26c41d7e7bb9
refs/heads/master
2021-05-25T11:47:26.523567
2020-10-14T12:29:05
2020-10-14T12:29:05
32,451,651
0
0
null
2020-10-14T12:29:07
2015-03-18T10:12:34
HTML
UTF-8
Java
false
false
5,191
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package alma.atarigo.ia; import java.util.ArrayList; import java.util.Collections; import java.util.List; import alma.atarigo.CaptureException; import alma.atarigo.CellContent; import alma.atarigo.CellEvent; import alma.atarigo.CellPosition; import alma.atarigo.GobanModel; import alma.atarigo.Rule; import alma.atarigo.RuleViolationException; import alma.atarigo.ia.valuation.Valuation; import alma.atarigo.rule.Rules; import alma.atarigo.rule.Suicide; /** * * @author gass-mouy */ public abstract class AbstractAlgorithm implements Algorithm{ protected GobanModel goban; protected int height; protected CellContent content; protected Valuation valuation; protected int UP_LIMIT = 10000; protected int DOWN_LIMIT = -10000; /** * Creation d'un goban artificiel en mémoire * @param parent : lien vers son parent * @param position : la position simulée * @param content : le content du simuleur * @return : une nouvelle instance en mémoire */ static public ArtificialGoban makeArtificialGoban(GobanModel parent ,CellPosition position ,CellContent content){ return new ArtificialGoban(parent,position,content); } /** * Creation d'une paire <valeur,position> * @param value : la valeur * @param position : la position * @return : la paire */ static public Pair<Long,CellPosition> makePair(long value, CellPosition position){ return new Pair<Long,CellPosition>(value,position); } /** * Test de violation de règle * @param goban * @throws RuleViolationException * @throws CaptureException */ public static void checkRules(final GobanModel goban) throws RuleViolationException,CaptureException{ for(Rule rule : Rules.IA_RULES){ rule.check(goban); } } /** * Calcul du nombre de noeud à traverser par l'algorithme * s'il parcourait tout l'arbre de recherche * @param x Le nombre de possibilité initial * @param depth La profondeur de l'arbre de recherche * @return */ public static long akira(long x, long depth){ long akira=1; if(depth!=0){ long nawak=1; for(long i=1 ; i<=depth ; ++i){ for(long j=i ; j<=depth ; ++j){ nawak *= (x-j+i); } akira += nawak; nawak=1; } } return akira; } /** * Calculer la liste des possibilités de jeu pour un contenu à partir d'un état de jeu * @param model L'état de jeu * @param content Le contenu * @return une liste de <code> CellPosition </code> */ public static List<CellPosition> getChildrenFor(GobanModel model,final CellContent content){ List<CellPosition> result; if(content.isKuro()){ result = model.getPositionsFor(CellContent.Empty,CellContent.ShiroSuicide); }else if(content.isShiro()){ result = model.getPositionsFor(CellContent.Empty,CellContent.KuroSuicide); }else{ return Collections.emptyList(); } List<CellPosition> fakes = new ArrayList<CellPosition>(); for(CellPosition cell : result){ CellEvent event = makeEvent(cell,content); try{ Suicide.RULE.check(model,event); }catch(RuleViolationException e){ fakes.add(cell); } catch (CaptureException e) { } } result.removeAll(fakes); Collections.shuffle(result); return result; } /** * Construire un evenement * @param p * @param c * @return */ public static CellEvent makeEvent(final CellPosition p,final CellContent c){ return new CellEvent() { @Override public CellPosition getPosition() { return p; } @Override public CellContent getContent() { return c; } }; } /* (non-Javadoc) * @see alma.atarigo.ia.Algorithm#setAll(alma.atarigo.GobanModel, alma.atarigo.CellContent, int) */ public void setAll(GobanModel goban, CellContent content, int height){ this.goban = goban; this.content = content; this.height = height; } /* (non-Javadoc) * @see alma.atarigo.ia.Algorithm#setContent(alma.atarigo.CellContent) */ public void setContent(CellContent content){ this.content = content; } /* (non-Javadoc) * @see alma.atarigo.ia.Algorithm#setDepth(int) */ public void setDepth(int height){ this.height = height; } /* (non-Javadoc) * @see alma.atarigo.ia.Algorithm#setGoban(alma.atarigo.GobanModel) */ public void setGoban(GobanModel goban){ this.goban = goban; } /* (non-Javadoc) * @see alma.atarigo.ia.Algorithm#setValuation(alma.atarigo.ia.valuation.Valuation) */ public void setValuation(Valuation valuation){ this.valuation = valuation; } /* (non-Javadoc) * @see alma.atarigo.ia.Algorithm#getValuation() */ public Valuation getValuation(){ return valuation; } }
[ "rvesteg@fe6e65f2-260b-11df-8e73-9931e1e0996c" ]
rvesteg@fe6e65f2-260b-11df-8e73-9931e1e0996c
78314c4808c1d261d9f9e16b645128ecd4bed13d
8e6c49bc430e5ee6fd4dfcf63b523240428c8a47
/app/src/main/java/com/rocio/poma/practica7_bottomnavigation/FragmentInicio.java
7cddeecfeaaf6d8f55343e55688e42ee0eb11949
[]
no_license
RocioPomaSilvestre/Practica7_BottomNavigation
6dc920358c7b7afb76c61de3d7b3ae4eea37f505
457ded2353d7de269f0565a2b56e0f541159bbcc
refs/heads/master
2023-06-03T03:48:32.921169
2021-03-15T13:45:00
2021-03-15T13:45:00
379,088,257
0
0
null
null
null
null
UTF-8
Java
false
false
2,060
java
package com.rocio.poma.practica7_bottomnavigation; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * A simple {@link Fragment} subclass. * Use the {@link FragmentInicio#newInstance} factory method to * create an instance of this fragment. */ public class FragmentInicio extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public FragmentInicio() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment FragmentInicio. */ // TODO: Rename and change types and number of parameters public static FragmentInicio newInstance(String param1, String param2) { FragmentInicio fragment = new FragmentInicio(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_inicio, container, false); } }
[ "pomarocio07@gmail.com" ]
pomarocio07@gmail.com
12a60a4fbd3f3c07d0b440b797cd51b2a72ac449
f52981eb9dd91030872b2b99c694ca73fb2b46a8
/Source/Plugins/Core/com.equella.core/src/com/tle/core/lti/consumers/dao/LtiConsumerDao.java
6d702fc3dc8c442870d3cdc1f7222ce96d0c7412
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LGPL-2.1-only", "LicenseRef-scancode-jdom", "GPL-1.0-or-later", "ICU", "CDDL-1.0", "LGPL-3.0-only", "LicenseRef-scancode-other-permissive", "CPL-1.0", "MIT", "GPL-2.0-only", "Apache-2.0", "NetCDF", "Apache-1.1", "EPL-1.0", "Classpath-exception-2....
permissive
phette23/Equella
baa41291b91d666bf169bf888ad7e9f0b0db9fdb
56c0d63cc1701a8a53434858a79d258605834e07
refs/heads/master
2020-04-19T20:55:13.609264
2019-01-29T03:27:40
2019-01-29T22:31:24
168,427,559
0
0
Apache-2.0
2019-01-30T22:49:08
2019-01-30T22:49:08
null
UTF-8
Java
false
false
866
java
/* * Copyright 2017 Apereo * * 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.tle.core.lti.consumers.dao; import com.tle.common.lti.consumers.entity.LtiConsumer; import com.tle.core.entity.dao.AbstractEntityDao; public interface LtiConsumerDao extends AbstractEntityDao<LtiConsumer> { LtiConsumer findByConsumerKey(String consumerKey); }
[ "doolse@gmail.com" ]
doolse@gmail.com
7cc0dd08c2162ac5d484279b0a1b171716c3782e
8a5124e81f56737dcf737663b42c7fdc39be53b5
/common/src/com/surelogic/common/export/ExportFactory.java
eaf7a0b9aafcb82461a9065282f637197c906e52
[]
no_license
surelogic/common
f3b985a55977468450dbb592858a7ad1d3a7d871
fb903329b716908c0c73d4802fc784b97ac0b1b1
refs/heads/master
2021-04-30T23:20:13.248863
2017-05-29T21:06:04
2017-05-29T21:06:04
50,686,859
0
1
null
null
null
null
UTF-8
Java
false
false
406
java
package com.surelogic.common.export; import java.io.File; public final class ExportFactory { public static ITableExporter asCSV(ExportTableDataSource from, File to) { return new CSVTableExporter(from, to); } public static ITableExporter asHTML(ExportTableDataSource from, File to) { return new HTMLTableExporter(from, to); } private ExportFactory() { // no instances } }
[ "tim.halloran@surelogic.com" ]
tim.halloran@surelogic.com
a60b7cbbe3ec3d0d7cba3cea42488fd566504831
32f38cd53372ba374c6dab6cc27af78f0a1b0190
/app/src/main/java/com/squareup/leakcanary/LeakCanary.java
f11ac75ef845d6437e602cc3751d7074e5462daa
[]
no_license
shuixi2013/AmapCode
9ea7aefb42e0413f348f238f0721c93245f4eac6
1a3a8d4dddfcc5439df8df570000cca12b15186a
refs/heads/master
2023-06-06T23:08:57.391040
2019-08-29T04:36:02
2019-08-29T04:36:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,257
java
package com.squareup.leakcanary; import android.app.Application; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Build; import android.os.Build.VERSION; import android.util.Log; import com.alipay.mobile.security.bio.utils.HanziToPinyin.Token; import com.squareup.leakcanary.HeapDump.Listener; import com.squareup.leakcanary.internal.DisplayLeakActivity; import com.squareup.leakcanary.internal.HeapAnalyzerService; import com.squareup.leakcanary.internal.LeakCanaryInternals; public final class LeakCanary { public static RefWatcher install(Application application) { return install(application, DisplayLeakService.class, AndroidExcludedRefs.createAppDefaults().build()); } public static RefWatcher install(Application application, Class<? extends AbstractAnalysisResultService> cls, ExcludedRefs excludedRefs) { if (isInAnalyzerProcess(application)) { return RefWatcher.DISABLED; } enableDisplayLeakActivity(application); RefWatcher androidWatcher = androidWatcher(application, new ServiceHeapDumpListener(application, cls), excludedRefs); ActivityRefWatcher.installOnIcsPlus(application, androidWatcher); return androidWatcher; } public static RefWatcher androidWatcher(Context context, Listener listener, ExcludedRefs excludedRefs) { AndroidDebuggerControl androidDebuggerControl = new AndroidDebuggerControl(); AndroidHeapDumper androidHeapDumper = new AndroidHeapDumper(context); androidHeapDumper.cleanup(); RefWatcher refWatcher = new RefWatcher(new AndroidWatchExecutor(), androidDebuggerControl, GcTrigger.DEFAULT, androidHeapDumper, listener, excludedRefs); return refWatcher; } public static void enableDisplayLeakActivity(Context context) { LeakCanaryInternals.setEnabled(context, DisplayLeakActivity.class, true); } public static String leakInfo(Context context, HeapDump heapDump, AnalysisResult analysisResult, boolean z) { String str; PackageManager packageManager = context.getPackageManager(); String packageName = context.getPackageName(); try { PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0); String str2 = packageInfo.versionName; int i = packageInfo.versionCode; StringBuilder sb = new StringBuilder("In "); sb.append(packageName); sb.append(":"); sb.append(str2); sb.append(":"); sb.append(i); sb.append(".\n"); String sb2 = sb.toString(); String str3 = ""; if (analysisResult.leakFound) { if (analysisResult.excludedLeak) { StringBuilder sb3 = new StringBuilder(); sb3.append(sb2); sb3.append("* LEAK CAN BE IGNORED.\n"); sb2 = sb3.toString(); } StringBuilder sb4 = new StringBuilder(); sb4.append(sb2); sb4.append("* "); sb4.append(analysisResult.className); String sb5 = sb4.toString(); if (!heapDump.referenceName.equals("")) { StringBuilder sb6 = new StringBuilder(); sb6.append(sb5); sb6.append(" ("); sb6.append(heapDump.referenceName); sb6.append(")"); sb5 = sb6.toString(); } StringBuilder sb7 = new StringBuilder(); sb7.append(sb5); sb7.append(" has leaked:\n"); sb7.append(analysisResult.leakTrace.toString()); sb7.append("\n"); str = sb7.toString(); if (z) { StringBuilder sb8 = new StringBuilder("\n* Details:\n"); sb8.append(analysisResult.leakTrace.toDetailedString()); str3 = sb8.toString(); } } else if (analysisResult.failure != null) { StringBuilder sb9 = new StringBuilder(); sb9.append(sb2); sb9.append("* FAILURE:\n"); sb9.append(Log.getStackTraceString(analysisResult.failure)); sb9.append("\n"); str = sb9.toString(); } else { StringBuilder sb10 = new StringBuilder(); sb10.append(sb2); sb10.append("* NO LEAK FOUND.\n\n"); str = sb10.toString(); } StringBuilder sb11 = new StringBuilder(); sb11.append(str); sb11.append("* Reference Key: "); sb11.append(heapDump.referenceKey); sb11.append("\n* Device: "); sb11.append(Build.MANUFACTURER); sb11.append(Token.SEPARATOR); sb11.append(Build.BRAND); sb11.append(Token.SEPARATOR); sb11.append(Build.MODEL); sb11.append(Token.SEPARATOR); sb11.append(Build.PRODUCT); sb11.append("\n* Android Version: "); sb11.append(VERSION.RELEASE); sb11.append(" API: "); sb11.append(VERSION.SDK_INT); sb11.append(" LeakCanary: 1.3.1\n* Durations: watch="); sb11.append(heapDump.watchDurationMs); sb11.append("ms, gc="); sb11.append(heapDump.gcDurationMs); sb11.append("ms, heap dump="); sb11.append(heapDump.heapDumpDurationMs); sb11.append("ms, analysis="); sb11.append(analysisResult.analysisDurationMs); sb11.append("ms\n"); sb11.append(str3); return sb11.toString(); } catch (NameNotFoundException e) { throw new RuntimeException(e); } } public static boolean isInAnalyzerProcess(Context context) { return LeakCanaryInternals.isInServiceProcess(context, HeapAnalyzerService.class); } private LeakCanary() { throw new AssertionError(); } }
[ "hubert.yang@nf-3.com" ]
hubert.yang@nf-3.com
4500dae18a3c01414467c5db412b778cc02c5e08
31831a8743050055af60538f161c64892331f8df
/app/src/main/java/com/fly/newstart/neinterface/text/BActivity.java
789cb467fc462788042fcbde5d37ee9bc3ec048b
[]
no_license
MapleSunFLY/NewStart
3aea15e0e938407b7bedb1f091ad6dced9572044
b4df3dca5f4f1fa674cd758cd5ecaf72740ae93b
refs/heads/master
2020-03-14T00:57:02.506780
2019-12-31T09:08:28
2019-12-31T09:08:28
131,367,353
0
0
null
null
null
null
UTF-8
Java
false
false
2,363
java
package com.fly.newstart.neinterface.text; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.fly.newstart.R; import com.fly.newstart.common.base.BaseActivity; import com.fly.newstart.neinterface.FunctionManager; public class BActivity extends BaseActivity { private Button mBtnFuncton01; private Button mBtnFuncton02; private Button mBtnFuncton03; private Button mBtnFuncton04; private Button mBtnCloseB; private TextView mTvShow; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_b); mBtnFuncton01 = findViewById(R.id.btnFuncton01); mBtnFuncton02 = findViewById(R.id.btnFuncton02); mBtnFuncton03 = findViewById(R.id.btnFuncton03); mBtnFuncton04 = findViewById(R.id.btnFuncton04); mBtnCloseB = findViewById(R.id.btnCloseB); mTvShow = findViewById(R.id.tvShow); mBtnFuncton01.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FunctionManager.getInstance().invokeFunction(AActivity.FUNCTION_1); } }); mBtnFuncton02.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mTvShow.setText(FunctionManager.getInstance().invokeFunction(AActivity.FUNCTION_2, String.class)); } }); mBtnFuncton03.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FunctionManager.getInstance().invokeFunction(AActivity.FUNCTION_3, "调用了方法3,有参数无返回值类型方法"); } }); mBtnFuncton04.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mTvShow.setText(FunctionManager.getInstance().invokeFunction(AActivity.FUNCTION_4, "调用了方法4,有参数有返回值类型方法", String.class)); } }); mBtnCloseB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } }
[ "fenglanyang@postop.cn" ]
fenglanyang@postop.cn
141d81f89baa4eb37b893414e5974ab1851067d6
868869d107155bd9ae797191c28ab424ba4d3792
/BatorBack/src/main/java/com/kebodev/entity/BtrDAddressType.java
f5470bbc56b305efd7c0715663f46ea0d886d1a1
[]
no_license
kebodev/BatorProd
84c7fdc05e242395d08d0de1d88ee6aa15bcfb20
9a0aca48c7f01b6bf4c11cf18f22135280c22b07
refs/heads/master
2021-01-15T08:19:30.822024
2017-08-07T10:44:18
2017-08-07T10:44:18
96,806,913
0
0
null
null
null
null
UTF-8
Java
false
false
5,960
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.kebodev.entity; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author gabor_dev */ @Entity @Table(name = "BTR_D_ADDRESS_TYPE") @XmlRootElement @NamedQueries({ @NamedQuery(name = "BtrDAddressType.findAll", query = "SELECT b FROM BtrDAddressType b"), @NamedQuery(name = "BtrDAddressType.findByAdtyId", query = "SELECT b FROM BtrDAddressType b WHERE b.adtyId = :adtyId"), @NamedQuery(name = "BtrDAddressType.findByAdtyName", query = "SELECT b FROM BtrDAddressType b WHERE b.adtyName = :adtyName"), @NamedQuery(name = "BtrDAddressType.findByDateFrom", query = "SELECT b FROM BtrDAddressType b WHERE b.dateFrom = :dateFrom"), @NamedQuery(name = "BtrDAddressType.findByDateTo", query = "SELECT b FROM BtrDAddressType b WHERE b.dateTo = :dateTo"), @NamedQuery(name = "BtrDAddressType.findByCrDate", query = "SELECT b FROM BtrDAddressType b WHERE b.crDate = :crDate"), @NamedQuery(name = "BtrDAddressType.findByModDate", query = "SELECT b FROM BtrDAddressType b WHERE b.modDate = :modDate")}) public class BtrDAddressType implements Serializable { private static final long serialVersionUID = 1L; // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation @Id @Basic(optional = false) @NotNull @Column(name = "ADTY_ID") private BigDecimal adtyId; @Basic(optional = false) @NotNull @Size(min = 1, max = 100) @Column(name = "ADTY_NAME") private String adtyName; @Basic(optional = false) @NotNull @Column(name = "DATE_FROM") @Temporal(TemporalType.TIMESTAMP) private Date dateFrom; @Basic(optional = false) @NotNull @Column(name = "DATE_TO") @Temporal(TemporalType.TIMESTAMP) private Date dateTo; @Basic(optional = false) @NotNull @Column(name = "CR_DATE") @Temporal(TemporalType.TIMESTAMP) private Date crDate; @Basic(optional = false) @NotNull @Column(name = "MOD_DATE") @Temporal(TemporalType.TIMESTAMP) private Date modDate; @JoinColumn(name = "CR_USER_ID", referencedColumnName = "USER_ID") @ManyToOne(optional = false) private BtrUser crUserId; @JoinColumn(name = "MOD_USER_ID", referencedColumnName = "USER_ID") @ManyToOne(optional = false) private BtrUser modUserId; @OneToMany(cascade = CascadeType.ALL, mappedBy = "adtyId") private List<BtrAddress> btrAddressList; public BtrDAddressType() { } public BtrDAddressType(BigDecimal adtyId) { this.adtyId = adtyId; } public BtrDAddressType(BigDecimal adtyId, String adtyName, Date dateFrom, Date dateTo, Date crDate, Date modDate) { this.adtyId = adtyId; this.adtyName = adtyName; this.dateFrom = dateFrom; this.dateTo = dateTo; this.crDate = crDate; this.modDate = modDate; } public BigDecimal getAdtyId() { return adtyId; } public void setAdtyId(BigDecimal adtyId) { this.adtyId = adtyId; } public String getAdtyName() { return adtyName; } public void setAdtyName(String adtyName) { this.adtyName = adtyName; } public Date getDateFrom() { return dateFrom; } public void setDateFrom(Date dateFrom) { this.dateFrom = dateFrom; } public Date getDateTo() { return dateTo; } public void setDateTo(Date dateTo) { this.dateTo = dateTo; } public Date getCrDate() { return crDate; } public void setCrDate(Date crDate) { this.crDate = crDate; } public Date getModDate() { return modDate; } public void setModDate(Date modDate) { this.modDate = modDate; } public BtrUser getCrUserId() { return crUserId; } public void setCrUserId(BtrUser crUserId) { this.crUserId = crUserId; } public BtrUser getModUserId() { return modUserId; } public void setModUserId(BtrUser modUserId) { this.modUserId = modUserId; } @XmlTransient public List<BtrAddress> getBtrAddressList() { return btrAddressList; } public void setBtrAddressList(List<BtrAddress> btrAddressList) { this.btrAddressList = btrAddressList; } @Override public int hashCode() { int hash = 0; hash += (adtyId != null ? adtyId.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof BtrDAddressType)) { return false; } BtrDAddressType other = (BtrDAddressType) object; if ((this.adtyId == null && other.adtyId != null) || (this.adtyId != null && !this.adtyId.equals(other.adtyId))) { return false; } return true; } @Override public String toString() { return "com.kebodev.entity.BtrDAddressType[ adtyId=" + adtyId + " ]"; } }
[ "kuli.gabor@telekom.hu" ]
kuli.gabor@telekom.hu
da601ff88b6fd53b3c0c28893a71005ea3739139
35207a2be24e61699424a537376f1dc97ec81827
/src/TestRollAbilities.java
00be4092de73a80d112d1669bd08db07e565167a
[]
no_license
westonbmyers/homeIntelliJ
dbf7c5d90d91c1e70cd07df72f6a709569086a28
c35f9154ccf7469234dcde8f96210e143a022fb4
refs/heads/master
2021-01-10T01:38:26.262307
2015-11-28T22:31:39
2015-11-28T22:31:39
47,041,799
0
0
null
null
null
null
UTF-8
Java
false
false
3,967
java
/** * Created by westonmyers on 11/6/15. Modified 11/18/15 - extended TestSuper * and made changes to function as a sub-class. * This class populates the abilities of the character. * It tests the following: * 1 - Default constructor and default field values * a. Verify sides the die has (dieSidesToUse field) = 6 * b. Verify the number dice allowed for a ability field = 3 * c. Verify the number of buffer rolls for a ability = 0 * d. Verify the number of ability complete groups = 1 * 2 - Verify the constructor sets the field values * a. Verify sides the die has (dieSides) = number sent in constructor * b. Verify the number dice used for a ability = number sent in constructor * c. Verify the number of buffer rolls for a ability = number sent in constructor * d. Verify the number of buffer ability complete groups = number sent in constructor * 3 - Verify it records all the rolls for a group * a. Verify that the amount of rolls used for total is not more than number of dice allowed * (verify that the buffer amount is not what is used) * b. Verify that the highest rolls are used to fill the allowed amount of rolls * c. Verify the extra rolls from the buffer rolls are removed * 4 - Verify ability groups (with abilities) = amount of groups in the groups field * 5 - Get and verify total roll from addition of all dice rolled is correct * 6 - Get and verify a grand total of all the ability scores added together * 7 - User is able to select which group they use for there abilities and the others are removed * 8 - Verify score adjusting * a. If score number goes down, grand total goes up by equal amount * b. If score number goes up, grand total goes down by equal amount * c. Verify the total of all adjusted scores = grand total of roll * d. Verify the grand total is not reduced < 0 or > grand total * 9 - Verify ability customization * a. Verify ability type names can be changed * b. Verify ability types can be added * c. Verify ability types can be deleted * 10 - Verify abilities are saved */ import org.junit.Test; /** * Test #1 */ public class TestRollAbilities extends TestSuper{ @Test @Override public void runTests() { testDefaultConstructorFields(); printResults(failedTests); } private void testDefaultConstructorFields(){ String strStrt = "The field '"; String strMid = "' is not the default of "; String strLst = "! It is set to "; RollAbilities defaultStat = new RollAbilities(); /** * Test #1 a: Verify sides the die has (dieSidesToUse field) = 6 */ if (defaultStat.getDieSidesToUse().getValue() != 6){ failedTests.add(strStrt + "dieSidesToUse" + strMid + "6" + strLst + defaultStat.getDieSidesToUse().getValue() + "!"); } /** * Test #1 b: Verify the number dice allowed for a ability field = 3 */ if (defaultStat.getAllowedNumOfDice() != 3){ failedTests.add(strStrt + "allowedNumOfDice" + strMid + "3" + strLst + defaultStat.getAllowedNumOfDice() + "!"); } /** * Test #1 c: Verify the number of buffer rolls for a ability = 0 */ if (defaultStat.getNumBufferRolls() != 0){ failedTests.add(strStrt + "numBufferRolls" + strMid + "0" + strLst + defaultStat.getNumBufferRolls() + "!"); } /** * Test #1 d: Verify the number of additional ability complete groups = 1 */ if (defaultStat.getNumCompleteStatGroups() != 1) { failedTests.add(strStrt + "numBufferRolls" + strMid + "1" + strLst + defaultStat.getNumCompleteStatGroups() + "!"); } } }
[ "westonmyers@Westons-MacBook-Air.local" ]
westonmyers@Westons-MacBook-Air.local
2cd506b7b71529320ab49963a98c4092223800a5
136824ece02b2ba04b87df960627c653dda7a967
/src/main/java/com/imooc/sell/dataobject/ProductCategory.java
18fa4ef76afbbb1d3cd549109a37c8519a5bb9e9
[]
no_license
caobabai/sell
3f137b4641b6503a02506ce944e3cbbf64e1c2b2
3f7f33ee23093f91a0c74cfd993d67f6a104caf9
refs/heads/master
2021-01-06T23:57:19.726084
2020-02-19T03:21:27
2020-02-19T03:21:27
241,519,397
0
0
null
null
null
null
UTF-8
Java
false
false
1,855
java
package com.imooc.sell.dataobject; import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.util.Date; /** * 类目 * Created by 曹友学 * 2020-02-18 22:22 */ @Entity @DynamicUpdate public class ProductCategory { /** 分类id */ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer categoryId; /** 分类名 */ private String categoryName; /** 分类编号 */ private Integer categoryType; private Date createTime; private Date updateTime; public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Integer getCategoryId() { return categoryId; } public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public Integer getCategoryType() { return categoryType; } public void setCategoryType(Integer categoryType) { this.categoryType = categoryType; } @Override public String toString() { return "ProductCategory{" + "categoryId=" + categoryId + ", categoryName='" + categoryName + '\'' + ", categoryType=" + categoryType + '}'; } }
[ "2942838129@qq.com" ]
2942838129@qq.com
b984ecd0533159a25a961c12054a436fc0151f22
b17820f8fd81983c61ef7aca22b13733e68c59cb
/xdtech-edu/src/main/java/com/xdtech/sys/service/impl/DictionaryCodeServiceImpl.java
2781dd84a5dfd04834e2f28b9027ff2b7da2b4bc
[]
no_license
zhengzhixiong/xdtech-sys
c482dd6ef535bf6c5b48c97c8aa5a9e7898477e9
73a251dc3ba476ed40c22ddd7628588c3a3143ee
refs/heads/master
2021-01-18T20:12:46.949564
2015-01-18T15:45:47
2015-01-18T15:45:47
24,594,880
0
0
null
null
null
null
UTF-8
Java
false
false
1,616
java
package com.xdtech.sys.service.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.xdtech.core.orm.Page; import com.xdtech.core.orm.utils.BeanUtils; import com.xdtech.sys.dao.DictionaryCodeDao; import com.xdtech.sys.model.DictionaryCode; import com.xdtech.sys.service.DictionaryCodeService; import com.xdtech.sys.vo.DictionaryCodeItem; import com.xdtech.web.model.Pagination; @Service @Transactional public class DictionaryCodeServiceImpl implements DictionaryCodeService{ @Autowired private DictionaryCodeDao dictionaryCodeDao; public void save(DictionaryCode entity) { dictionaryCodeDao.save(entity); } public void delete(DictionaryCode entity) { dictionaryCodeDao.delete(entity); } public void delete(Long id) { dictionaryCodeDao.delete(id); } public DictionaryCode get(Long id) { return dictionaryCodeDao.get(id); } public List<DictionaryCode> getAll() { return dictionaryCodeDao.getAll(); } public Map<String, Object> loadPageAndCondition(Pagination pg, Map<String, String> values) { Map<String, Object> results = new HashMap<String, Object>(); Page<DictionaryCode> page = dictionaryCodeDao.findPage(pg); List<?> dictionarys = BeanUtils.copyListProperties(DictionaryCodeItem.class, page.getResult()); results.put("total", page.getTotalItems()); results.put("rows", dictionarys); return results; } }
[ "358744287@qq.com" ]
358744287@qq.com
27c29b381ef129648ce9eeeced4bc8e1f7dd106c
7592fadb22bfbb8538588288cff8b428187fbaca
/dynamic programming/221 maximal-square/20.6.6.java
3bc11169b0f90e1045de316e27a6c9f8f8a32086
[]
no_license
Lijinfeng-robot/Leetcode
700b343e60f1fd34247e756fb0cd77e19fba2cd1
76d0cb27a37eb5f1e4a06e9c381b7cc13d93edfa
refs/heads/master
2023-05-31T05:13:54.179971
2020-09-20T15:57:40
2020-09-20T15:57:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
942
java
class Solution { public int maximalSquare(char[][] matrix) { int row = matrix.length; if(row < 1){ return 0;} int column = matrix[0].length; int[][] dp = new int[row][column]; int maxEdge = 0; for(int i =0;i<row;i++){ dp[i][0] = matrix[i][0] == '0'? 0:1; if(dp[i][0] == 1){ maxEdge = 1;} } for(int i = 0;i<column;i++){ dp[0][i] = matrix[0][i] == '0'? 0:1; if(dp[0][i] == 1){ maxEdge = 1;} //可以省略 } for(int i = 1;i<row;i++){ for(int j = 1;j<column;j++){ if(matrix[i][j]=='0'){ dp[i][j]=0; }else{ dp[i][j]=Math.min(Math.min(dp[i-1][j],dp[i][j-1]),dp[i-1][j-1])+1; maxEdge = Math.max(dp[i][j],maxEdge); } } } return (int)Math.pow(maxEdge,2); } }
[ "noreply@github.com" ]
noreply@github.com
81fc7fb77152eaa037e09638fefb2ce53f831df7
59937160a29b8df14b277298ad3d46a10e8cef1a
/src/main/java/com/thinkgem/jeesite/modules/everymemoryword/pojo/SevenDaysTime.java
d70c0f251bc666ed664b4800f648310a98d0cee1
[ "Apache-2.0" ]
permissive
cuishaowen/wordAssault2
97c96079e446e740ea40f684a58e02d979c2b223
85e9ccbbeb83395677d486cfb23680c5b21ad850
refs/heads/master
2022-12-29T09:23:08.313092
2019-10-17T01:32:09
2019-10-17T01:32:09
204,702,732
2
0
Apache-2.0
2022-12-16T06:11:44
2019-08-27T12:53:00
JavaScript
UTF-8
Java
false
false
483
java
package com.thinkgem.jeesite.modules.everymemoryword.pojo; public class SevenDaysTime { private Integer totalTime; private String selectTime; public Integer getTotalTime() { return totalTime; } public void setTotalTime(Integer totalTime) { this.totalTime = totalTime; } public String getSelectTime() { return selectTime; } public void setSelectTime(String selectTime) { this.selectTime = selectTime; } }
[ "cuishaowen2013@qq.com" ]
cuishaowen2013@qq.com
c369b3b388d9527026efb720dab53dcc9781dc85
d0bd6c5bd866d0625d57bc21c9c7aa8029b37c90
/src/main/java/com/semafoor/semaforce/model/entities/result/Result.java
5091c2b1a8266fa609933d72407f82b51e77878f
[]
no_license
H-J-Uijterlinde/WorkoutApp_BackEnd
ee4bec3cf416a942d7c6f55c937ceb8d72b69346
0d8105eccbdfafdb0614077f85b53adcec61a327
refs/heads/master
2020-08-26T16:57:05.089742
2019-12-19T14:33:08
2019-12-19T14:33:08
217,080,920
0
0
null
null
null
null
UTF-8
Java
false
false
2,271
java
package com.semafoor.semaforce.model.entities.result; import com.fasterxml.jackson.annotation.JsonBackReference; import com.semafoor.semaforce.model.entities.AbstractEntity; import com.semafoor.semaforce.model.entities.exercise.Exercise; import com.semafoor.semaforce.model.entities.user.User; import com.semafoor.semaforce.model.entities.workout.ScheduledExercise; import com.semafoor.semaforce.model.entities.workout.TrainingDay; import lombok.Data; import lombok.EqualsAndHashCode; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.util.HashMap; import java.util.Map; /** * Defines the Result entity. */ @Data @EqualsAndHashCode(callSuper=false) @Entity @NamedQueries({ @NamedQuery( name = "Result.findInstantTrainingResultsByExerciseIdAndUserId", query = "select R from Result R " + "join R.user as U join R.exercise as E " + "where U.id = :userId and E.id = :exerciseId and R.isInstantTrainingResult = true" ) }) public class Result extends AbstractEntity { @Id @GeneratedValue(generator = "ID_GENERATOR") private Long id; @NotNull(message = "The user for this result must be set") @ManyToOne(fetch = FetchType.LAZY) @JsonBackReference private User user; @NotNull(message = "The exercise for this result must be set") @ManyToOne(fetch = FetchType.LAZY) private Exercise exercise; @OneToMany(mappedBy = "result", cascade = {CascadeType.ALL}, orphanRemoval = true, fetch = FetchType.EAGER) @MapKey(name = "weekNumber") private Map<Integer, WeeklyResult> weeklyResults = new HashMap<>(); @NotNull(message = "Please indicate if this results comes from an instant training workout") private boolean isInstantTrainingResult; public Result() { } public Result(User user, Exercise exercise, Map<Integer, WeeklyResult> weeklyResults) { this.user = user; this.exercise = exercise; this.weeklyResults = weeklyResults; } public void addResult(WeeklyResult weeklyResult) { weeklyResult.setResult(this); this.weeklyResults.put(weeklyResult.getWeekNumber(), weeklyResult); } }
[ "hjuijterlinde@hotmail.com" ]
hjuijterlinde@hotmail.com
3f6ab2bc286e156cdf5621382c916416662fd338
099e6196a1af1fbacc8c874776eb96ddde30bfbe
/src/com/book2/B4_InteRnet/serverAndclient/server/B_Module3.java
64861cbab21b5c4e70345416ffc18810dd96fbfc
[]
no_license
zxmjjf/importanceCode
2acafa26f239d71e352bae62caa5164f51c03640
a5d334ad35febd044a1914031752aa1238b0c5e9
refs/heads/master
2020-07-23T19:55:50.879497
2019-10-15T00:31:17
2019-10-15T00:31:17
207,689,908
0
0
null
null
null
null
UTF-8
Java
false
false
735
java
package com.book2.B4_InteRnet.serverAndclient.server; import javax.swing.*; import javax.swing.border.Border; import java.awt.*; public class B_Module3 { private JPanel jPanel; //客户端请求信息面板 B_Module3(){ /*客户端详细信息面板. 基本设置*/ jPanel = new JPanel(); jPanel.setBackground(Color.PINK); //添加边框 Border border = BorderFactory.createBevelBorder(1, Color.DARK_GRAY, Color.WHITE); Border border1 = BorderFactory.createTitledBorder(border, "客户端详细信息", 2, 2, new Font("华文彩云", Font.BOLD, 15), Color.RED); jPanel.setBorder(border1); } protected JPanel getJPanel() { return this.jPanel; } }
[ "1594426983@qq.com" ]
1594426983@qq.com
5e7a947170387c5e0be2bc64f3aa2d7b2e45330a
2f6ab52174c2e00912476e624089608737c02573
/taller4_proyecto/src/main/java/com/example/taller2/model/UstPersonSymptom.java
5933bec2ca181bf1b80b6ad36d849ac5ddb7734d
[]
no_license
juandavid2025/spring-device-manament-project
c55ae157f2ca01b3142bc66c8b5c300ce4d931db
c03a10d2320f2c2e80a44c97f7bda07d7c4aeb30
refs/heads/main
2023-08-27T02:55:47.002903
2021-09-21T02:55:28
2021-09-21T02:55:28
321,808,085
0
0
null
null
null
null
UTF-8
Java
false
false
2,335
java
package com.example.taller2.model; import java.io.Serializable; import javax.persistence.*; import java.util.Date; /** * The persistent class for the UST_PERSON_SYMPTOM database table. * */ @Entity @Table(name="UST_PERSON_SYMPTOM") @NamedQuery(name="UstPersonSymptom.findAll", query="SELECT u FROM UstPersonSymptom u") public class UstPersonSymptom implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name="UST_PERSON_SYMPTOM_PERSSYMPID_GENERATOR", sequenceName="UST_PERSON_SYMPTOM_SEQ") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="UST_PERSON_SYMPTOM_PERSSYMPID_GENERATOR") @Column(name="PERSSYMP_ID") private long perssympId; private String answer; @Temporal(TemporalType.DATE) private Date answerdate; @Temporal(TemporalType.DATE) private Date answerexpiration; @Temporal(TemporalType.DATE) private Date lastdateanswchanged; //bi-directional many-to-one association to Person @ManyToOne @JoinColumn(name="PERS_PERS_ID") private Person person; //bi-directional many-to-one association to Symptomquestion @ManyToOne @JoinColumn(name="SYMPQUES_SYMPQUES_ID") private Symptomquestion symptomquestion; public UstPersonSymptom() { } public long getPerssympId() { return this.perssympId; } public void setPerssympId(long perssympId) { this.perssympId = perssympId; } public String getAnswer() { return this.answer; } public void setAnswer(String answer) { this.answer = answer; } public Date getAnswerdate() { return this.answerdate; } public void setAnswerdate(Date answerdate) { this.answerdate = answerdate; } public Date getAnswerexpiration() { return this.answerexpiration; } public void setAnswerexpiration(Date answerexpiration) { this.answerexpiration = answerexpiration; } public Date getLastdateanswchanged() { return this.lastdateanswchanged; } public void setLastdateanswchanged(Date lastdateanswchanged) { this.lastdateanswchanged = lastdateanswchanged; } public Person getPerson() { return this.person; } public void setPerson(Person person) { this.person = person; } public Symptomquestion getSymptomquestion() { return this.symptomquestion; } public void setSymptomquestion(Symptomquestion symptomquestion) { this.symptomquestion = symptomquestion; } }
[ "fabioandresmejia@hotmail.com" ]
fabioandresmejia@hotmail.com
1aa7cdcd487ace8e2ea2eaefda38f8f0e2fe0b64
274660956559ffc0e287eaa3c262e23db0d31078
/I Курс/1 Семестр/Прога/Лаб.7/cabbage/SelectionSort.java
dd4e49124c18bfa6f64dc67c79e64fd1322f60b3
[]
no_license
NikitaBukreyev/UniDump
79552655a95cb67ea9507c67b0fc8e4a1b621334
b97ae8130f49f0bb487849e67e62af9f43be7868
refs/heads/main
2023-04-14T09:31:16.352711
2021-04-14T20:46:54
2021-04-14T20:46:54
343,472,076
0
0
null
2021-03-01T15:54:01
2021-03-01T15:54:01
null
UTF-8
Java
false
false
378
java
package cabbage; public class SelectionSort implements SortChooser { public void sort(float[] table) { int n = table.length; for (int i = 0; i < n-1; i++) { int min_idx = i; for (int j = i+1; j < n; j++) { if (table[j] < table[min_idx]) { min_idx = j; } } float temp = table[min_idx]; table[min_idx] = table[i]; table[i] = temp; } } }
[ "wormer007@gmail.com" ]
wormer007@gmail.com
5535c69a9c53108fdf595d40a1c62860700189ba
75b91f4c4df2b6df361426b3c547c44053b86943
/jfw-core/src/main/java/org/jfw/core/code/webmvc/handler/RemoveSessionAttributeHandler.java
74ed2874a86e9364fac949ec6f4aaa4d52eb5eb9
[ "Apache-2.0" ]
permissive
saga810203/jfw
764cf3e8430c2756f7e02b62e91c967913bade8c
5e9fe09f69539add1ba0bec74d3a8dd1ae97a15c
refs/heads/master
2021-01-17T13:33:45.680800
2016-04-14T06:20:13
2016-04-14T06:20:13
41,295,741
0
0
null
null
null
null
UTF-8
Java
false
false
628
java
package org.jfw.core.code.webmvc.handler; import org.jfw.core.code.generator.annotations.webmvc.RemoveSessionAttribute; import org.jfw.core.code.webmvc.Handler; public class RemoveSessionAttributeHandler extends Handler{ @Override public void appendBeforCode(StringBuilder sb) { RemoveSessionAttribute sa= this.getMethodAnnotation(RemoveSessionAttribute.class); if(null==sa || (this.getCmcg().getMethod().getReturnType()==void.class))return; this.getCmcg().readSession(); sb.append("session.removeAttriubte(\"").append(sa.value().trim()).append("\");\r\n"); } }
[ "pengjia@isoftstone.com" ]
pengjia@isoftstone.com
9c9a9fb480831b9ca7a7c68c09d1a6a0035fedb6
6c2507cc9914e63bc56b68c9bbf66174d01cda9b
/sas-client/src/main/java/com/lingnan/sas/client/service/NewsInfoService.java
05b4b6a146edc59968ff707557df1f6c9a1bcff7
[]
no_license
Cyril-ljx/sas
930dbb72e2626a8f258ad922190031594a423cca
4ca71cbde251dd9c97a65d014a8101ce751fdafa
refs/heads/master
2023-04-16T00:40:26.740358
2021-04-27T07:06:01
2021-04-27T07:06:01
362,021,919
1
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.lingnan.sas.client.service; import com.lingnan.sas.core.entity.MessageEntity; import com.lingnan.sas.core.entity.MessageRefEntity; import com.lingnan.sas.core.entity.Newsinfo; import org.apache.ibatis.annotations.Param; import java.util.HashMap; import java.util.List; public interface NewsInfoService { List<Newsinfo> queryNewsByPage(int offset, int limit);; Newsinfo queryNewsById(int id); }
[ "1939945226@qq.com" ]
1939945226@qq.com
6a84b5c0b077757a89af2988d8af174446289fa5
deb6879907f89785ee0272b9f6754f34324d781c
/Project/UserManagement/src/main/java/com/codegym/controller/UserController.java
955673f73a0df85c3c8b1303b03fd656e9759067
[]
no_license
inhtruong/exerciseModule4
c82c29858d58e4b81105d352102b6e9e8aaf71cc
5840aaac7f558c58176c48734d2f940eff8dfd4b
refs/heads/master
2023-09-02T05:21:37.552452
2021-09-23T13:45:25
2021-09-23T13:45:25
395,565,543
0
0
null
null
null
null
UTF-8
Java
false
false
4,285
java
package com.codegym.controller; import com.codegym.DTO.TransferDTO; import com.codegym.model.Transfer; import com.codegym.model.User; import com.codegym.service.ITransferService; import com.codegym.service.IUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.List; @Controller @RequestMapping("user") public class UserController { @Autowired private IUserService userService; @Autowired private ITransferService transferService; @GetMapping("") public ModelAndView getIndex(ModelAndView modelAndView) { modelAndView.setViewName("index"); List<User> userList = userService.findAll(); modelAndView.addObject("users", userList); return modelAndView; } @GetMapping("/create") public ModelAndView create(Model model) { return new ModelAndView("create","user", new User()); } @PostMapping("/save-insert") public ModelAndView save(User user, RedirectAttributes redirectAttributes) { userService.insert(user); redirectAttributes.addFlashAttribute("success", "Add success"); return new ModelAndView("redirect:/user"); } @GetMapping("/{id}/edit") public ModelAndView edit(@PathVariable int id, Model model) { return new ModelAndView("edit","user", userService.findOne(id)); } // @PostMapping("/update") public ModelAndView update(User user, RedirectAttributes redirectAttributes) { userService.update(user); redirectAttributes.addFlashAttribute("success", "Edit success"); return new ModelAndView("redirect:/user"); } // @GetMapping("/{id}/delete") public ModelAndView delete(@PathVariable int id) { return new ModelAndView("deleter","user", userService.findOne(id)); } @PostMapping("/save-delete") public ModelAndView delete(User user, RedirectAttributes redirect) { userService.remove(user.getId()); redirect.addFlashAttribute("success", "Removed customer successfully!"); return new ModelAndView("redirect:/user"); } @GetMapping("/{id}/view") public ModelAndView view(@PathVariable int id, Model model) { return new ModelAndView("view","user", userService.findOne(id)); } @GetMapping("/{id}/deposit") public ModelAndView deposit(@PathVariable int id, Model model) { return new ModelAndView("deposit","user", userService.findOne(id)); } @PostMapping("/save-deposit") public ModelAndView deposit(User user, @RequestParam("deposit") float deposit, RedirectAttributes redirect) { userService.deposit(user.getId(), deposit); redirect.addFlashAttribute("success", "Removed customer successfully!"); return new ModelAndView("redirect:/user"); } @GetMapping("/{id}/withdraw") public ModelAndView withdraw(@PathVariable int id, Model model) { return new ModelAndView("withdraw","user", userService.findOne(id)); } @PostMapping("/save-withdraw") public ModelAndView withdraw(User user, @RequestParam("withdraw") float withdraw, RedirectAttributes redirect) { userService.withdraw(user.getId(), withdraw); redirect.addFlashAttribute("success", "Removed customer successfully!"); return new ModelAndView("redirect:/user"); } @GetMapping("/{id}/transfer") public ModelAndView transfer(@PathVariable int id) { ModelAndView modelAndView = new ModelAndView("transfer"); modelAndView.addObject("transfer", new Transfer()); modelAndView.addObject("userSender", userService.findOne(id)); modelAndView.addObject("listUser", userService.findAllExceptId(id)); return modelAndView; } @PostMapping("/save-transfer") public ModelAndView transfer(Transfer transfer, RedirectAttributes redirect) { transferService.insert(transfer); redirect.addFlashAttribute("success", "Removed customer successfully!"); return new ModelAndView("redirect:/user"); } }
[ "duydat.dhsp@gmail.com" ]
duydat.dhsp@gmail.com
ac2f9349f301f03f9f1a168826b4270fcb66115a
ac4ff5b38e62b9f3883ab48a2b9f29403c29fdd5
/lsq/src/main/java/com/xpsoft/oa/action/flow/FlowRunInfo.java
9973f3594b3d9deb9d92eb07ebeeae52e72946a9
[]
no_license
wangscript/lsqoa
e571f3a0f7f01fd660730bd34779b9cfcc3c749e
9a1587bb7c43c23e4f6b555b582b8df89d9ac7a4
refs/heads/master
2021-01-22T08:23:12.129364
2013-08-05T13:54:54
2013-08-05T13:54:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,594
java
package com.xpsoft.oa.action.flow; import com.xpsoft.core.jbpm.pv.ParamField; import com.xpsoft.core.util.AppUtil; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.Properties; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.struts2.ServletActionContext; public class FlowRunInfo { private Map variables = new HashMap(); private Map<String, ParamField> paramFields = new HashMap(); private boolean isStartFlow = false; private HttpServletRequest request; private String processName = "通用"; private String activityName = "开始"; private String destName = null; private String transitionName; private String taskId; private String piId; private String runId; private String userId; private boolean isAuto; private int returnBack;//0退回审批人; 1退回发起人 private boolean isReStart=false; private String serverUrl=(String)AppUtil.getSysConfig().get("app.serverUrl"); public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public FlowRunInfo(HttpServletRequest req) { if ("true".equals(req.getParameter("startFlow"))) { this.isStartFlow = true; if ("true".equals(req.getParameter("reStart"))) { this.isReStart = true; } } else { String signUserIds = req.getParameter("signUserIds"); if (StringUtils.isNotEmpty(signUserIds)) { this.variables.put("signUserIds", signUserIds); } String flowAssignId = req.getParameter("flowAssignId"); if (StringUtils.isNotEmpty(flowAssignId)) { this.variables.put("flowAssignId", flowAssignId); } String signUserId = req.getParameter(""); String pTaskId = req.getParameter("taskId"); if (StringUtils.isNotEmpty(pTaskId)) { this.taskId = pTaskId; } String pPiId = req.getParameter("piId"); if (StringUtils.isNotEmpty(pPiId)) { this.piId = pPiId; } String runId = req.getParameter("runId"); if (StringUtils.isNotEmpty(runId)) { this.runId = runId; } String pActivityName = req.getParameter("activityName"); if (StringUtils.isNotEmpty(pActivityName)) { this.activityName = pActivityName; } String pDestName = req.getParameter("destName"); if (StringUtils.isNotEmpty(pDestName)) { this.destName = pDestName; } String pSignName = req.getParameter("signalName"); if (StringUtils.isNotEmpty(pSignName)) this.transitionName = pSignName; String returnBack = req.getParameter("returnBack"); if ("0".equals(returnBack)) { this.returnBack = 0; }else if("1".equals(returnBack)){ this.returnBack = 1; }else{ this.returnBack = -1; } } } public FlowRunInfo() { } public Map getVariables() { return this.variables; } public void setVariables(Map variables) { this.variables = variables; } public boolean isStartFlow() { return this.isStartFlow; } public void setStartFlow(boolean isStartFlow) { this.isStartFlow = isStartFlow; } public HttpServletRequest getRequest() { return this.request; } public void setRequest(HttpServletRequest request) { this.request = request; } public String getProcessName() { return this.processName; } public void setProcessName(String processName) { this.processName = processName; } public String getActivityName() { return this.activityName; } public void setActivityName(String activityName) { this.activityName = activityName; } public Map<String, ParamField> getParamFields() { return this.paramFields; } public void setParamFields(Map<String, ParamField> paramFields) { this.paramFields = paramFields; } public String getTransitionName() { return this.transitionName; } public void setTransitionName(String transitionName) { this.transitionName = transitionName; } public String getTaskId() { return this.taskId; } public void setTaskId(String taskId) { this.taskId = taskId; } public String getPiId() { return this.piId; } public void setPiId(String piId) { this.piId = piId; } public String getDestName() { return this.destName; } public void setDestName(String destName) { this.destName = destName; } public void setdAssignId(String assignId) { this.variables.put("flowAssignId", assignId); } public void setMultipleTask(String userIds) { this.variables.put("signUserIds", userIds); } public boolean isAuto() { return isAuto; } public void setAuto(boolean isAuto) { this.isAuto = isAuto; } public int isReturnBack() { return returnBack; } public void setReturnBack(int returnBack) { this.returnBack = returnBack; } public boolean isReStart() { return isReStart; } public void setReStart(boolean isReStart) { this.isReStart = isReStart; } public String getServerUrl() { return serverUrl; } public void setServerUrl(String serverUrl) { this.serverUrl = serverUrl; } public String getRunId() { return runId; } public void setRunId(String runId) { this.runId = runId; } }
[ "loushi135@163.com" ]
loushi135@163.com
fd9b33dc66abd57f9a3264ab33899caf0d100a80
9a075e96e835652c72b43970dc2f8b6fb9e8947e
/target/classes/entities/PersonEntity.java
8636308a1ab3eefdc1d323f0f6bd3ed50280dd10
[]
no_license
tudorruxanda/aosfirstlab
3d5edfc1441a3011ea796aca9dfc4bb9a82fa67c
613aef539deda4b7c709b1b85a28f1e907c2078d
refs/heads/master
2020-04-02T16:11:50.080746
2018-10-25T03:23:56
2018-10-25T03:23:56
154,602,560
0
0
null
null
null
null
UTF-8
Java
false
false
795
java
package entities; import java.io.Serializable; import javax.persistence.*; /** * The persistent class for the person database table. * */ @Entity @NamedQuery(name="Person.findAll", query="SELECT p FROM Person p") public class PersonEntity implements Serializable { private static final long serialVersionUID = 1L; private int id; private String email; private String name; public PersonEntity() { } @Id @GeneratedValue(strategy=GenerationType.IDENTITY) public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } }
[ "tudorruxanda@yahoo.com" ]
tudorruxanda@yahoo.com
79ffc278dcd67a2429d38f0a45ca4142c5b1ca5e
c697b14836a01be88e6bbf43ac648be83426ade0
/Algorithms/0001-1000/0061. Rotate List/Solution.java
ecfd438cfb1bae59e931c2fffafc09a112ce16e7
[]
no_license
jianyimiku/My-LeetCode-Solution
8b916d7ebbb89606597ec0657f16a8a9e88895b4
48058eaeec89dc3402b8a0bbc8396910116cdf7e
refs/heads/master
2023-07-17T17:50:11.718015
2021-09-05T06:27:06
2021-09-05T06:27:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
904
java
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { public ListNode rotateRight(ListNode head, int k) { if (head == null || head.next == null || k == 0) return head; int length = 0; ListNode temp = head; while (temp != null) { temp = temp.next; length++; } k %= length; if (k == 0) return head; ListNode pointer1 = head, pointer2 = head; for (int i = 0; i < k; i++) pointer2 = pointer2.next; while (pointer2.next != null) { pointer1 = pointer1.next; pointer2 = pointer2.next; } ListNode newHead = pointer1.next; pointer1.next = null; pointer2.next = head; return newHead; } }
[ "chenyi_storm@sina.com" ]
chenyi_storm@sina.com
8681c879dbaa2f6159f1b0e4c2169a39d2138a55
f0d5f707fa6d631b8fe54e2f025d9b9142854c8b
/src/main/java/com/taskombanktesttask/clientapi/exceptions/DataAccessException.java
620f56364dca03875031a5f540fdebfce8863894
[]
no_license
bignatyev/test-task-api
a52985de9ecd48a8c9df5a8e2e090f31c0f5e823
3fc59c87760ef47f2233819be2961866b7f98d0c
refs/heads/master
2021-07-25T05:27:59.535298
2017-11-03T16:21:30
2017-11-03T16:21:30
109,417,368
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package com.taskombanktesttask.clientapi.exceptions; public class DataAccessException extends Exception { public DataAccessException(String message) { super(message); } public DataAccessException(String message, Throwable cause) { super(message, cause); } }
[ "submitthesatan666@gmail.com" ]
submitthesatan666@gmail.com
b4266b56fc44ee3fb984d6d57f3d4e89562064b1
56a8bf5f7efea8d3d62adc7e4d9af657a99a8871
/Guía5/src/cl/cursos/java/herencia/CuentaCorriente.java
f1b2c7b3eb5c1b25ffa278057ce4b11e7dc83c7f
[]
no_license
edelrio/Workspace
97d60c5a2ea29d500f2cd97491303429ab5af164
3f62186d09af72b48d12f7c0550229bf94c5199c
refs/heads/master
2020-04-06T03:38:07.002945
2016-06-10T14:50:54
2016-06-10T14:50:54
60,854,699
0
0
null
null
null
null
UTF-8
Java
false
false
965
java
package cl.cursos.java.herencia; public class CuentaCorriente extends CuentaBancaria { private int lineaCredito; public CuentaCorriente() { System.out.println("Constructor de Cuenta Corriente"); } public int getLineaCredito() { return lineaCredito; } public void setLineaCredito(int lineaCredito) { this.lineaCredito = lineaCredito; } public void girar( int monto) { if( monto <= (this.getSaldo() + this.getLineaCredito()) ) { if(monto <= this.getSaldo()) { this.setSaldo(this.getSaldo( ) - monto); } else { int resto = monto - this.getSaldo(); this.setLineaCredito(this.getLineaCredito() - resto); this.setSaldo(0); } } else { System.out.println("Saldo insuficiente"); } } public void imprimir() { super.imprimir(); //System.out.println(this.getNumeroCuenta()); //System.out.println(this.getSaldo()); System.out.println(" Linea de credito :" + this.getLineaCredito()); } }
[ "usuario" ]
usuario
ef4ea47a13885f286cf94c208489426112ecc789
297497957c531d81ba286bc91253fbbb78b4d8be
/third_party/libwebrtc/sdk/android/api/org/webrtc/CryptoOptions.java
a7a9b07bb0b543f73697361b1d69bb0fa375021f
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
marco-c/gecko-dev-comments-removed
7a9dd34045b07e6b22f0c636c0a836b9e639f9d3
61942784fb157763e65608e5a29b3729b0aa66fa
refs/heads/master
2023-08-09T18:55:25.895853
2023-08-01T00:40:39
2023-08-01T00:40:39
211,297,481
0
0
NOASSERTION
2019-09-29T01:27:49
2019-09-27T10:44:24
C++
UTF-8
Java
false
false
3,275
java
package org.webrtc; public final class CryptoOptions { public final class Srtp { private final boolean enableGcmCryptoSuites; private final boolean enableAes128Sha1_32CryptoCipher; private final boolean enableEncryptedRtpHeaderExtensions; private Srtp(boolean enableGcmCryptoSuites, boolean enableAes128Sha1_32CryptoCipher, boolean enableEncryptedRtpHeaderExtensions) { this.enableGcmCryptoSuites = enableGcmCryptoSuites; this.enableAes128Sha1_32CryptoCipher = enableAes128Sha1_32CryptoCipher; this.enableEncryptedRtpHeaderExtensions = enableEncryptedRtpHeaderExtensions; } @CalledByNative("Srtp") public boolean getEnableGcmCryptoSuites() { return enableGcmCryptoSuites; } @CalledByNative("Srtp") public boolean getEnableAes128Sha1_32CryptoCipher() { return enableAes128Sha1_32CryptoCipher; } @CalledByNative("Srtp") public boolean getEnableEncryptedRtpHeaderExtensions() { return enableEncryptedRtpHeaderExtensions; } } public final class SFrame { private final boolean requireFrameEncryption; private SFrame(boolean requireFrameEncryption) { this.requireFrameEncryption = requireFrameEncryption; } @CalledByNative("SFrame") public boolean getRequireFrameEncryption() { return requireFrameEncryption; } } private final Srtp srtp; private final SFrame sframe; private CryptoOptions(boolean enableGcmCryptoSuites, boolean enableAes128Sha1_32CryptoCipher, boolean enableEncryptedRtpHeaderExtensions, boolean requireFrameEncryption) { this.srtp = new Srtp( enableGcmCryptoSuites, enableAes128Sha1_32CryptoCipher, enableEncryptedRtpHeaderExtensions); this.sframe = new SFrame(requireFrameEncryption); } public static Builder builder() { return new Builder(); } @CalledByNative public Srtp getSrtp() { return srtp; } @CalledByNative public SFrame getSFrame() { return sframe; } public static class Builder { private boolean enableGcmCryptoSuites; private boolean enableAes128Sha1_32CryptoCipher; private boolean enableEncryptedRtpHeaderExtensions; private boolean requireFrameEncryption; private Builder() {} public Builder setEnableGcmCryptoSuites(boolean enableGcmCryptoSuites) { this.enableGcmCryptoSuites = enableGcmCryptoSuites; return this; } public Builder setEnableAes128Sha1_32CryptoCipher(boolean enableAes128Sha1_32CryptoCipher) { this.enableAes128Sha1_32CryptoCipher = enableAes128Sha1_32CryptoCipher; return this; } public Builder setEnableEncryptedRtpHeaderExtensions( boolean enableEncryptedRtpHeaderExtensions) { this.enableEncryptedRtpHeaderExtensions = enableEncryptedRtpHeaderExtensions; return this; } public Builder setRequireFrameEncryption(boolean requireFrameEncryption) { this.requireFrameEncryption = requireFrameEncryption; return this; } public CryptoOptions createCryptoOptions() { return new CryptoOptions(enableGcmCryptoSuites, enableAes128Sha1_32CryptoCipher, enableEncryptedRtpHeaderExtensions, requireFrameEncryption); } } }
[ "mcastelluccio@mozilla.com" ]
mcastelluccio@mozilla.com
d447b86e8e5e9bbc12887d38f456b2dd7ce59409
ec9422ce46c08ba37f2d6853996b7e6d0b90641b
/Event-portlet/docroot/WEB-INF/service/com/Trylof/services/service/messaging/ClpMessageListener.java
f8ad0c69dfdcd08909835127b98fd3e65f3d6607
[]
no_license
Rahul1d/Lost-And-Found
762eec6119dea20207d6749b6e259c9423ab4a4e
2e24d5b3c14a93ba6f24e3ed7019a78cc8e3d07b
refs/heads/master
2021-07-04T00:31:15.185057
2017-09-25T11:21:53
2017-09-25T11:21:53
104,777,218
0
0
null
null
null
null
UTF-8
Java
false
false
2,404
java
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.Trylof.services.service.messaging; import aQute.bnd.annotation.ProviderType; import com.Trylof.services.service.ClpSerializer; import com.Trylof.services.service.ItemFoundLocalServiceUtil; import com.Trylof.services.service.ItemFoundServiceUtil; import com.Trylof.services.service.ItemLostLocalServiceUtil; import com.Trylof.services.service.ItemLostServiceUtil; import com.Trylof.services.service.ItemVerificationLocalServiceUtil; import com.Trylof.services.service.ItemVerificationServiceUtil; import com.Trylof.services.service.SearchResLocalServiceUtil; import com.Trylof.services.service.SearchResServiceUtil; import com.Trylof.services.service.UserMasterLocalServiceUtil; import com.Trylof.services.service.UserMasterServiceUtil; import com.liferay.portal.kernel.messaging.BaseMessageListener; import com.liferay.portal.kernel.messaging.Message; /** * @author Utkarsh */ @ProviderType public class ClpMessageListener extends BaseMessageListener { public static String getServletContextName() { return ClpSerializer.getServletContextName(); } @Override protected void doReceive(Message message) throws Exception { String command = message.getString("command"); String servletContextName = message.getString("servletContextName"); if (command.equals("undeploy") && servletContextName.equals(getServletContextName())) { ItemFoundLocalServiceUtil.clearService(); ItemFoundServiceUtil.clearService(); ItemLostLocalServiceUtil.clearService(); ItemLostServiceUtil.clearService(); ItemVerificationLocalServiceUtil.clearService(); ItemVerificationServiceUtil.clearService(); SearchResLocalServiceUtil.clearService(); SearchResServiceUtil.clearService(); UserMasterLocalServiceUtil.clearService(); UserMasterServiceUtil.clearService(); } } }
[ "rahul18jan1996@gmail.com" ]
rahul18jan1996@gmail.com
7d9980bf666f20d7841c111e5f8f42d33ff2280b
ccc5d3fdac2d2de4650f2791f426af77767e8d5e
/Cartao/src/CartaoPP.java
befed005445b3ade4df0cf8cda608f783cbdf0a3
[]
no_license
lunabrSP/AulasJava
94af806b2e2e3d0f56a0412bb8d679fd14261d87
99cc681a746646d3f354e3e317a9b371e6918a4d
refs/heads/master
2022-11-11T11:01:08.912737
2020-07-03T16:05:01
2020-07-03T16:05:01
276,937,189
0
0
null
null
null
null
UTF-8
Java
false
false
1,681
java
public class CartaoPP { protected String numeroCartao; protected String nomeTitular; protected int anoValidade; protected int mesValidade; protected double saldo; public CartaoPP(String numeroCartao, String nomeTitular, int anoValidade, int mesValidade, double saldo) { this.numeroCartao = numeroCartao; this.nomeTitular = nomeTitular; this.anoValidade = anoValidade; this.mesValidade = mesValidade; this.saldo = saldo; } protected String getNumeroCartao() { return numeroCartao; } protected void setNumeroCartao(String numeroCartao) { this.numeroCartao = numeroCartao; } protected String getNomeTitular() { return nomeTitular; } protected void setNomeTitular(String nomeTitular) { this.nomeTitular = nomeTitular; } protected int getAnoValidade() { return anoValidade; } protected void setAnoValidade(int anoValidade) { this.anoValidade = anoValidade; } protected int getMesValidade() { return mesValidade; } protected void setMesValidade(int mesValidade) { this.mesValidade = mesValidade; } protected double getSaldo() { return saldo; } protected void setSaldo(double saldo) { this.saldo = saldo; } public void adcionarCredito(double valor) { if (valor >0 ) { setSaldo(getSaldo() + valor); } } public boolean comprar(double valor) { if (valor <= getSaldo()) { setSaldo(saldo - valor); return true; } else { return false; } } public String toString () { return "Operacao C.C.\n: [nome do titular: " + nomeTitular + ", Numero do cartao: "+ numeroCartao + ", Ano Validade: " + anoValidade + ", Saldo:R$ " + saldo; } }
[ "lunabr@gmail.com" ]
lunabr@gmail.com
0151aa47dc87492d7cde3cd5803ddacafaf9e184
3b85db026f3aa749cff2a7ccf8cca2b62246140a
/src/rewriter/com/newrelic/org/dom4j/io/ElementStack.java
88610dccf9c1ac763151b6aa98cbdf12d354be9d
[]
no_license
chenhq/newrelic_ref
9255cf81572d89309a17989c09e42b0d00db126d
792d7c84dd231fec170894b233996c744f8c318d
refs/heads/master
2021-01-10T19:01:40.257458
2014-12-26T08:39:09
2014-12-26T08:39:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,314
java
/* */ package com.newrelic.org.dom4j.io; /* */ /* */ import com.newrelic.org.dom4j.Element; /* */ import com.newrelic.org.dom4j.ElementHandler; /* */ import com.newrelic.org.dom4j.ElementPath; /* */ /* */ class ElementStack /* */ implements ElementPath /* */ { /* */ protected Element[] stack; /* 30 */ protected int lastElementIndex = -1; /* */ /* 32 */ private DispatchHandler handler = null; /* */ /* */ public ElementStack() { /* 35 */ this(50); /* */ } /* */ /* */ public ElementStack(int defaultCapacity) { /* 39 */ this.stack = new Element[defaultCapacity]; /* */ } /* */ /* */ public void setDispatchHandler(DispatchHandler dispatchHandler) { /* 43 */ this.handler = dispatchHandler; /* */ } /* */ /* */ public DispatchHandler getDispatchHandler() { /* 47 */ return this.handler; /* */ } /* */ /* */ public void clear() /* */ { /* 55 */ this.lastElementIndex = -1; /* */ } /* */ /* */ public Element peekElement() /* */ { /* 65 */ if (this.lastElementIndex < 0) { /* 66 */ return null; /* */ } /* */ /* 69 */ return this.stack[this.lastElementIndex]; /* */ } /* */ /* */ public Element popElement() /* */ { /* 78 */ if (this.lastElementIndex < 0) { /* 79 */ return null; /* */ } /* */ /* 82 */ return this.stack[(this.lastElementIndex--)]; /* */ } /* */ /* */ public void pushElement(Element element) /* */ { /* 92 */ int length = this.stack.length; /* */ /* 94 */ if (++this.lastElementIndex >= length) { /* 95 */ reallocate(length * 2); /* */ } /* */ /* 98 */ this.stack[this.lastElementIndex] = element; /* */ } /* */ /* */ protected void reallocate(int size) /* */ { /* 108 */ Element[] oldStack = this.stack; /* 109 */ this.stack = new Element[size]; /* 110 */ System.arraycopy(oldStack, 0, this.stack, 0, oldStack.length); /* */ } /* */ /* */ public int size() /* */ { /* 116 */ return this.lastElementIndex + 1; /* */ } /* */ /* */ public Element getElement(int depth) /* */ { /* */ Element element; /* */ try { /* 123 */ element = this.stack[depth]; /* */ } /* */ catch (ArrayIndexOutOfBoundsException e) /* */ { /* */ Element element; /* 125 */ element = null; /* */ } /* */ /* 128 */ return element; /* */ } /* */ /* */ public String getPath() { /* 132 */ if (this.handler == null) { /* 133 */ setDispatchHandler(new DispatchHandler()); /* */ } /* */ /* 136 */ return this.handler.getPath(); /* */ } /* */ /* */ public Element getCurrent() { /* 140 */ return peekElement(); /* */ } /* */ /* */ public void addHandler(String path, ElementHandler elementHandler) { /* 144 */ this.handler.addHandler(getHandlerPath(path), elementHandler); /* */ } /* */ /* */ public void removeHandler(String path) { /* 148 */ this.handler.removeHandler(getHandlerPath(path)); /* */ } /* */ /* */ public boolean containsHandler(String path) /* */ { /* 161 */ return this.handler.containsHandler(path); /* */ } /* */ /* */ private String getHandlerPath(String path) /* */ { /* 167 */ if (this.handler == null) /* 168 */ setDispatchHandler(new DispatchHandler()); /* */ String handlerPath; /* */ String handlerPath; /* 171 */ if (path.startsWith("/")) { /* 172 */ handlerPath = path; /* */ } /* */ else /* */ { /* */ String handlerPath; /* 173 */ if (getPath().equals("/")) /* 174 */ handlerPath = getPath() + path; /* */ else { /* 176 */ handlerPath = getPath() + "/" + path; /* */ } /* */ } /* 179 */ return handlerPath; /* */ } /* */ } /* Location: /home/think/Downloads/newrelic-android-4.120.0/lib/class.rewriter.jar * Qualified Name: com.newrelic.org.dom4j.io.ElementStack * JD-Core Version: 0.6.2 */
[ "hongqing.chen@gmail.com" ]
hongqing.chen@gmail.com
d4212aa97ec0f93e3b87660fded130be4e1a96d8
a4b307d4947096ee6f935935e5eb9900d349a5b7
/JToy-JAXWSwithCDI/src/main/java/name/paulevans/samplecodeprojects/command/client/ClientCommandFactory.java
a6478e2a88e7cf7f1cf8894643d657f4ed25fc2a
[]
no_license
evanspa/Java-Toys
9db81e5d71532171daccdbdfe59ae48bbc58a224
0614c268fe4e3a88ebd0b5b8f04affb58402577f
refs/heads/master
2021-01-21T23:04:38.438072
2015-02-06T05:17:36
2015-02-06T05:17:36
7,048,701
0
0
null
null
null
null
UTF-8
Java
false
false
1,020
java
package name.paulevans.samplecodeprojects.command.client; import name.paulevans.samplecodeprojects.command.client.clientcmds.CalculateOrderSubTotalCommand; import name.paulevans.samplecodeprojects.command.client.cmddelegate.ClientCommandDelegateFactory; /** * <p>Simple client command factory class</p> * * @author Paul R Evans * @version $Id$ * */ public class ClientCommandFactory { /** * <p>Creates a new 'calculate order sub-total' client command.</p> * * @return a new 'calculate order sub-total' client command object */ public static final CalculateOrderSubTotalCommand newCalculateOrderSubTotalCommand() { CalculateOrderSubTotalCommand command; // create the client command instance... command = new CalculateOrderSubTotalCommand(); // set a client command delegate... command.setClientCommandDelegate(ClientCommandDelegateFactory. newXmlWsInvokerCommandDelegate_withJaxWs_and_Castor()); // return it! return command; } }
[ "evansp2@gmail.com" ]
evansp2@gmail.com
2812835dd74bb95774e87bac8d2d9cc550a5d905
0cc6e6c16bf427ca9afba6b835d1eb406702e8c8
/Data/dist/game/data/scripts/quests/Q00088_SagaOfTheArchmage/SagaOfTheArchmage.java
2e406dc9fe75d9b59ec2778563366b640589e8dc
[]
no_license
Kryspo/blaion
a19087d1533d763d977d4dcc8235a2d1a61890b8
7e34627b01f30aacc290b87e1ad69e81b9e9cc33
refs/heads/master
2020-03-21T15:01:15.618199
2018-06-28T07:35:50
2018-06-28T07:35:50
138,689,668
1
0
null
null
null
null
UTF-8
Java
false
false
2,861
java
/* * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package quests.Q00088_SagaOfTheArchmage; import quests.SagasScripts.SagasSuperClass; /** * @author Emperorc */ public class SagaOfTheArchmage extends SagasSuperClass { public static String qn1 = "Q00088_SagaOfTheArchmage"; public static int qnu = 88; public static String qna = "Saga of the Archmage"; public SagaOfTheArchmage() { super(qnu, qn1, qna); NPC = new int[] { 30176, 31627, 31282, 31282, 31590, 31646, 31647, 31650, 31654, 31655, 31657, 31282 }; Items = new int[] { 7080, 7529, 7081, 7503, 7286, 7317, 7348, 7379, 7410, 7441, 7082, 0 }; Mob = new int[] { 27250, 27237, 27254 }; qn = qn1; classid = new int[] { 94 }; prevclass = new int[] { 0x0c }; X = new int[] { 191046, 46066, 46087 }; Y = new int[] { -40640, -36396, -36372 }; Z = new int[] { -3042, -1685, -1685 }; Text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", "Paying homage to those who disrupt the orderly will be PLAYERNAME's death!", "Now, my soul freed from the shackles of the millennium, Halixia, to the back side I come ...", "Why do you interfere others' battles?", "This is a waste of time.. Say goodbye...!", "...That is the enemy", "...Goodness! PLAYERNAME you are still looking?", "PLAYERNAME ... Not just to whom the victory. Only personnel involved in the fighting are eligible to share in the victory.", "Your sword is not an ornament. Don't you think, PLAYERNAME?", "Goodness! I no longer sense a battle there now.", "let...", "Only engaged in the battle to bar their choice. Perhaps you should regret.", "The human nation was foolish to try and fight a giant's strength.", "Must...Retreat... Too...Strong.", "PLAYERNAME. Defeat...by...retaining...and...Mo...Hacker", "....! Fight...Defeat...It...Fight...Defeat...It..." }; registerNPCs(); } }
[ "cristianleon48@gmail.com" ]
cristianleon48@gmail.com
af7222655fb02923ee9aef7aaedb1005e304c484
856623c5f75d4ced82cc0979427d2cb080676e09
/androidGssms/src/net/evecom/android/web/Web4Activity.java
fcce7b77730f6ee8188f8db59a91f9528fdcba30
[]
no_license
marszhanglin/android_gssms
6eb5937ede938f4aa7f2f69fd4cfae664fbf1fbd
e29a168d76c863f86a2f9e46ac5cfac1a0bb3b0f
refs/heads/master
2021-01-10T07:17:25.283899
2015-05-30T12:18:21
2015-05-30T12:25:15
36,556,524
0
0
null
null
null
null
GB18030
Java
false
false
29,683
java
/* * Copyright (c) 2005, 2014, EVECOM Technology Co.,Ltd. All rights reserved. * EVECOM PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * */ package net.evecom.android.web; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URLDecoder; import net.evecom.android.R; import net.evecom.android.util.HttpUtil; import net.evecom.android.util.ShareUtil; import net.tsz.afinal.FinalHttp; import net.tsz.afinal.http.AjaxCallBack; import net.tsz.afinal.http.HttpHandler; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EncodingUtils; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnDismissListener; import android.content.DialogInterface.OnKeyListener; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.os.Message; import android.util.DisplayMetrics; import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; import android.webkit.DownloadListener; import android.webkit.GeolocationPermissions; import android.webkit.JsPromptResult; import android.webkit.JsResult; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebSettings.ZoomDensity; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; /** * MessagePostWebActivity * * @author Mars zhang * */ public class Web4Activity extends Activity { /** MemberVariables */ private WebView webView; /** MemberVariables */ ProgressDialog dialog = null; /** MemberVariables */ protected Context mContext; /** 分页 */ private String temp = "15"; /** 进度提示框 */ private AlertDialog dialogPress; /** 图片 */ private ImageView imageView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; temp = HttpUtil.getPageSize(this); setContentView(R.layout.message_post_web); imageView = (ImageView) findViewById(R.id.image_view_at_web); webView = (WebView) this.findViewById(R.id.wv_oauth_message); CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().removeSessionCookie(); /** * 设置WebView的属性,此时可以去执行JavaScript脚本 */ webView.getSettings().setJavaScriptEnabled(true); /** * 调用loadUrl()方法进行加载内容 */ webView.setWebViewClient(new HelloWebViewClient()); dialog = ProgressDialog.show(Web4Activity.this, null, "正在获取,请稍后.."); dialog.setCancelable(true); // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1 // webView.loadUrl("http://www.baidu.com"); // String url = HttpUtil.BASE_PC_URL // + "/buildingController/login"; http://harlan-pc/gssms/mobile/ // String url // =HttpUtil.BASE_PC_URL+"loginController/professionalJobLogin"; String url = HttpUtil.BASE_PC_URL + "mobile/loginController/professionalJobLogin"; // post访问需要提交的参数 // String postDate = "loginname=sysadmin&pwd=888888"; String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "") + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize=" + temp; // 由于webView.postUrl(url, postData)中 postData类型为byte[] , // 通过EncodingUtils.getBytes(data, charset)方法进行转换 webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64")); // 调用自定义的下载监听 webView.setDownloadListener(new MyWebViewDownLoadListener()); WebSettings webSettings = webView.getSettings(); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true);// support zoom // webSettings.setPluginsEnabled(true);//support flash webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); // webSettings.setPluginsEnabled(true); //为了视频播放(flash好像没有用了) /** 百度地图 */ // //启用数据库 webSettings.setDatabaseEnabled(true); String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); // 启用地理定位 webSettings.setGeolocationEnabled(true); // 设置定位的数据库路径 webSettings.setGeolocationDatabasePath(dir); // 最重要的方法,一定要设置,这就是出不来的主要原因 webSettings.setDomStorageEnabled(true); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int mDensity = metrics.densityDpi; // DebugLog.d(TAG, "densityDpi = " + mDensity); if (mDensity == 240) { webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == 160) { webSettings.setDefaultZoom(ZoomDensity.MEDIUM); } else if (mDensity == 120) { webSettings.setDefaultZoom(ZoomDensity.CLOSE); // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){ // webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == DisplayMetrics.DENSITY_HIGH) { webSettings.setDefaultZoom(ZoomDensity.FAR); } webView.setWebChromeClient(m_chromeClient);// 为了视频播放(flash好像没有用了) dialogPress = new AlertDialog.Builder(this).setTitle("正在下载文件").setMessage("下载进度:0/0") .setPositiveButton("确定", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); } /** MemberVariables */ private WebChromeClient m_chromeClient = new WebChromeClient() { @Override public void onShowCustomView(View view, CustomViewCallback callback) { } @Override public void onCloseWindow(WebView window) { super.onCloseWindow(window); } @Override public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, Message resultMsg) { return super.onCreateWindow(view, dialog, userGesture, resultMsg); } /** * 覆盖默认的window.alert展示界面,避免title里显示为“:来自file:////” */ public boolean onJsAlert(WebView view, String url, String message, JsResult result) { final AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setTitle("提示").setIcon(R.drawable.qq_dialog_default_icon).setMessage(message) .setPositiveButton("确定", null); // 不需要绑定按键事件 // 屏蔽keycode等于84之类的按键 builder.setOnKeyListener(new OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { Log.v("onJsAlert", "keyCode==" + keyCode + "event=" + event); return true; } }); // 禁止响应按back键的事件 builder.setCancelable(false); AlertDialog dialog = builder.create(); dialog.show(); result.confirm();// 因为没有绑定事件,需要强行confirm,否则页面会变黑显示不了内容。 return true; // return super.onJsAlert(view, url, message, result); } public boolean onJsBeforeUnload(WebView view, String url, String message, JsResult result) { return super.onJsBeforeUnload(view, url, message, result); } /** * 覆盖默认的window.confirm展示界面,避免title里显示为“:来自file:////” */ public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) { final AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setTitle("提示").setIcon(R.drawable.qq_dialog_default_icon).setMessage(message) .setPositiveButton("确定", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.confirm(); } }).setNeutralButton("取消", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.cancel(); } }); builder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { result.cancel(); } }); // 屏蔽keycode等于84之类的按键,避免按键后导致对话框消息而页面无法再弹出对话框的问题 builder.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { Log.v("onJsConfirm", "keyCode==" + keyCode + "event=" + event); return true; } }); // 禁止响应按back键的事件 // builder.setCancelable(false); AlertDialog dialog = builder.create(); dialog.show(); return true; // return super.onJsConfirm(view, url, message, result); } /** * 覆盖默认的window.prompt展示界面,避免title里显示为“:来自file:////” * window.prompt('请输入您的域名地址', '618119.com'); */ public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, final JsPromptResult result) { final AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setTitle("提示").setMessage(message); builder.setIcon(R.drawable.qq_dialog_default_icon); final EditText et = new EditText(view.getContext()); et.setSingleLine(); et.setText(defaultValue); builder.setView(et).setPositiveButton("确定", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.confirm(et.getText().toString()); } }).setNeutralButton("取消", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.cancel(); } }); // 屏蔽keycode等于84之类的按键,避免按键后导致对话框消息而页面无法再弹出对话框的问题 builder.setOnKeyListener(new OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { return true; } }); // 禁止响应按back键的事件 // builder.setCancelable(false); AlertDialog dialog = builder.create(); dialog.show(); return true; // return super.onJsPrompt(view, url, message, defaultValue, // result); } @Override public void onProgressChanged(WebView view, int newProgress) { super.onProgressChanged(view, newProgress); } @Override public void onReceivedIcon(WebView view, Bitmap icon) { super.onReceivedIcon(view, icon); } @Override public void onReceivedTitle(WebView view, String title) { super.onReceivedTitle(view, title); } @Override public void onRequestFocus(WebView view) { super.onRequestFocus(view); } /** * 百度地图配置权限(同样在WebChromeClient中实现) */ public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); super.onGeolocationPermissionsShowPrompt(origin, callback); } }; /** * HelloWebViewClient * * @author Mars zhang * */ private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { view.setVisibility(View.INVISIBLE); super.onPageStarted(view, url, favicon); } @Override public void onPageFinished(WebView view, String url) { view.setVisibility(View.VISIBLE); if (dialog != null) dialog.dismiss(); } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { if (dialog != null) dialog.dismiss(); view.clearView(); view.setVisibility(View.GONE); imageView.setVisibility(View.VISIBLE); // view.setVisibility(View.GONE); System.out.println(errorCode + " errorCode "); if (errorCode == -6) { try { view.stopLoading(); } catch (Exception e) { } try { view.clearView(); } catch (Exception e) { } if (view.canGoBack()) { view.goBack(); } } else if (errorCode == -2) { System.out.println("404------------"); try { view.stopLoading(); view.destroy(); } catch (Exception e) { } try { view.clearView(); } catch (Exception e) { } if (view.canGoBack()) { view.goBack(); } } // Toast.makeText(And_meetActivity.this,errorCode+ // "网络延迟,请重新尝试!"+description, Toast.LENGTH_SHORT).show(); Toast.makeText(Web4Activity.this, "网络延迟,请重新尝试!", Toast.LENGTH_SHORT).show(); // Toast.makeText(And_meetActivity.this, "网络延迟,请重新尝试!", // Toast.LENGTH_LONG); } } // @Override // protected Dialog onCreateDialog(int id) { // if (id == PROGRESS_ID) { // return ProgressDialog.show(mContext, "正在请求数据", "正在获取服务器数据,请稍后.."); // } // return super.onCreateDialog(id); // } // 下面代码没有添加,在我的手机里也隐藏地址栏了,但是有的设备可能还要加这些 @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if ((keyCode == KeyEvent.KEYCODE_BACK)) { // webView.goBack(); if (dialog != null) dialog.dismiss(); // finish(); return true; } return super.onKeyDown(keyCode, event); } /** * 返回首页 * * @param v */ public void message_post_web_tomain(View v) { AlertDialog.Builder builder1 = new AlertDialog.Builder(Web4Activity.this); builder1.setTitle("提示信息"); builder1.setIcon(R.drawable.qq_dialog_default_icon);// 图标 builder1.setMessage("是否确定要返回首页?"); builder1.setPositiveButton("确定", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder1.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); } // 内部类 /** * * 2014-7-22下午5:18:50 类MyWebViewDownLoadListener * * @author Mars zhang * */ private class MyWebViewDownLoadListener implements DownloadListener { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { Toast t = Toast.makeText(mContext, "需要SD卡。", Toast.LENGTH_LONG); t.setGravity(Gravity.CENTER, 0, 0); t.show(); return; } // downLoadApk(url); // FinalHttp fh = new FinalHttp(); // //调用download方法开始下载 // HttpHandler handler = // fh.download("http://www.xxx.com/下载路径/xxx.apk", //这里是下载的路径 // "/mnt/sdcard/testapk.apk", //这是保存到本地的路径 // new AjaxCallBack() { // @Override // public void onLoading(long count, long current) { // System.out.println("下载进度:"+current+"/"+count); // } // // public void onSuccess(File t) { // textView.setText(t==null?"null":t.getAbsoluteFile().toString()); // } // }); // //调用stop()方法停止下载 // handler.stop(); System.out.println(url); DownloaderTask task = new DownloaderTask(); task.execute(url); } } /** 判断并下载文件 */ private void downLoadApk(String url) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {// 判断是否有SD卡 FinalHttp fh = new FinalHttp(); // HttpClient client=fh.getHttpClient(); // client.getParams().setIntParameter("http.socket.timeout",10000); // 创建一个临时文件 File clear_temp = new File(Environment.getExternalStorageDirectory(), "temp.pdf"); deleteFile(clear_temp); File temp = new File(Environment.getExternalStorageDirectory(), "temp.pdf"); dialogPress.show(); // 调用download方法开始下载 HttpHandler handler1 = fh.download(url, // 这里是下载的路径 // temp.getAbsolutePath(), // 这是保存到本地的路径 Environment.getExternalStorageDirectory().getAbsolutePath(), false, // true:断点续传 // false:不断点续传(全新下载) new AjaxCallBack<File>() { @Override public void onLoading(long count, long current) {// 每秒回调一次 System.out.println(current + "/" + count); dialogPress.setMessage("下载进度:" + current / 1024 + "k/" + count / 1024 + "k"); super.onLoading(count, current); } @Override public void onFailure(Throwable t, int errorNo, String strMsg) { dialogPress.dismiss(); super.onFailure(t, errorNo, strMsg); } @Override public void onSuccess(File t) { System.out.println(t == null ? "null" : t.getAbsoluteFile().toString() + "下载成功"); dialogPress.dismiss(); } }); } else { toast("没有SD卡更新失败"); } } /** 土司 */ private void toast(String strMsg) { Toast.makeText(getApplicationContext(), strMsg, 0).show(); } /** 删除文件 */ public void deleteFile(File file) { if (file.exists()) { // 判断文件是否存在 if (file.isFile()) { // 判断是否是文件 file.delete(); // delete()方法 你应该知道 是删除的意思; System.out.println("file.delete();"); } else if (file.isDirectory()) { // 否则如果它是一个目录 File files[] = file.listFiles(); // 声明目录下所有的文件 files[]; for (int i = 0; i < files.length; i++) { // 遍历目录下所有的文件 this.deleteFile(files[i]); // 把每个文件 用这个方法进行迭代 } } file.delete(); System.out.println("file.delete();"); } else { System.out.println("文件不存在。。"); } } // 内部类 /** * * 2014-7-22下午5:18:40 类DownloaderTask * * @author Mars zhang * */ private class DownloaderTask extends AsyncTask<String, Void, String> { public DownloaderTask() { } @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub String url = params[0]; // Log.i("tag", "url="+url); String fileName = url.substring(url.lastIndexOf("/") + 1); fileName = URLDecoder.decode(fileName); Log.i("tag", "fileName=" + fileName); File directory = Environment.getExternalStorageDirectory(); File file = new File(directory, fileName); if (file.exists()) { Log.i("tag", "The file has already exists."); return fileName; } try { HttpClient client = new DefaultHttpClient(); client.getParams().setIntParameter("http.socket.timeout", 10000);// 设置超时 HttpGet get = new HttpGet(url); HttpResponse response = client.execute(get); if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode()) { HttpEntity entity = response.getEntity(); InputStream input = entity.getContent(); writeToSDCard(fileName, input); input.close(); // entity.consumeContent(); return fileName; } else { return null; } } catch (Exception e) { e.printStackTrace(); return null; } } @Override protected void onCancelled() { // TODO Auto-generated method stub super.onCancelled(); } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); closeProgressDialog(); if (result == null) { Toast t = Toast.makeText(mContext, "连接错误!请稍后再试!", Toast.LENGTH_LONG); t.setGravity(Gravity.CENTER, 0, 0); t.show(); return; } Toast t = Toast.makeText(mContext, "已保存到SD卡。", Toast.LENGTH_LONG); t.setGravity(Gravity.CENTER, 0, 0); t.show(); File directory = Environment.getExternalStorageDirectory(); File file = new File(directory, result); Log.i("tag", "Path=" + file.getAbsolutePath()); Intent intent = getFileIntent(file); startActivity(intent); } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); showProgressDialog(); } @Override protected void onProgressUpdate(Void... values) { // TODO Auto-generated method stub super.onProgressUpdate(values); } } /** MemberVariables */ private ProgressDialog mDialog; private void showProgressDialog() { if (mDialog == null) { mDialog = new ProgressDialog(mContext); mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);// 设置风格为圆形进度条 mDialog.setMessage("正在加载 ,请等待..."); mDialog.setIndeterminate(false);// 设置进度条是否为不明确 mDialog.setCancelable(true);// 设置进度条是否可以按退回键取消 mDialog.setCanceledOnTouchOutside(false); mDialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { // TODO Auto-generated method stub mDialog = null; } }); mDialog.show(); } } private void closeProgressDialog() { if (mDialog != null) { mDialog.dismiss(); mDialog = null; } } public Intent getFileIntent(File file) { // Uri uri = Uri.parse("http://m.ql18.com.cn/hpf10/1.pdf"); Uri uri = Uri.fromFile(file); String type = getMIMEType(file); Log.i("tag", "type=" + type); Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(uri, type); return intent; } public void writeToSDCard(String fileName, InputStream input) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { File directory = Environment.getExternalStorageDirectory(); File file = new File(directory, fileName); // if(file.exists()){ // Log.i("tag", "The file has already exists."); // return; // } try { FileOutputStream fos = new FileOutputStream(file); byte[] b = new byte[2048]; int j = 0; while ((j = input.read(b)) != -1) { fos.write(b, 0, j); } fos.flush(); fos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Log.i("tag", "NO SDCard."); } } private String getMIMEType(File f) { String type = ""; String fName = f.getName(); /* 取得扩展名 */ String end = fName.substring(fName.lastIndexOf(".") + 1, fName.length()).toLowerCase(); /* 依扩展名的类型决定MimeType */ if (end.equals("pdf")) { type = "application/pdf";// } else if (end.equals("m4a") || end.equals("mp3") || end.equals("mid") || end.equals("xmf") || end.equals("ogg") || end.equals("wav")) { type = "audio/*"; } else if (end.equals("3gp") || end.equals("mp4")) { type = "video/*"; } else if (end.equals("jpg") || end.equals("gif") || end.equals("png") || end.equals("jpeg") || end.equals("bmp")) { type = "image/*"; } else if (end.equals("apk")) { /* android.permission.INSTALL_PACKAGES */ type = "application/vnd.android.package-archive"; } // else if(end.equals("pptx")||end.equals("ppt")){ // type = "application/vnd.ms-powerpoint"; // }else if(end.equals("docx")||end.equals("doc")){ // type = "application/vnd.ms-word"; // }else if(end.equals("xlsx")||end.equals("xls")){ // type = "application/vnd.ms-excel"; // } else { // /*如果无法直接打开,就跳出软件列表给用户选择 */ type = "*/*"; } return type; } }
[ "780965203@qq.com" ]
780965203@qq.com
a11f88604a981671d73175695e7a7f05fb84e5c4
6254347eaf4e96dc77e69820bef34df0eaf2d906
/emp4j/tags/V_1_0_2/src/test/java/org/pdfsam/emp4j/exceptions/ClassNameKeyExceptionTest.java
339fbbe978985c8a5de0dcc3987b7987f8594c10
[]
no_license
winsonrich/pdfsam-v2
9044913b14ec2e0c33801a77fbbc696367a8f587
0c7cc6dfeee88d1660e30ed53c7d09d40bf986aa
refs/heads/master
2020-04-02T16:20:17.751695
2018-12-07T14:52:22
2018-12-07T14:52:22
154,608,091
0
0
null
2018-10-25T04:03:03
2018-10-25T04:03:03
null
UTF-8
Java
false
false
750
java
package org.pdfsam.emp4j.exceptions; import junit.framework.Assert; import org.junit.Test; /** * Test unit for the ClassNameKeyException * @author Andrea Vacondio * */ public class ClassNameKeyExceptionTest { @Test public void messageTest(){ try { throw new ClassNameKeyException(1); } catch (ClassNameKeyException e) { Assert.assertEquals("TEST001 - Unknown exception.", e.getMessage()); } try { throw new ClassNameKeyException(2, new String[]{"Test"}); } catch (ClassNameKeyException e) { Assert.assertEquals("TEST002 - Unknown exception Test.", e.getMessage()); } try { throw new ClassNameKeyException(3); } catch (ClassNameKeyException e) { Assert.assertEquals("TEST003 - ", e.getMessage()); } } }
[ "torakiki@2703fb93-1e26-0410-8fff-b03f68e33ab9" ]
torakiki@2703fb93-1e26-0410-8fff-b03f68e33ab9
97dd6c68feb19d02bce9ef006c3c71f1aee72bdc
d7a370853e3e45e589bf85a216ca3338f7230242
/books/src/main/java/com/capgemini/books/exceptions/BookNameCannotBeNullException.java
171f9d6b7e6a9aa15dacd395918bc3984a07f837
[]
no_license
RajarshiBhattacharya-JA-17/JA-17-Lab-and-Assignments
9b2a9510da8c86695cb5cd807b2bf1e5a43a7bc4
89efa6dca470bede26a1c372a1ef78829ed65800
refs/heads/main
2023-05-31T08:09:03.945930
2021-06-15T03:51:29
2021-06-15T03:51:29
366,979,803
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
/** * */ package com.capgemini.books.exceptions; /** * @author The Wonder Land * */ public class BookNameCannotBeNullException extends Exception { /** * */ private static final long serialVersionUID = -7829239011941095999L; public BookNameCannotBeNullException(String msg) { super(msg); } }
[ "noreply@github.com" ]
noreply@github.com