blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
af3aa30bc67d15f3dd1b25a3aa2611ce9b612a06
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5744014401732608_0/java/teacup123123/ProbB.java
de28a68045277870bb0d12e6867e18031823ff6a
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Java
false
false
1,543
java
package jamC; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; public class ProbB extends Prob{ public static void main(String[] args) { System.out.println((int)'A'); ProbB pa= new ProbB(); pa.fromFile("C:\\Users\\tchang\\Downloads\\B-small-attempt3.in"); } @Override public void load(BufferedReader br,BufferedWriter bw) { try{ int T=Integer.parseInt(br.readLine()); for(int cas=0;cas<T;cas++) { String ans="",line[]=br.readLine().split(" "),possibilityStr=""; int B=Integer.parseInt(line[0]); int M=Integer.parseInt(line[1]); String binStr=Integer.toBinaryString(M); binStr=new StringBuilder(binStr).reverse().toString(); boolean possib=binStr.length()<B-1||M==Math.pow(2, B-2); possibilityStr=(possib)?"POSSIBLE":"IMPOSSIBLE"; int mat[][]=new int[B][B];//i j if(possib) { for(int jj=0;jj<B-1;jj++) { for (int i=0;i<jj;i++) mat[i][jj]=1; } if(M==Math.pow(2, B-2)) for(int i=0;i<B-1;i++) mat[i][B-1]=1; else for(int i=0;i<binStr.length();i++) { mat[i+1][B-1]=Integer.parseInt(""+binStr.charAt(i)); } } bw.write("Case #"+(cas+1)+": "+possibilityStr); bw.newLine(); if(possib) { for(int i =0;i<B;i++) { for(int j =0;j<B;j++) bw.write(""+mat[i][j]); bw.newLine(); } } } } catch (IOException e) { e.printStackTrace(); } } }
[ "alexandra1.back@gmail.com" ]
alexandra1.back@gmail.com
fc7e5a64f1faa3c8c0d9f799e653669f75488481
f2b368d5ee63bdefedff52b3b8e243d891064654
/validate-demo/src/main/java/cn/lvhaosir/demos/validate/config/ListInValues.java
2ff74b176d6c1136b048939dcca41d4b2837017d
[]
no_license
lvhaosir6/demos
80ca797526d0229b47ab809c12911c633fdf1f8c
1a0deee3b9e068a5ed30c40419f844525e652d58
refs/heads/main
2023-01-13T16:42:31.686040
2020-11-19T11:25:33
2020-11-19T11:25:33
313,881,460
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
package cn.lvhaosir.demos.validate.config; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.*; import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * <p>ListInValues</p> * 自定义的校验注解 * @author lvhaosir6 * @version 1.0.0 * @date 2020/11/19 */ @Documented // 可以指定多个不同的校验器 @Constraint(validatedBy = {ListInValuesValiadator.class}) @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE}) @Retention(RUNTIME) public @interface ListInValues { // 默认提示值可自定义,词条文件:ValidationMessages.properties String message() default "{javax.validation.constraints.NotBlank.message}"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; int[] values() default {}; }
[ "lvhao@umeox.com" ]
lvhao@umeox.com
a953cc34386f22af8ed6d6cae35b77881596e740
486c8debb0279008e0e9a40185629f3affa4db89
/guns/guns-film/src/main/java/com/stylefeng/guns/rest/common/persistence/model/Info4.java
ccf4b13cb1efa3fda555eb352381ba82d6d7b832
[ "Apache-2.0" ]
permissive
residentOfTouHou/project3_microservice
52be1c7fac4fa7bd7448c763daf0dff7be72a5c3
dcdd1a13461b76a405080f95dfe4d94aeb29bf8e
refs/heads/master
2022-06-23T09:05:08.505841
2019-12-04T09:56:21
2019-12-04T09:56:21
224,431,762
0
0
null
2022-05-20T21:17:44
2019-11-27T12:58:51
Java
UTF-8
Java
false
false
333
java
package com.stylefeng.guns.rest.common.persistence.model; import lombok.Data; import java.io.Serializable; @Data public class Info4 implements Serializable { private static final long serialVersionUID = -524825176943056530L; private ActorsAndDirector actors; String biopgraphy; Integer filmId; ImgVO imgVO; }
[ "331479296@qq.com" ]
331479296@qq.com
f2969dee4f4e8fa5c3417fdd6ed3aacdeeb9a84c
684b134f7b9f84de552bbc95dfccbeef8182b5a0
/src/com/jxwz/dao/SectionDao.java
89368180730e60e1f28ae9ad9dd020a7c7746e3e
[]
no_license
imnot70/jxwz_new
bffc848397983fddb14e2d7eea93d0a8b5d1ce23
96e259b66954d59b7d41444a266c5d58fe4b2989
refs/heads/master
2020-03-12T03:36:01.503662
2018-05-19T12:13:00
2018-05-19T12:13:00
130,427,553
0
0
null
null
null
null
UTF-8
Java
false
false
685
java
package com.jxwz.dao; import java.util.List; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Repository; import com.jxwz.entity.Section; import com.jxwz.util.Constants; @Repository public class SectionDao extends BaseDao<Section> { public List<Section> findSectionsByChapterId(Long id) { DetachedCriteria criteria = DetachedCriteria.forClass(Section.class); criteria.add(Restrictions.eq("status",Constants.STATUS_ENABLE)); criteria.add(Restrictions.eq("chapter.id",id)); criteria.addOrder(Order.asc("sort")); return findByCriteria(criteria); } }
[ "754192687@qq.com" ]
754192687@qq.com
fea2f3c64aea7b0089deface68958ba4a91d6e8c
eee52ee77456151834b330434a27bef9317217eb
/database/merise/src/exercice4_video_club/objects/customer.java
c6030c146e2bc0fa170a36825660464b45547fa7
[]
no_license
FTurleque/abc_2105-perso
ad1879f5adcb2b7d07a06646b405531745392123
0d599024f29f2a71b71586b7cfd3f9e5f8366093
refs/heads/main
2023-08-22T04:42:15.723370
2021-10-14T09:16:36
2021-10-14T09:16:36
374,582,238
0
0
null
null
null
null
UTF-8
Java
false
false
62
java
package exercice4_video_club; public class customer { }
[ "57303912+FTurleque@users.noreply.github.com" ]
57303912+FTurleque@users.noreply.github.com
cd7e41f179ce02908bb7b95958d2a8e343716fe7
ae626c427c065a3aeb49b144ef484dd36cc475d8
/RemusiX-master/app/src/main/java/song.java
99adb9bc6452b3934dfdab51c9de24b718d38b41
[]
no_license
AhmedAdelSelim/RemusiX
e77264941260f153c11fbe0239a73b849a97d29f
fe00afe2e0f878a23d23be5fdf85ee67ff6d5b01
refs/heads/master
2020-05-09T11:21:37.404965
2019-04-06T16:14:17
2019-04-06T16:14:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
637
java
public class song { private int img; private String singer; private String title; public song(int img, String singer, String title) { this.img = img; this.singer = singer; this.title = title; } public int getImg() { return img; } public void setImg(int img) { this.img = img; } public String getSinger() { return singer; } public void setSinger(String singer) { this.singer = singer; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }
[ "bestintheworld728@yahoo.com" ]
bestintheworld728@yahoo.com
3e876e0ccef1b0d8fd96603a8182b45ee7df6d60
d32489a764ae2ee1c2d6aba618fb88a6a8953b6b
/01_Projet_Agence_BoVoyage/src/main/java/fr/adaming/controllers/test.java
3d7465de4d1c9eb90da6fbbbada5d623beb1d350
[]
no_license
AgenceVoyage/Projet_Agence_Voyage
b05c222d59008c7f0f6fbc20e2e8cefb28811a7f
a21cd2f368eab9a8b932c4974abd8b318c45cc82
refs/heads/master
2021-04-30T15:22:43.214356
2018-02-16T14:17:10
2018-02-16T14:17:10
121,237,655
0
0
null
null
null
null
UTF-8
Java
false
false
61
java
package fr.adaming.controllers; public class test { }
[ "inti-0265@192.168.1.170" ]
inti-0265@192.168.1.170
c35d729b24059d245466b16b58d6fd95e6c2989a
659defc8ffdcd225c79857d2dde855c8e82fa111
/app/src/main/java/com/mb/android/nzbAirPremium/ui/helper/FormatHelper.java
08e3c47a05805abf20537b230a64b0db458159bc
[]
no_license
milesburton/nzbair
72eab64eb0ae8863ed61de5144bb916d4c90edc2
18c785538c71dcb0d4bf54260ffba6752f7956e0
refs/heads/master
2021-08-31T23:14:04.924129
2017-12-23T10:56:31
2017-12-23T10:56:31
115,188,847
0
0
null
null
null
null
UTF-8
Java
false
false
1,188
java
package com.mb.android.nzbAirPremium.ui.helper; import java.text.NumberFormat; public class FormatHelper { private static NumberFormat nf = NumberFormat.getInstance(); public static String formatFileSize(double sizeInMb) { if (sizeInMb <= 0) { return "0 MB"; } final double r = sizeInMb / 1024; String qual = " MB"; if (r >= 1) { sizeInMb = r; qual = " GB"; } nf.setMaximumFractionDigits(2); return nf.format(sizeInMb) + qual; } public static String formatFileSizeBytes(double sizeInBytes) { String sizeType = " B"; if (sizeInBytes > 0) { sizeInBytes = sizeInBytes / 1024;// Kilobytes if (sizeInBytes > 1024) // Is greater than 1MB { sizeInBytes /= 1024; // In megabytes if (sizeInBytes > 1024) { // Is greater than 1GB // Gigabytes sizeType = " GB"; sizeInBytes /= 1024; // In megabytes } else { sizeType = " MB"; } } else { sizeType = " KB"; } } final NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(2); return nf.format(sizeInBytes) + sizeType; } public static NumberFormat getNumberFormatter() { nf.setMaximumFractionDigits(2); return nf; } }
[ "miles.burton@agileview.co.uk" ]
miles.burton@agileview.co.uk
99bfc9ea2aa935b8aa4456868e682d3af8ed1be7
18adf160de1a894491893c2a125938f11d1d68cf
/app/src/main/java/com/app/newsfeed/model/pojo/BasePojo.java
053559e688efe4724beb7f602090f3ad77540dea
[]
no_license
Sunny1989/NewsFeed
1fa420d2e7f761226240642a6cefd6660903db8d
74588eb1b1ee25bd27cc7fc190c0d80e623d20ba
refs/heads/master
2020-04-17T10:29:52.578476
2019-01-19T03:55:52
2019-01-19T03:55:52
166,503,399
0
0
null
null
null
null
UTF-8
Java
false
false
122
java
package com.app.newsfeed.model.pojo; public class BasePojo { public String totalResults; public String status; }
[ "sumeetchawla89@gmail.com" ]
sumeetchawla89@gmail.com
fb0d58ee21b77bccb62a37a5f61db2d54125bfad
00e21b78a75ea92f1855d873c7dd1aea6824e994
/src/main/java/com/hello/world/graphqlsdl/repository/NoteRepository.java
9ab2f763f50cac6d30fde57f465e0362863bb064
[]
no_license
NathanAlcantara/spring-boot-graphql-poc
7fa940da24421025f8abe16c2b903630f38f781c
68bc6827fac92c5a1375eaf386fb57ff85df2f3a
refs/heads/master
2020-07-01T09:57:30.669398
2019-08-28T22:44:20
2019-08-28T22:44:20
201,136,342
0
1
null
null
null
null
UTF-8
Java
false
false
376
java
package com.hello.world.graphqlsdl.repository; import com.hello.world.graphqlsdl.model.Note; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; import java.util.UUID; @Repository public interface NoteRepository extends JpaRepository<Note, UUID> { void deleteByIdIn(List<UUID> ids); }
[ "nathangabriel97@gmail.com" ]
nathangabriel97@gmail.com
93937b12820f8aa365eca110a3c1f9aadea9133e
519d182d2ac67604ec75eb7eb3ce522e1079ad9b
/src/main/java/com/otn/dao/ResOsnrLinkTypeDao.java
fcbb8b990a43e928b83656fdba0550d3939d4b08
[]
no_license
buptnml/GuiZhou_OTN_Backend
577754e6fbf50d055c145839fdd7e11d9386ce99
b8f9c69ffc15e14e5362a6b14ea6ff4c0fbe634e
refs/heads/develop
2021-06-13T08:07:22.626387
2018-10-31T03:36:03
2018-10-31T03:38:26
96,731,256
1
13
null
2018-10-23T03:33:37
2017-07-10T03:15:11
Java
UTF-8
Java
false
false
282
java
package com.otn.dao; import com.otn.entity.ResOnsrLinkType; import org.springframework.stereotype.Repository; import tk.mybatis.mapper.common.Mapper; /** * Created by caoxiaohong on 17/9/20. */ @Repository public interface ResOsnrLinkTypeDao extends Mapper<ResOnsrLinkType> { }
[ "WinstonHan@bupt.edu.cn" ]
WinstonHan@bupt.edu.cn
0409218e95b0cced8582760e7abe566e4e2bee62
dcb4b2876606cfc9216438d899e89ee6115348c9
/app/src/main/java/com/smart/urban/bean/UrbanDetailsBean.java
e0870b8cfb23b61b95d711221c9b422957704822
[]
no_license
Brave-wan/SmartUrban
4b2a71f5cf41fcff19162feea388461649590513
244fc29117ca5b9eb20e34c83c38136cd2c16c73
refs/heads/master
2020-03-10T00:05:27.414780
2018-06-12T10:46:33
2018-06-12T10:46:33
127,097,216
0
0
null
null
null
null
UTF-8
Java
false
false
17,993
java
package com.smart.urban.bean; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; /** * Created by root on 18-4-23. */ public class UrbanDetailsBean { /** * title : 《石家庄市城市管理办法》公布,共享单车、公厕免费等有了说法! * createUserName : admin * subtitle : 近日,石家庄市政府公布了《石家庄市城市管理办法(暂行)》,对市容市貌、共享单车、垃圾分类、公厕开放、城管部门如何执法等问题作出了明确规定 * isOnline : Y * viewCount : 0 * images : [{"belongId":1524297581807,"order":null,"address":"http://111.231.222.163:8080/images/upload/20180421/50281524301246419.png","id":1524297581808,"type":"3"}] * commentCount : 1 * content : <p> &nbsp; &nbsp;<img src="http://111.231.222.163:8080/images/upload/20180421/50281524301246419.png" _src="http://111.231.222.163:8080/images/upload/20180421/50281524301246419.png"/></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;">近日,石家庄市政府公布了<span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">《石家庄市城市管理办法(暂行)》</span>,对<span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">市容市貌、共享单车、垃圾分类、公厕开放、城管部门如何执法</span>等问题作出了明确规定。我们一起来看看↓↓↓</p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">保证城市地平线清晰</span></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><img src="http://p1.pstatp.com/large/5b4a0001760e8815b8fc" img_width="500" img_height="375" alt="《石家庄市城市管理办法》公布,共享单车、公厕免费等有了说法!" inline="0" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-style: none; max-width: 100%; display: block; margin: 10px auto;"/></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">第二十六条</span><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">城市街道两侧建(构)筑物应当整洁美观。</span>严禁依附现有建(构)筑物私搭乱建,保持城市天际线、腰线、地平线轮廓清晰、端庄大气。</p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">共享单车不得影响道路通行</span></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;"><img src="http://p3.pstatp.com/large/5b460004247bc35a8b93" img_width="500" img_height="373" alt="《石家庄市城市管理办法》公布,共享单车、公厕免费等有了说法!" inline="0" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-style: none; max-width: 100%; display: block; margin: 10px auto;"/></span></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">第二十八条</span><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">各类非机动车辆应当在城市管理部门施划的专用停车区域内整齐摆放,不得影响市容观瞻。</span><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">共享单车运营企业</span>应当按照市政府要求有序投放,安排足够人员规范车辆停放,保持街面秩序,不得影响城市市容和道路通行。</p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">城市垃圾应当分类投放</span></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><img src="http://p3.pstatp.com/large/5b4500043d49f05fc6fc" img_width="720" img_height="461" alt="《石家庄市城市管理办法》公布,共享单车、公厕免费等有了说法!" inline="0" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-style: none; max-width: 100%; display: block; margin: 10px auto;"/></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">第三十三条</span><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">城市生活垃圾应当做到分类投放,分类运输、分类处置,提高回收利用率,力争物尽其用。</span>县级以上人民政府应当完善生活垃圾分类配套体系建设,明确公共机构、相关企业实行强制分类,引导居民自觉开展生活垃圾分类。</p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">单位公厕可对外开放</span></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><img src="http://p3.pstatp.com/large/5b480003b3d2a9bdf9a1" img_width="450" img_height="300" alt="《石家庄市城市管理办法》公布,共享单车、公厕免费等有了说法!" inline="0" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-style: none; max-width: 100%; display: block; margin: 10px auto;"/></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">第三十八条</span><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">城市公厕应当遵循统一规划、合理布局、功能完善、方便群众的原则,充分利用城市空地、道路两侧和其他公共场所,按照住房和城乡建设部颁发的《环境卫生设施设置标准》设置。</span>城市公厕应当标志清晰、干净卫生。在城市公厕严重不足又难以新建的路段,县级以上人民政府可以根据实际需要与有关单位签订服务协议,对单位内部厕所对外开放。</p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">城管部门扣押物品不得擅自处置</span></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><img src="http://p3.pstatp.com/large/5b4500043d4b20c70cfd" img_width="800" img_height="600" alt="《石家庄市城市管理办法》公布,共享单车、公厕免费等有了说法!" inline="0" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-style: none; max-width: 100%; display: block; margin: 10px auto;"/></p><p style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin-top: 16px; margin-bottom: 16px; color: rgb(34, 34, 34); font-family: &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, &quot;Helvetica Neue&quot;, Arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 28px; white-space: normal; widows: 1;"><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">第五十二条</span><span style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-weight: 700;">城市管理综合执法部门对查封、扣押的物品,应当妥善保管,不得使用、截留、损毁或者擅自处置。</span>对当事人逾期不履行金钱给付义务的,应当依据《行政强制法》及有关规定予以拍卖或变卖,所得款项冲抵罚款;拍卖、变卖所得超过处罚数额的,应当返还当事人。查封、扣押的物品属非法物品的,移送有关部门处理。</p><p><br/></p> * createUserId : 0 * recordStatus : Y * createTime : 1524301252000 * modifyUserId : null * modifyTime : 1524301252000 * id : 1524297581807 */ private String title; private String createUserName; private String subtitle; private String isOnline; private int viewCount; private int commentCount; private String content; private int createUserId; private String recordStatus; private long createTime; private Object modifyUserId; private long modifyTime; private long id; private List<ImagesBean> images; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getCreateUserName() { return createUserName; } public void setCreateUserName(String createUserName) { this.createUserName = createUserName; } public String getSubtitle() { return subtitle; } public void setSubtitle(String subtitle) { this.subtitle = subtitle; } public String getIsOnline() { return isOnline; } public void setIsOnline(String isOnline) { this.isOnline = isOnline; } public int getViewCount() { return viewCount; } public void setViewCount(int viewCount) { this.viewCount = viewCount; } public int getCommentCount() { return commentCount; } public void setCommentCount(int commentCount) { this.commentCount = commentCount; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getCreateUserId() { return createUserId; } public void setCreateUserId(int createUserId) { this.createUserId = createUserId; } public String getRecordStatus() { return recordStatus; } public void setRecordStatus(String recordStatus) { this.recordStatus = recordStatus; } public String getCreateTime() { Date date = new Date(createTime); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); return format.format(date); } public void setCreateTime(long createTime) { this.createTime = createTime; } public Object getModifyUserId() { return modifyUserId; } public void setModifyUserId(Object modifyUserId) { this.modifyUserId = modifyUserId; } public long getModifyTime() { return modifyTime; } public void setModifyTime(long modifyTime) { this.modifyTime = modifyTime; } public long getId() { return id; } public void setId(long id) { this.id = id; } public List<ImagesBean> getImages() { return images; } public void setImages(List<ImagesBean> images) { this.images = images; } public static class ImagesBean { /** * belongId : 1524297581807 * order : null * address : http://111.231.222.163:8080/images/upload/20180421/50281524301246419.png * id : 1524297581808 * type : 3 */ private long belongId; private Object order; private String address; private long id; private String type; public long getBelongId() { return belongId; } public void setBelongId(long belongId) { this.belongId = belongId; } public Object getOrder() { return order; } public void setOrder(Object order) { this.order = order; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getType() { return type; } public void setType(String type) { this.type = type; } } }
[ "185214487@qq.com" ]
185214487@qq.com
5821faa32994aca3d0c0890de64e62e1bbec0a6f
7cbccb273150829c49c81dd41041daa2bdc851a6
/SEAN_E2EFramework/E2EFrameworkSean/src/main/java/common/pages/PersonDetailPage.java
fb8375cfd715c8053e57132d86a2c461660e0815
[]
no_license
mdsaneyalam/QA-Materials
674ebc694c34b5962483ea468835e10f2f214f36
2b817f6790401349d5219f2a7108f1d6cf0485c9
refs/heads/master
2021-06-30T07:16:09.780239
2017-09-20T17:39:55
2017-09-20T17:39:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,358
java
package common.pages; import _driverScript.AbstractStartWebDriver; import org.junit.Assert; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindAll; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.testng.Reporter; import person.personDetach.modals.PersonDetachAddModal; import person.personDetach.modals.PersonDetachDeleteModal; import person.personDetach.modals.PersonDetachEditModal; import person.personMda.modals.PersonMdaAddModal; import person.personMda.modals.PersonMdaDeleteModal; import person.personMda.modals.PersonMdaEditModal; import person.personUnavailable.modals.PersonUnavailableAddModal; import person.personUnavailable.modals.PersonUnavailableDeleteModal; import person.specialPosition.modals.PersonSpecialPositionAddModal; import person.specialPosition.modals.PersonSpecialPositionDeleteModal; import person.specialPosition.modals.PersonSpecialPositionEditModal; import utilities.Utilities; import java.io.IOException; import java.util.List; import static common.actions.CommonActions.logTestFailure; import static common.actions.CommonActions.logTestPass; /** * Created by sdas on 9/23/2016. */ public class PersonDetailPage extends AbstractStartWebDriver { public PersonDetailPage(WebDriver wDriver) { super(); PageFactory.initElements(wDriver, this); } // LOCATORS @FindBy(css = ".auActionButton") WebElement ActionButton; @FindBy(css = ".auActionMenu .auAddMDA") WebElement AddMDA; @FindAll(@FindBy(css = ".auMdaHist .auEdit")) List<WebElement> EditMDA; @FindAll(@FindBy(css = ".auMdaHist .auDelete")) List<WebElement> DeleteMDA; @FindBy(css = ".auActionMenu .auActionAddSpecialPosition") WebElement AddSpecialPos; @FindAll(@FindBy(css = ".auSpecialPositionHist .auEdit")) List<WebElement> EditSpecialPos; @FindAll(@FindBy(css = ".auSpecialPositionHist .auDelete")) List<WebElement> DeleteSpecialPos; @FindBy(css = ".auActionMenu .auActionAddDetach") WebElement AddDetach; @FindAll(@FindBy(css = ".auDetachmentHist .auEdit")) List<WebElement> EditDetach; @FindAll(@FindBy(css = ".auDetachmentHist .auDelete")) List<WebElement> DeleteDetach; @FindBy(css = ".auPersonnelDetail .auActionClose") WebElement DetailClose; @FindBy(css = ".auActionMenu .auAddUnavailable") WebElement AddUnavailable; @FindAll(@FindBy(css = ".auUnavailabilityHist .auEdit")) List<WebElement> EditUnavailable; @FindAll(@FindBy(css = ".auUnavailabilityHist .auDelete")) List<WebElement> DeleteUnavailable; //====================================================================================== // SPECIAL POSITIONS ACTIONS///////////////////////// public PersonDetachAddModal getDetachAddPanel() throws IOException { Reporter.log("Opening PersonDetachAddModal..... ", true); try { waitForElementThenDo(wDriver, ActionButton, 30).click(); waitForElementThenDo(wDriver, AddDetach, 30).click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonDetachAddModal(wDriver); } public PersonDetachEditModal getDetachEditPanel(int rowIndex) throws IOException { Reporter.log("Opening PersonDetachEditModal..... ", true); try { Utilities.waitForElementThenDo(wDriver, EditDetach.get(rowIndex), 30).click(); // PersonHistoryUtilities.getEditOrDeleteIconFromTable("Detach", "auEdit").click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonDetachEditModal(wDriver); } public PersonDetachDeleteModal getDetachDeletePanel(int rowIndex) throws IOException { Reporter.log("Opening PersonDetachDeleteModal..... ", true); try { Utilities.waitForElementThenDo(wDriver, DeleteDetach.get(rowIndex), 5).click(); //PersonHistoryUtilities.getEditOrDeleteIconFromTable("Detach", "auDelete").click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonDetachDeleteModal(wDriver); } // SPECIAL POSITIONS ACTIONS////////////////////////// public PersonSpecialPositionAddModal getSpecialPositionAddPanel() throws IOException { Reporter.log("Opening Special Position ADD Panel..... ", true); try { Utilities.waitForElementThenDo(wDriver, ActionButton, 30).click(); Utilities.waitForElementThenDo(wDriver, AddSpecialPos, 30).click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonSpecialPositionAddModal(wDriver); } public PersonSpecialPositionEditModal getSpecialPositionEditPanel(int rowIndex) throws IOException { Reporter.log("Opening Special Position ADD Panel EDIT..... ", true); try { for(WebElement ele : EditSpecialPos){ if(ele.isDisplayed() && !ele.getAttribute("class").contains("hidden")){ ele.click(); break; } } } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonSpecialPositionEditModal(wDriver); } public PersonSpecialPositionDeleteModal getSpecialPositionDeletePanel(int rowIndex) throws IOException { Reporter.log("Opening Special Position DELETE Panel..... ", true); try { for(WebElement ele : DeleteSpecialPos){ if(ele.isDisplayed() && !ele.getAttribute("class").contains("hidden")){ ele.click(); break; } } //Utilities.waitForElementThenDo(wDriver, DeleteSpecialPos.get(rowIndex), 30).click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonSpecialPositionDeleteModal(wDriver); } ///MDA RELATED ACTIONS///////////////////////////// public PersonMdaAddModal getMdaAddPanel() throws IOException { Reporter.log("Opening MDA ADD Panel..... ", true); try { Utilities.waitForElementThenDo(wDriver, ActionButton).click(); Utilities.waitForElementThenDo(wDriver, AddMDA, 30).click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonMdaAddModal(wDriver); } public PersonMdaEditModal getMdaEditPanel(int rowIndex) throws IOException { Reporter.log("Opening MDA EDIT Panel..... ", true); try { Utilities.waitForElementThenDo(wDriver, EditMDA.get(rowIndex), 30).click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonMdaEditModal(wDriver); } public PersonMdaDeleteModal getMdaDeletePanel(int rowIndex) throws IOException { Reporter.log("Opening MDA DELETE Panel..... ", true); try { Utilities.waitForElementThenDo(wDriver, DeleteMDA.get(rowIndex), 30).click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new PersonMdaDeleteModal(wDriver); } public SmartBoardPage closePersonCardDetailPanel() throws IOException { Reporter.log("Closing Detail Panel..... ", true); try { //wDriver.findElements(By.xpath("//img[contains(@class, 'auActionClose')]")).get(1).click(); Utilities.waitForElementThenDo(wDriver, DetailClose, 5).click(); } catch (Exception e) { iconNotFoundError(); e.toString(); Assert.fail(); } return new SmartBoardPage(wDriver); } ///UNAVAILBLE RELATED ACTIONS///////////////////////////// public PersonUnavailableAddModal getUnavailableAddPanel() throws IOException { Reporter.log("Opening ADD Unavailable Panel..... ", true); logTestPass(wDriver, "Opening ADD Unavailable Panel"); try { Utilities.waitForElementThenDo(wDriver, ActionButton).click(); Utilities.waitForElementThenDo(wDriver, AddUnavailable, 30).click(); } catch (Exception e) { logTestFailure (wDriver, "Could not open ADD Unavailable Panel"); e.toString(); Assert.fail(); } return new PersonUnavailableAddModal(wDriver); } public PersonMdaEditModal getUnavailableEditModal(int rowIndex) throws IOException { Reporter.log("Opening Unavailable EDIT Panel..... ", true); try { for(WebElement edit: EditUnavailable){ if(edit.isDisplayed() && !edit.getAttribute("class").contains("hidden")){ edit.click(); break; } } } catch (Exception e) { iconNotFoundError(); } return new PersonMdaEditModal(wDriver); } public PersonUnavailableDeleteModal getUnavailableDeleteModal(int rowIndex) throws IOException { logTestPass(wDriver, "Opening Unavailable Delete Panel..... "); try { Utilities.waitForElementThenDo(wDriver, DeleteUnavailable.get(rowIndex), 30).click(); /* for(WebElement delete: DeleteUnavailable){ if(delete.isDisplayed() && delete.isEnabled() && !delete.getAttribute("class").contains("hidden")){ delete.click(); break; } }*/ } catch (NoSuchElementException e) { iconNotFoundError(); } return new PersonUnavailableDeleteModal(wDriver); } public static void iconNotFoundError() throws IOException { logTestFailure(wDriver, "NO Clickable Icon is found at the location!!!"); } }
[ "codecamper@outlook.com" ]
codecamper@outlook.com
296d24129085aaaccc51c27cc9cbb18f442bd62c
4cfbdf5a17a227a85700b9ea09a1b1092414aa13
/src/CHelper/src/algs/Digraph.java
ca8fee666633fd7557b45927e2d19d0d4281c739
[]
no_license
BhanukaUOM/CHelper
709bdb2fdcd6dbc7a0706cb743687bf15ad2fc81
139546a26aea25ffffece67c06209902828395b3
refs/heads/master
2020-03-10T22:18:17.395814
2018-06-05T10:49:09
2018-06-05T10:49:09
129,616,268
0
0
null
null
null
null
UTF-8
Java
false
false
9,388
java
/****************************************************************************** * Compilation: javac Digraph.java * Execution: java Digraph filename.txt * Dependencies: Bag.java In.java StdOut.java * Data files: https://algs4.cs.princeton.edu/42digraph/tinyDG.txt * https://algs4.cs.princeton.edu/42digraph/mediumDG.txt * https://algs4.cs.princeton.edu/42digraph/largeDG.txt * * A graph, implemented using an array of lists. * Parallel edges and self-loops are permitted. * * % java Digraph tinyDG.txt * 13 vertices, 22 edges * 0: 5 1 * 1: * 2: 0 3 * 3: 5 2 * 4: 3 2 * 5: 4 * 6: 9 4 8 0 * 7: 6 9 * 8: 6 * 9: 11 10 * 10: 12 * 11: 4 12 * 12: 9 * ******************************************************************************/ package CHelper.src.algs; import java.util.NoSuchElementException; /** * The {@code Digraph} class represents a directed graph of vertices * named 0 through <em>V</em> - 1. * It supports the following two primary operations: add an edge to the digraph, * iterate over all of the vertices adjacent from a given vertex. * Parallel edges and self-loops are permitted. * <p> * This implementation uses an adjacency-lists representation, which * is a vertex-indexed array of {@link Bag} objects. * All operations take constant time (in the worst case) except * iterating over the vertices adjacent from a given vertex, which takes * time proportional to the number of such vertices. * <p> * For additional documentation, * see <a href="https://algs4.cs.princeton.edu/42digraph">Section 4.2</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class Digraph { private static final String NEWLINE = System.getProperty("line.separator"); private final int V; // number of vertices in this digraph private int E; // number of edges in this digraph private Bag<Integer>[] adj; // adj[v] = adjacency list for vertex v private int[] indegree; // indegree[v] = indegree of vertex v /** * Initializes an empty digraph with <em>V</em> vertices. * * @param V the number of vertices * @throws IllegalArgumentException if {@code V < 0} */ public Digraph(int V) { if (V < 0) throw new IllegalArgumentException("Number of vertices in a Digraph must be nonnegative"); this.V = V; this.E = 0; indegree = new int[V]; adj = (Bag<Integer>[]) new Bag[V]; for (int v = 0; v < V; v++) { adj[v] = new Bag<Integer>(); } } /** * Initializes a digraph from the specified input stream. * The format is the number of vertices <em>V</em>, * followed by the number of edges <em>E</em>, * followed by <em>E</em> pairs of vertices, with each entry separated by whitespace. * * @param in the input stream * @throws IllegalArgumentException if the endpoints of any edge are not in prescribed range * @throws IllegalArgumentException if the number of vertices or edges is negative * @throws IllegalArgumentException if the input stream is in the wrong format */ public Digraph(In in) { try { this.V = in.readInt(); if (V < 0) throw new IllegalArgumentException("number of vertices in a Digraph must be nonnegative"); indegree = new int[V]; adj = (Bag<Integer>[]) new Bag[V]; for (int v = 0; v < V; v++) { adj[v] = new Bag<Integer>(); } int E = in.readInt(); if (E < 0) throw new IllegalArgumentException("number of edges in a Digraph must be nonnegative"); for (int i = 0; i < E; i++) { int v = in.readInt(); int w = in.readInt(); addEdge(v, w); } } catch (NoSuchElementException e) { throw new IllegalArgumentException("invalid input format in Digraph constructor", e); } } /** * Initializes a new digraph that is a deep copy of the specified digraph. * * @param G the digraph to copy */ public Digraph(Digraph G) { this(G.V()); this.E = G.E(); for (int v = 0; v < V; v++) this.indegree[v] = G.indegree(v); for (int v = 0; v < G.V(); v++) { // reverse so that adjacency list is in same order as original Stack<Integer> reverse = new Stack<Integer>(); for (int w : G.adj[v]) { reverse.push(w); } for (int w : reverse) { adj[v].add(w); } } } /** * Returns the number of vertices in this digraph. * * @return the number of vertices in this digraph */ public int V() { return V; } /** * Returns the number of edges in this digraph. * * @return the number of edges in this digraph */ public int E() { return E; } // throw an IllegalArgumentException unless {@code 0 <= v < V} private void validateVertex(int v) { if (v < 0 || v >= V) throw new IllegalArgumentException("vertex " + v + " is not between 0 and " + (V-1)); } /** * Adds the directed edge v→w to this digraph. * * @param v the tail vertex * @param w the head vertex * @throws IllegalArgumentException unless both {@code 0 <= v < V} and {@code 0 <= w < V} */ public void addEdge(int v, int w) { validateVertex(v); validateVertex(w); adj[v].add(w); indegree[w]++; E++; } /** * Returns the vertices adjacent from vertex {@code v} in this digraph. * * @param v the vertex * @return the vertices adjacent from vertex {@code v} in this digraph, as an iterable * @throws IllegalArgumentException unless {@code 0 <= v < V} */ public Iterable<Integer> adj(int v) { validateVertex(v); return adj[v]; } /** * Returns the number of directed edges incident from vertex {@code v}. * This is known as the <em>outdegree</em> of vertex {@code v}. * * @param v the vertex * @return the outdegree of vertex {@code v} * @throws IllegalArgumentException unless {@code 0 <= v < V} */ public int outdegree(int v) { validateVertex(v); return adj[v].size(); } /** * Returns the number of directed edges incident to vertex {@code v}. * This is known as the <em>indegree</em> of vertex {@code v}. * * @param v the vertex * @return the indegree of vertex {@code v} * @throws IllegalArgumentException unless {@code 0 <= v < V} */ public int indegree(int v) { validateVertex(v); return indegree[v]; } /** * Returns the reverse of the digraph. * * @return the reverse of the digraph */ public Digraph reverse() { Digraph reverse = new Digraph(V); for (int v = 0; v < V; v++) { for (int w : adj(v)) { reverse.addEdge(w, v); } } return reverse; } /** * Returns a string representation of the graph. * * @return the number of vertices <em>V</em>, followed by the number of edges <em>E</em>, * followed by the <em>V</em> adjacency lists */ public String toString() { StringBuilder s = new StringBuilder(); s.append(V + " vertices, " + E + " edges " + NEWLINE); for (int v = 0; v < V; v++) { s.append(String.format("%d: ", v)); for (int w : adj[v]) { s.append(String.format("%d ", w)); } s.append(NEWLINE); } return s.toString(); } /** * Unit tests the {@code Digraph} data type. * * @param args the command-line arguments */ public static void main(String[] args) { In in = new In(args[0]); Digraph G = new Digraph(in); StdOut.println(G); } } /****************************************************************************** * Copyright 2002-2018, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http://algs4.cs.princeton.edu * * * algs4.jar 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. * * algs4.jar 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 algs4.jar. If not, see http://www.gnu.org/licenses. ******************************************************************************/
[ "bhanuka2017@gmail.com" ]
bhanuka2017@gmail.com
e44e5f504f4087fb28db36835a9eb876fd384194
313d1e3ec966b21b698d46bcf704b3da049f286d
/ContactServiceTest.java
463b8a460805968a7bdcb90fac82cf4e8bdf8db1
[]
no_license
Fambam-EC/SoftwareTesting
0b95d87d952ca464ff0622809e55a46686cf27a3
8f5181521263936eca03a5c64c795a296ada58e6
refs/heads/main
2023-03-08T13:42:23.894852
2021-02-27T16:21:08
2021-02-27T16:21:08
342,901,021
0
0
null
null
null
null
UTF-8
Java
false
false
1,590
java
package main; import static org.junit.jupiter.api.Assertions.*; import java.util.ArrayList; import org.junit.jupiter.api.Test; class ContactServiceTest { @Test void testContact() { Contact contact = new Contact("123456", "Ethan", "Cook", "1234567890", "Over the yellow brick road"); assertTrue(contact.getcontactID().equals("123456")); assertTrue(contact.getfirstName().equals("Ethan")); assertTrue(contact.getlastName().equals("Cook")); assertTrue(contact.getphoneNum().equals("1234567890")); assertTrue(contact.getaddressID().equals("Over the yellow brick road")); } ArrayList <Contact> account = new ArrayList<Contact> (); @Test void deleteContact() { Contact contact = new Contact("123456", "Ethan", "Cook", "1234567890", "Over the yellow brick road"); account.add(contact); assertFalse(account.isEmpty()); account.remove(contact); assertTrue(account.isEmpty()); } @Test void addContact() { // TODO Auto-generated method stub Contact contact = new Contact("123456", "Ethan", "Cook", "1234567890", "Over the yellow brick road"); account.add(contact); assertFalse(account.isEmpty()); } @Test void modifyContact() { Contact contact = new Contact("123456", "Ethan", "Cook", "1234567890", "Over the yellow brick road"); account.add(contact); contact.setContactID("ID"); contact.setfirstName("ID"); contact.setlastName("ID"); contact.setphoneNum("ID"); contact.setaddressID("ID"); account.remove(contact); account.add(contact); assertFalse(account.isEmpty()); } }
[ "noreply@github.com" ]
Fambam-EC.noreply@github.com
3c5b71bbc44aabb5da303ddeb72ec589fe564ba4
4b0ea57dc10ebbd4e3b5e7e113d7a2dad43f3dc9
/src/main/java/com/collection/domain/Usuario.java
18c2dfe7b7ea4a822341ad9a4c6cf4f8fccfe2dc
[]
no_license
joserq93/ProyectoCollection
a0bcc94a3a9c1981a64995370d0accdc46e359f3
930da80b6cbc0c3ca1b2a2dcc8cf1a5817f1da7a
refs/heads/master
2016-09-06T17:02:55.527976
2015-06-11T18:10:54
2015-06-11T18:10:54
37,267,294
0
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package com.collection.domain; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import org.springframework.format.annotation.DateTimeFormat; @Entity @Table(name="Usuario") public class Usuario { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; @NotNull @Size(min=1,max=20,message="Insert User") private String user; @NotNull @Size(min=1,max=20,message="Inset Password") private String password; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getUser() { return user; } public void setUser(String user) { this.user = user; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
[ "dark.-jose@hotmail.com" ]
dark.-jose@hotmail.com
afbc8ecb1329ccf121bff363ca1dc277899973ed
6fe34c082d0f1f58ab8d930bfd88e1ccc708ef62
/aws-java-sdk-chime/src/main/java/com/amazonaws/services/chime/model/ListAccountsRequest.java
d0d678d39f1ef614f480cf8a9580ed084d98156e
[ "Apache-2.0" ]
permissive
vidyann/aws-sdk-java
57b717d137f080fe3dd006814e4f40c052559d49
f30e0b30c3d9a122f0d71b943d5b52f4d78fef51
refs/heads/master
2020-04-10T03:57:45.563673
2018-12-06T23:17:07
2018-12-06T23:17:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,234
java
/* * Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.chime.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/chime-2018-05-01/ListAccounts" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ListAccountsRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * Amazon Chime account name prefix with which to filter results. * </p> */ private String name; /** * <p> * User email address with which to filter results. * </p> */ private String userEmail; /** * <p> * The token to use to retrieve the next page of results. * </p> */ private String nextToken; /** * <p> * The maximum number of results to return in a single call. Defaults to 100. * </p> */ private Integer maxResults; /** * <p> * Amazon Chime account name prefix with which to filter results. * </p> * * @param name * Amazon Chime account name prefix with which to filter results. */ public void setName(String name) { this.name = name; } /** * <p> * Amazon Chime account name prefix with which to filter results. * </p> * * @return Amazon Chime account name prefix with which to filter results. */ public String getName() { return this.name; } /** * <p> * Amazon Chime account name prefix with which to filter results. * </p> * * @param name * Amazon Chime account name prefix with which to filter results. * @return Returns a reference to this object so that method calls can be chained together. */ public ListAccountsRequest withName(String name) { setName(name); return this; } /** * <p> * User email address with which to filter results. * </p> * * @param userEmail * User email address with which to filter results. */ public void setUserEmail(String userEmail) { this.userEmail = userEmail; } /** * <p> * User email address with which to filter results. * </p> * * @return User email address with which to filter results. */ public String getUserEmail() { return this.userEmail; } /** * <p> * User email address with which to filter results. * </p> * * @param userEmail * User email address with which to filter results. * @return Returns a reference to this object so that method calls can be chained together. */ public ListAccountsRequest withUserEmail(String userEmail) { setUserEmail(userEmail); return this; } /** * <p> * The token to use to retrieve the next page of results. * </p> * * @param nextToken * The token to use to retrieve the next page of results. */ public void setNextToken(String nextToken) { this.nextToken = nextToken; } /** * <p> * The token to use to retrieve the next page of results. * </p> * * @return The token to use to retrieve the next page of results. */ public String getNextToken() { return this.nextToken; } /** * <p> * The token to use to retrieve the next page of results. * </p> * * @param nextToken * The token to use to retrieve the next page of results. * @return Returns a reference to this object so that method calls can be chained together. */ public ListAccountsRequest withNextToken(String nextToken) { setNextToken(nextToken); return this; } /** * <p> * The maximum number of results to return in a single call. Defaults to 100. * </p> * * @param maxResults * The maximum number of results to return in a single call. Defaults to 100. */ public void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } /** * <p> * The maximum number of results to return in a single call. Defaults to 100. * </p> * * @return The maximum number of results to return in a single call. Defaults to 100. */ public Integer getMaxResults() { return this.maxResults; } /** * <p> * The maximum number of results to return in a single call. Defaults to 100. * </p> * * @param maxResults * The maximum number of results to return in a single call. Defaults to 100. * @return Returns a reference to this object so that method calls can be chained together. */ public ListAccountsRequest withMaxResults(Integer maxResults) { setMaxResults(maxResults); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getUserEmail() != null) sb.append("UserEmail: ").append(getUserEmail()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()).append(","); if (getMaxResults() != null) sb.append("MaxResults: ").append(getMaxResults()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListAccountsRequest == false) return false; ListAccountsRequest other = (ListAccountsRequest) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getUserEmail() == null ^ this.getUserEmail() == null) return false; if (other.getUserEmail() != null && other.getUserEmail().equals(this.getUserEmail()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false; if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getUserEmail() == null) ? 0 : getUserEmail().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode()); return hashCode; } @Override public ListAccountsRequest clone() { return (ListAccountsRequest) super.clone(); } }
[ "" ]
c230e590d470ec78d6a2d9388ee099740868425e
e1e7e0a8a188f0caeb0a16ce696a19fd44c8021c
/infero-gui/src/main/java/infero/gui/domain/InferoLog.java
b3055e70ea906e4046ab7a9726bdde3d21501db3
[ "LicenseRef-scancode-public-domain" ]
permissive
trygvis/infero
b07fee6b798aa2a94c9035f83b93602a00c9ede6
a5b5bea71ee3d3d63ff86db5a209e0c57c41b39b
refs/heads/master
2021-01-20T12:13:19.328431
2010-01-10T15:43:37
2010-01-10T15:43:37
453,338
1
0
null
null
null
null
UTF-8
Java
false
false
2,133
java
package infero.gui.domain; import com.google.inject.*; import static java.util.Arrays.asList; import javax.swing.event.*; import java.util.*; @Singleton public class InferoLog { private final List<InferoLogEntry> _entries = new ArrayList<InferoLogEntry>(); public final List<InferoLogEntry> entries = Collections.unmodifiableList(_entries); private final EventListenerList listenerList = new EventListenerList(); @Inject public InferoLog() { } // ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- public void logEntry(InferoLogEntry entry) { int oldSize = _entries.size(); _entries.add(entry); fireChangeEvent(new LogSizeEvent(oldSize, _entries.size())); } public void logEntries(List<InferoLogEntry> entries) { int oldSize = _entries.size(); _entries.addAll(entries); fireChangeEvent(new LogSizeEvent(oldSize, _entries.size())); } public void logEntry(InferoLogEntry... entries) { logEntries(asList(entries)); } public void clear() { int oldSize = _entries.size(); _entries.clear(); fireChangeEvent(new LogSizeEvent(oldSize, _entries.size())); } // ----------------------------------------------------------------------- // Event // ----------------------------------------------------------------------- private void fireChangeEvent(ChangeEvent changeEvent) { for (ChangeListener listener : listenerList.getListeners(ChangeListener.class)) { listener.stateChanged(changeEvent); } } public void addChangeListener(ChangeListener changeListener) { listenerList.add(ChangeListener.class, changeListener); } public class LogSizeEvent extends ChangeEvent { public final int oldSize; public final int newSize; public LogSizeEvent(int oldSize, int newSize) { super(InferoLog.this); this.oldSize = oldSize; this.newSize = newSize; } } }
[ "trygvis@inamo.no" ]
trygvis@inamo.no
130a1a4f58db0d5297b774b6d14d4c4483fa7e34
8be59ad2ac2675e10bb7856cc4c5ef0b47dd8d9b
/app/build/generated/source/r/debug/com/vinil/dishmenu/Manifest.java
615d520bfb8aea1360cf825064582fd2d8574886
[]
no_license
vinilprabhu/Dish-Menu-Android
7dd2d6806d3270b0cec7f3d0b369d6adb7124f85
0c8302a05246fcf928494e18968038ca036b597a
refs/heads/master
2021-01-12T12:32:40.339320
2017-02-07T16:05:46
2017-02-07T16:05:46
72,544,021
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.vinil.dishmenu; public final class Manifest { public static final class permission { public static final String C2D_MESSAGE="com.vinil.dishmenu.permission.C2D_MESSAGE"; } }
[ "vinilprabhu@gmail.com" ]
vinilprabhu@gmail.com
7f4ebb4c50985959642a0d5de8fc0f7ba74ca4ea
5f7c7ddbdfa4e84feec66062347a7ecda491819e
/atoi.java
93ea76f442ec69c4b0aa79f997eca09755ee7011
[]
no_license
smartbook1982/myShuati1
fc42c5fb01daf31de66c4ffbbda9cfa7d0ff00e7
71866ef6ae8d3c1731086cb696b3d2150b47eda2
refs/heads/master
2022-06-01T22:03:21.004610
2022-04-17T15:29:54
2022-04-17T15:29:54
476,460,596
0
0
null
null
null
null
UTF-8
Java
false
false
798
java
//Convert String to Integer // " -321321a8329" return -321321 public class Solution { public int myAtoi(String str) { int sum = 0; int i = 0; char[] c_arr = str.toCharArray(); if (c_arr.length == 0) return 0; while(i<c_arr.length && Character.isWhitespace(c_arr[i])) i++; int j = 0; if (c_arr[i] == '-' || c_arr[i] == '+') { j = i; i++; } for (; i < c_arr.length; i++) { int num = c_arr[i] - '0'; if (!Character.isDigit(c_arr[i])) break; if (sum > Integer.MAX_VALUE / 10 || (sum == Integer.MAX_VALUE / 10 && num >= 8)) { return c_arr[j] != '-' ? Integer.MAX_VALUE : Integer.MIN_VALUE; } sum = sum * 10 + num; } return c_arr[j] == '-' ? -sum : sum; } }
[ "407764776@qq.com" ]
407764776@qq.com
59622c979441576a73a36eaa89276685df8ea6e4
d7802de17d9905b05db516efdd245348382d6a0e
/Experiment3/lab3_code/app/src/androidTest/java/com/example/administrator/contacts/ApplicationTest.java
fca2d40fe370c68f83dbdd5363001b9fe87149a8
[]
no_license
SplendidSky/Android
d805f009a841ed2838da5e7bd6d970cddd0357d0
fea7c7d827baf41df8011ffcb85403f00e31105f
refs/heads/master
2021-01-17T11:52:30.614765
2017-03-07T07:44:51
2017-03-07T07:44:51
84,049,382
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.example.administrator.contacts; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "530415489@qq.com" ]
530415489@qq.com
bf4a1a76033738c324d32c021fe326881cf3abfa
04bfaf142c9c2aaa52dceeba7b37452a4b7fd03b
/bps/V1.0.2/src/main/java/com/vilio/bps/inquiry/worldunion/service/WUGetHousingInfo.java
b7c83d0e4e799e3060141efd7b98e4f1137057a2
[]
no_license
yanzj/hhsite
a1dd19a11a5623bcc04651dd364640767df9b335
603ef16f7d4d53494e4ab99cae631cfafeee3159
refs/heads/master
2020-04-14T04:18:35.363346
2018-12-31T02:18:04
2018-12-31T02:18:04
163,632,151
0
1
null
2018-12-31T02:16:10
2018-12-31T02:16:10
null
UTF-8
Java
false
false
653
java
package com.vilio.bps.inquiry.worldunion.service; import com.vilio.bps.commonMapper.pojo.BpsPlots; import com.vilio.bps.inquiry.worldunion.pojo.SearchBean; import com.vilio.bps.inquiry.worldunion.pojo.WUConstruction; import java.util.List; /** * Created by dell on 2017/5/12/0012. */ public interface WUGetHousingInfo { public List<SearchBean> getConstruction(String cityId, String name) throws Exception; public List<WUConstruction> getConstrutionViewInfoById(String conId) throws Exception; public List<SearchBean> getBuild(String conId) throws Exception; public List<SearchBean> getHouse(String buildId) throws Exception; }
[ "panda7168@163.com" ]
panda7168@163.com
9480c5faa7b4b7d52e987d81e4fe5f4532507367
9a91211e64141503c5162b1e8c10b91201b15e78
/src/main/java/org/example/interpreter/cardreader/TerminalExpression.java
77c10dd8d064c3b3dea811031fdbeb58edfe64b1
[]
no_license
yangshunxin/javaDesignPattern
ed33a5aa0dcb1973fc94796a90ed3892fb569305
5dd510b1c2b630b6a9ba053fae90a3362ab17286
refs/heads/main
2023-06-27T06:29:04.705572
2021-07-29T10:56:26
2021-07-29T10:56:26
388,305,621
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package org.example.interpreter.cardreader; import java.util.HashSet; import java.util.Set; /** * @author yangshunxin * @create 2021-07-26-17:10 */ //终结符表达式类 public class TerminalExpression implements Expression{ private Set<String> set = new HashSet<String>(); public TerminalExpression(String[] data) { for (int i = 0; i < data.length; i++) { set.add(data[i]); } } @Override public boolean interpret(String info) { if (set.contains(info)){ return true; } return false; } }
[ "15000167782@139.com" ]
15000167782@139.com
72a2c2bf1477273ebe976696f0c94a1bb0bbe136
68184cc5d50ad1bc60fdae3c45d17c70da871b94
/Mobzy-API/src/main/java/com/offz/spigot/mobzy/Pathfinders/Flying/PathfinderGoalFlyDamageTarget.java
1d03bbf01437effbc84243afe574ba27d3965075
[]
no_license
NewFran/Mobzy
2873506c94cc620d7f3a43042d6d1e9a58910bb9
cde4012d0c002f04a090031afa9a782f586a69b1
refs/heads/master
2020-12-04T00:15:38.068078
2019-10-14T19:05:31
2019-10-14T19:05:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,067
java
package com.offz.spigot.mobzy.Pathfinders.Flying; import com.offz.spigot.mobzy.Mobs.Types.FlyingMob; import net.minecraft.server.v1_13_R2.PathfinderGoal; import org.bukkit.entity.LivingEntity; public class PathfinderGoalFlyDamageTarget extends PathfinderGoal { private FlyingMob mob; private long hitAt; private long cooldown = 200; public PathfinderGoalFlyDamageTarget(FlyingMob flyingMob) { mob = flyingMob; } public boolean a() { return true; } public void e() { if (mob.getGoalTarget() != null && hitAt + cooldown < System.currentTimeMillis()) { LivingEntity target = (LivingEntity) mob.getGoalTarget().getBukkitEntity(); Double attackDamage = mob.getStaticBuilder().getAttackDamage(); //if within range, harm if (attackDamage != null && mob.distanceToEntity(target) < mob.width / 2 + 1) { hitAt = System.currentTimeMillis(); target.damage(attackDamage.floatValue(), mob.getBukkitEntity()); } } } }
[ "dan.voznyy@gmail.com" ]
dan.voznyy@gmail.com
41d3dd8885162d4d10d4c6c65f945d7b44b0d654
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_11_buggy/mutated/1851/Token.java
6973d638d16103feaaa325724ce47e2d96caeb10
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,210
java
package org.jsoup.parser; import org.jsoup.helper.Validate; import org.jsoup.nodes.Attribute; import org.jsoup.nodes.Attributes; import org.jsoup.nodes.BooleanAttribute; /** * Parse tokens for the Tokeniser. */ abstract class Token { TokenType type; private Token() { } String tokenType() { return this.getClass().getSimpleName(); } /** * Reset the data represent by this token, for reuse. Prevents the need to create transfer objects for every * piece of data, which immediately get GCed. */ abstract Token reset(); static void reset(StringBuilder sb) { if (sb != null) { sb.delete(0, sb.length()); } } static final class Doctype extends Token { final StringBuilder name = new StringBuilder(); final StringBuilder publicIdentifier = new StringBuilder(); final StringBuilder systemIdentifier = new StringBuilder(); boolean forceQuirks = false; Doctype() { type = TokenType.Doctype; } @Override Token reset() { reset(name); reset(publicIdentifier); reset(systemIdentifier); forceQuirks = false; return this; } String getName() { return name.toString(); } String getPublicIdentifier() { return publicIdentifier.toString(); } public String getSystemIdentifier() { return systemIdentifier.toString(); } public boolean isForceQuirks() { return forceQuirks; } } static abstract class Tag extends Token { protected String tagName; protected String normalName; // lc version of tag name, for case insensitive tree build private String pendingAttributeName; // attribute names are generally caught in one hop, not accumulated private StringBuilder pendingAttributeValue = new StringBuilder(); // but values are accumulated, from e.g. & in hrefs private String pendingAttributeValueS; // try to get attr vals in one shot, vs Builder private boolean hasEmptyAttributeValue = false; // distinguish boolean attribute from empty string value private boolean hasPendingAttributeValue = false; boolean selfClosing = false; Attributes attributes; // start tags get attributes on construction. End tags get attributes on first new attribute (but only for parser convenience, not used). @Override Tag reset() { tagName = null; normalName = null; pendingAttributeName = null; reset(pendingAttributeValue); pendingAttributeValueS = null; hasEmptyAttributeValue = false; hasPendingAttributeValue = false; selfClosing = false; attributes = null; return this; } final void newAttribute() { if (attributes == null) attributes = new Attributes(); if (pendingAttributeName != null) { Attribute attribute; if (hasPendingAttributeValue) attribute = new Attribute(this.data, pendingAttributeValue.length() > 0 ? pendingAttributeValue.toString() : pendingAttributeValueS); else if (hasEmptyAttributeValue) attribute = new Attribute(pendingAttributeName, ""); else attribute = new BooleanAttribute(pendingAttributeName); attributes.put(attribute); } pendingAttributeName = null; hasEmptyAttributeValue = false; hasPendingAttributeValue = false; reset(pendingAttributeValue); pendingAttributeValueS = null; } final void finaliseTag() { // finalises for emit if (pendingAttributeName != null) { // todo: check if attribute name exists; if so, drop and error newAttribute(); } } final String name() { // preserves case, for input into Tag.valueOf (which may drop case) Validate.isFalse(tagName == null || tagName.length() == 0); return tagName; } final String normalName() { // loses case, used in tree building for working out where in tree it should go return normalName; } final Tag name(String name) { tagName = name; normalName = name.toLowerCase(); return this; } final boolean isSelfClosing() { return selfClosing; } @SuppressWarnings({"TypeMayBeWeakened"}) final Attributes getAttributes() { return attributes; } // these appenders are rarely hit in not null state-- caused by null chars. final void appendTagName(String append) { tagName = tagName == null ? append : tagName.concat(append); normalName = tagName.toLowerCase(); } final void appendTagName(char append) { appendTagName(String.valueOf(append)); } final void appendAttributeName(String append) { pendingAttributeName = pendingAttributeName == null ? append : pendingAttributeName.concat(append); } final void appendAttributeName(char append) { appendAttributeName(String.valueOf(append)); } final void appendAttributeValue(String append) { ensureAttributeValue(); if (pendingAttributeValue.length() == 0) { pendingAttributeValueS = append; } else { pendingAttributeValue.append(append); } } final void appendAttributeValue(char append) { ensureAttributeValue(); pendingAttributeValue.append(append); } final void appendAttributeValue(char[] append) { ensureAttributeValue(); pendingAttributeValue.append(append); } final void appendAttributeValue(int[] appendCodepoints) { ensureAttributeValue(); for (int codepoint : appendCodepoints) { pendingAttributeValue.appendCodePoint(codepoint); } } final void setEmptyAttributeValue() { hasEmptyAttributeValue = true; } private void ensureAttributeValue() { hasPendingAttributeValue = true; // if on second hit, we'll need to move to the builder if (pendingAttributeValueS != null) { pendingAttributeValue.append(pendingAttributeValueS); pendingAttributeValueS = null; } } } final static class StartTag extends Tag { StartTag() { super(); attributes = new Attributes(); type = TokenType.StartTag; } @Override Tag reset() { super.reset(); attributes = new Attributes(); // todo - would prefer these to be null, but need to check Element assertions return this; } StartTag nameAttr(String name, Attributes attributes) { this.tagName = name; this.attributes = attributes; normalName = tagName.toLowerCase(); return this; } @Override public String toString() { if (attributes != null && attributes.size() > 0) return "<" + name() + " " + attributes.toString() + ">"; else return "<" + name() + ">"; } } final static class EndTag extends Tag{ EndTag() { super(); type = TokenType.EndTag; } @Override public String toString() { return "</" + name() + ">"; } } final static class Comment extends Token { final StringBuilder data = new StringBuilder(); boolean bogus = false; @Override Token reset() { reset(data); bogus = false; return this; } Comment() { type = TokenType.Comment; } String getData() { return data.toString(); } @Override public String toString() { return "<!--" + getData() + "-->"; } } final static class Character extends Token { private String data; Character() { super(); type = TokenType.Character; } @Override Token reset() { data = null; return this; } Character data(String data) { this.data = data; return this; } String getData() { return data; } @Override public String toString() { return getData(); } } final static class EOF extends Token { EOF() { type = Token.TokenType.EOF; } @Override Token reset() { return this; } } final boolean isDoctype() { return type == TokenType.Doctype; } final Doctype asDoctype() { return (Doctype) this; } final boolean isStartTag() { return type == TokenType.StartTag; } final StartTag asStartTag() { return (StartTag) this; } final boolean isEndTag() { return type == TokenType.EndTag; } final EndTag asEndTag() { return (EndTag) this; } final boolean isComment() { return type == TokenType.Comment; } final Comment asComment() { return (Comment) this; } final boolean isCharacter() { return type == TokenType.Character; } final Character asCharacter() { return (Character) this; } final boolean isEOF() { return type == TokenType.EOF; } enum TokenType { Doctype, StartTag, EndTag, Comment, Character, EOF } }
[ "justinwm@163.com" ]
justinwm@163.com
32a9d0ac4a244969fd1fd2a170a5cd645c2e4668
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-imagebuilder/src/main/java/com/amazonaws/services/imagebuilder/model/transform/GetComponentPolicyRequestMarshaller.java
7abc5b3ef6bfefe7899f9f3fd295312e0c0347bc
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
2,072
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.imagebuilder.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.imagebuilder.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * GetComponentPolicyRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class GetComponentPolicyRequestMarshaller { private static final MarshallingInfo<String> COMPONENTARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.QUERY_PARAM).marshallLocationName("componentArn").build(); private static final GetComponentPolicyRequestMarshaller instance = new GetComponentPolicyRequestMarshaller(); public static GetComponentPolicyRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(GetComponentPolicyRequest getComponentPolicyRequest, ProtocolMarshaller protocolMarshaller) { if (getComponentPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getComponentPolicyRequest.getComponentArn(), COMPONENTARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
0a0c21b351bb8b4c1f4055adec6fbb885914ad52
4eb29eb7f726a2810d150dfd9cfbfb4f404a3723
/app/src/main/java/app/com/newsfeed/UI/MVP_Presenter/NewsPresenter.java
b8cd45681691a651587cbbab6bb713f3dbf97c81
[]
no_license
devikanigam04/NewsFeed
e788fda66fbbcd817a6fa1482ff2b1bb088dcdfa
f7f16d59accaa93386d9b497ef0e82736b86f954
refs/heads/master
2021-01-20T15:10:10.681838
2017-05-09T10:01:45
2017-05-09T10:01:45
90,727,732
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package app.com.newsfeed.UI.MVP_Presenter; import app.com.newsfeed.Data.Pojo.NewsResponse; import app.com.newsfeed.UI.MVP_Contracter.NewsContracter; public class NewsPresenter implements NewsContracter.Presenter, NewsContracter.Model.Listener{ private NewsContracter.View view; private NewsContracter.Model model; public NewsPresenter(NewsContracter.View view, NewsContracter.Model model) { this.view = view; this.model = model; } @Override public void getData() { model.getData(this); } @Override public void result(NewsResponse newsResponse) { view.result(newsResponse); } @Override public void failure(String error) { view.failure(error); } }
[ "devikanigam.04@gmail.com" ]
devikanigam.04@gmail.com
9109e53562a5fbd032118a7bc4df0449f394576a
0e29c070d99f2de7066576cf3331681a9d70dc30
/AudioSpectrumAnalyzer/src/log/LOG.java
e0f15b255d02101b28140720bb6fdd2c41b6645c
[]
no_license
zz4fap/android-spectrum-analyzer
b7728ff5ad6a628d6f259995165c05e9b4ebef3b
f6d25fd765361fd550303e7848164cfa30a83167
refs/heads/master
2020-04-06T03:39:51.013073
2012-02-07T17:24:53
2012-02-07T17:24:53
32,116,692
3
0
null
null
null
null
UTF-8
Java
false
false
905
java
package log; import com.spectrumanalyzer.ui.SpectrumAnalyzer; import android.util.Log; public class LOG { private static final String DEBUG_TAG = "SpectrumAnalyzer"; private LOG(){} public static void d(String TAG, String msg){ if(SpectrumAnalyzer.getRunAppInDebugMode()){ Log.d(TAG,msg); } } public static void d(String msg){ if(SpectrumAnalyzer.getRunAppInDebugMode()){ Log.d(DEBUG_TAG,msg); } } public static void i(String TAG, String msg){ if(SpectrumAnalyzer.getRunAppInDebugMode()){ Log.i(TAG,msg); } } public static void i(String msg){ if(SpectrumAnalyzer.getRunAppInDebugMode()){ Log.i(DEBUG_TAG,msg); } } public static void e(String TAG, String msg){ if(SpectrumAnalyzer.getRunAppInDebugMode()){ Log.e(TAG,msg); } } public static void e(String msg){ if(SpectrumAnalyzer.getRunAppInDebugMode()){ Log.e(DEBUG_TAG,msg); } } }
[ "zz4fap@84c98125-e114-56cc-d498-39303f8bdc64" ]
zz4fap@84c98125-e114-56cc-d498-39303f8bdc64
9818175dcf1b8953db1af82783f71398a66f60c8
efdeced948d830fac9b0b9258dd524283931a58b
/ncmanstreet/src/main/java/com/rcs/nchumanity/tool/LBSallocation.java
2c4651e6be39433678eacce44385af04417947e8
[]
no_license
enjoy-learning-everything/lifeTutor
e562803b82fe35073f6fa47bd642102ec19cd079
2e2b32a6d67dfcbaae1c642e2ca2872f279b699e
refs/heads/master
2023-04-27T05:51:33.913114
2019-08-28T08:01:42
2019-08-28T08:01:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,411
java
package com.rcs.nchumanity.tool; import android.Manifest; import android.content.Context; import com.baidu.location.BDAbstractLocationListener; import com.baidu.location.BDLocation; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.rcs.nchumanity.fragment.ParentFragment; import com.rcs.nchumanity.ul.ParentActivity; public class LBSallocation { /** * 获得当前的位置 * @param context * @param listener */ public static void getCurrentLocation(Context context, BDAbstractLocationListener listener){ LocationClient locationClient; locationClient = new LocationClient(context); locationClient.registerLocationListener(new BDAbstractLocationListener() { @Override public void onReceiveLocation(BDLocation bdLocation) { if(!hasLoca){ hasLoca=true; listener.onReceiveLocation(bdLocation); locationClient.stop(); } } }); hasLoca = false; LocationClientOption lp = new LocationClientOption(); lp.setOpenGps(true); lp.setIsNeedAddress(true); lp.setCoorType("bd09ll"); locationClient.setLocOption(lp); locationClient.start(); } private static boolean hasLoca=false; /** * 开始发起定位 在Activity中使用 * @param activity * @param requestCode * @param <T> */ public static <T extends ParentActivity> void startLocationWithActivity( T activity,int requestCode){ String[] permission = { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE }; activity.requestPermission(permission,requestCode); } /** * 开始发起定位在fragment中使用 * @param fragment * @param requestCode * @param <T> */ public static <T extends ParentFragment> void startLocationWithFragment(T fragment, int requestCode) { String[] permission = { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE }; fragment.requestPermission(permission,requestCode); } }
[ "fangzhiyue@git.com" ]
fangzhiyue@git.com
f7abf598dbc5e994727b5050ad17f6ee1103fda8
2ad3bd2ff72e4389d1e845f7263a42f9cd048206
/TwoDimRaggesArrayUtilityTest.java
3bb209f7efbf8fc6303fcc6736be134d5a0738f1
[]
no_license
fmancia1/Sales-Report-for-Retail-District-5
c65a384b675288fb2f140064160f663d34f87aad
64c5c7cb7cd6c4935d1ce4bc814168b5fe96696a
refs/heads/main
2023-01-10T17:12:23.769046
2020-11-13T06:05:38
2020-11-13T06:05:38
312,487,108
0
0
null
null
null
null
UTF-8
Java
false
false
13,320
java
//package _solution; //package _solutionF2018; import static org.junit.Assert.*; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; import org.junit.After; import org.junit.Before; import org.junit.Test; public class TwoDimRaggedArrayUtilityTest { private double[][] dataSet1 = {{1,2,3},{4,5},{6,7,8}}; private double[][] dataSet2 = {{7,2,9,4},{5},{8,1,3},{11,6,7,2}}; private double[][] dataSet3 = {{7.2,2.5,9.3},{5.9},{8.1,1.7,3.3},{11.6,6.9,7.3,2.7}}; //dataSet3 has fewer elements in first row than in other rows private double[][] dataSet4 = {{-2.5,-5.3,6.1},{-4.4,8.2},{2.3,-7.5},{-4.2,7.3,-5.9,2.6}}; //dataSet4 has negative elements as well as positive private File inputFile,outputFile; @Before public void setUp() throws Exception { outputFile = new File("TestOut.txt"); } @After public void tearDown() throws Exception { dataSet1 = dataSet2 = dataSet3 = dataSet4 = null; inputFile = outputFile = null; } /** * Test getTotal method * Returns the total of all the elements in the two dimensional array */ @Test public void testGetTotal() { assertEquals(36.0,TwoDimRaggedArrayUtility.getTotal(dataSet1),.001); assertEquals(65.0,TwoDimRaggedArrayUtility.getTotal(dataSet2),.001); assertEquals(66.5,TwoDimRaggedArrayUtility.getTotal(dataSet3),.001); assertEquals(-3.3,TwoDimRaggedArrayUtility.getTotal(dataSet4),.001); } /** * Test getAverage method * Returns the average of all the elements in the two dimensional array */ @Test public void testGetAverage() { assertEquals(4.5,TwoDimRaggedArrayUtility.getAverage(dataSet1),.001); assertEquals(5.417,TwoDimRaggedArrayUtility.getAverage(dataSet2),.001); assertEquals(6.045,TwoDimRaggedArrayUtility.getAverage(dataSet3),.001); assertEquals(-.3,TwoDimRaggedArrayUtility.getAverage(dataSet4),.001); //fail("Not yet implemented"); } /** * Test getRowTotal method * Returns the total of all the elements of the row. * Row 0 refers to the first row in the two dimensional array */ @Test public void testGetRowTotal() { assertEquals(9.0,TwoDimRaggedArrayUtility.getRowTotal(dataSet1,1),.001); assertEquals(5.0,TwoDimRaggedArrayUtility.getRowTotal(dataSet2,1),.001); assertEquals(22.0,TwoDimRaggedArrayUtility.getRowTotal(dataSet2,0),.001); assertEquals(28.5,TwoDimRaggedArrayUtility.getRowTotal(dataSet3,3),.001); assertEquals(5.9,TwoDimRaggedArrayUtility.getRowTotal(dataSet3,1),.001); assertEquals(3.8,TwoDimRaggedArrayUtility.getRowTotal(dataSet4,1),.001); assertEquals(-.2,TwoDimRaggedArrayUtility.getRowTotal(dataSet4,3),.001); //fail("Not yet implemented"); } /** * Test getColumnTotal method * Returns the total of all the elements in the column. If a row in the two dimensional array * doesn't have this column index, it is not an error, it doesn't participate in this method. * Column 0 refers to the first column in the two dimensional array */ @Test public void testGetColumnTotal() { assertEquals(11.0,TwoDimRaggedArrayUtility.getColumnTotal(dataSet1,0),.001); assertEquals(19.0,TwoDimRaggedArrayUtility.getColumnTotal(dataSet2,2),.001); assertEquals(11.1,TwoDimRaggedArrayUtility.getColumnTotal(dataSet3,1),.001); assertEquals(-8.8,TwoDimRaggedArrayUtility.getColumnTotal(dataSet4,0),.001); assertEquals(2.7,TwoDimRaggedArrayUtility.getColumnTotal(dataSet4,1),.001); //fail("Not yet implemented"); } /** * Test getHighestInRow method * Returns the largest of all the elements in the row. * Row 0 refers to the first row in the two dimensional array */ @Test public void testGetHighestInRow() { assertEquals(3.0,TwoDimRaggedArrayUtility.getHighestInRow(dataSet1,0),.001); assertEquals(8.0,TwoDimRaggedArrayUtility.getHighestInRow(dataSet2,2),.001); assertEquals(5.9,TwoDimRaggedArrayUtility.getHighestInRow(dataSet3,1),.001); assertEquals(6.1,TwoDimRaggedArrayUtility.getHighestInRow(dataSet4,0),.001); assertEquals(8.2,TwoDimRaggedArrayUtility.getHighestInRow(dataSet4,1),.001); //fail("Not yet implemented"); } /** * Test getHighestInRowIndex method * Returns the index of the largest of all the elements in the row. * Row 0 refers to the first row in the two dimensional array */ @Test public void testGetHighestInRowIndex() { assertEquals(2,TwoDimRaggedArrayUtility.getHighestInRowIndex(dataSet1,0)); assertEquals(0,TwoDimRaggedArrayUtility.getHighestInRowIndex(dataSet2,2)); assertEquals(0,TwoDimRaggedArrayUtility.getHighestInRowIndex(dataSet3,1)); assertEquals(2,TwoDimRaggedArrayUtility.getHighestInRowIndex(dataSet4,0)); assertEquals(1,TwoDimRaggedArrayUtility.getHighestInRowIndex(dataSet4,1)); } /** * Test getLowestInRowIndex method * Returns the index of the smallest of all the elements in the row. * Row 0 refers to the first row in the two dimensional array */ @Test public void testGetLowestInRowIndex() { assertEquals(0,TwoDimRaggedArrayUtility.getLowestInRowIndex(dataSet1,0)); assertEquals(1,TwoDimRaggedArrayUtility.getLowestInRowIndex(dataSet2,2)); assertEquals(0,TwoDimRaggedArrayUtility.getLowestInRowIndex(dataSet3,1)); assertEquals(1,TwoDimRaggedArrayUtility.getLowestInRowIndex(dataSet4,0)); assertEquals(0,TwoDimRaggedArrayUtility.getLowestInRowIndex(dataSet4,1)); } /** * Test getLowestInRow method * Returns the smallest of all the elements in the row. * Row 0 refers to the first row in the two dimensional array */ @Test public void testGetLowestInRow() { assertEquals(6.0,TwoDimRaggedArrayUtility.getLowestInRow(dataSet1,2),.001); assertEquals(5.0,TwoDimRaggedArrayUtility.getLowestInRow(dataSet2,1),.001); assertEquals(2.5,TwoDimRaggedArrayUtility.getLowestInRow(dataSet3,0),.001); assertEquals(-4.4,TwoDimRaggedArrayUtility.getLowestInRow(dataSet4,1),.001); assertEquals(-7.5,TwoDimRaggedArrayUtility.getLowestInRow(dataSet4,2),.001); //fail("Not yet implemented"); } /** * Test getHighestInColumn method * Returns the largest of all the elements in the column. If a row in the two dimensional array * doesn't have this column index, it is not an error, it doesn't participate in this method. * Column 0 refers to the first column in the two dimensional array */ @Test public void testGetHighestInColumn() { assertEquals(8.0,TwoDimRaggedArrayUtility.getHighestInColumn(dataSet1,2),.001); assertEquals(6.0,TwoDimRaggedArrayUtility.getHighestInColumn(dataSet2,1),.001); assertEquals(11.6,TwoDimRaggedArrayUtility.getHighestInColumn(dataSet3,0),.001); assertEquals(8.2,TwoDimRaggedArrayUtility.getHighestInColumn(dataSet4,1),.001); assertEquals(6.1,TwoDimRaggedArrayUtility.getHighestInColumn(dataSet4,2),.001); //fail("Not yet implemented"); } /** * Test getHighestInColumn method * Returns the index of the largest of all the elements in the column. If a row in the two dimensional array * doesn't have this column index, it is not an error, it doesn't participate in this method. * Column 0 refers to the first column in the two dimensional array */ @Test public void testGetHighestInColumnIndex() { assertEquals(2,TwoDimRaggedArrayUtility.getHighestInColumnIndex(dataSet1,2)); assertEquals(3,TwoDimRaggedArrayUtility.getHighestInColumnIndex(dataSet2,1)); assertEquals(3,TwoDimRaggedArrayUtility.getHighestInColumnIndex(dataSet3,0)); assertEquals(1,TwoDimRaggedArrayUtility.getHighestInColumnIndex(dataSet4,1)); assertEquals(0,TwoDimRaggedArrayUtility.getHighestInColumnIndex(dataSet4,2)); //fail("Not yet implemented"); } /** * Test getLowestInColumn method * Returns the smallest of all the elements in the column. If a row in the two dimensional array * doesn't have this column index, it is not an error, it doesn't participate in this method. * Column 0 refers to the first column in the two dimensional array */ @Test public void testGetLowestInColumn() { assertEquals(2.0,TwoDimRaggedArrayUtility.getLowestInColumn(dataSet1,1),.001); assertEquals(3.0,TwoDimRaggedArrayUtility.getLowestInColumn(dataSet2,2),.001); assertEquals(5.9,TwoDimRaggedArrayUtility.getLowestInColumn(dataSet3,0),.001); assertEquals(-4.4,TwoDimRaggedArrayUtility.getLowestInColumn(dataSet4,0),.001); assertEquals(-7.5,TwoDimRaggedArrayUtility.getLowestInColumn(dataSet4,1),.001); //fail("Not yet implemented"); } /** * Test getLowestInColumnIndex method * Returns the index of the smallest of all the elements in the column. If a row in the two dimensional array * doesn't have this column index, it is not an error, it doesn't participate in this method. * Column 0 refers to the first column in the two dimensional array */ @Test public void testGetLowestInColumnIndex() { assertEquals(0,TwoDimRaggedArrayUtility.getLowestInColumnIndex(dataSet1,1)); assertEquals(2,TwoDimRaggedArrayUtility.getLowestInColumnIndex(dataSet2,2)); assertEquals(1,TwoDimRaggedArrayUtility.getLowestInColumnIndex(dataSet3,0)); assertEquals(1,TwoDimRaggedArrayUtility.getLowestInColumnIndex(dataSet4,0)); assertEquals(2,TwoDimRaggedArrayUtility.getLowestInColumnIndex(dataSet4,1)); //fail("Not yet implemented"); } /** * Test getHighestInArray method * Returns the largest of all the elements in the two dimensional array. */ @Test public void testGetHighestInArray() { assertEquals(8.0,TwoDimRaggedArrayUtility.getHighestInArray(dataSet1),.001); assertEquals(11.0,TwoDimRaggedArrayUtility.getHighestInArray(dataSet2),.001); assertEquals(11.6,TwoDimRaggedArrayUtility.getHighestInArray(dataSet3),.001); assertEquals(8.2,TwoDimRaggedArrayUtility.getHighestInArray(dataSet4),.001); //fail("Not yet implemented"); } /** * Test getLowestInArray method * Returns the smallest of all the elements in the two dimensional array. */ @Test public void testGetLowestInArray() { assertEquals(1.0,TwoDimRaggedArrayUtility.getLowestInArray(dataSet1),.001); assertEquals(1.0,TwoDimRaggedArrayUtility.getLowestInArray(dataSet2),.001); assertEquals(1.7,TwoDimRaggedArrayUtility.getLowestInArray(dataSet3),.001); assertEquals(-7.5,TwoDimRaggedArrayUtility.getLowestInArray(dataSet4),.001); //fail("Not yet implemented"); } /** * Test the writeToFile method * write the array to the outputFile File * then read it back to make sure formatted correctly to read * */ @Test public void testWriteToFile() throws FileNotFoundException { double[][] array=null; try { TwoDimRaggedArrayUtility.writeToFile(dataSet4, outputFile); } catch (Exception e) { fail("This should not have caused an Exception"); } array = TwoDimRaggedArrayUtility.readFile(outputFile); assertEquals(-2.5, array[0][0],.001); assertEquals(-5.3, array[0][1],.001); assertEquals(6.1, array[0][2],.001); assertEquals(-4.4, array[1][0],.001); assertEquals(8.2, array[1][1],.001); assertEquals(2.3, array[2][0],.001); assertEquals(-7.5, array[2][1],.001); assertEquals(-4.2, array[3][0],.001); assertEquals(7.3, array[3][1],.001); assertEquals(-5.9, array[3][2],.001); assertEquals(2.6, array[3][3],.001); } /** * Test the readFile method * reads from a file and then test that the returned two dimensional array of doubles * is ragged. */ @Test public void testReadFile() { double[][] array=null; try { inputFile = new File("Test1.txt"); PrintWriter inFile = new PrintWriter(inputFile); inFile.print("-2.5 -5.3 6.1\n" + "-4.4 8.2\n" + "2.3 -7.5\n" + "-4.2 7.3 -5.9 2.6"); inFile.close(); array = TwoDimRaggedArrayUtility.readFile(inputFile); assertEquals(-2.5, array[0][0],.001); assertEquals(-5.3, array[0][1],.001); assertEquals(6.1, array[0][2],.001); assertEquals(-4.4, array[1][0],.001); assertEquals(8.2, array[1][1],.001); assertEquals(2.3, array[2][0],.001); assertEquals(-7.5, array[2][1],.001); assertEquals(-4.2, array[3][0],.001); assertEquals(7.3, array[3][1],.001); assertEquals(-5.9, array[3][2],.001); assertEquals(2.6, array[3][3],.001); } catch (FileNotFoundException e) { // TODO Auto-generated catch block fail("This should not have caused an FileNotFoundException"); } //testing that the array is a ragged array try{ assertEquals(0.0, array[1][2],.001); fail("This should have caused a ArrayIndexOutOfBoundsException"); } catch (ArrayIndexOutOfBoundsException e){ assertTrue("Correctly threw ArrayIndexOutOfBoundsException", true); } catch (Exception e) { // TODO Auto-generated catch block fail("This should not have caused an Exception"); } //testing that the array is a ragged array try{ assertEquals(0.0, array[2][2],.001); fail("This should have caused a ArrayIndexOutOfBoundsException"); } catch (ArrayIndexOutOfBoundsException e){ assertTrue("Correctly threw ArrayIndexOutOfBoundsException", true); } catch (Exception e) { // TODO Auto-generated catch block fail("This should not have caused an Exception"); } }
[ "noreply@github.com" ]
fmancia1.noreply@github.com
caac1aeb95c453ce1825e732e47504c1fde15d14
555e512780c5a5d9421036adae3221a311c746ea
/src/SinglyLinkedList.java
1ed21b567b7ea6aa431c605d54fdedaf416330e3
[]
no_license
rsrob600/SLL_JavaDataStructures
82adeb6aec084bb0feeaba613f6026e88d992d91
30b0a96cb33984813a7feecaa70d2a0848f937bb
refs/heads/master
2020-06-10T04:20:58.638592
2019-06-24T21:06:11
2019-06-24T21:06:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,453
java
public class SinglyLinkedList { public Node head; public SinglyLinkedList() { // your code here // Set head to null sll constructor (don't think code is necessary here) //this.head = null; } // Print all nodes in the list public void printValues() { if(head == null) { return; } Node current = head; while(current != null) { System.out.println(current.value); current = current.next; } System.out.println(current); } // Append new node to list: public void add(int value) { // instantiation of new node (reference back to the node constructor) Node newNode = new Node(value); // establish the starting node of the linked list if(head == null) { head = newNode; } else { // start loop at the beginning of the linked list with the first node "Head" Node runner = head; // run the loop over the "Next" values of each node until you get to the end of the linked list or "Null" while(runner.next != null) { // walk the loop down through the list (one node at a time) runner = runner.next; } // once at the end of the linked list "Next" values or "Null" add a new node runner.next = newNode; } } // SSL method to remove the last node from the list public void remove() { // establish the starting point of the linked list if(head == null) { } // remove the pointer to the last node (making it the head of it's own single node link list) effectively removing it from the original linked list Node last = head; // setting the previous node to "Null" so it is the end of the list now Node previous = null; // run the loop until you get to the end of the linked list or "Null" while(last.next != null) { // setting the last node to head so it removes it from the original linked list previous = last; // walk the loop down through the list (one node at a time) last = last.next; } // set the node that was just before the last one we deleted to "Null" making it the end of the list now previous.next = null; } }
[ "noreply@github.com" ]
rsrob600.noreply@github.com
df3ac3abbaf8a2ce611ea6daf3e0225e551afe8e
a4ed3b1f3ab045bf5e3a1e6bf0694e51e51f7233
/sldparser/src/main/geotools/filter/LogicFilterImpl.java
2ff94075734139b4b10d318d06efbccf515c7433
[ "Apache-2.0" ]
permissive
TerraMobile/TerraMobile
7ffd2d6a2e4f04e59fb5b71badb00a962998d46d
6380b6c3730294947c8d70d6f3b3a06dce12aa92
refs/heads/master
2021-07-15T08:23:50.581870
2016-04-13T20:43:00
2016-04-13T20:43:00
32,412,196
2
2
Apache-2.0
2020-07-12T09:50:30
2015-03-17T18:26:56
Java
UTF-8
Java
false
false
7,480
java
/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) * * 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; * version 2.1 of the License. * * 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 org.geotools.filter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.opengis.filter.Filter; import org.opengis.filter.FilterVisitor; /** * Defines a logic filter (the only filter type that contains other filters). * This filter holds one or more filters together and relates them logically * with an internally defined type (AND, OR, NOT). * * @author Rob Hranac, TOPP * * * @source $URL$ * @version $Id$ */ public abstract class LogicFilterImpl extends BinaryLogicAbstract { /** The logger for the default core module. */ private static final Logger LOGGER = org.geotools.util.logging.Logging.getLogger("org.geotools.core"); @Deprecated protected LogicFilterImpl() { this(new ArrayList<Filter>()); } protected LogicFilterImpl(List<Filter> children) { super(children); } /** * Convenience constructor to create a NOT logic filter. * * @param filter The initial sub filter. * @throws org.geotools.filter.IllegalFilterException Does not conform to logic filter * structure */ @Deprecated protected LogicFilterImpl(Filter filter) throws IllegalFilterException { this(); children.add(filter); } /** * Convenience constructor to create an AND/OR logic filter. * * @param filter1 An initial sub filter. * @param filter2 An initial sub filter. * @param filterType The final relation between all sub filters. * * @throws org.geotools.filter.IllegalFilterException Does not conform to logic filter * structure */ protected LogicFilterImpl(Filter filter1, Filter filter2, short filterType) throws IllegalFilterException { this(); // Push the initial filter on the stack children.add(filter1); // Add the second filter via internal method to check for illegal NOT this.addFilter(filter2); } /** * Adds a sub filter to this filter. * * @param filter Specified filter to add to the sub filter list. * * @throws org.geotools.filter.IllegalFilterException Does not conform to logic filter * structure * * @task REVISIT: make all filters immutable. This should return a new * filter. */ public final void addFilter(Filter filter) throws IllegalFilterException { int filterType = Filters.getFilterType(this); if ((filterType != LOGIC_NOT) || (children.size() == 0)) { children.add(filter); } else { throw new IllegalFilterException( "Attempted to add an more than one filter to a NOT filter."); } } /** * Gets an iterator for the filters held by this logic filter. * * @return the iterator of the filters. */ public Iterator getFilterIterator() { return children.iterator(); } /** * package private method to get the internal storage of filters. * * @return the internal sub filter list. * * @deprecated use {@link #getChildren()} */ List getSubFilters() { return children; } /** * Returns a string representation of this filter. * * @return String representation of the logic filter. */ public String toString() { String returnString = "["; String operator = ""; Iterator iterator = children.iterator(); int filterType = Filters.getFilterType(this); if (filterType == LOGIC_OR) { operator = " OR "; } else if (filterType == LOGIC_AND) { operator = " AND "; } else if (filterType == LOGIC_NOT) { return "[ NOT " + iterator.next().toString() + " ]"; } while (iterator.hasNext()) { returnString = returnString + iterator.next().toString(); if (iterator.hasNext()) { returnString = returnString + operator; } } return returnString + "]"; } /** * Compares this filter to the specified object. Returns true if the * passed in object is the same as this filter. Checks to make sure the * filter types are the same, and then checks that the subFilters lists * are the same size and that one list contains the other. This means * that logic filters with different internal orders of subfilters are * equal. * * @param obj - the object to compare this LogicFilter against. * * @return true if specified object is equal to this filter; false * otherwise. */ public boolean equals(Object obj) { if (obj == this ) return true; if ((obj != null) && (obj.getClass() == this.getClass())) { LogicFilterImpl logFilter = (LogicFilterImpl) obj; if( LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("filter type match:" + (Filters.getFilterType( logFilter ) == Filters.getFilterType( this ))); LOGGER.finest("same size:" + (logFilter.getSubFilters().size() == this.children.size()) + "; inner size: " + logFilter.getSubFilters().size() + "; outer size: " + this.children.size()); LOGGER.finest("contains:" + logFilter.getSubFilters().containsAll(this.children)); } return ((Filters.getFilterType( logFilter ) == Filters.getFilterType( this )) && (logFilter.getSubFilters().size() == this.children.size()) && logFilter.getSubFilters().containsAll(this.children)); } else { return false; } } /** * Override of hashCode method. * * @return a code to hash this object by. */ public int hashCode() { int result = 17; int filterType = Filters.getFilterType(this); result = (37 * result) + filterType; result = (37 * result) + children.hashCode(); return result; } /** * Used by FilterVisitors to perform some action on this filter instance. * Typicaly used by Filter decoders, but may also be used by any thing * which needs infomration from filter structure. Implementations should * always call: visitor.visit(this); It is importatant that this is not * left to a parent class unless the parents API is identical. * * @param visitor The visitor which requires access to this filter, the * method must call visitor.visit(this); */ public abstract Object accept(FilterVisitor visitor, Object extraData); }
[ "claudio.bogossian@gmail.com" ]
claudio.bogossian@gmail.com
9c4a82aac3aca13633e91c9593cb6c43f3349b8f
d808fc5430bfcc04bc7e5ead852423212cfc0ff6
/camera/camera-camera2/src/main/java/androidx/camera/camera2/impl/package-info.java
f8fd68a3e383cdafc808274536fc76a916c20f51
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
homerredroc/platform_frameworks_support
3a99e16b0100832bb6405c182c55901d0525c7ec
b9cd83371e928380610719dfbf97c87c58e80916
refs/heads/androidx-master-dev
2022-12-14T15:11:38.280256
2019-07-12T23:46:45
2019-07-12T23:46:45
222,355,236
1
0
Apache-2.0
2022-12-10T12:48:48
2019-11-18T03:24:06
null
UTF-8
Java
false
false
750
java
/* * Copyright 2019 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. */ /** * @hide */ @RestrictTo(RestrictTo.Scope.LIBRARY) package androidx.camera.camera2.impl; import androidx.annotation.RestrictTo;
[ "trevormcguire@google.com" ]
trevormcguire@google.com
d5076018bfdfd0d5405b94fa8be32c04bd02f700
1d5c3b08b684b850ab7b3a1995a2f919d8424264
/app/src/main/java/com/kmnfsw/work/question/util/androidTree/NodeTreeAdapter.java
d86067b4cc879a453e1cc73498a9b70049dd6369
[]
no_license
gzchenbing/EmployeeWork
80c00d97325115f41d680453035177761b4eb417
293a4b45fdf65c573df827d39f8c2cb351c60171
refs/heads/master
2020-04-01T22:32:56.519168
2018-10-19T02:18:25
2018-10-19T02:18:25
153,714,281
1
0
null
null
null
null
UTF-8
Java
false
false
6,516
java
package com.kmnfsw.work.question.util.androidTree; import java.util.LinkedList; import java.util.List; import com.kmnfsw.work.R; import android.content.Context; import android.content.res.TypedArray; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; /** * Created by HQOCSHheqing on 2016/8/3. * * @description 适配器类,就是listview最常见的适配器写法 */ public class NodeTreeAdapter extends BaseAdapter{ private static final String Tag = ".question.util.androidTree.NodeTreeAdapter"; //大家经常用ArrayList,但是这里为什么要使用LinkedList // ,后面大家会发现因为这个list会随着用户展开、收缩某一项而频繁的进行增加、删除元素操作, // 因为ArrayList是数组实现的,频繁的增删性能低下,而LinkedList是链表实现的,对于频繁的增删 //操作性能要比ArrayList好。 private LinkedList<Node> nodeLinkedList; private LayoutInflater inflater; private int retract;//缩进值 private Context context; private TreeItemClickCallback treeItemClickCallback; public NodeTreeAdapter(Context context,ListView listView,LinkedList<Node> linkedList,TreeItemClickCallback clickback){ inflater = LayoutInflater.from(context); this.context = context; nodeLinkedList = linkedList; treeItemClickCallback = clickback; listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { expandOrCollapse(position); } }); //缩进值,可以将它配置在资源文件中,从而实现适配 retract = (int)(context.getResources().getDisplayMetrics().density*10+0.5f); //Log.i(Tag, "缩进值"+retract); } /** * 展开或收缩用户点击的条目 * @param position */ private void expandOrCollapse(int position){ Node node = nodeLinkedList.get(position); if (node != null && !node.isLeaf()){ boolean old = node.isExpand(); if (old){ List<Node> nodeList = node.get_childrenList(); int size = nodeList.size(); Node tmp = null; for (int i = 0;i < size;i++){ tmp = nodeList.get(i); if (tmp.isExpand()){ collapse(tmp,position+1); } nodeLinkedList.remove(position+1); } }else{ nodeLinkedList.addAll(position + 1, node.get_childrenList()); } node.setIsExpand(!old); notifyDataSetChanged(); } } /** * 递归收缩用户点击的条目 * 因为此中实现思路是:当用户展开某一条时,就将该条对应的所有子节点加入到nodeLinkedList * ,同时控制缩进,当用户收缩某一条时,就将该条所对应的子节点全部删除,而当用户跨级缩进时 * ,就需要递归缩进其所有的孩子节点,这样才能保持整个nodeLinkedList的正确性,同时这种实 * 现方式避免了每次对所有数据进行处理然后插入到一个list,最后显示出来,当数据量一大,就会卡顿, * 所以这种只改变局部数据的方式性能大大提高。 * @param position */ private void collapse(Node node,int position){ node.setIsExpand(false); List<Node> nodes = node.get_childrenList(); int size = nodes.size(); Node tmp = null; for (int i = 0;i < size;i++){ tmp = nodes.get(i); if (tmp.isExpand()){ collapse(tmp,position+1); } nodeLinkedList.remove(position+1); } } @Override public int getCount() { return nodeLinkedList.size(); } @Override public Object getItem(int position) { return nodeLinkedList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null){ convertView = inflater.inflate(R.layout.android_tree_item,null); holder = new ViewHolder(); holder.imageView = (ImageView)convertView.findViewById(R.id.id_treenode_icon); holder.label = (TextView)convertView.findViewById(R.id.id_treenode_label); holder.confirm = (LinearLayout)convertView.findViewById(R.id.id_confirm); convertView.setTag(holder); }else{ holder = (ViewHolder)convertView.getTag(); } Node node = nodeLinkedList.get(position); holder.label.setText(node.get_label()); if(node.get_icon() == -1){//最后一级 holder.imageView.setVisibility(View.INVISIBLE); holder.confirm.setVisibility(View.VISIBLE);//最后一级时对提交按钮进行渲染 }else{ holder.imageView.setVisibility(View.VISIBLE); holder.imageView.setImageResource(node.get_icon()); holder.confirm.setVisibility(View.INVISIBLE);//非最后一级时对提交按钮进行隐藏 } holder.confirm.setTag(position); holder.confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(context,"选中:"+v.getTag(),Toast.LENGTH_SHORT).show(); //Log.i(Tag, "选中:"+v.getTag()); treeItemClickCallback.getTreeItemClickData((int)v.getTag()); } }); convertView.setPadding(node.get_level()*retract,5,5,5);//处理缩进 return convertView; } static class ViewHolder{ public ImageView imageView; public TextView label; public LinearLayout confirm; } /**用于点击事件回调*/ public interface TreeItemClickCallback{ public void getTreeItemClickData(int position); } }
[ "gzchenbing@qq.com" ]
gzchenbing@qq.com
5dc1d12f7ea03eb21bb33f5650bb3e6c5d07d39d
5a04b13b77c0385bbf3fe3e92d54c97c5390afa1
/HashMapTest.java
727bae0d100e4ca2da05889c6865354edbd58252
[]
no_license
517-JY/Dijikstra-ShortestMapPath
ed995f3774c0be3a5ebd2253f233e444729a771b
945eee4d3248d73aa947cb820f5c3b05692b4462
refs/heads/main
2023-04-23T02:11:59.862215
2021-05-13T03:52:49
2021-05-13T03:52:49
366,927,210
0
0
null
null
null
null
UTF-8
Java
false
false
2,637
java
import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class HashMapTest { @Test void hasKeyTest() { HashMap mp = new HashMap(); GraphNode node1 = new GraphNode("5451397c-0d6e-4d7d-985f-bd627dcd2fcc", false); mp.set(node1, 1); GraphNode node2 = new GraphNode("22bea985-2d6b-4f9c-80f5-15001db7b822", false); mp.set(node2, 2); GraphNode node3 = new GraphNode("37420837-eb1e-43e8-a8f2-ac464a413195", false); assertEquals(true, mp.hasKey(node1)); assertEquals(true, mp.hasKey(node2)); assertEquals(false, mp.hasKey(node3)); } @Test void setAndRehashTest() { HashMap mp = new HashMap(); GraphNode node1 = new GraphNode("5451397c-0d6e-4d7d-985f-bd627dcd2fcc", false); mp.set(node1, 1); GraphNode node2 = new GraphNode("22bea985-2d6b-4f9c-80f5-15001db7b822", false); mp.set(node2, 2); GraphNode node3 = new GraphNode("555d9242-ea47-440c-b3ac-e492542171b7", false); mp.set(node3, 3); GraphNode node4 = new GraphNode("3286c2a7-e17b-438d-8116-7ce1be04c1d0", false); mp.set(node4, 4); GraphNode node5 = new GraphNode("080e073d-70e9-46d5-9182-08d4671f9ee6", false); mp.set(node5, 5); assertEquals(5, mp.size()); GraphNode node6 = new GraphNode("6ec0919a-11ba-418a-b81d-2b4bc2443850", false); mp.set(node6, 6); GraphNode node7 = new GraphNode("d060dbd6-49a0-4880-a986-46e13cb7738e", false); mp.set(node7, 7); GraphNode node8 = new GraphNode("66271f0e-0d4c-45f5-ae9f-12d7bb76f0a1", false); mp.set(node8, 8); GraphNode node9 = new GraphNode("aa08af04b2f0 8fe2b48d-4ba3-4680-a2f8", false); mp.set(node9, 9); GraphNode node10 = new GraphNode("a09932c5-87cb-46e1-88b9-9cc7cc9ebf37", false); mp.set(node10, 10); GraphNode node11 = new GraphNode("13f480ea-7811-4461-be93-d7cc3c7a86cb", false); mp.set(node11, 11); GraphNode node12 = new GraphNode("ad45f53b-13a8-44fd-80e7-63eac1b6ef04", false); mp.set(node12, 12); assertEquals(12, mp.size()); } @Test void getValueTest() { HashMap mp = new HashMap(); GraphNode node1 = new GraphNode("5451397c-0d6e-4d7d-985f-bd627dcd2fcc", false); mp.set(node1, 1); GraphNode node2 = new GraphNode("22bea985-2d6b-4f9c-80f5-15001db7b822", false); mp.set(node2, 2); GraphNode node3 = new GraphNode("555d9242-ea47-440c-b3ac-e492542171b7", false); mp.set(node3, 3); mp.set(node2, 4); mp.set(node3, 5); GraphNode node4 = new GraphNode("3286c2a7-e17b-438d-8116-7ce1be04c1d0", false); assertEquals(1, mp.getValue(node1)); assertEquals(4, mp.getValue(node2)); assertEquals(5, mp.getValue(node3)); assertEquals(-1, mp.getValue(node4)); } }
[ "noreply@github.com" ]
517-JY.noreply@github.com
ca763af96363e94818cb52d5cd622805f5bf9f31
408fa67e9d4a425f164da274ed7dd65e3ae155ca
/spring-boot/004-bean/src/main/java/com/git/hui/boot/bean/rest/DemoController.java
fe355c59a9b12766e35b3135adc328798a98ffe9
[ "Apache-2.0" ]
permissive
liuyueyi/spring-boot-demo
c7d1c73135d998b366c793ab05ce5fed295cc32a
8960892da18cc3aa3f32b131d6d524d13bbec6fa
refs/heads/master
2023-08-30T22:52:04.738407
2023-08-16T14:50:02
2023-08-16T14:50:02
149,739,805
584
328
Apache-2.0
2023-04-29T12:52:28
2018-09-21T09:14:27
Java
UTF-8
Java
false
false
1,845
java
package com.git.hui.boot.bean.rest; import com.alibaba.fastjson.JSON; import com.git.hui.boot.autoconfig.AutoBean; import com.git.hui.boot.autoconfig.AutoConfBean; import com.git.hui.boot.bean.autoload.factory.FacDemoBean; import com.git.hui.boot.bean.autoload.simple.AnoDemoBean; import com.git.hui.boot.bean.autoload.simple.ConfigDemoBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; /** * Created by @author yihui in 17:04 18/9/30. */ @RestController public class DemoController { /** * 构造方法引入方式 */ private AnoDemoBean anoDemoBean; public DemoController(AnoDemoBean anoDemoBean) { this.anoDemoBean = anoDemoBean; } /** * 经典的注解引入方式 */ @Autowired private ConfigDemoBean configDemoBean; /** * 通过 FactoryBean 创建bean的使用测试 */ private FacDemoBean facDemoBean; @Autowired private void setFacDemoBean(FacDemoBean facDemoBean) { this.facDemoBean = facDemoBean; } /** * 测试引入第三方包的情况 */ @Autowired private AutoBean autoBean; @Autowired private AutoConfBean autoConfBean; @GetMapping(path = "/show") public String show(String name) { Map<String, String> map = new HashMap<>(4); map.put("ano", anoDemoBean.getName(name)); map.put("config", configDemoBean.getName(name)); map.put("fac", facDemoBean.getName(name)); map.put("auto", autoBean != null ? autoBean.getName() : "null"); map.put("autoConf", autoConfBean != null ? autoConfBean.getName() : "null"); return JSON.toJSONString(map); } }
[ "bangzewu@126.com" ]
bangzewu@126.com
0c88f17b3f711fdd2c63261aee6da8f7b78d058a
16935ecd3e9029392feae94ac683b2b259150828
/aws-java-sdk-proton/src/main/java/com/amazonaws/services/proton/model/GetServiceInstanceResult.java
a3774e76dbd8684ef3468032e2f7af5b3642ea65
[ "Apache-2.0" ]
permissive
segfaultomatic/aws-sdk-java
c33b627d4172956cb219ceb706c4dfd040cb1e1f
7377e690a8be4de39068ba51226c4d8e0637f720
refs/heads/master
2022-06-18T03:22:43.141443
2022-05-27T20:39:37
2022-05-27T20:39:37
214,092,414
0
0
Apache-2.0
2019-10-10T05:14:48
2019-10-10T05:14:47
null
UTF-8
Java
false
false
4,096
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.proton.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceInstance" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetServiceInstanceResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * The service instance detail data that's returned by Proton. * </p> */ private ServiceInstance serviceInstance; /** * <p> * The service instance detail data that's returned by Proton. * </p> * * @param serviceInstance * The service instance detail data that's returned by Proton. */ public void setServiceInstance(ServiceInstance serviceInstance) { this.serviceInstance = serviceInstance; } /** * <p> * The service instance detail data that's returned by Proton. * </p> * * @return The service instance detail data that's returned by Proton. */ public ServiceInstance getServiceInstance() { return this.serviceInstance; } /** * <p> * The service instance detail data that's returned by Proton. * </p> * * @param serviceInstance * The service instance detail data that's returned by Proton. * @return Returns a reference to this object so that method calls can be chained together. */ public GetServiceInstanceResult withServiceInstance(ServiceInstance serviceInstance) { setServiceInstance(serviceInstance); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getServiceInstance() != null) sb.append("ServiceInstance: ").append(getServiceInstance()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetServiceInstanceResult == false) return false; GetServiceInstanceResult other = (GetServiceInstanceResult) obj; if (other.getServiceInstance() == null ^ this.getServiceInstance() == null) return false; if (other.getServiceInstance() != null && other.getServiceInstance().equals(this.getServiceInstance()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getServiceInstance() == null) ? 0 : getServiceInstance().hashCode()); return hashCode; } @Override public GetServiceInstanceResult clone() { try { return (GetServiceInstanceResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
cef5d203f78bbc6feec050d624191cf87b6adff2
b27bb003540a65cfc8b0b107783037666e79ec14
/Milestone1/src/com/wipro/flowcontrolstatements/Loop12.java
36fe4d83008b1746c0059fb1744412d63656a8ff
[]
no_license
sree39/WTN
6736c2ec6b5ac1f3dd137e7f4750fdc2727d6a23
4db05f54636328b6f2cbf8b907f91ce700896a36
refs/heads/master
2022-11-27T00:03:15.072839
2020-07-27T06:12:18
2020-07-27T06:12:18
271,682,377
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.wipro.flowcontrolstatements; public class Loop12 { public static void main(String[]args) { int n=Integer.parseInt(args[0]); int i; int flag=0; for(i=2;i<=n/2;i++) { if(n%i==0) { flag=1; } } if(flag!=1) { System.out.println("Prime number"); } else { System.out.println("Not a Prime number"); } } }
[ "lenovo@sreelekha" ]
lenovo@sreelekha
7566b92754f6c5ac26669105a49840f329c12b01
de7327cf2c98408e2bf39d1be4588502c409ad8b
/app/build/generated/ap_generated_sources/debug/out/pdf/pdftool/adapter/AdapterImageFilters$ViewHolder_ViewBinding.java
23f59d4865b24bbb840afb0db801cf2a39abc666
[]
no_license
afaqbhatti1/AdvancePDFTool
2eeebeddc7eda41a672c5ca8eeb025c5126c2f16
9b06a6da9ff9be40d59f2ba1be173ae4eb1042ae
refs/heads/master
2023-07-28T02:26:22.801776
2021-09-13T06:47:16
2021-09-13T06:47:16
405,847,569
0
0
null
null
null
null
UTF-8
Java
false
false
1,171
java
// Generated code from Butter Knife. Do not modify! package pdf.pdftool.adapter; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.CallSuper; import androidx.annotation.UiThread; import butterknife.Unbinder; import butterknife.internal.Utils; import java.lang.IllegalStateException; import java.lang.Override; import pdf.pdftool.R; public class AdapterImageFilters$ViewHolder_ViewBinding implements Unbinder { private AdapterImageFilters.ViewHolder target; @UiThread public AdapterImageFilters$ViewHolder_ViewBinding(AdapterImageFilters.ViewHolder target, View source) { this.target = target; target.img = Utils.findRequiredViewAsType(source, R.id.filter_preview, "field 'img'", ImageView.class); target.name = Utils.findRequiredViewAsType(source, R.id.filter_Name, "field 'name'", TextView.class); } @Override @CallSuper public void unbind() { AdapterImageFilters.ViewHolder target = this.target; if (target == null) throw new IllegalStateException("Bindings already cleared."); this.target = null; target.img = null; target.name = null; } }
[ "afaqbhatti0@gmail.com" ]
afaqbhatti0@gmail.com
80a1b79523ca57f763a0b27a1807720703181da7
5b78639cc285964275b4dadec8dd8fd08b91b097
/spring-integration/src/main/java/com/mtsmda/spring_integration/lab6/enrichers/football/FootballClub.java
c18378404b2d4ac832ff06eb0b250ab9fa5a0393
[]
no_license
akbars95/jms
a7271565bf60e95721fab0d86f3cbcaf1ab45751
b0b7042c1453074e055a91a38b1564dd79ba3778
refs/heads/master
2020-07-21T06:11:58.584030
2016-12-08T12:17:03
2016-12-08T12:17:03
73,852,177
0
0
null
null
null
null
UTF-8
Java
false
false
1,228
java
package com.mtsmda.spring_integration.lab6.enrichers.football; /** * Created by dminzat on 11/24/2016. */ public class FootballClub { private String footballClubName; private int place; private String footballNextPath; public FootballClub() { } public FootballClub(String footballClubName, int place) { this.footballClubName = footballClubName; this.place = place; } public String getFootballClubName() { return footballClubName; } public void setFootballClubName(String footballClubName) { this.footballClubName = footballClubName; } public int getPlace() { return place; } public void setPlace(int place) { this.place = place; } public String getFootballNextPath() { return footballNextPath; } public void setFootballNextPath(String footballNextPath) { this.footballNextPath = footballNextPath; } @Override public String toString() { return "FootballClub{" + "footballClubName='" + footballClubName + '\'' + ", place=" + place + ", footballNextPath='" + footballNextPath + '\'' + '}'; } }
[ "Dmitri.Minzat@endava.com" ]
Dmitri.Minzat@endava.com
3004d7f79c1aa1a0183a95bee686677753d1c6f0
4feee104e69148b60f07a5d64a97177ebb200ffa
/Course2/Week3/HashSubstring.java
38f2102113abe5091e3d9d661e2e33942eea1c20
[]
no_license
Hdbcoding/ucsd_algorithms
1721d1cf9e9cc8c3cea24c914e2cbaa6e4bdc581
c43f0710d495eb8f5f529356eb961021a67fa455
refs/heads/master
2020-07-06T15:00:16.954453
2020-03-08T02:05:13
2020-03-08T02:05:13
203,059,422
0
1
null
null
null
null
UTF-8
Java
false
false
5,018
java
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class HashSubstring { public static void main(String[] args) throws IOException { runSolution(); // testSolution(); } static void runSolution() throws IOException { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); printOccurrences(getOccurencesRobinKarp(readInput(in)), out); out.close(); } static void testSolution() { runTest(new Data("aba", "abacaba"), new int[] { 0, 4 }); runTest(new Data("Test", "testTesttesT"), new int[] { 4 }); runTest(new Data("aaaaa", "baaaaaaa"), new int[] { 1, 2, 3 }); } static void runTest(Data input, int[] expected) { List<Integer> actual = getOccurencesRobinKarp(input); String eString = Arrays.toString(expected); String aString = Arrays.toString(actual.toArray()); if (!eString.equals(aString)) System.out.println("Unexpected result for " + input.text + ", " + input.pattern + ". Expected " + eString + ", but got " + aString); } static List<Integer> getOccurrencesNaive(Data input) { String pattern = input.pattern, text = input.text; int m = pattern.length(), n = text.length(); List<Integer> occurrences = new ArrayList<Integer>(); for (int i = 0; i + m <= n; ++i) { if (patternMatched(pattern, text, i)) occurrences.add(i); } return occurrences; } static Data readInput(FastScanner in) throws IOException { String pattern = in.next(); String text = in.next(); return new Data(pattern, text); } static void printOccurrences(List<Integer> ans, PrintWriter out) throws IOException { for (Integer cur : ans) { out.print(cur); out.print(" "); } } static boolean patternMatched(String pattern, String text, int i) { boolean equal = true; for (int j = 0; j < pattern.length(); ++j) { if (pattern.charAt(j) != text.charAt(i + j)) { equal = false; break; } } return equal; } static List<Integer> getOccurencesRobinKarp(Data input) { String pattern = input.pattern, text = input.text; List<Integer> result = new ArrayList<>(); long[] hashes = getSubstringHashes(text, pattern.length()); long pHash = getHashCode(pattern); for (int i = 0; i + pattern.length() <= text.length(); i++) { long tHash = hashes[i]; if (pHash != tHash) continue; if (patternMatched(pattern, text, i)) result.add(i); } return result; } static long[] getSubstringHashes(String text, int pLength) { int indexLastPattern = text.length() - pLength; long[] hashes = new long[indexLastPattern + 1]; hashes[indexLastPattern] = getHashCode(text, indexLastPattern, pLength); long y = pow_x(pLength); for (int i = indexLastPattern - 1; i >= 0; i--){ char next = text.charAt(i); char prev = text.charAt(i + pLength); long v = hashes[i+1] * x + next - y * prev; hashes[i] = safeModulo(v); } return hashes; } static long pow_x(int l) { long y = 1; for (int i = 0; i < l; i++){ long v = y * x; y = safeModulo(v); } return y; } static long getHashCode(String pattern) { return getHashCode(pattern, 0, pattern.length()); } static long x = 31; static long p = 1000000007; static long getHashCode(String t, int i, int l) { long hash = 0; for (int j = l - 1; j >= 0; j--) { char c = t.charAt(i + j); long v = hash * x + c; hash = safeModulo(v); } return hash; } private static long safeModulo(long v) { return ((v % p) + p) % p; } static class Data { String pattern; String text; public Data(String pattern, String text) { this.pattern = pattern; this.text = text; } } static class FastScanner { private BufferedReader reader; private StringTokenizer tokenizer; public FastScanner() { reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = null; } public String next() throws IOException { while (tokenizer == null || !tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine()); } return tokenizer.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } } }
[ "hdbyrd1@gmail.com" ]
hdbyrd1@gmail.com
7395d4828d367b3b784f578584512f630795ceb7
be20d3878b2f9b5328e865bf4e40f4e10ab6dc84
/app/src/main/java/com/lixin/foodmarket/activity/MyApplication.java
94e47d01bada979b46e2a21c255c62588b64d39f
[]
no_license
iSmartest/FoodMarket
985ad1360c499f811c95bd0199798a3a53087262
9b66ac2e4c973e4e010cc458593e75ecb550fd4b
refs/heads/master
2021-01-23T04:38:56.460739
2017-05-31T10:13:21
2017-05-31T10:13:21
92,933,590
0
0
null
null
null
null
UTF-8
Java
false
false
4,165
java
package com.lixin.foodmarket.activity; import android.app.Activity; import android.app.ActivityManager; import android.app.Application; import android.content.Context; import android.content.Intent; import android.os.Bundle; import com.lixin.foodmarket.tool.ImageManager; import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.assist.QueueProcessingType; import com.umeng.socialize.PlatformConfig; import com.umeng.socialize.UMShareAPI; //import com.baidu.mapapi.SDKInitializer; //import com.lixin.carclassstore.tools.ImageManager; //import com.umeng.socialize.PlatformConfig; //import com.umeng.socialize.UMShareAPI; public class MyApplication extends Application { public static Context CONTEXT; private static MyApplication myApplication; @Override public void onCreate() { super.onCreate(); CONTEXT=getApplicationContext(); initImageLoader(this); UMShareAPI.get(this); // SDKInitializer.initialize(CONTEXT); PlatformConfig.setWeixin("wxf4d512f8f11f566f","81acb0fcccd4e0ea7c835f4da19155d3"); PlatformConfig.setQQZone("1106112021","tNy60cXvvRrG1goP"); myApplication = this; } public static MyApplication getApplication() { return myApplication; } /** * 通过类名启动Activity * * @param targetClass */ public static void openActivity(Context context, Class<?> targetClass) { openActivity(context, targetClass, null); } /** * 通过类名启动Activity,并且含有Bundle数据 * * @param targetClass * @param extras */ public static void openActivity(Context context, Class<?> targetClass, Bundle extras) { Intent intent = new Intent(context, targetClass); if (extras != null) { intent.putExtras(extras); } context.startActivity(intent); } public static void openActivityForResult(Activity activity, Class<?> targetClass, Bundle extras, int requestCode) { Intent intent = new Intent(activity, targetClass); if (extras != null) { intent.putExtras(extras); } activity.startActivityForResult(intent, requestCode); } public static void openActivityForResult(Activity activity, Class<?> targetClass, int requestCode) { openActivityForResult(activity, targetClass, null, requestCode); } /** * 通过Action启动Activity * * @param action */ public static void openActivity(Context context, String action) { openActivity(context, action, null); } /** * 通过Action启动Activity,并且含有Bundle数据 * * @param action * @param extras */ public static void openActivity(Context context, String action, Bundle extras) { Intent intent = new Intent(action); if (extras != null) { intent.putExtras(extras); } context.startActivity(intent); } public void exit() { //使用状态统计-结束 // ImageManager.imageLoader.destroy(); android.os.Process.killProcess(android.os.Process.myPid()); ActivityManager activityMgr = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); activityMgr.killBackgroundProcesses(getPackageName()); System.exit(0); } public static void initImageLoader(Context context) { ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory() .discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO) .build(); ImageLoader.getInstance().init(config); ImageManager.init(); } }
[ "1403241630qq.com" ]
1403241630qq.com
372de353582317f4a7e56dc8ac3d584d81d2197b
e42afd54dcc0add3d2b8823ee98a18c50023a396
/java-vmmigration/proto-google-cloud-vmmigration-v1/src/main/java/com/google/cloud/vmmigration/v1/UpdateMigratingVmRequest.java
8e9f08ce4ed210204e7f42d15bc25010a458be5e
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
degloba/google-cloud-java
eea41ebb64f4128583533bc1547e264e730750e2
b1850f15cd562c659c6e8aaee1d1e65d4cd4147e
refs/heads/master
2022-07-07T17:29:12.510736
2022-07-04T09:19:33
2022-07-04T09:19:33
180,201,746
0
0
Apache-2.0
2022-07-04T09:17:23
2019-04-08T17:42:24
Java
UTF-8
Java
false
false
46,275
java
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/vmmigration/v1/vmmigration.proto package com.google.cloud.vmmigration.v1; /** * * * <pre> * Request message for 'UpdateMigratingVm' request. * </pre> * * Protobuf type {@code google.cloud.vmmigration.v1.UpdateMigratingVmRequest} */ public final class UpdateMigratingVmRequest extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.vmmigration.v1.UpdateMigratingVmRequest) UpdateMigratingVmRequestOrBuilder { private static final long serialVersionUID = 0L; // Use UpdateMigratingVmRequest.newBuilder() to construct. private UpdateMigratingVmRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private UpdateMigratingVmRequest() { requestId_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new UpdateMigratingVmRequest(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private UpdateMigratingVmRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.FieldMask.Builder subBuilder = null; if (updateMask_ != null) { subBuilder = updateMask_.toBuilder(); } updateMask_ = input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(updateMask_); updateMask_ = subBuilder.buildPartial(); } break; } case 18: { com.google.cloud.vmmigration.v1.MigratingVm.Builder subBuilder = null; if (migratingVm_ != null) { subBuilder = migratingVm_.toBuilder(); } migratingVm_ = input.readMessage( com.google.cloud.vmmigration.v1.MigratingVm.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(migratingVm_); migratingVm_ = subBuilder.buildPartial(); } break; } case 26: { java.lang.String s = input.readStringRequireUtf8(); requestId_ = s; break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.vmmigration.v1.VmMigrationProto .internal_static_google_cloud_vmmigration_v1_UpdateMigratingVmRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.vmmigration.v1.VmMigrationProto .internal_static_google_cloud_vmmigration_v1_UpdateMigratingVmRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest.class, com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest.Builder.class); } public static final int UPDATE_MASK_FIELD_NUMBER = 1; private com.google.protobuf.FieldMask updateMask_; /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> * * @return Whether the updateMask field is set. */ @java.lang.Override public boolean hasUpdateMask() { return updateMask_ != null; } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> * * @return The updateMask. */ @java.lang.Override public com.google.protobuf.FieldMask getUpdateMask() { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ @java.lang.Override public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { return getUpdateMask(); } public static final int MIGRATING_VM_FIELD_NUMBER = 2; private com.google.cloud.vmmigration.v1.MigratingVm migratingVm_; /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the migratingVm field is set. */ @java.lang.Override public boolean hasMigratingVm() { return migratingVm_ != null; } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The migratingVm. */ @java.lang.Override public com.google.cloud.vmmigration.v1.MigratingVm getMigratingVm() { return migratingVm_ == null ? com.google.cloud.vmmigration.v1.MigratingVm.getDefaultInstance() : migratingVm_; } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.cloud.vmmigration.v1.MigratingVmOrBuilder getMigratingVmOrBuilder() { return getMigratingVm(); } public static final int REQUEST_ID_FIELD_NUMBER = 3; private volatile java.lang.Object requestId_; /** * * * <pre> * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore * the request if it has already been completed. The server will guarantee * that for at least 60 minutes since the first request. * For example, consider a situation where you make an initial request and t * he request times out. If you make the request again with the same request * ID, the server can check if original operation with the same request ID * was received, and if so, will ignore the second request. This prevents * clients from accidentally creating duplicate commitments. * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * </pre> * * <code>string request_id = 3;</code> * * @return The requestId. */ @java.lang.Override public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } } /** * * * <pre> * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore * the request if it has already been completed. The server will guarantee * that for at least 60 minutes since the first request. * For example, consider a situation where you make an initial request and t * he request times out. If you make the request again with the same request * ID, the server can check if original operation with the same request ID * was received, and if so, will ignore the second request. This prevents * clients from accidentally creating duplicate commitments. * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * </pre> * * <code>string request_id = 3;</code> * * @return The bytes for requestId. */ @java.lang.Override public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (updateMask_ != null) { output.writeMessage(1, getUpdateMask()); } if (migratingVm_ != null) { output.writeMessage(2, getMigratingVm()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, requestId_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (updateMask_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getUpdateMask()); } if (migratingVm_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getMigratingVm()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, requestId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest)) { return super.equals(obj); } com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest other = (com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest) obj; if (hasUpdateMask() != other.hasUpdateMask()) return false; if (hasUpdateMask()) { if (!getUpdateMask().equals(other.getUpdateMask())) return false; } if (hasMigratingVm() != other.hasMigratingVm()) return false; if (hasMigratingVm()) { if (!getMigratingVm().equals(other.getMigratingVm())) return false; } if (!getRequestId().equals(other.getRequestId())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasUpdateMask()) { hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; hash = (53 * hash) + getUpdateMask().hashCode(); } if (hasMigratingVm()) { hash = (37 * hash) + MIGRATING_VM_FIELD_NUMBER; hash = (53 * hash) + getMigratingVm().hashCode(); } hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER; hash = (53 * hash) + getRequestId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Request message for 'UpdateMigratingVm' request. * </pre> * * Protobuf type {@code google.cloud.vmmigration.v1.UpdateMigratingVmRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.vmmigration.v1.UpdateMigratingVmRequest) com.google.cloud.vmmigration.v1.UpdateMigratingVmRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.vmmigration.v1.VmMigrationProto .internal_static_google_cloud_vmmigration_v1_UpdateMigratingVmRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.vmmigration.v1.VmMigrationProto .internal_static_google_cloud_vmmigration_v1_UpdateMigratingVmRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest.class, com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest.Builder.class); } // Construct using com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); if (updateMaskBuilder_ == null) { updateMask_ = null; } else { updateMask_ = null; updateMaskBuilder_ = null; } if (migratingVmBuilder_ == null) { migratingVm_ = null; } else { migratingVm_ = null; migratingVmBuilder_ = null; } requestId_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.vmmigration.v1.VmMigrationProto .internal_static_google_cloud_vmmigration_v1_UpdateMigratingVmRequest_descriptor; } @java.lang.Override public com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest getDefaultInstanceForType() { return com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest.getDefaultInstance(); } @java.lang.Override public com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest build() { com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest buildPartial() { com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest result = new com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest(this); if (updateMaskBuilder_ == null) { result.updateMask_ = updateMask_; } else { result.updateMask_ = updateMaskBuilder_.build(); } if (migratingVmBuilder_ == null) { result.migratingVm_ = migratingVm_; } else { result.migratingVm_ = migratingVmBuilder_.build(); } result.requestId_ = requestId_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest) { return mergeFrom((com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest other) { if (other == com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest.getDefaultInstance()) return this; if (other.hasUpdateMask()) { mergeUpdateMask(other.getUpdateMask()); } if (other.hasMigratingVm()) { mergeMigratingVm(other.getMigratingVm()); } if (!other.getRequestId().isEmpty()) { requestId_ = other.requestId_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private com.google.protobuf.FieldMask updateMask_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> updateMaskBuilder_; /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> * * @return Whether the updateMask field is set. */ public boolean hasUpdateMask() { return updateMaskBuilder_ != null || updateMask_ != null; } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> * * @return The updateMask. */ public com.google.protobuf.FieldMask getUpdateMask() { if (updateMaskBuilder_ == null) { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } else { return updateMaskBuilder_.getMessage(); } } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { if (updateMaskBuilder_ == null) { if (value == null) { throw new NullPointerException(); } updateMask_ = value; onChanged(); } else { updateMaskBuilder_.setMessage(value); } return this; } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { if (updateMaskBuilder_ == null) { updateMask_ = builderForValue.build(); onChanged(); } else { updateMaskBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { if (updateMaskBuilder_ == null) { if (updateMask_ != null) { updateMask_ = com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); } else { updateMask_ = value; } onChanged(); } else { updateMaskBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ public Builder clearUpdateMask() { if (updateMaskBuilder_ == null) { updateMask_ = null; onChanged(); } else { updateMask_ = null; updateMaskBuilder_ = null; } return this; } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { onChanged(); return getUpdateMaskFieldBuilder().getBuilder(); } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { if (updateMaskBuilder_ != null) { return updateMaskBuilder_.getMessageOrBuilder(); } else { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } } /** * * * <pre> * Field mask is used to specify the fields to be overwritten in the * MigratingVm resource by the update. * The fields specified in the update_mask are relative to the resource, not * the full request. A field will be overwritten if it is in the mask. If the * user does not provide a mask then all fields will be overwritten. * </pre> * * <code>.google.protobuf.FieldMask update_mask = 1;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> getUpdateMaskFieldBuilder() { if (updateMaskBuilder_ == null) { updateMaskBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder>( getUpdateMask(), getParentForChildren(), isClean()); updateMask_ = null; } return updateMaskBuilder_; } private com.google.cloud.vmmigration.v1.MigratingVm migratingVm_; private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.vmmigration.v1.MigratingVm, com.google.cloud.vmmigration.v1.MigratingVm.Builder, com.google.cloud.vmmigration.v1.MigratingVmOrBuilder> migratingVmBuilder_; /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the migratingVm field is set. */ public boolean hasMigratingVm() { return migratingVmBuilder_ != null || migratingVm_ != null; } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The migratingVm. */ public com.google.cloud.vmmigration.v1.MigratingVm getMigratingVm() { if (migratingVmBuilder_ == null) { return migratingVm_ == null ? com.google.cloud.vmmigration.v1.MigratingVm.getDefaultInstance() : migratingVm_; } else { return migratingVmBuilder_.getMessage(); } } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMigratingVm(com.google.cloud.vmmigration.v1.MigratingVm value) { if (migratingVmBuilder_ == null) { if (value == null) { throw new NullPointerException(); } migratingVm_ = value; onChanged(); } else { migratingVmBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMigratingVm( com.google.cloud.vmmigration.v1.MigratingVm.Builder builderForValue) { if (migratingVmBuilder_ == null) { migratingVm_ = builderForValue.build(); onChanged(); } else { migratingVmBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeMigratingVm(com.google.cloud.vmmigration.v1.MigratingVm value) { if (migratingVmBuilder_ == null) { if (migratingVm_ != null) { migratingVm_ = com.google.cloud.vmmigration.v1.MigratingVm.newBuilder(migratingVm_) .mergeFrom(value) .buildPartial(); } else { migratingVm_ = value; } onChanged(); } else { migratingVmBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearMigratingVm() { if (migratingVmBuilder_ == null) { migratingVm_ = null; onChanged(); } else { migratingVm_ = null; migratingVmBuilder_ = null; } return this; } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.cloud.vmmigration.v1.MigratingVm.Builder getMigratingVmBuilder() { onChanged(); return getMigratingVmFieldBuilder().getBuilder(); } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.cloud.vmmigration.v1.MigratingVmOrBuilder getMigratingVmOrBuilder() { if (migratingVmBuilder_ != null) { return migratingVmBuilder_.getMessageOrBuilder(); } else { return migratingVm_ == null ? com.google.cloud.vmmigration.v1.MigratingVm.getDefaultInstance() : migratingVm_; } } /** * * * <pre> * Required. The update request body. * </pre> * * <code> * .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.vmmigration.v1.MigratingVm, com.google.cloud.vmmigration.v1.MigratingVm.Builder, com.google.cloud.vmmigration.v1.MigratingVmOrBuilder> getMigratingVmFieldBuilder() { if (migratingVmBuilder_ == null) { migratingVmBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.vmmigration.v1.MigratingVm, com.google.cloud.vmmigration.v1.MigratingVm.Builder, com.google.cloud.vmmigration.v1.MigratingVmOrBuilder>( getMigratingVm(), getParentForChildren(), isClean()); migratingVm_ = null; } return migratingVmBuilder_; } private java.lang.Object requestId_ = ""; /** * * * <pre> * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore * the request if it has already been completed. The server will guarantee * that for at least 60 minutes since the first request. * For example, consider a situation where you make an initial request and t * he request times out. If you make the request again with the same request * ID, the server can check if original operation with the same request ID * was received, and if so, will ignore the second request. This prevents * clients from accidentally creating duplicate commitments. * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * </pre> * * <code>string request_id = 3;</code> * * @return The requestId. */ public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore * the request if it has already been completed. The server will guarantee * that for at least 60 minutes since the first request. * For example, consider a situation where you make an initial request and t * he request times out. If you make the request again with the same request * ID, the server can check if original operation with the same request ID * was received, and if so, will ignore the second request. This prevents * clients from accidentally creating duplicate commitments. * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * </pre> * * <code>string request_id = 3;</code> * * @return The bytes for requestId. */ public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore * the request if it has already been completed. The server will guarantee * that for at least 60 minutes since the first request. * For example, consider a situation where you make an initial request and t * he request times out. If you make the request again with the same request * ID, the server can check if original operation with the same request ID * was received, and if so, will ignore the second request. This prevents * clients from accidentally creating duplicate commitments. * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * </pre> * * <code>string request_id = 3;</code> * * @param value The requestId to set. * @return This builder for chaining. */ public Builder setRequestId(java.lang.String value) { if (value == null) { throw new NullPointerException(); } requestId_ = value; onChanged(); return this; } /** * * * <pre> * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore * the request if it has already been completed. The server will guarantee * that for at least 60 minutes since the first request. * For example, consider a situation where you make an initial request and t * he request times out. If you make the request again with the same request * ID, the server can check if original operation with the same request ID * was received, and if so, will ignore the second request. This prevents * clients from accidentally creating duplicate commitments. * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * </pre> * * <code>string request_id = 3;</code> * * @return This builder for chaining. */ public Builder clearRequestId() { requestId_ = getDefaultInstance().getRequestId(); onChanged(); return this; } /** * * * <pre> * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore * the request if it has already been completed. The server will guarantee * that for at least 60 minutes since the first request. * For example, consider a situation where you make an initial request and t * he request times out. If you make the request again with the same request * ID, the server can check if original operation with the same request ID * was received, and if so, will ignore the second request. This prevents * clients from accidentally creating duplicate commitments. * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * </pre> * * <code>string request_id = 3;</code> * * @param value The bytes for requestId to set. * @return This builder for chaining. */ public Builder setRequestIdBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); requestId_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.vmmigration.v1.UpdateMigratingVmRequest) } // @@protoc_insertion_point(class_scope:google.cloud.vmmigration.v1.UpdateMigratingVmRequest) private static final com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest(); } public static com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<UpdateMigratingVmRequest> PARSER = new com.google.protobuf.AbstractParser<UpdateMigratingVmRequest>() { @java.lang.Override public UpdateMigratingVmRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new UpdateMigratingVmRequest(input, extensionRegistry); } }; public static com.google.protobuf.Parser<UpdateMigratingVmRequest> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<UpdateMigratingVmRequest> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.vmmigration.v1.UpdateMigratingVmRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "neenushaji@google.com" ]
neenushaji@google.com
cdffaca4227ba339c30a7c387ebf87d3191450ca
c35b52076b811acc01939e1940c306aaa87fd0ce
/src-common/com/liaoliao/basedao/RowMapper.java
73df399fed3166ebd710700ea7168e38c3714a33
[]
no_license
chen1044316902/cc_app
8c713862445477e6a9831540370663807c82d547
30a2b8a3f90b95c3a2aea0cab561e96e18453a54
refs/heads/master
2020-03-23T23:53:40.118232
2018-07-25T07:29:42
2018-07-25T07:29:42
142,261,969
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package com.liaoliao.basedao; import java.sql.ResultSet; import java.sql.SQLException; /** * RowMapper */ public interface RowMapper { public Object mapRow(ResultSet rs, int index) throws SQLException; }
[ "1044316902@qq.com" ]
1044316902@qq.com
6bfab75afdd51fa9ba5384303f0db50d8142b8c9
4b81b70d47beaaf41e75e3039e88930e3caa635a
/src/main/java/ght/edu/Main.java
8a47a0e3a9fc8feb98c3b1a216f2a8d323a9298a
[]
no_license
IvannaMoskaliuk/BooleanCalculator
da97009baff9318e0995c65275771b05430fb2ba
9be2aabcf4bee8d22a3a44e610d7da6b69578f7a
refs/heads/master
2022-12-05T11:41:57.366475
2020-08-19T21:43:49
2020-08-19T21:43:49
288,843,845
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
/** * @author Ivanna Moskaliuk KNUTE * @version 09.08.2020 * Boolean Calculator * class Main **/ package ght.edu; public class Main { public static void main(String[] args) { BooleanOperation booleanOperation = new BooleanOperation(null, null); System.out.println(booleanOperation.conjunction()); System.out.println(booleanOperation.disjunction()); } }
[ "ivanka_mos@ukr.net" ]
ivanka_mos@ukr.net
6773815a540f12e28910decec8ffbd1e5e58580a
f5e5558e486aa93e75ea05025c98a39a5bff3201
/src/main/java/com/fff/hos/httpservice/activity/HttpServiceQueryActivity.java
22d9281733dc2a380ae2447550343edf67b34397
[]
no_license
elminsterii/HangoutServer
255f85c4ee687006a4d8482ad9fc456f085af997
23e770358d4d2a4ddb8b0ffb5ed289abeaabe214
refs/heads/master
2020-03-13T08:00:49.827641
2018-06-18T05:44:08
2018-06-18T05:44:08
130,543,203
0
0
null
null
null
null
UTF-8
Java
false
false
2,223
java
package com.fff.hos.httpservice.activity; import com.fff.hos.data.Activity; import com.fff.hos.json.HttpJsonToJsonObj; import com.fff.hos.server.ErrorHandler; import com.fff.hos.server.ServerManager; import com.fff.hos.server.ServerResponse; import com.google.gson.*; import com.google.gson.reflect.TypeToken; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; @WebServlet(name = "HttpServiceQueryActivity", value = "/queryactivity") public class HttpServiceQueryActivity extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { doPost(request, response); } @SuppressWarnings("unchecked") @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("application/json"); HttpJsonToJsonObj jsonToJsonObj = new HttpJsonToJsonObj(); JsonObject jsonObj = jsonToJsonObj.parse(request); ServerManager serverMgr = new ServerManager(); ErrorHandler errHandler = new ErrorHandler(); ServerResponse serverResp = serverMgr.queryActivity(jsonObj); String strResponse = errHandler.handleError(serverResp.getStatus()); if(serverResp.getStatus() == ServerResponse.STATUS_CODE.ST_CODE_SUCCESS) { List<Activity> lsActicities = (List<Activity>)serverResp.getContent(); Gson gson = new GsonBuilder().setLenient().create(); Type listType = new TypeToken<ArrayList<Activity>>() {}.getType(); String strRes = gson.toJson(lsActicities, listType); JsonArray resJsonArray = new JsonArray(); resJsonArray.add(new JsonParser().parse(strResponse)); resJsonArray.addAll(new JsonParser().parse(strRes).getAsJsonArray()); strResponse = resJsonArray.toString(); } response.getWriter().print(strResponse); response.flushBuffer(); } }
[ "elminsterii2@gmail.com" ]
elminsterii2@gmail.com
944e6566099189ed797a9e171d1bab57a39f121d
32804bcd5c22a7ac232bc0de852b5c8c66430ec4
/vfs-azure/src/main/java/com/sludev/commons/vfs2/provider/azure/AzFileObject.java
cba0fb9ca77efba53ec6db7fae715b566a318031
[ "Apache-2.0" ]
permissive
departmentone/vfs-azure
946f8609f60be66ef0156747d0a7de366293ecb8
d5f288bcc2a609f01716f7b95145cbc17b1e04fe
refs/heads/master
2020-04-24T10:07:57.428352
2019-02-22T10:20:19
2019-02-22T10:20:19
171,883,140
0
0
Apache-2.0
2019-02-22T10:20:20
2019-02-21T14:07:27
Java
UTF-8
Java
false
false
13,460
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.sludev.commons.vfs2.provider.azure; import com.microsoft.azure.storage.StorageException; import com.microsoft.azure.storage.blob.BlobContainerProperties; import com.microsoft.azure.storage.blob.BlobInputStream; import com.microsoft.azure.storage.blob.BlobProperties; import com.microsoft.azure.storage.blob.CloudBlobContainer; import com.microsoft.azure.storage.blob.CloudBlockBlob; import com.microsoft.azure.storage.blob.ListBlobItem; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.provider.AbstractFileName; import org.apache.commons.vfs2.provider.AbstractFileObject; import org.apache.commons.vfs2.provider.URLFileName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * The main FileObject class in this provider. It holds most of the API callbacks * for the provider. * * @author Kervin Pierre */ public class AzFileObject extends AbstractFileObject { private static final Logger log = LoggerFactory.getLogger(AzFileObject.class); private final AzFileSystem fileSystem; private CloudBlobContainer currContainer; private CloudBlockBlob currBlob; private BlobContainerProperties currContainerProperties; private BlobProperties currBlobProperties; /** * Creates a new FileObject for use with a remote Azure Blob Storage file or folder. * * @param name * @param fileSystem */ protected AzFileObject(final AbstractFileName name, final AzFileSystem fileSystem) { super(name, fileSystem); this.fileSystem = fileSystem; currContainer = null; currBlob = null; currBlobProperties = null; currContainerProperties = null; } /** * Convenience method that returns the container and path from the current URL. * * @return A tuple containing the container name and the path. */ protected Pair<String, String> getContainerAndPath() { Pair<String, String> res = null; try { URLFileName currName = (URLFileName)getName(); String currNameStr = currName.getPath(); currNameStr = StringUtils.stripStart(currNameStr, "/"); if( StringUtils.isBlank(currNameStr) ) { log.warn( String.format("getContainerAndPath() : Path '%s' does not appear to be valid", currNameStr)); return null; } // Deal with the special case of the container root. if( StringUtils.contains(currNameStr, "/") == false ) { // Container and root return new ImmutablePair<>(currNameStr, "/"); } String[] resArray = StringUtils.split(currNameStr, "/", 2); res = new ImmutablePair<>(resArray[0], resArray[1]); } catch (Exception ex) { log.error( String.format("getContainerAndPath() : Path does not appear to be valid"), ex); } return res; } /** * Callback used when this FileObject is first used. We connect to the remote * server and check early so we can 'fail-fast'. If there are no issues then * this FileObject can be used. * * @throws Exception */ @Override protected void doAttach() throws Exception { Pair<String, String> path = getContainerAndPath(); try { // Check the container. Force a network call so we can fail-fast currContainer = fileSystem.getClient().getContainerReference(path.getLeft()); } catch (RuntimeException ex) { log.error( String.format("doAttach() Exception for '%s' : '%s'", path.getLeft(), path.getRight()), ex); throw ex; } currBlob = currContainer.getBlockBlobReference(path.getRight()); } /** * Callback for checking the type of the current FileObject. Typically can * be of type... * FILE for regular remote files * FOLDER for regular remote containers * IMAGINARY for a path that does not exist remotely. * * @return * @throws Exception */ @Override protected FileType doGetType() throws Exception { FileType res; Pair<String, String> path = getContainerAndPath(); if( currBlob.exists() ) { res = FileType.FILE; } else { // Blob Service does not have folders. Just files with path separators in // their names. // Here's the trick for folders. // // Do a listing on that prefix. If it returns anything, after not // existing, then it's a folder. String prefix = path.getRight(); if( prefix.endsWith("/") == false ) { // We need folders ( prefixes ) to end with a slash prefix += "/"; } Iterable<ListBlobItem> blobs = null; if( prefix.equals("/") ) { // Special root path case. List the root blobs with no prefix blobs = currContainer.listBlobs(); } else { blobs = currContainer.listBlobs(prefix); } if( blobs.iterator().hasNext() ) { res = FileType.FOLDER; } else { res = FileType.IMAGINARY; } } return res; } /** * Lists the children of this file. Is only called if {@link #doGetType} * returns {@link FileType#FOLDER}. The return value of this method * is cached, so the implementation can be expensive.<br /> * @return a possible empty String array if the file is a directory or null or an exception if the * file is not a directory or can't be read. * @throws Exception if an error occurs. */ @Override protected String[] doListChildren() throws Exception { String[] res = null; Pair<String, String> path = getContainerAndPath(); String prefix = path.getRight(); if( prefix.endsWith("/") == false ) { // We need folders ( prefixes ) to end with a slash prefix += "/"; } Iterable<ListBlobItem> blobs = null; if( prefix.equals("/") ) { // Special root path case. List the root blobs with no prefix blobs = currContainer.listBlobs(); } else { blobs = currContainer.listBlobs(prefix); } List<ListBlobItem> blobList = new ArrayList<>(); // Pull it all in memory and work from there CollectionUtils.addAll(blobList, blobs); ArrayList<String> resList = new ArrayList<>(); for(ListBlobItem currBlob : blobList ) { String currBlobStr = currBlob.getUri().getPath(); resList.add(currBlobStr); } res = resList.toArray(new String[resList.size()]); return res; } // @Override // protected FileObject[] doListChildrenResolved() throws Exception // { // FileObject[] res = null; // // Pair<String, String> path = getContainerAndPath(); // // String prefix = path.getRight(); // if( prefix.endsWith("/") == false ) // { // // We need folders ( prefixes ) to end with a slash // prefix += "/"; // } // // Iterable<ListBlobItem> blobs = null; // if( prefix.equals("/") ) // { // // Special root path case. List the root blobs with no prefix // blobs = currContainer.listBlobs(); // } // else // { // blobs = currContainer.listBlobs(prefix); // } // // List<ListBlobItem> blobList = new ArrayList<>(); // // // Pull it all in memory and work from there // CollectionUtils.addAll(blobList, blobs); // ArrayList<AzFileObject> resList = new ArrayList<>(); // for(ListBlobItem currBlobItem : blobList ) // { // String currBlobStr = currBlobItem.getUri().getPath(); // AzFileObject childBlob = new AzFileObject(); // FileName currName = getFileSystem().getFileSystemManager().resolveName(name, file, NameScope.CHILD); // // resList.add(currBlobStr); // } // // res = resList.toArray(new String[resList.size()]); // // return res; // } private void checkBlobProperties() throws StorageException { if( currBlobProperties == null ) { currBlob.downloadAttributes(); currBlobProperties = currBlob.getProperties(); } } /** * Callback for handling "content size" requests by the provider. * * @return The number of bytes in the File Object's content * @throws Exception */ @Override protected long doGetContentSize() throws Exception { long res = -1; checkBlobProperties(); res = currBlobProperties.getLength(); return res; } /** * Get an InputStream for reading the content of this File Object. * @return The InputStream object for reading. * @throws Exception */ @Override protected InputStream doGetInputStream() throws Exception { BlobInputStream in = currBlob.openInputStream(); return in; } /** * Callback for handling delete on this File Object * @throws Exception */ @Override protected void doDelete() throws Exception { // Use deleteIfExists() to simplify recursive deletes. // Otherwise VFS will call delete() on an empty folder, and we know // folders do not really exist. Especially empty ones. currBlob.deleteIfExists(); } /** * Callback for handling create folder requests. Since there are no folders * in Azure Cloud Storage this call is ingored. * * @throws Exception */ @Override protected void doCreateFolder() throws Exception { log.info(String.format("doCreateFolder() called.")); } /** * Used for creating folders. It's not used since Azure Cloud Storage does not have * the concept of folders. * * @throws FileSystemException */ @Override public void createFolder() throws FileSystemException { log.debug(String.format("createFolder() called.")); } /** * Callback for getting an OutputStream for writing into Azure Blob Storage file. * @param bAppend bAppend true if the file should be appended to, false if it should be overwritten. * @return * @throws Exception */ @Override protected OutputStream doGetOutputStream(boolean bAppend) throws Exception { OutputStream res; res = currBlob.openOutputStream(); return res; } /** * Callback for use when detaching this File Object from Azure Blob Storage. * * The File Object should be reusable after <code>attach()</code> call. * @throws Exception */ @Override protected void doDetach() throws Exception { currBlob = null; currContainer = null; currBlobProperties = null; currContainerProperties = null; } /** * Callback for handling the <code>getLastModifiedTime()</code> Commons VFS API call. * * @return Time since the file has last been modified * @throws Exception */ @Override protected long doGetLastModifiedTime() throws Exception { long res; checkBlobProperties(); Date lm = currBlobProperties.getLastModified(); res = lm.getTime(); return res; } }
[ "kervin@sludev.com" ]
kervin@sludev.com
cc3cda70e75c3ec124f5a7b4731f8477b1137755
4ed68959cd6d35068cee02c37b4630fcf8ccad73
/src/java/org/apache/cassandra/config/Schema.java
b2d557e016f0622dbd2913073c0a8a5a12da4eca
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
jackliu8722/cassandra-1.2.16
1120a47d3e736a58673fef27f2dbba04bfb005b7
c09e8694f920a16f4f573a3a32daf99118651b57
refs/heads/master
2021-01-10T18:37:44.468192
2014-06-26T01:40:24
2014-06-26T01:40:24
21,223,741
2
1
Apache-2.0
2023-03-20T11:51:38
2014-06-26T01:12:53
Java
UTF-8
Java
false
false
14,381
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.cassandra.config; import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.*; import com.google.common.collect.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.cassandra.db.*; import org.apache.cassandra.db.Table; import org.apache.cassandra.db.marshal.AbstractType; import org.apache.cassandra.io.sstable.Descriptor; import org.apache.cassandra.service.MigrationManager; import org.apache.cassandra.tracing.Tracing; import org.apache.cassandra.utils.ByteBufferUtil; import org.apache.cassandra.utils.Pair; import org.cliffc.high_scale_lib.NonBlockingHashMap; public class Schema { private static final Logger logger = LoggerFactory.getLogger(Schema.class); public static final Schema instance = new Schema(); /** * longest permissible KS or CF name. Our main concern is that filename not be more than 255 characters; * the filename will contain both the KS and CF names. Since non-schema-name components only take up * ~64 characters, we could allow longer names than this, but on Windows, the entire path should be not greater than * 255 characters, so a lower limit here helps avoid problems. See CASSANDRA-4110. */ public static final int NAME_LENGTH = 48; /* metadata map for faster table lookup */ private final Map<String, KSMetaData> tables = new NonBlockingHashMap<String, KSMetaData>(); /* Table objects, one per keyspace. Only one instance should ever exist for any given keyspace. */ private final Map<String, Table> tableInstances = new NonBlockingHashMap<String, Table>(); /* metadata map for faster ColumnFamily lookup */ private final BiMap<Pair<String, String>, UUID> cfIdMap = HashBiMap.create(); // mapping from old ColumnFamily Id (Integer) to a new version which is UUID private final BiMap<Integer, UUID> oldCfIdMap = HashBiMap.create(); private volatile UUID version; // 59adb24e-f3cd-3e02-97f0-5b395827453f public static final UUID emptyVersion; public static final ImmutableSet<String> systemKeyspaceNames = ImmutableSet.of(Table.SYSTEM_KS, Tracing.TRACE_KS); static { try { emptyVersion = UUID.nameUUIDFromBytes(MessageDigest.getInstance("MD5").digest()); } catch (NoSuchAlgorithmException e) { throw new AssertionError(); } } /** * Initialize empty schema object */ public Schema() {} /** * Load up non-system tables * * @param tableDefs The non-system table definitions * * @return self to support chaining calls */ public Schema load(Collection<KSMetaData> tableDefs) { for (KSMetaData def : tableDefs) load(def); return this; } /** * Load specific keyspace into Schema * * @param keyspaceDef The keyspace to load up * * @return self to support chaining calls */ public Schema load(KSMetaData keyspaceDef) { for (CFMetaData cfm : keyspaceDef.cfMetaData().values()) load(cfm); setTableDefinition(keyspaceDef); return this; } /** * Get table instance by name * * @param tableName The name of the table * * @return Table object or null if table was not found */ public Table getTableInstance(String tableName) { return tableInstances.get(tableName); } /** * Store given Table instance to the schema * * @param table The Table instance to store * * @throws IllegalArgumentException if Table is already stored */ public void storeTableInstance(Table table) { if (tableInstances.containsKey(table.name)) throw new IllegalArgumentException(String.format("Table %s was already initialized.", table.name)); tableInstances.put(table.name, table); } /** * Remove table from schema * * @param tableName The name of the table to remove * * @return removed table instance or null if it wasn't found */ public Table removeTableInstance(String tableName) { return tableInstances.remove(tableName); } /** * Remove table definition from system * * @param ksm The table definition to remove */ public void clearTableDefinition(KSMetaData ksm) { tables.remove(ksm.name); } /** * Given a table name & column family name, get the column family * meta data. If the table name or column family name is not valid * this function returns null. * * @param tableName The table name * @param cfName The ColumnFamily name * * @return ColumnFamily Metadata object or null if it wasn't found */ public CFMetaData getCFMetaData(String tableName, String cfName) { assert tableName != null; KSMetaData ksm = tables.get(tableName); return (ksm == null) ? null : ksm.cfMetaData().get(cfName); } /** * Get ColumnFamily metadata by its identifier * * @param cfId The ColumnFamily identifier * * @return metadata about ColumnFamily */ public CFMetaData getCFMetaData(UUID cfId) { Pair<String,String> cf = getCF(cfId); return (cf == null) ? null : getCFMetaData(cf.left, cf.right); } public CFMetaData getCFMetaData(Descriptor descriptor) { return getCFMetaData(descriptor.ksname, descriptor.cfname); } /** * Get type of the ColumnFamily but it's keyspace/name * * @param ksName The keyspace name * @param cfName The ColumnFamily name * * @return The type of the ColumnFamily */ public ColumnFamilyType getColumnFamilyType(String ksName, String cfName) { assert ksName != null && cfName != null; CFMetaData cfMetaData = getCFMetaData(ksName, cfName); return (cfMetaData == null) ? null : cfMetaData.cfType; } /** * Get column comparator for ColumnFamily but it's keyspace/name * * @param ksName The keyspace name * @param cfName The ColumnFamily name * * @return The comparator of the ColumnFamily */ public AbstractType<?> getComparator(String ksName, String cfName) { assert ksName != null; CFMetaData cfmd = getCFMetaData(ksName, cfName); if (cfmd == null) throw new IllegalArgumentException("Unknown ColumnFamily " + cfName + " in keyspace " + ksName); return cfmd.comparator; } /** * Get subComparator of the ColumnFamily * * @param ksName The keyspace name * @param cfName The ColumnFamily name * * @return The subComparator of the ColumnFamily */ public AbstractType<?> getSubComparator(String ksName, String cfName) { assert ksName != null; return getCFMetaData(ksName, cfName).subcolumnComparator; } /** * Get value validator for specific column * * @param ksName The keyspace name * @param cfName The ColumnFamily name * @param column The name of the column * * @return value validator specific to the column or default (per-cf) one */ public AbstractType<?> getValueValidator(String ksName, String cfName, ByteBuffer column) { return getCFMetaData(ksName, cfName).getValueValidator(column); } /** * Get metadata about table by its name * * @param table The name of the table * * @return The table metadata or null if it wasn't found */ public KSMetaData getKSMetaData(String table) { assert table != null; return tables.get(table); } /** * @return collection of the non-system tables */ public List<String> getNonSystemTables() { return ImmutableList.copyOf(Sets.difference(tables.keySet(), systemKeyspaceNames)); } /** * Get metadata about table by its name * * @param table The name of the table * * @return The table metadata or null if it wasn't found */ public KSMetaData getTableDefinition(String table) { return getKSMetaData(table); } /** * Get metadata about table inner ColumnFamilies * * @param tableName The name of the table * * @return metadata about ColumnFamilies the belong to the given table */ public Map<String, CFMetaData> getTableMetaData(String tableName) { assert tableName != null; KSMetaData ksm = tables.get(tableName); assert ksm != null; return ksm.cfMetaData(); } /** * @return collection of the all table names registered in the system (system and non-system) */ public Set<String> getTables() { return tables.keySet(); } /** * @return collection of the metadata about all tables registered in the system (system and non-system) */ public Collection<KSMetaData> getTableDefinitions() { return tables.values(); } /** * Update (or insert) new table definition * * @param ksm The metadata about table */ public void setTableDefinition(KSMetaData ksm) { assert ksm != null; tables.put(ksm.name, ksm); } /* ColumnFamily query/control methods */ public void addOldCfIdMapping(Integer oldId, UUID newId) { if (oldId == null) return; oldCfIdMap.put(oldId, newId); } public UUID convertOldCfId(Integer oldCfId) throws UnknownColumnFamilyException { UUID cfId = oldCfIdMap.get(oldCfId); if (cfId == null) throw new UnknownColumnFamilyException("ColumnFamily identified by old " + oldCfId + " was not found.", null); return cfId; } public Integer convertNewCfId(UUID newCfId) { return oldCfIdMap.containsValue(newCfId) ? oldCfIdMap.inverse().get(newCfId) : null; } /** * @param cfId The identifier of the ColumnFamily to lookup * @return The (ksname,cfname) pair for the given id, or null if it has been dropped. */ public Pair<String,String> getCF(UUID cfId) { return cfIdMap.inverse().get(cfId); } /** * Lookup keyspace/ColumnFamily identifier * * @param ksName The keyspace name * @param cfName The ColumnFamily name * * @return The id for the given (ksname,cfname) pair, or null if it has been dropped. */ public UUID getId(String ksName, String cfName) { return cfIdMap.get(Pair.create(ksName, cfName)); } /** * Load individual ColumnFamily Definition to the schema * (to make ColumnFamily lookup faster) * * @param cfm The ColumnFamily definition to load */ public void load(CFMetaData cfm) { Pair<String, String> key = Pair.create(cfm.ksName, cfm.cfName); if (cfIdMap.containsKey(key)) throw new RuntimeException(String.format("Attempting to load already loaded column family %s.%s", cfm.ksName, cfm.cfName)); logger.debug("Adding {} to cfIdMap", cfm); cfIdMap.put(key, cfm.cfId); } /** * Used for ColumnFamily data eviction out from the schema * * @param cfm The ColumnFamily Definition to evict */ public void purge(CFMetaData cfm) { cfIdMap.remove(Pair.create(cfm.ksName, cfm.cfName)); } /* Version control */ /** * @return current schema version */ public UUID getVersion() { return version; } /** * Read schema from system table and calculate MD5 digest of every row, resulting digest * will be converted into UUID which would act as content-based version of the schema. */ public void updateVersion() { try { MessageDigest versionDigest = MessageDigest.getInstance("MD5"); for (Row row : SystemTable.serializedSchema()) { if (invalidSchemaRow(row) || ignoredSchemaRow(row)) continue; row.cf.updateDigest(versionDigest); } version = UUID.nameUUIDFromBytes(versionDigest.digest()); SystemTable.updateSchemaVersion(version); } catch (Exception e) { throw new RuntimeException(e); } } /* * Like updateVersion, but also announces via gossip */ public void updateVersionAndAnnounce() { updateVersion(); MigrationManager.passiveAnnounce(version); } /** * Clear all KS/CF metadata and reset version. */ public synchronized void clear() { for (String table : getNonSystemTables()) { KSMetaData ksm = getTableDefinition(table); for (CFMetaData cfm : ksm.cfMetaData().values()) purge(cfm); clearTableDefinition(ksm); } updateVersionAndAnnounce(); } public static boolean invalidSchemaRow(Row row) { return row.cf == null || (row.cf.isMarkedForDelete() && row.cf.isEmpty()); } public static boolean ignoredSchemaRow(Row row) { try { return systemKeyspaceNames.contains(ByteBufferUtil.string(row.key.key)); } catch (CharacterCodingException e) { throw new RuntimeException(e); } } }
[ "jackliu8722@gmail.com" ]
jackliu8722@gmail.com
b547a96494933a901cb1b7b24ab9c668b013d8c1
4000abb9b4f0dfff234b53c68ef186c9403bfe31
/app/src/androidTest/java/com/yoka/masterkey/ExampleInstrumentedTest.java
7e4f18ec329bebd572bfa18abaf5ab502c2659c5
[]
no_license
yokana888/Demo
db4dc26f080f6ab38f94f0567a74570e2402f14e
fef6f5d96af214645da599f2101560c70c735472
refs/heads/master
2023-04-21T22:24:53.590065
2021-04-30T09:52:36
2021-04-30T09:52:36
363,097,022
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package com.yoka.masterkey; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.yoka.masterkey", appContext.getPackageName()); } }
[ "kawaiirockmansick@gmail.com" ]
kawaiirockmansick@gmail.com
8fffb1586e9062eae42d504fc23f30702cb4d751
8cb155c87a490ed6a7a3f5e830dd34b7261da8f0
/spider-common/src/main/java/com/ecmoho/jpush/api/schedule/ScheduleResult.java
e3ab3a9517960d107a35008d36696de87a01e443
[]
no_license
silencelwy/spiderManager
6776412ac4625b028887a3b9301244c663087823
45f2f6a18cf4469c2ffc32f4d09897e2bd9ee805
refs/heads/master
2023-04-03T18:52:59.068135
2016-10-11T10:04:50
2016-10-11T10:04:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.ecmoho.jpush.api.schedule; import com.ecmoho.jpush.api.common.resp.BaseResult; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; public class ScheduleResult extends BaseResult{ @Expose String schedule_id; @Expose String name; @Expose Boolean enabled; @Expose JsonObject trigger; @Expose JsonObject push; public String getSchedule_id() { return schedule_id; } public String getName() { return name; } public Boolean getEnabled() { return enabled; } public JsonObject getTrigger() { return trigger; } public JsonObject getPush() { return push; } }
[ "gusy39@163.com" ]
gusy39@163.com
4dd5dc20ba3cf0a76ff9af5390a2b6968670d308
ff4806e33b38e2932def5870e5fe59b3e610314c
/junior/chapter_003/src/main/java/patterns/factory/Fighter.java
61f0cc8e82368ab0d28dce717c6337202e65296f
[ "Apache-2.0" ]
permissive
Vichukano/job4j
45a74b382b7ffd232f66f0ec010eb482ad394ddf
2f8793ad28b0f2f413c9f5efd60f17e276704c92
refs/heads/master
2021-06-26T14:30:10.297641
2019-04-04T22:38:59
2019-04-04T22:38:59
144,193,343
3
0
null
null
null
null
UTF-8
Java
false
false
84
java
package patterns.factory; public interface Fighter { String readyToFight(); }
[ "vichukano@gmail.com" ]
vichukano@gmail.com
c4d243a4c8801cb2834f6ac56a533b8bea95ba43
242e9776eb5df9f6a321f6cb57fa67f2ee826d20
/src/Object/Parent.java
c1152ee723224db4d68d371f53c153e5acefd3b8
[]
no_license
PaulRaja777/Practise
6a5904332843e810da615dcec942ef06d97c17cf
cc668bf5c4678ba3e3408006b11d1ed9cc9e8c10
refs/heads/master
2023-04-11T09:33:16.135464
2021-04-04T15:30:56
2021-04-04T15:30:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package Object; public class Parent { public void Sheela() { System.out.println("My Data"); } public static void main(String[] args) { Parent a = new Parent(); a.Sheela(); } }
[ "paulrajasesuraju@gmail.com" ]
paulrajasesuraju@gmail.com
913fbeb3a8e79dd21c0a67ff91f6f0ca4e24eff8
3d31b4a08b6437537605d36f3163e2d8a9ba7682
/JhaBox2DTest/core/src/fr/heyjojo/box2d/test/MyGdxGame.java
00d6b59de298867f6eb756d28aedb560687e7732
[]
no_license
jhagai/workspace
51cec030fc175d1b9ed77a0131a8a47244bc30da
9f199e368580b0fcf1f40a99dbb2df7cd0ab669c
refs/heads/master
2020-03-29T09:40:48.172043
2015-01-17T20:29:23
2015-01-17T20:29:23
28,608,910
0
0
null
null
null
null
UTF-8
Java
false
false
6,748
java
package fr.heyjojo.box2d.test; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.InputAdapter; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.BodyDef; import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; import com.badlogic.gdx.physics.box2d.CircleShape; import com.badlogic.gdx.physics.box2d.Fixture; import com.badlogic.gdx.physics.box2d.FixtureDef; import com.badlogic.gdx.physics.box2d.PolygonShape; import com.badlogic.gdx.physics.box2d.World; import com.badlogic.gdx.physics.box2d.joints.MouseJoint; import com.badlogic.gdx.utils.TimeUtils; public class MyGdxGame extends ApplicationAdapter { SpriteBatch batch; Texture img; /** the camera **/ protected OrthographicCamera camera; /** the renderer **/ protected Box2DDebugRenderer renderer; BitmapFont font; /** our box2D world **/ protected World world; /** ground body to connect the mouse joint to **/ protected Body groundBody; /** our mouse joint **/ protected MouseJoint mouseJoint = null; /** a hit body **/ protected Body hitBody = null; /** temp vector **/ protected Vector2 tmp = new Vector2(); boolean keyLeft = false; boolean keyRight = false; boolean keyUp = false; boolean keyDown = false; Body squareBody; InputAdapter InputAdapter = new InputAdapter() { public boolean keyDown(int keycode) { switch (keycode) { case Keys.LEFT: keyLeft = true; break; case Keys.RIGHT: keyRight = true; break; case Keys.UP: keyUp = true; break; case Keys.DOWN: keyDown = true; break; } return true; } public boolean keyUp(int keycode) { switch (keycode) { case Keys.LEFT: keyLeft = false; break; case Keys.RIGHT: keyRight = false; break; case Keys.UP: keyUp = false; break; case Keys.DOWN: keyDown = false; break; } return true; } }; @Override public void create() { // setup the camera. In Box2D we operate on a // meter scale, pixels won't do it. So we use // an orthographic camera with a viewport of // 48 meters in width and 32 meters in height. // We also position the camera so that it // looks at (0,16) (that's where the middle of the // screen will be located). camera = new OrthographicCamera(48, 32); camera.position.set(0, 15, 0); // create the debug renderer renderer = new Box2DDebugRenderer(); // create the world world = new World(new Vector2(0, -10), true); // we also need an invisible zero size ground body // to which we can connect the mouse joint BodyDef bodyDef = new BodyDef(); groundBody = world.createBody(bodyDef); // Create a polygon shape PolygonShape groundBox = new PolygonShape(); // Set the polygon shape as a box which is twice the size of our view // port and 20 high // (setAsBox takes half-width and half-height as arguments) groundBox.setAsBox(camera.viewportWidth, 10.0f); // Create a fixture from our polygon shape and add it to our ground body groundBody.createFixture(groundBox, 0.0f); // Clean up after ourselves groundBox.dispose(); // call abstract method to populate the world createWorld(world); batch = new SpriteBatch(); font = new BitmapFont(); Gdx.input.setInputProcessor(InputAdapter); } public void createWorld(World world) { // First we create a body definition BodyDef bodyDef = new BodyDef(); // We set our body to dynamic, for something like ground which doesn't // move we would set it to StaticBody bodyDef.type = BodyType.DynamicBody; // Set our body's starting position in the world bodyDef.position.set(0, 15); bodyDef.bullet = true; // Create our body in the world using our body definition Body circleBody = world.createBody(bodyDef); // Create a circle shape and set its radius to 6 CircleShape circle = new CircleShape(); circle.setRadius(1f); // Create a fixture definition to apply our shape to FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = circle; fixtureDef.density = 0.5f; fixtureDef.friction = 10f; fixtureDef.restitution = 0f; // Make it bounce a little bit // Create our fixture and attach it to the body circleBody.createFixture(fixtureDef); circleBody.setFixedRotation(true); // Remember to dispose of any shapes after you're done with them! // BodyDef and FixtureDef don't need disposing, but shapes do. circle.dispose(); bodyDef.position.set(-1.5f, 20); bodyDef.bullet = true; // Create our body in the world using our body definition squareBody = world.createBody(bodyDef); PolygonShape rectangle = new PolygonShape(); rectangle.setAsBox(1f, 2f); FixtureDef rectFixtureDef = new FixtureDef(); rectFixtureDef.shape = rectangle; rectFixtureDef.density = 0.5f; rectFixtureDef.friction = 10f; rectFixtureDef.restitution = 0f; squareBody.createFixture(rectFixtureDef); squareBody.setFixedRotation(true); rectangle.dispose(); } @Override public void render() { Vector2 vel = squareBody.getLinearVelocity(); Vector2 pos = squareBody.getPosition(); if (keyLeft) { //squareBody.applyLinearImpulse(-1.0f, 0, pos.x, pos.y, true); squareBody.setLinearVelocity(-10f, squareBody.getLinearVelocity().y); // squareBody.applyForceToCenter(-1.0f, 0.0f, true); } else if (keyRight) { //squareBody.applyLinearImpulse(1f, 0, pos.x, pos.y, true); squareBody.setLinearVelocity(10f, squareBody.getLinearVelocity().y); // squareBody.applyForceToCenter(1.0f, 1.0f, true); } else { //squareBody.applyLinearImpulse(0f, 0, pos.x, pos.y, true); squareBody.setLinearVelocity(0, squareBody.getLinearVelocity().y); } // update the world with a fixed time step long startTime = TimeUtils.nanoTime(); world.step(Gdx.app.getGraphics().getDeltaTime(), 3, 3); float updateTime = (TimeUtils.nanoTime() - startTime) / 1000000000.0f; startTime = TimeUtils.nanoTime(); // clear the screen and setup the projection matrix Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); // render the world using the debug renderer renderer.render(world, camera.combined); float renderTime = (TimeUtils.nanoTime() - startTime) / 1000000000.0f; batch.begin(); font.draw(batch, "fps:" + Gdx.graphics.getFramesPerSecond() + ", update: " + updateTime + ", render: " + renderTime, 0, 20); batch.end(); } }
[ "joel.hagai@gmail.com" ]
joel.hagai@gmail.com
98458086e5e28975ff7aa1ec5f7d30eaace08dcd
963148cc7d0f642b256b9c4e37e00d977f543841
/src/extraction/AbstractWrapper.java
36f51b868003c97442e00bcb2e5b17201aa49170
[]
no_license
jpedrocm/ir-project
c8f47ffcb791b7dd16e75d0c2c3ae00592115711
bf1039002937bf67340fa4bb2e929236a20c0dc3
refs/heads/master
2021-06-09T17:06:15.702154
2016-12-03T01:27:00
2016-12-03T01:27:00
67,051,462
1
0
null
null
null
null
UTF-8
Java
false
false
779
java
package extraction; import java.util.Arrays; import java.util.HashMap; import java.util.List; import org.jsoup.nodes.Document; public abstract class AbstractWrapper { public abstract String getProductName(Document doc); public HashMap<String, List<String>> getSpecifications(Document doc) { HashMap<String, List<String>> specifications = new HashMap<String, List<String>>(); String name = getProductName(doc); if (name != null) specifications.put("Name", Arrays.asList(name)); String price = getPrice(doc); if (price != null) specifications.put("Price", Arrays.asList(price)); return specifications; } public abstract String getPrice(Document doc); }
[ "lfn2@cin.ufpe.br" ]
lfn2@cin.ufpe.br
51876dfd90abe869f98d3901a5ca7cc09bf4a2ab
bc70c15832eeaea1ac4ee71b576ce6ebe327c073
/SpotifyApi/src/main/java/com/drivemode/spotify/SpotifyApi.java
bfb2da9cd6b62a8120c5c3d49e271127f4ee432c
[ "Apache-2.0" ]
permissive
Drivemode/SpotifyApi
28744a0e7a650932fc1b0454880e411ade74e6d8
8955407a908b29b624c89d10c19725b8e17983fc
refs/heads/master
2021-01-23T05:44:35.212789
2015-04-02T09:46:52
2015-04-02T09:46:52
28,123,629
58
14
null
null
null
null
UTF-8
Java
false
false
8,449
java
package com.drivemode.spotify; import android.app.Application; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; import com.drivemode.spotify.auth.AccessToken; import com.drivemode.spotify.auth.AccessTokenStore; import com.drivemode.spotify.rest.RestAdapterFactory; import retrofit.Callback; import retrofit.RequestInterceptor; import retrofit.RestAdapter; import retrofit.RetrofitError; import retrofit.client.Response; /** * Singleton object to deal with Spotify Web API and user authorization. * * First you need to initialize the singleton in your {@link android.app.Application}. * After the initialization, you can access the singleton instance via {@link com.drivemode.spotify.SpotifyApi#getInstance()}. * * Basic Usage: * - If you need to authorize user, use {@link com.drivemode.spotify.SpotifyApi#authorize(android.content.Context, String[])}. * - If you are to access Web API, use {@link com.drivemode.spotify.SpotifyApi#getApiService()}. Service object is generated by Retrofit. */ public class SpotifyApi { public static final String TAG = SpotifyApi.class.getSimpleName(); private static volatile SpotifyApi sSingleton; private final Application mApplication; private final ClientConfig mConfig; private final AccessTokenStore mTokenStore; private final RestAdapterFactory mAdapterFactory; private SpotifyService mSpotifyService; private SpotifyAuthenticateService mAuthenticateService; /* package */ SpotifyApi(Application application, ClientConfig config) { mApplication = application; mConfig = config; mTokenStore = new AccessTokenStore(application); mAdapterFactory = new RestAdapterFactory(); } /** * Initialize the singleton instance of this class. * @param application the application. * @param config your Spotify API configuration. */ public static void initialize(@NonNull Application application, @NonNull ClientConfig config) { if (sSingleton == null) { synchronized (SpotifyApi.class) { if (sSingleton == null) { sSingleton = new SpotifyApi(application, config); } } } } public static synchronized SpotifyApi getInstance() { if (sSingleton == null) { throw new IllegalStateException("SpotifyApi is not yet initialized."); } return sSingleton; } /** * Terminate singleton instance lifetime. */ public static synchronized void destroy() { sSingleton = null; } /** * @return The SpotifyService instance to access Web API */ public synchronized SpotifyService getApiService() { if (mSpotifyService == null) { RestAdapter adapter = mAdapterFactory.provideWebApiAdapter(new WebApiAuthenticator()); mSpotifyService = adapter.create(SpotifyService.class); } return mSpotifyService; } /** * @return The SpotifyAuthenticateService instance to access Authorization API */ public synchronized SpotifyAuthenticateService getAuthService() { if (mAuthenticateService == null) { RestAdapter adapter = mAdapterFactory.provideAuthenticateApiAdapter(); mAuthenticateService = adapter.create(SpotifyAuthenticateService.class); } return mAuthenticateService; } /** * @return true if user already authorized. */ public boolean isAuthrorized() { AccessToken token = mTokenStore.read(); // XXX return !TextUtils.isEmpty(token.accessToken); } /** * Start user's authorization. * @param context the context. * @param scopes the scopes you need. */ public void authorize(Context context, String[] scopes) { authorize(context, scopes, false); } /** * Start user's authorization. * @param context the context, should be {@link android.app.Activity} context. * @param scopes the scopes you need. * @param showDialog set true if you always need to show prompt. */ public void authorize(Context context, String[] scopes, boolean showDialog) { String scope = TextUtils.join(" ", scopes); Uri uri = Uri.parse("https://accounts.spotify.com/authorize").buildUpon() .appendQueryParameter("client_id", mConfig.getClientId()) .appendQueryParameter("response_type", "code") .appendQueryParameter("redirect_uri", mConfig.getRedirectUri()) .appendQueryParameter("scope", scope) .appendQueryParameter("show_dialog", String.valueOf(showDialog)) .build(); Intent intent = new Intent(Intent.ACTION_VIEW, uri); context.startActivity(intent); } /** * Call this method if user back to the activity which can handle the callback. * Callback should pass the data as Uri for {@link android.app.Activity#onNewIntent(android.content.Intent)}, * so keep in mind that your callback activity should be singleton in the back stack. * @param data the data in the {@link android.content.Intent} passed to your callback {@link android.app.Activity} * @param listener callback listener that is invoked when the access token is retrieved */ public void onCallback(Uri data, final AuthenticationListener listener) { if (data == null) return; Log.v(TAG, data.toString()); String code = data.getQueryParameter("code"); getAuthService().getAccessToken("authorization_code", code, mConfig.getRedirectUri(), mConfig.getClientId(), mConfig.getClientSecret(), new Callback<AccessToken>() { @Override public void success(AccessToken accessToken, Response response) { Log.v(TAG, "success retrieving access token: " + accessToken.toString()); mTokenStore.store(accessToken); listener.onReady(); } @Override public void failure(RetrofitError error) { listener.onError(); } }); } /** * Refresh access token in the background thread. */ public void refreshTokenIfNeeded(final AuthenticationListener listener) { if (!mTokenStore.isExpired()) { Log.v(TAG, "no need to refresh"); listener.onReady(); return; } AccessToken token = mTokenStore.read(); getAuthService().refreshAccessToken("refresh_token", token.refreshToken, mConfig.getClientId(), mConfig.getClientSecret(), new Callback<AccessToken>() { @Override public void success(AccessToken accessToken, Response response) { Log.v(TAG, "success refreshing access token: " + accessToken.toString()); mTokenStore.update(accessToken); listener.onReady(); } @Override public void failure(RetrofitError error) { listener.onError(); } }); } /** * Refresh access token in the same thread. */ public void blockingRefreshTokenIfNeeded() { if (!mTokenStore.isExpired()) { Log.v(TAG, "no need to refresh"); return; } AccessToken token = mTokenStore.read(); AccessToken newToken = getAuthService().refreshAccessToken("refresh_token", token.refreshToken, mConfig.getClientId(), mConfig.getClientSecret()); mTokenStore.update(newToken); } public ClientConfig getConfig() { return mConfig; } public AccessTokenStore getTokenStore() { return mTokenStore; } /** * The request interceptor that will add the header with OAuth * token to every request made with the wrapper. */ private class WebApiAuthenticator implements RequestInterceptor { @Override public void intercept(RequestFacade request) { AccessToken token = mTokenStore.read(); if (token != null) { request.addHeader("Authorization", token.tokenType + " " + token.accessToken); } } } public interface AuthenticationListener { public void onReady(); public void onError(); } }
[ "Keith.Yokoma@gmail.com" ]
Keith.Yokoma@gmail.com
8e61c01d7d3ba470bf10cbf0735863dddff3c9bf
2b3774f5b9137b51f8cdd684e21229b43e36eed7
/src/edu/colorado/collections/LinkedQueue.java
b60bc7bb43d0dfee39e3fc613868f3505e0875cb
[]
no_license
Vagacoder/Data_Structures_and_Other_Objects_Using_Java
ac232d9f8c0f0472b57243818d051f7ec4983bc3
81fd832d4c7f232193f571aa9e529423c629ac2e
refs/heads/master
2021-04-30T12:44:14.506423
2019-01-22T07:20:31
2019-01-22T07:20:31
121,281,083
0
0
null
2018-04-26T05:51:34
2018-02-12T17:53:11
Java
UTF-8
Java
false
false
5,132
java
// File: LinkedQueue.java from the package edu.colorado.collections // Complete documentation is available from the LinkedQueue link in: // http://www.cs.colorado.edu/~main/docs/ package edu.colorado.collections; import java.util.NoSuchElementException; import edu.colorado.nodes.Node; /****************************************************************************** * A <CODE>LinkedQueue&lt;E&gt;</CODE> is a queue of references to E objects. * * <b>Limitations:</b> * Beyond <CODE>Int.MAX_VALUE</CODE> items, <CODE>size</CODE> is wrong. * * <b>Java Source Code for this class:</b> * <A HREF="../../../../edu/colorado/collections/LinkedQueue.java"> * http://www.cs.colorado.edu/~main/edu/colorado/collections/LinkedQueue.java * </A> * * @author Michael Main * <A HREF="mailto:main@colorado.edu"> (main@colorado.edu) </A> * * @version Feb 10, 2016 * * @see ArrayQueue ******************************************************************************/ public class LinkedQueue<E> implements Cloneable { // Invariant of the LinkedQueue class: // 1. The number of items in the queue is stored in the instance variable // manyNodes. // 2. The items in the queue are stored in a linked list, with the front // of the queue stored at the head node, and the rear of the queue at // the final node. // 3. For a non-empty queue, the instance variable front is the head // reference of the linked list of items and the instance variable rear // is the tail reference of the linked list. For an empty queue, both // front and rear are the null reference. private int manyNodes; private Node<E> front; private Node<E> rear; /** * Initialize an empty queue. * <b>Postcondition:</b> * This queue is empty. **/ public LinkedQueue( ) { front = null; rear = null; } /** * Put a new a new item in this queue. * @param item * the item to be pushed onto this queue * <b>Postcondition:</b> * The item has been pushed onto this queue. * @exception OutOfMemoryError * Indicates insufficient memory for increasing the queue's capacity. * <b>Note:</b> * An attempt to increase the capacity beyond * <CODE>Integer.MAX_VALUE</CODE> will cause the queue to fail with an * arithmetic overflow. **/ public void add(E item) { if (isEmpty( )) { // Insert first item. front = new Node<E>(item, null); rear = front; } else { // Insert an item that is not the first. rear.addNodeAfter(item); rear = rear.getLink( ); } manyNodes++; } /** * Generate a copy of this queue. * @return * The return value is a copy of this queue. Subsequent changes to the * copy will not affect the original, nor vice versa. Note that the return * value must be type cast to an <CODE>LinkedQueue</CODE> before it can be used. * @exception OutOfMemoryError * Indicates insufficient memory for creating the clone. **/ @SuppressWarnings("unchecked") public LinkedQueue<E> clone( ) { // Clone a LinkedQueue<E>. LinkedQueue<E> answer; Object[ ] cloneInfo; try { answer = (LinkedQueue<E>) super.clone( ); } catch (CloneNotSupportedException e) { // This exception should not occur. But if it does, it would probably indicate a // programming error that made super.clone unavailable. The most comon error // The most common error would be forgetting the "Implements Cloneable" // clause at the start of this class. throw new RuntimeException ("This class does not implement Cloneable"); } cloneInfo = Node.listCopyWithTail(front); answer.front = (Node<E>) cloneInfo[0]; answer.rear = (Node<E>) cloneInfo[1]; return answer; } /** * Determine whether this queue is empty. * @return * <CODE>true</CODE> if this queue is empty; * <CODE>false</CODE> otherwise. **/ public boolean isEmpty( ) { return (manyNodes == 0); } /** * Get the front item, removing it from this queue. * <b>Precondition:</b> * This queue is not empty. * @return * The return value is the front item of this queue, and the item has * been removed. * @exception NoSuchElementException * Indicates that this queue is empty. **/ public E remove( ) { E answer; if (manyNodes == 0) // NoSuchElementException is from java.util and its constructor has no argument. throw new NoSuchElementException("Queue underflow"); answer = front.getData( ); front = front.getLink( ); manyNodes--; if (manyNodes == 0) rear = null; return answer; } /** * Accessor method to determine the number of items in this queue. * @return * the number of items in this queue **/ public int size( ) { return manyNodes; } }
[ "qiruihu@gmail.com" ]
qiruihu@gmail.com
44f43cb25030c25589514a6ae961504c54684ca8
03c079f67821d20e2a774561f87f61e8ce3d24db
/Book-Store/src/gui/SignUpCustomer.java
896fe0fe569739c5d35145722231c05bdf3aacb2
[]
no_license
shereen95/Book-Store
321d694135bccc21b24ae53f7dcfb319f0725826
5476e86a7039e5b6cda0933c475027c2dc611dc4
refs/heads/master
2021-07-04T16:05:24.618344
2017-09-26T23:36:00
2017-09-26T23:36:00
104,948,609
0
0
null
null
null
null
UTF-8
Java
false
false
7,971
java
package gui; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import com.mysql.jdbc.Connection; import main.SignUp; import main.User; public class SignUpCustomer extends JFrame { /** * */ private static final long serialVersionUID = 1L; private static SignUpCustomer frame = null; private JPanel contentPane; private JTextField usernametf; private JTextField firstnametf; private JTextField lastnametf; private JTextField emailtf; private JTextField telephonetf; private JTextField addresstf; private JPasswordField passwordField; private JPasswordField passwordField_1; private ArrayList<String> params ; private SignUp signup ; /** * Create the frame. */ public SignUpCustomer(final java.sql.Statement statment ,final Connection connection , final boolean edit , final User usr) { frame = this ; params = new ArrayList<>() ; signup = new SignUp(statment); this.setTitle("New User Registeration"); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 796, 600); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Sign up", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(153, 180, 209))); panel.setBounds(94, 26, 649, 530); contentPane.add(panel); panel.setLayout(null); JLabel lblNewLabel = new JLabel("user name "); lblNewLabel.setBounds(6, 16, 98, 30); panel.add(lblNewLabel); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblFirstName = new JLabel("first name "); lblFirstName.setBounds(6, 76, 98, 30); panel.add(lblFirstName); lblFirstName.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblLastName = new JLabel("last name "); lblLastName.setBounds(6, 136, 98, 30); panel.add(lblLastName); lblLastName.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblPassword = new JLabel("Email"); lblPassword.setBounds(6, 196, 98, 30); panel.add(lblPassword); lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblTelephone = new JLabel("telephone"); lblTelephone.setBounds(6, 256, 98, 30); panel.add(lblTelephone); lblTelephone.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblAddress = new JLabel("Address"); lblAddress.setBounds(6, 316, 98, 30); panel.add(lblAddress); lblAddress.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblPassword_1 = new JLabel("password"); lblPassword_1.setBounds(6, 376, 98, 30); panel.add(lblPassword_1); lblPassword_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblPassword_2 = new JLabel("password"); lblPassword_2.setBounds(6, 436, 98, 30); panel.add(lblPassword_2); lblPassword_2.setFont(new Font("Tahoma", Font.PLAIN, 14)); usernametf = new JTextField(); usernametf.setBounds(146, 23, 497, 20); panel.add(usernametf); usernametf.setColumns(10); firstnametf = new JTextField(); firstnametf.setBounds(146, 83, 497, 20); panel.add(firstnametf); firstnametf.setColumns(10); lastnametf = new JTextField(); lastnametf.setBounds(146, 143, 497, 20); panel.add(lastnametf); lastnametf.setColumns(10); emailtf = new JTextField(); emailtf.setBounds(146, 203, 497, 20); panel.add(emailtf); emailtf.setColumns(10); telephonetf = new JTextField(); telephonetf.setBounds(146, 263, 497, 20); panel.add(telephonetf); telephonetf.setColumns(10); addresstf = new JTextField(); addresstf.setBounds(146, 323, 497, 20); panel.add(addresstf); addresstf.setColumns(10); passwordField = new JPasswordField(); passwordField.setBounds(146, 383, 497, 20); panel.add(passwordField); passwordField_1 = new JPasswordField(); passwordField_1.setBounds(146, 443, 497, 20); panel.add(passwordField_1); JButton btnSignUp = new JButton("save"); btnSignUp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String user_name = usernametf.getText().trim() ; String first_name = firstnametf.getText().trim() ; String last_name = lastnametf.getText().trim() ; String address = addresstf.getText().trim() ; String email = emailtf.getText().trim() ; String pass1 = String.valueOf(passwordField.getPassword()) ; String pass2 = String.valueOf(passwordField_1.getPassword()) ; String telephone = telephonetf.getText() ; if (telephone.isEmpty() || user_name.isEmpty() || first_name.isEmpty() || last_name.isEmpty() || address.isEmpty() || email.isEmpty() || pass1.isEmpty() || pass2.isEmpty()) { JOptionPane.showMessageDialog(frame, "please fill all the fields !"); } else { if (pass1.equals(pass2)) { params.add(user_name); params.add(first_name); params.add(last_name); params.add(email); params.add(pass1); params.add(telephone); params.add(address); params.add("0"); params.add("1"); try { int result = 1 ; if (edit) result = usr.editProfile(params) ? 1 : 2 ; else result = signup.addUser(params); if (result == 2) JOptionPane.showMessageDialog(frame, "Error :: Can't add user !"); else { // open main UI JOptionPane.showMessageDialog(frame, "added " + user_name + " successfully J"); frame.setVisible(false); frame.dispose(); new LoginFrame() ; } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); JOptionPane.showMessageDialog(frame, "Error :: Can't add user !"); } } else { JOptionPane.showMessageDialog(frame, "password is not identical !"); } } } }); btnSignUp.setBounds(416, 492, 124, 31); panel.add(btnSignUp); btnSignUp.setIcon(new ImageIcon("C:\\Users\\Abdelmaseeh\\Desktop\\BookStore\\pics\\signup.png")); JButton btnCancell = new JButton("cancell"); btnCancell.setBounds(146, 492, 124, 31); panel.add(btnCancell); btnCancell.setIcon(new ImageIcon("C:\\Users\\Abdelmaseeh\\Desktop\\BookStore\\pics\\cancell.png")); btnCancell.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { frame.setVisible(false); frame.dispose(); new LoginFrame() ; } }); if (edit) { try { ResultSet resultSet = usr.showProfile() ; while (resultSet.next()) { usernametf.setText(resultSet.getString(1)); firstnametf.setText(resultSet.getString(2)); lastnametf.setText(resultSet.getString(3)); emailtf.setText(resultSet.getString(4)); telephonetf.setText(resultSet.getString(6)); addresstf.setText(resultSet.getString(7)); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); JOptionPane.showMessageDialog(frame, "Error !!"); } } } }
[ "eng.shereenaboeldhab@hotmmail.com" ]
eng.shereenaboeldhab@hotmmail.com
54c1457f118eda98000cc0ac78a31801075bb66e
35639eaf326d315149905ad38c34211d3b88e76f
/src/day38_Statics/ScrumTask/Developer.java
ab4de75deb0d56b124dab5d6092d8e71d1e84c27
[]
no_license
blackpars4x4/JavaProgramming2020_B21
3e761061d8182660b42d9d317fefd0c5ca5c0d25
eac69380e156abe0433358423ecd5937eba8d719
refs/heads/master
2023-03-03T22:33:50.436451
2021-02-10T16:36:25
2021-02-10T16:36:25
306,726,974
1
0
null
2020-11-20T05:22:51
2020-10-23T19:17:48
Java
UTF-8
Java
false
false
1,267
java
package day38_Statics.ScrumTask; public class Developer { public String name, ID, jobTitle, companyName; public double salary; public char gender; public static boolean hasCodingSkills = true; public void setInfo(String name, String ID, String jobTitle, String companyName, double salary, char gender) { this.name = name; this.ID = ID; this.jobTitle = jobTitle; this.companyName = companyName; this.salary = salary; this.gender = gender; } public void coding() { System.out.println(jobTitle + " " + name + " is coding"); } public void fixingBug(){ System.out.println(jobTitle+" "+name+" is crying"); } @Override public String toString() { return "Developer{" + "name='" + name + '\'' + ", ID='" + ID + '\'' + ", jobTitle='" + jobTitle + '\'' + ", companyName='" + companyName + '\'' + ", salary=" + salary + ", gender=" + gender + '}'; } } /* create a class called Developer Attributes: name, employeeID, JobTitle, Salary hasCodingSkills, Actions: setInfo(), coding(), fixingBug(), toString() */
[ "55367496+blackpars4x4@users.noreply.github.com" ]
55367496+blackpars4x4@users.noreply.github.com
b35053074cf8a89ff558d20ecd748f7c22dd8344
5009932f2af21e01ae686fd6cfa3d001fdafd7c4
/src/main/java/com/spr/bt/springboot/domain/posts/Posts.java
6e5941badcc5f5b6a6561405470f51d224e3a80f
[]
no_license
seok8440/sprbt
2d517d0f4144f4a711bf390a402542e0725e432d
4ab03faaae0b361ec44f0e71655b5c0d5133437c
refs/heads/master
2023-01-20T00:23:57.976270
2020-11-11T18:01:20
2020-11-11T18:01:20
255,879,172
0
0
null
null
null
null
UTF-8
Java
false
false
854
java
package com.spr.bt.springboot.domain.posts; import com.spr.bt.springboot.domain.BaseTimeEntity; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import javax.persistence.*; @Getter @NoArgsConstructor @Entity public class Posts extends BaseTimeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(length = 500, nullable = false) private String title; @Column(columnDefinition = "TEXT", nullable = false) private String content; private String author; @Builder public Posts(String title, String content, String author) { this.title = title; this.content = content; this.author = author; } public void update(String title, String content) { this.title = title; this.content = content; } }
[ "seok8440@naver.com" ]
seok8440@naver.com
f2f40e6cc214191c614e13d9e7eaf56173821279
68c043ebf9a06aca34c395d136514371dabd10df
/src/main/java/com/trafficrecorder/trafficrecorder/utility/Utility.java
fad10f277231316ce72aab782ba9ae136e356901
[]
no_license
dipan/spring-boot-boilerplate
edbbce7b4a2364b4c573ac3a8927745e242bb65a
12f009405ca193e1a5bf5bb81b89674ea6e7bdb9
refs/heads/master
2022-12-03T03:14:39.442174
2020-08-15T08:05:58
2020-08-15T08:05:58
285,828,177
0
0
null
null
null
null
UTF-8
Java
false
false
1,243
java
package com.trafficrecorder.trafficrecorder.utility; import java.text.SimpleDateFormat; import java.util.Date; import java.util.regex.Pattern; public class Utility { public static SimpleDateFormat simpleDateTimeFormat = new SimpleDateFormat("dd MMM yyyy, HH:mm:ss"); public static SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyyMMddHHmmss"); public static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd"); public static final Pattern BOOLEAN_TRUE_PATTERN = Pattern.compile("^(y(es)?)|(t(rue)?)$", Pattern.CASE_INSENSITIVE); public static Boolean isTrue(Object value, Boolean defaultValue) { return value == null ? defaultValue : Boolean.valueOf(BOOLEAN_TRUE_PATTERN.matcher(value.toString()).matches()); } public static boolean isStringEmptyOrNull(String string) { return string == null || string.trim().length() == 0 || string.trim().equalsIgnoreCase("null"); } public static boolean isStringNonEmpty(String string) { return string != null && string.trim().length() > 0 && !string.trim().equalsIgnoreCase("null"); } public static String getFormattedDate(SimpleDateFormat dateFormat) { return dateFormat.format(new Date()); } }
[ "mandal.common@gmail.com" ]
mandal.common@gmail.com
3030d3c4edad6608f9ddfc3bda0a6639f1964dea
d36ae0f0e80beb49e0b5776ee2c8cd380d39d136
/src/main/java/com/arthurdev/bluefood/infrastructure/web/security/SecurityConfig.java
d06319e57dea638ec570dafa52dca1e6f68bd51b
[]
no_license
arthur-dev21/Bluefood
ae5716fec5513e7ae8b3047750de672b1f04cdbe
d92bc3a6c6b3af27b6c65b266da1b186f58e2a04
refs/heads/master
2023-03-20T01:47:41.620196
2021-03-11T17:15:26
2021-03-11T17:15:26
340,924,115
0
0
null
null
null
null
UTF-8
Java
false
false
1,580
java
package com.arthurdev.bluefood.infrastructure.web.security; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter{ @Bean //tem a resposbilidade de criar uma instancia de AuthenticationSuccessHandlerImpl public AuthenticationSuccessHandler authenticationSuccessHandler() { return new AuthenticationSuccessHandlerImpl(); } @Override protected void configure(HttpSecurity http) throws Exception { //esse metodo define a authenticaçao e autorizaçao , quem pode logar no sistema e quai paginas pode ser acessadas respectivamente http.csrf().disable() .authorizeRequests() .antMatchers("/images/**", "/css/**", "/js/**", "/public/**", "/sbpay/**").permitAll() .antMatchers("/cliente/**").hasRole(Role.CLIENTE.toString()) .antMatchers("/restaurante/**").hasRole(Role.RESTAURANTE.toString()) .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .failureUrl("/login-error") .successHandler(authenticationSuccessHandler()) .permitAll() .and() .logout() .logoutUrl("/logout") .permitAll(); } }
[ "arthurkenned21@gmail.com" ]
arthurkenned21@gmail.com
9b8f0bbfa0eb7d966c4d58c642c67072a05bf1e9
36e4990d37f3eae1f626890b241f5cfe2a00a929
/app/src/main/java/br/com/zup/omdbdesafio/model/business/ObjectAlreadyExistException.java
bbad96cfd06317cac1c3e551e69ed943b5bfcecf
[]
no_license
FranNeto/omdb_desafio
4007c679929c6e922811e43c396c6b867422763a
5ca4bee1be4c4579c93607e5be0213b0d86edc30
refs/heads/master
2020-06-28T18:39:13.092226
2018-11-18T00:53:59
2018-11-18T00:53:59
74,484,400
0
0
null
null
null
null
UTF-8
Java
false
false
112
java
package br.com.zup.omdbdesafio.model.business; public class ObjectAlreadyExistException extends Exception { }
[ "franciscopereirafn@gmail.com" ]
franciscopereirafn@gmail.com
e9a50f8758bc34799970509dc22e90a5d3d7bec1
54d4da2be355db4270235f33ee91669b60245545
/src/main/java/flaxbeard/steamcraft/client/render/TileEntitySmasherRenderer.java
b84d64dc93e9907b76e6d194406d2a15924acb7b
[]
no_license
Sirse/FSP
6971ee724b44045d8d0728d18547a353b856bc8f
b062826e4976cf8d4f4690b32521d24ad44f0927
refs/heads/master
2020-05-23T02:36:38.866351
2017-03-12T17:27:05
2017-03-12T17:27:05
84,743,815
1
0
null
null
null
null
UTF-8
Java
false
false
4,443
java
package flaxbeard.steamcraft.client.render; import flaxbeard.steamcraft.client.render.model.ModelSmasher; import flaxbeard.steamcraft.misc.WorldContainer; import flaxbeard.steamcraft.tile.TileEntitySmasher; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; public class TileEntitySmasherRenderer extends TileEntitySpecialRenderer implements IInventoryTESR { private static final ModelSmasher model = new ModelSmasher(); private static final ResourceLocation texture = new ResourceLocation("steamcraft:textures/models/smasher.png"); @Override public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { TileEntitySmasher smasher = (TileEntitySmasher) var1; GL11.glPushMatrix(); GL11.glTranslatef((float) var2 + 0.5F, (float) var4 + 0.5F, (float) var6 + 0.5F); int meta = var1.getWorldObj().getBlockMetadata(var1.xCoord, var1.yCoord, var1.zCoord); ForgeDirection dir = ForgeDirection.getOrientation(meta); switch (meta) { case 0: GL11.glRotatef(90.0F, 0F, 1F, 0F); break; case 1: GL11.glRotatef(90.0F, 0F, 1F, 0F); break; case 2: GL11.glRotatef(90.0F, 0F, 1F, 0F); break; case 3: GL11.glRotatef(270.0F, 0F, 1F, 0F); break; case 4: GL11.glRotatef(180.0F, 0F, 1F, 0F); break; case 5: GL11.glRotatef(0.0F, 0F, 1F, 0F); break; } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); model.renderAnchored(); double dist = 0.0f; if (smasher.extendedTicks <= 5) { dist = (Math.sin(Math.toRadians(18D * smasher.extendedTicks)) * 0.51F); } else if (smasher.extendedTicks <= 15) { dist = 0.51F; } else { dist = 0.51F - (Math.sin(Math.toRadians(9D * (smasher.extendedTicks - 15))) * 0.51F); } GL11.glTranslated(dist, 0.0F, 0.0F); model.renderPiston(0.0F); WorldContainer wc = new WorldContainer(smasher.getWorldObj(), smasher.smooshingMeta); RenderBlocks renderBlocks = new RenderBlocks(wc); renderBlocks.renderAllFaces = true; if (smasher.spinup >= 41 && smasher.extendedTicks < 3 && smasher.getWorldObj().getBlockMetadata(smasher.xCoord, smasher.yCoord, smasher.zCoord) % 2 == 0) { GL11.glTranslated(-dist, 0.0F, 0.0F); GL11.glTranslatef(1.5F, 1.0F, 1.0F); GL11.glScaled(1.0F - dist * 2F, 1.0F, 1.0F); GL11.glTranslatef(-1.5F, -1.0F, -1.0F); GL11.glTranslatef(1.0F, 0.0F, 0.0F); GL11.glTranslatef((float) -smasher.xCoord, (float) -smasher.yCoord, (float) -smasher.zCoord); try { Block block = smasher.smooshingBlock; int blockMetadata = smasher.smooshingMeta; GL11.glPushMatrix(); Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); boolean rendered = renderBlocks.renderBlockByRenderType(block, smasher.xCoord, smasher.yCoord, smasher.zCoord); tess.draw(); GL11.glPopMatrix(); renderBlocks = null; } catch (Exception e) { } } GL11.glPopMatrix(); wc = null; } @Override public void renderInventoryTileEntityAt(TileEntity var1, double x, double y, double z, float var8) { GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y - 0.1F, (float) z); Minecraft.getMinecraft().renderEngine.bindTexture(texture); model.renderAnchored(); model.renderPiston(0); GL11.glPopMatrix(); } }
[ "sirse.box@gmail.com" ]
sirse.box@gmail.com
6e6cf5bbbb50e3235f05edc3f8ba23e71cdca842
52a9207c0b23577f20810f670f5bff63900ab0e4
/src/main/java/edu/pwilder/plagiarism_detect/io/IoUtils.java
b02fc789c2c3239ea004c2c3f1aa9bd26282d7d4
[ "Unlicense" ]
permissive
pwilder/plagiarism-detect
be35f33d1bc9c96a053fa2be0f97bb77209e4465
4a59f702941240a556040cc8b3f746e07157fdf9
refs/heads/master
2020-04-20T09:39:01.811210
2019-02-02T17:13:24
2019-02-02T17:13:24
168,770,194
0
0
Unlicense
2019-02-02T16:34:35
2019-02-01T22:48:26
Java
UTF-8
Java
false
false
582
java
package edu.pwilder.plagiarism_detect.io; import java.io.Closeable; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * Poor mans Apache IOUtils */ public class IoUtils { private static final Logger LOGGER = Logger.getLogger(IoUtils.class.getName()); public static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (final IOException e) { LOGGER.log(Level.FINE, "Could not close", e); } } }
[ "philip.wilder@gmail.com" ]
philip.wilder@gmail.com
d4541dbb7e476243cfb070c4c26442aac0d1d405
a74c84cd7214fa33b171ce8cc64cb76095cf4be1
/src/org/apache/poi/xwpf/converter/core/IURIResolver.java
7df529bf152305b967fcb8b56282f869adc5b54e
[]
no_license
INL/OpenConvert
c0a3c148668790dd05393f1e283c12de8d153e9c
7a58c9dd4a07066eb90cbf47038ef637a993cb83
refs/heads/master
2022-02-21T00:54:24.691854
2022-02-11T08:32:26
2022-02-11T08:32:26
43,800,959
19
9
null
null
null
null
UTF-8
Java
false
false
1,690
java
/** * Copyright (C) 2011-2012 The XDocReport Team <xdocreport@googlegroups.com> * * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package org.apache.poi.xwpf.converter.core; /** * URI resolver. */ public interface IURIResolver { /** * Default URI resolver. */ public static final IURIResolver DEFAULT = new IURIResolver() { public String resolve( String uri ) { return uri; } }; /** * Returns the resolved uri. * * @param uri * @return */ String resolve( String uri ); }
[ "jesse.dedoes@inl.nl" ]
jesse.dedoes@inl.nl
ba5a5cecccdc759a6da7cff56e8cca7305300e0e
95e7b164d5b231da24bca39cd366f21c7da398b3
/src/uk/co/chrisloy/sandpit/graph/UndirectedGraph.java
c58db7d9c256fb29e305f4d163cbfefe92231c8c
[]
no_license
chrisloy/java-algorithms
084ae9a1c87d4105ca0732e11f7fb2deb106694d
ff8aedb421377e03b1691ca67090869c440bc37c
refs/heads/master
2016-09-07T15:41:54.825238
2013-08-21T14:36:44
2013-08-21T14:36:44
7,099,601
0
1
null
null
null
null
UTF-8
Java
false
false
97
java
package uk.co.chrisloy.sandpit.graph; public interface UndirectedGraph<T> extends Graph<T> { }
[ "chrisloy@retina.local" ]
chrisloy@retina.local
a906e68ec6617dbe7ab73cf7de9742a9da073dea
bb6e65ae91a2d01fd8ac249521b8ff1416bc8651
/cq-pension-service-api/src/main/java/com/cqp/service/api/NursPlanService.java
3d91e4432cfccb3463ddfa1f743c55ccbf83b543
[]
no_license
Ceboe/cq-pension-business
85db7ae56df2f5ae00beae8a99a1b1e8e3b97b7e
4818c0a2a76bd16f1c640ff6aeab63bd3835c950
refs/heads/master
2023-01-01T12:18:34.809371
2020-10-21T08:53:03
2020-10-21T08:53:03
299,817,418
1
0
null
null
null
null
UTF-8
Java
false
false
1,248
java
package com.cqp.service.api; import com.cqp.model.NursPlan; import com.github.pagehelper.PageInfo; import java.util.List; /**** * @Author:shenkunlin * @Description:NursPlan业务层接口 * @Date 2019/6/14 0:16 *****/ public interface NursPlanService { /*** * NursPlan多条件分页查询 * @param nursPlan * @param page * @param size * @return */ PageInfo<NursPlan> findPage(NursPlan nursPlan, int page, int size); /*** * NursPlan分页查询 * @param page * @param size * @return */ PageInfo<NursPlan> findPage(int page, int size); /*** * NursPlan多条件搜索方法 * @param nursPlan * @return */ List<NursPlan> findList(NursPlan nursPlan); /*** * 删除NursPlan * @param id */ int delete(Integer id); /*** * 修改NursPlan数据 * @param nursPlan */ int update(NursPlan nursPlan); /*** * 新增NursPlan * @param nursPlan */ int add(NursPlan nursPlan); /** * 根据ID查询NursPlan * @param id * @return */ NursPlan findById(Integer id); /*** * 查询所有NursPlan * @return */ List<NursPlan> findAll(); }
[ "2467163892@qq.com" ]
2467163892@qq.com
acd7c45a021e4a7c0b180a381b99fff815b7f197
1204174b503e7795fba6388c44428a7ef218c266
/selenium_test.java
2652441af09ae115812414bc9de2acdcabff1e09
[]
no_license
mmywong/LAMP-Selenium-TestLibrary
13d49e75f361dd42fc23b1a8e1bf63ba3f7ad55a
ced977a9bf4f05f90be4b91e5f935e57e82238a0
refs/heads/master
2021-04-07T19:18:22.827698
2020-03-22T08:48:15
2020-03-22T08:48:15
248,700,841
0
0
null
null
null
null
UTF-8
Java
false
false
2,282
java
import java.io.IOException; import java.io.File; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; public class selenium_test { public static void main(String[] args) throws IOException, InterruptedException { System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"); ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("--headless"); chromeOptions.addArguments("--no-sandbox"); WebDriver driver = new ChromeDriver(chromeOptions); driver.get("http://192.168.1.240/simple-lamp/index.php"); Thread.sleep(1000); login(driver); uploadfile(driver); screenshot(driver); driver.quit(); } public static void login(WebDriver driver) { WebElement searchbar = driver.findElement(By.id("username")); searchbar.sendKeys("michelle"); driver.findElement(By.cssSelector("input[type='submit']")).click(); System.out.println("testing searchbar"); if (driver.getPageSource().contains("Logout")) { System.out.println("Pass"); } else { System.out.println("Fail"); } } public static void screenshot(WebDriver driver) { File src = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); try{ FileUtils.copyFile(src, new File("screenshot.png")); System.out.println("screenshot captured"); } catch (Exception e){ System.out.println(e.getMessage()); } } public static void uploadfile(WebDriver driver){ System.out.println("testing upload..."); //upload image WebElement uploadElement = driver.findElement(By.id("fileToUpload")); uploadElement.sendKeys("/home/mirynth/Downloads/818292.png"); //click "Upload Image" button driver.findElement(By.name("submit_button")).click(); } }
[ "michellewong.nma@gmail.com" ]
michellewong.nma@gmail.com
6af31461a24c655c896e7c07b5d130cea0a408e2
906d55ead2340143721d0a4d7f7b040e24cf40a6
/Iphone2/src/SmartPhone.java
c163935cb14606aae606fc6c10038224f4f1a4a6
[]
no_license
1209mori05/test
6b8ed6d66eb4c687956b16b98dbaf8fb091ded37
93e869491c3d3037638bfbffb1b889320c25d2f1
refs/heads/master
2021-04-30T06:56:28.300469
2018-03-30T07:52:14
2018-03-30T07:52:14
121,457,847
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
public class SmartPhone extends Phone implements Mp3Player,NewFunction{ } // {}内は空白 // implementsでMp3Player,NewFunctionインターフェイスの // 抽象メソッドを読み込み実装し、 // extendsでPhoneクラスのメソッドを継承しつつ // オーバーライドしている。
[ "ghosty025690@icloud.com" ]
ghosty025690@icloud.com
4f1bab3b96dfb59b23cc056df98edf1345126d62
d6516641d315f5f537d81122e403df99324996e6
/src/test/java/com/mekaku/ppic/PpicApplicationTests.java
9512f2f7071e8df1cd3a3733ed14f32965d48597
[]
no_license
MeKaKu/PPIC-backend
622f0973d3d323b3fb3b1f09ba340c2f4b8f1d2d
7b35004df461ab1a6d78770d697b280941562f4d
refs/heads/master
2023-04-22T03:16:00.089398
2021-05-21T09:24:03
2021-05-21T09:24:03
368,378,934
0
0
null
null
null
null
UTF-8
Java
false
false
548
java
package com.mekaku.ppic; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import javax.sql.DataSource; import java.sql.SQLException; @SpringBootTest class PpicApplicationTests { @Autowired DataSource dataSource; @Test void contextLoads() { } @Test void databaseTest() throws SQLException { System.out.println(dataSource.getClass()); System.out.println(dataSource.getConnection()); } }
[ "OUJIANJAPAN@163.com" ]
OUJIANJAPAN@163.com
094e72b62bd3344a7e7328b90292122f49aa11a7
9d0b670a344272ab1f8413c527125a1a1445ddb1
/src/_0604/pojo/OrderHistory.java
f44dfe3817e9bd64f424894d1a39e44a6ec42a57
[]
no_license
sun-0128/Shop
53779cefcdf5f03e1679071a37108d566c337912
6115dcd3dfb83c25f5f4427941092b02b002fe83
refs/heads/master
2022-12-12T06:34:56.333137
2020-09-16T03:36:31
2020-09-16T03:36:31
295,914,315
0
0
null
null
null
null
UTF-8
Java
false
false
1,459
java
package _0604.pojo; import java.util.Date; /** * @author sunyong * @date 2020/06/04 * @description */ public class OrderHistory { private int hid; private int orderId; private String orderDetail; private Date dealTime; private Date confirmDate; private String rollbackTime; private String rollbackReason; public int getHid() { return hid; } public void setHid(int hid) { this.hid = hid; } public int getOrderId() { return orderId; } public void setOrderId(int orderId) { this.orderId = orderId; } public String getOrderDetail() { return orderDetail; } public void setOrderDetail(String orderDetail) { this.orderDetail = orderDetail; } public Date getDealTime() { return dealTime; } public void setDealTime(Date dealTime) { this.dealTime = dealTime; } public Date getConfirmDate() { return confirmDate; } public void setConfirmDate(Date confirmDate) { this.confirmDate = confirmDate; } public String getRollbackTime() { return rollbackTime; } public void setRollbackTime(String rollbackTime) { this.rollbackTime = rollbackTime; } public String getRollbackReason() { return rollbackReason; } public void setRollbackReason(String rollbackReason) { this.rollbackReason = rollbackReason; } }
[ "1335902858@qq.com" ]
1335902858@qq.com
575de63bad2d385c2338c085deedac5733eadb1d
c3a14fee3863e402f91a8d4c1c25aeaa31334236
/src/org/test/FirstDay5.java
2f10f6e4b203c83c34426501cc8a009bc43a0652
[]
no_license
arolinhelan/projectfirst
8c1ad6fd10851c6342102da81c6954f4a799138e
c83d1665cc89555cc172ab4cc2487f1e51ddd635
refs/heads/master
2022-12-16T16:08:41.742983
2020-09-18T10:48:08
2020-09-18T10:48:08
296,585,962
0
0
null
2020-09-18T10:48:10
2020-09-18T10:13:04
Java
UTF-8
Java
false
false
195
java
package org.test; public class FirstDay5 { public void testCase() { System.out.println("arolin"); } public static void main(String[] args) { FirstDay5 s =new FirstDay5(); s.testCase(); }}
[ "arolinhelan@gmail.com" ]
arolinhelan@gmail.com
712eb060bad163bb6b707453902a09bf70d03b2b
ba74038a0d3a24d93e6dbd1f166530f8cb1dd641
/teamclock/src/java/com/fivesticks/time/useradmin/xwork/PasswordModifyAction.java
e0e9a8fe41284033de77e0e81e5d6dccaa043a30
[]
no_license
ReidCarlberg/teamclock
63ce1058c62c0a00d63a429bac275c4888ada79a
4ac078610be86cf0902a73b1ba2a697f9dcf4e3c
refs/heads/master
2016-09-05T23:46:28.600606
2009-09-18T07:25:37
2009-09-18T07:25:37
32,190,901
0
0
null
null
null
null
UTF-8
Java
false
false
6,293
java
/* * Created on Sep 30, 2004 by Reid */ package com.fivesticks.time.useradmin.xwork; import com.fivesticks.time.common.SessionContext; import com.fivesticks.time.common.SessionContextAware; import com.fivesticks.time.common.util.ValidationHelper; import com.fivesticks.time.menu.MenuSection; import com.fstx.stdlib.authen.users.User; import com.fstx.stdlib.authen.users.UserBD; import com.fstx.stdlib.authen.users.UserBDFactory; import com.fstx.stdlib.common.simpledate.SimpleDate; import com.opensymphony.xwork.ActionSupport; /** * @author Reid */ public class PasswordModifyAction extends ActionSupport implements SessionContextAware, PasswordModifyContextAware, UserModifyContextAware { private SessionContext sessionContext; private PasswordModifyContext passwordModifyContext; private UserModifyContext userModifyContext; private String submitPassword; private String cancelPassword; private String userPassword1; private String userPassword2; private String targetUser; public String execute() throws Exception { this.getSessionContext().setMenuSection(MenuSection.PASSWORD); if (this.getCancelPassword() != null) { if (this.getUserModifyContext().getTarget() == null) return SUCCESS; else return SUCCESS + "-admin"; } if (this.getSubmitPassword() == null && this.getCancelPassword() == null) { if (this.getTargetUser() != null) { User user = UserBDFactory.factory.build().getByUsername( this.getTargetUser()); if (user == null) { return ERROR; } this.getPasswordModifyContext().setTargetUser(user); } else { this.getPasswordModifyContext().setTargetUser( this.getSessionContext().getUser().getUser()); } return INPUT; } validate(); if (this.hasErrors()) { return INPUT; } UserBD bd = UserBDFactory.factory.build(); SimpleDate expires = SimpleDate.factory.buildMidnight(); expires.advanceDay(new Long(this.getSessionContext().getSettings().getUserPasswordLife()).intValue()); bd.changePassword(this.getPasswordModifyContext().getTargetUser(), this .getUserPassword1(),expires); this.getPasswordModifyContext().setTargetUser(null); if (this.getUserModifyContext().getTarget() == null) return SUCCESS; else return SUCCESS + "-admin"; } public void validate() { ValidationHelper helper = new ValidationHelper(); if (helper.isStringEmpty(this.getUserPassword1())) { this.addFieldError("userPassword1", "Password is required."); } if (helper.isStringEmpty(this.getUserPassword2())) { this.addFieldError("userPassword2", "Password (confirm) is required."); } if (!this.getUserPassword1().equals(this.getUserPassword2())) { this.addFieldError("userPassword1", "Passwords must match."); } } /** * @return Returns the sessionContext. */ public SessionContext getSessionContext() { return sessionContext; } /** * @param sessionContext * The sessionContext to set. */ public void setSessionContext(SessionContext sessionContext) { this.sessionContext = sessionContext; } /** * @return Returns the passwordModifyContext. */ public PasswordModifyContext getPasswordModifyContext() { return passwordModifyContext; } /** * @param passwordModifyContext * The passwordModifyContext to set. */ public void setPasswordModifyContext( PasswordModifyContext passwordModifyContext) { this.passwordModifyContext = passwordModifyContext; } /** * @return Returns the passwordCancel. */ public String getCancelPassword() { return cancelPassword; } /** * @param passwordCancel * The passwordCancel to set. */ public void setCancelPassword(String passwordCancel) { this.cancelPassword = passwordCancel; } /** * @return Returns the passwordSubmit. */ public String getSubmitPassword() { return submitPassword; } /** * @param passwordSubmit * The passwordSubmit to set. */ public void setSubmitPassword(String passwordSubmit) { this.submitPassword = passwordSubmit; } /** * @return Returns the userPassword1. */ public String getUserPassword1() { return userPassword1; } /** * @param userPassword1 * The userPassword1 to set. */ public void setUserPassword1(String userPassword1) { this.userPassword1 = userPassword1; } /** * @return Returns the userPassword2. */ public String getUserPassword2() { return userPassword2; } /** * @param userPassword2 * The userPassword2 to set. */ public void setUserPassword2(String userPassword2) { this.userPassword2 = userPassword2; } /** * @return Returns the targetUser. */ public String getTargetUser() { return targetUser; } /** * @param targetUser * The targetUser to set. */ public void setTargetUser(String targetUser) { this.targetUser = targetUser; } /** * @return Returns the userModifyContext. */ public UserModifyContext getUserModifyContext() { return userModifyContext; } /** * @param userModifyContext * The userModifyContext to set. */ public void setUserModifyContext(UserModifyContext userModifyContext) { this.userModifyContext = userModifyContext; } }
[ "reidcarlberg@c917f71e-a3f3-11de-ba6e-69e41c8db662" ]
reidcarlberg@c917f71e-a3f3-11de-ba6e-69e41c8db662
7c8da1784c398c41e4a670671a96b492adffe4bc
cec0c2fa585c3f788fc8becf24365e56bce94368
/io/netty/handler/codec/mqtt/MqttUnsubAckMessage.java
0b6ba95213a1533764b9279e02723320232ccf75
[]
no_license
maksym-pasichnyk/Server-1.16.3-Remapped
358f3c4816cbf41e137947329389edf24e9c6910
4d992e2d9d4ada3ecf7cecc039c4aa0083bc461e
refs/heads/master
2022-12-15T08:54:21.236174
2020-09-19T16:13:43
2020-09-19T16:13:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
914
java
/* */ package io.netty.handler.codec.mqtt; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public final class MqttUnsubAckMessage /* */ extends MqttMessage /* */ { /* */ public MqttUnsubAckMessage(MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader) { /* 25 */ super(mqttFixedHeader, variableHeader, null); /* */ } /* */ /* */ /* */ public MqttMessageIdVariableHeader variableHeader() { /* 30 */ return (MqttMessageIdVariableHeader)super.variableHeader(); /* */ } /* */ } /* Location: C:\Users\Josep\Downloads\Decompile Minecraft\deobfuscated.jar!\io\netty\handler\codec\mqtt\MqttUnsubAckMessage.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
[ "tanksherman27@gmail.com" ]
tanksherman27@gmail.com
d3618f32ea119ee72e0f1adcefc326576ac02345
d730308970df56fba9be1f2ff81bcc5814b9c787
/Vipians/src/muni/Zip.java
96ac0cd9a277dd3444bed2ca19a5b9873b63220f
[]
no_license
munivictoria/sgmdv
dda1285de24477e75986d655c9fc4d805ef47a4e
9da300b2c90cb3ec7f7c3af47509db884f71ab05
refs/heads/master
2021-01-18T21:16:59.795064
2016-05-16T13:36:11
2016-05-16T13:36:11
28,036,850
0
0
null
null
null
null
UTF-8
Java
false
false
1,289
java
package muni; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; /** * * @author nico * */ public class Zip { private String carpetaTemporal; public String getCarpetaTemporal() { return carpetaTemporal; } public void setCarpetaTemporal(String carpetaTemporal) { this.carpetaTemporal = carpetaTemporal; } /** * El primer File es el Zip, el resto son los archivos a meter dentro del zip. * @param archivos */ public void comprimir(List<File> pListaArchivos, File pZip) { byte[] buffer = new byte[1024]; try { FileOutputStream locFOS = new FileOutputStream(pZip.getPath()); ZipOutputStream locZOS = new ZipOutputStream(locFOS); for(File cadaArchivo : pListaArchivos) { ZipEntry ze = new ZipEntry(cadaArchivo.getName()); locZOS.putNextEntry(ze); FileInputStream in = new FileInputStream(this.carpetaTemporal + File.separator + cadaArchivo.getName()); int len; while((len = in.read(buffer)) > 0) { locZOS.write(buffer, 0, len); } in.close(); } locZOS.closeEntry(); locZOS.close(); } catch(IOException ex) { ex.printStackTrace(); } } }
[ "ferna@fernando-notebook.(none)" ]
ferna@fernando-notebook.(none)
0b29f7d0e91bad00610b9c2a9d4fa4882e5d1fa3
fec4c1754adce762b5c4b1cba85ad057e0e4744a
/jfAppService/src/main/java/com/jf/service/CombineDepositOrderService.java
a957b776f2a26e375b5b7d98a027d517db99a300
[]
no_license
sengeiou/workspace_xg
140b923bd301ff72ca4ae41bc83820123b2a822e
540a44d550bb33da9980d491d5c3fd0a26e3107d
refs/heads/master
2022-11-30T05:28:35.447286
2020-08-19T02:30:25
2020-08-19T02:30:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
811
java
package com.jf.service; import com.jf.common.base.BaseService; import com.jf.dao.CombineDepositOrderMapper; import com.jf.entity.CombineDepositOrder; import com.jf.entity.CombineDepositOrderExample; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @Transactional public class CombineDepositOrderService extends BaseService<CombineDepositOrder, CombineDepositOrderExample> { @Autowired private CombineDepositOrderMapper combineDepositOrderMapper; @Autowired public void setCombineDepositOrderMapper(CombineDepositOrderMapper combineDepositOrderMapper) { super.setDao(combineDepositOrderMapper); this.combineDepositOrderMapper = combineDepositOrderMapper; } }
[ "397716215@qq.com" ]
397716215@qq.com
bca15db95a98d2d752e0b456ef4ae08b57e725ad
d3cf715a8aa9a4c9b43de21a0d6d2c862b91f26f
/supega_trabajador/app/src/main/java/info/androidhive/supegatrab/gcm/PushNotificationService.java
6d0e5f4fa036e503ba03b303168558cbdc3afdcb
[]
no_license
tenshi98/Descontinuados-Android
ac1b4abb51eceeb5916a85ec32d30df7c76652f5
fbd5a938c842820ccd80c2d2caa38db0d5c62ac9
refs/heads/master
2020-07-04T23:54:59.450644
2019-08-15T02:21:25
2019-08-15T02:21:25
202,456,729
0
0
null
null
null
null
UTF-8
Java
false
false
2,261
java
package info.androidhive.supegatrab.gcm; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.TaskStackBuilder; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import com.google.android.gms.gcm.GcmListenerService; import info.androidhive.supegatrab.R; import info.androidhive.supegatrab.activity.MainActivity; public class PushNotificationService extends GcmListenerService { @Override public void onMessageReceived(String from, Bundle data) { String mensaje = data.getString("message"); //Se envia la notificacion a una clase personalizada notifyUser(this, mensaje); } public void notifyUser(Context context,String mensaje){ NotificationManager notificationManager = (NotificationManager) context.getSystemService(Activity.NOTIFICATION_SERVICE); Intent notificationIntent = new Intent( context, MainActivity.class); notificationIntent.putExtra("Notificaciones", "viewNotificaciones"); Bitmap large = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_large); int small = R.drawable.ic_launcher; TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(notificationIntent); PendingIntent pIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); Notification notification = new Notification.Builder(context) .setContentTitle(getString(R.string.app_name)) .setContentText(mensaje) .setContentIntent(pIntent) .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setContentIntent(pIntent) .setAutoCancel(true) .setLargeIcon(large) .setSmallIcon(small) .setTicker(mensaje) .setWhen(System.currentTimeMillis()) .build(); notificationManager.notify(0, notification); } }
[ "54037366+tenshi98@users.noreply.github.com" ]
54037366+tenshi98@users.noreply.github.com
37596a98486d15c1ade2aa8e2a349549a9284305
26ec3c430e68cecf91c6bbe2af0acdb4c2130fac
/springcloud-consumer-dept-feign/src/main/java/com/jd/springcloud/DeptConsumer_feign.java
86f52c4ebaee04b908f6b9fe9ec7d82bf6ed94b0
[]
no_license
linguanghan/SpringCloudDemo
72e8cde3740ed29c2d88ac667fede54319fb5b1f
e7e8f95b2fd0bd1de6fd752a9fd5c5ea76385a36
refs/heads/master
2023-04-30T00:18:11.650859
2021-05-15T10:24:08
2021-05-15T10:24:08
367,575,745
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
package com.jd.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; /** * TODO * * @author 13540 * @version 1.0 * @date 2021-05-10 17:38 */ @SpringBootApplication @EnableEurekaClient @EnableFeignClients(basePackages = {"com.jd.springcloud"}) public class DeptConsumer_feign { public static void main(String[] args) { SpringApplication.run(DeptConsumer_feign.class, args); } }
[ "1354009873@qq.com" ]
1354009873@qq.com
627f58dff726df8f6d5eb765995e8fc46b659862
4988d3f8e4f2874c82d4d5afe21824a534ebb5a1
/src/main/java/com/example/demo/DemoApplication.java
37d8a2991877d03d739cdb71b281ce5f1659a7f7
[]
no_license
lostground97/jenkinsDemo
a079796eb6668881496a0ad1747d2e0358892d6a
44f990934c3c3665aa8cd3f537f858754d64204f
refs/heads/master
2022-12-11T18:18:08.842346
2020-09-11T04:54:42
2020-09-11T04:54:42
293,730,852
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); System.out.println("Hello From Sping Boot Application"); } }
[ "sethi.rishabh97@gmail.com" ]
sethi.rishabh97@gmail.com
ab07b4dc4dfae3cdc02861810ba7a63cdb5186f0
cd6276f31d4621c5843981409194fa6de4ec4fec
/quora-api/src/main/java/com/upgrad/quora/api/controller/CommonController.java
ec25ffa45f2338e0502ff7edafc07a5dbfd9c0af
[]
no_license
simuphil7/upgrad-quora
742e9225ba93a1e9b35c86ffd0699fdc419eb191
4dc0c94d17266c3ddf434645a9d6dca124c4cdb6
refs/heads/master
2022-12-21T08:05:33.859896
2019-11-02T14:33:13
2019-11-02T14:33:13
219,144,253
0
1
null
null
null
null
UTF-8
Java
false
false
2,377
java
package com.upgrad.quora.api.controller; import com.upgrad.quora.api.model.UserDetailsResponse; import com.upgrad.quora.service.business.UserCommonService; import com.upgrad.quora.service.entity.UserEntity; import com.upgrad.quora.service.exception.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; //RestController annotation specifies that this class represents a REST API(equivalent of @Controller + @ResponseBody) @RestController @RequestMapping("/") public class CommonController { //Required services are autowired to enable access to methods defined in respective Business services @Autowired private UserCommonService userCommonssService; /** * @param userUuid the first {@code String} to check user profile. * @param accessToken the second {@code String} to check if the access is available. * @return ResponseEntity is returned with Status OK. */ @RequestMapping(method = RequestMethod.GET, path = "/userprofile/{userId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity < UserDetailsResponse > userProfile(@PathVariable("userId") final String userUuid, @RequestHeader("authorization") final String accessToken) throws AuthorizationFailedException, UserNotFoundException { // Logic to handle Bearer <accesstoken> // User can give only Access token or Bearer <accesstoken> as input. String bearerToken = null; try { bearerToken = accessToken.split("Bearer ")[1]; } catch (ArrayIndexOutOfBoundsException e) { bearerToken = accessToken; } final UserEntity userEntity = userCommonssService.getUser(userUuid, bearerToken); UserDetailsResponse userDetailsResponse = new UserDetailsResponse().firstName(userEntity.getFirstName()) .lastName(userEntity.getLastName()).userName(userEntity.getUserName()).emailAddress(userEntity.getEmail()) .country(userEntity.getCountry()).aboutMe(userEntity.getAboutMe()).dob(userEntity.getDob()).contactNumber(userEntity.getContactNumber()); return new ResponseEntity < UserDetailsResponse > (userDetailsResponse, HttpStatus.OK); } }
[ "simuphil7@gmail.com" ]
simuphil7@gmail.com
0d74727357e83a4eec39e2bca1b7aef9becf767e
a3ee20cbdac0c33d01aa6664eaa49dfaaa0fcf8d
/framework/modules/boot-starter/src/main/java/com/tairanchina/csp/dew/core/web/validation/CreateGroup.java
acce20997a6976aa33eb6901219f53fb382ea0a9
[ "Apache-2.0" ]
permissive
lightTrace/dew
6a1a09dec8fc8667f8aad7caaf7830cc60cf3526
d977dc354fccd7967d83173fc1ddacb490af9a69
refs/heads/master
2020-05-02T06:52:28.334219
2019-03-26T11:45:47
2019-03-26T11:45:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
721
java
/* * Copyright 2019. the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tairanchina.csp.dew.core.web.validation; public interface CreateGroup { // doNothing }
[ "i@sunisle.org" ]
i@sunisle.org
6ed1d5ba3ebfbd7aac5166497f3318c96c7ace67
a36486c878ed15ba156a9f8500bdcf60e60dcf9c
/spring-cloud-utils/src/main/java/com/spring/cloud/base/utils/crypto/DESede.java
15ba1d5571fedf5e58124364bc350e6ed5ae9250
[ "Apache-2.0" ]
permissive
debugsw/springcloud
6cc6129c3dc2ba769453b29a8f9bd40978c75480
9cec564a6f00711f98f0d73c0516e64626a160f9
refs/heads/master
2023-08-02T15:30:44.451788
2023-07-24T01:13:24
2023-07-24T01:13:24
134,233,051
5
3
Apache-2.0
2023-06-21T03:10:22
2018-05-21T07:18:40
Java
UTF-8
Java
false
false
3,260
java
package com.spring.cloud.base.utils.crypto; import com.spring.cloud.base.utils.str.StrUtil; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; /** * @Author: ls * @Description: DESede是由DES对称加密算法改进后的一种对称加密算法 * @Date: 2023/4/13 15:56 */ public class DESede extends SymmetricCrypto { private static final long serialVersionUID = 1L; /** * 构造,默认DESede/ECB/PKCS5Padding,使用随机密钥 */ public DESede() { super(SymmetricAlgorithm.DESede); } /** * 构造,使用默认的DESede/ECB/PKCS5Padding * * @param key 密钥 */ public DESede(byte[] key) { super(SymmetricAlgorithm.DESede, key); } /** * 构造,使用随机密钥 * * @param mode 模式{@link Mode} * @param padding {@link Padding}补码方式 */ public DESede(Mode mode, Padding padding) { this(mode.name(), padding.name()); } /** * 构造 * * @param mode 模式{@link Mode} * @param padding {@link Padding}补码方式 * @param key 密钥,长度24位 */ public DESede(Mode mode, Padding padding, byte[] key) { this(mode, padding, key, null); } /** * 构造 * * @param mode 模式{@link Mode} * @param padding {@link Padding}补码方式 * @param key 密钥,长度24位 * @param iv 偏移向量,加盐 */ public DESede(Mode mode, Padding padding, byte[] key, byte[] iv) { this(mode.name(), padding.name(), key, iv); } /** * 构造 * * @param mode 模式{@link Mode} * @param padding {@link Padding}补码方式 * @param key 密钥,长度24位 * */ public DESede(Mode mode, Padding padding, SecretKey key) { this(mode, padding, key, null); } /** * 构造 * * @param mode 模式{@link Mode} * @param padding {@link Padding}补码方式 * @param key 密钥,长度24位 * @param iv 偏移向量,加盐 * */ public DESede(Mode mode, Padding padding, SecretKey key, IvParameterSpec iv) { this(mode.name(), padding.name(), key, iv); } /** * 构造 * * @param mode 模式 * @param padding 补码方式 */ public DESede(String mode, String padding) { this(mode, padding, (byte[]) null); } /** * 构造 * * @param mode 模式 * @param padding 补码方式 * @param key 密钥,长度24位 */ public DESede(String mode, String padding, byte[] key) { this(mode, padding, key, null); } /** * 构造 * * @param mode 模式 * @param padding 补码方式 * @param key 密钥,长度24位 * @param iv 加盐 */ public DESede(String mode, String padding, byte[] key, byte[] iv) { this(mode, padding, SecureUtil.generateKey(SymmetricAlgorithm.DESede.getValue(), key), null == iv ? null : new IvParameterSpec(iv)); } /** * 构造 * * @param mode 模式 * @param padding 补码方式 * @param key 密钥 */ public DESede(String mode, String padding, SecretKey key) { this(mode, padding, key, null); } /** * 构造 * * @param mode 模式 * @param padding 补码方式 * @param key 密钥 * @param iv 加盐 */ public DESede(String mode, String padding, SecretKey key, IvParameterSpec iv) { super(StrUtil.format("{}/{}/{}", SymmetricAlgorithm.DESede.getValue(), mode, padding), key, iv); } }
[ "shuai012192@126.com" ]
shuai012192@126.com
a30fb65d2d1a8c75cb8fa3d224d8f6c71b245a5d
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_a940c003320b3e6c9289cd64870b9a1e8e5a37e7/ParameterTypes/5_a940c003320b3e6c9289cd64870b9a1e8e5a37e7_ParameterTypes_s.java
3842a91eb350df4dbef29f9857d9c000dd8bf12a
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
13,914
java
/* * Copyright 2003-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.codehaus.groovy.reflection; import org.codehaus.groovy.GroovyBugError; import org.codehaus.groovy.runtime.MetaClassHelper; import org.codehaus.groovy.runtime.wrappers.Wrapper; import java.lang.reflect.Array; public class ParameterTypes { protected volatile Class [] nativeParamTypes; protected volatile CachedClass [] parameterTypes; protected boolean isVargsMethod; public ParameterTypes () { } public ParameterTypes(Class pt []) { nativeParamTypes = pt; } public ParameterTypes(String pt[]) { nativeParamTypes = new Class[pt.length]; for (int i = 0; i != pt.length; ++i) { try { nativeParamTypes[i] = Class.forName(pt[i]); } catch (ClassNotFoundException e){ NoClassDefFoundError err = new NoClassDefFoundError(); err.initCause(e); throw err; } } } public ParameterTypes(CachedClass[] parameterTypes) { setParametersTypes(parameterTypes); } protected final void setParametersTypes(CachedClass[] pt) { this.parameterTypes = pt; isVargsMethod = pt.length > 0 && pt [pt.length-1].isArray; } public CachedClass[] getParameterTypes() { if (parameterTypes == null) { getParametersTypes0(); } return parameterTypes; } private synchronized void getParametersTypes0() { if (parameterTypes != null) return; Class [] npt = nativeParamTypes == null ? getPT() : nativeParamTypes; CachedClass[] pt = new CachedClass [npt.length]; for (int i = 0; i != npt.length; ++i) pt[i] = ReflectionCache.getCachedClass(npt[i]); nativeParamTypes = npt; setParametersTypes(pt); } public Class[] getNativeParameterTypes() { if (nativeParamTypes == null) { getNativeParameterTypes0(); } return nativeParamTypes; } private synchronized void getNativeParameterTypes0() { if (nativeParamTypes != null) return; Class [] npt; if (parameterTypes != null) { npt = new Class [parameterTypes.length]; for (int i = 0; i != parameterTypes.length; ++i) { npt[i] = parameterTypes[i].getTheClass(); } } else npt = getPT (); nativeParamTypes = npt; } protected Class[] getPT() { throw new UnsupportedOperationException(getClass().getName()); } public boolean isVargsMethod(Object[] arguments) { // Uncomment if at some point this method can be called before parameterTypes initialized // getParameterTypes(); if(!isVargsMethod) return false; final int lenMinus1 = parameterTypes.length - 1; // -1 because the varg part is optional if (lenMinus1 == arguments.length) return true; if (lenMinus1 > arguments.length) return false; if (arguments.length > parameterTypes.length) return true; // only case left is arguments.length == parameterTypes.length Object last = arguments[arguments.length - 1]; if (last == null) return true; Class clazz = last.getClass(); return !clazz.equals(parameterTypes[lenMinus1].getTheClass()); } public final Object[] coerceArgumentsToClasses(Object[] argumentArray) { // Uncomment if at some point this method can be called before parameterTypes initialized // getParameterTypes(); argumentArray = correctArguments(argumentArray); final CachedClass[] pt = parameterTypes; final int len = argumentArray.length; for (int i = 0; i < len; i++) { final Object argument = argumentArray[i]; if (argument != null) { argumentArray[i] = pt[i].coerceArgument(argument); } } return argumentArray; } public Object[] correctArguments(Object[] argumentArray) { // correct argumentArray's length if (argumentArray == null) { return MetaClassHelper.EMPTY_ARRAY; } final CachedClass[] pt = parameterTypes; if (pt.length == 1 && argumentArray.length == 0) { if (isVargsMethod) return new Object[]{Array.newInstance(pt[0].getTheClass().getComponentType(), 0)}; else return MetaClassHelper.ARRAY_WITH_NULL; } if (isVargsMethod && isVargsMethod(argumentArray)) { return fitToVargs(argumentArray, pt); } return argumentArray; } /** * this method is called when the number of arguments to a method is greater than 1 * and if the method is a vargs method. This method will then transform the given * arguments to make the method callable * * @param argumentArray the arguments used to call the method * @param paramTypes the types of the paramters the method takes */ private static Object[] fitToVargs(Object[] argumentArray, CachedClass[] paramTypes) { Class vargsClass = ReflectionCache.autoboxType(paramTypes[paramTypes.length - 1].getTheClass().getComponentType()); if (argumentArray.length == paramTypes.length - 1) { // the vargs argument is missing, so fill it with an empty array Object[] newArgs = new Object[paramTypes.length]; System.arraycopy(argumentArray, 0, newArgs, 0, argumentArray.length); Object vargs = MetaClassHelper.makeArray(null, vargsClass, 0); newArgs[newArgs.length - 1] = vargs; return newArgs; } else if (argumentArray.length == paramTypes.length) { // the number of arguments is correct, but if the last argument // is no array we have to wrap it in a array. If the last argument // is null, then we don't have to do anything Object lastArgument = argumentArray[argumentArray.length - 1]; if (lastArgument != null && !lastArgument.getClass().isArray()) { // no array so wrap it Object wrapped = MetaClassHelper.makeArray(lastArgument, vargsClass, 1); System.arraycopy(argumentArray, argumentArray.length - 1, wrapped, 0, 1); Object[] newArgs = new Object[paramTypes.length]; System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1); newArgs[newArgs.length - 1] = wrapped; return newArgs; } else { // we may have to box the arguemnt! return argumentArray; } } else if (argumentArray.length > paramTypes.length) { // the number of arguments is too big, wrap all exceeding elements // in an array, but keep the old elements that are no vargs Object[] newArgs = new Object[paramTypes.length]; // copy arguments that are not a varg System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1); // create a new array for the vargs and copy them int numberOfVargs = argumentArray.length - paramTypes.length; Object vargs = MetaClassHelper.makeCommonArray(argumentArray, paramTypes.length - 1, vargsClass); newArgs[newArgs.length - 1] = vargs; return newArgs; } else { throw new GroovyBugError("trying to call a vargs method without enough arguments"); } } public boolean isValidMethod(Class[] arguments) { if (arguments == null) return true; final int size = arguments.length; CachedClass[] pt = getParameterTypes(); final int paramMinus1 = pt.length-1; if (isVargsMethod && size >= paramMinus1) return isValidVarargsMethod(arguments, size, pt, paramMinus1); else if (pt.length == size) return isValidExactMethod(arguments, pt); else if (pt.length == 1 && size == 0) return true; return false; } private boolean isValidExactMethod(Class[] arguments, CachedClass[] pt) { // lets check the parameter types match int size = pt.length; for (int i = 0; i < size; i++) { if (!pt[i].isAssignableFrom(arguments[i])) { return false; } } return true; } public boolean isValidExactMethod(Object [] args) { // lets check the parameter types match getParametersTypes0(); int size = args.length; if (size != parameterTypes.length) return false; for (int i = 0; i < size; i++) { if (args[i] != null && !parameterTypes[i].isAssignableFrom(args[i].getClass())) { return false; } } return true; } public boolean isValidExactMethod(Class [] args) { // lets check the parameter types match getParametersTypes0(); int size = args.length; if (size != parameterTypes.length) return false; for (int i = 0; i < size; i++) { if (args[i] != null && !parameterTypes[i].isAssignableFrom(args[i])) { return false; } } return true; } private static final boolean testComponentAssignable(Class toTestAgainst, Class toTest) { Class component = toTest.getComponentType(); if (component==null) return false; return MetaClassHelper.isAssignableFrom(toTestAgainst, component); } private boolean isValidVarargsMethod(Class[] arguments, int size, CachedClass[] pt, int paramMinus1) { // first check normal number of parameters for (int i = 0; i < paramMinus1; i++) { if (pt[i].isAssignableFrom(arguments[i])) continue; return false; } // check direct match CachedClass varg = pt[paramMinus1]; Class clazz = varg.getTheClass().getComponentType(); if ( size==pt.length && (varg.isAssignableFrom(arguments[paramMinus1]) || testComponentAssignable(clazz, arguments[paramMinus1]))) { return true; } // check varged for (int i = paramMinus1; i < size; i++) { if (MetaClassHelper.isAssignableFrom(clazz, arguments[i])) continue; return false; } return true; } public boolean isValidMethod(Object[] arguments) { if (arguments == null) return true; final int size = arguments.length; CachedClass[] paramTypes = getParameterTypes(); final int paramMinus1 = paramTypes.length-1; if ( size >= paramMinus1 && paramTypes.length > 0 && paramTypes[(paramMinus1)].isArray) { // first check normal number of parameters for (int i = 0; i < paramMinus1; i++) { if (paramTypes[i].isAssignableFrom(getArgClass(arguments[i]))) continue; return false; } // check direct match CachedClass varg = paramTypes[paramMinus1]; Class clazz = varg.getTheClass().getComponentType(); if ( size==paramTypes.length && (varg.isAssignableFrom(getArgClass(arguments[paramMinus1])) || testComponentAssignable(clazz, getArgClass(arguments[paramMinus1])))) { return true; } // check varged for (int i = paramMinus1; i < size; i++) { if (MetaClassHelper.isAssignableFrom(clazz, getArgClass(arguments[i]))) continue; return false; } return true; } else if (paramTypes.length == size) { // lets check the parameter types match for (int i = 0; i < size; i++) { if (paramTypes[i].isAssignableFrom(getArgClass(arguments[i]))) continue; return false; } return true; } else if (paramTypes.length == 1 && size == 0) { return true; } return false; } private Class getArgClass(Object arg) { Class cls; if (arg == null) { cls = null; } else { if (arg instanceof Wrapper) { cls = ((Wrapper)arg).getType(); } else cls = arg.getClass(); } return cls; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
7ccf4015dce638663bf02df5cbcff6d7cc060250
8848d2a272d3f283caee8c163ed39afa47e5f2c8
/app/src/main/java/com/prashanth/popularmovies/MainActivity.java
2a897510fb51ba1c2aa2960129f5b0e6462deca6
[ "Apache-2.0" ]
permissive
prashb94/Popular-Movies-Android
28c64eb8edac2bf23abe82af8bcf12b7fe028aff
1c571585de37a90b482820c410765f89209e976a
refs/heads/master
2021-01-22T04:33:57.499787
2017-02-10T11:29:03
2017-02-10T11:29:03
81,557,096
2
0
null
null
null
null
UTF-8
Java
false
false
6,010
java
package com.prashanth.popularmovies; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONObject; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; public class MainActivity extends AppCompatActivity implements MoviesGridAdapter.MoviesGridAdapterOnClickHandler { private RecyclerView mMoviesGrid; private static final int spanCount = 2; private MoviesGridAdapter mAdapter; final static String POSTER_PATH = "poster_path"; final static String TITLE = "title"; final static String VOTE_COUNT = "vote_count"; final static String VOTE_AVERAGE = "vote_average"; final static String OVERVIEW = "overview"; final static String RELEASE_DATE = "release_date"; static String defaultOrder = "top_rated"; private ArrayList<HashMap<String, String>> moviesList = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get Recycler View from activity_main mMoviesGrid = (RecyclerView) findViewById(R.id.rv_movies_grid); //Create Grid layout manager and set the layout manager of above procured recycler view GridLayoutManager layoutManager = new GridLayoutManager(this, spanCount); mMoviesGrid.setLayoutManager(layoutManager); //Create recycler view adapter and set adapter of recycler view to this adapter mAdapter = new MoviesGridAdapter(this, this); mMoviesGrid.setAdapter(mAdapter); loadMovies(defaultOrder); } public void loadMovies(String sortOrder){ new MovieDbQueryTask().execute(sortOrder); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main,menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int itemSelectedId = item.getItemId(); switch (itemSelectedId){ case R.id.action_sort_popular: Toast.makeText(this, "Now Showing: Popular Movies!", Toast.LENGTH_LONG).show(); defaultOrder = "popular"; loadMovies(defaultOrder); return super.onOptionsItemSelected(item); case R.id.action_sort_top_rated: Toast.makeText(this, "Now Showing: Top-Rated Movies!", Toast.LENGTH_LONG).show(); defaultOrder = "top_rated"; loadMovies(defaultOrder); return super.onOptionsItemSelected(item); default: return super.onOptionsItemSelected(item); } } @Override public void onListItemClick(int clickedItemIndex) { String posterPath = moviesList.get(clickedItemIndex).get(POSTER_PATH); String title = moviesList.get(clickedItemIndex).get(TITLE); String voteCount = moviesList.get(clickedItemIndex).get(VOTE_COUNT); String voteAverage = moviesList.get(clickedItemIndex).get(VOTE_AVERAGE); String overview = moviesList.get(clickedItemIndex).get(OVERVIEW); String releaseDate = moviesList.get(clickedItemIndex).get(RELEASE_DATE); Log.v("MovieArrayData", title); Context context = this; Class destinationClass = MoviesDetailActivity.class; Intent intentToStartDetailActivity = new Intent(context, destinationClass); Bundle extras = new Bundle(); extras.putString("Poster_Path", posterPath); extras.putString("Title", title); extras.putString("Vote_Count", voteCount); extras.putString("Vote_Average", voteAverage); extras.putString("Overview", overview); extras.putString("Release_Date", releaseDate); intentToStartDetailActivity.putExtras(extras); startActivity(intentToStartDetailActivity); } public class MovieDbQueryTask extends AsyncTask<String, Void, ArrayList<HashMap<String, String>>> { @Override protected ArrayList<HashMap<String, String>> doInBackground(String... params) { String queryType = params[0]; URL queryURL = NetworkUtils.buildUrl(queryType); try{ moviesList.clear(); JSONObject movieDbResponse = new JSONObject(NetworkUtils.getResponseFromHttpUrl(queryURL)); JSONArray movieDbJsonArray = movieDbResponse.getJSONArray("results"); for (int i = 0; i < movieDbJsonArray.length(); i++) { JSONObject movieJSON = movieDbJsonArray.getJSONObject(i); HashMap<String, String> movie = new HashMap<>(); movie.put(POSTER_PATH, movieJSON.getString(POSTER_PATH)); movie.put(TITLE, movieJSON.getString(TITLE)); movie.put(VOTE_COUNT, movieJSON.getString(VOTE_COUNT)); movie.put(VOTE_AVERAGE, movieJSON.getString(VOTE_AVERAGE)); movie.put(OVERVIEW, movieJSON.getString(OVERVIEW)); movie.put(RELEASE_DATE, movieJSON.getString(RELEASE_DATE)); moviesList.add(movie); } return moviesList; } catch (Exception e){ e.printStackTrace(); return null; } } @Override protected void onPostExecute(ArrayList<HashMap<String, String>> hashMaps) { if(hashMaps != null){ mAdapter.setMovieData(hashMaps); } super.onPostExecute(hashMaps); mAdapter.notifyDataSetChanged(); } } }
[ "prash_94@hotmail.com" ]
prash_94@hotmail.com
c0a3c03dcda292c42a5321f9dd42eb30401e5ab2
8eff85553631897449b99e370a4bf1c065af31eb
/CarrosV2/app/src/main/java/com/devmasterteam/carrosv2/view/MainActivity.java
e7c180793f776d9ffa5930e729f932bdae9982d3
[]
no_license
AlessandraMayumi/AndroidStudioProjects
cc215a226c679d3b78ec3eddd8a889a74a426907
940539668fb3376a74c8be1b46f8860f4f17778f
refs/heads/master
2020-04-21T22:58:12.909137
2019-06-01T14:13:22
2019-06-01T14:13:22
169,930,496
0
0
null
null
null
null
UTF-8
Java
false
false
2,308
java
package com.devmasterteam.carrosv2.view; import android.content.Context; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import com.devmasterteam.carrosv2.R; import com.devmasterteam.carrosv2.adapter.CarListAdapter; import com.devmasterteam.carrosv2.constants.CarrosConstants; import com.devmasterteam.carrosv2.data.CarMock; import com.devmasterteam.carrosv2.entities.Car; import com.devmasterteam.carrosv2.listener.OnListClickInteractionListener; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { ViewHolder mViewHolder = new ViewHolder(); private Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setIcon(R.mipmap.ic_launcher); this.mContext = this; CarMock carMock = new CarMock(this); List<Car> carList = new ArrayList<>(carMock.getList()); // Obter a recyclerview this.mViewHolder.recyclerCars = (RecyclerView) this.findViewById(R.id.recycler_cars); OnListClickInteractionListener listener = new OnListClickInteractionListener() { @Override public void onClick(int id) { Bundle bundle = new Bundle(); bundle.putInt(CarrosConstants.CARROS_ID, id); Intent intent = new Intent(mContext, DetailsActivity.class); intent.putExtras(bundle); startActivity(intent); } }; // Definir adapter CarListAdapter carListAdapter = new CarListAdapter(carList, listener); this.mViewHolder.recyclerCars.setAdapter(carListAdapter); // Definir layout LinearLayoutManager livearLayoutManager = new LinearLayoutManager(this); this.mViewHolder.recyclerCars.setLayoutManager(livearLayoutManager); } private static class ViewHolder { RecyclerView recyclerCars; } }
[ "alessandra_mms@hotmail.com" ]
alessandra_mms@hotmail.com
87b65a59310cc9a4da0f17da840697f3f18b9b3f
79f38f93cfcd47711fe9db76b2b56ef37f18bf92
/telegraph/cq/core-app/core-app-list/src/main/java/uk/co/telegraph/core/list/dynamic/impl/StandardDynamicComparisonList.java
a4ef665c0b1cc949b8c8b19b0231dd5c92a1fd23
[]
no_license
jsdelivrbot/ionic4-angular6
3a6361bce9db129fbc841ee31fc029abe14ea273
0c67b344397c1ce276a808388f602ea68becaf2e
refs/heads/master
2020-04-10T13:58:48.155725
2018-12-09T12:53:32
2018-12-09T12:53:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,479
java
package uk.co.telegraph.core.list.dynamic.impl; import java.util.List; import uk.co.telegraph.core.list.ListItem; import uk.co.telegraph.core.list.dynamic.AbstractDynamicList; import uk.co.telegraph.core.list.dynamic.ListSearchEngineWrapper; import uk.co.telegraph.core.search.api.ComparisonSearchCriteria; import uk.co.telegraph.core.search.api.Hits; import uk.co.telegraph.core.search.api.SearchResultOrder; /** * Comparison list */ public class StandardDynamicComparisonList extends AbstractDynamicList { @Override public List<ListItem> getItems(int offset, int limit) { return findItems(offset, limit); } protected List<ListItem> findItems(int offset, int limit) { ComparisonSearchCriteria searchCriteria = new ComparisonSearchCriteria(); searchCriteria.setTags(tags); ComparisonListSearchEngineWrapper wrapper = new ComparisonListSearchEngineWrapper(); wrapper.setSearchCriteria(searchCriteria); return findAllItems(wrapper, offset, limit); } private class ComparisonListSearchEngineWrapper implements ListSearchEngineWrapper { private ComparisonSearchCriteria searchCriteria; @Override public Hits findItems(int limit, int offset) { return getSearchEngine().findComparisons(searchCriteria, SearchResultOrder.fromString(listConfiguration.getOrderBy()), limit, offset, listConfiguration.isPaginated()); } public void setSearchCriteria(ComparisonSearchCriteria searchCriteria) { this.searchCriteria = searchCriteria; } } }
[ "d15_1_89@msn.com" ]
d15_1_89@msn.com
796b9f7a72ca572de0a8911e645f46e75f85631b
78efb3c80b6dbce45578dfd5cd08f8b58b5ce55d
/src/main/java/it/polimi/ingsw/client/view/CustomSwing/RequirementPrinter.java
5713822881c4ed667594c5a1ddd9c90cf161e127
[]
no_license
LucaCellamare/ing-sw-2021-cellamare-massa-neglia
9013b4cac4ba66db1185c32daec5ec823e70ef8c
11ebf9ab08a2363149e2fe77a29b5d6c5e27b674
refs/heads/main
2023-07-18T21:45:25.709816
2021-09-06T23:41:59
2021-09-06T23:41:59
403,783,769
0
0
null
null
null
null
UTF-8
Java
false
false
156
java
package it.polimi.ingsw.client.view.CustomSwing; import javax.swing.*; public interface RequirementPrinter { void print(JPanel pane, int position); }
[ "lucagiuseppe.cellamare@mail.polimi.it" ]
lucagiuseppe.cellamare@mail.polimi.it
26826e44f98c3a140038ffd82ce00eb9beb51ee0
c861ed53b15a834a2f5bec783121c01218db6e36
/src/designPatterns/Visitor.java
922acae9288a82379c08f5f936af3095eff199ac
[]
no_license
mikalcallahan/PeasantKitchen
40ea7914f00d9fab86d77b723858ba9c9ee4e554
53f7cdb559e515265d979c28fe81176db649aaed
refs/heads/master
2021-04-30T16:01:17.171732
2016-12-10T00:48:47
2016-12-10T00:48:47
70,285,092
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package designPatterns; /** * The Visitor interface. * * @param <T> the type parameter */ public interface Visitor<T> { /** * Visits each item, one at a time * * @param item the item */ void visit(T item); }
[ "noobtastic101@gmail.com" ]
noobtastic101@gmail.com
a5f62f00f8eae2f126bb9cde202a1fd78115f610
e9e54ca8027d5a39a9b1d4e050b8fe2d99f56574
/src/main/java/org/uengine/sns/login/web/LoginController.java
e9135e3a4cf09ef8a4393ec6aebd080133c9098a
[]
no_license
basquiat78/sns
01d8ecf6afa0f40d6e715ab4211d9c1a10a636bd
1fd9f809d74da8cd672a936bd5d20f9b020693af
refs/heads/master
2023-07-24T10:49:34.847066
2023-07-10T05:19:43
2023-07-10T05:19:43
99,539,534
0
0
null
2023-04-17T01:30:54
2017-08-07T05:23:26
JavaScript
UTF-8
Java
false
false
5,011
java
package org.uengine.sns.login.web; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.uengine.sns.common.ExceptionController; import org.uengine.sns.common.intercepter.AuthInterceptor; import org.uengine.sns.common.intercepter.service.AuthenticationService; import org.uengine.sns.common.util.HttpUtil; import org.uengine.sns.member.service.MemberService; import org.uengine.sns.member.vo.MemberVo; /** * * MainController * @author uEngine-basquiat (uEngine Solutions) * */ @Controller public class LoginController extends ExceptionController { private static final Logger LOG = LoggerFactory.getLogger(LoginController.class); @Autowired AuthenticationService authenticationService; @Autowired MemberService memberService; @RequestMapping(value = "/login", method = RequestMethod.GET) public String login(HttpSession session) { if(session != null) { session.invalidate(); } return "login"; } /** * @param request * @param session * @param memberId * @return String */ @RequestMapping(value = "/init", method = RequestMethod.POST) public String init(HttpServletRequest request, HttpSession session, @RequestParam(required=true) String memberId) { MemberVo member = memberService.getMemberById(HttpUtil.getLocaleString(request), Long.parseLong(memberId)); if(member == null || member.getMemberId() == 0L) { return "redirect:"+request.getContextPath()+"/login.do"; } session.setAttribute("memberId", Long.parseLong(memberId)); session.setAttribute("memberName", member.getMemberName()); session.setAttribute("userId", member.getSyncKey()); // 그룹웨어와 동일한 세션 session.setAttribute(AuthInterceptor.GROUPWARE_SESSION_USERID, member.getSyncKey()); session.setAttribute(AuthInterceptor.GROUPWARE_SESSION_LOCALE, "ko"); LOG.debug("init end =========================================================== "); return "redirect:/main/"+memberId; } /** * @param session * @param request * @param loginId * @param loginPassword * @return String */ @RequestMapping(value = "/login", method = RequestMethod.POST) public String snsLogin(HttpSession session, HttpServletRequest request , @RequestParam(required=true) String loginId , @RequestParam(required=true) String loginPassword) { MemberVo member = memberService.getCheckLoginMember(HttpUtil.getLocaleString(request), loginId, loginPassword); if(member == null || member.getMemberId() == 0L) { return "redirect:"+request.getContextPath()+"/login.do"; } session.setAttribute("memberId", member.getMemberId()); session.setAttribute("memberName", member.getMemberName()); session.setAttribute("userId", member.getSyncKey()); return "redirect:/main/"+member.getMemberId(); } /** * @param session * @param request * @return Map<String, Object> */ @RequestMapping(value = "/sloLogin", method = RequestMethod.POST) public @ResponseBody Map<String, Object> sloLogin(HttpSession session, HttpServletRequest request) { Map<String, Object> retObj = new HashMap<String, Object>(); String otaId = request.getParameter("SLO_P_OTA"); if(otaId == null) { retObj.put("result", "OtaId is null."); return retObj; } String userId = authenticationService.authenticateBySlo(otaId); if(StringUtils.isEmpty(userId)) { retObj.put("result", "User Id is null."); return retObj; } MemberVo member = memberService.getMemberBySynckey("ko", userId); if(member == null || member.getMemberId() < 1L) { retObj.put("result", "SNS Member is null."); return retObj; } session.setAttribute("memberId", member.getMemberId()); session.setAttribute("memberName", member.getMemberName()); session.setAttribute("userId", member.getSyncKey()); // 그룹웨어와 동일한 세션 session.setAttribute(AuthInterceptor.GROUPWARE_SESSION_USERID, member.getSyncKey()); session.setAttribute(AuthInterceptor.GROUPWARE_SESSION_LOCALE, "ko"); retObj.put("result", "Y"); return retObj; } /** * 테스트용 * @param request * @param member * @return String */ @RequestMapping(value = "/testurl", method = RequestMethod.GET) public String dummy(HttpServletRequest request, @ModelAttribute("Member") MemberVo member) { return "sns/main/dummy"; } /** * @param MemeberVo * @return MemeberVo */ @RequestMapping(value = "/logins", method = RequestMethod.POST) public @ResponseBody MemberVo logins(@RequestBody MemberVo memberVo) { MemberVo loginMember = memberService.getCheckLoginMember("ko", memberVo.getLoginId(), memberVo.getLoginPassword()); loginMember.setLoginPassword(""); return loginMember; } }
[ "funnyjazz@naver.com" ]
funnyjazz@naver.com
2a9c8a479414cd56e958af99a82d0f73235be5f1
9776b61e1f8b92a3f8cb03858ec942ba0e9f4487
/PrimeNumberChecker.java
fec8734ea3fd7d10570079d3944f8b52b86f0968
[]
no_license
Haza290/Prime_Number_Checker
7b78fce391f930b76d24eda4b5cf2f7fb4d849df
1c21e704b1437ff729c43e8453c02c3432faea2b
refs/heads/master
2021-08-29T20:15:22.687033
2017-12-14T22:36:00
2017-12-14T22:36:00
114,175,670
0
0
null
null
null
null
UTF-8
Java
false
false
4,799
java
import java.util.ArrayList; import java.io.*; import org.apache.poi.xssf.usermodel.*; public class PrimeNumberChecker { static int LOWER_BOUND = 2; // Smallest number checked if prime (inclusive) static int UPPER_BOUND = 15000000; // Largest number checked if prime (exclusive) String XLSX_FILE_PATH = "D:\\Users\\Harry\\Desktop\\test.xlsx"; public static void main(String[] args) throws Exception { new PrimeNumberChecker(); } public PrimeNumberChecker() throws Exception { // Creates an array of PrimeChecker and adds the different classes to it ArrayList<PrimeChecker> primeCheckerClasses = new ArrayList<PrimeChecker>(); primeCheckerClasses.add(new BinarySearchReadInPrimeChecker()); primeCheckerClasses.add(new NaiveAscendingPrimeChecker()); primeCheckerClasses.add(new SimpleReadInPrimeChecker()); // Generate results and upload them to google sheet ArrayList<Results> results = runPrimeCheckers(primeCheckerClasses); printData(results); } /** * Takes all the prime checker classes, run them from numbers LOWER_BOUND to UPPER_BOUND, recording * time taken and if that number was prime * * @param primeCheckerClasses An Array of different prime checker classes * @return An array of results of time taken and if a number was prime from each prime checker classes */ private ArrayList<Results> runPrimeCheckers(ArrayList<PrimeChecker> primeCheckerClasses) { ArrayList<Results> results = new ArrayList<Results>(); // for each prime checking method check all numbers from 2 to UPPER_BOUND and record there times // and if they found the number to be prime for (int i = 0; i < primeCheckerClasses.size(); i++) { // Stores current prime checker class PrimeChecker currentPrimeCheckerClass = primeCheckerClasses.get(i); System.out.println("starting: " + currentPrimeCheckerClass.getClass().getSimpleName()); // Creates arrays to store time taken to check if number is prime // and if they are primes ArrayList<Long> times = new ArrayList<Long>(); ArrayList<Boolean> isPrime = new ArrayList<Boolean>(); // Long totalRunningTime = System.currentTimeMillis(); Long tenSecondTimmer = System.currentTimeMillis(); for (int number = LOWER_BOUND; number < UPPER_BOUND; number++) { Boolean isNumberPrime; Long startTime = System.currentTimeMillis(); // Starts the timer isNumberPrime = currentPrimeCheckerClass.checkNumber(number); // Runs the prime checker Long endTime = System.currentTimeMillis(); // Ends the timer Long primeCheckerTime = endTime - startTime; // Adds time taken to check prime to times and if it is boolean or not to isPrime times.add(primeCheckerTime); isPrime.add(isNumberPrime); if(System.currentTimeMillis() - tenSecondTimmer > 10000L){ System.out.println("Running: " + currentPrimeCheckerClass.getClass().getSimpleName() + " on: " + number + " of: " + UPPER_BOUND); tenSecondTimmer = System.currentTimeMillis(); } } // Adds all results from this current Prime Checker Class to a Results class and adds that // to an array results.add(new Results(currentPrimeCheckerClass.getClass().getSimpleName(), times, isPrime)); } return results; } private void updateSpreadSheet(ArrayList<Results> results) throws Exception { // Open file, if we can't find file create a new one File file = new File(XLSX_FILE_PATH); XSSFWorkbook workbook; // If file exists open it otherwise create a new file if(file.isFile() && file.exists()) { System.out.println("file exsits"); FileInputStream fIP = new FileInputStream(file); workbook = new XSSFWorkbook(fIP); } else { System.out.println("file doesn't exsits"); workbook = new XSSFWorkbook(); workbook.createSheet(); } // Creates the number axis between the 2 bounds for (int i = LOWER_BOUND; i < UPPER_BOUND; i++) { if (workbook.getSheetAt(0).getRow(i) == null) { workbook.getSheetAt(0).createRow(i); } workbook.getSheetAt(0).getRow(i).createCell(0).setCellValue(i); } FileOutputStream outFile =new FileOutputStream(new File("C:\\Anuj\\Data\\Data.xlsx")); workbook.write(outFile); outFile.close(); } /** * Prints summary of results, used for debugging * @param results */ private void printData(ArrayList<Results> results) { for (int i = 0; i < results.size(); i++) { Long totalTime = 0L; int totalNumPrimes = 0; ArrayList<Long> times = results.get(i).getTimes(); ArrayList<Boolean> primes = results.get(i).getIsPrime(); for (Long time : times) { totalTime += time; } for (boolean isPrime : primes) { if(isPrime) { totalNumPrimes ++; } } } } }
[ "haza290@yahoo.co.uk" ]
haza290@yahoo.co.uk
6009e0880ec14c1fe28184fe08ea715e14f565ac
cbd9a5d87b795fbb9836cc076672a2f00d459223
/ontology/TascuApi/src/main/java/org/purl/ontology/bibo/domain/Manuscript.java
6b35278cc9f66d0cc172440daae68c5b5c03d2bc
[ "Apache-2.0" ]
permissive
ibisba/tascu_data
d7b339e9ffe7eafdf0079dfc8115d32be2f3d6a4
42e4c99a64a8879fa9c84a120636cde0125a5625
refs/heads/master
2020-07-01T19:57:35.660258
2020-02-24T18:52:03
2020-02-24T18:52:03
201,281,064
0
1
Apache-2.0
2019-11-01T14:47:57
2019-08-08T14:59:57
null
UTF-8
Java
false
false
160
java
package org.purl.ontology.bibo.domain; /** * Code generated from http://purl.org/ontology/bibo/ ontology */ public interface Manuscript extends Document { }
[ "jasperkoehorst@gmail.com" ]
jasperkoehorst@gmail.com
4da25ac58a4482cd06b33f981a50e0106a8844dc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/11/11_d3ccd81750a45af9a868bec2a3fc9c748fb58e22/FitsAdapter/11_d3ccd81750a45af9a868bec2a3fc9c748fb58e22_FitsAdapter_t.java
6fbd5af11ced1242e5a9773efa2c80da76bf753d
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
14,920
java
// // FitsAdapter.java // /* VisAD system for interactive analysis and visualization of numerical data. Copyright (C) 1996 - 1998 Bill Hibbard, Curtis Rueden, Tom Rink and Dave Glowacki. 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 1, 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 in file NOTICE for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package visad.data.fits; import nom.tam.fits.BasicHDU; import nom.tam.fits.BinaryTableHDU; import nom.tam.fits.Fits; import nom.tam.fits.FitsException; import nom.tam.fits.ImageHDU; import nom.tam.fits.PrimaryHDU; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.Array; import java.net.URL; import java.rmi.RemoteException; import java.util.Vector; import visad.Data; import visad.FlatField; import visad.FunctionType; import visad.FunctionImpl; import visad.Integer1DSet; import visad.Integer2DSet; import visad.IntegerNDSet; import visad.MathType; import visad.RealTupleType; import visad.RealType; import visad.ScalarType; import visad.Set; import visad.SetType; import visad.Tuple; import visad.TupleType; import visad.TypeException; import visad.VisADException; public class FitsAdapter { Fits fits; Data data[]; ExceptionStack stack; public FitsAdapter() throws VisADException { fits = null; data = null; stack = null; } public FitsAdapter(String filename) throws VisADException { this(); try { fits = new Fits(filename); } catch (FitsException e) { throw new VisADException(e.getClass().getName() + "(" + e.getMessage() + ")"); } } public FitsAdapter(URL url) throws VisADException { this(); try { fits = new Fits(url); } catch (FitsException e) { throw new VisADException(e.getClass().getName() + "(" + e.getMessage() + ")"); } } private int get1DLength(Object data) throws VisADException { if (!data.getClass().isArray()) { return 1; } int len = Array.getLength(data); int total = 0; for (int i = 0; i < len; i++) { total += get1DLength(Array.get(data, i)); } return total; } private int copyArray(Object data, double[] list, int offset) throws VisADException { if (data instanceof byte[]) { byte[] bl = (byte[] )data; for (int i = 0; i < bl.length; i++) { int val = (bl[i] >= 0 ? bl[i] : ((Byte.MAX_VALUE + 1) * 2) - bl[i]); list[offset++] = (double )val; } } else if (data instanceof short[]) { short[] sl = (short[] )data; for (int i = 0; i < sl.length; i++) { int val = (sl[i] >= 0 ? sl[i] : ((Short.MAX_VALUE + 1) * 2) - sl[i]); list[offset++] = (double )val; } } else if (data instanceof int[]) { int[] il = (int[] )data; for (int i = 0; i < il.length; i++) { list[offset++] = (double )il[i]; } } else if (data instanceof long[]) { long[] ll = (long[] )data; for (int i = 0; i < ll.length; i++) { list[offset++] = (double )ll[i]; } } else if (data instanceof float[]) { float[] fl = (float[] )data; for (int i = 0; i < fl.length; i++) { list[offset++] = (double )fl[i]; } } else if (data instanceof double[]) { double[] dl = (double[] )data; for (int i = 0; i < dl.length; i++) { list[offset++] = dl[i]; } } else { throw new VisADException("type '" + data.getClass().getName() + "' not handled"); } return offset; } private int decompose(Object data, double[] list, int offset) throws VisADException { Class component = data.getClass().getComponentType(); if (component == null) { return offset; } if (!component.isArray()) { return copyArray(data, list, offset); } int len = Array.getLength(data); for (int i = len - 1; i >= 0; i--) { offset = decompose(Array.get(data, i), list, offset); } return offset; } private double[][] buildRange(Object data) throws VisADException { int len = get1DLength(data); double[] values = new double[len]; int offset = decompose(data, values, 0); while (offset < len) { values[offset++] = Double.NaN; } double[][] range = new double[1][]; range[0] = values; return range; } private Data addPrimary(PrimaryHDU hdu) throws FitsException, VisADException, RemoteException { int[] axes = hdu.getAxes(); if (axes == null || axes.length == 0) { return null; } // reverse order of axes for (int i = 0; i < axes.length / 2; i++) { int j = axes.length - (i + 1); int tmp = axes[j]; axes[j] = axes[i]; axes[i] = tmp; } Object fData = hdu.getData().getData(); if (fData == null) { throw new VisADException("No HDU Data"); } if (!fData.getClass().isArray()) { throw new VisADException("Unknown HDU Data type: " + fData.getClass().getName()); } RealType axisType[] = new RealType[axes.length]; for (int i = 0; i < axisType.length; i++) { String name = "NAxis" + (i+1); try { axisType[i] = new RealType(name, null, null); } catch (TypeException e) { axisType[i] = RealType.getRealTypeByName(name); } } RealTupleType type = new RealTupleType(axisType);; RealType value; try { value = new RealType("value", null, null); } catch (TypeException e) { value = RealType.getRealTypeByName("value"); } FunctionType func = new FunctionType(type, value); IntegerNDSet iSet = new IntegerNDSet(type, axes); FlatField fld = new FlatField(func, iSet); fld.setSamples(buildRange(fData)); return fld; } private Data addImage(ImageHDU hdu) throws VisADException, RemoteException { int[] axes; try { axes = hdu.getAxes(); } catch (FitsException e) { axes = null; } if (axes == null) { throw new VisADException("Couldn't get image axes"); } if (axes.length != 2) { System.err.println("Punting on " + axes.length + "-D image"); throw new VisADException("Not a two-dimensional image"); } Object fData = hdu.getData().getData(); if (fData == null) { throw new VisADException("No HDU Data"); } if (!fData.getClass().isArray()) { throw new VisADException("Unknown HDU Data type: " + fData.getClass().getName()); } RealTupleType type = RealTupleType.SpatialCartesian2DTuple; RealType pixel; try { pixel = new RealType("pixel", null, null); } catch (TypeException e) { pixel = RealType.getRealTypeByName("pixel"); } FunctionType func = new FunctionType(type, pixel); Integer2DSet iSet = new Integer2DSet(type, axes[0], axes[1]); FlatField fld = new FlatField(func, iSet); fld.setSamples(buildRange(fData)); return fld; } private int copyColumn(Object data, double[] list, int offset) throws VisADException { // punt if this isn't a 1D column Object[] top = (Object[] )data; if (top.length != 1 && !(top[0] instanceof byte[])) { System.err.println("FitsAdapter.copyColumn: Punting on wide column (" + top[0].getClass().getName() + ")"); return offset; } if (top[0] instanceof byte[]) { if (top.length != 1) { System.err.println("Ignoring assumed " + top.length + "-char String column"); return offset; } else { byte[] bl = (byte[] )top[0]; for (int i = 0; i < bl.length; ) { list[offset++] = (double )bl[i++]; } } } else if (top[0] instanceof short[]) { short[] sl = (short[] )top[0]; for (int i = 0; i < sl.length; ) { list[offset++] = (double )sl[i++]; } } else if (top[0] instanceof int[]) { int[] il = (int[] )top[0]; for (int i = 0; i < il.length; ) { list[offset++] = (double )il[i++]; } } else if (top[0] instanceof long[]) { long[] ll = (long[] )top[0]; for (int i = 0; i < ll.length; ) { list[offset++] = (double )ll[i++]; } } else if (top[0] instanceof float[]) { float[] fl = (float[] )top[0]; for (int i = 0; i < fl.length; ) { list[offset++] = (double )fl[i++]; } } else if (top[0] instanceof double[]) { double[] dl = (double[] )top[0]; for (int i = 0; i < dl.length; ) { list[offset++] = dl[i++]; } } else { throw new VisADException("type '" + top[0].getClass().getName() + "' not handled"); } return offset; } private double[][] buildBTRange(BinaryTableHDU hdu) throws VisADException { int rows = hdu.getNumRows(); int cols = hdu.getNumColumns(); double[][] d = new double[cols][rows]; for (int i = 0; i < cols; i++) { Object list; try { list = hdu.getColumn(i).getData(); } catch (FitsException e) { throw new VisADException("Failed to get column " + i + " type: " + e.getMessage()); } int len; if (list instanceof byte[][]) { len = copyColumn((byte[][] )list, d[i], 0); } else if (list instanceof short[][]) { len = copyColumn((short[][] )list, d[i], 0); } else if (list instanceof int[][]) { len = copyColumn((int[][] )list, d[i], 0); } else if (list instanceof long[][]) { len = copyColumn((long[][] )list, d[i], 0); } else if (list instanceof float[][]) { len = copyColumn((float[][] )list, d[i], 0); } else if (list instanceof double[][]) { len = copyColumn((double[][] )list, d[i], 0); } else { String type; try { type = hdu.getColumnFITSType(i); } catch (FitsException e) { type = "?Unknown FITS type?"; } System.err.println("FitsAdapter.buildBTRange: Faking values for" + " column #" + i + " (" + type + "=>" + list.getClass().getName() + ")"); // fill with NaN int c = i; for (len = 0 ; len < rows; len++) { d[c][len] = Double.NaN; } } if (len < rows) { int c = i; System.err.println("FitsAdapter.buildBTRange: Column " + i + " was short " + (rows - len) + " of " + rows + " rows"); while (len < rows) { d[c][len++] = Double.NaN; } } } return d; } private Data addBinaryTable(BinaryTableHDU hdu) throws FitsException, VisADException, RemoteException { int[] axes = hdu.getAxes(); if (axes == null) { throw new FitsException("Couldn't get binary table axes"); } if (axes.length != 2) { throw new FitsException("Not a two-dimensional binary table"); } int numColumns = hdu.getNumColumns(); RealType index; try { index = new RealType("index", null, null); } catch (TypeException e) { index = RealType.getRealTypeByName("index"); } boolean hasTextColumn = false; RealType rowType[] = new RealType[numColumns]; for (int i = 0; i < numColumns; i++) { String name = hdu.getColumnName(i); if (name == null) { name = "Column" + i; } String colType = hdu.getColumnFITSType(i); if (colType.startsWith("A") || colType.endsWith("A")) { hasTextColumn = true; } try { rowType[i] = new RealType(name, null, null); } catch (TypeException e) { rowType[i] = RealType.getRealTypeByName(name); } } RealTupleType row = new RealTupleType(rowType);; FunctionType func = new FunctionType(index, row); Integer1DSet iSet = new Integer1DSet(hdu.getNumRows()); FlatField fld = new FlatField(func, iSet); fld.setSamples(buildBTRange(hdu)); return fld; } private Data convertHDU(BasicHDU hdu) throws FitsException, VisADException, RemoteException { if (hdu instanceof ImageHDU) { return addImage((ImageHDU )hdu); } if (hdu instanceof PrimaryHDU) { return addPrimary((PrimaryHDU )hdu); } if (hdu instanceof BinaryTableHDU) { return addBinaryTable((BinaryTableHDU )hdu); } return null; } public void buildData() { Vector vec = new Vector(); int startDepth; if (stack == null) { startDepth = 0; } else { startDepth = stack.depth(); } for (int n = 0; true; n++) { try { BasicHDU hdu = fits.getHDU(n); if (hdu == null) { break; } Data d = convertHDU(hdu); if (d != null) { vec.addElement(d); } } catch (Exception e) { if (stack == null) { stack = new ExceptionStack(e); } else { stack.addException(e); if (stack.depth() > startDepth + 10) { break; } } } } if (vec.size() == 0) { data = null; } else { data = new Data[vec.size()]; for (int i = 0; i < data.length; i++) { data[i] = (Data )vec.elementAt(i); } } } public void clearExceptionStack() { stack = null; } Data[] getData() throws ExceptionStack, RemoteException, VisADException { if (data == null) { buildData(); if (data == null) { throw new VisADException("No data"); } } if (stack != null) { throw stack; } return data; } public void save(String name, Data data, boolean replace) throws IOException, RemoteException, VisADException { FitsTourGuide guide; // make sure this object can be saved as a FITS file TourInspector count = new TourInspector(replace); guide = new FitsTourGuide(data, count); count = null; // build the new FITS file Fits f = new Fits(); TourWriter tw = new TourWriter(replace, f); guide = new FitsTourGuide(data, tw); tw = null; guide = null; // open the final destination BufferedOutputStream bos; bos = new BufferedOutputStream(new FileOutputStream(name)); // write the FITS file try { f.write(bos); } catch (FitsException e) { throw new VisADException(e.getClass().getName() + "(" + e.getMessage() + ")"); } bos.close(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
9558318a2e3b15720887e62e6a0e2f7e405a6677
8912aa36a90e10807ae5383317193f63bc0a81ec
/src/main/java/com/zhousz/zerg/config/MysqlDataSourceConfig.java
dbc096ccb9d50357c7832b89813b869173caf7a4
[]
no_license
lucas-nz/zerg
666838a5e73196989ea410a3575f598e89b6d820
49f140606e5e8ef92592cfd33431af57272a212a
refs/heads/master
2021-09-27T13:30:47.660523
2018-11-09T00:50:30
2018-11-09T00:50:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,986
java
package com.zhousz.zerg.config; import javax.sql.DataSource; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; @Configuration @MapperScan(basePackages = MysqlDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "mysqlSqlSessionFactory") public class MysqlDataSourceConfig { // dao static final String PACKAGE = "com.zhousz.zerg.dao.mysql"; // mapper static final String MAPPER_LOCATION = "classpath:mapper/mysql/*.xml"; @Bean(name = "mysqlDataSource") @ConfigurationProperties("spring.datasource.druid.mysql") public DataSource mysqlDataSource() { return DruidDataSourceBuilder.create().build(); } @Bean(name = "mysqlTransactionManager") public DataSourceTransactionManager mysqlTransactionManager() { return new DataSourceTransactionManager(mysqlDataSource()); } @Bean(name = "mysqlSqlSessionFactory") public SqlSessionFactory mysqlSessionFactory( @Qualifier("mysqlDataSource") DataSource dataSource) throws Exception { final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); sessionFactory.setDataSource(dataSource); // 如果不使用xml的方式配置mapper,则可以省去下面这行mapper location的配置 sessionFactory .setMapperLocations(new PathMatchingResourcePatternResolver() .getResources(MysqlDataSourceConfig.MAPPER_LOCATION)); return sessionFactory.getObject(); } }
[ "13687646803@163.com" ]
13687646803@163.com
d2e1eb88a9e9f370d1f96a1f17932f5affe237b6
c0de43891cb37a14106e0cdeb0e76d2eefa90719
/java-testing/LaughterDetection/src/edu/uw/css595/shalinir/player/SwingAudioPlayer.java
abb76a0f6d15735f8db07c6949a14359508f9b11
[]
no_license
ohkhan/laugh-finder
34961b3c9ef7e88c898bc90778cf839c1131b248
e27e885dfcb1995d182e68f30583276352d6de28
refs/heads/develop
2021-01-15T11:20:49.663835
2016-04-10T01:52:09
2016-04-10T01:52:09
66,098,216
0
0
null
2016-08-19T16:58:55
2016-08-19T16:58:55
null
UTF-8
Java
false
false
10,193
java
package edu.uw.css595.shalinir.player; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; /** * A Swing-based audio player program. NOTE: Can play only WAVE (*.wav) file. * * @author www.codejava.net * */ public class SwingAudioPlayer extends JPanel implements ActionListener { private AudioPlayer player = new AudioPlayer(); private Thread playbackThread; private PlayingTimer timer; private boolean isPlaying = false; private boolean isPause = false; private String audioFilePath; private String lastOpenPath; private JTextField textFileName = new JTextField(40); private JLabel labelFileName = new JLabel("Select a WAV file:"); private JLabel labelTimeCounter = new JLabel("00:00:00"); private JLabel labelDuration = new JLabel("00:00:00"); private JButton buttonOpen = new JButton("Browse"); private JButton buttonPlay = new JButton("Play"); private JButton buttonPause = new JButton("Pause"); private JSlider sliderTime = new JSlider(); // Icons used for buttons private ImageIcon iconOpen = new ImageIcon(getClass().getResource( "/images/Open.png")); private ImageIcon iconPlay = new ImageIcon(getClass().getResource( "/images/Play.gif")); private ImageIcon iconStop = new ImageIcon(getClass().getResource( "/images/Stop.gif")); private ImageIcon iconPause = new ImageIcon(getClass().getResource( "/images/Pause.png")); public SwingAudioPlayer() { setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets(5, 5, 5, 5); buttonOpen.setFont(new Font("Sans", Font.BOLD, 14)); buttonOpen.setIcon(iconOpen); buttonPlay.setFont(new Font("Sans", Font.BOLD, 14)); buttonPlay.setIcon(iconPlay); buttonPlay.setEnabled(false); buttonPause.setFont(new Font("Sans", Font.BOLD, 14)); buttonPause.setIcon(iconPause); buttonPause.setEnabled(false); labelTimeCounter.setFont(new Font("Sans", Font.BOLD, 12)); labelDuration.setFont(new Font("Sans", Font.BOLD, 12)); sliderTime.setPreferredSize(new Dimension(400, 20)); sliderTime.setEnabled(false); sliderTime.setValue(0); JPanel panelFileSelector = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5)); panelFileSelector.add(labelFileName); panelFileSelector.add(textFileName); panelFileSelector.add(buttonOpen); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; add(panelFileSelector, constraints); JPanel panelSlider = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5)); panelSlider.add(labelTimeCounter);; panelSlider.add(sliderTime); panelSlider.add(labelDuration); constraints.gridy = 1; add(panelSlider, constraints); JPanel panelButtons = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5)); panelButtons.add(buttonPlay); panelButtons.add(buttonPause); constraints.gridy = 2; add(panelButtons, constraints); buttonOpen.addActionListener(this); buttonPlay.addActionListener(this); buttonPause.addActionListener(this); } /** * Handle click events on the buttons. */ @Override public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if (source instanceof JButton) { JButton button = (JButton) source; if (button == buttonOpen) { openFile(); } else if (button == buttonPlay) { if (!isPlaying) { playBack(); } else { stopPlaying(); } } else if (button == buttonPause) { if (!isPause) { pausePlaying(); } else { resumePlaying(); } } } } private void openFile() { JFileChooser fileChooser = null; if (lastOpenPath != null && !lastOpenPath.equals("")) { fileChooser = new JFileChooser(lastOpenPath); } else { fileChooser = new JFileChooser(); } FileFilter wavFilter = new FileFilter() { @Override public String getDescription() { return "Sound file (*.WAV)"; } @Override public boolean accept(File file) { if (file.isDirectory()) { return true; } else { return file.getName().toLowerCase().endsWith(".wav"); } } }; fileChooser.setFileFilter(wavFilter); fileChooser.setDialogTitle("Open Audio File"); fileChooser.setAcceptAllFileFilterUsed(false); int userChoice = fileChooser.showOpenDialog(this); if (userChoice == JFileChooser.APPROVE_OPTION) { audioFilePath = fileChooser.getSelectedFile().getAbsolutePath(); lastOpenPath = fileChooser.getSelectedFile().getParent(); if (isPlaying || isPause) { stopPlaying(); while (player.getAudioClip().isRunning()) { try { Thread.sleep(100); } catch (InterruptedException ex) { ex.printStackTrace(); } } } playBack(); } } public void openFile(String filePath) { audioFilePath = filePath; lastOpenPath = filePath; if (isPlaying || isPause) { stopPlaying(); while (player.getAudioClip().isRunning()) { try { Thread.sleep(100); } catch (InterruptedException ex) { ex.printStackTrace(); } } } this.playBack(); this.pausePlaying(); } public String getAudioFilePath() { return this.audioFilePath; } /** * Start playing back the sound. */ private void playBack() { timer = new PlayingTimer(labelTimeCounter, sliderTime); timer.start(); isPlaying = true; playbackThread = new Thread(new Runnable() { @Override public void run() { try { buttonPlay.setText("Stop"); buttonPlay.setIcon(iconStop); buttonPlay.setEnabled(true); buttonPause.setText("Pause"); buttonPause.setEnabled(true); player.load(audioFilePath); timer.setAudioClip(player.getAudioClip()); textFileName.setText(audioFilePath); sliderTime.setMaximum((int) player.getClipSecondLength()); labelDuration.setText(player.getClipLengthString()); player.play(); resetControls(); } catch (UnsupportedAudioFileException ex) { JOptionPane.showMessageDialog(SwingAudioPlayer.this, "The audio format is unsupported!", "Error", JOptionPane.ERROR_MESSAGE); resetControls(); ex.printStackTrace(); } catch (LineUnavailableException ex) { JOptionPane .showMessageDialog( SwingAudioPlayer.this, "Could not play the audio file because line is unavailable!", "Error", JOptionPane.ERROR_MESSAGE); resetControls(); ex.printStackTrace(); } catch (IOException ex) { JOptionPane.showMessageDialog(SwingAudioPlayer.this, "I/O error while playing the audio file!", "Error", JOptionPane.ERROR_MESSAGE); resetControls(); ex.printStackTrace(); } } }); playbackThread.start(); } public void stopPlaying() { isPause = false; buttonPause.setText("Pause"); buttonPause.setEnabled(false); timer.reset(); timer.interrupt(); player.stop(); playbackThread.interrupt(); } public void pausePlaying() { buttonPause.setText("Resume"); isPause = true; player.pause(); timer.pauseTimer(); playbackThread.interrupt(); } public void resumePlaying() { buttonPause.setText("Pause"); isPause = false; player.resume(); timer.resumeTimer(); playbackThread.interrupt(); } public void playBetween(long startInMs, long endInMs) { if (isPlaying) { this.pausePlaying(); } player.stopAt(endInMs); player.setClipMillisecondLength(startInMs); timer.setPlayedTime(startInMs); this.resumePlaying(); } private void resetControls() { timer.reset(); timer.interrupt(); buttonPlay.setText("Play"); buttonPlay.setIcon(iconPlay); buttonPause.setEnabled(false); isPlaying = false; } }
[ "milesdowe@gmail.com" ]
milesdowe@gmail.com
79bcd38dae89e1c88222bf6d0daa62b198ec83ef
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/test/java/org/gradle/test/performancenull_191/Testnull_19073.java
9b72fdca98729a49bba600da115772924e0241de
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
308
java
package org.gradle.test.performancenull_191; import static org.junit.Assert.*; public class Testnull_19073 { private final Productionnull_19073 production = new Productionnull_19073("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
4e4c2157f14cb9a85e3d20f599425cac5c9614ab
71325cdf96c1cdee416ff6426c40fe8b0216a3de
/app/src/main/java/com/indugwhs/loftcoin3/AppComponent.java
03a1e2e5008129b51ff62f5ca50b7fecba05d5b8
[]
no_license
indugwhs/loftcoin3
bc767f2d2e9a21d5d32bfb7b58b7dc7d14413f2b
1f24b7f955d4a494e9fa881e42e339acd8b58f92
refs/heads/master
2023-06-18T06:50:53.100153
2021-07-13T23:58:27
2021-07-13T23:58:27
379,377,476
0
0
null
2021-07-13T23:58:28
2021-06-22T19:18:49
Java
UTF-8
Java
false
false
679
java
package com.indugwhs.loftcoin3; import android.app.Application; import androidx.room.PrimaryKey; import com.indugwhs.loftcoin3.data.DataModule; import com.indugwhs.loftcoin3.util.UtilModule; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; @Singleton @Component( modules = { AppModule.class, DataModule.class, UtilModule.class } ) abstract class AppComponent implements BaseComponent { @Component.Builder static abstract class Builder { @BindsInstance abstract Builder application(Application app); abstract AppComponent build(); } }
[ "sagalakova3105@mail.ru" ]
sagalakova3105@mail.ru
5c9889eb9def42ad5574e5a04d0a6495e1b676e3
37e3d73b36c98375ef24d79af19bbbfd7a86be0c
/app/src/main/java/com/geektech/quizapp_gt_4_2/data/history/HistoryDao.java
021f1d398077d36d1682c681cca948168dd37dd4
[]
no_license
Zhoodar8/gt-quizapp-4-2
2c2add4fd9f5e0c2426c26163e63813d3a27ad3c
d8befab0a4944c28d61021a5a553031ce110d88c
refs/heads/master
2020-12-17T04:22:28.534086
2020-02-21T02:54:36
2020-02-21T02:54:36
235,283,472
0
1
null
2020-01-21T07:47:53
2020-01-21T07:47:52
null
UTF-8
Java
false
false
808
java
package com.geektech.quizapp_gt_4_2.data.history; import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Insert; import androidx.room.OnConflictStrategy; import androidx.room.Query; import com.geektech.quizapp_gt_4_2.model.Question; import com.geektech.quizapp_gt_4_2.model.QuizResult; import java.util.List; @Dao public interface HistoryDao { @Insert(onConflict = OnConflictStrategy.REPLACE) long insert(QuizResult quizResult); @Query("DELETE FROM quiz_result WHERE id=:id") void delete(int id); @Query("SELECT * FROM quiz_result WHERE id=:id") QuizResult get(int id); @Query("SELECT * FROM QUIZ_RESULT") LiveData<List<QuizResult>> getAll(); @Query("DELETE FROM QUIZ_RESULT") void deleteAll(); }
[ "madinah312" ]
madinah312
e557caef4e91ea199ac0403454febf7e305b1022
ab9b39f0025901720e1993f9f91a312dc3b90554
/src/main/java/per/cjh/example/controller/TeacherController.java
bf6a7b539bc81b1e3b513b1f06cdc383b7d5870f
[]
no_license
chenJiongH/Teaching-management-system
6f3417d38c802036cf73bb4bb2e93ec7d0115ef6
530d4f3f8baac928d5ad02b5153a82eaf77313b3
refs/heads/master
2023-01-10T14:38:42.142874
2020-11-13T07:05:45
2020-11-13T07:05:45
289,586,918
3
0
null
null
null
null
UTF-8
Java
false
false
4,211
java
package per.cjh.example.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import per.cjh.example.domain.ExSC; import per.cjh.example.domain.ExTC; import per.cjh.example.service.TeacherService; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpSession; import java.util.List; /** * @author cjh * @description: 和教师相关的操作 * get -教师展示、post -教师添加、put -教师更新、delete -教师删除 * @date 2020/5/4 20:47 */ @Api(tags = "教师信息管理的相关 API") @RestController @RequestMapping("/teacher") @Slf4j public class TeacherController { @Autowired private TeacherService teacherService; @ApiOperation("页码查询教师课程列表") @ApiImplicitParams({ @ApiImplicitParam(name = "curpage", value = "页码") }) @GetMapping() public List<ExTC> teaGet(Integer curpage) { try { return teacherService.get(curpage); } catch (Throwable e) { e.printStackTrace(); return null; } } @ApiOperation("教师修改个人信息一刷新,获取个人信息") @GetMapping("/self") public ExTC stuSelf(@ApiIgnore HttpSession session) { try { String phone = (String) session.getAttribute("username"); log.info("教师:" + phone + " 正在修改个人信息"); return teacherService.teacherSelfGet(phone); } catch (Throwable throwable) { throwable.printStackTrace(); return null; } } @ApiOperation("新增教师课程记录") @ApiImplicitParams({ }) @PostMapping() public String teaPost(ExTC teacherCourse) { try { log.info(teacherCourse.toString()); teacherService.insertOne(teacherCourse); return "添加成功"; } catch (Throwable e) { e.printStackTrace(); return "添加失败"; } } @ApiOperation("管理员修改教师课程记录,增加三个隐藏文本框,放置原手机号、学期名、课程名") @ApiImplicitParams({ @ApiImplicitParam(name = "oriPhone", value = "原手机号"), @ApiImplicitParam(name = "oriTerm", value = "原学期名"), @ApiImplicitParam(name = "oriCname", value = "原课程名"), }) @PutMapping() public String teaPut(ExTC teacherCourse, String oriPhone, String oriTerm, String oriCname) { try { teacherService.updateOne(oriPhone, oriTerm, oriCname, teacherCourse); return "修改成功"; } catch (Throwable e) { e.printStackTrace(); return "修改失败"; } } @ApiOperation("修改教师个人信息页面,根据原手机号修改教师密码") @ApiImplicitParams({ @ApiImplicitParam(name = "oriPhone", value = "原手机号"), @ApiImplicitParam(name = "password", value = "新密码"), }) @PutMapping("/self") public String teaSelfPut(String password, String oriPhone) { try { teacherService.update(password, oriPhone); return "修改成功"; } catch (Throwable e) { e.printStackTrace(); return "修改失败"; } } @ApiOperation("删除一条教师课程记录") @ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号"), @ApiImplicitParam(name = "term", value = "学期名"), @ApiImplicitParam(name = "cname", value = "课程名"), }) @DeleteMapping() public String teaDelete(String oriPhone, String oriTerm, String oriCname) { try { teacherService.deleteOne(oriPhone, oriTerm, oriCname); return "删除成功"; } catch (Throwable e) { e.printStackTrace(); return "删除失败"; } } }
[ "1094505959@qq.com" ]
1094505959@qq.com
312a4c8ef7cd58c7da8300d2956c883ce84073ac
cf729a7079373dc301d83d6b15e2451c1f105a77
/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201601/o/package-info.java
c559f3262d2224641ee91873ead87538ab1130e0
[]
no_license
cvsogor/Google-AdWords
044a5627835b92c6535f807ea1eba60c398e5c38
fe7bfa2ff3104c77757a13b93c1a22f46e98337a
refs/heads/master
2023-03-23T05:49:33.827251
2021-03-17T14:35:13
2021-03-17T14:35:13
348,719,387
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
@javax.xml.bind.annotation.XmlSchema(namespace = "https://adwords.google.com/api/adwords/o/v201601", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.google.api.ads.adwords.jaxws.v201601.o;
[ "vacuum13@gmail.com" ]
vacuum13@gmail.com
bae499a165cc1c78b585a201e457cc18304ea7ac
e5932dab5f07e8a84c1a2905ce7c145f6c2499cf
/fundamentos/src/main/java/br/furb/devnapratica/fundamentos/FundamentosApplication.java
d4ef707171e4f346eb3f51563a760113e5ff529e
[]
no_license
SeniorSA/furb
c5224f10c13a84bcb4bdb02a07458b4480ac50ae
4c0b1c40ff7ac103a8c9e0170f77d0e131493049
refs/heads/master
2020-05-05T11:05:06.967385
2019-04-16T17:47:39
2019-04-16T17:47:39
179,974,265
0
1
null
null
null
null
UTF-8
Java
false
false
335
java
package br.furb.devnapratica.fundamentos; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class FundamentosApplication { public static void main(String[] args) { SpringApplication.run(FundamentosApplication.class, args); } }
[ "jclaudiocf@gmail.com" ]
jclaudiocf@gmail.com